« first day (788 days earlier)      last day (4176 days later) » 

7:00 PM
@webarto what code is that
 
@Baba Basically coding PHP4 style in PHP5.3+, etc. I mean, experience means nothing if you don't improve yourself, maybe even daily...
 
@webarto :)
 
@webarto Sadly true.
 
@webarto 100% correct
 
@webarto You've got mail
 
7:06 PM
@MikeB Service Juridique? :)
Wow, how many pings :P
You were in spam.
 
wtf
Oh.. probably cause it was just a few words and a link
 
Really, Gmail marked it as Spam, even you've sent from Gmail. Not a Spam I said.
I'm thinking because of the word "ways" and link :)
100 ways to get rich, bigger [insert organ here]
Thanks for the link ;D
 
Even if you don't agree with it.. the more you know
 
what is better .. making it JSON and just use json decode
or stick with explode
 
@MikeB I agree, but I wouldn't do that if the other answers don't really deserve it. There isn't a cure for this, right? :)
 
7:15 PM
@grasshopper you can ask here
 
I mean, without exposing downvoters, they can make some bot functionality, but that is not reliable.
@Baba webarto.com/62/random-sentence-spinning-function It's an interview question... Is this my site... damn... better delete it :D
 
@MadaraUchiha kk, so what do you recommend instead of CI, other framework or pure PHP?
 
@webarto ... lol
 
@grasshopper People >>> technologies
 
@MikeB I failed to decode your message
 
7:19 PM
@Baba yet ... i am kind of newbie ...comparison to you guys ..i use json only where ..where i have to... might be silly
 
 
rm -rf *
 
:)
 
@grasshopper Use what you, and/or your team, is already familiar with when starting a new project
 
@Baba I thought that was cool, back in 2008 :D
 
7:22 PM
@webarto guess as much when i saw srand((double)microtime()*1234567);
Note: As of PHP 4.2.0, there is no need to seed the random number generator with srand() or mt_srand() as this is now done automatically.
:)
how would you have written it now ?
 
Meh, what did I know... webarto.com/39/sql-injection-example this is how I passed some exams in college :D
 
That was bombz, brought many sites down :D
 
on a side note, do you all work for companies? or do some of you make your living with a whole bunch of sites?
 
@webarto i have tried in my college got success but .... my dam luck they are doing manually .
 
7:25 PM
@NullPointer :)
 
I'm not fond of cubicles so was wondering if some of you have succeeded with the latter
 
Good old days ..PHP Calculate Percentage : webarto.com/29/php-calculate-percentage
how would you have written the lotto generator now ?
 
Give me few minutes.
 
Ok ...
@NullPointer like to see yours too
 
@Baba ??confused
 
7:30 PM
that was a long time ago
how do you think its best to implement it today
 
@Baba plonk
 
@PeeHaa ... at last .. you are free
 
Evening all
 
good evening @PeeHaa
 
i hear your boss kidnapped you
 
7:32 PM
@Baba Yes I am. Just got home. It's friday today for me :)
 
@hakre hi
 
@Baba Yup. Kinda :(
@hakre hola
 
@hakre ..... lol
 
@hakre Do you think it is more sane to write wrapper for $wpdb then do global in each function :S
class DB
{

    public static function get_results($query)
    {
        global $wpdb;
        $query = self::set_prefix($query);
        $result = $wpdb->get_results($query, ARRAY_A);
        return $result;
    }

    public static function query($query)
    {
        global $wpdb;
        $query = self::set_prefix($query);
        $result = $wpdb->query($query);
        return $result;
    }

    public static function set_prefix($query)
    {
        global $wpdb;
        return str_replace('wp_', $wpdb->prefix, $query);
Don't laugh, it was ages ago :P
 
@webarto The only thing that is "prepare" is the name of the function. And nothing else. After using it for years it looks like they think now that it is doing prepared statements.
@webarto dependency via global. nice ;)
 
7:37 PM
@hakre I'm really curious what will they do about mysql_, I bet one big saucy @ :)
 
@webarto I don't want to laugh, I want to throw up, but I guess that's ok :P
 
@MadaraUchiha .... hi
 
@Baba Hey
 
@MadaraUchiha how are you doing ?
 
@Baba I'm great, how are you?
 
7:39 PM
@MadaraUchiha I made this to avoid all of the nonsense, like writing SELECT * FROM $wpdb->prefix ... horrible.
 
@MadaraUchiha .... Mixing some vodka with PHP seems to be working for now
 
`DB::query("DROP TABLE IF EXISTS wp_mobile");`
vs
global $wpdb;
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}_mobile");
 
lol
do i have to choose ?
 
7:53 PM
@tereško It is WP we are talking about :P
 
0
Q: How do I stop a PHP script running on the background

user1898904I started this process (time.php) <?php ignore_user_abort(true); // run script in background set_time_limit(0); // run script forever $interval=300; // do every 1 minute... do{ // add the script that has to be ran every 1 minute here // ... $to = "xxxxxxxxx@gmail.com"; $subject = ...

lol
you get to see a lot of interesting script and you ask your self .. How did this person get here
 
@Baba something like this pastebin.com/qSXbaB0a not very sure...
 
@salathe Nice!
 
Can you share what is it, with us mortals :P
 
8:01 PM
 
@webarto Go to any php manual page (your local mirror might not have updated yet)
 
@webarto .. interesting .. but i think it can be better
 
@salathe Oh, nice, epic...
@Baba Feel free to share :)
 
