« first day (693 days earlier)      last day (4262 days later) » 
00:00 - 20:0020:00 - 00:00

8:00 PM
2 people in that room, last activity 3 hr ago xD
 
eh, try the exchange
ah, I see you have
i've UV'd it
 
have i missed anything interesting ?
 
My phone's screen broke and now I'm desperately trying to run an application on it
a.k.a.
1
Q: How do I run an application on my phone from my PC?

TruthI have a phone with a touch-screen malfunction, I want to run applications on it from my computer, connected by USB. Is that possible? I've tried applications like http://mymobiler.com, but that has failed me (I can see the screen, it's not responsive).

 
@Truth you may want to specify that debugging mode is disabled
 
@Nile Just did
:)
 
8:04 PM
okay, well good luck.
 
@Nile That question hurts my eyes, but I don't think it deserves closing
 
@Truth look at my answer then the comments
 
But your answer is kinda not-useful for the question at hand
 
@Truth the answer is to use break;
 
Maybe you should consider clarifying it a bit to make it more relevant
@Nile Break will break out of the entire switch-case IIRC
 
8:44 PM
@Truth so then continue;?
 
@Nile Not sure, I bet this could be solved without switch/case
0
Q: Ho to place image in the center of <a> tag?

MoresThere is a tag in 150x130: .listings ul li a.thumb{ float:left; width:150px; height:130px; border:#ededed 3px solid; } When I save images I check image's width and height. with==150 or height==130. And in view: <a href="#" class="thumb"> if ( checking with is f...

Didn't know ho's could place images?
 
Hello
:)
@Truth you there?
 
I am
 
When searching with queries in PDO
Would it be LIKE %:param%
or
 
@JordanRichards no
 
8:48 PM
LIKE '%:param%'
 
You would have to supply the % when you execute
 
@JordanRichards LIKE :param
 
Not when you prepare
 
Sam
the algorithm for the question, IMO, is poorly designed; switch is mainly used when only one of the cases will match; if there's a chance more than 1 will match, I don't see a point in using switch
 
And $stmt->bindValue(":param", "%" . $var . "%");
 
8:49 PM
ok so..
$statement->execute(array(':param'=>"%".$param."%"));
 
@Sam In nearly all cases where you have a switch/case block, you want some sort of polymorphism.
@JordanRichards Correct
 
:) ok thank you
onwards and upwards
I've been recording all my files to switch from sql to pdo :)
 
Sam
@Truth which means only one the case must match the condition, correct?
 
so thanks for the advice
 
If you don't see what is wrong with goto I'm very sorry but explaining it would take longer them I'm willing to spend on questions when OP is talking about "prejudices" and goto in the same sentence. — PeeHaa 5 secs ago
 
8:51 PM
Bye guys :)
Thanks @Truth and @PeeHaa for your help.
 
np
 
Oh one last thing, I know this is not REALLY releated in PHP, well it is and it isn't. I want to make flash games with stencyl that connect to a database via php to store results etc
 
Thought for they day: VB is the worst language ever. Ever.
 
Any idea on how I'd do that?
 
@DaveRandom VB6 FTW!
 
8:54 PM
@PeeHaa lol
 
90% of crypters are made in VB6
 
@Sam Generally, only one case should match
Hence the break; at the end of each case
 
@PeeHaa Yeh, who needs punctuation or readable code. Or navigable documentation. I particularly like the fact that If IsNull(var) is not the same as If var = Null. Took me quite a while to figure that out.
 
Sam
exactly......but in his question, he wants to jump from one case to another
 
@Sam Which is why I said in my comment that his design is flawed, and he should give more details about the problem, since there's probably a better design.
 
8:59 PM
can someone help me with this:
and mistake, not 94 but 96 records
 
Sam
he seemed more combative though.....as if he's ready to defend a flawed design; keeps shooting down other suggestions
 
@MichałKról The second argument to LIMIT specifies the number of records, not the last record
 
oohhh
 
You have asked for a maximum of 274 records
 
now that makes sense , thx
 
