Posts

Showing posts from January, 2015

objective c - JSON POST Request on the iPhone (Using HTTP) Problems -

im having problems request asp .net mvc web service. read in thread while ago possible find out server wants the request's content-type etc. no error when compiling when actual request nothing happens , in log of server says (null) (null). there no problem doing request , fethcing objects in list. can please me irritating bug? here code: //----------------get request webservice works fine---------------------------------------- nsmutableurlrequest *request = [[nsmutableurlrequest alloc] initwithurl: url]; [request sethttpmethod: @"get"]; nsdata *response = [nsurlconnection sendsynchronousrequest: request returningresponse: nil error: nil]; nsstring *stringresponse = [[nsstring alloc] initwithdata: response encoding: nsutf8stringencoding]; //nslog(@"stringresponse %@", stringresponse); //-------------------------------------------------------------------------------------------- nsstring *twittertrendsurl=@"http://search.twitter.com/trends.json"; ...

android - How to resize AlertDialog on the Keyboard display -

Image
okay have alertdialog box approximately 10 controls (text , textview) on it. these controls in scrollview alertdialog, plus got 2 buttons positive , negative. issue have when soft keyboard pops 2 buttons hidden behind keyboard. i looking redraw function on inner view or dialog box. if 1 has idea please help. below screen shot of talking about. if dialog activity using 1 of dialog themes effect behavior setting adjustresize flag windowsoftinputmode parameter of activity. i'm using: android:windowsoftinputmode="adjustresize|statehidden" i think can still use flag regular dialogs, i'm not sure how apply it. may have create alertdialog custom theme inherits right parent theme , sets flag, or might have use contextthemewrappers , stuff. or maybe can use window#setsoftinputmode . alertdialog.getwindow().setsoftinputmode( windowmanager.layoutparams.soft_input_adjust_resize);

Looking for documentation on the "right" way to install apps on Windows 7 -

i'm working legacy applications (10-15 years old), , trying find guidance on "right" way install , run them (and user application) on windows 7 without requiring full admin privileges. in other words, executable/read-only should files go, user-data/read-write should files go, registry entries should go, avoid issues uac , windows 7 file/registry virtualization during both installation , @ run-time. i seem remember, years ago, microsoft white paper on subject, unable find relevent information now. have found information on user side (how legacy applications run on windows 7 via compatibility tweaks), none on developer side (how create/install applications play nicely on windows 7 natively). any pointers such information appreciated. thanks. marc you're thinking of windows logo requirements . install correct folders default users should have consistent , secure experience default installation location of files, while maintai...

Moving objects from code in Silverlight for Windows Embedded 7 (SWE) -

i desperately looking code sample allow me dynamically create , move graphic objects in silverlight windows embedded 7 (swe). have found several examples of application pre-defined storyboard compiled c++ application using swi , animation started using storyboard. not looking for. need application internally have list of objects can dynamically set position. application showing how implement snowfall several types of snowflakes dynamically animated or ballons flying randomly closest see.

How do you calculate program run time in python? -

this question has answer here: how time of python program's execution? 19 answers how calculate program run time in python? you might want take @ timeit module: http://docs.python.org/library/timeit.html or profile module: http://docs.python.org/library/profile.html there additionally nice tutorials here: http://www.doughellmann.com/pymotw/profile/index.html http://www.doughellmann.com/pymotw/timeit/index.html and time module might come in handy, although prefer later 2 recommendations benchmarking , profiling code performance: http://docs.python.org/library/time.html

Sybase to equivalent oracle -

below sybase query :: select id, + "|", + substring(name, 1, 35), + "|", + substring(convert(datetime,dateadd(ss, dt,"01/01/1900")),1,20) + " time" + "|" + isnull(crnumber," ") alertmods modtype = 1 i have migrated oracle:: used concat , substr.these changes alternative.please suggest me whether using right alternative in oracle. thanks

ASP.NET MVC Multiple data inside actionlink -

i want create link using action link: <%= html.actionlink(item.forename item.surname, "details", "members", new { member = item.memberno }, new {})%> want create link using persons forename , surname link. how can this? thanks you perform following ugliness: <%= html.actionlink( string.format("{0} {1}", item.forename, item.surname), "details", "members", new { member = item.memberno } )%> but correct way use view model. way correct way in mvc use view model: public class personviewmodel { public string fullname { get; set; } public string memberno { get; set; } } include properties needed view in view model , map model view model in controller simply: <%= html.actionlink( item.fullname, "details", "members", new { member = item.memberno } )%>

sql - Return Most Recent Time -

i have complex join procedure need return recent time, on x date x patient. select convert(varchar(36), apt.uniqueid), apt.atime, rtrim(apt.apwork) + ' ' + rtrim(apt.apwrk2), aps.apsdispchar, rtrim(ltrim(aps.apstextcolor)), rtrim(ltrim(aps.apsbgcolor)), apt.apid, dbo.makecasestring(pat.pfname, pat.pfnamcase) + ' ' + dbo.makecasestring(pat.plname, pat.plnamcase), apn.apnentrytime apt inner join pat on pat.pid = apt.apid inner join aps on ((apt.aconfstat not null , apt.aconfstat = aps.apsid) or (apt.aconfstat null , aps.apsid = ' ')) inner join apn on (apn.apnpid = apt.apid , apn.apndate = apt.adate , apn.apntime = apt.atime) apt.adid = @provideridparam , apt.adate = @dateparam , apn.apnentrytime in (select max(apn.apnentrytime) apn) order apt.atime asc currently i'm using: apn.apnentrytime in (select max(apn.apnentrytime) apn) it works data, while other data (that's l...

