« first day (1753 days earlier)      last day (3421 days later) » 

12:00
Do HTTP response headers contain the status code?
posted on August 04, 2015 by kbironneau

/* by Matt Bennett */

@Jimbo the status line contains the status code...and is in the header section.
@Danack Basically, if I used CURLOPT_HEADERFUNCTION and supplied a callback for it, would the status code be in there somewhere, as it's a header, even though you can get the status code via other means with cURL
@Jimbo I would be marginally surprised if it was, the status line does not have the same format as an actual header:
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
But it would be useful so maybe?
@Jimbo Why are you using cURL?
12:10
@DaveRandom Legacy aids twitter
@DaveRandom what do you propose instead of curl ?
sorry suggest* ( multiple ping fail )
So yes, it does receive the response line
@NullPoiиteя Artax personally, but more generally any HTTP lib with a sane API
Which curl does not have
how could i forget Artax :(
user895378
I'm about to finally embark on the long-awaited artax rewrite now that I have stable underlying libs
user895378
morning
12:17
good morning
later
user895378
@Fabor lol
Anonymous
morning
morning pretty ...
user895378
Funny, I heard a phantom ping sound and switched tabs just when that message was posted. Telepathic connection? Probably.
@NullPoiиteя Because he made it async oriented
Bastard
12:27
hi,any one have idea about Asterisk VOIP
for php which interface better to use like PAGI,PAMI or PHPAGI..
i am very new to the Asterisk VOIP process. could any one used
?
@Jimbo It's totally usable without async context.
@kelunik I know :D Just had a simpler API when it was sync
@user3454479 I believe thee only person who might be able to answer that is @DaveRandom
who said what about who now?
@Jimbo Just wrap it. ;-)
12:35
@user3454479 run. very fast.
/he talks from experience...
Run and never look back.
Actually I never tried to make PHP talk to Asterisk, I never got to the point where I made Asterisk work reliably enough to make it worth my while trying to control it programmatically. It's a long time since I tried though
If you're integrating to an existing system, then you obviously have no choice in tech. If it's not a legacy thing, then I'd look at twilio.com which is meant to be not terrible.
12:39
PAGI/PAMI seem to be more alive than PHPAGI
It really depends what you are trying to do though
Very loose tangent: @Fabor how's your ADSL looking now?
Still the same speed which is nice. Wife says she gets cutouts during the day though, but I've not experience them.
We have created the application using cakephp 3.0 that an application runs in an Iframe.

Now the problem is not able to get the session value in the safari browse
Anyone please, help to get the session value in safari browser
user924016
you want the session_id of the session that is inside the iframe, outside the iframe?
Anonymous
is it possible to create singletons or a single instance of an object without using static methods? or global
@RonniSkansing I got the session, But not able to overwrite the session id in safari browser
12:45
@Fabor Would be good to know if router sees auth and/or line drops when that happens, you need a syslog server for that, it's easy enough to set up if you can be arsed and have a machine to run it on. I still think the line probably needs re-profiling but should do due diligence before making a bit noise with the ISP about it
I did ask them but got a "doesn't need it response"
user924016
@samaYo yes
@DaveRandom I'm not familiar with asterisk at all, I just know it works with our php apps and the whole 700+ phone agent call center is based around it
but the legacy code I've seen is worse than nightmare
^ this
I know it can be made to work, but I also know it's pretty fragile and some of the src is 10~ years old and truly horrifying
andddd we have 6 people who manage it as their full time job
12:48
yup, sounds about right
don't get me wrong, I'm not saying I have a better equivalent product. I am, however, saying I have many better non-equivalent paid products
The underlying problem is that programmers don't understand telephony, while telecom engineers don't know how to program
Anonymous
@RonniSkansing thank G-d you exist :)
You can see this quite easily just by looking at softphones client phone partner software for traditional PBXs. Even the really big names can't get it right.
Anonymous
@RonniSkansing now get to the telling
user924016
@samaYo put into a g*d awful global
We have created the application using cakephp 3.0 that an application runs in an Iframe.

Now the problem is not able to get the session value in the safari browse

