« first day (214 days earlier)      last day (4792 days later) » 

12:46 AM
I think it's telling me to stop earning rep on SO
 
Hah, nice.
 
Xeo
hm, can anyboby else in here access the normal SO chat? i always get a timeout
 
Heh, I have "code-formatting, preview, status-norepro"
 
@Xeo Works fine for me
 
@Xeo Seems alright to me.
 
Xeo
12:50 AM
strange
 
Chat works for me.
(Timeouts can happen more often on mobile devices)
 
Xeo
@Moshe sitting at my laptop, just clicking the 'chat' link on top of the page. loads and loads and.. nothing happens :/
 
Ah.
Anyone know about mysql?
 
@Xeo Hard refresh with ctrl + F5?
 
@TheOutOfStarsException - Are you around?
@YiJiang - You know about PHP and MySQL?
 
12:52 AM
@Moshe A bit
 
@YiJiang I've set up a connection and I'm trying to insert data into a table.
 
Xeo
@YiJiang doesnt seem to help
 
Not working...
Hang on...
 
Xeo
wait, i take that back, loaded long, but atleast I'm back into the c++ lounge, thanks! :)
 
@YiJiang - PHPMyAdmin says "#1136 - Column count doesn't match value count at row 1"
 
12:56 AM
@Moshe That means the number of columns you've specified in the INSERT statement doesn't match the number of VALUE you're trying to insert
 
Oh?
Checking...
Oh, makes sense.
I forgot to concatenate two values.
heh
@YiJiang Actually, I am not entering an ID.
How do I enter an auto-increment value?
 
@Moshe I believe you can simply leave it out of the INSERT statement and MySQL will auto-increment the id by itself
 
It's still not matching...
Hrm...
one sec
Found it
 
1:15 AM
Sup?
 
@ircmaxell I have to return a this borrowed MiFi device.
 
nice
 
@ircmaxell - But, your encryption is generating characters that interfere with MySQL
 
base64 encode it then
 
@ircmaxell I thought I did. I should base64 encode after encrypting?
 
1:17 AM
Yeah, not before
 
Oooh
 
Hrm, /dev/random is blocking quite a bit for me now...
 
Fixed.
 
Reading 1000 bytes from it is taking forever
 
er, gotta split.
cya folks
 
1:19 AM
laterz
/me is building a full blown cryptography library for PHP
 
@ircmaxell Cool, don't forget to base64 encode output ;-)
 
putting the final touches on the random string generator. The hash generator is done with the exception of legacy implementations...
They key generator is mocked up, but not finished
And then I have to implement the encryption system...
 
1:48 AM
@ircmaxell - I'm back, are you there?
 
1:59 AM
yup
 
@ircmaxell - I've got the user->DB working, I'm finishing up the confirmation stuff. Then I need to work out an admin panel.
 
cool
 
@ircmaxell For this project, I can just hard code a password, since it's one individual handling everything, right?
 
I wouldn't...
 
@ircmaxell How would you do it?
 
2:04 AM
store it properly, even in a user table if that's what it needs
 
Ok
So just make seperate table with user info... Ok
 
2:29 AM
Vote limit reached, try again in 21 hours... Heh heh heh.
I only have 20 SE sites worth of votes left for the day :O
 
What will you do with the rest of your day!?
 
frets
 
muahahaha...
 
What would happen if I stalked a random person and sockpuppeted them?
 
@mootinator You could sockpuppet me, but I'd know what you were doing, as would the SE team.
 
2:36 AM
@Moshe Indeed.
In fact, I've pretty much incriminated myself enough that doing such a thing would be pointless.
 
> Normal java using URLConnection won't accept to access the internet. If access the browser it will allow to perform a search without this exception "HTTP response code : 403 for URL"
Anyone want to take a stab at what that's trying to say?
 
Nope.
Give me a username and I will sockpuppet. (j/k)
 
:P
 
@TimStone The guy is using a browser as a "middleman" to make a connection he shouldn't be allowed to make and the browser isn't behaving as intended?
 
Interesting take, but that's not it.
 
2:44 AM
The Java program just doesn't authenticate whereas the browser has a cookie?
 
Man I go AFK for half a day and get four people all blaming/poking/asking me for stuff! o:
 
@mootinator Ah, I think that's closer actually. He's saying that the method should work if accessing the page in the browser also works.
 
0
A: can't figure the right code

StackOverflowExceptionyou are on the right track for capturing highest. you need to apply similar logic for lowest.

Oy 4k user...
 
Yay! I've got my RNG done!!!
 
