Posts

Showing posts from September, 2013

python - GroupResult is not JSON serializable in Celery -

do similar here retrieving groupresult taskset_id in celery? . after tasks.save() i error: traceback (most recent call last): file "/home/rodions/pma/pma/pma/controllers/report/cross_site_stock.py", line 270, in report_cross_site_stock_refresh tasks.save() file "/home/rodions/pma/env/local/lib/python2.7/site-packages/celery-3.1.17-py2.7.egg/celery/result.py", line 769, in save return (backend or self.app.backend).save_group(self.id, self) file "/home/rodions/pma/env/local/lib/python2.7/site-packages/celery-3.1.17-py2.7.egg/celery/backends/base.py", line 325, in save_group return self._save_group(group_id, result) file "/home/rodions/pma/env/local/lib/python2.7/site-packages/celery-3.1.17-py2.7.egg/celery/backends/mongodb.py", line 170, in _save_group 'result': binary(self.encode(result)), file "/home/rodions/pma/env/local/lib/python2.7/site-packages/celery-3.1.17-py2.7.egg/celery/backends/base.py&q

how to add a noflo chart/plot component -

Image
i have time-series-style array of data pass noflo component displays data in cart/graph/plot using browser runtime , flowhub ui. i've browsed through component library , not found relevant component. i'm familiar several charting libraries , willing write myself, unsure how fit component. is there charting/plotting component missed? i've seen noflo-ducksboard , want able view plot within noflo-ui. how might load charting library component? is there particular charting library suggest use? i have not seen specific charting library. noflo-canvas lower-level, , give primitives need. here quick demo line chart: https://app.flowhub.io/#example/77f213fb32c9b22527e2 to build need build 1 component translates data points drawn.

php - How to grab a word from a page -

i wondering how grab text external page using php. think preg_match() can can't how use it. the text in page following: dragontail-5.7.2.tgz and need grab only 5.7.2 thank helping. check out: https://regex101.com/r/cf8ms1/1 /([0-9.]+)/gm means "select integer characters since more 1, , include "." well, , give me of them, on multiline too. thank you." last thing delete last or first character ".", so: if (preg_match('/([0-9.]+)/gm', $input, $matches)) { $result = trim($matches[1], '.'); } else { $result = null; }

django - Unrecognized flag: '--ext' on python manage.py shell_plus --notebook -

i have django project using django 1.6.10 running on mac os x 10.10 , python 2.7. have django_extensions , ipython[notebook] installed virtualenv using pip: django-extensions==1.5.0 ipython==3.1.0 however, when try run django ipython notebook: 12:02 $ python manage.py shell_plus --notebook ipython notebook crashes with: [c 12:02:37.652 notebookapp] bad config encountered during initialization: [c 12:02:37.652 notebookapp] unrecognized flag: '--ext' this documented here: https://opensourcehacker.com/2014/08/13/turbocharge-your-python-prompt-and-django-shell-with-ipython-notebook/#django_integration i'm not sure crash originating. ideas? this has been fixed in master branch of django-extensions on github. use version of django-extensions: in requirements.txt: # django extensions -e git+git://github.com/django-extensions/django-extensions.git#egg=django-extensions then... pip install -r requirements.txt or @ command line sans requirements.t

c - Pointer Value in Struct Changing Without Reassigning -

i'm getting following output gdb: (gdb) print tid->rvm $28 = (rvm_t) 0x605010 (gdb) step 306 rlog->entries[i].sizes[num - 1] = size; (gdb) step 307 } (gdb) print tid->rvm $29 = (rvm_t) 0x64 (gdb) print tid $30 = (trans_t) 0x607b50 this code tid structure: struct _trans_t { rvm_t rvm; int numsegs; segment_t* segments; }; the rvm_t rvm struct containing metadata recoverable virtual memory pager. i don't believe allowed post full function code happening, because university assignment, can see single line of code change occurs, rlog->entries[i].sizes[num - 1] = size; . there no reference value changed. have use ugly typedefing pointers structs thing. assignment submission server contains header file as-is , can't edit it. my question heck can cause this. tid passed parameter function rvm_about_to_modify(trans_t tid, void *segbase, int offset, int size) . struct member rvm never touched inside function , can see step s

