« first day (957 days earlier)      last day (4007 days later) » 

12:18 AM
quick question everybody, related with the `shell_exec()`function.
I can do `echo shell_exec("ls")` with no problem
I can ssh to the server and do `for f in `ls` ; do echo $f ; done`.
However, doing `shell_exec()` for that for shell loop, doesn't give me anything.
Any idea what I might be missing here?
 
@nunos I'm not sure you can use backticks in the command itself. Try instead of `ls` $(ls)
 
thanks for you reply, but still didn't do the trick though :s
 
@nunos what is your default shell?
 
found the problem
I wasn't escaping the $f
 
12:32 AM
/me found :-)
 
it was being interpreted in php instead of the shell
thanks ;)
 
@nunos follow the protip section to avoid it :-)
 
yes you did, not me :P
 
Single quotes! =o)
 
I will, thanks ;)
 
12:33 AM
that's because cats better than dogs ;-P
2
 
@zerkms I agree
 
Anyone who is active jenkins user alive - could you please upvote issues.jenkins-ci.org/browse/JENKINS-17347
 
1:03 AM
i used file("myFile.txt" , FILE_IGNORE_NEW_LINES) it still returns each line including newline . What going Wrong ??
 
1:17 AM
@Cody what do you want to do?
 
I just not want to include newline at the end of each line
 
have a codepad?
 
yep sublime
 
link
 
What link ??
 
why new lines are still included
 
ends in \r\n ?
 
anyone here use codeigniter with sparks?
 
nobody here uses CI to my knowledge
 
@ka yep i am in window so \r\n
 
1:28 AM
@kaᵠ what do you use, if anything in terms of an mvc framework?
 
@Cody and with the flag FILE_IGNORE_NEW_LINES you still have each line end in \r\n or just \r ?
 
it still ending in \r\n
 
@DevelopingChris i don't use frameworks
@Cody don't know what to say, as a woraround you could use trim() or rtrim()
 
i know that but then what's the point to included these flags
 
it should work
paste a few lines of your file
 
1:32 AM
Woods are lovely
dark and deep
but i have
promises to keep
and miles
to go before i sleep
if i insert few empty lines in the above text
then pastebin.com/eFJ5CCz5 this one is also not working
 
what php version are you running?
@Cody try with ini_set("auto_detect_line_endings", true); before reading the file
should fix it
 
1:48 AM
5.3
exactly 5.3.13
 
update @Cody get the latest 5.4
anyway try with ini_set first
 
issue still exist
if i use this it works
<?php

$line = file("myfile.txt" ,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
var_dump( $line );

?>
@yiz can you help me with this code pastebin.com/eFJ5CCz5
 
yiz
2:06 AM
what about it?
 
in file() function FILE_SKIP_EMPTY_LINES flag should skip empty lines but that's not happening
 
yiz
what are you using for the newline characters?
 
\r\n
i am in windows
@yiz Any suggestions
 
yiz
maybe there are special characters like spaces or tabs on certain lines
try
$line = array_values(array_filter($line, "trim"));
 
here is my text
 
2:18 AM
@yiz A line with just '0' on it is not an empty line.
 
yiz
just 0? character 0? int 0 or in some languages, null?
 
@Jack it's a weird discussion about ternaries )
 
yiz
even though in a file you probably mean character '0', of course if a line looks like this:
0
it is not empty :p
I need coffee before I start making sense, didn't have any so far
 
all works fine if i use
<?php

$line = file("myfile.txt" ,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
var_dump( $line );

?>
but then there is no documentation said FILE_SKIP_EMPTY_LINES works only in conjunction with other flags
Is there a bug ??
What you think?
 
@Cody they are always a bitmasks
 
2:26 AM
@Cody is this after you started using: ini_set("auto_detect_line_endings", true);
?
 
@zerkms yeah =S
 
no
 
lol
he downvoted me on the other question
 
hah
 
jerk
lol
 
2:30 AM
@zerkms added an upvote :)
it's a vague question anyway, but still.
 
"In contrast, in high-performance scenarios, even fairly small PHP file will consume substantial system resources. The general issue of PHP performance is what drove Facebook to write" --- I like how people justify micro-optimizations by referencing to facebook experience
 
The speed gain you get with HipHop of course really depends on what kind of work the script does :)
 
