« first day (343 days earlier)      last day (4621 days later) » 
00:00 - 13:0013:00 - 00:00

1:31 PM
I can try
 
@Robik I need to select posts (question & answers) + their flair data. I use
SELECT p . *
FROM posts p
LEFT JOIN users u ON u.id = p.owner
WHERE p.on_question_id =1
OR p.id =1
ORDER BY on_question_id ASC , deleted ASC
LIMIT 0 , 30
However, it doesn't select actual users data
With
SELECT p. * , u.email, u.username, u.rep
FROM posts p, users u
WHERE (
p.on_question_id =1
OR p.id =1
)
AND u.id = p.owner
ORDER BY on_question_id ASC , deleted ASC
LIMIT 0 , 30
 
SELECT p . *
FROM posts p
 
it works perfect
@Eugene I use it already. Don'T you see it?
@Eugene yeah, I need ALL data from that table
 
@genesisφ So what's the problem then?
 
@Eugene it selects only post data in my first LEFT JOIN query
and nothing from users table
 
1:43 PM
@genesis Well, that's because you SELECTed only p.* ...
 
@NikiC and do you think that , u.* would work?
 
yes it would
 
+1
 
wow
And what if user is deleteD? will be users.data null?
 
SELECT p.*, u.*
 
1:44 PM
though I obviously encourage you to specify all fields you want to select explicitly
 
@NikiC +1
 
Damn. I'm repairing table with 220 000 posts a half-hour already >.<
 
@NikiC But when you don't need all fields and there are few left out.
 
SELECT p . * , u . *
FROM posts p
LEFT JOIN users u ON u.id = p.owner
WHERE p.on_question_id =1
OR p.id =1
ORDER BY on_question_id ASC , deleted ASC
LIMIT 0 , 30
worked nice. +1 @nikic on answer
@NikiC + badge :)
 
There should be a way to give rep to people in the chat
 
1:47 PM
@Zirak exactly
but who cares...
 
@genesis , stop using name "id" for columns
 
@tereško it was example. I don't do so
@tereško however you still' didn't say me reason except "bad practice"
 
@tereško huh? Why shouldn't a column be named id? I use that all the time
 
if table Posts have a foreign key containing id from Users table , than it should have the same name
@NikiC , sure , a lot of people do , but it is stupid
 
@tereško Not really. It is a matter of coding style. I understand your motivation (uding USING() instead of ON), but I don't think that it's really a best practice. It is one way to do it, but not necessarily the best way.
 
1:56 PM
the naming should be consistent throughout the database
besides , not all tables need an id column
 
@tereško Consistent yes. But user.id and table.user_id is also consistent ;) In a different way. As long as you stick to that naming convention everything is consistent, thus okay.
@tereško Sure. But how does that relate to table.id vs table.table_id?
 
essentially what you are doing is obscuring the meaning of that columns
and more importantly : the meaning of the key
plus , you cannot select columns without providing implicit aliases
 
@tereško I will not further argue with you for obvious reasons, but I honestly doubt that table.id is "obscuring" something compared to table.table_id.
 
how do you expect SELECT Posts.id , Users.id FROM Poses LEFT JOIN Users ON Posts.author = User.id WHERE Posts.type = 'something' to work ?
 
I told you that I won't argue with you.
 
2:06 PM
SELECT Posts.id , Users.id as uid FROM Poses LEFT JOIN Users ON Posts.author = uid WHERE Posts.type = 'something'
 
yes , how will you use it in php ?
without aliasing
 
$result = $db->query("SELECT Posts.id , Users.id as uid FROM Poses LEFT JOIN Users ON Posts.author = uid WHERE Posts.type = 'something'");
while($row = $db->fetch($result)){
    $uid = $row['uid'];
}
 
@genesis Don't answer teresko. You probably heard the quote "Never argue with an idiot. He will drag you down to his level and beat you with experience". This quote is exactly for a situation like this.
 
@NikiC I know he'll. he's always "right" :p. I just given him an example how is it possible
 
do you know what alias is ?
 
2:09 PM
Not sure
Huh I got 254 rep today for nothing?
 
users AS U
U is alias for users
 
ah. I always use aliases
 
Majority does.
 
@NikiC did you see my answer on that? :p
ah, you probably upvoted now :
 
2:14 PM
@genesis Yeah, that's where I found the image ^^
 
if you scroll fast to the right on that image, it reminds me these small books with only images. Does anybody know name for them?
 
Yep, I though exactly the same
A flip book or flick book is a book with a series of pictures that vary gradually from one page to the next, so that when the pages are turned rapidly, the pictures appear to animate by simulating motion or some other change. Flip books are often illustrated books for children, but may also be geared towards adults and employ a series of photographs rather than drawings. Flip books are not always separate books, but may appear as an added feature in ordinary books or magazines, often in the page corners. Software packages and websites are also available that convert digital video files ...
 
ah :p
are there any online? :p
 
@NikiC dunno, what's example of normal naming?
 
@KamilTomšík Any name without \ oder namespace\ in front of it. So Hallo, Hallo\World, A\B\C, but not \Hallo for example
 
2:20 PM
Whoo. My SO PHP clone is almost completed :p
I hate diff & markdown :p
 
@NikiC and in which way the behavior is different?
 
@KamilTomšík Well, namespace\... is relative, \... is absolute and everything else is ... uhm ... "normal" :D The behavior of normal names depends on the context
 
5
Q: scope of $this is funked in PHP is it a bug or a feature?

Itay MoavI have a class: class a(){ function b(){ if(isset($this){ echo 'instance! '; echo get_class($this); }else{ echo 'static'; } } } And then, another class class C{ public function test(){ a::b(); } } $C...

ewwwww
 
@Gordon Known for long.
$this isn't necessarily instanceof self in PHP ^^
 
@NikiC ewwwww for long then
Is it a violation of Command Query Separation when I have a method tokenize that tokenizes a string and when its done returns the parse tree?
 
2:46 PM
@Gordon I have no idea what the Command Query Separation is, but a Tokenizer should definitely not return an AST. Ideally it shouldn't even return a token stream, but that's yet another question ;)
 
Anybody know of any good torrent library? What I would like to do is get the info hash of a uploaded torrent. So I think it needs some bencode decoding function etc.
 
hi
 
@Gordon tokenize actually doesn't do anything, it's just query
@Gordon "do" in cqs means change of state (of object or any of its subparts)
@Gordon so it's okay to return
 
thanks
 
i hav a question regarding best coding practice. lets say you show a list of CDs, and when a user selects one, the next page should show details of that item. in this case, would you rather create a new object and pass it to the next page OR just pass the index of the selected item and re-query the details?
 
2:51 PM
@coder9 the list of CDS likely doesnt contain all the details, so just pass the ID and query the full details
 
in what kind of situations you'd have to create new CD objects then?
im kinda new to OO PHP :)
 
@Gordon np
 
    public function tokenize($string)
    {
        $this->tokenStream = array();
        $this->parsedString = $string;

        while ($this->parsedStringHasCharacters()) {
            $this->buildTokenStream();
        }
        return $this->tokenStream;
    }
@KamilTomšík that would be ok then?
@coder9 whenever you need them
 
@Gordon pretending the class is named tokenizer, will tokenizer change its behavior (or even internal state) in any sense after calling tokenize?
 
@KamilTomšík the class name is Tokenier and no it wont because thats the only public method
 
2:56 PM
@Gordon from what you've shown, everything what changes happens more or less on stack (even when it's private var)
so it's just query
@Gordon yeah, that name was just for the sake of question
 
@KamilTomšík yes, actually i just broke a single method down into smaller functions for readability
Ah, Fowler has a Bliki entry for everything: martinfowler.com/bliki/CommandQuerySeparation.html
 