c# - How to parse string in the format "20150129163809" to datetime? -

this question has answer here: convert string value format of yyyymmddhhmmss c# datetime 2 answers i application need convert string in datetime format below: var k= datetime.parse("20150129163809"); but throwing error message "string not recognized valid datetime." but, when datetime.parse("2015-01-29 16:38:09") its working fine... what wrong? use parseexact parse well-formatted strings: var k = datetime.parseexact("20150129163809","yyyymmddhhmmss",cultureinfo.invariantculture); datetime.parse limited in capabilities , not try , "guess" format string in.

debugging - How do I get Chrome Dev Tools to allow me to edit minified JavaScript in production? -

i need test fix, , production data failing (and tangled nest of foreign keys prevent copying data down test). the javascript fix simple, 2 or 3 lines section_functions.min.js. i open dev tools, click sources tab, drill down file... edit it. cntl+s, star disappears file's tab in dev tools. i use web app's interface in such way altered function in file should invoked... but in console, same error before , it's telling me exception on /js/section_functions.min.js (old):1 . i know it's possible edit javascript live in fashion, , must doing boneheaded preventing using modified version. failing correctly? there usefull trick, add sourcemap compressed js file can see , edit code in beauty way. other way faster using {} buton in chrome tools in bottom of file in left of line , column number when have looking can edit it. good luck

c++ - C programming unary operator precedence -

this question has answer here: difference between a+++++b , a++ + ++b [duplicate] 1 answer #include <stdio.h> int main() { int c=10,b; b=++c+++c; printf("%d",b); return 0; } could please let me know,why throwing compilation error? the gibberish tokenised as ++ c ++ + c and parsed as ((++c)++) + c this tries increment rvalue yielded ++c , isn't allowed. can increment lvalue (or class type, in c++). even if allowed, give undefined behaviour: you'd have unsequenced modification , use of value of c .

java - Thymeleaf Not Hot Swapping Intellij -

