Search Results

Search found 727 results on 30 pages for 'hk ch'.

Page 12/30 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Counting the number of occurrences of characters in an array

    - by Anthony Pittelli
    This is what I have but it is not working, this is confusing for me. If you scroll down I commented on someones post the exact problem I am having and what I am trying to do. I was thinking maybe the problem is my code to generate the random characters: public void add (char fromChar, char toChar){ Random r = new Random(); //creates a random object int randInt; for (int i=0; i<charArray.length; i++){ randInt = r.nextInt((toChar-fromChar) +1); charArray[i] = (char) randInt; //casts these integers as characters } }//end add public int[] countLetters() { int[] count = new int[26]; char current; for (int b = 0; b <= 26; b++) { for (int i = 97; i <= 123; i++) { char a = (char) i; for (int ch = 0; ch < charArray.length; ch++) { current = charArray[ch]; if (current == a) { count[b]++; } } } } return count; }

    Read the article

  • How would I automate my array to be used with cURL?

    - by Rob
    I have an array containing the contents of a MySQL table. I need to put each of these contents into curl_multi_handles so that I can execute them all simultaneously Here is the code for the array, in case it helps: $SQL = mysql_query("SELECT url FROM urls") or die(mysql_error()); while($resultSet = mysql_fetch_array($SQL)){ $urls[]=$resultSet } So I need to put be able to send data to each url at the same time. I don't need to get any data back, and in fact I'll be having them time out after two seconds. It only needs to send the data and then close. My code prior to this, was executing them one at a time. here is that code: $SQL = mysql_query("SELECT url FROM shells") or die(mysql_error()); while($resultSet = mysql_fetch_array($SQL)){ $ch = curl_init($resultSet['url'] . $fullcurl); //load the urls and send GET data curl_setopt($ch, CURLOPT_TIMEOUT, 2); //Only load it for two seconds (Long enough to send the data) curl_exec($ch); curl_close($ch); So my question is: How can I load the contents of the array into curl_multi_handle, execute it, and then remove each handle and close the curl_multi_handle?

    Read the article

  • How can I pull multiple rows from a MySQL table and use all of them automatically for the same thing

    - by Rob
    Basically, I have multiple URL's stored in a MySQL table. I want to pull those URLs from the table and have cURL connect to all of them. Currently I've been storing the URL's in the local script, but I've added a new page that I can add and remove them from the database, and I'd like the page to reflect it appropriately. Here is what I currently have: $sites[0]['url'] = "http://example0.com "; $sites[1]['url'] = "http://example1.com"; $sites[2]['url'] = "http://example2.com"; $sites[3]['url'] = "http://example3.com"; foreach($sites as $s) { // Now for some cURL to run it. $ch = curl_init($s['url']); //load the urls and send GET data curl_setopt($ch, CURLOPT_TIMEOUT, 2); //No need to wait for it to load. Execute it and go. curl_exec($ch); //Execute curl_close($ch); //Close it off } Now I assume it can't be too amazingly difficult to do, I just don't know how. So if you could point me in the right direction, I'd be grateful. But if you supply me with some code, please comment it appropriately so that I can understand what each line is doing.

    Read the article

  • Not getting an array as result (calling a webservice by AJAX-JSON)

    - by Pasargad
    I'm trying to get the result of my web service as an array and then loop over the result to fetch all of the data; what I have done so far: In my web service when I return the result I use return json_encode($newFiles); and the result is as following: "[{\"path\":\"c:\\\\my_images\\\\123.jpg\",\"ID\":\"123\",\"FName\":\"John\",\"LName\":\"Brown\",\"dept\":\"Hr\"}]" tehn in my Web application I'm calling the rest web service by the following code in the RestService class: public function getNewImages($time) { $url = $this->rest_url['MyService'] . "?action=getAllNewPhotos&accessKey=" . $this->rest_key['MyService'] . "&lastcheck=" . $time; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if ($data) { return json_decode($data); } else { return null; } } and then in my controller I have the following code: public function getNewImgs($time="2011-11-03 14:35:08") { $newImgs = $this->restservice->getNewImages($time); echo json_encode$newImgs; } and I'm calling this `enter code here`controller method by AJAX: $("#searchNewImgManually").click(function(e) { e.preventDefault(); $.ajax({ type: "POST", async: true, datatype: "json", url: "<?PHP echo base_url("myProjectController/getNewImgs"); ?>", success: function(imgsResults) { alert(imgsResults[0]); } }); }); but instead of giving me the first object it is just giving me quotation mark (the first charachter of the result) " Why is that? I'm passing in JSON format and in AJAX I mentioned datatype as "JSON" ! Please let me know if you need more clarification! Thanks :)

    Read the article

  • ??Recovery Manager (RMAN)??

    - by ??
    Normal 0 7.8 ? 0 2 false false false EN-US ZH-CN X-NONE DefSemiHidden="true" DefQFormat="false" DefPriority="99" LatentStyleCount="267" UnhideWhenUsed="false" QFormat="true" Name="Normal"/ UnhideWhenUsed="false" QFormat="true" Name="heading 1"/ UnhideWhenUsed="false" QFormat="true" Name="Title"/ UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/ UnhideWhenUsed="false" QFormat="true" Name="Strong"/ UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/ UnhideWhenUsed="false" Name="Table Grid"/ UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/ UnhideWhenUsed="false" Name="Light Shading"/ UnhideWhenUsed="false" Name="Light List"/ UnhideWhenUsed="false" Name="Light Grid"/ UnhideWhenUsed="false" Name="Medium Shading 1"/ UnhideWhenUsed="false" Name="Medium Shading 2"/ UnhideWhenUsed="false" Name="Medium List 1"/ UnhideWhenUsed="false" Name="Medium List 2"/ UnhideWhenUsed="false" Name="Medium Grid 1"/ UnhideWhenUsed="false" Name="Medium Grid 2"/ UnhideWhenUsed="false" Name="Medium Grid 3"/ UnhideWhenUsed="false" Name="Dark List"/ UnhideWhenUsed="false" Name="Colorful Shading"/ UnhideWhenUsed="false" Name="Colorful List"/ UnhideWhenUsed="false" Name="Colorful Grid"/ UnhideWhenUsed="false" Name="Light Shading Accent 1"/ UnhideWhenUsed="false" Name="Light List Accent 1"/ UnhideWhenUsed="false" Name="Light Grid Accent 1"/ UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/ UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/ UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/ UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/ UnhideWhenUsed="false" QFormat="true" Name="Quote"/ UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/ UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/ UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/ UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/ UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/ UnhideWhenUsed="false" Name="Dark List Accent 1"/ UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/ UnhideWhenUsed="false" Name="Colorful List Accent 1"/ UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/ UnhideWhenUsed="false" Name="Light Shading Accent 2"/ UnhideWhenUsed="false" Name="Light List Accent 2"/ UnhideWhenUsed="false" Name="Light Grid Accent 2"/ UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/ UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/ UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/ UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/ UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/ UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/ UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/ UnhideWhenUsed="false" Name="Dark List Accent 2"/ UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/ UnhideWhenUsed="false" Name="Colorful List Accent 2"/ UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/ UnhideWhenUsed="false" Name="Light Shading Accent 3"/ UnhideWhenUsed="false" Name="Light List Accent 3"/ UnhideWhenUsed="false" Name="Light Grid Accent 3"/ UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/ UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/ UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/ UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/ UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/ UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/ UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/ UnhideWhenUsed="false" Name="Dark List Accent 3"/ UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/ UnhideWhenUsed="false" Name="Colorful List Accent 3"/ UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/ UnhideWhenUsed="false" Name="Light Shading Accent 4"/ UnhideWhenUsed="false" Name="Light List Accent 4"/ UnhideWhenUsed="false" Name="Light Grid Accent 4"/ UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/ UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/ UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/ UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/ UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/ UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/ UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/ UnhideWhenUsed="false" Name="Dark List Accent 4"/ UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/ UnhideWhenUsed="false" Name="Colorful List Accent 4"/ UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/ UnhideWhenUsed="false" Name="Light Shading Accent 5"/ UnhideWhenUsed="false" Name="Light List Accent 5"/ UnhideWhenUsed="false" Name="Light Grid Accent 5"/ UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/ UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/ UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/ UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/ UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/ UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/ UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/ UnhideWhenUsed="false" Name="Dark List Accent 5"/ UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/ UnhideWhenUsed="false" Name="Colorful List Accent 5"/ UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/ UnhideWhenUsed="false" Name="Light Shading Accent 6"/ UnhideWhenUsed="false" Name="Light List Accent 6"/ UnhideWhenUsed="false" Name="Light Grid Accent 6"/ UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/ UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/ UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/ UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/ UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/ UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/ UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/ UnhideWhenUsed="false" Name="Dark List Accent 6"/ UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/ UnhideWhenUsed="false" Name="Colorful List Accent 6"/ UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/ UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/ UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/ UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/ UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/ UnhideWhenUsed="false" QFormat="true" Name="Book Title"/ /* Style Definitions */ table.MsoNormalTable {mso-style-name:????; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.5pt; mso-bidi-font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-font-kerning:1.0pt;} ????,RMAN?Oracle?????????????????????,?RMAN?????????????????,?????????????? ?????,RMAN????? RMAN???????????? RMAN???/?????????? ???????????? ????1487262.1???????????,?????RMAN??/????????4??????: ???? ???? ???? ??????? ???????????????,???????SQLPLUS???,???????????“DD-MON-RR HH24:MI:SS”???????,??????????? ??: SQL>spool monitor.out SQL>@monitor '06-aug-12 16:38:03' ?????RMAN???????????,?????????,?????? - ???????????????????,?????RMAN?????? ???????4??????????????? ???? ??DBA????????V$SESSION_LONGOPS???????????????????????,?????????????????? ??: SID CH CONTEXT SOFAR TOTALWORK % Complete --- -- ------- ------ ---------- ---------- 16 t1 1 181950 1186752 15.33 148 t2 1 249722 422400 59.12 ??: - ???????????????? - ??????????????? ???? ??????RMAN?????????????????????????????????????????????????????????Oracle???????????????????????? ??: SID CH SEQ# EVENT STATE SECONDS --- -- ---- --------------------------------- ------- ------- 16 t1 5735 RMAN backup & recovery I/O WAITING 10 143 8200 SQL*Net message from client WAITING 258.83 148 t2 7941 Backup: MML create a backup piece WAITING 196.13 ?????????T2???????????????,???????T2????????????????? ??: -?CH??????RMAN???,?Rman???????????,????????? -??SEQ#?????????,???????? -?????????,??????SEQ#???? -????????????????RMAN backup & recovery I/O'??????????????IO???? ???? ???????????????????????????????,???????backup_tape_io_slaves=TRUE,?????????????????? ??: SID CH STATUS OPEN_TIME SOFAR Mb TOTMB IO_COUNT % Complete TYPE FILENAME --- -- ----------- ------------------ -------- ------ ---------- -------- ------ ------------- 19 t1 FINISHED 02-aug-12 17:28:42 567.5 567.5 569 100.00 INPUT users01.dbf 19 t1 IN PROGRESS 02-aug-12 17:28:42 3489.99 8704 3490 40.10 INPUT sh.dbf 19 t1 IN PROGRESS 02-aug-12 17:28:42 3778 15113 OUTPUT kvnhlb22_1_1 20 t2 FINISHED 02-aug-12 17:28:38 740 740 742 100.00 INPUT system01.dbf 20 t2 FINISHED 02-aug-12 17:28:38 880 880 882 100.00 INPUT sysaux01.dbf 20 t2 FINISHED 02-aug-12 17:28:38 1680 1680 1682 100.00 INPUT undotbs01.dbf 20 t2 FINISHED 02-aug-12 17:28:38 3007.25 12029 OUTPUT l0nhlb23_1_1 ??: - ???????????????,??RMAN??????IO,??????????IO??,??(Document 360443.1 RMAN Backup Performance) - ?? IO_COUNT??????????? ??????? ?????,????????, ????????????v$backup_sync_io ?????????. ??: SID CH FILENAME TYPE STATUS BSZ BFC OPEN IO_COUNT --- -- ------------ ------ ----------- ------ --- ------------------ -------- 16 t1 ksnhla1b_1_1 OUTPUT IN PROGRESS 262144 4 02-aug-12 17:12:20 1092 148 t2 ktnhla1c_1_1 OUTPUT IN PROGRESS 262144 4 02-aug-12 17:12:15 2968 ??: -?????????????????,??RMAN??????IO -?? IO_COUNT?????????? -??IO_COUNT ????, ???IO_COUNT ????????????,???????????????,????????????? ????: ??????????????? Document 1487262.1 Script to monitor RMAN Backup and Restore Operations Document 144640.1   RMAN: Monitoring Recovery Manager Jobs Document 360443.1   RMAN Backup Performance Document 740911.1   RMAN Restore Performance ??,?????My Oracle Support Database Backup and Recovery community ?Oracle?????????????/??????

    Read the article

  • Apache Error Upgrading to PHP 5.5

    - by user195385
    I am trying to upgrade php and received this error at the command line: httpd: Syntax error on line 493 of /private/etc/apache2/httpd.conf: Syntax error on line 8 of /private/etc/apache2/other/+php-osx.conf: Cannot load /usr/local/php5/libphp5.so into server: dlopen(/usr/local/php5/libphp5.so, 10): Symbol not found: _libiconv\n Referenced from: /usr/local/php5/lib/libintl.8.dylib\n Expected in: /usr/lib/libiconv.2.dylib\n in /usr/local/php5/lib/libintl.8.dylib I was trying to upgrade at http://php-osx.liip.ch/ using the command: curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5 Any help would be appreciated!

    Read the article

  • PHP: Convert curl_exec output to UTF8

    - by Paul Tarjan
    I would like to only work with UTF8. The problem is I don't know the charset of every webpage. How can I detect it and convert to UTF8? <?php $url = "http://vkontakte.ru"; $ch = curl_init($url); $options = array( CURLOPT_RETURNTRANSFER => true, ); curl_setopt_array($ch, $options); $data = curl_exec($ch); // $data = magic($data); print $data; See this at: http://paulisageek.com/tmp/curl-utf8 What is magic()?

    Read the article

  • Jquery qtip ajax issue

    - by user272899
    Hi All, I am trying to post the value of an input box (In this case a imdb link) to my imdbgrabber.php page and have it return the info of that movie into a qtip box. Everything works fine until i try and post the variable to the imdbgrabber page. This is the code. Javascript: var link = $("#link").val(); var imdbLink = 'link='+ link; $(".moviebox").qtip({ style: { name: 'cream' }, content: { method: 'GET', data: imdbLink, url: '/includes/imdbgrabber.php', text: '<img class="throbber" src="/images/loading.gif" alt="Loading..." />' }, position: { corner: { target: 'bottomright', tooltip: 'bottomleft' } } }); HTML: <!--start moviebox--> <div class="moviebox"> <a href="#"> <img src="http://1.bp.blogspot.com/_mySxtRcQIag/S6deHcoChaI/AAAAAAAAObc/Z1Xg3aB_wkU/s200/rising_sun.jpg" /> <form method="get" action=""> <input type="text" name="link" id="link" style="display:none" value="http://www.imdb.com/title/tt0367882"/> </form> </a> </div> <!--end moviebox--> and finally the php: <?php $url=$_GET['link']; //$url = 'http://www.imdb.com/title/tt0367882/'; //get the page content $imdb_content = get_data($url); //parse for product name $name = get_match('/<title>(.*)<\/title>/isU',$imdb_content); $director = strip_tags(get_match('/<h5[^>]*>Director:<\/h5>(.*)<\/div>/isU',$imdb_content)); $plot = get_match('/<h5[^>]*>Plot:<\/h5>(.*)<\/div>/isU',$imdb_content); $release_date = get_match('/<h5[^>]*>Release Date:<\/h5>(.*)<\/div>/isU',$imdb_content); $mpaa = get_match('/<a href="\/mpaa">MPAA<\/a>:<\/h5>(.*)<\/div>/isU',$imdb_content); $run_time = get_match('/Runtime:<\/h5>(.*)<\/div>/isU',$imdb_content); $rating = get_match('/<div class="starbar-meta">(.*)<\/div>/isU',$imdb_content); ////build content //$content = '<h2>Film</h2><p>'.$name.'</p>' // . '<h2>Director</h2><p>'.$director.'</p>' // . '<h2>Plot</h2><p>'.substr($plot,0,strpos($plot,'<a')).'</p>' // . '<h2>Release Date</h2><p>'.substr($release_date,0,strpos($release_date,'<a')).'</p>' // . '<h2>MPAA</h2><p>'.$mpaa.'</p>' // . '<h2>Run Time</h2><p>'.$run_time.'</p>' // . '<h2>Full Details</h2><p><a href="'.$url.'" rel="nofollow">'.$url.'</a></p>'; //gets the match content function get_match($regex,$content) { preg_match($regex,$content,$matches); return $matches[1]; } //gets the data from a URL function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } ?> <!--start infobox--> <div class="info"> <span> <?php echo '<strong>'.$name.'</strong>' ?> </span> <img src="http://1.bp.blogspot.com/_mySxtRcQIag/S6deHcoChaI/AAAAAAAAObc/Z1Xg3aB_wkU/s200/rising_sun.jpg" /> <div class="plot"> <?php echo ''.substr($plot,0,strpos($plot,'<a')).'</div>' ?> </div> <div class="runtime"> <?php echo'<strong>Run Time</strong><br />'.$run_time.'</div>' ?> </div> <div class="releasedate"> <?php echo '<strong>Release Date</strong><br />'.substr($release_date,0,strpos($release_date,'<a')).'</div>' ?> </div> <div class="director"> <?php echo '<strong>Director</strong><br />'.$director.'' ?> </div> <div class="rating"> <?php echo '<strong>Rating</strong><br />'.$rating.'' ?> </div> </div> <!--end infobox--> I am sure it is a simple mistake somewhere but after hours of looking i thought i would ask the experts.

    Read the article

  • Undefined offset PHP error

    - by user272899
    I am recieving the following error: Notice indefined offset 1: in C:\wamp\www\includes\imdbgrabber.php line 36 the code is for getting information from IMDB. The link is posted to the page using ajax on another page, I have tested that i am getting the correct response using echo $url <?php $url = $_GET['link']; echo $url; //$url = 'http://www.imdb.com/title/tt0367882/'; //get the page content $imdb_content = get_data($url); //parse for product name $name = get_match('/<title>(.*)<\/title>/isU',$imdb_content); $director = strip_tags(get_match('/<h5[^>]*>Director:<\/h5>(.*)<\/div>/isU',$imdb_content)); $plot = get_match('/<h5[^>]*>Plot:<\/h5>(.*)<\/div>/isU',$imdb_content); $release_date = get_match('/<h5[^>]*>Release Date:<\/h5>(.*)<\/div>/isU',$imdb_content); $mpaa = get_match('/<a href="\/mpaa">MPAA<\/a>:<\/h5>(.*)<\/div>/isU',$imdb_content); $run_time = get_match('/Runtime:<\/h5>(.*)<\/div>/isU',$imdb_content); $rating = get_match('/<div class="starbar-meta">(.*)<\/div>/isU',$imdb_content); ////build content //$content = '<h2>Film</h2><p>'.$name.'</p>' // . '<h2>Director</h2><p>'.$director.'</p>' // . '<h2>Plot</h2><p>'.substr($plot,0,strpos($plot,'<a')).'</p>' // . '<h2>Release Date</h2><p>'.substr($release_date,0,strpos($release_date,'<a')).'</p>' // . '<h2>MPAA</h2><p>'.$mpaa.'</p>' // . '<h2>Run Time</h2><p>'.$run_time.'</p>' // . '<h2>Full Details</h2><p><a href="'.$url.'" rel="nofollow">'.$url.'</a></p>'; //gets the match content function get_match($regex,$content) { preg_match($regex,$content,$matches); return $matches[0]; } //gets the data from a URL function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } ?> <!--start infobox--> <div class="info"> <span> <?php echo '<strong>'.$name.'</strong>' ?> </span> <!-- <img src="http://1.bp.blogspot.com/_mySxtRcQIag/S6deHcoChaI/AAAAAAAAObc/Z1Xg3aB_wkU/s200/rising_sun.jpg" /> --> <div class="plot"> <?php echo ''.substr($plot,0,strpos($plot,'<a')).'</div>' ?> </div> <div class="runtime"> <?php echo'<strong>Run Time</strong><br />'.$run_time.'</div>' ?> </div> <div class="releasedate"> <?php echo '<strong>Release Date</strong><br />'.substr($release_date,0,strpos($release_date,'<a')).'</div>' ?> </div> <div class="director"> <?php echo '<strong>Director</strong><br />'.$director.'' ?> </div> <div class="rating"> <?php echo '<strong>Rating</strong><br />'.$rating.'' ?> </div> </div> <!--end infobox-->

    Read the article

  • Reading in Russian characters (Unicode) using a basic_ifstream<wchar_t>

    - by Mark
    Is this even possible? I've been trying to read a simple file that contains Russian, and it's clearly not working. I've called file.imbue(loc) (and at this point, loc is correct, Russian_Russia.1251). And buf is of type basic_string<wchar_t> The reason I'm using basic_ifstream<wchar_t> is because this is a template (so technically, basic_ifstream<T>, but in this case, T=wchar_t). This all works perfectly with english characters... while (file >> ch) { if(isalnum(ch, loc)) { buf += ch; } else if(!buf.empty()) { // Do stuff with buf. buf.clear(); } } I don't see why I'm getting garbage when reading Russian characters. (for example, if the file contains ??? ??? ???, I get "??E", 5(square), K(square), etc...

    Read the article

  • php curl: how can i emulate a get request exactly like a web browser?

    - by ufk
    Hi. there are websites that when i open specific ajax request on browser i get the resulted page, but when i try to load them with curl, i receive an error from the server. how can i properly emulate a get request to the server that will simulate a browser ? that's what i'm doing: $url="https://new.aol.com/productsweb/subflows/ScreenNameFlow/AjaxSNAction.do?s=username&f=firstname&l=lastname"; ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); $result=curl_exec($ch); print $result;

    Read the article

  • get all words using java

    - by hussain
    i want to know how to get all word using java String first[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}; String second[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}; String ch =""; String total[]; for(int i = 0;i<26;i++) { for(int j = 0;j<26;j++) { ch+=first[i]+first[j]; System.out.println(ch); } } i get only 576 words only by this program but the 26! words is 4.03291461 × 1026 how to write the program in java thanks and advance

    Read the article

  • java: speed up reading foreign characters

    - by Yang
    My current code needs to read foreign characters from the web, currently my solution works but it is very slow, since it read char by char using InputStreamReader. Is there anyway to speed it up and also get the job done? // Pull content stream from response HttpEntity entity = response.getEntity(); InputStream inputStream = entity.getContent(); StringBuilder contents = new StringBuilder(); int ch; InputStreamReader isr = new InputStreamReader(inputStream, "gb2312"); // FileInputStream file = new InputStream(is); while( (ch = isr.read()) != -1) contents.append((char)ch); String encode = isr.getEncoding(); return contents.toString();

    Read the article

  • Rails: Accessing previous loop in Populator (rake db:populate)

    - by sscirrus
    I am populating my Rails database using populator, and I have a case where I would like to build a series of records where fields start_date and end_date follow seamlessly from each other (from today back into the past). Here is a sample of what I'm doing: Chain.populate 1 do |ch| ch.date_end = DateTime.now ch.date_start = DateTime.civil(DateTime.now.year-rand(40)-1, rand(12)+1, rand(31)+1) end Chain.populate 0..10 do |chs| chs.date_end = Chain.find(:last).date_start chs.date_start = DateTime.civil(chs.date_end.year-rand(10)-1, rand(12)+1, rand(31)+1) end Problem? undefined method 'date_start' for nil:NilClass. I assume the problem is the first Chain record hasn't been saved, so I added: Chain.save # in between the two loops This didn't work either. How can I make this work? Thank you!

    Read the article

  • Unknown symbols when I read file

    - by Sergey Gavruk
    I read file, but in the end of file i get unknown symbols: int main() { char *buffer, ch; int i = 0, size; FILE *fp = fopen("file.txt", "r"); if(!fp){ printf("File not found!\n"); exit(1); } fseek(fp, 0, SEEK_END); size = ftell(fp); printf("%d\n", size); fseek(fp, 0, SEEK_SET); buffer = malloc(size * sizeof(*buffer)); while(((ch = fgetc(fp)) != NULL) && (i <= size)){ buffer[i++] = ch; } printf(buffer); fclose(fp); free(buffer); getch(); return 0; }

    Read the article

  • Why won't the following Clojure code tail a file via ssh?

    - by Zubair
    The following code never manages to tail a file. It simply hangs waiting for reader input. Has anyone tried anything similar? (def output (ref [] )) (import 'ch.ethz.ssh2.Connection) (import 'ch.ethz.ssh2.Session) (import 'ch.ethz.ssh2.StreamGobbler) (import 'java.lang.StringBuilder) (import 'java.io.InputStream) (import 'java.io.BufferedReader) (import 'java.io.InputStreamReader) (let [connection (new Connection "hostname")] (. connection connect) (let [ok (. connection authenticateWithPassword "username" "password" ) session (. connection openSession )] (. session execCommand "tail -f filename.txt") (let [sb (StringBuilder.) stdout (StreamGobbler. (. session getStdout)) br (BufferedReader. (InputStreamReader. stdout)) ] (future (loop [line2 (. br readLine)] (if (= line2 nil) nil (do (dosync (ref-set output (conj @output line2))) (recur (. br readLine)))) ) ) ) ) )

    Read the article

  • alias some columns names as one field in oracle's join select query

    - by Marecky
    Hi We are developing something like a social networking website. I've got task to do 'follow me' functionality. In our website objects are users, teams, companies, channels and groups (please don't ask why there are groups and teams - it is complicated for me too, but teams are releated to user's talent) Users, teams, channels, companies and groups have all their own tables. I have a query which gets me all the follower's leaders like this select --fo.leader_id, --fo.leader_type, us.name as user_name, co.name as company_name, ch.title as channel_name, gr.name as group_name, tt.name as team_name from follow_up fo left join users us on (fo.leader_id = us.id and fo.leader_type = 'user') left join companies co on (fo.leader_id = co.user_id and fo.leader_type = 'company') left join channels ch on (fo.leader_id = ch.id and fo.leader_type = 'channel') left join groups gr on (fo.leader_id = gr.id and fo.leader_type = 'group') left join talent_teams tt on (fo.leader_id = tt.id and fo.leader_type = 'team') where follower_id = 83 I need to get all fields like: user_name, company_name, channel_name, group_name, team_name as one field in SELECT's product. I have tried to alias them all the same 'name' but Oracle numbered it. Please help :)

    Read the article

  • How to convert a url to a browser like url? ( ...%20... )

    - by Kaoukkos
    I want to get data using CURL but I have a problem. When I set the url like this $url = "https://graph.facebook.com/fql?q=SELECT name FROM page"; // continues I do not have anything returned. When I copy the browser url, this is $url = "https://graph.facebook.com/fql?q=SELECT%20name%20FROM%20page"; I get the results through CURL. I tried htmlentities and htmlspecialchars without luck. What am I missing here? $ch = curl_init($url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); $content = curl_exec($ch);

    Read the article

  • C Newbie, ascii control function

    - by user570607
    Hey there, I have written a program that works well in C that converts non-readable ASCII to their character values. I would appreciate if a C master? would show me a better way of doing it that I have currently done, mainly this section: if (isascii(ch)) { switch (ch) { case 0: printControl("NUL"); break; case 1: printControl("SOH"); break; .. etc (32 in total) case default: putchar(ch); break; } } Is it normal to make a switch that big? Or should I be using some other method (input from an ascii table?)

    Read the article

  • PHP: Convert web-page to utf8

    - by Paul Tarjan
    I would like to only work with UTF8. The problem is I don't know the charset of every webpage. How can I detect it and convert to UTF8? <?php $url = "http://vkontakte.ru"; $ch = curl_init($url); $options = array( CURLOPT_RETURNTRANSFER => true, ); curl_setopt_array($ch, $options); $data = curl_exec($ch); // $data = magic($data); print $data; See this at: http://paulisageek.com/tmp/curl-utf8 What is magic()?

    Read the article

  • Gmock setting out parameter

    - by user1135541
    Have a gmock method, and during test, need to set the out parameter to variable address. So that the out parameter of dequeue, which is data points to variable ch; MOCK_METHOD1(dequeue, void(void* data)); char ch = 'm'; void* a = (void*)&ch; EXPECT_CALL(FQO, dequeue(_)) .WillOnce(/*here I need to set argument to a*/); I tried to figure out side effects: https://code.google.com/p/googlemock/wiki/V1_7_CheatSheet#Side_Effects but keep getting an error.

    Read the article

  • SEO consequences for merging country sites in a .com

    - by Pekka
    I am in the process of refactoring a number of rental portals I've built for a company with locations in Austria, Germany, Switzerland, and the Netherlands. Instead of the current setting of each country site running under its own domain name: www.companyname.de www.companyname.ch www.companyname.at I would love to merge them all in this way: www.companyname.com/de www.companyname.com/ch www.companyname.com/at with the country TLDs doing a 301 redirect to the respective .com address. However, I have been repeatedly told not to do this due to likely problems with SEO - the business is very SEO dependent, and being a rental chain, needs to be strong in local results. So the question is: Is there an unavoidable hit in Search Engine Optimization when redirecting to a central .com domain? What measures can be taken to soften the blow? What comes to my mind is explicitly specifying a lang attribute in the html tag. Are there any other ways to specifically point out geographical location for sub-directories?

    Read the article

  • SEO consequences for merging country sites in a .com

    - by Pekka
    I am in the process of refactoring a number of rental portals I've built for a company with locations in Austria, Germany, Switzerland, and the Netherlands. Instead of the current setting of each country site running under its own domain name: www.companyname.de www.companyname.ch www.companyname.at I would love to merge them all in this way: www.companyname.com/de www.companyname.com/ch www.companyname.com/at with the country TLDs doing a 301 redirect to the respective .com address. However, I have been repeatedly told not to do this due to likely problems with SEO - the business is very SEO dependent, and being a rental chain, needs to be strong in local results. So the question is: Is there an unavoidable hit in Search Engine Optimization when redirecting to a central .com domain? What measures can be taken to soften the blow? What comes to my mind is explicitly specifying a lang attribute in the html tag. Are there any other ways to specifically point out geographical location for sub-directories?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >