« first day (1017 days earlier)      last day (3934 days later) » 

12:00 AM
Seriously. I can't do it, but someone somewhere will figure it out very soon I'm sure. As soon as that day comes the fossil fuel problem will no longer be a problem
 
@DaveRandom when ppl talk about such chemical, i think about electrons! y cant we just add/remove a few electron/protons to turn nitrogen into uranium!
 
We already have the technologies to power everything with hydrogen a lot more efficiently (and in many cases much better in many other ways) than we can with fossil fuels, the problem is that we can't make hydrogen cheaply enough (at least not in large enough volumes) and we can't store it in a way that's safe enough to expose to the general public
You can't just let some idiot fill his car up with liquid hydrogen, it is way too dangerous
You might as well just sell people rocket fuel
 
@DaveRandom Is there a sane way to limit per GROUP BY in sql?
 
@DaveRandom lol, scary, those bombers will use it for killing innocent ppl. Very dangerous stuffs :(
 
So for every group there are only x results?
 
12:04 AM
@PeeHaa Interesting question
@NokImchen tbh if the internal combustion engine were invented now, it would never get past the health and safety types
 
@DaveRandom Well thank you :)
 
:-P
 
@DaveRandom waiting for an answer! i had this prob too! i solved it by using another column :| but mine approach was bad.
 
@PeeHaa I can think of a couple of ways but no sane ones yet
 
@DaveRandom yup! nice thought! steam engine is much Eco-friendlier, ..right?
 
12:06 AM
That's what I thought.
 
What aggregate function are you actually trying to apply?
(not sure if that makes a diff or not at the moment but it might)
 
SELECT statistics.time, pages.url FROM statistics INNER JOIN pages ON pages.domain = :domain WHERE statistics.page = pages.id GROUP BY pages.id, pages.url, statistics.time ORDER BY pages.id ASC
I want to limit based on pages.url
 
@NokImchen Not really. Unless you're heating the water with nuclear fusion. I suppose when you boil it down (hah!) all power stations are actually just giant steam engines
 
or id :)
Teh only way I see is a sub select
 
12:10 AM
Yeh I keep coming up with nastiness involving at least one derived table :-(
 
:(
 
@DaveRandom oh, yes, we have to burn to produce steam! lol, i forgot the coal !!!! sometime i wonder, y not use mercury, cos the mercury can expand like elephant even in low body temperature, so we can use it to pressurize, and then let the mercury come out into another chamber where it will be cooled to make it condensed. this process can be repeated and will be like renewable source of enegy!!
 
There must be something you can do with HAVING
Man there are some properly ugly "solutions" to this problem floating about on the net
 
I know. I think I have seen most of them by now :P
 
@bwoebi View it now. Still too much?
 
sqlfiddle.com/#!2/e48a0/1 is the best I can come up with I think @PeeHaa
And it sucks pretty badly
And I think with that I must love you and leave you, I have to get up in the morning :-(
nite @all
 
@DaveRandom yeah. I'm going to fiddle some more tomorrow
later @DaveRandom
night all
 
@PeeHaa goodnight :)
@DaveRandom goodnight :)
 
1:20 AM
Why are so many questions on SO about building quiz scripts?
 
1:35 AM
must be part of the curicullium of some online
academy
 
1:47 AM
Hello , Good Morning, its Monday Already :)
 
people who use sublime text, how can I execute a shortcut command for all files in my project?
 
@BenjaminGruenbaum It would have been more helpful to also mention the actual answer ;-)
 
@Orangepill could you help me with something
or anyone with MySQLi
knowledge
 
2:26 AM
@elitegamer What's happening
 
well, for some reason, my form has stopped adding data to the DB
it did it once, then stopped. Here is my Query
 
@elitegamer I usually hide behind an orm but I can probably help you out
 
$query = "INSERT INTO news (title, image, content, date, poster) VALUES ($title, $image, $content, $date , $username)";
I get no errors either, but it does not add anything to the DB
 
for one your query should at a very minimum have ' around all of the values.
 
you should look into prepared statements, otherwise there's no point in using mysqli
 
2:28 AM
better though would be to build a parameterized query.
 
what do you mean
@FabrícioMatté why is that
 
$query = "INSERT INTO news (title, image, content, date, poster) values (?,?,?,?,?)";
 
what are the question marks
those are the values
 
@EliteGamer to easily prevent SQL injection and to not worry with quoting and such.
 
2:30 AM
Hi All,i have prob with this code $head = (array_key_exists($dex, $out)) ? $out[$dex] : array_slice($value, 0, 2); details code and problem in stackoverflow.com/questions/17801535/…
 
