Posts

Showing posts from September, 2011

data visualization - Layer plots in R -

Image
i need layer scatterplot , alleffects plot . here example data: library("effects") x<-c(1,2,6,7,4,3,5) y<-c(5,6,3,6,9,4,4) a<-as.factor(c(1,1,1,2,2,2,2)) xyplot(y ~ x|a) lm.y<-lm(y~x*a) plot(alleffects(lm.y)) to clear, xyplot layered upon plot(allefects...) plot. appreciate advice. the package latticeextra provides several functions combine trellis objects: +.trellis , c.trellis , layer family. here need +.trellis : library("effects") library("latticeextra") x <- c(1,2,6,7,4,3,5) y <- c(5,6,3,6,9,4,4) <- as.factor(c(1,1,1,2,2,2,2)) pxy <- xyplot(y ~ x|a) lm.y <- lm(y~x*a) aef <- alleffects(lm.y) there problem plot method efflist objects (the result of alleffects ): prints trellis object gives no return. trick use plot method eff objects (the components of efflist object) defined return trellis object. effect of example can extracted aef[[1]] : peff <- plot(aef[[1]]) and final step +.

SetInterval is hogging up resources- alternatives the Node.js way -

below simple function reports time system resources 100 times second: var util = require('util'); function report(){ console.log(new date()); console.log(util.inspect(process.memoryusage())); } setinterval(report,10); sure, example isn't practical- more illustrative purposes it works- memory allocation goes up , , up . understanding, isn't memory leak- rather natural behavior of javascript. due function, or record of performed functions being added heap every time setinterval called. , long process alive. so here's question: is there better way achieve same output, more efficiently?

php - Paypal Automatic Payment - Incorrectly Formatted Item Amount -

i'm having bit of trouble trying figure automatic payment setting custom form. it works fine if use buy version, need setup automatic billing. whenever submit form, error: the link have used enter paypal system contains incorrectly formatted item amount. i've tried following fix it: added/removed "$" before amount added/removed ".00" amount used parameter "amount" , "a3" created button in paypal , added hidden input named hosted_button_id here code form , query string in backend: form <input type="text" name="a3" placeholder="price" value="9.99"><br>     <input name="cmd" type="hidden" value="_xclick-auto-billing" /> <input type="hidden" name="hosted_button_id" value="xxxxx">         <input name="no_note" type="hidden" value="1" />     <input nam

Silverlight App cannot access a resource namespace from the Domain Service Project -