@webarto one moment
 
@salathe Shiny!
 
8:03 PM
Does it have flood protect, and stuff? I mean, can we see the code somewhere :)
 
Just going to modify your a bit
 
night guys...:)
 
@salathe Great, didn't know which repo is it, or where is it. Thanks!
 
Officially it's git.php.net/?p=web/master.git but github is much prettier
 
8:12 PM
Sure is.
 
@webarto eval.in/4488 slightly modified version
main idea is to completely remove mt_rand
and while loop
in_array would also no longer be needed
Multiple algorithm can also be used
 
I understand that totally, it's just that I'm more loops and if's guy. Nice solution indeed.
Your solution is far superior.
 
I think yours is cool ... still using your code .. just a little modification .. its still all yours :)
 
I really like algorithm implementation.
 
The Fisher–Yates shuffle (named after Ronald Fisher and Frank Yates), also known as the Knuth shuffle (after Donald Knuth), is an algorithm for generating a random permutation of a finite set—in plain terms, for randomly shuffling the set. A variant of the Fisher–Yates shuffle, known as Sattolo's algorithm, may be used to generate random cycles of length n instead. Properly implemented, the Fisher–Yates shuffle is unbiased, so that every permutation is equally likely. The modern version of the algorithm is also rather efficient, requiring only time proportional to the number of items bei...
 
8:26 PM
1
Q: Split array into half with equal or approximately equal array sum

webartoProblem: Array with numeric values needs to be split in half with approximately equal or if possible equal array sum. Number or order of elements in arrays is not important. $probabilites = array(0.4, 0.15, 0.1, 0.1, 0.2, 0.2, 0.3); # 1.45 $probabilites[0] = array(0.4, 0.15, 0.1, 0.1); # 0.75 ...

 
@baba: what are you trying to do?
 
@Baba I tried to made this graph with PHP, it's en.wikipedia.org/wiki/Shannon%E2%80%93Fano_coding, I failed at some point :)
 
@ircmaxell try to see if i can improve on pastebin.com/qSXbaB0a
@ircmaxell final output eval.in/4488
 
hrm...
I'm not sure the shuffle will get you what you're after
 
@webarto as a data type or .. you really want to draw it
 
8:28 PM
wait, I'm an idiot, yes it will
I was thinking of a different algo
 
@ircmaxell any better idea ... :)
Which one ?
 
no, I was thinking of an algo that unbiases biased random input
which wouldn't be applicable here. But you don't need that
 
@Baba Calculate everything of course, and then draw it on client side (JSON), or make a table with PHP (somehow) :) visualize is the word I think...
 
Lol hi.
 
@ircmaxell oh .. what algo where you looking at
 
8:30 PM
let me try to remember the name
 
google.com/search?q=shannon+fano various representations...
 
@webarto does not look difficult i can easy cheat with good DataTypes from github.com/olekukonko/PHP-Datastructures
 
Right, forgot about that grayscale kitten work.
 
@ircmaxell the closest one to Fisher i know is Sattolo ... but me know when you remember yours .. like to explore
 
brb
 
8:41 PM
@webarto what are you using to draw the chat
@ircmaxell ok
 
@Baba I forgot, to be honest. Sorry for bothering you with my nonsense ;)
 
@webarto .... its ok
1
Q: Split array into half with equal or approximately equal array sum

webartoProblem: Array with numeric values needs to be split in half with approximately equal or if possible equal array sum. Number or order of elements in arrays is not important. $probabilites = array(0.4, 0.15, 0.1, 0.1, 0.2, 0.2, 0.3); # 1.45 $probabilites[0] = array(0.4, 0.15, 0.1, 0.1); # 0.75 ...

lol
Knapsack problem usually mistaking for Sun of Subset or Con Change Problems
 
