Posts

Showing posts from May, 2010

winapi - Pasting image from clipboard to MS Word has wrong aspect ratio -

this question kind of follow this one . i'm using code in first answer region of desktop, , copying clipboard. might seem didn't research, did. problem first contact ctypes, winapi , jazz. ms paint, paint.net , libreoffice can read image perfectly, ms word changes aspect ratio; sets width , height 15cm. my question is: kind of data word expecting? code example great. this current code (same other answer): import ctypes ctypes import wintypes pil import imagegrab io import bytesio msvcrt = ctypes.cdll.msvcrt windll = ctypes.windll kernel32 = windll.kernel32 user32 = windll.user32 gdi32 = windll.gdi32 img = imagegrab.grab() output = bytesio() img.convert("rgb").save(output, "bmp") data = output.getvalue()[14:] output.close() cf_dib = 8 gmem_moveable = 0x0002 global_mem = kernel32.globalalloc(gmem_moveable, len(data)) global_data = kernel32.globallock(global_mem) msvcrt.memcpy(ctypes.c_char_p(global_data), data, len(data)) kernel32.globalunloc

c# - How to set the binding of an itemscontrol to a different ViewModel? -

i've been trying bind list itemscontrol , continually come binding issues i've come help. my code far is: ... <ssm:recentfilesviewmodel x:key="recentfilesvm" /> ... <itemscontrol itemssource="{binding source={staticresource recentfilesvm}, path=files} margin="0 4 0 0"> <itemscontrol.template> <datatemplate> <telerik:radribbonbutton width="285"> <textblock margin="0 0 0 2" text="{binding path}" /> </telerik:radribbonbutton> </datatemplate> </itemscontrol.template> </itemscontrol> i can list appear if set datacontext entire window means of other bindings don't work. object requires viewmodel want set unique itemscontrol. can please me working? it's driving me insane. edit: i have way because there no direct view model other objects. we're trying keep decoupled possible there no

scala - How to convert an anonymous function to a method value? -

with code val foo = list('a', 'b', 'c') astring.forall(foo.contains(_)) intellij highlights foo.contains(_) , suggests "anonymous function convertible method value". have researched eta expansion, unable see how improve particular piece of code. ideas? i believe it's saying have val foo = list('a', 'b', 'c') astring.forall(foo.contains) note we're not explicitly converting foo.contains method here anonymous function.

java - Try and Catch for simple calculator input -

