Posts

Showing posts from June, 2015

php - How to pass grid data to another page? -

i new php. have page containing grid. users can edit values in grid. when click submit button, pass of grid data action page. however, don't know how this. please give inputs. for eg. if form this, can give name text below. <form name="form_submit" method="post" action=""> <table> <tr> <td><input type="text" name="title[]" /></td> <td><input type="text" name="text[]" /></td> </tr> <tr> <td><input type="text" name="title[]" /></td> <td><input type="text" name="text[]" /></td> </tr> <tr> <td><input type="text" name="title[]" /></td> <td><input type="text" name="text[]" /></...

wordpress disable image being viewed in gallery -

i included code image attachment template (image.php) file display gallery of thumbnails current post. function show_all_gallery_thumbs() { global $post; $post = get_post($post); /* image code */ $images =& get_children( 'post_type=attachment&post_mime_type=image&output=array_n&orderby=menu_order&order=asc&post_parent='.$post->post_parent); if($images) { $thumblist = '<ul class="thumbnails">'; foreach( $images $imageid => $imagepost ) { unset($the_b_img); $the_b_img = wp_get_attachment_image($imageid, array(64,64)); $thumblist .= '<li class="span1"><a href="'.get_attachment_link($imageid).'" class="thumbnail">'.$the_b_img.'</a></li>'; } $thumblist .= '</ul>'; } return $thumblist; } how detect image bei...

mysql - How to query multiple tables in alphabetical order? -