but i do not understand why it is not working
 
hope somebody can share any idea
 
@EliteGamer Not working ... I have exactly the same problem, my code doesn't work either o_0"
 
You would run this through

$statement = mysqli_prepare($query);
 
the mysqli docs are pretty detailed on prepared statements php.net/manual/en/mysqli.quickstart.prepared-statements.php but I guess Orangepill will post the rest of the example soon :P
 
2:32 AM
@Orangepill where do i put that? in place of mysqli_query($connect , $query); ?
 
@zira I've seen that problem before.
1
Q: php - how to merge 2d array that have different no of element for each array

ziraI have 2 set of 2d array and i want merge into 1 2d array. but the number of element in each array its not same and for the first 2 element is same and i don't want to duplicate it. here its is. First 2d array: Array( [0] => Array ( [0] => 25/2/2013 ...

 
Just look at the examples here that should clue you in to the proper way to do it
 
^^ Doesn't that already solve the problem @zira
 
The call to mysqli_prepare returns a prepared statement from which you can bind_param() and execute()
 
why does my code not work though?
 
2:34 AM
@zira the guy that answered there know his stuff.
 
$connect=("");
		if (mysqli_connect_errno($connect))
		{
			echo "Failed to connect to MySQL: " . mysqli_connect_error();
		}
		$query = "INSERT INTO news (title, image, content, date, poster) VALUES ($title, $image, $content, $date , $username)";
		mysqli_query($connect , $query);

		mysqli_close($connect);
 
@elitegamer the root is because you are generating mailformed sql
 
Dunno, probably missing the 's as Orangepill said or a syntax error
 
even with the 's it won't work
 
Though you should move to prepared queries
 
2:35 AM
@elitegamer your values are not quoted or escaped.
 
anyone here know any asp.net aswell?
/sql stuff
 
ok, let me do it, but it will not work
$query = "INSERT INTO news (title, image, content, date, poster) VALUES ('$title', '$image', '$content', '$date' , '$username')";
 
@Jack the requirement not same.
 
just did an insert into a sql database through asp.net which has a newid(). but i need to pull the guid
i cant find out how to pull the newid as a string
 
i have tried using your code but does not work also @Jack
 
2:37 AM
@EliteGamer It seems the parameters to mysqli_query() are reversed.
@zira Explain why not work.
 
ok, let me check that
 
@EliteGamer Btw, PHP should warn you about that.
 
it does not
 
anyone?
 
@Orangepill it worked once, but when i tryied to add more data, it did not
 
2:39 AM
@EliteGamer Then you should do error_reporting(-1); ini_set('display_errors', 'On'); first.
 
the prams are not
 
if (!mysqli_query($connect , $query)) {
    printf("Error: %s\n", mysqli_error());
}
 
i had them right
it blew up when i did it your way
 
oh wait
 
wait what?
 
2:41 AM
used prepared statement syntax to get error, need another approach for your case
 
@zira Your expected output doesn't make sense. Please explain why it should be that output.
@EliteGamer Also, what doesn't work? Just saying it doesn't work makes people guess what you did wrong ... and that gets exhausting after a while.
 
@FabrícioMatté when i added ur code, i got Error: (and nothing else)
 
Try the code above again, updated it
 
@Jack it does not insert any data into the DB
 
@EliteGamer Did you check the return value of mysqli_query()?
 
2:43 AM
no
i do not know how.
this is the first DB i have done
 
Well, then you might as well switch to PDO.
 
my updated version with mysqli_error() prints anything besides "Error:"?
 
@FabrícioMatté same thing, but i also got this error : mysqli_error() expects exactly 1 parameter, 0 given in ...... etc
on line 60
 
Oh I thought the link was optional but it is not, then
mysqli_error($connect)
but yeah, you may as well switch to PDO
 
For debugging try mysqli_query(...) or die(mysqli_error($connect));
 
2:45 AM
@FabrícioMatté i got: Error: Duplicate entry '0' for key 1
idk what that is
 
by any chance
Is title a primary key and you're inserting 0/empty there twice?
 
hm
forgot to make it auto increment
 
@EliteGamer First, you're not passing a value for the primary key and second, the column is probably not set to auto_increment.
 
let me try again
^^ lol
just saw it (facepalm)
 
yeah, then remove it from the query :P
 