yep. in 99.9999% the slowest part is a database (some other remote resource)
but people still continue search-and-replacing " to '
 
Call me back when you have a 5,000 sqft room serving your website ;-)
 
@Jack I serve all my projects on my phone
 
2:36 AM
@zerkms I saw that once in a Google (!) video on how to optimize PHP.
 
now back to extjs hell
 
Your answer skips over the 99.9% of scenarios that fall between "executed on the client's machine via the command line" and "Facebook". — Jack 5 secs ago
 
3:03 AM
10
Q: Has PHP's attitude towards exceptions changed in version 5.4.10?

Emanuil RusevThe following would work in PHP 5.3, but not in PHP 5.4.10. throw new Custom_Exception(); class Custom_Exception extends Exception {} PHP 5.4.10 would respond with the following fatal error: Class 'Custom_Exception' not found in ... Does anyone know why? p.s. Moving the class definitio...

Hmm, seems TL ^^
Double -1: PHP objects outside of extensions are thread-safe by default, singleton is a nightmare to test in this form, so, to be avoided at all costs if you're planning on using that database class as more than just a PDO instance storage. — Sébastien Renauld 7 hours ago
wow, he's on a roll huh.
 
3:25 AM
Really? It's 2013. We have bigger fish to fry than singletons. It's basically an accepted axiom that singletons are bad... Not only are Static Methods Considered Harmful, but Global State and Singletons Are Brittle, so the prevailing wisdom is Singletons vs Global State, Choose Neither... — ircmaxell 16 secs ago
 
noice :)
I can imagine people seeing this 50 years later "It's 2013, etc. etc." and go "B*tch please, statics and globals were just misunderstood" :)
2
 
oh goodie!
oh gawd, he didn't ....
 
I cannot even get what he wanted to demonstrate with that script
 
3:48 AM
@zerkms Also, lol @ $fileStr = fopen("tmp/core.php","w"); mkdir("tmp/");
 
hehe, I'm surprised that it works
 
It works because PHP will inspect the code and swap the two statements in anticipation ;-)
 
What I hate in a bug reporting process is convincing a dev team member that it is a bug
 
It's not easy :) what bug?
 
extjs ))
 
3:52 AM
better explain it harder how to reproduce :))
 
we're developing hardcore grid based on extjs grid and use its internals extensively - so I'm finding tons of bugs that general users don't spot
 
Blegh, sencha forums should consider either infinite scrolling threads or reverse ordering ;-)
Reminds me of "Q: Where is the best place to hide a body? A: On the second page of a Google search"
 
and now he's not able to reproduce and attached a screencast sencha.com/forum/… that's weird
 
4:08 AM
it looks as if it does load -debug.
 
Hey guys I got a question for yall. so I am going to be developing a media type site and now I was thinking of using WordPress but I would have to redevelop the whole back end interface because we don't want that normal wordpress look. So would it be better to use Drupal or just create a whole interface from scratch?
 
@zerkms since you do sencha ... would you know where i could find some evidence supporting that javascript performance in a webview is 50% compared to, say, chrome on android?
@DavidBiga The looks can be configured without having to rewrite the backend.
 
What I ment was the styling*
:)
 
In which case is styling != looks?
 
The backend will have to be rewritten a lot, well added to to do what I will need it to do. But I was going to use WordPress because of the blogging framework type already there.....haha yes :) @Jack what would you recommend?
 
4:13 AM
I wouldn't recommend wp to anyone, nor joomla, drupal, etc.
 
@Jack I don't develop for mobile devices (thankfully)
 
awww =(
 
Zerkms responsive is the way to go, so easy to do.
 
screencast.com/t/nk6XTpkw - my first screencast to reproduce a bug :-S
 
@Jack gotcha, I was thinking of creating a separate framework but for time I think WordPress would be best :)
I appreciate your help!
 
