« first day (596 days earlier)      last day (4349 days later) » 
00:00 - 19:0019:00 - 00:00

omfg
 
How come this causes my image files "png" to corrupt?
             header ("Content-type: image/png");
header ("Content-disposition: attachment; filename=".$name.";");
header("Content-Length: ".filesize($file));
readfile($file);
exit;
 
impossibru
 
$file = "foldername / file name
 
some symbols sent before the header ?
 
7:13 PM
@readfile :P
 
here is the full code
 
there is echo $file = $folder."/".$name;
it should not be there
 
only die
 
Omg
that was it
Cheers @tereško
I feel like a right nob jockey now
 
Nicely put.
 
7:16 PM
was it an error or you thought you can do it that way?
 
you should have checked the server's error log
there would have been warning about "header already sent"
 
Yeah
It didn't generate one though
error
I only echoed to make sure it was set
 
@tereško Maybe he was doing it CLI style :O
 
doubt that
 
Wooo, whatever that menas
means
 
7:18 PM
@HarryBeasant , find the php.ini file and look up what's set in the error_reporting setting
 
Alright cheers
 
because this could code MUST have generated a an E_WARNING
 
I see, well i am just trying to figure out a better way of delivering files and stopping people from hot-linking my shiz
 
I know it's full of E_WARNING, that's why there's @ all across the board ;)
 
@HarryBeasant Apache is quite good at implementing those rules too, a simple HTTP_REFERER makes a huge difference.
 
7:25 PM
you are wasting memory for no good reason (hotlinking can be prevented via .htaccess)
 
Yeah
htaccess caused me problems
Because if the user hotlinks i want to redirect to the file location, with the adverts and stat counters etc
Plus with this method, i can implement other things
This is also a remote server btw
 
Plus its all sent via https
So it doesn't send headers
 
Can you use classes with define?
 
What do you mean, Seth?
In what way?
 
7:30 PM
I get a syntax error with this: define('S', new Class()); S->something()
like that
 
Quote: "only scalar and null values are allowed."
 
Ack, alright
 
Guys, i use this to redirect to https
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ filefrontier.com$1 [R=301,L]
How could i do that on all pages, but one
 
Add another RewriteCond
 
Above the one you already have
 
7:32 PM
Yes or below
As long as its above RewriteRule
 
RewriteCond %{REQUEST_URI} !page
 
Oh whoops, thought you said "add another RewriteRule"
 
Yeah like that ;)
 
Actually, because my site is on https, surely, i could, in my php, say if the http referrer is set, stop the download?
That would work right?
 
@SethCarnegie , you should also know that constants are just a "global variable, that does not change" .. while not as harmful as garden variety global variables, they still are considered a bad practice in OOP, since they too are form of global state
 
7:35 PM
So what should constants be used for?
 
@tereško yes, I was using it for my database variable that I get from new PDO
 
@SethCarnegie , now that is a really bad idea =P
 
@tereško How so
 
@tereško although global, in few frameworks I've tried they cannot be used in views (I might be possibly wrong)
 
@webarto , they should be available all across the application. It might depend on framework's definition of "view" .. if "view" is something governed by custom templating engine , it might be true .. though even most of templating engines have ways to access constants
@Jeroen , i fail to come up with a good usecase .. maybe some file path definitions, but even that can be done without dipping in global scope
 
7:41 PM
@tereško And what about class constants?
 
@SethCarnegie , because PDO instance is an object. You would be assigning a handler to constant. If you used it, you would be violating the Law of Demeter
@Jeroen , yeah , that's actually a good example for use of constants .. it makes code more readable .. if ( $player->getStatus() === User::STATUS_BANNED )
 
@tereško how else would you do it (now we're using plain variables, not constants since you can't use objects with constants)
 
@Jeroen a good use case is code readability, e.g. if you have some kind of numeric stati in a field, it is bad to write stuff like if ($status == 1) because you have no clue what 1 is (magic number) so you can define a constant for each status so you can write if ($status == STATUS_NO_ACCOUNT).
 
@tereško in Kohana "it does not work" when using View inside View (= HTML with some basic PHP), global functions can be accessed though... will check.
 
@markustharkun I saw it being used like that in multiple cases
 
7:45 PM
i have table servers and "games" and how can i make "most popular games" from servers ???
 
Thanks for the explanation markus and teresko!
 
@SethCarnegie do you mean "how to provide PDO instance to all objects that require it ?" .. is that your question ?
@HarisMuharemović , with an SQL query
 
@tereško : yes
 
@Jeroen actually, it is the only way I use them
 
