Posts

Showing posts from March, 2013

javascript - Call link in mobile site not working -

in mobile site, used <a href="tel:+1800229933">call free!</a> making call specified number device.but not working in of devices.thanks in advance. you should use callto: example: <a href="callto:+1800229933">call free!</a>

python - how to create a popup while loading data through method? -

i have method needs few second load data. these few second want display popup. problem python freezes starting load-method. my first idea draw progressbar in qteditor , hide it. , then: def load_data(self): self.progressbar.sethidden(false) [...load data...] the progressbar show, after load data. thought if "outsource" "sethidden" work: self.start.connect(self.load_data) def pre_load_data(self): self.progressbar.sethidden(false) self.start.emit() #signal created myself def load_data(self): [...load data...] but again progressbar created after process finished. tried make popup in other *.py file, , import it: popup.py: class popup(qtgui.qdialog): def __init__(self): qtgui.qwidget.__init__(self) self.pp=ui_loading() self.pp.setupui(self) and show popup before calling load_data-method: def test(self): self.bla = popup.popup() self.bla.show() self.load_data() the popup show inmediatly, empty. after load_data fi

regex - How to parse/substitute part of a string given a starting matching condition in python? -

assume have string text='bla1;\nbla2;\nbla3;\n#endif\nbla4;' i want define method removes '\n' except if '\n' preceded string starting '#' or '\n' follows '#', result of process should be: text2='bla1;bla2;bla3;\n#endif\nbla4;' is there simple way in python using regex? (note: clear me how avoid \n followed #, using negative lookbehind, i.e. r'\n+(?!#)' challenge how identify \n preceded string starting #) the challenge is: how deal positive lookbehind variable-length strings in python? find : (#[a-z]+\\n)|\\n(?!#) and replace : '\1' output : bla1;bla2;bla3;\n#endif\nbla4; demo here : http://regex101.com/r/uo8wh2 this keep \n newline chars have preceding word starting # or followed hash. hth

asterisk - Originating VoIP call using AsterNET in C# -

i try doing mconnection.sendaction(new originateaction() { channel = "sip/201test", exten = "401", context = "201", priority = "1", callerid = "201", timeout = 30000 }); where 201 , 401 extensions connected local network. trying call 201 401. doing wrong? edit: i have test application button "call" i have 2 extensions connected server - 201, 401 i want call 201 401 on "call" button click channel name selected randomly not sure if right. update: ``` mconnection.sendaction(new originateaction() { channel = "sip/401", exten = "401", context = "default", priority = "1", callerid = "201&qu

c++ - Using a map as "Phonebook" -

i have code similar this enum days { monday, tuesday, wednesday, thursday, friday, saturday, sunday }; typedef void (*dailyfunction)(int); namespace dailyfunctions { void monday(int somedata); void tuesday(int somedata); void wednesday(int somedata); void thursday(int somedata); void friday(int somedata); void saturday(int somedata); void sunday(int somedata); } and somewere else in code use switch statement assign 1 of dailyfunctions dailyfunction ptr. when typing (more or less) same switch statement third time, had idea, great have map std::map<days, dailyfunction> myphonebookmap which allow me this: dailyfunction function_ptr = myphonebookmap[weekday]; to me seems, optimal place define such map in namespace dailyfunctions under function-declarations but how can define const map there (since shouldnt change) , populate @ same time? you can use boost function boost::assign::map_list_of or use copy constructor initialize c

c++ - GLSL - When and where is the vertex and fragment called? -

i want know when vertex , fragment shader called in opengl loop. @ end of glutdisplayfunc() or glutmainloop(), or @ every vertex draw call? , vertex , fragment consecutively called 1 after other(ie: vertex fragment), or different times? say have following snippet of code: glpushmatrix(); glrotatef(rot,0.0f,1.0f,0.0); gltranslatef(0.0f,0.0f,25); glcolor3f(0.0,0.0,1.0); drawsphere(4,20,20); // draw triangles glcolor3f(1.0,0.0,0.0); gltranslatef(0.0f,0.0f,5); drawsphere(4,20,20); // draw triangles glpopmatrix(); does vertex shader called after each vertex call, reads current matrix on top of stack, send pre-defined modelview matrix uniform vertex shader? when fragment shader run? is @ end of glutdisplayfunc() or glutmainloop(), neither, because glut is not part of opengl. it's library (for creating simple opengl applications). or @ every vertex draw call? from programmers point of view it's not specified when happens e

Unable to record my call in Android 4.4 -

i not able record call in android 4.4 . checked few applications googleplay don't work either. in application use mediarecorder.audiosource.voice_call doesn't work. anyone knows solution? see link - audiosource-voice-call-not-working-in-android-4-0-but-working-in-android-2-3 after lot of search found manufactures have closed access such function because call recording not allowed in countries. if finds such question , solution other way post on here may helpful many because many people have same issue.

django - Remove (filter out) objects from queryset -

i'd remove 3 objects queryset. working of list, im pretty sure there should better way queryset api . didnt figure out how yet: what i'm doing: ranks = rank.objects.all() remove_ranks = ['field marshall', 'military attache', 'mercenary recruiter'] new_ranks =[] rank in ranks: if not rank.name in remove_ranks: new_ranks.append(rank) how can using django api ? try remove_ranks = ['field marshall', 'military attache', 'mercenary recruiter'] rank.objects.exclude(name__in=remove_ranks) what do? .exclude opposite of .filter name__in equivalent of in-statement in sql this should produce sql query along line select * rank name not in ('field marshall', 'military attache', 'mercenary recruiter')

javascript - Error when adding a new member to JSON -

(i checked out @ least couple dozen posts on error , made few changes see fit no avail) so, started out simple var : var _jsonstr = '{"hotspots:":[]}'; then, parsed it: var _jsonobj = json.parse(_jsonstr); in other part of html, values variable id , x , , y , assign values _jsonobj follows: _jsonobj.hotspots[0].id = id; // error! _jsonobj.hotspots[0].xval = x; _jsonobj.hotspots[0].yval = y; and i'd end set of id , x , y value pairs in json like: var _jsonobj = { "hotspots": [ { id: 0, xval: 25, yval: 50 }, { id: 1, xval: 80, yval: 120 }, { id: 2, xval: 39, yval: 91 }, ... ] }; hate admit couldn't figure out why keep getting error says, "unable set property 'id' of undefined or null reference" commented above. sounds me doing wrong adding new member json object don't see why so. you getting error because _jsonobj.hotspots[0] undefined . this should fi

Call function after a period of time in C# -

i have c# code call function like: private void cmdcommand_click(object sender, eventargs e) { m_socclient.close(); } but want m_socclient.close(); function called after maybe 30 second. possible? yes, using async / await feature: private async void cmdcommand_click(object sender, eventargs e) { await task.delay(30000); m_socclient.close(); } you can using thread.sleep block ui thread , window won't responsive until task finished.

ios - JSON Serialization Returns Null -

in our project taking values json services most questions asked many times not find solution. here code block: nsdata *urldata=[nsurlconnection sendsynchronousrequest:request returningresponse:&response error:&error]; nsstring *responsedata = [[nsstring alloc]initwithdata:urldata encoding:nsutf8stringencoding]; nslog(@"response ==> %@", responsedata); nserror *error = nil; nsdictionary *jsondata = [nsjsonserialization jsonobjectwithdata:urldata options:nsjsonreadingmutablecontainers error:&error]; nsstring* userid = [jsondata objectforkey:@"user_id"]; nslog(@"success: %ld userid: %ld",(long)success, (long)userid); log: response code: 200 response ==> {"user_id":4} success: 0 userid: 0 as can see want convert json object string when printout content of jsondata returns null guess have issue jsonserializaton. can suggest solution? thanks, umit just test following code, it's ok.

google spreadsheet - split() function skips blanks -

in a1 cell have a,b,c,,e . want split cell 5 cells: a , b , c , , e this formula =split(a1,",") splits 4 cells a , b , c , e , skips on blank. how tell split "properly"? i don't think can specify directly, though here workaround: add delimiter character string. replace , ,| now when split , , know sure empty columns have character (in case | ) use replace substitute delimiter | blank string since output of split array, need use arrayformula here final formula like =arrayformula(substitute(split(substitute(a1,",",",|"),","), "|",""))

how to receive file in java(servlet/jsp) -

hi making communication protocol. on web server send 1 file curl(in c# post http request). task been done. how should receive file java on web server gone through this article . file downloading. want receive file java. this link may .. have provide multiprt form data .. http://www.journaldev.com/2122/servlet-3-file-upload-using-multipartconfig-annotation-and-part-interface

cordova - SVG image as background image in windows phone 8 and phonegap -

i using svg image background in phonegap project windows phone8 not showing. following code .loyaltystar { position:absolute; margin-top:3px; background:url(../img/available-icon.svg) no-repeat; width:21px; height:21px; } <li><a href="a.html" class="loyaltystar"></a></li> is phonegap 2.4 supports svg windows phone 8. got solution removed xml start tag image , working ...

actionscript 3 - RandomGenerated Map with Path from start to end -

i wanted randomly generate new 2d array (my map) , ensure has @ least 1 path start point end point. right have static grid , have pathfinding algorithm working properly. question best approach develop this? easiest way create grid , iterate through ensure path open? i think worst-case scenario randomly generate 1 , path find if false returned randomly generate another, inefficient. please help!

java - How to get jackson to ignore non-DTO objects -

we upgraded glassfish jersey 2.7 sun jersey implementation. when did jackson started trying deserilize our domain objects. in our case isn't want. have domain setup domain objects never directly sent out via web services. transformed in dto , sent out. call return response.ok(new somefoobardtoobject(somefoobardomainobject)).build() and use work previous version of jersey/jackson. more date code we're getting errors following: conflicting setter definitions property "preferreditem": com.foo.domain.foobar#setpreferreditem(1 params) vs com.foo.domain.foobar#setpreferreditem(1 params) even though never try send out actual domain object. how tell jackson @ objects received or sent via web service. here web service causing issue i've simplified down this. if take out restaurantitemdto restaurantitemdto method parameters works, if keep in there doesn't. restaurantitemdto has base types in it's fields. way references domain object through construct

Formatting DateTime in C# -

i trying output datetime in 12 hour format. works , breaks. code: while (myreader.read()) { console.writeline("date before formatting = " + myreader["date"].tostring()); datetime dt = datetime.parseexact(myreader["date"].tostring(), "yyyy/mm/dd hh:mm:ss", cultureinfo.invariantculture); string format = "mm/dd/yyyy hh:mm:ss tt"; console.writeline(myreader["rxnumber"].tostring() + "\t\t" + dt.tostring(format)); } output: connection opened date before formatting = 2013/12/26 11:26:08 12/26/2013 11:26:08 date before formatting = 2013/12/26 09:02:01 12345 12/26/2013 09:02:01 am date before formatting = 2013/12/26 09:04:29 123456 12/26/2013 09:04:29 am date before formatting = 2013/10/28 10:19:26 10/28/2013 10:19:26 date before formatting = 2014/02/14 12:25:57 7000006 02/14/2014 12:25:57 am date before formatting = 2014/02

excel - How to deleting selected range of cells when range is dependent on a variable? -

i want delete cells in range g123:p10000 , value of 123 in g123 keeps on changing, how can provide variable while providing range. below can used 1 time, want use multiple times based on value in variable named 'count' changes every run deletes range only range("g123:p10000").select selection.clearcontents i tried below, not working count = activesheet.range("a1").end(xldown).row range("g$count:p10000").select selection.clearcontents what need .offset() , .resize() modifications range. ... count = countrows(activesheet.range("a1")) activesheet.range("g1").offset(count,0).resize(10000-count,1).clearcontents with public function countrows(byval r range) long if isempty(r) countrows = 0 elseif isempty(r.offset(1, 0)) countrows = 1 else countrows = r.worksheet.range(r, r.end(xldown)).rows.count end if end function

Failed to extract specific tables from web onto spreadsheet in Excel VBA (Mac) -

basically, have following program, allow me obtain stock prices of particular stock, "700" in below example.the stock prices appear in particular table on webpage. in pc computer, able use .webselectiontype = xlspecifiedtables .webtables = "4" to pick out specific tables want webpage. on mac, not , ran run-time error 438 : object doesn't support property or method . annoying. removed 2 lines code. problem that: not extract particular stock prices table web now. can show me how can overcome ? sub getstockdatatest() getgooglestockhistory 700 end sub sub getgooglestockhistory(gint long) 'load google stock hisotry activesheet.querytables.add(connection:="url;https://www.google.com.hk/finance/historical?q=hkg%3a" & format(gint, "0000") & "&num=200", destination:=thisworkbook.sheets("query").[a1]) .name = "webquery" .refreshstyle = xloverwritecells .

excel vba - Loop finishing with error -

i need each row has phrase " total" in it, insert rows above , below it, format other cells in , around same row, remove phrase " total" cell, , repeat process other rows in report. the macro i've developed, once it's found , replaced of instances of " total", run-time error '91': object variable or block variable not set. i finish loop without ending error has executed on multiple sheets. here meat of code: 'employersummariesaddedforregionsontabs macro dim foundcell range, lastcell range dim firstaddr string range("d3:d3000") range("d3").select set lastcell = .cells(.cells.count) end set foundcell = range("d1:d3000").find(what:=" total", after:=lastcell, lookin:=xlvalues, lookat:=xlpart, _ searchorder:=xlbyrows, searchdirection:=xlnext, matchcase:=false, searchformat:=false) if not foundcell nothing firstaddr = foundcell.address end if until foundcell nothing set fo

c# - Format String for SQL Entry -

the user enters date mm/dd/yyyy in string , needs formatted in c#/asp.net insertion sql server 2008 r2 record. understand should convert datetime , parameterize query, can't find example of this. what easiest way this? use datetime.parse , in query add re turned datetime parameter. var date = datetime.parse(thestring); sqlcommand cmd = new sqlcommand("insert xxx (thedatefield) values(@param1)", con); cmd.parameters.addwithvalue("param1", date); //execute query , want.

c++ - Search through arrays to find seperate instances of a word -

this assignment in advanced c++ class, we're going on pointers , dynamically allocated arrays, though doesn't seem trouble lies... function header, quote, words, , count important arrays, numwords holds count of how many elements in quote array. void countwords ( char ** quote, char **& words, int *& count, int numwords ) { variables , such, of arrays being passed pointer main. char ** temp = nullptr; int * itemp = nullptr; int wordcount = 0; int quotecount = 0; what follows priming read for loop coming up. i'm creating 2 dynamically allocated arrays, 1 store new found instances of word in quote array, , store count of how many times word appeared in quote array. seems working fine, don't how large (code bloat) advice started differently excellent. first dynamic array char's. temp = new char * [wordcount + 1]; (int z = 0; z < wordcount; z++) { temp[z] = words[z]; } temp[wordcount] = new char[ strlen(

ios - How to create an if statement if segment is not selected? -

i want create statement says if (segmenttitle.selectedsegmentindex == not selected) { segmenttitle.selectedsegmentindex == 0; } what not selected in c code? if read docs uisegmentedcontrol find answer: if (segmenttitle.selectedsegmentindex == uisegmentedcontrolnosegment) { segmenttitle.selectedsegmentindex = 0; }

javascript - Remove Controls in MediaElement player. Where to add/change the code -

this basic question change or add code. want remove of controls on media element player. there information everywhere on internet in summary states. you can control buttons appear on control bar setting {features:['playpause','backlight']} array etc... my question go change or insert code {features: etc... i see folders media front/players/osmplayer/player/templates etc. , there several src query-ui js folders , files. can point me in right direction. if have ever changed features of player can ask folder , file did go to insert or alter code. just add features want/need in own custom mejs initialization script : $('video,audio').mediaelementplayer({ features:['playpause','progress','volume'], alwaysshowcontrols: false }); see jsfiddle

c# - Anonymous subclass -

how create instance of anonymous subclass in c# ? let have base class bclass , want create instance of sublclass additional method , property? how possible do? anonymous classes (aka anonymous types ) can not extend class or implement interface. if need inheritance or implement interface need create named class.

c++ - boost unit test fails with error - unknown location(0): fatal error in "MyCheckTest": -

i'm trying run unit test using boost gives me error when run test -> " unknown location(0): fatal error in "mychecktest":" error not mention line test failing.. i'm not able figure out , hence sharing code: // function.hpp #pragma once #include <boost/archive/text_oarchive.hpp> #include <boost/serialization/string.hpp> #include <boost/serialization/shared_ptr.hpp> #include <boost/serialization/serialization.hpp> #include <boost/serialization/access.hpp> #include <boost/smart_ptr/make_shared.hpp> #include <boost/archive/text_iarchive.hpp> #include <boost/serialization/export.hpp> struct function { std::string id, name; private: friend class boost::serialization::access; template<class archive> void serialize(archive &ar, const unsigned int /*version*/) { ar & id; ar & name; } public: function(void); typ

python - How do setup virtualenv and dependencies in pycharm? -

Image
i using virtualenv on remote machine , want simulate same env on mac can use pycharm further development. my virtualenv in path , "~/venv" i have created ~/.pycharmc following contents(as suggested in " how activate virtualenv inside pycharm's terminal? ") source ~/venv/bin/activate /bin/bash --rcfile ~/.pycharmrc works fine , creates necessary venv, not working in pycharm environment(attaching image @ end) what missing ? go settings > project interpreter > python interpreters > add navigate ~/venv/bin , select python binary. pycharm notices virtual environment , supports completely. make sure select added environment projects interpreter.

user interface - tk_optionMenu error "can't read "a": no such variable" -

i trying execute simple code global eval tk_optionmenu .qt.oc [list 1 2 4 8 16] proc run {} { puts "$a" } i have button associated run proc , when press pres on run button receive following error: can't read "a": no such variable can't read "a": no such variable while executing "puts "$a"" (procedure "run" line 2) invoked within "run" invoked within ".top.run invoke" ("uplevel" body line 1) invoked within "uplevel #0 [list $w invoke]" (procedure "tk::buttonup" line 22) invoked within "tk::buttonup .top.run" (command bound event) any suggestions? global must used inside scope trying access global variable. example: proc run {} { global puts "$a" } here's excerpt global man page : this command has no effect unless executed in context of proc body.

jquery - How to use ajax to pass parameters to servlet -

i'm using below code in servlet parameters jsp page form.how use ajax/jquery pass parameters servlet. map<string, string[]> params = request.getparametermap(); $.ajax({ type: "post", url: "http://myhost/my-servlet-mapping-url", data: {"param1":"value1"}, success: function(data, textstatus, jqxhr) { console.log("success!!"); }, datatype: datatype }); it's regular way. problem? you've got nulls?

ios - User location is showing like annotation -

i have multiple annotation in mapview , listed in 3 different arrays. i've used - (mkannotationview *)mapview:(mkmapview *)mapview viewforannotation:(id<mkannotation>)annotation method change te callout of annotation. the weird thing userlocation changing customised annotation. why that, , problem? how listed annotations: myann = [[annotations alloc]init]; location.latitude = 52.338847; location.longitude = 4.937482; myann.coordinate = location; myann.title = @"afvalpunt"; myann.subtitle = @"rozenburglaan 1"; [category3 addobject:myann]; [self.locationarrays addobject:category3]; self.currentannotation = 0; [self.mymapview addannotations:[self.locationarrays objectatindex:0]]; how method set up: - (mkannotationview *)mapview:(mkmapview *)mapview viewforannotation:(id<mkannotation>)annotation { mkannotationview *annotationview = [mapview dequeuereusableannotationviewwithidentifier:@"mapan"]; if (!annotationview) {

linux - Bash scripting with skeleton in Debian -

this question has answer here: cron jobs — run every 5 seconds 4 answers before of first, i'm linux (administrator|developer) newbie. i need run bash script every 5 seconds, it's simple; export service's information text files. i try cron daemon, it's run every minute @ least. i'm discover skeleton script , have many questions this: i need write special code in bash file? how run every 5 seconds? there best practices manual? yes not possible through cron daemon runs once in every minute. or when job list modified put whatever want run in script inside infinite while loop , put sleep of 1 sec like while [ 1 ] run_your_cmds here sleep 1 done but dont think need kind of monitoring. best practice!! please dont try , cron.

java - move items in linked list -

how move items , down position in linked list? the text file contains data follows saved in linked list. want sort items according first items, i.e ty12354, ytpy217,ty12354dsaf.... ty12354, toyota, ty1257,2100000 sk2344, skoda, so2345, 180000 ytpy217,safsadf,asfasf,1241234 ty12354d,sfasdf,asfasf,235123412 ty12354dsaf,asdffasd,asfasfafsd,12344 abc123,asdffasd,asfasfafsd,12344 i used following code sorting, doesn't work: (int x = 0;x < (lstcar.size()-1); x++) { c=(car) lstcar.get(x); //lstcar linked list d = (car) lstcar.get(x+1); int compare =d.getregnumber().compareto(c.getregnumber()) ; if(compare < 0){ temp = d; lstcar(x)=c; //tried method doesnt work //lstcar.sort(); c = temp; } } this not right way set element in linkedlist: lstcar(x)=c; //tried method doesnt work instead use: lstcar.set(x,c); if want sort list keeping approach (i.e. d

java - Background colour of combo box cell editor -

i have been trying find solution past few days , driving me crazy. have table in set selection colour yellow. set background of cell editor component yellow colour remains same when cell being edited. overriding prepareeditor method such: @override public component prepareeditor(tablecelleditor editor, int row, int col) { component c = super.prepareeditor(editor, row, col); c.setbackground(color.yellow); c.setfont(myfont); return c; } this working fine columns except column in assign combo box cell editor. once start editing cell in column background becomes white. background colour in popup menu yellow background colour in selected value box remains white. tried adding focus listener combo box able change background of popup items , not background of selected item. tried adding focus listener combo box such: mycombobox.addfocuslistener(new focuslistener() {//code here}); and editor component such: mycombobox.geteditor().geteditorcomponent().ad

javascript - Convert base 64 encoding string into image -

i want convert base 64 encoding image png or jpeg image. i want convert image , must save on server, must move in other folder can fetch it. have given here code save.php <?php header('content-type: image/png'); header('content-disposition: attachment; filename="' . $_post['name'] .'"'); echo '<img src="'.$_post['img_val'].'" />'; $filtereddata=substr($_post['img_val'], strpos($_post['img_val'], ",")+1); $unencodeddata=base64_decode($filtereddata); $return=file_put_contents('img.png', $unencodeddata); ?> this javascript function sending data save.php function capture(){ html2canvas($("#share"), { onrendered: function(canvas) { var myimage = canvas.todataurl("image/png"); $('#img_val').val(myimage); document.getelementbyid("myform").submit(); } }); looks right, however, think yo

python - Splitting a list into groups determined by grouping of another list -

say have 2 lists a = [true, true, true, false, false, true, false] b = [1, 2, 1, 3, 2, 1, 0] i can group 1 list similar items: import itertools b = [list(g) k, g in itertools.groupby(a)] >>> [[true, true, true], [false, false], [true], [false]] is there convenient way apply operation other list give: >>> [[1,2,1], [3,2], [1], [0]] this works there nicer:? new_list = [] index = 0 in b: length = len(i) new_list.append(y[index:index+length]) index += length thanks you can groupby on enumerate(a) : >>> itertools import groupby >>> operator import itemgetter >>> indices = ((x[0] x in g) _, g in groupby(enumerate(a), key=itemgetter(1))) >>> [[b[x] x in lst] lst in indices] [[1, 2, 1], [3, 2], [1], [0]]

c++ - How to restrict implicit conversion of typedef'ed types? -

suppose there're 2 types: typedef unsigned short altitude; typedef double time; to detect errors passing time argument in position of altitude functions @ compile time i'd prohibit implicit conversion altitude time , vice-versa. what tried first declaring operator altitude(time) without implementation, compiler said must member function, understood it's not going work typedef ed type. next i've tried turning 1 of these types class, appeared project extensively uses lots of arithmetic including implicit conversions double , int , bool etc., passes them , streams via operator<< , operator>> . despite way allowed me find errors looking for, didn't try make full implementation of compatible class because take lot of code. so question is: there more elegant way prevent implicit conversions between 2 particular typedef ed types, , if yes, how? a typedef nothing more establish name existing type. therefore question boils down whet

php - Mandrill Class Crashes After Initialization -

running through simple mandrill installation, part: <?php require_once 'mandrill-api-php/src/mandrill.php'; $mandrill = new mandrill('$mandrillkey'); //api key hidden stackoverflow ?> <p>page loads & require statement fulfilled: installation</p> the new mandrill class causes page not load. know because if comment out $mandrill = new mandrill('$mandrillkey') page loads. when enabled error logging got following error: fatal error: call undefined function curl_init() in /mnt/pcruse3/dev/web/oa_dev_paul/mandrill/mandrill-api-php/src/mandrill.php on line 65 i have fixed permissions folder , else loads.

parsing - Parse Text File after a specific word VB.NET -

i have module application reads text file , finds lines specific words in them . my input looks this dealer number: 90402001 dealer name: san tan ford contract number: 7466564 override class: contract code: 3417620 portal claim#: 148905 dealer number: 90402001 dealer name: san tan ford contract number: 7679454 override class: contract code: 3762406 portal claim#: 149325 dealer number: 90416003 dealer name: car town kia contract number: dg209507 override class: contract code: 3110169 portal claim#: 134550 dealer number: 90430005 dealer name: rich ford contract number: 7380708 override class: contract code: 3130744 portal claim#: 148537 my output below dealer name: san tan ford contract number: 7466564 dealer name: san tan ford contract number: 7679454 dealer name: rich ford contract number: 7380708 all need grab text after "number:" here have far imports s

c# - Postsharp skips to decorate methods that are marked with CompilerGenerated attribute -

this trying accomplish: converting 2500 integration tests nunit mstest, can run them microsoft test manager/lab. tests need run on user interface thread of product working on or not succeed. this problem: have created postsharp aspect automatically run mstest test methods initialize environment tests , run them on ui thread. works fine, except tests created specflow. specflow generates code behind classes marked system.runtime.compilerservices.compilergenerated attribute. , when class marked attribute, postsharp seems skip methods in it. the aspect defined on assembly level. have tried use multicastattributes.compilergenerated attributes during registration not seem change behavior. when place aspect directly on method, works. i using latest stable version of postsharp (currently 3.1.). a sample aspect: [serializable] public class myaspect : postsharp.aspects.onmethodboundaryaspect { public override void onentry(postsharp.aspects.methodexecutionargs args) {

php - Making html page appear on click of submit button -

i trying make page appear when click button, know how this, time in trouble.i have following code: <html> <head> <meta charset="utf-8"/> </head> <body> <!--see siin tekstiväli--> <h3>minu küsitlused </h3> <hr> <br> <br> <br> <ol> <?php include_once 'init/init.funcs.php'; $result = mysql_query('select * katse_kysimustik_pealkiri'); while($row = mysql_fetch_assoc($result)) { $titles[] = $row['pealkiri']; } foreach($titles $title) { ?> <li> <?php echo $title ?> <form action='minu_kysitlused_1.php'> <input type="button" name = "saada" value="saada"> <input type="button" value="tulemused"> <input type="button" value="lõpeta ennetähtaegselt"> <input type="button" value="

javascript - Ext JS store unexpectedly reloads data when it should be buffered -

we trying work off of example: http://dev.sencha.com/deploy/ext-4.0.1/examples/grid/buffer-grid.html e.g. in store: // create data store var store = ext.create('ext.data.store', { id: 'store', pagesize: 50, // allow grid interact paging scroller buffering buffered: true, // never purge data, prefetch front purgepagecount: 0, model: 'forumthread', proxy: { type: 'memory' } }); //and in grid: ... store: store, verticalscroller: { xtype: 'paginggridscroller', activeprefetch: false }, loadmask: true, ... but when scroll past pagesize records in grid, long pause more next set of records being rendered -- store reloading data our web service. call our web service loads of data , don't want re-loaded when user scrolls. want rendering buffered, not data loading, example states "his example illustrates loading of records front , buffering rendering." because want avoid moving sor

How to debug behat features using xdebug? -

having hard time behat, cent find way debug (php/xdebug using breakpoints , steps). have experience or maybe there better way same? edited: "behat/mink": "*", "behat/mink-extension": "*", "behat/mink-zombie-driver": "*@dev", "behat/mink-selenium2-driver": "*" testing regular feature on website. you should set following environment variable before launching tests: xdebug_config="xdebug_session_start=" it works me.

ios - Border of UICollectionViewCells doesn't show up for the last two cells -

the border shows cells except last 2 cells (see screenshot 1). weird thing is, border shows first 2 cells (see screenshot 2). in advance! screenshot 1 screenshot 2 basically, you're drawing line that's quarter pixel wide (on retina display, 8 of pixel on non-retina) in light color, after of scaling, dithering, , clipping (the line drawn half outside layer, gets clipped) done, you're not getting anything. change line width 0.5 (1 retina pixel) , should work.

javascript - JQuery - Click, disable mouseover with reset -

i have tooltip popups away image. however, cannot seem clicking working concurrently hovering. i'd achieve have popup stay visible when user clicks image , disable when user clicks outside popup box, however, visible if user has hovers in image , hidden when user hovers out of image. i'm not quite sure how tackle this. http://jsfiddle.net/bz4m7/ html <div class="tooltip"> <div class="description"> here big fat description box</div> </div> css .tooltip { border: 1px #333 solid; width:200px; height:200px; background-image:url('http://mathworld.wolfram.com/images/gifs/sqtripic.gif'); } .description { display:none; position:absolute; border:1px solid #000; width:400px; height:400px; left: 50%; top: 50% background: #000000; } js $(".tooltip").mouseover(function() { $(this).children(".description").show(); }).mouseout(function() { $(this).c

c# - Count how many children are contained inside a specific element -

i want count how many childs contained inside hometeam element.this number dynamic. use ,but gives me how many times hometeam shown.gives me 1 int cout = xmldoc.descendants("hometeam").count(); my xml : <homestats> <hometeam> <hometeamname>pan</hometeamname> <iperiod>74</iperiod> <iiperiod>102</iiperiod> <iiiperiod>124</iiiperiod> </hometeam> </homestats> the answer in example is:the hometeam element contains 4 (hometeamname,iperiod,iiperiod,iiiperiod).so must 4. suggestion? you're close. need add 1 more step; child elements: int cout = xmldoc.element("hometeam").elements().count();

mysql - Getting server time and using it in python -

i have unique situation in need of pulling current time sql server , using value in python program string. don't know how pull down print or assign variable. example: do stuff... var = mysql server datetime <---- how do part ?? print var; more stuff... you can use library _mysql connect server should work. import _mysql db = _mysql.connect(host="localhost",user="user", passwd="pass", db="db") db.execute('select now()') r = db.store_result() time_var = r[0][0] print time_var

php - Scraping a table using Simple HTML Dom -

i trying scrape product table, http://www.dropforyou.com/search2.php?mode=search&posted_data%5bcategoryid%5d=2&posted_data%5bsearch_in_subcategories%5d=on i need product id, quantity , price. since site uses cookies , post form grabbing site curl. works fine. loading simple html dom $html = str_get_html($content); i have been able load table values array, can't label them. come in 0,1,2 , can't tell what's what. i tried using different method posted here on stackoverflow, gives me fatal error: call member function find() on non-object in my working code isn't labeled $content = curlscraper($urltoscrape); $html = str_get_html($content); $tds = $html->find('table',2)->find('td'); $num = null; foreach($tds $td) { $num[] = $td->plaintext; } echo '<pre>'; var_dump ($num); echo '</pre>'; the code found on stackoverflow gives me fatal error: call member function find() on non-object in $

java - Another way without abusing memory -

hey have completed problem, wondering if there way without using unnecessary amounts of memory, while still using array. below problem , code. question:implement method named prezee accept string parameter named book. output screen number of characters before each ‘z’. example: if string is: “my house ez find. go z street , turn left. ze house black starz on door.” the output should read: 13 z, 16 z, 29 z, 27 z code: import java.util.*; public class prezee{ public static void main(string[] args){ scanner user=new scanner(system.in); system.out.println("please enter sentence"); string input=user.nextline(); int[] anarray; anarray=new int[input.length()]; int count=0; for(int i=0;i<input.length();i++){ string subst=input.substring(i,i+1); if(!(subst.equalsignorecase("z"))){ count ++; } else{ anarray[i]=count; count=0; } } for(int j=0;j<input.length();j++){ if(anarray[j]!=0){

Linux Enviroment Variable and C project getenv() -

i need use environment variable c project did in terminal: export file_config="/home/pc/file.conf" file.conf file created. if env in terminal, can see "file_config" in list value (/home/pc/file.conf). want assign path_to_config -> /home/pc/file.conf in .c program did this: #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { char* path_to_config = getenv("file_config"); but getenv doesn't returns path file_config.. when in debug mode path_to_config value 0x0. i've tried other environment variables not 1 in particular exported. let me guess: running program ide. environment ide provides program totally unrelated environment export variable. suggestion: run program command line at terminal in did export . shall see variable right. then search ide way specify environment target program, , set there. optionally, add export line shell's startup script.

c - two arguments of arry and read the columns -

i have simple tab: int rows = atoi(argv[1]); int tab[rows][2]; and i'm forwarding func by: myfunc(tab); void myfunc(int (*tab)[2]); how can read number of rows? still try about: int readrowinmyfunc = sizeof(tab)/(sizeof(int **)); but doesn't work. sizeof(tab) = rows * 2 * sizeof(int) so rows = sizeof(tab) / (2*sizeof(int)) note bad idea create array on stack dynamic size. if run program argv[1] = 100000000000000000000?

c++ - Checking a char array for words by cycling through it with a string of chars -

i'm working on game right that's connect 4, letters instead of colored checkers. player "drops" letter tile grid, , can claim word if letter 1 played. word checked see if in grid (which array of structs contain letter value (char) , boolean value determine whether tile "empty". have coded human player's turn, i.e. 1 takes user input. computer turn, turning out problematic. the computer player should @ letter tiles has remaining (each 'player' has string containing every letter in alphabet set of vowels; every time player plays tile, respective tile erased string), , choose drop column give largest amount of points; length of word correlates amount of points. right now, human code goes little this; input letter -> input desired row -> game checks see if lowest row of column open -> tile placed in lowest available row of column -> player asked if claim word -> player inputs word -> game checks every row, column, , diagonal

c# - trying to create a extension method to convert from string to decimal -

i'm trying come global way of converting string x number of decimal places , i'm having no luck. need return decimal x number of decimals. here have far cannot figure out how know divide easily: public static decimal toxdecimalplaces(this object value, int numberofdecimalplaces, decimal defaultvalue = 0) { double retval; if (double.tryparse(value.tostring(), out retval)) { return (decimal)(retval / 10); } return defaultvalue; } so if send it: value = "12345" value.toxdecimalplaces(2) i'd back: 123.45 etc. the division of retval needs different pending on numberofdecimalplaces. any suggestions? prefer not have create handful of extension methods or should do? should create: to1decimalplaces to2decimalplaces to3decimalplaces etc for each 1 need , move on? how using math.pow ? something like return (decimal)(retval / math.pow(10, numberofdecimalplaces));

c++ - Getting information from Exchange Server 2003? -

in exchange server 2007 , later i.e. exchange server 2010,2013 , have find information related exchange like, name of mailboxes , distribution groups using cmdlet commands as get-mailbox get-distributiongroup all these can achieve using exchange management shell commands in exchange server 2007, 2010, 2013. how can retrieve data mailboxes, mailuser, message delivery reports, email addresses on server in exchange server 2003. , how select meaningful attributes. for example: get list of message have subject "exchange server" get-messagetrackinglog -messagesubject "exchange server" this gives me information sender, receiver, , many more attributes of messages have message subject "exchange server" , how can find type of information in exchange server 2003. use adsi editor these information. you can use wmi this, wmi please click here . message tracking log class found here .

tcl - How to get path of current script? -

sometimes needed current path of script. ways that? while script being evaluated (but not while procedures being called) current script name (strictly, whatever passed source or c api equivalent, tcl_evalfile() , related) result of info script ; it's highly advisable normalise absolute pathname calls cd don't change interpretation. scripts need information tend put inside themselves: # *good* use of [variable]… variable mylocation [file normalize [info script]] they can retrieve value (or things derived it) easily: proc getresourcedirectory {} { variable mylocation return [file dirname $mylocation] } the other common locations are: $::argv0 “main” script (and you're evaluating main script if it's equal info script ) [info nameofexecutable] tcl interpreter program (typically argv[0] @ c level) [info library] tcl's own library scripts located $::tcl_pkgpath tcl list of directories packages installed $::auto_path tcl lis

python - datetime.date(2014, 4, 25) is not JSON serializable in Django -

this question has answer here: how overcome “datetime.datetime not json serializable”? 24 answers i followed how overcome "datetime.datetime not json serializable" in python? not helping i tried code >>> import datetime >>> =datetime.date(2014, 4, 25) >>> bson import json_util >>> b = json.dumps(a,default = json_util.default) traceback (most recent call last): file "<console>", line 1, in <module> file "/usr/lib/python2.7/json/__init__.py", line 250, in dumps sort_keys=sort_keys, **kw).encode(obj) file "/usr/lib/python2.7/json/encoder.py", line 207, in encode chunks = self.iterencode(o, _one_shot=true) file "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode return _iterencode(o, 0) file "/home/.../python2.7/site-packages/bson/js

count - Delphi: TreeView elements vs. Form position changing -

we have found seems bug(?), , cause bug in our code. delphi xe3, win32. 2 forms, main have button: procedure tform4.button1click(sender: tobject); begin tform1.create(application) begin showmodal; release; end; end; the form1 doing this: procedure tform1.formcreate(sender: tobject); var i, j: integer; mn: ttreenode; begin := 1 10 begin mn := treeview1.items.add(nil, 'm' + inttostr(i)); j := 1 10 begin treeview1.items.addchild(mn, 'c' + inttostr(j)); end; end; position := podesigned; beep; caption := inttostr(treeview1.items.count); end; after 0 elements in caption. but when have button in form code... procedure tform1.button1click(sender: tobject); begin caption := inttostr(treeview1.items.count); end; ... then can see number (110 elements). if write treeview1.handleneeded after position changing, count good. the problem based on recreat

javascript - How to store previous state of checkboxes in multiple accordians -

i have multiple accordians on page , each accordian has multiple checkboxes in it. want store previous state of checkbox can verify state changed or not. problem cant use event document.ready because in event shows not checkboxes loaded on page because under accordians , loaded when accodian expands , 1 accordian expandable in application. in event have store previous state of checkboxes? thanks. assume multiple checkboxes has own unique id or value you want store state respect id or value you can use .map() checked box. var store; var storechecked = function() { store = $('input:checkbox:checked').map(function () { return [this.id,this.checked]; }).get(); }; see demo here: jsfiddle

java - Extract words in rectangles from text -

Image
i struggling extract fast , efficiently words in rectangles bufferedimage. example have following page : ( edit! ) image scanned, can contain noise, skewing , distortion. how can extract following images without rectangle : ( edit! ) can use opencv or other library, i'm absolutely new advanced image processing techniques. edit i've used method suggested karlphillip here , works decent. here code : package ro.ubbcluj.detection; import java.awt.flowlayout; import java.awt.image.bufferedimage; import java.io.bytearrayinputstream; import java.io.ioexception; import java.io.inputstream; import java.util.arraylist; import java.util.list; import javax.imageio.imageio; import javax.swing.imageicon; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.windowconstants; import org.opencv.core.core; import org.opencv.core.mat; import org.opencv.core.matofbyte; import org.opencv.core.matofpoint; import org.opencv.core.point; import org.opencv.