Posts

Showing posts from August, 2015

c# - Ajax TabContainer tabs not working after issues with visibility -

at first having problems forcing tabcontainer show. apparantly caused render 'style="visibility: hidden"' on runtime. fixed adding style="visibility:visible" tabcontainer. looks now: <asp:tabcontainer id="tabcontainer1" runat="server" style="visibility:visible"> <asp:tabpanel id="tabpanel1" headertext="tab 1" runat="server"> <contenttemplate> contents of tab 1 <br /> contents of tab 1 <br /> contents of tab 1 <br /> </contenttemplate> </asp:tabpanel> <asp:tabpanel id="tabpanel2" headertext="tab 2" runat="server"> <contenttemplate> contents of tab 2 <br /> contents of tab 2 <br />

python - how to sort the items in QListWidget by drop and drag -

i newer pyqt, using write gui, please tell me how sort items in qlistwidget drop , drag? thanks in advance qlistwidget inherits qabstractitemview . can use qabstractitemview.setdragdropmode() , set qabstractitemview.internalmove if you'd able change order of items drag & drop. here's relevent section of documentation . here's quick example showing in action: import sys pyqt4.qtgui import qapplication, qwidget, \ qvboxlayout, qlistwidget, qabstractitemview class widget(qwidget): def __init__(self, parent=none): qwidget.__init__(self, parent) self.widget_layout = qvboxlayout() # create listwidget , add 10 items move around. self.list_widget = qlistwidget() x in range(1, 11): self.list_widget.additem('item {:02d}'.format(x)) # enable drag & drop ordering of items. self.list_widget.setdragdropmode(qabstractitemview.internalmove) self.widget_layout.add

python - urllib.urlopen returns an old page? -

so have simple html page (a dir listing) , try read urllib, way: page = urllib.urlopen(corerepositoryurl).read() the problem is, html read way older newest. info() returns me this: date: fri, 19 apr 2013 18:48:09 gmt server: apache/2.0.52 (fedora) content-type: text/html; charset=utf-8 connection: close age: 481084 and page last updated today (2013-04-25). component might 1 caches? add header "cache-control" value "max-age=0" in request import urllib2 req = urllib2.request(url) req.add_header('cache-control', 'max-age=0') resp = urllib2.urlopen(req) content = resp.read() using header each cache along way revalidate cache entry

css - Make centered DIV inside wide DIV expand with content width -

i'm using 2 divs, parent , child. parent has width of 100% , contents text-align'ed center. the child div should have width of 0 (or close it) , expand width automatically contents, while still being centered in parent div. example: +------------ parent div ------------+ | | | ..some content.. | | | | +--child div--+ | | |inside child | | | +-------------+ | | | +------------------------------------+ +------------ parent div ------------+ | | | ..some content.. | | | | +------ child div ------+ | | |inside child more | | | +-----------------------+ | | | +------------------------------------+ if put fixed width child div, can center correctly:

javascript - onhashchange event casuing invalid markup validation -

hope don't sound idiot posting using: <body onhashchange="hashchangehandler();"> is causing invalid markup validation. is there somewhere else can put other body tag? i know there's window.onhashchange = funcref; or window.addeventlistener("hashchange", funcref, false); have no idea put it, if makes sense. the site still works invalid markup flag bugging me! i know there's … have no idea put it, if makes sense. in <script> element. that's all. <script> function thingy(e) { alert('changed'); } window.addeventlistener("hashchange", thingy, false); </script>

mysql - Data Synchronisation among clients -

i have database server (mysql). this holds table of products. 1 of field of products table remaining quantity. i have few clients (around 10) querying remaining quantity while placing order. once order placed remaining quantity decreased based on order. i face problem when quantity low: example if remaining quantity "10" , client1 creating order 8quantity(order not yet placed, in process ) , client2 places order 5 quantity, client places order latter fail. i want improve system such when 1 client in process of ordering, other clients should shown (remaining quantity - client1 order quantity). thought of altering remaining quantity entered in order table, creates problem when order cancelled or computer placing order powered off / crashed. please suggest me suitable algorithm handle case effectively.. whenever order in progress, other clients should see (remaining quantity - order in progress quantity). one answer might in question: other clients sho

google app engine - Store java.util.List into GAE Datastore -

