Posts

Showing posts from March, 2015

ruby on rails - Cassandra cql comparator type counter -

ruby on rails - Cassandra cql comparator type counter - i want utilize next code updating field... @@db.execute("update user_count set counters = counters + #{val} cid = 1 ") first time tried got next fail: cassandracql::error::invalidrequestexception: invalid operation non commutative columnfamily user_count found out have utilize comparator counter, cant find how can setup cassandra-cql gem... know how can work? below there code not work ... @@db.execute("create columnfamily user_count(cid varchar primary key, counters counter) comparator = counter " ) @@db.execute("insert user_count (cid, counters) values (?,?)", 1, 0) you need set default_validation=countercolumntype instead of comparator. @@db.execute("create columnfamily user_count(cid varchar primary key, counters counter) default_validation=countercolumntype") @@db.execute("update user_count set counters = counters + 1 cid = 1") you must utilize ...

php - Selenium/PHPUnit: End a session when re-using browser sessions? -

php - Selenium/PHPUnit: End a session when re-using browser sessions? - i'm runnig selenium tests phpunit. i have long test sequences split several test files create them easier maintain. higher speed re-use browser session these cases. i able reuse sessions (phpunit_extensions_seleniumtestcase::sharesession(true)), cannot figure out how end session , open new 1 before starting next tests (which require fresh browser session). i have tried using next line in teardown() method of test kill current browser session $this->stop(); this kills browser, generates error: "session xxxxxx not exist or ended" => exactly, how selenium start new session in case? thanks clues. when create few tests method in test class (test file), i don't use $this->stop(); in teardown() method. noticed @ end of each test, browser closes itself. set browser , browser url in setup() method , open in every test method using $this->open('/'); ...

ms access - How to find count of multiple records with different where conditions from same table -

ms access - How to find count of multiple records with different where conditions from same table - i have table such this id | cid |lightness | darkness | color ------|-------|-------------|--------------|--------- 1 | 5 |10 | 20 | greenish 2 | 5 |10 | 08 | greenish 3 | 5 |10 | 10 | greenish 4 | 5 |20 | 05 | greenish 5 | 8 |10 | 20 | reddish 6 | 8 |10 | 16 | reddish 7 | 8 |33 | 20 | reddish 8 | 5 |10 | 10 | greenish i want find out following: count of records color has lightness 10 count of records color has darkness 20 so output should be color | lightness | darkness | total ---------|-------------|------------|--------- greenish | 4 | 1 | 5 reddish | 2 | 2 | 4 total |...

javascript - Have element change select form value -

javascript - Have element change select form value - how can link actions of click function select form jquery. for exmaple if image 1 clicked. how can allow form know image 1 clicked changing 'selected' alternative in form. <a href="#" rel="green">green</a> <select> <option value="green">green</option> </select> when "green" clicked "selected" alternative added selection i know i've seen done before. cannot find anywhere. thanks, robert $('a').click(function() { $('select').val($(this).attr('rel')); }); demo: http://jsfiddle.net/mz7ns/ javascript jquery

javascript - Calling onclick with local variable -

