Posts

Showing posts from May, 2013

mysqli - Validate E-Mailadress Mysql Insert -

is possible validate emailadress when insert in mysqldatabase? , insert want test if email exist in database. must test 2 things emailgroup , emailadress. this mysql insert: $sql=" load data local infile '$datei' table empfaenger fields terminated '$spaltentrennzeichen' lines terminated '\n' ignore 1 lines ($sqlstring) set emailliste = '$emailliste', status = 'aktiv' ";

clojure - Several ways to call "use"? -

what's difference between (use 'korma.db) , (:use korma.db) ? functionally seem same thing, 1 looks it's function call , other dereferencing map? why 2 ways of writing , how end doing same thing? thanks much! the (:use ...) form directive passed ns, not dereference of map. ns macro, things in ns form not evaluated in standard way. :use directive in ns form causes ns invoke (use ...). since "use" has effect on evaluations done in ns invoke it, makes sense specify in context of declaring namespace rather randomly invoking somewhere else in ones code.

java - servlet throws a NPE cant figur out why -

public class addmovieservlet extends httpservlet { private static final long serialversionuid = 1l; /** * @see httpservlet#httpservlet() */ public addmovieservlet() { super(); // todo auto-generated constructor stub } @override protected void dopost(httpservletrequest req, httpservletresponse resp) throws servletexception, ioexception { super.dopost(req, resp); process(req,resp); } @override protected void doget(httpservletrequest req, httpservletresponse resp) throws servletexception, ioexception { // todo auto-generated method stub super.doget(req, resp); process(req,resp); } //my process method protected void process(httpservletrequest req , httpservletresponse resp) { //we set requests of elements of our movie string name = req.getparameter("name"); long date = long.parselong(req.getparameter("reldate").tostring()); string lang = req.getparameter("lang"); int rating = integer

c++ - Error: No operator << matches these operands? -

i practicing c++ (trying leave java), , stumbled on annoying error saying:error: no operater << matches these operands. i've searched website clear answer , no luck, did find i'm not one. this error in .cpp file, there other errors, i'm not paying mind them right now. void namedstorm::displayoutput(namedstorm storm[]){ for(int = 0; < sizeof(storm); i++){ cout << storm[i] << "\n"; } } something "<<" im not sure whats going on. since trying cout class object need overload << std::ostream& operator<<(ostream& out, const namedstorm& namedstorm)

c# - Styling all instances of a derived type in WPF -

i have class named mywindow derives window : using system.windows; public class mywindow : window { } and use class in mainwindow.xaml : <mywpfapp:mywindow x:class="mywpfapp.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wpfapplication1="clr-namespace:wpfapplication1" title="mainwindow" height="350" width="525"> <grid> <textblock text="test" foreground="orange"/> </grid> </mywpfapp:mywindow> and in app.xaml file, add following style override background property of mywindow instances: <application.resources> <style targettype="mywpfapp:mywindow"> <setter property="background" value="black"></setter> </style> </application.resources> but

c# - Text draws out of CellBounds during CellPainting -

Image
i'm overriding cellpainting event datagridview in addin vsts2010. have 2 lines of data , want first line black , second line grey. works fine, sometimes, , no reason can tell, cell contents painted 50 pixels left , 5 pixels should be. example: the hightlighted filename executionhints.cs can see "nhints.cs" this happens in 1 vsts session of 3, or @ point during afternoon 1 session. there appears no pattern when happens. i've tried using e.cellbounds.x , hardcoding "2" x position drawstring still happens. i've attached debugger when happens , values correct, i.e. value == "executionhints.cs", e.cellbounds.x == 1, e.clipbounds.x == 0. any ideas? suggestions try? code: private void grdfiles_cellpainting(object sender, datagridviewcellpaintingeventargs e) { if (grdfiles.columns[e.columnindex].name != clmdisplay.name || e.rowindex < 0) return; var lines = new string[] { "", "" }; solidbrush backcolo

ruby - Checking Variables In The Constructor -

i learning ruby , know in other languages can ensure variables not empty when initializing. how in ruby example? class person attr_reader :name def initialize name @name = name end end without setting default name, , raising exception if empty string sent (not nil) argument, raise exception. class person attr_reader :name def initialize name raise "name can not empty string" if name.empty? @name = name end end then if send empty string error similar this: temp.rb:5:in `initialize': name can not empty string (runtimeerror) temp.rb:11:in `new' temp.rb:11:in `<main>' shell returned 1 as far part of "it makes them enter name until valid" mentioned in comment... should let running code this. this allowing no default, forcing user use other empty string. class personnameerror < exception end class person attr_reader :name def initialize name @name = name end end begin

php - Using Custom Zend Validator in INI file -

i don't have custom zend_form , declared elements in ini file. there no problem creating zend_form ini file, having problem using own custom validator in ini file. return not found in registry error. currently, code this. [bootstrap] $resourceloader = new zend_loader_autoloader_resource(array( 'namespace' => 'my', 'basepath' => dirname(__file__) )); $resourceloader->addresourcetype('validator', 'forms/validate/', 'form_validate'); [ini file] form.elements.new_password.options.validators.password.validator = "password" [custom validator] <?php class my_form_validate_password extends zend_validate_abstract { ...... please tell me i'm missing here. thanks! this case of on thinking: i'm going assume you're using version of zf1.x that's new (v1.10 , newer). you have file called project/application/configs/application.ini in standard applic

Math: converting coordinate system to other system -

i want convert map of 1200x1000 pixels iphone screen coordinates (480x360) can manipulation of user touches on screen. let´s got 'player' on map , @ location 1200x1000 want correspond location on iphone screen: 1200x1000 = 480x360. math functions can use complete this? instead of hard coding map , touch locations, think better if can convert relative frame. i.e. @ location 1200x1000 , map 5000x5000, convert (1200/5000)% x (1000/5000)% , multiply screen size.

ios - How to call some code if users press back button -

in uinavigationcontroller ? for example, want make sure uinavigationcontroller not animating when user press button. if aren't intending intercept button tap instead act of current view controller disappearing, can use: - (void)viewwilldisappear:(bool)animated { if (self.ismovingfromparentviewcontroller) { // handle button press } } if sure want button, can create own custom uibarbuttonitem , set current controller's leftbarbuttonitem . sure call [self.navigationcontroller popviewcontrolleranimated:yes] after have finished doing own logic.

php - Ajax request isn't working in cakephp -

i'm trying ajax request in cakephp. submit #enviar . action pages/contato . this ajax request: $(document).ready(function() { $('#enviar').click(function(){ $.ajax({ type: 'post', url:"<?php echo router::url(array('controller' => 'pages','action' => 'contato')); ?>", }) }) }); i change $.ajax simple alert() , when click submit works. problem? better change url, in ajax function :- $.ajax({ type: 'post', url:"http://localhost/teste/pages/contato" })

objective c - How come my uitextfield(s) keeps being disabled after model? -

i made app wife track inventory. has couple of view controllers enter new item, display items, search items, , display selected item. after switching through each view couple of times (no particular order) of textfields become disabled (you cannot select them change value) across of view controllers. buttons still work however. have setup when user enters info particular cell, saves memory if switch views , come back, cells data in viewdidload method. please help! *edit - using storyboard bunch of segues (i'm new programming , self taught, idk if right way or not)... here pic of storyboard http://i.imgur.com/at3pr0i.png ok, @ storyboard, think see problem. if storyboard looks spilled spaghetti on it, it's not designed correctly. specifically, looks you're going "backwards" (to controllers you've been to) using segues -- that's not good. segues instantiate new controllers! so, if go around in circle few times, you're adding more , mor

osx - Applescript: hiding manipulation of gui when running a gui applescript -

i'm working on applescript clicks menu items in application menu bar. i'd run script without displaying whole process of clicking target menu item. example, here's code below click disable hour menu item in menu bar f.lux application ignoring application responses tell application "system events" tell process "flux" click menu bar item 1 of menu bar 2 end tell end ignoring shell script "killall system\\ events" delay 0.1 tell application "system events" tell process "flux" tell menu bar item 1 of menu bar 2 click menu item "disable hour" of menu 1 end tell end tell how go preventing display of gui manipulation when running script? you cannot this. applescript gui scripting work ui elements must front , key human.

iterator - Ruby, error with brackets for code block -

so trying understand code blocks , iterators simple exercise, , ran issue using brackets don't understand. i have 'my_times' method class integer def my_times c = 0 until c == self yield(c) # passes 'c' code block c += 1 end self # return self end end 5.my_times {|i| puts "i'm on iteration #{i}"} which works fine, have 'my_each2' operates should class array def my_each2 size.my_times |i| # <-- signifies code block correct? 'end' unnecessary? yield self[i] end self end end array.my_each2 {|e| puts "my2 block got handed #{e}"} from understanding 'do |i|' in "size.my_times |i|" code block (with no 'end'?) correct? if so, why error trying put in {brackets} instead of using 'do'? class array def my_each3 size.my_times {|i| puts "i'm

php - Unique filed according to admin id in yii -

i using yii framework , have 3 fields in table named table_details , fields table_number,seats , admin_id.i want enter unique table_number each admin_id.if use unique validation field table_number,then insert table_number once in table want insert table_number uniquely each admin_id. you can define own rule. i.e. public function rules() { return array( array('table_number', 'uniquetable', "on" => "insert"), ); } and define uniquetable function in model: public function uniquetable($attribute,$params) { $record=tabledetail::model()->findbyattributes(array('table_name'=>$this->table_name, "admin_id" => yii::app->user->id)); if(count($record) > 0){ $this->adderror($attribute, 'you have table name'); } }

javascript - Close Autocomplete -

cannot work out doing wrong here. want autocomplete div close if there nothing in search field or when area of site clicked, similar onblur. instead div stays present. here code: $(document).ready(function(){ $(".search").keyup(function() { var searchbox = $(this).val(); var datastring = 'searchword='+ searchbox; if(searchbox=='') { } else { $.ajax({ type: "post", url: "search.php", data: datastring, cache: false, success: function(html) { $("#display").html(html).show(); } }); }return false; }); }); "display" autocomplete div. try -- see demonstration var handler = function(event){ // hide "#display" on elsewhere click if($(event.target).not("#display *") || $(".search").val().length != 0) return; $("#display").hide(); } $(document).on("click", handler); above handler hide display div when cliked on elsewhere. if c

php - Problems wit sign me up plugin -

hi trying use sign me plugin application. unable running. there many issues , errors. plugin have downloaded is:- sign_me_up-2.0 but there many errors getting ex:- declaration of signmeupcomponent::initialize() should compatible component::initialize(controller $controller) i have tried tutorials , serached solutions online. no luck... can me out on how use plugin ??? reffered :- http://www.jotlab.com/2011/sign-me-up-a-cakephp-registration-plugin thanks in advance make sure version of cakephp compatible plugin. understand between version 1.3 , 2, took advantage of newer features of php included strongly-typed method parameters. error you're receiving signmeupcomponent inherits component class in framework core. if component wants override initialize method, must follow same method/function signature. if plugin on git , feel comfortable in doing so, clone , update components methods, , put in pull request you're changes can merged in. alternat

c preprocessor - What's the meaning of ## in the define code in C++ -

this question has answer here: how concatenate twice c preprocessor , expand macro in “arg ## _ ## macro”? 2 answers #define declare_delete_ptr(type) \ void deleteptr_##type(string &operand) \ {\ }\ what's meaning of ## in macro definition in c++? what's difference followed code? #define make_strings(var) #var it 1 #, former 2 # it concatenates value pass through parameter type ... declare_delete_ptr(gremlin) would expand to: void deleteptr_gremlin(string &operand) { }

html - Tables in IE7 displaying inline -

i have 2 tables in ie7 inside div. div has width property set 500px. tables inside div , have (each) width property set 450px. when page rendered in ie7, second table displays next first table (same line) though parent div has width of 500px, not being respected. this displays ok in other browsers. how can tell ie7 display second table below first one? use <!--[if ie 7]> <link rel="stylesheet" type="text/css" href="ie7.css"> <![endif]--> create small hack in css targeting ie7. for reference ie css

CSS3 Column-span Spacing Issue -

i'm trying set simple 2 column layout using css3's columns when try , span image across both columns, i'm getting weird spacing issues. if @ this stupidly specific jsfiddle , you'll see each time have 1 of "feature" images spans both columns, large gap above image on both columns @ viewport widths (not counting assumed blank space left varied heights of images). i'm using basic of css3 here (prefixes not shown): section { column-count: 2; column-gap: 10px; } .feature { column-span: all; } any ideas?

jquery ui - Require.js: Is it possible to wait multiple objects? -

let say, want load jquery.ui require.js what object should set waiting in shim? jquery.ui? no, not true. in case run after first line evaluated - $.ui = $.ui || {}; , no wigets loaded. what next. have tried wait $.widget . yes, better, because of $.widget() base func loading ui part. but, $.ui.autocomplete still undefined. hm. what wait next? some of code require $.widget, have wait predefined widgets. is possible force require.js wait multiple objects , run different callbacks or way? edit: or pass multiple values modules depends? edit2: shim config : shim: { 'moment_ru': { deps: ['moment'], init: function () { moment.lang('ru'); } }, 'knockout': { exports: 'ko' }, 'knockout_mapping': { deps: ['knockout'], exports: 'ko.mapping' }, 'jquery_ui': { deps: ['jquery&

profiling - Cuda Performance measuring - Elapsed time returns zero -

i wrote few kernel function , wonder how many miliseconds process these functions. using namespace std; #include <iostream> #include <stdio.h> #include <stdlib.h> #define n 8000 void fillarray(int *data, int count) { (int = 0; < count; i++) data[i] = rand() % 100; } __global__ void add(int* a, int *b) { int add = 0; int tid = threadidx.x + blockidx.x * blockdim.x; if (tid < n) { add = a[tid] + b[tid]; } } __global__ void subtract(int* a, int *b) { int subtract = 0; int tid = threadidx.x + blockidx.x * blockdim.x; if (tid < n) { subtract = a[tid] - b[tid]; } } __global__ void multiply(int* a, int *b) { int multiply = 0; int tid = threadidx.x + blockidx.x * blockdim.x; if (tid < n) { multiply = a[tid] * b[tid]; } } __global__ void divide(int* a, int *b) { int divide = 0; int tid = threadidx.x + blockidx.x * blockdim.x; if (tid < n) { divi

java - Check if printer is shutdown or not using PrinterStateReason -

how check printer shutdown or not using class printerstatereason ? i new in java, want check if default printer connected system on or off. gone through doc , not getting how should implement it. is there example?

c# - Adding DLL into 'Class Library Project': Mismatch between the processor architecture warning -

i trying convert c# code (program.cs) dll. c# code uses dll, dll of dreamcheeky thunder missile launcher . can software here (just 1 mb) , installation got dll. i created class library project under visual studio 2010 professional c# category , added dll. as added it, got following warning warning 1 there mismatch between processor architecture of project being built "msil" , processor architecture of reference "usblib", "x86". mismatch may cause runtime failures. please consider changing targeted processor architecture of project through configuration manager align processor architectures between project , references, or take dependency on references processor architecture matches targeted processor architecture of project. missilelauncher i not familiar windows specific programming, mind letting me know why getting , solution? a simple google search finds this: how fix visual studio compile error, "mis

by what tool making this ios class UML graph? -

Image
1 2 3 title,by software making cool graph? way, under mac ---edit http://www.macresearch.org/files/images/expressionclassdiagram.png this data model created coredata within xcode.

java - Best approach to implement an accurate recorded stream execution -

i have stream of events recorded (for example arraylist<inputevent> sorted inputevent.getwhen() ). differences in time between consecutive events can of order of tens of milliseconds. my goal execute ("replay") recorded stream accurate possible, is, execute first event inputevent firstevent @ long starttime = system.currenttimemillis() , second @ starttime + (secondevent.getwhen() - firstevent.getwhen()) , , on. of course, accurate way be: execute(arraylist<inputevent> stream) { long starttime = system.currenttimemillis(); long firsttime = stream.get(0).getwhen(); (inputevent e : stream) { while system.currenttimemillis() < starttime + e.getwhen() - firsttime) { } executeevent(e); } } which terribly cpu consuming approach, on other hand: execute(arraylist<inputevent> stream) { long lastwhen = strem.get(0).getwhen(); (inputevent e : stream) { try { thread.sleep(e.

github - Git password issue? -

i'm committing git repo using command line, upon entering username , password, tells me authentication failed. i 100% i'm typing details correctly , my repo i'm committing to. i have no idea going wrong, symbol have in either username or password @ . any help? https://git.wiki.kernel.org/index.php/gitfaq#my_username_contains_a_.27.40.27.2c_i_can.27t_clone_through_http.2fhttps solution : url-escape '@' sign in username, i.e. replace %40, git clone https://user%40mail.com@gitserver.com/path/.

Override the positional and optional arguments with another argument in command line (argparse python module) -

i using argparser parse command line arguments. now, have ./script.py 1112323 0 --salary 100000 -- age 34 here first 2 positional arguments , rest optional. now, want have feature such when user gives filename input in command line, should override these above arguments , take arguments header of file. meam when user gives sth id|sequence|age|name|........... (header of file first 2 cols positional arguments , rest positional) on giving in command line: ./script.py -f filename it should not complain of above positional arguments. is feasible on current implementation? you need implement check yourself. make both arguments (positional , -f) optional (required=false , nargs="*") , implement custom check , use error method of argumentparser. make easier user mention correct usage in string. something this: parser = argumentparser() parser.add_argument("positional", nargs="*", help="if don't provide positional arg

python - ValueError: invalid literal for int() with base 10: -

here updated codes traceback class base(models.model): created_by = models.foreignkey(user,default=user.pk, related_name="(app_label)s_%(class)s_creator") created_by = models.foreignkey(user,default=user.pk, related_name="(app_label)s_%(class)s_editor") created_at = models.datetimefield(auto_now_add=true) modified_at = models.datetimefield(auto_now_add=true) class meta: abstract = true class department(base): dept_id = models.autofield(primary_key=true) name = models.charfield(max_length=60, unique=true) description = models.textfield() def __unicode__(self): return str(self.name) --------------------------------------------------------------------------- valueerror traceback (most recent call last) c:\python27\lib\site-packages\django-1.5-py2.7.egg\django\core\management\commands\shell.pyc in <module>() ----> 1 test = department.objects.create(name='test',description='test') c:\python27\lib\site-packages\djan

sqlite - The best way to store big number of files with adding quick search -

in windows 8/rt app use sqlite database ( sqlite-net ) witch store in isolated storage. in database have lot of data, including files(images, pdf's , other) links. links web server. when got link, want download file , store locally. question is: best way store big number of files (100+)? 1 important think: i need organize find desired file . i have 3 ideas: create database files (i can't modify existing) create folder in , store here directly. create list of files , store in is. which better/faster? or have great solution? 100 files isn't such big number can store 100k files (or folders) in single (ntfs) directory. if receive files webserver question whether source makes sure there no duplicate filenames. if can't assured, i'd recommend having database table mapping original filename , metadata hash (sha256 or similar) , store file filename corresponding hash. then, when using file, can pass pass user using original filename using storag

ruby on rails 3 - july 2013 breaking changes - object create action -

i have facebook app single custom action ( earn ) , single custom object ( badge ). create these objects user server via post to 'https://graph.facebook.com/' + fb_user_id + '/itsbeta:earn' and send parameters access_token => user_access_token, badge => badge.fb_url where badge.fb_url contains og-tags. works fine @ moment. but when enable july 2013 migration, start getting errors a post action object exists., code :1611231 seems case of deprecated feature "duplicate creation actions same open graph object", in settings of badge object on advanced tab don't have field called "create action", instead have "subscribe action", single action name there: subscribe action: earn what's wrong?

c++ - C++11: std::vector::shrink_to_fit complexity -

the article @ cppreference.com tells complexity of std::vector::shrink_to_fit constant. far know possible if elements not moved, because if complexity n . says all iterators, including past end iterator, potentially invalidated. means moving of elements defined possibility. is article faulty? ... or there magic don't know about? the article is faulty, fixed it. while official standard doesn't complexity of std::vector::shrink_to_fit , in n3376 changed wording, thereby fixing dr 2033: 23.3.6.3: void shrink_to_fit(); requires : t shall moveinsertable *this . complexity : linear in size of sequence.

i want to calculate the variance of image in opencv..here is the code...its giving error while executing..please suggest solution -

this code not give correct output of variance of image.please tell how correct give right value of variance the code in opencv.please suggest method calculate variance of pixels in image for(i=1;i<h-1;i++) { for(j=1;j<w-1;j++) { sum=0; for(a=-1;a<=1;a++) { for(b=-1;b<=1;b++) { sum=sum+inputimage(i+a,j+b); } //calculate mean mean(i,j)=sum/imagesize*imagesize } } } for(i=1;i<h-1;i++) { for(j=1;j<w-1;j++) { sum=0; for(a=-1;a<=1;a++) { for(b=-1;b<=1;b++) { sum=((inputimage(i+a,j+b)-meanimg(i,j))^2); } } //calculate variance var=sum/((windowsize*windowsize)-1); } }

multidimensional array - dynamic memory allocation ,error expression must have a constant value -

i have error saying expression must have constant value 1 please me out #include void transpose_vec() { std::vector<int> temp(size_b_row1); using namespace std; std::vector<double> matrix(size_b_row1); std::vector<double> matrix_t(size_b_row1); int i; for(i=0;i<size_b_row1;i++) { matrix_t[1][i] = matrix[i]; } }

java - ReentrantLock -> lockInterruptibly() won't check interrupt state sometimes? -

recently i've been refactoring project "reentrantlock" simplify logic. general idea is: 1. "main" runnable thread running on own 2. if in order, main thread wait on condition "nextstep" 3. when wrong happened, method "oncancel()" invoked by/in thread, forcing main thread throw interruptionexcpetion, shutdown occur after tests, turned out own method: dointerrupt(); never worked expected: forcing main thread enter "interruptedexception" clause , quit loop. update-2: i've added "is-interrupted" debug message output log lines, if turns out interrupt state "mysteriously" cleared one... update: lock , condition methods: lock.lockinterruptibly(); condition.await(); seemed not checking interrupt state sometimes? .... javadoc reads: ...... if current thread: has interrupted status set on entry method; or interrupted while acquiring lock, interruptedexce

asp.net mvc 3 - Mvc maproute multiple page levels -

is there anyway can reduce amount of duplication maproute registration in global.ascx file mulit page levels below. routes.maproute("article-level1", "{sluglevel1}/article/{id}/{article-title}", new { controller = "article", action = "detail", id = urlparameter.optional }); routes.maproute("article-level2", "{sluglevel1}/{sluglevel2}/article/{id}/{article-title}", new { controller = "article", action = "detail", id = urlparameter.optional }); routes.maproute("article-level3", "{sluglevel1}/{sluglevel2}/{sluglevel3}/article/{id}/{article-title}", new { controller = "article", action = "detail", id = urlparameter.optional }); ... more levels 4 10 ... please let me know if there better way do. you can explore "catch-all" route parameters: han

Pass parameter between pages using jquery mobile -

what right way pass parameters between pages in jquery mobile. in q&a of jquery mobile, there suggestion plugin. mandatory? please let me know correct way. there no 1 concrete answer. have pass parameters links in page. http://view.jquerymobile.com/master/demos/faq/pass-query-params-to-page.php data/parameters manipulation between page transitions it possible send parameter/s 1 page during page transition. can done in few ways. reference: https://stackoverflow.com/a/13932240/1848600 solution 1: you can pass values changepage: $.mobile.changepage('page2.html', { dataurl : "page2.html?paremeter=123", data : { 'paremeter' : '123' }, reloadpage : true, changehash : true }); and read them this: $(document).on('pagebeforeshow', "#index", function (event, data) { var parameters = $(this).data("url").split("?")[1];; parameter = parameters.replace("parameter=",""

How to remove row and sections from UITableView Sections based on NSDictionary Data Modal? -

code mentioned below deleting particular row - (void)tableview:(uitableview *)tableview commiteditingstyle: (uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath { if (editingstyle == uitableviewcelleditingstyledelete) { // delete row data source // need remove nsdictionary *contact = [[self.sections valueforkey:[[[self.sections allkeys] sortedarrayusingselector:@selector(localizedcaseinsensitivecompare:)] objectatindex:indexpath.section]] objectatindex:indexpath.row]; nslog(@"contact %@",contact); [self.sections removeobjectforkey:contact]; nslog(@"%@",self.sections); [tableview deleterowsatindexpaths:[nsarray arraywithobject:indexpath] withrowanimation:uitableviewrowanimationfade]; // crashing @ above line of code , shows error message see @ bottom of post } } from above code able load uitableview correctly app crashes when trying delete commiteditingstyle: method ? error messag

classification - How to classify chat text when there is no Training data? -

i have use case in chat text classified. want use documentcategorizer in apache opennlp categorize chat. must have training data should have chats classified. have manually categorize hundreds of chats prepare training , test data? else can do? intend chat categories service related problems. list of categories domain specific. should provider of data, provide me categorized chat data? thanks, in advance. by definition, cannot have classification problem without labelled data. either labels (at least part of) data, or should try address problem in different way. -- edited add examples of how address problem without classifying: in general, depending on specific task can try solve "classification" problem via clustering or/and document or term matching. clustering group documents related same topic, while term matching observe documents refer specific terms. if no training data available, have knowledge problem, either method, or combination between them mi

mysql - PHP and MySQLi check if in transaction -

is there way if i'm inside of transaction? example: if mysqli::autocommit 'on' or 'off'? need because project using memcache, should updated once transaction success. wanna assert user not invoking update cache method in process of transaction. thanks in advance! there isn't foolproof way find out if transaction has been started because, if use mysqli::autocommit start one, issue sql start transaction. see answers here: how detect transaction has been started?

eclipse - MAP VIEW IN ANDROID - JUST SHOWING TILES. LIVE MAP VIEW IS NOT THERE -

i tried getting location on map following code not getting live map view..... tiles grids etc...map view not visible.. please see code , help. androidgpstrackingactivity.java package com.androidhive.dashboard; import java.util.list; import com.google.android.maps.geopoint; import com.google.android.maps.mapactivity; import com.google.android.maps.mapcontroller; import com.google.android.maps.mapview; import com.google.android.maps.overlay; import com.google.android.maps.overlayitem; import android.app.activity; import android.content.intent; import android.graphics.drawable.drawable; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.toast; import androidhive.dashboard.r; public class androidgpstrackingactivity extends mapactivity { button btnshowlocation; mapview mapview; list<overlay> mapoverlays; additemizedoverlay itemizedoverlay; geopoint geopoint; // map controllers mapcontroller mc; double latitude; doubl

iphone - didSelectRowAtIndexPath does not push new view controller and also no error -

i have newb question. have table view controller that's working fine @ first glance. prints rows nsmutabledictionary. when click on row, fires function expected without crashing or giving system errors: - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { uistoryboard *storyboard = [uistoryboard storyboardwithname:@"mainstoryboard" bundle:[nsbundle mainbundle]]; scinventoryleaf *childview = [storyboard instantiateviewcontrollerwithidentifier:@"inventoryleaf"]; nsarray *keys = [arrinventory allkeys]; id akey = [keys objectatindex:indexpath.row]; id anobject = [arrinventory objectforkey:akey]; childview.title = akey; childview.price = [anobject objectforkey:@"price"]; [self.navigationcontroller pushviewcontroller:childview animated:yes]; } but reason, childview not presenting after onrowclick. did name identifier in storyboard. what wrong? shoudl troubleshoot next

C++ One std::vector containing template class of multiple types -

i need store multiple types of template class in single vector. eg, for: template <typename t> class templateclass{ bool somefunction(); }; i need 1 vector store of: templateclass<int> t1; templateclass<char> t2; templateclass<std::string> t3; etc as far know not possible, if how? if isn't possible explain how make following work? as work around tried use base, non template class , inherit template class it. class templateinterface{ virtual bool somefunction() = 0; }; template <typename t> class templateclass : public templateinterface{ bool somefunction(); }; i created vector store base "templateinterface" class: std::vector<templateinterface> v; templateclass<int> t; v.push_back(t); this produced following error: error: cannot allocate object of abstract type 'templateinterface' note: because following virtual functions pure within 'templateinterface' note: virtua

c - What is the reason for memsetting initialized buffer -

while traversing wikipedia following links, stumbled across the following code example initializes char buffer 0, memset s 0 before use. necessary? if so, why? reason ask no expert, , example states coder's intention comment " /* initialized zeroes */ " on memset , opposed " /* initialized zeroes */ " on initialization. edit: note, i've rolled edit on wikipedia page caused this, no longer visible in link. char buffer[5] = {0}; /* initialized zeroes */ /* declaration / statements, no access buffer object */ memset ( buffer, 0, sizeof buffer); /* initialized zeroes */ in above code, call memset totally useless. buffer guaranteed initialized 0 .

How to print the result of the query in php -

i new php, want print response of query, getting records database , calculating average , want echo average average (column). below query. can 1 me please? select avg(client_workout_length) client_workout month(client_date_of_workout)=04 , client_id=2; thanks in advance! your try although mysql deprecated , shouldn't use can use mysqli http://www.php.net/manual/en/book.mysqli.php or pdo http://php.net/manual/en/book.pdo.php <?php $query = "select avg(client_workout_length) average_workout_per_month client_workout month(client_date_of_workout)=".$month." , client_id=".$clientid." "; $result = mysql_query($query); if (!$result) { echo 'could not run query: ' . mysql_error(); exit; } $row = mysql_fetch_row($result); echo "<pre>"; print_r($row); echo "</pre>"; ?>

Maven, cyclic imports, classpath for compile -

i have task migrate legacy project ant maven , have trouble cyclic imports. problem ant builds many jars contains same classes. originally ant project have 1 src folder , contains packages there. maven compatibility me require split src folder several modules pom.xml (as says in guides , manuals). fast example. foo.java package myapp; import my.domain.myapp.bar; ... bar.java import my.domain.myapp.foo; ... src/my/domain/myapp/foo/foo.java (foo.jar) src/my/domain/myapp/bar/bar.java (bar.jar) there 2 packages placed in same parent package , no problems compilation. ant project compile java classes , generate artifacts patterns. so, compiled *.class copying jar. maven did't see same way, suppose me need split packages like: pom.xml (parent) --foo ----src/main/java/my/domain/myapp/foo/foo.java ----pom.xml --bar ----src/main/java/my/domain/myapp/bar/bar.java ----pom.xml so, in maven know set dependency jar jar. in case i've cyclic imports locks build. can't bui

Counting Answers By day mySQL -

i have table called mytable. with following fields id date_done successful ('yes', 'no', null) total_cost i know can per day count using select date_done, count(*) mytable group date_done; what want count of number of 'yes" andsers in successful day. what sql like? select date_done, sum(successful = 'yes') mytable group date_done

file - transferring huge inventory data on a daily basis -

this question more design , architecture rather programming. i'm working in small company store , process huge amount of data collecting inventory of items several companies( inventory details of company ) on daily basis. , db updated inventory details collected reflect 1 massive data form. these companies send inventory data might contain different values( such current stock, weekly stock, new stocks arrived today, increase in price per tons ). , each company differ in values , inventory items. in file format/any format send data? , i'm sure updated same table, irrespective of data.(at end, ll 1 huge massive data process, say, search entire inventory) in case, sending data in flat file, being processed in server side update table? or there easier tools/techniques send inventory data transported, i'm unaware of.

app-inventor need help running multiple timers -

i trying run 40 or more countdown timers in single app game play. i have managed 1 timer block run if run 2 or more, timers interfere each other? know timers not accurate millisecond not issue. i don't have experience @ sorry, , have not had straight forward answers yet.i have asked so, make simple possible please thank you. app inventor doesn't have capabilities yet run many timers, might make apps can handle many. timers on 1 page of game or on different levels?

php - Action on selecting option from drop down menu -

i started working drop down menus. trying figure out how make happen once user chooses particular option drop down menu. for example, have following simple drop down menu. <select> <option value = ''> choose manager </option> <option value = 'saf'> sir alex ferguson </option> <option value = 'jose'> jose mourinho </option> </select> followed following text box. <input type='text' name = 'club' /> on choosing sir alex drop down menu, want text box called club display mufc. jose, want text box called club display real madrid. what simplest way this? more importantly, not want reload page! <script> function updatetext(){ $('input[name="club"]').val($('select[name="something"] option:selected').val()); } </script> <select name="something" onchange="updatetext()"> <option valu

ruby on rails - Image resizing + hosting (language independent) -

for several of applications (mvc3 / ror / php) looking library (framework or service) resize images on fly + host different sizes on cdn / cache somewhere not use own bandwidth. bonus : should work on mobile generate thumbnails + store them on cache somewhere (s3 or rackspace, whatever). thank in advance replies. cheers my company launched service : cloudimage.io, few others exists too: http://cloudimage.io http://cloudinary.com http://imageresizing.net http://imgix.com for cloudimage.io, if have image such http://mywebsite.com/photo.jpg , can resize @ 400px mobile : http://cloudimage.io/t/resize/400/mywebsite.com/photo.jpg . then mobile download images directly in right size. on mobile application, if app used worldwide, having images stored on worldwide cdn better user experience. you'll find lot of examples on above websites.

list - How to add listener on ArrayList in java -

i want create own implementation of arraylist in java, can listen when list changing , action when happens. have read, understand can't extend arraylist , add listener. i want use mylist in class variable public modifier, users can change directly , done action when changes it. class mylist extends arraylist<object>.... { ... } class useofmylist { public mylist places = new mylist<object>(); places.add("buenos aires"); //and able list cities = new arraylist<object>(); cities.add("belmopan"); places = cities; so how create , when add,remove or pass list mylist action performed? you're not going able extending arraylist , has no built-in notification mechanism (and, further, because has been declared final , cannot extended). however, can achieve desired result creating own list implementation , adding "listener" functionality vis vis add() , remove() methods: class mylist<t>{ private ar

rounding - Loss of significance php round -

this question has answer here: php - floating number precision 9 answers i have following code $suma += round(1*43067.8000,2); $suma += round(-1*18875.1800,2); $suma += round(-1*15293.9700,2); $suma += round(-1*8898.6500,2); print $suma; the output 3.6379788070917e-12 why answer not 0 if number rounded before addition? round still returns float. because float there might small errors. in case, causes answer differ 0.

java trouble making a correct interface -

i want make class can interact database, has following desired functionality: it has method return fields database, later can changed such can limit returns. it has method insert specific instance of class. it has method update specific instance of class. show code in moment after further explanation. now want extract interface, or rather abstract class think might more appriopiate, sure classes/datafields follow same 'interface', , able use them supertype in lists etc. the data class, in case account.java, should represent table in database stores {username, password}, omitting explicite unique identifier now, still not sure if make additional id field or use uniqueness of username field. it best if abstract class handle mysql interaction 'mess'. account.java far: package testthing; import java.util.map; /** * * @author frank */ public class account { private final static string all_query = "select * accounts"; private final s

ruby on rails 3 - Convert an alphanumeric string to integer format -

i need store alphanumeric string in integer column on 1 of models. i have tried: @result.each |i| hex_id = [] i["id"].split(//).each{|c| hex_id.push(c.hex)} hex_id = hex_id.join ... model.create(:origin_id => hex_id) ... end when run in console using puts hex_id in place of create line, returns correct values, above code results in origin_id being set "2147483647" every instance. example string input "t6gnk3pp86gg4sboh5oin5vr40" doesn't make sense me. can tell me going wrong here or suggest better way store string aforementioned example unique integer? thanks. answering request form op it seems hex_id.join operation not concatenate strings in case instead sums or performs binary complement of hex values. issue hex_id array of hex-es rather string, or char array. nevertheless, seems happen reaching maximum positive value integer type 2147483647 . still, unable find documented effects on array.join applied on h

c# - Relationship between MSVC and .NET framework versions -

this rather general question, result of confusion how compile gdal using different versions of microsoft visual c++ (msvc) , c#-bindings. understand msvc compiler , there different versions (msvc 2003, 2005, 2008, 2010, 2012). understand c# tied .net framework, software development framework comes in different versions (.net 1.0 5.0). i want compile gdal (because want use extension not included in sdk builds available here ) used c# (via c#-bindings) using vs 2012, version of msvc have use? guess answer msvc 2012 (same .net framework version), why actually? gdal build create dlls. .net framework not backwards compatible in sense can use dlls compiled older version of msvc inside c#-project uses vs 2012? any enlightenment appreciated. the relationship largely irrelevant unless you're toying c++/cli (which doesn't are). c# uses native dlls either using p/invoke (aka dllimport ) or through com, doesn't matter compiler made long exports in right format (and t