this program written in java serves calculator. can tell me how implement try/catch block if user tries input result text can handle incorrect workflow? here code: package simplecal; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class simplecal extends jframe { jtextfield jftinput1, jftinput2, jftresult; jbutton jbtminus, jbtadd,jbtdivid, jbttimes; final int jtext_size = 5; simplecal(){ setlayout(new flowlayout()); jftinput1 = new jtextfield(jtext_size); jftinput2 = new jtextfield(jtext_size); jftresult = new jtextfield(jtext_size); add(new jlabel("input 1: ")); add(jftinput1); add(new jlabel("input 2: ")); add(jftinput2); add(new jlabel("result ")); add(jftresult); jpanel p1 = new jpanel(); jbtminus = new jbutton("subtract"); jbtadd = new jbutton("add"); jbttimes = new jbutton("multiple"); jbtdivid = new jbut

asp.net - Left join using a different or not equal in Entity Framework -

i have build query users did not received , alert new posts. my relevant table structure follows: posts: postid int users: userid int, email varchar postalertusers: postalertuserid int, postid int, userid int all related fields have fk constraints between tables. i've built query in sql couldn't find way work in entity framework: select u.email users u inner join posts p on p.userid != u.userid left join postalertusers pu on u.userid = pu.userid , p.postid = pu.postid pu.postalertuserid null i've wrote following ef query, didn't got same results: from u in context.users join pu in context.postalertusers on u.userid equals pu.userid postalerts pa in postalerts.defaultifempty() join p in context.posts on pa.postid equals p.postid pa.userid != u.userid select u.email; how can same results using linq entities. using dot syntax (i don't know correct term dbset.where(x => ...) syntax) better. edit: i want users didn't have record on posta

python imaging library - IOError: cannot identify image file -

can tell why pil can't open png file? https://b75094855c6274df1cf8559f089f485661ae1156.googledrive.com/host/0b56ak7w-hmqax005c3g5etlbake/8.png i ioerror: cannot identify image file, , looking @ code, seems tries pil.pngimageplugin.pngimagefile , corresponding "accept" function, , returns false i'm using version 1.1.6 i don't know problem pil 1.1.6 tested latest pillow 2.4.0 , worked: >>> pil import image >>> im = image.open("8.png") >>> im.show() pil in unmaintained , pillow actively maintained , developed fork. use pillow, first uninstall pil, install pillow. further installation instructions here: http://pillow.readthedocs.org/en/latest/installation.html

javascript - how create a flag with EaselJS -

i find simple canvas flag, have question of how can make easeljs ? because in easeljs documentation don't says about, make canvas "without dom interaction" , , change pixel positions, in easeljs documentation can't find how make it, , have questions: 1 can merge easeljs code normal canvas code? explanation, if draw animated north korean flag star textures, can make static draw easeljs , , animate naked canvas code? 2 possible make other library?, such limejs or other libraries 3 must use webgl library ?, such three.js?

.net - C# SerialPort DSR/DTR and CTS/RTS handshaking -

Image
i trying communicate device using c#/.net's serialport class. the documentation interacting device described here. i using null modem cable tx/rx , handshake pins swapped (verified). i expect following c# code work, not getting response (low high) camera trying interact with. sure problem code though. camera works other "pcs". why never dsrholding (null modem cable, dtr high camera) become true within code? static void main(string[] args) { var serialport = new serialport("com5"); // start dsr/dtr handshake // using null modem cable, dtr/dsr switched serialport.dtrenable = true; while (!serialport.dsrholding) { // probally should timeout instead of infinite wait thread.sleep(10); console.writeline("waiting dtr line go high."); } // start rts/cts handshake // using null modem cable, rts/cts switched serialport.rtsenable = true; while (!serialport.ctsholding) {

java - Android simple WebView crash -

i'm creating simple application right , add webview on bottom of screen. webview on first page, when run application webview run. got error. i use simple code, showing content of web. here's xml code <webview android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" /> and here's java code webview browser = (webview) findviewbyid(r.id.webview); browser.loadurl("http://www.tutorialspoint.com"); i added internet permission on manifest. here's logcat 06-26 10:09:18.657: e/androidruntime(25152): fatal exception: main 06-26 10:09:18.657: e/androidruntime(25152): process: com.indomultimedia.hellobali, pid: 25152 06-26 10:09:18.657: e/androidruntime(25152): java.lang.runtimeexception: unable start activity componentinfo{com.indomultimedia.hellobali/com.indomultimedia.hellobali.mainhelloballi}: java.lang.nullpointerexception 06-26 10:09:18.657:

android - Authenticator response code 400 -

i tried hitting server using httpsurlconnection , got response code 401 - need authenticate. tried following: authenticator.setdefault (new authenticator() { protected passwordauthentication getpasswordauthentication() { return new passwordauthentication ("myuser", "!mypassword".tochararray()); } }); got response code 400 - bad request. based on stackoverflow research tried using: string authorizationstring = "basic " + base64.encodetostring(("username" + ":" + "password").getbytes(), base64.default); conn.setrequestproperty("authorization", authorizationstring); same problem, code 400. i'm trusting hosts using @chrispix method in post: trust anchor not found android ssl connection not sure if interfering somehow, prototype , site certificate isn't valid, needed bypass check. the connection set thes

javascript - What is wrong with these sine calculations in this html5 canvas implentation -

i know can use guess-and-check javascript math, results of seem wildly incorrect, i'd know wrong math. (the sine doesn't display @ all, can if change numbers around -- doesn't make sense mathematically me.) checked online graphing calculator, test here (with width , height of canvas): https://www.desmos.com/calculator/ohs4l3jxkc , seems correct. here's working jsfiddle of implementation http://jsfiddle.net/jv5v3/ ease of use. html: <canvas style="width:100%;height:50px;"></canvas> javascript: makewave($("canvas")); function makewave(canvas){ var twopi = math.pi * 2; var width = canvas.css('width').replace(/\d/g,''); var height = canvas.css('height').replace(/\d/g,''); var xmulti = width/twopi; var c = canvas[0]; var context=c.getcontext("2d"); for(var = 0; < width*2; i++){ var sineval = (-1*math.sin(i/xmulti)*(height/2)) + (height/2);

double exclamation marks in haskell -

i have code: ghci>let listoffuns = map (*) [0..] ghci>(listoffuns !! 4) 5 20 what !! mean? i saw example double exclamation this: ghci> [1,2,3,4]!!1 ghci> 2 but seems don't apply question example. how understand function. need explanations. !! indexes lists. takes list , index, , returns item @ index. if index out of bounds, returns ⊥.

javascript - Can I put a CollaborativeString inside a custom type? -

i'm reading google drive realtime api documentation on building collaborative data model . i way gapi.drive.realtime.databinding.bindstring behaves. doesn't mess cursor placement when multiple people typing in same text box. requires pass collaborativestring. but if register custom type, have use gapi.drive.realtime.custom.collaborativefield no matter type of field defining, , can't pass 1 of these bindstring . in fact, collaborativefield type not appear documented anywhere, , inspecting in console shows has no methods. means there's no registerreference method, collaborativestring uses keep track of cursor positions. how frustrating. guess have work around it. see few options: ignore fact cursor gets messed during collaboration use collaborativemap instead of custom type, , wrap custom type @ runtime probably going option 2. i think misunderstand how site works, onus not on other people show how - you're asking other people take ti

PowerShell verb for "Expire" -

i'm in midst of finalising set of cmdlets server application. part of application includes security principal management , data object management, , "expiration" of both (timed , manual). after expiration date, login , access security principal refused , access data owned principal optionally prevented (either deletion or part of automatic maintenance marking expired). from output of get-verb, cannot see obvious synonym expire, natural choice of verb action being undertaken here. expire on security principal expires principal , may expire stored data, while expire of data object restricted object. set- in use both object types, , has partial overlap in functionality (expire- forces date in past, , removes data, while set- allow future or past dates not remove data). in fashion expire combining 2 operations (set+remove) , data-security reasons, wouldn't want force separation 2 operations (that's possible). for reason, consider disable- not appropriate s

Python requests and OpenSSL - HTTPSConnectionPool Max retries exceeded -

i have problem using python requests library in ubuntu 14.04 when execute following script: import requests import json payload = {'code':'tg-000000000000000000000000', 'client_secret':'x0000000000000000000000000000000', 'grant_type':'authorization_code', 'client_id':'1111111111111111', 'redirect_uri':'http://127.0.0.1:8000/mercadolibre/process_ml_response/'} headers = {'content-type': 'application/x-www-form-urlencoded'} requests.post("https://api.mercadolibre.com:443/oauth/token", data=payload, headers=headers) i following traceback file "<stdin>", line 1, in <module> file "/home/theuser/.virtualenvs/tumoto/local/lib/python2.7/site-packages/requests/api.py", line 88, in post return request('post', url, data=data, **kwargs) file "/home/theuser/.virtualenvs/tumoto/local/lib/python2.7/site-packages/requests/api.py&quo

scala - Why is the message "The global sbt directory is now versioned" in 0.13? -

i'm pretty new scala , sbt , message below every time run sbt . message pretty makes sense can't figure out fix it. i think i'd move configuration place it's expected not sure if mess things up. cannot find doc on how change sbt.global.base system property. the global sbt directory versioned , located @ /users/justinhj/.sbt/0.13. seeing warning because there global configuration in /users/justinhj/.sbt not in /users/justinhj/.sbt/0.13. global sbt directory may changed via sbt.global.base system property. you should move in /users/justinhj/.sbt new folder /users/justinhj/.sbt/0.13 (mind 0.13 subdirectory). new sbt 0.13 folder naming scheme. if don't want change global config folder can invoke sbt modified global base parameter sbt.global.base follows: sbt -dsbt.global.base=/users/justinhj/.sbt take @ document more explanations: http://www.scala-sbt.org/release/docs/command-line-reference.html

How do I join to a first row in OpenEdge SQL? -

joining first row in sql should trivial joining inner select select so_nbr, sod_line last_line so_mstr join sod_det on sod_det.rowid = (select top 1 sod_det.rowid sod_det sod_nbr = so_nbr order sod_line desc) x so_ord_date > curdate() - 60 unfortunately get: error code -20302, sql state hy000: [datadirect][openedge jdbc driver][openedge] top clause used in unsupported context. (13694) note, stuck on oe10.1c , not able upgrade. according abe voelker's answer : openedge 11.2 added support offset , fetch clauses sql select queries; versions of openedge below 11.2 not support offset / fetch . from 11.2 product documentation "sql reference" document: the offset clause specifies number of rows skip, before starting return rows query expression. fetch clause specifies number of rows return, after processing offset c

javascript - error while creating dynamic button and how to add click event dynamically without using id -

var shoplink= $("<button></button>") .prop("id",i) .val("view more") .css({ width: '20px' height: '20px' }); when used button js file not working.i want add click events button dynamically without using id. css function params worng, missed , , button have value attr form data should use text() function instead of val() .css({ width: '20px' , height: '20px' /\ }); |---------------- try var shoplink=$("<button></button>") .prop("id","idbutton") .text("view more") .css({ width: '20px', height: '20px' }); demo

Setting up Django-nonrel with Mongodb -

i trying develop web app using: - mongodb database - django web framework i encountering few problems makes me doubt quality of approach setup is: - mongodb installed , working - django-nonrel, djangotoolbox , djangomongodbengine installed in virtualenv python 3.4 - os windows 7 enterprise - using pycharm editor - settings in settings.py are databases = { 'default': { 'engine': 'django_mongodb_engine', 'name': 'jungle1', 'host': '127.0.0.1', 'port': 27017 } } unfortunately when run through tutorial @ http://django-mongodb-engine.readthedocs.org/en/latest/tutorial.html improperlyconfigured exception, having difficulty solving. has had experience similar setup? is there glaring mistake or omission spot? is sound approach @ all? - instance more productive try , use mongoengine instead? or use bottle.py pymongo? thanks lot help marc i guess if clear value o

How to deploy ElasticSearch to production? -

i have downloaded , build code around elasticsearch. works in staging server. unzipped download folder c:\elasticsearch\elasticsearch-1.1.1 now see \bin \config \data \lib \logs \pluggins folders , license.txt file in there. total size of unzipped folder 4.9gb!!! which of these need copy production? i need run windows service. could please me here. thanks this depends on want keep production. if want data copy folder data. if still want same config , pluggins copy whole folder exept logs. however should aware putting elastic search in production way more complicated that, needs in cluster , have special configuration on servers.

java parsing soap response with optional nodes -

i need parse soap reponse can have optional nodes. structure this: queryinvoiceresponse invoicelist invoice - optional, unbounded; type invoice consignee - optional; type consignee address type string name type string tin type string consignor - optional; type consignor address type string name type string tin type string customerjoopparticipants - optional; joopparticipant - optional, unbounded; type joopparticipants productshares share - unbounded; type productshare productnumber - required; type int quantity type decimal tin - required; type string customers customer - unbounded; type customer statuses - optional; status - optional, unbounded; type customertype - typ

ruby - How to add key-value pairs to hash in a loop -

i want add key-value pairs hash in loop. hash looks this [ {'filename' => filename1, 'filelocation'=> filelocation1}, {'filename' => filename2, 'filelocation'=> filelocation2} ] i using following code it. not add values, last key-value pair. filedetails= {} doc = rexml::document.new args[0] doc.elements.each("node/congfigurations/config") { |config| filename= config.elements["@filename"].value filelocation= config.elements["@location"].value filedetails={'filename' => filename, 'filelocation'=> filelocation} } how can collect values? first, expected output not hash, array. declare this filedetails = [] and inside loop, make change filedetails << {'filename' => filename, 'filelocation'=> filelocation} # push hash array edit " it not add values, last key-value pair " this because, using assignment operator. ev

xpages on click event from view panel column - pop up dialog forms from views -

there 2 datasources: cdoc ( doc. content ) , pdoc ( inside dialog ). these 2 datasources linked based on cdoc'unid . my main view panel this: [_a_common_field] cdoc1 , pdocs cdoc1 ( column categorized ) cdoc1 pdoc 1 cdoc1 pdoc 2 cdoc1 [_a_common_field] cdoc2 , pdocs cdoc2 ( column categorized ) cdoc2 pdoc 1 cdoc2 how can compute target property viewpanel1 considering fact want pdoc opened in dialog ( created ) , cdoc opened in 'clasical' mode when target property wasn't added ? this answer assumes trying open selected document view panel in dialog. (in essence, open dialog values document listed in embedded view) forward more open document in window , done it. if want open in dialog, fine. if define data source in dialog itself, warned have had issues such approaches in past , think datasources should defined in xpage view level. answer 1. not allow links in view. 2. have checkbox

.net - Delay a MediaElement in Silverlight without holding up the UI thread -

i have loop of audio files need played in mediaelement. and need wait 5 seconds between each one, i'm experiencing trouble ui thread being held thread.sleep() command. there way delay audio file ? int _interval_time = 5000; .... //loop start thread.sleep(_interval_time); //holding ui media.play(); //loop end i'm using silverlight 5 (xap) web control thanks rob that, here created timer solve. dispatchertimer _timer = new dispatchertimer(); int counter = 0; _timer.interval = timespan.fromseconds(1); _timer.tick += (s, e) => { counter++; if (counter >= _interval_time) { _timer.stop(); //do stuff here } }; _timer.start();

Yoshi's jQuery typewriter effect break loop -

i'm still new jquery. found typewrite effect yoshi , love it!!! can please tell me, how make stop/freeze on last line? here's script: http://jsbin.com/araget/459/ here's question yoshi answered: https://stackoverflow.com/a/13325547 i apologize if i've posted incorrectly, couldn't find way ask question , i'm stuck :/ try add cleartimeout if length equal text-index var clr=null;// variable clearing timeout ..... clr = settimeout(function () { // if(idx==settings.text.length-1){ // check if length equal text.length-1 cleartimeout(clr); // clear timeout return false; // break loop } .... .... live demo

Excel vba search in array -

i need search in array sub f() dim myarray variant myarray = worksheets("qq").range("d:f") dim searchterm string searchterm = "927614*" 'check if value exists in array if ubound(filter(myarray, searchterm)) >= 0 , searchterm <> "" msgbox "your string match value f column " & myarray(application.match(searchterm, myarray, false),3) else msgbox ("search term not located in array") end if end sub but error type mismatch. how lookup value * in array? just loop through array , use like . untested code: dim matchfound boolean matchfound = false = 1 ubound(myarray, 1) j = 1 ubound(myarray, 2) if myarray(i, j) searchterm msgbox "found match @ (" & & "," & j & ") : " & myarray(i, j) matchfound = true exit end if next j if matchfound exit

java - Why Process destroy cannot work when exec bat but not exe -

process p = runtime.getruntime().exec(new string[] { "c:/work/bat/consoleapplication1.exe" }); thread.sleep(4000); p.destroy(); int res = p.waitfor(); system.out.println("res" + res); this print res1 , jvm stoped @ 1 time, if : process p = runtime.getruntime().exec(new string[] { "c:/work/bat/exe.bat" }); this print res1 after 4s jvm not stopped @ 1 time. jvm stop after more 6s . this exe.bat c:\work\bat\consoleapplication1.exe this consoleapplication1.exe : int _tmain(int argc, _tchar* argv[]) { int a=0; while(a<100){ sleep(100); cout<<a++ <<endl; } return 0; } so, how can stop bat file exe file? try kill process. find process id , use taskkill command. runtime rt = runtime.getruntime(); rt.exec("taskkill " +<your process id>); but works in windows. linux use - rt.exec("kill -9 " +<your process id>);

concurrency - CUDA: Concurrent, Unique Kernels on the Same Multiprocessor? -

is possible, using streams, have multiple unique kernels on same streaming multiprocessor in kepler 3.5 gpus? i.e run 30 kernels of size <<<1,1024>>> @ same time on kepler gpu 15 sms? on compute capability 3.5 device, might possible. those devices support 32 concurrent kernels per gpu , 2048 threads peer multi-processor. 64k registers per multi-processor, 2 blocks of 1024 threads run concurrently if register footprint less 16 per thread, , less 24kb shared memory per block. you can find of hardware description found in appendices of cuda programming guide.

html - Text over skewed div with background image -

is there way put text on div has been skewed background image on it? heres example of i'm trying achieve because i'm using ::before pseudo element text appears behind image. html <div class="diag-right">text here</div> css .diag-right { height:220px; float:right; width:260px; position: relative; overflow: hidden; outline: 1px solid transparent; left: -120px; transform: skew(-20deg); -o-transform: skew(-20deg); -moz-transform: skew(-20deg); -webkit-transform: skew(-20deg); -ms-transform: skew(-20deg); -sand-transform: skew(-20deg); } .diag-right::before { content: ""; position: absolute; width: 370px; height: 100%; top: 0; left: -40px; background: url("http://imgur.com/t25mfev.jpg") 0 0 repeat; transform: skew(20deg); -o-transform: skew(20deg); -moz-transform: skew(20deg); -webkit-transform: skew(20deg); -ms-transform:

javascript - Prevent html pages from browsing caching -

the problem having partial files(*.html) getting cached browser. while developing it's not big problem once deploy application, clients see old page(s) until clear cache or hit ctrl f5 have tried specifying meta tags(cache-control,expires) still see pages getting picked cache in developer tool of chrome (maybe missing here?). i going try , add random number in front of url <div ng-include src="'views/test.html?i=1000'"></div> but came across https://groups.google.com/forum/#!topic/angular/9gorrowzp2m ,where james cook rightly states way fill cache partials on , over. i read somewhere it's better set meta tags in headers server don't know how that? thinking of somehow doing in http interceptor?maybe somehow add meta tags in request or response of httpinterceptor? https://gist.github.com/gnomeontherun/5678505 any ideas how that? or if it's good/bad idea? or other way prevent partial pages getting cached browser? to p

How to get the image of vimeo video? -

how image of vimeo video. can image of youtube video using api. how same can done in vimeo case? i need because want pin(share) vimeo video on pinterest , pinterest allows images in url. or if there other way pin vimeo video in pinterest please suggest me! , , suggestion appreciated. vimeo video link for private videos need use api : https://developer.vimeo.com/api/start for public videos can use oembed : https://developer.vimeo.com/apis/oembed

ios - Canceling login credentials, will call SKPaymentTransactionStatePurchased case -

i implemented iap in app code: -(void)paymentqueue:(skpaymentqueue *)queue updatedtransactions:(nsarray *)transactions { (skpaymenttransaction *transaction in transactions) { [_loadingindicator startanimating]; switch (transaction.transactionstate) { case skpaymenttransactionstatepurchased: [self unlockpurchase]; [[skpaymentqueue defaultqueue] finishtransaction:transaction]; break; case skpaymenttransactionstaterestored: [self unlockpurchase]; [[skpaymentqueue defaultqueue] finishtransaction:transaction]; break; case skpaymenttransactionstatefailed: nslog(@"transaction failed"); [[skpaymentqueue defaultqueue] finishtransaction:transaction]; break; default: break; } } } when purchase button pressed , alert view pops ,

ios - Linked In invitation api using NSMutable request -

am using following code send invite linked in account using email id. problem turns out no invitation request received. please help... -(void)sendinviteto:(nsdictionary*) member withcompletionhandler:(void (^)(bool, nserror *))completionblock { globalhandler *gb=[globalhandler getobject]; [gb.tokenhandler linkedinauthtokenwithcompletionhandler:^(nsstring *authtoken, nserror *error) { if(!error) { nsstring *firstname=[member valueforkey:@"firstname"]; nsstring *lastname=[member valueforkey:@"lastname"]; nsstring *str=[nsstring stringwithformat:@"https://api.linkedin.com/v1/people/~/mailbox?oauth2_access_token=%@&format=json",authtoken]; nslog(@"invite str=%@",str); nsmutableurlrequest *request=[nsmutableurlrequest

Rails devise after clicking confirmation link user logged in -

i want when user click confirmation link after user should logged in , redirect specific path. don't have idea.how can this? now i'm click account confimation , redirect sign in page want logged in , redirect root page this confirmation_instructions.html.erb <p>welcome <%= @email %>!</p> <p>you can confirm account email through link below:</p> <p><%= link_to 'confirm account', confirmation_url(@resource, confirmation_token: @token) %></p> this user.rb class user < activerecord::base has_paper_trail acts_as_messageable rolify # include default devise modules. others available are: # :confirmable, :lockable, :timeoutable , :omniauthable devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, :trackable, :validatable has_one :day_care has_many :actvities, dependent: :destroy has_one :director, dependent: :destroy has_one :assistant_director, dependent: :

android-how to remove lines on map -

i'm drawing lines between 2 position on map , works fine . i need remove them when want draw new line . code : polylineoptions lineoptions; arraylist<latlng> points = null; for(int i=0;i<result.size();i++){ points = new arraylist<latlng>(); list<hashmap<string, string>> path = result.get(i); for(int j=0;j<path.size();j++){ hashmap<string,string> point = path.get(j); if(j==0){ distance = (string)point.get("distance"); continue; }else if(j==1){ duration = (string)point.get("duration"); continue; } double lat = double.parsedouble(point.get("lat")); double lng = double.parsedo

javascript - Using oauth_token and oauth_token_secret how to get user details with twitter api? -

i have oauth_token , oauth_token_secret. there way twitter user details using this? have twitter button in website , after successful login got oauth_token , oauth_token_secret. you can retrieve quite bit of information users api. visit ( https://dev.twitter.com/docs/api/1.1 ) , scroll down "users" section. details calls can make , information returned each.

javascript - XMLHttpRequest syntax for photos -

according google's chrome getting started tutorial: https://developer.chrome.com/extensions/getstarted i having difficulty understanding source code javascript function xhr request grab photos flickr requestkittens: function() { var req = new xmlhttprequest(); req.open("get", this.searchonflickr_, true); req.onload = this.showphotos_.bind(this); req.send(null); }, i understand syntax of req.open, req.send,etc. why boolean true, placeholder, , null inserted? these necessary parameters request? can please explain or refer resources explain it? thanks! the best resource xmlhttprequest specification . you can read there, that: open method has following syntax: open(method, url [, async = true [, username = null [, password = null]]]) can see: async argument optional , defaults true. in example can omitted. send method, send([data = null]) , takes optional argument providing request entity body. defaults null , ignored when requ

jsf - PrimePush under Jboss 7.1.1 -

i developing counter example application primepush technology. i'm using promefaces 5.0 , atmosphere 2.1.6 under jboss 7.1.1 i discovered primefaces 3.4.2 , atmosphere 1.0.8 push works. must use primefaces 5.0 so i'm using official primefaces counter example @managedbean @applicationscoped public class globalcounterview implements serializable{ private volatile int count; public int getcount() { return count; } public void setcount(int count) { this.count = count; } public void increment() { count++; eventbus eventbus = eventbusfactory.getdefault().eventbus(); eventbus.publish("/counter", string.valueof(count)); } } here's web.xml <servlet> <servlet-name>faces servlet</servlet-name> <servlet-class>javax.faces.webapp.facesservlet</servlet-class> <load-on-startup>1</load-on-startup> <async-supported>true</async-sup

c++ - std::array compile time deduction -

i have piece of code tried automatically decode buffer given awaited data types. data represented tuples: std::tuple<uint8_t, int32_t> data; size_t bufferindex; iobuffer::constsptr buffer( std::make_shared<iobuffer>(5) ); i have tuple heplers iterate on tuples , execute functor each one: //------------------------------------------------------------------------- // template <typename function, typename ...tuples, typename ...args> void iterateovertuple( function& f, std::tuple<tuples...>& t, args&... args ) { impl::iterateovertupleimpl<0, sizeof...(tuples), std::tuple<tuples...>>()( f, t, args... ); } //--------------------------------------------------------------------- // template <int i, size_t tsize, typename tuple> struct iterateovertupleimpl : public iterateovertupleimpl<i + 1, tsize, tuple> { template <typename function, typename ...args> void operator()( f

.htaccess RewriteBase vs html Base? -

i have folder inside root called someappname , users can logout going link someappname/logout . users need able logout anywhere in site. instance when editing list of regrets. when users go /someappname/regret-list/edit/<someregretid> , done editing takes them /someappname/regret-list/edit/logout not existing route. i thought fixed adding .htaccess file , using rewritebase /someappname/ , instead directing users /logout instead of reaching /someappname/ not arriving @ /logout not intended behavior. i pretty sure can fix using html base property don't understand why .htaccess file not help? advice appreciated. after research find .htaccess: rewritebase works rewrite base of rewrites. means routing not work correctly without when move application out of root folder , needed that. appears need html base in order links absolute going right places. tl;dr you need both, 1 apache mod rewrite , other common absolute links. unless wish include new par

Magento - Shipping Rates - rates by product and by country -

i try implement bit special delivery rate: sum of rates products , rates country. exemple: - product : shipping rates = 2 euros - product b : shipping rates = 3 euros - delivery country : 5 euros total shipping rates 10 euros. i try owebia shipping don't think it's possible combine summ of products rate , destination rate, maybe, but... sum of products rates ok, can not add destination rate. maybe have idea? thanks.

lua - Conditional operator does not work -

i use "storyboard", , conditional operator not work on create scene. file result.lua have statement, must rely age depending on variable mydata.year. operator "if" not work. my code on zip file "test.zip". please, me, doing wrong? its code: https://www.dropbox.com/s/40qxy6ljz725uol/test.zip

Storing client's IP address in Firebase -

as far know there no information available browser find out client's ip address without making call resource. is there way store client's ip address? mean in similar way firebase.timestamp placeholder works. although i've heard there ways clients determine , report ip address, relying on client side code report ip address opens ability run custom client side code report wrong ip address. the secure way of keeping track of clients' ip addresses either involve having server, or firebase having special function, when called client, causes firebase's server grab client's ip address , save you. my recommendation run simple server can take post request. server needs able verify user request coming from, , able accurately grab client's ip address , save on firebase.

vb.net - OPTION STRICT OFF - NULL Exception -

please see code below: dim strhidereason string = strhidereason & " " & objdbdr.getname(inthidecheck) & " " & objdbdr(inthidecheck) objdbdr(inthidecheck) null. objdbdr datareader. the code above compiles, trying set option strict on, have this: dim strhidereason string = strhidereason & " " & objdbdr.getname(inthidecheck) & " " & cstr(objdbdr(inthidecheck)) it throws exception. can refactor code resolve this, confused why first compiles. compiler ignore objects null in string concatenations when option strict off? when have option strict off: on runtime object objdbdr(inthidecheck) automatically converted(if possible) type string. msdn for strings in visual basic, empty string equals nothing objdbdr(inthidecheck) return nothing converted string empty string. when have option strict on: option restrict implicit conversions, , must convert objects string self. function cstr

Alfresco 3.3 - Selecting document based on category -

we have limitation of using 3.3 sometime. simple scanerio: created folder structure in site. created couple of documents in folder under site created categories applied couple of categories on documents now need fetch documents based on categories.... tried: 1. cmis way. - not possible. 2. other way? please suggest. you can lucene search, this: path:"/cm:categoryroot/cm:generalclassifiable/cm:languages/cm:german//member" you can run search node browser try out. can run server-side javascript, this: var results = search.lucenesearch('path:"/cm:categoryroot/cm:generalclassifiable/cm:languages/cm:german//member"'); print (results.length);

.htaccess - htaccess to web.config 500 internal server error -

i have web page working on linux server. content of htaccess file <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?sayfa=$1 [l] </ifmodule> i moved page windows server supports php , mysql. htaccess did not work. created web.config code using online tool. webconfig code. <rule name="rule 1q" stopprocessing="true"> <match url="^(.*)$" /> <action type="rewrite" url="/index.php?sayfa={r:1}" /> </rule> but code not work? how can fix it? lot

python - Audio visualizer on led matrix -

my need play audio file , have contents on 8x8 matrix in equalizer aspect done in piccolo quite spectrum analyzer adapted beaglebone or raspberrypi. doesn't need ambiant analysis microphone : visualisation when playing music on same board. adafruit made library made leds matrix control easy, missing audio analysis down matrix each audio chunk. languages maybe c or c++, best if it's in python code.for there libraries timeside , aubio couldn't found out how fill leds matrix same way in piccolo, though i've tested examples. to crude 8-band, 8-level ongoing spectral estimate (in python, using numpy): import numpy np fftsize = 4096 # 100ms @ 44 khz; each bin ~ 10 hz # band edges define 8 octave-wide ranges in fft output binedges = [8, 16, 32, 64, 128, 256, 512, 1024, 2048] nbins = len(binedges)-1 # offsets our 48 db range onto useful, per band offsets = [4, 4, 4, 4, 6, 8, 10, 12] # largest value in ledval nleds = 8 # scaling of leds per doubling in a