javascript - Calling onclick with local variable - first, apologies asking must answered here somewhere (i've been looking!) i want this: var i; (i = 0; < 5; i++) { ... // add together anchor dom ... a.onclick = goog.bind(this.dosomething, this); ... } namespace.clazz.prototype.dosomething = function(event, index) { console.log('index: ' + index); } i want 5 anchors each pass different value i dosomething when clicked (along click event). want maintain context of this in dosomething (hence bind). if can reverse order arguments received, should able this... a.onclick = goog.bind(this.dosomething, this, i); so dosomething should this... namespace.clazz.prototype.dosomething = function(index, event) { console.log('index: ' + index); }; at to the lowest degree that's how looks the google closure library source. javascript google-closure

windows - Recursive Unzipping with 7z.exe -

windows - Recursive Unzipping with 7z.exe - i stumbled across below line means of extracting every .zip file in every subfolder. for /f "usebackq" %a in (`dir /s /b *.zip`) 7z.exe e %a i've tried on winxp cmd.exe prompt , error: "a unexpected @ time." can please tell me whats wrong above line. 7z.exe error or there wrong batch script syntax. did cutting , paste .bat file. cheers try alter %a %%a: for /f "usebackq" %%a in (`dir /s /b *.zip`) 7z.exe e %%a windows batch-file unzip 7zip

ruby - Rails SelectTag include_blank not working -

ruby - Rails SelectTag include_blank not working - i using select_tag , populating database using this. <%= select_tag 'project', options_from_collection_for_select(@issue_statuses,"id", "name"), :include_blank => 'select' , html_options = { :onblur => "myblur(this);", :onchange=> "submit_selected(this);", :style=> "visibility:visible;" } %> but on including ":include_blank" getting next error: compile error /home/hitesh/redmine-1.3.0-1/apps/redmine/vendor/plugins/redmine_polls/app/views/questions/index.html.erb:42: syntax error, unexpected ')', expecting tassoc ...le=> "visibility:visible;" } ).to_s); @output_buffer.concat ... ^ how include blank or prompt value in above code. thnx. enclose :include_blank phone call within this: {} <%= select_tag 'project', options_from_collection_for_select([],"id...

mysql - Most efficient indexes to use for a query using WHERE and GROUP BY? -

mysql - Most efficient indexes to use for a query using WHERE and GROUP BY? - i have table ~7 1000000 rows continually running queries of sort: select myfield, count(*) mytable myfield2='constantvalue' , myfield not in ( select field anothertable) , timestamp >= [arbitrarytimestamp] grouping myfield; cardinalities above fields: myfield = 40,000 distinct values. timestamp = distinct, around 7 1000000 distinct values. myfield2 = 2 distinct values. field anothertable = 50 distinct values. as expected, runs terribly slow, , using explain tells me using where; using temporary; using filesort . i improve efficiency of these queries adding index table, i'm not sure best way is. should add together index on myfield ? , index on timestamp ? both? combined index on both? also, there else can speed these type of queries? in add-on suggestions mike , dkami...

java - How to retrieve Bluetooth Address through Name from Paired/bonded device list? -

java - How to retrieve Bluetooth Address through Name from Paired/bonded device list? - i when i'm discovering devices: intentfilter filter = new intentfilter(bluetoothdevice.action_found); this.registerreceiver(mdiscovery, filter); and in in broadcastreceiver: string action = intent.getaction(); if (bluetoothdevice.action_found.equals(action)) { bluetoothdevice device = intent.getparcelableextra(bluetoothdevice.extra_device); if (device.getbondstate() != bluetoothdevice.bond_bonded) { and can device.getname() , device.getaddress(). my problem is, know how intent discovery. so, android devices fair know have list paired devices names respective addresses. given name, how can straight (without discovery , without broadcast receiver) address? after created object of bluetoothadapter ( let's mbluetoothadatper) can list of bonded(paired) devices mbluetoothadapter.getbondeddevices(). more info on link. ...

.net - How to hash a UTF-8 string in Classic ASP -

.net - How to hash a UTF-8 string in Classic ASP - i've been looking classic asp script allows me hash string using md5 algorithm. need match hashed string against same string in asp.net page, hashed using .net's md5 hashing algorithms. even though have found several scripts classic asp generate hash, haven't found 1 generates right hash using non-english characters (like ñ , example). do know classic asp script works in particular case? note: i have tried these scripts: http://userpages.umbc.edu/~mabzug1/cs/md5/md5.asp http://forums.aspfree.com/code-bank-54/asp-classic-md5-hash-82164.html examples: string: muñeca correct md5 hash: ea07bec1f37f4b56ebe368355d1c058f generated hash: 298e60cb1179df15d5772726a3975132 the first part of hashing string getting byte array of string's characters. byte array created depends on encoding type used string. .net strings encoded in utf-16. don't recall vbscript's encoding type off type...

html - list-style-image is not working -

html - list-style-image is not working - i trying create custom bullet points , not working. this html. <div id="services"> <ul id="servicetext"> <h2 id="serviceheader"><strong>services offer:</strong></h2> <li>intros</li> <li>transitions</li> <li>lower 3rd titles</li> <li>web page design</li> <li>and more...</li> </ul> </div> this css ul#servicetext { list-style-image: url(images/checkmark.gif); font-size: 14px; float: right; padding-top: 5px; color: white; } my site located here xdtrammell.com/lol if helps see code. change selector ul#servicetext li . maintain in mind can't include h2 element in ul . not valid html. html css

algorithm - To pixelate geometric primitives -

algorithm - To pixelate geometric primitives - it necessary have matrix representation of set of geometric primitives (i.e., line, curve, circle, rectangle, filled forms). simplicity may suppose dealing lines, reply on [so]. rectangles hence pixelated. rest of primitives 2 questions appear me: 1) how pixelate curve including circle (~closed curve)? 2) how pixelate filled simple / complex shape (rectangle, multi-patch)? the simplest way (currently in use) may utilizing visualizing library (such matplotlib python ) save result (a map of geometric primitives) pixelated image on disk (or ram) , reuse purpose of interest. apparently, method can handle complexity since in background whatever (the visualizer) output 2d image , i.e., 2d matrix . serious problems emerge in application: 1) procedure slow! 2) procedure not standard heavily dependent setting of visualizer, low-level configuration impossible or hard set visualizer. in other words, black box beingness...

Connect to Google Plus as a Page / Get pages the user administrates -