@tereško do you have somewhere a list of semesters/classes/subject from college you've attended, for comparison sake... EU vs third world countries
 
7:48 PM
ako ima neko balkanski :D
 
ima (imade)
 
: Haris Muharemović
 
@SethCarnegie Take a look at dependency injection
 
@tereško what with that ?
it says "You are on the Featured tab.
There are no questions with an active bounty at the moment.
Perhaps you'd like to select a different tab?
"
buahah
 
Haha
 
7:50 PM
@tereško Basically
 
I think he means you should speak english...
And try to write the SQL query yourself
 
i've made it
SELECT game, COUNT(game) AS gamenum
FROM serveri
GROUP BY game
ORDER BY gamenum DESC
 
@SethCarnegie watch this video : youtube.com/…
it will explain what Dependency Injection is
 
@tereško I will look for a non-30 minute version
 
that's your first mistake
 
7:52 PM
@SethCarnegie , watch the full video
@Jeroen , no , i mean this: slash7.com/pages/vampires
2
 
No thanks, I don't have 30 minutes to waste when I can get it in much less
 
then why did you ask for advice ,if you know better ?
 
please don't waste your precious 30 minutes
 
@tereško Haha yeah I thought you meant something like that, just didn't know there was a name for it
 
@tereško nice one!
 
7:54 PM
@SethCarnegie . you could always read about it : martinfowler.com/articles/injection.html
 
@tereško thank you for your advice and I have decided to use your advice as I see fit, I don't think there's a problem with that
@tereško That's what I'm doing
 
because if you are reading any other article , it most likely is bullshit
 
hi
 
where can i get Free Resources for Software Product Presentation in Websites
 
7:56 PM
^ bot detected
 
Im designing a website for my new software product.Its a small product and i can't spend to hire a designer.I have already created a Boxshot(3DBox software pack) Image.But i can see websites with software window screenshots which are tilted and provided with stylish backgrounds for attracting customers.Where can i get free templates for doing this.
 
@webarto , only up till 42nd slide .. DIC is an antipattern
 
Not by spamming a PHP chat for a start.
 
anyone.any ideas?
 
@techno you can use Photoshop
 
7:58 PM
@techno I'd suggest Paint
 
@techno www.pixlr.com/editor
 
any existing templates .PSD if your knowlge
 
Ah yeah, I remember that slideshow. I built a DI container based on it. It worked but it seemed to result in more code to set up a graph, not less.
 
@SethCarnegie , to read AND understand that article , you will need 2 hours .. unless you are much much much smarter them me
 
i mean photoshop templates
 
7:59 PM
@techno nobody here knows and you can google it very well yourself!
 
i have tried that
 
this is the wrong church to pray in
 
fowler's writing is as easy to "penetrate" as brick wall
 
@techno there are tutorials how to do that in photoshop out there!
 
8:07 PM
well .. guy gets some thumbs-up for realizing what a mess he is in and trying to get out ... just a bit too slow
 
dontfix if not broken will bring us nowhere :P theoatmeal.com/comics/tesla
 
@tereško he's cooperating
 
@SethCarnegie , this is a case of "move with momentum or get something broken"
 
@tereško the fact that they are not wearing gloves or headgear and the guy is throwing punches indicates that this is an exhibition
along with that ridiculous move
which would be illegal if they were really sparring
 
They should make it legal, for the crowd ;)
 
Xeo
8:12 PM
ha-ha!
 
@Xeo hey Xeo what's up
 
Keep sending messages to scroll that out of view, its getting on my nerves.
 
foo
bar
 
Three or four more should do it :)
 
hello
 
8:13 PM
3
 
done
 
world
 
same here, that's why I marked it as spam
 
8:13 PM
0
 
its still here for me...
 
problem solved
 
Thanks :)
 
nearly gone!
 
8:24 PM
<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>
 
Anyone have any experience with Joomla 1.5.15 running in a php 5.3.13 environment? Having issues with debug_stacktrace() exhausting all my memory...
 
21
Q: What Easter Eggs do the chat sites have?

MosheAccording to @balpha, he SE chat sites may have individual Easter eggs, depending on the site. If you find them, please post. Edit: Because it's so easy to make this stuff up, a screenshot as proof would be nice. (Although Photoshop ain't that hard either...)

You have to try the "Stack Overflow/(any room): insanity" one :)
 
@Greg I think it is pretty safe to say that J1.5.15 and PHP5.3.13 are kind of incompatible AND that there should be no Joomla 1.5.15 sites out there anymore... but I can't tell you exactly
 
