« first day (1056 days earlier)      last day (3908 days later) » 

12:00 AM
It's no sleep Friday!
w3schools is bad and you should feel bad... — webarto 11 secs ago
Tonight on SO:
Q: X doesn't work, help
C: Works for me, (*fiddle.com link)
A: (unrelated)
 
12:26 AM
Hi
 
0
A: Using PHP to split a string

webarto$str = 'ubuntu1204gui Client myurl/token=something1 windows7 Gateway myurl/token=token=something2 ubuntu1204gui Server myurl/token=token=something3'; $arr = []; foreach(explode(' ', $str) as $key => $value) { $arr[(($key + 1) % 3)][] = $value; } var_dump($arr); Output array (size=3) 1 =>...

At least I'm honest.
Hi
 
OOP is incredibly annoying, but it is good too.
 
No pain no gain.
 
12:42 AM
Sometimes, pain in programming is just annoying. For even little things.
 
Not sure what your feelings are.
 
@TheGuyWhoCouldn'tTalkToTheGirl , tell us about your problem
 
He describes his problem in username and you still ask him? :P
 
lol
Its not really a problem. I have talked about this with many different people, right now I was just putting code here and there. It was incredibly messy, not cleanly structured, got complicated at times and there was a lot of copy/pasting. I decided I need more structure and so I thought I will go with OOP approach, but its confusing as to what should be an object and how it will all work out.
 
@webarto zing
 
12:48 AM
zing bro
 
@TheGuyWhoCouldn'tTalkToTheGirl Well, how exactly are you confused what should be an object or not?
 
@TheGuyWhoCouldn'tTalkToTheGirl , raw.github.com/wiki/loopasam/schema/images/…
 
Because I don't feel like wasting time thinking about how everything should work out.
Anyone here use XAMPP or know much about it?
 
@TheGuyWhoCouldn'tTalkToTheGirl , do you have any question about?
 
Yes, how would I go about hosting multiple websites on it?
I don't want to keep changing the config file to switch between sites.
 
12:56 AM
@TheGuyWhoCouldn'tTalkToTheGirl , did you check google? google.com/search?q=xampp+domains
 
1:25 AM
 
1:54 AM
Repwhoring is low tonight...
 
@webarto , why do you need more privileges?
 
Yay.
@sectus So I can continue with my evil plans.
No reason, it bugs me.
Stackoverflow is sad nowadays.
 
What are some good examples of some very good designed html/css/etc. sites designed that have good user experience?
 
2:20 AM
I'd put my vote on icloud.com looks nice, (fails miserably on JavaScript disabled -- so -1 on user experience)
 
3:06 AM
 
user652649
hello
 
user652649
@Jack stop badge-whoring around!
 
lol ... it's from some old answers actually.
 
user652649
:P
 
You're getting close to earning a js badge actually :) 13 more ups
 
user652649
3:12 AM
ah, i don't care at all
 
uhhuh
 
user652649
the only reason to get rep, is using it for bounty
 
user652649
i have a question, i'm making some scripts for manipulating colors (rgb hsl etc)
hue of hsl goes from 0 to 360.
 
user652649
so i get integers that can be for example "-10" which is equal to 350
 
user652649
3:14 AM
or i can even get 370 which is equal to 10
 
user652649
how can i normalize these integers to be in the 0-360 range?
 
user652649
i'm doing with while() now but i think it's crap :P
 
$x % 360?
but that won't work for -ve
 
: )
 
user652649
what's -ve? negative numbers?
 
3:16 AM
yes.
 
user652649
ok, yes
 
dirty hack ($x + 100*360) % 360
 
(360 + $x) % 360 comes closer, but not if $x < -360 :)
 
user652649
@sectus very dirty :P
 
user652649
anyway i don't think i will ever do 100 color turns, so it's good enough if you don't have other suggestions :P
 
3:21 AM
($x < 0 ? 360 : 0) + ($x % 360) .. that should do it.
 
user652649
but not if $x < -360 ?
 
($i % 360 + 360) % 360
 
-370 => 350 ... correct isn't it?
@sectus Hmm that might actually be it heh
 
($x + 360) % 360
 
@Jack , now we need to do perforamnce tests.
 
3:24 AM
@webarto $x = -370;
 
user652649
@webarto zzup :P
 
wazzaaa
 
user652649
@sectus lol, just caring of writing sensible math xD
 
@Jack What's expected output? :P
 
@webarto 350
Because the -10 should wrap around.
 
3:28 AM
$i % 360 + 360 ?
 
@webarto $i = 350
 