9:01 PM
You would do LIMIT 250, 24 if you want 24 records starting from the 250th
 
awsome
 
@Sam Looks to me like he basically wants someone to tell him that goto is an acceptable solution, and doesn't want to accept that it isn't. You can't help people like that.
 
Sam
@DaveRandom sadly
 
9:23 PM
@rdlowrey Do you happen to be here?
 
@DaveRandom No, but it's spelled "ho'"
 
Hey there :)
 
Hey @JordanRichards.
 
Is it possible to ADD onto a query AFTER it's prepared?
like so...
 
9:26 PM
@JordanRichards No. It's not possible.
 
oh ok
hmm
oh nvm I know a work around now
 
@JordanRichards Can you explain the specific use case? Sounds like a possible bad design if you find yourself wanting to do that.
 
Yeah it was, I know what I did wrong now, thanks anyway @DaveRandom
Hey Levi, could you go into the other room for a bit?
I have some questions.
 
I don't even know what to do about this. Words fail me. He's answered his own question, with this.
0
A: How to switch to next case in php?

AnonymousHow about this? if ($STEP!=2&&$STEP!=3) { if (is_null($a)){ if ($b==1){ echo $b; } else { if (is_array($e)){ die('error'); } else { # $STEP=2; # } ...

 
9:39 PM
@Truth So if you talked about something that belonged to them, it would be ho''s?
 
9:59 PM
Hey guys is there a way to BIND paramaters BEFORE prepare()?
 
Sam
why would you want to do that?
 
@JordanRichards No, the statement doesn't know what parameters are available until it has been prepared.
 
oh crumbs :(
@Sam because the query changes
@Sam the query depends on an if statement, the paramaters change also
 
Write two queries . . .
 
Sam
so, use a conditional statement for the db process; don't use the same for both
 
10:05 PM
here's what happens, has this been POSTed? yes, no? Has this, yes no? Has This.. Has this.. (ach one giving it's own query) at the end a string is added onto the end of the query for pagination (after the if statements) the pagination area needs to LIMIT what is shown, therefore it has to be where it is.
@Sam could you give an example of that please?
the query can't be executed until the LIMIT has been added on
 
Sam
so, the only difference in all the queries is the limit part?
 
@Sam incorrect. The difference is the way they are written. E.g "LIKE.", "WHERE blah=blah" etc they all vary then at the end of all the IFs it adds on the pagination limit
(I appreciate you trying to help here, thanks for taking the time)
 
Sam
ok......all of them will contain limit, right?
will they all provide the same number of parameters?
 
no
they will all containt limit, they will all have different paramaters (and number of params)
 
Sam
ok.....as stated above; use a conditional statement for the query preparation; each of the possible options will run a different query
 
10:14 PM
@JordanRichards PDO or MySQLi?
 
@DaveRandom I used to use MYSQL, but I'm recoding all my site to pdo
I think I've found a solution
I append on the limit beforehand
 
@JordanRichards See if this helps you at all: stackoverflow.com/questions/12327363/…
(NB: It's not yet finished)
Also, I'd be very surprised if bindParam() is what you want, use cases are few and far between. Just use named placeholders and pass an associative array to execute()
0
Q: Need to decode this php code

thomas moorMY website was hacked few days back.I found the following code in my website template.It looks like its malicious.I need to know whats the content of it.Thanks in advance.Please tell the method to decrypt this kind of script http://pastebin.ca/2202342 the code starts like this: <?php /*...

The guy is basically not willing to put any effort in and wants someone to do it for him, and doesn't care how it is done.
 
Sam
No wonder it was hacked; it's likely the guy built the site from codes copied from the web
 
lol
tal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? LIMIT 0, 12' at line 1' in
what's that supposed to mean?
 
There's a typo somewhere in your SQL statement.
 
10:26 PM
my query looks like this $get_items_q = "SELECT * FROM items WHERE type<>'skin' AND type <>'socks' AND type <>'transparent' AND name<>'123456789' ORDER by id :order";
then this is appended on..
$get_items_q = $get_items_q." LIMIT $start, $limit";
 
@JordanRichards ORDER by id :order makes no sense, what are your trying to do?
 
:order either mean 'ASC' or 'DESC'
 
@JordanRichards See bullet point #3 of a few things to remember in the answer I linked before
 
Hiyall
 
@InGodITrust hey, epic name btw
@DaveRandom uhh, how?
 
10:28 PM
> Placeholders in prepared statements can only be used for values, they cannot be used for object names. In other words, you cannot dynamically specify database, table, column or function names, or any SQL keyword, using a placeholder.
 
@DaveRandom OH!
Thanks! :)
 
@JordanRichards yeah yeah, no time for that now thought! :-)
how do you guys determine if you are on local or production server to know to which database to connect to
 
Afternoon all
 
@Bracketworks what makes it afternoon, its very early in the morning where i am at the mo
 
@DaveRandom would {$value} work?
I know for definate that it's either equl to ASC or DESC
 
10:30 PM
@InGodITrust Rather than always try to timeshift for others, I just say what time it is here and hope for the best :)
 
Sam
@JordanRichards since the order can only be 'asc' or 'desc'; check for which one the user selected, and code it in, instead of parametizing it
 
@Bracketworks ;) jj
 
so just use an if statement for like if($blah='ASC'){$query='for that'}else if($blah='DESC'){$query='for that'}
 
Anyhow, I've been forcibly made to transition most of my work to ASP.net :(
 
10:31 PM
@JordanRichards Since there are only two choices, ASC or DESC, I would do something like $order = $_GET['order'] == 'desc' ? 'DESC' : 'ASC', then you can safely use $order directly in the query because it does not contain anything from user input
 
Sam
.NET blows!
 
@sam @DaveRandom @Bracketworks how do you guys determine if you are on local or production server to know to which database to connect to
 
@Sam Generally true; especially with an outdated mismanaged set up
 
@InGodITrust Use two config files, one for the production and one for dev. When copying dev code to production, don't include the config file.
 
@InGodITrust That depends, what're you using? How is your dev/production environment set up
 
Sam
10:33 PM
@InGodITrust lol......if you are on a local server, won't the domain be localhost, and if on the live server, an actual domain name?
 
@DaveRandom wouldnt it be better to have a script that detects auto...
 
Sam
@Bracketworks I started with .NET...C#; it seemed very easy
 
@Bracketworks homemade
 
Sam
everything's there for you to use
 
@sam could be localhost, mysite.dev, and this is not includeing stage
 
10:35 PM
@Sam C# is actually quite a nice language; it's the framework that's a pain in the ass.
 
@InGodITrust You asked what I do, and that's what I (generally) do. I'm not saying it's the best way, it's just what I do.
2 hours ago, by DaveRandom
Thought for they day: VB is the worst language ever. Ever.
 
I'd like to (as I'm sure many long-time users would) see many of the language features of C# brought over to PHP
 