Connect to Google Plus as a Page / Get pages the user administrates - i'm trying here connect g+ using api. , there 1 big question. in code need connect g+ via api , posts of g+ pages. user, api's not giving authorized user's owned pages. (i.e. in case of facebook utilize "../me/accounts" pages , utilize page id-s public feed) is there way connect g+ not user, page , see posts? or there way missed user's pages? edit1: ok, learned, it's yet impossible user's administered pages. maybe there way login page or that? in case each admin of page need connect page want fetch posts from... getting activities page same getting them person. have specify id instead of using special me identifier. get activities google+ page: get https://www.googleapis.com/plus/v1/people/101560853443212199687/activities/public you can see live illustration using api explorer. google-api google-plus

coding style - Best way to use of setters in OOP -

coding style - Best way to use of setters in OOP - let's assume have class , whenever set attributes bla , foo (which can set externally , internally) want phone call method of class, let's phone call onchangefunction() . would way phone call onchangefunction() when setting internal values directly, e.g. function somefunction() // calculations here ... this.bla = some_value; this.onchangefunction() end or improve set variables bla , foo using internal setter-methods because there action triggered , more arranged code. i go step further: let's don't need extern setter can called outside (access type = public ), still invent private setter same approach , utilize setter because of triggered set-action? edit: mean following: if not have public setter (because there should not public access set variable, because it's internal variable) still have setter private -only because of triggered action thing? thanks in advance! i think in...

java - Daylight Savings Time (CST + CDT) - adding minutes issue -

java - Daylight Savings Time (CST + CDT) - adding minutes issue - i updating scheduling application ability repeat appointment dates future. the appointment future appointment time figured out finding amount of minutes between original appointment start time , end time. so, instance appointment 120 mins long. in below code, book period of time of time in appointments can made. so, booktime , appointments in getting copied. 1 iteration of appointment copying. calendar begincalendar = calendar.getinstance(); begincalendar.settime(newbooktime.getstartdate()); begincalendar.add(calendar.minute, booktimediffminutes); newappointment.setstartdate(begincalendar.gettime()); calendar endcalendar = calendar.getinstance(); endcalendar.settime(newappointment.getstartdate()); endcalendar.add(calendar.minute, appointmentdiffminutes); newappointment.setstopdate(endcalendar.gettime()); the issue on daylight savings day cst turns cdt ... if start time of appointment 11pm on cst day ,...

jquery - show list of posts/thumbs for a specific month or time period. how to implement add/remove filter functions -

jquery - show list of posts/thumbs for a specific month or time period. how to implement add/remove filter functions - this wordpress. im using jquery already, , found post creates filter: showing posts between date range this direction sense need follow, unless not. understand filters have never had utilize them , wordpress explanation confusses me. if possible. give hint in loop or how 1 might impliment filter this? think know do, cant wordpress load custom timeframe.please , give thanks you. i trying create archives page allow me select year , display thumbnails of each month's posts see fit on page. dont want dynamic/drop downwards style wordpress uses. im doing much more graphical , have finish command on , how each month going loaded, placed, , seen. [i have tried every single plugin known man, want command on please, give thanks again!]* ever heared query_posts() ? allows alter default queries in way want. have @ example, if ( is_home() ) { ...

java - Streaming XML through Transformation into JAXB Unmarshaller, with a declared class type for the root element -

java - Streaming XML through Transformation into JAXB Unmarshaller, with a declared class type for the root element - there many examples of streaming xml through xslt, jaxb java objects. this: transformer responsetransformer = transformerfactory.newinstance().newtransformer(new streamsource(getclass().getresourceasstream("responsetransformation.xsl"))); unmarshaller jaxbunmarshaller = jaxbcontext.newinstance(objectfactory.class.getpackage().getname()).createunmarshaller(); jaxbresult jaxbresult = new jaxbresult(jaxbunmarshaller); responsetransformer.transform(new streamsource(new stringreader(responsexml)), jaxbresult); res = jaxbresult.getresult(); there examples of jaxb unmarshal declared type (from unmarshaller javadoc): jaxbcontext jc = jaxbcontext.newinstance( "com.acme.foo" ); unmarshaller u = jc.createunmarshaller(); documentbuilderfactory dbf = documentbuilderfactory.newinstance(); dbf.setnamespaceaware(true); documentbuilder db = dbf.newdoc...

c# - send pdf statement without saving on application server -

c# - send pdf statement without saving on application server - requirment: generate invoice in pdf format on company template , send in email. approach used: placed company template @ path: ~content/invoicetemplate/ using itextsharp pdf stamper, generated pdf, saved @ path: ~/content/reports/ in email module, picked file generated above , attached email sent problem: every invoice generated beingness stored on application server, making application heavier day day. question: other way out send generated in voice in email, without saving on application server? code: public static void writeintemplate(list<models.statement> statementlist) { seek { string invoicenumber = statementlist.firstordefault().invoice.tostring().trim(); using (document document = new document()) { filestream filestream = new filestream(hostingenvironment.mappath("~/content/reports/" + invoicenumber + ...

