« first day (1750 days earlier)      last day (3198 days later) » 

1:00 PM
@tereško Looks like a translation key to me
 
well , you kinda can
the translation matrix is:
<?php
return array(
// Days Name -----------
	'day.1' => 'Saturday',
	'day.2' => 'Sunday',
	'day.3' => 'Monday',
	'day.4' => 'Tuesday',
	'day.5' => 'Wednesday',
	'day.6' => 'Thursday',
	'day.7' => 'Friday',

// Months Name -----------
	'mon.1' => 'Farvardin',
	'mon.2' => 'Ordibehesht',
	'mon.3' => 'Khordad',
	'mon.4' => 'Tir',
	'mon.5' => 'Mordad',
	'mon.6' => 'Shahrivar',
	'mon.7' => 'Mehr',
	'mon.8' => 'Aban',
	'mon.9' => 'Azar',
	'mon.10' => 'Dei',
	'mon.11' => 'Bahman',
	'mon.12' => 'Esfand',
 
@tereško how do you know Iranian months ?
 
magic of copy-paste
 
@tereško ah :)
But honestly, I don't want to use of that class, because I need to convert the date and time over and over for all of my posts and comments ! If I use of that class for converting, my website will be very heavy !
 
Oh, it looks like a gettext clone
 
@Andrea I tried to warn you away
 
Yeah, you were right
@JoeWatkins If a test fails in Travis, and nobody is around to see it, is the code faulty?
 
Abe
the totally absence of whitespace
 
NOPE
 
1:05 PM
can you tell me how can I store timestamp (like this: `1438432974`) ?
I used of `CURRENT_TIMESTAMP`, but It returns like this: `2015-08-01 17:28:24`
 
/me sticks fingers in ears and sings LA LA LA LA LA
 
How can you run a link
using JS
 
Abe
gah $source=($category==='yii'||$category==='zii')?'coreMessages':'messages';
 
without redirecting the user
 
@HassanAlthaf "run" a link?
 
1:05 PM
like
user clicks a link
well a button
 
do you mean make an HTTP request? do you mean show the webpage?
 
my friends want to do this:
when a user clicks a button
 
In the former case, XMLHttpRequest is what you want. In the latter case, <iframe>
 
it redirects to something like:
 
I think I broke their test software
 
1:06 PM
lol.com/doAction?param=lol
which will run a PHP code to update some time
 
Anonymous
@bwoebi php request - add another flag to var_export() so the result will be returned with short array form [ .. ]. this is useful for people who use and want to compare the value against [] Is this doable ?
 
@Sajad blame mysql. It presents all time formats as DATETIME. You would have to use PostgreSQL or some other database to have native timestamps shown to you. But you can extract the data correctly using UNIX_TIMESTAMP(some_time_flied)
 
but how can he do it without the user having to refresh page?
 
@HassanAlthaf So what you want to do is make the HTTP request, without displaying a page
That's usually called AJAX
You can do it in JavaScript with XMLHttpRequest
 
Abe
1:08 PM
<form action="http://lol.com/doAction" method="get">
<button name="param" value="lol">Click</button>
</form>
@HassanAlthaf
 
@tereško UNIX_TIMESTAMP returns 0000-00-00 00:00:00
 
lemme check
 
oh fkin sht
 
Someone from undisclosed University in the US keeps hitting my server with some kind of "proxy test software" so I wrote a hack that talks non normative HTTP and now it's resending requests successively for about the last hour or so.
heh
 
does it reload the page @Abe
 
1:08 PM
@HassanAlthaf It works like this:
 
Abe
@HassanAlthaf oh. well then xhr or iframe
 
var xhr = new XMLHttpRequest();
xhr.open('get', 'someurl.php', true);
 
Abe
xhr is likely the sane-r way to do it
 
@Andrea thanks.
was looking for an example like that
lol
 
If you want to handle the response, you can add xhr.onchange = function () { ... };
 
1:09 PM
can u do lol.com
nah it just needs to log time and update DB
 
