« first day (2007 days earlier)      last day (2951 days later) » 

10:00 AM
$string = "test";
if (strpos($string, ".") !== false) {
$string.=".";
}
echo $string."png";
Any ideas, why this only concats the string?
 
@TechTreeDev What else should it do?
 
@TechTreeDev because there is no dot in the "test" to start with?
 
It should check if the string ist "test" or "test." . If there's already a dot in it, ignore it and add the extension. if not, add a dot so in both cases its "test.png"
 
did you mean === false?
 
oh damn :'D
 
10:03 AM
And the "rookie mistake award" goes to.... :-)
 
Yea, my first award
 
:P
 
@PeeHaa … Peehaa \o/
 
@Gordon Dude I already have a cabinet full of those things :P
 
dont we all?
 
10:05 AM
Probably yea
 
If you don't you're not doing it right, clearly :p
Bit of a long shot here, but if you have 2 vhosts, one with an alias of *.domain.com and another with foo.domain.com in that order of priority, and then navigated to foo.domain.com, would the second vhost be used over the first? On apache2.
Tell you what, I'll actually do the right thing first and test it out myself.
 
@Sean I'm going to guess it uses the first hit whatever it is alphabetically
alphabetically based on the config filenames
 
Aye, it was to be set in that order of priority. For all intents and purposes, they are respectively in 1.conf and 2.conf
It's just to see whether the wildcard would take priority over a normal alias
 
What's the result? :)
 
Damn. Seems like the wildcard will be matched first and it'll stop there.
 
10:15 AM
Suspected it
 
Really dislike how Apache vhosts uses the first vhost it finds as its default.
 
@Sean You and me both, I've had to activate the default 000-default thing and make it redirect to my main site.
 
@Sean there's a reason the default enabled vhost is 000-default in some distributions :)
I find it nice that it's deterministic.
fpm didn't use to be.
 
I dislike Apache for a variety of reasons, I think that nginx is superior in most if not all regards.
 
10:21 AM
php -S teh bset
 
^ dat
 
hi
frinds, how can i get output parameter form sqlserver 2014 to php for displaying Error message..
 
@FlorianMargaine That reminds me. I had some issue a while back for which you thought you could send and easy patch if only I created a bug for it. Needles to say I "forgot" to do it and forgot what it was :P YOu still know it?
It was fpm (config?) related I think
 
Mar 3 at 13:31, by PeeHaa
Is there any way to set the umask of php-fpm without having to set it in the init script?
 
<3
 
10:27 AM
I remember telling you "open a bug", so search was easy
I don't say that word super often, turns out.
 
:)
Will create a bug for it later today (I hope) so you can either patch it if you still feel like it or ignore it. Either way is fine by me :)
 
I just sent out this, so a slot freed itself
 
Cool. Will probably ping you later
 
is there a best way to get the last part of my url? for example: test/test2/test.php I want everything after the last '/' basically
 
http://stackoverflow.com/questions/36619149/upload-video-with-restfu‌​lclient-api-in-codeigniter
 
10:34 AM
I see a lot of solutions with explode but I have a feeling that shouldnt be the way
 
http://stackoverflow.com/questions/36618753/best-way-to-create-a-que‌​stionnaire-builder-on-codeigniter
 
@Loko Other way would be to use strrpos() and substr()
 
Other way would be regex
whatever works for you
 
Wahauw what stupid part am I missing :D pastery.net/ekyvjv
 
end brace and the fact it's returning an array
and db isn't defined
 
Welcome to Stack Overflow. Please edit your question to avoid using all-caps, and give a clearer description of exactly what you're seeing. — Jon Skeet 11 mins ago
 
@Duikboot SELECT * is evil
 
Also that
 
@Leigh only if you never need all of the columns
 
10:48 AM
@Gordon Not only. Imho you can equate it to "hidden dependencies", and also if the schema changes (i.e. column removed - yes, bad, but can happen), then it's better to have the query fail than your application continue potentially processing incomplete data
sorry for edit ping spam :)
 