rmi - java RMID example -

i want experiment activatable objects in rmi. there simple example somewhere works? i'm trying use oracle's tutorial java.security.accesscontrolexception: access denied (java.net.socketpermission 127.0.0.1:1098 connect,resolve) try add first argument java-vm -djava.security.policy=rmi.security example of rmi.security (could more specific, created policytool) grant { permission java.security.allpermission; };

c++ - Library to generate a CHM file -

i have been looking library expose functionality allow me generate chm files. far can tell, not exist , have rely on chmbuilder (in sandcastle) thought ask before going route. microsoft html sdk http://msdn.microsoft.com/en-us/library/ms670169(vs.85).aspx

iphone - How to parse a Dictionary according to its index? -

i have dictionary , want parse dictionary according index of keys inside dictionary.actually want switch different dictionaries per value of current variable mean want keep accessing object inside dictionary according index. k = k+1; nsdictionary * checkbox = [step objectforkey:@"checkboxsingle"]; nsdictionary * first = [checkbox objectatindex:k]; thanks here have couple of examples iterate through nsdictionary. using first example, can access arbitery values using array [checkbox allkeys]; . not should using nsdictionary because order of stuff afaik can completley random. can sorting nsarray though if serve purpose. also nsdictionary implements nsfastenumeration, means if want can do; for (nsstring *currentkey in checkbox) { nsdictionary *current = [checkbox objectforkey:currentkey]; }

jQuery Ajax validation and DataAnnotations attribues -