nope, fail
 
user652649
round((abs($x)+360/2)/360)*360;
 
yup
 
user652649
i guess [...]
 
user652649
3:32 AM
/brain dead
 
@Wes Doesn't work for -360.
 
user652649
(-370 + (round((abs(-370)+360/2)/360) * 360)) % 360
 
That gives 350 for i == -360
And also, wth!
 
user652649
nope
 
user652649
(-350 + (Math.round((Math.abs(-350)+360/2)/360) * 360)) % 360
 
user652649
3:36 AM
returns 10
 
And it should be 0 :)
 
user652649
-350 is 10
 
user652649
var deg = -350;
console.log( (deg + (Math.round((Math.abs(deg)+360/2)/360) * 360)) % 360 );
 
user652649
right?
 
let me check.
yes, it's correct :)
 
3:39 AM
($i % 360 + 360) % 360
 
@webarto That was already mentioned by @sectus :)
 
eyes ... no see ... blur
 
user652649
@Jack no, it's different, @webarto one seems to be correct lol
 
@Wes It's the same.
 
2 mins ago, by webarto
($i % 360 + 360) % 360
 
user652649
3:42 AM
((-10-350-360-100) % 360 + 360) % 360
 
user652649
correct
 
18 mins ago, by sectus
($i % 360 + 360) % 360
 
user652649
yes i just saw lol
 
Yep
 
it's different, because I CTRL+K'ed it.
 
3:42 AM
ah of course.
 
user652649
garbage(deg + (Math.round((Math.abs(deg)+360/2)/360) * 360)) % 360 );
 
user652649
thank you all
 
thank you, come again
 
user652649
 
Okay, and for the performance results .... drum rolls .... ($a % 360 + 360) % 360 is the "fastest"
 
user652649
3:44 AM
lol
 
we knew that already :P
 
@webarto The results are quite close I should add.
At 1M iterations: 2.55s vs 2.50s
 
It's basic arithmetic more or less, shit's optimized.
 
Oops, forgot to mention I've only considered my function and that one :)
function mod1($a, $b)
{
    $m = $a % $b;
    return $m < 0 ? $m + $b : $m;
}
Wes' solution came at 4.33s :)
 
Friday morning.
 
user652649
3:55 AM
@Jack did you actually test it? lol
 
user652649
@Jack my solution was crap indeed xD
 
user652649
lol
 
0
A: Substring each line of the string

JackIntroducing strtok() $text = <<<EOM 0100014746510106200140001020061780000000041666670072860103508101 0100008030950106200270002020139450000000020000006663540105338500 0100004586400106200270002020206660000000003700000511890102603900 0100008204530106200270002020218320000000011666670014450101008906 ...

I like strtok() :)
 
Introducing?
Has not it been here for a while?
 
4:08 AM
It has ... but not many people use it :)
Also, it's more of a stylistic choice than technical formality :)
 
Oh, ok.
 
Like, if I introduce you to my wife; she has been around for a while but you may not have met her :)
 
Got it. ;)
 
@Jack Why you wanna go pick on my answer .....
 
Time to go to office. See you later.
 
4:11 AM
@Orangepill c'mon, it's Friday ... and you know, it's a one-liner :)
I've reciprocated your vote fwiw :)
 
I like version with preg_match
 
@Jack I don't deserve it ... my solution probably has the biggest memory footprint of all of the correct ones posted.... yours is superior in every way.
 
I've thought about that as well ... but for something simple as this, I'd rather stick with string functions.
 
@Jack how about ($i + 720) % 360?
 
@Orangepill It's not worse than some of the other answers :)
@webarto $i = -721 :)
 
4:14 AM
blah
 
@webarto , you could use recursion.
 
that brought good to no one
 
function mod4($a, $b)
{
    if ($a < 0) {
        return mod4($a + $b, $b);
    } else {
        return $a % $b;
    }
}
See how beautiful that is?
And it's still faster than @Wes math code ;-)
 
user895378
@Danack sorry for my slow response time on auryn stuff. I've been up to my ears in pthreads server awesomeness for the last couple of days. Hopefully I can address your PR tomorrow.
 
user652649
@Jack ye ye i got it i got it xD
 
4:29 AM
haha
 
0
Q: Stop page from reloading?

user2752988I'm developing an interactive Periodic Table for an assignment. I have the info for most of the elements in a table in a database, and clicking on the element queries the database and displays the relevant info for that particular Element in a table at the bottom of the page. Not every element in...

> www.abusemynipples.info
6
 
LOL
 
