Posts

Showing posts from January, 2015

javascript - convert an image server side to CanvasPixelArray -

edit so looks have somehow convert image to https://developer.mozilla.org/en/dom/canvaspixelarray serverside my current attempts have been * pass base64 encoded image server ... converting binary atob() but stuck trying draw onto canvas without having like var = new image(); i.onload = function(){.....} i.src = "base64 string" so more general statement i trying bypass creating image object means display new image if goal avoid use of javascript , embed image in page, can do <img src="data:image/png;base64,uhhiaminbase64..."> if base64 obtained dynamically in ajax, way use decoding library create image object code made. an alternate solution send directly rgb values in binary array (base64 encoded if use json) , iterate client-side on array in order change canvas' imagedata. seems easy enough inefficient wouldn't have compression of png or jpeg.

android - Location network service -

i developing app display details on network provider, got errors can me clear it? logcat-file: d/androidruntime(308): shutting down vmw/dalvikvm(308):threadid=1: thread exiting uncaughtexception(group=0x4001d800) e/androidruntime(308): fatal exception: main e/androidruntime(308): java.lang.runtimeexception: unable instantiate activity componentinfo{com.locationtest/com.locationtest.locationtestactivity}: java.lang.nullpointerexception e/androidruntime(308):at android.app.activitythread.performlaunchactivity(activitythread.java:2585) e/androidruntime(308):at android.app.activitythread.handlelaunchactivity(activitythread.java:2679) e/androidruntime(308):at android.app.activitythread.access$2300(activitythread.java:125) e/androidruntime(308):at android.app.activitythread$h.handlemessage(activitythread.java:2033) e/androidruntime(308):at android.os.handler.dispatchmessage(handler.java:99) e/androidruntime(308):at android.os.looper.loop(looper.java:123) e/androidruntime(308)a...

Is it possible to debug JavaScript code in Visual Studio without running a browser? -

visual studio, @ least in v2012, supposed have first-class support javascript. however, haven't found "javascript project type", js not listed top-level language in file > new project dialog etc. javascript is, or @ least starting be, more scripting language web apps i'm wondering if there way / plugin / extension visual studio allow me type in javascript , execute language construct (e.g., on node console), not part of asp.net web application. vs2012 have support javascript, not in "pure js project" sense. if you're running vs2012 rc on win8 release preview, should see project types windows 8 metro style applications implemented javascript. these types of projects not available create on win7 , below (because run on win8). if you're working js inside web application projects, asp.net projects, etc. you'll see new rich features javascript editing , debugging.

PHP remove (conditional) duplicate row in text -

$string = "apple foo banana ... banana foo other text ... apple"; i have text single rows duplicated after row "...". the rows before , after can ("foo"), duplicate (without "..." "apple"). the "..."-row can appear multiple times without duplicate row after it. i want remove duplicated rows have "..." row inbetween. in other words: remove line after "..." if it's same above "..." how can match banana ... banana to remove duplicated row: banana so result is $string = "apple foo banana ... foo other text ... apple"; cheers! if task remove line following line 3 dots: echo preg_replace("/^(.+?)\r?\n(\.{3})\r?\n\\1/m", "\\1\n\\2", $string); the expression matches: a whole line comprising @ least 1 character (1) three dots on single line (2) a whole line comprising @ least 1 character (1) the /m modifier used select mult...

sql - WHERE clause returning incorrect records -

i'm using this declare @year_filter_start datetime set @year_filter_start = dateadd( dd, -1, dateadd( yy, datediff( yy, 0, getdate() ), 0 ) ) declare @year_filter_end datetime set @year_filter_end = getdate() insert table ( blah ) select blah other_table actissuedate null or actstartdate between @year_filter_start , @year_filter_end and it's returning records actissuedate not null , actstartdate not between year start , today. @year_filter_start supposed beginning of year, @year_filter_end supposed today. for example: a record actstartdate 2010-08-02 , actissuedate 2011-03-15 or actstartdate 2009-05-18 , actissuedate 2009-09-06 is there wrong statement? try following, need few more parentheses think: where ((actissuedate null) or (actstartdate between @year_filter_start , @year_filter_end)) the engine sees 2 statements way have it. need make one.

html - How to align two spans together ? -

i'm having problems aligning 2 spans together. second span starts lower first 1 causing mis-alignment of spans. essentially i'm trying align .cbtnsymbol , .cbtnlabel starting @ same height. here testcase: http://jsfiddle.net/dwgea/ here go: http://jsfiddle.net/dwgea/19/ just add line-height: 30px; vertical-align:middle; .cbtnlabel

ios - Coreplot: Setting length of global range not working -

