Posts

Showing posts from April, 2011

angularjs - htm5mode with parameters doesn't work for me -

angularjs - htm5mode with parameters doesn't work for me - the first hand, code: config app: promoapp.config(['$routeprovider','$locationprovider',function($routeprovider,$locationprovider){ $locationprovider.html5mode(true); $routeprovider. when('/home',{ templateurl: 'views/home.html', controller: 'homecontroller' }). when('/web',{ templateurl: 'views/web.html', controller: 'webcontroller' }). when('/portfolio',{ templateurl: 'views/portfolio.html' }). when('/game',{ templateurl: 'views/game.html' }). when('/contact',{ templateurl: 'views/contact.html', controller: 'contactcontroller' }). when('/admin',{ templateurl: 'views/admin.ht

julia find in matrix with (row,col) instead of index -

julia find in matrix with (row,col) instead of index - in julia can find coordinates of elements in matrix via: julia> find( x -> x == 2, [ 1 2 3; 2 3 4; 1 0 2] ) 3-element array{int64,1}: 2 4 9 these values right prefer (row,col) tuples instead. (1,2) (2,1) (3,3) what easiest way accomplish in julia? i don't believe there inbuilt way it, here function it function findmat(f, a::abstractmatrix) m,n = size(a) out = (int,int)[] in 1:m, j in 1:n f(a[i,j]) && push!(out,(i,j)) end out end e.g. julia> findmat(x->x==2, [ 1 2 3; 2 3 4; 1 0 2] ) 3-element array{(int64,int64),1}: (1,2) (2,1) (3,3) if big number of items satisfy status might more efficient in 2 passes, uncertainty it. matrix find julia-lang

pass vectors by pointer and reference in c++ -

