Posts

Showing posts from June, 2013

javascript - Navigation bar that animates on click and displays another bar -

hello need coming idea on how create category navigation bar. when 1 of parent category clicked shows box besides shows subcategories. this has animated effect , show on click , disappear on lose focus. wanna know best of doing be. i'm new please help. thanks. generally, sub menus have css rule of display:none until they're interacted with, property changes make show. can done dozens of different ways, either manually, using plugin, or framework. since you're asking question, may want take @ twitter bootstrap , provides dropdown functionality among other components.

How to handle Flash objects using Selenium Web Driver -

how handle flash objects perform actions in application. unable identify element. can 1 me issue selenium automates web browsers. from http://seleniumhq.org .. selenium automates browsers. that's it. flash objects impossible automate using selenium flash objects not technically 'browser driven' javascript is. you'll have find other software automate flash. source - contributor / maintainer of project.

formal methods - How to show the “count” of a set relation? -

please have @ below taking’ = taking ∪ {s? → m?} as can see, taking name relation s maps m . above relation shows adding procedure (union) adding new maptlet relation. however, need number of s available in relation. how can it? below have done #taking = numberofstudents but not sure this. please help if want know how many different student taking m (whatever m is) it easy: need possible s taking relation , measure cardinality of resulting set. just that: numberofstudents = #(\dom taking) where \dom function(relation) domain give students in relation.

python - flask: how to architect an POST endpoint that interfaces with HTML dropdowns -

so have sqlite db file i've used python script generate reading in present information flask endpoint. the endpoint parses items db , generates dict object subsequently pass jinja template: @app.route('/endpoint', method=['get', 'post']) def somefunction: << generate finaldict via db queries >> return render_template('whatever.html', **"finaldict": finaldict}) whatever.html renders bootstrap table, i.e. <table> <tr> <th> header 1 </th> ... </tr> <tr> <td> {{ finaldict['someitem'] }} </td> ... </tr> </table> so far, good, renders how i'm hoping might. what want do, have final column in table contain dropdown menu allow user categorize item in row. so if row looks id | name | whatever , have final | [dropdown] allow user select categorization, 1 of 3 possibilities. wha...

How to check if kernel driver is attached with libusb-0.1? -

in libusb-1.0 1 can use libusb_kernel_driver_active this: if (libusb_kernel_driver_active(dev_handle, 0) == 1) { //find out if kernel driver attached cout<<"kernel driver active"<<endl; if(libusb_detach_kernel_driver(dev_handle, 0) == 0) //detach cout<<"kernel driver detached!"<<endl; } how check using libusb-0.1? for libusb-compat can use usb_get_driver_np : api_exported int usb_get_driver_np(usb_dev_handle *dev, int interface, char *name, unsigned int namelen) { int r = libusb_kernel_driver_active(dev->handle, interface); if (r == 1) { /* libusb-1.0 doesn't expose driver name, fill in dummy value */ snprintf(name, namelen, "dummy"); return 0; } else if (r == 0) { return -(errno=enodata); } else { return compat_err(r); } }

hyperlink - my menu affecting href image -

menu style affects image when add link image (href), notice purple affectng google image. <!doctype html> <html> <head> <style> ul { float:left; width:100%; padding:0; margin:0; list-style-type:none;} { float:left; width:6em; text-decoration:none; color:white; background-color:purple; padding:0.2em 0.6em; border-right:1px solid white; } a:hover {background-color:#ff3300;} li {display:inline;} </style> </head> <body> <ul> <li><a href="#">link one</a></li> <li><a href="#">link two</a></li> <li><a href="#">link three</a></li> <li><a href="#">link four</a></li> </ul> <p> body text </p> <a href="test.php" target="_blank"><img src="http://www.google.se/images/google_80wht.gif" </body> </html> the css rule you've defined ...

android - facebook connect with no sdk -

i"m trying implement facebook connect on webview. problem couldn't figure out how implement it. as per documentation called api below window.location.href="https://www.facebook.com/dialog/oauth?client_id=148352165368959&redirect_uri=https://www.facebook.com/connect/login_success.html&response_type=code%20token&scope=email,publish_actions" it bring confirmation window etc etc i'm not sure how navigate application , how information https://www.facebook.com/connect/login_success.html i've gone through bbq plugin documentation hard newbie me. time in advance. can atlest point me tutorial? if wish integrate facebook android application use facebook sdk. sdk- https://github.com/facebook/facebook-android-sdk reference- http://developers.facebook.com/android/

php - Generating a unique key-secret to identify a system -

i need generate unique identifier based on information. there multiple clients , 1 server. each client call web service @ server first time registration. each client send system name (considered unique), logged in user name, date of registration, mac-address (probable) etc. based on information, want generate unique identifier particular user. server written in php. know hash methods can generate unique key, standard , being used generally? thanks help. an effective approach add salt (a few characters known server) concatenated details clients. take hash of data. in example below, salt mysalt . <?php echo hash('ripemd160', 'mysalt' . clienthostname . clientusername . clientregistrationdate); ?> this approach means hash can't guessed/reverse-engineered third party.

html - Weird White Image Border W/logo -

i trying load image using css styling , have red ridge border around it, reason when use css instead of html odd small white border on inside of red ridge border white logo in top left hand corner little logo tiny monitor don't know how else describe it. know going on? have other images loaded same way no problem. here css script html <table class="toptableleft"> <tr class="toptableleft"> <th class="thtoptableleft1"><div class="tblheadr">&nbsp;&nbsp;symbol&nbsp;&nbsp;</div></th> <th class="thtoptableleft2"><div class="tblheadr2">meaning</div></th> </tr> <tr> <td class="ntscheduled"></td> <td class="tdtext">not scheduled</td> </tr> <tr> <td class="astris...

android - "unexpected end of stream" thrown during NetHttpRequest.execute() when uploading file -

this has been asked in couple questions i've yet see real answer. i've got android code executes nethttprequest post image server, fails so: unexpected end of stream java.io.ioexception: unexpected end of stream @ libcore.net.http.fixedlengthoutputstream.close(fixedlengthoutputstream.java:58) @ com.google.api.client.http.javanet.nethttprequest.execute(nethttprequest.java:84) @ com.google.api.client.http.httprequest.execute(httprequest.java:1009) @ com.test.myactivity$imageuploadtask.doinbackground(myactivity.java:870) @ com.test.myactivity$imageuploadtask.doinbackground(myactivity.java:1) @ android.os.asynctask$2.call(asynctask.java:287) @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:305) @ java.util.concurrent.futuretask.run(futuretask.java:137) @ android.os.asynctask$serialexecutor$1.run(asynctask.java:230) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1076) @ java.util.concurren...