Sam
@InGodITrust Dave has given you the best answer
 
@DaveRandom I gotta contest that slightly; VBA is the worst language ever.
 
@Bracketworks So write in Java. It's basically the same language, without the PITA framework, and without the M$ limitation.
 
10:36 PM
@DaveRandom i get that, but why do you do that? Should I not check if the HTTP_HOST is localhost or mysite.dev or similiar and that will tell me if it local? Dont you find it a pain?
 
@DaveRandom Well, tell that to my employer ;)
 
@Bracketworks A fair point.
 
@DaveRandom Or dialect.. whatever
 
Sam
@InGodITrust no......that is not necessary; make the settings in the config files, and include the right file in the bootstrap file
 
@sam why, isnt my way easier
 
10:39 PM
@InGodITrust Not really, it's just a couple of settings. For any serious/very fluid project I tend to write a migration tool for putting code live very early on, and I just write that in such a way that it ignores the config file.
 
@Sam LOL I used to never have a bootstrap file xD
 
Sam
@InGodITrust not really
 
@Sam Then Levi corrected me and told me why it was so important
 
Sam
me neither......I kept hearing about it on here, checked it out, and figured out why it was necessary.........sweet mother.
 
@Sam lol :) high fives
 
10:40 PM
first time im hearing about it
 