Anyone please, help to get the session value in safari browser
Anonymous
13:02
@RonniSkansing huh? example?
user924016
like $_ENV
user924016
you could also just inject down the same dependency down the chain
Anonymous
I have some trust-issue with enviroment variables ... never tried it once.
user924016
well could be any globals array
user924016
but its a horrid way of doing anything
user924016
13:04
what are using the global for?
hi all
SELECT custId,cust_nm,cust_add,cust_mob,
                   DATE_FORMAT(cust_marrige,'%d-%m') AS cust_marrige,
				   DATE_FORMAT(cust_dob,'%d-%m') AS cust_dob
                 FROM cust
				WHERE Month(cust_dob) = ".$month." AND Day(cust_dob) = ".$date."
				     OR  Month(cust_marrige) = ".$month." AND Day(cust_marrige) = ".$date."";
@KarthikKeyan stackoverflow.com/a/6139648/747609 might help you
this is my select query i want to select next day record
how it's possible
@KarthikKeyan Didn't I already gave you like 3 possible solutions?
Anonymous
@RonniSkansing to limit \PDO instances
Anonymous
13:10
I don't want to use static methods in my container
@PrashantBhatt Your naming is just horrible
user924016
Your table is already called cust and yet you've still felt the need to prefix each column name with cust... which mean that you have a column called nm. Seriously, is the something wrong with typing name?
or address or mobile_number for that matter
Also for the record, it's spelled "marriage"
@DaveRandom it that anything wrong with that naming
user924016
yes, cust is imo a bad abbreviation
13:14
Descriptive names cost nothing
an asshole the built the crap application I have to manage thought it was cool to name a function _f()
I'm waiting for the day I finally meet him...
That's why I called my first child My First Child instead of MFChld
I wonder it they'd let you name a child something completely unpronouncable
Anonymous
@RonniSkansing it's a very small project, built on less than 400 lines of code, using a DI container that uses reflection to get dependancy from a type hint would be a crime :)
> Have you met my son, zfgdxfgxxxxfdlmngfqrqrqrq III?
user924016
@samaYo then just inject in the \Pdo dependency to the consumers of it
13:16
^^ that's pronounced "Luxury Yacht", by the way
user924016
class Foo {
  protected $pdo;
  public function __construct(\Pdo $pdo) { $this->pdo = $pdo; }
}
there's a couple that did that... in Sweden I think
@SamaYo use pimple then... or don't use a container
@DaveRandom My son's name is Brfxxccxxmnpcccclllmmnprxvclmnckssqlbb11116 pronounced [ˈalbɪn]
> In 2007, Michael and Karolina Tomaro fought to have their daughter named "Metallica", after the metal band.[3] Tax officials determined that the name was "inappropriate", but the Göteborg County Administrative Court ruled in March 2007 that there was no reason to block the name, stating that a Swedish woman already uses the middle name Metallica. Tax officials did not agree with the decision and denied the parents a passport for their daughter, but later withdrew the objection.
Seriously, I know the parents think they're being clever, but the child has to live with that name...
13:20
Says the guy with Random as last name...
Says the guy with Haa as last name...
@salathe :P
Abe
Abe
@salathe and more importantly with Pee as first name
@DaveRandom Amen to that... and giving your child an oddly spelled name just damns them to correcting people for the rest of their life.
user895378
@PeeHaa His real name is actually @DavePseudorandom but few people really knew the difference and he just shortened it.
Good morning
> little bobby tables we call him
good mornings
@ircmaxell Mornings
13:26
@ircmaxell morning...
@ircmaxell how's the new job?
@iroegbu There was a guy whose surname was tollemache-tollemache (double barrelled, but each portion was pronounced differently) - struggling to find ref but I've seen it before
@rdlowrey I might change it to CSDPR
user895378
@ircmaxell o/
@Orangepill so far so good :-)
Pseudorandom... how predictable..
@PeeHaa Yeah i got but is not work in the safari
13:33
@KarthikKeyan You have tried all three solutions and neither of them worked?
@Abe I turn off strict mode
@DaveRandom found many instances of tollemache-tollemache, pronounced /ˈtuːlmeɪk ˈtɒlmæk/
Abe
Abe
@ircmaxell i wouldn't have expected that :P
r5d
r5d
Hello everybody! I want to make a very tiny Prolog compiler in PHP. Is there any suggestion for me?
think again
13:41
:D
SELECT custId,cust_nm,cust_add,cust_mob, DATE_FORMAT(cust_marrige,'%d-%m') AS cust_marrige, DATE_FORMAT(cust_dob,'%d-%m') AS cust_dob FROM cust WHERE Month(cust_dob) = 08 AND Day(cust_dob) = (NOW(),INTERVAL 1 DAY) OR Month(cust_marrige) = 08 AND Day(cust_marrige) = (NOW(),INTERVAL 1 DAY)
yes, it's not working
i can't fetch value Day(cust_marrige) = (NOW(),INTERVAL 1 DAY)
what is wrong with it
comparing scalar with tuple - that's a weird idea..
my condolences
@PrashantBhatt Can you explain what "(NOW(),INTERVAL 1 DAY)" is meant to represent?
13:47
has that tour been around for long?
@MarcelBurkhard years at least.
@PrashantBhatt You are trying to get people who's wedding anniversary is tomorrow?
@PrashantBhatt if so you might get more mileage out of something like date_format(date_add(now(), INTERVAL 1 DAY), '%m%d') = date_format(cust_marriage, '%m%d')
@Orangepill fyi just using TO_DAYS() is likely to be more performant that using strings.
@Danack leap years... I thought of that
?
You're implying to_days isn't aware of leap years?
14:00
@iroegbu Yeh I suck at searching for stuff like that
@Orangepill no. String comparisons is the absolute last resort for dates
You want to extract the components as ints and work with them that way
Not least because often indexes can be optimised for this kind of op, but you're throwing all the indexes away when you stringify it
@DaveRandom that makes sense
You don't want one of those stringly typed databases
but extracting as an int would be the same I would think... but it would probably be better than extracting as a string
Hi All, Could you please tell me what actually php does if i call crypt function as:
crypt("password", '$6$'); i.e without salt parameter
I once worked with a legacy system where the PK of a table was a varchar(11) which was used to store an auto-incrementing int, the id generation was done at the application layer and was not atomic
14:06
I suppose it would just hash( using SHA512) the password with default number of rounds. Is it right?
posted on August 04, 2015 by kbironneau

