Posts

Showing posts from April, 2010

Android clipboard change listener broke in 4.3? -

so have app monitors clipboard , copies data database. been around since 4.0 , never had issue. 4.3 app copy crashes whenever try copy. standard it. else experience or know of workaround? clipboardmanager manager = (clipboardmanager) getsystemservice(clipboard_service); manager.addprimaryclipchangedlistener(new clipboardmanager.onprimaryclipchangedlistener() { @override public void onprimaryclipchanged() { } }); mark murphy has blog post on subject: http://commonsware.com/blog/2013/08/08/developer-psa-please-fix-your-clipboard-handling.html

jquery - Bootstrap Tabs - streetview -

i came across great little script, loading gmap in bootstrap tabs, via stackoverflow. the link: http://jsfiddle.net/b4zle/49/ i tried making necessary changes try , fire streetview tab, blank. kind soles please. this gmap code ( map ) var map; jquery(function($) { $(document).ready(function() { var latlng = new google.maps.latlng(-16.920728, 145.769219); var myoptions = { zoom: 12, center: latlng, maptypeid: google.maps.maptypeid.roadmap }; map = new google.maps.map(document.getelementbyid("map_canvas"), myoptions); console.dir(map); google.maps.event.trigger(map, 'resize'); $('a[href="#themap"]').on('shown', function(e) { google.maps.event.trigger(map, 'resize'); }); $('#mytab a[href="#themap"]').on('shown', function(){ google.maps.event.trigger(map, 'resize'); map.setcenter(latlng); }); var con...

backbone.js - Backbone.validation not working on save -