4:17 AM
@DavidBiga It's not meant to be negative btw ... without knowing specific use-cases, it's just hard to tell which one to go for, if any.
@zerkms nice ... pretty cool tool ^^
 
@Jack ya I understand, I pretty much answered my own question while I was talking though :)
 
yiz
@Jack, are you at the west side or the east side of Singapore, north or south?
I have a question about VPS
If a site using VPS is under DOS attack, would every other sites on the same machine get affected?
 
@yiz very likely :)
 
oh wow, microsoft's CDN servers non-minified JS: ajax.microsoft.com/ajax/4.0/2/WebForms.js
 
I stay in the north :)
 
yiz
4:24 AM
woodland? :D
 
@zerkms still gzipped at least :)
 
yiz
I was in Singapore for 2.5 years
 
@yiz Not that far up ;-)
actually webview is close to native browser ... but chrome blows them both out of the water in terms of performance lol
well, on android at least, at time of writing.
 
4:58 AM
Is there any difference between using filter_var($string, FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => 'my_regex']]) and preg_match('my_regex', $string)
 
Peep Peep
 
@crypticツ yes kittycat. preg_match returns 1, 0 or false, filter_var returns the string or false
@hakre I'd say drop by but I'm not here today
 
5:30 AM
Somtimes I wish there was a little bit more time in the day
 
@crypticツ They're meant to do different things, so yes, they're different :)
 
I am using dityform for alert if user change the value of form.But its giving strange behaviour for checkbox.Any idea guys.
??
 
5:47 AM
hai all .. Im retrieving an image from localhost DB. so when i retrieving image.. it no displays image but when i remove the header("Content-type: image/jpeg"); .. it displays the tmp path.. how can i fix this kindly help me im new to php..
 
yiz
Everyone has 24 hours in a day (although some are slower than the others, so relatively they have 'less' time). It is all about priorities - for coffee drinkers, there is never too little time for a morning coffee (assume they are like most other people - sleep at night, get up in the mornings)
 
@SaravanaKumarChinnaraj why are you saving image in DB? Instead u can save images in folder and save path in db
 
Well, I just need to start putting sleep higher up on the list of priorities :P
 
yiz
Probably you should, then you can be more effecient and thus accomplish more things in a day :)
 
how can we done that @PHP5.5
how can we do that @PHP5.5
 
5:57 AM
@SaravanaKumarChinnaraj see in database create one column which name will be images and save images in folder called images (it will contain all images u uploaded) and save photo1.jpg into images column .So next time when u retrieve that image from database it will be like localhost/YOURFOLDERNAME/images/photo.jpg where localhost/YOURFOLDERNAME will be static
gotcha?
 
yea.. @PHP5.5 its great & thank u.. I got it...
 
@SaravanaKumarChinnaraj welcome
 
@ircmaxell just watched your drupalcon slides; yay for the Germans :)
 
6:15 AM
hi,all
I have a problem with smarty
 
yes , using smarty is a problem
 
@tereško correct
 
violation of being nice ... duly noted ;-)
 
these statements assign $is_new

if(isset($_GET['is_new'])){
$is_new = $_GET['is_new'];
$_objSmarty->assign('is_new', $is_new);
}

these statements display $is_new

<span class="value">
<&if isset($is_new)&&!empty($is_new)&>
<&if $is_new eq '1'&>
<span>yes</span>
<&elseif $is_new eq '0'&>
<span>no</span>
<&/if&>
<&else&>
<span>null</span>
<&/if&>
</span>

when I pass is_new=0 in the url, the page display "null"
 
@shell pls pastebin it.
 
6:20 AM
Hi, good morning gentleman.
 
what's that <&if isset... stuff? eeeww
Hello Mr. IDEM.
 
agent @Jack Your orders are as follows: Explain the eq in the script above. I've never seen that in php b 4.
IDEM googles....
 
@Ihsan it does not compute.
 
I want when $is_new==0,the page will display no
Is there any bug in my statements?
 
morning fellas
 
6:26 AM
@shell Yes you used a PERL comparator in PHP...( eq ) and many more.
 