i having issues getting thymeleaf templates hot swap / update using intellij. @ moment have full server restart in order see changes, rather tedious , slows down work flow. i using gradle, intellij 14.1, , tomcat 8. running application in debug mode. i have tried setting thymeleaf not cacheable. @configuration public class thymeleafconfig { @autowired environment environment; @bean public servletcontexttemplateresolver templateresolver() { servletcontexttemplateresolver resolver = new servletcontexttemplateresolver(); resolver.setprefix(environment.getrequiredproperty("thymeleaf.resolver.prefix")); resolver.setsuffix(environment.getrequiredproperty("thymeleaf.resolver.suffix")); resolver.settemplatemode(environment.getrequiredproperty("thymeleaf.resolver.templatemode")); resolver.setorder(environment.getrequiredproperty("thymeleaf.resolver.order", integer.class)); resolve

java - I just started learning Maven. How does Eclipse build without it? -

i've been coding java in eclipse awhile without needing specify dependencies. learned how maven it, i'm wondering: how did eclipse build projects on own? how did eclipse figure out versions of imports, , dependencies of dependencies, needed make work? finally, advantages , disadvantages of building project in eclipse starting new->other->maven project instead of new->java project? to first question: eclipse doesn't add dependency in standard java project. have manually add build path needed jars, otherwise you'll have compilation errors. to second question: if create standard java project maven not used, if create pom.xml file in root of project. can convert standard java project in maven project (see convert existing eclipse project maven project ).

javascript - Selecting an option from one drop down populates other input fields -

i trying figure out how populate other tags specific text after selecting drop down. so if drop down , drop down below following should happen. when choose "a" dropdown1, dropdown2 should populate "you chose a". if choose "b" dropdown2 should "you chose b". same goes "c" here sample code below. <html> <body> <form> <select id="dropdown1"> <option value = "a">a</option> <option value = "b">b</option> <option value = "c">c</option> </select> <select id="dropdown2"> <option value="you chose a">you chose a</option> <option value="you chose b">you chose b</option> <option value="you chose c">you chose c</option> </select> </form> </body> </html> any appreciated. if show code awesome or if po

c# - Can a collection be modified by another thread during ToList() -

this question has answer here: are ienumerable linq methods thread-safe? 2 answers class sample { private list<int> _list; public list<int> list { { return _list.select(p => p + p).where(q => q % 2 == 0).tolist(); } } public void add(int n) { _list.add(n); } public void remove(int n) { _list.remove(n); } } i have situation similar above in multithreaded environment add , remove , list accessed multiple threads simultaneously. in cases collection modified; enumeration operation may not execute thrown in list getter, makes sense threads can add/remove while select/where operations executing. can list modified thread during call tolist() ? meaning, changing getter to return _list.tolist().select(p => p + p).where(q => q % 2 == 0); be en

winavr - main.c:19: undefined reference to `usbInit' & undefined reference to `usbPoll' -

i faced error in building project using v-usb library.followed code : #include <avr/io.h> #include <avr/interrupt.h> #include <avr/wdt.h> #include "usbdrv.h" #include <util/delay.h> usb_public uchar usbfunctionsetup(uchar data[8]) { return 0; // nothing } int main() { uchar i; wdt_enable(wdto_1s); // enable 1s watchdog timer usbinit(); usbdevicedisconnect(); // enforce re-enumeration for(i = 0; i<250; i++) { // wait 500 ms wdt_reset(); // keep watchdog happy _delay_ms(2); } usbdeviceconnect(); sei(); // enable interrupts after re-enumeration while(1) { wdt_reset(); // keep watchdog happy usbpoll(); } return 0; } and relative part in usbdrv.h: #ifndef usb_public #define usb_public #endif usb_public void usbinit(void); usb_public void usbpoll(void) can me? i guess have forgotten add usbdrv-c files makefile or may compiled , have add them lib make file. (but afair v-usb have add c-files) p

Meteor update a Collection object -

in meteor, i'm having collection schema, , number of items added dynamically. in case, i'm dealing milestones object , , once user check 1 off want update complete in collections item true (default false) here schema milestones: { type: array, optional: true }, 'milestones.$': { type: object }, 'milestones.$.name': { type: string }, 'milestones.$.hours': { type: number }, 'milestones.$.complete': { type: boolean } how write $set statement this? you have array of objects so, $elemmatch trick here. projects.update({_id:this._id},{milestones:{$elemmatch:{'milestones.$‌​.name':this.name}},{$set:{'milestone.$.complete':value}}})

Unable to use the setup_twitter_oauth() function in R to work with twitter -

i trying use twitter package in r , have installed required packages viz :install.packages("twitter", "rcurl", "rjsonio", "stringr") loaded them well. when try set twitter connection using setup_twitter_oauth(api_key, api_secret, token, token_secret) command required parameters , error : error: not find function "setup_twitter_oauth" don't know problem.please help. edit: following result of sessioninfo() command : > sessioninfo() r version 3.1.2 (2014-10-31) platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] lc_collate=english_india.1252 lc_ctype=english_india.1252 [3] lc_monetary=english_india.1252 lc_numeric=c [5] lc_time=english_india.1252 attached base packages: [1] stats graphics grdevices utils datasets methods base other attached packages: [1] rfacebook_0.5 rlinkedin_0.1 tm_0.6 nlp_0.1-6 [5] wordcloud_2.5 rcolorbrewer_1.0-5 xml_3

inheritance - Fluent NHibernate Create entity mapping for overlapping entities -

for eg. have 2 tables in database nonresidentstudents - columns studentid, studentname, modeoftransport residentstudents - columns studentid, studentname, dateofjoininghostel studentid , studentname common columns , last column uncommon between two for reason, cant change these tables or define common master table , make uncommon columns in sub tables. table stucture rigid. now when trying create entity , mapping above schema using fluent nhibernate (only) know if can define sort of common entity , common mapping common columns , create child entities inheriting common entities. in child entity , mapping class have representations uncommon columns. please share code of how it. i did before. common class public class basemapping : classmap<entitybase>{ public basemapping () { useunionsubclassforinheritancemapping (); // rest of mapping attributes } } for individual classes inherit base this: public class departmentmapping

javascript - How to get a Right Triangle's points' coordination in the space? -

Image
i have right triangle equal legs of 1 unit long rotated on 3 individual angles in space in picture below: as seen in picture, input have angles 'a' , 'b' rotates triangle in space , move orientation 1 "red triangle in picture" (the triangle still laying on z-axis), rotates on 1 of it's legs ('c' angle) , turns second orientation "the green triangle in picture". also, right corner located on (0,0,0). here question: how in simple mathematics, can 2 coordination (marked in blue in picture) green triangle, in x, y , z? i need in simple mathematics can code in javascript. never mind. i reviewed triangular knowledge , solved problem basic functions including sine, cosine , arctangent! now have points in space!

javascript - Angular custom directive - two way binding which always sets attribute to true or false -

i'm creating custom angular directive slide in menu needs watch couple of attributes , 1 of attributes needs 2 way bound main controller scope (sometimes). however, attribute not added developer needs added automatically , set default (false). so, directive can used this. <slide-menu position="right" is-open="menuisopen"></slide-menu> or this: <slide-menu></slide-menu> when used first way main controller able open , close menu changing value of boolean $scope.menuisopen. when used without supplying is-open attribute should default false , used internally , child toggle directive. an additional complication whether attribute supplied developer or not should exist in dom. in second example above directive set false default , add attribute is-open="false" dom? the reason requiring is-open="false/true" in dom @ times menu operated using css tansitions use following selector: slide-menu[is-active="t

Is the Receive Marketing Emails field on a Customer available through the Bigcommerce API? -

the bigcommerce admin area shows receive marketing emails field customer. field not appear in api response data or documentation customer entity in documentation. is there way access value through api? i learned bigcommerce support receive marketing emails field cannot accessed through api , not represent opt-in store's email newsletters. value set customers default , refers whether or not receive "abandoned cart" or "product review" emails, if enabled in store. if customer opts out of emails through link in email receive, value changed 'no'.

qt - Fill the QLabel/QGraphics widget placed in the grid with the image -

Image
i have placed 2 qgraphicsview's , 1 qlabel inside horizontal layout (qhboxlayout) layoutstretch set 1, 1, 1 . problem when try load images inside them, images not fill widgets area. here code: qpixmap pix1("image1.jpg"); pix1 = pix1.scaled(ui->label1->size()); ui->label1->setpixmap(pix); qpixmap pix2("image2.jpg"); pix2 = pix2.scaled(ui->graphicsview1->size()); ui->graphicsview1->scene()->addpixmap(pix2); qpixmap pix3("image3.jpg"); pix3 = pix3.scaled(ui->graphicsview2->size()); ui->graphicsview2->scene()->addpixmap(pix3); and here undesired output: i have tried setting horizontalpolicy , verticalpolicy property of widget expanding , minimum , none of them helped either. set size policy qsizepolicy::ignored , scale qt::keepaspectratiobyexpanding : ui->label1->setsizepolicy(qsizepolicy::ignored, qsizepolicy::ignored); pix1 = pix1.scaled(ui->label1->size(), qt::keepaspect

html - how to show different number of records until a submit button is pressed in php -

i want if user enters name of item in text box particular details database should displayed on same page in table below. right working 1 item. if user wants select multiple items , want show record of each selected item on page until submit button not pressed. here code. appreciated. <html> <head> <title>sales</title> <script> function search(string){ var xmlhttp; if(window.xmlhttprequest){ xmlhttp = new xmlhttprequest(); }else{ xmlhttp = new activexobject("xmlhttp"); } xmlhttp.onreadystatechange = function(){ if(xmlhttp.readystate == 4 && xmlhttp.status == 200){ document.getelementbyid("search").innerhtml = xmlhttp.responsetext; } } xmlhttp.open("get", "sales_search.php?s="+string, true); xmlhttp.send(null); } </script> </head> i have not included css code shorten it. <?php include "connection.php"; function sales_result() { $submit = $_get['fin

python - Need help in pattern matching -

problem: sentence starts hi (case insensitive) , not followed space , letter d. my regex : [hi|hi|hi|hi][^ d|d][a-za-z ]* however, don't understand why string hi dave how doing getting accepted regex. i using python re library this. try: have tried different versions [^ ][^d|d] , none of these seem work. you can't use alternation inside of character class. character class defines set of characters. saying — "match 1 character specified class". easiest way implement negative lookahead while utilizing inline (?i) case-insensitive modifier , anchoring . (?i)^hi(?! d).* explanation: (?i) # set flags block (case-insensitive) ^ # beginning of string hi # 'hi' (?! # ahead see if there not: d # ' d' ) # end of look-ahead .* # character except \n (0 or more times)

Populate a list view in on create android -

i trying populate listview on screen called leaderboard.xml have been around loads of different sites , nobody seems show clear way of doing (most seem require form of user input). i have database helper class below: package com.example.deepseadiver; import java.util.arraylist; import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlexception; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; public class databasehelper { private static final string database_name = "scoredatabase"; private static final int database_version = 1; private static final string table_name = "highscores"; private openhelper mdbhelper; private sqlitedatabase mdb; private final context dbcontext; private static final string database_create = "create table " + table_name + " (" +

is XML well signed with xades-bes signature -

i've got xml file should signed certificate enerated openssl. <?xml version="1.0" encoding="utf-8"?><ds:signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" id="pemi-signature-id-1"><ds:signedinfo id="pemi-signedinfo-id-1"><ds:canonicalizationmethod algorithm="http://www.w3.org/tr/2001/rec-xml-c14n-20010315"></ds:canonicalizationmethod><ds:signaturemethod algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:signaturemethod><ds:reference id="pemi-reference-id-1" uri="#pemi-object-id-2"><ds:digestmethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:digestmethod><ds:digestvalue>rq307h+y/mfzlpfuzuchjxmhj/8=</ds:digestvalue></ds:reference><ds:reference id="pemi-reference-id-2" type="http://uri.etsi.org/01903#signedproperties" uri="#pemi-signedproperties-id-1&

php - How to get common minimum value in two arrays -

i have function checks on 2 arrays , returns common minimum value in both arrays. returns correct answer when both arrays have equal number of elements. other other bigger not return correct one. how overcome this? <?php $a = array(0); $b= array(1,0); $n = sizeof($a); $m = sizeof($b); sort($a); sort($b); $i = 0; ($k = 0; $k < $n; $k++) { if ($i < $m - 1 , $b[$i] < $a[$k]) $i += 1; if ($a[$k] == $b[$i]) echo $a[$k]; } echo "end"; ?> thanks a way simpler way take minimum value of intersection of arrays : $array = array (5,6,7,8,9); $array2 = array (9,7,5,3,4,1); $min = min(array_intersect($array, $array2)); echo $min; // 5

Laravel recaptcha validation in registrar does not work -

i newbie in laravel. i've used recaptcha package: https://github.com/greggilbert/recaptcha , documentation saids that: in validation rules, add following: $rules = array( // ... 'g-recaptcha-response' => 'required|recaptcha', }; by way use laravel 5's registrar: <?php namespace taxman\services; use taxman\user; use validator; use illuminate\contracts\auth\registrar registrarcontract; class registrar implements registrarcontract { /** * validator incoming registration request. * * @param array $data * @return \illuminate\contracts\validation\validator */ public function validator(array $data) { return validator::make($data, [ 'name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:4', 'telephone' => &#

module - Understanding the Ruby mixin's proxy class mechanism -

i refering follwing article, paragaph "pitfall #1": http://definingterms.com/2013/03/23/pitfalls-of-ruby-mixins/ i've got following setup, changed form of 1 used in article: module emailreporter def send_report #sending report ... puts self.class end end class person end class employee < person include emailreporter end as understand, when include emailreporter in employee, methods not pasted it, anonymous proxy class created , put inheritance chain above employee , under person. when call employee.new.send_report, not in scope of employee, in scope of proxy class. thus, not have access constants or class variables of employee, have access instance variables. questions: if run employee.new.send_report, output "employee", not "employee__proxy_class". why that? shouldn't "self" refer proxy class? the article suggest proxy class delegates method calls module emailreport. of course cannot cal

c# - Interop.OpcAutomation.dll not able to connect to Remote Opc server. Error : Access Denied -

i trying connect remote opc server client using c#. got interop.opcautomation.dll opc foundation , worked nicely local opc server, when comes connect remote opc server somehow shows access denied (hresult: 0x80070005 (e_accessdenied)). here code: this._reqserver = new opcserver(); this._reqserver.connect("opc.simaticnet.1", "machinename"); //here throws exception so here tried: configured permission in dcom in mycomputerproperties , opcenum. i checked third party clients such opcquickclient , can able access remote opc server same client, forces me come conclusion configuration @ server side ok. so has tried make c# client can access remote opc server, please tell more needs done?? create local user on computer has same user name , password 1 on server. right click on visual studio , run using user.

java - Populate Array from Oracle Database -

i trying create db connection , populate array results. need populating "destinationitem[]" sql below. //destinationbean.java // manual array works need populated db using below query , db connection info. private destinationitem[] destinationresults = new destinationitem[]{ new destinationitem("58285", "dodge grand caravan"), new destinationitem("57605", "dodge sx 2.0"), new destinationitem("58265", "chrysler 300 touring") }; public destinationitem[] getdestinationresults() { return destinationresults; } public class destinationitem { string destid; string commdefid; public destinationitem(string destid, string commdefid) { this.destid = destid; this.commdefid = commdefid; } // getter/setter below // end i need take db connection logic , populate "destinationitem[]" array abo

regex - logstash grok filter pattern not found -

i've been attempting create custom grok patterns logstash. of them work fine, 1 has got me stumped. pattern is: winuser (?<=user:\s)\w+ here sample of data being searched: 2015-04-14 14:06:18 exchange.ows1.osborneit.com info 1149 nt authority\network service remote desktop services: user authentication succeeded: user: administrator domain: . source network address: 172.24.1.32 i have tested on http://grokconstructor.appspot.com/do/match , works correctly, logstash seems ignore it. can't seem figure out i'm doing wrong. below logstash configuration: input { udp { type => "eventlog" codec => json port => 5140 tags => ['windows', 'eventlog'] } } filter { if [type] == "eventlog" { grok { match => [ "message", "%{ip:client}", "message", "%{winuser:username}" ] } } } output { elasticsearch { host => localhost }

Ant conditional unless possible? -

i'd target execute if either of 2 conditions met. can have 2 unless evaluated 1 target? essentially, i'd target not run if either of these true: unless="product.is.x" or "product.is.y" sorry if i'm going in wrong way, i'm new ant. read targets mention how it: a target has ability perform execution if (or unless) property has been set. in case, can like: <condition property="mytarget.condition"> <or> <equals arg1="${product.is.x}" arg2="true" /> <equals arg1="${product.is.y}" arg2="true" /> </or> </condition> ... <target name="mytarget" unless="mytarget.condition"> ...

Meteor session keeps resetting in cart -

i building web store using meteor. having issue meteor session gets reset when item added cart. user can add item cart 2 locations - master products listing page , product detail page. scenario a: customer on master products listing page , adds item cart. customer clicks on products detail page item. customer adds item cart products detail page. new session created , items added on products listing page disappear , products product detail page in cart. so problem new session created when item added cart , i'm not sure why that's happening... here addtocart click event productdetails.js: 'click .add-to-cart': function (e, tmpl) { e.preventdefault(); var quantity = $('[name=qty]').val(); var thisproduct = products.findone(); var sessionid = meteor.default_connection._lastsessionid; var productinfo = { productcode: thisproduct.productcode, memprice: thisproduct.memprice, brand: thisproduct.brand, size: thisproduct.size, description: thisprodu

Displaying the phone number of a contact in Android Contact Content Provider -

i trying write program display id, name , phone number of contact in android. far id , names of contact displayed number of contact doesn't. can me, below code program: package com.example.oghenekaroedoh.provider; import android.app.listactivity; import android.content.cursorloader; import android.database.cursor; import android.net.uri; import android.os.bundle; import android.provider.contactscontract; import android.util.log; import android.widget.cursoradapter; import android.widget.simplecursoradapter; public class provider2activity extends listactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_provider); uri allcontacts = contactscontract.contacts.content_uri; //query string our contacts //uri allcontacts = uri.parse("content://contacts/people"); //declare our cursor cursor c; string[] projec

java - Extracting Salt out of Jasypt Digest -

i using jasypt encrypt user's password. understanding, jasypt appends salt digest. want able extract salt digest , save in db can have encrypted password , salt on separate fields. i've looked @ documentation , there doesn't seem a way this.

javascript - How to preselect Section in knockout-postbox.js so that the content is visible -

after looking ryan niemeyer's brilliant knockout-postbox.js made minor adapting , want menu open preselected section. hence added variable initialization of selectedsection observable seen below. var menumodel = function() { var preselected = "profile"; this.name = ko.observable().subscribeto("nickname"); this.sections = ["profile", "notifications","users","projects"]; this.selectedsection = ko.observable(preselected).publishon("section"); }; this selects desirable section, contents of section remains invisible. here's preselected sections viewmodel: var profilemodel = function() { //apply filter turn value receive boolean this.visible = ko.observable().subscribeto("section", function(newvalue) { return newvalue === "profile"; }); //some more code - syncing , subscribing/publishing observables. }; the html goes this: <div id=&q

unix - Reading zipped sas datasets and zipping them on the fly -

i working large files on unix server gzip compression capabilities , space purposes files remain zipped. know how read in zipped txtfile, to: 1) zip dataset created zipped txtfile 2) later set zipped sas dataset in datastep/procedure. is possible? if please alter code below, do: libname lib "path"; filename txtfile pipe "gzip -dc filepath"; data lib.ds1; **would zipped sas dataset**; infile txtfile dlm="|" missover dsd; input *columns*; run; data lib.ds2; **would zipped sas dataset**; set lib.ds1; *setting zipped sas dataset; run; try executing gzip command sas session. data _null_; command = 'gzip -c /path/ds2.sas7bdat > /path/ds2.sas7bdat.gz'; call system (command); run; for testing purposes, keep -c option. way can keep original file , compare newly compressed one.

function - How to access a variable outside of a nested for loop in JavaScript -

i have js function loops. inside nested loops, str element prints of intended elements. but, outside doesn't print of it. appreciate help. here code: function getresearchersfullname(alldatajson){ var str = []; var myarr = []; var c = 0; for(var = 0; < alldatajson.length; i++){ myarr[i] = alldatajson[i].researchers.split(", "); for(var j = 0; j < myarr[i].length; j++){ str[c] = myarr[i][j]; //console.log(str[c]); //prints expected } } return str; } i trying use returned value follows prints 1 of str values. var fullnames = getresearchersfullname(alldatajson); for(var = 0; <fullnames.length; i++){ console.log(fullnames[i]); //returns 1 object } your code never increments c . element of str that's ever modified element 0. use str.push(myarr[i][j]); , won't need c @ all.

mysql - Limit Group Concat for first 5 products -

i have few group concats in query, loading time slow, because think de query concats , limit end result. prijs-table big takes 8 seconds load. this query: select babyfoontest.idnummer, babyfoontest.typenummer, deeplink, merk, afbeelding, group_concat(price) `prijs`, group_concat(producturl) `deeplink`, $query_string_variable total prijzen inner join babyfoontest on prijzen.eancode = babyfoontest.ean (shopnaam = 'amazon' , categorie = 'babby en dreumes') group eancode order total desc, abs(prijs) limit 0, 5; i want show first 5 products how can limit group-concats first 5 rows? need subquery? if so, how do in example? sorry, not expert in sql. thanks much! kind regards, mark

java - How to share state between test classes in a suite with TestNG and Maven? -

i have java test framework set using testng , maven. tests organized suites via testng xml files. i share state between different test classes in same suite. specifically, want share id 'test plan' created in testrail test case manager @ start of test suite execution. how that? testng doesn't seem offer functionality transferring information between test classes, , i'm unsure of how @ maven level either. static variable in parent class work, or leak or cause many thread-safety issues? update: have decided solve problem using static variable in parent class (which holds various state tests running). use case, i'm not run multiple instances of parent class concurrently in same jvm in way needs static variable threadsafe. however, still open other ideas on how accomplish this, because enjoy learning new things. i think can use beforemethod annotation , put stuff desired state before each test execution. more "state sharing" not desired.

.net - WCF and "Persistent Connections" -

i trying calls wcf services use load balancer (an f5). the problem when try set 1 of machines in pool "disabled" still send requests through machine. the documentation f5 says when server disabled "only persistent or active connections allowed". i wondering if wcf using persistent connection (or similar) bypassing loadbalancer's efforts disable node on server. (the goal disable server, active connections out, update code on server, re-enable it.) does wcf use persistant connections default? if so, way turn off? there no default connections in wcf (you mean - communication channels) depends explicit or implicit (via factories) hosting configurations. the (true-)'persistent' communication provided duplex nettcpbinding (active connections). durable services allows other (business-)dimension of persistence (via http, connections not open, active). wcf sessions, reliable sessions - same story - fake 'persistence'. so che

python - How can I avoid double checking in a brute force search? -

i saw post on reddit counterexample euler's conjecture. decided try brute force calculation myself. my code import numpy np fifths1 = np.arange(1,151) fifths = fifths1**5 x in fifths1: y in fifths1: z in fifths1: w in fifths1: lambdas=[x,y,z,w] if sum(np.array(lambdas)**5) in fifths: print((x,y,z,w)) however, code takes long because triple checks cases. from paper linked, counter example is 27^5 + 84^5 + 110^5 + 113^5 = 144^5 my code returns (27, 84, 110, 133) (27, 84, 133, 110) (27, 110, 84, 133) (27, 110, 133, 84) (27, 133, 84, 110) (27, 133, 110, 84) how can optimize brute force search not check same case multiple times. i think numpy wrong library use here. this isn't problem can vectorised in current form (the biggest reason use library) and, furthermore, looping on numpy arrays slower looping on python lists. you incur performance penalty constructing new

assembly - MASM32 error A2070: invalid instruction operands -

i have assembly32 code hanoi, can't compile it, error: hanoi.asm(9) : error a2070: invalid instruction operands use masm32. the full code: .586 .model flat public _towers extern _printf:near .code _towers:push ebp mov ebp, esp sub esp, 4 cmp [ebp+8], 1 ;error jne l1 mov eax, [ebp+16] push eax mov eax, [ebp+12] push eax push offset flat:format; call _printf add esp, 12 jmp done l1: mov eax, 6 sub eax, [ebp+12] sub eax, [ebp+16] mov [ebp-4], eax push eax mov eax, [ebp+12] push eax mov eax, [ebp+8] dec eax push eax call _towers add esp, 12 mov eax, [ebp+16] push eax mov eax, [ebp+12] push eax push 1 call _towers add esp,12 mov eax, [ebp+16] push ea

button - Javascript background changing based on function -

i have simulate function chooses random numbers between 0 , 37 when click button. if it's even, background red. if it's odd, background black. initial background light blue. have far, , not working. <html> <head> <title>wheel</title> <script type="text/javascript"> var currentnum = wheelspins(); document.body.style.backgroundcolor = "#00ffff"; function wheelspins() { return math.floor(math.random() * 37); if(currentnum % 2 == 0){ style.backgroundcolor="#ff0000"; } else if(currentnum %2 == 1){ style.backgroundcolor="#000000"; } } </script> </head> <body> <form> <input type="text" name="number" value="" id="wheelspins()" size="10"/> <input type="button" value="spin wheel" onclick="document.getelementbyid('wheelspins()').value=wheelspins();"/> </form> </body> </html&

How can I use python xlib to generate a single keypress? -

i want make simple python 3 script generate single keypress (f15). don't want use bunch of libraries need 1 key pressed , don't need support whole keyboard. know need use keypress , keyrelease in order generate keyboard event. i'm not sure start , documentation little confusing. http://tronche.com/gui/x/xlib/events/keyboard-pointer/keyboard-pointer.html http://python-xlib.sourceforge.net/?page=documentation i'll use ctypes show how work, porting python-xlib should straightforward. lets start loading library: import ctypes x11 = ctypes.cdll("libx11.so") and defining structures needed: class display(ctypes.structure): """ opaque struct """ class xkeyevent(ctypes.structure): _fields_ = [ ('type', ctypes.c_int), ('serial', ctypes.c_ulong), ('send_event', ctypes.c_int), ('display', ctypes.pointer(display)), ('