@HassanAlthaf you can only request the same domain with XMLHttpRequest
 
@Sajad what query did you write?
 
@Andrea yea, but laravel likes absolute URLs but k
 
Abe
@HassanAlthaf you can use any type of url as long origin's domain matches target's domain
 
1:10 PM
awsum
 
@HassanAlthaf AJAX is really handy, because you can also get the content of the request back
so for example, you could make your PHP script do:
echo "Processing complete! $users processed!";
Then, in JavaScript, display the message the PHP produced
 
@tereško
CREATE TABLE Orders
(
OrderDate TIMESTAMP NOT NULL DEFAULT UNIX_TIMESTAMP,
)
 
@Andrea how? ;O
 
@HassanAlthaf, you might want to visit Javascript room
 
Oh, yeah, they could help you here
the basics, though, is .onchange
 
1:12 PM
@tereško yes sir.
@Andrea aight, thanks.
 
Abe
or just read mdn's article about xhr
 
@Sajad OrderDate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 
There you can put a function that's called when there's a status update. You can then check if it completed, and read the response
 
Nice.
 
you just select the data using: SELECT UNIX_TIMESTAMP(OrderDate) AS timestamp FROM Orders , @Sajad
also, I need a beer
BRB (3min)
 
1:15 PM
@tereško I did it :-) always you help me Bro! thanls
 
@tereško also you should not drunk during coding ! ;-)
 
Abe
@Sajad code drunk, debug sober (toptip™)
 
@Abe ow tnx, I don't know english very well
 
Abe
1:17 PM
it's a quote from hemingway adapted for programmers @Sajad
 
@Abe aha :)
 
@Abe that doesn't look fun
 
@samaYo not sure why… just eval it and compare?
 
made $10 in 1 min
for writing a query for my friend
l0l
 
heh
I got kinda good at SQL after I collected video game stats in a database and wanted to analyse them
 
1:29 PM
I got good (for some definitions of the word) when I read "SQL Antipatterns"
 
it's funny
I watched that, and I mostly already knew it
I don't know quite how
because I think my first SQL databases were awful
(Yes, it was MySQL. Yes, it was mysql_.)
 
How do I plus a date with a number?
(1438438368) + (1348-10-11) ?
it should be noted that `1348-10-11` is equivalent of 1970-01-01
 
@Sajad convert it into a DateTime object, and use its manipulation methods
@Sajad you don't need to add 1970-01-01 or its equivalent
 
@Sajad you are looking at this from the wrong end
 
Abe
how do you guys name factory methods? $factory->make||create(Thing)?()
 
1:34 PM
1348-10-11 in that case is equal to 0
 
@tereško look:
 
@Sajad UNIX timestamp is just another date format
 
1438438368 / 60 / 60 / 24 / 30 / 12 = 46
then
46 + 1348 = 1394
I want 1394 !!!
 
you don't work with it directly. Instead, you convert it into a DateTime object
 
@Andrea what is DateTime object ?
 
@Andrea like this? : 2012-07-08 11:14:15.638276
that is a datatime object ?
 
@Andrea it doesnt do solar hijri
 
@tereško like !
 
@Sajad why not use timestamp ?
 
@tereško ah, yeah :/
 
1:38 PM
@NullPoiиteя what is the output of timestamp ?
 
@NullPoiиteя he needs to convert timestamp to "Iranian calendar"
 
@tereško like !
just I need to plus a number with a date, like this:
(1438438368) + (1348-10-11)
 
@Sajad you can't "just" do that
 
but I don't know how should I plus ...
 
by plus :P
 
1:39 PM
 
@Sajad you need code that understands the Solar Hijri date format and can add dates
 
1438438368 / 60 / 60 / 24 / 30 / 12 = 46 year
1438438368 / 60 / 60 / 24 / 30 = 554 month
1438438368 / 60 / 60 / 24 = 16648 day
 
Maybe the code @tereško gave you supports this
 
@Sajad is soelar hijri the same as "persian calendar" ? (sorry .. english failed)
 
