Posts

Showing posts from July, 2013

Jquery Mobile 1.3.1 vs 1.2.1? -

i'm new jquery mobile , want build web app using version best use , why? latest 1.3.1 or 1.2.1? need advice. use 1.3.1 because has bigger set of ui widgets. from stability point equally stable. errors found in version 1.2 , 1.2.1 fixed in 1.3.1. also 1.3.1 allows use higher range of jquery versions (up jquery 2.0). 1.2 , 1.2.1. locked max. jquery 1.8.3. jqm 1.3.1 has better handling of page transitions.

batch file - Folder creation using bat command -

i have bat file create folder. :x3main if exist "%1%\jboss" goto test if exist "%1%\db" goto db goto end :test mkdir "%destination%\ix3\cosmic\jboss" goto end :db mkdir "%destination%\ix3\cosmic\db" goto end here first folder created successfully(if exist "%1%\jboss" goto test) second function not working. if remove first function second function working. please can explain reason behind this? some info: in nt line of windows reliable test folder need end foldername backslash and may have meant %~1 instead of %1% if exist "%~1\jboss\" task and in case can use nothing if folder exists: 2>nul eliminates harmless error message when folder exists. mkdir "%destination%\ix3\cosmic\jboss" 2>nul mkdir "%destination%\ix3\cosmic\db" 2>nul

bit manipulation - Why does a right shift on a signed integer causes an overflow? -

given 8 bits negative integer (signed between -1 , -128), right shift in hla causes overflow , don't understand why. if shifted once, should divide value 2. true positive numbers not negative. why? example if -10 entered result +123. program cpy; #include ("stdlib.hhf") #include ("hla.hhf") static i:int8; begin cpy; stdout.put("enter value divide 2: "); stdin.geti8(); mov(al,i); shr(1,i); //shift bits 1 position right if(@o)then // if overlow stdout.put("overflow"); endif; end cpy; signed numbers represented 2's complement in binary, plus sign bit "on left". 2's complement of 10 coded on 7 bits 1110110, , sign bit value negative numbers 1. -10: 1111 0110 ^ | sign bit then shift right (when right shift zeroes added left): -10 >> 1: 0111 1001 ^ | sign bit your sign

Finding attribute value of some unspecified ancestor using Xpath -

