Posts

Showing posts from March, 2010

python delete empty sub lists of list -

this question has answer here: modification of list items in loop (python) [duplicate] 3 answers i want delete empty sub list, ways failed, other ways successful. why ? worry way: data=[[],[],[],[],[]] rows in data: if len(rows)==0: list.remove(rows) print data the result [[],[]] .it isn't expected result [] the correct way(my friend tell me,thank him): list = [[],[],[],[],[]] a=list(filter(lambda x: [] != x, list)) print the result expected empty list [] avoid iterating on list while doing changes on it: data=[[],[],[],[],[]] rows in data: if len(rows)==0: data.remove(rows) print data instead, create new list: >>> lst = [] >>> data = [[],[],[],[1,2,3]] >>> >>> rows in data: if rows: #if rows not empty list lst.append(rows) >>> lst [[1, 2, 3

python - scrapy start_requests not entering callback function -

i don't know why callback function (parse) not getting called start_requests urls.it gets terminated without entering parse function. this cbrspider.py file class cbrspider(scrapy.spider): name = "cbr" allowed_domains = ["careerbuilder.com"] start_urls = ( 'http://www.careerbuilder.com/browse/category/computer-and-mathematical', ) def start_requests(self): in range(1,2): yield request("http://ip.42.pl/raw", callback=self.parse_init) in range(1,2): yield request("http://www.careerbuilder.com/jobs-net-developer?page_number="+str(i)+"&sort=date_desc", callback=self.parse) in range(1,3): yield request("http://www.careerbuilder.com/jobs-it-manager?page_number="+str(i)+"&sort=date_desc", callback=self.parse) def parse_init(self, response): self.ip = response.xpath('//body/p/text()').extract() def

continuous integration - How to fix failed tests count in teamcity for re-executed tests? -

we using teamcity selenium tests execution specflow+specrun , problem teamcity count re-executed tests. for example if test failed first time re-executed 2 times more, in teamcity see 3 tests failed, 1 test. also if first re-execution fail, other 2 success, reported in teamcity 2 failed, 1 passed, need reported 1 test has been passed. it possible configure in teamcity using service messages or else? updated: based on answer can gather logs using powershell script , change build status using teamcity service messages: $path = get-childitem %teamcity.build.checkoutdir%\projectfolder\bin\remote\testresults\specrun.log $file = get-content $path $total = $file | select-string "total:" $passed = $file | select-string "succeeded:" $failed = $file | select-string "failed:" write-host $( "##teamcity[buildstatus text='tests {0}, {1}, {2}']" -f $total, $passed, $failed ) teamcity behaving expected . teamcity reports testi

assembly - memory adressing on intel ia 32 -

i know memory addressing can done multiples of word size intel 32 bits, allocating memory on stack in assembly can done //pseudo code sub , esp ,4 // allocating integer on stack sub esp, 8 // buffer of size 5 example b[5] so addressing done multiples of 4's. referring locals , parameters on stack done with // referring variable --ebp-4 but in disassembly see instructions like movb $0x41, 0xffffffff(%ebp) ,// refer ebp-1 example so refers memory 1 bytes. so refers 1 byte, not multiple of 4 bytes.the multiple of 4 bytes esp? or related every register? the multiple of 4 bytes esp? or related every register? note that sub esp, n doesn't access memory location, use related memory alignment instruction simple register-immediate subtraction, it use value. for performance reason if read 16 bits should on address multiple of 2, 32 bits should on address multiple of 4. called natural boundary alignment . 32 bit

soapui - SOAP UI Error in Windows system -