I couldn't figure it out, and it was that simple...
 
answered one crazy one here once
hold on
 
@Baba How old are you? You seem wise :P
 
8:48 PM
@webarto 38
13
Q: Calculate which products together would deliver the requested power

Bob KruithofLet's say I've got three products: Product A Will deliver 5 power. Costs 50. Product B Will deliver 9 power. Costs 80. Product C Will deliver 15 power. Costs 140. I want to know what combination of products I could buy when I need 7 power. I could buy two of A but one of B is cheaper. When I...

That question was suggested for Knapsack Problem
true & false
 
Only 4 upvotes to such an awesome answer, sad... well, 5 now, heh.
 
true because I want to know what combination of products I could buy when I need 7 power. I could buy two of A but one of B is cheaper.
@webarto and false because I am looking for a way to calculate the possible combinations of products for the given amount of power I need.
 
@webarto Your link is dead
I've tested it couple of times and it works as expected.. pokit.etf.ba/get/500b563910d333cd07739b48a4256c38.pngwebarto Jul 20 '11 at 8:36
 
@webarto most people don't vote what they don't understand ... :)
 
Unless you feel a 404 is expected ;)
 
8:51 PM
@PeeHaa You know, I actually sat down, and tried to make a SS tool in Visual Basic... I got sick of 404 after few weeks...
@Baba If you had written it in jQuery it would be 4 figures now :P
 
@webarto ... lol
 
@DaveRandom How come git diff hates you that much?
 
@webarto the answer looks good ... hope it worked for you
@PeeHaa no beer today
 
@Baba Just opened the first of many. Going to Germany tomorrow so better be prepared
 
@PeeHaa .. u have never disappointing me once
-2
Q: Making lorem ipsum generator in php for my local language

Bohdan HdalI need to create lorem ipsum generator for my ukrainian language. Please help to find examples, how to make it in php-code. Thank you.

 
9:01 PM
@Baba Why do you need to make it in another language? It's already nonsense.
 
@SomeKittens what do you expect from such type of crazy question .... :)
 
but really i could not stop laughing the first time i saw the meaning of Lorem ipsum
 
@Baba Yeah, that was funny
 
@ShaquinTrifonoff even in English can seem to understand what it means
 
9:10 PM
Damn. Soundcloud's interface sucks :(
 
-6
Q: Migrating from PHP to ASP

Mehdy AmazighI wanted to ask if my PHP skills will really be useful, I feel a bit guilty having learned PHP, as ASP. Net seems a little more appropriate for what I do now (and as C# is faster than PHP from what I've read), I would like to learn both at the same time, do you think it is possible, is it really ...

 
9:28 PM
A randomness extractor, often simply called "an extractor," is a certain kind of pseudorandom generator which, when applied to weakly random, high-entropy sources (such as radioactive decay, or thermal noise), generates a highly random output that is uniformly distributed. The only restriction on possible sources is that they are nondeterministic to the extent that there is no way the source can be fully controlled, calculated or predicted. For a given source, a randomness extractor can even be considered to be a true random number generator (TRNG); but there is no single extractor whic...
 
@ircmaxell interesting ... one moment
@ircmaxell i see why you say its not relevant in the previous code ....
Nice Technique ...
Removing the bias from a stream of random digits
you can easily do mutation efficiently in a genetic algorithm with this
@ircmaxell .. thanks good one
@ircmaxell have you implemented in PHP before ?
 
No, I've ripped a php implementation before though
 
9:43 PM
you still have the implementation ? ... so that i don't have to reinvent the wheel
@ircmaxell do you still have the implementation ?
 
no
 
Oh ok .. then i have to start all over
its ok
thanks
 
so I had a quick question.
I have a variable that need to set to true if a test is true. so: $a = ($r==1); BUT, I want it to not unset after it's been set. So once it flips to true, have it stay there until I change it somewhere else.
I can do if($r==1) $a = true;
that'll work, I was just wondering if there was a shortcut anyone knew of
something like $a = max($a, ($r==1));
 
And how is something like that a shortcut? :P
 
well that isn't
I was just wondering if there was one
 
9:52 PM
It's not really clear to be what it is you want actually. You want something to keep some value until you don't want to keep the value ?)
 
yeah, I'm setting it in a loop, to be checked later.
just a flag
but once true, I need it to stay true
 
@Beachhouse Can't you just break out of the loop?
 
define('flag', true);
 
yeah, I can't break
 
Unable to be changed
 
9:53 PM
otherwise I would
 
I think you are trying to "obfuscate" stuff by trying to be smart. If so please don't
 