i find xpath expression select nodes, attribute 'a' value exists , concatenation of attribute 'b' , value of 'a' of first ancestor, attribute 'a' exists, or such nodes, first in hierarchy, have attribute 'a'. <a a='town/'> <b> <c a='town/street' b='street'> <d a='town/street' b='street'> <e a='town/street/house' b='street'></e> <f a='town/street/house' b='house'> <g a='town/street/house' b='house' ></g> </f> </d> </c> </b> </a> the xpath should pick elements a, c , f tried \\*[(@a = concat(ancestor::*[@a][1]/@a,'/',@b)) or (not(ancestor::*[@a])] , not work intended. can please help? thank you. first, you're using backslashes instead of slashes in beginning of query. then, input inconsistent (or copy&paste error?),

actionscript 3 - How to enable orientation change for some views in Flex Mobile? -

i have views in mobile app (for both ios , android) orientation fixed portrait using <aspectratio>portrait</aspectratio><autoorients>false</autoorients> in settings xml file. now have added view plays video youtube , should able play videos, both in landscape & portrait orientation. came across this question provides solution restrict 1 orientation (globally views), how can re-enable orientation change 1 view? note : using flash builder 4.6 actionscript 3 , youtube api any appreciated :) remove <aspectratio>portrait</aspectratio><autoorients>false</autoorients> xml, as generalize whole application. do seperately each , every view. since first view need portrait ,do this.( taken adobe docs ) stage.addeventlistener( stageorientationevent.orientation_changing, onorientationchanging ); function onorientationchanging( event:stageorientationevent ):void { // if stage move orientation don't support, le

r - Barplot with Categorical X Axis -

i trying generate bar plot categorical x axis , 2 different y axis. trying use twoord.plot generate bar plot follows: x <- c("a","b","c","d","e") ry <- c(0.1,0.2,0.3,0.4,0.5) ly <- c(0.15,0.25,0.35,0.45,0.55) library(plotrix) twoord.plot(x,ry,x,ly, xlab="xlabel", ylab="ylabel", rylab="rylabel", main="main", type=c("bar","l"),lcol=rainbow(length(x)),rcol=4) however, getting error "error in plot.window(...) : invalid 'xlim' value". is there way work categorical/character variables x-axis? also, there way rotate x-axis labels show @ 45 degrees? i have been able code work following changes: xnumeric <- seq(1:length(x)) twoord.plot(xnumeric,ly,xnumeric,ry, xlab="xlabel", ylab="ylabel", rylab="rylabel",

like operator syntax in sqlite with android -

i'm developing android , need query sqlite using operator , variables. the piece of code try modify is, implementation of database present @ this link. so, i'm trying query on table created in link in order select name table. i'm doing this: cursor c = sampledb.rawquery("select firstname, age " + sample_table_name + " where" +field+ " %"+search+"%" , null); where field , search 2 variable defined above in way: final string field = "lastname"; final string search = "makam"; if execute app in output, should see row name , age have selected in query.but, obtain nothing!!! the logcat of eclipse shows : sqlite returned: error code = 1,msg = near "like": syntax error. but i'm pretty sure syntax it' s correct. me? use way: cursor c = sampledb.rawquery("select firstname, age " + sample_table_name + " " +field+ " '%"+search+"%'&qu

country - Php if selection by origin visitor (ip adress) -

i have code in shopping cart (magento 1.6.2) <?php if ($this->getquote()->getsubtotal() < 41.28): ?> <?php $subtotalamt = $this->getquote()->getsubtotal(); ?> <?php $freeshipamt = 41.28; ?> <?php $sumtotal = ($freeshipamt - $subtotalamt )* 1.21; ?> <?php mage::helper('checkout')->formatprice($sumtotal); ?> <p>gratis verzending vanaf € 49,95 <br/>(binnen nederland)</p><p> <strong>nog <span>€ <?php print number_format($sumtotal, 2, ',', ' '); ?></span> tot gratis verzending!</strong></p> <?php else: ?><p><strong>uw bestelling wordt gratis verzonden!</strong> <br/>(binnen nederland)</p> <?php endif ?> <?php /* <span>$<?php print ($sumtotal); ?></span> away earning free shipping!</p> */ ?> this code calculates needed amount customer receive free shipping within netherlands. is t

iphone - Not able to convert NSString to NSDate -

i'm getting date (thu may 02 10:08:08 +0000 2013) link , stored string. want convert string nsdate. i'm using code: nsdateformatter *formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"yyyy-mmmm-dd hh:mm:ss"]; nsdate *message_date=[formatter datefromstring:str]; nslog(@"message_date ========%@",message_date); but message_date printing null value. so please guide me , put sample code. please try use 1 nsstring *str = @"thu may 02 10:08:08 +0000 2013"; nsdateformatter *formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"eee mmm dd hh:mm:ss z yyyy"]; nsdate *message_date=[formatter datefromstring:str]; nslog(@"message_date ========%@",message_date);

c# - How to use the .show() of Ajax ModalPopUpExtender when ModalPopupExtender is within a gridview? -

so using modalpopupextender control ajax control toolkit. it's understanding when want set targetcontrolid button that's within gridview, need put modalpopupextender within template holds button. in case: <asp:templatefield> <itemtemplate> <asp:linkbutton id="lbtndeletewidget" runat="server" text="delete" commandname="deletewidget" commandargument="<%# container.dataitemindex %>"></asp:linkbutton> </itemtemplate> <footerstyle horizontalalign="right" /> <footertemplate> <asp:button id="btnaddnewwidget" runat="server" cssclass="buttonstyle" text="add new widget" onclick="btnaddnewwidget_click"/> <ajaxtoolkit:modalpopupextender id="modalpopupextender1" runat="server" backgroundcssclass="modalbac

php - How can I get text only from the current node with DOMElement? -

<div> <a>abc</a> xyz </div> given above html structure, $divelement->nodevalue returns 'abc xyz', when want 'xyz' only. $divelement->getattribute('value') empty. how can 'xyz' without removing <a> element? just iterate through <div> , combine text node: http://3v4l.org/fntaf $dom=new domdocument; $dom->loadhtml(<<<html <div> <a>abc</a> xyz </div> html ); $div=$dom->getelementsbytagname("div")->item(0); var_dump($div->childnodes->length);//just debug $txt=""; foreach(range(0,$div->childnodes->length-1) $idx) { if($div->childnodes->item($idx)->nodetype==3) { $txt.=$div->childnodes->item($idx)->nodevalue; } } var_dump($txt); nodetype==3 means text node. corresponding nodename #text .

javascript - How to load home page after closing the app using jquery mobile,phonegap -

im working on jquery mobile,phonegap application.it contains home screen , navigate second page on click of button. the problem if close application on second page , open again, doesnt load home screen. i load home screen irrespective of wherever close application. thanks, srinivas if understood correctly mobile app put background , want show home page when brought front. in case can use phonegap event pause : document.addeventlistener("pause", yourcallbackfunction, false); function yourcallbackfunction() { } this function execute when mobile app background. when event occurs need change jqm page home page, this: $.mobile.changepage("#some-page"); basically code this: document.addeventlistener("pause", switchpage, false); function switchpage() { $.mobile.changepage("#home-page"); }

