Posts

Showing posts from May, 2010

java - how to open frame2 from another frame1 by clicking button on frame1 in net beans -

i have created 2 frames in project in net beans named library.java , newcustomer.java , have button in library den code go newcustomer clicking button("new customer") in library?? inside library.java create method lets `public void addactionlistnenerstocomponents();` which call in library constructor (just suggestion.. depend on implementation). inside can have action listeners. scenario can like jbutton newcustomerbutton = new jbutton("add customer"); newcustomerbutton.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { newcustomer newcustomerframe = new newcustomer(); newcustomerframe.setvisible(true); } });

How to remove the current date from date box in jquery mobile? -

how remove current date date box .actually when open date box high light current date.but user select date example "14". if user again open date box hightlight "14"and current date. here fiddle http://jsfiddle.net/ravi1989/uhdyv/1/ <input name="mydate" id="mydate" type="date" data-role="datebox" class="documentdate_h" data-options='{"mode": "calbox","usenewstyle":true,"zindex":1200}' /> first click (+) button on header .it show pop .open date box .it show today date select date .then again open date box.it show selected date , today's date.? second issue how change colour of monday , tuesday ...? changing color of current date default theme "a" can use this: <input name="mydate" id="mydate" type="date" data-role="datebox" data-options='{"mode": "calbox"...

css - How to put <li> content in the middle with before: and after: images? -

Image
i'm trying make navigation using <ul> , have 2 images (36px height) right , left borders of button (list item). i add them before: , after: in css, after that, link inside <li> (for example: "main") appears in bottom because of 2 images added (before: , after:). i want text in middle of 2 images normal button. the green want, red get. thanks trying help, somehow managed it. css: #topmenu ul{ list-style: none; padding: 0; } #topmenu ul li{ float: left; margin-right: 5px; background-image: url('images/btnback.png'); background-repeat: repeat-x; height: 36px; border-radius: 8px; } #topmenu ul li:before{ content: url('images/btnleft.png'); float: left; } #topmenu ul li:after{ content: url('images/btnright.png'); } and html: <div id="topmenu"> <ul> <li> <a href="#">main</a> </li> <li> <a href="#">about</a> </li> <li...

What does the jquery statement "var collection = jQuery([1]);" mean? -

