Posts

Showing posts from August, 2015

php - recursive directory iterator results: filter out specific characters from resultant paths -

i'm trying return unique instances paths specified directory, recursively. i'm using recursivedirectoryiterator . omit instances of paths contain '.' in them, i'm having trouble. here's i've got going test: <?php function test($dir){ $dirarray = []; // array store dirs $path = realpath($dir); $dirs = new recursivedirectoryiterator($path, filesystemiterator::skip_dots); $objects = new recursiveiteratoriterator($dirs, recursiveiteratoriterator::self_first); // loop through objects , store names in dirarray[] foreach($objects $name => $object){ if($object->isdir() && strpos($object->getbasename(), '.') !== true) { $dirarray[] = $name; echo "test: " . $object->getbasename() . "\n"; } } print_r($dirarray); } test('/some/dir'); ?> this code nearly need. returns unique dirs, includes '.' in path name. ...

linux - webstorm license in virtualbox, ubuntu 14.04.1 -

i have installed webstorm 9 on oracle virtualbox , follwing error: -virtualbox:~/downloads/webstorm-139.252/bin$ ./webstorm.sh [ 317] error - nse.impl.generallicensemanager - no valid license found java.lang.throwable @ com.intellij.openapi.diagnostic.logger.error(logger.java:115) @ com.intellij.ide.a.g.bb.a(bb.java:107) @ com.intellij.idea.mainimpl$1.start(mainimpl.java:47) @ com.intellij.idea.startuputil.prepareandstart(startuputil.java:105) @ com.intellij.idea.mainimpl.start(mainimpl.java:42) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ com.intellij.ide.plugins.pluginmanager$2.run(pluginmanager.java:91) @ java.lang.thread.r un(thread.java:745) [ ...

mysql - syntax error or access violation 1064 php pdo -

$stmt = $dbh->prepare("select menulist_tbl menulist_id=:menuid"); $stmt->bindvalue(':menuid',$menuid,pdo::param_str); $stmt->execute(); $selected_row = $stmt->fetch(pdo::fetch_assoc); i have select statement syntax error or access violation 1064 in line 471 line $stmt->execute(); cant see error because using same statement before dont error wondering why now you need specify selecting have not. if need select columns select * table_name if need select specific columns then select col1,col2 table_name in case may have as select * menulist_tbl menulist_id=:menuid or if want specific columns selected instead of *

javascript - Adding transparent space to PNG for 3d -

i've got problem have resize images power of 2 load three.js. i've using following resize them: var w = powerof2down(this.width); var scale = w / this.width; var scaledheight = this.height * scale; var h = powerof2up(scaledheight); var scalefactor = ( this.width / w) * ( this.height / h ) * 0.1; photo.scale.normalize().multiplyscalar(scalefactor); function powerof2down(value) { if(value < 80) return 64; else if(value < 150) return 128; else if(value < 400) return 256; else if(value < 800) return 512; return 1024; } function powerof2up(value) { if(value <= 64) return 64; else if(value <= 128) return 128; else if(value <= 256) return 256; else if(value <= 512) return 512; return 1024; } this works in places, scales much. i'm wondering adding white space sma...

Flex List Within a List? -

Image
i trying display small set of hierarchical data , have found advanceddatagrid terrible in how handles layout going try , approach way using spark lists. i getting mysql database arraycollection of lessons. each lesson has parent topic (i have included topicname field within each lesson ease) , want display lessons after grouping them respective topics. i create hierarchical data structure, possibly using groupingcollection2, , wondered if display spark list of topics , within topicitemrenderer create display spark list of lessons given topic? any thoughts welcome. chris to create grouped list of data replaced advanceddatagrid spark list within spark list. has layout predictable , sizes properly. in case know have display approximately 20 items in grouped list don't have performance issues. this how did it: general - created new mxml component dedicated list of lessons. organise code following model, view, presenter pattern created lessonlist_view (mxml) , ...

ruby on rails - How to remove the cancelled migration from the db folder -

i want remove migration application. i have migration file 20141105030942_removedate_fromexpense.rb the class file migrations class removedatefromexpense < activerecord::migration def change remove_column :expenses, :date, :date end end when give command: rake db:migrate:down version=20141105030942 i following error: == 20141105030942 removedatefromexpense: reverting ============================ -- add_column(:expenses, :date, :date) rake aborted! standarderror: error has occurred, migration canceled: sqlite3::sqlexception: duplicate column name: date: alter table "expenses" add "date" date/home/sumyvps/.rvm/gems/ruby-1.9.3-p545@railstutorial_rails_4_0/gems/sqlite3-1.3.8/lib/sqlite3/database.rb:91:in `initialize' db:migrate:status migration file below 20141105030942 removedate fromexpense has idea why happening? you not need specify column type in migration file. name of table , column enough remove column table. e...

java - Spring Batch Transaction Exception:Existing transaction detected in JobRepository -

i trying , exception: java.lang.illegalstateexception: existing transaction detected in jobrepository. please fix , try again (e.g. remove @transactional annotations client). is there have encountered problem? @transactional(propagation = propagation.required) public void method1() // method must transactional { ... /*code call jms services*/ method2(); } @transactional(propagation = propagation.not_supported) public void method2() { batchservice.runjobwithid(123l); } try removing @transactional(propagation = propagation.not_supported) method2()

Extjs Grid updating Issue in Date Field -

i have 3 datefield in grid , when updating in row, shows red mark on date field means date fields modified not making change in date field. i tried find out problem , got following reason: context.originalvalues.datecreated : 11/10/2014 context.originalvalues.datemodified : 11/10/2014 context.originalvalues.lastlogin : 11/10/2014 and context.newvalues.datecreated : mon nov 10 2014 00:00:00 gmt+0530 (ist) context.newvalues.datemodified : mon nov 10 2014 00:00:00 gmt+0530 (ist) context.newvalues.lastlogin : mon nov 10 2014 00:00:00 gmt+0530 (ist) so, grid shows these dates columns updated. there way solve issue. thanks in advance. solved issue :) the date in store in string format created date object in store, , working fine. used following codes create date object in store. { name: 'lastlogin', type: 'date', dateformat: 'n/j/y', convert: function (newvalue, model) { return new date(model.get('lastlogin...

r - Multi windows range calculations data.table vs dplyr -

i'm doing range calculations (i.e. max , min) on multiple windows on stocks returns. have version in dplyr, many people publishing benchmarking calculations data.table faster. i've created version data.table syntax, it's slower dplyr one. me find better way use data.table make faster? many thanks. library(quandl) library(tidyr) library(dplyr) library(data.table) library(microbenchmark) tickers <- c("goog/nasdaq_aapl", "goog/nasdaq_msft", "goog/nyse_ibm", "goog/nasdaq_goog") data <- quandl(tickers,transformation = "rdiff") returns <- gather(data, stock, value, -date) %>% separate(stock, c("name", "field"), " - ") %>% filter( field == "close" ) %>% select( - field ) returns_dt <- data.table(returns) multi_window_range <- function(data) { result_1y <- data %>% filter( date ...

javascript - Changing Angular $location.path in response to a push service -

i making angular/ionic app needs change views in response push notification google's cloud messaging service . each view has it's on associated controller. at moment, code set following: have push service, receives push notification, , broadcasts message on root scope interested controllers: self.onnotificationgcm = function(data){ switch(data.event){ case "cancelled": $rootscope.$broadcast("ordercancellation", data.payload); break; case "completed": $rootscope.$broadcast("ordercompleted", data.payload); break; default: break; } } on particular controller, listener might this: $scope.$on("ordercompleted", function(event, data){ $location.path('completedorder'); $rootscope.$apply(); } the problem code causes error when event fired: cannot read property '$$nextsibling' of null it seems if change of ...

Grails and MongoDb (persistent instance deletion) -

if have grails application have used persist domain objects database (mongodb in case not matter), , modify domain class, add more properties or take properties away. now, modified version of application newer version of domain class still recognize persisted old version of domain instances? more importantly if restart grails application new version of domain class, delete(or to) persisted old versions of domain objects? trying chase similar issue facing on team i'm not sure if application deleted old objects db (which don't think so) or did human system user. the way in grails handles database depends on value of dbcreate property in datasource.groovy. if declare datasource { dbcreate = "update" } then additional properties add domain class added columns in database. note not delete columns exist. had property called x , wanted replace property called y, create y column in database x column still remain. here list of possible values , beh...

jboss7.x - JBoss AS 7.3 vs 7.4 and differences -

i can find eap component differences, can find differences between jboss 7.3 , 7.4? trying decide between two. the differences same eap, because eap 6.3.0 ga built 7.4 , eap 6.2.0 ga built 7.3 . eap code repository forked/rebased as7 after 7.2.0 tag . and such has own lifecycle , has diverted considerably as7/wildfly (upstream) repository. in short there no such thing jboss 7.3 or 7.4 internal version. code eap releases available on ftp , can build , use without restrictions ( ftp://ftp.redhat.com/redhat/jbeap/ ). you can see component details in https://access.redhat.com/articles/112673 i hope help.

Error 302 Google Sheets PHP SDK -

i've been trying add listelements listfeed , it's working. problem after requests error message : error in google request (error code: 302). i've searched alot of places, couldn't find answer. here code : //google initialization $client = new google_client(); $client->setclientid(gappid); $client->setclientsecret(gappsecret); $client->refreshtoken(gapprefreshtoken); $auth = $client->getaccesstoken(); $tokenresponse = json_decode($auth); $gtoken = $tokenresponse->access_token; //getting list feed $servicerequest = new defaultservicerequest($gtoken); servicerequestfactory::setinstance($servicerequest); $spreadsheetservice = new google\spreadsheet\spreadsheetservice(); $spreadsheetfeed = $spreadsheetservice->getspreadsheets(); $spreadsheet = $spreadsheetfeed->getbytitle($gconfig["spreadsheettitle"]); $worksheetfeed = $spreadsheet->getworksheets(); $worksheet = $worksh...

reporting services - Issue with SSRS report with temp table -

to clear @ moment. not use stored procedure create temp table! i new ssrs reports , trying complete large report. have multiple datasets using pretty same information in each. tried creating temp table in first dataset , in last dataset dropping table report not running. have questions. say example have following ----------------- -------------- |data-set 1 |---------------------------|data source | |===============| | |============| |input | | |use single | |===============| | |transaction | |@mydate | | |enable | |@processorid | | |============| |===============| | |variables | | |===============| | |@startdate | | |@enddate | | |create #table | | |---------------| | |insert data | ...

jquery - element moves after click event -

i have custom dropdown works fine, except when click toggle starting element moves. have ideas? have tried changing code around width position etc. html: <div class="element" style="position: absolute; right: 200px; top:50px; color: white; cursor: pointer;"> <span class="my-dropdown" href="#" id="user-name"> john doe <span style="font-size:smaller;">&#9660;</span> </span> <ul class="my-dropdown-menu" data-for="user-name"> <li><a href="#">logout</a></li> <li><a href="#">change password</a></li> <li><a href="#">profile</a></li> </ul> </div> css: .my-dropdown-menu a, .link { color: black; } .my-dropdown-menu a:visited, .visited { color: black; } .my-drop...

c# - Can I set up a unit test to run many times and return the percentage success? -

i new unit testing, , have been scouring web, trying figure out how further automate unit tests. building registration scheme, , want test variety of hard drive serial numbers, app numbers, etc. want generate registration key , check make sure decodes properly. looking automate running test (with integrated visual studio test environment) variety of inputs, , after thousands of runs, find out % of tests successful , unsuccessful. possible? below test method: [testmethod] public void generatingvalidkeytest() { int numreaddevices; string appnum = "123"; string hddserial = "1234567890"; string numdevices = "12"; string regnumber = registration.generatekey(appnum, numdevices, hddserial); assert.istrue(registration.checkkey(regnumber, appnum, out numreaddevices, hddserial), "generated key not pass check."); assert.areequal(int.parse(numdevices), numreaddevices,"number of r...

node.js - What happens under the hood when I type "Node server.js" -

is "instance" of node? special provisions os node instance get? if asking if there 1 big process of node, executes scripts, or if each script executed own instance, answer second. each script has own node instance. far know, each instance has same provisions bash, python, perl, etc have. try ps ax|grep node see current instances in execution.

python - Unable to do a simple cycle and list interaction to replace values on an array (list of lists) -

basically want switch every number above, below, left , right of number 1, in each iteration. (consider # number one, , ' ' number 0: --------------------- | | | | | | --------------------- | | | | | | --------------------- | | | # | | | --------------------- | | | | | | --------------------- | | | | | | --------------------- --------------------- | | | | | | --------------------- | | | # | | | --------------------- | | # | # | # | | --------------------- | | | # | | | --------------------- | | | | | | --------------------- --------------------- | | | # | | | --------------------- | | # | # | # | | --------------------- | # | # | # | # | # | --------------------- | | # | # | # | | --------------------- | | | # | | | --------------------- --------------------- | | # | # | # | | --------------------- | # | # | # | # | # | --------------------- | # | # | #...

android - Access Button's LinearLayout through its OnClickListener -

i have few buttons in linearlayout . both dynamically created. there way can access linearlayout through button ? set linearlayouts id's 0 or 1. want buttons if in linearlayout equal 1. code: linearlayout linearlayout = new linearlayout(view.getcontext()); linearlayout.setid(1); button dynamicbuttons = new button(view.getcontext()); ... ... ... linearlayout.addview(dynamicbuttons, layoutparam); so added button linearlayout . can button's onclicklistener : dynamicbuttons.setonclicklistener( new view.onclicklistener() { public void onclick(view view) { if (dynamicbutton.getparentview().getid()==1){ //when click button, want access linearlayout button in //do } } }); of course line dynamicbutton.getparentview().getid()==1 wrong. how can access button's linearlayout? you on right track. need cast linear layout. dynamicbuttons.setonclicklistener( new view.onclicklistener() { ...

design - android sdk, change action bar color to a solid color (no fading) -

so in apps push bullet have action bar solid background color, no fading ever. how accomplish while still keeping minimum api level 14. tutorials saw did not work, app randomly crashes when using themes too. edit fixed problem simply. men't shadow @ bottom of action bar... i went themes , added this <item name="android:windowcontentoverlay">@null</item> you can change action bar color or can set background using drawable try this. <resources> <style name="appbasetheme" parent="android:theme.light"> <item name="android:background">@color/custom_bg_coolor</item> </style> <style name="apptheme" parent="appbasetheme"> <item name="android:actionbarstyle">@style/myactionbar</item> </style> <style name="myactionbar" parent="@android:style/widget.holo.light.actionbar"> <item name="android:background...

java - using a loop get a user to input an integer 10 times then get the minimum -

i've got homework assignment need write program using loop takes 10 integer values user , outputs minimum of values entered. here i've got: import java.util.scanner; public class num52 { public static void main (string [] args ) { int value; int minvalue; scanner scan = new scanner(system.in); for( int = 0; < 10; i++ ) { system.out.print( "enter number integer > " ); value = scan.nextint( ); if( value < minvalue ) minvalue = value; } system.out.println( "the minimum number " + minvalue ); } } you have forgotten initialize minvalue. try in loop if (i == 0) minvalue = value; or can intialize before loop this minvalue = interger.max_value; //this more efficient code.

c - How to go all reference of a text in whole project using vim -

i know simple question , there huge source of information not able find solution question. i have tried cscope , got references once in file not find way go go next occurrence. i know use of ctrl+] ctags not want.i want go reference of text 1 one . like when want change prototype of function , want go 1 one. hope there way it. you looking :tnext , :tprevious . read following topics: :help tags :help ctags :help cscope but here generic "search/replace in project" method… search string in whole project , list matching lines in quickfix window: :vim foo **/*.py | cw record change in simple macro: qq ciwbar<esc> :cnext<cr> q repeat change every match in list: @q @@ @@ … skipping irrelevant matches :cnext . and one… open new tab: :tabnew<cr> populate local argument list files contain search pattern: :arglocal `grep -rl foo *.js`<cr> perform global search/replace on every file in local argument list :...

Matlab vs Python 2D convolution performance -

i prototype algorithms in matlab, have requirement of putting them on server runs quite bit of python code. hence converted code python , compared two. matlab implementation runs ~1000 times faster (from timing function calls - no profiling). know off hand why performance of python slow? matlab % init random data w = 800; h = 1200; hmap = zeros(w,h); npts = 250; i=1:npts hmap(randi(w),randi(h)) = hmap(randi(w),randi(h))+1; end % params disksize = 251; nbreaks = 25; saturation = .9; floorthresh =.05; fh = fspecial('gaussian', disksize, disksize/7); hmap = conv2(hmap, fh, 'same'); % scaling, paritioning etc hmap = hmap/(max(max(hmap))); hmap(hmap<floorthresh) = 0; hmap = round(nbreaks * hmap)/nbreaks; hmap = hmap * (1/saturation); % show image imshow(hmap, [0,1]) colormap('jet') python import numpy np scipy.signal import convolve2d conv2 # test data parameters w = 800 h = 1200 npts = 250 # generate data xvals = np.random.randint(w, size=n...

php - Dynamic Dropdown option in a list with image -

i trying dropdown option result in list respective image, gives other picture...here partial codes, suggestion bro? <?php $university=$_get['university']; $sql=mysql_query("select univ university univ='$university'"); while($row=mysql_fetch_assoc($sql)){ ?> <li> <select> <option value='<?php echo $row['univ'] ;?>'> <?php echo $row['univ'] ;?> <?php echo '<img src=abu.png width:"20"height="20">';?> </option> </select> </li> <?php } ?> as comments said, code formation not correct. see example below right formation. note: dont use mysql_* anymore because it's deprecated, use mysqli_* or pdo . <?php $university=$_get['university']; $sql=mysql_query("select univ university univ='$university'"); ?> <select> <?php while($...

loops - SPSS Looping across multiple string variables to find duplicates -

i have long list of records text names in 2 columns, x1 , x2. want compare x2 names x1 names , identify match instance of x1 , note in temp variable. i've tried looping through 2 columns (see syntax below) "y" @ every record. i hope can show me correct syntax. thanks bren string temp(a1). compute temp= "n". vector x=x1 x2. loop #i=1 77700. loop #j = (#i+1) 77700. if x(#i)=x(#j) temp = "y". end loop. end loop. execute. i believe solved problem. compute index=$casenum. sort cases name1. string key (a63). compute main=name2. aggregate outfile * / break name1 / found=n. rename variables name1=main. match files file index / table * /in=match / main . sort cases index. thanks viewed , thinking problem me.

c# - Which Icon corresponds to a tentative filename? -

Image
i have file on binary in database, i'm not loading until user double clicks on item (with it's icon) extractassociatedicon should solving (i've seen here: extractassociatedicon returns null ) but asks for existance of document on path , (which don't have), how can associate extension of tentative file (example: "something.docx" ) extension user has associated on pc icon should show? @edit: may able pull out content (byte[]) database, if useful icon asociated image. (however, may take forever transfer each file byte[] set icon image). also this example of @matthewwatson using takes 8 seconds on each object value = rkfileicon.getvalue(""); line, has 8.4k items iterate. @@edit: tried public static icon geticonoldschool(string filename) { ushort uicon; stringbuilder strb = new stringbuilder(filename); intptr handle = extractassociatedicon(intptr.zero, strb, out uicon); icon ico = icon.fromhandle(h...

3d - How can I render the same texture with different colors? -

Image
i have simple texture of white shape on black background, , want ability specify different color white part, without changing source texture: is there built-in way in libgdx, or have write custom shader (and if so, best way that)? note: i'm using 3d api, question in context of modelbatch, materials, , how used render 3d geometry. as turns out, if material has textureattribute.diffuse, , colorattribute.diffuse, color value derived texture multiplied value defined color attribute, can seen in default fragment shader : #elif defined(diffusetextureflag) && defined(diffusecolorflag) vec4 diffuse = texture2d(u_diffusetexture, v_diffuseuv) * u_diffusecolor; so, case, can set value of color attribute, , produce desired results -> black portions of texture remain unchanged, because 0 (black) multiplied x result in zero; white portions of texture change whatever color set via color attribute, because 1 (white) multiplied x result in x.

php - Symfony2 FOSOAuthServerBundle grant type password requires client secret -

i'm integrating fosoauthserverbundle handle login mobile app symfony2 backoffice. i've followed instructions of this answer , i've never used oauth2 before i'm bit lost sometimes. i tried logging in using 'password' grant_type reason won't work unless specify client_secret get parameter. supposed ? here's request looks like: http://myserv.local/app_dev.php/oauth/v2/token ?client_id=1_4up4x3hpaask4g0sok0so8sg00gk48c44cc0wkwwsg8048wcog &grant_type=password &username=test@test.com &password=somepassword it returns response unless client_secret parameter added: {"error":"invalid_client","error_description":"the client credentials invalid"} yes, supposed include client secret. once make request, access_token can used each each future request don't need use credentials or client info again until access_token expires. , when token expires, won't need use user crede...

actionscript 3 - Loader - Error #2036: Load Never Completed (random times) -

some computers windows 7 keep getting #2036 error few or more days, , other not (everything loaded correctly). its not wrong path or case sensitive file name, because works , official youtube code. using var loaderreferences:dictionary = new dictionary(); var loader:loader = new loader(); loaderreferences[0] = loader; to avoid gc didn't help. using loader.load(new urlrequest( "http://www.youtube.com/apiplayer?version=3&nocache="+new date().gettime())); to avoid cache didn't help. clear flash cache didn't help. update flash player didn't help. flash has access internet , load else, different domain success. i read lot in google , tried every solution found. security.allowdomain("www.youtube.com"); var loader:loader = new loader(); loader.contentloaderinfo.addeventlistener(event.init, onloaderinit); loader.contentloaderinfo.addeventlistener(ioerrorevent.io_error, nofile); loader.contentloaderinfo.addeventlistener(...

apache - 301 redirect entire domain to corresponding URL on new domain - EXCEPT for one directory -

as title says, migrating website olddomain.com newdomain.com . have htaccess 301 redirect in place in web root of olddomain.com follows redirects request olddomain.com/any/url same corresponding url on newdomain.com : rewriteengine on rewritebase / rewritecond %{http_host} !newdomain.com$ [nc] rewriterule ^(.*)$ http://newdomain.com/$1 [l,r=301] my question is, how can modify rewrite rule exclude 1 specific directory? olddomain.com/downloads continue serve file mirror, need exclude olddomain.com/downloads (and subdirectories such /releases , etc) original site-wide 301 redirect such request url on olddomain.com redirected corresponding url on newdomain.com exception of request file or directory lives inside olddomain.com/download . edit mentioned in comments below, need exclude olddomain.com/getlatest.php redirect, since generates download link relies on parsing server directory structure. you can use negative condition in rewriterule : rewriteengine on ...

ExtJS/CSS--button css styling not showing in IE8 -

i added minor css styling button , works fine in firefox , chrome not ie css .search-button { background:#00a300 !important; border-radius:20px !important; background-image: none !important; } .search-button .x-btn-inner { color: #ffffff !important; font-size: 13px !important; } button xtype: "button", itemid:"searchbtn", text: "<b>search &gt;&gt;</b>", formbind: true, cls:"search-button" //basecls:null thanks edit: 1 thing noticed when hover on button or click it, shows background color around border disappears on mouseout or depress of button

assembly - Warning: Function must be extern error in C -

i following along tutorial c programming in 6502 assembly , having great deal of difficulty on 3rd step. when compiling code in command line, these errors: test4.c(8): error: '{' expected test4.c(9): warning: function must extern test4.c(9): error: ';' expected test4.c(13): error: '}' expected i using program compile .c files made in code::blocks .nes files. current tutorial having me make .s assembly file when compiling in cl65 command line in windows program compiling it. here link tutorial page on: https://helloacm.com/tutorial-3-c-programming-in-6502-using-assembly/ i have tried many different combinations of code can think of try , rid of least of problems, alas no avail. amateur in c, use c++ cannot , still trying figure out. not able find "function must extern" error anywhere quick google search either. have idea what's going on? here how wrote code in code::blocks: void main() { asm("nop"); } void testasm...

javascript - How to insert date into mongo from JSON file -

i have .json file contains object date. how can make sure date field inserted "date" datatype in mongo? i need done via node.js. { "name": "jeff johnson", "email": "jeff@gmail.com", "phone": "5555555555", "date_added": "2014-01-22t14:56:59.301z" } the core of json using not "preserve" "data type" "date" determined , in fact represented "string". other side of course mongodb in fact "schemaless", there no inherent information available "database" field should date. with in mind, there few approaches vary "current" implementation "future" considerations. however parsing data ( , there many parser implementations out there ), "your" application logic "know" field in fact "date", , handle translation itself. down document level: var obj = json.parse(sing...

c++11 - How to iterate over a std::tuple in C++ 11 -

this question has answer here: iterate on tuple 9 answers i have made following tuple: i want know how should iterate on it? there tupl_size() , reading documentation, didn't how utilize it. have search so, questions seem around boost::tuple . auto = make_tuple("i good", 255, 2.1); here attempt break down iterating on tuple component parts. first, function represents doing sequence of operations in order. note many compilers find hard understand, despite being legal c++11 far can tell: template<class... fs> void do_in_order( fs&&... fs ) { int unused[] = { 0, ( (void)std::forward<fs>(fs)(), 0 )... } (void)unused; // blocks warnings } next, function takes std::tuple , , extracts indexes required access each element. doing so, can perfect forward later on. as side benefit, code supports std::pair , std::arr...

javascript - Run a php line again after updating a row in the database -

if possible run again php line after update table in database? i have html button fire jquery.post: btn.onclick = function(e) { $.post('inc/pstpts.php', { pts: pts }); } in pstpts.php make query , update target row success. had loaded row in html this: <?php ($i=0; $i < $q->query_numrows(); $i++) { print '<tr><td>' . $d[$i]['user_nom'] . ' '; print '<tr><td>' . $d[$i]['user_ape'] . ' '; print '<tr><td>' . $d[$i]['user_email'] . ' '; print '<tr><td>' . $d[$i]['user_cel'] . ' '; } ?> but had loaded old data. i want run 5 lines after update. since have less code, post pseudocode give idea. server side: //get inputs $_post // update database $update = $db->update($_post); //simplified. example if($update !== false) { $entry =...

How to segmentation object c# -

i used code segmentation, i'm trying detect pixels 1 one because object binary, not grayscale. when run program, draws 2 object. first object drawn (object still has black color , red rectangle), second object fails drawn. screenshot here . please me, why happen? #region edge detection private void btnsegmentasi_click(object sender, eventargs e) { segments = new list<imagesegment>(); bitmap bmp = (bitmap)pb2.image; imagearea = new rectangle(0, 0, pb2.image.width - 1, pb2.image.height - 1); (int y = 0; y < pb2.image.height; y++) { (int x = 0; x < pb2.image.width; x++) { bool skip = false; foreach (imagesegment segment in segments) { if (pointisinrect(x, y, segment.rect)) { skip = true; break; } } if (skip) continue; color warna = bmp.getpixel(x, y); if (warna....

How to read a image in java and turn it to byte array?[use Lena.bmp 512x512 as example] -

i want analysis pixel of lena.bmp (matlab) don't know how in java , store byte[] i have read aritle: how convert image byte array in java? but when implement, find some pixel value did't exist . example , pixel range 0~255, can not find '120' on pixel of photo(lena.bmp). there code /* * change template, choose tools | templates * , open template in editor. */ package image_io; import java.awt.image.bufferedimage; import java.io.bytearrayoutputstream; import java.io.file; import java.io.ioexception; import javax.imageio.imageio; /** * * @author user */ public class readimage { public static void main (string []args){ byte[] imageinbyte; int [] kindofpixel = new int [256]; try{ bufferedimage originalimage = imageio.read(new file("c:\\users\\user\\desktop\\project\\lsb_implement\\lena.bmp")); bytearrayoutputstream baos = new bytearrayoutputstream(); imageio.write( originalimag...

gridview - Resize selection column width in WPF GridControl -

Image
could resize width of selection column in wpf gridcontrol (yellow area)? this row indicator panel : can use tableview.indicatorwidth property resize width.

android - Can I position a TextView based on center position of another TextView? -

i have 3 initial textviews @ top (textview1, textview2, textview3). have textview label expands across whole width of screen. below label have 3 more textviews wish position @ horizontal centre of top 3 textviews'. there can put in xml achieve this? not find appropriate constraints. find centre horizontal parent. here picture example want like: http://i57.tinypic.com/21zq03.png i using relative layout. use layout_gravity - <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:orientation="horizontal" android:weightsum="1" > <textview android:id="@+id/text1" android:layout_width="0dp" android:layout_height="40dp" android:layout_weight="0.33" /> <textview android:id="@+id/text2" android:layou...

function - Cscope output all parameters -

there limitation of 1 line per cscope entry, e.g. type func(type param1, type param2, type param3, type param4) will give type func(type param1, type param2, cscope entry. i need cscope output parameters in function definitions , calls. i not sure achievable. however, workaround use grep , more "flexible" , parse output of: grep -ri -a 2 "type func" . this print lines contains "type func" , -a 2 2 following lines. can use regex output until closing ) of function declaration.

java - How to retrieve all entity with different column value? -

in following criteria query criteria criteria = createlogrecordcriteria(maxid, playerid, playerstatus, usercategory, from, to); criteria.setfirstresult(offset); criteria.setmaxresults(limit); criteria.setprojection(projections.distinct(projections.property("player"))); list lst = criteria.list(); return lst; i retrieve set of different player s , need retireve entities different player value. how can done through criteria ? believe this query searching for. for below query: select t table t t.player in (select distinct t.player table t ); if detachedcriteria feasible option, subcriteria can passed maincriteria written below (provided subcriteria should defined detachedcriteria): criteria subcriteria = criteria.forclass(table.class); subcriteria.setprojection(projections.distinct(projections.property("player"))); criteria maincrit...

linux - Logstash too many files opened? -

i running logstash 1.4.1 , on running getting following on console: failed open /home/desktop/input/2014-11-03/abc.log: permission denied - /home/desktop/input/2014-11-03/abc.log {:level=>:warn} failed open /home/desktop/input/2014-10-14/abc.log: permission denied - /home/desktop/input/2014-10-14/abc.log {:level=>:warn} failed open /home/desktop/2014-10-16/abc.log: permission denied - /home/desktop/input/2014-10-16/abc.log {:level=>:warn} .............. log4j, [2014-11-13t16:20:04.583] warn: org.elasticsearch.discovery.zen: [logstash-hp-pro-3330-mt-7573-11818] failed connect master [[kyle gibney][em0zmukaqpaxd6_n4jwjza][-hp-pro-3330-mt][inet[/xx.xx..xx..xx:9300]]], retrying... org.elasticsearch.transport.connecttransportexception: [kyle gibney][inet[/xx.xx.xx.xx:9300]] general node connection failure @ org.elasticsearch.transport.netty.nettytransport.connecttonode(nettytransport.java:668) @ org.elasticsearch.transport.netty.nettytr...

java - FileNotFoundException running JBehave (Maven Project, IntelliJ) -

firstly, i'd i'm .net developer who's temporarily working on java project. i'm familiar specflow , seems jbehave similar. i'm trying basic story run in project, try seems fail same exception java.io.filenotfoundexception: c:\source\dataloader\target\jbehave\storydurations.props (the system cannot find file specified) @ java.io.fileinputstream.open(native method) @ java.io.fileinputstream.<init>(fileinputstream.java:120) @ java.io.filereader.<init>(filereader.java:55) @ org.jbehave.core.reporters.templateableviewgenerator.storydurations(templateableviewgenerator.java:123) @ org.jbehave.core.reporters.templateableviewgenerator.generatereportsview(templateableviewgenerator.java:115) @ org.jbehave.core.embedder.embedder.generatereportsview(embedder.java:249) @ org.jbehave.core.embedder.embedder.generatereportsview(embedder.java:237) @ org.jbehave.core.embedder.embedder.runstoriesaspaths(embedder.java:213) @ org.jbehave.core.junit.junitstories.run(jun...