Search Results

Search found 440 results on 18 pages for 'abs'.

Page 6/18 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Download Remote File

    - by Abs
    Hello all, I have a function that will be passed in a link. The link is to a remote image. I thought I could just use the extension of the file in the URL to determine the type of image but some URLs won't have extensions in the URL. They probably just push headers to the browser and therefore I do not have an extension to parse from the URL. How can I test if the URL has an extension and if not then read the headers to determine the file type? Am I over complicating things here? Is there an easier way to do this? I am making use of Codeigniter maybe there is something already built in to do this? All I really want to do is download an image from a URL with the correct extension. This is what I have so far. function get_image($image_link){ $remoteFile = $image_link; $ext = ''; //some URLs might not have an extension $file = fopen($remoteFile, "r"); if (!$file) { return false; }else{ $line = ''; while (!feof ($file)) { $line .= fgets ($file, 4096); } $file_name = time().$ext; file_put_contents($file_name, $line); } fclose($file); } Thanks all for any help

    Read the article

  • Run FFmpeg from Shell Script

    - by Abs
    Hello all, I have found a useful shell script that shows all files in a directory recursively. Where it prints the file name echo "$i"; #Display File name. I would instead like to run an ffmpeg command on non MP3 files, how can I do this? I have very limited knowledge of shell scripts so I appreciate if I was spoon fed! :) //if file is NOT MP3 ffmpeg -i [the_file] -sameq [same_file_name_with_mp3_extension] //delete old file Here is the shell script for reference. DIR="." function list_files() { if !(test -d "$1") then echo $1; return; fi cd "$1" echo; echo `pwd`:; #Display Directory name for i in * do if test -d "$i" #if dictionary then list_files "$i" #recursively list files cd .. else echo "$i"; #Display File name fi done } if [ $# -eq 0 ] then list_files . exit 0 fi for i in $* do DIR="$1" list_files "$DIR" shift 1 #To read next directory/file name done

    Read the article

  • Is file_get_contents multi line?

    - by Abs
    Hello all, Does file_get_contents maintain line breaks? I thought it did but I have tried this: if($conn){ $tsql = file_get_contents('scripts/CreateTables/SLR05_MATCH_CREATETABLES.sql'); $row = sqlsrv_query($conn, $tsql); print_r(sqlsrv_errors()); } The errors I get is that SQL Server complains that there is incorrect syntax. I get the same errors when I run the SQL Script without any line breaks, which suggests file_get_contents removes them? When I run the script normally (open the file in SQL Server Management Studio) and execute it, it works perfectly. So is there something that I can use that maintains line breaks etc? Or is there another problem here in using queries from a file with the SQL Server PHP Driver from Microsoft? Thanks all for any help

    Read the article

  • Is this the best way to make an API request using PHP CURL?

    - by Abs
    Hello all, I have a site that has a simple API which can be used via http. I wish to make use of the API and submit data about 1000-1500 times at one time. Here is their API: http://api.jum.name/ I have constructed the URL to make a submission but now I am wondering what is the best way to make these 1000-1500 API GET requests? Here is the PHP CURL implementation I was thinking of: $add = 'http://www.mysite.com/3rdparty/API/api.php?fn=post&username=test&password=tester&url=http://google.com&category=21&title=story a&content=content text&tags=Season,news'; curl_setopt ($ch, CURLOPT_URL, "$add"); curl_setopt ($ch, CURLOPT_POST, 0); curl_setopt ($ch, CURLOPT_COOKIEFILE, 'files/cookie.txt'); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE); $postdata = curl_exec ($ch); Shall I close the CURL connection every time I make a submission? Can I re-write the above in a better way that will make these 1000-1500 submissions quicker? Thanks all

    Read the article

  • Unbind Events with JQuery: Does it work with events setup in HTML?

    - by Abs
    Hello all, I have a few onclick and on mouseover events in my html generated by PHP, something like this: <div onmouseover="fave('heart_<?php echo $row['id']; ?>';" class="heart"><a href=""></a></div> I wish to make use of unbind on the mouseover but it hasn't worked when I tried this: $('#'+ id).unbind('mouseover'); So I am guessing unbind will only work with events created by JQuery? Is there something else I can try? Btw, I can't move my events to a separate js file as each id is unique and. Thanks all

    Read the article

  • document.getElementById("tweetform").submit is not a function?

    - by Abs
    Hello all, I am using Firefox and I've been reading some forums claiming this doesn't work in firefox but it has been working for me for the last few days but has stopped working and I can not figure out why. I make a AXAX POST Request using an IFrame. When I get the response I use this: function startLoad(){ $.get("update.php", function(data){ if(data==''){ startLoad(); } else{ document.getElementById("tweetform").submit(); } }); } However, from firebug, I get this: document.getElementById("tweetform").submit is not a function [Break on this error] document.getElementById("tweetform").submit(); I know submit exists, but what is going on? Thanks all

    Read the article

  • PHP sleep accuracy

    - by Abs
    Hello all, I use the following code to see how long a user is on a particular page. I use a hidden image with a src attribute to this script: $timer_seconds = 1; while(!connection_aborted()) { echo "\n"; flush(); sleep(1); $timer_seconds++; } I sometimes find this can be off by 5-10 seconds! I am guessing its the load of the server that effects the timing?? Is there anyway I can make this accurate? Thanks all for any help.

    Read the article

  • JavaScript: A BackSlash as part of the string

    - by Abs
    Hello all, I have a JavaScript variable that I echo out using PHP which is shown like this in the page source: var db_1 = 'C:\this\path'; When I set the value of a text field with that variable like so: $('#myinput').val(db_1); The slashes have disappeared and only the other characters are left! Why is this and how can I put the slashes back in?? Thanks all

    Read the article

  • Httpd Process High memory usage and slow page loads

    - by Abs
    Hello all, I am running wampserver on my windows vista machine. I have been doing this for a long time and it has been working great. I have completed loads of projects with this setup. However, today, without me changing anything (no configuration etc) only PHP code changes, I find that every time I load pages of my site (those with user sessions or access the database) are really slow to load - Over 30 seconds, they use to take 1 or 2 seconds. When I have a look at the task manager, I can see on page loads the httpd process jumps from 10mb to 30mb, 90mb, 120mb, 250mb and then back down again. I have tested previous php code projects and they seem to all be slow as well! What is going on? Thanks all for any help on this confusion issue!

    Read the article

  • Drop down selection not registered when form submitted quickly?!

    - by Abs
    Hello all, I have noticed a strange thing that happens on my web app when the server is under heavy loads (I am remoting on to the Windows Server). I have a drop down box which is generated dynamically (server side). When I make a selection and quickly press the submit button to indicate my selection the next page does not register my selection but if I do it a bit more slowly it will. I have not come across this before, has anyone? I know its a small issue but there are a lot of "trigger happy", including me... should I put a delay before the form is submitted? If I do, I can only guess the right amount of time. Or is there an underlying problem with my web app? Thanks all

    Read the article

  • Set the mouseover Attribute of a div using JQuery

    - by Abs
    Hello all, I would like to set an attribute for a div. I have done this: $('#row-img_1').onmouseover = function (){ alert('foo'); }; $('#row-img_2').onmouseout = function (){ alert('foo2'); }; However, the above has not worked, it does not alert when mouse is over or when it moves out. I have also tried the $('#row-img_1').attr(); and I could not get this to work either. I am aware that I should be using a more effective event handling system but my divs are dynamically generated. Plus this is a small project. ;) Thanks all for any help.

    Read the article

  • PHP TTF/OTF Reader

    - by Abs
    Hello all, Is anyone aware of a font reader class where I can pass in a font file (ttf or otf) and I can find out the font name, the model, artist etc. The meta data really. Thanks all for any help

    Read the article

  • find: missing argument to -exec

    - by Abs
    Hello all, I was helped out today with a command, but it doesn't seem to be working. This is the command: find /home/me/download/ -type f -name "*.rm" -exec ffmpeg -i {} -sameq {}.mp3 && rm {}\; The shell returns find: missing argument to `-exec' What I am basically trying to do is go through a directory recursively (if it has other directories) and run the ffmpeg command on the .rm file types and convert them to .mp3 file types. Once this is done, remove the .rm file that has just been converted. I appreciate any help on this.

    Read the article

  • How to find input element id by value?

    - by Abs
    Hello all, How do I get the id of an input element based on its value? The values will always be unique and there are only 7 of them. I have tried this: $('#wrapper').find("input[value='"+value+"']").each(function(){ return this.id; }); But nothing is returned! Thanks all for any help

    Read the article

  • On Update: Auto Update Date/Time Field

    - by Abs
    Hello all, Is there an equivalent of MySQLs on update field for SQL server? With both DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP clauses, the column has the current timestamp for its default value, and is automatically updated. What I am looking for is to have a date/time field and every time I update a record it updates the field with the date/time it was updated automatically? If it doesn't exist, I guess I'll have to go manual. Thanks all

    Read the article

  • Make a PHP GET request from a PHP script and exit

    - by Abs
    Hello all, Is there something simpler than the following. I am trying to make a GET request to a PHP script and then exit the current script. I think this is a job for CURL but is there something simpler as I don't want to really worry about enabling the CURL php extension? In addition, will the below start the PHP script and then just come back and not wait for it to finish? //set GET variables $url = 'http://domain.com/get-post.php'; $fields = array( 'lname'=>urlencode($last_name), 'fname'=>urlencode($first_name) ); //url-ify the data for the GET foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_GET,count($fields)); curl_setopt($ch,CURLOPT_GETFIELDS,$fields_string); //execute GET $result = curl_exec($ch); //close connection curl_close($ch); I want to run the other script which contains functions when a condition is met so a simple include won't work as the if condition wraps around the functions, right? Please note, I am on windows machine and the code I am writing will only be used on a Windows OS. Thanks all for any help and advice

    Read the article

  • Flash Browser? Flash Server Side?

    - by Abs
    Hello all, I have two noobish questions about Flash, Actionscript, Flex etc. 1) With these technologies is it possible to create a simple web browser that can render websites? 2) Is it possible to run these technologies on the server side? I am guessing no as Flash requires a browser to run within? Thanks all for any help

    Read the article

  • Setting PHP session variables using Flash Actionscript

    - by Abs
    Hello all, I have a simple PHP upload script that is called from my Flash App. I am sure it makes the call because it actually uploads the file! session_start(); $default_path = 'files/'; $target_path = ($_POST['dir']) ? $_POST['dir'] : $default_path; if(!file_exists($target_path)) mkdir($target_path, 0777, true); $destination = $target_path . basename( $_FILES[ 'Filedata' ][ 'name' ] ); $file_name = rand(1,9999).$_FILES[ 'Filedata' ][ 'name' ]; if(move_uploaded_file($_FILES[ 'Filedata' ][ 'tmp_name' ], $destination)){ $_SESSION['path'] = 'flashuploader_online/upload/'.$destination; } However, I try to use the session variable "path" in another script but it gives me an empty value! Yes, I have made sure to use session_start. Am I missing something? Update At least now I know what the problem is! But I am not sure how to solve it without it getting messy to pass across session variables. Any ideas?

    Read the article

  • Binding Events rather than using onclick

    - by Abs
    Hello all, I have been told its better to bind events to elements rather than having onclicks with functions everywhere. I agree with this as it devolves more from the HTML which means cleaner and easier to debug code. But I am having trouble doing this! I loop through some data with PHP (see below) and I currently use onclick to call a function. How can I bind this onclick event to many elements using JQuery. <?php foreach($main_tags as $key=>$value){ ?> <li> <a id="<?php echo $key; ?>" href="#" onclick="tag_search('<?php echo $key; ?>'); return false;"> <?php echo $key; ?> <span class="num-active"> <?php echo $value; ?> </span> </a> </li> <?php } ?> Thanks all for any help

    Read the article

  • Removing Numbers from a String using Javascript

    - by Abs
    Hello all, How do I remove numbers from a string using Javascript? I am not very good with regex at all but I think I can use with replace to achieve the above? It would actually be great if there was something JQuery offered already to do this? //Something Like this?? var string = 'All23'; string.replace('REGEX', ''); I appreciate any help on this.

    Read the article

  • Matching a String and then incrementing a number within HTML elements

    - by Abs
    Hello all, I have tags in a html list, here is an example of two tags. <div class="tags"> <ul> <li> <a onclick="tag_search('tag1');" href="#">tag1 <span class="num-active">1</span></a> </li> <li> <a onclick="tag_search('tag2');" href="#">tag2 <span class="num-active">1</span></a> </li> </ul> </div> I would like to write a function that I can pass a string to, that will match the strings in the a hyperlink i.e. "tag1" or "tag2", if there is a match then increment the number in the span, if not then add a new li. The bit I am having trouble with is how do I search for a string in the div with class tags and then when I find a match identifying the element. I can't even do the first bit as I am use to using an ID or a Class. I appreciate any help on this using JQuery Thanks all Code so far function change_tag_count(item){ alert(item);//alerts the string test $.fn.searchString = function(str) { return this.filter('*:contains("' + item + '")'); }; if($('body').searchString(item).length){ var n = $('a').searchString(item).children().text(); n = parseInt(n) + 1; $('a').searchString(item).children().text(n); }else{ alert('here');//does not alert this when no li contains the word test $("#all_tags ul").append('<a onclick="tag_search(\''+item+'\');" href="#">'+item+'<span class="num-active">1</span></a>'); } }

    Read the article

  • How to run command in the background and notify me via email when done

    - by Abs
    Hello all, I have the following command which will take ages to run (couple of hours). I would like to make it a background process and for it to send me an email when its done. For the cherry on the top, any errors it encountered should write to a text file when an error has occurred? find . -type f -name "*.rm" -exec ./rm2mp3.sh \{} \; -exec rm \{} \; How can I do this with my above command?

    Read the article

  • Problem Making C++ script

    - by Abs
    Hello all, I am not sure if I can post this sort of question (apologies in advance) but I am trying to build something from this blog post. # mkdir wkthumb # cat > wkthumb.cpp # qmake -project # qmake && make # ./wkthumb I have no experience with this, but I download all the files needed in the directory wkthumb using git. I have gone inside this directory and tried to execute cat > wkthumb.cpp - this just hangs for me. In addition, I thought cat was supposed to be used like this: cat file1.txt file2.txt > file3.txt? The above is blank with the first arguments? I am using Fedora Core 10.

    Read the article

  • Adding a Click event to a submit button and then submitting the form

    - by Abs
    Hello all, I have a form with a submit button. I have attached a click event to that submit button using JQuery. Once I did this my form wasn't submitting, I thought this was because of the event I added- if I remove that click event it submits the form successfully. I have tried giving my form an id and calling the submit function but this was not successful either. What can I do? $('#submit_gen').click(function() { $('#genbtn').html('<img src="images/ajax-loader.gif" alt="loading" />'); $('#action_form').submit(); }); The HTML: <form id="action_form" action="generate.php" method="post" enctype="multipart/form-data"> <input id="file_upload" type="file" name="upload" onchange="file_select();"/> <input type="text" id="overlay_input"> <div id="genbtn" class="genbtn"> <input id="submit_gen" type="submit" value="Upload"> </div> </form> Thanks all

    Read the article

  • Slide Effect happening too many times

    - by Abs
    Hello all, I call this functions on onmouseover and onmouseout for several divs. //Takes effect on divs with id, 62,63,64,65... function slide_it(id){ $('#options_'+id).slideToggle('slow'); } The problem is that if I move my mouse over and then mouse out, then again, mouse over and then mouse out. If I do this several times, the slide effect happens the same number of times I moved my mouse over and out of the div, as expected. But I can't figure out how I can do this once? I can set a variable, but I have several divs that this function is used by and I can't think of a simple way of doing this rather than storing things into an array, but this is messy! I really appreciate any help on this that is simple to implement! Thanks all for any help

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >