Posts

Showing posts from January, 2012

javascript - How can I validate 3 select elements with jQuery? -

i'm trying validate 3 select fields on form, application score keeping application hockey, , recording scoring plays. goal scorer, b primary assist, , c secondary assist. have following validation rules: a must not empty b cannot equal or c c cannot equal or b if b empty, c must empty so in other words, a, ab, or abc valid combinations, must unique. disabling submit button applying disabled bootstrap class/html attribute submit button. in actual code, = awaygoal, b = awaypassist, c = awaysassist i have following jquery code: var awaygoal = $("#awaygoal"); var awaypassist = $("#awaypassist"); var awaysassist = $("#awaysassist"); var awaygsubmit = $("#submitawayscore"); $('#awayscore select').change(function() { if(awaygoal.val() != "" && awaypassist.val() != awaygoal.val() && awaygoal.val() != awaysassist.val()) { if(awaypassist.val() != "" && awaysassist.val() != &quo

installation - Python: TypeError when running script but not in interpreter -

i trying run python file via command line or within interpreter using: import sys import subprocess subprocess.call([sys.executable, "file.py", "arg1", "arg2", "arg3"]) however program returns typeerror: "cannot concatenante 'str' , 'numpy.float64' objects". what can not understand, when run program line line in interpreter, there no such errors , fine. i have no idea start debugging suspect have setup. i have 64bit version of python , 32bit version of python installed in windows 7. both versions of python 2.7. (this due usage of modules available in 32 bits - such program above being running in 32 bit version). environment path variable has been edited use 32bit version. i'm not sure other information relevant please let me know , i'll dig up. basically want able run program command: python program.py arg1 arg2 arg3 any appreciated you passing arguments function without converting

android - Using AsyncTask to implement API and updating result to UI -