<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>
Hahaha
 
@markustharkun yeah, I figured, the docs say 1.5.15+ is compatible, but I'm still having issues. It's an old site, I'm going to see if I can upgrade it before trying to upgrade php again.
 
8:29 PM
<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>
 
@Greg it's a headache but necessary
 
@markustharkun agreed. Thanks for the confirmation :) I've got some work ahead of me...
 
@Greg the hardest is 1.5 to 1.6, after that it gets easier
 
@markustharkun gotcha. I'm using a rockettheme joomla install, I'm hoping they don't do anything that gets in the way of updating the core joomla files...
 
@Greg good luck
 
8:42 PM
Whats up guys...
 
@RedCoder $result is not an array of results.
It's a mysql "handle". You pass the handle to other functions to do something with it.
 
Also, you shouldn't use mysql_* anymore, use PDO: php.net/manual/en/book.pdo.php
(or mysqli)
 
For example, to get all rows from that result, you use: while($row = mysql_fetch_assoc($result))do_something_with($row);
Oh, and what @Jeroen said. Don't use mysql_* functions use mysqli instead.
(mysqli is called like mysql used to, so it's easy to migrate)
 
@Jeroen why not MySQLi ?
 
@Jeroen Yeah...PDO is a good idea. Too bad i would have to do an edit of many..many lines of code. But i'll be using it for my future projects.
 
8:50 PM
6
Q: Which one is faster and lighter - mysqli & PDO

blasteralfredI am using MySQL with PHP5. I got to know that ancient mysql_* functions are no longer maintained and community has begun the deprecation process. So I decided to move away from mysql_*. The question is where to? I am looking for lighter, simpler and faster way. Somebody tell me which among these...

That's why, webarto ;)
Though mysqli is fine as well
 
I wrote that tutorial ... yeah, whatever, just not mysql_*
 
By the way why exactly is mysqli better than mysql...i've never asked. Is the API better, more reliable or something?
@Christian Thanks for the edit...hadn't noticed that. And the tips.
 
[status-full]
 
Great, Chrome crashed -_-
@webarto Haha I just noticed. So why did you ask me why not to use mysqli?
 
8:56 PM
<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>
 
@RedCoder It's not better, but mysql_* functions are in the process of being deprecated
 
@Jeroen because I've thought you've read it in some lousy tutorial :P
 
@webarto Well, that depends on your definition of lousy
@webarto But seeing as you're the author, I doubt you'd call it lousy :)
@hakre You couldn't resist either?
 
yay :D
that one is really cool to watch btw.
 
I know, I ran it 15 mins ago as well
 
9:00 PM
@hakre What's that supposed to do?
 
links to bobince maniac post about regexp
 
Strange, about 10 older answers of mine were just upvoted within a 2 minute timespan
 
@webarto I'm still confused....
 
4433
A: RegEx match open tags except XHTML self-contained tags

bobinceYou can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML. As I have answered in HTML-and-regex questions here so many times before, the use of regex will not allow you to consume HTML. Regular expressions are a tool th...

 
@webarto OK, seen that ages ago, but where's the link?
 
9:02 PM
21
Q: What Easter Eggs do the chat sites have?

MosheAccording to @balpha, he SE chat sites may have individual Easter eggs, depending on the site. If you find them, please post. Edit: Because it's so easy to make this stuff up, a screenshot as proof would be nice. (Although Photoshop ain't that hard either...)

 
@Christian the <(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+> becomes clickable, at least in my case, and words fly randomly...
 
you mean on SO chat (here)? 'coz it ain't a link for me :/
 
yes, here, just paste it
 
Yes
 
hoooooo
 
9:04 PM
just click on it
 
cute :D
 
:)
 
/me likes it
People, can you give this a quick look?
 
would be nice if they've implemented some of IRC commands
 
And tell me what you think.
 
9:06 PM
I think you use Java
 
@Jeroen It ain't mine. There's a java applet to try the concept.
I'd like your opinion about the concept.
@hakre you too... give it a look pleeze :)
 
@hakre Why are you sending that link?
 
because this juicy detail is missing in that answer
 
because we discussed which API should be preferred
 
9:08 PM
and naturally this juicy detail is not part of that nettuts article, oOoO
 
I can add it, but honestly, don't think it would matter to nettuts+ audience...
 
Good point :D
But I didn't know about that, thanks for sending the link
 
Or better still, this should explain it all:
 
@webarto yes, no offence webarto. the article was a good read. I wonder how one can copy it over as an answer on SO nearly verbatim
 
@Christian It looks like an improvement, yes, but it will only be useful if it gets thorougly adopted
 