@Leigh my thinkpad is usually muted :)
 
@PeeHaa if you remember , I had an issue with UTF-8 .. had to use mb_substr instead of substr to solve the real issue
 
@Loko parse_url() and then basename() on the path component
 
@PaulCrovella \o/ I killed a big fatty with my little worm
 
11:04 AM
sliter made me exit chrome
 
@PaulCrovella my company will send you the bill
 
@Saitama Tried to trap a small one, got rekt instead
 
@MadaraUchiha hehe, a god got rekt :P
 
11:09 AM
@PaulCrovella I don't get it, can you eat others or?
 
Didn't realized that the larger you are, the slower your dash is
@Epodax You make them hit you
And avoid hitting them
 
ah
Similar
 
@Epodax i like that one better
 
@Gordon It' can get frustrating very fast though
 
@Leigh SELECT sku should it be
 
11:13 AM
@Saitama yeah, geoguessr is very cool. used to play this a few weeks ago
 
Or perhaps I just lack restraint when it comes to games.
 
Got rekt by a smaller one again
@Gordon :)
 
Still no success, dammit I used this already many times but I receive no success :D pastery.net/qkjuam
 
> Your final length was 2355.1!
 
11:18 AM
Man, hetzner sure is taking their time getting our new server up.
 
Epo, also, they're not that cheap
 
Wes
@Saitama holy crap i suck. selected belgium, was new zealand LOL
 
:P
 
@VamsiKrishnaB \o/
 
Wes
libya -> san francisco. wtf african looking california
yeah got one! :D 174 miles diff only
 
11:25 AM
@Epodax it can? nah
 
@Wes I got a pretty good one, luckily I was next to a sign telling me how far Ankara was at the next turning :P
 
Wes
lol
 
> Your final length was 4607.5!
 
@Wes protip: drive around for some time until you discover a road sign or similar hints
 
Wes
got a lucky one too, i've seen an orange truck, i guessed snow and happened it actually was siberia :B
@Gordon that's cheating :D
 
11:31 AM
@Wes if it was cheating they would have prevented us from driving around :)
 
@Saitama Nice 8125 points on my first attempt. Not too bad
 
That's me now ^
 
:D
It's fun trolling people, getting to ~1000 length then dying in a crowded area
Then seeing those 50k length fighting over me and dying
 
Wes
best i could do so far is 6000
 
@Saitama ┬──┬◡ノ(° -°ノ) STOP FLIPPIN THE TABLE
 
11:35 AM
My strategy is to wander around a fat guy, and when that guy dies, EAT ALL OF IT
 
That's everyone strategy though
 
@Oldskool De ja vu
 
You gotta take it once step forward
 
@Epodax Yes, I like to steal good ideas ;-)
 
if your nick is good , some people wont bother attacking you
 
11:37 AM
go head-on with a fat one - little ones are favored in the collision
 
Wes
8606!
 
@VamsiKrishnaB my nick is lelouch
 
how can I get ::class on PHP 5.3?
 
get_class()
shame on you
:P
 
I can't even remember when I last used 5.3
btw, @SergeyTelshevsky , did you finish reading this thing: pdfiles.com/pdf/files/English/Databases/SQL_Antipatterns.pdf ?
 
11:44 AM
@tereško also there's __class__ if you use it inside the class
 
naah, I need it "externally"
 
not this one, I've looked through some other book, there was also some presentation
I think Danack linked it
why do you ask?
 
it's a recommended reading material, though the usefulness depends on ones skill level
 
@tereško hmm, was there any serious issues on the upgrade path from 5.3 that would prevent you from moving to a > 5.3 version? /cc @SergeyTelshevsky
 
11:48 AM
yeah, as I mentioned earlier, there were issues with loads of legacy code using deprecated stuff
 
I think there were some changes in error reporting
 
Im building a 1page form which should check if values matches the DB y/n.
For now it's working but could I add some improvements? https://www.pastery.net/eqhucx/
Oh and I was not sure about htmlentities is that still needed in PDO?
upper/lower- case and postive numbers are only allowed.
 
@Duikboot htmlentities is for output not input
 
/me knock's head on the table indeed
 
11:53 AM
> 10467.8
\o/
 
@Gordon Other remarks? Currently I posting the form the same page ( server self ) What's the best way to push the $errors being generated on the validation method to the front end? I have some empty checks as well in the isset and they work. But the ones on the validation method are not.
 
@room: Not really PHP related, but your suc a clever lot i'm sure someone will now- In Stripe if someone renews a Subscription does that subscription id change or does the dates just get updated?
*know
 
Anonymous
funny to see downvotes but no answers xd — Dani Roca 5 mins ago
 
@Duikboot I dont understand what it does…
 
@Jay ha ha ha
 
11:57 AM
It checks if a serial number exists y/n Based on the SKU and Date value in the database, if both fields are just incorrect it just say invalid .
 
Anonymous
@CiaranSynnott thanks?
 
your mixinf two database connections
mixing*
 
Anonymous
...
 
Anonymous
I mean, i'm not?
 
Anonymous
11:59 AM
@CiaranSynnott Think you have the wrong person ;)
 
Anonymous
@CiaranSynnott Also w3schools is shite.
 
@CiaranSynnott as a rule id doesn't change ..thats what makes it an id
 
@Duikboot you are not using fld_no and prefix. also validate_values doesnt return anything. errors isnt initalized beforehand. ok, it doesnt have to be, but why not be explicit? then, why are you using a post for that operation? also, cant you do this in one query? finally: closing php tag is unneeded and considered bad practise.
 
"TEDdybearnoose"
 
Anonymous
12:05 PM
@Oldskool cocaine.
 
@Oldskool seems like thesis on hello world :P
 
@Duikboot I dont see you use $errors. you only echo if its matched. echo'ing is bad practice because functions should not echo because it's a side effect. make it return $error or something
 
@Epodax cunt cool guy
 
Lets say I have a directory structure like this: htdocs/myproject/map1/file.php. When I use: $_SERVER['DOCUMENT_ROOT'] I get something like: "C:/xampp/htdocs" I want to get "C:/xampp/htdocs/myproject/" though. Now I know there is nothing special about that directory that php should recognize as the directory that I want. How could I let php know I want that specific folder besides hardcoding? Is there a way?
 
@Jay doodoodoodooooo doodooooo doodoooo… doodoodoodooooo doodooooo doodoooo … cocaine
 
Anonymous
12:13 PM
@Gordon Are you ok?
 
@Jay He might be OD'ing by the look of it.
 
@Loko when you bootstrap your project you can define('APP_ROOT', __DIR__); - assuming your bootstrap file is in the directory you want
 
@Jay @Oldskool oh, come on… you know that riff
 
@Naruto ノ┬─┬ノ ︵ ( \o°o)\
 
Kay
What's the best way to encrypt passwords that are already stored in plaintext in a database?
 
12:15 PM
@Gordon Maybe if I hear it. Phonetically it doesn't ring any bells.
 
> 18195.7!
 
@Kay do not encrypt passwords, php.net/password_hash
 
@Oldskool youtube.com/watch?v=pJyQpAiMXkg /cc @Jay - though the original is by J.J. Cale
 
\o/
#1
 
Anonymous
@Gordon I presume nsfw ;) - So i'll leave it for now :D
 
12:16 PM
@Jay it's totally sfw
 
@Jay No, it's very SFW
 
It's youtube, how can it not be SFW? :o
 
Yes but when I return them where should I 'catch' them sounds maybe a bit weird but it's the one page structure that makes is a bit confusing.
 
it's only a small step from SFW to SJW... let's keep it NSFW guys...
 
Anonymous
@Gordon @Oldskool Ah my bad
 
Anonymous
12:18 PM
@Epodax You need to spend more time on youtube..
 
@DamienOvereem o/
 
@Epodax err...
 
