Posts

Showing posts from January, 2014

c++ - Is there a way to emplace return value? -

// version 1 struct range { int begin, end; }; inline range getrange() { int newbegin, newend; // calculations return {newbegin, newend}; } struct test { std::vector<range> ranges; inline void intensive() { ranges.push_back(getrange()); // or ranges.emplace_back(getrange()); // (gives same performance results) } }; // version 2 struct range { int begin, end; }; struct test { std::vector<range> ranges; inline void intensive() { int newbegin, newend; // calculations ranges.emplace_back(newbegin, newend); } }; version 2 faster version 1 . fact is, getrange() used multiple classes. if apply version 2 , there lot of code duplication. also, cannot pass ranges non-const reference getrange() , other classes use std::stack instead of std::vector . have create multiple overloads , have more code duplications. is there common way/idiom emplace return value ? followin

rotation - Rotate grid of plot with R -

Image
for example : plot(1:10, 1:10) grid(col="red") is possible rotate red grid around intersection of x axis , y axis (the origin {0,0}) , arbitrary angle ? doesn't mean example want that. the grid function cannot in base r anyway. it's not object-oriented plotting paradigm. think come close abline : plot(1:10, 1:10,xlim=c(0,10), ylim=c(0,10)) sapply(seq(0,20,by=2), function(a) abline(a=a, b=-1,lty=3,col="red")) sapply(seq(-10,10,by=2), function(a) abline(a,b=1,lty=3,col="red")) it's minor application of coordinate geometry rotate arbitrary angle. angle=pi/8; rot=tan(angle); backrot=tan(angle+pi/2) sapply(seq(-10,10,by=2), function(inter) abline(a=inter, b=rot,lty=3,col="red")) sapply(seq(0,40,by=2), function(inter) abline(a=inter, b=backrot, lty=3,col="red")) this break down when angle = pi/2 might want check

c# - SendInput is blocked in fruit ninja for pc -

i writing program uses sendinput function simulate mouse events play fruit ninja pc. when called sendinput , mouse moved nothing happened on game screen. tell me why doesn't work , give me solutions? programmed on c# , used [dllimport] call sendinput function. thanks. i suggest simulating mouse move . should simulate mouse drag . first mouse down -> mouse move -> mouse up here code old project: namespace clicker.enums { public enum mouseevents { move = 0x0001, /* mouse move */ leftdown = 0x0002, /* left button down */ leftup = 0x0004, /* left button */ rightdown = 0x0008, /* right button down */ rightup = 0x0010, /* right button */ middledown = 0x0020, /* middle button down */ middleup = 0x0040, /* middle button */ xdown = 0x0080, /* x button down */ xup = 0x0100, /* x button down */ wheel = 0x0800, /* wheel button rolled */ virtualdesk = 0x4000, /* map entire

.htaccess - Rule to redirect file based on timestamp? -

i need filter json files based on date , time present on it's name. if file name datetime.json bigger current time want redirect future.json . if file name less current time, don't redirect. for example: current date , time 1377512625 . file name 1345732202 . current date , time greater file name, serve 1345732202.json : http://myserver.com/1345732202.json current date , time 1377512625 . file name 1408804202 . current date , time less file name, serve future.json : http://myserver.com/1408804202.json here .htaccess not work: rewriteengine on rewritecond %{time} <%{request_filename} [nc] rewriterule ^(.*)\.json$ /future.json [r=307,l]

sql - Removing SSRS security for a single person -

we have employee left company, , have bunch of ssrs reports has access to. there way remove of reports @ once, or have go 1 one? you can delete user reportserver database. then, user can no longer verified, , login becomes impossible. ps: backup reportserver database first, in case... delete [reportserver].[dbo].[policyuserrole] userid in ( select userid users username ='blabla' ) delete users username ='blabla'

android - Creating a polygonal geofence -

this question has answer here: android geofencing (polygon) 1 answer does know how create polygonal geofence in android? i know android supports circular (i.e., lat/long + radius) geofences, need more precise control on boundaries. for concerns cpu & power consume , recommend use solution decribed here . create fake circular geo-fence around polygon when geofence alert thrown circular geofence, evaluate if inside polygon using answer provided karl.

r - Set color for segments in ggnet -

