Posts

Showing posts from June, 2014

website - Google Rich Snippet - Error with review count -

i have implemented google rich snippets on web pages. when tried use review aggregate snippets, gives me below error: " if count specified in review aggregate, page should contain reviews. otherwise may want use votes " i have got reviews on page why google this. because use aggregate reviews each item must include @ least 1 of either count or votes. if page can accept users votes without reviews (reviews not mandatory vote in other words), should use "votes" property, not "count"

how to set an OCR language in Google Drive -

i need upload image google drive including ocr feature. the problem setocrlanguage method. need specify hebrew language , based on iso 639-1 codes should "heb". i'm getting response "code" : 400, "errors" : [ { "domain" : "global", "location" : "ocrlanguage", "locationtype" : "parameter", "message" : "invalid value", "reason" : "invalid" } ], any idea should code or can list of avaliable codes?

java - Cannot run mvn clean -

when run "mvn clean " getting error message below on windows 7 pc. tried re-installing maven still error not solved. other command except mvn clean running fine. [info] scanning projects... [info] [info] using builder org.apache.maven.lifecycle.internal.builder.singlethreaded.singlethreadedbuilder thread count of 1 [info] [info] ------------------------------------------------------------------------ [info] building springmvc maven webapp 1.0-snapshot [info] ------------------------------------------------------------------------ [warning] pom org.apache.maven.plugins:maven-clean-plugin:jar:2.5 invalid, transitive dependencies (if any) not available, enable debug logging more details [info] ------------------------------------------------------------------------ [info] build failure [info] ------------------------------------------------------------------------ [info] total time: 0.222 s [info] fi...

IBM DB2 9.7 determining default tablespace -

i have db2 9.7 database. have defined specific tablespace, tables go userspace1. now have created 2 new tablespaces , assign 2 tables each of 2 new tablespaces in clause. however, other tables go 1 of 2 new tablespaces too, though have not specified rest of tables! how can rest of tables go previous userspace1 tablespace, without explicitly defining each table? thanks. when no tablespace clause indicated, db2 choose tablespace according next algorithm: if clause not specified, database manager chooses table space (from set of existing table spaces in database) smallest sufficient page size , row size within row size limit of page size on authorization id of statement has use privilege. if more 1 table space qualifies, choose table space in following order of preference, depending how authorization id of statement granted use privilege on table space: 1. authorization id 2. role authorization id granted 3. group authorization id belongs 4. rol...

Cypher Query returning value -

is possible type cast like start n=node(0) match n-[:my_events]->m has(m.node_type) , has(m.day1) , m.node_type='schdule_node' , m.day1<>'' return id(m) order integer.parseint(m.day1) asc toint appears work on http://console.neo4j.org start n=node(0) match n-[:my_events]->m has(m.node_type) , has(m.day1) , m.node_type='schdule_node' , m.day1<>'' return id(m) order toint(m.day1)

java - Send multiple httpRequest by different proxies -