i can apply query 1 table , want apply 5 tables in temporary table making records in alphabetical order. because has freezing problem more 5000 records , solution applying records when starts "a letter" , after "b letter" .... end "z letter" example amanda anabele . . . zeplin zambia the important thing first letter should in alphabetical order shortly want make temporary table , applying query in alphabeticak order on first letter.. how can make it? update names inner join (select n1.id, n1.name, count(n2.id)+1 cnt names n1 inner join names n2 on n1.name=n2.name , n1.id>n2.id group n1.id, n1.name) s on names.id = s.id set names.name = concat(names.name, '.', s.cnt) if want gather data multiple tables, use union or - if not want/need filter out duplicates - union (which should bit faster). example: select col1, col2 table1 union select col3, col4 table2 if want sorted, way (if remember c...

Magento all products become out of stock after import -

i having frustrating problem magento import. encountered problem after several times of doing import without issue. have 2 different csv files have same content use import products. diffrence 'is_in_stock' column. use import update products quantity of our online store. this csv file sets products out of stock: outofstock-issue.csv this 1 correctly sets product' stock availability: outofstock-issue-2.csv

c# - How to insert image at end of Word document -

i trying insert image word document inserted @ start of document. want insert image @ specific position. there way insert image @ specific position in document? this code range.inlineshapes.addpicture(imgloc, ref otrue, ref ofalse,type.missing);

javascript - show only one series data in High charts in start of drawing/load -

i trying draw 1 series in high chart, have several series data me jsfiddle i want show tokyo series in start, , show user option show more using legend js $(function () { $('#container').highcharts({ title: { text: 'monthly average temperature', x: -20 //center }, subtitle: { text: 'source: worldclimate.com', x: -20 }, xaxis: { categories: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] }, yaxis: { title: { text: 'temperature (°c)' }, plotlines: [{ value: 0, width: 1, color: '#808080' ...

In python run command line application show terminal readout -

i have written python application using wxpython sends commands command line application. application runs lengthy commands, when run in terminal gives lots of feedback , readout whilst running. when it's finished can output print or save file, istead of running command line application blind, python open terminal run application can real time view of what's happening, still terminals return values when finished though. section of current code: command4 = "/usr/local/itms/share/itmstransporter.woa/itmstransporter -m provider -u username -p password -v extreme" process = subprocess.popen([command4], stdout=subprocess.pipe, shell=true) result4 = process.communicate()[0] when run not open terminal window, runs blind, can't see going on, commands take long time run, need see whats going on in real time in terminal window, how can make so. running on pc mac. kind regards.

XSLT 1.0 Group nodes by child attribute value -

i'm trying group child elements, within parent element only, own parent grouping. group action/@publishforresources within own parent element actions. so if have xml such below <?xml version="1.0" encoding="utf-8"?> <scheduleupdates id_schedule="10" timestamp="2013-07-31t09:28:15.285+10:00" id_user="2" userid="2" username="admin" caused-by="" cookiepgs="" crbstransactionid="2298"> <actions operation="insert"> <action id_action="207836" actionkindid="3" id_task="4094" publishforresources="855"/> <action id_action="207824" actionkindid="3" id_task="4101" publishforresources="876"/> <action id_action="207828" actionkindid="3" id_task="4098" publishforresources="876"/> <actio...

xml - Get xmllint to output xpath results \n-separated, for attribute selector -

how can xmllint output multiple results of xpath selector attributes "per line"? take example: <?xml version="1.0" encoding="iso-8859-1"?> <config> <tagx key1="value1 " key2=" value2"/> <tagy key3="value3" key4=" value4 "/> </config> $ xmllint example.xml --xpath "/config/*/@*" the result is: key1="value1 " key2=" value2" key3="value3" key4=" value4 " what i'd is: key1="value1 " key2=" value2" key3="value3" key4=" value4 " would need split after even-numbered quote marks, or there neater way this? there's related question, about same subject except it's picking out contents of <tag>value</tag> , , not <tag attribute="value" /> you can try: $ xmllint --shell inputfile <<< `ech...

Android ListView onTouchEvent doesn't always give ACTION_DOWN -

my problem when try drag item in listview, don't action_down event. got lots of action_move events , 1 action_up event. not case. got action_down 3 times. confused me. i looked @ similar questions it's answers seems not fit mine . can think of why happening? thanks //list_client -- listview list_client.setontouchlistener(new view.ontouchlistener() { float f1 = -1, f2 = -1 ; @override public boolean ontouch(view v, motionevent event) { switch(event.getaction()){ case motionevent.action_down: f1 = event.getrawy(); break; case motionevent.action_move: f2 = event.getrawy(); if(f2 - f1 > 50){ if(view.visible != rl_search_and_add.getvisbility() && ){ rl_search_and_add.setvisibility(view.visible); } f1 = f2; }else if (f2 - f1 < -50){ rl_search_and_add.setvisib...

ios - Getting OauthException when uploading a video to facebook -

i trying upload video on iphone user's facebook timeline using social framework. used snippet given in this answer . here code: - (void)performactivity { nslog(@"sharing on facebook."); acaccountstore *accountstore = [[acaccountstore alloc] init]; acaccounttype *facebookaccounttype = [accountstore accounttypewithaccounttypeidentifier:acaccounttypeidentifierfacebook]; nsdictionary *options = @{acfacebookappidkey : @"***", acfacebookpermissionskey : @[@"email"], acfacebookaudiencekey:acfacebookaudiencefriends}; [accountstore requestaccesstoaccountswithtype:facebookaccounttype options:options completion:^(bool granted, nserror *error) { if (granted) { nsdictionary *options = @{acfacebookappidkey : @"***", acfacebookpermissionskey : @[@"publish_stream"], acfacebookaudiencekey:acfacebookaudiencefriends}; [accountstore requestaccesstoaccountswithtype:facebookaccounttype options:options completion:^(bool gra...

Using memcached with Java and ScheduledFuture objects -

i've been playing around caching objects (by first creating own cache turned out stable implementation inefficient) , trying hand @ using memcached. although memcached works beautifully, i've ran problem. how i'm using objects follows: i read data database object, store object in memcached. every couple of minutes retrieve object memcached, retrieve additional data either database or other objects in memcached, update object new / relevant data, store object memcached. objects need viewed pulled memcached, packaged , sent onto client-side application display. this works well, except when number of objects i'm creating-storing-updating-viewing in memcached becomes high. java/tomcat-jvm doesn't seem garbage-collecting "fast enough" on objects pulled out of memcached, , vm runs out of memory. i'm limited 8gb of memory (and preferably bring down 4 if can - using memcached), question is, there solution in preventing jvms memory usage expan...

How do I handle files with spaces in my Makefile? -

so anonymous developers have decided use ridiculous convention of using spaces in folder names contain source files. change these folders not use spaces sadly don't make rules around here that's not option (though wish were). luac = luac src_dir = . source = \ stupid/naming\ convention/a.lua \ stupid/naming\ convention/very\ annoying/b.lua \ vpath .lua $(src_dir) out_dir = ../out/ output = $(patsubst %.lua, $(out_dir)/%.luac, $(source)) all: $(output) $(out_dir)/%.luac: %.lua $(luac) "$<" mv luac.out "$@" .phony: simple makefile. it's meant compile lua files have , put them output directory. no matter keeps wanting split source string on spaces in folder, end beautiful error this: make: *** no rule make target `stupid/naming ', needed `all'. stop. is ther...

Convert excel to csv and import data to php -

Image
i need import data excel php, heard it's hard, need convert excel file csv. have problem, can't convert successfully, when trying error message: my original excel file looks like: and after convert csv: what's problem? need convert , keep same format. my php file csv reading looks like: <?php $row = 1; if (($handle = fopen("test.csv", "r")) !== false) { while (($data = fgetcsv($handle, 1000, ",")) !== false) { $num = count($data); echo "<p> $num fields in line $row: <br /></p>\n"; $row++; ($c=0; $c < $num; $c++) { echo $data[$c] . "<br />\n"; } } fclose($handle); } ?> and result how looks after reading in php: example so need ideas how convert xls csv without loosing format or how import data excel file php. can me, please? thank you. this phpexcel library have problems (memory / time ) loading big f...

javascript - Loading effect inside canvas -

i developing game player can shoot enemies on hitting on space bar have scenario when player hit space loading bar should decreased till hit 0 , regenerate till hit 100. when regenerate player can shoot again having problem in doing scenario. the code : var charge=100 var player = { x: 225, y: 430, width: 50, height: 50, image: "", speed: 6, life: 3, middpoint: 25, playercanshoot: true, draw: function () { canvas.drawimage(this.image, this.x, this.y, this.width, this.height); }, shoot: function () { bullets.push(playerbullets({ speed: 20, x: this.x + this.middpoint, y: this.y })); var x = setinterval(function () { charge = charge - 20; }, 500); if (charge == 0){ clearinterval(x); // when charge 0 var y=setinterval(function(){ charge=charge+20; ...

Hosting sites from dropbox -

i know there great sites site44.com, kissr allows host site dropbox. well in case, don't want use site 44 or kissr host site dropbox. there api or sort of tool allow me connect site , dropbox ?. i have site need make client , @ time of creating client, need create individual folder designated each client. of course, able html form , php. now, planning is, create folder , save file in in dropbox , syncing newly created folder in site... i can tell how site44 works, poll /delta api: https://www.dropbox.com/developers/blog/23/using-dropboxs-delta-api-lessons-learned-from-site44 instead of doing that, fetch data on-demand. website code read files dropbox when they're requested, save difficulty of polling /delta , keeping local copy up-to-date.

c# - need help using CSVHelper package in Visual Studio 2012 -

i saw example here on stackoverflow, code goes this: var csv = new csvhelper( file.openwrite( "some-file.csv" ) ); csv.writer.writerecords( mycustomobjectlist ); however, i'm unable instantiate csvhelper class, there isn't one, csvhelper namespace. there way above code working, or did install incorrectly? thanks it looks example older version of csvhelper library. api changed quite bit between 1.x , 2.x, , there no longer csvhelper class. can instantiate csvreader , csvwriter classes directly (or there's csvfactory ), above code this: var csvwriter = new csvwriter(new streamwriter("some-file.csv")); csvwriter.writerecords(mycustomobjectlist)

objective c - iOS : Repositioning UIGraphicsBeginImageContext and UIImageView -

i've got code allows me draw on top of uiimageview - want able limit drawing area. i've been able limit size, i'm unable position it: if change (0, 0) else image disappeared , ability draw stops working drawimage - uiimageview - (void)touchesmoved:(nsset *)touches withevent:(uievent *)event { mouseswiped = yes; uitouch *touch = [touches anyobject]; currentpoint = [touch locationinview:self]; uigraphicsbeginimagecontext(cgsizemake(560, 660)); [drawimage.image drawinrect:cgrectmake(0, 0, 560, 660)]; cgcontextsetlinecap(uigraphicsgetcurrentcontext(), kcglinecapround); cgcontextsetlinewidth(uigraphicsgetcurrentcontext(), 5.0); cgcontextsetrgbstrokecolor(uigraphicsgetcurrentcontext(), 0, 1, 0, 1); cgcontextbeginpath(uigraphicsgetcurrentcontext()); cgcontextmovetopoint(uigraphicsgetcurrentcontext(), lastpoint.x, lastpoint.y); cgcontextaddlinetopoint(uigraphicsgetcurrentcontext(), currentpoint.x, currentpoint.y); cgcon...

image - Setting the quality for ffmpeg command? -

what have add command: cat *.jpg | ffmpeg -f image2pipe -r 10 -vcodec mjpeg -i - out7.webm to best available quality? try adding switch "-qscale x". the lower x, better quality (range 2 32, fractions allowed). should work.

regex - Regexp for C preprocessor command -

i trying write 1 regexp match c preprocessor commands in c program. wonder if can give me suggestions? thank in advance. that grep '^[[:blank:]]*#' note grep first line of multi line preprocessor directive (continued backslash newline).

debugging - Google Charts-Code for Category Filter -

was trying out google chart function codes. i'm trying create line chart category filter. here's code: function drawvisualization() { // prepare data. var data = google.visualization.arraytodatatable([ ['x', 'cats', 'blanket 1', 'blanket 2'], ['a', 1, 1, 0.5], ['b', 2, 0.5, 1], ['c', 4, 1, 0.5], ['d', 8, 0.5, 1], ['e', 7, 1, 0.5], ['f', 7, 0.5, 1], ['g', 8, 1, 0.5], ['h', 4, 0.5, 1], ['i', 2, 1, 0.5], ['j', 3.5, 0.5, 1], ['k', 3, 1, 0.5], ['l', 3.5, 0.5, 1], ['m', 1, 1, 0.5], ['n', 1, 0.5, 1] ]); // define category picker 'category' column. var categorypicker = new google.visualization.cont...

linux - Should you create a separate user for web content? -

not long ago saw colleague of mine creating separate user on linux putting web site content under users home folder. told me so, because of security considerations. wondering there reason doing this? since can set permission of web content folder www-data wherever located? an example: create user "web" web content -> $ adduser web put web content under /home/web point web server /home/web/app root folder using $home webroot not idea because systems create basic files within $home when create user (ex. .profile, .bashrc,.bash_history,...) create dedicated user webserver (ex. www-data in debian) normal (or no) $home setup server use different document root.

linux - Build Android APK programatically -

i've been looking issue long... no succeed. i need build web environment creates signed android .apk files given android application source code. how can this? web environment running on linux machine. i thinking on linux shell script builds signed .apk file. however, i've read information apache ant don't understand purpose , if trick. many thanks.

internet explorer - View Cart works in Chrome and Firefox but not IE -

i have paypal add cart , view cart buttons on website i'm building. add cart works fine in chrome, firefox , ie. view cart works in chrome , firefox, not ie. i'm using ie 10 on windows 7, wampserver proving localhost. paypal functions executed real, not using sandbox, genuine paypal accounts. ideas? thanks. try using instead: <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="business" value="sulalor@eircom.net"> <input type="hidden" name="display" value="1"> <input type="hidden" name="shopping_url" value="localhost/bwb/index.html"> <input type="image" src="https://www.paypal.com/en_us/i/btn/btn_viewcart_lg.gif" border="0" name="submit" a...

javascript - Can I use function as an object inside the same function -

i write code follows, function myfunction(){ myfunction.myvar = "somevar"; } after execute function, can able access myfunction.myvar how working? , if so, problem hidden in this? if problem, please explain context of that. how working? when declare function in execution context, binding added variable environment of context. when reference identifier, current variable environment checked see if binding exists identifier. if no binding exists, outer variable environment checked, , on, global scope. so: // outer scope // binding exists 'example' function example() { // inner scope // no binding 'example' // references 'example' in outer scope example.x = 1; } what problem hidden in this? there none (in general... although whether it's right solution depends on you're trying do). you creating "static" property of function. javascript functions first-class can set properties on...

c# - No response when call button click in javascript -

good day, i have aspx contain button id button1, following aspx code : <div> <asp:linkbutton id="lnkview" commandname="view" runat="server">view</asp:linkbutton> <asp:button id="button1" runat="server" text="ok" onclick="button1_click" /> </div> /* code here */ <script> function test() { document.getelementbyid("<%=button1.clientid %>").click(); alert("hello"); return true; } </script> the following aspx code behind: //some code here lnkview.attributes.add("onclick", "return test()"); //some code here protected void button1_click(object sender, eventargs e) { scriptmanager.registerstartupscript(this.page, this.gettype(), "javascript", "<script>alert('record added successfully')</script>", false); } as can see, li...

javascript - populate and disable text field depending on dropdown -

unfortunately i'm not familiar javascript/jquery. have form dropdown. need populate text field depending on selection of dropdown. first voice of dropdown "other" text field must writable, second want assign value automatically , disable text field. the value of dropdown saved in db must remains name of option. i found several solutions google none of them fits needs...hope me. to create functionality you're looking for, there few basic things you'll need learn. jquery selectors first, if aren't familiar jquery's selector syntax, learn here . the .change() event next, you'll need know how bind dropdown menu's .change event. 1 way $('#dropdownid').change(function() { ... }); , shortcut $('#dropdownid').on('change', function() { ... }); . within callback functions, can access dropdown element this , result, jquery object $(this) . we can grab dropdown's value $(this).val() , use basic logic e...

Form error management in symfony 2 -

im trying guess why form submit not valid, since entity has no constraints. i pass twig template 'error' => $form->geterrors() have no idea how show in twig error message thanks all from the docs : {{ form_errors(form.fooproperrty) }} and {{ form_errors(form) }} if may guess, form not validating because forgot render csrf token, can render doing {{ form_rest(form) }}

raspberry pi - Send commands from lighttpd to mono application -

i'm working on project , want do, have installed lighttpd on raspberry pi running xbian , have created asp file using control xbmc using .net library.i got mono application control xbmc , want send command or signal or message lighttpd running mono application how this, have use rpc, pipe etc. thank you you either use lua or php plugin, parse requests there , run stuff accordingly. a rather difficult alternative write plugin , make whatever needs (though require @ least decent c skills security awareness) http://redmine.lighttpd.net/projects/1/wiki/howtowritealighttpdplugin

html - File opens instead of downloading in internet explorer in a href link -

<a href="path/to/file/filename.xxx" download="filename.xxx">filename</a>' when click link, filename.xxx should downloaded. it works in chrome. in internet explorer, opens file instead of downloading. problem? there properties added make work in ie. and need file download sample works browsers. the download attribute not supported in ie (see http://caniuse.com/#search=download%20attribute ). that suggests download attribute supported firefox, chrome, opera , latest version of blackberry's browser. for other browsers you'll need use more traditional methods force download. server side code necessary set appropriate content-type , content-disposition header tell (or trick depending on point of view) browser download item. headers should this: content-type: application/octet-stream content-disposition: attachment;filename=\"filename.xxx\" (thanks antyrat copy , paste of headers)

c# - Reorder a List of string using LINQ -

i have list of string list contains state names. need move few states(ex new york, california etc) appear @ top of list. how can using linq? fyi: list alreday sorted in alphabetical order. its simple list , few important states needs @ top. no criteria. the following proof of concept using letters instead of states. var = new list<string>() {"a","b","c","d","e"}; var top = new list<string>() {"c","d"}; var finallist = top.concat(all.except(top)); the idea have full list of states ( all ) , list of ones want @ top ('top'). take ones @ top , concatenate list of remaining ones create using except method.

apache - How to do url re-writing for MVC purpose in PHP -

this works fine on localhost: #the rewriteengine directive enables or disables runtime rewriting engine. rewriteengine on #this won't allow folder accessible if it's not having index.php file options -indexes #this redirect user http://localhost/awe/ if 404 or 403 error comes errordocument 404 http://192.168.1.6/app/ errordocument 403 http://192.168.1.6/app/ rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewritecond %{request_filename} !-l rewriterule ^(.+)$ index.php?url=$1 [qsa,l] the same gives me error on godaddy.com server : error 500 when remove options -indexes use show me 1st page index.php exists there doesn't show internal pages , shows 404 error because being defined under bootstrap . kindly suggect needs done. also, have put 1 of subdomain , within 1 folder: path of app this: http://mysubdomain.mywebsite.com/myprojectname/app so .htaccess file putting in folder http://mysubdomain.mywebsite.com/myprojectname/app ...

php - How to redirect to the page that I submit in the form (pagination) -

hello have form: <form method="get"> <input type="number" name="page=home&paginh"> <input type="submit"> </form> and have pagination in code...so want put field in site form above, when user write number in field , submit it, must redirect him page user wrote. problem this... result take in url http://example.com/index.php?page%3dhome%26paginh=2 number '2' in end number user submit. problem url changes page stills same. have searched lot not find solution. in advance! yes sorry! this php: <?php $per_page = 1; //ayto einai apotelesma p 8a vgalei sto index(arxiko h home) ola ta post mazi. $pages_query = mysql_query("select count(`id`) `posts`") or die(mysql_error()); $pages = ceil(mysql_result($pages_query, 0) / $per_page); //$page = (isset($_get['page'])) ? (int)$_get['page'] : 1; if (isset($_get['paginh'])) { $page = (int)$_get['paginh']; ...

Need tips to optimize SQL Server stored procedure -

this stored procedure, it's taking time execute though running local database. please suggest changes in order improve performance begin try declare @country_cd int set @country_cd =(select country_cd country country_desc = ltrim(rtrim(@country_desc))) declare @companny_cd int set @companny_cd =(select company_cd company company_desc = ltrim(rtrim(@company_desc))) begin transaction delete pack country_cd = @country_cd , company_cd = @companny_cd , pack_desc = ltrim(rtrim(@pack_desc)) commit transaction end try begin catch if(@@trancount > 0) rollback transaction declare @errmsg nvarchar(4000), @errseverity int select @errmsg = error_message(),@errseverity = error_severity() raiserror(@errmsg, @errseverity, 1) end catch hard without knowing more database schema. few initial ideas might cleanup *_desc variables right away rather doin...

performance - PL/SQL : Should i use a collection or do multiple querys? -

Image
i'm working on project need create big html table each table row 15 minute interval , every table column day. goal show users want reserve rooms when room available , not. webpages pl/sql packages print out proper html. example of table room : (don't mind different colors) all room definitions stored oracle database containing start date, end date, starting hour, ending hour , days of week. example definition be: (07-31-2013 - 07-31-2014, 00:00 - 23:59, mondays,tuesdays , fridays) my concern build every square of html table, need make query check if specific period defined. (for example if user wants see full week 10:00 14:00 room, 112 querys made build table 15 minute intervals) not mention user can see 4 weeks , time interval (could 00:00 23:59). problem need make check room definitions have make check many times see if interval taken reservation... make 224 querys see week. my solution room definitions , reservations affect period user wants see , put them in...

php - Imagick - Make black background white -

i using following code mask 1 image on image.on output gives me image black backgroung. but need white background or transparent background. following code using mask 1 image on another. <?php $destination_path = getcwd().directory_separator; $im1="image1.png"; $im2="image2.png"; $i1="$destination_path$im1"; $i2="$destination_path$im2"; $base = new imagick($i1); $mask = new imagick($i2); // setting same size images $base->resizeimage(274, 275, imagick::filter_lanczos, 1); // copy opacity mask $base->compositeimage($mask, imagick::composite_dstin, 0, 0, imagick::channel_alpha); $base->writeimage('output.png'); header("content-type: image/png"); echo $base; ?> the trick using: $im = $im->flattenimages(); : <?php $im = new imagick($filename); $im->setimagebackgroundcolor('#ffffff'); $im = $im->flattenimages(); $im->setimageformat("jpeg"); $im->setimagec...

android - Why is it not sleeping for 3 seconds before it starts listening? -

i'm trying do: perform texttospeech speechrecognizer starts listening user repeats texttospeech'd word/phrases but problem that, example, if "example" via texttospeech, when speechrecognizer starts listening, takes in "example" previous , adds onto 1 user says. @ end, ended "example example", didn't want. code: public void onitemclick(adapterview<?> parent, view view, int position, long id) { // todo auto-generated method stub item = (string) parent.getitematposition(position); tts.speak(item, texttospeech.queue_flush, null); thread thread = new thread() { public void run() { try { sleep(3000); } catch (interruptedexception e) { e.printstacktrace(); } } }; thread.start(); sr.startlistening(srintent); } you doing 2 process in 2 thread. creating thread 1 , make sleep 3 seconds , sr.startlistening(s...

3d - Different Axes Positions in MATLAB -

Image
i'm trying shift axes positions in matlab figure. i'd achieve similar (which done in gnuplot): i don't have idea whether possible @ all, or might find answer, appreciated. hmm.... so let's plot: x = zeros(1,21); y = -10:10; z = y/2; figure; plot3(x,y,z); % line (0,-10,-5) (0,10,5) similar example well, 1 problem matlab doesn't automatically plot coordinate axis you've shown there. discussed here: how show x , y axes in matlab graph? to plot (in 3d), cheap solution is: locs = axis; % current axis boundaries hold on; plot3([locs(1) locs(2)], [0 0], [0 0]); %plot xaxis, line between(-x,0,0) , (x,0,0); plot3([0 0], [locs(3) locs(4)], [0 0]); %plot y axis, line (0,-y,0) , (0,y,0); plot3([0 0], [0 0], [locs(5) locs(6)]); % plot z axis hold off just gnu plot, 3d matlab plot "in box." unlike gnu plot, matlab box isn't outlined. if want outline you'll have draw lines too...ugh. % lets plot 12 lines make box in black ...

Excel: Data validation of specific numbers with special cell formatting -

i'm learning data validation of cell values in excel , have discovered problem solve. have cell want allow specific number values. no problem since can use data validation specific cell. can't use "numbers" criteria have numbers 10; 20; 30 example because can specify number ranges (larger than, less than, between etc). instead of using number range use "list" function , write 10; 20; 30 , works. the problem occurs when add special formatting cell. let's want format 1 isn't pre-existing in excel, enter value "10" should display "10 moneys" or grammatically correct. if use custom formatting can add " moneys" after "standard" displayed in cell format menu (ctrl + 1). if either 1 works, if add both list 10; 20; 30, , formatting of standard" moneys" doesn't work when use drop down menu. reason because drop down menu tries add value "10 moneys" , list doesn't recognise because expe...

Can we use GoogleAds/AdMob/AdWhirl in cocos2d-android? -

i want add admob / adwhirl gamelayer scene. i search on everywhere couldn't find way work. don't want switch library. , should do? if have worked on , give way . as there not layout xml file cocos2d android can add progammatically. crate linear layout in onstart method itself. like this linearlayout.layoutparams adparams = new linearlayout.layoutparams( getwindowmanager().getdefaultdisplay().getwidth(), getwindowmanager().getdefaultdisplay().getheight()+getwindowmanager().getdefaultdisplay().getheight()-50); adview = new adview(simplegame.this, adsize.banner, "your ad id"); adview.setadlistener(simplegame.this); adrequest request = new adrequest(); request.addtestdevice(adrequest.test_emulator); adview.loadad(request); ccdirector.shareddirector().getactivity().addcontentview(adview,adparams); this should i...

apache commons beanutils - How to copy objects managed by Hibernate? -

i want copy object (its properties). object managed hibernate , has lazy collections. propertyutils.copyproperties() throws lazy exception. is there way? ps: not want unproxy object since don't own (its in jar) you can call hibernate.initialize() on every lazy collectio of original object before copying. obviously, not work outside of transaction, if yor object detached hibernate session. so, have initialize lazy collections enough.

c# - DynamicMethod and type checks -

can explain or point explanation why runtime types check not occurs in sample below - string property can set type value ... stuck in unexpected place , surprised using system; using system.reflection; using system.reflection.emit; namespace dynamics { internal class program { private static void main(string[] args) { var = new a(); a.name = "name"; console.writeline(a.name.gettype().name); propertyinfo pi = a.gettype().getproperty("name"); dynamicmethod method = new dynamicmethod( "dynamicsetvalue", // name null, // return type new type[] { typeof(object), // 0, objsource typeof(object), // 1, value }, // parameter types typeof(program), // owner true); // skip visibility ilgene...

java - How to change ActionBar Tab bottom border and selected tab background? -

Image
i have created clean app fixed tabs , imported appcompat, how change active tab bottom border color , change clicked tab background? this want: have @ action bar style generator http://jgilfelt.github.io/android-actionbarstylegenerator/

php - "accessRules()" in YII -

i use yii framework , limiting access pages accessrules , filter. there information of how limit access without db or how getting access variable, how can getting role database , access filters in controller. public function filters() { return array( 'accesscontrol', // perform access control crud operations 'postonly + delete', // allow deletion via post request ); } public function accessrules() { return array( array('allow', // allow authenticated user perform 'create' , 'update' actions 'actions'=>array('create','update', 'view', 'index'), 'users'=>array('@'), ), array('allow', // allow admin user perform 'admin' , 'delete' actions 'actions'=>array('admin','delete', 'view', 'index'), 'users'=>array(...

performance - Randomize timestamp column in large MySQL table -

i have test database table ~100m rows generated cloning original 3k rows multiple times. let's table describes events have timestamps. due cloning have ~10m events per day far real cases. i'd randomize date column , scatter records several days. here procedure i've come with: drop procedure if exists `randomizedates`; delimiter // create procedure `randomizedates`(in `daterange` int) begin declare id int unsigned; declare buf timestamp; declare done int default false; declare cur1 cursor select event_id events; declare continue handler not found set done = true; open cur1; the_loop: loop fetch cur1 id; if done leave the_loop; end if; set buf = (select now() - interval floor(rand() * daterange) day); update events set starttime = buf event_id = id; end loop the_loop; close cur1; end // delimiter ; on 3k table executes ~6 seconds assuming linear сomplexity take ~50 hours applied on 100m table. there way speed up? or maybe p...

Django South migrations fails with column does not exist, for a column that hasn't been introduced yet -

on app running multiple migrations 0023-0027 in 1 go. first of migration complaining missing column not introduced until later. running migrations blogs: - migrating forwards 0027_auto > blogs:0023_auto error in migration: blogs:0023_auto the error reads: django.db.utils.databaseerror: column blogs_blog.author_bio not exist line 1: ...log"."author_name", "blogs_bl... so idea why migration 0023 fail missing column not introduced until migration 0027? the problem auto-generated 0023 migration in forwards function had following in it: in blog.objects.all(): a.uuid = u'' + str(uuid.uuid1().hex) a.save() that calls model based on latest content, author_bio in it. fix call model "orm" so: in orm.blog.objects.all(): a.uuid = u'' + str(uuid.uuid1().hex) a.save()

java - Empty JTextField User Input Error -

i'm trying create program takes user input through jtextfield , converts integer me calculate with. want prevent breaking program typing nothing jtextfield. how can detect when jtextfield empty? daniel this spot use regular expression. here basic information on how use them.

asp.net mvc 4 - Using UrlHelper inside a controller breaks test -

i'm new mvc , tdd please go easy on me! i have action needs redirect action. i'm constructing base uri follows: urlhelper u = new urlhelper(this.controllercontext.requestcontext); string baseuri = u.action("paypalauth", "order"); i've adapted paypal's sample code (string baseuri = request.url.scheme + "://" + request.url.authority + "/order/paypalauth?";) maybe i've not used best method come baseuri target action? main problem is, when call action mstest unit test null exception on controllercontext. what's easiest way solve problem? have found similar questions on can't follow them. guess may need use mocking framework don't know start! what's easiest way solve problem? by mocking controllercontext . here's example of how achieved: https://stackoverflow.com/a/32672/29407

dojo - dijit/form/form issues POST issues in firefox -

i trying post form using dojo.xhrpost . below code works fine in chrome not work @ in firefox. when doesn't work see page reloads again , nothing happens. tried use dojo.stopevent(event); doesn't seem work in firefox. can please suggest me mistake. feel issue more form xhrpost. html looks below: <div data-dojo-type="dijit/form/form" data-dojo-id="myform" id="loginform" enctype="multipart/form-data" action="" method="post"> <script type="dojo/method" data-dojo-event="onsubmit"> if(this.validate()){ senddata(); //calling javascript function }else{ alert('form contains invalid data. please correct first'); return false; } return true; </script> <table cellspacing="10"> <tr> <td><label for="name">username:</label></td> <td><input type="text" ...

html - Please help me with this navigation bar -

this code vertical navigation bar have created, there 1 more thing need add here , flyout menu on mouse over. have tried many things did not work. here's css code .navbar{ list-style-type: none; margin: 0; padding: 10px; width: 280px; /* width of menu */ } .navbar li{ border-bottom: 1px solid white; /* white border beneath each menu item */ } .navbar li a{ background: #333 url(media/sexypanelright.gif) no-repeat right top; /*color of menu default*/ font: bold 13px "lucida grande", "trebuchet ms", verdana; display: block; color: white; width: auto; padding: 5px 0; /* vertical (top/bottom) padding each menu link */ text-indent: 8px; text-decoration: none; border-bottom: 1px solid black; /*bottom border of menu link. should equal or darker link's bgcolor*/ } .navbar li a:visited, .navbar li a:active{ color: white; } .navbar li a:hover{ background-color: black; /*color of menu onmouseover*/ color: white; border-bottom: 1px solid black; /*bottom border...

How to display an ArrayList in a JPanel -

how can jlist show in jpenel. example i'd have following groups of items displayed in jpanel, each group showing on it's own column, new group being dropped new line, how google lists search results. for example: import java.util.arraylist; import java.util.list; import javax.swing.jpanel; public class readerimpl { jpanel paneto = new jpanel(); list<string> text() { list<string> lovely = new arraylist<string>(4); lovely.add("tall, short, average"); // line 1 lovely.add("mangoes, apples, bananas"); // line 2 lovely.add("12, 33"); return lovely; } // how add lovely arraylist paneto } a jlist renderer can draw checkbox, jlist does not support cell editor. instead, consider one-column jtable. check out link here. hope helps.

php - Sorting distinct results into different tables -

i have table contains information on classes cpr, first aid, etc...i sort , display information table each class type. of cpr classes in table new table first aid classes, etc... the code below puts each class it's own table...i need group them classname if possible. thanks in advance help. scott <?php $result = mysql_query("select * providerclasses clientid = '$clientid' order classname"); $i = 0; // start count bg color while($row = mysql_fetch_array($result)) { echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\" class=\"gridtable\" width=\"975\" style=\"margin-bottom:100px;\">"; echo "<tr class=\"gridheader\">"; echo "<td width=\"88\" class=\"grid-header-cell\">date</td>"; echo "<td width=\"161\" class=\"grid-header-cell\">time</td>"; echo "...