ksoap2 - android soapfault error -

ksoap2 - android soapfault error - i begginer in android,here have activity utilize web service: soapobject request = new soapobject(namespace, method_name); getbounddata val = new getbounddata() { }; propertyinfo pi = new propertyinfo(); pi.setname("getbounddata"); pi.setvalue(val); pi.settype(getbounddata.class); request.addproperty(pi); soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.setoutputsoapobject(request); marshal floatmarshal = new marshalfloat(); envelope.addmapping(namespace, getbounddata.class.getsimplename(), getbounddata.class); floatmarshal.register(envelope); httptransportse androidhttptransport = new httptransportse(url); androidhttptransport.debug =true; textview t = (textview)this.findviewbyid(r.id.resultbox); httptransportse androidhttptransport = new httptransportse(url); seek { androidhttptransport.call(soap...

java - Why setVisible doesn't work? -

java - Why setVisible doesn't work? - i have swing gui border layout. in north have added component. label component has gif icon invisible lblbusy.setvisible(false); later button create visible below. why not show up? btndownload.addmouselistener(new mouseadapter() { @override public void mouseclicked(mouseevent e) { swingutilities.invokelater(new runnable() { public void run() { lblbusy.setvisible(true); btncancel.setenabled(true); } }); download = new download(txtsource.gettext(), new file(txtdestination.gettext()), textareastatus); download.start(); lblbusy.setvisible(false); } }); 1) eventdispatchthread rellated issue, edt quite guaranteed changes gui done on 1 moment 2) invoked actionperformed jbutton , , untill events ended gui should freeze or unresponsible, same jbutton , jlabel in case 3...

Call scala from java - performance? -

Call scala from java - performance? - i have parser written in scala due implementation simplicity. need phone call java application. know need include scala library in classpath, etc. performance? strong performance decreases comparing pure java parser calls? calling scala java isn't going incur overhead: it's bytecode when executes. it's not if having travel through kind of bridge between java , scala, might if calling java into, don't know, python. whether scala implementation of particular algorithm going run faster or slower depend on nature of algorithm , way you'd implement it. given you're not going implement same way in 2 languages, it's hard predict. java performance scala

iphone - Use built-in mic if Headset is plugged in -

iphone - Use built-in mic if Headset is plugged in - i playing around audiosessions in ios , want utilize built in mic of iphone sound input route if external headset (including mic) plugged in. i'm able observe if headset plugged in using next code: cfstringref route; uint32 propertysize = sizeof(cfstringref); audiosessioninitialize(null, null, null, null); audiosessiongetproperty(kaudiosessionproperty_audioroute, &propertysize, &route); if((route == null) || (cfstringgetlength(route) == 0)){ // silent mode nslog(@"audioroute: silent"); } else { nsstring* routestr = (nsstring*)route; nslog(@"audioroute: %@", routestr); nsrange headsetrange = [routestr rangeofstring : @"headset"]; if(headsetrange.location != nsnotfound) { nslog(@"headset") //route sound in built-in mic. } .... more code so, ideas how this? iphone objective-c ios

.net - Database for full text search needed. SQL vs NoSQL? -

.net - Database for full text search needed. SQL vs NoSQL? - i know there several postings topic on stackoverflow, requirements of them bit different. i'm looking database eligible total text search, main criteria short duration of query , should run on windows 2008 server appropriate drivers .net. open-minded kind of software long free - exception in terms of costs mssql server 2008 because have licences it. i assume there no free sql-based database performs improve total text search ms sql server, question if there nosql-product free , can beat ms sql server in terms of total text search. thanks you should check , compare lucene or solr (which based on lucene) indexing engine. you can utilize sql server store info (the info should indexed in fts , metadata , relationship between tables etc) , indexing lucene (if results of check show it's improve fts) .net sql database full-text-search nosql

ruby on rails - Using gsub to clean string and then truncate -

ruby on rails - Using gsub to clean string and then truncate - i need remove characters string (computer mac address + junk...) , truncate leave first 18 characters. currently, have next in model: def popular_locations popular_locations = radacct.group(calledstationid).order('calledstationid desc').count end that outputs list , count format needs adjustment search i'll do. i tried adding this: clean_mac_address = :calledstationid.gsub(/[^0-9a-z]/i, '') but error undefined method `gsub' :calledstationid:symbol -- edit -- initially calledstationid stored in db (radacct model) next format: 00-18-0a-21-44-7b:home office this mac address plus ssid name. i need strip out dashes , ssid because have model (locations) has list of mac addresses in format: 00:18:0a:21:44:7b locations , radacct unrelated (radacct model sessions dumped into). need do count of sessions , grouping calledstationid (as seen above). we'll query ...

coremidi - MidiReadProc - using srcConnRefCon to listen to only one source -

coremidi - MidiReadProc - using srcConnRefCon to listen to only one source - i trying write basic app uses coremidi receive midi events specific source. understand midi events come port phone call proc connected via midiinputportcreate(). understand when using midiportconnectsource() can send identifier (connrefcon) help know source is. i'm not sure how utilize it. i figure within midireadproc can utilize scrconnrefcon , if statement hear specific source, still dont know *void should pass separate each source. ideally readproc this: void sourcereadproc (const midipacketlist *pktlist, void *readprocrefcon, void *srcconnrefcon) { if (srcconnrefcon == mysourcechoice) { // pass pktlist } }; any help appreciated. gw after break i've come project fresh perspective. when phone call midiportconnectsource , pass unique connrefcon it's not apparently passing ...

How do I use regex in JavaScript to capture the text between two particular characters? -

How do I use regex in JavaScript to capture the text between two particular characters? - in illustration below trying capture text between 2 asterixes. var str="the *rain in spain* stays in plain"; var patt1=/\*...\*/; console.log(str.match(patt1)); i'm trying follow illustration here http://www.regular-expressions.info/examples.html \q...\e matches characters between \q , \e literally, suppressing meaning of special characters. but having problem next along try var str="the *rain in spain* stays in plain"; var patt1=/\*.*\*/; console.log(str.match(patt1)); the \* means literal "*" character. . means character , * means number of times, .* means "any number of characters". optional bonus: the code above should work fine, you'll notice matches greedily. input abcd*efgh*ijkl*mnop , output *efgh*ijkl* , whereas might have preferred non-greedy match *efgh* . to this, utilize var pa...

iphone - Paid app to Free app with Inapp purchase -

iphone - Paid app to Free app with Inapp purchase - i have paid app in appstore converting free app inapp purchase. , want give info free user's purchased version 1.0. @ point facing problem. if user buys paid app , if deletes app after sometime before release update should in case want give info free user's deleted app also. have 2 questions here 1) app gets approved if don't give info free users deleted application , doesn't have backup of app ? 2) if possible give info free user's deleted app please tell me way how it? you can not if user delete app device , install latest in app purchase version. if application interacting server , storing info user purchased app, means depend of app functionality. if app social networking app login/ registration there within app , registration of user storing on server can allow free access of app based on registration mail service id of user. secondly, if have database sqllite within application ...