user895378
outstanding.
 
user895378
Question link of the day goes to @webarto
 
user652649
 
4:39 AM
mornin
 
user652649
morning
 
@rdlowrey So honored! :P
 
Anyone familiar with processing robots.txt?
 
how i can remove footer link from template... anyone can help me.
<?php /*
        All links in the footer should remain intact.
        These links are all family friendly and will not hurt your site in any way.
        Warning! Your site may stop working if these links are edited or deleted

        You can buy this theme without footer links online at newwpthemes.com/buy/?theme=creativ
    */ ?>

    <div id="credits">Powered by <a href="http://wordpress.org/"><strong>WordPress</strong></a> | Theme Designed by: <?php echo wp_theme_credits(0); ?>  | Thanks to <?php echo wp_theme_credits(1); ?>, <?php echo wp_theme_credits(2); ?> and <?php echo wp
 
posted on September 06, 2013 by bjori doesn't blog

Turns out; The title of the blog is completely true.. I really really don't blog :) Since my last blog entry, just over 2 years ago, I.. Left my job at Redpill Linpro Moved from Oslo to London Joined 10gen (now MongoDB) Moved to San Francisco Got married Moved to Menlo Park ..and now I'm expecting a female ninja early next year.. That is a good chunk of life changing events crammed i

 
4:51 AM
@CoolBoy Are you asking how you can steal a template without paying for it?
 
@Orangepill not that... i want to remove this link only...
 
> All links in the footer should remain intact.
These links are all family friendly and will not hurt your site in any way.
Warning! Your site may stop working if these links are edited or deleted

You can buy this theme without footer links online at http://newwpthemes.com/buy/?theme=creativ
@CoolBoy ^^
is there a way for a closure to call itself to implement a recursive array_reduce?
 
@Orangepill you repwhore. :P
 
5:06 AM
@YogeshSuthar which one?
 
@Orangepill in rep points. you have 15.6K. Its near to me 16.7.
 
@YogeshSuthar My whoring days are over... I got a lot the first couple of months I was here before Gordon spanked me and told me how not to be a douchebag :D
 
@Orangepill ohhh that's good for me. :P
 
@YogeshSuthar I've been slutting it up a little just because I can smell php gold.
 
@Orangepill Go for PHP gold badge and then stop repwhoring, just as I did. :P Now I am moving for Android, so busy in learning it.
 
5:30 AM
so noone knows if it is possible for an anonymous function to reference itself (call_user_function(__FUNCTION__, $a)) doesn't work as a closure is a object. self doesn't appear to have any meaning inside of a closure.
 
@Orangepill I have done this before.
Let me try to remember.
I believe you can take itself via reference.
 
It's a purely academic question...
 
$anon = function() use (&$anon) {
    $anon(); // not a useful example.
};
 
@LeviMorrison works as stated...
 
It works as it must be taken via reference.
Admittedly this seems very much like a hack and may not be guaranteed by the engine.
 
5:36 AM
if I self-sign ssl certificate for debugging purpose... will it been seen as untrusted connection on browsers?
I'm using xampp
 
@user1831003 Most likely.
 
is there a way to counter it?
I need a software to make peace with local ssl certificate... but it's coming across as untrusted... =/
 
@Orangepill You mean Y-combinator?
@user1831003 You can install the cert on your browser.
Afaict you can only do this with IE.
 
Y-combiner?
 
win
3
Q: want to add colomn for sequence number(1,2,3,... etc) in jTable

