Posts

sql - Adding two fields in php -

$result = mysql_query("select * productlist1 order pdesc asc"); while($row = mysql_fetch_array($result)) $sold=$row['psold']; $left=$row['pleft']; $all=$left + $sold; { echo '<tr>'; echo '<td>'.$row['pcode'].'</td>'; echo '<td>'.$row['pdesc'].'</td>'; echo '<td>'.$row['date'].'</td>'; echo '<td>'.$row['time'].'</td>'; echo '<td><div align="center">'.$row['psold'].'</div></td>'; echo '<td><div align="center">'.$row['pleft'].'</div></td>'; echo '<td><div align="center">'.$row['pprice'].'</div></td>'; echo '<td><div align="center">'.$all.'<...

aptana - Why there is additional unwanted line in my php file when it has uploaded to cpanel? -

Image
i've been searching in google this, did not find answer. or maybe not know keyword this. find files have unwanted new line every time uploaded cpanel. before upload: after upload: it started when uploaded myfile.php 208 lines today via filezilla, , next day re-download file , edited using aptana. got file has unwanted new line become 382 lines . have been experiencing this? please me solve problem. thank you. sorry bad english the issue conversion of file between different operating systems. the server unix system, changes line termination character. such when files downloaded server, need use utility unix2dos convert file.

python - CSS select with beautifulsoup4 doesn't work -

i tried bs4, select method doesn't work. what's wrong code? import requests import bs4 def main(): r = requests.get("http://nodejs.org/download/") soup = bs4.beautifulsoup(r.text) selector = "div.interior:nth-child(2) > table:nth-child(2) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(3) > a:nth-child(1)" print(soup.select(selector)[0].text) if __name__ == "__main__": main() the answer on page differs viewing in browser parsing bs. have @ r.text , parse there. the response <div class="interior row"> <div id="installers"> <ul> <li> <a href="http://nodejs.org/dist/v0.10.26/node-v0.10.26-x86.msi"> <img alt="" height="50" src="http://nodejs.org/images/platform-icon-win.png" width="45"> windows installer <small>node-v0.10.26-x86.msi</small> <...

iphone - Get Directions for multiple locations in GMAP iOS. -

i have array contains multiple locations (latitude , longitude). i plot locations using lat , long in map, need join locations road (get directions in google map). i used google map api in application. thanks in advance. it sounds you're looking google directions api functionality. allows directions between multiple points (using waypoints) in order create 1 long route. service requires api key , has courtesy limit of 2,500 calls per day. google directions api

preg replace - How to remove text with preg_replace function of php -

i have code this: $data='<p>text begin</p> <script type="text/javascript"> $(".idr").hide(); $("[rel=tooltip]").tooltip({ placement: "top"}); </script> <p>text finish</p>'; i'm trying remove below text: <script type="text/javascript"> $(".idr").hide(); $("[rel=tooltip]").tooltip({ placement: "top"}); </script> with preg_replace() echo preg_replace("/<script(.+?)script>/i", '', $data); but it's doesn't work. suggestions? if tring remove script try this: preg_replace('/<script\b[^>]*>(.*?)<\/script>/is', "", $data);

jquery - slide (animation) not working -

i have page small buttons (more 2) profiles. working more or less fine, except hide , show (slidetoggle) - div (profilepannel) appears without nice slow expand, suddently. only css element (margin-bottom) working fine. see it, may click profile one, see on second button, final effect. jquery var menu; $(document).ready(function(){ $('.img').click(function () { menu = $("#" + $(this).data("menu")); $(".profilepannel:not(#" + menu.attr("id") + ")").slideup("slow"); menu.slidetoggle("slow"); }); }) try it! can nice , tell me why, , how can change it? and btw, have trouble positioning profilepanel - wish show under each profile button, without moving rest of buttons. have tried position: relative, absolute, z-index have missed , dont have output wish. it seems min-height causing issues. if remove/change that, effect going for: .profilepannel { width:...

c - Logic behind finding Heap space available -

hi i'm new memory management, thought of finding logic find free heap space. feel finding difference between " program break " , " stack pointer " can correct? if not please justify , let me know right logic. memory layout under linux complex beast , opinion should not care available heap: 1 of purpose of virtual memory. every process sees flat large memory space. regarding propose solution, don't think correct because described here: http://duartes.org/gustavo/blog/post/anatomy-of-a-program-in-memory/ hep grows starting @ end of bss segment. you can heap size process (22088 in example) terminal with: cat /proc/22088/maps | grep heap 7f5082180000-7f5082ac7000 rw-p 00000000 00:00 0 [heap] from c user space code, can read @ file heap size of current process.