Posts

Showing posts from July, 2011

c++ - Array of different objects -

alright trying this. i have account class, have checkingaccount , savingsaccount class inherit account class. in program have array called accounts. going hold objects of both types of accounts. account** accounts; accounts = new account*[numaccounts]; accountfile >> tempaccountnum >> tempbalance >> temptransfee; checkingaccount tempaccount(tempbalance, tempaccountnum, temptransfee); accounts[i] = tempaccount; i error when trying assign tempaccount accounts array. no suitable conversion function "checkingaccount" "account" exists. how make accounts array hold both kinds of objects? each element in accounts account* . is, "pointer account ". you're trying assign account directly. instead, should taking address of account: accounts[i] = &tempaccount; remember pointer pointing @ invalid object once tempaccount has gone out of scope. consider avoiding arrays , pointers. unless have reason not to, us

underscore.js - Group objects by property in javascript -

how convert this: [ {food: 'apple', type: 'fruit'}, {food: 'potato', type: 'vegetable'}, {food: 'banana', type: 'fruit'}, ] into this: [ {type: 'fruit', foods: ['apple', 'banana']}, {type: 'vegetable', foods: ['potato']} ] using javascript or underscore assuming original list contained in variable named list : _ .chain(list) .groupby('type') .map(function(value, key) { return { type: key, foods: _.pluck(value, 'food') } }) .value();

c# - Are the SmtpClient.SendMailAsync methods Thread Safe? -

the smtpclient class states instance members not thread safe. can seen if concurrent calls made send or sendasync . both methods throw invalidoperationexception on second call if first has not yet completed. the method sendmailasync , introduced in .net 4.5, not list invalidoperationexception thrown exception. new .net 4.5 methods implement sort of queuing? reflector isn't able shed light on implementation details of class, assume has been implemented in native methods. can multiple threads call sendmessageasync method on shared instance of smtp client safely? i'm not sure why using reflector didn't work you. if decompile it, see following code: [hostprotection(securityaction.linkdemand, externalthreading=true)] public task sendmailasync(mailmessage message) { taskcompletionsource<object> tcs = new taskcompletionsource<object>(); sendcompletedeventhandler handler = null; handler = delegate (object sender, asynccompletedeventa

javascript - Iterating over parent elements -