java - return an array of prime numbers -

i need method return prime numbers in array. so if given: primearray(5) than array should returned: (2, 3, 5) for reason doesn't seem work me: public static int[] primearray(int numfind) { //determines size of array returned int primetotal = 0; //loop find total prime numbers (int j = 1; j <= numfind; j ++) { if (isprime(j)) primetotal +=1; } //declare array returned int[] numa = new int[primetotal]; //current index of prime number int ip = 0; //loop add prime elements array (int x = 1; x <= numfind; x ++) { if (isprime(x)) { numa[ip]=x; ip++; // <--- causing me problems } } return numa; } public static boolean isprime(int n) { (int = 2; < n; i++) { if(n%i==0) return false; } return true; } this i'm using test code: int[] num = primearray(11); system.out.println(num[0]); ...

java - Synchronize multiple weblogic database access -

we have multiple instances of weblogic running on server. these instances access single database. one of table stores requests need process. issue more 1 weblogic can access database @ given time , can pick request , process it. due 1 request gets processed multiple times & creates issues. these no use of creating attribute in db stores flag whether record processed or not 2 weblogic can access record in same time. the code access database java, no use of making part synchronized as, each weblogic has there separate copy of code. please suggest how can make sure 1 record gets processed 1 time multiple running weblogics. well, answer depends upon, how accessing db, using api hibernate or simple jdbc. 1 thing can is, can manage thru session. once record accessed, becomes dirty , hence not accessed next time. surely need add mechanism how ever can let application know that, "which requests processed , not". 2 weblogic can access record in same time...

java - How to grow progress bar horizontally in javafx? -

i have application have table , progressbar . want expand progress bar when user resizes window. textbox in javafx can able set hbox priority , achieve intended. progressbar not working. can 1 tell me doing wrong ? hbox root = new hbox(); final progressbar browser = new progressbar(); // final webengine webengine = browser.getengine(); // browser.settext("jjj"); hbox.sethgrow(browser, priority.always); // webengine.loadcontent("<b>asdf</b>"); root.getchildren().add(browser); scene.setroot(root); bind widths of progress bar , vbox: vbox root = new vbox(); root.setalignment(pos.top_center); final progressbar browser = new progressbar(); browser.prefwidthproperty().bind(root.widthproperty().subtract(20)); // -20 // padding right , left, since aligned top_center. root.getchildren().add(browser);

javascript - Button event isn't firing after disabling the button in IE9 and IE8 -