Whoo! (Ric) Flair.
 
2:55 AM
Anyone know off hand if I can load the Random class in windows through COM?
 
@ircmaxell - No idea. What query dumps the info from a DB into an array?
 
well, it's a select query
 
@ircmaxell I wish I knew things like that off hand.
 
Oh, right, ok
@TheOutOfStarsException - You're back?
 
Well, what about any source of random entropy like /dev/random in Windows?
 
2:57 AM
@Moshe not really, have dinner on the stove, gtg very soon
 
@TheOutOfStarsException Oh, ok. I need some assistance please.
 
I am lacking in context.
 
@Moshe ask me quickly, gtg very soon :-)
 
@TheOutOfStarsException I've gotten the site working, just wondering why it's not reading the custom donation box properly.
There are several radio boxes, all with preset amounts, except the custom box.
If the custom radio is selected, regardless of the value, the missing data flag is raised in my PHP code.
//Set a  flag
$isMissingData = false;

//iterate through the info
foreach($unfilteredData as $key => $value){

	//echo $key . " " . $value . " \n <br />";

	//	Validate the contents.
	//	This just checks for empty values

	if(empty($value)){

		//	Check if the donation is empty
		//	If it is, check if it was
		//	the selected ticket item

		if($key == 'donation'){

			if($unfilteredData['tickets'] == '0'){

				//We are missing a donation value
				$isMissingData = true;

				echo 'tickets: ' . $tickets . ' donation: ' . $unfilteredData['donation'];
 
3:01 AM
oh, just realized...
 
sorry @Moshe I literally have dinner on the stove... :-/
 
@TheOutOfStarsException np, when you can, lemme know.
 
Stick with it,rubber duck it. throw in lots of echo s. You'll get it!
 
Thanks.
 
@mootinator Indeed, I replied to that thread
But, I'm building a cryptographic quality RNG
 
3:03 AM
Gotcha.
I cheated and connected to an .aspx page on localhost to get my random number last time I did anything like that in PHP :P
2
 
lol
So far I have between 4 and 6 random sources
(the difference being /dev/random and /dev/urandom depending on the requested strength
 
@ircmaxell - Will your library run on both Windows and linux servers?
 
That's why I'm trying to find a good RNG from windows :-P
 
@ircmaxell Was wondering, that's what I figured.
 
:-D
 
3:08 AM
I thought you were only supporting Windows... Silly me.
 
Nah
Linux, BSD and Mac are easy, since they have /dev/random and /dev/urandom (for strong and moderate strength RNG repsectivly)
 
@ircmaxell So how does that WTF page not have what you asked for? I'm still lost on that one...
// Then try the Microsoft method
if(version_compare(PHP_VERSION, '5.0.0', '>=') && class_exists('COM'))
{
    try {
        $util = new COM('CAPICOM.Utilities.1');
        $output = base64_decode($util->GetRandom($count, 0));
    }
    catch(Exception $ex) { }
}
 
that's not a cryptographically secure RNG
 
3:16 AM
I'm trying to get data of various elements of the periodic table off Wikipedia, but the API documentation feels very scant...
 
^^ That's what I was looking for
 
Aha
 
I mean, I just need to get the content of a few pages in a machine-friendly format, but I can't seem to find the right documentation page
Actually, just the infobox at the side containing the data
 
@ircmaxell - How do I do a login? One PHP page? Multiple? I'm storing info and I need to be able to: login the admin, show the data, allow the admin to mark a card as processed, and log the admin out.
 
One page should suffice. Just start a session, and check the session if it's authenticated.
if not, then show login form
if login is successful, set authenticated to a good value in the session
public function generate($size) {
    if (!class_exists('\\DOTNET')) {
        return str_repeat(chr(0), $size);
    }
    try {
        $util = new \DOTNET(
            'mscorlib',
            'System.Security.Cryptography.RNGCryptoServiceProvider'
        );
        $varient = new \VARIENT(array_fill(0, $size, chr(0)), VT_UT1 | VT_ARRAY | VT_BYREF);
        $util->GetBytes($varient);
        return implode('', (array) $varient);
    } catch (Exception $e) {
        return str_repate(chr(0), $size);
 
3:27 AM
And for processing info?
A GET param?
a=process&id=1234
 
Huh?
Sure, and post for modifications
 
How do I call the same page with post?
How do I call the same page with a post request?
Ah, a form.
 
?
ya
 
I'm in the admin panel, and the admin clicks "mark as processed"
 
right
 
3:29 AM
I want to clear the CC num and send out a confirmation email.
Is that a form?
I'm a bit confused.
 
I would assume so
 
So each "mark as complete" button is a submit button in a form. Ok.
I hope I understand you.
For now I'm throwing up the form, as it's done.
Er, one more thing, @ircmaxell - I've got an optional field, which I'd like to populate if it's blank. I'm choosing random elf names from an array, how would I do that?
$arrayOfNames = array('dobby', 'bilbo baggins', 'frodo');
What next?
$name = ???
 
Search thatt, there are a few ways
 
Ok
I assume there's a rand function
I know there's count()
So, @ircmaxell I'm guessing:
$arrayOfNames[rand()*count(arrayOfNames)-1];
yes?
 
you could
no
rand() returns an int
rand(0, count($arrayOfNames) - 1);
 
3:36 AM
Oh, ok, Googled it.
I wanted to guess before searching. Oh well.
Thanks.
 
@Moshe php.net's manual is one of the best kept documentations around; use it!
 
It's cheaper to enroll in a Photoshop class at an accredited university and buy the student edition than it is to buy the full edition of Photoshop. Interesting.
4
 
@YiJiang @ircmaxell Here are my names, any additions would be welcome:
$names = array("Bilbo Baggins", "Dobby", "Gollum", "Gendalf", "Voldemort", "Captain Kirk", "Darth Vader");
 
@Moshe Hehe, what sort of name are you after?
 
9 mins ago, by Moshe
Er, one more thing, @ircmaxell - I've got an optional field, which I'd like to populate if it's blank. I'm choosing random elf names from an array, how would I do that?
 
3:42 AM
@mootinator Technically speaking you can't use the student edition for commercial purposes, right?
 
@YiJiang Well, not just Elf names. Fictional characters.
Preferably elf/dwarf names from magical stories etc...
 
Thanks.
Any name ideas folks?
 
@YiJiang True. But if you just want it for personal use, you might as well get the class out of the deal.
 
34
Q: Careers 2.0 Featured Listing: Web company needs successor for retiring unicorns

balphaYou know what day is coming up, right? Just to get you up to speed: Stack Overflow's first April Fool's day came with glitter, cornify buttons, lots of pink, and Comic Sans. Last year, all user avatars turned into unicorn images, provided by a web service created by some weirdo with too much fr...

Some great ideas there, but still nothing that tops unicornify
 
3:45 AM
@Moshe Van Helsing, Anything involving extra Is and ls.
 
@Moshe 'Sherlock Holmes', 'Watson'
 
@mootinator I don't recognize that one.
@YiJiang good ones
 
@Moshe Oh, recognizable eh
 
@mootinator What is that from?
 
Dracula, apparently...
 
3:47 AM
@ircmaxell - $names[array_rand($names)]; this should do it, no?
@mootinator Oooohhhh.
 
sure
 
Great.
 
Anyhow, you're missing Gimli.
 
True.
 
Woot! I'm up to 8 random sources
2 Strong cryptgraphic quality
2 medium quality
3 low quality
1 very low quality
 
3:49 AM
I'm surprised this isn't longer.
Articles relating to elves that originate in fiction rather than folklore or mythology.
 
Thanks @mootinator. Should do it.
Never thought I'd say this, but @mootinator - lmao
SWEET!
 
Snap, Crackle and Pop are definitely my favorite fictional elves.
 
Okay, I'm going to do the Lord Of the Rings characters
I have to get this done, so I'll modify it later.
 
there are enough of them
 
@ircmaxell Who, LOTR characters, or my current cast?
 
3:53 AM
yup
 
@ircmaxell sorry, edited, what?
 
this is really strange
I just used array_rand() trivially
 
LOTR chars
 
ran php through strace to see how it was getting entropy to seed random
 
it's a call to rand
 
3:54 AM
@ircmaxell Yes, I know
but rand() is seeded
 
yes, I see one call to time(), and /dev/urandom being opened 3 times
 
> 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.
 
Yes, I'm curious how it is done 'automagically'
 
using the GENERATE_SEED() macro
let me try to find that definition
 
3:57 AM
what I see is, 1 call to time() when array_rand() is called, then it writes the random string, then it opened /dev/urandom 3 more times
So from the looks of this, time() is used on the first call, then random is re-seeded for subsequent re-use via /dev/urandom
 
Okay, done with that. To be kind to those who care, I've put the generated ones in parenthesis. Real entered values will not be parenthesized, so it'll be easier to sort them.
 
which is perfectly acceptable.
 
Try mt_rand
 
\O/
 
3:59 AM
since that's using a non-lib implemenetation of the Mersene Twister
so the only system call should be for the seed
 
Notice, time(NULL) is called just before the string is printed
then it appears to have re-seeded from /dev/urandom
 
#ifdef PHP_WIN32
50	#define GENERATE_SEED() (((long) (time(0) * GetCurrentProcessId())) ^ ((long) (1000000.0 * php_combined_lcg(TSRMLS_C))))
51	#else
52	#define GENERATE_SEED() (((long) (time(0) * getpid())) ^ ((long) (1000000.0 * php_combined_lcg(TSRMLS_C))))
53	#endif
 
line 25 is where the interesting part starts
 
You're compiled with ThreadSafety, aren't you?
 
@ircmaxell Yes
 
4:02 AM
that's why
71	#ifdef ZTS
72	        ret = php_rand_r(&BG(rand_seed));
73	#else
74	# if defined(HAVE_RANDOM)
75	        ret = random();
76	# elif defined(HAVE_LRAND48)
77	        ret = lrand48();
78	# else
79	        ret = rand();
80	# endif
81	#endif
 
@ircmaxell that doesnt explain how rand() is seeded
 
Well, I'm looking for php_rand_r
 
Isn't it amazing how one seemingly trivial curiosity can send three to five people on a massive hunt through one of the most mind warping code bases ever published?
 
@TimPost Eh, I thought it's just the two of you :P
 
@TimPost I've already moved on :)
 
4:08 AM
@YiJiang You forgot to count my voices ....
 
Is "google" not already in the low quality posts filter?
 
That must be happening in the C rand_r lib
 
4:23 AM
static int
do_rand(unsigned long *ctx)
{
    return ((*ctx = *ctx * 1103515245 + 12345) % ((u_long)PHP_RAND_MAX + 1));
}

PHPAPI int
php_rand_r(unsigned int *ctx)
{
    u_long val = (u_long) *ctx;
    *ctx = do_rand(&val);
    return (int) *ctx;
}
(fyi)
 
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
 
is late to the show
 
clickIE4 :|
 
Where is that blasphemy? |:
 
0
Q: div layout problems. resolution.

user645607Okay i have this problem with every page i make. im not sure what im doing wrong but all my pages never work for every resolution. Probably because im using a widescreen? lol im not sure but it never looks right on resolutions smaller than a widescreen one. parts of it you cant see so you have to...

Just kill me already
 
4:26 AM
...
 
Hang on, the British get only a maximum of 12 mins of adverts per hour of TV?
 
That was quite the change in topic, but that seems hugely improbable.
 
Well, since nobody answered me, and I couldn't find it:
0
Q: Add Googl(e|ing) to the low quality posts filter

mootinatorSeveral posts deal with how "Did you google it?" type answers aren't productive. How to deal with "Have you tried Google?" comments I came across this post, which isn't an altogether terrible post, but suggests googling terms more than once: Dumbbell weight training for distance running (curre...

 
@TimStone Well, I'm trying to wipe records of that question from my memory
 
@YiJiang I know, I almost wish the liquor store was open so I could go out and buy something that would erase that experience from my mind forever.
 
4:29 AM
@YiJiang What do they do with the other 8 minutes?
Or is it four...
 
4:47 AM
Why does PHPMyAdmin only show some of my data?
This is so strange!
 
You'll probably need to be a bit more specific than that.
 
@TimStone - I have a PHP script that inserts data into a MySQL database.
On localhost, the insert works just fine.
On My live server, PHPMyAdmin shows only some the info.
Er, rather only several columns appear to be populated.
 
What do the rest of the columns look like? They're completely blank in the display?
 
Yes, I think only the varchars are empty.
I've exported from localhost and then imported my .sql file.
The int's get 0 values and the varbinary seems to be entered...
and the timestamp is entered too.
Any ideas?
@TimStone - Could be my DB type... ?
InnoDB
vs MyISAM
 
Did you try querying to see if the data was actually there?
 
4:58 AM
@TimStone No, but I noticed that the database type on localhost didn't match the server db type.
 
Yeah, that's not really relevant.
 
Ok
 
Query for something that should be there and make sure it isn't, so you know that the problem is with the DB and not phpMyAdmin.
0
Q: System.currentTimeInMillis() as column names in database

Marcos I want to use long timestamp value(may be generated by System.currentTimeInMillis()) as column names in my database. Can System.currentTimeInMillis() method guarantee an always increasing values ?? I have seen people complaining that sometimes it became slower.. ! I am also open to other alterna...

O_o
 
PHPMyAdmin seems to be an older version, going to query...
@TimStone - Is this right?
$q = mysql_query('SELECT * FROM dbname');

echo $q;
er, apparently not
 
Well, I meant more that you should go into phpMyAdmin and query something like SELECT * FROM my_table WHERE my_varchar_column = 'some known value' and see if any results are returned.
 
5:06 AM
Ah, ok, will do.
Although that won't verify that PHPMyAdmin is broken, since that's still through PHPMyAdmin.
 
Hmmm, global login doesn't appear to work in Firefox 4
 
Hmm, I just spent the last 3 hours voting 90 times.
Time to go do something else.
 
@TimStone - It ouputs zero...
er, missing info
Not PHPMyAdmin
@TimStone - Even stranger, the DB seems to store base64 encoded data...
 
Did you look at the export file to make sure it looked correct?
 
Yes
 
5:13 AM
@YiJiang -1 to Firefox 4
 
Er, no.
I recreated the DB by hand.
And some of the info is being entered.
 
@TimStone chat.stackexchange and stackexchange.com login still works though
 
The CC number, which is base64 encoded, seems to be entered properly.
 
@Moshe Erm...why?
 
But I notice I'm no longer auto logging in when visiting network sites
 
5:14 AM
Ah, I see.
 
@TimStone Forget why, that's not the problem, per se.
 
So it's only slightly inconvenient as I have to manually log in every time I visit a site after a while
 
do a total logout and log back in on a site, then check another to see if it works
I sometimes have to do that.
 
@TimStone - I've done a query on the localhost and printed the query to the screen. Then I copied it to the server SQL and it claims to have inserted the data.
And, it shows the data too..
Hrm... Might a problem in my url for my submit page.
 
I am all sorts of confused about what it is that you've done now. :P
 
5:24 AM
@TimStone I ran my form on localhost, where I've built a query in PHP.
I then echoed that query to the screen.
I copied the query from my screen to to the SQL input on the live server.
 
sighs Yes, I understand all of this.
 
Then ran it.
Then PHPMyAdmin displayed the data.
I think something else is wrong...
 
I have no idea what any of this has to do with the URL in your submit page, and I don't get what you did to load the data in the first place that apparently went so awry.
 
I have a button on my page that says "done".
When it is clicked, jQuery takes over.
jQuery sends a post request to a PHP file which performs the insert.
I think the problem is somewhere between jQuery and the PHP file.
or between the PHP file and the DB.
The PHP file is getting called, but it's not getting the data for some reason...
 
So you need to debug it.
 
5:29 AM
Yeah, that would have been the sensible place to start had I known that you were loading data using your own code, heh.
Here I was assuming that something went wrong with the phpMyAdmin importer.
 
The DB is getting a new entry, but an empty one.
@TimStone My mistake. Ask @drachenstern, I'm not great at explaining things.
My code starts my reading post values.
Then puts them in an array
Then loops through the array and checks that no required data is missing.
Then we clean the info using mysql_real_escape_string($value);
then we connect to the DB and insert the data.
I'm not sure what's wrong since this works on my localhost.
 
I have a question.
 
@RebeccaChernoff shoot
(deleted)
 
What have you done to debug this? (and saying it doesn't work in here doesn't count)
 
@RebeccaChernoff Not much, I don't know where to start, honestly.
 
5:36 AM
Sounds like you need to research how to debug first. shrugs
 
@RebeccaChernoff Fair enough.
 
I'm not saying it to be mean, I'm trying to be helpful.
Not being able to debug your own code is incredibly crippling.
 
@RebeccaChernoff I understand, I appreciate it.
@RebeccaChernoff Very true. I'm very rusty with PHP.
But this is strange because it works fine on localhost.
 
It doesn't really have anything to do with the language. Debugging is debugging. Different languages are just different syntax.
 
Ok, then I suppose logging everything is a place to start.
 
5:39 AM
Your database isn't the same as the one on localhost apparently, so who knows. The change in database engine is largely unimportant here, but it's hard to say whether or not you messed up anything else. I'm still a bit confused why you didn't export the structure from your working copy and use that directly?
 
@TimStone I did at first but the engines were different, so I recreated it by hand.
 
..The server doesn't have InnoDB?
 
@TimStone I did not configure it. I'm not the admin of this server.
Ok, PHP isn't getting the values, apparently...
Or it's not doing something with them...
 

« first day (214 days earlier)      last day (4792 days later) »