@KamilTomšík github.com/nikic/PHP-Parser/tree/master/lib/PHPParser/Node/Name :) Better? (I didn't add the asXYZ methods yet as I'm not sure whether they really are necessairy
 
@NikiC yeah, a bit better
 
Just a bit :(
 
@NikiC Can your parser parse itself yet?
 
3:03 PM
@Robik Sure.
 
1
Q: where to use CodeIgniter html table(MVC Problem)

Moein7tlI wanna make table in CodeIgniter,I think using Table library can be useful for it. Now how can I use it? I will get data from mysql database and using parse. I should use it in View or Controller folder?

 
Whoa. Looks almost finished
 
@Robik It is finished from the parsing perspective (it'll parse any valid 5.3). But I have lot's of work to do on the public API :)
 
Oh, okay
 
1
A: Is str_replace faster with array?

Omeid HeratFrom PHP Docs on str_replace : // Outputs F because A is replaced with B, then B is replaced with C, and so on... // Finally E is replaced with F, because of left to right replacements. $search = array('A', 'B', 'C', 'D', 'E'); $replace = array('B', 'C', 'D', 'E', 'F'); $subject = 'A'; echo str...

can I have some stronger reference for that ?
 
3:07 PM
@OmeidHerat closevoting as too localized
@Moein7tl please refer to the CodeIgniter manual
 
@Gordon closevoting as not constructive :P
 
that is a bit harsh I reckon, the wording might be really localized but will the idea of how str_replace with array works is broad enough.
Not constructive >_>
 
@OmeidHerat no one cares whether its faster :)
 
that makes sense, but sometimes stupid questions lead up to smart answers (mine is not the case though) like the comment on the questions.
I am sure there will be lots of googlers will find that and will know that they shouldn't care about it.
Ah!
why am I advocating that question :P
 
3:20 PM
// Lol, i just disabled Menu bar in FireFox and : i.imgur.com/RBofY.png
 
@Robik press ALT to bring it back temporarily
 
Cool, i thought its disabled on XP
 
Ok I got a question, but please don't shout at me that use linux I am here in windows for a reason.
 
Looking through the other questions of that Hossein dude I'd say all of them should be closed
 
PHP interactive mode is known to be not working in windows, at least what is packed with xampp.
now in cygwin I can't get php -a to execute the lines of code.
 
like i type echo "test";[Enter] nothing happens !
 
@OmeidHerat no code will be evaluated until you terminate with ctrl-z (at least in windows). its not an interactive shell like what erb or python offers.
 
ctrl+z -> ^Z[Enter] it terminates PHP without any results.
I remember in linux I used to able to do like echo 2+4 and get 6
 
@ircmaxell Why did you implement own stack in Interpreteres instead of SplStack?
 
3:42 PM
@OmeidHerat start "php -a" in command line shell and then type <?php echo "hello";
and then ctrl-z (weird char will appear) and then enter
@OmeidHerat btw: there's also php -r "code you want"
 
oh cheers that seems to work
 
@OmeidHerat and of course, you can pipe php
 
but I want a interactive shell !
 
@OmeidHerat then you're out of luck :)
 
the example 1
$ php -a
Interactive shell

php > echo 5+8;
13
php > function addTwo($n)
php > {
php { return $n + 2;
php { }
php > var_dump(addtwo(2));
int(4)
php >
 
3:45 PM
@OmeidHerat i think the manual refers to the new improved interactive shell. @salathe might know more
 
@Gordon which could explain that
 
@Gordon that can't be so brand new I remember using that back in Jan-Mar
 
@Gordon Somehow funny how one more question asked got stackoverflow.com/users/738112/hossein lot's of downvotes on other questions and probably will get all those questions closed
 
@OmeidHerat actually I think to remember that I saw this usage too but I cannot reproduce it anymore
@NikiC hopefully.
 
Ah from the same page ....... if PHP is compiled with the --with-readline option.
maybe I should recompile PHP.
 
3:50 PM
Hi guys. I just came up with the next big thing(tm) and i need some feedback (cool? not cool?) and someone who sucks less at backend stuff than I do for an implementation and 50% of the company's shares that will be worth approx. $4.235.234,59 in no time!
So, think about this: Like 95% of all questions on stackoverflow are essentially "please take 5 minutes to code foo for me because i am totally incompetent", right? And we keep doing it … for karma.
 
Wow I like that exact number for approximation with 59 cent.
 
@OmeidHerat it also starts with 42
Now, what if karma had a price tag? Like: Hey, I'm a frontend guy, I have some spare time on my hands. You're a backend guy with a jQuery question that is trivial to me. I solve your problem, you accept, thereby giving me 15 karma.
 
@vzwick meta.stackoverflow.com
 
A couple weeks later, it's the other way around. I can't seem to solve that tricky SQL Join thingy … You help me, you get your 15 karma back.
@Gordon I know. Let me speak out.
 
Karma = currency, you mean?
 
3:55 PM
Now let's assume everyone got 100 or so karma to start with. If he needed a lot of support and had little time to dedicate for supporting others himself, he would soon run out of karma.
So, the next big thing(tm) is to sell him karma.
Also, developers can convert their karma into cash by withdrawal to a PayPal acct. or something.
Tadaaa.
 
there are programmers who won't ask question even if it should cost them one penny
 
and also this is an old big thing anyways
 
micropayments for SO have been discussed on meta before. wont happen
 
but will constantly bother you for spoon-feeding (for free, of course)
 
Geez, I've just run into the first major problem … Karma inflation :D
 
3:56 PM
That's a horrible idea. A lot of times karma = how popular I am
 
there is freelancer.com and lots of other services already doing this.
 
@Gordon Not talking about implementing this with SO
@OmeidHerat I know. But there's an awful lot of overhead involved if you just basically need three lines of code.
 
there should be.
 
Why so?
 
you are doing money transfer you need to have user information and verify it and you are forced to do so by law.
to avoid illegal money transfer and money washing
Money laundering is disguising illegal sources of money so that it looks like it came from legal sources. The methods by which money may be laundered are varied and can range in sophistication. Many regulatory and governmental authorities quote estimates each year for the amount of money laundered, either worldwide or within their national economy. In 1996 the International Monetary Fund estimated that two to five percent of the worldwide global economy involved laundered money. However, the FATF, an intergovernmental body set up to combat money laundering, admitted that "overall it is ...
 
3:59 PM
Besides, dealing with money is a giant pain in the ass.
 
and there is heaps of other reasons.
 
Especially on the interwebz
 
@OmeidHerat Dunno about the legal implications. Differs a lot from country to country, you could just incorporate an LLC on the caymans or wherever.
@Zirak I'm from germany. Don't tell me about pain in the ass :D
If we want our sales tax to be deductible, we need a physical receipt.
 
it wouldn't matter under any kind of business you need to able to provide information about money you have in your business, specially when you are working overseas.
 
You guys convinced me. Bad idea. Dang.
 
4:01 PM
that article is almost a year old and is covering over 50 websites already doing this.
 
Well, i'm off to thinking of the real next big thing(tm), thank you for your time :D
 
no problem.
 
mumble mumble … karma … mumble mumble … bounty = cash mumble mumble … would need to outperform SO … mumble mumble … shit.
 
Think of reputation as an epenis. Now, if you sell it for money... :P
 
4:05 PM
laughs
 
I like the idea of bount = cash, but wait... there is regulation's on SO for asking at first place and it clearly says 'give me the code' and also in near future 'fix my code' questions are not allowed. so back to the same point.
 
being a veteran redditor, i can relate to the concept of karma == penis quite well.
ok guys, since you managed to debunk the next big thing(tm) so quickly, what about this: (the next next big thing(tm)):
a simple widget that you can throw into whatever website you like (preferably blog/news, though) … that performs client-side content analysis of the site … queries a remote API … yields related sites in a neat format.
 
Google?
 
[deleted]
 
Google AdSense(tm) to be specific.
 
4:11 PM
heh. kinda.
just sans the money.
more like traffic exchange.
just with a catch.
well-performing links (since only sites that have implemented the script take part in the system, you can track performance - time on page, bounces, etc. - neatly) score higher, are displayed more often …
… badly performing links, obviously score lower, are displayed less often.
 
A huge number[don't remember it] of people these days get a job that never existed before.
if that tells you something.
 
it doesn't.
 
A link exchange is a confederation of websites that operates similarly to a web ring. Webmasters register their web sites with a central organization, that runs the exchange, and in turn receive from the exchange HTML code which they insert into their web pages. In contrast to a web ring, where the HTML code simply comprises simple circular ring navigation hyperlinks, in a link exchange the HTML code causes the display of banner advertisements, for the sites of other members of the exchange, on the member web sites, and webmasters have to create such banner advertisements for their own we...
 
Well, just a small question: Why would I want to use it?
 
@OmeidHerat alright, look, i've been doing web development for 10+ years. it's not as if i din't know about link exchanges :D
I'm just trying to think that one step further.
 
4:16 PM
@vzwick will it kinds of says that the chance of someone coming up with something to outdate google is far way smaller then creating something new that gives you the same income.
 
@Zirak because it's zero cost (in terms of money as well as in terms of maintenance), it brings relevant traffic to your site … and it's especially interesting for niche sites.
 
@vzwick Sorry if that seemed rude, why I was trying to mention was that this a really well developed concept and it was famous for a while as 'link box' and is now replaced by smarter and wider Google Adsnes that also pays if you do better.
And oh not to mention it's a nightmare for page-rank and thus for the business as they literally pay for it.
 
@OmeidHerat no offense taken. i know what adsense is. what i think is, though, that there are many many many instances where adsense just doesn't perform well.
nightmare for pagerank? links inserted via a JS widget? not even getting crawled, has zero effect on JS.
also, you didn't quite hear me out.
of course, eventually selling paid links would be an option to monetize the whole thing. but i think this is a liiiiiittle too simple an approach.
 
what's far more interesting is the user data you get when you're running this service.
"Googlebot can only interpret it if the function is part of the page (rather than in an external script)."
whenever a user clicks one of those links, he's funneled through your server.
 
4:21 PM
that 2nd of june 2009
I have strong believes that Googlebot is way smarter then that now.
 
and you have at least some clue what topic it is that he's interested in.
over time, you can build neat profiles.
… the usage of which you can then sell to website owners as an API service.
kind of "user hits site, you implement an iframe … a callback on your site is called that tells you the categories of stuff the user is interested in"
@OmeidHerat well, then there still is rel="nofollow"
 
that will stop the Googlebot from indexing them but not using them for your website evaluation and page-rank.
 
fact is, if you run a major website, you're left with very little control when it comes to advertising today.

* you can use adsense and rely on google to have figured out more or less relevant ads for your content (and, to a lesser extent, user preference).
* you can use some non-sensitive ad formats. if they're PPV, you don't have to care about performance. if they're PPC, they will usually perform even worse than adsense.
* you can try and hack something together that builds user preference profiles for your site. meh.
so, if there was an api that gives you that preference data and lets you do with it whatever you want … i think there's a market for that.
 
ok nice
now that being said who can make a website to know user preference more then Google ?
 
@OmeidHerat iFrame, whatever. I don't think the problem is unsolvable.
no one to date. but that's not the important point.
the important point is the availability of the data.
there is no way you can query google for my preferences.
 
4:31 PM
I can't but they sure is using that to target adds for you.
Supply and demand is an economic model of price determination in a market. It concludes that in a competitive market, the unit price for a particular good will vary until it settles at a point where the quantity demanded by consumers (at current price) will equal the quantity supplied by producers (at current price), resulting in an economic equilibrium of price and quantity. The four basic laws of supply and demand are: # If demand increases and supply remains unchanged, then it leads to higher equilibrium price and quantity. # If demand decreases and supply remains unchanged, then it...
and its important to know what you want.
 
yap. ever used adsense on a site of yours?
 
no, but I can see how the adds are related to what I was trying to find online the other day on google.
specially with my google account signed in.
 
go and try adsense as a publisher.
you'll be pissed of beyond imagination.
 
Search for whatever and you see all of the websites adds are about whatever
 
emm .. a bit of offtopic : i need a new alarm sound , where should look for a different one ?
 
4:36 PM
your phone maybe ?
 
Use a song you like, but don't like too much.
 
for a while I had a song that it said
wake up you are still the same rubbish you were
this is another day and same boring job, here you are
.
.
.
 
If you like Skynyrd, I can recommend the Freebird solo.
 
4:52 PM
0
Q: Problem creating info hash of torrent file

PeeHaaI'm creating a BitTorrent site. If a user uploads a .torrent file I need to get the info hash to get more info from the tracker. However I cannot seem to get the correct info hash from the file. I've download the a .torrent ( http://www.mininova.org/get/2886852 ) from mininova. According the ...

Anyone knows how to get the info_hash of a torrent?
 
5:06 PM
Hello @OmeidHerat
 
5:39 PM
hi
 
Hi @Alex
 
 
1 hour later…
7:10 PM
hi guys!
 
7:40 PM
why hey there
 
@ircmaxell @KamilTomšík @NikiC I need a better name for ExportToStreamService
 
8:03 PM
@Gordon really? :-)
 
@KamilTomšík not necessarily but id like opinion
technically it is a service
it takes a stream and some data and then does all it takes to open the stream, export the data to it and then close the stream again
 
@Gordon why should it be service?
 
public function exportToStream($streamOrFileName, $dataToExport)
{
    if ($handle = fopen($streamOrFileName)) {
        if (is_array($dataToExport)) {
            fwrite($handle, sprintf('<?php return %s;', var_export($data, true)));
        } else {
            throw new InvalidArgumentException('$dataToExport is not an array');
        }
        fclose($handle);
    } else {
        throw new DomainException('$streamOrFileName cannot be fopened');
    }
}
it coordinates the export and has no state itself, so technically its a Service. It's pure fabrication because it is not a real concept in the domain model
 
yes, and that's why service is bad - it does not have any state, it's method (or a bunch of them) floating somewhere else than it should be
 
i didnt ask whether service is bad. i know your opinion on that :)
fact is, if i have three domain classes that all want to export their arrays to an includable file i wont duplicate the code in them but use an export service
 
8:14 PM
@Gordon okay then :)
@Gordon so, export to stream - what about serializer, marshaller?
 
hmmm
in this particular case its neither
 
well, gtg, tomorrow
 
cya
 
@Gordon Aside: You should do the array check first, and only then fopen
Otherwise you will throw the exception without closing the handle
 
8:29 PM
true
thanks
 
But concerning the name: No idea. I'm terrible at naming.
 
i think im gonna stick with ArrayToStreamExport or something like that
 
8:53 PM
2 messages moved to bin (way too off-topic)
 
9:20 PM
I would ask right away not to judge me for further question. So here is the question. I'm righting small framework for specific purpose. I would like to know your opinions about where is it better to start? From what component? Logically thinking it would be whole package considering Request, Response, Dispatcher.
 
right != write
@Eugene , and the answer would be: dispatcher
 
@tereško ?
@tereško So first would be dispatcher and then request and response.
 
actually , in your shoes , i would begin with bootstrap file and go from there
and i honestly have no idea what you mean by "request" and "response"
 
@tereško That's obvious. Application->Bootstrap->Dispatcher->result;
 
9:35 PM
 
@tereško Never minde.
 
@KamilTomšík i found why Template Method is evil. It has to be final → cannot be mocked
 
user1385191
10:19 PM
I've hit my first "cannot recreate class..." error, and now I'm just completely lost.
 
10:47 PM
huh ?
nut cracking tools
i have a large bad full of hazelnuts and had no way to get at them
 
user1385191
an error is thrown because the same interface is loaded twice
 
user1385191
I'm trying to understand autoloading, but no luck thus far
 
11:09 PM
can you paste your code somewhere ?
 
@MattMcDonald , yeah , but where is your autoloader ?
 
user1385191
I had:
 
user1385191
spl_autoload_extensions(".php");
spl_autoload_register();
 
user1385191
in index.php
 
od at least something like this :
spl_autoload_register( function( $name ){

		$name = strtolower($name);
		$filename = APPLICATION_ROOT . "/classes/{$name}.php";

		if ( file_exists($filename)){

			require $filename;
		}

	});
 
11:43 PM
oh , and @MattMcDonald , if you are using autoloader , then why the hell you have require all over the code
 
user1385191
I think that's where I misinterpreted it
 
Hello, I made an android app to collect a bunch of information store it in a sqllite database and I want my website to be able to load that information. I figured out how to get the app to export and upload the database file. yet when I have my php script open the file using the php version of sqlite it says it's encrypted. anyone know anything about this or should I ask in a android room?
 
00:00 - 13:0013:00 - 00:00

« first day (343 days earlier)      last day (4621 days later) »