i formatted system. on same system soap ui working fine. when click on button results, after importing wsdl, nothing happens. not showing error. the soap ui error log: 2013-07-23 12:49:30,196 error [errorlog] com.eviware.soapui.model.iface.request$submitexception: com.eviware.soapui.impl.wsdl.submit.requesttransportregistry$missingtransportexception: missing protocol in endpoint [https:/cccp.ext.nokia.com/eai_enu/start.swe?sweextsource=webservice&sweextcmd=execute&username=xxxxx&password=xxxxx] com.eviware.soapui.model.iface.request$submitexception: com.eviware.soapui.impl.wsdl.submit.requesttransportregistry$missingtransportexception: missing protocol in endpoint [https:/cccp.ext.nokia.com/eai_enu/start.swe?sweextsource=webservice&sweextcmd=execute&username=xxxxx&password=xxxxxx] @ com.eviware.soapui.impl.wsdl.wsdlrequest.submit(wsdlrequest.java:213) @ com.eviware.soapui.impl.wsdl.panels.request.abstractwsdlrequestdesktoppanel.dosubmit(abstrac

versionone - How to query "Included items in the Backlog" for BuildRun from API? -

buildruns have 2 sets of backlog item "completed items in backlog" , "included items in backlog". querying "completed items in backlog" obvious, how "included items in backlog"? the source "completed items in backlog" buildrun.completedprimaryworkitems . "included items in backlog", source buildrun.changesets.primaryworkitems - is, of primary workitems associated changesets included in build run.

appcelerator - Pass project to another developer without changing package name -

i have pass project developer has continue maintenance , development. gave him package project contents he's unable build because guid bound developer account. can unregister app can freely continue development? have create new app new package name? way has publish new app in stores , not update old ones (which wouldn't do). thank alex if app not using appcelerator analytics or arrow can remove <guid> in tiapp.xml , re-register app new organisation. if use arrow/analytics need contact support@appcelerator.com have app transfered.

linux - Eliminating the impact of UnionFS on results when benchmarking inside Docker -

i trying benchmark overall system performance of running docker using phoronix test suite 6.4.0 milestone 2 running inside fedora:23 image based container. one thing must considered is, docker uses proprietary unionfs store data. however, when running real-world application (like apache) inside docker, persistent data stored on dedicated folder on host, running on standard linux filesystem ext4, or in case btrfs. the solution propose use " docker volume " mount host directory docker. thing don't know directories used in benchmarks , have mounted inside docker container. the test suite pts/disk example should use docker volumes instead of unionfs. contains these tests. pts/compress-gzip pts/sqlite pts/apache pts/pgbench pts/compilebench pts/iozone pts/dbench pts/fs-mark pts/fio pts/tiobench pts/postmark pts/aio-stress pts/unpack-linux which directories in docker container should mounted host (made docker volumes)? idea use docker volumes? there other caveats

Detect a hyper link by jquery -

i have html page jquery. wan detect link. please read below codes: <a href="http://google.com">google</a> <a name="anchor">anchor</a> here 1st code link. 2nd code isn't link. jquery code: <script> $("a").click(function(){ alert("you clicked on link"); }); </script> the problem if click on both first 2 codes alerts have clicked on link. idea detect actual link? please me anyone! use has attribute selector: $("a[href]").click(function() { // something. });

android - List view changing views automatically? -

Image
i couldn't find problem,whenever scrolling view change .pls me out...t think android recycle views how override ? 1.before scrolling 2.after scrolling public class mobilearrayadapter extends arrayadapter<string> { private final context context; private final string[] values; private layoutinflater inflater; public mobilearrayadapter(context context, string[] values) { super(context, r.layout.list_mobile, values); inflater = layoutinflater.from(context); this.context = context; this.values = values; } @override public view getview(int position, view convertview, viewgroup parent) { view rowview=convertview; if (rowview == null) { rowview = inflater.inflate(r.layout.list_mobile, null); viewholder viewholder = new viewholder(); viewholder.text = (textview) rowview.findviewbyid(r.id.label); viewhol

html - Floating footer hits absolute positioned div -

Image
i trying create footer responsive , sticks bottom right of page can't work consistently when absolutely positioned div on same page. the code using can seen at: http://192.241.203.146/sample-page/ i have tried: position: absolute; bottom: 0; right: 0; margin-bottom: 10px; margin-top: 40px; as as: float: right; bottom: 0; right: 0; margin-bottom: 40px; margin-top: 40px; to work, not respect absolutely positioned content on page when resized down mobile. clashes so: i know using position:absolute means div removed flow of objects need use on element in middle of page avoid objects jumping around when use jquery fades. i suspect because not inside span or row per bootstrap base using. problem? i'm @ loss here - guidance appreciated :) your problem div normal page, position absolute. inspecting code saw this: if want footer visible in bottom, can wrap footer div width 100% of width of page. this: div#footer_container{ min-width: 100%; min-he