i created form posts , gets results through jquery ajax. need put validation stuff on it. wonder how it. should use jquery validation plugin? if use , if i'm guessing right - there no need decorate model dataannotations attributes, no longer gonna make sense, right? so i'm saying: use normal html form html.beginform() , not ajax form, override form's submit() function $("form[action$='updatecalendarform']").submit(function () { $.ajax({ url: $(this).attr("action"), contenttype: 'application/json; charset=utf-8', type: "post", data: json.stringify(calendardata), datatype: "json", success: updatecalendarcallback }); return false; // wouldn't rerender page }); function updatecalendarcallback(result){ // , here on page } what's best way add validation here without ajax helper methods (but using jquery) , dataan...

c# - wcf and session asmx rewrite -

i have web service uses session. want rewrite wcf can hosted outside iis. what best way replace session using wcf wont tie me iis in rewrite? you can use wshttpbinding reilable messaging , sessions can hosted outside iis. have here: how enable wcf session wshttpbidning transport security

How to reference captures in bash regex replacement -

how can include regex match in replacement expression in bash? non-working example: #!/bin/bash name=joshua echo ${name//[oa]/x\1} i expect output jxoshuxa \1 being replaced matched character. this doesn't work though , outputs jx1shux1 instead. bash> name=joshua bash> echo $name | sed 's/\([oa]\)/x\1/g' jxoshuxa

How do I use global namespace type hinting inside of a namespaced class in PHP 5.3+? -

namespace myclass\util; class sample { public function each(object $f) { } } from calling file (not namespaced) $sample = new sample(); $sample->each(new stdclass()); produces: catchable fatal error: argument 1 passed myclass\util\sample.php must instance of myclass\util\object, instance of object given you can use \ point global namespace : namespace myclass\util; class sample { public function each(\object $f) { } } reference, can read global space (quoting) : prefixing name \ specify name required global space in context of namespace.

Maven download or fetch the wsdl from the url to project directory -

we developed web service client application using wsdls url location. i don't want webservice client go , validate actual wsdls everytime , wanted download wsdls in local project . there way can download wsdls using maven similar copy resources? thanks vijay you can use wagon plugin download files project. see usage page .

java - Method of overload -

//******************************************************* // flexibleaccount.java // // bank account class methods deposit to, withdraw from, // change name on, , string representation // of account. //******************************************************* import java.util.random; public class flexibleaccount { private double balance; private string name; private long acctnum; //---------------------------------------------- //constructor -- initializes balance, owner, , account number //---------------------------------------------- public flexibleaccount(double initbal, string owner, long number) { balance = initbal; name = owner; acctnum = number; } public flexibleaccount(double initbal, string owner, double number) { random generator = new random(); balance = initbal; name = owner; number=generator.nextdouble(); this.acctnum= number; } public flexibleaccount(string owner) { balance = 0; name=ow...

java - How to directly connect two or more client sockets together? -

i'm looking way connect 2 or more client sockets directly without need server application running. i've searched several ways , best find jxta p2p protocol. want know if there alternatives other jxta. the basic functionalities of clients interacting (1) ability client send messages other clients , (2) request file available other client has. it's worth noting i'll running multiple instances of application on computer (localhost), having nats or firewalls aren't issues. you want multicast sockets . this question appears have code need implement them. note appropriate applications running on lan, have. supporting multicast across different networks (and across different segments of single large network) requires router support.

gwt rpc - GWT - Throwing an exception vs returning null -

suppose have method implemented on server side: @override public user login(string username, string password) throws authenticationfailedexception { // obtain hash user's db entry - omitted simplify code string sessionid = uuid.randomuuid().tostring(); currentlyloggedin.put(sessionid, new session(username)); return new user(sessionid, username); } the method takes username , password, retrieves password database , checks if valid. if valid, returns user object generated sessionid , username. if method fails? or in general, best approach if method not succeed? return null , or throw exception? always return exception. null can mean whatever, exception can have attached message explaining reason of problem. , that's not applicable gwt, java.

How to hide database table primary ID in ASP.NET Routes? -

i using asp.net routes first time. here trying achieve. registered routes in global.asax file routes.mappageroute("helpeditroute", "help/{action}/{id}", "~/ad/help.aspx") this code inside help.aspx response.redirect("~/help/edit/12") in code behind page of help.aspx doing redirect following url edit article number 12. here id database table primary key id. problem : don't want show database primary key(id) browser address bar. there way it? thanks. oftentimes referred url slug. and, in manageable scenarios (eg not stack overflow generates url slugs , exposes primary key), easy add user-generated, uniquely indexed field table handle this. code-wise, if stick default routing conventions, lookup based on surrogate key (slug) created rather primary key.

java - Compile Time & Run Time Error -

class dims { public static void main(string[] args) { int[][] = {{1,2,}, {3,4}}; int[] b = (int[]) a[1]; object o1 = a; int[][] a2 = (int[][]) o1; int[] b2 = (int[]) o1; // line 7 system.out.println(b[1]); } } i have doubt in above piece of code in java. why give runtime exception , not compile time error @ line number 7? because o1 int[][], not int[]. runtimeexception classcastexception, because first array of int arrays, , latter array of ints. you don't compile time error, because o1 defined object. @ compile time, hold derived object, in fact every type in java except primitive types long, int, short, byte, char, double, float , boolean. so, @ compile time seems possible object might in fact int[].

javascript - Equal height script almost works -

i'm using equalize heights of 2 columns: function equalheight(one, two) { if (document.getelementbyid(one)) { var lh = document.getelementbyid(one).offsetheight; var rh = document.getelementbyid(two).offsetheight; var nh = math.max(lh, rh); document.getelementbyid(one).style.height = nh + "px"; document.getelementbyid(two).style.height = nh + "px"; } } window.onload = function () { equalheight('primary', 'secondary'); } ... works great, except height of tallest column increased further 4-5px more, not required. why wouldn't calculate height of tallest column accurately? thanks because included padding. make sure remove that, either reading out value of , subtracting it, or manually doing using var nh = math.max(lh, rh) - 4; or 5 or whatever needed!

How to pass javascript var to server side on asp.net -

i'm trying pass textarea value server side. textarea cant runat=server though. heres code: <script type="text/javascript"> function replace() { //replace < , > on textarea var obj = document.getelementbyid('recipient_list'); var str = obj.value; str = str.replace(/</i, "("); str = str.replace(/>/i, ")"); obj.value = str; alert("rec_lst.value: " + document.getelementbyid('recipient_list').value); //pass value server. alert("passing server"); document.getelementbyid("ctl00$contentplaceholder1$txtemails").value = str; alert("passed server"); alert("txtemails.value: " + document.getelementbyid("ctl00$contentplaceholder1$txtemails").value); } </script> this isn't working though... idea...

How should I setup a table in a database to keep the history of records? -

i'm trying setup sql server database asp.net mvc site both store latest information history of changes data. the information site comes xml files uploaded user. site parses through xml , writes contained information sites database. elements in successive uploads may represent same thing, data may have changed. yet said before want keep track of every version. the table bellow shows 1 way thinking of approaching this. create duplicate records each item in each upload. new items match in previous uploads assigned same id, each item assigned unique upload id. upload 1: erik , sara added upload 2: erik renamed eric, bill added upload 3: sarah grew 2" taller, eric removed. [persons table] personid name height uploadid 1 erik 71 1 1 eric 71 2 2 sarah 70 1 2 sarah 70 2 2 sarah 72 3 3 bill 76 2 3 bill 76 3 [uploads tabl...

Integrating Glassfish in Eclipse for Java EE -

Image
i using eclipse java ee. have installed java ee sdk include glassfish server. not see glassfish in list of servers when creating web project. how add glassfish eclipse? eclipse indeed not ship glassfish plugin out box. need install separately. it's quite simple, click link download additional server adapters in new server wizard. wait list populated , pick oracle glassfish server tools . after restart it'll available among options. (those screenshots borrowed jsf 2.0 tutorial on eclipse + glassfish )

json - Javascript object declaration in IF statement -

i'm sorry title i'm not sure how describe one. basically i'm using jquery/ajax invoke php script validate input , data. returned data encoded json, set datatype json in jquery , returns object. i have discovered under (it has said unusual) conditions network connection not responding in expected way, ajax call invokes error option in jquery. in cases have error message coming server, error reached , no json has been sent server side script. haven't tracked down can provoke network situation yet, in case thought i'd deal in javascript whilst don't yet know. the idea check see if expected object had been created, , if not create 2 expected properties , run dialogue. way i'd avoid repeating writing error messages. it's not big saving, wanted try principle. $.ajax({ url: 'getmetadata.php', type: "post", data: entereddata, datatype: "json", timeout: (7000), //wait 7 seconds err...

dns - Custom domain in Tumblr -

i setup domain's a-record point tumblr: emmaraviv.com :: timeoftstretched.tumblr.com which works fine, www.emmaraviv.com not. in tumblr, have "custom domain" set "emmaraviv.com". don't see way specify multiples. i.e. "emmaraviv.com", "www.emmaraviv.com". i added a-record www., point same ip (the 1 tumblr tells use). when try go records address (www.emmaraviv.com.ryan-orourke.com -- it's under primary domain on host) resolves tumblr, not site. makes me think issue tumblr not recognizeing domain 1 should pointing @ timeoftstretched.tumblr.com. would love ideas? thanks!! on mine did following , worked, on dns setup: @ 66.6.44.4 www 66.6.44.4 then both domain.com , www.domain.com both go tumblr, in customize area put www.domain.com domain, should work.

load - jQuery how to build a link with json?, error -

i have this: $.get('xxx.php', { username: username }, function(data){ var get_back = data; alert(get_back); }); this return get_back=12345 and i'm trying build this: url: "http://www.test.com/users/" + get_back, the result http://www.test.com/users/12345 for reason doesn't want work. if hard-code 12345 in link work. i've tryed url: "http://www.test.com/users/" + get_back + "", , url: 'http://www.test.com/users/' + get_back, any ideas? edit: $.ajax({ type: "post", data: json.stringify(formdata), datatype: "json", url: "http://www.test.com/users/" + get_back + "", success: function(t){ alert(t); } }); that because get_back might in scope of else. either can call get_back before $.get call , global or can put on object this: var = { get_back: null, init: function(username){ var self = this; $.get('xxx.php...

How to create a method to fully utilize Uri.TryCreate? (or: combining multi-paths in a URL) -

i looking @ thread: path.combine urls? , thought maybe create path.combine. wrote: private string combineurlparts(params string[] urlparts) { var myurl = new uri(urlparts[0]); (int x = 1; x < urlparts.length; x++) { if (!uri.trycreate(myurl, urlparts[x], out myurl)) { // log failure } } return myurl.tostring(); } the idea being list baseurl (" http://someurl.com/ "), path ("/company/5/"), , part ("/financials/index.aspx") , have magically combined. this method works. first time thru loop, combines base url , first path fine. 2nd time thru loop, uri.trycreate overwrites path second part yielding: http://someurl.com/financials/index.aspx instead of expecting: http://someurl.com/company/5/financials/index.aspx any ideas what's going on here? i think passing same uri trycreate causing problem. try this: uri t; if (!uri.trycreat...

html - pseudo-class :last-child weirdness -

i'd last menu item blue, , i'm trying use psuedo-class a:last child accomplish this. weird thing is, it's applying rule seemingly random a:link in middle of menu. can tell me why? site: http://www.robert-wright-books.com/stage css: #access { background: transparent; float: left; font-size: 1.4em; text-transform: uppercase; overflow: hidden; width: 238px; margin: 36px 0 0 18px; } #access a:last-child { color: #006ccf } #access ul { list-style-type: none; margin: 0; padding: 0; margin-bottom: 0; } #access ul li { border-bottom: 1px dotted #957e5e } #access ul li:last-child { border-bottom: none } #access ul li a, #access ul li a:hover, #access ul li a:visited { color: #432f00; display: block; padding: 6px 24px; line-height: 17px; text-decoration: none; } consider #access a a child of #access, rest of links wrapped in li , , therefore li child, not a . #access ul li:last-child a points last menu item.

android - Why must I manually edit the XML file in Eclipse? Can it be set to be done automatically as I develop the UI? -

i not have such manual updating in app inventor logical eclipse have similar automatic update feature. app inventor made non-programmers. main purpose give possibility basicly develop app 1 great idea , no or low programming knowledge able done. now, eclipse ide integrates great android sdk. helps basic stuff ide does, plus things android integration (like test app on emulator/device easy).

c++ - How to start a process using a .dll file in VC++ 2010 -

i trying learn how use dll file in c++. according research, should open notepad when use displaynotepad() in code. trying compile getting compiler errors , know fact windows.h defines shellexecute says identifier not found. here code: #include "stdafx.h" #include <windows.h> #include <iostream> extern "c" { __declspec(dllexport) void displaynotepad() { shellexecute(null, "open", "c:\\windows\\notepad.exe", null,null, sw_show); } } my compiler giving me following error: error c3861: 'shellexecute': identifier not found. doing wrong? input. the declaration of shellexecute found in shellapi.h , not windows.h.

python - urls.py regex help with coordinates -

i tried searching not find answer this. i trying write function takes in coordinates, ie latitude , longitude. example, 53.345633,-6.267014 . these fed google maps api users current location, , directions nearby places (i have these locations stored somewhere) , directions returned. so, pretty have maps work done, can't test because, frustratingly enough, cannot figure out regex inside urls.py . can me this? i'm hoping simple enough guys. tried earlier failed miserably! it's frustrating coz i'm close finishing part too!! thanks help! ps format coordinates advisable, comma? perhaps 53.345633+-6.267014 better (then can use my_coords = coords.replace("+", ", ") or something)?? i'm not sure can try : def str2cords(scords): return [float(c) c in scords.split(',')] #or maybe scords.split(',') since float might mess exact cords? or regex : '/(-?\d+\.\d+),(-?\d+\.\d+)/'

Way to manage resources like JMX does in Netty -

does netty provide mechanism monitor resources jmx does? i did find article on http://community.jboss.org/wiki/netty4andjmxintegration [netty4 , jmx integration] proposal. no there no jmx support in netty yet.

c++ - Hide Cursor in Client Rectangle but not on Title Bar -

i trying hide cursor in client area of window (directx application) default behavior in title bar. i've tried several things didn't find way this. have idea how achieve this? add wndproc: case wm_setcursor: { word ht = loword(lparam); static bool hiddencursor = false; if (htclient==ht && !hiddencursor) { hiddencursor = true; showcursor(false); } else if (htclient!=ht && hiddencursor) { hiddencursor = false; showcursor(true); } } break;

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

what’s difference between $_server['path_info'] , $_server['orig_path_info'] ? how use them? when run print_r($_server) , path_info , orig_path_info not present in array. why not? how can enable them? i have read php manual on them, still don’t understand them. the path_info variable present if invoke php script this: http://www.example.com/phpinfo.php/hello_there it's /hello_there part after .php script. if don't invoke url that, there won't $_server["path_info"] environment variable. the porig_ prefix uncommon. path_info standard cgi-environment variable, , should never prefixed. did read that? (there issues around php3/php4 if invoked php interpreter via cgi-bin/ - hardly has such setups today.) for reference: http://www.ietf.org/rfc/rfc3875

iphone - UIActivityIndicatorView display in the center of the screen -

is there way have uiactivityindicatorview display in center of screen mirror networkactivityindicator? want same process networkactivityindicator, larger indicator more noticeable user. try this: uiview *view = /* whatever main view */ uiactivityindicatorview *spinner = [[uiactivityindicatorview alloc] initwithactivityindicatorstyle:uiactivityindicatorviewstylewhitelarge]; cgrect frame = spinner.frame; frame.origin.x = view.frame.size.width / 2 - frame.size.width / 2; frame.origin.y = view.frame.size.height / 2 - frame.size.height / 2; spinner.frame = frame; [view addsubview:spinner]; [spinner startanimating]; [spinner release]; // or, keep handle later stop animating this centers spinner in enclosing view, whatever might be. if not keep handle spinner, , if spinner subview of view (or @ least in known position), later handle dipping [view subviews] it. edit: use cgrectgetmidx() , cgrectgetmidy() instead of more complicated equations above finding ...

c# - authCookie and relogin the user -

scenario: have tricky situation need keep many modules happy [google analytics, etc, etc...]. got asp.net page in project initiates request on third party website (after clicking process button) , redirects user third party website. transaction processed on website , control returned current page on our site. can relate scenario kind of paypal processing too, it's not paypal. issue: if session time out, want user again authenticated when control reaches our website after processing done on third party website. thinking of passing authcookie information third party website , when control reaches our website back, have authcookie information (imagine scenario) , want log user in. can creating authcookie again based on username? it depends on transaction processing system using. if check result of transaction calling api, response have user id or can tie user id. can store user name in cookie, cookies per domain or subdomain , won't sent transaction processing web...

mfc - GUID default value in c++ -

i want use guid in class. 1) want give default value in default constructor (something 0, null, etc). how can it? 2) in constructor, want give default value in case call constructor don't have it. example: the constructor: my_class(int a, int b, int c = 0, guid g = ???) call: my_class m = new my_class(5,3); how can it? thanks 1, default value of guid: guid_null , or iid_null (it alias of guid_null ) 2, think should use refguid rather guid directly. in header files can use define_guid(guid_name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) define static guid guid_name. in class define refguid member , assign guid_name it. // {4cad5fed-86ca-453a-b813-0876daa992df} define_guid(_guid_a, 0x4cad5fed, 0x86ca, 0x453a, 0xb8, 0x13, 0x8, 0x76, 0xda, 0xa9, 0x92, 0xdf); class myclass { private: refguid rguid; public: myclass() : rguid(&guid_null) { } myclass(int a) : rguid(&_guid_a) { } };

javascript - if user pastes 32 characters into the license text-box first split textbox -

if user pastes 32 characters license text-box first split textbox, method place 8 characters each of 4 text boxes see have 4 text box ... max length (8) <input type = "text" size = "8" maxlength="32" name = "licensenumber1" id="licensenumber1"> <input type = "text" size = "8" maxlength="32" name = "licensenumber2" id="licensenumber2"> <input type = "text" size = "8" maxlength="32" name = "licensenumber3" id="licensenumber3"> <input type = "text" size = "8" maxlength="32" name = "licensenumber4" id="licensenumber4"> & license 32 characters 06e1823681f48e2f013904403b33ff08 if paste whole 32 character in first test box i.e. licensenumber1 want other 3 textbox wil automatic fill bcause(8*4=32) here's starting point. works in major b...

jquery - How to write regexp? -

how write regexp in jquery i.e. var regexp = /^([a-za-z0-9_\-\.])+\@([a-za-z0-9_\-\.])+\.([a-za-z]{2,4})$/; if there syntax write expression.. can 1 me, how write , if u know useful site share meee.. you can either write var pattern = /abc/[modifiers]; or var pattern = new regex("abc",[modifiers]);

CSS Dropdown Menu, Visible not working -

edit: incase in future finds found solution change using visibility: display: , in code visibiliy:hidden; becomes display:none; visibiliy:visible; becomes display:block; have not ever found out why visibility doesn't work on 4th nesting atleast appears fix it hi guys, i working dropdown menu created using css , lists. working fine reason 4th level of menu not listening visibility:hidden; command. according element inspector element listed being enabled not doing it. an example here: http://dev.hutchup.com/test/css-dropdown.htm i wont past code log , can see @ link above as can see first level 2 link when hovered on displays level's 3 , 4 when should display 3, , when li in 3 rolled on display 4th level. i know there many easier ways this/ prebuilt thing need way can use acl component joomla , have menu items not display . ive spent hours , cant fixed thank in advance! not sure, many levels of nesting scary business , in day , age better handled s...

cocoa - Saving preferences of document when it is a txt file -

i wonder how can save preferences of document such window size, position in screen, etc when document simple txt file. (my app text editor) i thought of nsuserdefaults , save file path happen if file moved later when app closed? using nsuserdefaults idea? looking advice thanks edit: added these 2 methods mydocument.m (thanks @somegeekintn @black frog) //helper method set nswindow frame string in file system attributes - (bool) _savepreferencesinfileaturl:(nsurl *)absoluteurl{ const char *path = [[absoluteurl path] filesystemrepresentation]; const char *name = [@"nswindow frame" cstringusingencoding:nsutf8stringencoding]; const char *framecstring = [nsstringfromrect([window frame]) cstringusingencoding:nsutf8stringencoding]; int result = setxattr(path , name, framecstring, strlen(framecstring) + 1, 0, 0); return (result<0)? no: yes; } //helper method reads nswindow frame string file system attributes - (bool) _readpreferencesinfileaturl:(...

python - Collaboration of command line and UI widgets -

could assume every powerful application provide command line/script input? even there many many fancy widgets in current software, still think command line input mode in ui still necessary nowadays, since command line/script input more straight forward , neat. if application provide more domain specific script language, more powerful. is there book provide theory on this? effective ui? you ask books related theory of this. theory 1 of separating presentation logic business logic, or separation of concerns. goes many names such model/view/controller, model/view/presenter, , many others, , there plenty of books on subject. if design application way, presentation layer (ie: user interface) separate entity can replaced another. thus, have graphical user interface textual one. arguably, in perfect world apps work way, desktop ui, web ui, command line ui, , on. this comes @ great cost, however. difficult design applications in way and, because of loose coupling between a...

c# 3.0 - Trouble installing certificate from .pfx file -

i trying install certificate on local machine (win server 2003) x509certificate2 class in c# test console application. when install certificate following code, fine: var serviceruntimemachinecertificatestore = new x509store(storename.root, storelocation.localmachine); serviceruntimemachinecertificatestore.open(openflags.readwrite); cert = new x509certificate2(certificatepath); serviceruntimemachinecertificatestore.add(cert); serviceruntimemachinecertificatestore.close(); problem is, private key of certificate not persisted, when installed without x509keystorageflags.persistkeyset. tried instanciate certificate (the private key has no password, pass in empty string): var serviceruntimemachinecertificatestore = new x509store(storename.root, storelocation.localmachine); serviceruntimemachinecertificatestore.open(openflags.readwrite); cert = new x509certificate2(certificatepath, "", x509keystorageflags.persistkeyset); serviceruntimemachinecertificatestore.add(cert); ser...

ibm mq - Is Modifying the content of a file possible in mqfte using ant task? -

i have substitute letter "a" letter "c" in content of txt file. let test.txt txt file. content follows: ace apple i need content in destination folder : cce cpple. is possible in mqfte using ant tasks? the short answer "yes." the longer answer can ant can scripted, including calling other scripts. approach use post-destination call edit file after arrives. call won't fire if file transfer fails. if transfer succeeds post-destination call fire , run task or script edit file. remember if configure run monitor, fire on every file transfer. if want run ad-hoc transfer need submit command line since gui not support pre/post calls.

smalltalk - Defining a maximum running time for a process -

i need stop process running longer n seconds, here's thought i'd do: |aprocess| aprocess := [ 10000 timesrepeat: [transcript show: 'x'] ] fork. [(delay forseconds: 1) wait. aprocess terminate] fork. i thought proper way proceed, seems fail time time, transcript goes on printing xes. bugs me work , can't figure out work/fail pattern is. this in library, don't need reinvent it. [10000 timesrepeat: [transcript show: 'x']] valuewithin: 1 second ontimeout: [transcript show: 'stop']

c++ - Is there a way to completely remove an inode when the Link count is 2? -

currently data organised in volume has cache directory (where files first created or transferred). after there suitable directories on volume in subdirs, contain files hardlinked files in cache. done same inode (file) can hardlinked multiple times in multiple directories. now when trying clean volume, recurively go through dirs(not cache) , based on criterion, unlink files (which reduces inode count of cache entry 1). there way me delete cache entry directly, when deleting last hardlink (that bringing down count 2 1). way not have manually parse through whole cache directory clear inodes it, have link count of 1. i have gone through unlink/remove functions, , not find specific of use. there purging algorithm internally takes care of this, can try implement that. any on highly appreciated. in anticipation of prompt reply. no, there isn't want out of box. it might useful deletion when unlinking hardlink , noticing link count 1, since @ point inode should in page ...

asp.net mvc - file input MVC 3 Client-side validation for required -

simple question... possible use client side mvc 3 validation on inputs of type file? to explain: mvc 3 uses model validation iclientvalidatable , unobtrusive javascript allow write validation on server side , have render client side using jquery validate using microsoft's plugins. make property required add attribute below [required] public httppostedfilebase cvfile {get; set;} as long client side val , unobtrusive javascript on in config should fire on client. however httppostedfilebase (i.e. <input type="file" name="model.cvfile" />) not run required on client side. any ideas how can achieved keeping relationship server side validation simple answer: httppostedfilebase renders "file" input type security issue and, afaik, not scriptable. there's no support "out of box". edit: seems popular topic online. http://www.hanselman.com/blog/abacktobasicscasestudyimplementinghttpfileuploadwithaspnetmvcincludingte...

python - Google App Engine Datastore multiline entries not displayed as multiline in HTML -

using google app store guestbook demo example, when entering entry on multiple lines , storing it, when read , displayed appears on 1 single line. how can make appear excactly entered, on multiple lines? the databasemodel this: class greeting(db.model): author = db.userproperty() content = db.stringproperty(multiline=true) date = db.datetimeproperty(auto_now_add=true) and submission form this: self.response.out.write(""" <form action="/sign" method="post"> <div><textarea name="content" rows="3" cols="60"></textarea></div> <div><input type="submit" value="sign guestbook"></div> </form> </body> </html>""") html ignores eol special characters \r\n or \n . here options: replace special characters proper html <br> tag wrap ...

mysql - grails rollback db operation on some error -

have service save lot of data db. using mysql have used this domain1.withtransaction {text-> def domain1=//create domain object save if(!domain1.save()){ domain1.errors.each { println } throw new runtimeexception('unable save domain1') } domain2.withtransaction {text-> def domain2=//create domain object save if(!domain2.save()){ domain2.errors.each { println } throw new runtimeexception('unable save domain2') } my problem if there occurred problem in saving domain2 need roll domain1 save also. need remove domain1 db. instead of using programatic transaction handling, service artifact allows automatic transaction handling. typically leads cleaner , more maintainable code. you can use failonerror:true when save() force runtimeexception ...

java - Shortest path between raw geo coordinates and a node of a graph -

Image
i have implemented simple dijkstra's algorithm finding shortest path on .osm map java. the pathfinding in graph created .osm file works pretty well. in case user's current location and/or destination not node of graph (just raw coordinates) how 'link' coordinates graph make pathfinding work? the simple straightforward solution "find nearest current location node , draw straight line" doesn't seem realistic. if have situation on attached picture? (upd) the problem here before start 'smart' pathfinding algorithms (like dijkstra's) 'link' current position graph, dumb formula (a hypotenuse pythagorean theorem) of finding nearest node in terms of geographical coordinates , formula not 'pathinding' - can not take obstacles , types of nodes account. to paraphrase - how find shortest path between , b if b node in graph, , not node? have heard of other solutions problem? the process you're describing " ma...

c# - Structuremap addalltypesof constructed by a specific constructor -

i structuremap ioc-framework convention based registration. try following: want add types implement specific interface when class has default (no parameters) constructor. , types must created using constructor. this have untill now, registers correct types, how specify default constructor should used when creating instance. public class myregistry : registry { public myregistry() { scan( x => { x.assemblycontainingtype<iusecase>(); x.exclude(t => !hasdefaultconstructor(t)); x.addalltypesof<iusecase>(); }); } private static bool hasdefaultconstructor(type type) { var _constructors = type.getconstructors(); return _constructors.any(c => isdefaultconstructor(c)); } private static bool isdefaultconstructor(constructorinfo constructor) { return !constructor.getparameters().any(); } } there few ways force ...

ruby on rails - Add action to scaffold generated controller -

i have created model, view , controller: $ rails generate scaffold post name:string title:string content:text then have added method on post controller: def fill_default_data post.fill_default_data end but when have open http://localhost:3000/posts/fill_default_data in browser error: activerecord::recordnotfound in postscontroller#show couldn't find post id=fill_default_data it looks rails don't see fill_default_data action , use show method. how can add new method scaffold generated controller? you should add relevant route config/routes.rb file. if have: resources :posts you should change to: resources :posts collection :fill_default_data end end that generate route can access through /posts/fill_default_data . app accessing show action , filling in "fill_default_data" id.

wpf - How can I specify MediaElement.Source with non-relative uri? -

we have wpf modules hosted in cpp unmanaged/managed application. enviroment causing troubles when specifying relative uri's media content. example, have no problem of doing in testapp: <mediaelement grid.row="0" x:name="player" source="media\getting started with.wmv" loadedbehavior="manual" unloadedbehavior="stop" stretch="fill" mediaopened="element_mediaopened" mediaended="element_mediaended"/> but, mentioned, not work in production code. if try use pack schema this: source="pack://application:,,,/media/getting started with.wmv" i exception: cannot navigate application resource 'pack://application:,,,/media/getting started with.wmw' using webbrowser control. uri navigation, resource must @ application�s site of origin. use pack://siteoforigin:,,,/ prefix avoid hard-coding uri. if try use 'siteoforigin' schema this: source="pack://s...

css - Floating DIV Containers -

am creating news container , within news content heading, images(if any), summary , read more link. the news content placed in div fixed width dont want fixed height however. the issue want containers float on left, works since height not same getting white space between 3rd , 4th one. how can fix this? you no need specify height.the height automatically adjusted based on content size. <div id="news-content"></div> css #news-content { width:100%; float:left; }

mysql - SQL Like or REGEXP filter results even when everything should be matched -

this have select node.nid nid, node.type node_type, product.* ml_node node left join ml_content_type_product product on node.vid = product.vid (node.type in('product')) , product.field_sockel_value regexp '.*' , product.field_artikel_value regexp '.*' , product.field_leistung_value regexp '.*' , product.field_licht_farbe_value regexp '.*' , product.field_rubrik_value regexp '.*' , product.field_artikelgruppe_value regexp '.*' order product.field_artikel_value having these where-conditions assume gives same results as: select node.nid nid, node.type node_type, product.* ml_node node left join ml_content_type_product product on node.vid = product.vid (node.type in('product')) order product.field_artikel_value but not. first returns 494 rows , last 1 gives 717. there's missing bunch of rows. when use query select node.nid nid, node.type node_type, product.* ml_node node left ...

java - PermGen Out of Memory reasons -

i detect oom in permgen environment: java 6 jboss-4.2.3 not big web-application i know string.intern() problem - don't have enough valuable usage of it. increasing of maxpermgen size didn't take force (from 128 mb 256 mb). what other reasons invoke oom permgen? scenario of investigation best in such situation (strategy, tools , etc.)? thanks help see note put jdbc driver in common/lib (as tomcat documentation says) , not in web-inf/lib don't put commons-logging web-inf/lib since tomcat bootstraps it new class objects placed permgen , occupy ever increasing amount of space. regardless of how large make permgen space, inevitably top out after enough deployments. need take measures flush permgen can stabilize size. there 2 jvm flags handle cleaning: -xx:+cmspermgensweepingenabled this setting includes permgen in garbage collection run. default, permgen space never included in garbage collection (and grows without bounds). -xx:+cmsclassunlo...

android - Reading multiple screen clicks and displaying the same on edittext -

am new android, , building simple calculator app. want read multiple clicks made on screen (i.e numbers) , display same in edittext. kindly find code below, in button's onclicklistener event, displaying numbers directly in edittext. piece of code, displayed numbers in edittext getting overwritten (i.e not getting appended). example when click '1', appears correctly, , next when click '2', appears '2', instead of "12". know logic wrong here, how can make characters append in edittext? code: button00.setonclicklistener(new button.onclicklistener(){ @override public void onclick(view v) { // todo auto-generated method stub edittext01.settext("0"); } }); button01.setonclicklistener(new button.onclicklistener(){ @override public void onclick(view v) { // todo auto-generated method stub edittext01.settext("1"); } ...

asp.net - How to edit the Ajax HTML Editor, that I only need a few buttons of it? -

i use html editor asp.net ajax ajaxcontroltoolkit http://www.asp.net/ajax/ajaxcontroltoolkit/samples/htmleditor/htmleditor.aspx . its like: http://s3.imgimg.de/uploads/2889172fdjpg.jpg but want have like: http://s3.imgimg.de/uploads/3eda09893jpg.jpg so default buttons overpowered users. there way reduce ajax htmleditor few buttons? or there controle can me with? you haven't said 1 you're using. recommend using tinymce: http://tinymce.moxiecode.com/ it easy achieve want it.

c# - Optional parameters on delegates doesn't work properly -

this question has answer here: can delegate have optional parameter? 2 answers why piece of code not compile? delegate int xxx(bool x = true); xxx test = f; int f() { return 4; } optional parameters use on calling side - not on single-method-interface implementation . example, should compile: delegate void simpledelegate(bool x = true); static void main() { simpledelegate x = foo; x(); // print "true" } static void foo(bool y) { console.writeline(y); }

jquery - Why does my Selenium command not work? -

i'm writing selenium script should start testing after ajax calls have completed. several forums have suggested use following condition (in waitforcondition command): selenium.browserbot.getcurrentwindow().jquery.active == 0 unfortunately keeps throwing error: jquery undefined jquery defined on site. have tried substituting jquery $, same error. any ideas? you might need wait jquery have finished loading, try waiting until typeof selenium.browserbot.getcurrentwindow().jquery == 'function' is true, before checking active.

html - IE doesn't evaluate meta-refresh anymore after pressing F5 -

ridiculous simple html-file: <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="refresh" content="5; url=./test.html"> </head> <body> <h1>hello world</h1> </body> </html> when open file any browser, browsers behave , reload page every 5 seconds. but when refresh page manually between 2 refreshes ( f5 ), ie (v 8.0.6001.18702) doesn't evaluate meta tag anymore , page gets no longer refreshed. opera , ff , safari still work expected , refresh every 5 seconds. has else experienced such problem? how (apart of using javascript, of course) issue solved? edit 1: verified behavior on ie6, guess it's general ie problem. hints how overcome this? edit 2: keep topic going: is known problem or worth file bug ticket somewhere (where?)? coul...

matlab - genetic code and zombies! -

in alien world, genetic codes of creatures in base-4 system(quartenary). pairs "13" , "22" considered genetic disorders. genetic code of lenght n, if there @ least n/4 disorders, creature becomes zombie!! example n=5, creature genetic code 01321 has disorder, not zombie while creature genetic code 22132 zombie( because has 2 disorders >n/4). now need write matlab program , value n user, easy, , display number of creatures , how many of them zombies here i've written far, can't figure out how determine creatures has genetic codes of zombie. i'd appreciate ideas , help.thank you n=input('enter length of genetic sequence: '); while (n<4) || (mod(n,1))~=0 disp('invalid input!') n=input('enter length of genetic sequence: '); end nofcreatures=4^n; count=0; i=0:nofcreatures k=dec2base(i,4); end fprintf('there %g creatures , %g of them zombies.\n',nofcreatures,count); i recommended in comment try regexp fu...

c# - Microsoft Ink InkAnalyzer "... is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)" -

i getting "... not valid win32 application. (exception hresult: 0x800700c1)" exception following code, suggestions how fix ? inkanalyzer analyzer = new inkanalyzer(this.overlay.ink, this); analyzer.addstrokes(this.overlay.ink.strokes); // exception analysisstatus status = analyzer.analyze(); i ran same problem. apparently ink analysis api work x86 assemblies, , i'm running x64 machine. targeting 'any cpu', had target 'x86' working. more info here .

Is there an equivalent to the Ruby Shellwords module for the Windows shell? -

i need construct windows shell commandlines arrays in ruby. if using bash, use standard shellwords module. there equivalent shellwords windows shell, can safely transform array commandline string? it appears me there in fact no windows analogue shellwords unfortunately.

functional programming - Functions in Haskell -

i'm new functional programming. have basic question. i'm using hugs interpreter, i write function in haskell; went though several tutorials, i'm not getting it. fact :: int -> int fact n = if n == 0 1 else n * fact (n-1) this gives me syntax error :-s error - syntax error in input (unexpected `=') i assume type right interactive prompt. sadly, these relatively primitive in haskell - complex definitions, such fact , can't entered @ prompt, @ least not in same way you'd write them. you need put function definitions etc. modules, load via (e.g.) :load fact.hs . there resources hugs provide more information on , other topic (i used http://cvs.haskell.org/hugs/pages/hugsman/index.html check assumptions). also note indentation matters, code won't work way posted here when in module. tutorials have correct versions. if not, they're useless , should forget them.