on page 109 of book "learning javascript design patterns" , there code sample confused me. jquery.single = (function( o ){ var collection = jquery([1]); // <-- want ask line return function( element) { // give collection element collection[0] = element; // return collection return collection; } })(); the use of function this: $('div').on('click', function() { var html = jquery.single( ).next().html(); console.log( html ); }); update: answering. checked out original code source author page 76 bytes faster jquery var collection = jquery([1]); // fill 1 item, make sure length === 1 now understand. wish author of book "learning javascript design patterns" add comment too, when cited code sample. jquery([1]) passing array 1 entry contains integer 1 jquery, return wrapper array containing jquery prototype methods. it later assigns element argument variable same...

sql server - SQL Query using value from previous row -

i trying subtract value of previous row current row using sql. select rd.ponum, od.orderline, rd.partnum, p.partdescription, od.ordernum, rd.ourqty, od.number01 reserved, case when rd.ourqty - od.number01 > 0 od.number01 else rd.ourqty end allocated, rd.ourqty - od.number01 newourqty, c.custnum, c.name dbo.rcvdtl rd inner join dbo.part p on rd.partnum = p.partnum inner join dbo.orderdtl od on rd.partnum = od.partnum inner join dbo.orderhed oh on od.ordernum = oh.ordernum inner join dbo.customer c on od.custnum = c.custnum (rd.ponum = 73) , (od.number01 > 0) , (od.openline = 1) this returns values: ponum | orderline | partnum | partdescription | ordernum | ourqty | reserved | allocated | newourqty | custnum | name 73 1 10050926 example description 62 55 35 35 20 1032 sam test 73 1 10050926 e...

ios - custom view when local notification is fired -

i relatively new xcode, building simple alarm clock , below small snippet of app. question is: how display custom view ( i.e. picture or animation ) when alarm fired, , put " dismiss " button on ? thank in advance nicola - (void) schedulelocalnotificationwithdate:(nsdate *)firedate :(nsstring *)message { uilocalnotification *notificaiton = [[uilocalnotification alloc] init]; if (notificaiton == nil) return; notificaiton.firedate = firedate; notificaiton.alertbody = message; notificaiton.timezone = [nstimezone defaulttimezone]; notificaiton.alertaction = @"view"; notificaiton.soundname = @"alarm-clock-1.mp3"; notificaiton.applicationiconbadgenumber = 1; notificaiton.repeatinterval = kcfcalendarunitweekday; nslog(@"repeat interval %@",notificaiton.description); [[uiapplication sharedapplication] schedulelocalnotification:notificaiton]; use method handle notifica...

c# - HTML (table) elements with dynamic controls? -

Image
so don't looks this i use multiple placeholders achieve feel though inefficient , take longer loop through each control. cause problems "remove" button because remove associate placeholder in. want display first row of controls separated table cells. you have different ways: 1. use 1 row add or edit record , use gridview or repeater show data 2. use gridview in editmode (but i'm not expert this) 3. can put controls in gridview or repeater , manage events using item/rowcommand

java - Remove NOT duplicated objects from two lists -

well, i've read lot removing duplicated values lists , nothing maintaining in fact duplicated in list. i'll try explain problem: i have read values db , save every entry (integer entry) matches searching criterias. operation done n times, since it's loop operation. returning object must list (or arraylist, or whatever list implementation adequate purpose). to make clear, pseudocode : for (int i=0; i<nelements; i++) { templist = getentriesfromdb(i); if (i==0) result=templist; else //this should maintain entries in fact duplicated // in both templist , result result = maintainduplicates(result,templist); } retun result; i know proposals problem. question is, making new loop extracts every single entry lists, create (third!!) temporal list save them there, etc.. aware cause bottleneck in implementation. any appreciated, in advance. the key operation here looking each element of 1 list in other. can slow o...

Run jar from within a Java application -

i trying build simple auto updater application. checking local application version against remote version. if there newer version want start updater.jar - downloads , replaces old application. my problem cannot seem updater.jar start if there new version. the code using is: runtime runtime = runtime.getruntime(); try { process proc = runtime.exec("java -jar updater.jar"); } catch (ioexception ex) { logger.getlogger(splash.class.getname()).log(level.severe, null, ex); } system.exit(0); the application exits updater.jar never launched.. any ideas? your child process exiting when parent process exits. when launch process should usually: consume stdout/stderr child process. if don't child process can block waiting output consumed. should consume in separate threads. see this answer more details use process.waitfor() capture exit code child process it looks me want spawn updater, let perform download , exit parent process. more comple...

c# - Howto avoid a "object reference not set to an instance of an object" exception in XAML code while design time? -

i have problem wpf usercontrol of own devising. problem object reference not set instance of object exception in xaml code while design time, when implement usercontrol in program. how can fix or suppress exeption? edit 1 the designer show me following information: at microsoft.expression.platform.instancebuilders.instancebuilderoperations.instantiatetype(type type, boolean supportinternal) @ microsoft.expression.platform.instancebuilders.clrobjectinstancebuilder.instantiatetargettype(iinstancebuildercontext context, viewnode viewnode) @ microsoft.expression.platform.instancebuilders.clrobjectinstancebuilder.instantiate(iinstancebuildercontext context, viewnode viewnode) @ microsoft.expression.wpfplatform.instancebuilders.frameworkelementinstancebuilder.instantiate(iinstancebuildercontext context, viewnode viewnode) @ microsoft.expression.wpfplatform.instancebuilders.usercontrolinstancebuilder.instantiate(iinstancebuildercontext context, ...

winforms - c# Register Global Hotkeys without hook library (Keyboard Hooks) -

i try configure global hotkeys in c# winform application should work , without focus. played little bit hooking librarys like: link but these libraries not working reliable decided different way. , found 1 there 1 problem: new method posted below can catch keypress, catch keydown (wm_keydown/0x100) , keyup event... not working. ideas? code: public form1() { initializecomponent(); } [dllimport("user32.dll")] private static extern bool registerhotkey(intptr hwnd, int id, int fsmodifiers, int vk); [dllimport("user32.dll")] private static extern bool unregisterhotkey(intptr hwnd, int id); const int mod_control = 0x0002; const int mod_shift = 0x0004; const int wm_hotkey = 0x0312; const int wm_keydown = 0x0100; private void form1_load(object sender, eventargs e) { // hook keys registerhotkey(this.handl...

png - How to decode the image which is a base64 string, in Dart? -

Image
i tried image clipboard when press ctrl+v on page, code a gist , console.log image content gets. i found image content long base64 string special prefix: data:image/png;base64,ivborw0kggoaaaansuheugaaaeeaaaaucayaaadstfabaaajheleqvrycxvxwxobvxl+pu2yfsuylmnxhtdpy8c4phxptokegkblydowyxlllegsx8d/gbvuerhgmelpjkcznsswjhpzsbhgjo6rl1pybmuyzenwyvsc9xvfmvcoj8457/k8y9k+w5lmpi0ejcuywdn7zrmjh8obvqulysmnt2wqsx3ylwivdnzm6lopprujcpidq23ivz2oyadvl8tlevlul2xeufv1qx2s8lxnjau4yphfadgarjmcatamgqs2drkgqrmokvfhyrp3xfw5vbdj6jg98eylopgtt1kzxklfhdudzk4hynn8xdqgst1ybkoi3g5gd8ixbkqhkqmd7sntadralvgxpbjui6mdypgvtzntpcuwhvjjt5oyo5bakjbmx7nzcqrsadsmqzxqxghazxtgylober1ukqat6qqo4tgemi0ie+oqw+6l+vyefuftdfxzu6z8xvbb+qkoxknceuekybnzcxamhvqb1ido1af56pr8dyrynmiyofi5vqkdymhphfjj1fv7tzz88tt2dd9qoxiqz95oikge3eavimgyqsy+tl+p9bdf4svccrkxl8bnndx/hqmzm5i8dg3helyzdqlogzpgqnprstgvhoswtnafm2spvnxcnzq9g+cx8uy3cehyhwj19bkesriplgrt7uxhzipv5cee5pyeib2xhmxorqxagb4yw1sjk3hv5kp09srewwes9mlrj5vop83hpepdegclrevlzn2+jz2ntzdy24prrl8kcw...

sql - SQLite database convert string back into blob -

i have 3 sqlite databases, need joined together. have tried following procedure: (1) select column1, column2, quote(column3) table1 - quote(x) convert blob field string field (2) i import table1.csv database, define first 2 fields integerin third string (3) i use: insert table_new (column1, column2, column3) select column1, column2, column3 table1 but doesn't convert correctly (output picture.png) there should function opposite quote , return me converted data? thank :) there no built-in sql function converts blob literal ( x'102234' ) blob, because such literal intended used in sql commands. the easiest way move data between databases use sqlite3 command-line tool: sqlite3 old.db ".dump" > data.sql sqlite3 new.db < data.sql other tools sqlite manager have similar functions export/import databases.

jquery - Is there a way to programmatically determine that an image link is bad? -

in site i'm working on, image displayed not (displayed) because link bad or stale (or whatever). can see here: why dynamic html seemingly randomly placed? when happens, want able show "image unavailable" message image be. possible? if so, 2 things needed: 1) able determine programmatically image not being displayed 2) replace it, in case, aforementioned message perhaps (pseudocode): if (imagemissing) { $('img').attr('src', 'imagemissing.png'); } ? update okay, code should like: function dosomething() { var htmlbuilder = ''; $.getjson('duckbills.json', function() { // each ... // process json file, building dynamic html htmlbuilder += 'img="bla.png"...'; $('img').error(function() { $(this).attr("src", "imagemissing.png"); }); }): }): ??? does cause each image, it's added, have error handler a...

vb.net - ASP.Net - Using variable value in different button click events - VB -

i have multiview 4 views. switch between views use 4 buttons , switch multiview's activeview index relevant view inside click event of each button. in each view there various controls capture data. there submit button @ bottom of final view write data database. what want achieve capture time stamp of when user clicks button move each view (which written database). can assign timestamp variable using below code in click event of each of 4 buttons dim phase1timestamp string = datetime.now.timeofday.tostring() the problem is, when come write records database in click event of submit button, cannot see values assigned these time stamp variables. is there way can pass these variable values submit button click event or there different way can achieve altogether? thanks the easiest way saving variable session, retrieving it. didn't if asp .net web forms or mvc, give option each. mvc has few different ways can achieve (viewdata, viewbag, tempdata, or directly s...

Catching runtime exceptions and outputs from python script in c# -

i'm writing wcf service runs python scripts. for i've been using following code: processstartinfo start = new proccessstartinfo(); start.filename = "my/full/path/to/python.exe"; start.arguments = string.format("{0} {1}", script, args); start.useshellexecute = false; start.createnowindow = true; start.redirectstandardoutput = true; start.redirectstandarderror = true; process p = new process(); p.startinfo = start; p.start(); p.waitforexit(); string stderr = process.standarderror.readtoend(); string stdout = process.standardoutput.readtoend(); now i've noticed (after lot of testing) process object gets standard error/output or catches exception if error related "compilation" errors, if have undeclared variable used or stuff that, runtime exceptions , prints not being caught or able read in c# scope. i've tried run either whole "python.exe pythoncommand.py args" sent c# code or send in processstartinfo.arguments in comma...

Java code to run data from acrobat distiller -

i writing program should select .txt files selected directory , print them using acrobat distiller. @ present, can select , open files first file printed , error: system.out.println("completed") whitout completing of other print out. import java.io.file; import java.io.ioexception; public class acrobat { public static void main(string[] args) { file foldertotalcountletters = new file("c:\\users\\jayraj\\workspace\\auto\\proof\\us\\letter\\07-01-2013"); file[] listoffilestotalcountletters = foldertotalcountletters.listfiles(); string totalcountletters; try{ (int itotalcount = 0; itotalcount < listoffilestotalcountletters.length; itotalcount++) { if (listoffilestotalcountletters[itotalcount].isfile()) { totalcountletters = listoffilestotalcountletters[itotalcount].getname(); system.out.println(totalcountletters); runtime runti...

asp.net mvc 4 - call action method with parameters MVC 4 javascript -

i'm tired , stupid, heres coding problem: we using d3.js draw on google map element in mvc4 action method called live. have implemented on click d3.js element , need redirect javascript mvc action method. the action method "declaration" looks this: public actionresult visualization(string appid = "", string userid = "") in javascript have inside d3.js function code snippet works , looks this: .on("click", function (d, i) { // example use click-event. alert(d.appname); } where d has appid , , userid aswell. what want create redirect click event, calling action method along parameters d . means when click d3.js element redirected other page pre-set parameters. we have tried things like: window.location.href = "/statslocationcontroller/visualization/appid=" + d.appidentifier + "/userid=" + d.deviceid we tried use window.location.replace(), none of has worked, guess haven't figure...

jsp - JSTL while loop (without scriptlets) -

is there way create while loop structure jsp, without using scriptlet? i ask have linked list-like structure (specifically, printing cause chain exceptions) afaik not have iterator interface use foreach on. you iterating on list <c:foreach var="entry" items="${requestscope['myerrorlist']}"> ${entry.message}<br/> </c:foreach> edit: you have method following transform exception , causes list later shown using foreach public static list<throwable> getexceptionlist(exception ex) { list<throwable> causelist = new arraylist<throwable>(); causelist.add(ex); throwable cause = null; while ((cause = ex.getcause()) != null && !causelist.contains(cause)) { causelist.add(cause); } return causelist; } for example: try { ... } catch (... ex) { request.setattribute("myerrorlist", getexceptionlist(ex)); }

javascript - jQuery mobile panel not fully rendering on device -

Image
i have been creating app mobiles using phonegap , jquery mobile, has been going until try , run on actual device (htc flyer android 3.2.1). there appears kind of rendering issue. just note appears happen on device, not when using emulator, or in browser on computer. when slide right open settings panel not render. pictures show better: this supposed happen when panel opens: but happens: when touch button or heading on panel seems refresh , render's fine, odd, both of above screen captures form device. upon discovering added code: $("#settingspanel").trigger("create"); to see if recreating help. know isn't great thing preformance wise had no other idea's wanted test on more powerful device see if performance thing, don't have other devices test on. so i'm stuck , i'd please.

c# - AjaxFileUpload Button 'Upload' Failure -

i have done quite bit of searching, , tried many different options. haven't seen other person has been having similar problem. i have the following code placed page , element reacts fine on page. 'toolkitscriptmanager have tried both regular 1 shown below. neither work. <asp:toolkitscriptmanager id="toolkitscriptmanager1" runat="server"></asp:toolkitscriptmanager> <asp:ajaxfileupload id="inpfileupload" runat="server" onuploadcomplete="inpfileupload_uploadcomplete" maximumnumberoffiles="3" allowedfiletypes="jpg,jpeg,doc,png" /> i have following background code element protected void inpfileupload_uploadcomplete(object sender, ajaxcontroltoolkit.ajaxfileuploadeventargs e) { string path = @"\\networkpath\uploadedfiles\" + e.filename; inpfileupload.saveas(path); } however gives me no error, or message stating going wrong. have ...

does Django have something similar to spring web flow? -

the purpose create stateful web applications controlled navigation. there clear start , end point. user must go through set of screens in specific order. once complete shouldn't possible repeat transaction accidentally. didn't test particular lib seems suited need: http://code.google.com/p/django-stateful/

r - Shiny Reactivity -

i've got application large number of parameters. each parameters has lots of granularity make finding desired 1 pain. causes reactive portion calculate slows things down. added submitbutton solved above problem experience problem in turn. below simple replication of framework build. parameter input takes in number 1 1000, indicates sample want. able above able resample same set of parameters. happening after adding submit button renders resample button inoperable unless click resample first , update button. any ideas of making them both working separately? shinyserver(function(input, output) { gety<-reactive({ a<-input$gobutton x<-rnorm(input$num) return(x) }) output$temp <-renderplot({ plot(gety()) }, height = 400, width = 400) }) shinyui(pagewithsidebar( headerpanel("example"), sidebarpanel( sliderinput("num", "number of samples", min = 2, max = 1000, ...

Hash in Ruby & Convert python to ruby -

i using hash in ruby, check whether word in “pairs” class , replace them. code in python , want convert ruby not familiar with. here ruby code wrote. import sys pairs = {'butter' => 'flies', 'cheese' => 'wheel', 'milk'=> 'expensive'} line in sys.stdin: line_words = line.split(" ") word in line_words: if word in pairs line = line.gsub!(word, pairs[word]) puts line it shows following error syntax error, unexpected kin, expecting kthen or ':' or '\n' or ';' if word in pairs ^ while below original python script right: import sys pairs = dict() pairs = {'butter': 'flies', 'cheese': 'wheel', 'milk': 'expensive'} line in sys.stdin: line = line.strip() line_words = line.split(" ") word in line_words: if word in pairs: line = line.replace(word ,pairs[word]) print line ...

javascript - Abstracting logic in Backbone js -

i'm developing backbone application using marionette , need organize logic in code. currently have few views handle similar logic, want abstract avoid repetition: view1 onrender: function() { var plugindata = this.$("selector1").plugin(); var pluginresult = this.handleplugindata(plugindata); this.dosomethingwithresult1(pluginresult); } view2 onrender: function() { var plugindata = this.$("selector2").plugin(); var pluginresult = this.handleplugindata(plugindata); this.dosomethingwithresult2(pluginresult); } etc note: handleplugindata same thing, dosomethingwithresultn it's different can abstracted few params. so questions are: how should abstract this?, thought of extending baseview class , adding logic there, don't know if there's better way. it's okay add custom model class handles calculation?. i've been using rails while , i'm used model === table in database. thank much! ...

css - how to define padding of a container in responsive design -

i have styles like: .main-title { background: #000; color: #fff; font: normal 1.5em "league gothic", "arial narrow", arial, sans-serif;*/ text-transform: uppercase; } now don't know exact height of main-title container multi-line title. how may declare consistent padding irrespective of it's height? just normal padding rule add consistent padding irrespective elements height. .main-title { padding: 10px; } you can use percents, torr3nt mentioned, , make padding respective width of element's parent. have created this fiddle show mean this. if element positioned absolute percent based of closest relatively positioned ancestor.

jpa - how to set value to composite primary key which is annotated with @EmbeddedId in java/hibernate application -

i have java bean/model class( ratiofunctionexpression.java ) jpa annotation below. class has composite key shown below. in dao.java how set key composite key? example appreciated @embeddedid @attributeoverrides({ @attributeoverride(name = "ratiofunctionid", column = @column(name = "ratio_function_id", nullable = false, scale = 0)), @attributeoverride(name = "expressionid", column = @column(name = "expression_id", nullable = false, scale = 0)) }) public ratiofunctionexpressionid getid() { return this.id; } public void setid(ratiofunctionexpressionid id) { this.id = id; } in order set value attribute, create new instance , assign it: ratiofunctionexpressionid newid = new ratiofunctionexpressionid(); newid.setratiofunctionid(afunctionid); newid.setexpressionid(anexpressionid); aratiofunctionexpression.setid(newid); remember being ratiofunctionexpressionid @embeddable , doesn't need id of own, because...

Sybase 15.7 - is it worth upgrading? -

we on sybase 15.0.3 sybase 15.7 seems offer useful things. above know if performs better or worth taking on other reasons. i hear runs bit better on ibm smt power processors because multi-threading instead of peer unix processes. there seems iq-like compression functionality, sounds handy big tables large row sizes. i don't know if in-memory relaxed durability dbs useful we'd have redesigns. - have experience of these? there mq messaging bit might handy - used , got impressions? we use new query optimiser things v15.0 (hash , merge joins) we're not expecting shocks or big differences there. is upgrading hard? when took on v15.0 had lot of testing, introduce login triggers , jobs more update index statistics. not expecting effort v15.7. any opinions , information gratefully received! based on usage, benefit upgrading. specifically, here of improvement areas may affect you. query processor latency has been reduced, espcially dynamic sql. ...

python - Value Error : invalid literal for int() with base 10: '' -

i'm new in python , don't know why i'm getting error sometimes. this code: import random sorteio = [] urna = open("urna.txt") y = 1 while y <= 50: sort = int(random.random() * 392) print sort while sort > 0: x = urna.readline() sort = sort - 1 print x sorteio = sorteio + [int(x)] y = y + 1 print sorteio where urna.txt file on format: 1156 459 277 166 638 885 482 879 33 559 i'll grateful if knows why error appears , how fix it. upon attempting read past end of file, you're getting empty string '' cannot converted int. >>> int('') traceback (most recent call last): file "<stdin>", line 1, in <module> valueerror: invalid literal int() base 10: '' to satisfy requirement of selecting 50 random lines text value, if understand problem correctly: import random open("urna.txt") urna: sorteio = [int(line) line in urna...

C# XML Serialisation of Object that has an Object field without namespaces -

i trying serialize object xml has 'object' field. want achieve xml no namespaces or attributes. able remove namespace of root element, however, object element remains having namespace. my object serialize; public class message { public string metadata { get; set; } public object payload { get; set; } public message() { } public message(string metadata, object payload) { this.metadata = metadata; this.payload = payload; } } how serialize; var s = new system.xml.serialization.xmlserializer(typeof(message)); var ns = new system.xml.serialization.xmlserializernamespaces(); ns.add(string.empty, string.empty); stringwriter writer = new stringwriter(); s.serialize(writer, payload, ns); writer.close(); my output: <message> <metadata>mymetadata</metadata> <payload xmlns:q1="http://www.w3.org/2001/xmlschema" d2p1:type="q1:string" xmlns:d2p1="htt...

java - Saving the state of the application -

this question has answer here: saving android activity state using save instance state 24 answers i have application : when application starts,one row 3 edittexts created calling method called newproduct() .the first of them focused , triggers creation of row of 3 edittexts.so,when last row focused,another row created dynamically. every columns inside different linear layout , gets added new arraylist<edittext>(); ,one of 3 columns.the values entered put inside string[] ,again,3 of them every column. my questions following : 1.how can save on screen orientation changes? when change orientation,the values remain in 2 of rows because 2 rows created @ oncreate ( newproduct method called,creates first row, , focused,so creates row).how can tell application create more 2 rows , keep values ? 2.how can make application keep everything,the number of rows , values...

String concatenate Jmeter + BeanShell -

i trying concatenate string in jmeter beanshell postprocessor somehow not working, seems way java handles multiple line string doesn't work here: string poxml="<s:envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:header/><s:body><ns7:newporequest " + "xmlns:ns2=\"http://services.portal.com/pro/common\" xmlns:ns5=\"http://services.portal.com/pro/po\" + "xmlns:ns7=\"http://services.portal.com/proc/ws\">" + "<ns7:tracinglevel>off</ns7:tracinglevel><ns7:userid>testutil</ns7:userid><ns7:applicationid>rf</ns7:applicationid>" + "<ns7:usertype>buyer</ns7:usertype><ns5:purchaseorder><ns5:poexternalid>xxx-930220</ns5:poexternalid>" + "<ns5:repairordernumber>vars.get("ordernumber")</ns5:repairordernumber>"; i can concatenate simple 1 line when comes multiple line...

python - pygtk not working on windows even after installation -

i have installed pygtk in windows here . still, when run code has statement import gtk in it, error as: traceback (most recent call last): file "e:\pycalc\calc2.py", line 7, in <module> import gtk importerror: no module named gtk i got message "pygtk installed in machine", after installation completion. please me

android - Restart activity as e.g. orientation change does -

i want app support different layouts right-handed , left-handed users. after changing respective preference want restart activity in same way restarts when e.g. orientation changes. what tried far: 1. intent intent = getintent(); finish(); startactivity(intent); this not store , load saved instance state 2. view cv = findviewbyid(android.r.id.content); sparsearray<parcelable> state = new sparsearray<parcelable>(); cv.savehierarchystate(state); setcontentview(desiredcv); cv = findviewbyid(android.r.id.content); cv.restorehierarchystate(state); even many things aren't should be. i think in end figure out how change layout without restarting easier in same way system-defined configuration changes. you use fragments , programmatically. following same way rearrange dinamically elements in ui think complicated maintain. onsaveinstancestate() not called on activity being finish-ed. , i'm not aware of way let android handle you. the solu...

android - After replacing a fragment with other fragment, clicking on empty places in new fragment performing operations of previous fragment -

in android replacing first fragment second fragment upon button click using below code: public class fragment1 extends fragment implements onclicklistener{ @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { .... @override public void onclick(view arg0) { fragment2 frag2 = new fragment2(); fragmentmanager fragmentmanager = getfragmentmanager(); fragmenttransaction fragmenttransaction = fragmentmanager .begintransaction(); fragmenttransaction.replace(r.id.frag1id,frag2); fragmenttransaction.commit(); }}} with above code, on click page redirecting fragment2 fragment1 replacing fragment1.as second fragment layout contains controls there lot of empty space. when, mistake, click on empty space action performed related first fragment controls. how first fragment controls present in background. can please solution...

spring mvc - returning control to correct mvc session -

in our spring mvc gae application have page form action sends data offsite to https://secure.notarealurl.com/subver they in turn return results calling www.anotherbogusurl.com/subver/results which mvc controller routes correct controller on our side. generate "session_id" sent both directions. how can mvc "reconnect" original "user/session" (who still waiting after last submit) can tell them if passed or failed - can continue accordingly? using session_id can user credentials , real session id how mvc pointed in right direction? if user has session on anotherbogusurl.com session should naturally resume when redirected site. application session id returned in form of cookie , automatically sent browser on every request.

c# - Bing RouteOptimization doesnt have any effect on routeService.CalculateRoute -

it seems routeservice.calculateroute(routerequest) not take effect routerequest.options . have tried setting routeoptimization.minimizedistance , routeoptimization.minimizetime; , neither seem adjust best route. seems calculateroute calculates waypoints depending on order in array of waypoints. know doing wrong? waypoint[] waypoints = new waypoint[waypointinfo.count + 1]; // +1 store waypoints[0] = new waypoint(); waypoints[0].description = "store"; waypoints[0].location = new routeservice.location(); waypoints[0].location.latitude = store.latitude; waypoints[0].location.longitude = store.longitude; (int = 0; < waypointinfo.count; i++) { waypoints[i+1] = new waypoint(); waypoints[i + 1].description = waypointinfo[i].address+ " - " +waypointinfo[i].name; waypoints[i+1].location = new routeservice.location(); ...

How to move reviews to product description magento -

i want know how move reviews tab product description. here our sample site: http://www.siameyewear.com/oakley-frogskins-polished-rootbeer-bronze.html can see there 3 tab under social share. 1. product description 2. reviews 3. product tags i don't want our customer click on reviews tab show content. right know how remove reviews tab don't know how move position want. my point want combine number 1 , number 2 or product description , reviews together. if know how add reviews product description. kindly please help. thank you structure defined in design/frontend/default/default/layout/catalog.xml file.check xml file , change structure whatever want.

c# - Filter in ComboBox -

Image
i fill combobox database values this: public void fillcombo() { using (sqlconnection mydatabaseconnection = new sqlconnection(myconnectionstring.connectionstring)) { mydatabaseconnection.open(); using (sqlcommand mysqlcommand = new sqlcommand("select description librarycongressclassificationoutline", mydatabaseconnection)) using (sqldatareader sqlreader = mysqlcommand.executereader()) { while (sqlreader.read()) { string desc = sqlreader.getstring(sqlreader.getordinal("description")); combobox1.items.add(desc); } } } } how filter data when type in combobox , automatically display data in comboxselection something(don't know called) without clicking you need play autocomplete: http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.autocompletemode.a...

How do I navigate through and understand the documentation in Android? -

i got 1 piece of code study , puzzled long time because tried make own version of , broke tried commenting original code step step see when failed , gave me null pointer in getview method after commented declaration of 1 variable used. wasn't seeing method being called anywhere , searched lot answer until found this: when getview() method of listview called? it esentially says getview getts called whenever item passed adapter through setadapter method. i on view docs, adapter docs, inflater, etc , couldn't find piece of information tell me happened, not setadapter method says behavior. documentation error or there general guideline i'm not following correctly? i think going in right direction, if breaking code , hitting road blocks. best resource study api's android android developer site itself http://developer.android.com/reference/android/widget/adapter.html plus [android] tagged questions on stackoverflow.

algorithm - Rank of a node in a order-statistics tree -

in order-statistics tree, rank of node? is given by rank = x.left.size + 1 or function? os-rank(t, x) { r = left.size + 1 y = x while (y != t.root) { if (y == y.p.right) { r = r + y.p.left.size + 1 } } return r } i'm confused, because think should x.left.size + 1 , since should position of x in inorder tree walk of tree. each node in order statistic tree stores number of nodes in left subtree (and, optionally, in right subtree). if read off value, won't know rank of node because don't know in order statistic tree node lies. example, if node in right subtree of root node, need factor in of nodes left of root rank. if have node , want know rank, can compute using modified bst lookup. in pseudocode: function rank(node root, node n): /* if n root of tree, rank number of nodes in * left subtree. */ if root.value == n.value: return n.leftsize /* belongs in right sub...

c++ - How to include a declaration in the comma operator? -

i have 2 simple testing lines: cout<<(cout<<"ok"<<endl, 8)<<endl; cout<<(int i(8), 8)<<endl; the first line worked, second failed compilation with error: expected primary-expression before 'int' for reason, need declaration in comma operator. more specific, want declare variables, obtain values, , assign them constant class members initialization list of class constructor. following shows intentions. if not achievable using comma operator, suggestions? #include <iostream> #include <fstream> #include <string> #include <sstream> #include <cstdlib> using namespace std; void readfile(const string & filename, int & a, int & b) { fstream fin(filename.c_str()); if (!fin.good()) {cerr<<"file not found!"<<endl; exit(1);} string line; getline(fin, line); stringstream ss(line); try {ss>>a>>b;} catch (...) {cerr<<"...

wpf - Custom Code Generation in C# -

how can generate c# code xml file @ compile time? there way this? below example of xml: <resources xmlns="" version="1.0"> <language culture="neutral"> <group name="default"> <resource name="file"><![cdata[file]]></resource> </group> <group name="files"> <resource name="title"><![cdata[[~default.file] selector]]></resource> <resource name="searchlabel"><![cdata[enter search]]></resource> </group> </language> </resources> this string resource collection. can see, self referencing, resx not. look t4 templates. t4 templates feature of visual studio allow transform arbitrary files code during build. http://msdn.microsoft.com/en-us/library/vstudio/bb126445.aspx http://www.hanselman.com/blog/t4texttemplatetransformati...

Android Foreground Service - Notification that doesn't show Samsung Galaxy device lights -

i have written small application that's intended run service. few times os has decided shutdown service when freeing memory, behavior i'm aware cannot stop. documentation states avoid happening can use foreground service invoking startforeground , passing notification method. i have written code show notification, , appears working okay. there 1 particular behavior i'm not keen on however, when press 'power' button on device screen switched off 2 'notification' lights @ bottom of samsung galaxy s 1 light up. indicates there's 'new' take @ on phone - such sms or missed phone call. don't think makes sense these light when notification available on there's on-going service. i understand cannot have foreground service without notification. i understand cannot cancel foreground service without not being foreground service more. however, there way stop lights @ bottom of galaxsy s1 lighting though there's new important informati...

statistics - Unexpected standard errors with weighted least squares in Python Pandas -

in the code main ols class in python pandas , looking clarify conventions used standard error , t-stats reported when weighted ols performed. here's example data set, imports use pandas , use scikits.statsmodels wls directly: import pandas import numpy np statsmodels.regression.linear_model import wls # make random data. np.random.seed(42) df = pd.dataframe(np.random.randn(10, 3), columns=['a', 'b', 'weights']) # add intercept term direct use in wls df['intercept'] = 1 # add number (i picked 10) stabilize weight proportions little. df['weights'] = df.weights + 10 # fit regression models. pd_wls = pandas.ols(y=df.a, x=df.b, weights=df.weights) sm_wls = wls(df.a, df[['intercept','b']], weights=df.weights).fit() i use %cpaste execute in ipython , print summaries of both regressions: in [226]: %cpaste pasting code; enter '--' alone on line stop or use ctrl-d. :import pandas :import numpy np :from statsmod...

java - How to get the max number in all sliding windows of an array? -

given array of numbers , sliding window size, how maximal numbers in sliding windows? for example, if input array {2, 3, 4, 2, 6, 2, 5, 1} , size of sliding windows 3, output of maximums {4, 4, 6, 6, 6, 5}. size of sliding window variable passed you. a sliding window subarray of original array starts @ particular index. instance, @ index 0, size 3, it's first 3 elements. @ index 1, size 3, it's 2nd, 3rd , 4th element. how solve in java or other programming language? or pseudocode, if desire. (note: not homework question, question found on site have own solution want compare others, i'll post solution below afterwards too) you can in o(n*log(w)) , n size of array, , w size of sliding window. use binary tree store first w numbers. following n-w steps, max value tree output, add element @ current position i tree, , remove element @ i-w tree. these operations o(log(w)) , overall timing of o(n*log(w)) : int[] data = new int[] {2, 3, 4, 2, 6, 2, 5,...

java - I need to construct an IPv6 packet with extension headers. -

i have been researching days , getting pretty desperate. i trying construct ipv6 packet extension headers in language possible(must through programming language automate tasks), can send them series of sites , test compatibility extension headers. what have tried now: java-- jpcap not support extension headers @ python-- scapy pydev supports 3 out of 9 extension headers. @ least want hop hop, fragmentation, routing, encapsulation, authentication , maybe destination options (6/9). so out of ideas. best tool use in order construct ipv6 packet ground default content (just presence of extension headers enough in order test comaptibility) payload empty. in packets containing fragmentation not in order increase packet size above mtu. any ideas? pretty desperate input appreciated. martinos it looks scapy may have need or extensible so. see extending scapy , couple of pdfs discuss need ipv6 extension headers - new features, , new attack & attacking ipv6 implemen...

angularjs - angular-js 2 or 3 ng-view for slide -

i need add 2 o 3 slider page angularjs reading json. code should that: <div class="wrapper"> <div id="navigation">...</div> <div class="slider"> <ul class="painting"> <li> <a href="#"><img src="img/01.jpg" height="240" width="237"/></a> <h1>title</h1> <h2>description</h2> </li> <li>...</li> <li>...</li> </ul> </div> <div class="slider"> <ul class="illustration"> <li> <a href="#"><img src="img/01.jpg" height="240" width="237"/></a> <h1>title</h1> <h2>description</h2> </li> ...