Posts

Showing posts from January, 2010

localization - ios i want localize by stringWithFormat -

i want localize stringwithformat this: nsstring *string = [nsstring stringwithformat:@"login %d in",2013]; uialertview *alertview = [[uialertview alloc] initwithtitle:nslocalizedstring(@string, nil) message:@"message" delegate:nil cancelbuttontitle:nil otherbuttontitles:@"sure", nil]; [alertview show]; also write in localizable.string: "login %d in" = "login %d in"; and doesn't work.can me?thank... you have localize format string itself. doing else doesn't make sense because string can practically when it's formatted (that's purpose of format strings, after all). out of curiosity, haven't seen things like "%d seconds remaining" = "%d secondes restants"; "hello...

php - Fatal error Invalid parameter number: mixed named and positional parameters -

i'm getting fatal error when try add $stmt->bindparam(':username', $username, pdo::param_str); script. below part of script. i'm trying use session username along id. if take out username = :username , $stmt->bindparam(':username', $username, pdo::param_str); work fine. fatal error i'm getting: fatal error: uncaught exception 'pdoexception' message 'sqlstate[hy093]: invalid parameter number: mixed named , positional parameters' in /home/www/test.php:7 stack trace: #0 /home/www/test.php(7): pdostatement->execute() #1 {main} thrown in /home/www/test.php on line 7 $action = isset($_get['action']) ? $_get['action']: ""; if($action=='delete'){ $username = $_session['user']['username'];<<<<<<<<i add line $query = "delete hostingpackage username = :username , id = ?"; $stmt = $db->prepare($query); $stmt->bindpar...

Resharper File Template - Extract part of the current file name -

i'm trying create "handler" file template when enter name of "getblogrequesthandler" following generated: public class getblogrequesthandler : ihandle<getblogrequest, getblogresponse> { } the problem given following template public class %variable%requesthandler : ihandle<%variable%request, %variable%response> { } i want able set macro %variable% "current file name without extension", without requesthandler part. is possible, or there workarounds ? by default it's not possible delete part of macro variable, can create custom macro desired functionality. check link more information: http://blogs.jetbrains.com/dotnet/2010/10/templates-galore-extending-functionality-with-macros/

plsql - Dynamic String contcatination in Cursor -

i have function concatinates value cursor. concatinates 4 columns , column name should hardcoded. there way have generic solution this, such if pass cursor automatically concatinate data regardless of column name , number of columns in 11g. function generatedata(p_datacursor in sys_refcursor) return varchar2 -- --------------------------------------------------------------------- crlf varchar2(2) := chr(13)||chr(10); lv_message varchar2(32000); begin rec in p_datacursor loop lv_message := lv_message || rec.a||','||rec.b||','||rec.c||','||rec.d || crlf; end loop; return lv_message; end; since 11g oracle built-in package dbms_sql provides function to_cursor_number - "this function takes opened or weakly-typed ref cursor , transforms dbms_sql cursor number." example code: declare l_cursor sys_refcursor; function generatedata(p_datacursor in sys_refcursor) return varchar2 curs sys_refcursor := p_datacursor;...

android - How do you create a stub application that only directs users to download the full version on Google Play? -

just looking create stub application nothing direct user download full version on google play once application launched. i'm assuming stub apk need same package name, signed same certificate have lower version code. while pointing google play product page. that's needed? can have apk update upon launch google play without directing user initiate clicking update button? thanks! try one: final string appname = "com.example"; startactivity(new intent(intent.action_view, uri.parse("market://details?id="+appname))); remember user can have no googleplay installed, in case want catch activitynotfoundexception (or that), , give link browser. your app stub has have same package name, , must signed same certificate 1 in googleplay.

html - Zurb Foundation - slide out menus -

doing reading there mentions zurb foundation has supports side slide-out menus, similar 1 can found on following website (triggers via icon on top left corner): http://www.dtelepathy.com/ looking @ foundations doco i'm unable find anything. able point me in right direction on how achieve such behavior zurb foundation? many thanks! there foundation 3 called off canvas slides. not sure compatitible foundation 4. http://zurb.com/playground/off-canvas-layouts

cordova - Need Email composer plugin with attachment In android? -

i working on email attachment plugin.i want sent html file , rtf file .i used following code .my mail sent .but there no attached file used whole given ?can give me idea? using getting error while adding email composer plugin in phonegap "error adding plugin com.example.abc" here 1 more use https://github.com/phonegap/phonegap-plugins/tree/master/android/emailcomposerwithattachments

c++ - Interpreting memory consumption of program using pugixml -

Image
i have program parses xml file of ~50mb , extracts data internal object structure no links original xml file. when try estimate how memory need, reckon 40mb. but program needs 350mb, , try find out happens. use boost::shared_ptr , i'm not dealing raw pointers , didn't produce memory leaks. i try write did, , hope might point out problems in process, wrong assumptions , on. first, how did measure? used htop find out memory full , processes using piece of code using of it. sum memory of different threads , more pretty output, used http://www.pixelbeat.org/scripts/ps_mem.py confirmed observation. i estimated theoretical consumption idea factor lies between consumption , should @ least. it's 10. used valgrind --tool=massif analyze memory consumption. shows, @ peak of 350mb 250mb used called xml_allocator stems pugixml library. went section of code instantiate pugi::xml_document , put std::cout destructor of object confirm released happens pretty in program (a...

android - Saving image from httpResponce -