to start with, have graph(coreplot linechart). have set x-range , y-range of defaultplotspace of graph. - (void) setupxrangeforplotspace:(cptxyplotspace *) plotspace { int rangelength = [self xrangelength]; plotspace.xrange = [cptplotrange plotrangewithlocation:cptdecimalfromfloat(- 0.5f) length:cptdecimalfromfloat(rangelength + 1.0)]; } - (void) setupyrangeforplotspace:(cptxyplotspace *) plotspace { float maxvalue = [self maximumyvalue]; // length = maxvalue + (10% of maxvalue); plotspace.yrange = [cptplotrange plotrangewithlocation:cptdecimalfromfloat(0.0f) length:cptdecimalfromfloat(maxvalue + (maxvalue/10.0))]; } now task show portion (region) of graph along x-axis according user interaction. changing globalxrange of plotspace. i took 2 textfields getting location , length. btnaction: method fired when button pressed. - (void) btnaction:(id) sender { float txt1fl = [txt1.text floatvalue]; float txt2fl = [txt2.text floatvalue]; nsl...

vbscript - Authenticating user via active directory groups in classic ASP -

we have security set intranet site follows through active directory. first have security groups department (sales, accounting, etc.) second have ad security group intranet site people logon via nt challenge/response. purpose let's call group "intranet users" under intranet users, i've added departments allowed use intranet. so in ad have intranet users , members of group sales , accounting. what need in classic asp authenticate user against groups under intranet users. i dug old code used elsewhere can't work , unless google-fu of topic terrible (a distinct possibility) can't find proper documentation of doing in classic asp. this code group enumerate objects within if it's user, not group. bauthuser = false set objgroup = getobject("winnt://domain/intranet users") each objmember in objgroup.members if objmember.class = "user" if objmember.name = request.servervariables("auth_user") bauthuser...

Spring Batch - No bean named 'job-configurations' is defined -

i using custom mvc application has dependencies on spring batch described in documentation, , assisted question integrating spring batch admin existing application . the trouble web-app starts map various urls appropriate controller job-configurations step bombs out. 2012-06-04 10:17:54,966 info [org.springframework.web.servlet.handler.simpleurlhandlermapping] - <mapped url path [/resources/**] onto handler 'org.springframework.web.servlet.resource.resourcehttprequesthandler#0'> 2012-06-04 10:17:55,512 info [org.springframework.ui.freemarker.springtemplateloader] - <springtemplateloader freemarker: using resource loader [webapplicationcontext namespace 'admin-servlet': startup date [mon jun 04 10:17:54 edt 2012]; parent: root webapplicationcontext] , template loader path [/web-inf/web/]> 2012-06-04 10:17:55,512 info [org.springframework.ui.freemarker.springtemplateloader] - <springtemplateloader freemarker: using resource loader [webapplicationcon...

add operation on a pointer value C -

i'm having problems trying create assembly emulator program in c. there 5 registers: rega, regb, regc, regx , insp, , 10 instructions: nop, set, , (bitwise &), or (bitwise |), add, sub, shl(<< left), shr(>>), jmp. the program reads instructions file; lines containing instruction , 2 arguments. in cases 1st argument register name (e.g. rega) , 2nd argument can register name or integer. i'm using sscanf instructions file. i'm having trouble add, sub, shl , shr functions. add function is: int opcode_add(char* opcode, char *arg1, char *arg2){ int i, j; for(i = 0; < max_register; i++){ if (strcmp(register_str[i],arg1) == 0){ for(j = 0; j <=max_register; j++){ if(strcmp(register_str[j],arg2) == 0){ *register_ptr[i] = *register_ptr[i] + *register_ptr[j]; break; }else { *register_ptr[i] = *register_ptr[i] + atoi(arg2); ...

How to consume image upload data as byte[] using Spring MVC 3 -

i need write image data in particular directory on server side getting null raw byte[] image upload data trying send html form , jquery ajaxuploader plugin here . following snippet controller using handle raw bytes of image being uploaded: @requestmapping(value = "uploadimage", method = requestmethod.post) public void uploadimage(byte[] uploaddata, writer writer, httpservletrequest request) throws ioexception, jsonexception { //uploaddata turning out null //.. } @initbinder protected void initbinder(servletrequestdatabinder binder) { binder.registercustomeditor(byte[].class, new bytearraymultipartfileeditor()); } i have got following configured in spring configuration file handling uploads: <bean id="multipartresolver" class="org.springframework.web.multipart.commons.commonsmultipartresolver"> </bean> i using spring mvc 3. guide me on how send raw bytes of upload data? thanks. first, if you'...

Building R (cran) + rpy2 on ubuntu -> libRblas.so not found -

i trying build r (tried 2.14.2 , 2.15) , rpy2 (2.2.6, python 2.7.1) on ubuntu (11.04, natty narwhal), deploy custom directory (in following called /home/me/lib/r), since not have root access, need newer version available on server. details of build etc further down, when running tests of rpy2, following error: /home/me/lib/pythonlib/lib/python/rpy2/rinterface/__init__.py in <module>() ---> 87 rpy2.rinterface._rinterface import * importerror: librblas.so: cannot open shared object file: no such file or directory warning: failure executing file: <experiments/arrangement/test_smacof_arrange.py> i sure calling right rpy2 module (my custom built one) has been built against custom built r version. doing following: i first build r-base on ubuntu wget http://cran.r-project.org/bin/linux/ubuntu/natty/r-base_2.14.2.orig.tar.gz # untar , go directory # enable-r-shblib flag needed rpy2 linking, enable-blas-shlib included # because hoped solve problem, doesnt change ....

android - How can I get the image path of an image inside an image view? -

i have set scaled image in image view. want path of scaled image. possible? heard stored somewhere in internal memory. update: i have problem: have set set image gallery in imagview. want save state (that means image in image view). how can that? i thought saving entire image blob sql database. heard should rather take image path. can tell me how can this? this how image gallery , how set in imageview. @override public void onactivityresult(int requestcode, int resultcode, intent data) { if (resultcode == result_ok) { if (requestcode == pick_from_file) { uri selectedimageuri = data.getdata(); selectedimagepath = getpath(selectedimageuri); log.v("image path====>>>> ",selectedimagepath); // decode, scale , set image. bitmap mybitmap = bitmapfactory.decodefile(selectedimagepath); bitmap scaledbitmap = bitmap.createscaledbitmap(mybitmap, new_width, new_height, true); ...

wxwidgets - wxWindows 2.9 binary for windows -

after upgrade new haskell platform, existing wxhaskell programs broken. seem require wxwidgets 2.9, can't find binary versions. wxpack has 2.8, , beyond 1 has compiler , build locally see. there tutorials on various sources, each few pages long, various advice on setup, changing configurations, etc. install wxconfig, install mingw compilers, setup configurations, rebuild, etc. is there source of simple binary install? i'd hope simple apt-get or cabal tool, haskell library tools (on windows?) seem less integrated others i'm familiar with. (update) did install , compile wxwidgets locally, , still cannot wxhaskell components install. i'm sure of requires simple details, again after time already, hope not have spend lot more time on this, , wish more automated! configuring wxc-0.90.0.3... configuring wxc build against wxwidgets 2.9 setup.exe: missing dependencies on foreign libraries: * missing c libraries: wxmsw29ud_all, wxtiffd, wxjpegd, wxpngd, wxzlibd, wx...

How can I implementing sliding, overlay views on Android? -

i working on pdf reader application. when user touches screen, 2 toolbars slide view, overlaid on top of pdf. there 1 toolbar @ top of screen , 1 @ bottom, slide in off-screen when touched. best way go implementing this? i've been having trouble finding code examples similar. help. i wrote post time ago how implement kind of full screen top , bottom bar. maybe it's useful you: http://miguelrodelas.com/web/2011/12/17/full-screen-in-android/

java ee - Injecting no-interface ejb in a different ear -

i have no-interface ejb deployed in ear (myear.ear) @stateless @localbean public class myservice{ // stuff } the ear deployed jboss-6.0.0.final i confirmed jndi name server jmx console: myear/myservice/no-interface i'm trying reference ejb ejb in war (outside ear) in same server: @ejb(mappedname = "myear/myservice/no-interface") private myservice myservice; i'm referencing ear project war project in eclipse, , compilation successful. i keep getting classnotfoundexception exception when deploying war: java.lang.classnotfoundexception: eg.com.test.myservice why ejb in war not seeing ejb other ear? edit : updated follwing remote interface @remote public interface myserviceremote{ // stuff } ejb @stateless public class myservice implements myserviceremote{ // stuff } ejb reference in different application @ejb(mappedname = "myear/myservice/remote") private myserviceremote myservice; i verified new jndi name on server: myea...

c# - Change column style depending of source -

i trying populate datagrid 1 column combobox need when collection binded combobox empty column becomes textbox column. have defined columns below: binding binding = new binding("datacontext.prices"); binding.relativesource = new relativesource(relativesurcemode.findancestor, typeof(usercontrol),1); datagridcomboboxcolumn productprices = new datagridcomboboxcolumn() { elementsyle = new style { targettype = typeof(combobox), setters = { new setter { property=combobox.itemssourceproperty, value= binding } } }, editingelementsyle = new style { targettype = typeof(combobox), setters = { new setter { property=combobox.itemssourceproperty, value= binding } } }, displaymemberpath = new binding("price"); selectedvaluepath = new bindnt("price...

knockout.js - Can the Knockout Concurrency plugin track newly added or deleted rows? -

i'm trying use knockout concurrency plugin in project, , i'm fiddling example code, i'm not getting work: https://github.com/andersmalmgren/knockout.concurrency/wiki/getting-started viewmodel = function() { this.name = ko.observable("john").extend({ concurrency: true}); this.children = [{ name: ko.observable("jane").extend({concurrency: true })}, { name: ko.observable("bruce").extend({concurrency: true })}]; this.getdata = function() { //simulate backend data var data = { name: "john doe", children: [{ name: "jane doe"},{ name: "bruce wayne"}, { name: "new row"}]}; new ko.concurrency.runner().run(this, data); } } ko.applybindings(new viewmodel()); http://jsfiddle.net/rcvk4/3/ nothing happens , newly added item not tracked plugin, know why? thanks trying out plugin, fast too, uploaded code today! the plugin indeed support tracking of del...

java - Preview with editing before printing -

how organize preview before printing, document in preview can edited? for example, print shows table of 3 columns in preview want change in 1 (not three, @ first) column, clicked mouse in right place, change text, press enter, modified text should preserved , print, continue next time print plaque earlier changes. what libraries better suited task, there may similar examples or tutorials http://docs.oracle.com/javase/tutorial/uiswing/ take jtable

C# how to force generic argument to be type -

i have generic method. want generic method limit 1 type. problem derived type not allowed - not want this. example codes: public static t generate<t>(t input) t : operation // allows binaryoperation - not want { //... } how request? problem derived type not allowed there no way enforce constraint, without checking @ runtime. doing violation of liskov substitution principle , states type should allow pass in derived type without restriction. if must enforce this, work runtime check, like: public static t generate<t>(t input) t : operation // allows binaryoperation - not want { // checks see if "operation" (and not derived type) if (input.gettype() != typeof(operation)) { // handle bad case here... } // alternatively, if want not allow "binaryoperation", can do: if (input binaryoperation) { // handle "bad" case of binaryoperation passed in here... } } not...

android - Spinner with different view for each item -

i try make spinner first item in dropdownview has no radio button. override viewtypes of arrayadapter make sure there 2 different views in spinner , views don't recycled wrong item. override getdropdownview of arrayadapter remove radio button first item. working, selected item doesn't show radio button. think wouldn't have setcheckmarkdrawable(android.r.drawable.btn_radio), because should there, not case. ideas? thank you! @override public int getviewtypecount() { return 2; } @override public int getitemviewtype(int position) { if (position == 0) return 0; else return 1; } @override public view getdropdownview(int position, view convertview, android.view.viewgroup parent) { if (position == 0) { view vw = super.getdropdownview(position, convertview, parent); ...

java - Upgrade to Hibernate4 and @ElementCollection results in inability to lookup existing data -

Image
we have model class user had list<string> of permissions, so: @lazycollection(lazycollectionoption.false) @collectionofelements @column() private list<string> permissions = collections.emptylist(); it produced sql table entry following: we upgraded hibernate 4, , @collectionofelements annotation has gone deprecated removed, figured time move on @elementcollection , so: @lazycollection(lazycollectionoption.false) @elementcollection // << changed @column() private list<string> permissions = collections.emptylist(); upon launching, however, unable log in our administrative account. curious, examined database using h2's jar, , found table had been altered: my questions: is there comprehensive list of ddl/schema changes old @collectionofelements new @elementcollection ? is there recommended practice, or additional annotation can provide these properties, ensure backwards compatibility? (can specify specific name-mapping scheme or colu...

python - How to mock out a function that's returned from getattr? -

i have class like: class myclass(object): def __init__(self, delegate_to): self._delegate_to = delegate_to def __getattr__(self, item): return getattr(self._delegate_to, item) but when try like: my_mock = self.mox.createmock(myclass) my_mock.f().andreturn(none) mox errors with: unknownmethodcallerror: method called not member of object: f how mock out delegated calls? hacky, try: class mymock(myclass): def f(): pass then in test: my_mock = self.mox.createmock(mymock) my_mock.f().andreturn(none)

javascript - Drawing squares 1 miles x 1 mile -

i using google maps api v3 draw squares of 1 mile 1 mile. problem: api reference , bounds property can used define size of rectangle object, in terms of latlng coordinates. given particular point's latlng, how can draw rectangle 1 mile 1 mile, or 1 km 1 km? update: trying divide state philadelphia 10 mile 10 mile squares. not need precise. you should keep in mind earth's surface curved; impossible divide squares. squares make google map longer on bottom on top. make map more complicated.

android - Why is my SimpleOnGestureListener not functioning? -

i'm using own gesturedetector class detect left|right onfling event. see looks in code nothing happens...? i need added functionality beyond toggle button opens|closes navigation view in fragments. toggle calls on method in animationlayout class follows: public void togglesidebar() { if (mcontent.getanimation() != null) { return; } if (mopened) { /* opened, make close animation */ manimation = new translateanimation(0, -msidebarwidth, 0, 0); manimation.setanimationlistener(mcloselistener); } else { /* not opened, make open animation */ manimation = new translateanimation(0, msidebarwidth, 0, 0); manimation.setanimationlistener(mopenlistener); } manimation.setduration(duration); manimation.setfillafter(true); manimation.setfillenabled(true); mcontent.startanimation(manimation); } and... public void opensidebar() { if (!mopened) { togglesidebar(); } } public void closesidebar() { if (mopened) { togglesidebar(); } } ...