i have submit button on page. on client click of submit button i'm using following javascript function: function submitdisable() { var valid = page_clientvalidate(); if (valid) { document.getelementbyid("btnsubmit").style.cursor = "wait"; document.getelementbyid("btnsubmit").disabled = true; document.getelementbyid("btnsubmit").innertext = "submitting..."; } else { submitenable(); approveenable(); } } it working fine in ie10 , chrome , aurora not working in ie9 , ie8 . whenever click on submit button gray out button , change text submitting , page hangs out. doesn't submit page . how can resolve issue in ie9 , ie8 ? looking forward replies. sounds doing asp.net require call necessary dopostback after button has been disabled: server-side implementation: protected void page_load(object o, eventargs e) { btnsubmit.attributes.add("onclick", "submitdisable...

javascript - Estimate shipping delivery date -

i would grateful if can me out this. i looking create add html/js page once customer puts country in drop down menu , clicks submit, produces estimated delivery date. the best way use map engine (like google maps api or nokia here) , calculate distance. complex , in situation over-sized. i did country-code list once , can use archive want. use json , add new option distance it. have add select: $(function() { var countrycodes=[ {"image":"ae.png","nameen":"united arab emirates","code":"ae","distance":2}, {"image":"us.png","nameen":"united states","code":"us","distance":1}, {"image":"vn.png","nameen":"viet nam","code":"vn","distance":4}, {"image":"cn.png","nameen":"china","code...

php - How to change uploaded file name in Magento? -

i using system.xml configuration upload file via backend. works perfectly. but need change uploaded image's name current store id . how can i? uploaded original name. my system.xml <?xml version="1.0"?> <config> <tabs> <restaurant translate="label" module="restaurant"> <label>upload logo</label> <sort_order>999999</sort_order> </restaurant> </tabs> <sections> <restaurant_options translate="label"> <label>upload logo</label> <tab>general</tab> <frontend_type>text</frontend_type> <sort_order>1000</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> <groups> <sample translate="label"> ...

javascript - How to set PointIntervals per month in HighChart -

i used highcharts plot number of users created on monthly basis. managed show month in x-axis , set pointinterval below pointinterval :24 * 3600 * 1000 * 31 but given blindly , won't plot points correctly. need plot points 1st of every month. above interval helps bind points on monthly basis not @ 1st day of month. example describes issue. tooltip gives clear idea. here code series: [{ type: 'area', name: 'cdp created', pointinterval: 24 * 3600 * 1000 * 31, pointstart: date.utc(2005, 0, 01), datagrouping: { enabled: false }, data: [0, 0, 0, 0, 0, 0, 0, 148.5, 216.4, 194.1, 95.6, 54.4] }] is there anyway set pointinterval depends on month. because if given pointinterval above calculate every 31 days. creates problem when month has 28 or 30 days. how acheive it. adjusting width of container div makes x-axis values not displaying properly. in advance unfortunate...

asp.net mvc application not working after publish -

i have wired problem app. along run app using visual studio, there no problem when try publish , run using iis following error [nullreferenceexception: object reference not set instance of object.] achasoft.achacms.web.routeconfig.registerroutes(routecollection routes) +813 achasoft.achacms.web.mvcapplication.application_start() +182 [httpexception (0x80004005): object reference not set instance of object.] system.web.httpapplicationfactory.ensureappstartcalledforintegratedmode(httpcontext context, httpapplication app) +9859725 system.web.httpapplication.registereventsubscriptionswithiis(intptr appcontext, httpcontext context, methodinfo[] handlers) +118 system.web.httpapplication.initspecial(httpapplicationstate state, methodinfo[] handlers, intptr appcontext, httpcontext context) +172 system.web.httpapplicationfactory.getspecialapplicationinstance(intptr appcontext, httpcontext context) +336 system.web.hosting.pipelineruntime.initializeapplication(intptr a...

Is the Camera class supported across all Android Devices? -

i working on app , using camera class comes android sdk. class seems work on galaxy ace, i've read doesn't work on android devices. here's function call: camera camera; camera.takepicture(shuttercallback, rawpicturecallback, jpegpicturecallback); sometimes oem's customize default behavior , takepicture introduced in api level 5. i'm using in 1 of application , till haven't seen device not supporting this. can more specific on device it's not working?

llvm - Remove Successors for each BB -

i need remove successors every basic block insert new ones i tried code, doesn't work void removesuccessor(terminatorinst *ti, unsigned succnum) { assert(succnum < ti->getnumsuccessors() && "trying remove nonexistant successor!"); // if our old successor block contains phi nodes, remove entry in // phi nodes comes branch... // basicblock *bb = ti->getparent(); ti->getsuccessor(succnum)->removepredecessor(bb); terminatorinst *newti = 0; switch (ti->getopcode()) { case instruction::br: // if conditional branch... convert unconditional branch. if (ti->getnumsuccessors() == 2) { cast<branchinst>(ti)->setunconditionaldest(ti->getsuccessor(1-succnum)); } else { // otherwise convert return instruction... value *retval = 0; // create value return... if function doesn't ret...

webserver - Android embedded web-server -

i want embed web-server in android application devices connecting have 2 abilities. 1 send xml-file can parse , stuff , other able download file sd-card. i found nanohttpd , androidhttpd etc not documentation , i'm facing problems on how give ability download file. there tutorial/example handles files or easy-to-use library except of ones noted above? two things come mind, both permissions related. take @ android manifest, you'll want 2 permissions app <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> internet, because you're accessing network services, , write_external_storage because when nanohttpd receives incoming connection writes temp files , / phones map "java.io.tmpdir" point @ sd card. create class extends basic nanohttpd, passing socket want run on, , implement abstract 'serve()' method. when client app...

vim - Dynamically change spell checking on a key stroke -

hello discovered spelllang if vim. trying achieve following: when press f7 dialogue opened asking me if want activate french or english dictionary set spelllang=fr spell or set spelllang=en spell when press f7 again spell disabled can in vimrc ? cheers (i using gvim , windows guess won't matter) yes can achieve this. wrote little script illustration. can put .vimrc . the key point use of inputlist() prompts user enter number. of course can expand spelllang_list contains list of possible languages desire. function! <sid>togglespell() let spelllang_list = [ 'fr', 'en' ] let string = [] in range(len(spelllang_list)) call add(string, i+1 . ") " . spelllang_list[i]) endfor if ! &spell let &spell = 1 let selection = inputlist(string) let &spelllang = spelllang_list[selection-1] else let &spell = 0 echo "'spell' disabled......

objective c - iOS gamekit/bluetooth data streaming -

i have written program using gamekit/bluetooth transfer low quality video using compressed jpegs 1 ios device another. realize gamekit/bluetooth should not used purpose (for small chunks of data) indeed work streaming 15 low quality compressed jpegs/second little no latency. the question have once increase either quality or frame rate ios device sender ios receiver, lag or delay occur , no longer real time. if there delay, i'd somehow sending ios device discard frames receiver can catchup or receiver ignore backlog queue. in gamekit have set session mode use gksenddataunreliable see if help, no avail. if delays occur, best solution , correct approach discard frames (jpegs) ios receiver can catch real time? sender need stop transmission period of time or there receiving client can discard accumulating queue. i've used nsstream before well, , while using wifi allows greater bandwidth, same problem still occur in terms of delays if data being transmitted. thank i...

Error when clicking 'new project' in Intellij 12 -

when clicking 'new project' doesn't create instead spits out error message on console..... [ 10829] error - com.intellij.ide.ideeventqueue - error during dispatching of java.awt.event.mouseevent[mouse_released,(451,206),absolute(1321,483),button=1,modifiers=button1,clickcount=1] on frame1 java.lang.classcastexception: com.intellij.openapi.module.unknownmoduletype cannot cast com.intellij.openapi.module.webmoduletype @ com.intellij.openapi.module.webmoduletype.getinstance(webmoduletype.java:13) @ com.intellij.ide.util.projectwizard.webprojecttemplate.createmodulebuilder(webprojecttemplate.java:50) @ com.intellij.ide.util.newprojectwizard.modes.createfromtemplatemode.createsteps(createfromtemplatemode.java:119) @ com.intellij.ide.util.newprojectwizard.modes.wizardmode.getsteps(wizardmode.java:51) @ com.intellij.ide.util.newprojectwizard.addmodulewizard.initmodulewizard(addmodulewizard.java:136) @ com.intellij.ide.util.newprojectwizard.addmodul...

php - Making Parallel Payments with calculated regional taxes (PayPal) -

Image
i in situation need spilt payment between multiple recipients in parallel, may in different countries , different taxes may apply per payment receiver. for using paypal's adaptive payments service, provided php sdk. my vat configuration in accounts have been testing follows: however on checkout no taxes applied, after logging account in 1 of affected countries: i have simple demonstration page hosted here: http://paytest.kingston-fear.com/ uses sandbox accounts, yet issue occurs live accounts vat set up. i've tried simplify code as possible demonstration purposes: https://github.com/xyploatkyrt/paytest/blob/master/checkout.php#l9 the tax , shipping rates set in account apply payments standard transactions. not adaptive payment or express checkout payments.

no acces to .txt with Webmatrix ASP.NET -

i got tiny website company check in store brand can found. website uses c# code check .txt files in subfolder. worked nice while used path "c:\brands" on pc try host homepage changed path "~/app_data/brands/normal" + storenames()[i] + ".txt". can't access .txt files anymore. txt files located in root/app_data/brands/normal code in root/app_code. problem? also i'm trying access files without special permissions or account. host https://panel.sitecloud.cytanium.com/ . what need access files again? problem code because doesn't work on localhost either (where worked extern folder).. edit: okay, mappath did job! forgot add mappath if(file.exists(httpcontext.current.server.mappath(sfilename))).. try use httpcontext.current.server.mappath physical directory: string data = file.readalltext(httpcontext.current.server.mappath("~/app_data/textfile.txt"));

javascript - Close a div by clicking outside -

i want hide div clicking on close link in it, or clicking anywhere outside div. i trying following code, opens , close div clicking close link properly, if have problem close clicking anywhere outside div. $(".link").click(function() { $(".popup").fadein(300); } ); $('.close').click(function() { $(".popup").fadeout(300); } ); $('body').click(function() { if (!$(this.target).is('.popup')) { $(".popup").hide(); } } ); <div class="box"> <a href="#" class="link">open</a> <div class="popup"> hello world <a class="close" href="#">close</a> </div> </div> demo: http://jsfiddle.net/lxaug/ an other way makes jsfiddle less buggy (needed double click on open). this doesn't use delegated event body level set tabindex="-1" div .p...

IBM Connections and IBM Websphere Portal integration -

i'm integrating ibm connections , ibm websphere portal using guideline ( guideline page ). to deploy portal application archive snportlets.paa need know couple of parameters connections installation(network deployment installation) run script: -dicportletwebapp=portletwebapp -dicblogshomepagehandle=homepagehandle -dicemailsetting=emailsetting -dictagsearchtype=tagsearchtype -dicdsxadminid= -dicdsxadminpwd= (those i've tried figured out) -dicbaseurl=https://connections_domain -dicprofilescontextroot=/profiles -dicfilescontextroot=/files -dicprofilesurl=https://connections_domain/profiles -dicprofilesurlunsecured=http://connections_domain/profiles -dicsearchcontextroot=/search -dicnewscontextroot=/news -dicfilesurl=https://connections_domain/files -dicsearchurl=https://connections_domain/search -dicoauthurl=https://connections_domain/connections/oauth -dicnewsurl=https://connections_domain/news -dicoauthcontextroot=connections/oauth the question: there config file ...

java - How can i get the name of day from a date in JSP -

hi trying day name date, date come page in format (dd,mm,yyyy) , code name of day date. tried: <%@ page import="java.io.*,java.util.*" %> <%@ page import="javax.servlet.*,java.text.*" %> <% line >> date date = new date(request.getparameter("date")); simpledateformat ft = new simpledateformat ("e"); out.print( "<h2 align=\"left\">" +ft.format(date) +"</h2>"); %> public date(string s) deprecated. so should this: simpledateformat sdf=new simpledateformat("dd/mm/yyyy"); // input date format date date = sdf.parse(request.getparameter("date")); simpledateformat ft = new simpledateformat ("eeee"); out.print( "<h2 align=\"left\">" +ft.format(date) +"</h2>");

vb.net - COM in a Windows form EXE using Visual Basic/Visual Studio 12 -

i don't program in .net framework i've needed use create simple exe application logs data measurement equipment. want application have automation interface couple of methods. i've done before using delphi/pascal , straightforward, , can create class library in visual studio registers , methods , can interfaced adding comclass windows form application doesn't work, can point me in right direction? this started comment kept growing, not off track ... you can register dll. short answer add class library project , put com class in there. allow share functionality of class, not same instance of class . i think problem trying establish interprocess communications . immediate suggestion not that, @ least @ first. for start have com app interface .net class library log data. have project .net executable displays log, , updates periodically. have .net code on both sides of fence , can start investigating ways them talk each other. the hard part invoking meth...

c - Working example of substitution using PCRS -

i need to substitution in string in c. recommended in 1 of answers here how regex string replacements in pure c? use pcrs library. downloaded pcrs here ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/contrib/ i'm confused how use it. below code (taken se post) const char *error; int erroffset; pcre *re; int rc; int i; int ovector[100]; char *regex = "from:([^@]+).*"; char str[] = "from:regular.expressions@example.com\r\n"; char stringtobesubstituted[] = "gmail.com"; re = pcre_compile (regex, /* pattern */ pcre_multiline, &error, /* error message */ &erroffset, /* error offset */ 0); /* use default character tables */ if (!re) ...

ios - Sending an URL alongside text using WhatsApp URL scheme -

Image
i'm trying send text accompanied url using whatsapp's custom url scheme. there's apparently 1 valid parameter purpose: text : nsurl *whatsappurl = [nsurl urlwithstring:@"whatsapp://send?text=hello%2c%20world!"]; the problem comes when want append own url text. opted encode using this: nsstring *encodedurlstring = (nsstring *)cfbridgingrelease(cfurlcreatestringbyaddingpercentescapes( null, (cfstringref)urlabsolutestring, null, (cfstringref)@"!*'();:@&=+$,/?%#[]", kcfstringencodingutf8 )); the url sent whatsapp alongside text doesn...

c++ - asm volatile function's output for the provided code -

can explain following function doing: inline int atomic_exchange_and_add( int * pw, int dv ) { int r; __asm__ __volatile__ ( "lock\n\t" "xadd %1, %0": "=m"( *pw ), "=r"( r ): // outputs (%0, %1) "m"( *pw ), "1"( dv ): // inputs (%2, %3 == %1) "memory", "cc" // clobbers ); } below call: void weak_release() // nothrow { if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) { destroy(); } } thanks in advance

Set background color in Java on a JPanel doesn't work -

i working on "paint-like" application (a little drawing software) familiarize java 2d components. here problem: have jframe contentpane instance of class inheriting jpanel. want set background color white remains on default color... class name corresponding contentpane container. here simplified code: public class container extends jpanel { public container() { super(); this.setbackground(color.white); } } the jframe constructor contains line: this.setcontentpane(maincontainer); have missed something? thx. this fix it... public class container extends jpanel { public container() { super(); this.setopaque(true); this.setbackground(color.white); } }

Iterating tags using XSLT -

i have xml structures below, <namelist> <name>name01</name> <name>name02</name> <name>name03</name> <name>name04</name> </namelist> how iterate on child tags of namelist , display them using xslt's xsl:for-each? ouput should name01 name02 name03 name04 thanks there no real need use xsl:for-each . can template matching favoured approach in xslt. you need 1 template match namelist element, can output 'containing' elements want, , start selecting child elements <xsl:template match="namelist"> <table> <xsl:apply-templates select="name" /> </table> </xsl:template> then have template matching name element, output in whatever format want. example <xsl:template match="name"> <tr> <td> <xsl:value-of select="." /> </td> ...

php - How to make a right route? -

for example have url & route: http://mysite/test/article-1 and // route on test route::set('test', 'test/<alias>',array('alias'=>'\d+')) it work http://mysite/test/article , how make right? , rule alias can't starts digit. this regex might looking for. ^(?![0-9])([a-za-z0-9]+)(-([0-9]+))? some tests: article -> true article-19 -> true article-article-19 -> true article19 -> true why-are_programmers+developers_on_stack-overflow -> true 1article -> false 1article-17 -> false

Dynamic enums in vb6 -

is there way create enum @ runtime in vb6? need create enum of products, i'll data of products @ runtime , supposed vary. no. the whole point of enums provide type safety @ compile time. example, if function accepts enum value parameter, range of valid inputs well-defined based on members of enum type. doesn't have worry how handle invalid input because result in compiler error. there's no way achieve kind of type safety @ run time, dynamically created enums don't make sense. @ rate, they're not feature supported language or runtime environment. you'll have use unique identifier (like string or numeric value) in place of enum. if wanted, create array or collection class mapped ids unique key (e.g., name of product). add products array dynamically @ runtime, , retrieve id name. note strategy, need validate inputs , handle errors manually.

java - Web service accepting array of object -

i new jdev , adf, have requirement build web service can receive array of object. there dot net service read email account exchange server , send read emails consuming our web service. dot net program can send more 1 email account , send our web service. of have created web service accepts parameters like @webmethod public string createhdafile(@webparam(name = "sender") string sender, @webparam(name = "primaryrecipient") string primaryrecipitant, @webparam(name = "secondaryrecipient") string secondaryrecipitant, @webparam(name = "subject") string subject, @webparam(name = "messagebody") string messagebody, @webparam(name = "attachmentname") string attachmentname ){ code ... } want know there way can accept array of object can receive emails in 1 go. ok. first of all, should generate xsd file xml schema - useful class generation xml. that's example .xsd file <?xml version="1.0" encoding=...

zsh: disable default completion for `make` -

i wrote auto-completion function make command, , placed in ~/.zsh : function __comp_make { # ... function body .... } compctl -k __comp_make make unfortunately, not work because completion make defined in /usr/share/zsh/functions/completion/unix/_make and apparently takes precedence on rule. i had rename _make unused_make not loaded @ zsh initialization. works, rather ugly solution. my question is: how should set completion rule takes precedence on loaded defaults? related: how 1 override existing zsh keyboard completion? edit: zsh 4.3.17 you need set fpath . see here . in ~/.zshrc , like: fpath=( ~/.zshfunctions $fpath ) where ~/.zshfunctions contains custom completion files, should solve you. note functions loaded before system ones. not work: fpath=( $fpath ~/.zshfunctions ) as aside, you're using compctl . it's old. i'd recommend using compsys instead, although decent link explaining why escapes me @ moment. t...

python - Django-Grappeli: Maximum recursion depth exceeded -

i have installed grappelli cms of django, indicated here after installation, when call admin page error is: runtimeerror:maximum recursion depth exceeded. how can solve problem? regards alessandro

how to call a python script inside another python script where both in the same directory? -

i have 2 script--script1.py , script2.py. want call script1.py in script2.py. algo this-- if condition: run script1.py #through command line else : exit in script1.py place this: def main(): if __name__ == "__main__": main() in script2.py : import script1 if condition: script1.main()

c++ - unhandled exception Access violation writing location in Visual Studio -

is there way in visual studio 2005 find out pointer or variable causing access violation? tried run in debug mode , break when happens. looking @ call stacks, happens in end of function (see below). using try/catch able find out pointer is? edit: posting code: there qt line edit , checkbox in application. toggling checkbox switch data format in line edit. 3'b111 <==> 3'h7. below callback function connected checkbox statechanged signal. exception happens in end of function, when destructing local variables. // switch hex/binary format. 15'h0000 <==> 15'b000000000000000 void switchdataformat(int checkstate) { qlineedit* writeregle = this->getwritereglineedit(); string oldtext = writeregle->text().tostdstring(); string newtext = ""; int maxlength; string reglengthtext = oldtext.substr(0, oldtext.find('\'')); string regvaluetext = oldtext.substr(oldtext.find('\'')+2); int reglength ...

haskell - An easy way to change the type of Parsec user state? -

i'm looking easy way combine 2 parts of parsect code have same stream , monad, different user state , outcome. function nice: withuserstate :: u -> parsect s u m -> parsect s v m the thing is, user state helpful in cases, need different states @ different times , don't want make states type bigger. have modify state somehow achieve this, or there function can't find @ moment? edit: i think alternative like changeuserstate :: (u -> v) -> parsect s u m -> parsect s v m parsec doesn't let directly out of box, can achieve using parsec's public api follows: {-# language scopedtypevariables #-} import text.parsec changestate :: forall m s u v . (functor m, monad m) => (u -> v) -> (v -> u) -> parsect s u m -> parsect s v m changestate forward backward = mkpt . transform . runparsect mapstate :: forall u v . (u -> v) -> state s u -> state s v mapstate f st = st { stateuser = f (stateuse...

java - Unable to Connect with my Database 000webhost.com -

try { string connectionurl = "jdbc:mysql://sql4.000webhost.com/a7291194_xxx"; connection connection = null; class.forname("com.mysql.jdbc.driver").newinstance(); connection = drivermanager.getconnection(connectionurl, "a7291194_xxx", "xxx"); if(!connection.isclosed()) system.out.println("successfully connected " + "mysql server using tcp/ip..."); connection.close(); }catch(exception ex){ system.out.println("unable connect database"+ex); } with following connector code trying connect database on 000webhost.com gives me error: communicationsexception: communications link failure last packet sent server 0 milliseconds ago. driver has not received packets server. i trying best first time totally new webhosting please me in advance! its same either on local or on server class.forname("com.mysql.jdbc....

java - Unable to deploy WAR file in liferay -

there war file. i can deploy tomcat7 without errors. when trying deploy liferay bundled tomcat error occures: 11:04:37,739 error [com.liferay.portal.kernel.deploy.auto.autodeployscanner][autodeploydir:210] com.liferay.portal.kernel.deploy.auto.autodeployexception: com.liferay.portal.kernel.xml.docume ntexception: error on line 1 of document : value following "version" in xml declaration must quoted string. nested exception: value following "version" in xml declaratio n must quoted string. com.liferay.portal.kernel.deploy.auto.autodeployexception: com.liferay.portal.kernel.xml.documentexception: error on line 1 of document : value following "version" in xml declaration must quoted string. nested exception: value following "version" in xml declaration must quoted string. @ com.liferay.portal.tools.deploy.basedeployer.autodeploy(basedeployer.java:201) @ com.liferay.portal.deploy.auto.portletautodeploylistener.deploy(portle...

operating system - Is there a part of a windows file that can't be modified? -

i'm trying accomplish let user download file web application onto system. file contain unique 5 digit code. using unique 5 digit code users can search file in file system. i'm wondering best place put 5 digit code in file users can search file. simplest approach put in name of file, however, users can change name of file easily. i'm looking filed can put code users won't able modify still able search it. possible? if file.. kind of file format mean. i'm asking because file pile of bytes , can append 5 digit code every in file, if own file format. if tell file format use, there fields can used search it. example tiff has many tags. images have other meta data. etc

c# - DTO's and calls between services -

say have 2 services in service layer, servicea , serviceb , each interface ( iservicea , iserviceb respectively). the ui layer has reference service interfaces return dtos methods. concrete service classes responsible mapping domain models (ef pocos) dtos. servicea takes dependency on iserviceb via dependency injection using ioc container, in order call methods on service. there couple of problems arise in doing this: unnecessary/duplicated mapping , dto call method and/or consume result. tightly coupling calling method dto contracts of called methods input parameters , return type. initially thought refactor logic down internal method , call both services. servicea takes dependency on interface iserviceb internal methods not exposed. how go dealing issue? further information (added example code requested): // domain model public class customer { public int id { get; set; } public string name { get; set; } } // dto domain model public class cust...

c# - Sum using from clause (linq) -

i've got following command: var sum = mylist.sum(p => p.field); is possible write same command using clause? eg. var sum = mylist ... there no expression sum in notation. here close can get: var sum = (from p in mylist select p.field).sum();

css - jQuery UI Sortable items in one line should have the same height -

Image
i use jquery ui sortable sort teasers. problem ist, teasers include different amounts of text. (red text.) if there more 1 line of teasers happens: want this: teasers should have same height highest teaser in line. it's no option give them same height. maximum count of teasers per line 3. is there easier way measuring height of highest teaser per line , adjust height of other teasers jquery after each sort? $(function () { $('li').addclass('teaser'); $('.sortable').sortable(); $('#fixheights').click(function () { var heights = []; $('.teaser').each(function () { heights.push($(this).height()); }); heights.sort(); var tallest = heights.pop(); alert(tallest); // optional $('.teaser').each(function () { $(this).height(tallest); }) }); }); jsfiddle demo! is there easier way measuring height of highest teaser pe...

hyperlink - How to "re-link" tables in VB.net? -

i'm new vb.net, , i'm having problem linking updated tables. link tables adding new data source, selecting tables, views, etc. meanwhile realize that, example, table "customers" needs have 2 new fields, have table "old" structure linked in dataset. how can link newly structured table on startup, or have re-link them manually?

java - Can't play the recorded file -

i'm making app records audio long imagebutton touched , held. achieved following code: public class mainactivity extends activity { mediarecorder recorder; mediaplayer mediaplayer; //storage paths string storagepath; string externalstoragepath; //full output paths string externaloutputpath; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //audio recorder recorder = new mediarecorder(); recorder.reset(); recorder.setaudiosource(mediarecorder.audiosource.mic); recorder.setoutputformat(mediarecorder.outputformat.three_gpp); recorder.setaudioencoder(mediarecorder.audioencoder.amr_nb); if (environment.getexternalstoragestate().equals(environment.media_mounted)) { externalstoragepath = environment.getexternalstoragedirectory().getabsolutepath(); externaloutputpath = externalstoragepath + file.separator + "/android/data/c...

objective c - What is the naming convention for methods you know will appear in a later SDK? -

i realize there subjectivity in question, considering apple development pretty opinionated naming conventions want in way others understand coding doing. trying ask question in generic way, i'll add of specific details in comments in case affects answer. let's supporting both ios 6 , ios 7. there new method on existing class exists in ios 7 sdk. assume implementing functionality in way "good enough" app straightforward. but, of course, i'd rather use sdk version better supported, more efficient, , better handle edge cases. as documented in this q&a straightforward handle situation. if ([myinstance respondstoselector:@selector(newselector)]) { //use sdk method } else { //use "good enough" implementation. } but don't want litter code whole bunch of conditional invocations. seems better encapsulate dynamic method selection. (especially in case, method hasn't shipped yet , name/signature might change.) my instinct add class...