Posts

Showing posts from August, 2011

javascript - In firefox, when right-click on a textfield, how to get the start position? -

javascript - In firefox, when right-click on a textfield, how to get the start position? - my requirement need know value selected in text field when right-click on specific value portion. e.g. suppose current value in text field "a@a.com, b@b.com, c@c.com", when move mouse on "b@b.com" , right click, programme should know have chosen email address. i implemented left-click (by checking event.selectionstart), in firefox, right-click not move edit cursor clicked position, wherever right click at, event.selectionstart keeps same value. any idea? thanks... ok. in firefox, event.rangeoffset can used. javascript html firefox dom

mysql - mysqldump error: Got packet bigger than max_allowed_packet' -

mysql - mysqldump error: Got packet bigger than max_allowed_packet' - my application download mails on imap , stores them in mysql database. before supporting mails size upto 10 mb , hence 'mediumtext' column store mail service content enough. need back upwards mails upto 30mb. changed datatype column 'largetext'. yesterday mail service size 25 mb stored. after whenever execute mysqldump command throws error: mysqldump: error 2020: got packet bigger 'max_allowed_packet' bytes when dumping table `ib_mailbox_backup` @ row: 3369 row 3369 contains 25 mb mail. in mysql config increased 'max_allowed_packet' 64m 512m , still fails same error. executing mysqldump command on same machine mysql server running. how solve this? you can add together --max_allowed_packet=512m mysqldump command. or add together max_allowed_packet=512m [mysqldump] section of my.cnf (thanks @varun) mysql mysqldump

iphone - Integrating FBConnect -

iphone - Integrating FBConnect - i integrating facebook api i.e, fbconnect post message on wall,i have integrated fbconnect api in it, getting fb login screen m not getting post wall dialog after. can tel whats problem? how can solve issue. thanks. you can post msg on wall using these lines fbstreamdialog* dialog = [[[fbstreamdialog alloc] init] autorelease]; dialog.usermessageprompt = @"enter message:"; [dialog show]; if want post image utilize dialog.attachment , hyperlink can utilize dialog.actionlinks. iphone objective-c facebook

c++ - Unhandled Exception while using cvCreateSeq -