c# - Changing the CSS in code behind asp.net -

in aspx page have div.. <div id="downloadableproducts" runat="server"><a href="#">downloadedable products</a></div> i trying change css in code behind this.. downloadableproducts.style("display") = "none"; but not work, error , red underline under downloadableproducts in code behind , says 'the name 'downloadableproducts' not exist in current context ' what doing wrong? you need add runat="server" div , access htmlcontrol in codebehind. example: htmlcontrol div1 = (htmlcontrol)page.findcontrol("downloadableproducts");

loops - bat file to read one line at a time and execute a command and then move to next line -

im writing bat file , need read txt file 1 line @ time , execute command each time , move next line , execute same command again. have text file 30 ip addresses in it, want bat read first one, execute command on it, write output seperate txt file , move line 2, execute command , write output txt file, line 3 , forth, me this? dont mind if want me use vbscript please explain dont understand vbscript :( please i'm desperate i'm intergrating tool in order run audit i'm doing , need help you don't need vbscript such simple task, if ip.txt file ip-adresses in in .bat or .cmd put echo off ::to write result separate files /f %%a in (ip.txt) ping -n 1 %%a>%%a.txt ::to write result 1 file /f %%a in (ip.txt) ping -n 1 %%a>>output.txt replace %% % if give commands @ console

c# - Displaying WebView in Outlook 2007 -

Image
i using addin express 2010 , , want develop web pane view when user clicks on folder . i able in outlook 2003 . the same installer not display same view outlook 2007. 1 year technical support addin express has expired, cant post forum. then looked outlook object model , set webview true, still not see webpane. there similar question @ outlook 2010 add-in build custom webviewpane without add-in express . in case have addin express 2010 , outlookspy. any ideas on how show webview can displayed in outlook 2007 / outlook 2010 . so answering own question. the reason can found here - you cannot add url address box on home page tab in outlook 2007 . i have changed registry key, , here screenshot in outlook 2007.

Layout blurry/low quality when jQuery mobile on android using phonegap -

i'm using phonegap , jquery mobile develop android application. in browser, pages fine, when run app on device (=in webview), pages cheap , kind of... off. if page zoomed 101% or that. has else run problem? idea how fix it? have tried adding target-densitydpi=device-dpi value viewport meta tag in </head> of page this: <head> <meta name="viewport" content="width=device-width, target-densitydpi=device-dpi" /> ... </head> that should trick; hope helps!

concurrency - Volatile in java -

as far know volatile write happens-before volatile read , see freshest data in volatile variable. question concerns term happens-before , take place? wrote piece of code clarify question. class test { volatile int a; public static void main(string ... args) { final test t = new test(); new thread(new runnable(){ @override public void run() { thread.sleep(3000); t.a = 10; } }).start(); new thread(new runnable(){ @override public void run() { system.out.println("value " + t.a); } }).start(); } } (try catch block omitted clarity) in case see value 0 printed on console. without thread.sleep(3000); see value 10. case of happens-before relationship or prints 'value 10' because thread 1 starts bit earlier thread 2? it great see example behaviour of code , without volatile variable differs in every program start, because result of code above de...

ruby - Rails way to write abstracted DateTime calculated SQL condition -

i trying write proper rails abstracted sql statement equivalent to: select * model date_sub(date_field, interval 7 day) < curdate() while know can write string sql in rails executed, nice able write in abstract way keeps code database platform agnostic. it's quite simple, in fact: model.all( :conditions => [ "date_field between ? , ?", 7.days.ago, date.today ]) and have it.

arrays - C code Error: free(): invalid next size (fast): -

this question has answer here: facing error “*** glibc detected *** free(): invalid next size (fast)” 2 answers i got error code, i'm not sure fix it. here's explanation of code does: i'm writing code read input file , store each line object (char type) in array. first line of input file number. number tells me how many lines should read , store in array. here's code: int main(int argc, char *argv[]){ file *fp; char **path; int num, i; ... /*after reading first line , store number value in num*/ path = malloc(num *sizeof(char)); ... free(path); } after running code, this *** glibc detected *** free(): invalid next size (fast): i have searched around , know malloc/free error, don't know fix it. great. thanks! path = malloc(num *sizeof(char)); this wrong. path pointer pointer char, need allo...

redhat - Glassfish bundle in unexpected state exception -

so, basicly: there standalone (no cluster) new installation of glassfish 3.1.2 on rhel 6.2 , java 6 without deployed applications (really new installation). i started default domain domain1 on server first time , stopped without done between start/stop. when start domain again, t following error: waiting domain1 start ...error starting domain domain1. server exited prematurely exit code 1. before died, produced following output: launching glassfish on felix platform 04.06.2011 18:27:47 bundleprovisioner update info: updated bundle 1 /home/glassfisfusr/glassfish3/glassfish/modules/endorsed/jaxb-api-osgi.jar 04.06.2011 18:27:47 bundleprovisioner update info: updated bundle 2 /home/glassfisfusr/glassfish3/glassfish/modules/endorsed/javax.annotation.jar 04.06.2011 18:27:47 bundleprovisioner update info: updated bundle 3 /home/glassfisfusr/glassfish3/glassfish/modules/endorsed/webservices-api-osgi.jar 04.06.2011 18:27:47 bundleprovisioner update skipped 04.06.2011 18:27:...

c# - How to redirect all errors, including 404 -

i'd errors go same error page. did try error tag statuscodes. works fine i'd rather not have specify statuscodes , still have every error go 1 page. problem if remove statuscode entries, 404 goes server's 404 page , not error page. is there way configure errors go same page? if understand well, need send errors custom error page, , errors iis7 gives (not program) this need setup on ii7, can setup web.config (but give instructions ii7) here example <configuration> <system.webserver> <httperrors errormode="detailedlocalonly" defaultresponsemode="file" > <remove statuscode="500" /> <error statuscode="500" prefixlanguagefilepath="c:\contoso\content\errors" path="500.htm" /> </httperrors> </system.webserver> </configuration> reference: http://www.iis.net/configreference/system.webserver/ht...

jquery - Is there a way to redirect a page on the iPad with javascript without getting the popup warning -

i need redirect file new tab if site being viewed on ipad. have following code in place... if(ismobile.any()) { window.open(_filename); } else { //code display file in current window or tab on computer } this works fine ipad sees popup , either blocks or throws warning dialog not acceptable client. understand there no way avoid issue using window.open. if, on other hand, user clicks link opens file in new tab not seen popup ipad , no block or warning. thought this... if(ismobile.any()) { var markup = "<a class='clickme' href="+_filename+" target='_blank'>click me</a>"; $('.myviewer').append(markup); $('.clickme').click(); } else { //code display file in current window or tab } while works on computer not work on ipad. in thread told should not working on computer, does. if there someway trigger event on ipad avoid popup blockers wrath.

Amazon Hadoop EMR & custom input file format -

i having bit of trouble getting amazon emr accepting custom inputfileformat: public class main extends configured implements tool { public static void main(string[] args) throws exception { int res = toolrunner.run(new jobconf(), new main(), args); system.exit(res); } public int run(string[] args) throws exception { path inputpath = new path(args[0]); path outputpath = new path(args[1]); system.out.println("input path: "+inputpath+"\n"); system.out.println("output path: "+outputpath+"\n"); configuration conf = getconf(); job job = new job(conf, "processdocs"); job.setjarbyclass(main.class); job.setmapperclass(map.class); job.setreducerclass(reducer.class); job.setmapoutputkeyclass(text.class); job.setmapoutputvalueclass(text.class); job.setinputformatclass(xmlinputformat.class); textinputf...

delphi - IShellFolder with async EnumObject (SHCONTF_ENABLE_ASYNC) -

i'm having pretty abnormal work in application. i'm using following code enumerate namespaces , root namespaces - such nethood work pretty slow - on 1 minute load (!!) happens on win7, on older system loading ok. i'm using functions, mustangpeak library: function tnamespace.enumeratefolder(messagewnd: hwnd; folders, nonfolders, includehidden: boolean; enumfunc: tenumfoldercallback; userdata: pointer): integer; var enum: ienumidlist; flags: longword; fetched: longword; item: pitemidlist; terminate: boolean; olderror: integer; oldwow64: pointer; begin result := 0; olderror := seterrormode(sem_failcriticalerrors or sem_noopenfileerrorbox); try if assigned(shellfolder) begin if assigned(enumfunc) begin terminate := false; flags := 0; if folders flags := flags or shcontf_folders; if nonfolders flags := flags or shcontf_nonfolders; if includehidden flags := f...

windows - git thinks files have changed -

i did work on project on 1 machine, pushed github and, on machine, cloned , did work, pushed. went first machine , did pull . first machine thinks files in project changed. i've tried git checkout -f -- and git rm --cached -r . git checkout -f and tried git stash but no matter do, git status tells me files have been changed. how make stop? this seems line-ending/autocrlf issue. great trick realized fixing (if index doesn't matter) is: $ git add -u . $ git reset .

c# - Controlling read/write access to fields -

suppose separate out read , write access in interface pattern below. namespace accesspattern { namespace readonly { public interface ia { double get_a(); } } namespace writable { public interface ia : readonly.ia { void set_a(double value); } } } this easy implement: namespace accesspattern { namespace readonly { public class : ia { protected double a; public double get_a() { return a; } } } namespace writable { public class : readonly.a, ia { public void set_a(double value) { base.a = value; } } } } suppose need class inherits , go ahead , define interface it: namespace accesspattern { namespace readonly { public interface ib : readonly.ia { int get_b(); } } namespace writable { public interface ib : readonly.ib, writable.ia { void set_b(int value); } } } implementing not easy. 1 fe...

javascript - adapting a click-to-insert by substituting alternate text -

i trying adapt script: jquery example: inserting text drag n’ drop . the goal users click image thumbnail , have appropriate markdown image code inserted textarea. i not familiar js, aware meat of script happening here: $('#clickwordlist li').click(function() { $("#txtmessage").insertatcaret($(this).text()); return false }); specifically, .text() bit there, not know how alter output suit needs snippet of markdown being inserted rather just, say, list text. markdown inline image syntax looks this: ![alt text](/path/to/img.jpg) i tried changing list div images , changing .insertatcaret($(this).src); "undefined" insertion text. $(this).src undefined because $(this) jquery object , , jquery objects don't have src property. assuming have image element in selector, can try: $("#txtmessage").insertatcaret($(this).attr('src')); the .attr() jquery method, when given 1 parameter, return matched e...

mysqli - Send member reminder based on their last login SQL statement -

member table columns [id, email, join_date] member login table columns [m_id, date] every time user logs in, new row created in member login table. i trying send them email reminder when have not logged in 30 days. stuck trying list of users [email addresses], tables listed, based on last time logged in. any appreciated. select distinct members.email, max(member_login.date_login) members inner join member_login on members.id = member_login.m_id group members.email having max(member_login.date_login) < curdate - interval 30 days

python - Django Integer and Decimal field multiplication -

i'm trying figure out how multiply decimal field value integer field value. here model: class orderitem(models.model): order = models.foreignkey(order, editable=false) product = models.foreignkey('products.product') qty = models.integerfield() original_price = models.decimalfield(max_digits=20, decimal_places=2) sale_price = models.decimalfield(max_digits=20, decimal_places=2) tax = models.decimalfield(max_digits=20, decimal_places=2) total = models.decimalfield(max_digits=2, decimal_places=2, null=true, blank=true, editable=false) total_tax = models.decimalfield(max_digits=2, decimal_places=2, null=true, blank=true, editable=false) picked = models.integerfield(null=true, blank=true) user = models.foreignkey('auth.user', editable=false) created = models.datetimefield(auto_now_add=true) modified = models.datetimefield(auto_now=true) i'm trying multiple "sale_price" column "qty" column f...

PHP excluding specific variable values from foreach statement -

i trying exclude fields form being required. entire array payment runs through each statement. trying keep fields extra, extra2 , extra3 being required. can set null or defined whatever string if empty. have currently: foreach($p $key => $value) { $value = trim($value); if($value == '') { $keyname = preg_replace('/([a-z])/', " $1", $key); $this->_errors['payment ' . $keyname] = __('payment ','cart66') . $keyname . __(' required','cart66'); $this->_jqerrors[] = "payment-$key"; } this have tried, no avail: foreach($p $key => $value) { $value = trim($value); if($value == '' && $p != 'extra' || 'extra2' || 'extra3') { $keyname = preg_replace('/([a-z])/', " $1", $key); $this->_errors['payment ' . $keyname] = __('payment ','cart66') . $keyname . __(' requ...

ajax - get selected value from selectOnemenu using javascript in primefaces and open a dialog box -

how can selected value of primefaces <p:selectonemenu> using javascript/jquery? i trying way, not go inside if condition, means id of element not correct. <h:head> <script> function showdialog() { alert("insdie function"); if($('#someselect').val() == 'india') { dlg.show(); alert("after function"); } alert("outside function"); } </script> </h:head> <h:body> <h:form> <p:panel> <h:panelgrid columns="2"> <p:selectonemenu id="someselect" value="#{testcontroller.countryname}" <f:selectitem itemlabel="select one" itemvalue="" /> <f:selectitems value="#{addpatientprofilebb.patst...

makefile - how to link the objects in all subdirectory togother? -

i'm writing makefile framework project. say, have main.c in top dir, , many subdirs each containing c file. link object files togoter, assign initial value in top makefile: export target_list := main.o and in each subdirs, append them list: # sub1/makefile target := a.o target_list += $(target) when return top dir, target_list still main.o. i'm sure subdirs entered. there way this? the top makefile: all: main export top_dir = $(shell pwd) export target_list := main.o subdirs := b c d cflags := -iinc all:main main:main.o subdirs cc $(target_list) -o $@ $(cflags) subdirs: $(patsubst %, _dir_%, $(subdirs)) $(patsubst %, _dir_%, $(subdirs)) : $(make) -c $(patsubst _dir_%, %, $@) $(tgt) the rules.make: all:$(target) %.o:%.c @echo $(target_list) $(cc) -c $^ -o $@ $(cflags) $...

php - Parsing a value from a JSON webpage -

using either javascript or php, how can value webpage? json attempting parse: {"error":[""],"templatehtml":"", "_visitor_conversationsunread":"0","_visitor_alertsunread":"0"} i trying value of "_visitor_alertsunread". how go doing this? thank you! you either parse using regex, using json decoding, or simple indexing. however, of these three, json clean , correct way go. 1) json decoding: $page = file_get_contents($url); $json_arr = json_decode($string,true); return $json_arr['_visitor_alertsunread']; 2) regular expression: $page = file_get_contents($url); $pattern = ".*?_visitor_alertsunread\\\":\\\"(\\d)\\\""; preg_match($pattern, $page, $matches); return $matches[1]; 3) indexing: $page = file_get_contents($url); $needle = "_visitor_alertsunread"; $startpos = strrpos($page, $needle) + strlen($needle) + 3; $endpos = ...

javascript - How to change CSS of blogger's first post only? -

i want change css of blog's first post ( digitalsorify ) looks the huffington post without using jquery. answering title (with css): .wrapfullpost:first-child { /* put first post style here */ }

R - Microsoft Access mdb database in Windows -

i have followed these steps install access database engine, configure odbc data source , create user dsn abc linked abc.mdb: https://stackoverflow.com/questions/6721702/windows-7-64-bit-odbc-drivers-for-ms-access-missing , how read data microsoft access .accdb database files r? no issues. however, odbcconnect("abc") giving me error: specified dsn contains architecture mismatch between driver , application this issue regards 32bit v 64 bit think. r 32 bit or 64 bit. created 32 bit dsn. c:\windows\syswow64\odbcad32.exe create 64 bit version. default control panel points %windir%\system32\odbcad32.exe 32bit version

c++ - Proper implementation of global configuration -

my goal have global constants in c++ game i'm working on (to represent graphics info , like). current implementation toss them in .h , include them everywhere. works, except every time change setting, entire code base must recompiled. so, next idea toss them in configuration txt file , parse them in, way no code changed when settings change. parser simple enough, , put values constants, because parser code block, constants no longer global. is there way solve this? perhaps way make them global despite being in block or way avoid recompiling when changing settings? another way create singleton class. #include <fstream> #include <map> #include <string> class configstore { public: static configstore& get() { static configstore instance; return instance; } void parsefile(std::ifstream& instream); template<typename _t> _t getvalue(std::string key); private: configstore(){}; configstore(co...

Android viewpager animation -

i informed when animation ends after function call: viewpager.setcurrentitem(2, true); does know how accomplish this? i have come across same issue. following conclusion: when page changed onpageselected called. it's called before animation. when animation stopped , onpagescrollstatechanged called state scroll_state_idle. so have combine 2 function calls function called. good luck. private class pagechangelistener implements onpagechangelistener { @override public void onpagescrolled(int position, float positionoffset, int positionoffsetpixels) { } @override public void onpageselected(int position) { ispagechanged = true; } @override public void onpagescrollstatechanged(int state) { switch (state) { case viewpager.scroll_state_idle: if (ispagechanged) { updatecurrentpage();//this called when animation ends ispagechanged = false; } ...

Download files from git remote repository -

so thing: i've got process should download files git remote repository , deploy them onto destination server not have git installed on. in addition, should able download files based on given git tag , head. what best way such thing? in order achieve 1 easy copy between git remote repo content , destination, can consider using git archive . see " git tip of week: git archive " one key advantage of using git perform archive rather command line tool avoid accidentally capturing (large) .git directory, or work-in-progress content. example, if have run build, zip (tar) include content of build output well. another advantage can extract content of repository @ an arbitrary revision . plus, copying 1 file aver network less error-prone rsync'ing large set of files.