pastery.net/veavnk Mentioned a small Q in there, @Gordon
 
@Leigh thanks. It works
 
12:20 PM
Doesn't youtube remove anything remotely NSFW?
 
@Epodax Nope, you can opt-in to potentially unsafe content
 
... I gotta find out how
 
And oh, I will make it 1 query soon :) just for now I want it this way.
Soon I want to validate those fields with AJAX. But first I want to have those errors working.
 
Ekn
hmm...this is actually lookin better
 
@Ekn your screen is beautiful
 
12:31 PM
@Gordon Really? xD
 
Ekn
it is :3
 
@Oldskool really! ;)
 
Ekn
lol
 
filezilla :}
 
Ekn
by the way, "yakuake" is pretty nice
(for a sec thought it was visible there)
 
12:36 PM
@saitama 4000 max:( DAMMIT
 
@Naruto :P
A lil while ago, I became 43xx.x in length and a guy named 'PLZ EAT ME' ATE ME!!!
 
@Saitama What a liar! - The guy named "PLZ EAT ME" that is
 
:'(
 
@Ekn BTW how did you get that dark theme on the chat? Are you enforcing a custom CSS or did I just plain miss that option? :)
 
12:41 PM
shouldn't have checked that link at work, i'm an addict now xD
 
@Naruto Well, they DID link it as "RIP productivity"
 
@Ekn Cool. Thanks :)
 
Ekn
de nada
 
yeah.. but but.. I was so curious.. xD
 
12:42 PM
@Oldskool I use Stylebot
 
I think GreaseMonkey lets you apply custom CSS as well
 
Ekn
yep, that's what I will be using
 
Lemon wrote an SO Chat Dark theme for Chrome
 
Ekn
oh wait, actually it might not be like that
@littlepootis that's what I first saw
 
i have a dark theme chrome plugin for slack because I have it on the second screen with me IDE which uses a dark theme as well
 
Ekn
12:47 PM
oh the purple-ish theme was the least boring... a dark theme would be nice on slack(actually, imo on almost any useful site)
 
for some reason I prefer the default on stack overflow though
 
Ekn
that looks pretty neat, thank you
yeah me too, just except when I try not to sleep
 
@Gordon Nice. Too bad that you can't darken the native app though.
 
despite I always use dark themes everywhere possible I tend to use default stack overflow too..
 
wth is slackbot.
 
12:56 PM
@Epodax You're not buddies with Slackbot yet? Oh my...
You're missing out!
 
@Oldskool yepp, I didnt find the native desktop app useful enough to bother. only use the app on mobile and the web thing on desktop
@Epodax kinda like Jeeves with more addons
 
@Gordon I really like the app, always have it on when I'm at work. But you can only theme the sidebar :(
Main window is a set theme.
 
@Gordon Thanks. Well I check in my template if empty $errors... but I always get the : 'Undefined variable: errors in ajax-serialno-check/index.php on line 37' And line 37 is return $errors;
'
 
Aaaaand now I need to find out what slack is
 
So... slack is IRC?
 
12:59 PM
@Duikboot did you initialize it, e.g. pastery.net/mtprbm/#l-12
 
yesh that's gone but it's doing nothing :D
 
@Epodax slack is like hipchat is like SO chat is like IRC /cc @littlepootis
 
@Gordon So... Another chat channel / program thing? And slackbot can be used for it?
 
@Epodax yes, you can use slackbot to automate lots of things.
 
Ekn
that reminds me I could've used that /remind me thing more often
 
1:02 PM
Well yes I do, :) but the $errors keeps empty even when I submit an empty form or one with wrong data.
 
ah well, no need to get a slackbot when I don't even use slack.
 
oh i see some other issue but that has nothing to do with the errors
 
can anyone tell me, how do I start MVC Structure in PHP with PDO Database and Routing
 
@Epodax try phpug.slack.com
 
Ekn
/me waves a too broad flag
 
1:04 PM
When I try to do: var_dump($errors); before the return it's also empty merde :D something is wrong
 