@Ihsan lol, that's smarty :)
 
@Jack IDEM has a top notch AI. It can learn... :D
 
when I pass $is_new=1,It's ok. The page will display "yes".
 
@Ihsan If it learned Smarty, it would instruct itself to jump off a building lol
 
@Jack It is me, not IDEM. IDEM is smart, I am not smarter because I imagined it.
 
6:30 AM
So you're saying IDEM would not learn it? lol
 
@Jack Also "that does not compute" was my favorite answer, it was one of the responses of a text adventure I played...(loong loong agooo in a galaxy faaar faar awaay)
 
What's up with Google Mirror? I went through a startup page, I don't see anything useful there, few playground examples, etc etc, what exactly is that for?
 
@Jack It learned it and (ab)used it...
idem is not a parody of hal9000 or other kickass AI's. It's course of computations which are built with good intentions makes it act with bad intentions because it computes the greater good, meaning it is a threat by itself and should be destroyed. Idem is bug free, perfect. It is a restricted demi-god and worse idem knows this..
@Mr.Alien Morning. Cloudy again?
@Gordon did you run yesterday?(marathon).
 
6:48 AM
Good morning! Hi @ihsan , teashan.com/images/tea_shan_logo.gif
 
@tereško this riga.com/news/… may rationalize the missing AC in the bus?
@Duikboot lol. the s and h is allllwaaays at the wrong place....
 
naah ... it's just some of the buses are old
 
i thought ac in buses was limited to tropical countries ;-)
 
:P
 
@tereško baltic-course.com/eng/baltic_states/?doc=75462 apply there. Get your money, type nonsense when boss comes or better be the boss...
 
6:53 AM
I'm writing a report on html5 app feasibility on android phones ... it's not very hopeful =/
 
@Jack lol and lol...
 
@Ihsan we have some issues with russian hackers
there have been several region-wide (latvia, lithuania, estonia) DDOS attacks
 
@tereško There is a russian city which is full of hackers phishers etc, a kind of mafia is governing them, I just can not remember the name.
 
that sounds like bullshit
 
@tereško Why?
 
6:56 AM
it's not just one city? haha
 
@tereško I am not lying. This is real. For instance Yuri creates a fake id of Tatiana with pictures of a lesser known hottie model. Then tatiana wants to marry. So somebody in us or turkey feeds money to her.(him)
 
@Ihsan , the issue is linked to political cycles in russia. Baltic states are a nice talking-point when elections come about. It has nothing to do with magical city of hackers
wat ?!
you are making no sense
 
@tereško Oh. Got it. So you have e-vote system?
 
wat ?
why our voting system would affect russian elections ?
 
does any country do e-voting for elections?
 
6:59 AM
Stupid usa.
 
@Jack i think estonia has that as an option
 
And that moment someone asks to please make a change on a project, now the whole DB needs te be changed -_-
 
cool ... personally i don't feel much for it ... it's so dehumanizing :)
then again, low turnouts aren't great either.
which is why they should make voting compulsory =D=D
 
@tereško sorry I thought russians wanted to interfere elections in Latvia. But you have meant political debates get hot during russion elections and radical nationalists attack baltic computer systems.
 
yes
 
7:02 AM
about that tatiana story and the "magic" city. It is not magic, tatiana (yuri) and friends make the base financing then comes bigger ops like credit card frauds id theft etc.
@Duikboot I will not lough to that. I feel sorry for you.
 
@Ihsan Sunny today ;) @everyone, how do I crawl a php page, if my code encounters a link, I want to crawl the page entirely, again if it encounters any link, again crawl those, any Idea how do I redirect it? as of now I am managing to crawl a single page, I want the script to be smart
@Ihsan You reminded me something when I read latvia, I forgot to buy this coin
 
@Ihsan those are common names in the area: it's like you would be talking about Jane and John ...
 
Hold targets in a list, mark crawled ones, if you encounter a link look list if you did not crawled it (unmarked) add it to list and follow the list one by one.
 
@Mr.Alien different country , we have this
 