i'm using asynctask in api carry out network operations. @ ui part there button, clicking on triggers api execute request/async task. api implementing callback updated onpostexecute() method. api gets right data populated once onpostexecute() passes data on callback. works good. i'm getting conceptual problem while updating ui. want achieve: 1- click "button" on ui 2- want update api's response string ui. response string after executing asynctask. the problem api return null response in current thread of execution. once ui thread done, see api/asynctask data coming in. know i'm missing trivial, important. know whats right way update api response on ui? [update] here ui code includes clicking button triggering async task via api (just class implements callbacks getting server response) button.setonclicklistener(new onclicklistener() { public void onclick(view v) { api api = new api(); request request

Removing Characters within a string-Java -

i keep getting error removing character within string. have tried find on site , nothing has worked. not post. rather maybe answer explains why shows , how fix in case else encounters issue. without further due, here code: public jtextfield clean() { string cleaner = topfield.gettext(); cleaner=cleaner.tolowercase(); int length = cleaner.length(); stringbuilder combiner = new stringbuilder(cleaner); (int x=0;x+1<length;x++) { char c = cleaner.charat(x); char c1 = cleaner.charat(x+1); if(c==' ' && c1==' ') { combiner.deletecharat(x); cleaner=combiner.tostring(); } if(c!='a' && c=='b' && c!='c' && c!='d' && c!='f' && c!='g' && c!='h' && c!='i' && c!='j' && c!='k' && c!='l' && c!='m' &

Java - Creating an image -

i'm working on game in java , trying create background without using image files. image consists of square split 4 triangles, each of different color. if point me towards of using graphics2d , saving bufferedimage , great. i recommend: first create bufferedimage using constructor takes 3 ints: width, height, , bufferedimage type, bufferedimage.type_int_argb work well, , width , height constants in program. you extract graphics2d object out of bufferedimage calling creategraphics() method. then draw graphics object using drawxxx(...) methods of have many select from. to change color, call setcolor(color c) on graphics/graphics2d object. when done drawing, sure dispose of graphics object via dispose() method. edit per adrian blackburn, check out bufferedimage tutorial part of standard oracle java tutorials.

xaml - ApplicationBarIconButton throwing AccessViolationException when i try to make any change -

i have set of applicationbariconbuttons on 1 of xaml page, looks on xaml: <shell:applicationbariconbutton x:name="button1" iconuri="/images/yourimage.png" text="button 1"/> in xaml.cs: button1.iconuri = new uri("/images/yourimage2.png", urikind.relative); when add execute change of iconuri or text, throws accessviolationexception i wonder what's going on over net, that's way such simple/straightforward change. , image file changed "content", build action "do not copy", i've tried sorts of combination it's still throwing errors. i've recreated whole solution. but i'm having problem whereby xaml doesn't updated when make change, way me update app on device deleting , reinstalling. another strange thing that, when run code analysis, i'm getting this: ca0001 error running code analysis ca0001 : following error encountered while reading module 'xxx': not resolve memb

c# 4.0 - ASP.NET MVC 4 AttributeRouting Multiple POST Actions in same controller -

i not sure doing wrong here. whenever post request controller update action invoked. calling: http://localhost/members/login/ however update keeps getting request. have tried switching order of actions in controller no avail. [routeprefix("members")] public class memberscontroller : apicontroller { [post("{member}")] public void update(member member) { //do stuff } [post("login/{member}")] public httpresponsemessage memberlogin(member member) { //do stuff } } any appreciated. thanks! that because api routing same. this article explain how routing , action selection done in web api. if not want split them 2 controllers make update put request. should tell routing engine 2 different actions.

python - traversing through a tree -

i want write function returns elements in tree in list. i'm not allowed use global variables though. here's tried: def traverse(current node): if no left child , no right child: return current nodes data else: if both left child , right child exist: return [current nodes data,left_child.traverse(),right_child._traverse()] elif no left child: return [current node's data,right_child.traverse()] elif no right child: return [current node's data,left_child.traverse()] we used example: (root 2, left child 1, right child 3 , right child of right child 4) 2 1 3 4 calling traverse on tree returned this: [2, 1, [3, 4]] so problem can't fit within 1 list. edit: here of node functions can called: node.data , node.left , node.right instead of returning list of values, want pass in array , recursively append values array: def traverse(node, arr): if node.left: tr

.htaccess - How to do a mod_rewrite with varying number of variables -

this question has answer here: mod_rewrite multiple variables , subfolders 2 answers i have mod_rewrite rule has 3 variables so: rewriterule ^page/(.*)/(.*)/(.*)$ page.php?a=$1&b=$2&c=$3 the 3rd variable isn't mandatory, first 2. problem occurs when attempts hit url first 2 in place page/blah/blah or page/blah/blah/ i understand can have 2 rules, e.g: rewriterule ^page/(.*)/(.*)/(.*)$ page.php?a=$1&b=$2&c=$3 rewriterule ^page/(.*)/(.*)$ page.php?a=$1&b=$2 but seems longwinded. how can write flexible rule allows 3 url possibilities arrive @ same page? /page/blah/blah/blah/ /page/blah/blah /page/blah/blah/ you may try in 1 .htaccess file @ root directory: options +followsymlinks -multiviews rewriteengine on rewritebase / rewritecond %{request_uri} !page\.php [nc] rewriterule ^page/([^/]+)/([^/]+)/?([^/]+)?/? /page

objective c - Xcode: How do I put this into a loop? -

i new xcode , trying make code more efficient. have code below , want put repeated lines @ end loop (there many more items in array). sure it's simple can't figure out how evaluate variables within loop. asking google wrong question isn't helping! glossarydetailviewcontroller *dcontroller = segue.destinationviewcontroller; glossarydict = glossaryarray [indexpath.row]; dcontroller.detaillabeltext = [glossarydict objectforkey:@"explanation"]; dcontroller.detailtitle = [glossarydict objectforkey:@"term"]; nsmutablearray *labelarray; labelarray = [glossarydict objectforkey:@"label"]; dcontroller.labelstring0 = labelarray[0]; dcontroller.labelstring1 = labelarray[1]; i know how create loop ie for(int i=0;i any pointers appreciated. thanks! if asking how automate these : dcontroller.labelstring0 = labelarray[0]; dcontroller.labelstring1 = labelarray[1]; dcontroller.labelstringxx=labelarray[xx]; then have 2 ways: either use arr

eclipse - Worklight Studio plug-in for Indigo in Windows 7 -

i cannot seem worklight install properly. using windows 7 32 bit operating system , clean installation of indigo(eclipse-jee-indigo-win32). when trying install worklight -> eclipse marketplace i got following message: an error occurred while collecting items installed session context was:(profile=epp.package.jee, phase=org.eclipse.equinox.internal.p2.engine.phases.collect, operand=, action=). artifact not found: osgi.bundle,org.eclipse.wst.jsdt.support.ie,1.0.500.v20130201_1508. http://public.dhe.ibm.com/ibmdl/export/pub/software/mobile-solutions/worklight/wdeupdate/plugins/org.eclipse.wst.jsdt.support.ie_1.0.500.v20130201_1508.jar artifact not found: osgi.bundle,com.ibm.etools.attrview,1.0.100.v20120918_0208. http://public.dhe.ibm.com/ibmdl/export/pub/software/mobile-solutions/worklight/wdeupdate/plugins/com.ibm.etools.attrview_1.0.100.v20120918_0208.jar artifact not found: osgi.bundle,com.ibm.etools.webtools.dojo.library,1.0.600.v20130222_1636. http://public.dhe.ibm.com/

ios - UIActivityViewController sharing image via email has no extension -

the image attached "attachment-1", no extension. how specify 1 ? nsdata *compressedimage = uiimagejpegrepresentation(self.resultimage, 0.8 ); uiactivityviewcontroller *activityviewcontroller = [[uiactivityviewcontroller alloc] initwithactivityitems:@[ @"check out!", compressedimage ] applicationactivities:nil]; [self.navigationcontroller presentviewcontroller:activityviewcontroller animated:yes completion:nil]; according this answer should able use workaround specify filename nsdata *compressedimage = uiimagejpegrepresentation(self.resultimage, 0.8 ); nsstring *docspath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0]; nsstring *imagepath = [docspath stringbyappendingpathcomponent:@"image.jpg"]; nsurl *imageurl = [nsurl fileurlwithpath:imagepath]; [compressedimage writetourl:imageurl atomically:yes]; // save file uiactivityviewcontroller *activityviewcontroller = [[uiac

Sending UDP packets in Objective C: packet arriving without any data -

i'm trying send udp packets in objective c. more specifically, building xcode targeting iphone 6.1 simulator. i can't seem receive data send. weirdly, data event... data's been truncated length 0. i've cut down as can, make dead simple test think should pass. #import "udpsockettest.h" #include <arpa/inet.h> #import <corefoundation/cfsocket.h> #include <sys/socket.h> #include <netinet/in.h> @implementation udpsockettest static int receivedbytecount = 0; void onreceive(cfsocketref socket, cfsocketcallbacktype type, cfdataref address, const void *data, void *info); void onreceive(cfsocketref socket, cfsocketcallbacktype type, cfdataref address, const void *data, void *info) { // gets called once, cfdatagetlength(data) == 0 receivedbytecount += cfdatagetlength(data); } -(void) testudpsocket { struct sockaddr_in addr; memset(&addr, 0, sizeof(addr)); addr.sin_len = sizeof(addr); addr.sin_family = af_in

Python Tkinter correct pronunciation -

i not sure in right place kind of question, if not pls let me know & remove question. anyway, correct pronunciation tkinter?i have looked around , tea kay inter, tink-ter , tea kin ter..and list goes on. 1 officially accepted? it's not tink-ter, that's not same name. first thing in docs is: the tkinter module (“tk interface”) which means can't tea kinter beacause t , k grouped together, must teakay-inter.

jquery set div width to other div's width after animation -

i'm animating div wider, after animation want set width of following list exact same of newly animated div, , move under it. oddly, when resizing, resizes small width, once clicked again wanted size millisecond. might not unclear. $('#loginbutton').click(function(){ $('.username').stop(true,false).animate({width:'toggle'}); $("#profilesettings").delay(220).toggle(300); $("#profilesettings").width( $("#loginbutton").outerwidth(true) ); }); here's fiddle so, i'd list appears width of entire image + name bar , i'd move under it. thanks! you can use anonymous callback function along animate call, menu appears once clicked element has finished expanding. way accurate width. can make display underneath setting clear:both; . the resulting code looks like... $('#loginbutton').click(function(){ //$('.username').stop(true,false).animate({width:'toggle'}); $('

javascript - Recursive callbacks -

need little trying breadcrumb builder working - it's recursive fetch parent categories should return array of entries. not quite working , brain fried.... returns last entry. var walk = function(c, done) { var results = []; category.findbyid(c).exec(function(err, cat) { if(cat) { results.push({ title: cat.title, id: cat.id}); if(cat.parent) { walk(cat.parent, function(err, res) { results = results.concat(res); }); } return done(null, results); } done(results); }); }; walk(product.categories[0].id, function(err, results) { // if (err) console.log (err); console.log(results); }); how node-fibers ? try this. good example link : mongo-model example and method synchronize util written coffee-script

How to load SQLite3 database with log file entries using perl -

i have assignment in perl class contains 2 programs, first create database , table using dbi::sqlite perl, have completed first part of program, have no idea how go doing second part. second part involves getting source ip , destination port pairs log file , inserting them table using sql insert statement. table created in first program contains 2 columns, 1 source ip , 1 destination ports, program shouldn't produce output except count of rows added table. can see below code have put represents how table setup, appreciate on learning how fill table. log file needed second program available @ link: http://fleming0.flemingc.on.ca/~chbaker/comp234-perl/sample.log the code first program #!/usr/bin/perl use strict; use warnings; use dbi; $dbh = dbi->connect( "dbi:sqlite:dbname=test.db", "", "", { raiseerror => 1} ) or die $dbi::errstr; $dbh->do(<<'end_sql'); create table probes ( source char(

How to create substrings from input string using regex? -

how create substrings input string using regex? each substring should have 3 contigious characters in input. ex: input text="1234abc"; expected substring output : 123,234,34a,4ab.abc.... use lookahead (?=(.{3})) so,first 3 characters captured in group within lookahead..now move next character (i.e 2 in example) , again capture 3 characters , on.. note: group captures within lookaround support limited regex implementations

ios - Place UIViews in Circular fashion -

Image
i creating graph interface different nodes , selected node @ center. created center node , drew circle mark location around subnodes placed. i wanted place many nodes in circumference of circle without each overlapping other. how find how many can placed in circumference? each of subnode views have same size. irrespective of that, arclength occupied each of sub nodes in circumference of circle different . how find total no of controls size possible placed in circle's circumference particular radius . , how find center point of each subnodes placed in circle's circumference. i know can use below formulas find angle traverse place subnodes. problem here arclength not fixed each subnode view. 2pirc/360 = arclength x = cx + r * cos(a) y = cy + r * sin(a) i have solved problem using below formula mentioned in answer in thread in stackoverflow: (x + r cos(2kπ/n), y + r sin(2kπ/n))

.net - AD: Group does not have a primaryGroupToken attribute -

Image
i need change primary group of user, can delete it's current one. group not have attribute "primarygrouptoken", need in order change primary group of user. here screenshot of attribute editor: obviously, code responds nothing: dim domaingroup new directoryentry("ldap://our.domain/cn=domain users,cn=users,dc=our,dc=domain") dim domaingroupgrouptoken string = domaingroup.properties("primarygrouptoken").value.tostring() is there way manually set it? or there wrong code? in advance. it's computed property. stealing here , need add call refreshcache before accessing property: dim domaingroup new directoryentry("ldap://our.domain/cn=domain users,cn=users,dc=our,dc=domain") domaingroup.refreshcache(new string() {"primarygrouptoken"}) dim domaingroupgrouptoken string = domaingroup.properties("primarygrouptoken").value.tostring() (not tested, vb bit rusty)

c++ - Can I avoid using the class name in the .cpp file if I declare a namespace in the header? -

this question has answer here: c++: “class namespaces”? [duplicate] 4 answers in c++, want declare displayinfo class in .h file, , in .cpp file, not have type first displayinfo::displayinfo() , every function definition. sadly, i've looked @ on 20 topics , c++ book on 2 hours , have not been able resolve this. think it's because i'm trying use 10-year-old java training in c++. 1st trial: //displayinfo.h namespace displayinfonamespace { class displayinfo { public: displayinfo(); //default constructor float getwidth(); float getheight(); ... }; } //displayinfo.cpp using namespace displayinfonamespace; //doesn't work using namespace displayinfonamespace::displayinfo //doesn't work either using displayinfonamespace::displayinfo //doesn't work { displayinfo::displayinfo() {}; //works when remove namespac

asp.net mvc 3 - Post ID doesn't Work in Form -

i have post define new database entity. after user enters needed values , submits form, insert entity , post same page , display it's id. when enter id area disabled , readonly below, works perfectly. @using (html.beginform()) { @html.validationsummary(true) <fieldset> id: @html.textboxfor(model => model.id, new { disabled = "disabled", @readonly = "readonly" }) <p><input type="submit" name="submit" value="create" /></p> </fieldset> } however, when enter readonly in below, insert entity, doesn't view id. @html.textboxfor(model => model.id, new { @readonly = "readonly" }) i have submit in form, uses entities id. however, cannot use disabled here id area, doesn't post id value. can resolve issue? you can enable disabled field before submitting. so, keep id field disabled. now, enable on submit. ie; if submit form on "mybutto

android - Trouble in ListFragment with BaseAdapter -

i trying create list custom baseadapter. getting nullpointerexception error, seem not load data adapter or view wrong. below code: fragmentactivity public class newsitemlistactivity extends fragmentactivity implements newsitemlistfragment.callbacks { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_newsitem_list); if (savedinstancestate != null) { mactiveposition = savedinstancestate.getint(state_active_position); } if (findviewbyid(r.id.newsitem_detail_container) != null) { listfragment = ((newsitemlistfragment) getsupportfragmentmanager() .findfragmentbyid(r.id.newsitem_list)); listfragment.setactivateonitemclick(true); } } activity_newsitem_list layout <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://sche

How to get variable from javascript to rails -

i such javascript: fb.api('/me', function(response) { var name = response.name; first_name = response.first_name; alert("name: "+ name + "\nfirst name: "+ first_name);} how value of name , first_name rails controller? use rails 3.2. place value of javascript array in request parameter, either via ajax or setting value of form input. i'm going use jquery in examples: option 1 (ajax): $.post('/users/some_action', {"name" : name, "first_name", first_name}) option 2 (setting form): $('#name').val(name) $('#first_name').val(first_name) in controller: name = params[:name] first_name = params[:first_name]

php - How to change the background color of a cell based on its value using javascript? -

i have table 3 columns: field1 category field2 , field3 hold measures (integers 1,2,3,4 , 5 exact). using javascript, how can conditionally format background color of cells in table hold these measures (notably field2 , field3) correspond following colors: cells 1 red cells 2,3, , 4 blue cells 5 green here's have far (it's in 1 html file now, while sorted out) , i've broken readability. think might missing background attribute in html altogether. know possible, not sure how dynamically change background color of table cell depending on contents using javascript. thanks in advance. start of script <html> <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $( "#status_report td.measure:contains('1')" ).css('background-color', '#fcc'

android - Cannot use json to get the data from url (NullPointerException) -

i'm trying data json format of http://projectxapp.herokuapp.com/dashboard/ads/api/v1/ads/ it shows nullpointerexception, , i've tried variable ways solve it. still have no ideas!! seems objectlist empty. public class imagepageractivity extends activity { // url make request private static string url = "http://projectxapp.herokuapp.com/dashboard/ads/api/v1/ads/"; // json node names static final string tag_meta = "meta"; static final string tag_meta_limit = "limit"; private static final string tag_meta_next = "next"; private static final string tag_meta_total_count = "count"; private static final string tag_objects = "objects"; private static final string tag_objects_end_time = "endtime"; private static final string tag_objects_id = "id"; private static final string tag_objects_link = "link"; private static final string tag_objects_photo = "photo"; private stat

MySQL Self Join Not All Rows included -

i have problem working out self join. i have following table: create table `test`.`tablen` ( `id` int(10) unsigned not null auto_increment, `group` int(10) unsigned not null, `item` int(10) unsigned not null, `data` varchar(45) default null, primary key (`id`) ) engine=innodb; insert `test`.`tablen` (`group`,`item`,`data`) values (1,100,'aaa'), (1,200,'bbb'), (2,100,'ccc'), (2,200,'ddd'), (3,100,'eee'); what need run query, outputs data each 'item' in single row. the query have got is: select t1.`group`, t1.`item`, t1.`data`, t2.`item`, t2.`data` tablen t1 left join tablen t2 on t2.`group`=t1.`group` 1=1 , t1.item = 100 , t2.item = 200 group t1.`group`; the problem is, returns 2 rows (group 1 , group 2). need return row group=3, though there no entry item=200. how can please. put t2.item = 200 condition join clause. select t1.`group`, t1.`item`, t1.`data`, t2.`item`, t2.`data` tablen t1 left join tabl

php - Joomla: error while saving form in custom view -

i have created custom component form update prices of 4 product displayed on frontend. my main controller code here: public function display($cachable = false, $urlparams = false) { require_once jpath_component.'/helpers/calculator.php'; $view = jfactory::getapplication()->input->getcmd('view', 'pricetable'); $layout = jfactory::getapplication()->input->getcmd('layout', 'edit'); jfactory::getapplication()->input->set( 'layout', $layout ); jfactory::getapplication()->input->set('view', $view); jfactory::getapplication()->input->set('id', 1); parent::display($cachable, $urlparams); return $this; } id set 1 loads first row database. code pricetable container is: function __construct() { $this->view_list = 'pricetable'; parent::__construct(); } now in admin backend form loaded desired first row of data. when try save

sql server - Include additional columns in a non clustered primary key index -

i have defined primary key on table nonclustered . non-clustered indexes explicitly created create nonclustered index possible include additional (non-indexed) columns. same possible implicitly created primary key non-clustered index? the syntax include columns available create nonclustered index , specifically include (column [ ,... n ] ) specifies non-key columns added leaf level of nonclustered index. nonclustered index can unique or non-unique. is not available add constraint, cannot include columns primary key, if non-clustered. a primary key useful unique identifier record, , candidate key available referential constraints. however, performance reasons, if have clustering key on column , have no other candidate keys promote pk, can create additional non-clustered index on primary key column(s) , include other columns onto index.

php - How to get current date in codeigniter -

how current date in codeigniter in yy-mm-dd format. wants current date in yy-mm-dd frmat , put value input text box you can use php date function . date('y-m-d'); up knowledge, there no separate date function in codeigniter. edit : but if want date in format 13-04-05 [ yy-mm-dd ] , try this date('y-m-d'); for more date formats, check link php date formats

excel - Create a Table with data filtered from data in another worksheet -

i have table 105 columns , around 300 rows in sheet 1. need in sheet 2 reduced version of same table, filtered column values (not first column). i've looked @ pivot tables seems can not same tabular structure. have tried advanced filter , error: "the extract range has missing or illegal field name". could help? microsoft's powerquery addin supports this. 1 of many sources can excel data-from table.

python - XML Unicode strings with encoding declaration are not supported -

trying following... from lxml import etree lxml.etree import fromstring if request.post: parser = etree.xmlparser(ns_clean=true, recover=true) h = fromstring(request.post['xml'], parser=parser) return httpresponse(h.cssselect('itagg_delivery_receipt status').text_content()) but give error: [fri apr 05 10:27:54 2013] [error] internal server error: /sms/status_postback/ [fri apr 05 10:27:54 2013] [error] traceback (most recent call last): [fri apr 05 10:27:54 2013] [error] file "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 115, in get_response [fri apr 05 10:27:54 2013] [error] response = callback(request, *callback_args, **callback_kwargs) [fri apr 05 10:27:54 2013] [error] file "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py", line 77, in wrapped_view [fri apr 05 10:27:54 2013] [error] return view_func(*args, **kwargs) [fri apr 05 10:27:54 2013] [error] file &q

mysql - can I have two rows that have same contents except 1 column -

Image
i made database , store information of pass, etc. in step in updating pass. edit 1 column of table of pass. can ? or wrong ? first obtain max(updatetag) table , execute following query select serialno table updatetag = <max update flag obtained in previous query>

javascript - Calling JS Function when The tag contains duplicate 'ID' attributes -

i want call js function can jquery calendar when click on text box showing error. want know how can use both attributes txtexpiry , datapicker? or there other way ? here code of text box <asp:textbox id="txtexpiray" runat="server" id="datepicker" clientidmode="static" width="70px"></asp:textbox> here function <script type='text/javascript'> $(function () { $('#datepicker').datepicker(); }); </script> you can't use duplicate id attributes - or duplicate attributes matter (id attributes should unique page). you can this: <asp:textbox id="txtexpiray" runat="server" clientidmode="static" width="70px"></asp:textbox> <script type='text/javascript'> $(function () { $('#txtexpiray').datepicker(); }); </script>

javascript - Avoiding the "script is running too long" dialog, should I split up my function and run it at intervals? -

i have large javasscript loop running on 1 of pages. large causing ie popup in old versions says like: 'a script of page making run slow, want terminate it?' i'm confident have optimized as possible i'm looking alternate ways it. i'm wondering whether beneficial me create interval ran first 100 iterations, second 100 iterations, third , on until iterations complete? prevent ie popup claiming scripts running slow? the "script long" browser popup appear time code doesn't yield control browser's main event processing loop enough. using settimeout suggest in question trigger calculations in batches indeed prevent popup appearing. yielding event loop periodically allow browser remain responsive other ui events - (for example) offer "cancel" button. suggest try yield @ least once second, if not more that.

Git branch diverged -

i new git, although understand it's concept don't think understand it's practice well. i given branch, uitest work on, because may have not done push, commit, pull correctly, have diverged branch. because new here, n don't want override other devs codes code or changes experimental used git , how works wouldn't mind discarding changes have copy of need re-do everything. $ git status # on branch uitest # branch , 'origin/uitest' have diverged, # , have 47 , 6 different commits each, respectively. # nothing commit (working directory clean) how undiverge? discard changes , pull recent changes latest changes , continue working without messing other peoples work. also, new this, little descriptive answer may not make sense me. many thanks there few ways. merge first, merge origin/uitest , doesn't leave clean history in introduces looks branch , merge though meant same branch along. believe linus liked call these kind of merge co

c++ - (not) using std::string in exceptions -

i'm reading should not throw std::string or other classes allocating memory. here or more importantly here on point 3. - don't embed std::string object . so i'm trying insert boost::exception project , see: lots of strings . why doesn't boost comply own recommendation? and if have parameters can't hardcoded, safed in config-file, how can put them exception, without using std::string ? or guideline don't use std::string do use std::string seldom possible guideline? i'm bit confused... i've done research. please correct me if i'm wrong. if understand right, it's allocation during throw , happening allocated memory. memory gets lost if allocate in constructor , can't freed in destructor of exception, produce memory-leak. it's okay allocate before throwing, exception clean. i tried this: struct xexception { int *ttt[10]; xexception() { ttt[0] = new int[0xfffffffl]; ttt[1] = new int[0xfffffffl]; t

OOP Javascript, get instance name -

i have object , write instance: var table1=new searchtable(someoptions) is there anyway "table1" programatically inside object? no. objects have no knowledge of variables , properties (there can multiple) assigned to.

c - Passing string to function and returning a structure -

i trying achieve simple objective of passing string function , returning structure containing data string. have written this, when try compile runtime error , can't understand why. thank kindly having look. #include <stdio.h> #include <ctype.h> #include <string.h> struct stringstats { int length; int uppercase; int lowercase; int digits; int nonalphanum; }; struct stringstats stringreader (char anystring[]) { int i; struct stringstats returned = {0, 0, 0, 0, 0 }; returned.length = strlen(anystring); (i = 0; anystring[i] != '\0'; ++i) { if (isupper(anystring[i])) ++returned.uppercase; if (islower(anystring[i])) ++returned.lowercase; if (isdigit(anystring[i])) ++returned.digits; if (isalnum(anystring[i]) == 0) ++returned.nonalphanum; } return returned; } int main(void) { struct stringstats stored; char passedstrin

iphone - custom callout in Mkmapview in ios -

i have display custom view on annotation click in ios, have display 7 images, name , detail disclosure button in custom view. on click of detail disclosure button , have call new view controller. how should it? -(mkannotationview *)mapview:(mkmapview *)mapview viewforannotation:(id <mkannotation>)annotation { // define reuse identifier. mkpinannotationview *annotationview=[[mkpinannotationview alloc] initwithannotation:annotation reuseidentifier:@"currentloc"]; annotationview.pincolor = mkpinannotationcolorgreen; annotationview.enabled = yes; annotationview.canshowcallout = yes; // adding button on annotation callout detail disclosure button// uibutton *rightbutton = [[uibutton alloc]initwithframe:cgrectmake(0.0f,0.0f,28.0f,22.0f)]; [rightbutton setimage:[uiimage imagenamed:@"rightarrow.png"] forstate:uicontrolstatenormal]; [rightbutton addtarget:self action:@selector(pressdetailbtn:)

python - Can anyone explain to me how this code allows the stars to move? -

trying understand how code works, can explain please. def draw_star(star): # drawing star # need change pixel, use set_at, not draw.line screen.set_at((star[0], star[1]), (255, 255, 255)) star[0] -= 1 if star[0] < 0: star[0] = screen.get_width() star[1] = random.randint(0, screen.get_height()) stars = [] in range(1200): x = random.randint(0, screen.get_width()) y = random.randint(0, screen.get_height()) stars.append([x,y]) star in stars: draw_star(star) first, code generates 1200 [x, y] coordinates, each python list : stars = [] in range(1200): x = random.randint(0, screen.get_width()) y = random.randint(0, screen.get_height()) stars.append([x,y]) each x , y coordinate consist of random value within constraints of screen. next, each of these coordinates drawn: for star in stars: draw_star(star) this passes [x, y] coordinate list function draw_star def draw_star(star): # drawing star th

Dynamically get values from server by index generated in XML and place by div java -

i have device , need values server , place in right place div. there 3 groups of values digital, analogs , integer. values generating xml.cgi: getparams(xml.cgi?d|1|3|i|1|3|a|1|3); and generate xml: <pcoweb><pco> <digital> <variable> <index>1</index> <value>0</value> </variable> <variable> <index>2</index> <value>0</value> </variable><variable> <index>3</index> <value>0</value> </variable> </digital> <integer> <variable> <index>1</index> <value>0</value> </variable> <variable> <index>2</index> <value>0</value> </variable> <variable> <index>3</index> <value>0</value> </variable> </integer> <analog> <variable> <index>1</index> <value>5.0</value> </variable> <variable> <index

sql - sum function not working properly -

Image
my database in sql server 2005: my query is: select * tradefile convert(datetime,sauda_date) 'mar 1 2013%' , scrip_code='dlf' , inst_type 'fut%' this gives me result: in buy=1 , sell=2. if make sum of buy qty i.e. buy_sell=1 3000 and when make sum sell trade qty i.e. buy_sell=2 3000 but when fire query getting same result follows: select convert(varchar(11),sauda_date) sauda_date, sum(case when buy_sell = 1 , scrip_code='dlf' , sauda_date between convert(datetime,'01/03/2013') , convert(datetime,'06/04/2013') trade_qty else 0 end) buyqty, sum(case when buy_sell = 2 , scrip_code='dlf' , sauda_date between convert(datetime,'01/03/2013') , convert(datetime,'06/04/2013') trade_qty else 0 end) sellqty , sum(case when buy_sell = 1 , scrip_code='dlf' trade_qty e

java - Variable type in javadoc methods eclipse -

is there way have type of input variable methods javadoc in eclipse? i know can have tags name of variables like: /* * param1 * param2 */ but i'd like: /* * string param1: * int param2: * return int: */ i've seen in window-->preferences->java-->code style-->code templates can't see resembling tags need. thanks no, javadoc tool not support this. why want this? in documentation of method generate javadoc, method signature shows types of parameters are.

Drupal 7 - User profile field editable only at registration -

in drupal 7, there way display mandatory field @ registration, , make un-editable after user has registered? thanks in advance! from drupal backend: configuration account settings manage fields from here can add new field (be sure check box asks if field should present on user registration form) then you'll want use hook disable field in user_profile form.\ code: template.php function theme_form_alter(&$form, &$form_state, $form_id) { switch($form_id) { case 'user_profile_form': $form['field_my_field']['#disabled'] = true; break; } }

Android: Random crash issue -

i getting random crash not able figure out in code happening. app exits randomly. comes around time when when trying populate list using listui. not sure of reason. relevent stack trace mentioned below. please give me direction, kind of problem leading issue. w/inputdispatcher( 188): channel '4171e5b0 com.pv.example.impl/com.pv.example.impl.exampleactivity (server)' ~ consumer closed input channel or error occurred. events=0x8 e/inputdispatcher( 188): channel '4171e5b0 com.pv.example.impl/com.pv.example.impl.exampleactivity (server)' ~ channel unrecoverably broken , disposed! w/inputdispatcher( 188): attempted unregister unregistered input channel '4171e5b0 com.pv.example.impl/com.pv.example.impl.exampleactivity (server)' i/activitymanager( 188): process com.pv.example.impl (pid 2419) has died. w/activitymanager( 188): force removing activityrecord{41748ee8 com.pv.example.impl/.exampleactivity}: app died, no saved state i/windowmanager( 188): win d