ios - sockets loses connect when moving between wifi to 3g -

i developing socket based application. it working fine , socket connection working fine. but when moving between wifi 3g loss socket connection. is there solution issue. that expected since new ip address when switch networks. need handle disconnect , re-establish connection

python - Sympy - Comparing expressions -

is there way check if 2 expressions mathematically equal? expected tg(x)cos(x) == sin(x) output true , outputs false . there way make such comparisons sympy? example (a+b)**2 == a**2 + 2*a*b + b**2 surprisingly outputs false . i found similar questions, none covered exact problem. from the sympy documentation == represents exact structural equality testing. “exact” here means 2 expressions compare equal == if equal structurally. here, (x+1)^2 , x^2+2x+1 not same symbolically. 1 power of addition of 2 terms, , other addition of 3 terms. it turns out when using sympy library, having == test exact symbolic equality far more useful having represent symbolic equality, or having test mathematical equality. however, new user, care more latter two. have seen alternative representing equalities symbolically, eq. test if 2 things equal, best recall basic fact if a=b, a−b=0. thus, best way check if a=b take a−b , simplify it, , see if goes 0. learn later function ca

rx scala - Controlling observable buffering by observable itself -

i'm trying slice observable stream itself, eg.: val source = observable.from(1 10).share val boundaries = source.filter(_ % 3 == 0) val result = source.tumblingbuffer(boundaries) result.subscribe((buf) => println(buf.tostring)) te output is: buffer() buffer() buffer() buffer() source iterated on boundaries line, before reaches result create boundaries , resulting buffers there's nothing fill in. my approach using publish / connect : val source2 = observable.from(1 10).publish val boundaries2 = source2.filter(_ % 3 == 0) val result2 = source2.tumblingbuffer(boundaries2) result2.subscribe((buf) => println(buf.tostring)) source2.connect this produces output alright: buffer(1, 2) buffer(3, 4, 5) buffer(6, 7, 8) buffer(9, 10) now need hide connect outer world , connect when result gets subscribed (i doing inside class , don't want expose it). like: val source3 = observable.from(1 10).publish val boundaries3 = source3.filter(_ % 3 == 0) val r

jquery - Table with rowspan and hovering -

i have troubles table lot of td rowspan. i've constructed it, mixing ideas other posts. on mouse over, need information related office hovered. example, if select paris, continent, country , other related info should come in red colour. as can see in fiddle, works expected except rows of germany , canada. https://jsfiddle.net/ppgoecjj/ html: <table class="mytable"> <tbody> <tr> <td rowspan="4"> north america </td> <td rowspan="4"> 4 </td> <td rowspan="2"> usa </td> <td> ohio </td> <td> office </td> <td rowspan="4"> open </td> </tr> <tr> <td&

node.js - how can I increase the connections for mongoose in nodejs -

i need run 10 queries simultaneously. how do in nodejs application. doing right var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost:27017/testdb', function(err) { if(err) { console.log(err); } else { console.log('connected database'); } }); what should solve problem. or should change in db configuration. you can increase poolsize while connecting. try this var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost:27017/testdb', {server: { poolsize: 50 }}, function(err) { if(err) { console.log(err); } else { console.log('connected database'); } });

Replace a sentence with another using unix -

i need replace whole line contains <attribute name ="automatically recover terminated tasks" value ="no"/> <attribute name ="automatically recover terminated tasks" value ="yes"/> . sample file below: <attribute name ="write backward compatible workflow log file" value ="no"/> <attribute name ="workflow log file name" value ="wf_hyb01_honeybadger_date_roll.log"/> <attribute name ="workflow log file directory" value ="$pmworkflowlogdir&#x5c;"/> <attribute name ="save workflow log by" value ="by runs"/> <attribute name ="save workflow log these runs" value ="$pmworkflowlogcount"/> <attribute name ="service name" value =""/> <attribute name ="service timeout" value ="0"/> <attribute name ="is service visible&