i using httpclient fluent api version 4.3.2 send multiple request various addresses defined user. each address use particular proxy setting. below current code: try { final executor executor = executor.newinstance().auth(proxy, username, password); system.out.println(executor.execute(request.get(uri).viaproxy(proxy)).returnresponse().getstatusline()); } catch (final exception e) { e.printstacktrace(); } i facing problem, when connect address 1 proxy 1 ( correct value of proxy username , proxy password), request send expected. but when add address 2 proxy 1 ( wrong value of proxy username , proxy password), expectation request fail, still connect successfully. i though after send request through proxy, first proxy setting cached somewhere in jvm, , can not set proxy setting request. is there solution this? trying setting proxy prior request execution executor executor = executor.newinstance().auth(pro...

What is the point of void operator in JavaScript? -

i've seen people using void operator in code. have seen in href attributes: javascript:void(0) doesn't seem better javascript:; so, justification of using void operator? explanation of use in links : <snip> this reason bookmarklets wrap code inside void() or anonymous function doesn't return stop browser trying display result of executing bookmarklet. example: javascript:void(window.open("dom_spy.html")) if directly use code returns (a new window instance in case), browser end displaying that: javascript:window.open("dom_spy.html"); in firefox above display: [object window] </snip>

java - Ricoh SDK/J Development -

i have requirement creating simple application showing text says hello world on ricoh printer console. researched , found ricoh sdk/j supported on j2me environment developing applications ricoh printers. curious know there other way create application using simple j2me midlet application. run on ricoh printer console? i'm no expert, i'm 99% sure there no other ways of developing apps ricoh printers. what need develop called xlet, , used in many consumer electronics, printers, stereos, tv set top boxes, blu-ray players run xlets blu-ray discs. (the movie menu stuff see when watch blu-ray disc). xlets may seem bit complex, because there exists many api's development. example, blu-ray discs have additional api not available other xlets. need figure out api's available ricoh printers. (probably core basic ones suspect). do search "getting started xlets", , bet you'll started quick.

node.js - JavaScript .bind(this) causes function to lose name property - bug/feature? -

in node js app, have callback have scope instantiated function, traditionally use .bind(this) register callback. if have name on function (which necessary) .name property lost , function appears [function] incorrect. the example code is: { let http = require('http'); let server = http.createserver(); function myrequestlistener() { console.log(this, this.name); // [function], '' } server.on('request', myrequestlistener.bind(myfakeclass)); server.listen(1811); } without .bind(myfakeclass) name property expected. to see full code base (my real world problem) can view code here @#38 is bug within js/v8 or feature? can't use arguments.callee.caller.name because i'm using node js harmony features meaning run whole thing in strict. affects versions of node 0.11.7 0.11.12 you're not logging name of function name of context, myfakeclass . the name of function is copied when build new function using bind can se...

ios - Populate the Selected value in Picker view -

here problem. had uitableview had add , edit functionality. @ first when click on add button displays picker view 3 components. component 1 contains list of projects (select,proj1, proj2, proj3, proj4). select proj3 , click on submit. data able save in data base. here comes problem. saved data able display in tableview list. when click on respective record, navigates detailed edit page see proj4 not selected in picker view. instead selected select following proj1,proj2,proj3 etc,. here code below. - (void)viewdidload { [super viewdidload]; self.txtstatus.delegate = self; [self loaddata]; [self loadprojects]; [self loadtasks]; [self loadsubtasks]; [self benefits]; txthours.enabled = no; } -(void)benefits { nsstring *benefitpost =[[nsstring alloc] initwithformat:@"username=%@",[self.projectpicker datasource]]; nsstring *benefiturl = @"http://picker.com/getbenefittypes"; nsurl *url = [nsurl urlwithstring:benefiturl...

java - Why Jackson is so slow? -

i use simple jackson code convert object json string, slow. takes 70 milisecond convert 1 object below in machine. did wong? objectmapper myobjectmapper = new objectmapper(); void testjson() { myclass state = new myclass(); try { string result = myobjectmapper.writevalueasstring(state); } catch (exception ex) { } } myclass 4 members myclass { public int a; public int b; public int c; public string d; } i use simple jackson code convert object json string, slow. takes 70 milisecond convert 1 object below in machine. did wong? 70 milliseconds encode , send json message implausible. there little doubt in mind real explanation 70 millisecond measurement artefact of way benchmarked code. probably, didn't allow jvm warm-up effects. so, yes, did benchmarking incorrectly. probably. now found out 3 solutions sending myclass's instance on network: 1: use jackson convert byte[] , se...

joomla - How to modify com_mailto to fit out needs -

i'm developing site company , need modify native component "mailto" fit our needs. i'm working joomla 2.5 i wondering if future updates occur, happen lines i've added, example, in "\components\com_mailto\controller.php"... i haven't find answers on net. also, same reason, i've modified default layout of article. should rename it? , if yes, how, because couldn't (when i've tried article did not display). thanks help before starting edit core joomla components, should should have @ options have. don't believe in editing core file causes problems updates when released, therefore in opinion, have 2 options: i make note of requirements , start looking 3rd party extension caters requirements. if cannot find 3rd party extension , don't particularly want start digging it's code, go developing plugin. plugins used manipulate behavior or , therefore come in extremely handy when require core editing. editing l...

javascript - Alfresco: Add a tag based on the location of the document -

i've been struggling little script should easy implement: i've added rule on folder runs script. script should folderlocation of uploaded or incoming document , add location tag: var url = document.properties.locale.noderef; document.addtag(url); it should this, doesn't work. how should it? your code should follow.first try code replace logic add path. if (!document.hasaspect("cm:taggable")) document.addaspect("cm:taggable"); document.addtag("test"); you can replace "test" accessed path of document.

marklogic - Is it possible to run marklogic7 appbuilder generated application from the file system, not the module database? -

in past used able generate search applications using marklogic's app builder, copy contents of created modules database file system, change configuration of http server , start customizing away. however, doesn't work new marklogic7 applications. when move application modules file system , run app generic rest api page. apparently rest api rewriter script doesn't pick configuration if app modules not stored in database. there way around this? the reason i'd use above workflow can use version control, , automated deployers. having app in modules database severely limits choice of dev tools. while don't think there's direct way you're looking for, using workflow laid out in blog post lets use version control , makes easy script automated deployers. makes use of roxy deployer ( intro ).

mashape api Class 'Unirest' not found error in php code -

i download php source code mashape api https://github.com/composer/composer url install composer git command $ curl -ss https://getcomposer.org/installer | php i include { "require" : { "mashape/unirest-php" : "dev-master" }, "autoload": { "psr-0": {"unirest": "lib/"} } } this line of code in composer.json , create new file test.php name on root directory , include require_once '/test/unirest.php'; $response = unirest::post("http://httpbin.org/post", array( "accept" => "application/json" ), array( "parameter" => 23, "foo" => "bar" ) ); $response->code; // http status code $response->headers; // headers $response->body; // parsed body $response->raw_body; // unparsed body after above process run php source code display class "unirest" not found there way solve this? ...

php - File upload using application/json in POST method -

i using following code send file api developing using application/json method. $file_content = file_get_contents($file_path); $file_api_parameter["file".$i] = base64_encode($file_content); but have heard sending file in manner causes problem if file size large. can tell me, how send large file api using application/json post method? code send post given below $jsondata = json_encode($parameter); $post_response = wp_remote_post( $url, array( "method" => "post", "timeout" => 45, "headers" => $headers, "body" => $jsondata, "sslverify" => false )); update -- files types want upload .pdf, .doc , .txt. right able upload .txt .pdf , .doc api method fails. because f...

c# - Regex to parse string input -

i want use regex parse groups string input = @"(1,2)(3,4)"; regex.matches(input, @"\((\d,\d)\)"); the results not 1,2 , 3,4 spaces. can guys me ? edit: i want 2 groups 1,2 , 3,4. string input = @"(1,2)(3,4)"; matchcollection inputmatch= regex.matches(collegerecord.tostring(), @"(?<=\().*?(?=\))"); for current string 2 outputs: inputmatch[0].groups[0].value; inputmatch[0].groups[1].value; or you can try foreach loop foreach (match match in inputmatch) { } i have not tested code, my working example: matchcollection facilities = regex.matches(collegerecord.tostring(), @"<td width=""38"">(.*?)image_tooltip"); foreach (match facility in facilities) { collegedetaildh.insertfacilitydetails(collegedetaildh._collegeid, facility.tostring().replace("<td width=\"38\">", string.empty).replace("<span class=\...

Fiji error: "No images file selected" when using a macro that calls the plugin 'Average Images' -

i create macro fiji, run using matlab. i average 3 images using plugins>stacks>average images . i used first plugins>macro>record... idea use. here result: run("average images", "add=d:\\corinne\\diabetes_paper_meas\\2013_01_29\\measurement.007_cb\\measurement._cb_frame0_pvar-8bit_combined.tif add=d:\\corinne\\diabetes_paper_meas\\2013_01_29\\measurement.007_cb\\measurement._cb_frame1_pvar-8bit_combined.tif add=d:\\corinne\\diabetes_paper_meas\\2013_01_29\\measurement.007_cb\\measurement._cb_frame2_pvar-8bit_combined.tif"); saveas("tiff", "d:\\corinne\\diabetes_paper_meas\\2013_01_29\\measurement.007_cb\\test.tif"); however, when run macro got error: no images file selected. however, in fiji not need open images run plugin add files through window interface... of course, since running macro not working same error when use following macro: file = getargument; if (file=="") exit ("no argument!"); setba...

ios - Mobile Website - Viewport depending on device-width -

i have mobile website , little problem viewport meta tag in -part. my code: <meta id="testviewport" name="viewport" content="width=640"> it working fine on iphone 4s on ipad 2, doesn't work properly. want viewport set width of users hardware. there way achieve or have read out model type , set viewport switch or if code? thanks in advance. niels edit: here's css. want achieve: let site displayed in device-width. if display-size smaller 640px, should change viewport 640px. not working on ios 7.0, safari: @viewport { width: device-width; } @media screen , (max-device-width: 640px) { @viewport { width: 640px; } } edit#2: fixed using js in of index.html: <meta id="viewport" name="viewport" content="width=device-width" /> <script> if (window.innerwidth < 640){ var vp = document.getelementbyid('viewport'); vp.setattribute('content...

Excel use Wildcards in LOOKUP RANGE -

i know 1 can use wildcards following a1&"*" but possible use wildcards , return range/array? sort of like: a1&"*":a4&"*" table1 columna columnb john123 ? john243 ? john422 ? table2 columna columnb john smith the goal have match function in table1 columnb pull in value table2 columnb columna's both start john. i try table1 columnb values = match( a1 ; table2!a1:a3 &"*") i found answer myself eventually: {=match(a1;table2!$a$1:$a:$4&"*")} make sure press ctrl+sfit+enter when entering.

leaflet - The data is repeated on each tile -

i have few wms layers generated geoserver (data postgis), in leaflet i'm creating layers using both l.tilelayer.wms , l.tilelayer . in both cases have same result - there same data on each tile . data repeated on each tile. data not on correct coordinates. hard explain, can @ enclosed printscreen here . my code this: var sondy = new l.tilelayer.wms('http://localhost:8080/geoserver/archeo/wms?bbox=-556182.167458477,-1031638.88186088,-556085.240458477,-1031526.68186088&width=442&height=512', { version: '1.1.0', layers: 'archeo:sondy_5514>4326', format: 'image/svg+xml', crs: l.crs.epsg4326, maxzoom: 21, transparent: true, attribution: 'map data &copy; archeo' }); var lokalita = new l.tilelayer('http://localhost:8080/geoserver/archeo/wms?service=wms&version=1.1.0&request=getmap&layers=archeo:lokalita%3e4326&styles=&bbox=17.001919195719633,50.3879944052749,17.00420450498308,50.3895...

Yii: change active record field names -

i'm new yii , have table 'student' fields 'stdstudentid' , 'stdname' , etc. i'm making api, data should returned in json. now, because want field names in json 'id' , 'name' , , don't want fields returned, made method in model: public function apifindbypk($id){ $student = $this->findbypk($id); return array( 'id'=>$student->stdstudentid, 'name'=>$student->stdname, 'school'=>$student->stdschool ); } the problem is, stdschool relation , in situation, $student->stdschool returns array fields schschoolid , schname , etc. don't want fields named in json, , don't want fields school returned , add fields of own. there way in yii, or i'll have manually writing methods this? i have been looking same thing. there great php lib named fractal letting achieve it: http://fractal.thephpleague.com/ to explain briefly lib, each of models create transformer doing mappin...

java - Design pattern - different object in, same object returned -

i'm working on android java project , have hunch able use better pattern situation accures in 2 places. i have class wich builds contentvalues (basically key/value object) inputed model/object , returns contentvalue object have different key/values depending on object i'm inputing. currently, there method each object want generate contentvalues for. e.g: public contentvalues buildpage (page p){ contentvalues val = new contentvalues(); val.put(page_description, p.getdesciption()); val.put(page_displayable, bitmaphelper.converttoblob(p.getpic())); val.put(page_module_id, p.getmoduleid()); val.put(page_title, p.gettitle()); return val; } public contentvalues buildquestion(question q){ contentvalues val = new contentvalues(); val.put(question_correct, q.getcorrect()); val.put(question_question, q.getquestion()); val.put(question_quiz_id, q.getquizid()); return val; } my intuition tells me there better way of doing it. the second situation opposite. i...

ios - Getting Error after updating to XCode 5.1 -

pcseqaudiobar hi, developing application uses pcseqaudiobar , working fine on xcode 5.0.2 , after updating 5.1 , started getting error.. no more can't compile code or deploy or anything… incompatible pointer types passing retainable parameter of type 'cfarrayref' (aka 'const struct __cfarray *')to cf function expecting 'const cgfloat *' (aka 'const float *') type i getting error on line… cggradientref _gradientref = cggradientcreatewithcolorcomponents(rgb, (__bridge cfarrayref) colors, null, sizeof(colors) / (sizeof(colors[0]) * 4)); please help… in advance.. you need pass cgfloat array , not nsarray . ex: static const cgfloat colors [] = { 0.894, 0.894, 0.894, 1.0, 0.694, 0.694, 0.694, 1.0 }; more on api apple docs , the number of items in array should product of count , number of components in color space. example, if color space rgba color space , want use 2 colors in gradient (one starting location ,...

javascript - JS dynamic variables or other solution -

i'm building web application-ordering system , i'm working on cart part of front end. i have array contains plain 1,2,3... count products of cart. every time user clicks product checks array , gives id (for later php use) product on cart. each product has each own attributes. have no issue adding attributes product. each attribute gets id resulting in attribute_1_1,attribute_1_2 first number product no on cart , second 1 attribute no on product. problem i'm facing when removing attribute. if example product 1 has attribute_1_1,attribute_1_2,attribute_1_3 , remove no 2 attribute js give next added attribute id of attribute_1_4 therefor when checking in php how many set it'll stop @ 1 because attribute_1_2 missing. either have make array each product it's attributes (in case i'll need dynamic variable var arraysattr+somethinghere=new array(); don't know now, or if there solution i'm missing please go ahead. thank you

php - Fastest way to retrieve part from JSON in my case -

now, use strstr data external json file. i'm not sure if it's fastest way want , can't test because json_decode don't work in code. $before = '"this":"'; $after = '","date"'; $data = strstr(substr($url, strpos($url, $before) + strlen($before)), $after, true) and json_decode: $address = file_get_contents('http://json.link/?something=hello'); $data = json_decode($address); echo $data->data->this; now, when replace first code second get: notice: trying property of non-object all code: $text = "a lot of text"; $text_split = array(0 => ''); $number = 0; $words = explode(' ', $text); foreach($words $word) { if(strlen($text_split[$number]) + strlen($word) + 1 > 500) { ++$number; $text_split[$number] = ''; } $text_split[$number] .= $word.' '; } foreach($text_split $texts) { $text_encode = rawurlencode($texts); ...

hadoop - Can't put files into HDFS -

i'm trying set hadoop multi-node cluster , i'm getting following problem. have 1 node master , 1 slave. it seems right because when execute {jps} processes master: { 29983 secondarynamenode 30596 jps 29671 namenode 30142 resourcemanager } and ones slave: { 18096 nodemanager 17847 datanode 18197 jps } unfortunately, when try -put command, error: hduser@master:/usr/local/hadoop/bin$ ./hdfs dfs -put /home/hduser/ejemplos/fichero /ejemplos/ 14/03/24 12:49:06 warn util.nativecodeloader: unable load native-hadoop library platform... using builtin-java classes applicable 14/03/24 12:49:07 warn hdfs.dfsclient: datastreamer exception org.apache.hadoop.ipc.remoteexception(java.io.ioexception): file /ejemplos/fichero. copying replicated 0 nodes instead of minreplication (=1). there 0 datanode(s) running , no node(s) excluded in operation. when go webui, there 0 live nodes , don't know why! can't fix error , appreciate help! you wa...

perl - ExtUtils::MakeMaker conditional/prompt for live tests -

i can't figure out how extutils::makemaker prompt user asking if want run subset of tests in /t require live internet connection. possible? in general, not want run such tests on end-user's system. can not rely on being reliable, if it's present. if want can use prompt helper function test section argument achieve if put networking tests in own directory: use extutils::makemaker; … $network = prompt("do want run tests requiring network access [y/n]", "n") =~ /y/i; writemakefile( ... test => { tests => $network ? 't/*.t t/network/*.t' : 't/*.t' } );

url rewriting - IIS pipeline: what goes first: URL Rewrite or binding? -

what happens first in pipeline: url rewrite (as defined in url rewrite module of iis), or binding mapping? if user puts in https://www.mydomain.com works fine, https://mydomain.com browser gives certificate error have buy new certificate mydomain.com, there way around of problem using url rewriting can use url rewriting redirect redirect https://mydomain.com https://www.mydomain.com ? we had same issue. certifcate binding (ssl handshake) first , url rewrite module. this post clarified me: redirect 'www' before ssl requirement instead of getting certificate https://mydomain.com requested subject alternative name in https://www.mydomain.com certificate. you can @ how san works http://www.digicert.com/subject-alternative-name.htm

Jsoup want to get Values where class names are same for all elements -

this html. want 2 details publisher: springer-verlag, price: $7,284 problem outer , inner class names same. please suggest how above 2 values below html using jsoup. <div class="details"> <div class="fullname">analytical , bioanalytical chemistry (2011)</div> <div class="catbox"> <div class="catcontents"> <div class="contents_ct1">eigenfactor category:</div> <div class="contents_ct2" style="margin-left: -5px;">analytic chemistry</div> </div> <div class="catcontents"> <div class="contents_ct1">isi category:</div> <div class="contents_ct2" style="margin-left: -49px;">co ea</div> </div> <div class="catcontents"> <div class="contents_ct1">g...

jQuery AJAX call not exiting when there is no response data -

i have following jquery code: $.ajax({ url: application.common.relativepath + '/persons/search/', contenttype: "application/json", datatype: 'json', // parameters name-value pairs passed data: { forename: forename, surname: surname, checkemployee: false }, success: function(data) { // no response data if (!data) { return; // problem. } // code executed if there response. } }); when there no response data, ajax function should exit, hence use of return statement. however, finding if there no response data ( data null), code below gets executed means return statement not being called break out of jquery ajax call. can please me break out of ajax call if there no data response. an ajax call ends in success return data. if server has no data return, return empty object of datatyp...

c# - nhibernate interceptor configuration is right or wrong -

i used nhibernate 2.1.2, fluentnhibernate 1.1, , sqlite configured in memory (for unit testing purposes). the purpose of interceptor make proxy object returned create criteria. think registered interceptor configuration correctly, create criteria returns naked object instead of proxied one. tried put breakpoint on interceptor instantiate method breakpoint not hit. so question is, how can know whether interceptor setup correctly or not? debug using logging? i'm having problem using configuration in visual studio unit testing. using (isession session = nhibernateconfig.sessionopen()) { using (var trans = session.begintransaction()) { var data = (from c in session.query<employeedetails>() (c.fname == "abc") select c).tolist(); //linq queries (int = 0; <= data.count; i++) { session.delete(data[i]);...

Separate a line to columns using several spaces (>1) as a delimiter using C++ or linux -

i have several lines looking this: 4539(random number of spaces)07235001(random number of spaces)aach(random number of spaces)trier saarburg i want separate 4 columns using c++ or linux. output want this: 4539|07235001|aach|trier saasburg so want treat several spaces delimiter not single one. (random number of spaces thankfully > 1) lines not consist of 4 columns , space problem not @ last column. thanks in advance you can use awk regular expressions this: echo "4539 07235001 aach trier saarburg" | awk 'begin { fs = "[ ]{2,}" } { ofs = "|" }; {$1=$1; print $0 }' fs variable used set field separator each record , may contain regular expression. ofs output equivalent of fs variable.

python - Query network device to determine operating system, without installing a remote agent? -

i query device (e.g. android phone on wifi) find out operating system running, without having run on device or install additional agent? is possible? look phrases "port scan" , "port mapping" ideas. you'll need make use of whatever services running on target machine, include avahi/bonjour/mdns, http, ssh, smtp, etc. you'd try figure out ports might open, try connect there (or send udp datagrams), , see find. develop own heuristics if have enough devices or small enough set need support, or find existing code of (maybe not in python directly though).

c - Why fragment shader didn't attach? -

i'm pretty new modern opengl (3.0+) , right i'm trying create basic white triangle on black background. i'm on mac os x mavericks 10.9.2, using glfw 3.0.4 create window, glew 1.10.0 load extensions. can find full source code here. my problem is, fragment shader doesn't want attached program. checked both program ( glisprogram() ) , shader ( glisshader ) , both passed. shaders compiling, , program linking.. however code compiles, runs , doesn't throw error, got running window black background without white triangle. here part, think broken somehow (or @ least can find error): const char* opengl_get_error(void) { switch (glgeterror()) { case 0x0500: return "gl_invalid_enum​"; case 0x0501: return "gl_invalid_value​"; case 0x0502: return "gl_invalid_operation​"; case 0x0503: return "gl_stack_overflow​"; case 0x0504: return "gl_stack_underflow​"; case 0x050...

angularjs - angular UI router | $stateParams not working -

seems $stateparams not working. passing date this: $state.go('state2', { someparam : 'broken magic' }); params being ignored on target state console.log('state2 params:', $stateparams); // return empty object {} code: var app = angular.module('app', [ 'ui.router' ]); app.config(function($stateprovider) { $stateprovider .state('state1', { url: '', templateurl: 'state-1.html', controller : function ($scope, $state, $stateparams) { $scope.go = function () { $state.go('state2', { someparam : 'broken magic' }); }; console.log('state1 params:', $stateparams); } }) .state('state2', { url: 'state2', templateurl: 'state-2.html', ...

ruby - Replacing text from a file with regular expressions -

i'm trying read xml file , substitute dp sp everywhere in text textsize attribute used. example android:textsize="8dp" replaced android:textsize="8sp" if below file processed: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" > <textview android:id="@+id/description" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="8dp"/> <view android:layout_width="wrap_content" android:layout_height="5dp" /> </linearlayout> and have following code: patterndp = /android:textsize=\"[\d]+dp\"/ content = file.re...

javascript - Ajax is working only the first time -

this situation: in codeigniter app, kind of social network demo, developing button. when reading through posts using foreach loop, button displayed after each post. first time work properly: ajax sends data codeigniter method, data inserted table , button become green (succesfull). stops work. if refresh page, call not triggered anymore. what have tried do: have seen other answers in stack overflow , other forums, no 1 fixed problem. anyway codeigniter part correct, problem ajax calling. have simplify debug purpose , right have very simple ajax function server side disable, thing should make buttons green when clicking on them. , again works first time , not work anymore... this html: <button id="button_like" type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-thumbs-up"></span> like</button> this ajax call: $('#button_like').click(function(e) { e.preventdefault(); // aler...

php - NotEqualTo Validation in Zend Framework 2 -

is there notequalto validator in zend framework 2? if not; how can implement notequalto validator in zend framework 2? or there other workarounds? example have text field having following attributes 'onfocus'=>'if(value==\'name\'){ value=\'\'}' 'onblur'=>'if(value==\'\'){ value=\'name\'}' when user submits form without entering name; have validate whether field having value of 'name' , if has; return error. note: can't use placeholder attribute client require placeholder text disappear on clicking text field(currently disappears when begin typing). i have made simple workaround using callback validator follows. 'validators' => array( array( 'name' => 'zend\validator\callback', 'options' => array( 'callback'=>function($value){ return $value!='name'; }), ),...

linq - MongoDB/C# Update Collection entries -

hello have mongodb collection called nodes structure follows: { "_id" : new bindata(3, "ljot2wcbskwg9vobsla0zq=="), "logicalname" : "test node", "host" : "eh5tmb054pc", "port" : 104, "appendtimestamp" : false, "studies" : ["1.3.12.2.1107"], "tests" : [], "mainentries" : [{ "_id" : "1.3.12.2.1107", "index" : 0, "type" : "study" }] } i created new key called "mainentries" storing "studies" , "tests". in order support new versions without hassle, want write method in setup helper, enable me read collection - check if studies,tests exists , if yes add key "mainentries" , remove studies/tests key. my question is: kind of query must use reach each collection of nodes check fields , update. using mongodb-csharp community driver. would appreciate...

How to power off an Android device programmatically -

how can power off android device programmatically? i searched answer, said phone must rooted (i don't want that), , others said it's impossible. is impossible? you can't unless have rooted phone. easy calling shutdown command linux: void shutdown() { try { process m_process=runtime.getruntime().exec("su"); dataoutputstream os = new dataoutputstream(m_process.getoutputstream()); os.writebytes("shutdown\n"); os.flush(); m_process.waitfor(); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } }

javascript - window.resize - Won't fire until I've manually changed the browser width -

i have little code snippet here: $(window).resize(function() { if ($(window).width() <= 768) { $('.menu-item-810').click(function () { $('.squares').slidedown(2000); }); } }); that says when browsers window width less or equal 768px, when click on element has class of .menu-item-810, slidedown .squares element. that want, , work.. 99.8% correctly. when screen width larger 768px, .squares element has different jquery effect, fades in , out, instead of sliding. needed slidedown instead, when in tablet/mobile view, wrote above snippet. like said, works, i've opened browser, resized 768px or less width, browsed site , click on .menu-item-810. nothing happens. it's when manually resize browser again, amount, jquery fires. if i've resized browser again, , click .menu-item-810, .squares element slides down expected, if manually resize browser. thought jquery listening start if wrapped snippet ...

c# - WP8 Listbox takes too much time to render UI for large set of items -

i have large observablecollection containing text data populated listbox itemssource. data fetching fine, listbox rendering takes time, 4-5 seconds. plus, have textbox want filter out listbox itemesource, if text entered in textbox starts item's text using linq. list<locality> l = collection.findall(locality=>locality.name.tolower().startswith(keywordlocation.text.trim())); the filtering takes time in data set , ruining user experience. ideas how decrease rendering time , improve filtering. solved. missed on few details. virtualizationstackpanel mode set recycling helped in rendering data faster , filtering out content.

c - Undefined reference instead of makefile -

the code want run has makefile , shows error: /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o: in function `_start':(.text+0x20): undefined reference `main' collect2: error: ld returned 1 exit status make: *** [nfa] error 1 the file main function terp.c. part of code main() is: #ifdef main #define allocate #include "global.h" /*externs verbose*/ #define size 256 private char buf[bsize] //input buffer private char *pbuf=buf; //current position in input buffer private char *expr; //regular expression command line ... skipping code here until main... void main (int argc,char *argv[]) { int sstate; //starting nfa state set *start_dfastate;//set of starting dfa states set *current; //current dfa state set *next; int accept; //current dfa state accept int c; //current input character int anchor; if (argc==2) fprintf(stderr,"expression %s\n",argv[1]); else { fprintf(stderr,"usage:terp pa...

android - Adobe flex mobile application -

i need develop wallpaper app using adobe flex adobe flash builder need after complete user interface , downloaded wallpaper manager native cod please me write native cods set image wallpaper on device .tnx! what want setting local image file device wallpaper right? if yes, can download on page ane should doing want (i haven't tested myself though), guess it's same 1 talking when mentionning wallpaper manager. using means getting instance of manager , calling 1 of following functions: var manager:wallpapermanager = wallpapermanager.getinstance(); if (manager.issupported()) { manager.setwallpaperfrompath(image-native-path); // if using native path of image on device manager.setwallpaperfrombitmapdata(bitmapdata); // if using actionscript bitmapdata object }

Nginx upstreams and Heroku -

i use nginx upstreams balance 2 instances of application, 1 of them on ec2 server , other on heroku. the problem is, when put app.herokuapp.com in upstream directive, resolves ip address, , requests sent ip address, heroku uses host identify application, doesn't work. i'm stuck on this, do? update: app uses host too, think stuck on this. can't change heroku, guess have add header original request host used application , keep host default, heroku find application add host header proxy. proxy_pass http://upstream; proxy_set_header host $host; ....

batch file - Windows CMD - Run program and specify image name -

Image
i run program commandline (or batch file) specify imagename shows in task manager. possible using windows cmd? this needs done in batch script or command-line argument, not renaming exe itself. from command prompt can use c:\> title mycustomtitle , show in taskmanager (windows 8) this: so tell them apart way. don't know of way change icon, , setting shortcut custom icon doesn't work. edit suggestion 2: copy c:\windows\system32\cmd.exe , rename it, run that. edit 2 since this microsoft kb article on createprocess makes me think it's not possible want, how wmi query shows running processes , process id, , can run after every launch , see new process id is? e.g. batch file wmic process (name="notepad.exe") processid rem keep track of seen processes powershell $knownprocessids= @() $processids = get-wmiobject win32_process -filter 'name="notepad.exe"' | select -expandproperty processid $newprocessid = $proce...

javascript - Unable to use Breeze in Jasmine/Karma tests -

it seems can't starting point try test breeze using jasmine , karma (in node.js) runner. vs 2013. karma runs in own server had allow cors. regardless, following jasmine test not run: describe('able retrieve single account record...', function() { var manager, acc, asynccallcomplete; asynccallcomplete = false; manager = new breeze.entitymanager({ servicename: 'http://localhost:35092/api/breezeapi' }); // load filtered accounts runs(function() { breeze.entityquery.from('accounts') .select('id, accountname') .where('id', '==', 2) .using(manager).execute() .then(function() { acc = data.result; asynccallcomplete = true; }, function (error) { asynccallcomplete = true; throw error; }); waitsfor(function () { return asynccallcomplete != false; }); ...

HTML Email behaving strange in Outlook -

hello have simple html table in email , reason last cell in thead / td not taking bg color coming out white. i have no idea why happening, happening in outlook. looks fine in gmail, yahoo, icloud , hotmail. i have fiddle shows correctly figured include <table id="responsive" bgcolor="#0057a0" align="center" style="width:100%;max-width:535px;background: #0057a0;"> <thead bgcolor="#0057a0"> <tr bgcolor="#0057a0"> <th width="31%" style="font-weight:normal;background: #0057a0;color: #fff;">&nbsp;</th> <th width="23%" style="font-weight:normal;background: #0057a0;color: #fff;">level 1</th> <th width="23%" style="font-weight:normal;background: #0057a0;color: #fff;">level 2</th> <th width="23%" bgcolor="#0057a0" style="fo...