c++ - Unhandled Exception while using cvCreateSeq - i using cvcreateseq function create sequence in opencv,while debugging exception occurs 'unhandled exception @ 0x7c812afb'.i coding in c , ide visual c++ 2010 express edition. can tell me why exception ocurring. thanks, the code is:- void main() { char * file = "d:\\testimage.jpg"; temp(file); } void computecococlust(char * filepath) { cvmemstorage * storagecontour = null; cvseq * first_contour = null; iplimage * ioriginal = null; /*load image*/ ioriginal = cvloadimage(filepath,cv_load_image_unchanged); /*load grayscale image*/ iplimage * igray = cvloadimage(filepath,cv_load_image_grayscale); /*show original image in window named 'original image'*/ fnshowimageinwindow("original image",ioriginal); /*show graylevel image in window named 'graylevel image'*/ fnshowimageinwindow("graylevel image",igray); fnreleasingmemoryofwindow("graylevel image",igray); ...

ios - modal view controller not calling presenting view controller's dismissModalViewControllerAnimated: method -

ios - modal view controller not calling presenting view controller's dismissModalViewControllerAnimated: method - in modal view controller have button handling method includes [self dismissmodalviewcontrolleranimated: yes]; in presenting view controller override dismissmodalviewcontrolleranimated: follows: -(void) dismissmodalviewcontrolleranimated: (bool)animated { nslog(@"dismiss"); [super dismissmodalviewcontrolleranimated: animated]; } when button touched, button handling method gets called, dismissmodalviewcontrolleranimated: override not seem called: nslog(@"dismiss"); statement isn't called, , breakpoint within method doesn't hit. i tried [[self presentingviewcontroller] dismissmodalviewcontrolleranimated: yes]; but didn't work either. however, modal view controller dismissed. any thought might going wrong? this handled declaring presenting view controller delegate modal view controller. modal vc called...

c# - EF Code First exception / configuration -

c# - EF Code First exception / configuration - this first time using code first, please bear me: i have next entities: class company { guid id string name virtual list<employee> employees } class employee { guid id string name guid companyid virtual company company } and next configuration employee: hasrequired(e => e.company) .withmany(i => i.employees) .hasforeignkey(r => r.companyid) .willcascadeondelete(false); i can create company list of employees. however, when seek update company , create eomployees 'null' or empty list next exception: multiplicity constraint violated. role 'employee_company_target' of relationship 'employee_company' has multiplicity 1 or 0..1. edit: answers questions in comments: there nil trying accomplish in particular. wanted test if delete employees related company or ignore it. should either of those, right? employeeid not foreign key, ...

.net - C# and SerialPort Class truncating data -

.net - C# and SerialPort Class truncating data - i have c# application uses .net serialport class. code utilize pick info serial port nil special. key parts are //open port comport.baudrate = myport.baudrate; comport.stopbits = stopbits.one; comport.databits = 8; comport.parity = parity.none; comport.readtimeout = 20000; comport.portname = myport.portsystemname; comport.handshake = handshake.none; comport.rtsenable = true; comport.datareceived += new serialdatareceivedeventhandler(port_datareceived); comport.datareceived += new serialdatareceivedeventhandler(port_datareceived); private void port_datareceived(object sender, serialdatareceivedeventargs e) { string msg = ""; seek { msg = comport.readexisting(); if (comport.isopen) comport.close(); ...

multithreading - Improving Task code to achieve async await in c# 4.5 -

multithreading - Improving Task code to achieve async await in c# 4.5 - this simple code,i creating task , assign thread waits task completed , modify ui. string txt = txthellomessage.text; hellotask = task<string>.factory.startnew( () => { string msg = client.sayhello(txt); homecoming msg; } ); new thread( () => { while (true)// waiting completion, think wrong { if (hellotask.iscompleted) { this.dispatcher.invoke((action)delegate() { txthellomessage.text = hellotask.result; }); break; } } } ).start(); is practice? there improve way accomplish ? i using c#4.5 no, it's not practice. you're using heavy , expensive thread handle outcome of lightweight (cheap) ta...

c - whats the use of function pointers? -

c - whats the use of function pointers? - possible duplicate: what point of function pointers? i trying understand in practical scenarios function pointers used. , can please give me practical illustration have pass function argument function. function pointers can useful when want create callback mechanism, , need pass address of function function. they can useful when want store array of functions, phone call dynamically example. c

android sqlite can't find table "No Such Table" -

android sqlite can't find table "No Such Table" - it's headache coz people having trouble.. tried many thing , tired. give code , pray :( if can solve really thanks!! startactivity : this.dhn = datahelper.getdatahelper(this); file directory = new file(environment.getdatadirectory() + file.separator + "data" + file.separator + "ko.tb" + file.separator + "databases"); if(directory.exists()) { } else { directory.mkdirs(); updatedb(); } directory = null; seek { guid = this.dhn.guid(); if(this.dhn.getsettings("dbversion") == null || integer.parseint(this.dhn.getsettings("dbversion")) != version || !this.dhn.istableexists("userinfo")) { updatedb(); } } grab (sqliteexception e) { updatedb(); guid = this.dhn.guid(); } public void updatedb() { this.dhn....

javascript - jquery mobile static footer without toggle -

javascript - jquery mobile static footer without toggle - i have page fixed footer <div data-role="page" id="next_collection" data-theme="d"> <div data-role="header" data-theme="elw"> title </div> <div data-role="content" style="min-height: 246px;"> content </div> <div data-role="footer" data-id="footer_nav" data-position="fixed"> <a href="#business_hours"><img src="images/icon.png" /></a> </div> </div> this works on android , ipod, on iphone 4s toggles (hide/show) footer if touch screen. tried prepare in old question not work anymore. $.mobile.fixedtoolbars.settouchtoggleenabled() get: $.mobile.fixedtoolbars undefined how stop footer toggle in newer versions? as @commadelimited says, toggle has been new feature not available in p...

jquery - Updating part of the title tag, but not all of it, or at least a good work around? -

jquery - Updating part of the title tag, but not all of it, or at least a good work around? - i want have number of notifications in title part of (like facebook does), haven't been able come way of doing this. did few years ago, way did wasn't good, mess , remove wrong parts of sometime. i'm trying come easiest way this. and value of title dynamic, can't have manually 1 way. so like: (8) mysite - home page then when changes go like: mysite - home page or mysite - userid102 what had done before this: var got_title = $('title').html(); var find_notifications = got_title.match(/\([0-9]\)\s/); ///look (1-9) if(find_notifications) { var default_title = got_title.split(' ')[1]; } if(!find_notifications) { var default_title = got_title; } $('title').html(update_notification+default_title); however it's unreliable, worked fine, maintain adding notifications, like: mysite -...

objective c - NSOutlineView: how to tick all selected checkbox with a click? -

objective c - NSOutlineView: how to tick all selected checkbox with a click? - when select multiple rows in nsoutlineview click on checkbox of 1 row , having selected checkboxes. now, if click on 1 checkbox clicked row row remains selected , such checkbox ticked. you'd have write handler checkbox action, enumerated selected rows in nsoutlineview, using selectedrowindexes, utilize indexes in loop locate , setchecked checkboxes. http://developer.apple.com/library/mac/ipad/#documentation/cocoa/reference/applicationkit/classes/nstableview_class/reference/reference.html#//apple_ref/occ/cl/nstableview objective-c cocoa

Visual Studio C++ 2010 Link Error -

Visual Studio C++ 2010 Link Error - i'm getting several error lnk2019: unresolved external symbol errors, they're not due dll s, lib s, or oo errors in every other stackoverflow post link error. code: https://github.com/mcandre/fgdump/tree/master/cachedump trace: 1>------ build started: project: cachedump, configuration: release win32 ------ 1>link : warning lnk4075: ignoring '/incremental' due '/opt:icf' specification 1>cachedump.obj : error lnk2019: unresolved external symbol "void __cdecl rc4_crypt(struct rc4_state *,unsigned char *,int)" (?rc4_crypt@@yaxpaurc4_state@@paeh@z) referenced in function "unsigned long __cdecl dumpcache(void)" (?dumpcache@@yakxz) 1>cachedump.obj : error lnk2019: unresolved external symbol "void __cdecl rc4_setup(struct rc4_state *,unsigned char *,int)" (?rc4_setup@@yaxpaurc4_state@@paeh@z) referenced in function "unsigned long __cdecl dumpcache(void)" (?dumpcache@@y...

java - pseudo code to find the numbers which appear more than once in a list -

java - pseudo code to find the numbers which appear more than once in a list - i have series 1,2,199,100,8,100,199,1001,5,9 , got write pseudo code find out numbers appear more 1 time in above list. can see 199 , 100 appear twice in list , should reply how should write pseudocode it? logic this: array x = {1,2,199,100,8,100,199,1001,5,9} array y array j for(int = 0;i< 9; i++){ if x[i] exists in y j[i] = y else y[i] = x } sort list quick sort or merge sort (n log n) single pass on list comparing current number previous o(n). if previous number equals current have duplicate. edit: array array = {1,2,199,100,8,100,199,1001,5,9} array sorted = sort(array) (int i=1; i<sorted.length; i++) int p = sorted[i-1] int c = sorted[i] if (p==c) print "duplicate" java algorithm pseudocode series

Is it possible to both read and save Visual Studio 2010 Solutions with a Linux IDE? -

Is it possible to both read and save Visual Studio 2010 Solutions with a Linux IDE? - i'm taking origin class on c++. professor gung-ho ides; not. fine , well. problem wants assignments turned in using solutions ms visual studio 2010 creates. have ubuntu @ home. now, there 2 things can already: first, can homework @ school's computer lab. or, second, since assignments simple, create .cpp , header files on text editor @ home, bring them computer lab, , create solutions there. what wondering: there way can not read solution folders (which there seem complicated methods for) store them in format visual studio likes? if there is, save me 20 - 30 minutes per class period going computer lab cost me? thanks. you can seek mono develop also maintain in mind pupil you'll qualify microsoft's dreamspark programme via can utilize visual studio 2010 @ no cost. windows 7 runs great in virtualbox under ubuntu. linux visual-studio-2010 projects-and-solu...

Wordpress images vanishing - not loading but other media is fine -

Wordpress images vanishing - not loading but other media is fine - go on, laugh @ newbie. a while back, images on www.neverenoughnotes.co.uk vanished...they weren't there. in posts edit field broken, , links no longer working. we rode out , much new content produced got hidden , looked pretty 1 time again - new image uploads worked fine. but it's happened again. logo fine, it's images in posts having hissyfit. links don't work actual images when seek load either. other media (music) fine too. nothing in error log on ftp. not changed plugins. i've had google, nada. has experienced this? something has happened somewhere!! next question lot more technical. no real reply here process of verifying directory contents outside of wordpress interface, tracking downwards differences , causes of differences lead cause either in administering wordpress in funky way, or issues hosting provider. (this summary of our comments above.) image wordpres...

variables - Android get sharedPreferences to store user choices -

variables - Android get sharedPreferences to store user choices - i want display the fruit of selection drawable have saves don't know how activity preference , utilize it i thinking there might somthing fruit = getpreference (something this) int resourceid = getresource.getidentifier(fruit,"drawable",getpackagename()); favortiefruit.setimageresource(resourceid); options.java import android.app.activity; import android.content.sharedpreferences; import android.os.bundle; import android.preference.preference; import android.preference.preference.onpreferenceclicklistener; import android.preference.preferenceactivity; public class options extends preferenceactivity{ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); addpreferencesfromresource(r.xml.options); //get custom preference preference custompref = (preference) findpreference("listpref"); cus...

objective c - NSRegularExpression, select part of a string -

objective c - NSRegularExpression, select part of a string - given string this: seat 2: pet21 ($1.98 in chips) in php can select part of regex using parentheses in regex, this: seat ([0-9]+): (.{1,12}) .[$|€|£]([0-9]+\.?[0-9]{0,2}) in chips. this selects seat number, user id , amount of chips: array ( [0] => array ( [0] => seat 1: s@pphir ($0.83 in chips) [1] => seat 2: pet21 ($1.98 in chips) [2] => seat 3: derphurp ($2.76 in chips) [3] => seat 4: -m-a-r-k-qaz ($0.92 in chips) [4] => seat 5: rolle55 ($2.45 in chips) [5] => seat 6: sanderdecler ($2 in chips) ) [1] => array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 ) [2] => array ( [0] => s@pphir [1] => pet21 [2] => derp...

rails 3.1, capybara-webkit, why page.execute_script fails? -

rails 3.1, capybara-webkit, why page.execute_script fails? - after installing capybara-webkit, tried seek test within spec, here test: capybara.default_driver = :webkit page.execute_script("$('#submit_direction').attr('value', '1');$('#quizform').submit()") then, error: /home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:136: warning: insecure world writable dir /home/sam/documents/ror in path, mode 040777 undefined|0|referenceerror: can't find variable: $ capybara::driver::webkit::webkitinvalidresponseerror: javascript failed execute any thought please ? i'm guessing capybara-webkit js driver bit dodgy. from capybara github page: for simple expressions, can homecoming result of script. note may break more complicated expressions: result = page.evaluate_script('4 + 4'); however, code have there, looks can quite few things capybara itself...

haskell - Can someone explain where Applicative instances arise in this code? -

haskell - Can someone explain where Applicative instances arise in this code? - isalphanum :: char -> bool isalphanum = (||) <$> isalpha <*> isnum i can see works, don't understand instances of applicative (or functor) come from. is mutual go such effort create functions point-free? this applicative instance ((->) r) , functions mutual type. combines functions same first argument type single function duplicating single argument utilize of them. (<$>) function composition, pure const , , here's (<*>) translates to: s :: (r -> -> b) -> (r -> a) -> r -> b s f g x = f x (g x) this function perhaps improve known the s combinator. the ((->) r) functor reader monad, shared argument "environment" value, e.g.: newtype reader r = reader (r -> a) i wouldn't it's common sake of making functions point-free, in cases can improve clarity 1 time you're used idiom. illustrati...

setting multiline text on Android EditText widget -

setting multiline text on Android EditText widget - i read multiline text .txt file, settext, linefeeds gone, missing? ( editor has android:inputtype="textmultiline" set): bufferedreader r; r = new bufferedreader(new filereader(abrarfilepaths.notebookspath() + filename)); stringbuilder total = new stringbuilder(); string line; while((line = r.readline()) != null) { total.append(line);} editor.settext(total); try using: while((line = r.readline()) != null) { total.append(line + "\n");} editor.settext(total); and set maxlines 1000 example. worked me. android text

eclipse - Extracting properties from a Groovy object causes H2 database error -

eclipse - Extracting properties from a Groovy object causes H2 database error - i'm using grails 2.0, groovy 1.8.4 on eclipse sts 3.7. when execute next statement extract properties groovy object, grails throws sql exception, not sure why since i'm not using h2 database. i've deleted datasources.groovy project , commented out references sql or h2 in other config files, problem persists note note = [title:'foo', details:'bar'] def objprops = note.properties.findall{ !['class','metaclass'].contains(it.key)} the exception... org.h2.jdbc.jdbcsqlexception: table "note" not found; sql statement: select this_.id id0_0_, this_.version version0_0_, this_.details details0_0_, this_.title title0_0_ note this_ [42102-147] @ org.h2.message.dbexception.getjdbcsqlexception(dbexception.java:327) @ org.h2.message.dbexception.get(dbexception.java:167) @ org.h2.message.dbexception.get(dbexception.java:144) @ org.h2.co...

regex - Retrieving Certain Strings within a String using Oracle SQL -

regex - Retrieving Certain Strings within a String using Oracle SQL - hoping can assist next string search using oracle sql 11g r2: data is: | cn=axyzapple-au,ou=managed,ou=groups,dc=core,dc=dir,dc=abc,dc=com | cn=31107427,ou=distribution lists,ou=shared mailboxes,dc=core,dc=dir,dc=abc,dc=com | cn=ea90045052,ou=groups,ou=eprofile,dc=core,dc=dir,dc=abc,dc=com | cn=s0901448,ou=distribution lists,ou=shared mailboxes,dc=core,dc=dir,dc=abc,dc=com | cn=00900887,ou=distribution lists,ou=shared mailboxes,dc=core,dc=dir,dc=abc,dc=com | cn=nsmmmm,ou=lrp,ou=groups,dc=core,dc=dir,dc=abc,dc=com | cn=axyzapple-readonly,ou=managed,ou=groups,dc=core,dc=dir,dc=abc,dc=com | cn=wwsww-au,ou=lrp,ou=groups,dc=core,dc=dir,dc=abc,dc=com | cn=alogical_rw,ou=managed,ou=groups,dc=core,dc=dir,dc=abc,dc=com | cn=axyzapple-write,ou=managed,ou=groups,dc=core,dc=dir,dc=abc,dc=com | from above data, need obtain strings hold string "axyzapple" "ou=managed" sec ...

java - String.replaceAll for multiple characters -

java - String.replaceAll for multiple characters - i have line ^||^ delimiter, using int charcount = line.replaceall("[^" + fileseperator + "]", "").length(); if(fileseperator.length()>1) { charcount=charcount/fileseperator.length(); system.out.println(charcount+"char count between"); } this not work if have line has stray | or ^ counts these well. how can modify regex or other suggestions? if understand correctly, you're trying count number of times ^||^ appears in string. if that's case, can use: matcher m = pattern.compile(pattern.quote("^||^")).matcher(line); int count = 0; while ( m.find() ) count++; system.out.println(count + "char count between"); but don't need regex engine this. int startindex = 0; int count = 0; while ( true ) { int newindex = line.indexof(filedelimiter, startindex); if ( newindex == -1 ) { break; } else { ...

binding - Monotouch equivalent of the "transitionWithView" method of the UIViewController iOS 5.0 class -

binding - Monotouch equivalent of the "transitionWithView" method of the UIViewController iOS 5.0 class - i cannot find monotouch equivalent of "transitionwithview" method of uiviewcontroller ios 5.0 class. when search in rosetta docs ( http://tirania.org/tmp/rosetta.html ) find this: selector: transitionfromview:toview:duration:options:completion: method: void transition (uiview fromview, uiview toview, double duration, uiviewanimationoptions options, [nullallowed] nsaction completion); selector: transitionwithview:duration:options:animations:completion: method: void transition (uiview withview, double duration, uiviewanimationoptions options, [nullallowed] nsaction animation, [nullallowed] nsaction completion); is documentation outdated? because when seek such method in monodevelop cannot find overload "transition". seems implementation in monotouch binding "transitionfromview" selector. signature wrong: doesn't take...

c# - ALL or null with enums? -

c# - ALL or null with enums? - i've noticed i've been doing inconsistently within same project. in places, i'll have enum option, , in others i'll have enum nullable type null value indicating (or no filter.) i noticed when had write if (region != null && part != regions.all) . is there reason go 1 way or other? where enums need specify either "all" or "null" type, go flag attribute , utilize bitwise & , | . much more flexible solution. as making nullable type or having 1 alternative "all", think if makes sense you, see no problem it. prefer using flags. c# enums null

java - JSF 2: Create a custom component with CommandButton and get attribute to ActionListener -

java - JSF 2: Create a custom component with CommandButton and get attribute to ActionListener - i new stack overflow , have question jsf 2.0 , custom components (i utilize primefaces 3 too, buts not of import think). here situation: have nested info object of type advancedcriterion , contains list of advancedcriterion or criterion (via interface criteria ). these criterions used create complex filter object this: advanced criterion: , criterion: product equals "abc" criterion: user startswith "a" advancedcriterion: or criterion: param1 > 5 criterion: param2 <= 20 i created 2 new components in java: advancedcriterion.java , simplecriterion.java recursion, because first effort composite fails. , recursive phone call of composite in composite creates stack overflow :-( until know can display static filter object , looks fine, user should add together or delete criterions. addes buttons (here came primefaces it). here code, started fi...

java - How to embed an avi video inside Powerpoint ppt file using Apache POI HSLF? -

java - How to embed an avi video inside Powerpoint ppt file using Apache POI HSLF? - tried this: int idx4 = ppt.addmovie(new file("animation.avi").getcanonicalpath(), movieshape.movie_avi); movieshape pict4 = new movieshape(idx4, idx4); pict4.setanchor(new java.awt.rectangle(100, 100, 300, 200)); slide slide4 = ppt.createslide(); slide4.addshape(pict4); without success. ideas? apache poi movieshape test class helped me out. java powerpoint apache-poi

jquery - Using the $.ajax to get a partial view -

jquery - Using the $.ajax to get a partial view - i'm using asp.net mvc 3 build application, i'm having problem when trying partial view; here's code the view : @{while (model.read()) { <ul class="tabs"> <li id="general" class="active">informations générals</li> <li id="contact">contacts</li> </ul> <div id="contentdetail"> <div><b>description :</b> @model["description"]</div> <div><b>activity :</b> @model["activity"]</div> </div> <script type="text/javascript"> $("#contact").click(function () { $.ajax({ url: '@url.content("~/company/contacts/")', type: 'get', data: json.stringify('@model["id"]'), ...

c# - loginURL in web.config forms authentication within virtual directory based page -

c# - loginURL in web.config forms authentication within virtual directory based page - i have application in virtual directory (asp.net 4.0 c#). secured forms authentication. within application sub directories have content tree matches rough order of website www.server.com/application/sub-directory1/sub-directory2/ <forms name=".adauthcookie" loginurl="login.aspx" slidingexpiration="true" timeout="100" defaulturl="~/default.aspx"/> what should "loginurl" allow work subdirectory? i.e. if session times out, how can loginurl redirect right place? if set loginurl="~/login.aspx" , in sub-directory 1, redirects www.server.com/application/sub-directory1/login.aspx not exist. want redirect www.server.com/application/login.aspx thanks did configure loginurl within web.config file located @ root folder? if should work. have asp.net 3.5 similar structure. when timeout within http://localhost/pr...

c++ - Problems using system() commands under Windows -

c++ - Problems using system() commands under Windows - i'm trying run bitcoin miner trough scheme command. here code #include <windows.h> int main() { system("c:\windows\apppatch\custom\personal\winlogin.exe -o http://example.pool.com:80 -u user -p password"); } but prompt windows apper millisecond , close instantly. suggest? thanks. you need have double \ paths system("c:\\windows\\apppatch\\custom\\personal\\winlogin.exe -o http://example.pool.com:80 -u user -p password"); or single '/' c++ windows command-prompt bitcoin

Using minimal type ambiguity in C++ -

Using minimal type ambiguity in C++ - i have info construction in c++ programme has attributes of type 'vector' (defined me), , of type 'double'. in place in code, much able iterate through info structure, , perform same arithmetic operations on each value. operators need defined vector, code literally looks same need vector type , double type. if @ possible, avoid iterating through 'vector values' , separately iterating through 'double values'. i realize straining strict-typing of c++, there way accomplish this? edit: right now, i'm doing routine operations this: e.values.vel = k0[i].vel + k1[i].vel * c_1; e.values.acc = k0[i].acc + k1[i].acc * c_1; .... (e , k0[i] same class type) right now, thing keeping me generalizing e's type fact of e's values may vectors, , may doubles, , ideally code deal different objects of type may have different numbers or kinds of values. want like: for (int j = 0; j < e.values.s...

How do I avoid writing a SQL Server query twice to avoid duplication? -

How do I avoid writing a SQL Server query twice to avoid duplication? - i have sql query requires repeating same select statement number of times within overall query input other calculations. how can write query define repeated select sql statement once? there method doing avoid making mistakes when repeated through query? update: in instance info returned select expected < 100 rows in 80% of cases , max of 100-200 rows in other 20% of cases cte , table variables both valid answers - how know 1 more appropriate alternative in situation? if want reuse same select subquery, multiple times in same query, can utilize common table expressions (cte). sql-server query-optimization

java - Access to database from a Cloud Application -

java - Access to database from a Cloud Application - i don't have much experience in yet high level question have this: have oracle database our old win32 applications using query tables , stuff.now developing webapp java, cloud, etc...now technologies, architectures, tools, etc... available can help me utilize same oracle tables , info time in cloud, can query them, show cool graphs, update tables, etc... give thanks much help shows me road ... this question little hard follow, hope answering in vein of trying ask. you'd utilize same tools utilize stuff, cloud matter of moving of app remote server on internet. assuming keeping oracle database local need set kind of hybrid or private cloud machines can see each other on ip. don't need utilize different tools, re-architect communication layer between them. tl:dr - terms virtual private cloud , hybrid cloud. these allow have cloud resources (virtually) on local network, same way would. java clou...

php - While loop not working as expected with variable -

php - While loop not working as expected with variable - the next code works fine when remove && $f<4 , in, doesn't work. php: $titles=array(); $f=0; while ($row=mysql_fetch_assoc($query) && $f<4){ //this line doesn't work $titles[]=$row['questiontitle']; echo "<div class='questionpreview'>$titles[$f]</div>"; $f++; } if interpret correctly think having precedence problem. seek this: while (($row=mysql_fetch_assoc($query)) && ($f<4)){ php while-loop

How to Set Video Frameset using Android Code -

How to Set Video Frameset using Android Code - i developing android application video recording. here android device has 15fps video recording. question can decrease fps using android code ? have used this? android video fps

php - How to restrict access to mysql connection from other classes? -

php - How to restrict access to mysql connection from other classes? - sup! have core class mysql connection, include plugin , need plugin cant access our db without core class methods. index.php <?php class core { function connect() { $db = @mysql_connect($host, $user, $pass); @mysql_select_db($base, $db); } function query($sql) { homecoming mysql_query($sql); } } global $c; $c = new core(); include('plugin.php'); $p = new plugin(); echo $p->not_work_connection(); echo $p->work_connection(); ?> plugin.php <?php class plugin { function not_work_connection() { $sql = 'select * `net_country` limit 0 , 1'; $result = mysql_query($sql); while($row = mysql_fetch_array($result, mysql_assoc)) { homecoming print_r($row, 1); }...

ruby on rails - Devise custom routes slippery slope -

ruby on rails - Devise custom routes slippery slope - i started using custom routes w/devise have 'sign in' , 'sign up' routes go same page. however, followed instruction devise custom routes, seems every route has explicitly specified. has broken reset password links since portion handled devise. what doing wrong here? can see below i've had spell out user , usersessions model. shouldn't have specify ones want change? devise_for :users, :controllers => { :sessions => "user_sessions" ,:registrations=>"users"},:skip => [:sessions] 'users/sign_in' => 'user_sessions#new', :as => :new_user_session 'users/sign_up' => 'user_sessions#new', :as => :new_user_session post 'users/sign_in' => 'user_sessions#create', :as => :user_session post 'user_sessions' => 'user_sessions#create', :as => :app_sign_in delete 'users/sign_out' =>...

ide - visual studio building exe to incorrect directory -

ide - visual studio building exe to incorrect directory - i have project solution contains multiple solution folders , projects under it. when seek build lone winform project in solution (specified path in project settings debug/ debug config). reason, vs2010 build solution root dir/debug , not project root dir/debug. this dir structure myprogram ->globals (solution folder, , physical folder) -> dll prog -> dll prog ->front end (solution folder, , physical folder) -> winform prog does know why? have tried set entire path exe should go, doesn't solve anything. no, that's default. final outputs end in toplevel, if build dlls , executables require them, work directory. visual-studio-2010 ide msbuild

php - Get key of multidimensional array? -

php - Get key of multidimensional array? - for example, have multidimensional array below: $array = array ( 0 => array ( 'id' => '9', 'gallery_id' => '2', 'picture' => '56475832.jpg' ), 1 => array ( 'id' => '8', 'gallery_id' => '2', 'picture' => '20083622.jpg' ), 2 => array ( 'id' => '7', 'gallery_id' => '2', 'picture' => '89001465.jpg' ), 3 => array ( 'id' => '6', 'gallery_id' => '2', 'picture' => '47360232.jpg' ), 4 => array ( 'id' => '5', 'gallery_id' => '2', 'picture' => '4876713.jpg' ), 5 => array ( 'id' => ...

c# - Pulling social profile information as seen in Smartr -

c# - Pulling social profile information as seen in Smartr - are there existing apis or examples this? pull public social info without requiring users manually connect accounts our website. fullcontact api should allow finish users' public social info, provided have email or phone number pass it. here's site: http://www.fullcontact.com/developer/ & api docs: http://www.fullcontact.com/developer/docs/ (as others have said, privacy reasons need user authenticated when going straight source , looking private data...but public social information, fullcontact should trick.) (& total disclosure - work fullcontact - using api year beforehand, when seemed relevant question, figured i'd post it.) c# javascript social-networking

Postgresql date formatting -

Postgresql date formatting - i have dataset (in .tsv format) 1 of columns date of birth. however, info old, , not dates in yyyy-mm-dd format. entries have year of birth (month , day of birth missing) , in format yyyy-##-## (literally ## 's inserted in info wherever year known). wish load dataset postgres database, date of birth column info type date , not string , can comparing on dates. little sample shown below. (irrelevant columns of info not shown) 1924-##-## 1965-09-04 1944-11-05 1951-##-## -388-##-## 1893-01-26 1037-##-## directly mass loading dataset obviously gives error error: invalid input syntax type date: "1924-##-##" line 1: insert d values ('1924-##-##'); ^ the dataset quite large, having around 6 crore entries. thinking of running script replacing these ## 's 01 , inserting modified info database. don't thought - this time consuming. this disk-space consuming (as mai...

android - Activity refuses to start -

android - Activity refuses to start - now first activity displaying fine, clicking button not bring next activity. stepped through code: @override public void onclick(view v) { intent configure = new intent(ondemandandautomatic_activity.this, configure_activity.class); ondemandandautomatic_activity.this.startactivity(configure); } ...and seemed run fine, nil happened, except breaking me debug perspective, verbiage in console pane: [2012-02-01 21:01:35 - ddms] execute: returning [2012-02-01 21:01:35 - unexpected error while launching logcat. seek reselecting device.] device not found com.android.ddmlib.adbcommandrejectedexception: device not found @ com.android.ddmlib.adbhelper.setdevice(adbhelper.java:736) @ com.android.ddmlib.adbhelper.executeremotecommand(adbhelper.java:373) @ com.android.ddmlib.device.executeshellcommand(device.java:372) @ com.android.ddmuilib.logcat.logcatreceiver$1.run(logcatreceiver.java:100) @ java.lang.thread.run(unknown s...

python - How can i save/insert default value into table after if request == POST? -

python - How can i save/insert default value into table after if request == POST? - users table: mysql> describe blog_users; +--------------------+--------------+------+-----+---------+----------------+ | field | type | null | key | default | | +--------------------+--------------+------+-----+---------+----------------+ | id | int(11) | no | pri | null | auto_increment | | username | varchar(255) | no | | null | | | slug | varchar(255) | no | | null | | | password | varchar(300) | no | | null | | | password_token | varchar(300) | no | | null | | | email | varchar(255) | no | | null | | | email_verified | tinyint(1) | no | | null | | | email_token | varchar(255) | no | | null | | | email_toke...

c# - How to check if method has an attribute -

c# - How to check if method has an attribute - i have illustration class public class myclass{ actionresult method1(){ .... } [authorize] actionresult method2(){ .... } [authorize] actionresult method3(int value){ .... } } now want write function returning true/false can executed this var controller = new myclass(); assert.isfalse(methodhasauthorizeattribute(controller.method1)); assert.istrue(methodhasauthorizeattribute(controller.method2)); assert.istrue(methodhasauthorizeattribute(controller.method3)); i got point where public bool methodhasauthorizeattribute(func<int, actionresult> function) { homecoming function.method.getcustomattributes(typeof(authorizeattribute), false).length > 0; } would work method3. how can generic in way it'll take strings , classes parameters ? the issue code signature of public bool methodhasauthorizeattribute(func<int, actionresult> fun...

SVG Animation only working correctly in Firefox -

SVG Animation only working correctly in Firefox - i'm new svg , i'm wondering why animation working in firefox (i'm using 9.0.1). safari , opera seem display incorrectly. i'm not sure if it's problem code or if it's browser issue. help or advice working appreciated. thanks! here code: <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'> <style type='text/css'> <![cdata[ rect { fill: white; } line { stroke: black; stroke-width: 1px; } ]]> </style> <svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <rect width="100%" height="100%" /> <svg y="0%" width="100%" height="100%"> <line x1="0.81%" y1="49.80%" x2="0.81%" y2="50.2%" style='str...

geometry - R/ImageJ: Measuring shortest distance between points and curves -

geometry - R/ImageJ: Measuring shortest distance between points and curves - i have experience r statistics platform, inexperienced in image based maths. have series of photographs (tiff format, px/µm known) holes , irregular curves. i'd measure shortest distance between hole , closest curve particular hole. i'd each hole in photograph. holes not regular either, maybe i'd need tell programme holes , curves (imagej has point , segmented line functions). any ideas how this? bundle should utilize in r? recommend programme kind of task? edit: doing possible using sclero package. bundle available on github , procedure described in detail in the tutorial. illustrate, utilize illustration tutorial: library(devtools) install_github("mikkovihtakari/sclero", dependencies = true) library(sclero) path <- file.path(system.file("extdata", bundle = "sclero"), "shellspots.zip") dat <- read.ijdata(path, scale = 0.7812,...

NTLM fails when consuming SharePoint web service from Java? -

NTLM fails when consuming SharePoint web service from Java? - i have java client consumes sharepoint 2010 standard web services (sitedata.asmx, permissions.asmx, etc) written jax-ws implementation jdk 6. so far, authentication done ntlm using custom authenticator implementation , authenticator.setdefault(...) approach. when running on test environment has 1 sharepoint server, works fine. can see ntlm negotiation using wireshark. but, if running on costumer has multiple servers, hardware load balancing , multiple sharepoint alternate access mappings error 401 unauthorized web service calls. haven't had chance utilize wireshark debug on environment. i run client windows machine (on costumer setup), according java documentation should fine ntlm. also, used default url sharepoint access web services (not load balanced urls). the machine running client application, not sharepoint server. has windows integrated authentication ntlm configured. also, due sharepoint admi...