-
Posts
4,704 -
Joined
-
Last visited
-
Days Won
179
Everything posted by kicken
-
Since your table names have a - in them, you have to quote them with backticks (`). With out them the - will be treated as a minus and cause a syntax error. As a tip, you should not use any special characters in your table or column names. Stick with a-z, 0-9, and _.
-
That is the source of your output. You're telling curl to be verbose about what it is doing.
-
Funciton for calculating the combined height of childNodes
kicken replied to Minus's topic in Javascript Help
You need to make a more accurate test case that reproduces the problem. Either of those lines work just fine for me if I toss in some quick sample HTML and run it.- 3 replies
-
- getelementbyid
- height
-
(and 1 more)
Tagged with:
-
PHP4 - Php_ssh2 connection in windows using php
kicken replied to sandyforum's topic in PHP Coding Help
Wrong forum, I've moved it for you. Also, cross posted @ http://forums.devshed.com/php-development-5/php-ssh2-connection-in-windows-using-php-951259.html -
Let user to take picture from webcam/smart phone
kicken replied to pascal_22's topic in PHP Coding Help
My android phone seems to provide the option to take a picture (or several other things) for file inputs. This is definitely something that would be device/browser specific and not something you have control over. For desktop browser, there is a new JS API called getUserMedia that can be used to access a users webcam/microphone. You could look into doing something with that, however support is a bit lacking still last time I played with it. As far as I am aware, flash provides the ability to access the webcam and mic as well, but I don't know anything about how it would actually be accomplished. -
Robot Detection Class - For Your Use
kicken replied to Muddy_Funster's topic in Beta Test Your Stuff!
Rather than do part of the json manually, and part with json_encode, just do the whole thing with json_encode: public function __toString(){ return json_encode(array('robots' => $this->robots)); } There isn't really a need for the call to checkBotList there. You call it from getRobots() right after you call checkFile so it'd just get done twice. Also you still have the hard-coded url in the fopen call rather than calling $this->url like I think you intended. Constructor functions do not return a value, nor should they cause a script to suddenly exit. Throw an exception to indicate that error that way the user can choose to ignore (or do something about) it if they wish. if(!is_dir($this->lfPath) && !mkdir($this->lfPath)){ throw new RuntimeException("error creating directory! PHP must have write permissions for this folder -- $lfPath"); } There is no need for the is_array check there. If $mixed is an array, then typecasting it to an array does nothing and $mixed is unchanged. If $mixed is a string, typecasting to an array is the same as doing $mixed=array($mixed);. Having a method named get* generally implies that it returns something. I'd suggest either you have that method return a value, or rename it, perhaps to updateBots. Lastly, in your docblock you might include an example or two of how exactly this class is supposed to be used.- 14 replies
-
That code relies on your vin column being defined as a UNIQUE index. Without that it will happily keep inserting duplicate rows.
-
What you can do depends on what kind of access you have. If you have FTP/SSH/SFTP/SCP access you should be able to download the entire site easily. If you can upload PHP scripts, you can create a script to zip all the files into an archive and download that. If all you have is the hosts's tools you're at the mercy of what they can do.
-
explode the list by comma to separate each email out. foreach over each email and then locate the position of the @ sign with strpos. substr the email from position 0 to the position of the @ sign to extract the firstname.lastname explode the firstname.lastname part on the period to separate them and use list to assign them to variables.
-
Robot Detection Class - For Your Use
kicken replied to Muddy_Funster's topic in Beta Test Your Stuff!
Something like this would only download the file if it has changed, otherwise you get a not modified response: function downloadRobots($local){ if (file_exists($local)){ $mtime = filemtime($local); $ctx = stream_context_create(array( 'http' => array( 'header' => "If-modified-since: ".gmdate(DATE_RFC1123, $mtime) ) )); } else { $ctx = stream_context_create(); } $fp = fopen("http://www.robotstxt.org/db/all.txt", 'rb', false, $ctx); $output = stream_get_contents($fp); $meta = stream_get_meta_data($fp); if (strpos($meta['wrapper_data'][0], ' 200 ') !== false){ file_put_contents($local, $output); } fclose($fp); } You'd still send a request each time but the response would be smaller if no changes were made. You could expand it further to not send the request until the cache file is over x age.- 14 replies
-
Since your divs are all set to a fixed width/height, just make the container a fixed width/height that will enclose all of the divs. http://cssdesk.com/7wLnS (updated)
-
Confused about how __set() and __get() methods work
kicken replied to eldan88's topic in PHP Coding Help
That is 100% wrong. Either you transcribed it from the tutorial incorrectly, or the tutorial is wrong. The string 'postal_code' will never equal the string 'name'. Unset() does not work with __get/__set, so either they do that to highlight the fact that it doesn't work, or it is a mistake. As for the other two questions, fix the class and re-try. -
How to use loading image in jQuery $.post() ?
kicken replied to ankur0101's topic in Javascript Help
If actually want the loading image to only display if there is a delay, you need to do as mentioned and use a flag + setTimeout to do that. I tend to just show the loading image regardless, as it is easier. If the request goes quickly it only shows for a second, if it shows at all. If the request is slow then it shows until it is complete. $('#click').on('click', function(){ $('#content').html('<img src="/images/loading.gif">'); $.post("http://localhost/my_hiden_url.php/", function(data) { $('#content').html(data); }); });- 6 replies
-
- jquery post
- loading text
-
(and 1 more)
Tagged with:
-
You'd probably be better off just floating the divs rather than trying to use inline-block. I'd guess that the issue may be related to the whitespace between your div tags, but do not know for sure. http://cssdesk.com/7wLnS
-
You need a way to extract and replace specific records from the file. Exactly how that would be done depends on the format of the file in question. If it's as simple as one record per line, you could just use file to break the file into records, and extract the correct one from the array for editing. To save you'd split the file into records again, replace the correct array entry, then re-write the array to the file. Once you have two functions created, one allowing you to extract a specific record, and one to replace a specific record, building the form and PHP to handle it is easy.
-
Want to run 100 pcs of php files in same times.
kicken replied to ShivaGupta's topic in PHP Coding Help
No, it relies on linux system commands and conventions. If you are trying to run it via CLI, just set_time_limit(0). If you want to run it through your server you'd probably want ignore_user_abort(true) as well and some kind of output. Trying to execute a long-running script through the web server is generally not a good idea to start with. -
In JS, everything except the basic types (string, bool, number) are passed as references. There is no significant difference between the two options you presented.
-
pull html content and style from other website
kicken replied to doron447's topic in Javascript Help
If he wanted to do it manually, he could just go to the site and use file->save as, no need to fiddle around in the js console trying to extract the html. For what he wants, he will need to use something like PHP to download the URL content and then extract the data. -
This sounds like an email you should send off to the HTML5 Builder support people so perhaps they can improve their product to your desires. We have nothing to do with said application and can't do anything about your issues. I would venture to guess that very few, if anyone, here uses that program. Most of the newbies seem to use Dreamweaver and the more advanced users tend to write their HTML/PHP/JS them selves rather than use some kind of wysiwyg editor.
-
Modal Dialog Advice, Forms, Alerts & Confirmation
kicken replied to 4xjbh's topic in Application Design
For simple alerts/confirmations I just do a dynamic div. Something like: function jqAlert(msg){ $('<div>').html(msg).dialog({modal: true, close: function(){ $(this).dialog('destroy').remove(); }}); } For something like a form I usually do a dynamic div like above but set the content to an iframe which then loads the form. You could alternativly just use jquery's .load() method to load the document directly into the div though. -
Help with database design - complex relationship
kicken replied to dhirajkumar41's topic in MySQL Help
The answer is another table. You'd have user_team contain just one row with the team's info (team id, name, rank, user id, etc) then another table, say user_team_players which contains 10 rows for the different players, using team id rather than user id to link things. -
As has been said, you'd have to have a dictionary of valid words to compare against. There isn't any other way to check if a particular string of letter is a "real word". There are free dictionary lists on the internet, do a little google'ing and you can find them. Once you have one, import it into another table in your DB and then you can use an INNER JOIN against it to filter the invalid tags.
-
Based on your example, explode() the string into individual words, array_reverse the result to reverse the order of the words, then implode it back together again. No need to loop the array or use strrev.
-
As an example of "..put[ting] the data in a different place", take a basic template class for example: class Template { protected $mVars=array(); public function __get($nm){ return isset($this->mVars[$nm])?$this->mVars[$nm]:null; } public function __set($nm,$v){ $this->mVars[$nm] = $v; } public function display($file){ extract($this->mVars); include($file); } } $tpl = new Template(); $tpl->Name = 'kicken'; $tpl->Date = date('Y-m-d'); $tpl->display('somefile.tpl'); The class stores all the variables to be used in the template inside the $mVars property. However, by using __get/__set you allow a user to get/set the variables as if they were real properties on the object. By shoving all the variables inside an array rather than directly on the object you prevent the possibility of someone accidentally overwriting some other property that the class might depend on.