@tereško NO ! that is Arabic !
 
1:41 PM
@tereško google it
 
strange .. I had the impression that Persia = Iran
 
@Sajad than you need to develop a calendar format
 
@tereško yes, persia = Iran
 
so, there is also a naming fuckup somewhere .. nice
 
@tereško yes
but Iran has had multiple calendars
 
Abe
1:42 PM
does Derick chat here? i want to beg him and sacrifice a goat in order to get microtime actual support in DateTime stuff
 
For the official calendar in Iran and Afghanistan, see Solar Hijri calendar The Iranian calendars (Persian: گاه‌شماری ایرانی‎ Gâhshomâriye Irâni) are a succession of calendars invented or used for over two millennia in Iran (Persia). One of the longest chronological records in human history, the Iranian calendar has been modified time and again during its history to suit administrative, climatic, and religious purposes. The modern Iranian calendar is now the official calendar in Iran and Afghanistan. It begins at the midnight nearest to the instant of the vernal equinox as determined by astronomical...
 
@Andrea no, Iran just has 1 calende ! Solar : 1394-5-10
 
@Sajad it used to use a different one, is what I mean
 
So there is not any module for plus a number with a date ?
 
emm .. many calendars are "solar"
 
1:44 PM
@Abe rarely. You better reach him via other means.
 
@Sajad you can't "just" add a number and a date
 
ok, I have a new question, forget solar, how you use of 1438438368 in Gregorian ?
 
the module would have to understand the specific date format
 
we use a built in library for converting
 
DateTime, unfortunately, does not support Solar Hijri, but does support Gregorian
for example
 
1:45 PM
@tereško I hate Iran :(
 
@Sajad meh, it has nothing to do with the country
 
@tereško what is the format of date in Latvia ?
 
for some reason I cannot find whether IntlDateFormatter supports Solar Hijri
 
Soviet working week
/s
@tereško check the ICU docs
intl is just ICU
 
@Sajad , you will have to dig through this php.net/manual/en/intlcalendar.createinstance.php
 
1:52 PM
@tereško what is mean of 'intl' ? google.translate does not translates it.
 
internationalization .. I think
 
@tereško It supports anything you have a locale for
 
yes, which is why I think it might be the solution
 
hmmm... I wonder if anyone mentioned that an hour ago?
 
@Sherif I think you mentioned !
 
1:57 PM
@Sajad What a coincidence eh?
 
@Sherif are you kidding me ? (sarcasm)
 
Sometimes I just love the random walkabouts this room takes :D
 
Abe
lol
 
@Andrea come to js room pls
rooms/17
 
okay
 
Abe
2:06 PM
 
H S
Hi, if we are using front end framwork like anguarjs for routing and templating, then is there need to use routing in slim framwork(php), or use the twig templating with slim
 
Imo there is never a need for slim or twig
 
H S
i am planning to use the slim for returing the json for the requests...thats it..
why u say so? @PeeHaa
 
0
Q: how to convert Gregorian format to Solar format in mysql using of CURRENT_TIMESTAMP

SajadHere is my table schema: CREATE TABLE Orders ( OrderDate TIMESTAMP NOT NULL DEFAULT NOW(), ) When I Insert a row, my output will be like this: +---------------------+ | 2015-08-01 16:22:47 | // Gregorian date +---------------------+ Now I need to convert it to Solar date, like this: +-...

 
@HS 1) because I don't like frameworks in general and 2) because you don't need an entire framework just for routing
 
2:18 PM
@NikiC May I ask what's up with the finally issues now?
 
@bwoebi I don't know
Not sure if laruence has been working on the nesting issue
I think I'll clean up my patch and apply it -- it will make implementing the other part easier as well (as you need multiple discard exceptions etc, those can also go on the loop stack)
 
@NikiC ... yes, that's what I was about to suggest.
 
Shoul i use __autoload() or spl_autoload_register()
 
@NeelIon spl_autoload_register
Man, there are so many things we still have to deprecate...
Lets deprecate ALL THE THINGS in 7.1
 