/* by Tristan et Julien */

Free root canal with proof of PHP Internals mailing list subscription!!!
@Tarun don't do that
@Orangepill I'm pretty sure all databases store all dates + times as ints internally....otherwise indexing them would be horrific.
@Danack I can confirm that.
@Danack MS store them as floats because MS
14:08
@ircmaxell Could you please tell me how should i use it.
@Tarun password_hash
@Tarun By not using it directly and using the password hashing API (compat lib for PHP <5.5)
TO_DAYS would be an effective way to get the number of days between to dates ( though date_diff would probably be better) but once you have that you can't just see if the difference % 365 == 0 because leap years ... not all years have 365 days
@Danack how does it store dates < epoch?
@FlorianMargaine No idea, but I suspect the answer involves using enough bytes to store stuff, and so to not have the problem in the first place.
14:12
@FlorianMargaine iirc innodb stores a struct of {char, short, uchar, uchar, uchar, uchar, uchar, short} (sign, y m, d, h, i, s, ms)
@Danack that's not true.
It doesn't store that as epoch-based timestamps, rather a collection of ints
@DaveRandom I see
 1 bit  sign           (1= non-negative, 0= negative)
17 bits year*13+month  (year 0-9999, month 0-12)
 5 bits day            (0-31)
 5 bits hour           (0-23)
 6 bits minute         (0-59)
 6 bits second         (0-59)