2:48 AM
@Jack because i need to print output all data have for that date that user selected.in addition want the data come out every minute.the all data is not in one file.so i have to extract from many file that why i need to merge all data to one.the another thing, all file is not same the time output, there have certain in every 1min and 2minute. also have file not captured data from beginning time of the day, so for those data not exist user request to show -9999.
 
Why not use null instead of -9999? Also, it seems that you just want to do padding.
 
@Jack thats why for first array i extract each minute from the beginning date user selected. others are arrays that contain data.
 
@FabrícioMatté for some reason, it is adding two of the same things in the DB
what do u think causes that?
 
thats user req..who me to change it -9999 to null
 
@EliteGamer probably the code executes twice.. Either you've reloaded the page, or the function gets called twice, or something.
 
2:51 AM
ah, ok
 
@zira Why is $output[2][2] supposed to be -9999?
 
@Jack because 2nd array does not have data on that minute
 
Sure, but why not have 2 and 3 be 1.75 and then 4 be -9999?
 
@FabrícioMatté is there a way i can make the form submit once?
 
Your question doesn't explain the logic at all.
 
2:55 AM
well, once after it refreshes, to keep from multiple entries
 
@EliteGamer PRG is what you're after I think.
Post - Redirect - Get
 
@EliteGamer yeah, you can do a redirect after the post has been handled, also know as PRG as Jack said
 
can you link me
or tell me how to do it
 
How about you search yourself?
 
is it a library?
 
2:56 AM
No
 
no a technique
 
ah
but, i am doing it in a CMS
type framework
 
@Jack because i need to its should follow the array sequence.output need to show 2nd array data then follow the third one
 
yawn guess i'll call it a night, work in a couple hours
night
 
@Orangepill i do not understand
 
3:00 AM
@elitegamer which part are you not getting?
 
ok, so they say to go to another url to break it
 
@zira This is giving me a headache, so I'm going to step aside now. One tip though, perhaps it would help to write in pseudo code what you're trying to achieve; as it stands now, it will just get close-voted after a while.
 
so, i just refresh the page?
 
in a way yes... but with a get instead of a post
 
hm, i am using post on my forms, and REQUEST in the php
all the code for submiting the form is in here: if(isset($_REQUEST['submit']))
 
3:03 AM
Don't use $_REQUEST.
 
i thought that was more secure
 
if you are posting you should use $_POST
 
then when do i ever use request?
 
I'm getting a segmentation fault at the end of a lot of my PHP programs in v5.5.1.
 
$_REQUEST is a mashup of $_GET and $_POST
 
3:04 AM
it works
 
@ircmaxell I've never tried tracking down PHP segmentation faults, any pointers specific to PHP?
 
lol
so i just add header("Location: news.php");
after the form is submitted
 
@elitegamer so does your form post to the same address?
 
yea
i have my php and html in the same page
news.php
 
After the form is submitted and processed then redirect. back to news.php using a location header
 
3:06 AM
where would that be?
at the end of that if statment?
 
Yep... just make sure you are not generating any output in that if
 
um
printf
for a error
 
That's fine as long as it only prints when it's an error...and nothing when it is not
 
hm
well, that does nto work
i pressed the button like 5 times, and then it added 5 records
 
do you have error reporting turned on?
 
3:09 AM
no
i do not think
 
when developing ALWAYS turn on error reporting
 
ok
let me do that now
@Orangepill i got no errors
 
error_reporting (E_ALL); ini_set("display_errors", "on");
 
yea
@Orangepill actually yes
Cannot send session cache limiter - headers already sent
i get that on line 6
session_start();
 
What's in line 1-5?
 
3:13 AM
@Orangepill php.ini (or even .htaccess) is better for turning errors on
 
@Orangepill 1-6
<?php

error_reporting (E_ALL); ini_set("display_errors", on);

//This will start a session
session_start();
 
is there a blank line or a space before <?php
 
no
there is one after
like <?php ..... space
 
that's okay
 
3:15 AM
is your editor set to save files as UTF-8 with a BOM?
 
um
not sure
i use Notepad++
 
what do i do?
these are .php files
 
@EliteGamer check what's selected on the encoding menu in N++
 
i think the error because the length of date not same between 1st and second array @Jack. because i noticed 1st array: array(size=2) 0=> string'13/08/2013' (length=10) 1=>string '12.00 am' (length=8) while second array: array (size=6)
0 => string '13/8/2013' (length=9)
1 => string '12.00 am' (length=8)
....
 
3:18 AM
@Orangepill ANSI
is that good?
 
yep
 
oh, u said it lol
 
not the best, but it shouldn't cause that error
 
but is that why the data is being sent twice?
 
