Posts

Showing posts from August, 2011

elasticsearch - How to handle wildcards in elastic search structured queries -

my use case requires query our elastic search domain trailing wildcards. wanted opinion on best practices of handling such wildcards in queries. do think adding following clauses practice queries: "query" : { "query_string" : { "query" : "attribute:postfix*", "analyze_wildcard" : true, "allow_leading_wildcard" : false, "use_dis_max" : false } } i've disallowed leading wildcards since heavy operation. wanted how analyzing wildcard every query request in long run. understanding is, analyze wildcard have no impact if query doesn't have wildcards. correct? if have possibility of changing mapping type , index settings, right way go create custom analyzer edge-n-gram token filter index prefixes of attribute field. curl -xput http://localhost:9200/your_index -d '{ "settings": { "analysis": { "filt

ruby - Watir-webdriver throws 'not clickable' error even when element is visible, present -

i trying automate tests in ruby using latest watir-webdriver 0.9.1, selenium-webdriver 2.53.0 , chrome extension 2.21. website testing has static headers @ top or static footers @ bottom. hence since watir auto-scrolls element view before clicking, elements hidden under static header or static footer. not want set desired_capabitlites (elementscrollbehavior) 1 or 0 websites testing can have both - static header or static footer or both. hence question 1) why watir throw exception 'element not clickable' when element visible , present? see ruby code ( have picked random company website example) , results below. 2) how can resolve without resorting elementscrollbehaviour? ruby code: require 'watir-webdriver' browser = watir::browser.new :chrome begin # step 1 browser.goto "shop.coles.com.au/online/mobile/national" # step 2 - click on 'full website' link @ bottom link = browser.link(text: "full website") #check if lin

python - Apply function to 2D numpy array elements -

i've seen post , want similar, not same. i implementing little game of life game , using numpy arrays representing states of game. need check, how many alive neighbors cell has. got function getting window of neighbors given coordinate , row count , column count window size want have. so windows of 3x3 size this: t = true f = false [[t,t,t], [f,t,t], [f,f,f]] # random truth values in representation true stands cell being alive. wrote code iterating on cells of state, counting true values , on using double loop, think there better numpy solution. what i'd in naive approach: iterate on cells of state (not window) (i'd formulate code to executed if cell meets criteria or (being alive , surviving or being dead , coming alive)) get window (wrapping or not wrapping) (function have) check if current cell alive (could lookup in state's numpy array) if alive start alive neighbors count of -1 otherwise start 0 count true values of window ( np.sum )

ruby on rails - Backing up and restoring Redis on Heroku -

i'm running app on heroku uses redis , postgres. occasionally backup , restore postgres lower tier staging or development testing. is there similar inbuilt redis tool backup production instance , restore local instance? write loops through each key , outputs file, , else locally reads file , restores, feel might overkill if utility exists that. thanks! redis can dump date disk file using format called rdb. should check redis provider how generate , obtain these files.

ruby - Hash of hashes from an array -

from array: this = [1, 2, 3, 4, 5] i trying create hash of hashes: {{num: 1}, {num: 2}, {num: 3}, {num: 4}, {num: 5}} but i'm getting empty hash: hash.new(this.each |num| hash.new(num: num) end) # => {} what doing wrong? first, desired result in question doesn't make sense since you're using hash {} syntax, there no keys. seems though want result array of hashes. second, you're confusing each map . each iterates through array, passing each item block. return value of arr.each arr . map , on other hand, returns new array based on return value of block: [1, 2, 3, 4, 5].map { |item| { num: item } }

linux - How to determine if sym link exists -

i'm trying determine if symbolic link exists. thought -l or -f it, doesn't seem working. vhost="/etc/apache2/sites-available/vhost.local"; if [ ! -l vhost ]; ln -s /home/user/ubuntu\ one/htdocs/vhosts/vhost.local vhost; a2ensite vhost.local; echo " -vhost.local": fi it should create sym link if there isn't one.... according test(1) manpage: -h file file exists , symbolic link (same -l) -l file file exists , symbolic link (same -h) -h or -l should trick. however, not testing against variable $vhost literal vhost . that's error. so, suppose meant say: if [ ! -l "$vhost" ]; ... additionally you're forgetting $ in ln -s : ln -s /home/user/ubuntu\ one/htdocs/vhosts/vhost.local "$vhost";

How to get country code (not ISO code) in Qt -