---------------------------
40 bits = 5 bytes
@NullPoiиteя can i use SHA512 hashing with this function.
14:13
^ assuming a datetime
Like I say though, I know for a fact that MS use a double with <days since 1900-01-01>.<ms since start of day> so there's definitely more that one way
TIMESTAMP is stored as an integer, where DATETIME is stored as a byte encoding
@Tarun no, and nor do you want to
@Tarun CRYPT-SHA512 is demonstrably weaker than bcrypt, hence there is no reason to use it.
from mysql internals doc timestamp is defined as A four-byte integer representing seconds UTC since the epoch ('1970-01-01 00:00:00' UTC)
@Tarun why i am feeling like you only want to listen Yes, And if that it all you want to hear than YES you can use anything you want
Hello gurus, I hope I'm not interrupting, is there any chance someone could take a look at my question about composer/namespaces? It's only had 2 views and is now well out of sight.... stackoverflow.com/questions/31811393/…
14:19
@Orangepill timestamp yes, datetime no
That's the fundamental difference between the two datatypes, the TZ stuff is just an affectation
@Jodes should be "Jodes\\" : "src"
^^ that.
@Rangad, brilliant, thanks, will try that!
and @Danack :)
It worked! Please do post that as an answer so I can mark it as correct!
11 mins ago, by Orangepill
 1 bit  sign           (1= non-negative, 0= negative)
17 bits year*13+month  (year 0-9999, month 0-12)
 5 bits day            (0-31)
 5 bits hour           (0-23)
 6 bits minute         (0-59)
 6 bits second         (0-59)
---------------------------
40 bits = 5 bytes
@NullPoiиteя @ircmaxell Thank you so much. Unfortunately i cant use password_hash since the PHP version installed on my Organization's server is <= 5.5
@Tarun ^^^this
@ScottArciszewski are you sure that bin2hex needs to be made cache-timing safe? Actually, it's 16 bytes… all you'd need to is ensuring that the lookup table is allocated on a 16 byte boundary in order to make caching effective. [as cache line sizes typically are 64 bytes. (rarely 16 or 32)] … Also, hex2bin could be changed to a branchless version which might be more efficient due to avoiding of frequent branch misprediction.
I don't think we'd need separate functions there.
Anonymous
14:48
pretty this can be made even smaller github.com/fabpot/twittee/blob/master/twittee.php
@SamaYo yeah .. $container = new stdClass();
no.. It wouldn't do the same thing
feel like there should be an is_callable check on the __set method
@ScottArciszewski Though, to be fair, I'm not sure if we need to add further timing resistance to hex2bin() as you only get the times on the whole string. All you know is how many 0-9 and how many a-f are in the string. Sure, it reduces the strength, but not sure if that's leaking too much.
@samaYo <?php $c = [];
@samayo you could also look at pimple for something light
or Dice
15:05
hey guys If any buddy could please give me suggestion why I see this error on live server while the same connection works fine on localhost?
Invalid DB Connection String (CI)