@tereško Exactly. The names were examplary. I was stereotyping.
 
7:06 AM
I've just 4 lines of code which is extracting links, I don't understand how the hell do I read the links and use those in file_get_contents()
@tereško LOL
 
@tereško Nice.
 
@Mr.Alien actually, there are several options
and those are common coins .. which is kinda why most of people want to avoid switching to euro .. our's looks better
 
@tereško Beautiful. Nice country with a sense of humor.
@tereško Correct... and a perfect decision.
 
well .. there are other reasons, but that one is only one which appeals to me
 
morningz
 
7:15 AM
Sorry I had a mistake.
1) Hold targets in a list,
2) First push the entry page to the list.Crawl it.
3) if you encounter a link add it to the list if it is not already in the list.
4) Mark pages in the list as crawled when you finish crawling them.
5)Crawl to next entry in the list, goto3
@Mr.Alien you will have sth like http 301 in redirects etc be careful.
 
@Ihsan gotta be careful with this stuff; this can also lead to infinite crawling ;-)
 
This is horrible I have to change from the lowest part to the one in the top
 
@Jack List in theory would avoid that. But there are sites that form infinite pages...Anyway @Mr.Alien will be rich soon. He is crawling the web. He will establish the new google in India... :D
@Duikboot just give me one more level of abstraction, I can move the world....
 
@Ihsan Yeah, it's in the generated links that prevent caching :)
 
How you mean @Ihsan? ( Don't understand you reply totally :P )
 
7:26 AM
@Duikboot It is a joke. Actually If you have layers of abstraction for functionalities theoretically you just change the positions of layers and you are done but this does not work every time. And the reply is a pun of overdosing this... like using MVC for a brochure site etc.
 
Oh :-)
Yeah now I have to change a lot :/
I think I might create an other db_table with client_partners
Wich holds the multiple partners for 1 client.
 
@Duikboot Do not use static classess
As far as I can understand a partner (1,2...) can have 4 kinds of forms.
 
@Ihsan That's like saying: don't use an iron (to make a phone call).
 
@Jack but I know he uses it. lol btw.
 
:D
no
@Ihsan The admin creates a client ( orange one) the admin generates a partner form. A client can login and select his project and fill it in and save it.
The admin can add as many dynamic forms as he wants.
the old structure was almost done but now I have a feeling I have to change a lot.
 
7:32 AM
@Duikboot oh ok the forms table holds all forms...
 
it's not that much more work really .. just one more level of indirection.
 
so you will just add a partner no field as index to the forms field.
 
that was what I was thinking too.
 
and you will build a new partner table
 
but my names are different
in my database that can issue some confusion.
 
7:34 AM
make it programmatically modifiable.
Then when the boss says add this field or add new xxx you will say oh that is haaard give me 2 days. then do it in 5 minutes and at the end of the 1 st day say I did it before schedule... :)
 
Yeah true :p should learn to program with more logic
 
@Ihsan Ok I got a way, I've 2 regex, 1 for links, 1 for email, I scan the links, store in db, I scan the emails store in db, I fetch the links on other alteration, use that to redirect, and again I store the other links, and this cycle goes on unless and until I stop
 
and add to the com_projects a com_client_id
 
@Duikboot I told you before, you are on a wrong track, you should be a graphic designer
 
I am actually too.
:-)
 
7:37 AM
@Mr.Alien +1
 
But I want to learn to code better.
 
@Duikboot Stick to it, and make things better in graphics :p
 
@Duikboot I am amazed with your performance. You are new to all this.
 
@Duikboot You use spreadsheets to create database models??
 
Yeah but I want to become much better today I'll receive my code clean
book :)
yes :P
most of the time just paper.
 
Try using MySQL WorkBench, it's free and useable.
 
yiz
How to put a newline in a log in a PHP script?
I did this:
        $logStr = '$result is: ' . $result . '\n';
 
@tereško Close on what basis?
 
yiz
This is what's printed in the log:
$result is: {"multicast_id":4754312130390130762,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}\n
 
@Mr.Alien off-topic .. my vote has been revoted there
 