XML::Simple in perl, with mixed xml file -

i have demo.xml file this. <?xml version="1.0"?> <data> <pattern>123456</pattern> <pattern>654321</pattern> <pattern>abcdefg</pattern> <pattern owners="alex">heloworld</pattern> <pattern owners="alex">perlprogramming</pattern> </data> this perl code parse file: use xml::simple; use strict; use data::dumper; $xml = new xml::simple; $data = $xml->xmlin("demo.xml"); print dumper($data); and here got: $var1 = { 'pattern' => [ '123456', '654321', 'abcdefg', { 'owners' => 'alex', 'content' => 'heloworld' }, { 'owners' => 'alex',

selenium - Login Programmatically to DotNetNuke -

i'm working on windows console application base on c#. in app user enter username , password (assume gmail.com) should let them access other part of program if logged in successfully, if not won't permission. search around these topics: - post , get - webrequest - selenium first checked msdn sample code received page source code! check selenium , should worked fine somehow. here code: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using openqa.selenium; using openqa.selenium.firefox; using openqa.selenium.support.ui; namespace gmail_login { class program { static void main(string[] args) { iwebdriver driver = new firefoxdriver(); driver.navigate().gotourl("http://gmail.com/"); //find target fields iwebelement user = driver.findelement(by.name("email")); iwebelement pass = driver.findelement

ansible - supports_check_mode for non-Python module -

an ansible module written in python can support check mode setting supports_check_mode=true : module = ansiblemodule( argument_spec = dict(...), supports_check_mode=true ) now have 700+ lines ruby script i'd turn module , avoid translating python. there way how support check mode non-python modules? ansible pass argument _ansible_check_mode module, true if in check mode. remember arguments put in file, , path file argument #2. here php example: ./library/test_module.php #!/usr/bin/env php <?php // want_json causes ansible store args in json $args = json_decode(file_get_contents($argv[1]), true); $check_mode = !empty($args['_ansible_check_mode']); $output = array( 'changed' => false, 'checking' => $check_mode ); echo json_encode($output); matching playbook: ./test_module.yml --- - hosts: localhost gather_facts: no become: no tasks: - test_module: key: value

maven - Can't execute "mvn clean package" task in GO CD -

i have setup "hello world" pipeline 1 task mvn clean package in go cd. have registered agent java , maven , running. when trigger pipeline, job fails: 12:05:08.655 [go] start execute task: <exec command="mvn" > <arg>clean package</arg> </exec>. 12:05:08.660 error happened while attempting execute 'mvn clean package'. please make sure [mvn] can executed on agent. if execute mvn clean package in agent, works. happening? there place can see more specific logs? instead of running following: command : mvn clean package try use command : /bin/bash arguments : -c mvn clean package

formula - Equation of 1 22 333 4444 55555 sequence? -

Image
i need find 1 22 333 sequence formula/equation. i write code getting number need find equation of sequence code: for (int = 1; <= 9; i++) { (int j = 0; j < i; j++) { console.write(i); } console.write("\n"); } with code results 1 22 333 4444 55555 666666 7777777 88888888 999999999 also latex code line should works me to. i mean equation somethings example: from sum of geometric progression , value of (n)th term is n*(power(10, n) - 1)/9 where power(a, b) raises a b th power.

java - Spring batch - InputStream as parameter for ItemReader -

is there way add parameter in spring batch inputstream instead of file path? you can write own custom reader , pass inputstream setresource. yourreader.setresource(new inputstreamresource(inputstream));

php - Dynamically change selected state of dropdown(s) for each row of data -

i'd show dropdown menu(s) contain selected day based on recorded on database. is there efficient way dynamically change selected state of dropdown menu based on recorded data? thank you note: there many dropdown menu(s) if recorded day of following clinicid more 1 row the $day integer, 1 sunday, 2 monday , on here mycode // check if row existed if ($count>0) { // if row existed start printing while($row = mysql_fetch_assoc($retval)) { $day = $row['day']; $starthour = $row['starthour']; $startmin = $row['startmin']; $endhour = $row['endhour']; $endmin = $row['endmin']; echo "<span>" . "<select name='day[]'>" . "<option value='1' selected='selected'>sunday</option>" . "<option value=

Drupal module node type creation .install vs .module -

after browsing net on hour question remains. 'correct' way create node type in module. .install: hook_install() gives possibility create node_types using node_type_save() hook... .module using hook_node_info() can add node type(s). what pro's , cons of 2 methods? there in fact different? happens when uninstall module? how should 1 manage updates in both cases? drupal docu hasn't been helpfull me :( you can create node_types using both node_type_save() , hook_node_info() . drupal core book module creates in hook_install. more common practice in hook_node_info() or hook_entity_info() ( node module uses hook_entity_info() ). if implement using hook_node_info() more complaint way drupal works. example node_type_rebuild() work values defined in hook_node_info() , not node_type_save() . imo should using hook_node_info() or hook_entity_info() , let drupal core handle rest.

html - Code Igniter head tag not loading -

<html> <head> <? $this->common_lib->common_header_page("online appointments @ favourite beauty salons , spas.","best discounts , offers @ favourite beauty salons , spas in gurgaon. search, compare, review , book online appointments"); ?> </head> <body> <div class="body-inner home-page"> <!--header start --> <div class="container"> <div class="row"> <?php $this->load->view('common/main_navigation_bar');?> <!--/ header start --> <!--banner sec start--> <?php $this->load->view('home/banner'); ?> <!--/banner sec end--> </div> for reason head tag not loading , website loads after banner sec has ended please try with use full <?php tag instead short tag <? as code shows using short tag on head tag.

Javascript add value if checkbox is checked -

<p> <label for="hours">learn javascript hardy way’ - complete e-book (printed)</label> <input type="number" min="0" id="chap7" name="hours" value="0"> </p> <input type="checkbox" id="printed"/>please tick if printed version<br /> <p class="post">postage : <strong>£<output id="post">0</output></strong><p> i piece of javascript upon checkbox being checked, makes postage value 3.50. however, 3.50 per copy of complete ebook. have check value of number box , times value inside. solution changes based on checkbox state: var chap7 = document.getelementbyid('chap7'), post = document.getelementbyid('post'), printed = document.getelementbyid('printed'); printed.addeventlistener('change', function() { var quantity = parseint(chap7.value, 10);

javascript - Regular expression that matches group as many times as it can find -

i have written regular expression match tags this: @("hello, world" bold italic font-size="15") i want regular expression match these strings: ['hello, world', 'bold', 'italic', 'font-size="15"'] . however, these strings matched: ['hello, world', 'font-size="15"'] . other examples: (success) @("test") -> ["test"] (success) @("test" bold) -> ["test", "bold"] (fail) @("test" bold size="15") -> ["test", "bold", 'size="15"'] i have tried using regular expression: \@\(\s*"((?:[^"\\]|\\.)*)"(?:\s+([a-za-z0-9-_]+(?:\="(?:[^"\\]|\\.)*")?)*)\s*\) a broken down version: \@\( \s* "((?:[^"\\]|\\.)*)" (?: \s+ ( [a-za-z0-9-_]+ (?: \= "(?:[^"\\]|\\.)*" )? ) )*

android - Re-use of xml menu template with flavors -

i making app 3 flavors. using navigationview inside drawerlayout navigation. have specified menu xml in navigationview this: ... app:menu="@menu/activity_main_drawer" ... and goes 3 flavors. activity_main_drawer looks this: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkablebehavior="single"> <item android:id="@+id/nav_categories" android:title="categories" /> <item android:id="@+id/nav_map" android:title="map" /> </group> </menu> this used in starting, main activity called mainactivity . thing is, applications not supposed differentiate anyhow, except api url. now, need remove 1 of links 1 of apps. the first solution come copy activity_main_drawer flavor specific resource menu folder ,

android - Difference between setContentView and LayoutInflater -

i creating tabs list several fragments. have noticed that, in main activity, used setcontentview layout xml , use findviewbyid corresponding ui element config. setcontentview(r.layout.fragment_tabs); mtabhost = (tabhost)findviewbyid(android.r.id.tabhost); mtabhost.setup(); mtabmanager = new tabmanager(this, mtabhost, android.r.id.tabcontent); however, in different fragment class, have use inflater instead. view v = inflater.inflate(r.layout.webview, container, false); webview mybrowser=(webview)v.findviewbyid(r.id.mybrowser); and both function used layout xml create object, why there difference? first 1 use during oncreate , , second 1 during oncreateview ? in situation should choose either of them? setcontentview activity method only. each activity provided framelayout id "@+id/content" (i.e. content view). whatever view specify in setcontentview view activity . note can pass instance of view method, e.g. setcontentview(new webview(this)); vers

datagridview - Please give me an idea how to hide textboxes along grid in asp.net 4.0 -

i got requirement taking input user through text box fill grid whenever dropdown list item "custom" selected. textboxes "fromdate" "todate" need appear on screen whenever user selects "custom" item dropdownlist. please give me idea how hide these textboxes along grid in asp.net 4.0(visual studio 2010) and why don't it, have idea... html: <asp:panel id="pnl" runat="server" visible="false"> <p>your textboxes below...</p> </asp:panel> <asp:dropdownlist id="ddl" runat="server" autopostback="true" onselectedindexchanged="ddl_selectedindexchanged"> <asp:listitem value="0" text="--select--"></asp:listitem> <asp:listitem value="1" text="custom"></asp:listitem> </asp:dropdownlist> code behind: protected void ddl_selectedindexchanged(object se

javascript - View / State with IONIC -

so i'm using ionic angularjs , i'm having issue on .states : app.config(function($stateprovider, $urlrouterprovider) { $stateprovider.state('app', { url : '', templateurl: 'main.html', abstract: true, }) $stateprovider.state('app.recherche', { url: '/recherche', views: { vrecherche: { templateurl: 'recherche.html', controller: 'myctrl' } }, }) $stateprovider.state('app.recherche.index', { abstract: true, url: '/', template : '<ion-nav-view></ion-nav-view>', }) $stateprovider.state('app.recherche.magasin', { url: '/magasin', //:dataid, controller: 'datactrl', templateurl: "magasin.html", }) $stateprovider.state('app.reunion', { url: '/reunion', views: { vreunion: { templateurl: 'reun

jQuery: using variable in animate for left continuous update -

var shiftleft = -250; setinterval(function(){ $("ul")animate( { left: '-=250' }, 500); }, 2000); here, in above code code need shiftleft variable used in animate function instead of -=250 . try this: var shiftleft = -250; var shiftleftstr = shiftleft.tostring(); var = shiftleftstr.substr(0, 1); var b = shiftleftstr.substr(1); var animatepx = + "=" + b; setinterval(function(){ $("ul").animate( { left: animatepx }, 500); }, 2000); so, first make string. after use substr first char, , after remaining chars. and after all, put pieces together.

ios - Stop playing audio in background mode giving error message "terminated app due to signal 9" -

Image
strong text i got stuck in problem in project. playing audio when app in background mode using avaudioplayer after 2 mins app terminated ios giving debugger message : "terminated due signal 9". have searched issue , got know if cpu usage high ios kills app "terminated due signal 9". memory usage 12 mb in application while playing audio. not understand how solve problem.please me out!! update 1 cpu usage around 90% on both foreground , background!! have used time profiler instrument check method consuming more cpu usage, got know main thread , method through updating value of uislider , label audio time!! still not have solution how minimize cpu usage!!!! update 2 - did mistake, calling timer interval of 0.0 sec!! calling interval of 1 second , problem solved.

jquery - Rails - How to re-render partial after Ajax GET method request -

Image
rail4,jquery ajax i need display order 1 day chosen on - jquery datepicker. i set ajax request , make staff contoroller can't make works. need advise. order_controller def index @order = params[:date] ? order.where(date: params[:date]) : order.get_order_today respond_to |format| format.html # render index.html.haml end end order.js.coffee $ -> $('#datepicker').datepicker dateformat: 'yy-mm-dd', onselect: (datestr) -> $.ajax -> type: "get", url: "orders/index", datatype: "html", data: {date: datestr} success: -> # should here render default index view? console.log("everything ok ;)") view/orders/index #order.col-xs-12.col-sm-6.col-md-8 = render 'orders/order' #datepicker.col-xs-6.col-md-4.date-picker-div view/orders/_order %h3 order info %table.table.table-striped %tr %th meal %

javascript - Using canvas to display a picture pixel by pixel within secs -

for learning purpose, trying display image pixel pixel in canvas within few seconds, below code write var timestamps = []; var intervals = []; var c = document.getelementbyid('wsk'); var ctx = c.getcontext("2d"), img = new image(), i; img.onload = init; img.src = "http://placehold.it/100x100/000000"; var points = []; function init(){ ctx.canvas.width = img.width; ctx.canvas.height = img.height; (i=0; i<img.width*img.height; i++) { points.push(i); } window.m = points.length; var sec = 10; //animation duration function animate(t) { timestamps.push(t); var pointsperframe = math.floor(img.width*img.height/sec/60)+1; var start = date.now(); (j=0; j<pointsperframe; j++) { var = math.floor(math.random()*m--); //pick point temp = points[i]; points[i] = points[m]; points[m] = temp; //swap point last element of points array var point = new point(i%img.width,math.floor(i/img.width));

c# - Creating a progress bar for SQL query (using ADO.NET) -

i'm trying make progress bar sql query don't know start. have tried implementing backgroundworker can't seem work. i'm using vs 2010 .net 4.0 treinen trein = listboxvoertuignr.selecteditem treinen; list<string> treinenids = new list<string>(); foreach (var item in listboxvoertuignr.selecteditems) { treinenids.add(item.tostring()); } fouten = eventsentities.foutens; category = eventsentities.category_mmap; ienumerable<dynamic> foutenresultaat = new list<dynamic>(); foutenresultaat = (from x in treinen join fout in fouten on x.treinid equals fout.treinid datestart <= fout.datum && dateend >= fout.datum && treinenids.contains(fout.treinen.name) && fout.omschrijving.contains(textboxfilteromschrijving.text) && fout.foutcode.contains(textboxfilterfout.text) && fout.module.contains(textboxfiltermodule.text) orderby fout.datum descending, fout.time descending

php - how to make static variable initialize to global variable -

the problem want change value of global variable each time sub called ,how can possibly it function sub() { static $x=global $present; static $y=global $max; static $z=global $min; if($x==$z) { $x=$y; } $x--; return $x; } sub(); sub(); sub(); i have tried too function sub() { global $present; global $max; global $min; if($present==$min) { $present=$max; } $present--; return $present; } sub();//it works once sub(); sub(); please provide me solution can change value of global variable each time function called.......thank you the main function of sub retrieving value frm data base ,src remains same no matter how many times call change fu

Assigning a value to the global variable (and a argument of a function aswell) R -

i working on master thesis (model of evolutionary trust game). , have following problem. have several types of investors , trustees paired play trust game. investors , trustees defined vectors. code(trust game) takes (globally defined) investor , trustee. play iteration of trust game , globally defined variables updated inside function trust game. work investor\trustee used argument of function trustgame. know how code this? not sure aswell if post code aswell. #### defining trustees #### # [1] honor\abuse # [2] information previous interaction - relevant investors buy information # [3] payoff # [4] number of interactions trustee1 <- c(1,0,0,0) #### defining investors #### # [1] buy\not buy # [2-4] investment decision if buying information in case 1(th), case 2(ta), case 3(nt) # [5] aggregated payoff # [6] number of interactions in 1 generation investor1 <- c(1,1,1,1,0,0) here code trust game trustgame <- function(investor,trustee) { investordecision <- null tr

linux - Updating a java program that runs as a daemon from within the program -

i have java program runs under rhel 6 daemon on system boot. have webpage gui allows user interact daemon administration purposes. one of administration task user have ability gui update program. this done using within java program downloading rpm website user enters , installs rpm using rpm -uvh processbuilder call within java program. the problem part of updating of daemon requires daemon stopped resulting in signal 15 error within daemon since trying update within program shutting down. i thinking want spawn processbuilder or fork type tool on java, separate process runs update , not encounter signal 15 when stopping daemon during rpm -uvh command. what best way generate separate process not crash during update process?

html - Jquery-UI dynamically increment the date from datepicker calendar -

Image
i created two calendars datepicker jquery ui , want change selected day second calendar according selected date first calendar . example, if select 5/21/2016 first calendar, when click on second input field open second calendar need calendar dynamically change selected date first calendar selected day + 4 days this code: <input class="datepicker begin" type="text" /> <input class="datepicker end" type="text"/> $(function () { $(".datepicker.begin").datepicker({ mindate: '+2d', maxdate: '+2y' }) $(".datepicker.end").datepicker({ mindate: '+4d', maxdate: '+2y' }); }); the above code should changed this: $(function () { $(".datepicker.begin").datepicker({ mindate: '+2d', maxdate: '+2y' }) $(".datepicker.end").datepicker(

Dose z3 find all satifiable models -

there constraints such x + y > 5 , x > 3 , y < 4, set of models x = 4 y= 3, given z3. dose z3 can give models incrementally, such set of models x=5,y = 2? thanks. regards can tell me please happens this: x,y = bools('x y') s = solver() s.add(or(x,y)) count = 0 while s.check() == sat , count <= 50: print s.model() s.add(or(x != s.model()[x], y != s.model()[y])) count = count + 1 print count the output is: [y = false, x = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y = true] [y

spring - why `EntityManager` work,but EntityManagerFactory did not work for me? -

i try use spring+jpa+hibernat e , try inject entitymanagerfactory ,and later create entitymanger in code.but when use entitymanager.persist(user) ,the user not saving database .but when try inject entitymanager instead of entitymanagerfactory ,it worked !,i not know problem. you can see question more code. when using plain entitymanagerfactory instead of entitymanager need call createentitymanager . create new entitymanager , plain entitymanager not managed nor detected spring. have start/commit transactions yourself. when using entitymanager obtain transactional synchronized instance, managed spring , bound current transaction. no need start / commit transaction yourself. see jpa section of reference guide.

javascript - Convert date and time to UTC -

i asking user input date , time application. user input time based on timezone in. when save date , time database want convert time utc when query time (which done in utc) can find entries. this i've done : var date = new date(); var datestring = "0" + (date.getmonth() + 1) + "/" + date.getdate() + "/" + date.getfullyear() + " " + time; //format date date = moment(datestring, "mm/dd/yyyy hh:mm a"); date = new date(date).toisostring(); where time time user enters (ex if want schedule 11:00am, time = 11:00am) when saved database, looks : isodate("2016-05-09t11:00:00z") not correct since est saved zulu time. how can convert time (i using moment) saved correct zulu time? one option use javascript's built-in utc functions. javascript date reference getutcdate() - returns day of month, according universal time (from 1-31) getutcday() - returns day of week, according universal time (from 0-6) getut

twitter - import files containing the positive and negative words into R -

i trying sentiment analysis on tweets ( have dataset tweets, no api scraping) in order see if tweet negative or positive. downloaded list of negative , positive words. saved textfile in working directory exact same name in code below. however, code gives error: positive_words <- readlines("positive_words.txt") error in file(con, "r") : cannot open connection in addition: warning message: in file(con, "r") : cannot open file 'positive_words.txt': no such file or directory how can import these textfiles r? thank you!!

javascript - Would long-polling be a good substitute for websockets in this case? -

i attempting develop 'boardgame' sort-of application, simplicity sake let's think of monopoly familiar one. i've read bit long-polling , it's implications , got me confused stated need utilize framework (such socket.io) anyway, uses websockets , such. is possible avoid this? understand websockets better ajax request sitting , waiting response, reading on them made me bit "scared" of how implement such thing. not familiar node.js (though i'd love be) because understand has low hosting support providers , "overly complex use" or whatnot. generally speaking, since talking boardgame not need websockets use realtime client-server communication, because mainly, boardgames not intensive on simultaneous actions , not think there many changes communicate in short timeframe. might not understanding whole thing correctly correct me if wrong if game slow paced, such board games are, simple ajax request should suffice, no? if keep open in-defin