Anywho, I figured I'd pop in and see how PHP was doing; haven't had much a chance recently as I used to; and also drop off this question for any web app polyglots (I know there's a few around here)
0
Q: ASP.net master pages, web root, and directory structure

BracketworksI've revised (but not changed) this question for brevity; see edits for previous version(s) I have an ASP.net website (non-application, non-MVC) with the following (proposed) file system hierarchy: What configuration changes (if any) can be made to implement this scheme? Is this possible? I'v...

 
oh .. this guy is back again
 
@DaveRandom can you expound on 'I tend to write a migration tool for putting code live very early on'
 
Sam
@InGodITrust your way is not better (especially in the long run); using a file allows you to use diff configurations for both the dev and prod servers
 
@tereško That at me? ;)
 
10:41 PM
naah , you are a regular
 
@sam at the moment i define a CONSTANT called RUNNING_LOCALHOST if i see a .dev in the HTTP_HOST
 
Yea, but I've been constipated with .net
 
@sam i then set the DB_NAME accordingly, but if not RUNNING_LOCALHOST then i set the DB_NAME differently. Seems clever to me
 
@InGodITrust I write a short procedure that will examine source files on the dev server/live server and compare them on mod time and file hash, and copy any files that are different from dev to live. I'll have a list of files that I tell it to ignore which will contain at least the config file.
 
Sam
@InGodITrust alright......step up into using configuration files
 
10:43 PM
@sam i am using one, but in my config file i do a check if RUNNING_LOCALHOST
 
Holy crap; I can't believe 5.4 came out in March.
Time flies.
 
Sam
@DaveRandom can I see a copy of that code?
 
@DaveRandom me to
 
Ok I'm gonna sound like a TOTAL newbie by saying this.. But.. What do you call $this? A $variable or a $value I'm pretty sure it's a $variable, but yeah, silly me.
lol I know ALL about $this, but not what it is called. Seems stupid
 
Sam
lol....an object referencing the current class...at least, that's what I think it is called
 
10:46 PM
In many object-oriented programming languages, this (also called self or Me) is a keyword that is used in instance methods to refer to the object on which they are working. C++ and languages which derive in style from it (such as Java, C#, and PHP) generally use this. Smalltalk and others such as Object Pascal, Python, Ruby, and Objective-C use self; Visual Basic uses Me. The concept is similar in all languages. For brevity, here we just say this. this is usually an immutable reference or pointer which refers to the current object. Some languages, such as Objective-C, allow assignment ...
 
@Sam how so?
@Sam How is it an OBJECT?
 
> home of the brave and land of the free [old native joke]
 
@Sam @InGodITrust It's different for every project. It's not a big job though, just a pair of RecursiveDirectoryIterators (one for dev, one for live) to get a file list for each, then iterate over the dev files and check 1) Is the file in the ignore list? Is so, skip it 2) Does the file exist on live? If not, copy it. 3) Does the dev file have a newer filemtime() than the one on live? If so, copy it. 4) Is the sha1_file() of the two files the same? If not, copy it.
 
@Sam IF I defined a $oneofthese in a blank php file. And then used it as if it were an object eg. $blah = new $poop, it wouldn't work
 
Obviously you end up with extra little bits and pieces bolted on depending on the project. Seriously though, it's not a big job.
 
10:49 PM
thanks all!
 
Sam
@DaveRandom I guess my question mainly is....how do you do the file transfer itself (from dev to production)?
 
@DaveRandom cheers, will look into it.
 
@Sam git fetch
 