Image
i hvar following data set: structure(c(2l, 6l, 2l, 6l, 7l, 7l, 2l, 7l, 6l, 8l, 8l, 4l, 8l, 2l, 9l, 8l, 7l, 6l, 9l, 1l, 9l, 4l, 9l, 3l, 2l, 10l, 9l, 10l, 8l, 10l, 7l, 6l, 10l, 1l, 2l, 12l, 9l, 8l, 12l, 1l, 11l, 10l, 2l, 44l, 79l, 10l, 8l, 47l, 45l, 51l, 9l, 11l, 74l, 75l, 77l, 69l, 75l, 77l, 78l, 2l, 44l, 44l, 46l, 46l, 8l, 6l, 1l, 1l, 6l, 7l, 1l, 4l, 7l, 8l, 8l, 1l, 4l, 8l, 3l, 8l, 8l, 9l, 9l, 9l, 1l, 9l, 5l, 9l, 3l, 9l, 9l, 9l, 10l, 8l, 10l, 7l, 10l, 10l, 1l, 10l, 10l, 9l, 12l, 12l, 1l, 12l, 12l, 12l, 12l, 7l, 7l, 44l, 44l, 44l, 44l, 44l, 44l, 44l, 44l, 44l, 44l, 7l, 7l, 7l, 7l, 44l, 10l, 9l, 42l, 43l, 46l, 46l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, -1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, -1l, 1l, 1l, 1l, -1l, -1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, -1l), .dim = c(66l, 3l), .dimnames = list(null, c("from", "to", "impac

exception - Android - Unable to instantiate activity ComponentInfo -

when try run app error on logcat: 08-23 17:32:01.700: e/androidruntime(4518): fatal exception: main 08-23 17:32:01.700: e/androidruntime(4518): java.lang.runtimeexception: unable instantiate activity componentinfo{com.app.myapp/com.library.core.presentation.sessionactivity}: java.lang.nullpointerexception 08-23 17:32:01.700: e/androidruntime(4518): @ android.app.activitythread.performlaunchactivity(activitythread.java:1573) 08-23 17:32:01.700: e/androidruntime(4518): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1667) the problem appears when touch on list item, corresponding intent: public void onitemclick(adapterview<?> adapterview, view view, int position, long id) { intent sessionintent = new intent(view.getcontext(), sessionactivity.class); //sessionintent.putextras(bundle); startactivity(sessionintent); } sessionactivity class contained in library p

mysql - Simple but Tricky sqlite search query for -

i have following sqlite query finding words contain character 'w' select * suppliers supplier_name '%w%'; which works fine words like: awesome,overflow etc but database contains word like: αγαπάω , αγαπώ etc i want these words selected when fired query how not working think these accents words anyhow want solve u please me on issue the letter "ω" greek alphabet letter, named omega, has no connection @ letter "w", shape.

c++ - How to call a static template member function from another class -

first of in advance time. have little problem templates (i'm quite new in templates thing). the code in c++ compiled (or @ least tried to) visual studio 2012. main.h: class main { public: template<class t> static void foo(t param1); }; main.cpp #include "main.h" template<class t> static void main::foo(t param1) { // things } other.h #include "main.h" class other { public: void foo2(); }; other.cpp #include "other.h" void other::foo2() { int var1 = 10; main::foo(var1); // here link error. } well problem know quite common unresolved external symbol, i've looked around web in order find can me understand , solve link error , i've found few things i've tried without result. i've tried: 1- implement foo function in .h file 2- use inline keyword 3- tried export (which not supported compiler) but none of approachs seems work me, i'm doing wrong or i'm missing something. rememb

php - Save as raw image data in Firefox -

i'm using echo file_gets_content output raw image data jpeg based on $_posted variables. expected result( display image) when "right click save as" firefox attempts download file turns out corrupt this not happen in google chrome why happening , how can work around this? turns out right...when "right click/ save as" in firefox browser attempts download media replicating process...the problem seems not post variables needed reproduce image. using session in logic resolved issue

javascript - RegExp stumper, should be simple -

i'm regexp, 1 has me stumped. here's javascript snippet: var justdateregex = '\d+/\d+/\d+'; var datestr = $('#dropdown').find(':selected').text(); var onlydate = datestr.match(justdateregex); console.log('regex: ' + justdateregex + ' datestr: ' + datestr + ' onlydate: ' + onlydate); here's output console.log regex: d+/d+/d+ datestr: 11/23/2013 12:00:00 onlydate: null i expect onlydate read: 11/23/2013, null. ideas why? string.match() expects parameter regexp object, not string. var justdateregex = /\d+\/\d+\/\d+/; var datestr = $('#dropdown').find(':selected').text(); var onlydate = datestr.match(justdateregex);

c++ - ZMQ: socket_send/recv blocking -

so i'm trying set simple communication between zmq in python , zmq in c/c++ extension. python sets context, binds inproc socket, , passes context , socket name extension. extension sets own socket, connects, , listens messages. python sends header , string representation of dictionary on extension. pretty simple stuff using req/rep sockets. however, reason can't seem find, call socket.send blocking, , extension never gets past call zmq_recv. have test environment have same scenario play out, sockets don't block, , i've triple-checked code , should working in same way. python: import zmq import cppextension # no lectures using threading please. i'm restricted to, in essence # using function because of code base i'm working with. thread import start_new_thread socket = self.zmq_context.socket(zmq.req) socket_name = "inproc://agl" socket.bind(socket_name) t = start_native_thread(cppextension.actor, (self.zmq_context, socke

iphone - Is it possible to start audio file in background mode -

so i've paid guys make me app can't make self. it's gps based app. thing is, user sets destination radius @ 20miles. when user enters radius, want app play audio file. works fine. but, can't done, when app in background mode. can't start audio file if app in background mode, can make notification. can achieved how ? make app play audio file, when user enters radius, when in background mode ? thanks in advance it possible using @ankitjain solution

html - Binding issues with for attribute in label tag in IE7 -

hi i'm not able put bindings in ids , fors attributes in ie7. example works fine in chrome, ie8, ..., doesn't work on ie7 or less <!doctype html> <html lang="en" ng-app id="ng-app" xmlns:ng="http://angularjs.org"> <head> <meta charset="utf-8"> <title>fjseif</title> </head> <body> <!--[if lte ie 8]> <script src="json2.js"></script> <![endif]--> <input type="radio" id="in{{1+1}}" name="lala"> <label for="in{{2}}">hello1</label> <input type="radio" id="in{{1+2}}" name="lala"> <label for="in{{3}}">hello1</label> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script> </body> </html> the label tag "in{{3}}" does'nt bind input of id &

database setup for ocra complied rails app -

i'm trying package rails (3.2) app run on windows machine , i'm using ocra 'compile' app exe. after repeatedly banging head on desk i've managed app compile , run, have 1 problem remaining; database app packaged inside .exe while app runs , functions (new records can created , retrieved) temporary, when exe stopped changes database lost. so guess need have database external app external exe. haven't managed make work. i've tried changing database path in database.yml several different values nothing i've tried works. examples i've seen connecting external database show connection being remote host , not local file. want database file in same folder exe. the compiled app runs in production mode, ocra command used build exe; ocra myapp\script\rails myapp --add-all-core --gemfile myapp\gemfile --no-dep-run --gem-full --chdir-first -- server -e production the database.yml after creating app production: adapter: sqlite3 database: db

Call WCF method from client c# -

i have created 1 wcf service application. there few methods in service1.svc . here iservice1.cs [operationcontract] getuserdetailsbyemail_result getuserdetailsbyemail(string email); here service.svc.cs public class service1 : iservice1 { #region getuserdetails public getuserdetailsbyemail_result getuserdetailsbyemail(string email) { return (new usermanager()).getuserdetailsbyemail(email); } #endregion } here getuserdetailsbyemail_result complex type created in demomodel.edmx . contain scalar property . basically trying is, want call method client (c#) side. here client side code //svc.getuserdetailsbyemailcompleted += new eventhandler<getuserdetailsbyemailcompletedeventargs>(svc_getuserdetailsbyemailcompleted); getuserdetailsbyemail_result dtbuserdetails = svc.getuserdetailsbyemailasync(loginname); here svc object of service1client . here calling wcf method. gives me error cannot implicitly convert type 'void' &

java - How to make scrollable to jPanel -

Image
i making swing application. , there height of jpanel. want make panel scrollable.: following description of requirement. i have 4 jpanel in 1 jpanel mean: jpanel p1=new jpanel(); jpanel p2=new jpanel(); jpanel p3=new jpanel(); jpanel p4=new jpanel(); i adding p2, p3, p4 inside p1 following output: like above showing panel has more height computer screen height. want display content of panel on computer screen scrolling. i searched here , found following questions: how make jpanel scrollable? how vertical scrolling jpanel? however, answers did not solve myproblem. without seeing code, guess don't have jscrollpane provide scrollable behaviour want. jpanel mainpanel = new jpanel(); //this base panel of ui jpanel p1=new jpanel(); jpanel p2=new jpanel(); jpanel p3=new jpanel(); jpanel p4=new jpanel(); jpanel newpanel = new jpanel(); newpanel.add(p1); newpanel.add(p2); newpanel.add(p3); newpanel.add(p4); jscrollpane pane = new jscrollpane(newpanel); m

NaN means in image resize in matlab? -

what code mean?? code written in matlab. citra=imresize(citra,[400 nan]); i know image (citra) resize 400. but, nan? that's mean? read docs: http://www.mathworks.com/help/images/ref/imresize.html either numrows or numcols may nan, in case imresize computes number of rows or columns automatically preserve image aspect ratio.

plsql - PL/SQL Error With Nested IF statements -

apex 4.2 i have following pl/sql code block below whenever run in apex, keep getting error: ora-06550: line 35, column 4: pls-00103: encountered symbol ";" when expecting 1 of following: if declare show_changes boolean; l_exists integer; begin select count(*) l_exists dba_role_privs grantee = upper(:app_user) , (granted_role = 'survey_job_suid' or granted_role = 'survey_suid'); if l_exists = 0 /* unauthorized */ if :p32_survey_job_request_id not null , (:p32_submission_date null , :p32_lock_date null) show_changes := true; if :p32_survey_job_request_id not null , (:p32_submission_date not null , :p32_lock_date null) show_changes := true; if :p32_survey_job_request_id not null , (:p32_submission_date not null , :p32_lock_date not null) show_changes := false; end if; else /* authorized */ if :p32_survey_job_request_id not null , (:p32_submission_date

android - When I close the Activity the service is killed then started again -

i have simple android program containing 1 activity , 1 service. starting service activity calling: startservice() the service should continue running when close activity started calling startservice . noticing when close activity service killed started again after short time. is normal behavior in android? if normal, there way enforce keeping exact service running? thank rami how "closing" activity? there's no need kill activity once you're finished using it, , service should keep running if activity in background. service.ondestroy() called before system destroys service. however, inclined believe have different problem, since it's unusual service killed unless device low on memory.

java - Joda DateTime,, Formatting, and Mysql Timestamp -

after week of going through many examples, , moving java date, calendar, joda. have decided seek other sources. the problem: our table has 2 fields date (timestamp), , tz (string). idea store user's utc in timestamp, , timezone, well, idea. think in utc, , present user time converted timezone on front end (ie, using value store in table.tz) another requirement use proper object (date, datetime whatever). , not pass string representation of date around. best valid long correctly translated mysql, without having use from_unixtime mysql function in our query. code using: public datetime converttimezone(localdatetime date, datetimezone srctz, datetimezone dsttz, locale l) { datetimeformatter formatter = datetimeformat.forpattern("yyyy-mm-dd hh:mm:ss").withlocale(l); datetime srcdatetime = date.todatetime(srctz); datetime dstdatetime = srcdatetime.todatetime(dsttz); system.out.println(formatter.print(dstdatetime)); system.out.println(formatter.parsedatetime(dst

c# - Communicate to the UI thread when a thread completes -

i have simple program here below has 2 threads performing task. thread1 data feeder. thread2 data processor. so far work being done through approach working want have better way of getting notified when work completes here code class program { private static blockingcollection<int> _samples = new blockingcollection<int>(); private static cancellationtokensource _cancellationtokensource = new cancellationtokensource(); private static bool _cancel; static void main(string[] args) { threadstart thread1 = delegate { processthread1(); }; new thread(thread1).start(); threadstart thread2 = delegate { processthread2(); }; new thread(thread2).start(); console.writeline("press key cancel.."); console.read(); _cancel = true; _cancellationtokensource.cancel(); console.read(); } private static void pro

c++ - How do I pull in unexpected build dependencies of standard libraries -

i feel ridiculous, i'm trying import openblas libraries project. built gfortran fortran compiler. builds had no issue pulling libopenblas.so in, on system, it's choking on libgfortran.so when try run our program, doesn't exist there. impression has been standard library on most, if not all, linux systems. add copy of libgfortran.so artifactory , let apache ivy pull in, seems make more sense use standard version if possible. there way pull in via ivy when doing ant resolve command if doesn't exist on system? an alternate solution may statically link libgfortran.a in on compiling system, attempts adding -static relative_path_to_libs/libgfortran.a compile , link fine, still errors when running said program on system lacks library. thank whatever can provide. if executable file format "elf" file format (default on linux systems) can use "readelf" display dynamic section of executable: readelf -d my_executable_file it should co

ios - Using MultipeerConnectivity.framework to send and receive photos and text files -

i want give user of app ability share photograph without having internet connection. quite hard explain i'll best. in app user can press on plus button take shot using iphone. image uploaded on internet (dropbox) in common folder can accessed app users. when other users open app, image has been uploaded downloaded on device. since there might more 1 image, app refreshes once in while, , downloads new photographs. want same thing using bluetooth (or airdrop). when 1 device takes picture, saved on device, , sent app users nearby. these users can edit it, send original device can accessed everyone. original device acts server, , other devices stream information device. whole purpose of have, 15 different ios devices in same room in sync display same exact thing. when edits, other people see it, if in sync "the cloud" (which dropbox). i understood might possible multipeerconnectivity.framework permits more 1 device connected @ same time. found example app called beam i

c - How does one represent the empty char? -

i'm writing little program keep getting error when compiling error: empty character constant i realize it's because i'm trying replace valid char empty space c[i]='' have not been able find way represent it. you can use c[i]= '\0' or c[i] = (char) 0 . the null/empty char value of zero, can represented character escaped zero.

internet explorer - Having trouble setting the width of the extlib dialog which is poped-up from inside a repeate control which inturn is within nested tabs (ie only) -

i having trouble in setting width of extension library dialog. dialog placed inside repeate control inturn within nested tabs , usual facing problem when application previewed in internet explorer. in other browsers works fine. add using latest oneui version application. any hints suggestions more welcome. in 1 of applications control width of dialog control setting following in css (in example set width 600px): .lotusdialogborder, .lotusdialog, .dijitdialogpanecontent { min-width: 600px; }

ios - Newly created NSManagedObject returns temporary objectID even after save -

very simple situation. not sure why it's causing issue. i have view creates new nsmanagedobject in child nsmanagedobjectcontext. when user presses "done", saves child context, saves parent context, posts notification newly created object's objectid. in main view controller, respond notification , try newly created object existingobjectwithid:error: . problem fails because objectid temporary (i "cocoa error 133000"). saves 2 contexts flawless: when reload app, can see entries created. @ time need reference new object, fails. why give me temporary object id after i've saved it? note: have tried using obtainpermanentidsforobjects:error: , works, permanent id still fails when try use obtain object. here's code: -(ibaction)done:(id)sender { if ([editordonenotification isequaltostring:knotification_objectadded]) { // save temporary moc nserror* e; if (![self.tempcontext save:&e]) { // successful save

Local Notification Error iOS -

when minimizing application, well, when try deploy boom going on, error * terminating app due uncaught exception 'nsinvalidargumentexception', reason: '* -[__nsarraym insertobject:atindex:]: object cannot nil' -(void) applicationdidenterbackground:(uiapplication *)application { nsdate *alerttime = [[nsdate date] datebyaddingtimeinterval:5]; uiapplication* app = [[uiapplication sharedapplication] init]; uilocalnotification* notifyalarm = [[uilocalnotification alloc] init]; nsurlrequest *request = [nsurlrequest requestwithurl:[nsurl urlwithstring:kallnews]]; nserror *error = nil; nsdata *response = [nsurlconnection sendsynchronousrequest:request returningresponse:nil error:&error]; nserror *jsonparsingerror = nil; sortarray = [nsjsonserialization jsonobjectwithdata:response options:0 error:&jsonparsingerror]; if (notifyalarm) { if ([[nsuserdefaults standarduserdefa

unix - Bash script containing binary executable -

is possible write bash script, contain binary executable program inside? i mean script, contain dump of executable in textual form, dumped executable script when executed? i love know solution, work out of box without need of installing additional packages. possible? thanks! i never done before ;) compile c source, create b.bash script containing binary (and original script simple development) (a.bash) #!/bin/bash if [ "$0" == "b.bash" ];then tail -n +$[ `grep -n '^binary' $0|cut -d ':' -f 1` + 1 ] $0 | base64 -d > a2.out chmod +x a2.out ./a2.out echo $? exit fi cat "$0" > b.bash echo "binary" >> b.bash cat > a.c << eof int main(){ return 12; } eof gcc a.c base64 a.out >> b.bash invoke (a.bash generates b.bash): bash a.bash ;bash b.bash i don't know how evade writing out binary temporary file before execution...

c# - Redirecting StandardOutput when it updates lines instead of making new ones -

i launching rsync inside app. right works fine, opens console window, prompts me password, , shows file progress files copy. public static int syncfolder(string sourcefolder, string destfolder) { process rsync = new process(); rsync.startinfo.filename = path.combine(rsyncpath, "rsync.exe"); rsync.startinfo.useshellexecute = true; rsync.startinfo.arguments = string.join(" ", new[] { "-rltzh --progress --chmod=a=rw,da+x", fileutils.encodeparameterargument(sourcefolder), fileutils.encodeparameterargument(destfolder) }); rsync.start(); rsync.waitforexit(); return rsync.exitcode; } the problem don't want separate console window opened. display text progress inside control of type , respond prompts (like entering password) inside program itself. public int syncfolder(string sourcefolder, string destfolder) { process rsync = new process(); rsync.startinfo.filename = path.combine(rsyncpath, "rsync.exe"

asp.net - JQuery Dialog with DataTable() -

i wondering if me out issue having. using asp.net , jquery ui 1.9.2. have on form textbox , button searching. when button clicked, server side query database , store results in gridview. make datatable work asp.net gridview, following in cs: protected override void onprerender(eventargs e) { base.onprerender(e); // no point change settings if there isn't rows if (this.gridmemberinfo.rows.count <= 0) return; // change table there thead this.gridmemberinfo.headerrow.tablesection = tablerowsection.tableheader; if(this.gridmemberinfo.showfooter) this.gridmemberinfo.footerrow.tablesection = tablerowsection.tablefooter; } this gridview inside of div use jquery dialog act modal popup. after binding gridview's datasource results query, create modal: cs: scriptmanager.registerstartupscript(this, this.gettype(), "membermodal", "createmembermodal();", true); js: function createmembermodal() { $(docu

html - jQuery not finding inputs in table cells -

i have strange issue table cell value. my html like: <table> <tr> <td> celll </td> <td> celll </td> <td> celll </td> </tr> <tr> <td> celll </td> <td> <input type='text'> </td> <td> <input type='text'> </td> </tr> </table> i want replace cell has input tag. so i: $('table').find('td').each(function(){ if($(this).text()==''){ console.log('found input') } }) however, can't seem find codes. any tips here? $.text() method gets combined text contents of each element , returns white spaces or new-lines. so trim string using $.trim method: $('table').find('td').each(function() { if($.trim($(this).text()) === ''){ console.log('found input'); } }); jsbin demo update anoth

python - how to: installing django on heroku -

i'm absolutely "brand new" paas , django/python. i install django on heroku. before, need install on python. i'm unable that. looked while doc it, unfortunately i'm not able. i've created heroku account. log in , try follow guide. please, me. give me starting point... tia renato setting project you'll need add couple of files root of project: the first file, named requirements.txt , should contain dependencies project (this not heroku specific). @ minimum, should include: django then, you'll need add file named profile (this more heroku-specific) tells heroku how run project: web: gunicorn your_project_name.wsgi:application your_project_name should whatever argument gave manage.py startproject . should name of folder contains wsgi.py file ( settings.py there too). deploying heroku next, should initialize git repository projec:t git init then, commit project: git add . git commit -m "initial commit p

android - No view found for ID xxx for fragment (nested fragments) -

i have activity has viewpager in layout. i have 2 fragments display, 1 each tab. one of fragments designed host other fragments - customermainfragment inflates fragment_customer_main : <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/lyt_customer_main" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <framelayout android:id="@+id/fragment_customer_content" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </linearlayout> this adds customersearchfragment framelayout inflates fragment_customer_search . customersearchfragment has following override switch out search fragment detail fragment on button press: @override public void onviewcreated(v

google app engine - How to add dynamic Facebook meta tags in GAE/GWT application -

i've seen techniques doing other platforms wonder if has clean way this. my app has single host html file , uses standard mvp/places/activities parse hash fragment. displays variety of buttons different elements. fb (confirmed using lint tool) read static html of host page need manipulate before returned requester (there no point in messing around in gwt problem). i use guice-y com.google.inject.servlet.servletmodule create like: serve("/fb/*").with(metatagadder.class); and use /fb/* button urls. spew out html of hosting page (adding in dynamic meta tags needed). *.nocache.js files jump entrypoint.onmoduleload(). this seems sort of clunky. have more better idea? so ended going way , works fine. create servlet dopost/doget methods write out host html , pass parameters it. url looks like: http://example.com/fb/mypage.html?foo=baz#place:foo=baz then have parameters available create meta tags , forth: // first chunk of static html resp.getwriter()

How to Query Android DownloadManager with sorting? -

i trying create custom download activity/page, , plan build on top of android downloadmanager. seems downloadmanager has no public sorting options, sorting stuff hidden, there way around this? i'd sort date, or file size. thanks, johnny in source code can find downloadmanger. query can sorted lastmodifydate. use way extract using source code of downloadmanger , rewrite sorted method. using this: appdownloadmanager.query query = new appdownloadmanager.query(); query.setfilterbystatus(appdownloadmanager.status_pending | appdownloadmanager.status_paused | appdownloadmanager.status_running | appdownloadmanager.status_failed); query.orderby(appdownloadmanager.column_id, appdownloadmanager.query.order_descending); it's first time answer question in stackoverflow , think english poor .tks

In RhodeCode, is it possible to index gists for search? -

i'd see gist contents included in search results. i've examined configuration options , googled topic not find way include them. gist not yet indexed whoosh, it's idea add public gists. private must remain un-indexed since url acl in case , search leak content. have indexer improvements on our todo lists 2014. i'll make sure discuss gist indexing.

javascript - Changing the default tab and page with js -

i beginner web design. need professionals me solve problem. underneath js using create tabs. change default tab, still couldn't figure out how change default tab page. please !!! <script type="text/javascript"> //<![cdata[ var tablinks = new array(); var contentdivs = new array(); function init() { // grab tab links , content divs page var tablistitems = document.getelementbyid('tabs').childnodes; ( var = 0; < tablistitems.length; i++ ) { if ( tablistitems[i].nodename == "li" ) { var tablink = getfirstchildwithtagname( tablistitems[i], 'a' ); var id = gethash( tablink.getattribute('href') ); tablinks[id] = tablink; contentdivs[id] = document.getelementbyid( id ); } } // assign onclick events tab links, , // highlight first tab var = 0; ( var id in tablinks ) { tablinks[id].onclick = showtab; tablinks[id].onfocus = function() { this.blur() }; if ( == 0 ) t

ssl - ODataService Type Provider error: (401) Unauthorized -

the type provider 'microsoft.fsharp.data.typeproviders.designtime.dataproviders' reported error: error reading schema. remote server returned error: (401) unauthorized. is there way use odata type provider odata service requires username , password? static type parameters type provider : serviceuri : string uri string odata service. localschemafile : string path file contains schema. file written type provider. forceupdate : bool requires direct connection service available @ design/compile time , local service file refreshed. default value true. when forceupdate false, provider reacts changes in localschemafile. resolutionfolder : string folder used resolve relative file paths @ compile time. default value folder contains project or script. dataservicecollection : bool generates collections derived dataservicecollection. default value false. yes, unfortunately it's not quite slick, , don't compile-time validation, 1 of n

angularjs - Update a model by unchecking a checkbox with a directive -

so i'm trying make dependency checkboxes. dependent checkbox disabled + unchecked once checkbox dependent upon uncheck. reason, unchecking checkbox inside directive job, in disabling , unchecking model binded not update. html: <div> <input type="checkbox" data-ng-model="test.dependency"/> <span>unchecking 1 disable next</span> </div> <div> <input dependent="test.dependency" type="checkbox" data-ng-model="test.optional" /> <span>this checkboxs directive uncheck when first 1 unchecked, model doesn't updated, not it's {{test.optional}}</span> </div> controller (for defaults options): $scope.test = { dependency: true, optional: false } directive: restrict: 'a', link: function(scope,elem,attrs){ scope.$watch(attrs.dependent,function(val){ if (!val){ elem[0].checked = false; elem[0].disabled = true } else {

java - OR operator in switch-case? -

let's take simple switch-case looks like: @override public void onclick(view v) { switch (v.getid()) { case r.id.somevalue : case r.id.someothervalue: // stuff break; } } i wonder why not allowed use || operator? like switch (v.getid()) { case r.id.somevalue || r.id.someothervalue: // stuff break; } the switch-case construct pretty similar if-else statement, can use or operator in if however. backgrounds switch-case not accept operator? what backgrounds switch-case not accept operator? because case requires constant expression value. , since || expression not compile time constant, not allowed. from jls section 14.11 : switch label should have following syntax: switchlabel: case constantexpression : case enumconstantname : default : under hood: the reason behind allowing constant expression cases can understood jvm spec section 3.10 - compilin

android - ListView Adapter with multiple Item layouts -

i'm looking @ adding listview android application thumbnail image. thumbnail on left , text on right. is there way of populating list view seperate xml files, example, have separate xmls austria, uk, usa etc , add them listview? the reason ask is, plan reuse individual countries multiple times, in, shown in z again continent etc. if possible, example of how done or link tutorial etc? thanks do want separate .xml files? or want reuse 1 .xml file , replace content? if want separate .xml files (meaning multiple different views in adapter) take @ adapters methods: getviewtypecount() - returns how many different view layouts have getitemviewtype(int pos) - returns correct view type id position with these methods can specify number of different types in adapter, , load different layout files depending on type. you example have adapter supporting multiple layouts. (e.g. 1 item being actual item, other 1 being separator between items) for more spec

php - Determining if next iteration is going to happen -

i have php script loops many times. there way in php tell whether last iteration ? script rather complex (1700 lines) , can't locate snippet responsible running script beginning. ideally i'm looking function (put in end of file) predicts whether or not script going run again beginning (as does). sure, other solutions welcomed. amount of iteration depends. upd: sorry, it's not loop causes script start over. there else (that can't define) makes page run beginning. i assume mean this: $max = 10; for($i = 0; $i <= $max; $i++) { if($i == $max) { //last iteration } }

delphi - TComboBox 'Control has no parent window' in destructor -

i'm using delphi xe2. build custom tcombobox can add key/string pairs , handle cleanup in component's destructor. all if not (csdesigning in componentstate) code omitted brevity. interface type tkeyrec = class(tobject) key: string; value: string; end; tmycombobox = class(tcombobox) public destructor destroy; override; procedure additempair(const key, value: string); end; implementation destructor tmycombobox.destroy; var i: integer; begin := 0 self.items.count - 1 self.items.objects[i].free; self.clear; inherited; end; procedure tmycombobox.additempair(const key, value: string); var rec: tkeyrec; begin rec := tkeyrec.create; rec.key := key; rec.value := value; self.items.addobject(value, rec); end; when application closes, destructor called, items.count property inaccessible because tcombobox must have parent control access property. time destructor called, no longer has parent control. i saw problem once befor

custom error message codeigniter doesn't show up -

the custom error message doesn't displaying error,it shows blank page instead error message here controller : public function daftar(){ $this->form_validation->set_rules('email','email','required'); $this->form_validation->set_rules('nama','nama','required'); $this->form_validation->set_rules('pass','password','required'); $this->form_validation->set_rules('passconf','passwordconf','required|matches[pass]'); if($this->form_validation->run()==false){ $this->form_validation->set_message('passconf','the password doesnt match'); } else{ redirect('lowongan/daftar_employer'); } } } you need escape apostrophe in word "doesn't". $this->form_validation->set_message('passconf','the password doesn\'t match');

c++ - How the LabWindows CVI detects buffer overflow in C -

yesterday,i find cvi can detect buffer overflow when run simple code in c,which make me confused. void main(void) { int a[10]; int buf[10]; int test[10]; int *p = &buf[10]; *p = 1; while(1); } when can run program, error occurred.the message "dereference of out-of-bounds pointer 1 bytes (1 elements) past end of array"(sorry not permission post image) i confused how implemented,as know c/c++ don't have built-in array boundary. try in other platform vc++6.0 , linux, , no 1 can detect overflow. you. i've not used labwindows/cvi, brief discussion it, i'm guessing detected out-of-bounds dereference @ runtime, not @ compile-time. static code analysis (correctness checks can performed @ compile-time without running software) limited in types of errors can catch. in simple example, compiler conceivably catch error, cannot catch errors in general case because tracing dataflow combinations of inputs go large program intractable problem powerful

maven - repository.cloudera.com: nodename nor servname provided, or not known -

my pom.xml: <dependencies> <dependency> <groupid>org.apache.hadoop</groupid> <artifactid>hadoop-core</artifactid> <version>2.0.0-mr1-cdh4.3.1</version> </dependency> <dependency> <groupid>org.apache.hbase</groupid> <artifactid>hbase</artifactid> <version>0.94.10</version> </dependency> </dependencies> <repositories> <repository> <id>cloudera</id> <url>https://repository.cloudera.com/artifactory/cloudera-repos/</url> </repository> </repositories> in browser, can download hadoop-core-2.0.0-mr1-cdh4.3.1.jar https://repository.cloudera.com/artifactory/cloudera-repos/org/apache/hadoop/hadoop-core/2.0.0-mr1-cdh4.3.1/ without issues, when try build project using maven, i've got error: could not transfer artifact org.apache.hadoop:hadoop-core:

html - Aligning 4 divs side by side with percentage dimensions in a parent div -

how can achieve this? html code: <div class="inset"> <div class="innerwrapper"> <div class="uncollapse"> </div> <div class="featuredbox"> <div class="rank"></div> <div class="banner"></div> <div class="desc"></div> <div class="votes"></div> </div> </div> </div> css code: @charset "utf-8"; .featuredbox { background-color: #f8f8f8; height: 160px; width: 100%; border: 1px solid #d5d5d5; margin-top: 10px; -webkit-box-shadow: 0px 0px 4px 1px #d8d8d8; box-shadow: 0px 0px 4px 1px #d8d8d8; padding-top: 15px; padding-bottom: 10px; } .featuredbox .rank { color: #8f8f8f; width: 10%; height: 100%; } .featuredbox .banner { width: 80%; height: 50%; } .featuredbox .desc {

java - how can I get back my paypal classic api information? -

i'm going use paypal on website. know paypal has upgraded developers' website. after switched new site (developer.paypal.com) , migrated test accounts old site, api information , test accounts have gone , can't find them more. from documentation know have go "profile"->"api credentials" it( https://developer.paypal.com/webapps/developer/docs/classic/lifecycle/ug_sandbox/#credentials ). couldn't find "profile". i can open dashboard. on dashboard there rest api apps, credentials , test accounts. i surfed www.x.com , not able find useful. could guys tell me find information? also want know paypal api should use implement below business logic: the first step, user pay money site. second step, user b provide service user a. third step, user confirm he/she has received service. forth step, site release money , transfer user b. thank much! you can find classic api credentials in sandbox / test going www.sandbox.pay