jquery - Managing too much data coming back from server in ajax request -

jquery - Managing too much data coming back from server in ajax request - i have issue. need populate 1 dropdown list of items. way doing select top 500, need items in there , there 1000 or more. below paste of amount of info im trying send when site crashs. http://pastebin.com/d5xjdvur jquery: $.ajax({ type: "post", url: "webservice.asmx/getfinish1", data: '{' + 'item:"' + item + '"' + '}', contenttype: "application/json; charset=utf-8", datatype: "json", success: function (msg) { //$("#item").val(msg); var info = jquery.parsejson(msg); if (!data.error) { $.each(data, function (d) { var areatext = $('#notes').val(); if (data[d].dropdown == "finish1") { if (data[d].value != "") { $(...

vectorization - How to vectorize the following block of matlab -

vectorization - How to vectorize the following block of matlab - assume has bounds (1:2,1:2,1:numfoo ), how vectorize next lines: w = zeros( 2, 2, numfoo ); = 1:numfoo temp(1:2,1:2) = inv( a(1:2,1:2,i) ); w(1:2,1:2,i) = ( temp * (temp') ); end tyia! since matrix size 2 , can utilize explicit expressions vectorize code. https://en.wikipedia.org/wiki/inverse_of_a_matrix#inversion_of_2.c3.972_matrices dets=a(1,1,:).*a(2,2,:)-a(1,2,:).*a(2,1,:); temp=[a(2,2,:)./dets -a(1,2,:)./dets ; -a(2,1,:)./dets a(1,1,:)./dets]; w=[temp(1,1,:).^2+temp(1,2,:).^2,... temp(1,1,:).*temp(2,1,:)+temp(1,2,:).*temp(2,2,:);... temp(2,1,:).*temp(1,1,:)+temp(2,2,:).*temp(1,2,:),... temp(2,1,:).^2+temp(2,2,:).^2]; i tested it, gives same result, , speed-up x100 elapsed time 1.070547 seconds. elapsed time 0.012767 seconds. matlab vectorization

c# - Show underline to column header for GridView Sort -

c# - Show underline to column header for GridView Sort - <asp:gridview allowsorting="true" onsorting="grid_sorting"....> <asp:templatefield ...> <headerstyle font-underline="true" /> </asp:templatefield> <asp:boundfield sortexpression="xyz"...> <headerstyle font-underline="true" /> </asp:boundfield> </asp:gridview> i want show gridview column header underline user undestand header supports sorting. right on mouse on showing underline column header. using above code still not getting underline column header. way this? this work: <asp:templatefield headertext="<u>your header text</u>" //define template here </asp:templatefield> simply add together tag header text. alter header text suit needs. for boundfield (actually all), work guess. add between <head>...

iphone - Save Image With In App -

iphone - Save Image With In App - what needing is, take image or take 1 form photo library, save within app isn't visible anywhere else within app. illustration "my secret folder" images seen within app. not making secret folder app.... don't worry... =) i sorry don't have much code show, have no thought how this. i looking @ rich text file , wondering if way go , if can store images, or if have different way. thanks, denali creative llc p.s. what looking save more 1 image within application. need able name image or ever image saved into's file name. lookup/search code using uiimagepickercontroller convert image info using convert image data save info document folder. no other apps can access documents folder. folder, see post save image disk read info disk, convert image , display reverse process. iphone objective-c ios xcode

String from ajax execute as jquery -

String from ajax execute as jquery - i create ajax phone call , receive string server (this string , chain): thisitem.parent().parent().hide() now want excecute jquery chain. believe eval() answer, understand that's dangerous? so what's alternative? or eval() not unsafe purpose? you can utilize http://code.google.com/p/jquery-json/ or https://github.com/douglascrockford/json-js library convert json javascript objects. browsers have native back upwards not of them. using tool recomended now. jquery string chain

AutoCAD .NET API - Interrupting the close pallete/window/user control command -

AutoCAD .NET API - Interrupting the close pallete/window/user control command - my first post, gentle! im developing own user controls autocad 2011 , cant life of me figure out how interrupt close on user command , insert own functions before carrying on close. just clarity here capture. http://imgur.com/q1ydu basically before window closes need clear few of own layers hidden behind model space, because if user can close tool , carry on without performing wipe going cause issues when comes adding new objects/saving/etc. cant trust user click "wipe" button on uc before exiting, thats asking trouble. so question is: looking in api code closes user control? acad palettes not closed (disposed) when click on 'x' mark. hidden. might want seek palettestate::statechanged event. might triggered when 'close' palette set. register delegate event , see if called. might work. * edit * think more it, should able grab event registering delegate ...

python - Twisted PerspectiveBroker callRemote from wsgi webapp -

python - Twisted PerspectiveBroker callRemote from wsgi webapp - i'm writing wsgi application needs utilize twisted perspectivebroker phone call remote methods. problem wsgi needs homecoming rendered webpage, calls twisted service asynchronous. webapp needs phone call remote methods, other stuff, has wait remote calls finish, render page , homecoming client. best way this? i planning on using flask write app. a wsgi application runs in own thread (or process). when running in twisted's wsgi container, different thread reactor running in. of twisted's apis not thread-safe: may called in reactor thread. so, basic way phone call twisted api wsgi application using reactor.callfromthread , thread-safe , causes function called in reactor thread: ... reactor.callfromthread(pbremote.callremote, "somemethod", some, args) however, discards result, you want. it's simple build api on top of reactor.callfromthread preserves result, though, ,...

SWIG Python to C++: TypeError trying to set struct member of type map -

SWIG Python to C++: TypeError trying to set struct member of type map<string, int> - swig seems generating wrong bindings converting struct field of type map, resulting in typeerror trying set map field python dictionary. there error missing? unsupported use-case? bug in swig? first output traceback (most recent phone call last): file ".\use_test.py", line 4, in <module> struct.data = { 'a':1, 'b':2 } file "c:\users\kmahan\projects\swigtest\test.py", line 150, in <lambda> __setattr__ = lambda self, name, value: _swig_setattr(self, mystruct, name, value) file "c:\users\kmahan\projects\swigtest\test.py", line 49, in _swig_setattr homecoming _swig_setattr_nondynamic(self,class_type,name,value,0) file "c:\users\kmahan\projects\swigtest\test.py", line 42, in _swig_setattr_nondynamic if method: homecoming method(self,value) typeerror: in method 'mystruct_data_set', argument...

ios - setTintColor: on UINavigationBar appearance has no effect -

ios - setTintColor: on UINavigationBar appearance has no effect - this code alter color of app's tab bar , navigation bar: uicolor* color = [uicolor colorwithpatternimage:[uiimage imagenamed:@"blue.jpeg"]]; //set colors [[uinavigationbar appearance] settintcolor:color]; [[uitabbar appearance] settintcolor:color]; yet tab bar tint color changes; navigation bar stays black. why settintcolor: work tab bar not navigation bar? edit: interestingly enough, when testing on real device (an iphone 4 running ios 5.0.1) neither tab bar nor navigation bar's color changed; both remain black. on simulator @ to the lowest degree tab bar changes... explanation behavior? thanks! edit 2: here's part of code in applicationdidfinishlaunching: uicolor* color = [uicolor colorwithpatternimage:[uiimage imagenamed:@"blue.jpeg"]]; //create navigation controllers firstnavigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:view...

Java SVD with JAMA or else -

Java SVD with JAMA or else - i have cloud of points , need best fitting line. i'm using jama don't know why, not working. it's me doesn't how works. have nx3 matrix (this jama svd supports) , right matrix v svd. vector need right singular vector (row or coloumn ? ) corresponding greatest singular value. vector supposed represent main direction. every vector supposed have y greatest positive value, x can both positive or negative , z supposed negative. vector has negative y value, or anyway it's pointing in wrong direction. my cloud of points pretty regular, postioned along y axis (with z little , negative). main direction supposed easy find. it's still not working properly. in case i'm getting row vector (i tried coloumn vector too) of right matrix v. substracted centroid "pointset". public static matrix bestdirection(matrix pointset){ matrix bestfittingline = new matrix(3,1); singularvaluedecomposition svd = pointset.svd();...

python - Why can't objects instantiated during __init__ see their creator? -

python - Why can't objects instantiated during __init__ see their creator? - well i'm new so, oop , python too, please gentle ;) i've looked threads , explainations related scoping issue elsewhere , haven't found any. grateful assistance. sample code: class zeus(object): def __init__(self): self.name='zeus' self.maze=maze() self.maze.get_zeus_name_1() self.maze.get_zeus_name_2(self) self.get_name_1() self.get_name_2(self) def get_name_1(self): try: print zeus.name except: print "impossible!?" def get_name_2(self,scope): print scope.name class maze(object): def get_zeus_name_1(self): try: print zeus.name except: print "can't done!?" def get_zeus_name_2(self,scope): print scope.name zeus=zeus() print 'now external calls:' zeus.maze.get_zeus_name_1() zeus....

