Posts

Showing posts from April, 2010

objective c - Weird memory leak with Blocks and copying in certain way in ARC -

the following simple code, under arc, in latest xcode (4.6.2) shows leaks when profiled leaks instrument, in ios simulator, in release build configuration -os optimization: - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { (int = 0; < 10; i++) { void (^block)() = ^ { nslog(@"%d", i); }; id x = block; [x copy]; } return yes; } it shows 10 leaked blocks. (it not show leaks optimization turned off; turning off optimization not realistic our app.) strange thing is, looking @ memory management history each of leaked blocks, fine -- each has malloc copy , release; release somehow not deallocate it? is compiler bug (it using default apple llvm compiler)? this seems either bug in compiler or leaks instrument, not sure which. should file bug apple. the same leak happens when shortening code this: int = 0; void (^block)() = ^{

python - pandas dataframe groupby like mysql, yet into new column -

df = pd.dataframe({'a':[11,11,22,22],'mask':[0,0,0,1],'values':np.arange(10,30,5)}) df mask values 0 11 0 10 1 11 0 15 2 22 0 20 3 22 1 25 now how can group a, , keep column names in tact, , yet put custom function z: def calculate_df_stats(dfs): mask_ = list(dfs['b']) mean = np.ma.array(list(dfs['values']), mask=mask_).mean() return mean df['z'] = df.groupby('a').agg(calculate_df_stats) # not work and generate: mask values z 0 11 0 10 12.5 1 22 0 20 25 whatever replaces values column masked mean. and can solution applied function on 2 columns , return in new column? thanks! edit: clarify more: let's have such table in mysql: select * `reader_datapoint` `wavelength` = '560' limit 200; which gives me such result: http://pastebin.com/qxiawcjq if run this: select *, avg(action_value) `reader_datapoint` `wav

javascript - Mashup Google maps & photos by Flickr -

i've problems little script permits me create mashup google maps , photos flickr. creates simple map rome milan , after that, requests ten images flickr based on geotag. @ end, positions every photo marker taken google. but can't understand i've done wrong. have ideas? <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>mappa+info</title> <style type="text/css"> html, body { margin:0; padding:0; width:100%; height:100%; } body { background:#ffffff; color:#000000; font-family:arial, helvetica, sans-serif; font-size:12px; line-height:150%; text-align:center;} #map { width:100%; height:100%; } input { width:250px; } </style> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=aizasyc0ham8pi7rmquism444jdehtjoswbte_e&am

android - When requestLocationUpdates call? -

i trying call requestlocationupdates using above: locationupdaterequester.requestlocationupdates(900000, 75, criteria, locationlistenerpendingintent); when call requestlocationupdates again after approx 15 min , 75 meter distance cover device? it checks @ every 15 min interval, change in distance. whenever distance increases above 75 meter, onlocationchanged() invoked.

java - Is it possible to re-direct an instance from a constructor in a multi-class? -

checking boolean condition passed multi-class' constructor, , if true i'm trying assign this instance of sub-class. doesn't work of course, there way re-direct instance in way? if there no way this, reasons why? here multi-class: public class multiclass { string str; public multiclass(boolean flag) { if (flag) { // doesn't work! wish would: // = new extraclass(); } else { this.str = "you in first class"; } } } // end of multiclass class extraclass { string str; extraclass() { this.str = "you in second class"; } } // end of extraclass ...and tester class: public class multiclasstest { public static void main(string[] args) { multiclass test = new multiclass(false); system.out.println(test.str); } } // end of multiclasstest you can have either use factory method e.g. static method can return implementatio

Display long text in fixed frame in Corona -

so @ moment have assignment @ school requires me create calculator mobile devices using corona, ive got buttons , display classes work. in display class, ive created 2 frame (one display method , others result). final result im looking handheld graphical calculator's ui (casio fx series..). which means can type in long , continuous method (the whole text move toe left , show end of method) press "=" calculator give result. what i've got far created frame can fit 2 lines of text displaying method, once you've filled frame numbers, corona crop out end of string . so i'm going having 2 strings, 1st 1 main 1 store user type in (the whole method) select last 10 characters main string , save in second string , display second string. so know if there's code can use select number of characters string ? you can use built in lua method string.sub (yourstring, startindex , endindex ) http://pgl.yoyo.org/luai/i/string.sub `

php - mysql table update gives no result -

i made html form updates fields in table in mysql db after succeful updates should direct me success page otherwise give error msg. indicating error i use form validation far nothing happens fields in table directs me blank page here form code : <html> <body> <form action="http://localhost/wordpress/orgupdate.php" method="post" name="myform"> name <input id="name" type="text" name="name" /> telephone <input id="telephone" type="text" name="telephone" /> fax <input id="fax" type="text" name="fax" /> web address <input id="webaddress" type="text" name="webaddress" /> state <input id="state" type="text" name="state" /> address <input id="address" type="text" name="address&

python - How to make autoscale_view respect text -

fig = plt.figure() ax = fig.add_subplot(111) ax.add_patch(...) # several times ax.text(x,y,"something") # several times ax.autoscale_view() truncates text. i.e. not respect text position, width , height in viewport calculations. how make autoscale_view respect ax.text(...) calls?

jquery - Get latest tweets through twitter search not working? -

i'm using following code latest tweets specific hashtag $(document).ready(function(){ getlatesttweets(); function getlatesttweets(){ var url = "http://search.twitter.com/search.json?q=%23syria&result_type=recent&rpp=3&callback=?"; $.getjson(url, function(json){ alert('reached'); var html = '<ul>'; $.each(json.results, function( key, result){ html += '<li><a href="#">' + '> ' + result.text + ' ...' + '</a></li>'; }); html += '</ul>'; $('#archive-twitter').append(html); }); } }); this code working fine 2 days ago stopped working today. getjson method won't succeed though when use following link http://search.twitter.com/search.json?q=%23syria&result_type=recent&rpp=3 in browser actual json data i don't know problem? update: added test link

php - Opencart: admin category list display by user_id -

i have 3 users opencart admin, follows: user_id=1 user_id=2 user_id=3 what question is, if user_id=1 user add categories admin category list (eg: computer, cellphone, tab, etc.) when user_id=2 or other users login time no need display... mean each users added categories lists, show when logged user account... dont allow show other users... sql public function getcategories($parent_id = 0) { $category_data = $this->cache->get('category.' . (int)$this->config->get('config_language_id') . '.' . (int)$parent_id); if (!$category_data) { $category_data = array(); $query = $this->db->query("select * " . db_prefix . "category c left join " . db_prefix . "category_description cd on (c.category_id = cd.category_id) c.parent_id = '" . (int)$parent_id . "' , cd.language_id = '" . (int)$this->config->get('config_language_id') . "' order c.s

vb.net - Font adding using PDFsharp -

i using pdfsharp add text pdf. when use below code add following text these fonts facing problem. after pdf created using pdfsharp , when opened in adobe reader getting message "cannot find or create font 'windings'. characters may not display or print correctly." opens the source pdf trying modify has fonts helvetica , windings(embedded) this part of code adds text pdf dim font xfont = new xfont("verdana", 20, xfontstyle.regular) gfx.drawstring("hello, world!", font, xbrushes.black, new xrect(0, 0, page.width, page.height), xstringformats.center) font = new xfont("wingdings", 20, xfontstyle.regular) gfx.drawstring("llll", font, xbrushes.black, new xrect(25, 15, page.width, page.height), xstringformats.center) font = new xfont("helvetica", 20, xfontstyle.regular) gfx.drawstring("abcd", font, xbrushes.black, new xrect(50, 25, page.width, page.height), xstringformats.center) after using code text ge

javascript - How to give the number in google map marker -

how give number in google map marker ? there marker available implement marker it's number. used following code this locations = (<?php echo json_encode($location); ?>); var map = new google.maps.map(document.getelementbyid('map'), { zoom: 6, center: new google.maps.latlng(locations[0][1], locations[0][2]), maptypeid: google.maps.maptypeid.roadmap }); var infowindow = new google.maps.infowindow(); var marker, i; marker = new google.maps.marker({ position: new google.maps.latlng(locations[0][1], locations[0][2]), map: map, icon: 'blue-dot.png' }); google.maps.event.addlistener(marker, 'click', (function(marker) { return function() { infowindow.setcontent(locations[0][0]); infowindow.open(map, marker); } })(marker, i));

Printing Individual Characters of Strings Python -

my code reads import time = raw_input("enter string: ") b = len(a) #print 1st letter of string time.sleep(2) #print 2nd letter of string #continue doing until last character in string what need make code in python 2.7? prods in right direction appreciated. thank you. you can iterate on string itself: import time = raw_input("enter string: ") char in a: #iterate on string 1 character @ time print char time.sleep(2) # sleep after printing each character example: >>> x in "foobar": ... print x ... f o o b r

PayPal IPN: HTTP/1.1 400 Bad Request -

i know has been asked times, none of solutions worked me. using instant payment notification (ipn) simulator paypal ( https://developer.paypal.com/webapps/developer/applications/ipn_simulator ) receive: unexpected response paypal: http/1.1 400 bad request <?php //open socket acknowledgement request $fp = fsockopen (ssl://www.sandbox.paypal.com, 443, $errno, $errstr, 30); if (!$fp) { // fsockopen error throw new exception("an error occured while using fsockopen(): [$errno] $errstr"); } //set acknowledgement request headers $header .= "post /cgi-bin/webscr http/1.1\r\n"; $header .= "host: ssl://www.sandbox.paypal.com\r\n"; $header .= "content-type: application/x-www-form-urlencoded\r\n"; $header .= "content-length: ".strlen($data)."\r\n"; $header .= "connection: close\r\n\r\n"; // post request paypa

Meteor's Session.set causing duplicate the Bootstrap modal? -

i using meteor 0.6.2.1. i have encountered strange issue bootstrap modal when call meteor's session.set(). i want show simple modal dialogue , update data when user clicks on template instance. i copy bootstrap modal example .html file: <body> {{> hello}} {{> alert}} </body> <template name="hello"> <h1>hello world!</h1> {{greeting}} <input type="button" value="click" /> <br/> <!-- button trigger modal --> <a href="#mymodal" role="button" class="btn" data-toggle="modal">launch demo modal</a> </template> <template name="alert"> <!-- modal --> <div id="mymodal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden=&quo

Prolog avoid generating same lists twice -

i have following code: internal_generator(list):- select(foo, list, mlist), select(bar, mlist, m2list), select(baz, m2list, _). internal_generator2(list):- select(sth1, list, mlist), select(sth2, mlist, m2list), select(sth3, m2list, _). external_generator([list1, list2]):- internal_generator(list1), internal_generator2(list2). prolog, after generating list1 internal_generator, starting generate list2 internal_generator2 , display results. however, when internal_generator2 throw results, prolog go internal_generator, other result foo,bar,baz , start generating possible values @ internal_generator2 again. how can refactor code in way store results internal_generator2? moreover, don't want use findall generate of possible results @ beginning of exernal_generator (my real example large, , global stack overflow). so need zip . in general terms, need reentrable coroutines that. built-in prolog mechanism works in nested fashion. so if re-write gene

PHP Javascript maintenance page -

i used in index.php <? include('config.php'); if($site->maintenance > 0){ echo "<script>document.location.href='maintenance'</script>"; exit; } ?> and in config.php after checked database connection $site = mysql_fetch_object(mysql_query("select * problems")); i made table in database , called problems when put value 0, transfers me maintenance. when checked variable $site var_dump($site) outputs: bool(false) and if checked this: var_dump($site->maintenance) outputs: null what have manage maintenance database , when want site work change value? why using js this? if user js off? use php instead create table maintenance column maintenance_status , hold boolean value, 0 1... 0 => off, 1 => on, keep single record created once, , later update always... so later create function function check_maintenance($connection) { /* call function on every page,

asp.net - Using a dropdownlist from one <asp> section to update a grid view in another <asp> section -

i have above problem, if include dropdownlist, data source , grid view in 1 section works fine. need have grid view in central section whilst keeping dropdownlist box left. hoped use left1.sqldatasource or left1/sqldatasource these dont work. any ideas how reference dropdownlist in central grid view? code <asp:content id="content2" contentplaceholderid="left1" runat="server"> <div id="head2"> start here: <asp:dropdownlist id="dropdownlist1" runat="server" autopostback="true"> <asp:listitem>please select genre</asp:listitem> <asp:listitem>chart</asp:listitem> <asp:listitem>house</asp:listitem> <asp:listitem>techno</asp:listitem> <asp:listitem>dubstep</asp:listitem> <asp:listitem>drum , bass</asp:listitem> </asp:dropdownlist> <

qt4 - page-break-inside doesn't work in table cells with rowSpan? -

Image
i want make pdf rendering of big report table. seems phantomjs doesn't support rowspan attribute. here example: phantomjs rasterize.js "http://fiddle.jshell.net/eric777/sltga/show/" report.pdf a4 here jsfiddle and here result is there workaround this? edit: maybe fix issue in webkit? this not bug in phantomjs, how webkit handles page breaks. (chrome, too.) can see opening page in safari , trying print on "us letter" size. don't know why 3 pages on a4 size when fiddle fits 2 pages of (shorter) letter size, think beside point. in general html pdf converters aware of have exact same problem or have such difficulty solving considered unacceptably buggy. see how avoid page break inside table row wkhtmltopdf example. see ways use javascript webkit break table better here , along more discussion of problem.

php - Only the_excerpt seems to return anything -

when producing front page of website , trying grab 5 excerpts wordpress database produces excerpt, no problem, ignores the_title, get_the_id , the_date: foreach( $post $posts) : setup_postdata($posts); echo "<hr><h1>" . the_title( false, false, false ) . "</h1>"; echo the_excerpt( ) . "<br />"; echo "<a href='./index.php?p=" . get_the_id( ) . "'><font color='white'>read more...</font></a><br />"; echo "published on: " . the_date( false, false, false, false ); endforeach; which produces output: http://i.stack.imgur.com/jnkxh.png and such, 'read more...' directed './index.php?p=' i have defined get_posts statement follows: $args = array( 'posts_per_page' => 5, 'numberposts' => 5, 'offset' => 0, 'category' => $c, 'order_by'

javascript - Fade elements in on scroll with Jquery -

i creating timeline of events on website, , trying each element (with class '.event') fade in scroll down through timeline. having issues - fade in @ same time rather individually. any ideas why? in advance! $(document).ready(function() { /* every time window scrolled ... */ $(window).scroll( function(){ /* check location of each desired element */ $('.event').each( function(i){ var bottom_of_object = $(this).position().top + $(this).outerheight(); var bottom_of_window = $(window).scrolltop() + $(window).height(); /* if object visible in window, fade it */ if( bottom_of_window > bottom_of_object ){ $(this).animate({'opacity':'1'},500); } }); }); }); based on jsfiddle seems linked styling and/or markup issue. here's updated version of jsfiddle works code , markup: http://jsfiddle.net/2ymn4/2/ . messes layout little bit, might need rethink structure, poin

android - findViewById returns null in fragment -

i have problem using findviewbyid methond in fragment. the spinner in spinner spinner = (spinner) view.findviewbyid(r.id.tabsearchspinner_location); null. please see code below. public class fragmenttabsearch extends sherlockfragment implements onitemselectedlistener { @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // todo auto-generated method stub view view = inflater.inflate(r.layout.fragment_tab_suggestions, container, false); spinner spinner = (spinner) view.findviewbyid(r.id.tabsearchspinner_location); arrayadapter<charsequence> adapter = arrayadapter.createfromresource(this.getsherlockactivity(), r.array.spinner_location, android.r.layout.simple_spinner_item); adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); spinner.setadapter(adapter); return view; } @override public void onitemselected(icsadapterview<?> parent, view view,

scala - Type aliasing to avoid name clash in type refinement -

can use aliasing don't need change either of type parameter/member in following name clash situation: trait bar { type } trait foo { def get[a]: option[bar { type = }] // "illegal cyclic reference" } i know can write trait foo { def get[a1]: option[bar { type = a1 }] } but prefer not change type name. you e.g. this: trait bar { type } trait foo { type m[x] = bar { type = x } def get[a]: option[m[a]] } or inline: def get[a]: option[({ type x[y] = bar { type = y }})#x[a]] = ??? or, if prefer: def get[a]: option[({ type a1 = a; type x = bar { type = a1 }})#x] = ???

php - CakePHP: How to retrieve data by multiple condition -

please me retrieve data table multiple condition in cakephp have 1 table name: article; have tried retrieve data code below want specific id given in parameter; article_price > 0 , article_status > 1 public function getarticle($artid = ''){ return $this->find('all', array( 'condition' => array( 'article_id =' => $artid, 'article_price' => '> 0', 'article_status = ' => '1'), 'order' => 'article_id desc' )); } // out put selected data without condition want. problem code? found out print: echo $this->element ('sql_dump'); , got following sql statement: select `article`.`article_id`, `article`.`name`, `article`.`article_price`, `article`.`article_status` `db_1stcakephp`.`article` `article` 1 = 1 order `article_id` desc please me. thank!

MYSQL INSERT - "0 rows inserted". Any suggestions why is that? -

insert fields (id_region, id_fields_info, subsidy_dka, id_rents_dka, type_uses, id_rented_from, id_categories, id_farmer, id_season) select regions.id, fields_info.id , 120, rents_dka.rent_dka, "собствена", rented_froms.id, categories.id_category, farmers.id, seasons.id regions, fields_info, rents_dka, rented_froms, categories, farmers, seasons region = "Азмък" , field_num = 2222 , rent_dka = 60 , name = "Десислав" , id_category = 3 , name = "Десислав" , season = "2012-2013" so have these tables: regions, fields_info, rents_dka, rented_froms, categories, farmers, seasons and filled data. i've made form user fills fields data these tables, i've mentioned, , when submit button clicked want fill table fields in mysql id's data, user had entered. to spot problem, i'd proc

How do I Create Bootstrap Thumbnail Items in DivShot? -

divshot looking awesome, finding useful i'm newbie bootstrap. 1 thing cant see in there how create thumbnail grids ( http://twitter.github.io/bootstrap/components.html#thumbnails ). there away of doing or missing something? cheers malcolm edit: unfortunly there no thumbnail possibility in divshot. divshot has nice included html editor , u can add thumbnail syntax there. css available via bootstrap.css

unit testing - Passing targets between SConscript files -

i'm trying hierarchical build working in scons. directory structure looks this: code/sconstruct code/src/sconscript code/src/main.c code/src/foo.c code/src/bar.c code/src/tests/sconscript code/src/tests/test_foo.c code/src/tests/test_bar.c test_*.c need linked c files implement functions test, test_foo.c has linked foo.c example. src/sconscript has return number of targets src/tests/sconscript can construct binaries(1 each test). question best way accomplish using return() function? want order of files returned not matter, tuple not do. thought construct dictionary keys being filenames. wanted check there wasn't nicer way this; maybe can structure files differently facilitate cleaner build? thanks in advance, instead of passing targets around, consider creating 2 libraries: libfoo , libbar. link libraries in when compiling test_foo , test_bar binaries, referencing them variant_dir. trying pass around targets tends complicated , hard maintain. in case you&#

stored procedures - sql: select average grade for all subjects for one student and print an according message -

i have table student following columns: id subject grade date ---|-------|------|-----------| 1 | | 1 | 01-mar-10 | 1 | | 5 | 05-apr-10 | 1 | b | 3 | 01-jun-10 | 2 | | 1 | 01-mar-10 | 2 | c | 3 | 01-apr-10 | in procedure pass student id (p_id), , need select average grade of subjects student, if student has 2 grades same subject, latest grade counts, this: for p_id=1: id avggrade ---|--------| 1 | 4 | this done now what need now, save information student's success in string , print dbms_output. highest grade 1, lowest 5. if student had single 5 (as last grade subject), no matter average has, string should contain "the student failed", if student had no 5 last grade, , had average of <= 1,5 , string should contain "perfect average", otherwise "the student passed" the code far is: create or replace procedure avg_grade ( p_id in number ) cursor c1 select a.id, av

How to use function view in Drupal -

hi guys new drupal bare me :) . i trying lear how create own module , stuck. created text.module, text.install , text.info . it's basic module inputing text. so have next scenario iput text in textbox saves table in database can display table in : http://img33.imageshack.us/img33/5815/textyi.jpg now question can , how can use function view in picture "ttt" becomes link can see title , text "ttt" ? edit : i figure out need : in table have 3 columns (test_id, title, text) now use $result = db_query("select title,text {text} "); now how can turn title link . let in row 1 col1 of title stands house. how can turn house link. need sometning $result= db_query ("select n.title, n.text form {text} n n.title = :title", array (":title" => ???? )) i think looking for <?php l(t('link text'), 'about-us', array('attributes' => array('class' => 'about-link')));

asp.net mvc - Does anyone know where the script reference ... payload.gosidekick.net ... comes from? -

i have asp.net mvc 4 project working on , noticed have script failure. looked , discovered unexpected script tag in code, requesting file ... payload.gosidekick.net ... not know or comes from. have number of plugins in page thought maybe 1 of them injecting reference. commented out script files , tag continues included! i cannot seem find or how it's getting injected , cannot tell googling around whether it's harmful or not. has had same experience? if so, able figure out how rid of it? thanks, g p.s. interestingly enough not in view source, notice in chrome when site executes means must getting injected @ runtime (?) updated link being injected <script type="text/javascript" src="http://payload.gosidekick.net/delivery/ds_shprty49d12x.js"></script> reposting comment answer: if happens in chrome, it's coming chrome extension. disabling extensions have installed fix it? update: did digging , found think copy of s

Use a variable to choose a dictionary to search in Python 3 and Tkinter? -

i have got customers, e.g. customer1 . , have stored data in dictionary this: customer1 = {"age": 20, "gender": "male",} i want have tkinter entry box , text variable called searchterm : searchterm = stringvar() entry = entry(frame, textvariable=searchterm) then want able find dictionary using value typed in , display data in text widget. i'm new python please help. assuming have frame called frame1 #create text present result , entry input text1 = text(frame1,bg="white",width=60) entry1 = entry(frame1,bg="yellow") #the handler necessary process input def handler1(event): text1.delete(1.0,end) data=entry1.get() #what ever want data# #get result...# text1.insert(result) #a button engage function input b1=button(self,text="open",width=20) b1.bind("<button-1>",handler1)

awk - How to create an alias correctly -

i've tested command $ nmap -sp 192.168.1.* | grep 192 | awk '{print $5}' which produces output 192.168.1.1 192.168.1.33 192.168.1.34 192.168.1.36 192.168.1.41 and added .bash_alias file , sourced it. # alias shows ips on local network alias list-ip="nmap -sp 192.168.1.* | grep 192 | awk '{print $5}'" but produces output nmap scan report 192.168.1.1 nmap scan report 192.168.1.33 nmap scan report 192.168.1.34 nmap scan report 192.168.1.36 nmap scan report 192.168.1.41 i've got no clue on i'm doing whrong. want output when run on command-line, , should be. you use double quotes, $5 gets expanded @ time set alias. try alias list-ip="nmap -sp 192.168.1.* | grep 192 | awk '{print \$5}'" note alias list-ip='nmap -sp 192.168.1.* | grep 192 | awk "{print $5}"' will not work because expansion still takes place, time when run alias. you can rid of awk , e.g.: alias list-ip=&

How to install visual studio documentation offline? -

i have suffered trying download documentation using visual studio's library manager . gets stuck after downloading 2 out of 5 books, , there no option pause , resume. know can full documentation download , install offline? you can install documentation manually setup folder itsef. availablein 'productdocumentation' folder. have open file .msha extensiom

php - Croatian letters enconding + Twitter Bootstrap + Helvetica Neue Pro -

twitter bootstrap won't show letter đ ć č ž š,croatian letters. set charset utf-8 , won't do... i'm getting data form mysql , in database ok, first tought font helvetica,so helvetica neue pro lt but...not sure load correctly...any idea how load... twitter bootstap + font awesome , so tired arial, , won't work! so help? tnx alot there can several reasons. before troubleshooting database, should first try static content ensure editor , server correctly set up. try adding html content php file contains croatian characters. if these characters come out wrong in browser, make sure: your code editor saves php files using utf-8 encoding your webserver outputs php files utf-8. check this, @ http header in browser. there should line named "content-type" value of "text/html; charset=utf-8". @ screenshot chrome locate http header: http://www.jesperkristensen.dk/webstandarder/doctype-chooser/chrome.png if static characters come out r

multithreading - How to make a Java Application faster? -

i have billing daemon must process hundred thousands of data in fast manner. implemented executorserivce parallel processing. did increase speed not much. takes approx 2.5-3 hours process 1,00,000 records. how can make more faster processing data within half hour? i have written following execution setting: -xms2048m -xmx2048m -xx:maxpermsize=256m i tried implement producer consumer model 1 producer , 4 consumers. each list can contain 10,000 records. arrayblockingqueue<billablelist> list =new arrayblockingqueue<billablelist>(10); executorservice threadpool = executors.newfixedthreadpool(5); threadpool.execute(new consumer("pool1", list)); threadpool.execute(new consumer("pool2", list)); threadpool.execute(new consumer("pool3", list)); threadpool.execute(new consumer("pool4", list)); future producerstatus = threadpool.submit(new producer("producer", list)); producerstatus.get(); threadpool.shutdown(); i

php - How to send contact form info to email -

i have small form i'm not understanding how send email using php. there seems different techniques. if code small form can analyze , take there. thank in advance!!! html form: <form method="post" action=""> <p> <input type="hidden" name="recipient" value="dew02d@yahoo.com" /> <input type="hidden" name="subject" value="test feedback" /> <input type="hidden" name="redirect" value="main.html" /> </p> <p style="font-family:arial, helvetica, sans-serif; color:#fff; font-size:12px; font-weight:bold"><label>first name: <input type="text" name="first name&q

android - How to communicate between background services -

i implementing app, in have 2 services. 1 task , pass value service , service task using value. when first service generate first value should start 2nd service. here after values generated first service added in queue in 2nd service. first time when 2nd service starts can set value in queue using intent, don't know how communicate after starting 2nd service. how communicate between these services. anybody have idea on please me. as of understanding, may communicate in 2 ways: bind service(s) make use of broadcastreceiver within service(s) exchange data/commands however, suggest not complicate design involving multiple services. in fact, should decide either need ordinary service or can done via intentservice .

java - Is it possible to implement efficiently a parallel mathematic computation in a 4 core Android device? (This has nothing to do with interfaces) -

i know keeping responsive interface in android heavy work must completed in independent thread. understand how accomplish (by using asyntask..., etc), , not point of question, know. but i've been struggling while simple parallel program. program search lowest integer in array witch length 15000000. i implemented runnable: ... run(){ highestinteger = integers[firstindex]; for(int = firstindex; < secondindex; i++){ if(highestinteger<integers[i]){ highestinteger = integers[i]; } } } ... highest integer in first half of array (in 1 thread) , highest integer in other half of array (in second thread). the program works on computer (as java/not-android program) , mean parallel times shorter (almost half) serial ones. but on android tablet (4 cores) times same , serial ones shorter. i have notice (with debugger) in tablet there several threads running: the main/ui thread (3 cores left) binder 1 thread (2 cores left) b

java - How do I pause a method until a button is pressed? -

i designing software multiple components - each own actionlistener. example, have jpanel cardlayout holds 10 cards - each own jpanel , purpose. on 1 side, there multiple buttons, i.e. login, logout, settings, etc. when click login, switch card using login() method login jpanel object want wait button click i.e. login, new user, or cancel before continuing login() method , setting current user. is there method pause program until 1 of buttons clicked retrieve data it? (kind of how joptionpane.showinputmessage(null,"input string") waits you) my code below: frame: /** * frame design */ public class frame extends jframe{ jpanel leftside, upperrightside; employeeadder employadd; arraylist<serviceview> serviceviewers; chartviewer viewchart; paybyview viewpayby; settingsviewer viewsettings; loginviewer viewlogin; categoryview viewcategory; serviceadder serviceadd; directory directory; employee currentemployee; chargeviewer viewcharge; jbutton login, logout,

joomla - Database schema version (2.5.11) does not match CMS version (3.1.1). -

i have been upgrading joomla (2.5- - 3.1) site locally upgrade broken. sql upgrade did not pass. have been trying use database fix option did not work in case. database schema version (2.5.11) not match cms version (3.1.1). table '#__content' not have column 'title_alias' type 'varchar(255)'. (from file 1.7.3-2011-10-15.sql.) i have been trying execute manually other query fails. how fix broken tables? where valid sql upgrade script? try clicking "fix" button on extension manager > database view. if still not resolve issue, you'll need manually apply of fixes. can grab sql updates github (the same relative file path applies well) , manually run each file's queries using tool such phpmyadmin. note you'll need change table prefix (#__) match of own site.

drupal 6 - Increase memory_limit of subdomains in the plesk panel -

i increased memory_limit 512m in plesk panel, ran phpinfo() , tested 2 addresses: fanap.ir/phpinfo.php ----> memory_limit=512m test.fanap.ir/phpinfo.php ----> memory_limit=128m how can increase memory_limit of subdomains? as know in plesk 11 subdomains have own php settings. click on subdomain name on sites list in "websites & domains" tab , there see "php settings" tab subdomain.

javascript - What is the underscore function for? -

i've been using underscore collection of statics. what underscore function for: var _ = function(obj) { if (obj instanceof _) return obj; if (!(this instanceof _)) return new _(obj); this._wrapped = obj; }; what example of how use this? you can use underscore wrapper function, more oop-like style : _(val).method(…); // instead of equal _.method(val, …); these wrapper objects allow chaining : _.chain(val).method1(…).method2(…); // or _(val).chain().method1(…).method2(…);

sql - Oracle: IN function within an IF block -

i have cursor c2, 1 column 'note', containing numbers. want check, whether column contains 5 , change local variable if so. this: create or replace procedure proc result varchar(50); cursor c2 select note student; begin if c2.note in(5) result := 'contains 5'; dbms_output.put_line(result); end; / doesnt work. please help! you have loop on records/rows returned in cursor; can't refer cursor that: create or replace procedure proc result varchar(50); cursor c2 select note student; begin r2 in c2 loop if r2.note = 5 -- in work doesn't add result := 'contains 5'; end if; end loop; dbms_output.put_line(result); end; / but if you're testing existence of record value 5 don't need cursor: create or replace procedure proc result varchar(50); begin select max('contains 5') result student note = 5; dbms_output.p

Populate jQuery plugin defaults from json file -

i'm building jquery plugin, allows users use custom themes, called options so: $('element').myfunction({ theme: '/path/to/theme' }); the theme contains file theme-info.json , contains name of theme, other metadata, , read plugin when initalised: { "name": "themename", "author": "authorname" } what i'd able do, populate default options plugin, array of plugin options json file within theme, can overridden when calling function, though had been hardcoded so: $.fn.myfunction = function (options) { var defaults = { theme: '/default/theme/path', themeoptions: { // values called json option1: 'value1', option2: 'value2' } } } and called plugin: $('element').myfunction({ theme: '/path/to/theme', themeoptions: { option1: 'value1', option2: 'value2' } }); is possible read json file defaults in way? , if

c++ - Can't read first string -

here code #include<iostream> #include<cstring> #define limit 25 using namespace std; int main() { int te; //number of test cases cin>>te; while(te) { char m[limit]; char w[limit]; cin.getline(m,limit); // line not getting executed reason cin.getline(w,limit); cout<<"m "<<m<<" "<<endl<<"w "<<w<<endl; te--; } } for god knows reason, machine refuses read m first test case. reads , prints values both m , w in other cases, first case, refuses read m. sample: input 1 hello m w hello 2 hello m w hello stack overflow m stack w overflow cin>>te; this extract 1 input stream , stop @ not extract \n . you'll need ignore() character, otherwise next line extraction read empty line. cin.ignore(); or ignore all characters , including next \n character (in case inputs 1foo or something), can do: cin.ignore(s

How can I systematically add a time stamp to new documents in Meteor? -

when new document inserted collection, i'd add time stamp it. want server this, not client. best solution here? rem: i'd rather not implement own custom meteor.methods() this, use classical meteor.collection.insert() method from here - https://github.com/oortcloud/unofficial-meteor-faq blockquote how can alter every document before added database? there isn't support right now, can use deny achieve want on server. example, timestamp each document goes mongo: posts.deny({ insert: function(userid, doc) { doc.createdat = new date().valueof(); return false; }}) ```

html - spacing between form fields -

i have html form element: <form action="doit" id="doit" method="post"> name <br/> <input id="name" name="name" type="text" /> <br/> phone number <br/> <input id="phone" name="phone" type="text" /> <br/> year <br/> <input id="year" name="year" type="text" /> <br/> </form> i there little more space between fields, example, between lines <input id="name" name="name" type="text" /> <br/> , phone number <br/> , and between <input id="phone" name="phone" type="text" /> <br/> , year <br/> . how can it? i wrap rows in labels <form action="doit" id="doit" method="post"> <label> name <input id="name" name="name

java - Starting a method if activity is started from another activity -

hi! i'm ask dumb question, assure i've searched web , either there no answer (highly unlikely) or i've come across solution have been unable recognize it. anyway, here is: let's have 2 activities, , b. activity b applications launcher activity, when start app, activity b first run. there, i'm going start activity via intent. now, i'm in activity , starting activity b again via intent. now, having started activity b via intent activity a, want run method showstuff() that's inside activity b. how? sorry weird story, i'm unfortunately unable express myself in techincal language. thank help! pass boolean flag "showstuff" though intent when start b intent intent = new intent(this, b.class); intent.putextra("showstuff", true); startactivity(intent); and in b in oncreate intent intent = getintent(); if (intent != null) { boolean showstuff = intent.getbooleanextra("showstuff", false); if (showstu

c++ - Path of the diameter of a binary tree -

i have binary tree , method size of longest path (the diameter): int diameter(struct node * tree) { if (tree == 0) return 0; int lheight = height(tree->left); int rheight = height(tree->right); int ldiameter = diameter(tree->left); int rdiameter = diameter(tree->right); return max(lheight + rheight + 1, max(ldiameter, rdiameter)); } i want function return exact path (list of nodes of diameter). how can it? thanks you have 2 options: a) think. b) search. among first few google hits can find this: http://login2win.blogspot.hu/2012/07/print-longest-path-in-binary-tree.html choose a) if want learn, choose b) if not care, want quick, albeit not perfect solution. there many possible solutions, of them: in divide , conquer approach end maintaining far longest paths on both sides, , keep longer. the quoted solution 2 traversals, 1 determining diameter, , second printing. nice trick overcome problem of not knowing whether @ deepest p