@NikiC thanks man
 
2:25 PM
@NikiC make a repo under Room-11 organization and manage a list of things to deprecate…
 
@NikiC php will be better for contribution of you guys
 
Then when time comes we'll have a nice list…
 
@bwoebi could also make an rfc with the list?
 
@NikiC we could… but I think I'd rather have a list and then when it's time for the RFC decide what we really want to deprecate. There might be points of disagreement between us… Well, do what you think is best.
 
@NikiC packing strings into tagged pointers. good idea?
 
2:30 PM
@Andrea Too much complexity
 
possibly
 
Its incompatible with how we currently work
 
@Andrea not sure if we have a lot of gain by it … as we have interned strings.
 
hmm .. looks like Xperia Z5 will be a disappointing as others
 
I'm done with android phones. @tereško I have lost faith in them. They release worser phones day by day.
 
2:31 PM
@bwoebi Packing not interning
 
@Abe really funny
 
I guess I will have to just take my Z2 to get glass and battery changed and
 
@tereško Get a 6+, it is beast. :D
 
@HassanAlthaf so, you are saying that you will go with iPhone?
 
@NikiC is it?
 
2:32 PM
@tereško ye.
 
@HassanAlthaf those are piece of crap
seriously
 
@Sherif hm?
 
if they had that sapphire glass, you might have had an argument, but they didnt
and the rest of specs are on a level of 2+ year old android flagship
 
@bwoebi You could keep both strings, but reference multiple strings through one pointer, for example.
Concatenation, is a good use case, as an example.
 
2:34 PM
Holy shit! I can do const CONTINUE now! <3 you all
 
@Andrea Ah, maybe not.
 
@Sherif she said tagged pointers. Which I understand as: mikeash.com/pyblog/…
 
We do have the ZSTR_VAL macro now
 
@NikiC exactly
the other issue is zend_refcounted, maybe?
 
@Andrea We'd have to check lower bits for generic refcounted code as well then
 
H S
2:35 PM
@pee
 
@NikiC Do we actually check the refcount in all cases, though?
 
H S
@PeeHaa, then do u suggest to write the routing in php only with out any framwork like slim?
 
hmm
@NikiC we could avoid a branch, I think
 
@HS Yes. Or use a dedicated routing library
 
@Andrea You mean marking those strings as not refcounted?
yeah, that would solve this partially
The whole thing will probably be crazily complicated if one actually tries it ^^
I'll read that blog post later
 
2:37 PM
@NikiC the actual packing is very simple, the trick would be fitting it into PHP :p
 
of course
 
@HassanAlthaf care to elaborate? With which phone did you compare it?
 
Everything is simple unless you try to integrate it into an existing 100kloc codebase
2
 
@tereško Android
 
that's not a phone
 
H S
2:38 PM
@pee
 
iOS and Android. @tereško
iOS wins.
 
based on?
 
@Andrea The issue with these tagged pointers is that they only will be able to hold up to 10 bytes or so. But usually, when concatenating, you get strings longer than just a few bytes. And the other short strings we have, usually all are interned because literally defined.
 
Efficiency
look at the names
 
H S
@PeeHaa like
?
 
2:39 PM
iOS is so efficient that
 
H S
have u used any in general
 
the length of its name
is less than half of Android
 
.. and now you are in the ignore list with other trolls
congratulations
 
2:39 PM
@bwoebi of course, longer strings can't be helped
 
@bwoebi how did you get to 10 bytes? I'd have assumed 7 at most
 
i was jokin
 
@NikiC read that blog post ^^ (5-bit packing)
 
@NikiC 7-bit/6-bit/5-bit packing
 
