Posts

android - Selecting from two tables -

i have following query in android query = "select docid _id," + key_id + "," + key_name + "," + " " + filter + " " + key_search + " match '" + txt + "';"; it selects the table depend on filter what wanna have filter "all" select 2 tables 1 query how can ? thanks please using preparedstatements ( http://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html ). inlining variables way allow sql injections. to answer question, use inner join (implicit or explicit).

ios - confusion in data storage into nscache -

i know im doing mistake here coz cant run project im trying build , im trying here parsed data xml save nsdata , put data cache when run project doesnt load data. @implementation viewcontroller { nscache *mycache; } - (void)viewdidload { mycache = [[nscache alloc] init]; } //saving data cache nsstring *imageurl = [currentdata.imagelink]; nsurl *url = [nsurl urlwithstring:imageurl]; nsdata *data = [nsdata datawithcontentsofurl:url]; data = [imagescache objectforkey:@"key"]; [imagescache setobject:imagelinks forkey:@"key"]; a few things: data downloads should done on background thread. it's best have own object in cache, , object should download image , cache both image , save image disk. when cache gets purged should remove image , reload disk if required. this code: nsdata *data = [nsdata datawithcontentsofurl:url]; data = [imagescache objectforkey:@"key"]; [imagescache setobject:[nsdata datawithcontentsofur...

php - Codeigniter join() not working -

i trying run query using codeigniter framework. want avoid using clause, , instead have included condition part of on clause in join statement of query. far more efficient since join statement executed before clause. here code: $this->db->select('sql_calc_found_rows projects.id, projects.project_name, projects.date_modified, projects.last_modifier, projects.status, project_users.permission', false)-> from('projects'); $this->db->join('project_users', 'project_users.id = projects.id , project_users.user_id = ' . $this->user_id); if ($orderby !== false) { $this->db->order_by($orderby, $direction); } if ($limit !== null) { $this->db->limit($limit, $offset); } $query = $this->db->get(); when attempt load page, receive sql error. seems codeigniter not including condition after and: select sql_calc_found_rows projects.id, proj...

javascript - writing a custom function inside d3.json -

i trying add numbers tag. using d3.json reference file. mixing jquery in , think not going well. how should this? once sum mathematical operations on reduce value of consumption_gj_ can pass radius circle this. here how code looks like: var sum = 0; //adding values function radiusdata(d){ +sum = d.consumption_gj_; alert(sum) } //here trying append total div $('.test').append(sum); right doing d.consumption_gj_ / 10000 come reasonable number not working out. here fiddle http://jsfiddle.net/sghoush1/vn7mf/9/ you need loop iterate on values , add them sum: data.foreach(function(d) { sum += +d.consumption_gj_; }); modified jsfiddle here .

html - What does this total width mean actually -

Image
i read book called "bulletproof web design" , don't understand. says "while have declared width of 720px #nav, indent tabs we're assigning left padding of 46px. since padding added width of element, navigation's total width equals 766px." #nav { float:left; width:720; margin:0; padding:10px 0 0 46px; background:#ffcb2d; } i mean width 720px defined in #nav selector , padding 46px. don't know book mean total width. have never heared expression before. total width common term equal width + padding? if @ graphic below, you'll see padding contributes total width of block: also, author using short-hand notation padding, breaks down to: top-padding: 10px; right-padding: 0px; bottom-padding: 0px; left-padding: 46px; the horizontal padding contributing to total width.

jboss7.x - Cleaning JBoss AS 7.1 Standalone.xml -

i couldn't find answer in other questions , wanted see if knew. i'm using jboss 7.1 on kepler eclipse, , wondering if there way change standalone.xml while server running , have jboss push change. cleaning server this? you can't edit raw xml files , see runtime changes. in fact there chance changes overwritten server. the best way make runtime changes either via web console or cli environment. don't know if jboss tools has kind of cli type of client can used.

c++ - De-duplication of NSString & unichar constants -

i have 2 simple constants: nsstring and unichar , defined follows: static nsstring * const string = @"\u2022"; static unichar const character = 0x2022; i'd want have number 0x2022 defined in 1 place. i tried lot of combinations ( # , ## , cfstr macro) no success. can done? (using ideas how concatenate twice c preprocessor , expand macro in "arg ## _ ## macro"? ): #define stringify(_x_) #_x_ #define unichar_from_hexcode1(_c_) 0x ## _c_ #define unichar_from_hexcode(_c_) unichar_from_hexcode1(_c_) #define nsstring_from_hexcode1(_c_) @"" stringify(\u ## _c_) #define nsstring_from_hexcode(_c_) nsstring_from_hexcode1(_c_) #define mycharcode 2022 static unichar const character = unichar_from_hexcode(mycharcode); static nsstring * const string = nsstring_from_hexcode(mycharcode); preprocessed output: static unichar const character = 0x2022; static nsstring * const string = @"" "\u2022"; (note @...