winI am using jTable with PHP Language,below is the jTable with data code for jTable that i have tried... <script type="text/javascript"> $(document).ready(function () { $('#StudentTableContainer').jtable({ title: 'The Student List', paging: true, //Enable pa...

can anybody help me on this..
 
5:45 AM
@Orangepill Btw, echo preg_replace('/^(.{6}).*/m', '$1', $text); is also valid for this question
 
Can some one please help

http://stackoverflow.com/questions/18650650/automating-deployment-using-mercurial-bitbucket-php
 
morning chaps
 
0
Q: Automating deployment - Using Mercurial Bitbucket PHP

user1537158I'm using Bitbucket's POST hooks to automate the deployment.Basically whenever a commit is made to my bitbucket repository, bitbucket will invoke the script(deploy.php) i specify on my server. I'am using this script.I have modified the script to work for mercurial. What i have done : (my deploy...

 
@Jack I think yours it better
 
Thought of it on the way back from lunch ;-)
 
5:50 AM
@Jack I was referring to the strtok... but is the Y-Combiner basically the same as a tail call optimization...
 
@Orangepill In terms of intent, the strtok() is nicer, I agree.
@Orangepill There's no tail call optimization .. Y-combinator is effectively anonymous recursion.
No tail call optimization in php anyway. See also stackoverflow.com/questions/12282497/…
Though, that's specifically about array_walk() :)
 
@Jack so regardless if I use recursive functions I'm like likely to end up with something like Maximum function nesting level of '100' reached, aborting!
 
Cool huh?
Well, that's if you have recursion protection enabled.
Otherwise: crash!
 
Well ... I'm going to tap out for the night 1am here. Goodnight guys
 
Cya!
 
win
6:01 AM
@jack can you please look at this, is it possible or not..? stackoverflow.com/questions/18633448/…
 
/waked
morning all
 
@win Dunno, I've never used jTable.
 
win
@jack ok thanks..
 
0
Q: Automating deployment - Using Mercurial Bitbucket PHP

user1537158I'm using Bitbucket's POST hooks to automate the deployment.Basically whenever a commit is made to my bitbucket repository, bitbucket will invoke the script(deploy.php) i specify on my server. I'am using this script.I have modified the script to work for mercurial. What i have done : (my deploy...

 
@user1537158 You don't have to repeat your question every 20min.
 
if you want more secure site then go with java... because most banking site done using java. — kalpit 7 mins ago
Ahahaha, classic.
Let me dig around and open-source my own banking software ;-)
 
6:35 AM
how to display input field and its label in same line in cakePHP
 
@JoeWatkins Morning
 
morning
 
helloe joe :)
 
hi @Jack
 
@HenrikBjørnskov @JoeWatkins @Jack any suggestions? chat.stackoverflow.com/transcript/message/11640617#11640617
 
6:47 AM
@TheLuckyGoof Writing HTML
 
@TheLuckyGoof Don't super ping please.
 
no clue
 
@TheLuckyGoof How about reading room description first?
 
thanks, google search engine is saying Google
Sorry...
We're sorry...

... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now.

so am screwed, I just found bing is not useful
so am pinging you, as a last option/choice/trail
 
Doesn't Bing mirror the results from Google? :)
 
6:51 AM
@TheLuckyGoof but your computer or network may be sending automated queries. that's why you should not violate rules. ;)
 
i can but my view has two models like

$this->Form->input('User.email' and $this->Form->input('Seeker.first_name',
 
7:03 AM
that's a pretty good attempt at an article ...
got some mistakes in it ... but pretty good ...
 
Cool, the guy is Portuguese Japanese :)
 
it's very frustrating to keep reading about concurrent access to data ...
it cannot, by any means occur ... it's just not a problem for PHP ...
 
How isolated are threads in php?
 
completely, they behave as if they share, but they do not, all of php is share nothing, if we share we break ...
 
There's always shmem =D
 
7:08 AM
Good morning ! :-)
 
Lol, Google Translate attempted code translation too.
I like to see the mention of fastcgi_finish_request() :) it's pretty cool stuff.
 
dammit 30 minuts too late at work, I knew I forgot something at home ... my glasses -_-
 
not really, to integrate into PHP using shared memory is no good; the default memory manager, the Zend MM prohibits any context from writing any other context, that's what makes multiple threads in apache work, it's the basis of thread safety ... you cannot share variables in userspace, you can behave as if you do ... but you cannot share physical blocks of memory, it simply will never work ...
that's the beauty of it, it more or less removes the main barrier to users writing multi-threaded code ... safety ...
it's implicit in every action on the object scope, if two threads write a member at the same time, nothing bad will happen, something unexpected may happen, but nothing fatal, no corruption, no deadlocking ...
<?php
class Shared extends Stackable {
    public function run() {}
}
class T extends Thread {
    public function __construct($shared) {
        $this->shared = $shared;
    }

    public function run() {
        $this->shared->data = rand(1,10000);
        $this->shared[]=rand(1,10000);
    }
}

$shared = new Shared();
$shared->data = "whatever";

$threads = array();
while (@$thread++ < 10) {
    $threads[$thread] = new T($shared);
    $threads[$thread]->start();
}

foreach ($threads as $thread)
in most languages, this would be asking for a big load of errors, 10 threads manipulating the same member or object is usually asking for trouble, not in PHP, the user doesn't have to, if they do not want to, consider the safety of data at all, they can write read and execute whatever they like, whenever they like without even knowing what a mutex is or does ...
 
@YourCommonSense Why the constant foreboding appearances? — Jack 8 secs ago
 