9:12 PM
none taken, I'm not offended by truth :) I, and everyone, can be wrong, so it's not a good choice to blindy rely on tutorials (other people opinion), no matter what.
 
@webarto perfect dude
 
@Jeroen So, by that you mean you like the concept?
I've tried the editor, and I really enjoyed using it.
 
@Christian Yes, it's hard to argue against it, but I doubt it makes that much of a difference
@hakre @webarto Have you taken a look at @christians link?
 
@Jeroen Why's that? Consider a list of constants, right now I have to manually insert spaces/tabs on each line if a new constant is longer. With this concept, that won't be a problem.
 
yes, I don't have Java installed... so...
 
9:15 PM
@webarto No need for java
 
Well, the header image should explain all, @webarto
 
@Jeroen yes, but I'm currently coding and could only scan a fragment
if you can write up an executive summary ;)
 
@Christian: Yes, that is an improvement, but like I said, it's not that significant
 
9:16 PM
Refresh to see it in action.
 
That's a pretty good Executive Summary :)
(I must admit, I didn't read the complete text either)
 
hey
 
@Christian @Jeroen it does solve one of "coding first problems" :)
 
This one's better, it loops :D
 
@Jeroen WTF is that?
 
9:18 PM
I tend to use # for one line comments, but still indentation is an issue
 
@NikiC What is what?
 
God, please, don't invent another indentation format
 
@NikiC It's not a format.
 
It's already hard enough to deal with indentation nowadays
 
Just watch the second gif
 
9:19 PM
That's what I said, it's only useful if it gets thorough adoption
 
@Christian Just say, is it whitespace based? If no, just drop that damned shit.
 
No.
It's an editor feature.
 
Yes, but is it whitespace based?
 
When it sees tab character, it autoindents
 
how do i get the last 3 values from a database and then asign them to $value1 $value2 $value3, where the value i want is 'name' in the table people
 
9:20 PM
I.e. is there just whitespace in the output?
 
you just write a regular tab once
@NikiC not at all
 
@russianbox what do you mean by 'last 3 values' ?
 
Then drop that shit
I kill everyone using tabs
I've warned you!
 
@NikiC -_-
 
I am scared to ask this, but... why?
 
9:21 PM
@Christian If a psychopath comes over to your house and kills you, you'll know why.
 
@NikiC The point of this is to have the best of both worlds, tabs and spaces.
 
hello everyone, I have a database that has some data (products) and i want to make a shopping cart. When someone selects a product I want to take those data and insert them into a new table that would be my the cart table. Is there a way to do this?
 
@Christian The best of two worlds can only be achieved if you make tab-like functionality but with whitespace
 
@JavascriptGeek Use sessions.
 
@JavascriptGeek Yes, write some PHP code
ANd maybe some javascript
 
9:22 PM
Otherwise it'll be only the worst of two worlds
 
Throw in a little HTML
@NikiC But why do you prefer whitespace over tabs?!
 
I have a table which has peoples names and info for them, i want to get the last 3 names to be added to the database. they all have id's which auto increment, so
id=1 name=bob age=22
id=2 name=sam age=42
id=3 name=jim age=43
id=4 name=rob age=23
 
@JavascriptGeek yes, there are many ways
 
@NikiC I don't understand, do you realize that would make the editor autoindent spaces in strings too?
 
SELECT name FROM table ORDER BY id LIMIT 0, 3
 
9:23 PM
ok, will search thank you
 
hey
 
will try with php at first and will come here again if i get really too stack
 
so i want the names from 2,3,4. and asign them to $value1 $value2 $value3
 
my english is awfull :(
 
SELECT name FROM table ORDER BY id DESC LIMIT 0, 3
That should do it
 
9:24 PM
so the LIMIT 0, 3, checks from the end and goes back in 3
 
ORDER BY id DESC orders it by the id column descending
LIMIT 0,3 starts at the beginning, 0, and gets 3 results
 
yes, but if you reverse order, then it from the end, which is relative...
 
He wants 2,3,4
Thats what this does, right?
 
@Jeroen Because you can't teach tab indenters to not align using tabs. And when you start aligning with tabs the code terribly breakes if you view it with a terrible tab width
 
yeah i want the last 3
 
9:27 PM
@NikiC I have a script that automatically analyzes this, even decide on usage and authomatically fixes on a per-file basis.
 
E.g. as soon as you display it in the browser (in a code lxr or in github pr diffs) tab indentation breaks
 
So, what do you do, you type space indentation manually?
 
@NikiC We are assuming your IDE doesn't do a mess out of adding tabs. In fact, I prefer this "feature" to be disabled.
 
Like 3 spaces?!
Or do you just use the tab button to enter multiple spaces?
 
@Jeroen No, the IDE just inserts four spaces when you type a tab. All IDEs support this
 
9:28 PM
Then there's the other thing, you shouldn't worry about tab width because it is exactly what this takes care of.
 
@NikiC unless you reconfigure. but 4 spaces is pretty common.
 
@russianbox SELECT name FROM table ORDER BY id DESC LIMIT 3 ?
 
Sadly my favorite slash rain example at lxr.php.net/opengrok/xref/PHP_TRUNK/Zend/zend_hash.h#307 doesn't work anymore
 
@NikiC All right, changed the setting in my editor (sublime) ;)
 