@Duikboot this looks good to me. it should give you that undefined var error
 
@Gordon What is this?!
 
@Epodax a public slack for php usergroups
 
oh
hrm, you HAVE to create a team? you can't just create a user profile? :(
 
hold on, I'll fetch the page where you can get the invite
You can now get an invitation for the phpug-Slack-Channel via https://slofile.com/slack/phpug
 
1:09 PM
Guys, I am using an API.
And I have about 8 calls.
It takes about 2 seconds for each call.
And my internet speed is good enough.
Could it be improved?
 
probably
 
What could be done?
 
profiling
 
What is that?
Oh.
 
figuring out where it's slow
 
1:11 PM
Only at the API calls.
I did a full check.
The rest of the code takes only 0.000304 seconds.
But the API takes 16 seconds.
 
Probably using SSL. over CURL or a socket?
 
if the api is not under your control, there is not much you can do besides caching the calls
 
$ch = curl_init();

        curl_setopt_array($ch, array(
            CURLOPT_RETURNTRANSFER => 1,
            CURLOPT_HEADER         => true,
            CURLOPT_URL            => $sUrl,
            CURLOPT_USERAGENT      => 'PHP-HaloAPI',
            CURLOPT_HTTPHEADER     => array(
                'Ocp-Apim-Subscription-Key: '.$this->sApiKey
            )
        ));