because the redirect isn't happening
are you auto_prepending a file in the php ini?
 
3:21 AM
hm
no
 
@EliteGamer is the file in which there's the session_start() the one that is being called directly or is it included from some other file?
 
directly
 
user895378
WTF PHP ...
 
@rdlowrey ?
 
user895378
> Although there is no longer a symbol in any scope pointing to this structure, it cannot be cleaned up because the array element "1" still points to this same array. Because there is no external symbol pointing to it, there is no way for a user to clean up this structure; thus you get a memory leak. Fortunately, PHP will clean up this data structure at the end of the request, but before then, this is taking up valuable space in memory.
 
user895378
3:23 AM
In other words, "Don't worry about it ... we know you don't want to actually use PHP to program and not to make silly webpages"
 
@rdlowrey Link?
 
user895378
(courtesy of the manual) Scroll to the very bottom.
 
for some reason, it is alwys submitting it twice
and i do not repeat the function in my php either
 
@rdlowrey Isn't that what the newer GC aims to solve?
 
user895378
@Jack I don't know. But I can verify that it doesn't solve it for me. I get leaked memory all over the place.
 
user895378
3:25 AM
(5.5.0)
 
@rdlowrey Isn't that a very basic example of a circular reference?
 
> Traditionally, reference counting memory mechanisms, such as that used previously by PHP, fail to address circular reference memory leaks. As of 5.3.0 PHP however implements the synchronous algorithm from the » Concurrent Cycle Collection in Reference Counted Systems paper which addresses that issue.
 
user895378
I can work around it ... it's just annoying.
 
@rdlowrey I think that should be reported as a bug then.
 
@Orangepill even after i redirect, i still get the same issue
 
3:27 AM
Because the new GC is meant to address cyclical references.
 
user895378
Yeah ... I'll try to put it into an easily reproducible script.
 
@rdlowrey Assuming of course zend.enable_gc is switched on.
 
user895378
Hmm. I should double check that.
 
@rdlowrey I think it's just a case of poor documentation. It would make much more sense if it said "traditional reference counting systems have this problem, but since php 5.3 we have (link to next page) to take care of this."
 
redirect with a query string attached id new.php?i=redirected see if the url in the location bar changes after you redirect.
 
3:29 AM
it does change
 
user895378
@Jack Yeah, still happens with zend.enable_gc enabled
 
but it does still submits two times
 
Hmm, how many bytes is a zval agian? 64 bytes or sth?
 
let me try this: unset($_REQUEST);
that did nothing
 
user895378
@Jasper Probably right ... I just forget how nice it is to not have to think about memory management ever in PHP :)
 
3:31 AM
@rdlowrey Also note:
> When the garbage collector is turned on, the cycle-finding algorithm as described above is executed whenever the root buffer runs full. The root buffer has a fixed size of 10,000 possible roots (although you can alter this by changing the GC_ROOT_BUFFER_MAX_ENTRIES constant in Zend/zend_gc.c in the PHP source code, and re-compiling PHP). When the garbage collector is turned off, the cycle-finding algorithm will never run.
> However, possible roots will always be recorded in the root buffer, no matter whether the garbage collection mechanism has been activated with this configuration setting.
 
@Orangepill i do not know what else to do
 
Given a 32 bit system and assuming you store only integer values, you would need 163 GiB of memory before you can tell what count() would produce ;-) — Jack 53 secs ago
 
@Jack I want one of those...
 
@EliteGamer Examine error logs... keep error reporting turned on and address every notice/error you see. I've used PRG countless times with out any issue.
 
@Jasper You need even more for 64 bit systems :)
 
3:37 AM
@Jack just a little....
 
@Jack Well, 163 GB is enough to cache my entire main disk twice, so I'll just roll with that
 
@Orangepill 309 GiB .. yeah, a little more :)
 
@Jack I was think it would be like a 22 digit number before the decimalpoint...
 
ok, i will
 
64*(2^64)
assuming zval is 64 bytes
 
3:46 AM
zval is 140 bytes on 64bit
 
It's really interesting to look at the analytics data for my blog. I really just set up the place for me to talk about whatever I feel like, never expecting visitors. Yet, I do get visitors, 21 in the last month. And heck, it's even the top google result for a term
 
4:01 AM
At last received Gold Badge in PHP
 
@yogeshSuthar congrats
i'm still 149 away :(
and 14 200+ days away from epic
 
@Orangepill You can earn that in 4-5 days. ;)
 
@YogeshSuthar gratz
 
@Jasper Welcome. :)
 