i'm developing application windows. find way country code 1(usa) , 82(south korea). qt provides qlocale::country enum includes countries. can use countrytostring static method in order name of each country.

java - APNG support for javaFX -

Image
after searching found 2 interesting answers: native image formats support javafx controlling gif image javafx but see javafx doesn't support apng images.how solve problem external library or write code.i need solution on that... example image: thanks help. there no apng support in javafx 8. use 3rd party library decode apng, extract frames , metadata it, convert javafx images , play them using javafx's animation support: google apng decoder java . choose java library decodes apng format. apply same solution roland demonstrates in: how can stop animated gif in javafx? or pre-convert apng files gifs: google apng gif converter . choose utility converts apngs gifs. convert apngs used application gifs. in javafx application use converted gifs rather apngs.

cypher - If the number of properties is greater than n, return a subgraph in Neo4j -

Image
this question direct extension of a question asked previously. say have graph database looks this: just previous question asked, interesting thing someproperty can 'yes' or 'no'. in top row, 1 of 3 nodes have 'yes' property. on bottom row, there 3 nodes have 'yes' property. other 2 have 'no'. how write cypher query returns whole bottom row, asking question: do either of these disjoint subgraphs have 2 or more values someproperty = 'yes'? previously, brilliant @cybersam recommended using like: match p=(:person)-[:related_to*]->(:person) 2 < reduce(s = 0, x in nodes(p) | case when x. someproperty = 'yes' s + 1 else s end) return p; ...which return matching paths. in case, return but trying generalize return whole set of 5 "b" nodes. after struggling this, realize i'm trying create 3 node subgraph, not return it. i'm trying use existence way return supergraph of match, , ignore

Enable gradle nature on android libgdx project -

i have libgdx game. clicked "disable gradle nature" on android project , can not run gradle on android project. cant see gradle option on menu when right click project name. can please help. the solution found add gradle in nature section in .project file eclipse , works.

axes - Rickshaw - need help designing line + bar toggle chart -

