Posts

How to get record in one table with conditional in two tables - PHP and Mysql -

i have 2 table like table: t1 id|name|type 1 | |0 2 | b |1 3 | c |0 4 | d |0 ... table: t2 uid|type 4 |1 3 |0 ... i want count or records in table t1 have type = 1 , records have id = uid in table t2 has type = 1 best way count or record in 1 query like $type = 1; $count = mysql_num_rows(mysql_query("select * .... type = $type ")); //$count = 2 $result = mysql_query("select * ... order id desc "); // $result include record in table t1 has id (4, 2) b/c order id desc edit: made sql try in http://www.sqlfiddle.com/#!2/8847d1/12 can't that want records result (all column have above conditional) id|name| 4 |d | 2 |b | how thank select t1.id,t1.name t1 left join t2 on t1.id = t2.uid t1.type = 1 or t2.type = 1

ruby - Regex for reverse match a string -

i want reverse match string using regex ex: "test.com".match(/gmail.test.com/)(we can "gmail.test.com".match(/test.com/) have situation requires check inverse match). is possible?. can me please. thanks in advance!! try: > 'gmail.test.com'.split('.').last(2) == ['test','com'] => true

asp.net - How to call 2 web services after clicking button in android? -

i have android application suppose save transaction in 1 database , update balance in database calling 2 seperate web methods. first web method called second web method not called. asynctask code public class transaction extends asynctask<string,void,boolean> { private string finalbalance1 = "", price1 = "", pname = "", pnric = "", pclass = "", sno = ""; public transaction(string price1, string pname, string pnric, string pclass, string sno, string finalbalance1) { super(); this.finalbalance1 = double.tostring(finalbalance); this.price1 = double.tostring(sprice); this.pname = sra.studentname; this.pnric = sra.studentnric; this.pclass = sra.studentclass; this.sno = logger.stallno; } @override protected boolean doinbackground (string...url) { boolean = tr...

jquery - Add column to table with input boxes -

Image
i want make dynamic table number of rows , columns can added table.i made success dynamically add rows problem adding column in table.for adding column want user give columnname column using window.prompt .when click add column adding column(without textboxes) second column,i want add column(with textboxes , columnname) closest addcolumn button. here table <table class="dynatable"> <thead> <tr> <th><button class="add">add</button></th> <th>id</th> <th>name</th> <th>col 3</th> <th>col 4</th> <th><button style="width: 100px; height: 25px" class="addcolumn">add column</button></th> </tr> </thead> <tbody> <tr class="prototype"> ...

Component visiblity getting delay while drop the component in the panel in java swing -

in project have used drag , drop functionality drop icon 1st panel 2nd panel. 1st panel contains 3 buttons different icons , 2nd panel added destination (drop place) in desktop pane. while drag , drop have used panel , label place icon in 2nd panel. icon available in label visibility getting delay(nearly 5 - 10 sec) @ first time drag , drop. after there no time delay drag , drop. happens time while start project. have tried repaint() , revalidate() panels still delay there. kindly suggest idea reduce delay. thanks in advance...

android - Codeboxed audio recording module not detected -

i using titanium sdk 2.1.2 , android sdk 2.2. have placed codeboxed audio recording module in ~/library/application support/titanium/modules/android/com.codeboxed.audiorecorder but when try include in ti.app.xml not being shown in modules list. running sample project provided codeboxed team. following link.please suggest wrong , guide. http://www.codeboxed.com/2011/08/titanium-module-for-android-audio-recording/ regard:ali

testunit - How to test simple ruby method, with timing and config dependencies -

i have method: def self.should_restart? if konfig.get(:auto_restart_time).present? time.now>=time.parse(konfig.get(:auto_restart_time)) && utils.uptime_in_minutes>780 end end in regular ruby (not rails) how go testing this? monkeypatch konfig , utils return want seems soooo ugly. you may able use timecop part of solution (which scores highly me "best-named gem, ever"). simple use, , patches sources of time data in sync, if example utils module uses standard methods assess time, should have same concept of "now" time.now shows. note won't work if utils making call external api on process, in case should stub return uptime values needed in test assertions. the following rspec snippet way of example, , making assumptions have available (such module under test being called server ) describe "#should_restart?" before :each timecop.travel( time.parse("2013-08-01t12:00:00") ) server.start #...