pass vectors by pointer and reference in c++ - a quick question how safely pass , utilize vectors in c++. i know when using vectors have careful addresses them , elements because when dynamically alter size may alter address (unless utilize reserve etc. i'm imagining not know how much space need). now want pass existing vector (created elsewhere) function adapts , changes size etc. i'm little unclear safe because accomplish of pointers. on top of there using references vector , muddies water me. for instance take 2 next functions , comments in them void function1(std::vector<int>* vec){ std::cout<<"the size of vector is: "<<vec->size()<<std::endl; //presumably valid here (int i=0;i<10;i++){ (*vec).pushback(i); //is safe? or fail? // or: vec->pushback(i); difference? } std::cout<<"the size of vector is: "<<vec->size()<<std::endl; //is line valid he

Multi-windows R graphs in C# with RDotNet -

Multi-windows R graphs in C# with RDotNet - i have c# code simple windows form 3 buttons. button 1 calls r , plots surface while button 2 plots contour. if launch application , click on button 1, correctly see surface plot click on button 2 open new window counter plot. unfortunately, if seek app freezes , cannot go on. have added button 3 intention close r engine if running. thought kill r instance , reopen when clicking on button 2. doesn't work either. there way prepare problem? using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using rdotnet; namespace mysurface { public partial class form1 : form { public form1() { initializecomponent(); } public void button1_click(object sender, eventargs e) { string dllpath = @"c:\program files\r\r-3.1.0\bin\i386\";

haskell - Evaluating lambda expressions on the form lambda x E -

haskell - Evaluating lambda expressions on the form lambda x E - i got problem trying evaluate lambda expressions on form lambda x e. after hours of thinking came nil yet, there here point me abit in right direction? this should returning function argument x, can used on body e. function can thought of anonymous function on form \x -> e. variables can used in e, exist when function made(lexical scope). i should back upwards evaluation of function calls on form f a. evaluating list ( f ... ) when f not special atom, successful when either f evaluates function, or list has 2 elements ( f ) , evaluating of function f argument succeeds , gives legitimate value, mean number of function. the code i've got far handle cases leading following: type context = [( string, int )] type memory = [( int, ast )] eval::ast -> context -> memory -> ( ast, context, memory ) eval (number x) con mem = ( number x, con, mem )

c++ - Make custom type "tie-able" (compatible with std::tie) -

c++ - Make custom type "tie-able" (compatible with std::tie) - consider have custom type (which can extend): struct foo { int a; string b; }; how can create instance of object assignable std::tie , i.e. std::tuple of references? foo foo = ...; int a; string b; std::tie(a, b) = foo; failed attempts: overloading assignment operator tuple<int&,string&> = foo not possible, since assignment operator 1 of binary operators have members of left hand side object. so tried solve implementing suitable tuple-conversion operator. next versions fail: operator tuple<int,string>() const operator tuple<const int&,const string&>() const they result in error @ assignment, telling " operator = not overloaded tuple<int&,string&> = foo ". guess because "conversion type x + deducing template parameter x operator=" don't work together, 1 of them @ once. imperfect attempt: hence trie

parsing - Read/parse a ABNF grammar with tags in C++ from a file -

parsing - Read/parse a ABNF grammar with tags in C++ from a file - i have file contains abnf grammar tags in simplified example: $name = bertha {userid=013} | bob {userid=429} | ( ben | benjamin ) {userid=265}; $greet = hi | hello | greetings; $s = $greet $name; now task obtain userid parsing given sentence grammar. example, parsing sentence greetings bob should give userid 429. grammars have read in @ runtime because can alter between runs. my approach following: parse grammar 1 or multiple trees, putting tags @ leaves or nodes belong to parse sentence this/those tree(s) build tree creates given sentence(i'm thinking using earley this) use tree obtain tags (unlike in example, there multiple different tags in such tree) my question is, there software components can utilize or @ to the lowest degree modify solve task? steps 1 , 2 seem quite generic (1. reading abnf grammar c++ internal representation (e.g. trees); 2. early-algorithm (or that) working i

python - What exactly does Spyder do to Unicode strings? -

python - What exactly does Spyder do to Unicode strings? - running python in standard gnu terminal emulator on ubuntu 14.04, expected behavior when typing interactively: >>> len('tiθ') 4 >>> len(u'tiθ') 3 the same thing happens when running explicitly utf8-encoded script in spyder: # -*- coding: utf-8 -*- print(len('tiθ')) print(len(u'tiθ')) ...gives next output, regardless of whether run in new dedicated interpreter, or run in spyder-default interpreter (shown here): >>> runfile('/home/dan/desktop/mwe.py', wdir=r'/home/dan/desktop') 4 3 but when typing interactively in python console within spyder: >>> len('tiθ') 4 >>> len(u'tiθ') 4 this issue has been brought elsewhere, question regards differences between windows , linux. here, i'm getting different results in different consoles on same system, , python startup message in terminal emulator ,

python - Pandas - consecutive values must be different -

python - Pandas - consecutive values must be different - i want subsample rows of dataframe such pairs of consecutive values in given column different, if 2 of them same, keep, say, first one. here example p = [1,1,2,1,3,3,2,4,3] t = range(len(p)) df = pd.dataframe({'t':t, 'p':p}) df p t 0 1 0 1 1 1 2 2 2 3 1 3 4 3 4 5 3 5 6 2 6 7 4 7 8 3 8 desireddf p t 0 1 0 2 2 2 3 1 3 4 3 4 6 2 6 7 4 7 8 3 8 in desireddf, 2 consecutive values in p column different. how this? >>> df[df.p != df.p.shift()] p t 0 1 0 2 2 2 3 1 3 4 3 4 6 2 6 7 4 7 8 3 8 explanation: df.p.shift() shifts entries of column p downwards row. df.p != df.p.shift() checks each entry of df.p different previous entry, returning boolean value. this method works on columns number of consecutive entries: e.g. if there run of 3 identical values, first value in run returned. python pandas dataframes distinct-

ios - AVURLAsset cannot find video track -

ios - AVURLAsset cannot find video track - i utilize uivideoeditorcontroller trim video. after editing, in delegate, seek remix video other media. however, [avurlasset trackwithmediatype:] unable find video track. code follow: - (void)video:(nsstring*)videopath didfinishsavingwitherror:(nserror*)error contextinfo:(void*)contextinfo { nsurl *videourl = [nsurl urlwithstring:videopath]; avurlasset *asset = [avurlasset urlassetwithurl:videourl options:nil]; if(asset == nil) { nslog(@"cannot create avurlasset"); return; } else { nslog(@"asset: %@", asset); } if([asset trackswithmediatype:avmediatypevideo].count == 0) { nslog(@"no video track"); return; } else if([asset trackswithmediatype:avmediatypeaudio].count == 0) { nslog(@"no sound track"); return; } // follow codes hidden intentionally } the console log prints: 2014-10-15 13:35:45.913 testvideotrim[

javascript - How to keep input status when click back button? -

javascript - How to keep input status when click back button? - click reset button on page test1, input of id become enabled. edit value , click submit button, , go page test2. click button homecoming page test1. problem is, input keeps edited value status disabled. want maintain enable. how solved problem. (it works on firefox not work on ie , chrome.) class="snippet-code-html lang-html prettyprint-override"> <html> <head> <title> test1 </title> <script type="text/javascript"> function setenable(){ document.myform.id.disabled = false; } </script> </head> <body> <form method="post" name="myform" action="test2.html"> <input type=text name="id" value="test" disabled/> <input type=button value="reset" onclick=setenable(); /> <input type=submit /> </form> </body> <

java - Filling ArrayList vs LinkedList -

java - Filling ArrayList vs LinkedList - i have been thinking linkedlist fills faster arraylist . know arraylist based on simple array limited length(constant). every time array out of range, new array higher range created. linkedlist much simpler. hasn't got limit (except memory), should filled faster. run next code: public static void main(string[] args) { int length = 7000000; list<integer> list = new linkedlist<integer>(); long oldtime = system.currenttimemillis(); (int = 0; < length; i++) { list.add(i); } system.out.println("linkedlist fill: " + (system.currenttimemillis() - oldtime)); list = new arraylist<integer>(); oldtime = system.currenttimemillis(); (int = 0; < length; i++) { list.add(i); } system.out.println("arraylist fill: " + (system.currenttimemillis() - oldtime)); } the output is: linkedl

php - Display MySQL errors Joomla 2.5 -

php - Display MySQL errors Joomla 2.5 - how can display if there error after executing lastly query query() or execute() in joomla 2.5? currently using var_dump($wsr_db_object->stderr(true)); not show mysql errors. helps query executed or not? edit: here how running $rw_db_object->setquery($insert_rw_cats); $rw_db_object->query(); var_dump($wsr_db_object->stderr(true)); joomla has built in dump method so: $query->dump(); when writing queries, please refer joomla documentation hope helps update: $rw_db_object->setquery($insert_rw_cats); $rw_db_object->query(); $rw_db_object->dump(); php mysql joomla joomla2.5

css3 - wordpress template reuse id for different page feeds -

css3 - wordpress template reuse id for different page feeds - i'm building wordpress template home page takes excerpt , featured image category or page , displays number of them on page. under each there link 'read more' or 'buy' using woocommerce plugin shop element. within posts/pages there woocommerce 'add cart' shortlink product. want each 'buy' link on home page go part of post/page shortlink code. used div id="buy" , added #buy template link. works fine once. know not supposed reuse id. want person updating site new products not have touch template want them able utilize same id. each section of home page within it's own loop, reset each time. create okay reuse same id? throughout template , on individual posts/pages?? having hash #buy in url on category page no problem - can have there on many urls want. , if you're creating <div id="buy">...</div> on individual page, it's no problem

automation - How to run vimscript from bash, and get the output in a bash script? -

automation - How to run vimscript from bash, and get the output in a bash script? - i'd run vimscript command line. check if command-t installed on vim instance (and if not, i'd install it). i can run commands in vim observe presence of command-t, illustration exists("commandtflush") homecoming 0 if exists , 2 if doesn't. how can phone call function bash script, , interpret result in bash? i ended using next commands. since vim uses ncurses, can't echo can read homecoming code of vim process. if exit vim :cquit vim exit homecoming code 1, otherwise exit 0. can utilize determine success/failure of function. add next file , save check-command-t.vim : :let cmdt = exists("commandtflush") :if cmdt == 2 " it's not installed. :cquit :else :exit :endif from bash want utilize vim -s check-command-t.vim tell vim run of commands in file. if vim -s check-command-t.vim; # command exited homecoming

java.lang.ClassNotFoundException: Didn't find class after updating Android studio (Local) -

java.lang.ClassNotFoundException: Didn't find class after updating Android studio (Local) - i've been getting java.lang.classnotfoundexception errors ever since updated 21. my apk crashes on install every time , throws next error: java.lang.runtimeexception: unable instantiate application mypackage.class: java.lang.classnotfoundexception: didn't find class "mypackage.class" on path: @ android.app.loadedapk.makeapplication(loadedapk.java:507) @ android.app.activitythread.handlebindapplication(activitythread.java:4301) @ android.app.activitythread.access$1500(activitythread.java:135) @ android.app.activitythread$h.handlemessage(activitythread.java:1256) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:136) @ android.app.activitythread.main(activitythread.java:5001) @ java.lang.reflect.method.invokenative(nativ

javascript - HTML form method post does not work with multiple submit -

javascript - HTML form method post does not work with multiple submit - html form method post not work multiple submit i have following <form id="myform" method="post" action=""> <select name="select_data"> <option value="1000">account demo 1</option> <option value="1035">account demo 2</option> </select> <input type="submit" onclick="sendform('<?php echo $domainurl;?>page_1')" form="myform" class="btn btn-primary btn-sm" value="page 1"> <input type="submit" onclick="sendform('<?php echo $domainurl;?>page_2')" form="myform" class="btn btn-primary btn-sm" value="page 2"> <script> function sendform(action) { document.getelementbyid('myform').action = action; document.getelementbyid('myform&

debugging - Is there any class count limit in MFC project compiled with /CLR -

debugging - Is there any class count limit in MFC project compiled with /CLR - with risk fall specific question... given c++ mfc (mixed, not shaked) project compiled /clr, have 200 classes defined. when add together new empty class project, error raises when compile , execute in debug mode. an unhandled exception of type 'system.io.fileloadexception' occurred in unknown module. additional information: not load file or assembly 'projecta, version=0.0.0.0, culture=neutral, publickeytoken=null' or 1 of dependencies. not find or load type. (exception hresult: 0x80131522) projecta name of mfc project itself. there no reference projecta assembly on project configuration, , there no reference custom assembly. this project have references .net framework assemblies, in order allow of custom defined classes in project can utilize clr classes. then, question is... do know whether there limitation of class number on mfc c++ project? edit:

c++ - libintl.h not found when compiling libquicktime on OSX -

c++ - libintl.h not found when compiling libquicktime on OSX - i getting error log.c:30:10: fatal error: 'libintl.h' file not found #include <libintl.h> when installing libquicktime 1.0.1 on osx with: ./configure --prefix=/usr && make however, next locate libintl.h , on scheme in /opt/local/include/libintl.h /usr/local/cellar/gettext/0.19.3/include/libintl.h i'm next instructions manually install libquicktime here: http://www.linuxfromscratch.org/blfs/view/6.3/multimedia/libquicktime.html i need version 1.0.1 of libquicktime compile custom matlab mexfile. can help? c++ c osx gcc make

c - Ambigious nature of scanf taking input before it is asked to enter from user? -

c - Ambigious nature of scanf taking input before it is asked to enter from user? - #include<stdio.h> void main(){ int num1,num2; printf("\n come in number 1 \t "); // inquire input one. >>>>>>>> line 1. scanf("%d ",&num1); printf("\n entered number %d \n",num1); printf("\n come in number 2 \t "); // inquire input two. >>>>>>>>> line 2. scanf("%d ",&num2); printf("\n entered number %d \n",num2); return; } i wish know reason.please provide it. the code above accepts 2 inputs,first input asked(by executing line 1) user come in 1 number terminal should inquire come in sec input instead taking other number(before executing line2 ) , asking come in sec input(i.e after executing line 2). in end is displaying 2 input taken before executing line two after executing line 1. i confused.i interested know rea

eclipse - Java - I can't open Microsoft Access file through executable jar -

eclipse - Java - I can't open Microsoft Access file through executable jar - i'm trying access microsoft access database using next code: class.forname("sun.jdbc.odbc.jdbcodbcdriver"); string database = "jdbc:odbc:driver={microsoft access driver (*.mdb, *.accdb)};dbq="+ dbpatch + "/silverdb.accdb"; connection conn = drivermanager.getconnection(database, "", ""); statement s = conn.createstatement(); the problem when run through eclipse, goes fine, when generate executable jar , run it, doesn't work. knows reason? thanks! check version of java running in eclipse vs when double click jar. if running java 7 in eclipse , java 8 when doubleclick, may explain problem. whatever issue, if don't post stack trace of failure no 1 here going able help you. "it doesn't work" isn't description allows seek help. java eclipse jdbc

linux - Portable programming environment -

linux - Portable programming environment - is there way create linux live usb necessary tools programme in c/c++/python/java/css/etc... ? i edit , compile code, , link os cloud in sense of having hard drive on cloud , os on usb stick while using machines resources (ram, cpu, etc..). usb stick's space 4 gb. not reply question, there few cloud development environments out-there, such http://codenvy.com, can connect paas services, github, etc. wouldn't need usb stick @ all. codenvy partnered eclipse create eclipse che. guess install on usb stick if wanted to. linux portability usb-drive

objective c - iOS Multipeer Connectivity didReceiveInvitationFromPeer did not -

objective c - iOS Multipeer Connectivity didReceiveInvitationFromPeer did not - i know question has been asked many times, after reading each of them more few times, still can't multipeer connectivity work. sending not receiving invitation. here code: @implementation mpcmanager - (id)init { self = [super init]; if (self) { _mypeerid = nil; _session = nil; _browser = nil; _advertiser = nil; } homecoming self; } - (void)automaticbrowseandadvertisewithname:(nsstring *)displayname { _mypeerid = [[mcpeerid alloc] initwithdisplayname:displayname]; _session = [[mcsession alloc] initwithpeer:_mypeerid]; _session.delegate = self; _advertiser = [[mcnearbyserviceadvertiser alloc] initwithpeer:_mypeerid discoveryinfo:nil servicetype:@"trm-s"]; _advertiser.delegate = self; [_advertiser startadvertisingpeer]; _browser = [[mcnearbyse

database - SQL - Add column data from one table into another while preserving original data -

database - SQL - Add column data from one table into another while preserving original data - i need add together info 1 table (table1) table (table2) info in fullname column matches in both tables. code below want, except deletes of other info in table1's title column. update table1 set title = (select title table2 table2.fullname = table1.fullname) my goal update table1's title column have both info had plus info table2's title column without erasing info in table1's title column prior running sql query. i'm assuming you're using oracle given syntax you've given. issue that, when utilize form of update statement, need where exists clause or similar: update table1 set title = ( select title table2 table2.fullname = table1.fullname ) exists ( select 1 table2 table2.fullname = table1.fullname ) otherwise non-matching titles nulled ou

GitLab reconfigure Error: executing action `create` on resource 'user[git]' -

GitLab reconfigure Error: executing action `create` on resource 'user[git]' - i tried install gitlab gitlab_7.4.3-omnibus.5.1.0.ci-1_amd64.deb on server. and there error when ran sudo gitlab-ctl reconfigure . the error log : [2014-11-07t12:26:33+08:00] info: forking chef instance converge... [2014-11-07t12:26:33+08:00] info: *** chef 11.12.2 *** [2014-11-07t12:26:33+08:00] info: chef-client pid: 17502 [2014-11-07t12:26:35+08:00] info: setting run_list ["recipe[gitlab]"] cli options [2014-11-07t12:26:35+08:00] info: run list [recipe[gitlab]] [2014-11-07t12:26:35+08:00] info: run list expands [gitlab] [2014-11-07t12:26:35+08:00] info: starting chef run r710 [2014-11-07t12:26:35+08:00] info: running start handlers [2014-11-07t12:26:35+08:00] info: start handlers complete. [2014-11-07t12:26:35+08:00] warn: cloning resource attributes directory[/var/opt/gitlab] prior resource (chef-3694) [2014-11-07t12:26:35+08:00] warn: previous directory[/var/opt/gitlab]: /o

networking - AIMD congestion window halving -

networking - AIMD congestion window halving - the aimd additive increment multiplicative decrease ca algorithm halves size of congestion window when loss has been detected. experimental/statistical or theoretical evidence there suggest dividing 2 most efficient method (instead of, say, numerical value), other "intuition"? can point me publication or journal paper supports or investigates claim? thank you networking congestion-control

sql server - Import from MSSQL to Excel when the data contains embedded line breaks -

sql server - Import from MSSQL to Excel when the data contains embedded line breaks - i trying export sql query (ms sql 2014) excel 2010. problem column values contain line breaks, remaining info gets copied next line in excel. there way rid of this? keeping column is? or maybe encapsulating column sql considers 1 column , ignores line breaks? here sql query: select * tbl_case (casenature not '%<strong>%' , casenature not '%<br />%' , casenature '%from:%') , userid in (select employeelogin tbl_employees riding='15010') works fine if utilize normal way import info mssql excel is: in excel, data->from other sources->sql server . to import info resulting arbitrary sql query: at lastly step of wizard (where select range), press properties... in resulting connection properties window: definition->command type - sql in command text field, write query sql-server excel

javascript - How to check window.showModalDialog availability? -

javascript - How to check window.showModalDialog availability? - javascript method window.showmodaldialog deprecated , not working in chrome browser anymore. stop working in fire fox. want replace window.open if browser not back upwards showmodaldialog. how observe if browser still back upwards functionality? possible modernizr library , how? use condition. if(window.showmodaldialog) console.log("derp"); else console.log("herp"); javascript modernizr showmodaldialog

if statement - javascript, unexpected token { -

if statement - javascript, unexpected token { - okay, have basic syntax error i'm having issues resolving. apparently missed basic , of import on code academy class can't seem resolve. i'll post code below. should obvious i'm trying within. the error = "syntax error: unexpected token {" the goal, write own code incorporating loops, if/else, , functions. var info = ["love", "peace", "anger", "war"] (i = 0; < data.length; i++){ if (i <=2){ console.log("life is" + " " +data[i]); } else if (i <=4){ console.log("strife is" + " " + data[i]); } else (i = 5){ console.log("that's now"); } } the problem, pointed out, else not take status makes sense else body run when other corresponding if/else-if conditionals failed. thus javascript (not requiring braces around if/else-bodies) parsing so: else statement more s

angularjs - Binding to data when changing the URL -

angularjs - Binding to data when changing the URL - i building application uses ui-router. on /teams route have form user can add together team name pushes name mongodb , binds view , displays team name several options, 1 of beingness button links page more specific info can added team. have routing working on , url appears /#/teams/oklahoma or /#/teams/washington example. here routing looks like: app.config( ['$stateprovider','$urlrouterprovider', function($stateprovider, $urlrouterprovider){ $urlrouterprovider.otherwise('/'); .state('teams', { url: '/teams', templateurl: './templates/main/league.html', controller: 'leaguectrl' }) .state('teams/:title', { url: '/teams/:title', templateurl: './templates/main/team.html', controller: 'teamctrl' }) here link /teams/:title route: <a href="#subjects/{

javascript - Submit multiple forms same jquery script -

javascript - Submit multiple forms same jquery script - i have multiple forms , want of them processed single jquery script, of course of study have php functions work correctly, tried them separately. this script: function proceso_form(type_form, id_div_error){ var url = "my_url.php?form="+type_form; //functions var response = document.getelementbyid(id_div_error); response.innerhtml="<img src='img/loader.gif' style='margin-right: 5px;'/>loading ..."; // response.style.display='block'; $.ajax({ type: "post", url: url, data: $(this).serialize(), //id form success: function(data) { if (data==1){ window.location.reload(); }else{ response.innerhtml=data; // show php response. } }

How to get return value from sub report to main report? -

How to get return value from sub report to main report? - i using jasperreports 4.5.1 version facing problem sum of value, have 2 study 1 main study , sub-report main study has 3 row , sub study have 5 row , 3 column want lastly column's sum , pass main report. create 1 variable , store sum of column no 3 , homecoming main study every time getting first total null or 0 , not getting lastly table's total main study ----------------------------------------------------- no item cost discount% ----------------------------------------------------- sub-report 1 150 10 2 b 200 10 3 c 550 25 --------------------------------------------------- main study total sum(prise) ----------------------------------------------------- no item cost discount% ---------

c++ - Writing ITK (insight Toolkit) results to local buffer -

c++ - Writing ITK (insight Toolkit) results to local buffer - after applying itk filter pipeline, how write result buffer used (outside itk)? the insight software guide has illustration book 1: chapter 4.1.7: "importing image info buffer", , same illustration found in wikiexamples. it shows how 1 can wrap itk pointer around c++ array utilize farther using importimagefilter object. however, illustration uses writer object write filtered result file. how write filtered result c++ array instead? or how overwrite array i've used input? in essence, i've application contains image in buffer ( localbuffer ) can wrap next illustration code: [...] const bool filterownsbuffer= false; importfilter->setimportpointer( localbuffer, size[0]*size[1], filterownsbuffer ); i can utilize it in itk pipeline , 'update' @ stage: [...] filtertype::pointer filter = filtertype::new(); filter->setinput( importfilter->getoutput() ); filte

google chrome - Android Webview Performance differences -

google chrome - Android Webview Performance differences - i writing webview app in android 4.4.3 latest android version. biggest problem performance differences between chrome browser , webview app. differences huge. how can webview app same performance chrome browser? try code. help in increasing speed - webview.getsettings().setrenderpriority(renderpriority.high); webview.getsettings().setcachemode(websettings.load_no_cache); also seek adding manifest under desired activity - android:hardwareaccelerated="true" edit chrome not utilize webview - source. does mean chrome android using webview? no, chrome android separate webview. they're both based on same code, including mutual javascript engine , rendering engine. that reason performance difference android google-chrome webview

Processing Library for Java in Netbeans - load an image without extending PApplet -

Processing Library for Java in Netbeans - load an image without extending PApplet - working in netbeans, having included processing.core import, trying next in method... papplet pbase = new papplet(); pimage img = pbase.loadimage(filepath); pbase.set(0,0,img); pbase.save(newfilepath); .. instead of using "myclass extends papplet" method since i'm not planning draw on screen. wish utilize processing library image functions available within applet. apart above code, additional thing i've done include import processing.core. am obliged create class , utilize in papplet.main("my.package.mainmethod") or can utilize standard library (i.e. above)? the above gives me nullpointer exception. i've read somewhere code i've written doesn't generate canvas why doesn't work. papplet pbase = new papplet(); pbase.init(); pimage img = pbase.loadimage(filepath); i forgot phone call init() - clue beingness in applet! j

amazon web services - Why my AWS volume size is different from the actual size? -

amazon web services - Why my AWS volume size is different from the actual size? - it's wried see actual disk size much less actual size. information, looks disk not partitioned. i have no thought why actual size 20g disk size 100g, , how find other 80g back? the image version stardard aws linux ami: name="amazon linux ami" version="2014.09" id="amzn" id_like="rhel fedora" version_id="2014.09" pretty_name="amazon linux ami 2014.09" ansi_color="0;33" cpe_name="cpe:/o:amazon:linux:2014.09:ga" home_url="http://aws.amazon.com/amazon-linux-ami/" amazon linux ami release 2014.09 try extending file scheme utilize of space on block device: sudo resize2fs /dev/xvdb the cloudinit software on ubuntu , amazon linux amis has command automatically run against root disk when scheme boots, don't have worry making root file scheme match volume size on new instances. howe

c++ - Const twice in one method parameter? -

c++ - Const twice in one method parameter? - i'm new c++ , trying understand code i'm looking at: bool classname::classmethod(const struct_thing* const parametername) {} what purpose of sec "const" in argument? how differ const struct_thing* parametername ? thanks! that means const pointer const variable. see next examples: int x = 5; // non-const int int* y = &x; // non-const pointer non-const int int const = 3; // const int int* const b = &a; // const pointer non-const int int const* const c = &a; // const pointer const int so can see 2 things have potential mutable, variable , pointer. either of these 2 can const . a const variable works you'd imagine: int foo = 10; foo += 5; // okay! int const bar = 5; bar += 3; // not okay! should result in compiler warning (at least) a const pointer works same way: int foo = 10; int bar = 5; int* = &foo; = &

java - How to access service in activity from fragment as soon as it's ready? -

java - How to access service in activity from fragment as soon as it's ready? - i have fragmentactivity , , i'm binding service in onresume method. have fragment gets added activity. fragment phone call service doinbackground method in asynctask initialization first, , after initialization, button in fragment become enabled. when tried execute asynctask fragment's onactivitycreated or onresume method, nullpointerexception when trying service. @override public void onresume() { new asynctask<void, void, boolean>() { @override protected boolean doinbackground(void params) { homecoming activity.getmyservice().dosomeinit(); // getmyservice() returns null } @override protected void onpostexecute(boolean result) { somebutton.enabled(result); } }.execute(); } the activity connect service, how can tell fragment service ready used (and hence no longer null)? i assume setting variable activity getactivity

c# - Save checked row of one dataGrid into another dataGrid -

c# - Save checked row of one dataGrid into another dataGrid - i have simple datagrid stores info returned in json format in it. have added unbound checkbox column it. want store checked rows in datagrid. how should proceed. my code protected void btnsave_click(object sender, eventargs e) { foreach (datagriditem item in this.gv1.items) { checkbox chkbox = (checkbox)item.findcontrol("chkrows"); //if it's selected add together our new datagrid if (chkbox != null && chkbox.checked) { //save } } } datasource 1st grid searchapirequest.defaultapikey = "samplekey"; searchapirequest request = new searchapirequest(rawname: txtuser.text); seek { searchapiresponse response = request.send(); datatable dt = new datatable(); dt.columns.add("website"); dt.colum

android - Optimizing my App for multiple screen resolutions -

android - Optimizing my App for multiple screen resolutions - i've finished app, , looks great on nexus 1 emulator (400x800 screen) while testing app, found out doesn't scale on larger displays. there can prepare in layout prepare scaling issues? *note, 1 of testers of app using lg g3 (2560x1440) screen, , lot of elements didn't fill screen in emulator. screenshot below, , here layout file: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:id="@+id/rlmain" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#bbcde3" android:orientation="vertical" > <gridlayout android:id="@+id/gridlayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" and

python - Print bash command result in Gtk Textview -

python - Print bash command result in Gtk Textview - i want print file attributes using bash command , write result in textview. here path selected through select button.file path stored in text. os.system("stat"+text+"") prints on terminals.i want store result of command. class="snippet-code-css lang-css prettyprint-override"> #/usr/bin/python import pygtk,gtk,os class project: def enter_callback(self,widget,entry): entry_text=entry.get_text() print("entry contents: %s \n" % entry_text) def file_ok_sel(self,w): print("%s " % self.filew.get_filename()) text=self.filew.get_filename() print(text) os.system("stat " + text + "") def button1_select(self,widget,data=none): self.filew=gtk.fileselection("file selection") self.filew.connect("destroy",self.destroy) self.filew.ok_button.connect("clicked",self

java - Can not print in Text area from same class? -

java - Can not print in Text area from same class? - i want print in text area named arena . calling append method same class no luck far. how print string in text area?? public class chat_window extends javax.swing.jframe implements runnable { public static datainputstream in = null; public static printstream out = null; private static socket cs = null; private static bufferedreader zz; private static boolean live = true; public chat_window() { initcomponents(); } public static void main(string args[]) { java.awt.eventqueue.invokelater(new runnable() { @override public void run() { chat_window w=new chat_window(); w.setvisible(true); } }); seek { cs = new socket("localhost", 3333); out = new printstream(cs.getoutputstream()); zz = new bufferedreader(new inputstreamreader(system.in));

javascript - Show div and move to top of page -

javascript - Show div and move to top of page - this question has reply here: animate scrolltop not working in firefox 10 answers at moment i'm showing/hiding div box when click button: $j('#button').click(function () { $j('#box').slidetoggle(); homecoming false; }); but move box top of page when it's shown , hide when clicked again. code below doesn't seem work: $j('#button').click(function () { $j('#box').slidetoggle(); $j('html').animate({ scrolltop: $j('#box').offset().top },400); homecoming false; }); am doing wrong? you have set animate statement box, too. i created demo you, hope understood want :-) demo toggle hidden div , move top of window $('#button').click(function() { $('#box').slidetoggle(); $('#box').animate({ top: 0

mysql - How can i get number of entries and column name in a unique select? -

mysql - How can i get number of entries and column name in a unique select? - i have next table: idcolumn name role status 1 peter ope 0 2 peter adm 1 3 jon ope 1 4 mac adm 1 5 jon adm 0 6 peter sec 1 what wanted column name , number of entries each 1 in single query. select name, count(*) table status = 1; exit example: --------------- name | count()| --------------- peter| 2 | jon | 1 | mac | 1 | --------------- this basic group by query: select name, count(*) table status = 1 grouping name; if going utilize sql, should larn basics. group by , join basics of sql language. mysql select count columnname

c# - Keep getting WIN32Exception when running FFMPEG in ASP.NET project -

c# - Keep getting WIN32Exception when running FFMPEG in ASP.NET project - i have asp.net project , want utilize ffmpeg help create thumbails videos. i've loaded ffmpeg project, , whenever run code same error: 'ffmpeg.mainmodule' threw exception of type 'system.componentmodel.win32exception' {"a 32 bit processes cannot access modules of 64 bit process."} i'm using vs 2013, , i've set target platform x86, , made 100% sure using 32bit version of ffmpeg. i'm using static libraries site (http://ffmpeg.zeranoe.com/builds/) tried alter target platform cpus or x64, , tried both 32 , 64 bit versions of ffmpeg. same error. running iis express when test in local environment. here code. appreciate help! string vsource = "http://example.com/myvideo.mp4"; string path1 = httpcontext.current.request.physicalapplicationpath; process ffmpeg = new process(); processstartinfo startinfo = new processstartinfo(hostingenvironment.mapp

stata - Compare each obs with rest of its sub-group -

stata - Compare each obs with rest of its sub-group - i have next goal regarding info structure group; month; year; next_year 1; february; 2014; 0 1; march; 2006; 0 1; november; 2013; 1 2; january; 2014; 0 3; january; 2004; 0 i have group , month , year , column next_year needs generated first three: each observation, want check if there observation within same grouping has date-value falls period of next year. if so, want set value of next_year 1, otherwise 0 (see example). i started converting date format stata can interpret - using ym(month, year) - such can create comparisons. however, not sure how iterate on observations within grouping in order determine if case or not. i know how in e.g. java, don't stata. suppose should not start loops there implemented commands such problems. if want check if there next observation within next 12 months, can try: clear set more off *----- illustration info ----- input grouping str8 month year 1 mar