$resp = curl_exec($ch);
        if(!$resp){
            die('Error in API call: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
        }
        else{
            // Then, after your curl_exec call:
            $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
            $header = substr($resp, 0, $header_size);
            $body = substr($resp, $header_size);
        }
        curl_close($ch);
Is there any issue in the code?
(I haven't written this code. Some other API).
 
Try adding CURLOPT_SSL_VERIFYPEER => false and CURLOPT_SSL_VERIFYHOST => false
 
1:14 PM
and ping or traceroute the endpoint from the shell
 
@Gordon it's this what's causing the issues : if (!$res['prod_date'] === $fld_sku ) { it's never the same it says even when it is. oh and im comparing 2 strings
indeed but that's fixed already
 
@Duikboot well a date is not an sku
 
If it's verifying the SSL certificate every time that could save you a bit
 
if (!$res['prod_date'] === $fld_date ) { and if (!$res['sku'] === $fld_sku ) {
 
downside is it's slightly less secure since you could be falling victim to a MITM attack. It's a tradeoff
 
1:16 PM
@Saitama production levels -2000
 
@Machavity Very, very, very bad idea.
 
@Machavity Oh security is an issue.
 
@Duikboot I cant tell whether that is a problem without knowing whats inside the vars.
 
@Machavity Real money is involved here.
I tested, and it got worse.
lol
It averaged to 16 2/3 before.
Now it averages to
 
@HassanAlthaf Then you're probably just going to have to live with it. You can't speed their end up and you can't speed the SSL handshake up without sacrificing security
 
1:18 PM
18 seconsd.
@Machavity Would Queues work?
(I'm using Laravel framework).
 
@HassanAlthaf Have you considered something asynchronous?
 
@Machavity Yeah. I want that. Can you do that in PHP?
 
@HassanAlthaf As you said, either queue it and add it to some automated process (gearman, cron, etc) or AJAX it
 
pastery.net/nqnkka @Gordon Well that's in there.
 
@HassanAlthaf since you are using the HaloApi client, I assume you are also using developer.haloapi.com/products/560af1e42109182040fb56fc which says 10 req/10s. Could it be you are throttled down?
 
1:21 PM
Reality is every payment page I've seen is slow or does it async (Amazon, newegg, etc)
 
@Gordon I did suspect that. I placed in an exception to be thrown if it gets throttled down to make sure it doesn't.
 
@Duikboot so, its the same number. should give an error then
 
Using == instead of === works
 
@Machavity The SSL handshake won't be the issue.
 
@Duikboot oh, wait… mysql returns strings of course
 
1:23 PM
If the number IS in the DB = no error
If the number the user filled in can't find find: throw error.
 
@Duikboot well, === also compares the type, so make sure both sides of the comparison have the same type… or use ==
@HassanAlthaf the only other thing I can think of right now is to traceroute to the api endpoint to see if anything en route is slowing you down
 
@Gordon How do I traceroute on a mac?
By the way, my friend suggested this thing:
Make two calls.
and get data
instead of 8
We are actually fetching 8 different players.
And finding the latest common GameID
 
@HassanAlthaf Just open a terminal and traceroute <target>
 
@Oldskool I need to urm, place in a header to use the API. Could I do that?
 
@HassanAlthaf well, obviously if you can fetch them with less calls, you should do less calls
 
1:28 PM
@Gordon But we are sacrificing something. We are basically allowing players to exploit the system.
We need to find a common game for the 8 player.
Never mind, we made a design change.
With that, the user doesn't have to wait for so long.
 
Is there a simple solution to display this as a jpg file in php without uploading it to my ftp and convert it there?
http://fontmeme.com/embed.php?text=QWERT&name=%20Across%20the%20Road.ttf&size=30&style_color=4A4A4A
 
base64-image.de @TechTreeDev ?
 
base64_encode
Was the function I believe. @TechTreeDev
 
Hm. I thought about this but BB code has a problem with that
 
@TechTreeDev What's the problem?
 
1:34 PM
I generate these Pictured based on variable unsernames as this could be done there easily in the URL. Then I'd like to show this Image at the End of each user's post using BBCode's [img] tag. On some versions the given source displays the image, but sometimes it doesnt. That's why im looking for a way to show/convert this to a "valid" imagetype
 
I don't think you have to save that image.
I used to use a script. Let me find it.
 
That would be awesome
 
I believe that script doesn't save.
 
@HassanAlthaf Thanky, I'll have a look at it
 
Is this:
FROM Orders, Products WHERE Orders.productId = Products.id

... the same as:
FROM Orders JOIN Products ON Orders.productId = Products.id

???
 
1:39 PM
what do you call the thing, which a decorator is decorating?
.. and, no, "Decorated" is not an acceptable answer
 
@tereško instance
or decoratee
decorated would be okay for me, too
inner would also work for me
 
I will go with "instance"
 
or whatever the type is if its a typed decorator
@ErikLandvall is your question whether it will do a join or which join specifically is used?
 
@Gordon My question is if they both would give the same result, if they are alias to each other?
...if they are two ways of wring the same thing
 
hi guys
 
1:51 PM
If a server is not accessible, what HTTP error code does it return?
 
it doesn't
 
@HassanAlthaf none?
 
So.. if I make a request.
I can't find out if the target server is down?
 
if it returns something, then it's accessible
 
1:52 PM
@ErikLandvall run them with EXPLAIN
 
Thanks.
 
I have a website setup as header.php,footer.php, page1.php,page2.php. On page1.php I include both header and footer. Now if am to setup analytics correctly should I have it in my header.php?
 
@GotaloveCode probably
 
If active record is the devil, is there an ideal better solution or many different kinds of implementations that don't use it?
 
@Gordon ok, I just don't have access to the db yet, but I do it somewhere else to see
 
@Sean I dont understand the question, but if you are looking for alternatives to AR, consider the Data Source Architectural Patterns at martinfowler.com/eaaCatalog
on a side note: AR isn't necessarily the devil. It's fine in small crud apps with little impedance mismatch
 
@Gordon alright.Thanks. Btw is it right to have one site.php with a conditional case to grab home.php,contact.php? or is the better practice to just have the home.php,contact.php include (header.php and footer.php)
?
 
@Gordon That link is super helpful, thanks!
 
@GotaloveCode there is many ways to skin a cat… if that answers your question
@Sean buy the book. its good.
 
I think the 1st one would mess up analytics but am guessing.Since it would seem to be the same page
 

« first day (2007 days earlier)      last day (2951 days later) »