this idea of storing json , json-like documents "natively" gae datastore: protected void createentity(key parent, map obj){ try { entity e = new entity( parent == null ? createkey(_kind, (string) obj.get(object_id)) : parent); iterator = obj.keyset().iterator(); while (it.hasnext()){ string key = (string) it.next(); if (obj.get(key) == null){ e.setproperty(key, null); } else if (obj.get(key) instanceof string) { setproperty(e, key, obj.get(key)); } else if(obj.get(key) instanceof number) { setproperty(e, key, obj.get(key)); } else if(obj.get(key) instanceof boolean) { setproperty(e, key, obj.get(key)); } else if(obj.get(key) instanceof list) { // problem area, right way store list? // list may contain jsonobject too! } else if(obj.get(key) inst

arrays - Does element.childNodes[] behave as a link list in javascript? -

i have element object , has children appended via appendchild(node) method,i know can access them element.childnodes[index] . now if remove element selecting them id element @ index i+1 @ index i if removed 1 @ index i ? secondly there way remove object array specifying indices via built in method achieve linked list behaviour(i mean without having copy elements index prior index when remove 1 prior them)? 1) yes 2) try array.splice : > = [0,1,2,3,4,5] [0, 1, 2, 3, 4, 5] > a.splice(3, 1) [3] > [0, 1, 2, 4, 5] don't know if arrays or nodelists implemented linked lists or else. depends on engine guess.

c# - iTextSharp DataMatrix barcode capacity -

i have specification implement datamatrix barcodes using 16x36 size. i'm using c# itextsharp library has barcodedatamatrix class. given these barcode dimensions, specified capacities are: numeric: 64 alphanumeric: 46 byte: 30 this taken site: http://www.barcodephp.com/en/2d/datamatrix/technical the requirement store 46 character string in 16x36 symbol. i'm having hard time understanding how can encode 46 byte string in such way fits 30 bytes.

How to migrate from old dojo require to the new dojo AMD loader? -

i want migrate old dojo.require loader new amd loader changed this: dojo.require("dojo._base.xhr"); dojo.require("dojox.mobile.parser"); dojo.require("dojox.mobile"); dojo.require("dojox.mobile.scrollableview"); dojo.require("dojox.mobile.tabbar"); dojo.require("dojox.mobile.textbox"); dojo.require("dojox.mobile.compat"); dojo.require("dojox.mobile.devicetheme"); dojo.require("dojox.mobile.tabbarbutton"); dojo.require("dojox.mobile.view"); dojo.require("dojox.mobile.button"); dojo.require("dojox.mobile.switch"); dojo.require("dojo.on"); dojo.require("dijit.registry"); dojo.require("dojo.aspect"); dojo.require("dojo.ready"); dojo.require("dojox.mobile.listitem"); dojo.requ

osx - What do the different exception codes in OS X / iOS Crash reports mean? -

in apple crash reports, there 2 lines providing exception type , exception codes crash report. know these codes mean? there self-explaining ones ones, kern_invalid_address : for example, 1 null pointer dereference : exception type: exc_bad_access (sigsegv) exception codes: kern_invalid_address @ 0x0000000000000000 if made error pointer arithmetic, you'll end similar: exception type: exc_bad_access (sigsegv) exception codes: kern_invalid_address @ 0x00007fff50399000 but there lots of these exception codes! example, here's 1 encountered , have no clue means (the address points big memory-mapped file): exception type: exc_bad_access (sigbus) exception codes: 0x000000000000000a, 0x0000000137676004 all found crash reports this technote , no detailed reference how interpret exception codes. a list of exception codes can found in xnu source . 0x000000000000000a kern_mem0ry_error: #define kern_memory_error 10 /* during page fault, memory ob

python - Eliminating Unwanted characters -

how eliminate characters like, e.g. â€Å“it , in word these characters causing python program fail. how handle these characters, input file has lots of them. please help. thanks that looks utf-8 being misinterpreted different encoding. try: fixed_input_string = input_string.decode('utf-8') and see if solves problem. btw, if have no idea said, read http://www.joelonsoftware.com/articles/unicode.html right now . if try write software accepts "english" text (which means ascii, there plenty of characters used in standard english text aren't in ascii), software going fail in kinds of "interesting" ways. unicode isn't going away, , you'll have learn sometime -- time start.

recursion - Java Square function -

would able explain these methods few comments line. squaring number. 1 using recursion, implementation , normal public static int sq(int n) { int = 0 ; int result = 0 ; while(i < n){ result = result + 2*i + 1 ; = + 1 ; } return result ; } public static int recsq(int n) { if(n == 0){ return 0 ; } else { return recsq(n - 1) + 2*(n - 1) + 1 ; } } public static int implementsq(int n) { int ; int result = 0 ; for(i = 0 ; < n ; i++){ result = result + 2*i + 1 ; } return result ; } the first 1 multiplying number 2 n times using loop increase local variable i. the second 1 doing same using recursion. each step decreasing n , returning 0 final case. calls calling again same function different parameters exept parameter value 0, function return 0. recursion not simple thing think off, understand better try imagine codeflow. example: recsq(2) 4 recsq(2)

How do I display a proof tree with HTML,CSS and/or Javascript? -

Image
i want display proof tree in style of natural deduction within web page. data json file. whats best way display this? possible css? or there library can this? rendering image not possible, because should interactive. should mention tree can large. example: update: better example of end result should like: the easiest solution mathjax latex javascript renderer. , there quite few other similar rendering options out there. alternatively @ mathml , w3c standard writing mathematical equations. sadly, right now, support quite lacking can seen here , long term it's going great solution. additionally mentioned mathjax can used mathml shim in browsers not support mathml yet. the concern mathjax shim going when make interactive it's going interact differently code in browsers , not support mathml, despite advice mathml except if you're bound latex. based on update not sure whether can expressed in mathml or latex , fear thing draw on canvas or set in sv

php array and returning a default value? -

here code: <div class="search-menu"> <div class="btn-group fc"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> <?php $currencies = explode(',', hana_get_opt('_cc')); foreach ($currencies $currency) { if ($currency == get_option('woocommerce_currency')){ echo $currency; break; }else{ echo "select currency"; break; } } ?> <span class="caret"></span> </a> <ul class="dropdown-menu currency_switcher"> <?php foreach ($currencies $currency) { if ($currency == get_option('woocommerce_currency')) echo '<li><a href="#" class="reset default" data-currencycode="' . $currency . '">' . $curren

android - Send String from an Activity to a Fragment of another Activity -

i have 2 activities (a , b) , fragment f fragment f contained in activity b i'd send strings activity fragment f how can that? thanks! first, you'll send string activity b. example: intent intent = new intent(this, youractivityclass.class); intent.putextra("mystring", "this string"); startactivity(intent); then later read string activity b , inject fragment before executing fragment-transaction. example: bundle args = new bundle(); args.putstring("mystring", getintent().getextras().getstring("mystring")) yourfragment.setarguments(args); later, use getarguments() in fragment retrieve bundle. or alternatively, use following in fragment directly access activity intent , fetch required value: string str = getactivity().getintent().getstringextra("mystring"); for more info, read this .

Jenkins plugin for checking out a single modified file from SVN -

i have job in developer changes file , checks in in svn. developer checks in file, jenkins has trigger build , copy changed file (not entire directory) svn target server. for example, developer checked in file in trunk in svn. trunk contains huge number of files, jenkins needs copy changed file svn trunk folder target server. how can achieved? there plugin or functionality helps support feature? you cannot check out single file subversion. smallest unit can check out directory. if have working copy, svn update pull differences. you can use svn export or svn cat extract single file repository, not have connection repository when you're finished (unlike working copy).

iphone - App gets crash on multiple NSURLRequest -

i making app in calling web service of times. when more 1 web service call @ 1 time app goes crash, here code call service. url = [url stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; request = [nsurlrequest requestwithurl:[nsurl urlwithstring:url]]; nslog(@"request : %@", request); [[nsurlconnection alloc] initwithrequest:request delegate:self]; also delegates. i calling asynchronous still app crash. 1 have suffered problem before may me on that. in advance.

java - How to Export the Code Coverage report of jtest outside of it to share the report with the team -

is there way export code coverage percentage of class files report format jtest tool report can shared rest of team? according online docs can export them html/xml , ascii, can apply xsl make own formats.

php - CodeIgniter Initial Page Load Variable? -

i'm looking solution loading header/footer/navigation on initial page view. the reasoning behind navigation panel uses ajax render content of destination link in main content div instead of loading page itself. however, need able along lines of if initial view, load header, navigation, actual page, footer. if not initial view , page loaded in content div area example navigation link or form submit, doesn't load header, navigation , footer actual page. so example have these 4 views: header_view navigation_view page_a_view footer_view and controller: controller_a the navigation has link 'page a' , points http://myurl.com/controller_a . if link clicked wanted controller_a load page_a_view view, because navigation link load data of page div. however if directly go http://myurl.com/controller_a , needs render the header/navigation/footer also. the solution thought on right lines base controller function load_page() like: function load_page($page, $dat

java - Ordering results from Collections.frequency -

i have got arraylist 500+ words in. i'm trying organise them list word appears @ top , 2nd frequent , on. so far i've managed filter out words frequency of less 5 code below cannot work out how can organise these results list of frequencies in descending order. set<string> unique = new hashset<string>(wordsl); (string key : unique) { if (collections.frequency(wordsl, key) > 5) { // println(collections.frequency(wordsl, key)); lwords.add(key); println(lwords); } } thanks in advance help. you can use map<string, integer> counting. you can later sort map value .

Hadoop Version across all Nodes -

does version , installation location of hadoop have exact same across nodes in cluster? example, if have hadoop-0.18.2 on master node in /usr/local/hadoop version , installation directory have same across data nodes? please need answer @ earliest. thank you. yes have identical otherwise encounter major issues.

java - Replacing digits with Noun using hash map -

my input sentence is: ram you after parse tree: ' 2|type|nx0e-vpadjn-vnx1 1|rpron|nx-rp-s 0|noun|nxn 3|noun|nxn ', '1' i want replace 2 'are' 1 'where' , ram 0 . how should hash map? this answer based on lot of assumptions question not clear enough. not have enough rep comment. if use string.split() on input sentence as: string[] words = "ram you".split(" "); // words[0] => ram // words[1] => // words[2] => // words[3] => it appears parse tree generated parsing input sentence. each entry in first section of parse tree corresponds word in input sentence. first digit in parse entry seems correspond index of each word in input sentence. so parse entry can broken as: <word index>|<word category>|<something not clear> so, seems 2|type|nx0e-vpadjn-vnx1 => 1|rpron|nx-rp-s => 0|noun|nxn => ram 3|noun|nxn => based on these assumptions possible use hashmap bui

Change status of Lync by script -

is possible change status of microsoft lync 2010 script? i want script works on win xp , change status available after fixed interval.tried search in internet not successful in finding one. according documentation, lync binary does not offer feature. however, use lync sdk achieve want writing small helper application (or incorporating relevant code in current application). according mvp in microsoft forums , not available out-of-the-box. however, according documentation, powershell script 1 should able trick: import-module "c:\program files (x86)\microsoft lync\sdk\assemblies\desktop\microsoft.lync.controls.dll" $availability = [microsoft.lync.controls.contactavailability]::available $contactinfo = new-object 'system.collections.generic.dictionary[microsoft.lync.model.publishablecontactinformationtype, object]' $contactinfo.add([microsoft.lync.model.publishablecontactinformationtype]::availability, $availability) $ar = $self

java - Are Custom Objects Passed by value or passed by Reference in Fragments and Activities.? -

hello java , android experts. having problem. making xmpp based chat application. there few things confusing me. i have class named room_structure implements serializable . class has object named currentroom . if passing currentroom object between 2 fragments putting in bundle working fine , surprisingly passed reference. dont know why that. shouldnt behave this. btw using android support library? but if passing currentroom object between activities using bundle , putting bundle in intent getting crash whenever try start new activity using intent. for more description here code public class room_structure implements serializable { private static final long serialversionuid = 1l; private string rname; private arraylist<message_pattern> msg_list; private multiuserchat xmppsession; private boolean background; private boolean modified; private boolean destroyed; } the above class has constructors getter , setters. now here doing: co

solr - If WildcardQuery doesn't affect the scoring of documents, why does it return 0.5 constantly? -

i using wildcardquery on documents , see result documents of them have score of 0.5. read queries wildcardquery not affect scoring of documents , wondering cause of score 0.5. i using simple query: wildcardquery wq = new wildcardquery("filed_name", "book"); wildcardquery does affect scoring. uses constant_score_auto_rewrite , may referring to. means fields match wildcardquery each have equal boost score added match. there is, however, none of typical similarity logic (tf-idf, instance) applied wildcardquery's matches.

ruby - Webservice POST not displaying requested parameters using rest client in rails 2.3.8 -

i have headers set accept application/json , content-type application/json post webservice. follwing requested parameters: { "occupantid": 162921, "buildingid": 13294, "quizid": 397, "score": 3, "result": "fail" } routes.rb map.connect '', :controller => 'quiz_v2', :action => 'record_quiz_result', :conditions => { :method => :post } when try see params in controller's action def record_quiz_result p params end returned controller_name , action_name i dont know happening here, may missed something. goto headers => custom header 1.content-type name , application/x-www-form-urlencoded value , save it. 2.now enter ur params in body should available , accessible through params hash in rails hope helps

php - A better way to do this search and replace for a template -

i search , replace web page template this: $template = <<<temp <html> <head> <title>[{pagetitle}]</title> </head> [{menua}] [{menub}] [{bodycontent}] </html> <<<temp; the above placed in separate file. then, do: $template = str_replace("[{pagetitle}]",$pagetitle,$template); $template = str_replace("[{menua}]",$menua,$template); $template = str_replace("[{menub}]",$menub,$template); $template = str_replace("[{bodycontent}]",$bodycontent,$template); //some 10 more similar above go here. echo $template; the problem is, there 15 in total ones above. is there better/cleaner/professional way (either search , replace, or entire thing differently). find messy , unprofessional. yes, can define array of things want replace , array things replace with. $array1 = array("[{pagetitle}]", "[{menua}]"); $array2 = array($pagetitle, $menua); $template = str_replac

MySQL table only submitting first time from EXT js + PHP entry -

i having problem mysql. i have setup , well, when submit form work if table empty. not submit entry if there information stored in table. here mysql table create table student (studentid int not null, studentfirst varchar(30), studentlast varchar(30), studentemail varchar(254), studentphone varchar(12), studentdob date, datestarted date, lessonid int, studentaddress varchar(50), studentcity varchar(30), studentstate char(2), studentzip varchar(10), musicinterest text); alter table student add constraint studentpk primary key auto_increment (studentid); alter table student add constraint lessonfk foreign key (lessonid) references lesson(lessonid); this php if(isset($_request['action'])){ switch($_request['action']){ case 'submit_student': $first = $_request['studentfirst']; $last = $_request['studentlast']; $email = $_request['studentemail']; $phone = $_request[&#

java - draw polylines with different colors on v2 maps -

i drawing multiple polylines using loop on version 2 google map. setting color polyline using code. mmap.addpolyline(new polylineoptions() .add(new latlng(lats, lons), new latlng(late,lone)) .width(5) .color(0xffff0000)); how increment rgb color dynamically each loop iteration. random rnd = new random(); int color = color.argb(255, rnd.nextint(256), rnd.nextint(256), rnd.nextint(256)); --- loop ---- mmap.addpolyline(new polylineoptions() .add(new latlng(lats, lons), new latlng(late,lone)) .width(5) .color(color));

php - what techniques should we use to prevent login with same cookies? -

i want create login page captcha code in php. after user entered user - pass , captcha code login. after session , cookies stored in cookies. if export these cookies session , import command line browser wget or elinks , modify user-agent in header (and change same browser logged in once before) can login info without enter user , pass , make loop 10000000 times refresh page in application , makes useless process on server .how can prevent condition ? 1 solution thought store $_server['request_uri'] , store in db , count counter each refresh if hits more 50 times in hour detect attack solution prevent ? edit: works parameter: session_regenerate_id(true); to prevent can use session_regenerate_id() function. function can used regenerate/change session id of current session. might useful if, example, want refresh session id every 10 minutes or after changing state of authenticity of user associated session.

java - Adding elements to a JList -

i have array of objects contain name of customers, this: customers[] how can add elements existing jlist automatically after press button? have tried this: for (int i=0;i<customers.length;i++) { jlist1.add(customers[i].getname()); } but mistake. how can solve that? working on netbeans. the error appears "not suitable method found add(string). way method getname returning name of customer in string. the add method using container#add method, not need. need alter listmodel , e.g. defaultlistmodel<string> model = new defaultlistmodel<>(); jlist<string> list = new jlist<>( model ); ( int = 0; < customers.length; i++ ){ model.addelement( customers[i].getname() ); } edit: i adjusted code snippet add names directly model. avoids need custom renderer

c# - Listbox items not filling the entire width of screen WP7 -

i trying create listbox containing items following template <listbox x:name="moviesactedin" style="{staticresource listboxstyle2}"> <listbox.itemtemplate> <datatemplate> <border borderthickness="0,0,0,1" borderbrush="black" margin="0,0,0,5"> <stackpanel orientation="horizontal" margin="0,0,0,5" horizontalalignment="stretch"> <image source="{binding image}" stretch="none" margin="0,0,5,5" /> <stackpanel orientation="vertical" margin="10,0,0,0" verticalalignment="top"> <textblock text="{binding title}" foreground="black" fontweight="bold"/> <textblock text="{binding director}" foreground="black"

c# - How to get facebook access token with oAuth 2.0? -

i want facebook access token using oauth 2.0 protocol in c#. have appid , appsecret keys me. googled lot , found many articles regarding this. articles describing getting access token using asp.net web application. don't want use asp.net. want using c# console application. when login facebook account , go app section , edit settings app. there comes option use graphapi app. graph api gives access token. whole process requires user intervention , logging facebook account. want automate whole process c# , oauth 2.0. there way ?

django - URL and database routing based on language -

i have urls in following form: http://example.com/[language_code]/xxx i need do: 1. based on language code, want select appropriate db or raise http 404 if language code not supported. 2. i'd save language code in request object preferably, can access in templates. 3. i'd urls.py don't this: url(r'^(?p<lang>\w+)/xxx/$', 'my_app.views.xxx') but rather: url(r'^xxx/$', 'my_app.views.xxx') so django ignore language code in url. can tell me please if doable django or should solution? i managed figure out. first of need read docs: https://docs.djangoproject.com/en/dev/topics/i18n/translation/ @1 - wrote own middleware based on http://djangosnippets.org/snippets/2037/ (it's crucial put middleware first 1 in middleware_classes list) import threading django.http import http404 django.conf import settings request_cfg = threading.local() class routermiddleware(object): def process_view(self, request

mysql - Customize deals app's homepage and emails thanks to user history: how to do it the right way on Rails/postgreSQL? -

i’d customize : 1. order of deals on homepage 2. emails depending on deals user has seen. thanks people on so , seems best have 3 models , tables "standard_user", "deals" , "deals_participation" in order have many-to-many relationships app need , link table follows: class dealparticipation < activerecord:base #this means deal_participations table has standard_user_id key belongs_to :standard_user #this means deal_participations table has deal_id key belongs_to :deal #... more logic goes here ... end class standarduser < activerecord::base has_many :deal_participations has_many :deals, :through => :deal_participations # ... more logic goes here ... end class deal < activerecord::base has_many :deal_participations has_many :standard_users, :through => :deal_participations belongs_to :admin_user #... more logic goes here ... end where i’m lost : how should store , table should query data of deals user has participated in: shou

parsing - clojure csv with escaped comma -

i trying parse csv string in clojure escaped commas , no quote around fields one "test1\,test2,test3" i tried libraries: [org.clojure/data.csv "0.1.2"] [cljcsv "1.3.1"] [clojure-csv/clojure-csv "2.0.0-alpha1"] but none of them seems capable recognize correctly ["test1,test2" "test3"] know library can this? thanks in advance you have excellent excuse write own parser :-). can use instaparse: https://github.com/engelberg/instaparse update: ok, not resist temptation myself :-) update 2: allow escaped characters inside quoted strings. (require '[instaparse.core :as insta]) (def custom-csv (insta/parser "file = (line <eol>)* line line = (field <','>)* field eol = '\\r'? '\\n' <field> = plain-field | quoted-field quoted-field = <'\\\"'> (#'[^\"\\\\]+' | escaped-char)* <'\\\"&#

c# - Async Controller Action Re-Called after one minute -

i have action on mvc3 async controller processes csv files, async part of follows: [handleerror] [noasynctimeout] public void uploadasync(int jobid) { var timestamp = datetime.now; log.debug("uploadasync " + timestamp); var job = _fileuploadservice.getjob(jobid); log.debug("asyncmanager.outstandingoperations.increment " + timestamp); asyncmanager.outstandingoperations.increment(); var task = task<job>.factory.startnew(() => { thread.sleep(90000); }); task.continuewith(t => { try { asyncmanager.parameters["results"] = getjobresultdetails(jobid); } //no "catch" block. "task" takes care of us. { asyncmanager.outstandingoperations.decrement(); } }); } and completed counterpart is: public jsonresult uploadcompleted(int jobid) { l

More than one path in a directed graph? -

i want start building app public transport. know should use dijkstra algorithm find shortest path between 2 points. how can more 1 path? give user @ least 3 or 4 options, not best route. reason want include more variables, time, cost , bus capacity. is there algorithm me this? or naively thinking should modify dijkstra give me more 1 path. cheers. have @ k shortest path routing , generalization of dijkstra.

sql - Select from table with dynamic compute name -

i want write query in name table dynamicaly compute. have code below. should put in 'magic code' region? declare @mytablename nvarchar(100) = 'sch' + cast(@nowyear varchar(5)) + 'q' + cast(@nowquarter varchar(3)) + '.[tvisits]' -- magic code -- mytable = dosomething(@akttablename) -- magic code -- select * mytable i use ms sql server 2012 you need use dynamic sql - declare @nowyear int = 2013 , @nowquarter int = 1 declare @mytablename nvarchar(100) = '[sch' + cast(@nowyear varchar(5)) + 'q' + cast(@nowquarter varchar(3)) + '].[tvisits]' declare @sql nvarchar(max) = n'select * ' + @mytablename exec sys.sp_executesql @sql

extjs4.1 - How to fire mousedown event programatically? -

i have formpanel , fields inside it. i'm registering mousedown event form shows border field. when mousedown happening otherfield i'm removing existing field border , applying current field mousedown occured. for form i'm adding fields dynamically. newly added field want show border i.e., want fire mousedown event programatically. can please suggest how can achieve? regards url the best thing here not fire mouse-down event programatically, call function mouse-down event uses.

php - I wrote a code to show the availability of doctors according to the date, but when the field on mysql is empty i have this array error -

this code i'm talking about session_start(); include ('configg.php'); $query = "select date, time gp_appointment name = '$_post[doctor]' , date = '$_post[date]'"; $result = mysql_query($query); $data = array(); while($row = mysql_fetch_assoc($result)) { $data[] = $row; } $colnames = array_keys(reset($data)) ?> <table border="1"> <tr> <?php //print header foreach((array)$colnames $colname) { echo "<th>$colname</th>"; } ?> </tr> <?php //print rows foreach((array)$data $row) { echo "<tr>"; foreach($colnames $colname) { echo "<td>".$row[$colname]."</td>"; } echo "</tr>"; } ?> </table> <a href="homepage.php">go homepage&

c - bitwise: different behaviour with negative input value -

i'm on hardware/software interface course hosted on coursera, i'm sure you've seen fair few of these questions.. one of assignments determine whether 2's complement integer x can fit n-bits, using subset of operators, etc. i'm doing well, came across 2 separate approaches, , hit whiteboard them both understand them fully. came confusion. the function returns 1 if possible fit, 0 if not. method 1 (correct output) int foobar(int x, int n) { return !(((x << (32-n)) >> (32-n)) ^x); } executed positive integer foobar(5,3) == 0 correctly calculates 5 cannot represented 2's complement 3 bit integer. executed negative integer foobar(-4,3) == 1 correctly calculates -4 can represented 2's complement 3 bit integer. method 1 analysis x=5, n=3 00000000000000000000000000011101 32 - n == 29 10100000000000000000000000000000 x<<29 00000000000000000000000000000101 >> 29 00000000000000000000000000000101

javascript - jQuery - Calculate date, six months from the input value -

i've input textbox write date, , way calculate 6 months input date. input date format is: dd/mm/yy example how should work: input date: 01/07/13 how output function should be: 01/01/14 if have date : var date = new date(year, month, day); to 6 months later, use: date.setmonth(date.getmonth() + 6); demo: http://jsfiddle.net/gf6b6/

jsf - trying to add an actionlistener -

im trying add actionlistener menuitem primefaces component itemlogout.addactionlistener(new actionlistenermanagedbean()); and in actionlistenermanagedbean use : public class actionlistenermanagedbean implements actionlistener { public actionlistenermanagedbean() { super(); } @override public void processaction(actionevent arg0) throws abortprocessingexception { system.out.println("test action listener called.."); } public void actionperformed(actionevent e) { if(e.getsource() == "aa"){ } } } but not happens when click on logout item menu. would me please ? in advance... your e.getsource() == "aa" should e.getsource() == itemlogout . basically e.getsource() returns object action invoked on. i assuming actionlistenermanagedbean inner class.

db2 - Using MERGE with XMLQUERY and transform -

using db2 luw 10.1. having trouble getting merge work on 2 tables xml columns merged using xquery transform. i have table looks this: create table foo ( id int not null primary key, data xml not null ) to data table, load (using load) staging table looks this: create table foo_incoming ( id int not null, data xml not null ) the data in xml columns merged using xquery transform. there's logic behind it's not straightforward, it's not overly complicated either. have tested transform using manual updates know works. i try merge 2 tables this: merge foo f using (select * foo_incoming) on (f.id = i.id) when matched update set data = xmlquery(' transform copy $out := $old modify ( ... ) return $out' passing f.data "old", i.data "new") when not matched insert (id, data) values (i.id, i.data) this works when there data in foo. xml column merged way want be. if

java - ArrayList not working as expected in do..while loop -

i have following loop creates string fits in screen, creates page speak. (int = 0; < totalline; i++) { temp = enterline(mtextview, texttobeshown, i); full = full + temp; } so after iteration done full holds 1 page. what want create outer iteration allows me create more 1 page, amount of pages created isn't defined. iteration needs stop if there aren't more pages created. i tried following code reason when calling page pages.get(1) gives out whole string not full / page. example if 3 strings have been added arraylist pages there 3 strings in arraylist same value. with testing log , know first iteration working well, , full gives expected values meaning in first do iteration gives out expected values full second iteration etc.. do{ (int = 0; < totalline; i++) { temp = enterline(mtextview, texttobeshown, i); if(temp.trim().length() == 0){ break; }else{ full = full

iphone - updating an already existing iOS App -

i facing problem working on ios app client. have created new version of client's app requested , seems happy it. have publish on app store, problem app has updated newer version. previous developer had published app using own provisioning profile , refuses share code or provisioning profile now. make more precise don't have client's certificate, private key, , correct provisioning profile used launch app on app store. if create new version of app , somehow manage have previous developer delete old app app store, client looses lot of app's users. can guys please advise best way sort mess? many thanks you need acces account published app. once have acces create new certificates , provisioning profiles. if not have access account there no way can update app.

best practice for breaking references in C# -

i wondering how can break reference instance if can't put null (because program won't work), can't use dispose: (if object!=null) {object.dispose();} , , don't know , how reinitialize object (it should reinit variables also). also, can find .net memory profiler issue advisor tells how resolve found issues might indicate memory leaks? e.g. : direct eventhandler roots (show details) (ignore...) disposed instances (show details) (ignore...) pinned instances (show details) (ignore...) undisposed instances (remove external references) (show details) (ignore...) large instances (show details) (ignore...) duplicate instances (show details) (ignore...) direct delegate roots (show details) (ignore...) and on

database - Creating Android Quiz with random Q and multiple A -

i'm trying make simple quiz app. need make question pop out in random order. now, have no problem working layout , button, concept of little quiz familiar me because have done in vb mysql, i'm unfamiliar working sqlite. now, question : 1. can create android app mysql? 2. if can't, how can make/code sqlite database fields this: id | question | optiona | optionb | rightquestion i match string in rightquestion radio button id validate each answer user clicked. i have read this , this , this , none of them i'm looking for. need help from point of view, can use mysql via web server, can send request sever , server interactive mysql. on other hand, refer here sqlite programming in android using android sqlite database

mysql - My sql query some mistake in stored procedure -

delimiter $$ drop procedure if exists `dinv`.`sp_insertcustomer`$$ create definer=`root`@`localhost` procedure `sp_insertcustomer`( in vcustid varchar(120), in vname varchar(16), in vmobilenumber varchar(120), in vemail varchar(500), in vcountry varchar(120), in vcity varchar(80), in vzipcode date, in vaddress varchar(80), in vremarks date, in vcreatedby varchar(80), in vparam varchar(50) ) begin set @type = vparam; if @type="save" insert customer(custid,name,mobilenumber,emailid,country,city,zipcode,address,remarks,createdby,createddate) values(vcustid,vname,vmobilenumber,vemail,vcountry,vcity,vzipcode,vaddress,vremarks,vcreatedby,getdate()); else update customer set name=vname,mobilenumber=vmobilenumber,emailid=vemail,country=vcountry,city=vcity,zipcode=vzipcode,address=vaddress, remarks=vremarks,modifiedby=vcreatedby,modifieddate=getdate() custid=vcustid; end if; delimiter ; error code : 1064 have error in sql syntax; check manual corresponds mysql

seo - Is There any way to change the snippet created by google indexed results? -

is there way change snippet created google indexing,so drives more traffic,making more relavent can show users google choose search results snippets following places (not in order): the page's meta description tag the page's open directory project (odp) listing page content relevant search query if not want google use odp listing's description can tell them not following meta tag: <meta name="robots" content="noodp"> if want encourage google use meta description tag make sure unique each page. make sure contains accurate description of page's content. in thew absence of odp description , meta description tag, google use portion of page's text description. text contain closest matches search query. have not seen official limit how long can couple of sentences seems right. on related note, if don't want snippet shown particular page can use following meta tag prevent 1 being shown: <meta name=&quo

django - PostgreSQL & Heroku - cannot connect to the database -

i'm trying add column table via django app south keep getting following error upon running python manage.py migrate <app name> command: conn = _connect(dsn, connection_factory=connection_factory, async=async) psycopg2.operationalerror: not translate host name "ec2-107-21-99-105.comp ute-1.amazonaws.com" address: temporary failure in name resolution does have idea why happening? i'm newbie both south , postgresql database management system (which heroku uses), more bit confused. make sure have defined default database in settings.py this: databases = { 'default': dj_database_url.config(default=os.environ.get('database_url')) }

javascript - How do I modify setDate to getFullYear less 1 day? -

i not finding way modify end date warranty 1 full year less day. here code if can or point me right post answer? here function have now. function setstdwarrenddate(date) { var stddate = $.datepicker.parsedate('mm/dd/yy', date); stddate.setfullyear(stddate.getfullyear() + 1); $('#stdwarrantyenddate').val($.datepicker.formatdate('mm/dd/yy', stddate )); } use: stddate.setfullyear(stddate.getfullyear() + 1); stddate.setdate(stddate.getdate() - 1);

oracle - Row count of all tables in a schema -

declare v_owner varchar2(40); v_table_name varchar2(40); cursor get_tables select distinct table_name , user user_tables lower(user) = 'schema_name' ; begin open get_tables; loop fetch get_tables v_table_name , v_owner ; exit when get_tables%notfound; execute immediate 'insert stats_table ( table_name , schema_name , record_count , created ) select ''' || v_table_name || ''' , ''' || v_owner || ''' , count(*) , to_date(sysdate,''dd-mon-yy'') ' || v_table_name ; end loop; close

ios - Change UIBarButton to Red -

i show edit button in red , not save button below uibarbuttonitem *barbtn = [[uibarbuttonitem alloc] initwithtitle:(_isedit)? @"save" : @"edit" style:uibarbuttonitemstylebordered target:self action:@selector(togleedit)]; [uibarbuttonitem appearance] settintcolor:[uicolor redcolor]]; uibarbuttonitem *barbtn = [[uibarbuttonitem alloc] initwithtitle: (_isedit) ? @"save" : @"edit" style: uibarbuttonitemstylebordered target: self action: @selector(togleedit)]; if (!_isedit) [barbtn settintcolor:[uicolor redcolor]];

Creating a c# application/windows service that runs once a day -

hi need create application runs once day. app can run @ time of day right after user login first time within day. my question, best approach this. should create windows service or windows application this? another requirement app must run once day no matter unless has been uninstalled. you can use windows task scheduler.