Posts

Showing posts from February, 2013

mysql - How to manage eficiently the new products of my database? -

i have database of store have add new products constantly. before publish new product or after r modifying 1 admin have check if has correct data. i thought in 2 options it: 1 .-adding new field called verified (type boolean) in product's table. when i'll modify or add new product it'll set false @ default. , turn true when admin check it. 2 .-using database, , export , import content every 5 days. what think best way it? have option i'm trying do? any advice, tip or appreciated, , if need more info let me know , i'll edit post. option 1 sounds reasonable. insert product verified being defaulted 0, when associate check, boolean goes 1 check verification. might add verified column time , date.

c++ - How can I understand the fdump-class-hierarchy output -

i'm playing fdump-class-hierarchy compiler option don't know how can understand output. "size", "align", "base size" , "base align" mean, , how these counted? thanks! when code is: class { public: private: double m_nothing; int m_number; }; the output is: class size=16 align=8 base size=16 base align=8 (0x406c690) 0 but, if change class little: class { public: private: int m_number; double m_nothing; }; the output be: class size=16 align=8 base size=12 base align=8 (0x406c690) 0 the size , align size , alignment of class when used complete type. is, if create objects complete type type (like defining variables of type, or using type new ). the size number of bytes occupies. size=16 means when used complete type, occupies 16 bytes. the alignment tells object may placed: align=8 means address of object must integer multiple of 8. the base size , base align give size , al

overriding a javascript function (Superfish in Drupal) -