7:40 AM
@Mr.Alien you don't jump into links before finishing current page I hope.
 
@yiz Use double quotes around \n
 
@yiz It will work perfectly but for viewing in all platforms use \r\n.
 
Or PHP_EOL.
 
@Ihsan I've just an idea, I'm at work now, will work on this after am hom
@tereško Done
 
@Ihsan You didn't notice her \n is inside single quotes, i.e. '\n' vs "\n" ? :)
 
7:41 AM
@Jack lol.... I did not...Sorry...
 
yiz
@Jack Thanks, double quote worked
@Ihsan you mean on windows
interestingly PHP_EOL doesn't work on the web browser
 
Yes for viewing on win unix and mac sanely use both...
 
yiz
I was dumb
should used <BR>
 
Ok :) but my idea to hold that client_id is good ?
I only have to use it in the com_projects table I think.
 
@yiz </br> if on browser
 
7:43 AM
@Ihsan go and drink some coffee first ... it's <br /> =p
 
@Ihsan '\n' will be treated as literal and "\n" as new line
 
@Mr.Alien really? ... gee... I know it for sure but I did not see it...
 
@yiz Is that PHP or something else?
 
@yiz or nl2br() :)
 
@Ihsan Yap, I prefer "\r\n"
@Jack Ya I was going to suggest the same that's why I asked here that was that perl or what
 
yiz
7:45 AM
@Mr.Alien PHP to print newline on the web browser. "\n" & PHP_EOL won't work
 
@yiz If you need just 1 use "\r\n" and if it's like say textarea, use nl2br
 
@Jack I hate <br /> I also hate </br>...
 
Yes, PHP_EOL is ostensibly used to find the newline character in a cross-platform-compatible way, so it handles DOS/Mac/Unix issues. Source: stackOverFloew
 
@Ihsan only one of them can be hated, the other doesn't exist.
 
@Jack Inexistent but working anyway... XD or lemme look
 
7:47 AM
Did anyone red here the following book? I will start reading it today,
http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882
 
Hello
 
yiz
To complicate things, I suppose to pass the result to iPhone/Android so the newline is just for making debugging easier
 
That's part of the problem. I don't know which query it is.. — KriiV 3 mins ago
 
Hi! @Hamza
 
sigh
 
7:47 AM
@Jack Glad @Ihsan Is not using <br></br>
 
@Ihsan of course, something that doesn't exist will always work and not work at the same time.
 
@Mr.Alien Oh sorry @Jack you are right... Coffeee more coffee....
 
<br>this is a line break</br> :)
 
<br />
 
7:49 AM
@Jack We have an idiom for this "I forgot the bigger donkey at the barn"... I am really ashamed...
 
@Jack lol
 
@Duikboot Aaa see there, you are a coder now -> <br />
 
haha :p
 
@Duikboot See you are a better coder than me ... Now...
 
7:52 AM
I really want to become a good PHP developer and will learn hard to become better.
 
@Duikboot You lack patience
:p
 
@Mr.Alien he does not.
 
@Ihsan Yes he does :p
 
@Duikboot You are on the right track... You read, you ask, and best of all you are having hands on experience (trouble).
 
@Duikboot Yea, you'll take some time to learn so don't be in a hurry
 
7:54 AM
Im absolutely not in a hurry :-) but Im doing nothing else actually day in day out learning PHP.
Actually php is going okay, but mysql is harder for me.
relational stuff
With php I also make stupid mistake like oh I forgot to do an execute() in a loop... that's just stupid.
 
f*ck... what is the use of $_SERVER if it is reporting fuzzily...
 
@Ihsan These 4 lines and I get all emails on the page :p
$page_string = htmlspecialchars(file_get_contents('http://domain.com/'));
$pattern = '/[a-z0-9_\-\+]+@[a-z0-9\-]+\.([a-z]{2,3})(?:\.[a-z]{2})?/i';
preg_match_all($pattern, $page_string, $matches);
print_r(array_unique($matches[0]));
 
humm... I look to my ancient treasure chest...
 

« first day (957 days earlier)      last day (4007 days later) »