Re: [PHP] PHP vs JAVA
What a co-incidence! I was searching PHP vs Python in google and reading articles. Now a similar mail on my inbox. When any language war goes on, everyone gets biased by the language he/she loves. It applies here too. I think your college teacher loves Java. During PHPvsPython search I found this info graphic https://www.udemy.com/blog/modern-language-wars/#. Some of the statistics contain Java too. Also you can search PHP and Web Development in big job sites and compare with same search but with Java. On Tue, Aug 20, 2013 at 8:00 PM, Tedd Sperling t...@sperling.com wrote: Hi guys: A teacher at my college made the statement that JAVA for Web Development is more popular than PHP. Where can I go to prove this right or wrong -- and/or -- what references do any of you have to support your answer? (sounds like a teacher, huh?) Here are my two references: http://w3techs.com/technologies/details/pl-php/all/all http://w3techs.com/technologies/history_overview/programming_language/ms/y But I do not know how accurate they are. What say you? Cheers, tedd ___ tedd sperling t...@sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I am completely lost and need an advice (beginner)
On Fri, Jul 19, 2013 at 1:08 AM, php colos phpco...@gmail.com wrote: Am I reading the wrong books for a beginner? Do you just read the book or also do what it says to do? If you just read but dont code along with it, you may not learn anything. After reading a lot of book you'll feel you have understand a lot of things. But thats true when you read. Not when you code. Just follow the instructions on the book. I hope you'll be able to write a lot of code. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] strlen ?
On Fri, Jul 5, 2013 at 11:10 PM, Jim Giner jim.gi...@albanyhandball.comwrote: Mike Hall comes back as 10, not 9 F.B. comes back as 5, not 4. Doesn't work for me. php var_dump(Mike Hall, strlen(Mike Hall)); string(9) Mike Hall int(9) Try trimming it first and then apply strlen. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Fwd: Wanted : Solid/documented/tests Nested Set Model class for mySQL.
If you find one that you are going to use, dont forget to share it here. I'll need this on a certain phase of my current project. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Seemingly incorrect strict standard.
Show a short reproducible code.
Re: [PHP] Has this always been the case?
Yes, this has been always the case. The property initializer in PHP can not have any expression. It should be constant value. If you want to use expression here use the constructor. class MyClass{ protected $nonStaticField; static protected $staticField; public function __construct(){ $this-nonStaticField = 4+5; } static public function init(){ self::$staticFiled = 4+5; } } -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Has this always been the case?
On Fri, May 31, 2013 at 5:12 PM, Stuart Dallas stu...@3ft9.com wrote: That is not entirely correct. It must be a literal value. The expression 'a'.'b' is a constant value. I may be being overly picky here, but I think it's an important distinction. I thought 'a'. 'b' is a constant expression and 'ab' is a constant value. Correct me if I am wrong. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] pass parameter via URL
On Mon, May 20, 2013 at 7:17 PM, iccsi inu...@gmail.com wrote: I would like to know how can I pass a parameter via URL using control value on the form. something like myPage.php?MyID=txtMyID.value I can use myPage.php?MyID=1, but cannot use myPage.php?MyID=txtMyID.value. Your help and information is great appreciated, This is more a js question. Because form.controlname.value is only available in javascript. A similar question I answered long ago on Stackoverflow is http://stackoverflow.com/questions/9009311/get-change-remove-url-parameters-with-jquery/9009558#9009558 And here is function I wrote that does it using pure javascript. http://shiplu.mokadd.im/61/parse-query-string-by-pure-javascrirpt/ -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] pass parameter via URL
On Mon, May 20, 2013 at 7:49 PM, iccsi inu...@gmail.com wrote: Thanks for the message and helping, Your js looks like to parse URL. Please let me know if I am wrong, Do you have any code to generate the URL parameter using control value? Thanks again for helping, Iccsi, shiplu wrote in message news:**CADO5mDCVbRquXCviuaY9fVajJb+** 6Ba872LbHrRHTdD8bJOATLg@mail.**gmail.com... You can generate the url using string concatenation operator +. To keep it consistent and out of error you need to reverse the same function i have given then you can perform both. The idea is there. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] How do I remove a string from another string in a fuzzy way?
Is your ticketing system written from scratch? Because such type of logic is already implemented in existing help desk softwares. I think you can also use a specific string in your email to define which part goes in ticket and which part not. For example, you can include PLEASE REPLY ABOVE THIS LINE\r\n in each of the email. When reply comes you can split the whole email with this string and get the first part as original reply. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] A little confused
On Tue, Apr 23, 2013 at 4:07 PM, Chris Knipe sav...@savage.za.org wrote: echo date_format($_SESSION['ExpiryDate'], D, \t\h\e jS \o\f M Y); Why not construct DateTime object echo date_format(new DateTime($_SESSION['ExpiryDate']), D, \t\h\e jS \o\f M Y); Or $dt = new DateTime($_SESSION['ExpiryDate']); echo $dt-format(D, \t\h\e jS \o\f M Y); I personally like the later. It takes less characters to do more. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Newbie Question - Parse XML with PHP...
On Apr 22, 2013 7:00 AM, Bastien Koert phps...@gmail.com wrote: I have an app that gets passed in xml and use this code to read that data in // We use php://input to get the raw $_POST results. $xml_post = file_get_contents('php://input'); $xml_post is string. I think now you know what to do.
Re: [PHP] Newbie Question - Parse XML with PHP...
Question: how do you use $mylist when the xml is not as a file but is returned on a web page? I assume It returns as a string from page. Then use simplexml_load_string(). See http://php.net/manual/en/function.simplexml-load-string.php -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Re: Is BBCode Installed
On Fri, Apr 12, 2013 at 4:24 AM, Stephen stephe...@rogers.com wrote: Now I have to install on my home development machine! You can install it by following command pecl install bbcode Note: root privilege is necessary to install -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Lifetime
Constants are available as long as the PHP process is executing. Destructors are called before a class instance is being wiped out from memory. But it does not remove a class or undefine a class. It works with instance. So a class constant never gets undefined. It stays with class definition.
Re: [PHP] PHP Application Installer Needed
I think modifying WAMP will do it. Earlier I did distribute apps by deploying Virtualbox appliances. Google virtualbox appliances for more information. IMHO this approach is better as the system will not be coupled with the host system. On Fri, Feb 22, 2013 at 4:26 PM, Dare Williams darrenwi...@yahoo.comwrote: Looking for an Installer / Binder that can do the following in a single .MSI / .EXE file: 1.Install Zend Server (php engine apache). 2.Install MySQL Server. 3.Configure the PHP.INI File / Replace with the provided php.ini file. 4.Configure the virtual host file on httpd.conf / Replace with the provided httpd.conf file. 5.Run the MySQL sql dump files. 6.Copy the web application to apache HTDOCS/Web root. 7.Create/Copy the application shortcut to desktop. 8.Restart PHP Engine Apache after installation. 9.Automatically launch the application in the browser Your response is need ASAP. Thanks -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Strip emails from a document
I think you meant extract emails from document, right? I'd probably find `@` and iterate before and after unless I get posix punct, space, characters. But it'll probably give some false matches. So its really hard to find 100% emails from an arbitrary text. This is because valid email can contain many different type of characters. According to RFC 822 space is a valid character in email. So finding all the valid emails is tough. In a *trivial situation* an email would be separated by space. So find @ first. Then go back and front to find the first space. You'll get most common emails. Something like using this regex pattern [^[:space:]@]+@[^[:space:]]+ would suffice. But keep in mind, it'll work on trivial cases. Not on special cases. Regular expression can not be used on special cases. Here is full RFC-822 compliant email matching regular expression http://ex-parrot.com/~pdw/Mail-RFC822-Address.html More information can be found on http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address On Sat, Jan 26, 2013 at 10:24 PM, Tedd Sperling t...@sperling.com wrote: Hi gang: I thought I had a function to strip emails from a document, but I can't find it. So, before I start writing a common script, do any of you have a simple script to do this? Here's an example of the problem: Before: Will Alex ale...@cit.msu.edu;Moita Zact za...@cit.msu.edu;Bob Arms ar...@cit.msu.edu;Meia Terms term...@cit.msu.edu; After: ale...@cit.msu.edu za...@cit.msu.edu ar...@cit.msu.edu term...@cit.msu.edu Cheers, tedd _ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Strip emails from a document
What is your input? On Sat, Jan 26, 2013 at 11:29 PM, Tedd Sperling t...@sperling.com wrote: On Jan 26, 2013, at 12:20 PM, Daniel Brown danbr...@php.net wrote: It's imperfect, but will work for the majority of emails: ?php function scrape_emails($input) { preg_match_all(/\b([a-z0-9%\._\+\-]+@[a-z0-9-\.]+\.[a-z]{2,6})\b/Ui,$input,$matches); return $matches; } ? It works imperfectly enough for me. :-) Here's the result: http://www.webbytedd.com/aa/strip-email/index.php Thanks to all. Cheers, tedd PS: Yes, 'extract is what I meant and more correct than 'strip' as I said. _ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Configuration Issue (Error 310 ERR_TOO_MANY_REDIRECTS)
Could you run curl --head -i --max-redirs 10 http://yoursite.com headers.log And paste the log here? On Thu, Jan 10, 2013 at 2:25 AM, Ken Kixmoeller phph...@comcast.net wrote: Hey, folks - One of my applications is being moved to a new server. Testing it out, I get the subject error. The error is reported this way in Chrome. In FireFox it says: Firefox has detected that the server is redirecting the request for this address in a way that will never complete. I suspect this is a PHP or Apache configuration issue, as neither the current test server, production server, nor my development server throw that error. I have searched for 2 days trying to find references for this. I see a lot of PHP-driven applications having the same problem (mostly blogs), but no under the hood fixes. Anyone experienced this? Ideas? Many thanks, Ken -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Date comparison going wrong, wrong, wrong
You can always use timestamp which is integer. $todaydate = time(); $showenddate = strtotime($showsRecord['end_date']); On Mon, Nov 12, 2012 at 12:30 AM, Terry Ally (Gmail) terrya...@gmail.comwrote: Hi all, I am having a problem with comparing time. I am using the following: $todaydate = date(D, M jS, Y g:i:s a); $showenddate = date(D, M jS, Y g:i:s a, strtotime($showsRecord['end_date'])); if ($todaydate $showenddate): echo The date of the show has not yet arrived; else: echo The show has ended; endif; The problem that I am encountering is that PHP is rendering the reverse of the equation. For example: If today's date is *11 Nov 2012* and the show's end date is *18 Nov 2012*, the message that I am getting is *the show has ended* which is wrong. A test example is at http://www.lakesidesurrey.co.uk/test.php. You can also me what I am doing wrong? Thanks Terry -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Rest Authentication
Its rather better to auto using a apikey. You'll provide this apikey on the website where user registers their application. On Mon, Nov 12, 2012 at 12:45 AM, Stuart Dallas stu...@3ft9.com wrote: On 10 Nov 2012, at 23:28, Adam Tong adam.to...@gmail.com wrote: I am developing a REST API. I found the Slim micro-framework usefull. I need authentication of course, and I see that Slim does not provide authentication for Rest. Is there any lightweight alternative to manually implementing http authentication and the hassle of apache configurations? HTTP auth doesn't need to involve the web server at all: http://stut.net/2012/11/11/snippet-http-authentication/ -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] PHP as Application Server
My recent experience is PHP eats more memory. But it matters when you are running it under memory constraint device. For a high end server its not a matter. I built an chat server using socket functions which was intended to run on embedded device. I didn't want to load apache. So I wrote it in plain PHP (as I am good at it). The server was working good until I my memory runs out. My memory requirement was really low, about 32M. Thats the total memory for everything. I ran a heavy RIA chat application with. Later I change the language to non-PHP (name of that language might start flame-war). Now its working well so far. One thing I know is, If you want to do it, you can do it. It'll need some effort but still doable. Performance optimization comes after development. So you can have your high performance enterprise application server. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] memory allocation
I would like to see how you are reading data from database? There are many ways to reduce memory usage. Here is a very common way reduce memory. instead of $res = mysql_query(select * from table1 limit 1000); while($row = mysql_fetch_assoc($res)){ /// process row. } Do this, for($x = 0; $x 1000; $x+=100;} $res = mysql_query(sprintf(select required_col1, required_col2, ... from table1 limit %d, %d,$x, 100)); while($row = mysql_fetch_assoc($res)){ /// process row. } } -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Joining a team, where no wiki or docs are available
If there is no wiki there could be inline comment. If not inline comments and those are written by your peers, dont join that team. Even there are inline comments you'll need to understand the architecture fast. Inline comments will help to understand a small context but not the whole For this try run the application with a debugger. And step through it. If you know debugging well in PHP you'll understand the workflow. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Joining a team, where no wiki or docs are available
On Mon, Sep 24, 2012 at 9:09 PM, AmirBehzad Eslami behzad.esl...@gmail.comwrote: Shiplu, For debugging, what else do you use beyond xdebug and var_dump() ? Netbeans for PHP and Eclipse PDT. Both has good debugger support. An all-in-one package will server your purpose. Otherwise configuring xdebug might be painful. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Images can execute php script?
On Sun, Sep 23, 2012 at 9:57 PM, admin ad...@buskirkgraphics.com wrote: Today I seen a hack into php that has rocked me to my foundation. I seen a picture uploaded onto a server using php and when php displayed the image, phpinfo() was executed and displayed. Does this problem exist in PHP 5.2.17 +? How do you stop it? Sorry, I have never known of this before today. How PHP is displaying the image? If it includes then its certainly possible? -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Risks involved in MyISAM to Innodb
On Fri, Sep 21, 2012 at 7:03 PM, Girish Talluru girish.dev1...@gmail.com wrote: Hi Guys, I have requirement to change my production database tables which are using myISAM and now bcoz of some changes we have to move to Innodb. Can anyone suggest how the plan should be and risks involve? Thanks, Girish Talluru If you use full-text search, it'll not work in InnoDb engine. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] tricky code problem
Without relevant code and what have you tried http://whathaveyoutried.com your questions don't make any sense. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] redirect a shell command to stdout in real time
You can use pipe to run the command and capture the stdout. Then dump it with proper header to browser. Note, If the external command (specially video encoding) takes long time you should probably use cron for this and maintain a queue. I recommend you apply some sorts of caching also. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] The end of mysql
On Sat, Sep 8, 2012 at 7:58 AM, Jim Giner jim.gi...@albanyhandball.comwrote: So with the announced end of the mysql functions (and switching to a different extension), one would think that my isp/hoster would be a bit more interested in my dilemma. I tried today to create my first mysqli-based test script and found that I didn't have that extension. A series of emails with my tech support told me that the shared server farm does not get mysqli - only their business servers. Since I dont' have a need for and want to pay more for a 'business server', I'm told I'm s... outta luck. I suggest you use a VPS. Cost of a VPS and a shared server is in same range nowadays. -- Shiplu Mokaddim Talks: http://shiplu.mokadd.im Follow: http://twitter.com/shiplu Innovation distinguishes between follower and leader
Re: [PHP] Coding Web search engine in PHP
On Mon, Aug 6, 2012 at 8:24 PM, Ansry User 01 yrsna.res...@gmail.comwrote: We are trying to code a very simple and customized search engine for internal purposes. Please suggest if the PHP is the way to go or suggest the alternatives?? It would be great if you can lead us to the links which would give us a start!! Thanks Solr with Nutch will do it. One is search server and other is crawler. You need both. Google these terms you'll get to the right direction. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Coding Web search engine in PHP
Where *do* come up with those names :) Sorry I couldn't understand the meaning of your sentence. May be this is due to cultural difference. Anyway, Solr is a search engine. Nutch is a crawler. Both can be integrated. Then one can send query to solr server from php using api. See http://wiki.apache.org/solr/SolPHP -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Coding Web search engine in PHP
On Mon, Aug 6, 2012 at 11:22 PM, Daniel Brown danbr...@php.net wrote: On Mon, Aug 6, 2012 at 1:15 PM, shiplu shiplu@gmail.com wrote: Where *do* come up with those names :) Sorry I couldn't understand the meaning of your sentence. May be this is due to cultural difference. Anyway, Solr is a search engine. Nutch is a crawler. Both can be integrated. Then one can send query to solr server from php using api. See http://wiki.apache.org/solr/SolPHP She was just giggling about the silly-sounding names for high-quality products. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ Thanks Daniel for clearing. I am pretty bad in English. :( -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Regex
#[0-9a-zA-Z,\.]# You should escape out that period as it will match any character otherwise. Thanks, Ash Ash, Thats not true. In character class only meta-characters are \ ^ - [ and ]. This is the rule of PCRE (see http://www.pcre.org/pcre.txthttp://www.pcre.org/pcre.txt#CHARACTERS%20AND%20METACHARACTERS). I assume we are talking about pcre as everybody used delimiter here which is required in pcre. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] PDO: extend or encapsulate?
From OOP point of view. Use encapsulation: When a class has a has-a relation-ship with other class you should use encapsulation. For example, If MyDB is a class that has-a pdo driver in it, then PDO will be encapsulated inside MyDB class. This is also called containment. MyDB should contain PDO. Use inheritance: When a class has a is-a relation ship with other class use inheritance. For example, Dog is an Animal. so Dog should extend Animal class. MyPHPDb is-a PHP Database Object (aka PDO). So it'll be inheritance. MyPHPDb should extend PDO. Think about the relation have. Then implement it. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Way to test if variable contains valid date
I want to thank you, Daniel, for this help. - I was looking for an isarray type function There is no such function or facility in php. However you can check date in string by DateTime object also try { $date = new DateTime('2000-01-01'); } catch (Exception $e) { echo $e-getMessage(); exit(1); } Check php.net/datetime.construct -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Dynamically Populating Multi-Dimensional Arrays
On Thursday, May 31, 2012, Mackintosh, Mike wrote: Hi All, I was working on a project and needed to dynamically populate a multi-dimensional array based on the size of an array. The script does exactly what I want it to do, but I can't imagine that it's done in the best way. I used an eval to construct the array based on the number of values passed to the index array. When attempting to do the same with Variable Variables, the addition of brackets caused the PHP Parser to die. Does anyone have any suggestions or alternatives to achieving the same results? Thanks, Mike Array: $array = array( array('name' = 'Person1', 'username' = 'username1', 'join_date' = 12233445566, 'state' = 'NJ'), array('name' = 'Person2', 'username' = 'username2', 'join_date' = 12233445566, 'state' = 'NJ'), array('name' = 'Person3', 'username' = 'username3', 'join_date' = 12233445996, 'state' = 'NY'), array('name' = 'Person4', 'username' = 'username4', 'join_date' = 12233445996, 'state' = 'NJ'), array('name' = 'Person5', 'username' = 'username5', 'join_date' = 12233445566, 'state' = 'NJ'), array('name' = 'Person6', 'username' = 'username6', 'join_date' = 12233445566, 'state' = 'NY'), array('name' = 'Person7', 'username' = 'username7', 'join_date' = 12233445776, 'state' = 'NY'), array('name' = 'Person8', 'username' = 'username8', 'join_date' = 12233445566, 'state' = 'NY'), array('name' = 'Person9', 'username' = 'username9', 'join_date' = 12233445996, 'state' = 'NJ'), ); Function: function createIndex($array, $index){ $index_array = array(); foreach($array as $result){ if(is_array($index)){ $key = '$index_array'; for($i=0;$i=sizeof($index)-1;$i++){ You should move this sizeof($index) part out of the loop. It should look like this $len=sizeof($index); for($i=0;$i$len;$i++) -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] What is The best way/tool for debuging PHP?
There is nothing you can call best. But whether some tools, technology will perform better depends completely on the context. I know some ways to debug PHP codes. 1. Netbeans IDE. The debugging facility here is excellent. You can debug even a single file without creating a project. It uses xdebug debugging engine. 2. Zend Studio/Eclispe PDT. Recent Zend studios are based on Eclispe PDT. They supports both xdebug and zend debugger. The problem I find with these IDEs that you can not debug a single file without creating a project. May be there is a way but I dont know. Its always better to download those all-in-one package IDEs to start development faster. These packages has zero setup time. So no time wasting. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Need help on increment date
It works for me too. I tell you two things, a) make sure there is a space after +1 day. So it should look like +1 day . This ensures that the unix time is not concatenated with day. b) calling strtotime 2 times is not a great solution. You can all it once only. Like this, $date = strtotime http://www.php.net/strtotime(+1 day 2008-02-28); // better to call this, as the order is quite logical $date = strtotime http://www.php.net/strtotime(2008-02-28 +1 day); -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Function size
On Wed, May 23, 2012 at 8:14 PM, Tedd Sperling t...@sperling.com wrote: Hi gang: On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: A rule of thumb is no more than 50 lines per function, most much less. Back in the day when we didn't have nifty gui screens and an 24 line terminals (yay green on black!), if a function exceeded one printed page, it was deemed too long and marked for refactoring. You hit upon a theory of mine -- and that is our functions grow in size up to our ability to view them in their totality. When our functions get beyond that limit, we tend to refactor and reduce. When number of lines becomes the criteria of function size? Wouldn't it depends on the task the function is doing? I follow this rule, *Each time I end up need a code block I wrote earlier, I convert it to a function. *So simple. This way you re-factor your code automatically and you dont do any copy paste. Last year someone on Stackoverflow asked something like this[1]. And that was my answer. [1] http://stackoverflow.com/a/8597409/376535 -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Function size
On Thu, May 24, 2012 at 1:56 AM, Matijn Woudt tijn...@gmail.com wrote: I agree that large switch block are not always easy and useful to split, however, writing too much code inside a switch block isn't considered good practice too IMO. Though, it is unavoidable in some cases I think. I do have some of these functions in my code too, I have one switch block of more than 500 lines, but that's just because I have more than 400 individual case statements, and I don't think there's a better way to do it. Doesn't mean I like it btw. I never encounter such big switch statement in PHP yet. However I saw huge switch and had to optimize it while working with a custom programming language interpreter written in C. When I see the language is OO, I try to apply polymorphic behavior and eliminate any switch statements. Here is a video that demonstrated the concept http://www.youtube.com/watch?v=4F72VULWFvc -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] regexp novice
On Fri, May 18, 2012 at 7:34 PM, Stuart Dallas stu...@3ft9.com wrote: Based on your requirements, 00:40 is completely valid. Why do you think it should be invalid? 00:40 is not a valid 12-hour format. BTW I just found another non-regex approach. Its even faster. function valid_time_Shiplu2($time) { sscanf($time, %2d%2d, $h, $m); return ($h0 $h13 $m=0 $m60); } -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] regexp novice
On Fri, May 18, 2012 at 2:37 AM, Jim Giner jim.gi...@albanyhandball.comwrote: ok - finally had to come up with my own regexp - and am failing. Trying to validate an input of a time value in the format hh:mm, wherein I'll accept anything like the following: hmm hhmm h:mm hh:mm in a 12 hour format. My problem is my test is ok'ing an input of 1300. Here is my test: if (0 == preg_match(/([0][1-9]|[1][0-2]|[1-9]):[0-5][0-9]/,$t)) return true; else return false; Can someone help me correct my regexp? I can not correct your regexp. But I must tell you that trying to tweak a regex for hours is surely **not productive**. If you got any type of text processing dont always go for regular expression. This problem can be solved just by simple string parsing. Here I have done that for you. function valid_time($time){ $m = (int) substr($time, -2); $h = (int) substr($time, 0, -2); return ($h=0 $h13 $m=0 $m60); } -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] regexp novice
Jim L. I did't actually consider that wide range of time values. Here is an update. Still this can be written without help of regex. I must add one more thing that a '00:01' is invalid in 12 hour format. OP wants it to be 12-hour format. function valid_time($time){ $m = substr($time, -2); $h = (explode(':', substr($time, 0, -2))); $h = $h[0]; return (is_numeric($h) is_numeric($m) $h0 $h13 $m=0 $m60); } See the code in action here http://ideone.com/tSQIb -- Shiplu Mokaddim Talks: http://shiplu.mokadd.im Follow: http://twitter.com/shiplu Innovation distinguishes between follower and leader -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] alias address in REMOTE_ADDR
On Saturday, May 12, 2012, Tóth Csaba wrote: Hi Everyone, I've run into a curious problem, not even really sure it's PHP, but that's where I caught it, so here it is: I have two servers hanging on the net, without proxies. Let's call them Server1 and Server2. Server1 has multiple IP addresses, configured as aliases. My problem: When I do a wget --spider from 1 to 2, I get the eth0 (not alias) address in Apache's accesslog on Server2. But when I do a file_get_contents( http://server2.tld), and observe the $_SERVER['REMOTE_ADDR'] on Server2, I get one of the alias IP addresses back. What can cause this? I really need the eth0 IP address back in REMOTE_ADDR. On server2 make sure the metric of both interface in the routing table is not same. Same metric can cause this behavior. Change the metric of eth0 to a lower value than the other. Then try again. Regards, Csaba -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] alias address in REMOTE_ADDR
On Saturday, May 12, 2012, shiplu wrote: On Saturday, May 12, 2012, Tóth Csaba wrote: Hi Everyone, I've run into a curious problem, not even really sure it's PHP, but that's where I caught it, so here it is: I have two servers hanging on the net, without proxies. Let's call them Server1 and Server2. Server1 has multiple IP addresses, configured as aliases. My problem: When I do a wget --spider from 1 to 2, I get the eth0 (not alias) address in Apache's accesslog on Server2. But when I do a file_get_contents( http://server2.tld), and observe the $_SERVER['REMOTE_ADDR'] on Server2, I get one of the alias IP addresses back. What can cause this? I really need the eth0 IP address back in REMOTE_ADDR. On server2 make sure the metric of both interface in the routing table is not same. Same metric can cause this behavior. Change the metric of eth0 to a lower value than the other. Then try again. Correction. On server2 should be On server1. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Segmentation fault while fetching BLOB data from mysql with ODBC
On Thursday, April 26, 2012, Leandro Dardini wrote: Anyone has experienced segmentation fault while reading blob (longblog) data from mysql using ODBC? If not, can you provide me few rows of code to show me how you fetch it? I am using php 5.3.3 and this code segfaults: $conn=odbc_connect(db,,); $sql=select * from table where id=1; $res=odbc_exec($conn,$sql); $row=odbc_fetch_object($res); Leandro This is certainly a bug. But I'm curious why you are not using MySQL extension? -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] To ? or not to ?
I keep my closing tag. Earlier I started removing closing tag. Then I search for the standardness of this practice and found its not standard. Some frameworks/cms intentionally do this. Besides a signle `\n` character is allowed after the closing tag which does not cause Can not send Header error. So I started using closing tag again. Later I found, from visual aspect, a closing tag makes the code balanced. Still using it. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
[PHP] RSS Standardness
Dealing RSS Version. I am going to write an RSS parser. Its a very simple parser which just grabs the latest items date and title. SimpleXML and DomDocument is my friend here. The problem here is there are too many standards for RSS. RSS 2.0, 0.92 and 0.91. What do you think which version should I implement? if its not a single version then which versions? I am also aware about SimplePie which I have been using a lot. Here my preference is not to load a library like SimplePie to just grab the title and date. I just want to use DomDocument and SimpleXML. Content-Type header. RSS were called RDF prior to 0.91 and currently RDF is a different protocol. How do you detect if the content is RSS 0.90 or Modern RDF if content-type header is 'Application/rdf+xml'. Other content type with same meaning is 'Application/rdf' and 'text/rdf'. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Function mktime() documentation question
To get the number of days for a specific month, I use: // $current_month is the month under question $next_month = $current_month + 1; I use this $next_month = $current_month + 1; $next_month_1= mktime(0, 0, 0, $next_month, 1, date(Y) ); $current_month_1= mktime(0, 0, 0, $current_month, 1, date(Y) ); $mdays = ($current_month_1 - $next_month_1)/(3600*24); It's much more easier if you use DateTime and DateInterval class -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] PHP run from console - automatic password input
Did you try -passin, -passout options of openssl command? See the man page here http://linux.die.net/man/1/openssl Specially the Pass phrase arguments section. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] PHP exercises
Here is a good place for logic building. http://projecteuler.net/ -- Shiplu Mokadd.im Innovation distinguishes between follower and leader
Re: [PHP] PHP run from console - automatic password input
On Tue, Nov 29, 2011 at 8:21 AM, asdf zxcv jazdatest...@gmail.com wrote: I'm trying to make my php script (run from console) to input nesesary data when console asks for it. For example, i want to automatically manage revoking self-signed certificates, but when i exec(command) then system asks me to give the pass phrase. I dont want to do that. Instead, I want my script to input the password automatically. Is there any way to achieve that? Regards Peter You could try, $pass = 1285@; exec(echo $pass | command); But if its a privilege issue on your linux system, its better to start the php script with proper privilege. -- Shiplu Mokadd.im Innovation distinguishes between follower and leader
Re: [PHP] PHP exercises
On Sat, Nov 26, 2011 at 11:54 AM, Larry Garfield la...@garfieldtech.comwrote: Hi folks. A friend of mine is trying to learn PHP. She already knows programming basics, but wants to learn PHP specifically. However, she learns much better with assignments or exercises than just from reading articles or books. The only site I've found so far is PHP Exercises (http://phpexercises.com/), but it of course went offline the day after I found it. Fail! Can anyone recommend other sources for tutorial-based or exercise-based PHP learning? Paid is OK if it's not too expensive and it's worth the money, although free is always preferred. IMO, the best way is to learn something is by cloning. Convince your friend to clone a simple website. If you exercise it, your target would be to pass in the exercise. After you pass, you forget it. When it comes to real deal, you never forget it. -- Shiplu Mokadd.im Follow me, http://twitter.com/shiplu Innovation distinguishes between follower and leader
Re: Re: [PHP] include
On Mon, Nov 21, 2011 at 3:34 AM, Tim Streater t...@clothears.org.uk wrote: On 20 Nov 2011 at 10:36, Tommy Pham tommy...@gmail.com wrote: I think you're approaching this the wrong way. 1) have a clear understanding of PHP - syntax, capabilities, etc. That's what I'm doing - gathering information about bits of PHP that I've not used (or not used very much) before to see how my new setup could be structured. 2) have a clear understand of what you're intending to do - application's function/purpose, features, manageability, expandability, portability, etc... I have a clear idea about *that*. I want to figure out if it's possible to use web sockets with a small server written in PHP to replace my current structure of ajax + apache + processes (which I suppose it forks). I see these benefits: 1) possible benefit - presumably when an ajax request arrives, a new process is started and so PHP has to be loaded and initialised each time. But perhaps this is in some way optimised so the PHP process is left running and apache then just tells it to read/execute a new script. Did you check http://php-fpm.org/ 2) Definite benefit - when a browser makes an ajax request to run a script, it gets no information back until the script completes. Then it gets all of it. I have a couple of unsatisfactory workarounds for that in my existing structure. Websockets appears to offer a way for the browser to receive timely information. 3) understand design patterns I don't know what this means. What your asking is practically impossible in any programming language akin to 'how to un-import packages in Java' or 'how to un-using namespace in C#'. If you don't want to use it, don't include it ;) I do want to use it but would like to be able to replace it with a newer version. If there is no way to do this then that is a data point. And here's another question. Can a child forked by pcntl_fork() use a socket that the parent obtained? Reading the socket stuff in the PHP doc, there are a number of user-supplied notes hinting this might be problematic. -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Shiplu Mokadd.im Follow me, http://twitter.com/shiplu Innovation distinguishes between follower and leader
Re: [PHP] What's the problem with this PHP code?
On Fri, Nov 4, 2011 at 1:47 PM, Sophia red_an...@techno-info.com wrote: Here is the PHP code: ?php $panka =c:can-it-rock- :the-boat-of- :love- ; $pankb = preg_split(':',$panka); It should be preg_split('/:/', $panka); $pankc = $pankb{1}; echo ( . $panka . )\n( . $pankc . )\n; ? I keep getting the following error: Sophia-Shapiras-MacBook-Pro:**tmp red_angel$ Sophia-Shapiras-MacBook-Pro:**tmp red_angel$ php testo.php Warning: preg_split(): No ending delimiter ':' found in /Users/red_angel/tmp/testo.php on line 8 ( c:can-it-rock- :the-boat-of- :love- ) () Sophia-Shapiras-MacBook-Pro:**tmp red_angel$ Sophia-Shapiras-MacBook-Pro:**tmp red_angel$ So --- what am I missing? What am I doing wrong? I'm pulling my hair out over this one! Anyone have a clue what's up? I can see that the colon is present *multiple* times in the string that is meant to be split! How come PHP's preg_split() function can't see it? Thanks, Sophia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Shiplu Mokadd.im Follow me, http://twitter.com/shiplu Innovation distinguishes between follower and leader
Re: [PHP] Why does this script run out of memory?
I had a spider written in PHP long ago. I had similar problems. because there were millions of rows of urls and I was fetching them in one single query. See inline, could this modification help you. Please test. On Fri, Oct 28, 2011 at 10:38 PM, Jim Long p...@umpquanet.com wrote: I'm running PHP 5.3.8 on FreeBSD 8.2 with MySQL 5.1.55. The script below is designed to be able to WHILE it's way through a MySQL query result set, and process each row. However, it runs out of memory a little after a quarter million rows. The schema fields total to about 200 bytes per row, so the row size doesn't seem very large. Why is this running out of memory? Thank you! Jim ?php $test_db_host = localhost; $test_db_user = foo; $test_db_pwd = bar; $test_db_name = farkle; $db_host = $test_db_host; $db_user = $test_db_user; $db_name = $test_db_name; $db_pwd = $test_db_pwd; if (!($db_conn = mysql_connect( $db_host, $db_user, $db_pwd ))) die( Can't connect to MySQL server\n ); if (!mysql_select_db( $db_name, $db_conn )) die( Can't connect to database $db_name\n ); $limit=10; $offset=0; while(1){ $qry = select * from test_table order by contract $offset, $limit; if ($result = mysql_query( $qry, $db_conn )) { $n = 0; while ($row = mysql_fetch_assoc( $result )) { // process row here $n++; } // while mysql_free_result($result); echo $n\n; } else { die( mysql_error() . \n ); // break the loop break; } $offset+=$limit; } ? Its the same thing but you are fetching data in chunks. Now this portion order by contract on quarter million rows is not a good practice. It will slow down your query time and make the script severely slow. I had about 100 millions of rows in my table in the url and I was sorting on last-visit column. Later I removed the order by and it was much faster. Try it and let us know. Thanks -- Shiplu Mokadd.im Follow me, http://twitter.com/shiplu Innovation distinguishes between follower and leader -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exporting large data from mysql to html using php
2-3 minutes is long enough. I think your SELECT query and MySQL schema has something that can be improved. Sent from a handheld device. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Friday Distraction
I saw this 3-4 days ago. And yes, I didn't allow the app to post anything on my wall. :D -- Shiplu Mokadd.im Follow me, http://twitter.com/shiplu Innovation distinguishes between follower and leader
Re: [PHP] Dennis Ritchie, Father of Unix and C programming language, dead at 70
I found this, And I liked it. int main() { printf(Goodbye Daddy\n); return 0; } -- Shiplu Mokadd.im Follow me, http://twitter.com/shiplu Innovation distinguishes between follower and leader
Re: [PHP] Intentionally generate an Internal Server Error
On Sun, Aug 7, 2011 at 9:50 AM, Ghodmode ghodm...@ghodmode.com wrote: I'd like to use PHP to intentionally generate an Error 500 Internal Server Error. Here's the problem. My site has this error intermittently and I'd like to monitor the error log to figure out the problem. Unfortunately, I don't get to see the actual Apache error log and my hosting provider's error reporting system isn't working. Customer support just sends me canned responses stating that everything's fine and they can't reproduce the error, so I'd like to create a reproducible internal server error so that they can see that it's not showing up in the error log. I know that I can mess up something in the .htaccess file, but that would break the whole site. I don't want to do that. I know I could use header(HTTP/1.1 500 Internal Server Error), but that means I would also have to provide the content of the Error 500 page. I want to kick off they're internal server error page. They don't give me to option to create one of my own. I'm using GoDaddy. Can someone suggest some invalid PHP code that should generate an internal server error? Thank you. One way would be, write a php extension and perform segfaults there. -- Shiplu Mokadd.im Follow me, http://twitter.com/shiplu Innovation distinguishes between follower and leader
Re: [PHP] Intentionally generate an Internal Server Error
You can search for a buggy extension that has known issue of segmentation faults. -- Shiplu Mokadd.im Follow me, http://twitter.com/shiplu Innovation distinguishes between follower and leader
Re: [PHP] Intentionally generate an Internal Server Error
By the way, You can also try sending proper html page and http header that will copy the Internal Server Error. That is completely possible in php. Just use the header() function. -- Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu Innovation distinguishes between follower and leader
Re: [PHP] PHP frameworks
On Fri, Jul 22, 2011 at 3:20 AM, Paul M Foster pa...@quillandmouse.com wrote: On Thu, Jul 21, 2011 at 03:59:52PM -0500, Chris Stinemetz wrote: Hello all, I am thinking about venturing into PHP frameworks, but I would like to get advice on what the correct selection would be for someone that is about intermediate in PHP knowledge. Thank you, Try CodeIgniter ( http://codeigniter.com ). It's a lightweight, well-engineered framework with relatively transparent code (meaning you can examine the source and see relatively easily what they're doing). Documentation is some of the best out there. Using Kohana 2. Its too old. But most of my skeleton codes are written in this framework. So not changing it. -- Shiplu Mokadd.im Follow me, http://twitter.com/shiplu Innovation distinguishes between follower and leader -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] str_replace around a character??
If you are looking for a one liner reg ex, it may take some time. This may lead wasting your development time. Better you do the following, 1. replace the string with tokens in address. 2. Split using comma. 3. Apply common email regex. 4. Replace tokens with actual strings. 5. Rebuild/join the string with , With this approach you can validate individual emails too. Sent from a handheld device -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What type of PHP5 shall I install to learn PHP5 together with Apache, Please specify the Apache type too Since There are Two Apache types also
See https://help.ubuntu.com/community/ApacheMySQLPHP Also you can try the command bellow sudo apt-get install lamp-server^ Note, ^ is a part of the package name. Sent from a handheld device -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Call to undefined function
Sent from a handheld device On 24-Jun-2011, at 5:53 AM, ad...@buskirkgraphics.com wrote: I am running a scheduled task for the first time since switching from linux to Windows IIS I am getting an error when the task runs. Fatal error: Call to undefined function mysql_connect() I ran php.exe -m to see that the MySQL Module is loaded. I have no issues unless I am running a php file in the Scheduled task. Any help would be appreciated Richard, Create a sample scheduled task with a sample.php file. In that file call phpinfo() and save that content. After finishing the task find the configuration file (php.ini) location in your saved content. Just make sure mysql is activated there. Good luck Richard L. Buskirk
Re: [PHP] Warning: Cannot modify header information - headers already sent by - classic
On Fri, May 20, 2011 at 1:45 AM, Marc Guay marc.g...@gmail.com wrote: Hi folks, I'm running some code locally which should produce this fun error we all know and love: Warning: Cannot modify header information - headers already sent by... but does not. Switching from 5.3 to 5.2 reveals the error and running it on another server with 5.2 also shows the error. I don't believe the version has anything to do with it, but who knows. I set error_reporting = E_ALL | E_STRICT and verified that display_errors = On, still nothing. Any ideas what could be allowing a header('Location:'); call to redirect without throwing an error after output has been sent to the browser? Marc Marc, I think you should mimic this in command line using curl. You can easily understand where the extra byte before headers are coming. -- Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu Innovation distinguishes between follower and leader
Re: [PHP] Sending messages from php to C++ application via UDP socket
On Thu, May 19, 2011 at 3:14 PM, Richard Quadling rquadl...@gmail.comwrote: On 18 May 2011 18:03, shiplu shiplu@gmail.com wrote: Try to think a string is an array of bytes. Parse that array of bytes at C++ end. There should host to network and network to host data conversion function. Use them. -- Shiplu Mokadd.im Just to confirm Sniplu's comment really. For example (see http://unicode.org/faq/utf_bom.html#bom4) $s_Utf8Bom = chr(0xEF) . chr(0xBB) . chr(0xBF); This will build the UTF-8 Byte Order Mark. You can use http://uk.php.net/manual/en/function.pack.php to build a binary string comprised of different values based upon C types (int/long, signed/unsigned, chars, hex strings, floats/doubles, nulls, etc.) In essence, if you have a C struct that represents the data you need to send, then you should be able to compose a suitable string. If you already have an app that can talk to the media player, then use a tool like wireshark to monitor the communication. That, at least, will give you real world example of the data you need to send. Richard. If there is already a protocol defined for such communication, use it. To get hint about this protocol use wireshark like tools. If no protocol is defined yet. You need to define one. For this all you have to make a serializer and an unserializer function for both php and c++ end that obeys the protocol. Now this serializer can use xml, yml, json, binary, base64 or any different format.. -- Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu Innovation distinguishes between follower and leader
Re: [PHP] Sending messages from php to C++ application via UDP socket
Try to think a string is an array of bytes. Parse that array of bytes at C++ end. There should host to network and network to host data conversion function. Use them. -- Shiplu Mokadd.im
Re: [PHP] $$var
Just being curious, I have a question. How many times PHP interpreter will replace this variables? I mean how deep it will be? If I use variable variables like $$a how long it will be evaluated? -- Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu Innovation distinguishes between follower and leader
[PHP] Performance Improvement on Calling C++ executable from PHP
Hello Everybody, I am developing a php application that interfaces with an external executable binary. The program is written in C++. I open the program (say a.out) using proc_open. Write some command at its stdin and fetch data stdout. Then close the program. The timing of only a.out is real 490ms usr 160ms sys 290ms When I invoke it using proc_open in php-cli, the timing becomes real 530ms usr 50ms sys 450ms Look closely, the cpu time and the real elapsed time increases. I run the php version from command line. As an apache handler this will surly take more time. My question is, how can I improve invoking this a.out? Is there any best practice? The command is something like $ ./a.out --option value --option value script.txt The program a.out can not be converted in php unless I write an extension. But this will need a lot of effort to write it in PHP. Some of my ideas are, 1. Create a standalone multi-threaded server that calls a.out and php calls that server. 2. Call a.out as a CGI and convert it that way. Any ideas? -- Shiplu Mokadd.im My talks, http://talk.cmyweb.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Performance Improvement on Calling C++ executable from PHP
=== Recently I my this php-general doesn't accept my mail for some reason. So I send it again from anther email === Hello Everybody, I am developing a php application that interfaces with an external executable binary. The program is written in C++. I open the program (say a.out) using proc_open. Write some command at its stdin and fetch data stdout. Then close the program. The timing of only a.out is real 490ms usr 160ms sys 290ms When I invoke it using proc_open in php-cli, the timing becomes real 530ms usr 50ms sys 450ms Look closely, the cpu time and the real elapsed time increases. I run the php version from command line. As an apache handler this will surly take more time. My question is, how can I improve invoking this a.out? Is there any best practice? The command is something like $ ./a.out --option value --option value script.txt The program a.out can not be converted in php unless I write an extension. But this will need a lot of effort to write it in PHP. Some of my ideas are, 1. Create a standalone multi-threaded server that calls a.out and php calls that server. 2. Call a.out as a CGI and convert it that way. Any ideas? -- Shiplu Mokadd.im -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: use of ini vs include file for configuration
For configuration, I used to use .php file earlier. I just used array syntax to keep the config values. But now I use json syntax. Its easy like xml. Ini file is much more user friendly than json though. -- Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu Innovation distinguishes bet ... ... (ask Steve Jobs the rest)
Re: [PHP] What other languages do you use?
At home I always speak in Bangla. But at work I have to speak in English. I watch Hindi movies well. So I understand Hindi too. I used, C Java C++ C# ActionScript Javascript Perl PHP Bash LISP Currently I am working in LISP C C++ At home I play with Bash, Javascript, PHP, C -- Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel with large files (27,000+ rows)
On Tue, Oct 5, 2010 at 12:39 AM, chris h chris...@gmail.com wrote: I'm currently working on a project that requires the parsing of excel files. Basically the user uploads an excel file, and then a script needs to save a row in a Postgres database for each row in the excel file. The issue we are having is that when we task PHPExcel with parsing an excel file with, say 27k rows, it explodes with a memory error. I've read up on the PHPExcel forums and we've tried cell caching as well as ReadDataOnly, they do not seem to be sufficient. Does anyone here know of a way to do this? Surely there is a way to parse a large excel file with PHP. This is also NOT an on-demand service. That is, when someone uploads a file they get a task_id which allows them to check the status of their excel file. So the solution does not need to be a fast one! Thanks, Chris. 1. Remove any variable that contains big object if its not necessary. 2. Use unset when applicable 3. Read chunk by chunk. 4. Profile it to find the exact place where you are wasting memory. Optimizing that little portion of code can improve memory performance. -- Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] version_compare
On Thu, Sep 30, 2010 at 9:43 PM, Brian Smither bhsmit...@gmail.com wrote: I found this code... if (version_compare(PHP_VERSION, '5.2.0', '=')) { It means condition (PHP_VERSION = 5.2.0) $text=filter_var($text, FILTER_SANITIZE_URL); } ...to be questionable. Under what conditions would version_compare() return true, yet the filter_var() be undefined? Because that's what is happening. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how do you upload to a 3rd-party remote server?
You have to maintain a queue if I understand it properly. PHP page will send request on one end of queue. And the server side cron will process from other end. Cron will upload it to ftp. Now you can implement a queue using database table or you can just use a file. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Query Puzzle
Use distinct. SELECT DISTINCT COLUMN1, COLUMN2 FROM ... ... Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Converting a javascript calculating page to a PHP one
You can use SpiderMoneky of Mozilla or V8 of Google to execute the js. Later you can also create a php extension to call your lib. The flow will be like this, PHP -- PHP_V8_WRAPPER -- V8 -- EXECUTE_JS Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Determining the similarity between a user supplied short piece of text (between 5 and 15 characters) and a list of similar length text items.
There is an algorithm called longest common sub sequence. If you can find the longest common sub sequence of the strings of database for the given string and sort it, you'll get the most matched word. But I think this algo is developed already and available in your context. It's name can be different. As a developer I am not sure actually what function in php or mysql serves the purpose. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] integrating lib (C++) into php
Sure. All you have to do is write a php extension. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] interface name file
I use naming convention for interface. If an object can be cached, I create an interface I+Cache+able = ICachable. So a sample class would be named as ASampleClass.php And the Interface would be ICachable.php This is a well known interface naming convention. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] curl
# yum install php4-curl or # yum install php-curl Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] complex unf8 indic script rendering and cairo
Anyone knows where I can find cairo (http://www.php.net/cairo) examples. The php sites doesn't have any example or tutorial. I am looking for a way to render complex unf8 indic script. Cairo seems a solution for me though I haven't tried yet. if you have any suggestion on complex indic script rendering that'll be great. Thanks Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: stripping first comma off and everything after
I'll use, list($data) = explode(,,$entries[$i][dn]); Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Set up MySQL + Apache 2.2.4 on Win XP
Actually you just restore your NS schema in the new EasyPHP stack. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Set up MySQL + Apache 2.2.4 on Win XP.
You can consider XAMPP. (www.apachefriends.org/en/xampp.html) It has everything in it. Mysql server, Apache server, PHPMyAdmin, PHP, Perl and an FTP server Just install it and its configured. Just put your files in htdocs and they will be up and running. I use this to package my intranet php application. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Set up MySQL + Apache 2.2.4 on Win XP.
On Wed, Jun 2, 2010 at 5:32 AM, Shreyas shreya...@gmail.com wrote: Since I have another Java app running and points to the same port 3306, when I tried to configure with EasyPHP, I had a conflict. How about configuring EasyPHP at a different port? In that ways, EasyPHP's MYSQL and my external MySQL will never have a conflicting situation. Does that make sense? --Shreyas locate my.cnf file. Its in your mysql directory. And your mysql directory is somewhere in wamp install directory. Open the file with notepad/wordpad and change the port number. Its written just like this, port= 3306 Change is to port= 3307 or whatever port you like. Then restart mysql. But remember, all you php app need to connect mysql through that 3307 port which is not standard. So mysql_connect() functions params should be tweaked. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest)
Re: [PHP] editing a file
You can use shell commands. Like sed, replace etc .. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Encoder like IonCube
Can you paste a sample encoded version of a php file on pastie.org? Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Encoder like IonCube
It just obfuscates. Long ago I created a decoder for this type of encoder. Every day I got 100s of decoding requests. After changing my domain and hosting company I didn't upload it yet. I think bcompiler is better. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: regexp questions
I think the error is related to changed described here. http://www.pcre.org/changelog.txt Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: regexp questions
oops! Please see the change log for version 8.00 on http://www.pcre.org/changelog.txt Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest)
Re: [PHP] PHP Encoder like IonCube
I dont own a windows computer. I found phpcoder.sf.net. it uses eaccelerator to encode. This is good. But the problem is latest version of e-accelerator discontinued the encoder. So may be, an older version will do it. Didn't configured it yet. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Encoder like IonCube
On Mon, May 10, 2010 at 6:28 AM, donald sullivan don...@nixspot.com wrote: bcompiler is available, but with the correct tools data can still be extracted. http://php.net/manual/en/book.bcompiler.php Its not a problem if data can still be extracted. But I guess exact data can not be extracted. If thats the case its okay. Sometimes an obfuscated code is enough to protect it. As far I remember I heard somewhere it can be achieved by e-accelerator somehow. How is it possible? Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Encoder like IonCube
Hello Ashley, My application will not be accessible through Internet. Users will use it through internal network. And internet is strictly prohibited there. Thats the reason why i'm lookin for such solution. On 5/10/10, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Mon, 2010-05-10 at 12:42 +0600, shiplu wrote: On Mon, May 10, 2010 at 6:28 AM, donald sullivan don...@nixspot.com wrote: bcompiler is available, but with the correct tools data can still be extracted. http://php.net/manual/en/book.bcompiler.php Its not a problem if data can still be extracted. But I guess exact data can not be extracted. If thats the case its okay. Sometimes an obfuscated code is enough to protect it. As far I remember I heard somewhere it can be achieved by e-accelerator somehow. How is it possible? Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) I have to ask, why do you want to do that? Wouldn't it be easier to offer your application as a system that only you host. That way, the end-user never gets to see your PHP code. Thanks, Ash http://www.ashleysheridan.co.uk -- Sent from my mobile device Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regexp questions
For example, the following regex doesn't work. return (bool) preg_match('/^[\pL\pN\pZ\p{Pc}\p{Pd}\p{Po}]++$/uD', (string) $str); Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Encoder like IonCube
Is there any php encoder like IonCube ? Looking for an opensource solution. My main target is to deliver encoded php codes so that it can not be re-engineered. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Two color rows in table inside while iteration
$a=0; while (++$a, $row=mysql_fetch_...){ echo tr class=\alternate-row-.($a%2).\... } Shiplu Mokaddim My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php