cataphract updated opengrok yesterday and the new version replaces tabs with two spaces
 
9:30 PM
@NikiC if you've got java, I'd urge you to try out the demo here: nickgravgaard.com/elastictabstops/#tryitrightnow
 
Before that the \ slashes there were a real mess (which looked like rain)
@Christian As if anyone in here has Java ^^
Or do some people in here have a Java plugin installed?
 
@NikiC What's that supposed to mean? Having the JRE doesn't automatically make you a java coder.
 
@webarto ok, so if that gets the last 3, is there away to get the 2nd last one. so only 1 value but the value from the 2nd last entry
@webarto is that when you'd use somthing like 0,2
 
ORDER BY id DESC LIMIT 1,1
 
@Christian Not implying that. Just assuming that most people in here have certain ideology which prevents them from installing a Java plugin ;) Similar to how we all (most of us) would love to get rid of the Flash plugin :)
 
9:33 PM
Start at 1 (so skip the first one, which is the last one because it is ordered as descending) and get 1
 
@Jeroen :D
 
@Jeroen oooooh, i see. yeah the 0 thing always gets me
@Jeroen i'll give this a try
 
@NikiC Irrelevant. First of all, Flash isn't Java and doesn't pretend to be.
Secondly, relying on modern web features (3d, video etc) will land you in a load of pain, even on up-to-date browsers.
 
Are you really willing to start this discussion?
 
@Christian I only explained my comment, nothing more. I know it's irrational thinking, but as you may know, there is some rationality to irrationality too (at least from the gaming theory and economics point of view - also the reason why democracy fails)
 
9:36 PM
@Jeroen It's pointless anyway. Sometimes I can't figure out why people really love crowd mentality.
 
You think I dislike there was a Java script on the page because of crowd mentality? Lol
 
@NikiC OK, so in short you don't have java and can't try it out. Fine, can't explain how it works any better, sorry.
 
(hmm, Java script is way too close to Javascript, I should have used a different word)
 
@Jeroen No, getting rid of java is the crowd mentality. Java's got a significant market share, and for what's worth, my java plugin (though up to date), is still a part of the cocktail in my pc setup, regardless how much I use it.
To conclude, people either got rid of java, or abruptly bought a shiny new computer. :)
 
There is some truth to that..
But I gotta go
 
9:41 PM
I simply didn't install Java since my last switch of computers and I didn't need it a single time until today ;) And I switched more than half a year ago :)
And I'd prefer to keep it that way
 
Cya!
 
@Jeroen Cheers.
 
@Jeroen bye
 
Thanks for the help with that stuff guys, it worked
 
@NikiC Well, installing java to try this out is ridiculous :)
I'm leaving as well. New co-worker to train tomorrow. Cheers everyone!
 
9:49 PM
hi everrone, I am new at this chat.
I need help to show in Flexpaper html code. Somebody have any idea?
 
welcome
 
I know that Flexpaper is to show PDF files, but is it possible to view/embeb HTML code into Flash ?
 
@NikiC thats less common than 4 spaces for programming languages but more common for HTML and XML.
@JesusIbarra yes,
 
10:20 PM
@hakre Ooops, I meant four spaces. Think-typo'd
Before it didn't replace and thus tabs were displayed with width 8 :)
anyways, good night
 
gn
 
Sam
10:41 PM
Evening
 
@NikiC common as well, but less common. more oldskool.
When there was not that much need to stuff so much into one line as nowadays.
 
stackoverflow.com/q/10863598/212940 (reasonably interesting, but argumentative.
 
11:30 PM
@vascowhite Definitely. I've considered his argument myself.
 
11:59 PM
Good night and good luck.
 
00:00 - 19:0019:00 - 00:00

« first day (596 days earlier)      last day (4349 days later) »