i have simple model using backbone.validations plugin . var locationmodel = backbone.model.extend({ validation: { location_name: { required : true, msg : 'a name required location' } } // end validation }); var test = new locationmodel(); test.url = 'http://link-goes-here'; test.save(); it appears on save event, it's going ahead , saving empty model though attribute "location_name" required? i did bunch of testing , way consistently not send request creating defaults on model: var locationmodel = backbone.model.extend({ defaults: { location_name: null }, validation: { location_name: { required: true, msg: 'a name required location' } } // end validation }); var test = new locationmodel(); test.on('validated', function() { console.log(arguments); }); test.url = '/echo/json'; test.save(); here's fiddle . ...

html - target css of parent div -

this question has answer here: is there css parent selector? 25 answers say have following mark up <div class="xxx yyy zzz"> <!-- div generated js , class names change time --> <div class="aaa"> hello </div> </div> how can target css of parent div without knowing class name of parent div using css ? ex: parent.aaa { background: #fff; } it's not possible target parent of element css. nice! you use javascript find element , add class parent, style added class: // javascript - jquery $(".aaa").parent().addclass("parentclass"); // css .parentclass { ... styles ... }

php - Language specific characters to regular english chars -

i not sure start this, here want do: users have textfield need input few words. problem page use people different countries, , enter "weird" latin charaters like: ž, Ä, Ü, đ, Ť, Á etc. before saving base want convert them z, a, u, d, t, a... there way without making (i think there charaters cover): $string = str_replace(array('Č','Ä','Á','đ'), array('c','a','a','d'), $string); and, yes, know can save utf-8 in database, problem string later sent sms, , because of sms protocol nature, these "special" chars use more space in message regular english alphabet cahracters (i limited 120 chars, , if put "Ä" in message, take more 1 character place). first of all, still store original characters in utf-8 in database. can "translate" them ascii characters upon retrieval. because if, say, in future sms adds utf-8 support (or want use user data else), you'll have origina...

python 3.x - How do I create a critical error message using PySide? -

i seem hitting brick wall. no matter do, creating critical error message box doesn't seem working. here's i've tried far: flags = qtgui.qmessagebox.standardbutton.abort flags |= qtgui.qmessagebox.standardbutton.ignore result = qtgui.qmessagebox.critical( self, 'critical error', 'error message', flags ) as taken this tutorial (old know, it's been helpful far). doing however, brings following error: 'pyside.qtgui.qmessagebox.critical' called wrong argument types: pyside.qtgui.qmessagebox.critical(createmessage, str, standardbuttons) supported signatures: pyside.qtgui.qmessagebox.critical(pyside.qtgui.qwidget, unicode, unicode, pyside.qtgui.qmessagebox.standardbuttons = qmessagebox.ok, pyside.qtgui.qmessagebox.standardbutton = nobutton) pyside.qtgui.qmessagebox.critical(pyside.qtgui.qwidget, unicode, unicode, pyside.qtgui.qmessagebox.standardbutton, pyside.qtgui.qmessagebox.stan...

oracle - Is this how non-bulk binding PL/SQL code should be translated to bulk-binding code, and is there ever a reason to forgo buk binding? -

(this oracle 10g): create or replace function bar(...) v_first_type varchar2(100) ; v_second_type varchar2(100); cursor cur select a,b source_table ; v_a int; v_b char; begin open cur; <<l_next>> --10g doesn't have continue statement. loop fetch cur v_a, v_b ; exit when cur%notfound ; --ignore record case: ignore record entirely if == -1 -- goto l_next ; --10g doesn't have continue statement. else -- else v_first := 'success' ; end if; -- transform case: if b == 'z' -- v_second := 'something'; else -- v_second := 'something else'; end if; insert report_table values (v_first, v_second); end loop; close cur; exception ... end; i'm @ first job out of college. i'm looking through legacy code l...

html - XSLT adding extra <br> tag when "copy-of" is used -

i transforming xml: <?xml version='1.0' encoding='utf-8'?> <song xmlns="http://openlyrics.info/namespace/2009/song" version="0.8" createdin="openlp 2.0.1" modifiedin="openlp 2.0.1" modifieddate="2012-03-14t02:21:52"> <properties> <titles> <title>amazing grace</title> </titles> <authors> <author>john newton</author> </authors> </properties> <lyrics> <verse name="v1"> <lines>amazing grace, how sweet sound<br/>that saved wretch me<br/>i once lost, found<br/>was blind see</lines> </verse> with xslt: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:o="http://openlyrics.info/namespace/2009/song"> <xsl:out...

Why not always use _express-checkout-mobile for Paypal Express Checkout? -

in paypal express checkout, _express-checkout-mobile seems auto-detect browser , show correct page @ times. are there scenarios mobile ui improperly displayed? there reason ever pass _express-checkout instead? i've used _express-checkout , automatically detects experience use. think if use _express-checkout-mobile use mobile experience regardless of platform user on, haven't tested specifically.

tcp - Ruby - EM::connection send_data not sending data -

i have class extending em::connection. inside class, check new entries in database, if there new entry, format data , send across tcp connection using send_data. after sending data, logs has done text file, updates database mark record sent. this program runs indefinitely , sends tcp updates @ frequencies driven sporadic user based activity generates database records. normally, can watch data pass across network using linux ngrep command. i having problem send_data command not sending data , not throwing errors. after gets in state, not send more data until restart program. makes issue worse because send_data not throw errors when occurs, program writes logs if worked , updates database record , marks sent. is there way check results of send_data command? if related far end not reading , read buffer maxing out, there anyway can check outbound buffer size?

c# - My code is not giving the desired output -

my text file has following information names date of birth date of joining bella swan 01/18/1986 12/12/2012 edward cullen 10/13/1983 05/08/2013 jacob black 10/18/1981 12/12/2012 carlisle cullen 05/08/1953 12/16/1998 alice cullen 01/18/1986 09/09/2009 if user enters date, records relevant date should pulled up. user enters date 01/18/1986 display shows following details: bella swan 01/18/1986 12/12/2012 alice cullen 01/18/1986 09/09/2009 if user enters date 12/12/2012 bella swan 01/18/1986 12/12/2012 jacob black 10/18/1981 12/12/2012 the guidelines need abide not work jagged arrays, linq, list, exception, etc. i don't know how above output. tried didn't work. static void main() {...

textarea - Remove single attribute from element multiple times using jQuery -

here's code far: <script src="http://.../jquery/1.7.1/..."></script> <script> $(document).ready(function(){ $('textarea').removeattr('style'); }); </script> <form> <tr><td> <textarea name="comment" cols="18" rows="4" style=""></textarea> </td></tr> </form> i put blank style tag first see if works, does, using .ready removes initially. when drag corner of textarea enlarge it, produces new style="xyz" my question is: how can repeat function, automatically, every time attribute style="xyz" shows up? resetting default cols="18" rows="4" size specified. (sorry if might simple answer, i'm not js/jq yet.) no need js that, just <textarea name="comment" cols="18" rows="4" style="resize:none"></textarea>

xml - Large document XPath query performance -

with 5 mb document, following query takes libxml2 3 seconds evaluate. there speed things up? need resulting node-set further processing, no count , etc. thanks! descendant::text() | descendant::* [ self::p or self::h1 or self::h2 or self::h3 or self::h4 or self::h5 or self::h6 or self::dl or self::dt or self::dd or self::ol or self::ul or self::li or self::dir or self::address or self::blockquote or self::center or self::del or self::div or self::hr or self::ins or self::pre ] edit: using descendant::node()[self::text() or self::p or ... suggested jens erat (see accepted answer) improved speed; original 2.865330s perfect 0.164336s. benchmarking without document benchmark on difficult. two ideas optimizing: use few descendant:: axis steps possible. they're expensive , can speed little bit. can combine text() , element tests this: descendant::node()[self::text() or self::h1 or self::h2] and extend elements (i'm keeping query short better readabi...

Perl XML to tab delimited text file with XSLT (or not) -

novice perl programmer, trying convert simple xml string tab delimited text file . struggled using xml::parser (and xml::twig/simple , xslt), couldn't figure out how main data parts column headings. then started trying xslt, can't figure out how separator between elements -- (then use split and/or join?) run in 1 string. i manually printed column headings manually. there easy way template? similar questions looked at, couldn't see separators being added files. xml tab delimited text modifying xslt converting xml tab delimited text file questions: what's easiest way this, generally, , should using xslt (which i've been trying understand). how can fix below this? it seems i'm close need delimiter xslt output string can split , join "\t" in output tab-delimited text file. ?? this xml (sms logs twilio): <?xml version="1.0" encoding="utf-8"?> <twilioresponse> <smsmessages end="49"...

php - Combine two SELECT queries from different tables -

issue i have 1 table ( posts ) articles , article meta. another table ( post_reviews ) contains user-submitted ratings (a value out of 5) each article, referencing posts id of post in question. i trying find top 3 posts, review, of last 3 days. therefore need to: find posts in time period (3 days) find average rating each post sort them average rating (desc) code for first part, can use query: select * `posts` `hub_id`=:hub_id , `date`>=:start_date , `date`<=:end_date) to find each individual post's average rating, use query: select sum(`review`) `total` `post_reviews` `id`=:id then number of rows work out average: select * `post_reviews` `post_id`=:id how can combine these three, or process data can order posts in time period average rating? answer the end result looks this: select `posts`.`id`, avg(`post_reviews`.`review`) `average` `posts` join `post_reviews` on (`posts`.`id`=`post_reviews`.`post_id`) `hub_id`=:hub_id ...

How to load random line from text file in android? -

i have piece of code; scanner s = new scanner(getresources().openrawresource(r.raw.game)); try { while (s.hasnextline()) { system.out.println(s.nextline()); } } { s.close(); } how can make load random line piece of code? thanks. you load lines data structure such arraylist , use random generate random index number. here's code put arraylist: scanner s = new scanner(getresources().openrawresource(r.raw.game)); arraylist<string> list = new arraylist<string>(); try { while (s.hasnextline()) { list.add(s.nextline()); } } { s.close(); } this code return random line: public static string randomline(arraylist list) { return list.get(new random().nextint(list.size())); }

apache - php mysqli: configuring issues -

i running apache 2.4 server php 5.5.1, , connected django via mod_wsgi (in case matters). running on oracle linux. in set-up, trying use mysqli , method mysqli_connect . however, facing issues mysqli set-up. have used following website: mysqli setup . however, after running ./configure --with-mysqli=/usr/bin/mysqlconfig , ./configure --with-mysqli , still not see mysqli section in phpinfo() test site. have run make , make install after both , has worked fine. furthermore, when try following command ./configure --with-mysql=/usr/bin/mysql_config --with-mysqli=mysqlnd , following error: configure: error: cannot find mysql header files under /usr/bin/mysql_config. note mysql client library not bundled anymore! on top of this, have uncommented extension=php_mysqli.dll line. right now, have idea of need do, ahold of mysql client library , allow access php. however, unsure of how this, , many of questions + answers have found have not worked. any appreciated. thanks. ...

php - Pagination in custom loop not working -

i have searched several topics , questions regarding problem, haven´t found answer suits code. the pagination custom posts displayed, when click in show next posts >> same posts previous page shown, though url shows ?paged=2 . my code following: <div class="podcast-entries"> <?php $args = array( 'post_type' => 'strn5_podcasts', 'posts_per_page' => 3, 'paged' => (get_query_var('paged') ? get_query_var('paged') : 1 ); $temp = $wp_query; $wp_query = null; $wp_query = new wp_query( $args ); if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?> <div <?php post_class(); ?> > <h4 class="podcast-title"><?php the_title(); ?></h4> <div class="podcast-content"> <?php the...

How to use PHP Simple HTML DOM to get data from a remote page traced by a $_GET item? -

when link in a.html clicked : <tr> <td class="book"><a class="booklink" ref="../collection?file=book1.pdf"> read </a> -blah blah blah </td> </tr> ?file=book1.pdf passed b.html: <?php $src = $_get['file']; ?> <iframe src="<?php echo $src; ?>" > </iframe> question:- how retrieve text "good read-blah blah blah" a.html , paste meta description in b.html using simple html dom? (please know there thousand of listed data in table in a.html) thank you. use dom load html document , xpath search it . // note: if html parse has bad syntax, use: libxml_use_internal_errors(true); $doc = new domdocument; $doc->loadhtml(file_get_contents('a.html')); if ($doc === false) { throw new runtimeexception('could not load html'); } $xpath = new domxpath($doc); $xpathresult = $xpath->query("//a[@href = '../collection?file={$_get...

.htaccess - I appear to have 500 error page and no 404 error page, why? -

i'm trying create custom 500 , 404 error pages here's .htaccess page: options -multiviews rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_filename} !\.php$ rewriterule ^(.*)$ $1.php [l,qsa] errordocument 404 "sorry, page not found" errordocument 500 "sorry, went wrong, try again later" here's 404 page http://example.com/cats - not page (but it's showing 500) and 1 should 500 http://example.com/dogs - page (because query returned blank) it's not error message @ - guessing should 500 anyway, be it appears show 500 , no 404, can't figure out how stop/fix it, ideas??? fixed a 500 thrown if there exception thrown php, not logical errors. select query returning blank result isn't considered error php queries return blank result part of legitimate flow of code. with regards getting 500 instead of 400, appears here http://www.javascriptkit.com/howto/...

javascript - Image fade-in when webpage finishes loading -

i'm trying have elements (all in div , img tags) fade in when webpage loads. right have images set change different image onmouseover don't want code fade in interfere @ all. if can code fade-in great if identify parts of code can change change speed of fade-in or that. thank much!! if use jquery this: $("myelement").show("fade", 400);

javascript - Hierarchical Edge Bundling - Automatically Generated Arcs in Radial Dendogram and Color -

back in october 2012, question posed ( d3.js - how automatically calculate arc lengths in radial dendrogram ) on how generate arcs in radial dendogram denote groups. user "wceo" posted elegant solution works well. however, possible change color of each arc individually, rather have them same color? trying... var color = d3.scale.category20(); ... and... var groupdata = svg.selectall("g.group") .data(nodes.filter(function(d) { return (d.key=='400' || d.key == '500' || d.key == '600' || d.key == 'current_missions' || d.key == 'future_missions') && d.children; })) .enter().append("group") .attr("class", "group") .attr("fill", function(d) { return color(d.group); }); ... returns each of 5 arcs same color. (i apologize not responding original topic. apparently don't have required 50 reputation so.) (edited include entire sample code) var w = 1800, h = 1600...

c++ - Polynomial Class: Polynomial Multiplication -

Image
i have polynomial class has get_vect member function stores integers in vector representation of coefficients of polynomial. now, trying multiply 2 polynomials using multiply non-member function, stuck when comes actual multiplication of vectors. far, have shown below: polynomial multiply(const polynomial & poly1, const polynomial & poly2) { vector<int> poly1 = poly1.get_vect(); vector<int> poly2 = poly2.get_vect(); vector<int> poly3; if( poly1.size() < poly2.size() ) { for(size_t = 0 ; poly2.size()-poly1.size() ; ++i ) { poly2.push_back(0); } } else if( poly1.size() > poly2.size() ) { for(size_t = 0 ; poly1.size()-poly2.size() ; ++i ) { poly1.push_back(0); } } return poly3; } i see how has follow below pattern: ok, if understand problem correctly, want poly3 vector<int> holds coefficients result polynomial multi...

Java: map of concurrently incremented counters -

i need implement map of counters (like map) in application. structure supposed accessed several threads. it looks concurrenthashmap<key, long> not proper solution, right? i thought concurrenthashmap<key, atomiclong> instead. but there problem - requests increment not spread evenly. few popular keys have 95% of increment requests data structure. as far understand lead concurrent access single atomiclong instances , there many locks should occur decrease efficiency. question 1: there better solution - perhaps, better data type instead of atomiclong , allows short accumulation of increments or this? question 2: want persist structure disk periodically (perhaps, every minute), , want persist "actual" state (with recent updates settled?) - straightforward way it? what makes think atomiclong uses locks internally? not true, it's built on cas operations. advice implement atomiclong , profile implementation later. if (and if) counter bot...

algorithm - Least common integer java? -

this question has answer here: java - finding least common integer in sorted array 3 answers how can detect opposite of mode in java? for instance, if wanted find least common number in array of numbers, how go doing that? thanks. what i've tried: public int getleastcommonnum(int[] array) { int min = array[0]; int pos = 0; (int = 1; < array.length; i++) { if (array[i] < min) { min = array[i]; pos = i; } } return array[pos]; } here propose solution using hashmap : public int getleastcommonnum(int[] array) { map<integer, integer> occurrences = new hashmap<integer, integer> (); (int num : array) { if (occurrences.containskey(num)) { occurrences.put(num, occurrences.get(num) + 1); } else { occurrences.put(num, 1); } } int minoccurred = -1; int mi...

security - Authentication scheme for an Android application: When the SIM card is locked or exhanged by another, the app stops working -

i need implement convenient way determine, whether mobile app being used valid customer or not. customers told me if lose mobile phone, contact operator , lock sim card. so, seems natural bind authentication sim card validity (the app works long correct sim present , not locked). then, in case of loss customer needs lock sim card, or anyway (because internet banks send sms approving transactions mobile phone). i tried read sim-card related data, works on phones , not on others (sometimes empty strings instead of imei number). how can implement authentication mechanism, is easy user (does not require user generate/enter new password), provides app information whether inserted sim card the same sim there @ first start of application and not locked? if it's impossible, authentication alternatives there (apart e-mail/password , phone number sms confirmation) ? update 1 (11.08.2013 14:17 msk): 1 obvious solution use phone number login name , server-generated 6-dig...

asp.net - Ajax calender is not showing with its text box it is showing in top of screen -

i m using ajax calendar extender text box calender extender opening in top of screen not in textbox using calendar extender goto design mode , click on textbox , goto arrow showing while click , extend ajaxcalnderextender....than show textbox.

java - Sorting ArrayList with natural sort order in Android? -

this question has answer here: natural sort order string comparison in java - 1 built in? [duplicate] 9 answers private arraylist<string> marraylist = new arraylist<string>(); marraylist.clear(); marraylist.add("test 3"); marraylist.add("test 21"); marraylist.add("test 4"); marraylist.add("test 6"); marraylist.add("test 1"); collections.sort(marraylist); (int = 0; < marraylist.size(); i++) { log.e("tag", "" + marraylist.get(i)); } result is: test 1 test 21 test 3 test 4 test 6 but want: test 1 test 3 test 4 test 6 test 21 i sorted not perfectly, how that, don't know, if have idea, please share me. although not solution idea, try this: collections.sort(marraylist, new comparator<string>() { pub...

mysql - Counting products associated with hierarchical category listing -

Image
what have: a table of categories listed hierarchically: a table of products. column category_id refers category.id : what trying do: i trying design query count products of catogries withing specified lft , rgt values. example: between lft = 2 , rgt = 11 there 3 "immediate subcategories" ids 3 , 4 , 5 . see wireless subcategory not included not immediate subcategory within range of lft , rgt products of subcategory counted part of immediate subcategory headphone can see picture below. headphone has 1 direct product , product relates wireless subcategory. the result should be: i have managed make query retrieves immediate sub-categories within specified lft , rgt values. select node.name,node.id, (count(parent.name) - 1) depth category node, category parent node.lft between parent.lft , parent.rgt , parent.lft between {$lft} , {$rgt} group node.name having depth = 1 order node.lft this query retr...

php - How to include attachment file using my form to email? -

i have form: <form id='contactus' action='send.php' method='post' enctype="multipart/form-data" accept-charset='utf-8'> <fieldset> <legend>my form</legend> <table><tbody> <tr valign="top"> <td nowrap="nowrap" style="text-align: right;"><label for='name' >name: </label></td> <td><input type='text' name='name' id='name' value=''/></td></tr> <tr valign="top"> <td nowrap="nowrap" style="text-align: right;"><label for='email' >email: </label></td> <td><input type='text' name='email' id='email' value=''/></td></tr> <tr valign="top"> <td nowrap="nowrap" style="text-align: right;"><label for='link' >link: </la...

c - Does freeing an uninitialized pointer result in undefined behavior? -

if have pointer not initialized and, mistake, try free it, going result in undefined behavior? like: int main(void){ char *string; free(string); return 0; } does freeing uninitialized pointer result in undefined behavior? yes. however, freeing null pointer well-defined. from c99 standard: the free function causes space pointed ptr deallocated, is, made available further allocation. if ptr null pointer, no action occurs. otherwise, if argument not match pointer earlier returned calloc , malloc , or realloc function, or if space has been deallocated call free or realloc , behavior undefined .

ruby on rails - simple_form turn boolean into dropdown with labels -

i have boolean column in model. it's called istype1. now in form, have dropdown 2 values (type1 if boolean true, , type2 if boolean false) instead of checkbox or radio buttons. is possible? right displaying radio buttons: <%= f.input :istype, :as => :radio, :label => "type"%> i prefer if had dropdown user select type1 or type2 without changing model string instead of boolean. thanks. this looking for: <%= f.input :istype, :as => :select, :collection => [['type1',false],['type2',true]], :include_blank => false, :label => "type" %>

validation - Validate multiple empty fields in PHP -

i have following statement validating empty fields in php works fine: if (isset($_session['logged_in'])) { if (isset($_post['room'], $_post['area'])) { $room = $_post['room']; $area = $_post['area']; if (empty($room) or empty($area)) { $error = 'required!'; } else { $query = $pdo->prepare('insert apartments (apartments_room, apartments_area) values (?, ?)'); $query->bindvalue(1, $room); $query->bindvalue(2, $area); $query->execute(); header('location: index.php'); } } i have opened more columns in database , therefor more insert fields in html validate. question how formulate if statement validation when checking multiple empty fields in case. so code example doesn't work anymore: if (isset($_session['logged_in'])) { if (isset($_post['room'], $_post['area'], $_post['rent'], $_post['addres...

adding tapku calendar to ios app -

i'm building ios app needs use calendar. i'm confused use: iphone calendar eventkit or calendar controller, suggest? i tried use both not because i'm new in ios development, use tapku calendar , followed these steps dose not work... why? can me this article? followed instructions , dose not work, download tapku , ran demo , demo dose not work, can me? if want add tapku project go file> add new files select both .xcodeproj file , bundle. now click on main project settings. go build phases. add dependency , tapku framework per instructions on github. now go project settings. find header search paths option. add in location of /src folder. believe 1 reason why shouldn't have worked somewhere in location might have folder space in it's name. if need put directory in "". good luck.

Reducing JavaScript Markup when drawing objects in HTML5 -

i'm trying draw few circles have same properties, different endingangle, don't want write entire circle code 5 times, there way either assign of code class, , change 1 variable 5 different id's? here 2 of circles var canvas = document.getelementbyid('firefox'); var context = canvas.getcontext('2d'); context.beginpath(); context.arc(64, 64, 60, 1.5*math.pi, .3*math.pi, true); context.linewidth = 8; context.linecap = "round"; context.strokestyle = '#c5731e'; context.stroke(); var canvas = document.getelementbyid('chrome'); var context = canvas.getcontext('2d'); context.beginpath(); context.arc(64, 64, 60, 1.5*math.pi, .9*math.pi, true); context.linewidth = 8; context.linecap = "round"; context.strokestyle = '#c5731e'; context.stroke(); .3*math.pi , .9*math.pi things going change between circles, way can write above don't have write of 5 times? you don't have change markup, can : ...

mysql - table structure for creating 13 rows and 31 colums -

i new mysql , sql. want create table entering 12 months , 31 days infront of it. not getting how structurise it. in left hand side should months name , infront of each month enter 31 days each. if use create table allocate ( id int, month varchar(50), days int(10) ); it not solve purpose. here css design of table data entered , same need table in mysql <table width="99%" border="1" cellspacing="1" cellpadding="1" align="center"> <form name="form1" action="submit.php" method="post"> <tr bgcolor="#00bfff"> <td><strong>month</strong></td> <td width="3%">1</td> <td width="3%">2</td> <td width="3%">3</td> <td width="3%">4</td> <td width="3%">5</td> <td width="3%">6...

ios - How to implement checkmark buttons in iPad out side of tableview -

how implement custom checkmark buttons depends on array count, , need allow multiple selection in buttons. i'm used this, int yaxis = 300; (int x=0; x< [myresultarray count];x++) { checkmarkbutton = [uibutton buttonwithtype:uibuttontypecustom]; checkmarkbutton.frame = cgrectmake(100, yaxis, 20, 20); checkmarkbutton.tag = selectedservicetag; [self.view addsubview:checkmarkbutton];yaxis = yaxis+30; } setting images check mark: [checkmarkbutton setbackgroundimage:[uiimage imagenamed:@"checkbox_none"] forstate:uicontrolstatenormal]; [checkmarkbutton addtarget:self action:@selector(serviceselected:) forcontrolevents:uicontroleventtouchupinside]; then had implement action method. -(void)serviceselected { checkmarkbutton.selected = !checkmarkbutton.selected; if (checkmarkbutton.selected) { [checkmarkbutton setbackgroundimage:[uiimage imagenamed:@"checkbox"] forstate:uicontrolsta...