I have to dumpster dive on questions and hope they don't get closed if I want it that fast :)
 
4:05 AM
@YogeshSuthar Welcome to the club ;-)
 
@rdlowrey You probably just need to be a bit more careful and think about cleanup.
 
@Orangepill Yeah, now-a-days users asking tooo localized questions. :(
@Jack Thanks. :)
 
@Orangepill That reminds me of interview with a vampire, where Louis is found eating rats in an alley ;-)
 
@jack thus far that has been the secret to my success on here.... trying to change that though and close as dups more.
 
@Orangepill Sure, it kept him alive ... ;-)
 
4:11 AM
@Jack I'm more of a tv series fan myself, so I'll go for post-curse, pre-buffy angel
 
Ugh, youngsters =P
 
I'm probably the old guy in the room
 
@Orangepill Nah, @Jack is much more older than you. :P
I am repwhoring here :P
 
@Jack Oh, don't get me wrong, interview was a great movie, I just have a personal preference for series. Besides, Interview only predates Buffy by three years
 
@YogeshSuthar That's right, I'm ancient ;-)
@Jasper My wife likes Buffy too, but I personally don't like series for the fact that it comes with an almost obligation to keep watching them :)
 
4:26 AM
yey I received downvote stackoverflow.com/a/17916000/1679187 :)
@Jack What is your birthyear. :D
 
@yogeshSuthar wasn't me
 
@YogeshSuthar Y U no escape variables in your sql?
 
@YogeshSuthar code only answer?
 
@Orangepill I knows. :P Ahhh, downvote removed.
 
@Jack I'll admit that's a valid complaint
 
4:28 AM
@Orangepill @YogeshSuthar You both don't do any escapism ;-)
 
@Jack May be OP has escaped it previously and did not included in his question. :)
 
lol
Ohh yeah and obligitory mysql_* is bad comment — Orangepill 47 secs ago
 
@YogeshSuthar Lol, don't assume :)
 
@YogeshSuthar I disagree with this:
> And it's always a good idea to escape your field and table identifiers with a backtick
for portability reasons
 
@JAck escapism?
 
4:32 AM
@Orangepill You know, mysql_real_escape_string().
 
@Jack If OP has used directly $_POST OR $_GET in query, only that time we have to escape them. :)
 
My bad, that ping should have been @Orangepill, not Yogesh
 
@Jasper what portability concerns are their? If using mysql_* functions....
 
@YogeshSuthar $cookie = $_COOKIE['mycookie']; ...
 
he's living on the edge
 
4:36 AM
@karthikr type is not a reserved word. — Jack 41 secs ago
 
@Jack That's only a guess, how can we read mind of OP. Also you are a good mindreader OP has probably done in that way. ;-)
 
@jack I do always do escaping .... but it has always been more a data quality issue to me then a security issue.
 
@Orangepill I prefer writing sql that standards-ish (or not-quite-the-standard-but-supported-by-everyone-all-the-same) so I can switch between sql flavors easily
you may prefer backticks (and for the variable part, if it is actually based on user input (but let's hope not, because that would be awful) quite justified), but they are definitely not "always better"
 
lolzz we are fighting here for escaping variables and winner is space answer
 
@Jasper I'll concede to you on that one. Normally I hide behind a ORM that does that messy stuff for me ... I just do quoteIdentifier :)
 
4:41 AM
@Orangepill Can you give me name of good ORM which I can use in PHP & MySQL?
 
@Orangepill makes sense
 
I like Zend_Db
 
@Orangepill For core PHP and Myqsl?
 
@YogeshSuthar Yep... pretty simple to get started with..
 
@Orangepill But it will be only for Zend framework, how can we use it without framework?
 
4:45 AM
@YogeshSuthar Zend Framework is a component framework... you can pick and choose what pieces you want... So you can only include in the DB relevant code.
 
@Orangepill Okk, thanks, I will try it. :)
 
morning everyone
@YogeshSuthar Bitch, congrats...
 
And nothing for parameterized answerd. :(
@Mr.Alien hahaha thanks. :)
 
@YogeshSuthar ;)
 
@Mr.Alien Now my target is CSS and Android.
 
4:55 AM
@YogeshSuthar sure, why not, I need some competition :p
Btw yest I answered to @Jimbo best friends question...
 
@YogeshSuthar You get an upvote from me for the term "lexically scoped language". It could use a sentence or so of explanation as not everyone knows what that means
 
@Mr.Alien She is getting reps tooo fast. :P
@Jasper I haven't used that term. :)
 

« first day (1017 days earlier)      last day (3934 days later) »