i have download image httpresponse , save on internal storage on android device. have block of code trying that: httpresponse httpresponse = httpclient.execute(httppost); inputstream inputstream = httpresponse.getentity().getcontent(); bitmap logo = bitmapfactory.decodestream(inputstream); fileoutputstream fos = null; try { fos = getapplicationcontext().openfileoutput("logo.png",context.mode_private); logo.compress(bitmap.compressformat.png, 90, fos); } catch (filenotfoundexception e) { e.printstacktrace(); } { fos.close(); } but dont result need. saved image not open image viewvers , slighly bigger in size too. image download 1.71 kb , result 2.01 kb. ideas? i don't know what's real problem in code can try code if want,this code ran without problem me to save internal memory... file filewithinmydir = getapplicationcontext().getfilesdir(); try { strictmode.threadpolicy policy = new strictmode...

c# - RavenDB. Alternative to leading wildcard? -

i have ravendb collection approximately 1 million documents. 1 field in these documents string containing domain name. have business requirement let users search substring of domain. example search 'example' needs return documents domain field contains example.com, example.net, or www.example.com. another standard search domain extension such .com return .com domains. it not safe assume period delimits search term. i'm moving ms sql environment , trying wrap head around doing without leading wildcard support. realize raven can use leading wildcards such searches expensive , slow. i've considered reversed version of field won't meet requirement. is ngram analyzer answer? how can meet search requirements? in order support arbitrary subsequences tokens, yes, ngram analyzer right approach. the example you've provided, though, should not require it. indexing "www.example.com" should produce searchable token "example" (the ...

c# - Is it possible to mergeattribute (style, background) -

i have if-statements , want set color of textbox depending on if-statement. tried mergeattribute("style","background-color: rgba(0, 255, 0, 1)") ...something that. is possible way? have wrong syntax?

Google-Forms response with Python? -

i'm trying write python-script makes possible submit responses in google-forms one: https://docs.google.com/forms/d/152ctd4vy9prvlfeacof6smmtfap1cl750sx72rh6hj8/viewform but how send post , how can find out, post should contain? first pip install requests you have post specific form data specific url,you can use requests.the form_data dict params correspondent options,if don't need options,just remove form_data. import requests url = 'https://docs.google.com/forms/d/152ctd4vy9prvlfeacof6smmtfap1cl750sx72rh6hj8/formresponse' form_data = {'entry.2020959411':'18+ sollte absolute pflicht sein', 'entry.2020959411':'alter sollte garkeine rolle spielen', 'entry.2020959411':'17+ wäre für mich vertretbar', 'entry.2020959411':'16+ wäre für mich vertretbar', 'entry.2020959411':'15+ wäre für mich vertretbar', 'entry.20209...

Firebird 2.5 Removing Rows with Duplicate Fields -

i trying removing duplicate values which, reason, imported in specific table. there no primary key in table. there 27797 unique records. select distinct txdate, plunumber itemaudit give me correct records, displays txdate, plunumber of course. if possible select fields select distinct of txdate,plunumber export values, delete duplicated ones , re-import. or if possible delete distinct values entire table. if select distinct of fields value incorrect. to information on duplicates, need query information duplicate rows using join : select b.* (select count(*) cnt, txdate, plunumber itemaudit group txdate, plunumber having count(*) > 1) inner join itemaudit b on a.txdate = b.txdate , a.plunumber = b.plunumber

javascript - Knockout select and textbox sharing binding -

i have page select , input-box being bound same value. idea 1 select value select, however, user should able enter arbitrary string in input-box. problem if enter not present in select, because of binding, value set first item in select. this behavior want achieve: user selects value select value set selected item. input updated selected value. user enters text in input value set entered text. select not change unless value present in collection of available values. in other words, want last changed control valid value. want both controls date as long given value valid control . my code looks this: js var viewmodel = { value: ko.observable('1'), set: ['1', '2', '3'] }; ko.applybindings(viewmodel); html <!-- ko if: set.length > 1 || (set.length > 0 && set[0] != '') --> <select type="text" class="form-control input-small" data-bind="options: set, value: value">...

upgrade Lotus notes to IBM Notes 8.0 or 8.5 -

we having lotus notes 4.5 database. want upgrade ibm notes 8.0 or 8.5. possible ? if yes, can give link or reference. a 4.5 database should work without changes on 8.x server or client. in rare cases need change. if case post issue here on stackoverflow. make sure change ods version of database can use improvements of 8.x ibm notes version. you might want use new design possibilities improve user experience next step.

java - Android best method to send files from client to server when network is not stable -

i'm using httpurlconnection send files server android application. it's working fine when network stable. whenever network not stable , i'm sending files again , again server data missing. can 1 tell me whether socket implementation solve issue? or other solution me in handling scenario? thanks in advance. you should check network failure test cases.when network failure while data transfering , should maintain list of items not sent.when network connected,then try send remaining items.

angularjs - Angular prettyPhoto $scope -

i have problem acessing $scope in prettyphoto inline opened html. simple html in have ng-click. <div id="inputmask" class="gridsystem modalwindow responsive" style="display:none;"> ... </div> and here js creating prettyphoto modal window: $.prettyphoto.open('#inputmask','',''); prettyphono creates special div, cannot connect controller and/or $scope. does have idea how should made? tnx angularjs not work dynamically generated content prettyphoto plugin generates, since angular needs compile html , setup necessary watches. you need wrap jquery plugin directive , manually update scope elements based on events handlers available plugin.

security - What I need to know to do asp.net streaming -

i have thing create internet shop sell video views. , there rules, don't know how do. rules is: loggined client can view 1 video 3 times per day. read somewhere need generate virtual links video , server must hold it, example, 3 hours or until client looked end video, , delete virtual link , refresh player state "start video position , waiting start". on youtube client shouldn't have way rewind video. i need hold situation client buy 'video01' give client him page address or attributes data player tag. if second client don't buy 'video01' shouldn't load it. (i think it's can solved cookies). after 180 video views, client's subscription must stopped. and question me how play video website? can explain me how make asp.net site rules wrote above? technology need use? grateful if advise me literature need read know how this? perhaps start need know how play video on asp.net webpages. free flash player should use s...

c++ - What are the consequences of having a static pointer to this -

i have class contains functions need run threads. proper way (form understand) have these functions declared static. use methods class need have instance class, create static variable initialized self in constructor. implications in efficiency , program logic? class foo { private: foo* this_instance; foo() { this_instance=this; } void foobar() { ... } static void* bar() { if (this_instance==null) return 1; //throws not catched they? this_instance->foobar(); return 0; } } not actual code make question clearer. the application works , checked helgrind/memcheck , errors not related issue @ hand. i'm asking question because solutions seem workarounds, including one. others 1 mentioned doctor love, other using helper static method. i wondering if approach result in epic failures @ point in time, reason unknown me , obvious other more experienced programmers. you not need functions static use them in threads. bind ...

android - Background transparency in libgdx -

how can make background of screen transparent if use libgdx in android? the code tried use doesn't work. gdx.gl.glclearcolor( 0, 0, 0, 0 ); gdx.gl.glclear( gl10.gl_color_buffer_bit | gl10.gl_depth_buffer_bit ); just found solution! just add code class extends androidapplication. androidapplicationconfiguration cfg = new androidapplicationconfiguration(); cfg.r = cfg.g = cfg.b = cfg.a = 8; cfg.usegl20 = false; view view = initializeforview(new linedrawing(), cfg); if (graphics.getview() instanceof surfaceview) { surfaceview glview = (surfaceview) graphics.getview(); glview.getholder().setformat(pixelformat.translucent); glview.setzorderontop(true); }

html - CSS:Is it legal to place the style=""? -

<div style="margin-bottom:1em;"> <input type="submit" value="guest access" name="guest_login" class="buttonhmpg" style="width:115px;" style=""> </div> we have "guest access" button on page, based on configuration displaying button, mean in configuration file if yes, display buttton, if no hide button using css style style=\"visibility:hidden\" . if remove style="" empty style tag, configuration of displaying , hiding not work. if remove style="" , displayed always. my question is legal place style="" ? beacause of style="" , guest access button displayed , hidden? no. 1 instance of given html attribute may appear on element. browsers required ignore attributes if 1 of matching name exists on element. when user agent leaves attribute name state (and before emitting tag token, if appropriate), complete attribute...

why windows title not set on jQuery ui window? -

i load view on popup window works fine window title not set , empty set in code runs without error. wrong me? $(function () { $(".dialog-trigger").on("click", function (event) { event.preventdefault(); $.ajax({ url: "opensendsmsdialog", type: "get", }) .done(function (result) { $("#clientdetailmodal").html(result).dialog({ autoopen: true, width: 400, modal: true, show: { effect: "blind", duration: 1000 } }, "option", "title", "321 file"); }); }); }); you're passing random arguments after object used initialize dialog, ignored: http://api.jqueryui.com/dialog/ $("#clientdetailmodal").html(result).dialog({ autoopen: true, width: 400, modal: true, show: { effect: "blind", duration: 1000 ...

android - How to empty edittext without setText(""); -

is there way reset edittext value without setting text like: ((edittext) findviewbyid(r.id.yoursxmlid)).settext(""); edit: textchanged listner called when use settext(""). another option is: edittext.gettext().clear(); you'll have cast anyway: ((edittext) findviewbyid(r.id.yoursxmlid)).gettext().clear();

java - Struts2, I have a NullPointerException report -

struts.xml : <package name="backpower" namespace="/backpower" extends="struts-default"> <default-interceptor-ref name="defaultstack"></default-interceptor-ref> <!-- backup battery manager --> <action name="backpower" class="com.cps.backpower.action.backpoweraction"> <result name="addbattery">/web-inf/views/backpower/info/addbattery.jsp</result> <result name="editbattery">/web-inf/views/backpower/info/editbattery.jsp</result> <result>/web-inf/views/backpower/info/list.jsp</result> </action> </package> add.jsp : <div class="form-actions"> <button name="method:save" type="submit" class="btn btn-primary"> save </button> <button type="reset" class="btn"> ...

How long ServiceStack takes to get start? -

i'm building client/server game wcf, unfortunately because of compatibility problem, met huge challenge when porting restful server end linux(mono). dudes ask me try servicestack instead of ask questions everywhere :p. now question is, know nothing framework. how long takes start? how needs change original wcf code? changing client end fit rest instead of webservice big work, don't want servicestack hard me. any advise? thank :) converting code wcf servicestack mean complete overhaul. no part of service layer same. not taken lightly. if work of converting client rest work, much. that being said, encourage @ anyway. servicestack considerably faster develop once familiar it, more flexible framework, , drastically faster wcf (especially @ serialization). i can't think of single thing in wcf prefer servicestack.

java - DialogFragment with multiple activities -

i used documentation here create dialogfragment. code : public static myalertdialogfragment newinstance(int title) { myalertdialogfragment frag = new myalertdialogfragment(); bundle args = new bundle(); args.putint("title", title); frag.setarguments(args); return frag; } @override public dialog oncreatedialog(bundle savedinstancestate) { int title = getarguments().getint("title"); return new alertdialog.builder(getactivity()) .seticon(r.drawable.alert_dialog_icon) .settitle(title) .setpositivebutton(r.string.alert_dialog_ok, new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int whichbutton) { ((fragmentalertdialog)getactivity()).dopositiveclick(); } } ) .setnegativebutton(r.string.alert_dialog_cancel, new dialoginterface.onclic...

Android requesting Thumbnails increases heap -

my application requests available thumbnails of phone via images.thumbnails.data. requests images.media.date_added value of each. if want start app, screen becomes black (i think works in background) , log says: grow heap ( frag case ) 3.373 19764-byte allocation after while, android tells me "application doesn't respond". i located access pictures reason heap grow , how can solve problem?

Missing Reference when using the Excel Library with Microsoft visual studio 2012 -

Image
i using visual studio 2012 mysql database .. trying generate simple report using forms. when click on button reports generate in excel sheet. problem facing using library: using excel = microsoft.office.interop.excel; when used says : one or more types required compile dynamic expression cannot found. missing reference? as shown in figure !! please ?? in advance i have sort out problem :) default project in visual studio 2010 should have references microsoft.csharp , system.core. in 2012, if not referenced in project need add them, , errors go away. thanks

objective c - NSTimer called method causes thread break point -

running class below gives thread break @ end of first run of @selector method timerevent called nstimer object [ timer ]. error given __nsfctimer, '< error: unknown class>'. seems crash after first iteration of currentnumber 1. any ideas? // // numberlooper.m // delegation excersise // // created edwin on 7/31/13. // copyright (c) 2013 offbeat software. rights reserved. // #import "numberlooper.h" @implementation numberlooper -(void) timerevent: (nstimer *)timer { if (currentnumber < 256) currentnumber ++; else currentnumber = 0; nslog (@"%d", currentnumber); [self.delegate numberhaschangedto:currentnumber]; } -(void) starttimerloop { if (!timer) { timer = [nstimer scheduledtimerwithtimeinterval: 0.020 target:self selector:@selector(timerevent:) userinfo:nil repeats:yes]; ns...

c - error when use array wchar -

i have variable type wchar (szdrive), want have array , element of has type wchar. here code: typedef struct array_wchar{ wchar array_char[5]; }; array_wchar array_drivename0[10]; int array_drivename_index0 =0; wchar szdrive[5] = l" :\\"; but when write: for(int i=0;i<10;i++){ array_drivename1[i].array_char = szdrive; } it has error: error c2106: '=' : left operand must l-value can explain me why , can give resolution? plz! you can't assign directly array that. need either use memcpy / strcpy or assign individual elements: memcpy(array_drivename0[i].array_char, szdrive, sizeof(array_drivename0[i].array_char)); or for (j = 0; j < 5; j++) { array_drivename0[i].array_char[j] = szdrive[j]; } also seem referencing array_drivename1 have declared array_drivename0. your overall structure confusing. have array of structs, each of contains array of wchars - why not have array of arrays , remove struct entirely? for example: ...

java - Why doesn't the following program work? -

i can't figure out why following program doesn't work. please me did make mistake. thank you. import java.util.scanner; public class largestnumber { public static void main(string[] args) { int[] numbers = new int[100]; int largestnumber = 0; system.out.println("enter numbers. when want finish, type 'finish'."); scanner sc = new scanner(system.in); { if (sc.hasnextint()) { (int counter = 0; counter < 10; counter++) numbers[counter] = sc.nextint(); } if (!sc.hasnextint() && !sc.hasnext("finish")) { system.out.println("it's neither number nor 'finish'."); } } while (!sc.hasnext("finish")); (int x : numbers) { if (x > largestnumber) { largestnumber = x; } } system.out.println(...

sql - Is there a default sort order for cursors in COBOL reading from DB2? -

i trying understand how following cobol cursor works: t43624 exec sql t43624 declare x_cursor cursor t43624 select t43624 t43624 ,b t43624 ,c t43624 ,d t43624 ,e t43624 ,f t43624 t43624 x t43624 t43624 l = :pp-l t43624 , m <= :pp-m t43624 , n = :pp-n t43624 , o = :pp-o t43624 , p = :pp-p t43624 , q = :pp-q t43624 end-exec. given there no order clause, in order rows returned? default have been set somewhere? there no default sort order results returned db/2 select statement. if need, or expect, data returned in order ordering must specified using order clause on sql predicate. you may find results appear ordered ordering artifact of access paths used db/2 resolve perdi...

ios4 - Is there any way to test Venmo APIs from outside the US or on platforms other than the iPhone? -

i need implement venmo payment systems in our client's iphone application. our client in usa, i'm offsite developer based outside of usa. is there way work venmo apis outside of usa testing purposes? right now, venmo blocks ip addresses outside of united states. use vpn or proxy access venmo outside us.

python - Passing class names to dictionary (and parsing order) -

i have code looks following: class action(object): ... class specificaction1(action): ... class specificaction2(action): ... they specified in same file. before specification want put dictionary looks this: actions = { "specificaction1": specificaction1, "specificaction2": specificaction2 } the idea can import actions dictionary other modules , have 1 dictionary 1 canonical string representation of actions (they sent on network , other places need identifier). is possible "class pointers" in same way function pointers? , editor complains names undefined before dictionary declared before class definitions - true? also, if above possible can instantiate class: actions['specificaction2']() ? classes first-class citizens in python, i.e. can treat them other object. point of view construction fine, except have define actions dictionary @ end of file (because unlike other languages order important in pytho...

android - Convert FragmentManager to MapView -

i'm using code show map @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); setcontentview(r.layout.activity_main); fragmentmanager myfragmentmanager = getfragmentmanager(); mapfragment mymapfragment = (mapfragment)myfragmentmanager.findfragmentbyid(r.id.map); mymap = mymapfragment.getmap(); mymap.setmylocationenabled(true); mymap.setmaptype(googlemap.map_type_terrain); } and i'm using markers, drag them , delete them. if want make map mapview able draw lines using ondraw , touchevent in same time, how can convert mapview?

php - Create a price range from given min and max values -

given 2 values $min , $max , want create price range users choose from. example $min = 849; $max = 41259; my thresholds are: <10k 10k 25k 25k 40k 40k+ so, if min value 12000, first 1 in threshold not come. tried couple of things, none worked. highly appreciated. one solution use loop in php. $min = 123; $max = 345; for($i=$min;$i<$max;$i++){ echo $i."<br/>"; } change $min minimum , $max maximum. update: if want first , last i.e. min , max values should not displayed itself. use code $min = 123+1; $max = 345-1; for($i=$min;$i<$max;$i++){ echo $i."<br/>"; }

.net - Parse HTML in C# without AgilityPack -

i have html file, several input fields id, loaded c# string: <div> <input id="inpname" type="text" /> <input type="checkbox" /> </div> lets want add required attribute input id inpname . in jquery do: $('input#inpname').prop('required', true); q : how can achieve add attribute without adding htmlagilypack? can use xmldocument or choice regular expressions ? u can use xml objects like in http://msdn.microsoft.com/en-us/library/system.xml.xmlnode.selectnodes.aspx and use xmlnode object take want http://msdn.microsoft.com/en-us/library/system.xml.xmlnode.aspx you can use expressions search want http://www.w3schools.com/xpath/xpath_syntax.asp you can use code node xmldocument doc = new xmldocument(); doc.loadxml(myxmlcontent); xmlnode root = doc.documentelement; xmlnode mynode = root.selectsinglenode("mytag");

copying range of cells and pasting to the first empty row more effective code? Excel -

i have macro takes selection of cells "new search" , paste range first open cell in "past searches" i'm thinking code ineffective. have ideas of how can improve this? sub macro5() range("a3:j3").select range(selection, selection.end(xldown)).select selection.copy sheets("past searches").select range("a1").end(xldown).offset(1, 0).select activesheet.paste worksheets("new searches").activate application.cutcopymode = false end sub first, don't have use .select or .activate on cells/worksheets you'll manipulate, reference them directly. can slow down code. the .copy method can take destination parameter, don't have use .paste somewhere else. also, .end property isn't reliable. it's better use usedrange instead. you can pretty in 1 line. worksheets("new search").range("a3:j3").copy destination:=worksheets("past searches").usedrange.columns(1).offset(1, 0)...

How to get a part data from a filename in Java? -

how part of data string: csvfile = "c:/users//phv/01surname local.csv" i need extract surname above string upd what think it? file f = new file(csvfile); string[] parts = f.getname().split(" "); string strparts = new string(parts[0]); string finfilename = strparts.substring(2, strparts.length()); i'm not sure understand question, assume want extract "surname". if that's correct, please try this: string surname = csvfile.substring(csvfile.lastindexof("/") + 3, csvfile.lastindexof(" "));

Laravel: How to respond with custom 404 error depending on route -

i'm using laravel4 framework , came across problem. i want display custom 404 error depending on requested url. for example: route::get('site/{something}', function($something){ return view::make('site/error/404'); }); and route::get('admin/{something}', function($something){ return view::make('admin/error/404'); }); the value of '$something' not important. shown example works 1 segment, i.e. 'site/foo' or 'admin/foo' . if request 'site/foo/bar' or 'admin/foo/bar' laravel throw default 404 error. app::missing(function($exception){ return '404: page not found'; }); i tried find in laravel4 documentation nothing right me. please :) thank you! in app/start/global.php app::missing(function($exception) { if (request::is('admin/*')) { return response::view('admin.missing',array(),404); } else if (request::is('site...

vb6 - Converting VB 6 code to VB.NET -

i upgrading code vb 6 vb.net, , following code gives me error: (vb6.pixelstotwipsx(mvarpicture.clientrectangle.width) - (bdr + x), vb6.pixelstotwipsy(mvarpicture.clientrectangle.height) - (bdr + x)), mvarbordercolor, b the error is: error 6 end of statement expected. can me that? this full code: public sub draw() dim bdr, x short dim newx, newy double dim oldx, oldy double dim gridheight, gridwidth double dim mvarpicturebox system.windows.forms.picturebox on error goto nopicbox ' in case picbox isn't set yet 'upgrade_issue: picturebox property mvarpicturebox.autoredraw not upgraded. click more: 'ms-help://ms.vscc.v90/dv_commoner/local/redirect.htm?keyword="cc4c7ec0-c903-48fc-accc-81861d12da4a"' if mvarpicture.autoredraw = false mvarpicture.autoredraw = true 'upgrade_issue: picturebox method mvarpicturebox.cls not upgraded. click more: 'ms-help://ms.vscc.v90/dv_commoner/local/redirect.ht...

javascript - validation for two select box using array -

i have array 'a' this var = new array(); a[key] =a[value]; a['mpp']='mpp'; a['pdf']='pdf'; a['excel']='xls'; a['word']='doc'; a['ppt']='ppt'; a['html']='html'; i have 2 select box 1 docformat contains a[key] , extension contains a[value], on submit have validate 2 select box array , can please suggest help? one way using jquery function validate(){ var key = $("#select-key").val(), val = $("#select-value").val(); return key in && a[key] == val; } assuming a array , select boxes have ids select-key , select-value respectively. hope helps.

How to run multiple jQuery effects at same time -

i trying achieve this. there box. set hide() in jquery. has fade in, @ same time, has move length top bottom. whatever length top bottom, fade in effect should begin when box start moving top , fade effect may complete when box completes it's movement top. here tried; <div id="div1">div</div> and $("#div1").animate({"margin-top": 200,}); $('#div1').fadein("slow"); but 2 functions use different time. how can this? here working fiddle. thanks in advance... :) try doing both animations css in same animate call: http://jsfiddle.net/xhrbq/ $("#div1").animate({ 'margin-top': 300, 'opacity': 1 }, 1000);

java - trouble with local time -

i use these codes local time: dateformat dateformat = new simpledateformat("yyyy/mm/dd hh:mm:ss"); calendar currenddate = calendar.getinstance(timezone.getdefault()); system.out.print("last update: "+dateformat.format(currenddate.gettime())); or: dateformat dateformat = new simpledateformat("yyyy/mm/dd hh:mm:ss"); calendar currenddate = calendar.getinstance(gettimezone("gmt+3.5")); system.out.print("last update: "+dateformat.format(currenddate.gettime())); but non of them give local time, both giving me gmt problem? note: using eclipse , android programming, codes above correctly work in java in android not! instead of system.out.print() use textview show time textview date = (textview) findviewbyid(r.id.gold_textview1); date.settext("last update: "+dateformat.format(currenddate.gettime())); please me find problem try date currentdate = new date() instead of calendar object. system.out.print() ...

windows - Batch File Date Format not right -

i have following code checks log file specific string, , based on datestamp matching executes tasks. now code below works great on windows 7 machine date-time format of: yy-mm-dd hh:mm, executing exact same batch file on windows server 2008 date-time format of: yy-mm-dd hh:mm not work - suspect might date-time format... confirm if date-time format used in batch file work yy-dd-mm date format? also, if date time format in log file differs dat-time format of log file itself? code still work? for /f "tokens=2" %%a in ('findstr /i /c:"database ok" log.txt') set "success=%%a" %%a in (log.txt) set "filedate=%%~ta" if "%filedate:~0,10%"=="%success%" ( call another.bat ) else ( >>otherlogfile.log echo(%date% %time% database unsuccessful ) thank you update 1: c:\utilities\filter>for %a in (logfile.txt) set "filedate=%~ta" c:\utilities\filter>set "filedate=2013-07-31 21:31...

html - IE8 list formatting issue -

so have page bulleted items reason not coming in on ie8 should, can please steer me in right direction? http://careers.express-scripts.com/search?search=&category=&state=mo&csrf-token= thanks i don't have ie can't test instinct says might text-indent , padding on li's. you've got: #body_left ul li { font-family: helvetica,sans-serif; font-size: 13px; list-style: disc inside none; padding: 5px 0 5px 33px; text-indent: -1em; } but try: #body_left ul li { font-family: helvetica,sans-serif; font-size: 13px; padding: 5px 0; margin-left: 33px; }

mysql - How to show zero when no result is returned in grouped joined query -

i trying compact down number of queries on (php) mysql database , have following problem: for last 10 posted comments, show average comment rating , whether there image associated comment the mysql is: select obj_images.fk_obj_id has_images, avg(obj_rating) rating /*other joined tables obj_comments omitted clarity ...*/ obj_comments inner join obj_images on obj_comments.fk_obj_id=obj_images.fk_obj_id group obj_comments.fk_obj_id order comment_id desc limit 10 even when there no image associated comment, has_images still returns value, ideally want return 0 when there no images associated comment , 1 when there images associated it what missing? thanks tips use outer join , ifnull() instead of inner join. select avg(c.obj_rating) avg_rating ifnull(i.fk_obj_id, 0) has_images, /* ... */ obj_comments c left join obj_images on c.fk_obj_id = i.fk_obj_id group c.fk_obj_id order c.comment_id desc limit 10 also think declaring table aliases ...

java - storing a string into an array causes an ArrayIndexOutOfBoundsException error -

int x = 0; string[] qequivalent = {}; string s = sc.nextline(); string[] question2 = s.split(" "); (int = 0; < question2.length; i++) { system.out.println(question2[i]); x++; } //debug system.out.println(x); string s2 = sc2.nextline(); string[] answer = s2.split(" "); (int c = 0; c < answer.length; c++) { system.out.println(answer[c]); } //debug int y; string u = sn.nextline(); string[] t = u.split(" "); (y = 0; y < question2.length; y++) { (int w = 0; w < t.length; w++) { if (t[w].equals(question2[y])) { qequivalent[y] = "adj"; system.out.println(qequivalent[y]); break; } } } this line of codes have of now. when string in question2 found in string[] t, should store string "adj" in string[] qequivalent. can't ...

html - PHP Search Sub-Directory for a specific file -

i've been looking solution problem. have website has many files in many sub-directories (all in 1 main directory). need search function can search part of name of file , return back. need function not case sensitive (i.e. if file name caps , user searches lower case should still find file). function have below works 1 directory , not work recursively. please me modify code work multiple directories. <?php $dirname = "./office precedents/";//directory search in. *must have trailing slash* $findme = $_post["search"]; $dir = opendir($dirname); while(false != ($file = readdir($dir))){ //loop every item in directory. if(($file != ".") , ($file != "..") , ($file != ".ds_store") , ($file != "search.php")) { //exclude these files search $pos = stripos($file, $findme); if ($pos !== false){ $thereisafile = true;//tell script found. //display search results l...

sqlite3 - Consequences of -wal file disappearing in SQLite? -

if sqlite database using write-ahead logging interrupted un-checkpointed transactions (due power failure or whatever), reopened temporary -wal file missing, database open cleanly state of last checkpoint, or corrupted in way? we're trying sqlite working icloud (yes, know you're not supposed that, make windows , android app , need cross-platform database solution), , think wal provides potential way avoid having maintain 2 copies of our database - we'd keep -wal file outside of icloud store main database in it, avoiding problem of icloud backing rollback journals (or backing databases mid-transaction without journals). the file format documentation mentions "hot wal file", applies uncommitted data. the database file not contain information committed data in -wal file, i.e., transactions before checkpoint typically not alter main database file @ all. therefore, deleting -wal file restore database state after last checkpoint (which outdated, consi...

acceptance testing - Specflow Feature File Best Practice -

thanks in advance help. my question pertains best practices inside specflow feature file? question: is using wait command inside of feature file considered bad practice. example: and click on username , wait 5 seconds , input new value last name the wait command forces 5 second wait. doing make sure page loaded prevent "element not found" errors or other errors. make sure have clean page manipulate. would better practice use wait inside of step file itself? //using fluent automation i.waituntil(() => ()); //or i.wait(); //timespan my reasoning not using fluent automation wait is: by utilizing fluent automation method dependent on default timeout in settings object. default timeout in cases may not long enough or may long. seems verbose me continually change/reset settings object benefit being remove wait commands feature file. so best practice? thanks, -n i think best practice keep feature file scenarios, , free of implementati...

python - Use Javascript To Print Page As PDF (With Django) -

i need convert web page pdf because won't print/look correct if isn't converted. because web page big, html document browser try , split multiple pages (not vertically, fine, horizontally, bad). though planned on server side django, realized virtually of available libraries written python2, when using python 3. so other option client side. thing find on stackoverflow this: convert html ( having javascript ) pdf using javascript , of answers in java, not javascript. i think ideal solution change style more printer friendly rather making pdf. if have pdf created javascript, there's library jspdf http://parall.ax/products/jspdf out there creating pdfs javascript. have write on own parse page create matching pdf. if can use php, recommend using dompdf, written translate webpages pdfs, there less work involved there. https://github.com/dompdf/dompdf i've used library, , seems decent, though doesn't support css styling.

android - Is it idiomatic to call FEATURE_ACTION_BAR from code -

my question related activating actionbar in android app. more idiomatic getwindow().requestfeature(window.feature_action_bar) or more idiomatic force through theme using ? if you're asking "best practice" recommended google, take @ sample applications on developer's page. you'll notice don't see requestfeature() used. action bar default holo themes, in cases don't need address problem @ all. even if you're using new compatlibrary, should use theme. new action bar guide doesn't mention requestfeature() . edit: ah, demos did have use of this. however, "normally set activity's theme" , tell how instead. // action bar window feature. feature must requested // before setting content view. set automatically // activity's theme in manifest. provided system // theme theme.withactionbar enables you. use // use theme.notitlebar. can add action bar own themes // adding element <item name="android:window...

unit testing - Enforcing code standards in git before commit is accepted -

alright, here's scenario: team of developers wants ensure new code matches defined coding standards , unit tests passing before commit accepted. here's trick, of tests need run on dedicated testing machine , not have access modify git server must done using local commit hook on each dev machine. while specs pretty strict (we're not switching windows or subversion, example) real world problem there flexibility if have solution fits. we're using git , *nix. the updated code needs sent server run test suite. a list of modified files needs provided ensure match coding standard. its rather large codebase, should send smallest amount of information necessary ensure identical copies of codebase. if tests fail message needs displayed error , commit should blocked. assume trust our dev team , okay allow tests bypassed --no-verify option. the question: best way test server sync local environment run tests? sort of hash-to-hash matching git patch new commit? ski...

R roxygen2 Error in preref.parsers[[tag]] %||% parse.unknown: attempt to use zero-length variable name -

i intend use roxygen2 roxygenize() update package documentation after bit of work. have done in past. on instance encountered following error message: ==> roxygenize('.', roclets=c('rd', 'collate', 'namespace')) * checking changes ... error error in preref.parsers[[tag]] %||% parse.unknown : attempt use zero-length variable name i don't doubt have problem variable name somewhere , though don't know how locate source of error. r cmd check doesn't identify problems other collate , namespace issues mean use roxygen2 rectify... any appreciated. to track problem down systematically removed files , re-ran roxygenize() until no longer failed run through. having identified offending file, suggested, misplaced "@". this results in aforementioned error: #' @ export so fix misplaced space , problem solved: #' @export the difficult aspect locating typo.

php - ../ in relative URL not behaving as expected -

almost documentation can find tells me using " ../ " in relative urls goes 1 level current directory. so if in file @ " html/testing/new_version/admin/login.php " i use following relative url " ../images/fail.gif " server should looking fail.gif @ " html/testing/new_version/images/fail.gif " . but come file not found error. it's looking file in "html/images/fail.gif" why that? php setting of sort?

html - PHP error when trying to integrate facebook PHP SDK -

i’m new php , tying set page users can login using facebook php sdk , javascript sdk. keep getting fallowing error , don’t seem able find solution. saw similar post in here couldn’t give solution error. parse error: syntax error, unexpected t_string, expecting ',' or ';' in /homepages/9/d321009915/htdocs/kno_login/login.php on line 2 here code: <?php echo '<div id='fb-root'></div>'; require_once("facebook.php"); $config = array(); $config['appid'] = 'some id'; $config['secret'] = 'something here'; $facebook = new facebook($config); ?> <script> window.fbasyncinit = function() { fb.init({ appid : '293441190799565', // app id channelurl : '//www.reyesmotion.com/kno_login/channel.html', // channel file status : true, // check login status cookie : true, // enable cookies allow server access session xfbml : true // parse...

iis 7 - WMI access to IIS7 -

we have internal tool enumerates iis sites , applications server. uses code similar this: using (var servermanager = servermanager.openremote(servername)) { var site = servermanager.sites[sitename]; // slow // , starting enumerate applications incredibly slow foreach (var application in site.applications) { // ... } } the problem i'm having when sites collection accessed, response time slow when connecting server on our vpn. accessing applications site slower. theory slowness caused fact entire set of metadata sites sent on wire. however, need subset of site data. my theory if switched code using wmi queries, i'd able query specific fields concern application (like select name site ). unfortunately, when trying explore wmi objects in wmi cim studio, local iis 7.5, none of objects i'd expect present, site , application objects. i'm using root\webadministration namespace. does of wmi stuff work iis 7.5? ensured "iis 6 wmi ...

Client/server: how to synchronize UDP send and receive in C? -

i writing simple web server , client using udp , far: the programs can connect each other, the client can send request, the server can read request, the server can recognize client's ip address , client's port, , the server can send message client my problem client code gets stuck waiting in rcvfrom function, after server has sent response. here function supposed pick server message , return number of bytes read socket: ssize_t receive_from_server(rdp_socket *rsocket, char *buffer, size_t buf_len){ socklen_t sendsize = sizeof(rsocket->server_addr); bzero(&(rsocket->server_addr), sendsize); //stuck here: return recvfrom(rsocket->sockfd, buffer, buf_len, 0, (struct sockaddr*)&(rsocket->server_addr), &sendsize); } i set sockopts both so_sndtimeo , so_rcvtimeo timeout after few seconds. question: in short term future adding acknowledgements (acks) reliable data transfer. imagine missing acks issue i'm wonderi...

ruby - Did Rails Routing change the way it handles the params[:path]? -

i upgraded site ruby 1.8.7 ruby 1.9.2, , rails 3.0.x 3.2.x. noticed of legacy urls weren't being handled correctly anymore, , wanted diagnose issue. here's noticed. http://myapp.com/links/oldlink.html had, in old app, provided params[:path] of /links/oldlink.html , now providing links/oldlink . it's dropping leading forwardslash file extension. can me figure out what's going on here? of course can manually change legacy strings in database drop forward slashes , file extensions, seems hacky solution, , want make sure understand underlying principles account change in rails routing behavior. thanks! you should try in routes.rb match '/foo', :to => redirect('/foo.html')

python - A way to show/hide a field on Django -

i have list display in django admin list_display = ('product', 'price', 'purchase_date', 'confirmed', 'get_po_number', 'notes') in models.py: class purchaseorder(models.model): notes = models.textfield( null=true, blank= true) this looks here: [1]: http://i.imgur.com/zykmpof.png ' as can see 'notes' take lot of room, there way can view/hide field click of button? instead of doing button, can resize field become smaller. class purchaseadmin(admin.modeladmin): formfield_overrides = { models.charfield: {'widget': textinput(attrs={'size':'20'})}, models.textfield: {'widget': textarea(attrs={'rows':4, 'cols':40})}, } admin.site.register(purchaseorder, purchaseadmin) if want have button, can use custom inline class define fields: class custominline(admin.tabularinline): readonly_fields = [...'link',...] # important part def...

c# - asp.net report viewer error basics : operation not allowed -

i'm trying handle on basics of report viewer control in asp.net webforms project c#. i'm using adventure work reports feel basics. i have report called salesordernumber under report parts on sql server i want able view @ point if (!page.ispostback) { // set processing mode reportviewer remote reportviewer1.processingmode = processingmode.remote; serverreport serverreport = reportviewer1.serverreport; // set report server url , report path serverreport.reportserverurl = new uri("(!removed!"); serverreport.reportpath = "/report parts/salesordernumber"; // create sales order number report parameter reportparameter salesordernumber = new reportparameter(); salesordernumber.name = "salesordernumber"; salesordernumber.values.add(...

graphics - Old 8 bit retro video emulation - sprite drawing -

i'm trying understand how sprites drawn onto scanlines of example vdp 9929a graphics chip, emulation. there limit of 4 sprites per scanline, mean cannot have more 4 sprites same y coordinate? if cascade them draw 32 sprites on each line below 1 , 1 pixel right of each other overlapping each other, result in centre of 16 sprites being drawn on same line. still drawn correctly not scanline relating starting y coord. hope i'm making sense. thanks in advance. there can no more 4 sprites on single scanline; additional sprites' horizontal pixels dropped. sprites higher priority drawn first. in other words, each line, chip draw 4 sprites highest priority exist on line, not start on line. 1111 3333 5555 1111 2222 3333 4444 5555 6666 1111 2222 3333 4444 5555 6666 1111 2222 3333 4444 5555 6666 2222 4444 6666 ....where 1 highest prio, scan line 1 draw sprite 1,3,5, scan line 2-4 draw 1,2,3,4, scanline 5 d...

ActionListener works perfectly after second time it's pressed -

entercommand.addactionlistener(new actionlistener() { public void actionperformed(actionevent event) { string userinput = enterword.gettext(); string userinput2 = entersecondword.gettext(); if (" ".equals(userinput) || " ".equalsignorecase(userinput2)) { joptionpane.showmessagedialog(null, "the space empty please try again"); } else { enterword.settext(" "); entersecondword.settext(" "); system.out.println("test"); japanesestudiesexcel je = new japanesestudiesexcel(); je.japanesestudiesexcel(userinput, userinput2); } ; } }); it checks input in fieldbox second time listener fired, first time not work. better explain this, when user enters nothing doesn't check empty string writes empty box excel. second time actionlistener fired...