i started using ricksaw animated graphs , i'm trying set x-axes list months. not in particular time series (yet), correspond specific data points. have simple coding program try , can't seem modify x-axes labels. there easy way this? also, how similar y-axis? thanks! < script > var mygraph = new rickshaw.graph({ element: document.queryselector("#mychart"), renderer: 'multi', width: 500, height: 250, min: 0, max: 18, series: [{ name: "population1", color: "steelblue", renderer: 'lineplot', data: [{ x: 0, y: 10, }, { x: 1, y: 3, }, { x: 2, y: 8, }, { x: 3, y: 15, }, { x: 4, y: 12, }, { x: 5, y: 8, }, { x: 6, y: 3, }, { x: 7, y: 5, }, { x: 8,

angularjs - Iterating over JSON properties -

i have used $http service in angular pull json object server using api. able display values so... <div ng-controller="apicontroller apictrl"> {{apictrl.api.status}} {{apictrl.api.meta.count}} {{apictrl.api.data[0].nickname}} {{apictrl.api.data[0].account_id}} </div> this displays values correctly unable display keys. read around, here , here . explained there ng-repeat set iterate through object , pull keys , values it. <div ng-controller="apicontroller apictrl"> <div> <div ng-repeat="(key, value) in api"> {{key}} : {{value}} </div> </div> </div> for reference apicontroller function apicontroller($http) { var vm = this; vm.api = []; $http.get('...').success(function (data) { vm.api = data; }); }; this json requested { "status": "ok", "meta": { "count": 1 }, "data": [ { &quo

Mysql query vertical "\G" not working -

i have question query data vertical format, tried \g or \g . i referenced "4.5.1.6.2 displaying query results vertically" @ https://dev.mysql.com/doc/refman/5.5/en/mysql-tips.html but not working , show error syntax @ "\g" my query : select * mytable \g . wrong. from that, want build final query this: select "a","b","c","d" "columnname" \g expect: columnname b c d i tried union or union all. several thousand record, it's slow performance. and mysql version : server version- 5.6.17 - mysql community server (gpl) @ bernd buffen i show query: select c.* ( ( select * (select "value1" newcolumn union select "value2" newcolumn union ...<200.000 union all>) ) left join (select key,column1,column2,colum3 supplier ) b on a.newcolumn = b.key ) c and handle query database, debug time begin end, spend 1.30 2 minutes. not good. t

ruby on rails - How to make url_for return slashed parameters rather than (? & based parameters) -

rails 2.3.5: routes: map.connect ':controller/:action/:sort_key/:sort_order' options: {"controller"=>"sections", "action"=>"list", "params"=>{"sort_key"=>"sect_code", "sort_order"=>"asc"}} url_for(options) give me: /sections/list/sect_code/asc in rail 4.2, routes: ':controller/:action/:sort_key/:sort_order' url_for(options) (same options) give me, /sections/list?sort_key=sect_code&sort_order=asc is difference intended? possible make behaviour same? thanks. the behaviour intended. when add parameter url_for options isn't controller, action or expected property (eg. trailing_slash: true) url_for helper generate string parameters appended in 'get' fashion. don't know of inbuilt way modify string output become slashes instead of parameters, since html encoded string produced, away using gsub , regex on result

filesystems - Mounting ext4 mounts as ext2 in linux 4.4.0 [RHEL] -

commands executed mkfs .ext4 -f /dev/xxx0 mke2fs 1.42.9 (28-dec-2013) filesystem label= os type: linux block size=4096 (log=2) fragment size=4096 (log=2) stride=0 blocks, stripe width=0 blocks 524288 inodes, 2097152 blocks 104857 blocks (5.00%) reserved super user first data block=0 maximum filesystem blocks=2147483648 64 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 allocating group tables: done writing inode tables: done writing superblocks , filesystem accounting information: done mount -o dax /dev/xxx0 /mnt/ext4-xxx0 mount output /dev/xxx0 on /mnt/ext4-xxx0 type ext2 (rw,relatime,seclabel,block_validity,barrier,dax,user_xattr,acl) dmesg output [ 2917.044866] ext4-fs (xxx0): dax enabled. warning: experimental, use @ own risk [ 2917.044869] ext4-fs (xxx0): mounting ext2 file system using ext4 subsystem ... ...

network programming - How to route all internet traffic of iOS device through Tor? -

i have application routes internet traffic of application through tor. now, want implement functionality route internet traffic of ios device through tor using network extension framework. i have couple of questions in regard 1) possible achieve this? 2) apple allow this? (i have posted query apple didn't response) thanks

jboss - Cannot upload deployment on WildFly 10 -

i new on using wildfly 10. when tried deploy war on wildfly 10, got following error: cannot upload deployment: {"wflyctl0080: failed services" => {"jboss.deployment.unit.\"customerservice.war\".parse" => "org.jboss.msc.service.startexception in service jboss.deployment.unit.\"customerservice.war\".parse: wflysrv0153: failed process phase parse of deployment \"customerservice.war\" caused by: org.jboss.as.server.deployment.deploymentunitprocessingexception: wflyut0027: failed parse xml descriptor \"/content/customerservice.war/web-inf/lib/taglibs-application.jar\" @ [1,0] caused by: com.ctc.wstx.exc.wstxeofexception: unexpected eof in prolog @ [row,col {unknown-source}]: [1,0]"}}

constructor - What makes enum in java non instantiable? -

i know enum enum year { first, second, third, fourth; } gets converted into final class year extends enum<year> { public static final year first = new year(); public static final year second = new year(); public static final year third = new year(); public static final year fourth = new year(); } when tried instantiate enum (not class) got compile time error as: error: enum types may not instantiated year y = new year(); as per knowledge private constructor makes class non instantiable. , thought compiler providing private constructor. again got confused when saw can define constructor enum default modifier , still cannot create object of type enum. enum year { first, second, third, fourth; year() { } } class example { public static void main(string[] args) { year y = new year(); } } my doubt is, if not constructors makes enum in java non instant

mysql - Extracting records not found on another table -

i have table... id name location date_created -- ---- -------- ------------ 15641 maybel new york 2015-09-15 84194 joseph arkansas 2015-02-03 36479 frank illinois 2015-10-28 19804 samantha san francisco 2015-11-05 67811 charles texas 2015-11-05 ... , table... id name location created_at -- ---- -------- ---------- 15641 maybel new york 2015-09-15 84194 joseph arkansas 2015-02-03 36479 frank illinois 2015-10-28 78916 logan philadelphia 2015-12-01 26799 george mississippi 2015-12-10 and need is... id name location created_at -- ---- -------- ---------- 19804 samantha san francisco 2015-11-05

ios - protocol method is not being called by the delegate -

i have implemented protocol in app, i have declared protocol method in loginviewcontroller , calling protocolmethod confirmviewcontroller here code snippet: loginviewcontroller.h @protocol firstcontrollerdelegate<nsobject> @required -(void)protocolmethod; @end @interface loginviewcontroller : uiviewcontroller<firstcontrollerdelegate> @end loginviewcontroller.m - (ibaction)loginbtnclicked:(id)sender { confirmviewcontroller *obj = [confirmviewcontroller new]; obj.delegate=self; [self performseguewithidentifier:@"confirmloginsegue" sender:self]; } -(void)protocolmethod{ nslog(@"--- not callled ---"); [self dismissviewcontrolleranimated:no completion:nil]; } code confirmviewcontroller.h @interface confirmviewcontroller : uiviewcontroller @property (nonatomic, assign) id <firstcontrollerdelegate> delegate; @end confirmviewcontroller.m (ibaction)continueclicked:(id)sender { [_delegate protocolme

c# - Programmatically set transformer parameters in FME2015 -

i trying upgrade application fme2009 fme2015. problem i'm running seems parameters set not being used in actual transformer. instead, default values transformer definition being used. specifically, source , destination coordinate system names not being applied. setting parameters in way worked when application linked against fme2009. code excerpt: stringcollection directives = new stringcollection(); directives.add(safe.fmeobjects.constants.transformermanager.createtransformerdirectives.serializationstring); parameters = string.format("\"source_coordsys,{0},xformer_name,spinecliptransformer,dest_coordsys,{1}\"", sourcecsys, destcsys); directives.add(string.format("name,spinecliptransformer,version,0,parameter_values,{0},input_feature_types,,input_filters,,input_attrs,,output_feature_types,,output_functions,", parameters)); transformer = fme.transformermanager().createtransformer(directives); when execute code can see logs default values be

git - Piping functions with other commands in linux -

i pipe function normal commands in linux. please note these commands put .sh script (i use bash shell). example, have me command follows: git diff --name-only head~1..head -z | xargs -0 dirname | catch_exceptions >> extracted_dir_names i have written catch_exceptions function above command , contains 2 sed delete statements. if pipe 2 sed commands in function work if put them 1 after other don't. explain why , how work around can done? in advance. this works: function catch_exceptions { sed '/^\./d' | sed '\#this/path/alone#d' } pushd /path/to/direc rm -f extracted_directories.txt git diff --name-only head~1..head -z | xargs -0 dirname | remove_duplicates | catch_exceptions >> extracted_directories.txt cat extracted_directories.txt popd } but when replace catch_exceptions with: function catch_exceptions { sed '/^\./d' sed '\#this/path/alone#d' } it doesn't work. with first function, output of

regex - notepad++ replace text with get some text -

hello want replace text : test.myfonction(arg1, arg2) test2.myfonction(arg1, arg2) test3.myfonction(arg1, arg2) by this: myfonction2(test, arg1, arg2) myfonction2(test2, arg1, arg2) myfonction2(test3, arg1, arg2) for this, use regex in notepad++, find something.mafonction(arg1, arg2) use this: (*).myfonction( but how test, test or test3 ? myfonction2(test well, need capture string before . , function name , parameters: (\w+)\.(\w+)\(([^\)]+)\) demo. now have 3 groups: the first string the function name the arguments and can use replace string desired output: \2\(\1, \3\)

ruby on rails - undefined method `+' for nil:NilClass spree -

i running spree app. i getting below error when try add product in cart. undefined method `+' nil:nilclass this error comes when add option types , variants of same product. i not sure what's going wrong here, because not doing changes in code or something. this extracted source shows. if quantity.between?(1, 2_147_483_647) begin order.contents.add(variant, quantity, options) rescue activerecord::recordinvalid => e error = e.record.errors.full_messages.join(", ") end here's order controller's populate function. # adds new item order (creating new order if none exists) def populate order = current_order(create_order_if_necessary: true) variant = spree::variant.find(params[:variant_id]) quantity = params[:quantity].to_i options = params[:options] || {} # 2,147,483,647 crazy. see issue #2695. if quantity.between?(1, 2_147_483_647) begin order.contents.add(variant, quantity, options)

javascript - Jquery deferred not behaving as expected -

i make 2 ajax calls. second 1 should called when first finished: var deferred = $.deferred(); firstajaxcall(); deferred.done(function () { secondajaxcall(); }); function firstajaxcall() { $.ajax({ url: '/someurl', type: 'post', success: function () { deferred.resolve(); } }); } function secondajaxcall() { $.ajax({ url: '/someotherurl', type: 'get', }); } i tried ( jquery deferreds ) $.when(firstajaxcall()).done(function() { secondajaxcall(); }); but no luck. still, in first example, second call gets called first, doesn't in first example flow this: firstajaxcall(); secondajaxcall(); deferred.resolve(); why second call called first , before deferred.resolve() ? you have return deferred $.ajax $.when make work function firstajaxcall() { return $.ajax({ url : '/someurl', type : 'post' }); } function secondajaxcall(data_f

What UserAgent is used by Hosted Web Apps created by Windows App Studio? -

i have created hosted web app using windows app studio . in order track it's usage in google analytics, need know useragent agent hosted web app uses. know? hosted web apps use webview control (with restictions) in order show web content within app. can track request becoming hosted web app when user agent contains "msapphost" in it: "mozilla/5.0 (windows nt 10.0; win64; x64; msapphost/3.0 ) applewebkit/537.36 (khtml, gecko) chrome/46.0.2486.0 safari/537.36 edge/13.10586" here have more details: https://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx

jquery - Javascript Quiz not progressing to next -

i trying make quiz whereby question displayed 1 question @ time , in total, users need answer 3 questions correctly before allowed progress. @ time, if user answer question wrongly, user directed gameover page. i have managed set randomised questions appear , when user chooses wrong answer, directed gameover page. at point, stuck @ part showing question1, though user has selected correct answer. could on how call next question when user has selected correct answer current question? thanks var questionorder = ["q1", "q2", "q3"]; var answerorder = [ ["yes", "no"], ["yes", "no"], ["yes", "no"] ]; var correctanswers = ["1", "2", "2"]; //to set random question var random_questionindex = math.floor(math.random() * questionorder.length); //assign variable generate random question quiz var question = questionorder[random_questionindex]

xcode - Symbols not found - IOUSBHostHIDDevice - OSX kext -

i had convert existing driver osx10.11 ( previous question ). i have replaced deprecated , removed classes , methods new ones introduced in 10.11. kext builds cannot load driver. the osbundlelibraries updated after issuing command kextlibs -xml driver.kext . <key>osbundlelibraries</key> <dict> <key>com.apple.driver.iobluetoothhiddriver</key> <string>4.4d69</string> <key>com.apple.driver.usb.iousbhosthiddevice</key> <string>1.0</string> <key>com.apple.iokit.iohidfamily</key> <string>2.0</string> <key>com.apple.iokit.iousbhostfamily</key> <string>1.0</string> <key>com.apple.kpi.bsd</key> <string>15.0</string> <key>com.apple.kpi.iokit</key> <string>15.0</string> <key>com.apple.kpi.libkern</key>

php - How to convert array/object of order data to EDI 850 format? -

Image
i need build integration process between website (magento in case) , warehouse/logistics api. warehouse needs data edi (850 order-requests, other numbers other things). know how prepare data in other known formats (xml/json/...), never used edi before, so.. how supposed prepare data? thanks in advance! *i downloaded sabas/edifact seems have way of converting arrays edi, still, need know put in array.. **here specifications api docs, how should use/read table? if able export xml use tool converts xml x12 files. way works describe edi structure , segments using xml fields. there several commercial tools available. best open source solution i've seen x12 parser the documentation great if you're not in .net environment , you're trying achieve opposite (xml x12) use create own conversion tool (i created own using groovy).

c++ - In-place function with return value -

i have function has similar behavior of this: void process(const t& input,t& output){ if(&input==&output){ //alter output directly } else{ output=input; //deep copy //alter output } } use case 1: t i; //fill t o; process(i,o); use case 2: t io; //fill io process(io,io); i want change function deceleration more readable: t process(const t& input){ //what here? } use case 1: t i; //fill auto o = process(i); use case 2: t io; //fill io io=process(io); question: how can imitate previous methodology of dealing in-place cases? how should implement it? need avoid deep copying when same object.

wordpress - Make multiple PHP if statements more efficient -

i starting out php wordpress , have written code put social network icons in footer. way have done works, i'm calling content of social network url stored in db , if there icon/link in footer. looks inefficient me, here code, know how make more efficient. <?php $social1 = of_get_option('fab_social_twitter_url'); $social2 = of_get_option('fab_social_facebook_url'); $social3 = of_get_option('fab_social_linkedin_url'); ?> <!-- divs right social network icons column --> <div class="eight columns"> <div class="social"> <ul> <?php if(!empty($social1)) { ?> <li><a href="<?php echo of_get_option('fab_social_twitter_url'); ?>"><img src="<?php echo of_get_option('fab_social_twitter_icon'); ?>" alt="follo

javascript - Add class on scroll -

i have fixed black filled svg logo in header want fill white when scrolls on dark full width container div further down page. how html structured: <header class="header"> <a href="> <svg class="logo__container"> <g class="logo"></g> </svg> </a> </header> .logo__container { width: 200px; height: 150px; } .logo { color: #000000; } i'm trying add .logo__white when scrolls on specific divs. sort of how logo works here http://www.dtelepathy.com/philosophy/ if understand right u want add class div when scroll/page position on same point start of div. can jquery. $(window).scroll(function (event) { // when page being scrolled var scroll = $(window).scrolltop(); // define current scroll height var divheight = $('.div-name').height(); // define position (height) of div if (scroll > divheight) { // if current scroll

Django rest framework Database thread pool management -

how django rest framework internally manage database connection pool. persist db connection or 1 db connection each db call? can configure database thread pool connection in django ? the django rest framework uses django's features regarding db connectivity. django opens connection database when first makes database query. keeps connection open , reuses in subsequent requests. django closes connection once exceeds maximum age defined conn_max_age or when isn’t usable longer. you can find detail on persistency of db connections, topic broad cover in here, on relevant django docs article .

javascript - Prevent BODY from scrolling when modal is opened AND input is focused -

similar question 1 here: prevent body scrolling when modal opened .modal{ -webkit-overflow-scrolling: touch; overflow-y: auto; } body.modal--open{ overflow:hidden; } the above css works fine, problem when user focuses on input field within modal body scrolls again. there can done prevent this? thanks!

javascript - AngularJS isteven-multi-select limit display options -

i using isteven-multi-select display select options db. unfortunatelly large array (from "a few" "+100k" records). reason why use smart select filter. there way how can set limit of rendering options improve performance? large array drop down js , firefox. my select: <div isteven-multi-select input-model="data.select.options" output-model="data.select.data" button-label="label" item-label="id label" tick-property="ticked" max-labels="4" > </div> controller: ... datainforesource.query( function(data) { $scope.data.select.options = data; console.log(data); } ); .... i tried select2 not find way how it. thanks advice. may try one: <div isteven-multi-select ... max-height="250px"></div> ps. can't add comment because following answer

javascript - Escape backslash and double quote in mongo $text -

i have problem mongo $text $search phrase. want create $search phrase variable. $search phrase should this: "\"search\"". in javascript can escape quote , backslash adding 1 more slash: '\\\"search\\\"' . if print or pass somewhere different results in different environments. in browser '\"search\"' in node js (5.x) '\\"search\\" . matter? final goal built $search string using in mongodb $text operator. maybe can me or question above. (i know it's late, want answer in case find page looking way solve problem) you don't have write right javascript format. leave in mongoshell db.collection.find({$text:{$search:'\"search\"'}}, function... so, way approach generic string is var search = "generic phrase search"; search = '\"' + search.split(' ').join('\" \"') + '\"'; db.collection.find({$text:{$search:search}}, f

Add vertex attributes to a weighted igraph Graph in python -

i learning python-igraph, , having difficulty in handling graph divided components (which unconnected between them). when apply 1 of clustering algorithms on graph doesn't seem work properly, , need apply algorithms each subgraph (component) separately. in order maintain identification of vertices, add vertex attribute give me id number in original graph. graph constructed weighted adjacency matrix: import numpy np import igraph def symmetrize(a): return + a.t - 2*np.diag(a.diagonal()) = symmetrize(np.random.random((100,100))) g = igraph.graph.adjacency(a.tolist(),attr="weight",mode="upper") i see there should way add vertex attributes , don't understand how use it.. adding vertex attribute of vertices works this: g.vs["attr"] = ["id1", "id2", "id3", ...] you can attach vertex attribute single vertex: g.vs[2]["attr"] = "id3" for instance, if need unique identifier ve

php - simple select returns unexpected result -

running code returns unexpected result <?php error_reporting(-1); try{ $pdo = new pdo('odbc:driver={sql server native client 11.0};server=192.168.178.11;database=test;','sa', 'secret'); $s = $pdo->prepare('select * test'); if($s->execute()){ var_dump($s->fetchall()); } $s = $pdo->prepare('select * test id = ?'); if($s->execute(array(1))){ var_dump($s->fetchall()); } }catch(exception $e){ echo $e->xdebug_message; } returns array ( 0 => array ( 'id' => '1', 0 => '1', 'test' => 'test ', 1 => 'test ', ), 1 => array ( 'id' => '2', 0 => '2', 'test' => 'test2 ', 1 => 'test2 ', ), 2 => array ( 'id' => '3', 0 => 

how do you test csv file content in Rails? -

i'm writing simple canadapost price shipping api, prices given in pdf document in table format (see page 3 of https://www.canadapost.ca/tools/pg/prices/sbparcels-e.pdf ). the data extracted csv files , imported database (table prices has columns weight , rate_code , date ). model , controller simple: take weight , rate_code , date , query prices table. i'm trying create suite of tests tests existence , correctness of every single price in chart. has generic , reusable because data changes every year. i thought of ideas: 1) read same csv files used import data database , create single rspec example loops around rows , columns , tests returned price. 2) convert csv files fixtures prices controller , test each fixture. i'm having hard time categorizing these tests. not unit tests, functional/feature tests? sound more integration tests, i'm not sure if rails differentiates functional tests integration tests. maybe answer obvious , i'm not

Condensed ASP.NET MVC -

i experienced engineer , hear recommendations , condensed books on asp.net mvc, not deal basics. don't need introduced patterns or web development fundamentals. on other hand, last web application worked running on asp.net web forms before ajax framework introduced. book recommendation on trendy/popular ajax frameworks appreciated. any suggestions, please thanks lot k. note: i, of course, had @ book reviews on amazon, etc. looking not recommendations people having similar profiles. unfortunately, impossible know profile of people recommends books on bookstore web sites. looking advise fellow programmer has many years of experience , possibly have had similar requirement. bought books recommended , found them containing details can discovered anyways while working it. perhaps, looking design description of framework brief explanations key objects , components. suggestions appreciated look @ these collection. 1. pro asp.net mvc 5 (expert's voice in asp.net

android - How to setup my environment variables with zsh on the Mac (El Capitan) -

i trying add system environments mac (using el capitan) , using zsh. i have echo following in terminal , following: echo $shell /bin/zsh echo $0 -zsh echo $path /usr/local/bin/bin:/bin:/usr/sbin:/sbin how change system environment variables following - i'm little unsure of how done zsh? i want add following : export ant_home=/usr/local/opt/ant export maven_home=/usr/local/opt/maven export gradle_home=/usr/local/opt/gradle export android_home=/usr/local/opt/android-sdk add text in ~/.zshrc export ant_home=/usr/local/opt/ant export maven_home=/usr/local/opt/maven export gradle_home=/usr/local/opt/gradle export android_home=/usr/local/opt/android-sdk

xamarin.ios - Is PlayN on iOS possible without licensing MonoTouch? -

following instructions on playn wiki able "hello" playn sample running on ios simulator. however, when using monostudio, told need upgrade indie license or higher compile code. (apparently using 33+ features required it.) when activated trial edition, sample compiled , ran fine on simulator. the playn wiki seems indicate you'd need license if plan on testing on real device. wrong or missing something? also, thought idea behind playn build free, open source game engine on top of free, open-source technology. mono both, monotouch neither. there option or stuck shelling out $1000/year use ios (which far seems far implemented on playn side of things)? right now, there isn't. sorry disappointing, nature of ios. non-free platform. perhaps can try hands @ writing cross compiler, , release under opensource license? can try basing on http://gcc.gnu.org/java/ .

java - WSO2 ESB - ws security throws exception, AxisFault, Invalid Security -

i need call web service implements ws-security, rampart, uses username token , time stamp authentication in ssl. when trying call service following soap message ends response in esb log proceeding exception. response soap message "<?xml version="1.0" encoding="utf-8"?> <soapenv:envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"> <soapenv:header> <wsse:security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustunderstand="true"> <wsu:timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:id="timestamp-18784"> <wsu:created>2016-04-19t04:30:20.850z</wsu:created><wsu:expires>2016-04-19t04:35:20.850z</wsu:expires></wsu:timestamp> </