hi have silverlight application has following project structure: solution |-------project1.app (this silverlight application project) | |-------project1.app.service.web (this domain service project) | |-------project1.app.web (this website project) project1.app.web has reference project1.app.services.web , project1.app has reference through ria wcf reference (silverlight project settings) project1.app.web the problem comes when trying access 1 of name spaces in resource files in project1.app.services.web resource designer.cs of project1.app.services.web looks this: namespace project1.app.resources.server { using system; /// <summary> /// strongly-typed resource class, looking localized strings, etc. /// </summary> // class auto-generated stronglytypedresourcebuilder // class via tool resgen or visual studio. // add or remove member, edit .resx file rerun resgen // /str option, or rebuild vs project. [global::system.cod

javascript - Handling checkboxlist inside Repeater control using asp.net -

after binding repeater contron, check box looks below, i have 2 doubts here.. 1 - if select checkbox of group 1, items under group 1 should selected. how can ? 2 - , have "select all" button when clicked should select items of groups. since checkbox inside repeater control, not sure how handle it. please help group 1 item 1 item 2 group 2 item 3 item 4 group 3 item 5 item 6 aspx : <ol> <asp:repeater id="rp_groups" runat="server" onitemdatabound="rp_groups_itemdatabound"> <itemtemplate> <ul> <asp:checkbox repeatcolumns="2" runat="server" id="chk_group" text='<%# eval("category_type") %>' value='<%# eval("service_type_category_id") %>' onclick="ongroupclick" /> <asp:checkboxl

php - Post an HTML Value to IFrame -

how use post function pass fields onto iframe? using target label doesn't seem work. supposed happen when submit fields, posts username , variable forum , logs me in. however, being redirected login page instead. might helpful know iframe in different file field. <form action="http://www.website.net/login.php" method="post" target="my_iframe"> <label for="username">username</label><input type="text" name="username" required> <label for="password">password</label><input type="password" name="password" required> <input type="submit" name="login" value="login" class="loginbtn"/><a href="http://www.website.net/register.php">register</a> </form> <iframe name="my_iframe" src="http://www.website.net/forums/ucp.php?mode=log

winapi - Where to place Winsock declarations in Win32 gui program? -

so have win32 project windows procedure , everything. want client able connect server, @ same time able process window messages. figured part out. asynchronous sockets client. question have is, put wsadata, server structure, , socket() declarations? in winmain function? windows procedure? in short, how integrate winsock implementation winapi gui? how combine two? tutorials ive found online deal either winsock or winapi, never seem mix two.

android: set background color for the entire screen dynamically, or how to set actionbar to overlay layout, but not overlap content -

my app uses theme.wallpaper family, means current wallpaper used app's background. may cause readability issues (depending on user's favorite wallpaper) want allow user choose image background. the way trying implement is: @override protected void onresume() { // wallpaper preferences check if user selected wallpaper , // display sharedpreferences wallpaperpref = getsharedpreferences(wallpaperactivity.wallpaper_preferences, mode_private); int selectedwallpaper = wallpaperpref.getint(wallpaperactivity.selected_wallpaper, 0); if (selectedwallpaper != 0) { findviewbyid(r.id.pager).setbackgroundresource(selectedwallpaper); getsupportactionbar().setbackgrounddrawable(getresources().getdrawable(selectedwallpaper)); } else { findviewbyid(r.id.pager).setbackgroundcolor(color.transparent); getsupportactionbar().setbackgrounddrawable(new colordrawable(color.transparent)); } super.onresume(); } the shared preference

jquery - Opening a link in a div with PHP -

i building site parses spanish dictionary. if word hola, receive definition, other words, suggestions, casa: http://verbum.xtrweb.com/verbumpost.php?word0=hola&word-1=casa i wish to: when click on suggestions (like casar in example posted above) print result in div hola. here code using: $words = array('word0','word-1'); function url_decode($string){ return urldecode(utf8_decode($string)); } $baseurl = 'http://lema.rae.es/drae/srv/search?val='; $cssreplace = <<<eot <style type="text/css"> // changed style </style> </head> eot; $resultindex = 0; foreach($words $word) { if(!isset($_request[$word])) continue; $contents = file_get_contents($baseurl . urldecode(utf8_decode($_request[$word]))); $contents = str_replace('</head>', $cssreplace, $contents); $contents = preg_replace('/(search?[\d\w]+)/'

ios - Sorting an NSDictionary, descending. How do I send options with the `compare:options:` selector? -

i attempting sort nsdictionary. from apple docs see can use keyssortedbyvalueusingselector : nsdictionary *dict = [nsdictionary dictionarywithobjectsandkeys: [nsnumber numberwithint:63], @"mathematics", [nsnumber numberwithint:72], @"english", [nsnumber numberwithint:55], @"history", [nsnumber numberwithint:49], @"geography", nil]; nsarray *sortedkeysarray = [dict keyssortedbyvalueusingselector:@selector(compare:)]; which gives: // sortedkeysarray contains: geography, history, mathematics, english but want: // sortedkeysarray contains: english, mathematics, history, geography i have read can use compare:options: , , nsstringcompareoptions change comparison compare in other direction. however don't understand how send compare:options: with option in selector. i want this: nsarray *sortedkeysarray = [dict keyssortedbyvalueusingselector:@selector(compare:options:nsorderdescending)]; how should

java - @type in JSON response -

i have generic class: @xmlseealso({/*my classes here*/}) @xmlrootelement public class response<t> implements serializable{ /*fields*/} when json response returns server, comes @type information in it. want remove response. appreciated. response looks following: {"response":{"@type":"mytype","email":"abc@abc.com","firstname":"a","id":"3","lastname":"b","password":"12345","username":"user"}} i hope not jackson or jersey bug. this shows because response class annotated @jsontypeinfo . if don't want can remove annotation, although bear in mind not have information type returning.

android: layout inflater -

in layout want add images on screen when user clicks on button. number of images depend on user i.e decided @ runtime. how can layout inflater used purpose such view changes dynamically user input. i think in case layout inflater not necessary can create imageviews dynamically in java , add main layout. linearlayout ll=(linearlayout)findviewbyid(r.id.yourll); while(count<yourusersimagesneeded) { imageview imageview = new imageview(activity); // set src , other attrs ll.addview(imageview); count++; }

Sort files on Date modified or created in asp.net using C# -

i need sort files based on date , time last created or modified , show latest added file in first. asp.net form uploading files on webserver , after uploading, default files organised on basis of name or should in alphabetic order. so, can 1 me sort , organise on basis of time uploaded. protected void getfiles() { system.text.stringbuilder sbld = new system.text.stringbuilder(); if (directory.exists(server.mappath("~/package_image/"))) { directoryinfo dirmail = new directoryinfo(server.mappath("~/package_image/")); fileinfo[] defaultfiles = dirmail.getfiles(); foreach (fileinfo filedir in defaultfiles) { if (filedir.extension.tolower() == ".jpg" || filedir.extension.tolower() == ".gif" || filedir.extension.tolower() == ".png" || filedir.extension.tolower() == ".jpeg" || filedir.extension.tolower() == ".bmp") { // need sorting on

objective c - something strange about TouchesMoved -

i want output coordinate of each touch. , here code: - (void)drawrect:(cgrect)rect { [[uicolor blackcolor] set]; (int = 0; i<_touches.count; i++){ cgpoint pos=[[_touches objectatindex:i] locationinview:self]; nsstring* str = [nsstring stringwithformat:@" %d:(%d,%d)",i+1,(int)pos.x, (int)pos.y]; [str drawatpoint:cgpointmake(0,16+16*i) withfont:font]; } } - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event{ nsarray* objects = [touches allobjects]; (int i=0;i<objects.count;i++){ [_touches addobject:[objects objectatindex:i]]; } [self setneedsdisplay]; } - (void)touchesmoved:(nsset *)touches withevent:(uievent *)event{ [self setneedsdisplay]; } it works. output like: 1:(20, 50) 2:(30, 69) ... thing is, every time dragging on screen, coordinate of latest touch changing while dragging. believe touchesmoved doesn't have effects _touches coordinate of each touch stored, latest coordinate

jquery - When a composite component containing JS code is rendered multiple times, JS works only on last component -

i have composite component using primefaces <p:selectonemenu> defined like: <p:selectonemenu id="inout" onchange="inoutchanged()"> .. </p:selectonemenu> i have javascript file included part of component defines inoutchanged() function like function inoutchanged() { var inout = $({cc.clientid}:inout); if(inout.val() == "inc") { slider.addclass("includedinrange"); } } this composite component works fine when there 1 on page. problem need have 4 of them on page. so, when change select of 1 composite component changing slider class of last component. believe because there in effect 4 inoutchanged() functions defined within page. is there way either scope function or name uniquely won't stomp on each other? your concrete problem caused because redeclared , reassigned same javascript variable slider in global scope. need move declaration of slider inside function. redeclaring same fun

Passing variables between GUI in Matlab -

i new matlab , haven't got long produce interlinking gui. lot easier work specific examples. have found generic examples not know sections matlab functions , need edited. possible demonstrate code how pass information edittext's bladedesign.fig , how accessed in bladedesign.fig? pushbutton4 submit button. edittext9 variable text box. function edit9_callback(hobject, eventdata, handles) % hobject handle edit9 (see gcbo) % eventdata reserved - defined in future version of matlab % handles structure handles , user data (see guidata) % hints: get(hobject,'string') returns contents of edit9 text % str2double(get(hobject,'string')) returns contents of edit9 double % --- executes during object creation, after setting properties. function edit9_createfcn(hobject, eventdata, handles) % hobject handle edit9 (see gcbo) % eventdata reserved - defined in future version of matlab % handles empty - handles not created until after createfcns cal

jdbc - Comparing Resultsets In java -

i looking ways compare 2 resultset s in java ( rs1 , rs2 ). things note/requirements the results sets 2 different databases( oracle & sql-server ).thus can't make sql query changes copare results fetched. any of resultset s can have more rows each other. any of resultset can have data not in other resultset example: rs1 rs2 column1 column2 column1 column2 column3 1 2 item1 c 1 b 4 item2 d 2 c 2 item3 e 5 d 1 item4 expected result ==> valid , because in rs1 & rs2 , column2 in rs2 > column2 in rs1 ==> b invalid, not there in rs1 ==> c valid , because in rs1 & rs2 , column2 c in rs2 > column2 c in rs1 ==> d invalid , because though there in rs1 , rs2 ,the column2 d in rs2 < column2 d in rs1 ==> e invalid because not there in rs2 lookin

sql server - Converting NULLs to 0 in SQL Pivot -

the following code generates pivot (shown below code) select * ( select glaccount , dc , amount accountingtxns acctno = '178523' ) tabledata pivot ( sum (amount) dc in ([d],[c]) ) sumamountdc glaccount d c interestdue 3801.37 3731.68 cash 25600 25000 intreceivable 3801.37 3801.37 intincome null 3684.47 intoverdue null 116.9 principal 25000 21868.32 how rid of nulls (i.e. convert them 0's)? use coalesce , select glaccount, coalesce(d, 0) d, coalesce(c, 0) c ( select glaccount, dc , amount accountingtxns acctno = '178523' ) tabledata pivot ( sum(amount) dc in ([d],[c]) ) sumamountdc tsql coalesce()

java - Please provide example for an If statement in hibernate criteria -

how write criteria on if condition using hibernate criteria. my query needs transformed select date, product, if(type = 'msrp', amount, 0) price, if(type != 'msrp', amount, 0) tax productdetail group date, product; please provide right usage of if statement in hibernate criteria. as @jbnizet said, this not supported criteria api. unless using nhibernate if using nhibernate projections.conditional( restrictions.eqproperty(.............. but here possible solutions hibernate. 1)you can use same query using nativesqlquery in such type of situations 2)or using hql.there expression in hql called case when .this might helpful using case statement in hql select

asp.net - change LinkButton style attribute from javascript -

i want change style attribute of linkbutton through javascript javascript, tried working dropdownlist not linkbutton . here code </asp:listitem> <asp:listitem text="vikas" value="0"> </asp:listitem> </asp:dropdownlist> <asp:linkbutton id="lnkbtnsave" style="display: none" text="save" runat="server"></asp:linkbutton> <asp:linkbutton id="lnkbtncancel" style="display: none" text="cancel" runat="server"></asp:linkbutton> <asp:textbox id="lnkbtntest" style="display: none" text="hope" runat="server"></asp:textbox> <asp:linkbutton id="lnkbtnchangehr" text="change hiring manager:" runat="server" onclientclick="javascript:retur

php - How to convert HTML code of Unicode to Real Unicode Character -

is there php function can convert &#1575;&#1576;&#1576; to equallent unicode character ت ب ا i have googled lot, think there no php built in function available purpose. actually, want store user submitted comments (that in unicode characters) mysql database. stored in format &#1575;&#1576;&#1576; in mysql database. using set names 'utf8' in mysql query. output in real unicode characters fine, insertion in mysql in format &#1575;&#1576;&#1576; don't want. solution?? i googled , found interesing solution here i have tried , think working <?php $trans_tbl = get_html_translation_table(html_entities); foreach($trans_tbl $k => $v) { $ttr[$v] = utf8_encode($k); } $text = '&#1575;&#1576;&#1576'; $text = strtr($text, $ttr); echo $text; ?> for mysql solution can set character set $mysqli = new mysqli($host, $user, $pass, $db); if (!$mysqli->set_char

Sorting output obtain by grep for timestamp -

my file this. [2013] [ a] info : [handlemessage] handling messages ... [2013] [ b] info : [handlemessage] message received is: [os os-evntsvr0-h 20130404125956465000rfst m430 f ] [2013] [ c] info : [handlemessage] complete handling message. [2013] [ a] info : [handlemessage] handling messages ... [2013] [ b] info : [handlemessage] message received is: [os os-evntsvr0-h 20130404135956465000rfst m430 f ] [2013] [ c] info : [handlemessage] complete handling message. i want capture message received. (which did) after capturing message have sort time stamp value in third column. contain characters in end. ( eg : above file 20130404125956465000rfst , 20130404135956465000rfst ) i got lot of messages , use command. gzgrep 'the message received is:' receiver.log.2013-04-04*.gz | cut -d"[" -f5 | sort -t -n -k3 but sorting numeric won't work due suffix characters. can me on so

jquery - image not sliding in ruby on rails -

i using jquery cycle lite plugin making image slide in rails app. not working. can tell me problem in code? <html> <head> <title>healthcare</title> <%= stylesheet_link_tag "ehrms", :media => "all" %> <script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'></script> <script type='text/javascript' src='script.js'> $('#mar').cycle({ delay: 2000, speed: 500, before: onbefore }); </script> </head> </html> #mar division images slide. the javascript code running page loads, page may not ready run scripts yet (the dom may not have been initialized, #mar element may not exist yet). typically want wrap such code in jquery ready() function, so: <script type='text/javascript' src='script.js'></script> <script type='text/javascript'> $(document).ready(function(){

ALGORITHM to simulate any Deterministic Pushdown Automata (DPDA) -

how write program can model deterministic pushdown automata (dpda) user should enter number of states, transition functions, input symbols program should model pda requested , test acceptance or rejection of random strings entered user this have done far in c++ -i have collected number of states, input symbols, , input symbols -i on transition function cant seem go further because cannot conceptualize modelling dpda

javascript - How to vertically align the elements in two divs? -

Image
<div id="div1"> <label class="someclass1">price 1</label> <label class="someclass1">price 2</label> <label class="someclass1">price 3</label> <label class="someclass1">price 4</label> </div> <div id="div2"> <input type="text" class="someclass2"/> <input type="text" class="someclass2"/> <input type="text" class="someclass2"/> <input type="text" class="someclass2"/> </div> i have 2 divs. 1 div contains <label> elements , div contains <input> elements. 2 divs aligned horizontally. need align labels , input elements vertically each label has it's input underneath. i may achieve above requirement putting <label> , <input> elements placing them in <table> rows/columns. require

Writing output from console in java to text file -

i'd show console's output in text file. public static void main(string [ ] args){ datafilter df = new datafilter(); df.displaycategorizedlist(); printstream out; try { out = new printstream(new fileoutputstream("c:\\test1.txt", true)); system.setout(out); } catch (filenotfoundexception e) { // todo auto-generated catch block e.printstacktrace(); } } i result correctly on screen not result in textfile ? test file genereted empty?? you should print "console" after have set system output stream file. datafilter df = new datafilter(); printstream out; try { out = new printstream(new fileoutputstream("c:\\test1.txt", true)); system.setout(out); df.displaycategorizedlist(); } catch (filenotfoundexception e) { // todo auto-generated catch block e.printstacktrace(); } { if (out != null) out.close(

objective c - What method is called after tap back button in ios -

i have 2 view controllers navigation controller. when use [self.navigationcontroller popviewcontrolleranimated:yes]; in second 1 - first 1 opens methods in viewdidload don't called. methods called in first 1 controller in situation? the navigation controller sends viewwillappear: view controller before putting view on screen, , viewdidappear: after. inside viewwillappear: , viewdidappear: , view controller can check self.ismovingtoparentviewcontroller . if ismovingtoparentviewcontroller yes , view controller being added navigation controller in first place (presumably because it's navigation controller's root view controller, or because being pushed). if ismovingtoparentviewcontroller no , view controller in navigation controller's stack, , view controller being popped reveal it. read “responding display-related notifications” in view controller programming guide ios .

image - How to find bunch of closest strings? -

i have string , pattern. how can use strfind in matlab , find bunch of closest strings? in other words, strfind finds exact match while interested find bunch of closest strings (e.g. 10 closest strings) you can make use of this function strdist file exchange, computes levenshtein distance between 2 strings. here's convenient wrapper function. give single string str , array of strings strarray (and optionally number of strings return n ) , gives cell array containing closest n strings: function result = strfuzzy(str,strarray,n) #strfuzzy # # inputs # str string # strarray cell array of strings # n integer, 1 <= n <= length(strarray) # # outputs # result cell array of length n containing closest matches str # if nargin < 2, error('requires @ least 2 arguments'), end if nargin < 3, n = length(strarray); end = cellfun( @(x) strdist(str,x), strarray ); [tmp,idx] = sort(a); result = strarray

Less verbose enum usage in java annotations -

this question has answer here: how can reference java enum without specifying type 3 answers i want use custom annotation in java project. curretnly i'm having this: @parallel(synchronicity=sync.sync, concurrency=conc.mutex) sync , conc both enums. this little verbose. not synchronicity long word, have specify enum name. prefer write in 1 of following ways: @parallel(synchronicity=sync, concurrency=mutex) @parallel(sync.sync, conc.mutex) but both don't seem possible. have idea on how make usage of enums in annotation less verbose? add import static com.foo.bar.sync.*; import static com.foo.bar.conc.*; to imports, able use @parallel(synchronicity=sync, concurrency=mutex)

asp.net - how to bind dataset with gridview -

this code .aspx.cs page public string makequery() { string query = string.empty; if (ddlportal2.selectedvalue == "select" && tbfrom.text == null && tbto.text == null && ddlquery.selectedvalue == "select") { query = "select * form3 , order convert(varchar(25), [datetime], 101) between '" + tbfrom.text + "' , '" + tbto.text + "' desc"; return query; } else if(ddlportal2.selecteditem.text!="select" && tbfrom.text!=null && tbto.text!=null && ddlquery.selecteditem.text=="select") { query = "select * form3 portal='" + ddlportal2.selectedvalue + "' , order convert(varchar(25), [datetime], 101) between '" + tbfrom.text + "' , '" + tbto.text + "' desc"; return query; } else if (ddlportal2.selecteditem.text != "select" &am

Flex-Air mobile TextInput cursor starts in the middle of a TextField on iOS -

i developing air application mobile devices. during registration process have textinput fields. on devices everthing works fine on ios cursor , input text placed somewhere in middle of textinput - think @ point user clicks field... can avoid behaviour? thanks, christian seems textinputskin makes problem... s|textinput { skinclass: classreference("spark.skins.mobile.textinputskin"); contentbackgroundcolor: #807f7f; color: #ffffff; fontsize: 32; fontfamily: ggstandardfont; fontweight: normal; } i've experienced similar issue seemed stem using custom font textinput. setting font family websafe font (ie arial) when editing textinput helped. reset font afterwards. eg. (in flex) softkeyboardactivating="setstyle('fontfamily', 'arial')" softkeyboarddeactivating="setstyle('fontfamily', 'mycustomfont')"

java - How to enforce Basic Authentication when fetching WSDL (Server side) -

i'm looking way force client side use http basic authentication when attempts retrieve wsdl file. using jax-ws created following web service, use glassfish 3: @webservice(servicename = "hello") @stateless public class helloservice { @webmethod(operationname = "sayhello") @rolesallowed("myrole") public string sayhello(@webparam(name = "name") @xmlelement(required=true) string name){ return "hello "+name; } } after googling around, seems adding security constraint web.xml descriptor should take care of this, did <session-config> <session-timeout> 30 </session-timeout> </session-config> <security-constraint> <display-name>hellosc</display-name> <web-resource-collection> <web-resource-name>hellorc</web-resource-name> <url-pattern>/*</url-pattern> <http-method>get</http-me

java - Unexpected regular expression behavior using Positive Lookbehind -

i writing regular expression match sequence of digits, followed dot , sequence of digits, , in total length, including dot, entire sequence should 13. purpose, regular expression wrote was: (\d{6,12})\.(\d{0,6})(?<=.{13}) when run expression against 2 following samples of data, expecting second 1 match, instead, both mathed. can me understand why? 1234567.123456 > matched expecting not matched; 1234567.12345 > matched. here java code used test this: import java.util.regex.pattern; public class app { public static void main(string[] args) { pattern matcher = pattern.compile("(\\d{6,12})\\.(\\d{0,6})(?<=.{13})"); system.out.println(matcher.matcher("1234567.123456").matches()); system.out.println(matcher.matcher("1234567.12345").matches()); } } output: true true you need anchor lookbehind assertion start of string, or match substring: pattern matcher = pattern.compile("(\\d{6

html - Why is this DIV padded at the top? -

here test-case problem: http://game-point.net/misc/testparapadding/ i want progressbargreen.png image inside div, , div right height (15px) hold it, there couple of pixels padding @ top of div. why? browser seems sizing content if contained text because padding changes if remove font-family styling body, there no text in div. interestingly problem doesn't happen in firefox's quirks mode. jsfiddle example you need line-height:15px on div holding image edit: explanation behaviour line-height affecting no-text blocks

php - jQuery, ajax multiple checkboxes into $_POST array -

i'm trying send $_post data page add sessions simple shopping cart. i have multiple forms within php while loop each multiple checkboxes, works apart checkboxes. my question how change piece of code change "item_extras" array? if(this.checked) item_extras = $(this).val(); i have tried following but, creates 1 line values instead of row within array. if confusing create sample if helps. if(this.checked) item_extras += $(this).val(); $('form[id^="add_item_form"]').on('submit', function(){ //alert("on click works"); event.preventdefault(); additem($(this)); }); function additem(ele) { //alert("i'm in additem function"); var item_id = ele.parent().parent().find("input[name=item_id]").val(); // item id var item_name = ele.parent().parent().find("input[name=item_name]").val(); // item name var item_options = ele.parent().parent().find('#options').va

c# - execute code just when install the application using installshield -

i wondering if possible run small code once when application installing. i create registry installation path. reason why need because have windows service in application well, install path changes system32. i have ini file created in installation folder @ installation. need reach file service , windows form well. you don't need code, create registry key in hklm\software\yoursoftware-here key name installpath , value of [installdir] in install, reference key in service. this assumes using basic msi project in install shield.

google app engine - How to fan out URL Fetch requests in a timely fashion? -

every minute or app creates data , needs send out more 1000 remote servers via url fetch callbacks. callback url each server stored on separate entities. time lag between creating data , sending remote servers should less 5 seconds. my initial thought use pipeline api fan out url fetch requests different task queues. unfortunately task queues not guaranteed executed in timely fashion. therefore requesting task queue start executing take minutes hours. previous experience gap regularly on minute not appropriate. is there way within app engine achieve want? maybe know of outside service can fan out in timely fashion? well, there's no solution gae here. keep backend running; hammering datastore/memcache every second new data send out, , spawn dozens of async url-fetches. thats inefficient... if want 3rd party service, pubnub.com capable of doing fan-out, don't know if fit in setup.

How to insert column in powerpoint using VBA -

the questions bit tricky one, have googled , got link http://joelblogs.co.uk/2010/08/13/automatically-create-summary-slides-in-powerpoint-2010/ vba code helps me insert summary of titles of other slides of 1 presentation in single parent slide. code working fine, when number of slides titles more 30 or 50 table of content parent slide cannot hold entire title names names hidden , go beyond slide presentation. hence, confirm there vba code distribute contents of summary names in 3 columns through vba in table of contents slide ? based on link have example need add code @ , of macro: with summary.shapes(2).textframe2 .column.number = 3 end which set 3 columns in summary text frame. remember, need set font size, too, keep text within text box. additional information: see font size changes (decrease) long put more text summary shape ( shapes(2) in example). trace font size check if should increase number of columns. here example: with summary.shapes(2).textfram

lungojs - lungo framework does not work with example code -

i testing lungo framework, , reading examples ( http://lungo.tapquo.com/howto/prototype ), not work. i using skeleton code: <body class="app"> <section id="main" data-transition=""> <article id="main-article" class="active"> test. </article> </section> <script src="components/quojs/quo.js"></script> <script src="components/lungo/lungo.js"></script> <script type='text/javascript'> lungo.init({ name: 'example' }); </script> </body> i have no errors in console. can causing issue? in advance. if that's of html, you're missing whole bunch of css files, etc. share js fiddle or longer code example? way you're not getting js errors implies me may missing css. also, version of lungo using? how did obtain it? lots of questions :) however, created basic lungo jsfiddle whil

excel vba - Need to bold cells where the formula result is greater than or equal to 10 via VBA -

i need apply bold cells within range formula result 10 or more. i've tried following code seems apply bold randomly! sub boldhighhours() application.screenupdating = false dim c object each c in range("i7:am1005") if c.value >= 10 c.offset(0, 1).font.bold = true c.offset(0, 2).font.bold = true else c.offset(0, 1).font.bold = false c.offset(0, 2).font.bold = false end if next application.screenupdating = true end sub if you've been following previous questions/saga you'll understand why can't use conditional formatting! autofilter doth not kindly upon large amounts of conditional formatting , punishes ye slowdown greatly! you need remove offset() : sub boldhighhours() application.screenupdating = false dim c range each c in range("i7:am1005") if c.value >= 10 c.font.bold = true else c.font.bold = false end if next

c++ - How to pass lambda to overridden method with boost::function parameter? -

i've got class constructors defined this: lambdajsonvisitor(); lambdajsonvisitor(boost::function<void (const value &)> f); lambdajsonvisitor(boost::function<void (const object &)> f); lambdajsonvisitor(boost::function<void (const keyvaluepair &)> f); lambdajsonvisitor(boost::function<void (const array &)> f); and i'm trying construct object this: lambdajsonvisitor setnodeidvisitor([&](const jsonapi::value &val) -> void { ... }); when try compile it, i'm getting following compiler error: 4>netmodel\cnetworkalarmbuilder.cpp(60): error c2668: 'jsonapi::lambdajsonvisitor::lambdajsonvisitor' : ambiguous call overloaded function 4> c:\workspace\client\projects\jsonparser\api/lambdajsonvisitor.h(21): 'jsonapi::lambdajsonvisitor::lambdajsonvisitor(boost::function<signature>)' 4> 4> [ 4> signature=void (const jsonapi::array &) 4>

css - Get dynamic background position using jQuery -

i'm trying implement parallax scrolling effect on site (using this tutorial smashing magazine). parallax effect working fine, need 1 of sprites stop scrolling when reaches point. default, continues scrolling until out of view. the parallax effect works animating background position of element. trying dynamic background position using code: jquery(function($) { var elem = $("#heart-box"); var backgroundpos = $(elem).css("backgroundposition").split(" "); var xpos = backgroundpos[0], ypos = backgroundpos[1]; $(window).scroll(function() { console.log(ypos); if ( ypos >= 210 ) { $(elem).hide(); } }); }); instead, starting position being returned, defined in css, , isn't changed in console log when page scrolled. when page scrolled, background y position dynamically changed - range

web services - How to retrieve the size of a file in a document library in sharepoint through webservices using Java -

i'm writting application in java has report available files in document library on sharepoint 2007. application uses java sharepoint library korecky ( project home ). works fine except fact, beside of several file information don't file size. concretely, request send list.asmx webservice calling getlistitems method. the request looks follows: <queryoptions> <viewattributes includerootfolder="true" scope="recursiveall"/> <includemandatorycolumns> true </includemandatorycolumns> <dateinutc> true </dateinutc> </queryoptions> according several forums in response webservice there should field available named ows_file_x0020_size should contain int representing file size, missing. have idea how request needs modified receive file size? you need field want call (in viewfields). final request should : <soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschem

ICAP "File decompression/decode" error when downloading XML R package -

i'm trying download xml package r. being windows user, , following http://www.omegahat.org/rsxml , tried in-line installation : install.packages("xml", repos = "http://www.omegahat.org/r") and got : package ‘xml’ available source package not binary you can indeed browse http://www.omegahat.org/r see bin/windows/contrib/2.15/ not contain xml file, contrary bin/windows/contrib/2.14/ (binary files, older version of r) or src/contrib/ (source files). now, if want download binary or source file browser (to install afterwards in r) have following error, both on http://www.omegahat.org/r , http://cran.r-project.org/web/packages/xml/index.html : icap error (icap_error) error occurred while performing icap operation: file decompression/decode error; file: <name of file downloaded>; sub file: <some files>/exampledata/dtd.zip; vendor: sophos, plc.; engine error code: 0xa004021a; engine version:

python - Flask error handler -

i created simple multi-application flask site. moved errors view (404, 501, etc.) application errors . when error occures see default error pages of flask, not own. structure of project is: /site |-> main.py flask import flask app = flask(__name__) app.config.from_pyfile('config.py') import errors, account, mysite, blog errors.views import not_found @app.route("/") def index_view(): return "welcome!" @app.route("/about") def about_view(): return "about" if __name__ == "__main__": app.run(debug=true) |-> templates |-> errors |-> 404.html |->errors |-> __init__.py main import app import errors.views |-> views errors import app flask import render_template @app.errorhandler(404) def not_found(error): return render_template('errors/404.html'), 404 if returning conte

JQuery EasyUI Treegrid cannot display json object data correctly using formatter -

i have jsondata follows: "rows":[ {"code":"001","name":"name 1","addr":"address 11","col4":{"data":"col4 data","value":"col4 value"}}, {"code":"002","name":"name 2","addr":"address 13","col4":{"data":"col4 data","value":"col4 value"}}, {"code":"003","name":"name 3","addr":"address 87","col4":{"data":"col4 data","value":"col4 value"}}, {"code":"004","name":"name 4","addr":"address 63","col4":{"data":"col4 data","value":"col4 value"}}, {"c

SQL retrieves duplicate even if distinct specified -

im trying retrieve distinct competence_id rows table has duplicate ones based on: select distinct competences.competence_id, skillmgt.* competences join skillmgt on competences.competence_id=skillmgt.cid skillmgt.eid=121 , datename(yyyy,skillmgt.timestamp)='2013' but gets competence_id s duplicates. you need group by. select competences.competence_id, skillmgt.* competences join skillmgt on competences.competence_id=skillmgt.cid group competences.competence_id

Visual Studio setup for C++: .NET Framework warning -

i have native c++ application developed in visual studio 2010. there's setup project part of solution. when setup being build, warning pops up: warning: target version of .net framework in project not match .net framework launch condition version '.net framework 4 client profile'. update version of .net framework launch condition match target version of the.net framework in advanced compile options dialog box (vb) or application page (c#, f#). in (c++ app) properties, there's field in common properties says: targeted framework: .netframework, version=v4.0 which can't edited. now questions is: why need .netframework c++ application @ all??? you can add (using text editor) <targetframeworkversion>v2.0</targetframeworkversion> <propertygroup label="globals"> section in of solution's .vcxproj files, reload modified projects. change causes vs stop adding bogus launch condition.

mysql - How to show sphinx search result with php? -

i installed sphinx search on localhost (wamp). want show results example in 1 simple html table. tried connect php sphinx search, think done it, when printed result 0.... not true. not understand in query part need put word want search? tried search in command windows, working, not know how show on web page. , want use mysql. php looks this: require ( "sphinx/api/sphinxapi.php" ); $s = new sphinxclient; $s->setserver("localhost", 9306); $s->setmatchmode(sph_match_any); $s->setmaxquerytime(3); $result = $s->query("test"); var_dump($result); here mini conf file: source src1 { type = mysql sql_host = localhost sql_user = root sql_pass = sql_db = test sql_port = 3306 # optional, default 3306 sql_query = \ select id, group_id, unix_timestamp(date_added) date_added, title, content \ documents sql_attr_uint = group_id sql_at

image processing - How can i work with Android EffectFactory Class? -

i tired develop sample application image processing, in app need add color effects (grayscale, sepia) on bitmap referred developer documents doc 1 , doc 2 , in document there no practical examples, need know whether can add vintage,sepia color effects using class, 1 guide me please, in advance. update: i tried this, private effectcontext meffectcontext; bitmap b1 = bitmapfactory.decoderesource(getresources(), r.drawable.sample); effectfactory effectfactory = meffectcontext.getfactory(); effect meffect = effectfactory .createeffect(effectfactory.effect_sepia); now how can set meffect bitmap? try: effect meffect= effectfactory.createeffect(effectfactory.effect_sepia); then use glsurfaceview show rendered effects, here example of need

Tuning MySQL buffer sizes - Mac Mini 2012 with 16GB -

i'm configuring mysql buffer sizes. find it's slow. i'm running mysql on i5 mac mini 16gbram os x mountain lion. database size 10gb. copy of my.cnf file , hoped offer suggestions getting better performance. [client] socket = /var/mysql/mysql.sock [mysqld] socket = /var/mysql/mysql.sock key_buffer_size = 2536m read_buffer_size = 16m performance_schema = on query_cache_size = 128m query_cache_type=1 query_cache_limit=16m bulk_insert_buffer_size = 1000m the variables you're tuning myisam related. innodb have at: what-to-tune-in-mysql-server-after-installation , innodb-performance-optimization-basics , choosing-innodb_buffer_pool_size

iphone - Passing IOS native objects back to unity3d -

i implemented ios plugin couple of simple methods interract unity application native static library. the problem, faced, passing native ui elements(objects) unity. f.e native sdk has method creates badge (uiview), on other hand have button in unity (it gui element or 3d object, whatever) i access method unity through plugin, smth like: [dllimport("__internal")] private static extern void xcodeplugin_getbadgeview(); and following: void xcodeplugin_getbadgeview() { // generate native uiview uiview *badge = [badge badge]; ???? return uiview badge instance unity (hm)?! } so need like: [somevieworobject addsubview:badge]; but inside unity. i know there ability send message unity: unitysendmessage( "unitycsharpclassname" , "unitymethod", "whatevervaluetosendtounity"); but whatevervaluetosendtounity should utf8 string. in conclusion: only 1 idea have pass coordinates unity native plugin, , add badge

string - Compare team names of different bookmakers -

i trying make small sport betting odds comparison script personal use. getting data of xml feeds (from different bookmakers). comparing them have know matches/events same. problem name of teams, leagues different @ different bookmakers. here example: bookmaker1: b1 league: uefa champions league match: manchester united vs inter milan bookmaker2: b2 league: champions l. match: manu vs inter bookmaker3: b3 league: champions league(uefa) match: manchester u. vs fc internazionale the date same. there lot of matches starting @ same time. there 1000's of matches , 100's of leagues. is there possibility recognize same, manually? with manually mean: if string manu or manchester u. => manchester united (and every teamname) how odds comparison sites (like oddsportal.com or other services)? i'm afraid there no magical solution. don't see pattern can base on. the best way identify name used each bookmaker , comparison accordi

Dynamically added attribute doesn't work in angularjs -

i have simple form 2 input boxes of number type. when try add max attribute via directive, seems ignore , doesn't validates although attribute added on dom element. when add inline works .i referred question angularjs can't read dynamically set attributes did'nt seemed me.new in angularjs , clueless. any appreciated. edit: updated fiddle demo http://jsfiddle.net/tnunh/6/ didn't furthuer, 1 solution have recompile element everytime change max value. just change inject $compile ( module.directive('type', ['$compile', function ($compile) { ) , after attr.$set('max', '100') call $compile(element)(scope) . this doesn't seem right, i'd need further input directive code see if exposes way change without recompiling.

entity framework - Using MiniProfiler in ASP.NET MVC 4 with EF5 -

Image
i tried ef tracing provider check sql statements generated, want use miniprofiler, i'm not able see results... what made far: intalled packages: uncomment initialization in miniprofiler.cs public static void prestart() { //... //todo: if profiling ef code first try: miniprofileref.initialize(); //... } added render in layout view (before closing body tag): @miniprofiler.renderincludes() but nothing showing in browser relative miniprofiler... i'm using database-first approach. am missing something? the following code should added in web.config: <system.webserver> <validation validateintegratedmodeconfiguration="false" /> <handlers> //... <add name="miniprofiler" path="mini-profiler-resources/*" verb="*" type="system.web.routing.urlroutingmodule" resourcetype="unspecified" precondition="integratedmode" /> </han