javascript - Uncaught TypeError: Cannot read property 'width' of null -

i'm trying out fabric.js, , right i'm trying put in image experiment with. i've followed the tutorial following error: uncaught typeerror: cannot read property 'width' of null ... refers line 14805 in all.js: _setwidthheight: function(options) { this.width = 'width' in options ? options.width : (this.getelement().width || 0); // <------ line this.height = 'height' in options ? options.height : (this.getelement().height || 0); }, my code (html): ... <div id="avatarbox"> <canvas id="canvas" width="500" height="500"/> <img src="img/test.png" id="my-image"> </div> ... my code (js): var canvas = new fabric.canvas('canvas'); var imgelement = document.getelementbyid('my-img'); var imginstance = new fabric.image(imgelement, { left: 100, top: 100, angle: 30, opacity: 0.8

c++ - initializing pre-allocated struct instances within a loop -

i want allocate memory number of instances of structure, using malloc(). then, want initialize each instance within loop. but, each iteration, observ constructor, , destructor after, called... why? more suprising me fact each of instance exists after loop despite of call of destructor... , instances initialized same values! i'm definitively missing important... grateful if can me because now, can't explain happen. here c++ code : struct mystruct{ int* a; int* b; mystruct(int x, int y) { std::cout << "the constructor called" << std::endl; = (int*)malloc(x*sizeof(int)); b = (int*)malloc(y*sizeof(float)); } ~mystruct() { std::cout << "the destructor called" << std::endl; delete[] a; delete[] b; } }; int main(int argc, char** argv){ int nb = 3; mystruct *s = (mystruct*)malloc(nb*sizeof(mystruct)); for(int i=0 ; i<nb ; i++) { *(s+i) = mystruct(1,2); } std::cout <&

garbage collection - Understanding git gc --auto -

Image
i'm experimenting aggressive auto gc in git, packing purposes. in repos if git config --list have setup ... gc.auto=250 gc.autopacklimit=30 ... if git count-objects -v get count: 376 size: 1251 in-pack: 2776 packs: 1 size-pack: 2697 prune-packable: 0 garbage: 0 but git gc --auto doesn't change these figures, nothing being packed! shouldn't loose objects packed since i'm 126 objects on gc.auto limit? one of main points of gc --auto should quick, other commands can call “just in case”. achieve that, object count guessed. git config says under gc.auto : when there approximately more many loose objects in repository […] looking @ code ( too_many_loose_objects() in buildin/gc.c ), here’s happens: the gc.auto divided 256 , rounded up the folder contains objects start 17 opened it checked if folder contains more objects result of step 1 this works fine, since sha-1 evenly distributed, “all objects start x” representative whole set.

android - How to make call directly without using calling intent? -

can make call directly without calling dial intent? i want use calling way create call manager. what different ways of making call? no, have use intent.action_call . that's way: intent dialintent = new intent(intent.action_call); dialintent.setdata(uri.parse("tel:000000")); startactivity(dialintent);

ios - Unable to hide keyboard on click search button in a UISearchBar -

i using uisearchbar search list, when click on search button on keyboard, keyboard not hide. please me fix issue. here code -(void)search:(uisearchbar*)searchbar text:(nsstring*)text { [copylistofitems removeallobjects]; if([text length] > 0) { // [ovcontroller.view removefromsuperview]; searching = yes; nsstring *searchtext = searchbar.text; for(imergencydata *objtrust in arytrustee) { nsrange titleresultsrange = [objtrust.strname rangeofstring:searchtext options:nscaseinsensitivesearch]; if (titleresultsrange.length > 0) [copylistofitems addobject:objtrust]; } nslog(@"number of object found %d",copylistofitems.count); } else { // [tbltrustee insertsubview:ovcontroller.view abovesubview:self.parentviewcontroller.view]; [searchbar resignfirstresponder]; searching = no; //tbltrustee.scrollenabled = no; } [tbltrustee reloaddata]; } -(void)searchbartextdidended

jquery - Avoid select options being automatically sorted by value -

i have select element fill jquery this: $.each(mydictionary, function (key, value) { $("#ddldepartments").append('<option value=' + key + '>' + value + '</option>'); alert(key+' '+value);//the sequence of records correct. }); alert(key+' '+value);automatically ordered values. the items added in correct order. confirm alerting added item value , inner html @ each record. then, after items added, select element gets automatically sorted values in ascending order. there way can avoid behavior?

c# - Create a static method that will parse any string to detect special characters and include \ before them -

in mvc-app want create method used everywhere avoid having special characters @, ", ' or else provoking major problem. so i'm trying build method using regex parses string detect if there's special characters in string , put \ in front of them make them harmless. public static string parsestringforspecialchars(string stringtoparse) { const string regexitem = "^[a-za-z0-9 ]*$"; string stringtoreturn = regex.replace(stringtoparse, regexitem, "\\"); return stringtoreturn; } there many problems in code: 1) not familiar regex , have troubles figuring out wanted do. here, think trying detect if there characters other thos in regexitem; 2) when code hits string stringtoreturn = line, app crashed says value cannot null. can me out? thanks! edit i have been asked show example of special characters, here are: '/', '.', '*', '+', '?', '|', '(', ')', '[',

c# - Getting duration from BackgroundAudioPlayer -

i using background audio player play audio file.i have tried duration of audio using background.instance.track.duration.totalseconds method.but when run app method returned "0" everytime.the duration retrieved if run code through breakpoints. below code. if (backgroundaudioplayer.instance.playerstate != playstate.playing) { progressbar1.visibility = system.windows.visibility.visible; totaltimedisplay.visibility = system.windows.visibility.visible; //this.totaltimedisplay.time = timespan.parse("00:00:00.0"); imgplay.source = new system.windows.media.imaging.bitmapimage(new uri("images/player_pause_new.png", urikind.relative)); audiotrack audiotrack = new audiotrack(new uri("a" + imgname + ".mp3", urikind.relative), "", "", "", null); backgroundaudioplayer.instance.track = audiotrack;

Spring File upload and persisting object -

i have form has 2 submit buttons. save button save object database , @ same time save upload file local directory. while send button generate email automatically recipient. what have far @requestmapping(value = "/staff/setter/addpage", method = requestmethod.post) public string processmodule(@requestparam("name") string name, @requestparam("file") multipartfile file, @modelattribute("module") module module, staff staff, httpservletrequest request, bindexception errors, httpsession session) { if( request.getparameter("save") != null ) { if(module != null){ try { multipartfile filea = module.getfiledata(); inputstream inputstream = null; outputstream outputstream = null; if (filea.getsize() > 0) { inputstream = filea.getinputstream(); outputstream = new fileoutputstream("c:

ruby - How to setup send HTML emails with mail gem? -

i sending emails using mail gem. here's code: require 'mail' require 'net/smtp' mail.defaults delivery_method :smtp, { :address => "smtp.arrakis.es", :port => 587, :domain => 'webmail.arrakis.com', :user_name => 'myname@domain.com', :password => 'pass', :authentication => 'plain', :enable_starttls_auto => true } end mail::contenttypefield.new("text/html") #this doesnt work msgstr= file.read('text2.txt') list.each |entity| begin mail.deliver 'myname@domain.com' "#{entity}" subject 'a subject' body msgstr end rescue => e end end end i don't know how

zope - User edits only its own post.Using Plone permisisons -

i have plone website , create menu item. in sharing tab add each user can post topic. how can prevent user1 edits posts owned user2? user1 can edit user2 posts. previously try creating group, assign each user group , add group using sharing tab, in way 1 user edit posts user. just subtract (uncheck) 'can edit'-permission of sharing-tab. creator of item default owner, owners have edit-permission, users can edit own items not ones of others. update (according new comment): to inhibit add-privilege on subfolders you'll need break inheritage of contributors-role, 'can add'-permission assigned to. however seems not possible, yet. quoting martin aspeli article "understanding permissions , roles": "currently (until plone 2.1, likely), local roles can added @ lower level in acqusition tree, not taken away". so need approach and, martijn suggested, you'll want go custom workflow - assumingly folderish - contenttype , type

c# - If a model implements INotifyPropertyChanged, how should ViewModel register/deregister for PropertyChanged event? -

i have model implements inotifypropertychanged , may updated background business thread. related viewmodel implements inotifypropertychanged . , view binds viewmodel. view may shown on multiple places, , goal of them updated when model changes. i know viewmodel should register propertychanged event of model. don't know when , best place registering , deregistering. specially deregistering, since i'm scared of having hundreds of vm event handlers on model vm/views not shown anymore. thanks in advance. is absolute necessity limit view not directly bind model? you can expose model property on vm , have view directly bind thereby not having vm subscribe inpc model something like: public class myviewmodel: inotifypropertychanged { ... private mymodel _model; public mymodel model { { return _model; } set { if (value == _model) return; value = _model; raisepropertychanged(() => model); } } ... } and in xaml (when myviewmode

How to Set a Title/Description for a Subscription Calendar (webcal:// ICS file) -

i have calendar app provide subscriptions linking client using "webcal://" protocol. it's working quite nicely. i'd know if there way title in receiving calendar application, such outlook, iphone, google, etc? currently, when loaded outlook displayed name of web script came. instance if script (using coldfusion) create_ics_file.cfm outlook shows "create_ics_file in internet calendars". on iphone shows in calendar full web address including url variables. example: mywebsite.com/create_ics_file.cfm?calid=4329-32 is way, in ics file or otherwise, set title on these subscriptions? using x-wr-calname - display name of calendar should trick see http://en.wikipedia.org/wiki/icalendar#calendar_extensions . see how change display name of icalendar in outlook?

java - Xerces and Websphere 7 ClassCastException -

i trying deploy webservice built on spring-ws + maven on websphere 7.0.0.21. class loading set parent_last , error: 00000019 messagedispat e org.springframework.web.servlet.frameworkservlet initservletbean context initialization failed org.springframework.beans.factory.beandefinitionstoreexception: unexpected exception parsing xml document servletcontext resource [/web-inf/spring-ws-servlet.xml]; nested exception java.lang.classcastexception: org.apache.xerces.jaxp.documentbuilderfactoryimpl incompatible javax.xml.parsers.documentbuilderfactory @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:412) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:334) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:302) @ org.springframework.beans.factory.support.abstractbeandefinitionreade

scala - Implicit conversion not working -

why following implicit method not applied? , how can achieve automatically convert instance of x instance of y while having implicit conversion[x,y] in scope. trait conversion[x, y] { def apply(x: x): y } implicit object str2intconversion extends conversion[string, int] { def apply(s: string): int = s.size } implicit def convert[x, y](x: x)(implicit c: conversion[x, y]): y = c(x) val s = "hello" val i1: int = convert(s) val i2: int = s // type mismatch; found: string required: int make conversion extend function1 , don't need helper method anymore: trait conversion[x, y] extends (x => y) { def apply(x: x): y } // unchanged implicit object str2intconversion extends conversion[string, int] { def apply(s: string): int = s.size } // removed convert // unchanged val s = "hello" val i1: int = convert(s) val i2: int = s

setting Access-Control-Allow-Origin using Rackspace Cloud Java API -

i using java api uploading files rackspace cloud. trying figure out how set header "access-control-allow-origin" on files uploading. found link talks setting header using python binding here: setting access-control-allow-origin (cors) in rackspace cloud files python api is there similar api java binding well? can't seem find it. thanks! i'm not of java guy, per this looks metadata needs set on containers, key of x-container-meta-access-control-allow-origin , , value of space separated list of allowed origins. thus need use whatever function used set container metadata jclouds api. it appears done on creation (based on adaptation of this code ): createcontaineroptions options = createcontaineroptions.builder .withmetadata(immutablemap.of("access-control-allow-origin", "*")); swift.getapi().createcontainer(constants.container, options); looking through docs, found following function in org.jclouds.openstack.s

wpf Get object type in xaml triggers -

i use triggers depend on local class types. common case general control styles, have class-dependent contentcontrols. scenario: 1) usercontrol implements listbox 'myusercontrol' 2) large listbox style, applies listbox control inside usercontrol. style has empty contentcontrol (that filled label / stackpanel) <contentcontrol name="specificlabel"></contentcontrol> 3) there contentcontrols defined each specific derived class <controltemplate x:key="listbox1template"> <label... </controltemplate> <controltemplate x:key="listbox2template"> <stackpanel... </controltemplate> 4) depending on derived class of mylistboxcontrol, template of contentcontrol chosen datatriggers: <datatrigger binding="{binding elementname=myusercontrol, path=datatype}" value="{x:type local:mylistbox1}"> <setter targetname="specificlabel" property="template" va

os.walk iteration not walking in Python -

i'm using os.walk() check directory redundant files , list them out. pseudo-code looks this: def checkpath(path): dirname, dirnames, filenames in os.walk(path) thing here... pathlist = ["path1", "path2"] each in pathlist: checkpath(each) so works fine first run through, expected, on next os.walk on second path skips right on through...there's nothing in dirname, dirnames, filenames. did print statements check things out, , it's entering function, not doing os.walk() part. before making os.walk() part function see if fix problem, in loop inline main body. when tried (just fun) cleaning dirname, dirnames, filenames variables del, on second path when cleanup came said variable dirname did not exist... so looks like, whether within function or not, successive iterations of os.walk() arent populating... ideas? thanks! to add working code example, this. doesn't matter it's doing, trying os.walk walk mult paths: impor

php - PDO object not in scope of a function -

ok, see similar questions mine, examples use php classes...mine not. maybe that's problem? shouldn't need classes because site exceedingly simple @ point in time. anyway, i'm trying use pdo connect mysql db. connect db fine in file called config.php , , include file in index.php require_once() . i can query db file called process.php , problem within function within file; seems dbo object out of scope within function. here relevant code snippets: index.php require_once('./lib/config.php'); config.php // tested , connects fine $pdo = new pdo('mysql:host=' . $hostname . ';dbname=' . $dbname, $username, $password, array( pdo::attr_persistent => true )); process.php <?php ... // can call $pdo fine in file outside of functions ... function authenticate($u, $p) { // can't call $pdo in here, error says $pdo non-object $que = $pdo->query('select user_id, user_pass users user_name = \'' . $u . &

c# - "Keyword not supported:'pdata source" -

what mean "keyword not supported:'pdata source".as struggling find out problem? initializecomponent(); connstring = "pdata source=.\\sqlexpress;attachdbfilename=c:\\users\andrew\\documents\\vinyl0.mdf;integrated security=true;connect timeout=30;user instance=true"; query = "select * record"; dadapter = new sqldataadapter(query, connstring); dtable = new datatable(); cbuilder = new sqlcommandbuilder(dadapter); cbuilder.quoteprefix = "["; cbuilder.quotesuffix = "]"; mydataview = dtable.defaultview; dadapter.fill(dtable); bindingsource bndsource = new bindingsource(); bndsource.datasource = dtable; this.datagridview1.datasource = bndsource; (int q = 0; q <= datagridview1.columncount - 1; q++) { your connection string incorrect. change pdata source data source or server , should fine. see

c# - Can I add HTML button triggers to update panel -

is possible add html input buttons asp.net triggers, have message box works gridview in update panel, but when go different page of gridview, message box displays buttons stops working, don't know how debug it, please help. this button, <input type="button" id="button2" value="cancel" cssclass="rightbutton" /> and can add to, <asp:asyncpostbacktrigger controlid="button2" eventname="click" /> or should not ? with runat server tag use html controls in c# script. i.e <input type="button" id="button2" value="cancel" cssclass="rightbutton" /> should be <input type="button" id="button2" value="cancel" cssclass="rightbutton" runat="server" /> and when double click on it(assuming vs ide), make new click event in c# snippet. besides practice use direct html tags when complex functions

css - Is there a more elegant way of implementing a background color on a link that by targetting the id? -

i want make wordpress menu items have 2 different background colors: 1 link , 1 :hover. i'm css beginner , found solution unfortunately it's not 1 because target menu id generated wordpress , if delete menu , create one, id gone , styling not work anymore. example: menu-item-1212 { background-color:#fff; } menu-item-1212 a:hover{ background-color:#000; } is there more elegant way solve no matter id first menu item have, retain background-color , hover one? i've searched online alternative , found :nth-child. did tried create this:(but didn't worked) #menu-secondary li a:nth-child(1) { background-color:#fff; } #menu secondari li a:hover:nth-child(1) { background-color:#000; } will appreciate suggestion, thanks. you targeting anchor nth child of li element. each li has 1 anchor probably. need target li nth child of menu, this: #menu-secondary li:nth-child(1) { background-color:#fff; } #menu secondari li:nth-child(1) a:hover { background-c

multithreading - client number in a java multithread server -

i use 2 classes in server myserver.java private executorservice executorservice = executors.newfixedthreadpool(10); public static void main(string[] args) throws ioexception { server = new myserver(); server.runserver(); } private void runserver() { int serverport = 8071; try { system.out.println("starting server"); serversocket = new serversocket(serverport); while(true) { system.out.println("waiting request"); try { socket s = serversocket.accept(); system.out.println("processing request"); executorservice.submit(new servicerequest(s)); } catch(ioexception ioe) { system.out.println("error accepting connection"); ioe.printstacktrace(); } } }catch(ioexception e) { system.out.println("error starting server on "+serverport); e.printstacktrace(); } } and servicerequest.java private socket socket; bufferedrea

php - How to display Cimy extra fields in front side user profile page in wordpress? -

i installed cimy user fields plugin add new custom fields in the user profile . i added 1 custom field gender user profile displays in admin panel user profile. how display on front side registered user profile page? have 1 idea.. please send me step step because new in wordpress . install , activate 'theme login' plugin. trick you.

attributes - Magento layered navigation colors -

i have bunch of shirts in category. lot of them have special colors night owl black , black / red. on , on. i wondering how have them show in layered navigation "black". how that? a basic approach have 2 color attributes: navigation color: black, red, blue, orange, green, etc vendor color: elective blue, fuzzy teal, mystery yellow, etc setup navigation color attribute filtering. vendor color displayed on product detail page or anywhere may appropriate. it's added item account in enrichment process tends work enough.

Filling dojo combobox with json data -

i have json object retrieved method contains user information. want set json object store of dojo combobox. please help. so if understand correctly, want use single object store of combobox (so give 1 option?). if you're trying use array of json objects json store, suggest looking @ enter link description here . as can see have store inside data attribute array of json objects. new memory({ data: [ ... ] }); then create combobox , important things store , searchattr properties. store property can connect store combobox , searchattr property can property of json object visible thing should displayed in combobox.

html - Something is broken with system comments with JSON and PHP -

i have encountered issue using databased json files , php. include script called messages.php, , operates using id ref. it: opens database connection, queries row , column of current article, decodes json data php_decode(), and writes results page. i think broken in json handling. json validated through 1 link posted on related question. here's code: <?php //prepare database query, searching messages $query = "select * articles id =".$_get['id']." limit 1"; echo "<script>alert($query);</script>"; //create connection $con = mysqli_connect('localhost','empty_user','tough_pass','roadsidediner_menu'); //provide query , handle $result = mysqli_query($con,$query); //aquire article row $row = mysqli_fetch_array($result); echo $row; //store json data $rough_json = $row['comments']; //decode json file $json = json_decode($rough_jason,true); //???? var_dump[$json]; //never get

java - Equivalent of DataOutputStream and DataInputStream in C -

i wrote code in java public class client { private static int _port; private static socket _socket; public static void main(string[] args) { try { _port = 8071; _socket = new socket("localhost", _port); random rand = new random(); int n = rand.nextint(50) + 1; dataoutputstream dos = new dataoutputstream(_socket.getoutputstream()); dos.writeint(n); dos.flush(); // show server response datainputstream din = new datainputstream(_socket.getinputstream()); int servernumber= din.readint(); system.out.println(servernumber); string serverrandomstring=din.readutf(); system.out.println(serverrandomstring); din.close(); dos.close(); } it's simple socket communication. server in java, want try writing client in c. there alternative dat

ruby on rails - Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (mysql2 is not part of the bundle. Add it to Gemfile.) (LoadError) -

i folllowing error when starting rails server using webrick on windows 7: c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/rubygems_integ ration.rb:214:in block in replace_gem': please install mysql2 adapter: gem install activerecord-mysql2-adapter` (mysql2 not part of bundle. add gemfile.) (loaderror) i have made sure database.yml had adapter mysql2, gemfile lists mysql2. below database.yml file , gem file development: adapter: mysql2 encoding: utf8 reconnect: false database: elearn3_development pool: 5 username: root password: password host: 127.0.0.1 port: 3306 test: adapter: mysql2 encoding: utf8 reconnect: false database: elearn3_test pool: 5 username: root password: passsword host: 127.0.0.1 port: 3306 production: adapter: mysql2 encoding: utf8 reconnect: false database: elearn3_production pool: 5

C - Getting a struct from a function by pointer - segmentation fault -

i'm new c, , i'm having great deal of trouble 1 function. have struct declared as: struct nivel { size_t filas; size_t columnas; int **mapa; }; it's 2d array, it's size info. now, have function reads text file , makes "nivel", it's defined as: void nuevo_nivel_desde_archivo(struct nivel * nuevo_nivel, char *nombre_archivo ){ nuevo_nivel->filas = 0; nuevo_nivel->columnas = 0; ... i'll post part, because it's problem resides. thought make function receives pointer structure , "fill it", have call function this: struct nivel *nuevo_nivel; nuevo_nivel_desde_archivo(nuevo_nivel,nombre_archivo); nombre_archivo holds name of text file. when try assign cero of fields of struct, segmentation fault error. pointers, should work, i'm afraid i'm missing here , making huge mistake. appreciated. edit: everyone! of stated, trying access memory wasn't allocated, null pointer. have problem, that'll pos

r - How to add layers with new data to a ggplot with a POSIX axis? -

i'm used if want add point ggplot , works fine: ggplot(mtcars, aes(x = disp, y = mpg)) + geom_point() + geom_point(x = 200, y = 20, size = 5, color = "blue") but, problems if there's posix dates involved: dat_1 <- data.frame(time = as.posixct(c("2010-01-01", "2010-02-01", "2010-03-01")), y_1 = c(-1, 0, 1)) the basic plot works, of course (my_plot <- ggplot(dat_1, aes(x = time, y = y_1)) + geom_point()) but adding layer my_plot + geom_point(x = as.posixct("2010-01-01"), y = 0, size = 5, color = "blue") returns error error in ops.posixt((x - from[1]), diff(from)) : '/' not defined "posixt" objects converting numeric solves issue: my_plot + geom_point(x = as.numeric(as.posixct("2010-01-01")), y = 0, size = 5, color = "blue") but not necessary if mapping in aes wrapper point_data <- data.frame(x = as

How can I avoid calling a stored procedure from a UDF in SQL Server -

before start, know can't call stored procedure udf , know there various "reasons" (none make sense me though, tbh sounds laziness on microsoft's part). i more interested in how can design system round flaw in sql server. this quick overview of system have: i have dynamic report generator users specify data items, operators (=, <, !=, etc.) , filter values. these used build "rules" 1 or more filters, e.g. might have rule has 2 filters "category < 12" , "location != 'york'"; there thousands , thousands of these "rules", of them have many, many filters; the output each of these rules statuory report has same "shape", i.e. same columns/ data types. these reports produce lists of tonnages , materials; i have scalar-valued function generates dynamic sql specified rule, returning varchar(max); i have stored procedure called run specific rule, calls udf generate dynamic sql, runs , returns result

javascript - How to get the onfocus event to fire for checkbox in firefox and chrome -

in ie using onfocusin event , works expected checkbox onfocusin works ie , not other browsers. onfocus doesn't work checkbox's either no matter browser in. there i'm missing here? sample below ( check box fires in ie) using asp.net 4.0 <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript"> function checkonfocus() { alert('got focus'); } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:textbox id="textbox1" runat="server" onfocus="checkonfocus(this);"></asp:textbox> <br /> <asp:checkbox id="checkbox1" runat="server" onfocusin="checkonfocus(this);" /> </div> </form> </body> </h

python - How do I handle dependencies between scenarios in Lettuce? -

i using lettuce define test cases. in many cases, it's easy write lettuce scenarios in such way can run either atomically or part of other scenarios in feature. however, find lettuce useful tool try , reason , implement more complex integration tests. in these cases, makes sense break tests scenarios, define dependency on previous scenario. way can run scenario without having explicitly define other scenarios need run. makes dependency clear in scenario definition. might this: scenario: long scenario given condition given condition ... scenario: dependent scenario given scenario "really long scenario" has been run given new condition stuff ... then like: @step('given scenario "([^"]*)" has been run') def check_scenario(step, sentence): scenario = get_scenario(sentence) # don't know how if not scenario.ran: scenario.run() how handle situation? there gotchas i'm missing approach?

wpf - Binding to a Dependency Property of UserControl -

i have wpf user control has dependencyproperty called ismultiselect. want show hide button in usercontrol xaml. <button visibility="{binding ismultiselect, converter=....}" /> this user control has viewmodel assigned datacontext. above syntax gives me binding error due property not existing in view model. how can fix error? you can target usercontrol in different ways in binding. one solution find setting relativesource this: <button visibility="{binding ismultiselect, relativesource={relativesource ancestortype={x:type usercontrol}}, converter=....}" />

global variable in bash function not global if called with & to background the command -

here example of i'm trying achieve. #!/bin/bash func2() { myarray=("e" "f") } func1() { myarray=("c" "d") in [1..10] func2 & done } myarray=("a" "b") func1 echo "${myarray[@]}" the echo @ end should e f but ends being c d because of & when call func2. if take out & runs expected. proof of concept more complicated script using make ssh calls several servers @ once. need multi-threading capability of &, since seems run in subshell, of variables local?!?!? i assume questions how affect parent shell variables subshell, although don't quite ask it. there no way directly, can manage communicating background processes. easiest way arrange them write data files after completion , interpreting that. if trust subprocesses, make them write bash code , eval in parent process. you might able detect when finish using trap on sigchld. another

html - Cannot change href attribute with jQuery -

i accessing links on webpage jquery, following code: $('a[href]').each(function() { $(this).attr('class', 'visited'); $(this).attr('href', '#'); }) the class on link changed, href not. there preventing me changing/altering href? edit: i updated code following: $('a[href]').each(function() { $(this).addclass('visited'); this.href = '#'; }) however, although works on websites, doesn't work on news.yahoo.com. reasons why so? for href, want use .prop() instead of .attr() . for classname, in cases want use .addclass() instead of overwriting entire class attribute.

parse.com - Changing data in another PFuser object -

in game, user can cause damage user, , take of gold. gold variable stored in other users pfuser object. how can 1 user change value gold stored in other users pfuser's object? you can not save or delete non-authenticated pfusers. way implement functionality set separate class public read/write user variables from parse documentation - security user objects the pfuser class secured default. data stored in pfuser can modified user. default, data can still read client. thus, pfuser objects authenticated , can modified, whereas others read-only. specifically, not able invoke of save or delete methods unless pfuser obtained using authenticated method, login or signup. ensures user can alter own data.