$dsn = "mysql://timely:i/Hq1cih8fdG@localhost/timely_mws_bash78";
$siteDb = $this->load->database($dsn, true);//Invalid DB connection string
15:18
Morning guys
lfkxbfdhgdfg
Morning
I have a question.
Suppose we have joined 2 tables data using the UNION clause. Both of these tables have a same column called 'Sale_ID'. 1 table consists of a purchased data while the other one stores the installments data against it
Now my question is how can I get the last row of each Sale_ID row ?
@bwoebi yay, finally changes landed. and it turned out that most of the remainig pass_two handling was unnecessary as well -- for some reason I thought there were still jumps that weren't handled by the compiler code
@NikiC yeah, I've seen :-) Good that this had been moved out of pass_two() now… makes it simpler :-)
15:24
yes...
Please see this pic here
I want to calculate the total right over that cell
But how do I know that it's the last row of that Specific Sale_ID ?
The last 3 rows are installments against that purchase
In other words I'm trying to create a ledger
Dear World: Images are a terrible way to communicate anything related to programming to someone else. Stahp. kthxbye
@Orangepill can I get a hint ? :P
[Guzzle\Common\Exception\RuntimeException]
The PHP cURL extension must be installed to use Guzzle.
@rdlowrey
15:30
@ZahidSaeed You design your schema is such a way that you don't have to ask that question.
user895378
@kelunik yeah, that's the problem with that coveralls client. After I get artax running with the new amp we need to make our own coveralls client to do the same thing. Should be pretty straightforward.
Is curl installed with the default Travis nightly?
@rdlowrey "coveralls client" is a new term to me ...
user895378
@kelunik yes
15:35
I was going to suggest using my artaxServiceBuilder to generate an API....but as it seems to be about two calls.....probably not worth it....
okay cool..
Does anyone know regex
Never met the guy.
user924016
regex?
@RonniSkansing Regular Expressions
15:39
/goes to buy beer
user924016
later
@iamtery what's the problem ?
@ZahidSaeed are you familiar with it?
Im stuck
@iamtery I'm still on learning stage. But anyway ask your question maybe I could help you a little bit
@iamtery As general rule, questions are easier to answer after they have been asked
No-one is going to agree to help before they know what they are agreeing to...
15:41
iam teryiam tery
8:21
00;TEST;Delete;Delete;Delete;keep|| So im trying to find the number and delete the stuff that has delete using regex this is so far i got ^\d+\;
user924016
forgiveness is easier to obtain than permission
@iamtery What do you mean by "the number"? Please show example input and output
@iamtery Where's the string ?
01;TEST;Delete;Delete;Delete;keep||
15:44
@iamtery So you want to extract numbers from that string. Right ?
can anyone help me installing php 7 in my debian?
Looks like a semicolon delimited list. Why not explode by semicolon and array_filter ctype_digit?
...or just use a sane data format
So number is going to be replaced With new letter let's "hey"
@Manulaiko You have to build from source at the moment
15:46
How about this :
$string = "01;TEST;Delete;Delete;Delete;keep||";
preg_replace("/\d+/", "hey", $string)
@DaveRandom I've already downloaded the sources, I've read the instructions and it says that I need to specify the extensions, but I just executed ./configure, will it load the extensions like PDO, sockets, file io...?
@iamtery Regex is probably not the best tool for the job. You have vector data, regex is really for scalar data, specifically strings. It probably better to treat this as the serialized vector that it is - i.e. unserialise it to a data structure, manipulate the values as needed, the reserialise
It might seem more complex but for this case it will be more correct and it will likely serve you better in the long run
@iamtery Does that fixes your problem ?
@Manulaiko Just add --with-* and/or --enable-* flags for the extensions you require. Run ./configure --help to see the options available on your system.
omg omg omg
15:51
A lot of stuff is built by default, but if you are going to do custom builds I personally think it's better to explicitly specify every extension you want
using emacs as my window manager :D
God damn emacs
@DaveRandom ok, once it's configured and I do make all will it be ready to use with apache or will I need to do anything else?
C-x M-c M-Butterfly --- in case anyone doesn't get that reference
@DaveRandom And then you want to use PHPUnit and start recompiling again and again because of missing dependencies. ^^
15:54
@ZahidSaeed im using notepad++
@Manulaiko I've actually never built the Apache module SAPIs, I'm not sure what the options are to do it. Again, you will need to examine the configure options. Obviously you'll also need to ensure that Apache is looking in the right place for the module lib. I can't imagine it's too difficult though.
@Sherif M-x butterfly is a thing in emacs nowadays :)
@iamtery It doesn't matter.
@DaveRandom ok, thank you for poiting me :*
This code will work on any code editor :P
15:56
@DaveRandom --with-apxs fyi
@kelunik I've started building Shared Modules Most Of The Things for pretty much this exact reason
You know we do have an installation guide in the manual php.net/manual/en/install.unix.apache2.php in case everyone's forgotten.
It maybe a bit old, but probably still informative.
@Sherif Thanks, but if I ever find myself needing to know that I'll be taking a long hard look at my life :-P
@DaveRandom Yea, well after you've had to build 40 different version of PHP on a few thousand servers, assemble your own debs, and maintain several pools with all kinds of wonky configurations ... some shit just gets stuck in your head that you can't unstick
@tereško I understand your pain with Kohana
16:00
it was long long time ago
In a galaxy far away?
Or is it simply that you can still remember how that music used to make you smile?
@DaveRandom I was actually doing for: youtube.com/watch?v=WqukWXviyew
well, fuck it, I'll experiment by myself, since I'm using ParrotSec in live mode with persistence if it doesn't work I'll just reformat the persistence and it's done
Ahh. So the latter then. Well that's less violent, I suppose.
@ircmaxell what was the stray that broke the camel's back?
16:03
@tereško that it exists
heh
I'm just wondering: is it somehow related to your new job?
/me shivers at the mention of Kohana
@Sherif well .. it was the reason why I started reading about SOLID, MVC and SoC. Up till then I was doing include oriented programming
@tereško yup
16:07
@tereško Oh yea, include oriented programming rocks :)
Especially when you have like 40 nested includes all in nested conditionals
What's the worst that could happen?
the scary part it that there are people, who have been writing php for 10+ years and are still writing like that
times are changing
I believe it
It's easy to become a dinosaur in this industry
which version of Kohana are you dealing with?
heh
16:11
not sure
@bwoebi BTW, that phpdbg btree code really came in handy :)
the bootstrap file contained the version info, IIRC
@Sherif =) … seems I did a good job then. Any feedback?
@bwoebi Well, I'm trying to figure out how the interface to expose the structure to userland should be and still be optimal, but your code gave me a few ideas.
I'm also trying to create an optimized suffix tree though, so...
@tereško old... I can't tell if it's latest or not (though something tells me it's not) dev.kohanaframework.org/projects/kohana2/files
16:13
kohana 2.x is really fucking old, it's even pre-HMVC (or what they decided to call it)
@ircmaxell Definitely not :)
the 2.x was still a CodeIgniter fork at it's roots
@bwoebi Objects in PHP just make the performance benefits of it a non-starter :/
I need @NikiC's brilliance on this one
hello! i'm working on some script and i need to use preg_replace. the problem is that i need to replace two dots (..) or more, but not one or three. For example -> "This is...something..here" should become "This is...something here". I was working on regex string to get this working, but didn't finish yet. Here is what I have: /([^\.]*)\.{2}([^\.]*)/i
@user1257255 why?
16:20
@ircmaxell why why? :D
why do you want to replace two dots?
because I get string from user which should be separated with space in the form of two dots... so two dots (or more than 3) should be changed to space.
@Sherif uh, pure objects aren't that bad… But yeah, you might want to run-time create them upon access?
@bwoebi Well, yea but it's the context switching that kills performance. Think of nextNode() method, for example. Traversing the tree proves more costly than it needs to be.
ah okay, the userland accessing is slow for you… yeah…
16:31
@user1257255 why is user even sending you something like that?
@tereško number of dots should be unchanged when the message arrive to my script, but those dots are instead of spaces. it's a special way of communication which hides actual separation of words... here are some rules about that, i'm just programming this, don't have much other info
it's either a homework or a seriously broken project
Abe
Abe
some people should really have the decency to hide their crap code rather than making it open source
like someone forced them to make it open?
I changed some code a bit and it got several orders of magnitude slower. Stupid low-level performance bottlenecks…
Abe
Abe
also, better to remain closed source and be thought stupid than go open and remove all doubts #rant
16:45
@Abe Open means you're code is automatically better, right?
@tereško sorry god because i'm learning, i just came here for help not for the feedback and comments of what i'm doing. if you want to help me than I will be thankful for this, otherwise you can easily shut up and switch tab in the browser. a lot of different communities are fucked up because of dumbs like you -> everyone want to have million users of their service, but when someone ask for help, they say do it yourself and when you will be pro, you can help other people.
Abe
Abe
@Sherif it's like they think it makes them sexier
probably after you reply to every single question for which you don't know solution :D
Morning.
Abe
Abe
16:54
@LeviMorrison \o
@user1257255 Pipe down son. Your problem is simple. You just use a negative look-ahead and negative look-behind in your regular expression codepad.viper-7.com/QruntW Google "PCRE Cheat Sheet". And try not to confuse not wanting to help with not knowing the answer.
It's off putting when you are the one looking for help.
what on earth did youtube do to their player
No idea.
I liked it better when it was ugly
16:58
@Sherif thank you very much for help. I got pissed off because he has almost every reply to my question in the same style ;)
I still think that what he is asking for is a bugsfix for a bad patch of a broken solution for a wrongly defined problem
Ok guys, I think I'm becoming overwhelmed. There are so many approaches by different experts all over the internet, it's hard to choose. I have my own ideas, but in humility, I've listened and researched others. Now my ideas are all mixed.
@user1257255 I get it. It just helps to remember that you aren't really entitled to anything in this world. Take your own advice and if you don't like what he's saying just ignore him.
I think I've narrowed down my biggest fundamental problem in my understanding of good OOP design....

« first day (1753 days earlier)      last day (3421 days later) »