i have html looks (sample 1): <tr id="q_19030" class="q_grid " style="background: none repeat scroll 0% 0% yellow;"> <a class="reset-button" data-question-id="g_1363"></a> </tr> i have html looks (sample 2): <fieldset id="q_19044" class="q_default " style="background: none repeat scroll 0% 0% yellow;"> <a class="reset-button" data-question-id="q_19044"></a> </fieldset> i have jquery code this: $(document).ready(function() { $('.surveyor_radio').parent().parent().append('<a class="reset-button">reset</a>'); $('.reset-button').click(function () { $('#'+$(this).data('question-id') + ' input[type="radio"]:checked').prop('checked', false).trigger('change'); }); $('fieldset').each(function () { var qid =

c++ - Maximum value for unsigned int -

this question has answer here: testing maximum unsigned value 6 answers here's want: unsigned int max_unsigned_int_size; max_unsigned_int_size = ???; how should this? c #include <limits.h> unsigned int max_unsigned_int_size = uint_max; c++ #include <limits> unsigned int max_unsigned_int_size = std::numeric_limits<unsigned int>::max();

text - Reading a part of a txt file in VB.NET -

i need read txt file part part... example, in txt file: (age,5char_name) 17susan23wilma25fredy i need read firstly 17susan . in other words, first 7 characters , after 23wilma , 25fredy , i'm not reading whole file , substring file record. there way via streamreader? records 7 bytes... 2 bytes age, 5 bytes name , records in line. there no jump next line. i think there solution: dim filestream new filestream("\records.txt", filemode.open) dim streamreader new streamreader(fs) dim buffer(7) char bw.readblock(buffer, 0, 7) console.writeline(buffer) this read first 7.. can read other via loop or for..

mysqli - Multiple MySQL access blocked using PHP but not MySQL locked -

i have upload location users can update portion of database uploaded file. files 9gb, inserting 150,000,000 lines can take few minutes. after clicking button on website update database, php (using mysqli) goes on mysql lock down. if open other tabs, nothing until large update complete. however, know it's not locking database/table, because cli can still "select count(*) table" , gives me result right away. what best method of inserting 150,000,000 records while still letting other php pages access db (for reading only)? you can use "insert delayed". delayed option insert statement mysql extension standard sql useful if have clients cannot or need not wait insert complete. common situation when use mysql logging , periodically run select , update statements take long time complete. you can read resource on official documentation here . ;-)

android - getbluetoothservice() called with no bluetoothmanagercallback -

i getting getbluetoothservice() called no bluetoothmanagercallback error in android application. i have no idea causing or bluetooth manager callbacks. can give me idea of causing problem or start looking. by reading android source code, seems warning cannot about. source code shows if call bluetoothsocket#connect(); then call bluetoothadapter.getdefaultadapter().getbluetoothservice(null); the key here, null parameter passes in above line. due this, there no callback, , bluetoothsocket class throw out warning. since warning, not think need it. https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/bluetooth/bluetoothsocket.java line 306 https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/bluetooth/bluetoothadapter.java line 1610

ruby on rails - TypeError: failed to coerce oracle.sql.DATE to oracle.sql.DATE -

environment: rails 3.2.11 jruby 1.7.2 activerecord-oracle_enhanced-adapter (1.4) server: jboss-as 7.1 standalone, java 1.6.2 the issue around date being sent request parameter in valid timestamp format (2013-04-12 08:00:00.000000). when doing in rails throws error in title doesn't make whole lot of sense. this doesn't happen when run in native jruby , java 1.7 though. looking answers find work around before install later java version on server. i able issue switching connection settings connection string instead of jndi; suspecting bug somewhere in jboss layer.

simplexml - create php array using simpleXMLobject -

i'm trying array ($resdata) object(simplexmlelement) php array: $resdata = array(59) { [0]=> ... [10]=> object(simplexmlelement)#294 (28) { ["reservation_id"]=> string(7) "8210614" ["event_id"]=> string(6) "279215" ["space_reservation"]=> array(2) { [0]=> object(simplexmlelement)#344 (9) { ["space_id"]=> string(4) "3760" ["space_name"]=> string(9) "205" ["formal_name"]=> string(33) "center" } [1]=> object(simplexmlelement)#350 (9) { ["space_id"]=> string(4) "3769" ["space_name"]=> string(9) "207" ["formal_name"]=> string(32) "right" } } } } i've tried: $res = (array)$resdata; $reservation = $res['reservation']; $result = array(); foreach ($reservation $key => $value){ $res = array($value); $spid = $res[0]

sql - Query taking too much -

i trying execute updates while condition returns results, problem when testing query never finishes. here query; while(select count(*) agreement agr agr.id in ( select toa.id agreement_temporaryonceagreement toa toa.executed =1) , agr.endingdate null) > 0 begin declare @agreementid int; set @agreementid = ( select top 1 agr.id agreement agr agr.id in ( select toa.id agreement_temporaryonceagreement toa toa.executed =1) , agr.endingdate null ) update agreement set endingdate = ( select tado.date temporaryagreementsdateofexecution tado tado.agreementid = cast(@agreementid int)) agreement.id = cast(@agreementid int); end; you don't need loop. single update query resembling should job done. update set endingdate = tado.date agreement join temporaryagreementsdateofexecution tado on a.agreementid = tado.agreementid join agreement_temporaryonceagreement toa on a.id = toa.id endingdate null , toa.executed = 1 there might slight variations depending on rd

Using Form Information As a Variable using Javascript and Forms -

alright, people of stack overflow, have question you: in web design class @ high school , learning ahead of class since knew first half of class. asked teacher if teach have learned javascript , agreed. however, 1 of things wanted me teach not working me when try out on own. trying simple check variable when input name box, if name or teacher's name pulls popup says "welcome" or that, , if else says "go away" issue no matter try in code not working. test function have @ moment; intended print out <!doctype html> <html> <head> <script type="text/javascript"> var name = document.kageform.user.value; function validator(){ alert(name); } </script> </head> <body> <form name="kageform"> username:<input type="text" name="user"> <br/> password: <input type="password" name="pass"

Function to terminate while loop in python? -

i create function keep_running define based on input either sensitive time had been running or number of iterations. can't seem come pythonic way iterations without decrementing counter outside of function, e.g.: def keep_running(ttl): return ttl > 0 ttl = 1 while keep_running(ttl): do_stuff() ttl -= 1 is there better way this, preferably within function keep_running ? the best way manage state inside class. initialize object loop_context ttl value, , loop condition loop_context.keep_running() .

Strategies for managing sorted lists in Firebase -

if had master list of million items, , list of million users, , each user had custom sorted subset of 50 items, immediate way model like: items [itemid] : { name : 'aaa', description : 'bbb', ... } ... users [userid1] : { name : 'john', token : 'xyz', sorteditems : { itemid1 : xx, itemid2 : xx, ... } } each user own collection of sorteditems in whatever order needed. problem have have multiple requests per item full item data. after handling updates sorted list, need query master list item data. not big deal, recommended? another strategy duplicate item data in both master list , sub-lists (or rid of master list). way data right there when need it. obvious problem synchronization. happens if property of item changes? you'd have loop through every user's sorteditems list , update each instance - recipe serious data inconsistencies. thoughts?

gui builder - Is it possible to build a Netbeans Matisse based project without Netbeans? -

part of project i'm on has gui app built netbeans using gui design tools come in ide. but part of bigger project, , needs built in environment not have netbeans installed (it happens gradle-based build on jenkins). i've gotten builds (seemingly) work, keep running inexplicable run-time errors (i.e., dependencies appear met identical jars on classpath , on, attempts read resources project jar fail.). from googling around, looks might have compiling .form files , including dependency resulting java. (though, netbeans build not add jars above our gradle build adds). so question is... can done? or proper build rely on hidden build-time mojo that's going on in netbeans? yes, can compile classes without netbeans. sure not netbeans library, absolutelayout . .form files netbeans showing components matisse, generated code in .java file.

struts2 - struts 2 Action chain getting different values of same object -

i have action class passing value jsp, modifying value in action class 1 , due action chain, action2 being called. in action 2 getting original value value= 100// in jsp action 1: value*10= 1000// action 1 go action 2 i want modified value go action 2 i.e. 1000// value modified in action 1. getting 10// i.e. original value. can tell me in order use values obtained action 1. struts.xml <action name="action1" class="vaannila.action.action1"> <result name="success" type="chain">action2 </result> </action> <action name="action2" class="vaannila.action.action2"> <result name="success" type="dispatcher">result.jsp </result> </action> action 1 public class action1 extends actionsupport implements sessionaware{ public string execute() throws exception{ system.out.println("original"+ psb.getvalue() ); // getting

animation - SVG animate point in cycle -

i have path various arcs. want animate single arc indefinitely. currently, can : http://jsfiddle.net/glxkt/1/ <animate id="c1" xlink:href="#p1" attributename="d" attributetype="xml" from="m 300 300 c 300 300 600 300 300 400 " to="m 300 300 c 300 300 400 300 300 400 " dur="1s" fill="freeze" /> <animate id="c2" begin="c1.end" xlink:href="#p1" attributename="d" attributetype="xml" from="m 300 300 c 300 300 400 300 300 400 " to="m 300 300 c 300 300 600 300 300 400 " dur="1s" fill="freeze" /> which can once. how can make animation indefinite? the end="indefinite" makes repeat , begin makes start both @ 0s , when other animation finishes. continuously repeats in firefox. <svg version="1.1&q

Three.js OBJLoader does not load obj file -

i trying load obj file using objloader.js trying load "plane.obj" file exists inside same folder html files exists , "objloader.js" exists in same folder. page doesn't show anything. here code : var scene = new three.scene(); camera = new three.perspectivecamera(75, window.innerwidth/window.innerheight, 0.1, 1000); var renderer = new three.webglrenderer(); renderer.setsize(window.innerwidth, window.innerheight); document.body.appendchild(renderer.domelement); var geometry = new three.cubegeometry(1,1,1); var material = new three.meshbasicmaterial({color: 0x00ff00}); var cube = new three.mesh(geometry, material); scene.add(cube); camera.position.z = 5; function render() { requestanimationframe(render); cube.rotation.x += 0.01; cube.rotation.y += 0.01; renderer.render(scene, camera); } var texture = three.imageutils.loadtexture( 'tex.jpg' ); var loader = new three.objloader(); loader.load( 'plane.obj', functio

ssis - AdventureWorks2012 database missing "DimTime" table -

i doing "creating simple etl package" microsoft technet tutorial. referes "dimtime" table in database not available. aware in 2008 version , "dimtime" renamed "dimdate" . does hold 2012 version? does tutorial hold 2012 version or 2008 or 2088r2 version? i tried ask in microsoft issue tracker no answers yet. you have use dimdate instead of dimtime. the dimtime table has been renamed dimdate since table contains dates rather times. source: http://msftdbprodsamples.codeplex.com/wikipage?title=awdw2008details

ruby on rails - wrong number of arguments (2 for 1) - ArgumentError in TwitterController#login -

i'm trying integrate twitter onto website users can register , login using twitter here's error when go http://localhost:3000/twitter/login argumenterror in twittercontroller#login wrong number of arguments (2 1) here's twitter controller far class twittercontroller < applicationcontroller def index end def login oauth.set_callback_url("http://#{request.host}/twitter/finalize") session[:request_token] = oauth.request_token.token session[:request_secret] = oauth.request_token.secret redirect_url = oauth.request_token.authorize_url redirect_url = "http://" + redirect_url unless redirect_url.match(/^http:\/\//) redirect_to redirect_url end def finalize end def oauth @oauth ||= twitter::client.new(app_config[:twitter][:consumer_key], app_config[:twitter][:consumer_secret]) end end what's causing inside controller? full trace: twitter (4.6.2) lib/twitter/client.rb:51:in `initialize' a

networking - can some one explain communication between two clients in below network? -

pc1 -> switch -> switch b -> pc2. ip address of pc1 -192.168.2.1 ip address of pc2 -192.168.2.2 if ping pc2 pc1, how packet forwarded? what packets source ip address, destination ip address, source mac address , destination mac address @ port connecting pc1 , @ port connecting pc2 ? you can omit switches between hosts, because don't affect or modify communication between hosts. store informations mac address reachable @ interface reduce spamming network segments useless data. whole communication done in few steps: pc1 want send icmp packet pc2, don't know mac address yet network: : pc1: arp - address of 192.168.2.2? network: : pc2: arp - address of 192.168.2.2 aa:bb:cc:dd:ee:ff pc1 has l2 address, can send packet network: : pc1: icmp echo-request - src-mac: 11:22:33:44:55:66, src-ip: 192.168.2.1 ... dest-mac: aa:bb:cc:dd:ee:ff, dest-ip: 192.168.2.2 pc2 recieves icmp echo-request, , want send echo-reply, don't know l2 address of 192.168.2.

sip - Modem Over IP or VOIP? -

i need connect remote server via modem legacy app. don’t have physical access server adding real modem isn't option. does know of: a service provides modem on ip? twilio, modems. a modem / sip client allow me emulate modem on specific com port connects voip provider? any advice appreciated. see quite few people problem, no great solutions. thanks! steve i think looking ppp (or maybe pppoe ). ppp common , still used heavily today pretty everywhere have home connected internet connection. you need @ whatever os using , see provide able connect 2 computers via modem , create tcp/ip connection between them. way don't need change program, showup network connection. under windows have accepting incoming connections .

Pointer confusion c++ -

i have following practical work complete learn c++, i've been spending long time looking answer , reading through work i'm bit confused clarification of going wrong here. code looks below: safearray& safearray::operator =(const safearray& other) { //add code here return *this; } we have implement code assigns 1 array another. if understand code correctly method takes formal parameter of constant "safearray" called other. & after safearray means actual array passed , not copy while const means can not changed. method returns actual array , not copy of it. as such thought simple case of creating pointer, referencing memory location of "other" , returning de-referenced result. in attempts code thought i've had no luck. i tried doing following: safearray* ptr = &other; //this should have created safearray pointer memory location of array "other". the problem here error: main.cpp:31:23: error: invalid conversion ‘c

java - Scrolling over large canvas -

Image
i need understanding fundamentals of scrolling on items drawn canvas in android. suppose want create timeline time @ 0 top of visualization , time increased timeline continues rendered below previous point. if wish render on android know create bunch of items on canvas overriding ondraw(). however, let's suppose visualization bigger screen allows. for example in first picture below large black box contains entire canvas render it. create blue line runs vertically , down several yellow, green , blue rectangles. red box represents screen of android rendering visualization. opens items drawn items contained within red box show on screen. now if user scroll down, items appeared below red box in view while items have gone out of confines of red box no longer visable, represented in second picture. i believe need use scrollables i'm quite lost how so. i've read on page http://developer.android.com/training/custom-views/custom-drawing.html explaining how c

objective c - How do you store information a device even after an app is deleted? -

i trying allow user try trial of in app once. how store information after user deletes app user cannot reinstall app try trial again? you can use keychain, because keychain items not deleted if app removed device. (it may removed "secure wipe", stated here: https://stackoverflow.com/a/3885110/1187415 , not sure that.)

How to handle array of pics in matlab -

i have array called rectimgs contains 2000 pics , see individual pic do imshow(rectimgs{375}) // displays 375th pic in array. now each pic 86 * 86 * 3 (rgb) size((rectimgs{375})) ans = 86 86 3 how access each pixel of image array, example want find out average value pixel 43*44 each picture (say red value), how can that. ok, figured out eg: access green value pixel 86 * 86 of 456th picture rectimgs{456}(86,86,3) will work

excel - JXL Get Cell Address -

i using java jxl api v2.6.16 generate excel spread sheet. above title puts it, how address of cell or more writable cell writing if have cell's column , row? or have write algorithm can generate that? thanks in advance. you can use code. hope help. can use in way: celladdress(cell.getrow() + 1, cell.getcolumn()) if cell defined cell cell = somecell; private string celladdress(integer rownumber, integer colnumber){ return "$"+columnname(colnumber)+"$"+rownumber; } private string columname(integer colnumber) { base columns = new base(colnumber,26); columns.transform(); return columns.getresult(); } class base { string[] colnames = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z".split(","); string equalto; int position; int number; int base; int[] digits; int[] auxiliar; public base(int n, int b) { position = 0; equalto = ""; base = b

asp.net - Getting query string parameter value having '&' in it in C# -

i passing url follows ... response.redirect("~/all-media/books/?serachtext=on&off"); where serachtext parameter. so, when access parameter follows, gives me "on" value. request.querystring["searchtext"] so, how can solve this? this won't work. ampersand needs url encoded. the url encoded value ampersand %26 . can either: a) response.redirect("~/all-media/books/?serachtext=on%26off"); or b) response.redirect("~/all-media/books/?serachtext=" + httputility.urlencode("on&off"));

initialization - C++ : how to make sure all variables are initialized? -

recently had lots of trouble non initialized variable. in java, default value of variable null, therefore exception thrown when if non-initialized variable used. if understood, in c++, variable initialized whatever data turns out in memory. means program run, , might hard know there wrong it. what clean way deal ? there programming habit reduce risk ? in case, variable declared in header file , should have been initialized in cpp file, example of things makes error more likely. thx edition after receiving few answers: my apologies, question not specific enough. the answer use flag compilers informed of non-initialized variables useful. but there rare cased variables can not initialized @ beginning, because depending on behavior of system. in header file double learnedvalue; in cpp file /* code has nothing learnedvalue ... */ learnedvalue = a*b*c; // values of a, b , c computed in code above /*code making use of learned value ... */ now happened forgot li

python - Change default namespace of subelement in lxml -

i want generate xml lxml : <aroot xmlns="http://a/"> <broot xmlns="http://b/" xmlns:a="http://a/"> <child1/> <child2/> <a:smalltag1/> <a:smalltag2/> </broot> </aroot> but following code (that seems correct output), not generates above xml. from lxml import etree lxml.builder import elementmaker ns_a = 'http://a/' ns_b = 'http://b/' = elementmaker(namespace=ns_a, nsmap={none: ns_a, 'b': ns_b}) b = elementmaker(namespace=ns_b, nsmap={none: ns_b, 'a': ns_a}) elem = a.aroot( b.broot( b.child1, b.child2, a.smalltag1, a.smalltag2, ), ) print(etree.tostring(elem, pretty_print=true).decode('ascii')) this generates: <aroot xmlns:b="http://b/" xmlns="http://a/"> <b:broot> <b:child1/> <b:child2/> <smalltag1/> <smalltag1/> </b:

postgresql - Partial text search with postgreql & django -

tried implement partial text search postgresql , django,used following query entry.objects.filter(headline__contains="search text") this returns records having exact match,ie suppose checking match against record "welcome new world" query __contains="welcome world" , returns 0 records how can implement partial text search postgresql-8.4 , django? if want exact partial search can use startswitch field lookup method: entry.objects.filter(headline__startswith="search text"). see more info @ https://docs.djangoproject.com/en/dev/ref/models/querysets/#startswith . this method creates query (" select ... headline 'search text%' ") if you're looking fulltext alternative can check out postgresql's built in tsearch2 extension or other options such xapian , solr , sphinx , etc. each of former engines mentioned have django apps makes them easier integrate: djapian xapian integration or haystack multiple i

javascript - sending http request to local server using appcelerator -

i developing mobile apps appcelerator. problem is, not able calling rest webservice using android emulator i.e server in local system i getting "not found" error message,also using local ipv4 address in emulator, no luck. please asap. i think need access rest services local server emulator. so if using rest services using localhost try follow. if webservice url below, http://www.domain.com/your_web_service_name then replace www.domain.com 10.0.2.2 because running application emulator, have use localserver using 10.0.2.2 hopefully, work you.

c - Spidev do not write/read simultaneously using ioctl -

Image
i hope find if issue might more hardware software related (we'll see). i'm working on custom board based on freescales p1021 processor (ppc, e500v2 core). external pcb connected , configured spi. specifications of external pcb reads expects 2-byte command in full duplex mode , last byte used transfer data on miso. knowing work prepare pieces of software test device. started known spi_test program. root@p1021rdb:~# ./spi_test -d /dev/spidev32766.3 spi mode: 0 bits per word: 8 max speed: 500000 hz (500 khz) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 root@p1021rdb:~# the signal shows 608 clocks , seems there data in first half. decide investigate , testing loopback - shorcutting mosi-miso loops data rx buffer. results: root@p1021rdb:~# ./spi_test -d /dev/spidev32766.3 spi mode: 0 bits per word: 8 max speed: 500000 hz (500 khz) ff ff ff ff ff ff 40 00 00 00 00 95 ff ff ff ff ff ff ff ff ff ff ff

java - How To Remove an item from an Array and move everything else down? -

this question has answer here: removing element array (java) [duplicate] 15 answers i have array of contact objects has max of 50 contacts, have less, array initialized size of 50. need method remove contact , shift after up. have seems work @ times, not every time. public contact remove(string lstnm) { int contactindex = findcontactindex(lstnm); // gets index of contact needs removed contact contacttoberemoved; if(contactindex == -1) // if contact not in array { contacttoberemoved = null; } else { contacttoberemoved = contact_list[contactindex]; // assigns contact going removed for(int = contactindex; < numcontacts; i++) // contact removed last contact in list { contact_list[i] = contact_list[i + 1]; // shift of contacts after 1 removed down } numcontacts -= 1; // 1 contact removed total num

matlab - Lapack SPPTRF available? -

do know if matlab supports lapack spptrf function. this function quite bargain when gotta compute cholesky factorization of huge positive definite symmetric matrix. it allows factorization giving upper triangular matrix, stored uni-dimensional matrix, input. or, else, chol built-in function using spptrf internally? edit i have been able find lapack library on file exchange http://www.mathworks.com/matlabcentral/fileexchange/16777-lapack , desired implementation of spptrf function. edit 2 matlab running on machine fatally crashing each time call spptrf . is there alternative way directly handle function?

html - How to make table columns not align? -

i'm trying create table columns in rows don't align columns in other rows. possible? the short answer no . however there kinds of possibilities: columns using colspan overlap each other , sum in complex ways : there still inherent alignment can complex. tables within tables - can put table inside cell, , differently in next row; these independent subtables , align independently. entirely separate tables 1 after - have 2 or more independent <table> blocks align independently , use css ensure that, example, total widths same or whatever constraint want. for recommendations on suits best we'd need see actual desired layout looks like.

ios - SSL in stream socket connection -

i'm working in ios application. i'm trying connect https server nsstream connection. nsurlconnection , work fine , can trusted challenge : -(void)connection:(nsurlconnection *)connection didreceiveauthenticationchallenge:(nsurlauthenticationchallenge *)challenge { } but problem delegate available in stream : - (void) stream:(nsstream *)stream handleevent:(nsstreamevent)eventcode { } how manage ? i found solution. wireshark [instream setproperty:(id)kcfbooleanfalse forkey:(nsstring *)kcfstreampropertyshouldclosenativesocket]; [outstream setproperty:(id)kcfbooleanfalse forkey:(nsstring *)kcfstreampropertyshouldclosenativesocket]; nsmutabledictionary *settings = [nsmutabledictionary dictionarywithcapacity:1]; [settings setobject:_certificates forkey:(id)kcfstreamsslcertificates]; [settings setobject:(nsstring *)nsstreamsocketsecuritylevelnegotiatedssl forkey:(nsstring *)kcfstreamssllevel]; [settings seto

How can I fill in turtle directions in a list using Python? -

i have list of turtle directions: redlist = ['seth(0)', 'forward(drawdist)', 'seth(0)', 'forward(drawdist)', 'seth(90)', 'forward(drawdist)', 'seth(90)', 'forward(drawdist)', 'seth(180)', 'forward(drawdist)', 'seth(180)', 'forward(drawdist)', 'seth(270)', 'forward(drawdist)', 'seth(270)', 'forward(drawdist)'] how can fill in using list? although list of syntactically correct python statements seems opportunity use eval() , resist temptation. syntax here simple enough, function 1 argument, can use re module parse commands , execute appear valid functions against valid arguments: import turtle import re redist = [ \ 'seth(0)', 'forward(drawdist)', 'seth(0)', 'forward(drawdist)', \ 'seth(90)', 'forward(drawdist)', 'seth(90)', 'forward(drawdist)', \ 'seth(180)'

sms - Is it possible to manipulate message query(Inbox) in Android? -

sorry if asking stupid question .so want know that.is possible manipulate query ,that used messages in android.to more specific need display messages particular set of numbers in default message inbox. know can access contact list using contentprovider , manipulate .but here wanted prevent messages black listed numbers being appearing in default message inbox. if possible please guide me through .thanks in advance. you can use alertdialog.builder... try code: var dialogbuilder = new alertdialog.builder(this); dialogbuilder.settitle("record saved!"); dialogbuilder.seticon(android.resource.drawable.icdialogalert); dialogbuilder.setmessage("successfully saved!"); dialogbuilder.setneutralbutton("confirm", (sender, args) => { startactivity(typeof(activity1)); }); dialogbuilder

java - JavaCV native object deallocation -

what's wrong following javacv code? try populate cvseq further work, jvm almost reliably crashes exception_access_violation @ various places, @ [msvcr100.dll+0x3c19b] memcpy+0x20b or [opencv_core243.dll+0x61793] cvseqpush+0x133 public static void main(string[] args) { cvmemstorage memstorage = cvmemstorage.create(); cvseq seq = cvcreateseq(0, loader.sizeof(cvseq.class), loader.sizeof(cvpoint.class), memstorage); (int j=0; j<1000000; j++) { cvpoint cvpoint = cvpoint(j, j+1); system.out.println(j); cvseqpush(seq, cvpoint); } } in configuration fails after 50000 iterations, @ other count or not @ all. there apparently allocation/deallocation error. , reproduces when not running in debug mode. if explicitly call system.gc() after 20000 iterations, fails inside cvseqpush right after gc (or 1-2 iterations later, because pointer deallocated space happens point correct address). or if set both xmx , xms parameters, fa

jsp - respone.sendRedirect() works fine in firefox but not in IE6 -

i have servlet redirects jsp page using response.sendredirect(), works fine in firefox, in ie6 not redirect page. can me please? this might you: http://www.coderanch.com/t/443561/servlets/java/sendredirect-working . public void editquery() throws ioexception { string url = request.getcontextpath() + "/search.jsp"; url = response.encoderedirecturl(url); //url = response.encodeurl(url); response.setheader("pragma", "no-cache"); response.setheader("cache-control", "no-cache"); response.setheader("expires", "1"); response.sendredirect(url); } please note ie6 no longer maintained. microsoft publishes no security fixes makes unsafe browser.

quicktime - Itunes crashing While launch on Windows PC -

this little weird problem use windows 8 pc , after recent upgrade itunes started fail on launch. looked in multiple forums there no available on apple online forums. people have mentioned on these forums contacting windows , apple forums not helping there no response on issue. of course disheartening loyal itunes user me. i tried playing around itunes in order find solution on issue , found there multiple reasons why error occur, there multiple solutions problems: solution-1: (this worked me) open quicktime from quicktime menu go "edit -> preferences -> quicktime preferences" go audio tab check if safe mode (waveout only) selected. change selection direct sound instead. apply changes. relaunch itunes. solution-2: (you loose itunes data in approach) 1.open itunes library saved on local drive in case: "c:\users\username\my music\itunes\" 2.rename itunes folder else itunes old. 3.relaunch itunes. restoring itunes data: copy

.net - How to Customize window title Extended,Gradient -

Image
window x:class="wpf_ui.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mian window" windowstyle="none" allowstransparency="true" width="775" height="500" i have customize window title extended,gradient.how should in wpf. i have make window appearance abv image try this overwrite stackpanel on window tilte bar. make windowstyle="none" resizemode="noresize" , adjust margin of controls(make top negative of stackpanel) overwrite window stackpanel on title bar. <window x:class="wpf_ui.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" windowstyle="none" windowstartuplocation="centerscreen" resizemode=

javascript - db issue on reboot in IOS + cordova + app development -

i creating app in ios cordova 2.1.0 framework. database files copied in /iphone simulator/6.0/applications/782be659-4ce2-4a10-941d-32de404483e6/library/caches folder. have following code in index.html: dbname = 'database'; gappconfig.dbmessage = 'message demo'; db = window.opendatabase(dbname, "1.0", gappconfig.dbmessage, 200000); db.transaction(queryselectconfig, errorquery); //get messages db function queryselectconfig(tx) { alert('select config') tx.executesql('select * '+gappconfig.configtable, [], queryselectsuccess, errorquery); } function queryselectsuccess() called when query successful, otherwise errorquery() function gets called. so, when app executed first time, query works fine. while, when reboot simulator or device, above query fails , errorquery() function gets called. in native objective-c code, copying db files path mentioned above (where phonegap tries find db) before index.html loaded. db initializatio

c# - enable mini profiler only to specific user and roles -

in asp.net mvc scott hanselman example shows how show mini profiler local environmnet protected void application_beginrequest() { if (request.islocal) { miniprofiler.start(); } //or number of other checks, } but, go step further , able see remotely, specific logged in users, or ips. any idea how? update: used following code: protected void application_endrequest() { miniprofiler.stop(); //stop can, earlier mvcminiprofiler.miniprofiler.stop(discardresults: true); } protected void application_postauthorizerequest(object sender, eventargs e) { if (!isauthorizeduserforminiprofiler(this.context)) { miniprofiler.stop(discardresults: true); } } private bool isauthorizeduserforminiprofiler(httpcontext context) { if (context.user.identity.name.equals("levalencia")) return true; else

HTML5 Background Animation onScroll, Best Practice -

i'm looking way implement animation on background on page when user scrolls down page. think of ... maybe divided sphere closer when user scrolls down page , departed on scroll up. i thought of using svg in combination of js, maybe of know better ways implement kind of stuff. maybe of coded kind of animation? ps: don't want use flash etc., html5 , existing frameworks. i found frameworks, plugins looking , don't want hold them back. here links: scrollorama scrolldeck, parallax have nice day! :) sy

Search a .log file and output results to csv in Python -

i use python search through log file multiple times using same grep statement (or equivalent of grep statement in python) , output results .csv file, appending search results each time. my log file (small sample): 16:14:59.027003 - warn - cancel type: 100ms - id: 311yrsbj - on venue: abcd 16:14:59.027010 - warn - ack type: 25ms - id: 311yrsbl - on venue: efgh 16:14:59.027201 - warn - ack type: 22ms - id: 311yrsbn - on venue: ijkl 16:14:59.027235 - warn - cancel type: 137ms - id: 311yrsbp - on venue: mnop 16:14:59.027256 - warn - cancel type: 220ms - id: 311yrsbr - on venue: qrst 16:14:59.027293 - warn - ack type: 142ms - id: 311yrsbt - on venue: uvwx 16:14:59.027329 - warn - cancel type: 134ms - id: 311yrsbv - on venue: yz 16:14:59.027359 - warn - ack type: 75ms - id: 311yrsbx - on venue: abcd 16:14:59.027401 - warn - cancel type: 66ms - id: 311yrsbz - on venue: abcd 16:14:59.027426 - warn - cancel type: 212ms - id: 311yrsc1 - on venue: efgh 16:14:59.027470 - warn -

html - Elements of postion absolute shifts on browser resize -

when re-size browser elements position set absolute not changes according other elements. if place absolute divs inside relative black box not shown. <div id="outer"></div> <div id="blackbox"></div> <div class="form"></div> #outer{ width:1250px; height:auto; margin:auto; position:relative; } #blackbox{ width:100%; height:100%; background:#000; opacity:0.5; position:absolute; z-index:10; left:0; top:0; } .form{ width:500px; height:350px; z-index:20; background:#fff; position:absolute; top:100; left:400; } used this <div id="outer"> <div class="blackbox"></div> <div class="form"></div> </div> define parent div position relative , child div position absolute live demo more position

c# - TcpClient / TcpListener filename -

i'm implementing simple file sending method based on example found here , i'm having trouble finding reference on how go sending filename and/or type before sending actual bytes. examples i've seen, manually set filename on receiving end. my thought far sending separately string, curious if i'm missing easier/convenient way of doing this. so, there method within tcpclient/tcplistener send filename i've missed? there common way of doing haven't run across? if necessary can post code well. all can send "data", flat array of bytes. need use kind of protocol both sender , listener apply data. you want transfer "two blocks of data", in case could: send size of each block, followed actual data, followed next block size , data, or: use separator character (which works if actual data not contain separator (and there solutions escaping separator in data)) alternatively format data, instance sending xml document, containing:

vb6 - Making the VB compiler warn when I don't declare variables properly -

how can make vb6 compiler fail when forget declare variable? this stop various typing errors (both keyboard , data types) , errors this when tries access unexpected. problems caused not correctly declaring variables: unexplained errors when using undefined variable, in fact pointing somehting else variables having different values @ different times, due spelling mistakes trying access variables outside of scope appearing uninitialised you should use option explicit . should put on first line of every module , form's code section. you can configure vb6 ide add automatically new modules going tools > options > require variable declaration.

c# - How to update a poco with Enterprise-Library 5.0 -

i pass poco properties stored procedure (update , add object) earlier versions of enterprise library (e.g. v2.0) can this: var arrparam = sqlhelperparametercache.getspparameterset(connectionstring(), sprocnameset); (int x = 0; x <= arrparam.length - 1; x++) { system.reflection.propertyinfo pi = dataobject.gettype() .getproperty(arrparam[x].parametername .substring(1, convert.toint32(arrparam[x].parametername.length) - 1)); arrparam[x].value = pi.getvalue(mydataobject, null); } sqlhelper.executescalar(connectionstring(), commandtype.storedprocedure, sprocnameset, arrparam); but version 5.0 (maybe earlier?) sqlhelperparametercache.getspparameterset method gone. the question is: how can stored-proc-parameters , fill these poco-properties-values? you can this: database db = databasefactory.createdatabase(); string spname = "mysp"; var parameters = new object[] { &q

c++ - Sending a vector through zeromq with msgpack -

i can't seem send vector of struct serialized msgpack through zeromq. it's vector of struct: struct mydata { mydata() : id(0), x(0), y(0), a(0) {} mydata(const obj &r) : id(0), x(r.pose[0]), y(r.pose[1]), a(r.pose[2]) {} mydata(const obj *r) : id(0), x(r->pose[0]), y(r->pose[1]), a(r->pose[2]) {} double id; double x; double y; double a; msgpack_define(id, x, y, a); }; on sending side: data std::vector<mydata> msgpack::sbuffer sbuf; msgpack::pack(sbuf, data); zmq::message_t msg(sbuf.data(), sizeof(char *) * sbuf.size(), null, null); local_socket->send(msg); // zeromq's send function did construct sbuffer or message_t wrong? on receiving side: i'm not sure if supposed cast msg.data() or not can't find documentation on how work zeromq , messagepack. message_t msg; server_socket->recv(&msg); msgpack::unpacked unpacked; msgpack::unpack(&unpacked, reinterpret_cast<char*>(ms

ios6 - Xcode 4.6.1 error message: Could not launch "<AppName>" 'A' packet returned an error: -1 -

when try test app on device, error message: could not launch "appname" 'a' packet returned error: -1 it sounds low level problem. have replaced cable, makes no difference. when have restarted xcode, app runs on device without problems. after test runs, however, error message reappears. any ideas causes error message? any ideas how can prevent error message appears?

visual c++ - Microsoft VC++ Runtime Library : abnormal termination -

we using vc ++ dll in vb 6.0 application. working in current server. plan deploy application in new server. now when tried execute vb6.0 application throwing abnormal erro , closes vb 6.0 application. i tried install vc++ redistributable package 2005 & higher.. not working.. please giude me pick correct version of redistributable package vb 6.0 thanks, gunasekaran sambandhan 1) use dependancy walker(depends.exe). application show dependancies needed vc++ dll. 2) show list of dlls. copy dlls directory vc++ dll exists. 3) if s vc++ mfc dll built "shared dll" option might need mfc dlls copied. 4) check correct c runtime library file msvcrt*.dll. file might required. although depends show these dependancies. 5) depends show whether there dependancy of c runtime library.

c# - Compile both 32 and 64 bit from the same projects? -

i using pcapdot.net dlls, both 32 , 64 bit. possible create 1 project 32 , 64 dlls after compiling create 2 different exe files 32 , 64 bit? your problem, probabbly (it's not clear) you're linking dll in project , pick right dll (32 or 64 bit) relative build of project. the solution referebce in project dll common name: say pcapdot.net dll , both platforms. and in post build event of project, based on current configuration of build, copy platform specific pcapdot.net dll folder project loads references. so when app loads load "correct" version of pcapdot.net dll . to more clear: say reference in project pcapdot.net dll "debug\external" in project tree have "your_project_name\dlls\x86\pcapdot.net dll" and "your_project_name\dlls\x64\pcapdot.net dll" say setuped project fro 64 bit compilation. in post build event, check , go copy "your_project_name\dlls\x64\pcapdot.net dll&quo

ember.js - How to instantiate the Ember Application when using precompiled templates with grunt-ember-templates -

(this questions related this one , have moved grunt-ember-templates instead of grunt-contrib-handlebars ) i trying split ember.js handlebars templates in several files, in order make code base more manageable. using grunt-ember-templates , configured follows: ember_templates: { compile: { options: { templatename: function(sourcefile) { return sourcefile.replace(/app\/templates\//, ''); // <%= yeoman.dist %>/scripts/ } }, files: { '<%= yeoman.dist %>/scripts/templates.js': [ '<%= yeoman.app %>/templates/**/*.hbs' ] } } } this creates dist/scripts/templates.js expected, client happily loading. templates.js looks this: ember.templates["accounts"] = ember.handlebars.template(function anonymous(handlebars,depth0,helpers,partials,data) { ... this looks fine me: templates saved in ember.templates array