@tereško -_- i was jkin :(
 
2:40 PM
I don't think we're interested in packing
 
@HS Like github.com/nikic/FastRoute, but there are like 100s of them
 
@NikiC would break ZSTR_VAL :p
 
Packing is definitely incompatible with what we currently do
It's one of those things you'd need C++ for, to effectively make a switch
 
probably, yeah
 
were we talking about something else? @NikiC
 
2:41 PM
unless we have a very complicated, turing-complete macro :3
 
that feeling when you get blocked. ;/
 
@bwoebi I thought you were just referring to sticking a 7 byte string in the pointer, put length in 7 bit, set last bit to 1
Actually, the length encoding will be a problem for ZSTR_LEN assignments
 
@NikiC Yeah, but even then, not really worth it.
 
@NikiC I don't think so
 
@bwoebi Can't know until you try
 
2:43 PM
I bet things will end up a bit slower with tagged pointers due to the additional branch.
 
Though I doubt it as well
@Andrea Why?
 
could be done with a bitfield, but even then, I don't think it'd cause an issue
 
Fuck, I need help. I need to write a 200 word max biography for a talk submission and I have no idea what sort of thing they're looking for...
 
because you need to make sure it's not trying to directly mutate anyway
well... actually, do you?
you can give it an actually mutable ZSTR_VAL
#define ZSTR_VAL(taggedstr) ((char*)(taggedstr))
 
@Andrea I found out an OODBMS. eyedb.org
 
2:46 PM
and I think also an actually mutable ZSTR_LEN
#define ZSTR_LEN(taggedstr) (((struct _zend_some_bs_with_bitfields*)(taggedstr))->len)
 
@Jimbo I described myself as having a beard.
 
Yeah, bitfields ...
C99...
 
@NikiC C89 doesn't have them?!
 
@Danack I can't even grow a beard. fml.
 
@Andrea … hmm
 
2:47 PM
@Andrea It does?!
 
@bwoebi :(
 
But anyway, we can just start using them and don't tell anyone :P
 
I always thought it did
@NikiC hahaha
 
@NikiC I think we're really at the point where we can just use C99…^^
 
H S
@PeeHaa do u think is the slim is overkill only for routing...
 
2:49 PM
Thanks God !!! I did it:
$fmt = new IntlDateFormatter("fa_IR@calendar=persian", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Asia/Tehran', IntlDateFormatter::TRADITIONAL);
echo $fmt->format(time());
 
That is what I said yes
 
@Sajad Well done man.
 
@HassanAlthaf ;-)
 
Andreas-Air:gash ajf$ cc --std=c89 bitfields.c
Andreas-Air:gash ajf$
!!!!
 
lol
 
2:50 PM
Yes, C89 DOES have them
 
@NikiC I still wait for your literal zend_string* ^^
 
I knew I wasn't remembering wrong
I think K&R has them at some point
 
@Andrea (you're right… I misremembered…)
 
let me check...
 
Sorry about that.
 
2:54 PM
@Danack When you have a sec, could you tell me if this is bollocks? Anyone else is free to chime in too...
> James is a software engineer working at @localstars with a particular interest in software and technical architecture. Technically opinionated, he's passionate about best practices and frequently looks for shortcuts that can work for his team while still adhering to the principles that define good programming.
 
best practices
 
It's in K&R!!!!
 
Looks good to me. Although best practices @Jimbo
 
@NikiC @bwoebi
 
But isn't "best practice" a thing?
 
2:55 PM
Heck, PHP uses bitfields in Zend
I can't believe you two...
 
@Jimbo You are only interested in a single one? :)
 
@Jimbo it's a noun. It's like saying "I love lamp", rather than "I love this lamp".
 
@Andrea It does? Can't remember…
 
or "I love lamps".
 
@bwoebi I seem to recall it having them somewhere
 
2:56 PM
@PeeHaa does google really shows definition from w3schools?
 
Okay, best practices, thanks guys :-)
 
maybe not
 
@NeelIon Yes among other things ?
 
I want to add humour, like Regularly downvoted on StackOverflow - but perhaps I'll leave that to establish my credibility at the beginning of the talk.
 
@PeeHaa string.replace()
 
2:59 PM
Yes?
 

« first day (1750 days earlier)      last day (3198 days later) »