java - Android HttpURLConnection: Why Linux makes session file in everytimes -

java - Android HttpURLConnection: Why Linux makes session file in everytimes - i'm write android app based lamp. there login function in app. of operation functions perfect. but, why linux makes session files everytimes when connect on phone utilizing httpurlconnection ??? when connect web page without login webbrowser(chrome), linux makes session file it's empty <---(a) and then, connect web page with login webbrowser(chrome) too, linux makes session file appended in (a) session file. so. result. if utilize webbrowser, linux makes session file, 1. but! when connect on phone(app), linux makes session file everytimes if login, it means app login -> (linux makes session) backpress -> app login -> (linux makes session) backpress -> app login -> (linux makes session) ** checked phpsessid in logcat, , cache sql, utilizing cookie sync manager android httpurlconnection header part source url urllogin = new url(url); httpurlconnec...

PHP IRC Bot Undefined Offset -

PHP IRC Bot Undefined Offset - okay. i'm building irc bot in php. i'm noob php, bare me if it's stupid mistake. error gives me lines 45 & 50 error "undefined offset: 4 in /*//*/grue.php on line 50" here's lines: line 45: $command = str_replace(array(chr(10), chr(13)), '', $this -> ex[3]); line 50: switch($this -> ex[4]) { here's rest of code: <?php //so bot doesn't stop. set_time_limit(0); ini_set('display_errors', 'on'); //sample connection. $config = array('server' => 'irc.foonetic.net', 'port' => 6667, 'channel' => '#lingubender', 'name' => 'kibot', 'nick' => 'grue', 'pass' => '',); class grue { var $socket; // tcp/ip connection var $ex = array(); // messages function __construct($config) { $this -> socket = fsockopen($config['server'], $config['port']); $this -...

assert - assertion compareTo in java -

assert - assertion compareTo in java - string title ="a"; int year = 2009; string director = "zebra"; string title1 ="b"; int year1 = 2010; string director1 = "zzz"; videoobj = new videoobj(title,year,director); videoobj b = new videoobj(title2,year,director); assert.asserttrue( a.compareto(b) == -b.compareto(a) ); what meaning of - in assert.asserttrue( a.compareto(b) == -b.compareto(a) ); statement??? please can explanation? thanks the meaning of - negation, plain , simple. i've seen idiom in numeric comparisons homecoming -1 , 0 or +1 value, depending on comparison. although work homecoming magnitude well, -n , 0 , +n (where n identical). it's checking compareto operations give opposite value when reverse operands. in other words, it's assertion compareto functions expected (but not guaranteed - see below). if a < b , b < a (ie, a both less than, and greater b ), have serious problem ne...

javascript - how to copy all data in a row to all other rows -

javascript - how to copy all data in a row to all other rows - <table id="ratecardlist"> <tr> <th> show time</th> <th> balcony </th> <th> box </th> <th> &nbsp; </th> </tr> <tr> <td>10.30am</td> <td><input type="text" name="bal:1:3" value="100" /> </td> <td><input type="text" name="box:1:5" value="200" /> </td> <td><a href="#" onclick="applytoall();">apply all</a></td> </tr> <tr> <td>1.30pm</td> <td><input type="text" name="bal:3:3" value="400" /> </td> <td><input type="text" name="box:3:5" value="450"/> </td> ...

oracle - Getting extra messages while executing a trigger -

oracle - Getting extra messages while executing a trigger - i'm facing problem while creating db trigger raise error message oracle forms. can please help me out? my code is: create or replace trigger unsuccessful_attempts_lock before update of last_logon_date on temp_user each row declare cursor c_unsuccessful_attempts select * temp_unsuccessful_attempts user_id=:new.user_id; max_fails exception; begin r_unsuccessful_attempts in c_unsuccessful_attempts loop if(r_unsuccessful_attempts.locked ='y') raise max_fails; end if; end loop; exception when max_fails fnd_message.set_name ('fnd', 'flex-user defined error'); fnd_message.set_token ('msg', 'you have reached maximum failed logins. business relationship has been locked temporarily. please contact scheme administrator') fnd_message.raise_error; when others raise_application_error(-20400,'an ...

oop - Pass by value and pass by reference in java -

oop - Pass by value and pass by reference in java - i reading pass value , pass reference in java, got many articles,some of them saying java next 'pass value " , of them saying difference between primitive , object. wrote next sample code. , putting output also. please comment , share reply is. i checked int, string , stringbuffer , employee class, working pass reference employee class only. package test; class emp { public string name=""; public int age=0; public emp(string name, int age) { super(); this.name = name; this.age = age; } public string tostring() { homecoming "name: "+ this.name + "....age: "+ this.age; } } public class class1 { public class1() { super(); } public void dochange(int i) { = +10; system.out.println("value of integer in method:>"+ i); } public void dochange(emp i) { i.age=29; ...

wpf - StackPanel and the .NET 4 Client Profile -

wpf - StackPanel and the .NET 4 Client Profile - i have old winforms app needs few new forms, benefit wpf. next tutorial: http://www.switchonthecode.com/tutorials/wpf-tutorial-using-wpf-in-winforms the project targets .net 4 client profile. i added wpf control. however, when drop stackpanel command in designer, designer displays next error message: type universe cannot resolve assembly: system.design, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a. changing target total .net 4 resolves issue. however, requiring total .net 4 library client app seems defeat purpose of having client profile. is there way accomplish want , still target client profile? wpf user-controls stackpanel .net-client-profile

python - pip freeze > requirements.txt error -

python - pip freeze > requirements.txt error - i getting next error command: $pip freeze > requirements.txt warning: cannot find svn location distribute==0.6.16dev-r0 this requirements.txt file beforehand: django==1.3 django-registration==0.7 first, i'd note not error, rather warning (though serious one). this appears open issue in pip, judging issue page on github repository. problem arises when pip installing development version held on repository not svn. 1 illustration issue page provides: mkvirtualenv test --no-site-packages workon test pip install flask==dev pip freeze > requirements.txt it print result standard error: warning: cannot find svn location flask==0.9-devdev-20120114 but file still have: ## fixme: not find svn url in dependency_links package: flask==0.9-devdev-20120114 jinja2==2.6 werkzeug==0.8.2 wsgiref==0.1.2 however, won't able utilize file in future install flask. see here: mkvirtualenv test2 --no-s...

Rails association with almost all other models -

Rails association with almost all other models - i'm looking suggestions on how deal "regions" in system. other models in scheme (news, events, projects, , others) need have part can sorted on. far, i've considered part model has_many :through on regionlink table. i've never had model joined many others , wonder if route has negatives. i've considered using acts_as_taggable_on gem , tag regions models. seems ok i'll have write more cleanup type code handle client renaming or removing region. whatever take need handle renaming and, more importantly, deleting regions. if part gets deleted give user selection on part replace association. any advice on handling appreciated. if each news, event, etc. belong 1 region, tags don't seem natural fit imo. leaves 2 options: add region_id field each model this simplest, has drawback not able @ "regioned" items @ 1 time - you'll have query news, events, etc. tables separ...

c++ - Multiple render systems -

c++ - Multiple render systems - some time in near future, begin developing game engine. 1 feature want include having multiple render systems such directx 9/10/11 , opengl. way, game using engine able back upwards more players since if 1 render scheme doesn't work, revert different one. so question, how go doing this? researched bit , saw ogre3d uses have no thought how it. want able plug in different render systems , utilize same code run it. you create interface class allows farther extend api hoping expand to. i have done in past create directx9\11 renderer , hoping expand opengl soon. there certainty lot task, easy explain basic working of it. unfortunately project on closed source, if have questions please don't hesitate ask. first want create separate project used .lib/.dll, called "renderinterface". contain basic interfaces vertexbuffer's, indexbuffer's, shaders, , importantly, irenderinterface , irenderutility, in later implemen...