here superfish library used in drupal . superfish.js file @ line 102 contains code: $.fn.extend({ hidesuperfishul : function(){ /* statements */ }, showsuperfishul : function(){ /* statements */ } }); i need override these 2 functions. how it? (i don't mean how in drupal specifically, rather how in javascript) p.s. based on information, tried adding code in own script: (function ($) { var orig_hidesuperfishul = $.hidesuperfishul; $.hidesuperfishul = function(){ alert('lol'); } })(jquery); firebug shows statement starting "var" runs once page refreshed, statement "alert" not run. instead, original hidesuperfishul function runs. [edit 1] changed custom code to: (function ($) { //var orig_hidesuperfishul = $.hidesuperfishul; var hidesuperfishul = function(){ alert('lol'); } })(jquery); [edit 2] added 4 breakpoints: in superfish.js @ line 102 code $.fn.extend({ in su

postgresql - Postgres not returning lastval() properly -

i trying insert new user our database, via psql in cli. when following: start transaction; insert "users" ("email", "first_name", "last_name", "password", "objectstate_id", "activate_rid") values ('xpress@carepilot.com', 'xpress', 'care', 'f9fecdd84ee071806423adf30d6d6ff04e1a0a2c6688f2c057ddbab1d6b55d02', 4, 'emqhtmmvviab5bdyj0e6'); select lastval(); lastval returns 39037, should technically 838. not inserting db reason. have googled , looked can think of , not getting answers. have idea going on here? the short version here using unqualified lastval bad idea. triggers, rules, etc can cause problems. you should avoid lastval entirely. use: begin; insert "users" ("email", "first_name", "last_name", "password", "objectstate_id", "activate_rid") values ('xpress@carepilot.com', &

solr4 - How do you use the Solr DIH to select XML based on descriptive values? -

the xml has descriptive fields , use them select specific fields. there way data import handler pick "text block a" , "text block b" using "code=34089-3" key? code field has no data unique type of information want pick. when use xpath="/document/component/section/text/paragraph" end text blocks a, b, c , d. ideally able pick text block a. possible? <component> <section> <id root="f915965e-fe3b-44eb-a2ed-c11f807e7f23"/> <code code="34089-3"/> <title>title a</title> <text> <paragraph>text block a</paragraph> <paragraph>text block b</paragraph> </text> </section> </component> <component> <section> <id root="80b7e2f1-f49f-4309-a340-210536705d4a"/> <code code="34090-1"/> <title>title b</title> <text> <paragr

windows 8 - Change where VS 2012 keeps the Visual Studio 2012 folder? -

i running visual studio 2012 on windows 8 laptop, , want move visual studio 2012 holds templates, projects, settings, etc in documents on folder on c: drive called dev. when copied folder on dev folder , deleted original, error message showed when ran vs again, , created visual studio 2012 folder in documents. click tools > options projects , solutions change projects location path. there separate setting project templates , item templates on same screen.

pandas dataframe fill missing rows with date column -

uuid site ts visit 0 +cw99 1124 2013-06-24 2 1 +cw99 1124 2013-06-26 1 2 +cw99 1124 2013-06-27 1 3 +cw99 1124 2013-06-20 1 4 +cw99 1124 2013-06-21 1 5 +cw99 1124 2013-06-24 2 6 +cw9w 956 2013-06-21 4 7 +cw9w 956 2013-06-22 2 8 +cw9w 956 2013-06-23 3 9 +cw9w 956 2013-06-24 4 i have dataframe passed in looks that. don't know how many distinct ts period there. want find min , max of ts expands rows not have ts (daily) 0 fill visit column while copying rest of fields uuid site ts visit 0 +cw99 1124 2013-06-20 1 1 +cw99 1124 2013-06-21 1 2 +cw99 1124 2013-06-22 1 3 +cw99 1124 2013-06-23 0 4 +cw99 1124 2013-06-24 2 5 +cw99 1124 2013-06-25 0 6 +cw99 1124 2013-06-26 1 7 +cw99 1124 2013-06-27 1 8 +cw9w 956 2013-06-20 0 9 +cw9w 956 2013-06-21 4 10 +cw9w 956 2

php - jquery mobile is ruining my POST -

i have html file (index.html) containing head section , body section. in body section have form post action pointing php file. if add head section cdn of jquerymobile... post stops working. how possible, , how avoid this? so head looks this: <head> <title>my mobile app</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1" /> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-a

java - Android 16-Bit Color Image to Bitmap -

Image
i trying 16-bit color image 80 x 60 resolution embedded camera ( datasheet here ). able 9600 (80 * 60 * 16 / 8) bytes camera, have problem displaying image. using following code convert byte array bitmap: bm = bitmap.createbitmap(80, 60, bitmap.config.rgb_565); bm.copypixelsfrombuffer(bytebuffer.wrap(jpegbytes)); jpegbytes array of image's bytes , 9600 bytes long. right now, getting images this: 99% of time. however, able non-corrupted images this: very rarely. have suggestions why happening? much! update: it seems pixels in correct spot, have rgb values mixed up. example, white portion between both photos same because order of rgb not matter white. however, clear colors mixed because red chair showing blue in corrupted image , blue backpack showing green in corrupted image use config.argb_8888 bitmap config from docs public static final bitmap.config rgb_565 : each pixel stored on 2 bytes , rgb channels encoded: red stored 5 bits of precis

php - How to store post variables value -

i got index page on search page included, , when submit it, passes values find.php through action , method post. code below if($_post['searchsubmit']=="search"){ $cat=$_post['searchcategory']; $area=$_post['searcharea']; $term=$_post['searchbox']; } the above code written on find.php, when try implement paging through basic paging method conditions make appropiate search query $where="where approved='yes'"; if($term!=""){ $where.=" , name '%$term%'"; } if($cat!=""){ $where.=" , category '%$cat%'"; } if($area!=""){ $where.=" , area '%$area%'"; } $start=0; $end=5; if($_get['page']!="") { $start=$_get['page']*$end; } where $start initial limit, , $end number of records. first

How to start an external program inside a java program -

this question has answer here: external program our java program 5 answers running msys.bat using processbuilder 1 answer i new in how start program inside java program! , don't know how call it. 1st question must inside new thread? second question how call new program. program want call "wondershaper". use ubuntu 12.04 running programm , in command line write. "sudo wondershaper eth0 10000 1000". how can write inside general program? have server want handle rate of it! thats why use it. have multithread server , code class client extends thread { private socket connectionsocket; public client(socket c) throws ioexception { connectionsocket = c; } public void run() { string path = "c:/pao/new2/";

android - ExpandableListView with custom row backgrounds -

Image
i'm android newbie. want create screen expandable headers illustrated. i've created 1st row "gff" shown. however, each row under gff shows space in between rows. also, listview does'nt fill width of screen , leaves margin on sides , above. how can header , caption fill entire length of screen shown in diagram? also, how can rows show different color? is there example or code similar? try setting divider of listview null, listview.setdivider(null) , should help. can set listview.setselector(null) should remove unnecessary margins.

ios - UISegmentedControl to control segues -

hi creating application switch between bluetooth , wifi mode. want use uisegmentedcontrol switch between segues. photo album post example of want achieve, although done .xibs. i've tried using ibaction method segment , using performseguewithidentifier method. latter works 1 way , not vice-versa, need. though works 1 way, still error. http://imgur.com/a/pttsu to clarify want able toggle between 2 screens, able switch screen 1 2. if have 2 different segues, , want perform 1 based on pressed check index selected , perform segue: - (ibaction)yoursegmentedcontrolpressed:(uisegmentedcontrol *)sender { if(sender.selectedsegmentindex==0)//left control button pressed { [self performseguewithidentifier:@"yourfirstsegue" sender:self]; } else if(sender.selectedsegmentindex==1)//right control button pressed { [self performseguewithidentifier:@"yoursecondsegue" sender:self]; } } if want use button control segues, gra

javascript - How to dynamically embed html into a frame tag -

i trying fetch data using jquery ajax library , want add returned html data frame object (without setting source attribute). general idea want showcase html content seperate document in frame. tried putting data div had effect of affecting main document. thanks! the frame is: <frame id="test"> </frame> $.ajax({ url : url }) .done(function(html) { document.getelementbyid('test').innerhtml = html }); the problem seems getelementbyid function return null. problem resolved if change frame div. problem solved! article surprisingly hard find. essentially, code used solve : doc = document.getelementbyid('test').contentdocument; doc.open(); doc.writeln('<p> hello! </p>') doc.close(); the article : http://softwareas.com/injecting-html-into-an-iframe

css - How important is the order of Attributes within a class -

i know if order within class important , if might effect speed of website. know order of classes within stylesheet important what's attributes within classes, important too? has correctly or incorrectly order of attributes within class effect? if so, effect , common rule such order? of course there more attributes guess should give idea order use. there should/can improve it: positioning styling font radius css .example_class { float: l/r; position: rel/absl; margin: 0 0 0 0; padding:0 0 0 0; width: xy px; height: xy px; background: image/color; font-family: font-name; font-size: xy px; color: #xyz / #abcdef / red; radius: 0 0 0 0; } the order of properties within selector doesn't matter @ all, aside fact can override selectors browsers can't read: background: #fff; /* used browsers can't understand: */ background: linear-gradient(...); other it's matter of taste -- sort them alphabetically or "group" you've done, or w

How to render controls defined in Json structure using MvvmCross? -

i have situation view definition(i.e. content gets displayed on layout file) defined in json structure. need able define json structure along bindings , code should able dynamically create controls based on json structure , fill out layout. i able accomplish same using code below. protected override void oncreate(bundle bundle) { base.oncreate(bundle); firstviewmodel firstviewmodel = new firstviewmodel() { id = 1001, firstname = "amit", middlename = string.empty, lastname = "taparia", race = "asian", isusnational = false }; this.viewmodel = firstviewmodel imvxviewmodel; var bindings = this.createinlinebindingtarget<firstviewmodel>(); this.root = new rootelement("main view", null, null). { new section("personal information") {

javascript - Is this an implementation of a fixpoint combinator? -

i presumed couldn't called "fixed point recursion" because straightforward. however, realized might be. have implemented fixed point recursion? here's function in question: /* recursive kleisli fold */ var until = function(f) { return function(a) { return kleisli(f, until(f))(a); }; }; here's additional context: // error monad's bind var bind_ = function(f, m) { return m.m === success ? f(m.a) : m; }; var bind = function(f, m) { return m !== undefined && m.m !== undefined && m.a !== undefined ? bind_(f, m) : m; }; var kleisli = function(f1, f2) { return function(a) { return bind(f2, f1(a)); }; }; the rest of code here , snippet above should enough follow. the definition of fixed-point combinator function f takes function f , returns function p such that given f(f) = p p = f(p) there many possible fixed point combinators written. don't let straightforwardness make thi

vb6 - Getting a COM+ component to work on a 2008 R2 server -

we've got ancient of days com+ components wrote long ago, we're trying migrate onto vm. they're running on windows 2003 r2 server, working fine. they're not working on 2008 r2 server vm is. appears though can't "reach" them @ vb6 apps on client machine. sure how proceed point forward. ideas, how diagnose problem helpful, please. you're not giving information go on. you might interested in these links: .net com+ interop part i debugging com+ applications part ii alternatively, might find easier install windows 2000 standalone server on vm, , run application off of it.

java - Android Rear Facing Camera Take Photo without preview -

i have followed tutorial lars vogel @ tutorial link while tutorial works front facing camera unfortunately cannot rear camera take photo. getting late , i'm missing simple. code is: private int findbackfacingcamera() { int cameraid = 0; // search facing camera int numberofcameras = camera.getnumberofcameras(); (int = 0; < numberofcameras; i++) { camerainfo info = new camerainfo(); camera.getcamerainfo(i, info); if (info.facing == camerainfo.camera_facing_back) { log.d(debug_tag, "camera found" + info.facing); cameraid = i; break; } } return cameraid; } make sure have correct permissions facing camera listed in android manifest. also, check out question: how open "front camera" on android platform?

iOS How can I record internal audio? -

this question has answer here: record internal sound iphone sdk 1 answer is possible record background sound app? if so, key technology? (core audio?) what want below.. open bbc radio on safari. open recording app. @ time, safari runs in background. record sound recording app. i tried find solutions using "novocaine" still haven't faintest idea. have tried getting stream url bbc radio , record directly stream? if can find right url, audiostreamer stream audio. record stream. more realistic approach accomplishing goal.

Paypal - Recurring Donations URL -

paypal makes easy create donate url. donor can enter custom $ amount or use fixed one. we'll use custom amount, since it's more flexible. there anyway allow donor enter custom amount, , have paypal display checkbox example allow amount recurring monthly donation via url? we checked out "subscribe" button, returns form, not url, , didn't see anywhere let donor choose amount. basically, should optional field in donate url. ideas on how accomplish this? you'll need use standard subscription buttons or recurring payments api . either way setup page user chooses options on site prior being sent on paypal.

java - Can the Spell Checker Framework used for code hinting? -

i looking @ spell checker framework , wondering if can use implement code hinting in app. can implement custom 'code' dictionary? wondering if possible approach code completion before embarking. good code completion (in personal opinion) context sensitive , should show completions things in scope , applicable current position within code. example, in java doesn't make sense show method name completions outside of method. makes sense plain spell checking against english language dictionary code comments, not method , variable names, etc. if want functional code editor think need come own editor (e.g., not use textview per se) , own completions, perhaps using system spell checker api spell check code comments. might want @ source code textview.java , editor.java ideas on how implement own code editor , completion ui @ editor level (maybe in conjunction other open source code editors). if needs relatively simple might able by adding spans of type suggestionspa

matlab - Poor fit with nlinfit -

i'm having fitting issues nlinfit. can't seem figure out how improve fit. decreasing tolx or tolfun has not changed value in coeffs. model = @(a,x) 1./(1 + a*x.^2); model0 = [1e13]; opts = statset('tolx', 1e-25, 'tolfun', 1e-25); coeffs = nlinfit(freqdata, noisedata, model, model0, opts); here's fit. http://i.imgur.com/v1dkd4x.png it seems dealing small numbers there might floating point precision issue. why won't transform expression different from, fit, inverse transform? example: take 1/model transformation, have simple polynomial fitting, model_new=(x,a)=1+a*x.^2 where can use polyfit , polyval , take 1/result ...

c# - Sending parameters as path segments doesn't work in ServiceStack -

i'm trying make request ss service parameters have empty values when send them url segments. according https://github.com/servicestack/servicestack/wiki/routing can call service in 2 ways: /resource/p1/p2/p3 or /resource?p1=v1&p2=v2&p3=v3 the first method never works (the parameters have default values depending on types) , second 1 works. wan't call service using first method. here's code //request dto [route("/test/{param1}/{param2}/{param3}")] public class test { public string param1 { get; set; } public int param2 { get; set; } public string param3 { get; set; } } //response dto public class testresponse : ihasresponsestatus { public responsestatus responsestatus { get; set; } public string inputs { get; set; } } what doing wrong? just close question: esker posted link mythz confirms we're experiencing iis/asp.net bug.

mysql - SQL max() function returns wrong value for row with maximum value -

this table structure: anees 1000.00 rick 1200.00 john 1100.00 stephen 1300.00 maria 1400.00 i trying find max(salary) , persons name . this query use select max(salary),emp_name emp1 i 1400.00 , anees. while 1400 correct anees wrong,it should maria. changes need make gordon gave explanation why , simplest way want want. if reason want use max() can this select emp_name, salary emp1 salary = ( select max(salary) salary emp1 ) output: | emp_name | salary | --------------------- | maria | 1400 | here sqlfiddle demo

view - Crystal report: changing command's data source -

i have change data source in quite few reports. easy when original data source uses table, more complicated when instead has sql command (well, practically view made in report, not in original database). lets report has such command: select nbr equipment equipment.owner='abc' i know in new database equipment.nbr called items.id, can map this. rest of command, "where" part? in new database there no equipment.owner , possibly might not items.owner. crystal drop part? know how remake it, adding selection formula report, first have know happened "where" condition, , after such mapping can't anymore preview sql command in data source. confrim me using query. if in data soruce no issue report work. if in formula have doubt crystal report won't accept format in basic syntax mode.

clojure - HTTP Kit WebSocket client -

i'm bit confused how create http-kit websocket client. on site there example how create websocket server , , creating client trivial can't seem right. examples out there not focused on javascript clients? p.s. discussion in this question , aleph example, , indication http-kit supports websocket client. take @ clj-wamp . tutorial examples worked out of box me % git clone https://github.com/cgmartin/clj-wamp-example.git % cd clj-wamp-example % lein run [update] server side (although there's javascript sample client in tutorial). client side may want check out sente , chord .

java - how to use non-static function inside of static function -

this question has answer here: an object reference required non-static field, method, or property 1 answer here class.. public class oop { int count = 0; public static void main(string args[]) { this.count(15, 30); system.out.print(this.count); } public void count(int start, int end) { for(;start<end; start++) { this.count = this.count + start; } } } i can't call count function inside of main function. reason static , non-static functions. i'm new java. how can use count inside of main? need learn? you need instantiate oop , call method it, this: oop oop = new oop(); oop.count(1,1); for further information check out: difference between static methods , instance methods

imagemagick - Specify a pixel in image magick -

where can find documentation this? i trying option: -format "%[pixel: u.p{1,1}]" and gets pixel 1,1. how pixel @ 100% of image, tried: -format "%[pixel: u.p{100%,100%}]" -format "%[pixel: u.p{-1,-1}]" i reading this , difficult understand pixel entry says: p = pixel use (absolute or relative current pixel) context the complete command using is: color=`convert ~/desktop/my_image.png -format "%[pixel: u.p{-1,-1}]" info:` and trying color in last pixel of image. by looking @ documentation suggest try u.p{w-1,h-1}

SSL Proxy/Charles and Android trouble -

Image
i want test https calls android device using charles proxy tool. need see raw request/response contents debugging app. i've configured charles adding host , port under "proxy settings" -> ssl tab. when run app, ssl calls seems disappear charles. 1 has idea how fix issue. charles documentation doesn't seem have information android devices. for android7 refer to: how charles proxy work android 7 nougat? for android version below android7 from computer, run charles: open proxy settings: proxy -> proxy settings, proxies tab, check "enable transparent http proxying", , remember "port" in heart. ssl proxy settings:proxy -> ssl proxy settings, ssl proxying tab, check “enable ssl proxying”, , add . locations: open access control settings: proxy -> access control settings. add local subnet authorize machines on local network use proxy machine/mobile. in android phone side: get charles ssl certificate. visit url m

sql - How to get dataset from XMLType in Oracle -

how 1 extract dataset set of xml documents stored in rows, sql select statement? here sample task illustrates question. input create table circle ( id number not null primary key , name_xml varchar2(2000) ) / insert circle select 1, '<t><person><firstn>sean </firstn> <lastn>durkin </lastn></person>' || '<person><firstn>tom </firstn> <lastn>sawyr </lastn></person></t>' dual union select 2, '<t><person><firstn>philip </firstn> <lastn>marlowe </lastn></person>' || '<person><firstn>john </firstn> <lastn>wayne </lastn></person>' || '<person><firstn>constantine</firstn> <lastn>palaeologus</lastn></person></t>' dual union select 3, null dua

css - Positioned "fixed" div is centered. Positioned "relative" div is centered. They both appear a little off -

here's looks like: http://i.imgur.com/h0oqz4q.png here's css: #header{ background:url('header.png'); border-radius:15px; box-shadow: 0px 0px 10px 9px rgba(4, 4, 4, 0.75); -moz-box-shadow: 0px 0px 10px 9px rgba(4, 4, 4, 0.75); -webkit-box-shadow: 0px 0px 10px 9px rgba(4, 4, 4, 0.75); height:145px; width:855px; margin:0 auto; z-index:1; position:fixed; left:0; right:0; top:-10px; max-height:145px; max-width:855px; } #centered_background{ background-color:#f2f2f2; width:845px; height:1000px; margin: 0 auto; position:relative; top:-15px; border-radius:20px; border:4px solid #2e2e2e; left:0; right:0; } i'm guessing has "fixed" aspect of header. don't know. thanks! the width of wrapper needs defined margin:auto work. html, body { width:100%; }

memory management - Java Hashmap. How many maximum records should it be used for? -

i have 10,000 mappings. idea put them in java hashmap , access ? save database transactions 10,000 records present in memory itself. every mapping have around 100 characters including key , value , mappings quite distinct. asking question since don't have great experience in java or on similar situation. 10k objects drop in bucket (pardon pun) far memory goes. try , see, think you'll find modest memory capacity these days handle it. make sure have reasonable heap size: -xmx512m or whatever

java - How to fix the Eclipse executable launcher was unable to locate its companion shared library for windows 7? -

i getting following error, while launching eclipse: the eclipse executable launcher unable locate companion shared library. previously eclipse working fine when had jre6 installed on pc. after installing jre7 update 25 , no longer able launch eclipse. my eclipse ini -file has these lines: -startup plugins\org.eclipse.equinox.launcher_1.0.100.v20080509-1800.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.1.r36x_v20100810 how fix error? great. had similar issue, result of update. please make sure names of libraries mentioned in eclipse.ini , actual names of these files on disk match exactly. -startup plugins\org.eclipse.equinox.launcher_1.0.100.v20080509-1800.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.1.r36x_v20100810 here post used fix issue on system http://codewithgeeks.blogspot.in/2013/11/fixing-eclipse-executable-launcher-was.html

variables - Where is the error? (Basic Actionscript 2.0) -

so making extremely basic application on as2.0 reason, can't it. consists of 2 textboxes, (variables named "num1" , "num2") equal sign converted button (variable named "btn") , final textbox (variable named "res") show result of adding 2 numbers, ones given in "num1" , "num2" textboxes. here's i've tried: on(click) { number(num1) + number(num2) = res; } i've tried on(click) { number(num1) + number(num2) = res.text; } but none of seem work. 1 of these throw "nan" @ "res" textbox , other 1 throws out nothing. where's problem? on(click) { _root.res.text = number(_root.num1.text) + number(_root.num2.text); }

python - NLTK perplexity error -

i got error message traceback (most recent call last): file "c:/users/shengrong/desktop/bigram", line 55, in <module> bg = bigram(file) file "c:/users/shengrong/desktop/bigram", line 43, in bigram return tt1.perplexity(my_bigrams) file "c:\python27\lib\site-packages\nltk\model\ngram.py", line 217, in perplexity return pow(2.0, self.entropy(text)) file "c:\python27\lib\site-packages\nltk\model\ngram.py", line 205, in entropy e += self.logprob(token, context) file "c:\python27\lib\site-packages\nltk\model\ngram.py", line 151, in logprob return -log(self.prob(word, context), 2) valueerror: math domain error import os,csv,nltk nltk.model.ngram import ngrammodel nltk.probability import lidstoneprobdist fout = open("/users/shengrong/documents/personal/wn1.data.csv", "w") outfilehandle = csv.writer(fout, de

regex - PHP - Preg_match_all optional match -

i'm having problems matching the[*] there , not. have suggestions? $name = 'hello $this->row[today1][] dfh fgh df $this->row[test1] ,how $this->row[test2][] $this->row[today2][*] monday'; echo $name."\n"; preg_match_all( '/\$this->row[.*?][*]/', $name, $match ); var_dump( $match ); output: hello $this->row[test] ,how $this->row[test2] $this->row[today][*] monday array ( 0 => array ( 0 => '$this->row[today1][*]', 1 => '$this->row[test1] ,how $this->row[test2][*]', 2 => '$this->row[today2][*]', ), ) now [0][1] match takes on because matching until next '[]' instead of ending @ '$this->row[test]' . i'm guessing [*]/ adds wildcard. somehow need check if next character [ before matching []. anyone? thanks [ , ] , * special meta characters in regex , need escape them. need make last [] optional per question. following the

Ember.js routing, outlets and animation -

it seems if want animate transition between states using new ember.js router , outlets, you're out of luck, since previous content of outlet destroyed before have chance animate it. in cases can animate 1 view out before transitioning new state, there's no problem. it's case both old , new views need visible that's problematic. it looks of functionality needed animate both previous outlet content , new added in this commit , i'm not sure understand how use it. there's been discussion using transitional routes/states explicitly model "in-between" states animations can represent ( here , here ), i'm not sure if it's possible match approach outletted controllers , views. this similar how *not* destroy view when exiting route in ember.js , i'm not sure overriding outlet helper solution. any ideas? you should check out: https://github.com/billysbilling/ember-animated-outlet . then can in handlebars templates: {{animate

c# - What is the type VoidTaskResult as it relates to async methods? -

Image
i've been using async (and .net 4.5 really) first time recently, , i've come across has me stumped. there isn't information voidtaskresult class can find on net came here see if has ideas going on. my code following. obviously, simplified. basic idea call plugin methods, asyncronous. if return task, there no return value async call. if return task<>, there is. don't know in advance type are, idea @ type of result using reflection (isgenerictype true if type type<>) , value using dynamic type. in real code, calling plugin method via reflection. don't think should make difference behaviour seeing. // plugin method public task yada() { // stuff } public async void doyada() { task task = yada(); await task; if (task.gettype().isgenerictype) { dynamic dyntask = task; object result = dyntask.result; // result } } this works plugin method shown above. isgenerictype false (as expected). however if change declaration of plug

ios - UITapGestureRecognizer on multiple UIView (scrollview subviews) -

i have set scrollview , bench of uiview (scrollview subviews) gestures on them: (id element in array) { customview *view = [[customview alloc] init]; [view setframe:cgrectmake(x, 16, self.view.frame.size.width, self.view.frame.size.height)]; [self.scrollview setcontentsize:cgsizemake(scrollcontentsizewidth, self.scrollview.frame.size.height)]; uitapgesturerecognizer *tap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(selectview:)]; [self.view settag:[[element valueforkey:@"id"] integervalue]]; [self.view addgesturerecognizer:tap]; view.userinteractionenabled = yes; [self.scrollview addsubview:view]; scrollcontentsizewidth +=110; x += 110; } the called method when view touched: -(void)selectview:(uitapgesturerecognizer *)recognizer{ nslog(@"id : %i",recognizer.view.tag);//always last ass

android - I can't find GoogleCloudMessaging class -

Image
i'm trying use googlecloudmessaging class, can't find how can add library use it. i added android sdk\extras\google\gcm\gcm-client\dist\gsm.jar , jar didn't include googlecloudmessaging class. it? should add project? thanks. googlecloudmessaging class located in google play services library. download it, include on project gsm.jar

android - how to change json import file from resource to http url -

hi, code load json form resource want change code load json url do? how change code me please. want load json form url me please private jsonobject getcontent() throws ioexception, jsonexception { bufferedreader bufferedreader = null; try { inputstream instream = getresources().openrawresource(r.raw.json); bufferedinputstream bufferedstream = new bufferedinputstream(instream); inputstreamreader reader = new inputstreamreader(bufferedstream); bufferedreader = new bufferedreader(reader); stringbuilder builder = new stringbuilder(); string line = bufferedreader.readline(); while (line != null) { builder.append(line); line = bufferedreader.readline(); } return new jsonobject(builder.tostring()); } { if (bufferedreader != null) { bufferedreader.close(); } } } /** * populates table in main view data. * * @param

javascript - Uncaught TypeError: Cannot read property 'app' of undefined -

i have composite view: var resultview = marionette.compositeview.extend({ template : resultpanel, itemview : resultitemview, initialize : function() { ... }, itemviewoptions : { app : this.options.app }, i want assign view's app property itemview's app property. can use view's app other view. i'm getting error: uncaught typeerror: cannot read property 'app' of undefined. doing wrong? there way in order this? possiblity #1: this.option not yet set when code executes. possibility #2: maybe 'this' not expect be. assign var = this; before , use 'that' instead of 'this'. or assign var _options = this.options; before extend() , use _options in extend.

php - Exact JSON creation using Ajax -

i'm working on sort of information visualization consists of displaying binary tree on web in website http://codemink.com for this, i'm using library: http://philogb.github.io/jit/static/v20/jit/examples/spacetree/example2.html this main code structure of above example. //init data var json = "{id:\"node02\", name:\"0.2\", data:{}, children:[{id:\"node13\", name:\"1.3\", data:{}, children:[{id:\"node24\", name:\"2.4\", data:{}, children:[{id:\"node35\", name:\"3.5\", data:{}, children:[{id:\"node46\", name:\"4.6\", data:{}, children:[]}]}, {id:\"node37\", name:\"3.7\", data:{}, children:[{id:\"node48\", name:\"4.8\", data:{}, children:[]}, {id:\"node49\", name:\"4.9\", data:{}, children:[]}, {id:\"node410\", name:\"4.10\", data:{}, children:[]}, {id:\"node411\", name:\"4.

sql server - Which connection string is deprecated? -

i'm checking out customer's files , not being godlikely savvy on sql, i'm not sure of following syntaxes preferred or more modern. both seem same thing may leave them work in consequent manner. string con1 = "server=servername;database=dbname;trusted_connection=yes;", con2 = "data source=servername;initial catalog=dbname;integrated security=sspi;"; ?!

java - dynamically changing entry value of util:map in Spring -

i have defined below map definition in spring config file,so clientlist map object.so question is,i want change entry key "java" value based on other condition. <util:map id="clientlist" map-class="java.util.hashmap"> <entry key="java" value="manualtest"/> <entry key="c" value="qtp"/> </util:map> so here,i can after getting map object , using if conditions.is otherway can in spring config file before spring container returns object? is possible define other bean determines value of entry? regards, raj what if this: <util:map id="clientlist" map-class="java.util.hashmap"> <entry key="#{t(com.myconditionclass).getcorrectkey()}" value="manualtest"/> <entry key="c" value="qtp"/> </util:map> here getcorrectkey() static method , (com.myconditionclass).getcorrectkey() call

javascript - Why don't these agile carousels work properly in chrome? -

i've been using agile carousel while , worked in past, has stopped working in safari , chrome, working on firefox , safari ipad. on this page , carousel stops @ second image , can not work out why. on this page again carousel stops on second image, problem intermittent , if pause carousel , start again problem disappears! any appreciated! additional info: here's code: <script> $(document).ready(function(){ $.getjson("carousel/agile_carousel_awards.php", function(data) { $("#flavor_1").agile_carousel({ carousel_data: data, carousel_outer_height: 478, carousel_height: 478, slide_height: 480, carousel_outer_width: 300, slide_width: 300, transition_time: 1200, timer: 4000, continuous_scrolling: true, }); }); }); </script> i'm beginning wonder if problem not code @ all, laptop. it's worked whe

c# - Glimpse is breaking signalr on mono -

after installing glimpse, ~/signalr/hubs stopped working @ mono productions server. still works when running locally using iis express. system.argumentnullexception argument cannot null. parameter name: httpcontext @ system.web.httpcontextwrapper..ctor (system.web.httpcontext httpcontext) [0x00000] in <filename unknown>:0 @ glimpse.aspnet.aspnetframeworkprovider.get_context () [0x00000] in <filename unknown>:0 @ glimpse.aspnet.aspnetframeworkprovider.get_httprequeststore () [0x00000] in <filename unknown>:0 @ glimpse.core.framework.glimpseruntime.getruntimepolicy (runtimeevent runtimeevent) [0x00000] in <filename unknown>:0 @ glimpse.core.framework.glimpseruntime.hasoffruntimepolicy (runtimeevent policyname) [0x00000] in <filename unknown>:0 @ glimpse.core.framework.glimpseruntime.endsessionaccess () [0x00000] in <filename unknown>:0 @ glimpse.aspnet.httpmodule.endsessionaccess (system.web.httpcontextbase httpcontext) [0x0