@MikeB, define can only be set once, but I'll need to clear that flag elsewhere.
 
So you need to set it, and have it definitely not change.. until it needs to
 
lol, yep :)
just not in that statement
so kinda sounds like no.
thanks anyway.. :)
 
Evening
 
10:04 PM
Hi @Dave
 
user895378
user image
2
 
user1125394
ternary counts?
 
@cyril If I have a say in it. Yes!
 
@rdlowrey uncle bob disagrees.
(just sayin)
 
user895378
@igorw Really? Uncle Bob must hate readability ... I know I don't remember that in Clean Code -- do you have a reference by any chance?
 
10:12 PM
@PeeHaa Pardon?
 
user895378
I still use ternary every now and then but only if what's happening is exceedingly obvious ...
 
@rdlowrey it was in one of the cleancoders videos, not sure if it is mentioned anywhere else.
 
@DaveRandom You always seem to get github confused with your commits :P
And you are forgiven :)
 
@rdlowrey I have @edorian mentioning it here: stackoverflow.com/questions/8057785/… does that count as proof?
 
wth.. when did they change the gist site?
 
10:15 PM
@Neal Couple of days ago
 
@Neal at least 100 years ago
 
user895378
@igorw lol he's pretty authoritative, actually. I don't like it though -- makes it too easy for a maintainer to flub something without realizing it.
 
@PeeHaa hmmm weird that I just got the change today
 
@rdlowrey stark?
 
it was the old site this morning
i think
 
user895378
10:16 PM
@twiz Sorry, it's a reference to the fantasy book series, A Song of Ice and Fire
 
@PeeHaa In what way? Looks fine to me... or is it one of those diffs where apparently the whole file has been changed when I've only modified a couple of lines? I do seem to provoke that a lot somehow...
 
Perhaps I get the new stuff sooner because they like me more ;)
@DaveRandom that :D
 
@rdlowrey if you have a policy of only one single function call in any given for or if body then it makes absolute sense. but I'm not going to argue over right or wrong here :)
 
@igorw Readability wise it doesn't really imho. Ow wait you said not arguing ;)
 
user895378
@igorw You're right, this is definitely not a right or wrong situation. It's just one of my tyrannical OCD pet peeves :)
 
10:19 PM
@PeeHaa I can only assume it's re-ordering things that does it. Or maybe, as you say, git diff just hates me.
 
> they were too similar to the files in a Git repository.
Well fak you :(
 
user895378
Well that was very kind of github to suggest Amazon S3 as an alternative.
 
paid alternative
lol
 
user895378
Maybe whomever was in charge of the file upload API gave them the finger and quit last week and they were just like, "screw it, kill that functionality"
 
@rdlowrey only for conditions :P
 
10:42 PM
I guess it was kind of open to illegal file sharing abuse and SOPA etc targeting, but still. People who are caused great confusion and pain by the fact that source code can have random files attached can suck my hairies anyway.
 
@DaveRandom Doubt that is the reason. Probably just a way of defending killing feature they thought they could ditch without much revolt
 
user1125394
(rand(1))?{
    echo 'heads';
}:{
    echo 'tails';
}
 
Well, despite the minor distribution setback...
Helper 0.20-beta2 for Chrome and Firefox is now available. All feedback to the issue tracker for cv-pls please.
5
@PeeHaa Unpin/Repin if you would be so kind ^^
 
user1125394
11:09 PM
version 0.002 beta 2 , adopt Chrome exponential versioning rules rather :p
 
Since Google don't seem to like the idea of a version string with non-numerics in it, I have been toying with the idea of making even numbered minor versions full releases and odd numbers development releases in future, like Apache HTTP. But at the same time a good rule of thumb is "if Apache does it, don't do it" so maybe not.
2
 
What is OP asking here?
0
Q: On the use of PHP json_encode for an array

sepoto$cnt = 0; while ($row = $result->fetch_assoc()) { $arre[$cnt]['id'] = $row['idevents']; $arre[$cnt]['title'] = $row['title']; $arre[$cnt]['start'] = "new Date(" . $row['start'] . "*1000)"; $arre[$cnt]['end'] = "new Date(" . $row['end'] . "*1000)"; $arre[$cnt]['allDay'] = $...

 
@PeeHaa Sounds like a code review request, with not nearly enough info to reasonably review it in a way that would be useful to him.
If I see a question that starts with code, zero pre-amble, it's usually a good sign that it's NARQ.
 
11:44 PM
@Leigh Answering the exact question the OP asked instead of the one they should have asked.
 

« first day (788 days earlier)      last day (4176 days later) »