Sam
@JordanRichards because if I believe that if you use $this without using a class/something similar, an error will be thrown (I haven't tried that before)
@tereško you can git pull using php?
 
 
10:53 PM
@Sam no it doesen't it's the other way round. If you try using $this and try using it as a class (without using anything to do with a class previously in your code) it will only then do an error
I think anyway lol
 
Sam
$this references the object of the current class being used
 
they are called variables
just found out lol
 
Sam
@tereško didn't know that......will look into it..........thanks.
 
Sam
$this is an object, $that is a variable
 
10:57 PM
@Sam Depends on the setup and what your working with. Small internal things I write in my office tend to be dev/live in different virtualhosts on the same machine, so it's just a local file system copy. Then you go all the way through FTP/HTTP to using external tools via exec(). Like I say, every project requires a different migration path.
 
@Sam WOAH STUPID ME!
 
Sam
you use $this when referencing to the current object inside a class
 
@Sam I didn't mean that
@Sam LOL Silly me
@Sam I was talking about $That
@Sam I used $this to basically explain $that
 
Sam
lol.....okay
 
10:58 PM
@Sam is $this a constant?
 
no.
 
@Lusitanian oh so it's just commanly used for a variable inside a class?
 
@Lusitanian (sorry I probably sound like a complete stupid guy)
 
Sam
and you also referenced w3schools.com/php/php_variables.asp. Unacceptable choice of reference here :-P
 
10:59 PM
heh it's okay
never use w3schools
 
@Sam whoops!!! why do u guys have a grudge against them or something? xD
 
Sam
@DaveRandom that's cool/smooth
 
@JordanRichards No, we have a grudge against misinformation.
 
@Lusitanian Thanks for that link, I get it now. It;s sort of like a super-variable
@Bracketworks :O Really? It's misinformation?
 
yup
 
11:01 PM
I USE THAT LIKE EVERY DAY! D:
How is it misinformation?
 
@JordanRichards It's a bit ranty but it will outline the problem: w3fools.com
 
damn .. how do you cancel a flag
tnx
 
@tereško Marked it as invalid
 
what on earth is W3C anyway?
(now I probably even sound more stupid)
 
@JordanRichards yes, you do. please don't ask questions like that
 
11:03 PM
yes you do
 
@JordanRichards w3.org Reading is for winners.
 
Ok I'll google it
 
@JordanRichards w3.org/Consortium
 
Lolol
ok
I'l read :)
@tereško a learner
 
@JordanRichards Makes for less questions and more answers ;)
 
11:04 PM
@JordanRichards learners use Google and read the manual
 
@JordanRichards , you are not a learner , you are a 12 year old help vamplire
 
@Nile I do use google, but when I can't find an answer on google, or I can't understand it I come here.
 
@tereško I vant to zuck your cerebral cortex ;)
 
@tereško I am 14, but yeah I see your point. Sorry for asking so much.
 
@tereško we should start a rivalry with like the c++ chat room, and whenever somebody like that starts asking questions like that, we can just say "the c++ is great for those types of things"
8
(^ star that so everybody knows)
 
11:06 PM
@Nile That would be, another rivalry
 
@Nile ok
 
@JordanRichards it is not about "asking too much" but a bout your presumption that SO is a crowd-sourced search engine
it is not
 
11:26 PM
@tereško I note you have not ed yourself... run out of votes?
 
i'm under 20k
 
@tereško Fair enough, I'm surprised about that
-1
Q: PHP header rename issue

JohnI have a very simple script that takes in post data and echos it out. The issue is that the download file rename is not taking effect since the data is posted to the script instead of through a get request. <?php header("Content-Disposition: attachment; filename=\"" . $_POST["name"] . "\"...

 
but i have run out of
and now i am out of too (spent some on the cv-backlog
 
@tereško I wasn't even aware that there was a limit.
How so you get the tag, url and preview box to all render as a single post?
 
by writing fast
those are separate lines
 
11:34 PM
...to the sandbox mobile!
 
@tereško If I try I get "you can perform this action again in 3 seconds" :-(
 
i think i don't get what you are tying to say
 
So I go get the permalink for the Q, I hit my cv-pls button, paste the link, hit enter, then immediately paste the link and hit enter again, and I get a little message popup that says "you can perform this action again in 3 seconds"
 
00:00 - 20:0020:00 - 00:00

« first day (693 days earlier)      last day (4262 days later) »