7:23 AM
Well, he's a good developer and all but I find most of his open source activities pretty useless, including this class‌​.
 
in JavaScript, 1 min ago, by chintan khetiya
http://pastie.org/8302434#
in JavaScript, 59 secs ago, by chintan khetiya
is it valid // assign drop down
$(function() {
$( "#pur_cat" ).autocomplete({
source: cat_array
});
}); code inside that function
 
Anonymous
7:37 AM
Mroaning
 
Anonymous
@webarto lol
 
Anonymous
nice idea
 
mornig
 
Speaking of foreboding appearances in general - it is because SO is all about imaginary programming. People giving out advises on the matters they never had real experience with. All the knowledge here is virtual, it is just roaming from one answer to another, without any reality check. This is where my foreboding from in general. — Your Common Sense 9 mins ago
 
Friday morning @PeeHaa :p
 
Anonymous
7:41 AM
Frid\a/y
 
Anonymous
($SeoWrapper->checkErrors()) ? 'Page Not Found 404' : list($title,$content,$keywords) = $fetch;
 
Anonymous
Yeah oO
 
@Simon_eQ E_BAD_TERNARY_USAGE
 
Anonymous
7:44 AM
@Leri Nope. It's the perfect way to use it.
 
Anonymous
There are no recursions
 
And you think this is readable, intuitive, etc?
 
Anonymous
@Leri get a grip of reality. There is nothing to criticize about that line of code.
 
Anonymous
its just as simple as that
 
Anonymous
if($currentPage === 'dynamic'){
        $fetch = $SeoWrapper->getDynamicContents($conn, 'pages', "id");
        ($SeoWrapper->checkErrors()) ? 'Page Not Found 404' : list($title,$content,$keywords) = $fetch;
    }else{
          ...
    }
 
7:47 AM
Your project is yours do whatever you like. Anyway, using ternaries like this make code less readable.
 
Anonymous
@Leri If you need something more readable than THAT, then your reading is the problem.
 
hehe, ok.
 
So yesterday I made a hello world in Java and C ...
 
@Simon_eQ getDynamicContents - has side effects?
 
 if($currentPage === 'dynamic') {
    if (!$SeoWrapper->checkErrors()) {
        $fetch = $SeoWrapper->getDynamicContents($conn, 'pages', "id");
        list($title,$content,$keywords) = $fetch;
    }
} else {...}
This is what your code actually does right now.
 
Anonymous
7:50 AM
@Leri no.
 
@Leri , put $fetch getting inside second if
 
Anonymous
that is now what it does
 
Anonymous
@sectus I don't think so.
 
@sectus Yeah, forgot to copy.
 
Anonymous
this is the repo btw github.com/Eritrea/seoWrapper
 
7:51 AM
@Simon_eQ , so why you fetch before error checking?
 
Anonymous
@sectus the error checking, is to see if query from database fails
 
Anonymous
like if you are searching article.php?id=22 and no data exists for that page, the error is triggered.
 
@Simon_eQ , so there is side effect in getDynamicContents
 
Anonymous
@HamZa congrats, that was me like 3 months ago
 
@Simon_eQ Also inner if can be merged with outer as well. I just remained in a case there's something in else.
 
7:53 AM
@Simon_eQ hehe
 
Anonymous
@sectus what side effect? If query isn't found then error will be initialized.
 
Anonymous
@Leri how? without making the code cumbersome, I don't see how it will be possible.
 
Anonymous
@Leri I have been working on this for like a week, you just can't take a seconds worth glance, and hope to find a flaw.
 
Anonymous
You have to see it a little longer than that.
 
I guess we got some windows users in ... anyone want to see a windows native, multi-threaded desktop application ??
I hate windows, but that's pretty damn cool ...
 
7:56 AM
"UPDATE users SET approved= '0' WHERE email =:email "

How can I add in this statement the following :
There are ev1 ev2 ev3 se1 when the satement above is executed I want every value that is 1 in ( ev1 ev2 ev3 or se1 ) to be x.

Can I do that in SQL?
 
@tereško after our discussion yesterday I found msdn.microsoft.com/en-us/library/scsyfw1d(v=vs.71).aspx made it all a lot clearer.
 
@Simon_eQ , ok... let's say this is a 'Sequential cohesion'. What about using exception?
 
Anonymous
@sectus I don't know what 'Sequential cohesion' means, but I don't really see the need to use an exception, for this simple class.
 
@Duikboot your question isn't very clear
 
Anonymous
Maybe, I'm not getting it.
 

« first day (1056 days earlier)      last day (3908 days later) »