« first day (1527 days earlier)      last day (3418 days later) » 

11:04 AM
ooh boy, connections between host machines and VMs, they're a pain. This probably isn't the best channel
There's probably a vagrant IRC channel on Freenode
 
oh, there I need special software to connect on irc I guess
why they cant do it simple
I want to write code but have to waste time with such things
 
No, not special software
You just need to do some sort of configuration for it
Honestly, I'd read the vagrant manual
 
I am also trying to connect from heidy sql to vagrant mysql database
also just failure, but I forwareded port
I have read manual
but I really need man who can explain what is exacly not clear
it would be much faster
 
@Darius.V can't you just ssh to the vagrant box and do whatever you want to do? oh, you trying to connect a service outside the box.. nevermind then..
 
I can conenct with putty to ssh
but when I want to edit database
I use HeidiSQL
but it should connect similar way as putty
just different port
if I would create tables in myql in vagrant image
then I would not need to connect from vagrant to host
 
11:12 AM
you should be able to forward a port from the host to the VM
 
yea, I did add config
config.vm.network "forwarded_port", guest: 3306, host: 3307
vagrant reload
and try to connect to 127,0,0,1 with port 3307
and get error sql error (2013) in statement #0: lost connection to Mysql server at reading initial communication packet, system error: 2
maybe I have to make ssh tunnel
 
Well if the guest port is 3306 you have to connect to that instead
 
but if it can connect to nginx server without tunnel
it shoudl connect to mysql as well
but with nginx there is config: config.vm.network "forwarded_port", guest: 80, host: 8080 and I connect to localhost 8080 - so connect to host port
so same way with mysql I htink
I have also connecgted to 3306 but it connected to mysql on host machine
 
Well that's what you want right?
 
no, I want to connect to vagarnt machine from host
or from vagrant to host
 
11:18 AM
You're running MySQL in vagrant?
 
yes
 
runing in both - host in vagrant
were always working in host, but then recently installed vagrant, and already using php on vagrant, but need to connect to database
running in host and vagrant I wanted to say
 
user1607528
 
user1607528
I have this relation table, my problem is how do I go about inserting it. Assuming a song can belong to 7 categories, 5 moods, 2 collections , same can be for moods, collection ( they can be more ). Do I just insert as many times as which one is max. In this case categories 4. And leave the rest null ?
 
11:27 AM
using insert mysql command?
INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...)
"Do I just insert as many times as which one is max." I dont get the question
 
@Muhammet that is a very poor schema design, you should avoid NULL as far as possible
 
user1607528
@Darius.V Let's say one song belongs to 10 categories, 2 moods, 4 collections, I insert 10 times
 
then there is categories table I assume
 
@Muhammet No that is not how you do that
 
user1607528
can you tell me the way to do it then please ?
 
11:30 AM
and categories table has column like song_id
 
Alright
what Darlus is saying is right
 
and you insert 10 categories
 
have a table of songs
 
I am not sure how this is real life
 
and a table of categories
 
11:31 AM
in real life usually 1 category could have many songs
 
and a table of songs and categories to map the two
@Darius.V No, it overlaps in real life too
 
ah yea
ig category is like genre, song migh be few genres at the same time
 
user1607528
@Darius.V assume "category" = "moods", one song can belong to happy, dance etc
 
ok
 
user1607528
11:33 AM
Andrea, you saying like a junction table 1 on 1 song_id and mood_id
 
user1607528
so 3 different mappinig tables ?
 
user1607528
nah
 
So you'd have songs (song id, song name), categories (category id, category name) and a table mapping songs to categories (song is, category id)
@Muhammet Yes.
What you are doing now won't work.
 
user1607528
Are you sure, because I have read a bit about it, and everywhere they were saying to do it in one table mapping
 
user1607528
and @hakre said the same
 
11:35 AM
Only works for a one-to-many mapping
 
user1607528
maybe different in my case
 
Your design works only where a single song has a single category.
However, each song has multiple categories, or can have anyway, so this won't work
It might work with a SQL JOIN but it'll be a pain to manipulate as each row maps three different other tables to songs
Alao, NULL in SQL doesn't work like it does in, say, PHP
 
user1607528
yeah thanks, its so confusing right now :)
 
user1607528
This is what hakre said earlier, but I am not sure if I understood it right :
most likely categories and moods are actually the same: a taxonomy. so you could normalize this and have one relation table that also references the taxonomy. this could be done with compound keys.
you can then add another taxonomy later on like bit depth or whatever.
 
Yeah, essentially just add categories of categories.
 
user1607528
11:44 AM
Andrea, i don't get it can you draw it for me or smth
 
@Muhammet Add categories for categories. Or maybe I should say "types" as it's less confusing:
types: (type id, name)
categories (category id, type id, name)
now you can have, say, a "mood" type and categories of that type
or a "genre" type and categories of that type
 
user1607528
oh i get it, thanks a lot
 
user1607528
this is much simpler and seems right :)
 
Glad to help :)
You'd end up with four tables: types, categories, songs, and song/category mappings
anyway, I have to go. Hope this helped.
 
user1607528
11:51 AM
Yeap, I understood now, thanks again for help
 
12:16 PM
morning
NikiC, Berlin, Germany
50k 16 112 172
I'm at 50k now :)
 
user1607528
congratzzzzz
 
congrats @NikiC .. =]
 
Also, just found an interesting question:
43
Q: "vertical" regex matching in an ASCII "image"

QtaxNote: This is a question about possibilities of modern regex flavors. It's not about the best way to solve this using other methods. It's inspired by an earlier question, but that one is not restricted to regex. The Problem In an ASCII "image"/art/map/string like: ....X....... ..X..X...X.... X...

 
@NikiC Congratulations. A day to mark in the calendar.
 
12:32 PM
@NikiC I got the badge by being sneaky
I may have linked to one of my answers on reddit and got ALL THE REPUTATION :D
 
@AndreaFaulds That's how many of the high-reputation answers come about ;)
 
@NikiC >:D
 
user1607528
@AndreaFaulds both song_id and category_id in junction table should be just Foreign Keys right ? Not any of them primary key AFAIK :) just want to make sure
 
@Muhammet yes, they don't belong to that table
a foreign key is a reference to some other table where that thing comes from, usually
 
user1607528
12:42 PM
yep, thanks. you explain it simply )))
 
user1607528
what book is good to understand the whole database thing ?
 
user1607528
from your experience
 
12:57 PM
hard to say. if you're looking for some ground work tutorial, perhaps sql.learncodethehardway.org/book is a way to start.
I can't remember what I've read all in the beginning to understand the basics.
Nor can I imagine that every book is equally well for everybody.
Just read through some different resources and then go on with what you've learned from each.
 
user1607528
thank you hakre, appreciate it. learnsqlhardway doesn't seem to be full though, until 10exercise
 
it's alpha. you can do the first 14 or 15 exercises.
the other exercises give you at least terms at hand you can start to look forward on your own.
 
user1607528
ok, thought the same. I will grab one of the books after finishing the tutorial
 
and I bet there are tons of other tutorials online. it's just when I learned it I had printouts so I can't tell you about good online resources because I don't know any.
 
user1607528
I have always just looked on what will accomplish my tasks, not really understanding in depth
 
Bas
1:14 PM
@hakre hey man, i've been working something out
var roadTaxData = {
    /**
     * provinceWeightFuelPricesData has the required parameters:
     *
     * - Province
     * - Weight from
     * - benzine price
     * - diesel price
     * - LPG3/earth-gas price
     * - LPG/others price
     *
     * Data for provinceWeightFuelPricesData is defined like:
     *
     * Vehicle type -> each province -> each province it's data
     */
    provinceWeightFuelPricesData: {
        personen_auto: {
            noord_holland: dataNoordHolland
            //TODO: Add all the provinces with it's data to the personen_auto object
To parse the arrays in different files
And then loop through those objects, then pass it to PHP?
in 9 different arrays
 
this is still javascript, right?
 
Bas
Yeah yeah
I have no idea how to make parsers with PHP for JS data.
 
then now create a new project directory on your disk.
name it after your project.
inside that, create a subdirectory called "data" and therein one called "js-files".
inside that "js-files" directory copy those 9 javascript files.
 
Bas
alright, but why a new project dir though?:)
 
the enter the project directory from your shell.
type in "git init"
and then "git add ."
and then git commit -m "added data js-files"
 
Bas
1:20 PM
Alright
uhm
How about that?, i can just commit those files aswell right?
 
that looks good
 
Ooh, PHPStorm
 
so you already have the files in your project and that under version control.
 
Bas
Yeah, just need to commit and push actually.
 
but the data files are missing
 
Bas
1:22 PM
8 of them indeed.
shall i add them first then?
 
technically it's not data, but you keep those as format definitions.
 
Bas
Hmm, all the data is inside those files aswell
var dataNoordHolland = [
    "1#26#90#26#101",
    "551#34#109#34#124",
    "651#42#129#42#147",
    "751#55#154#55#175",
    "851#73#189#87#203",
    "951#94#223#123#238",
    "1051#115#257#159#273",
    "1151#137#290#195#309",
    "1251#158#324#230#344",
    "1351#180#358#266#379",
    "1451#201#392#302#414",
    "1551#222#426#338#449",
    "1651#244#460#374#485",
    "1751#265#494#409#520",
    "1851#286#528#445#555",
    "1951#308#562#481#590",
    "2051#329#596#517#625",
    "2151#351#630#553#661",
 
sounds like a job for preg_split + json_decode and then explode on "#".
 
Bas
Oow, i was already doing that with JS.
because when i directly parse it to php, i dont know which array belongs to which province right
If i parse it all in one vehicle type variable in php.
 
it's possible with a bit regex I'd say as the js files are mostly data. I would parse them and then intermediately store them again as files containing the data in form of arrays already parsed.
 
Bas
1:27 PM
So i thougt, i'll just explode it with JS, and add an extra field to each row with the name of the province
What do you mean? srry
 
you can do in js as well, in any case you need some file you start to process on in plain PHP.
just to get the data into PHP.
if you want to do the lookup in PHP. otherwise you can do all the work as well in JS.
but I thought you want to do it in PHP.
 
Bas
I did actually, but i can't reconize which province it belongs to right?
If i parse all 12 arrays to a PHP file
because there are like 12 different province's
And if you store that all in one array in PHP, you cant reconize it anymoer right?
 
@AndreaFaulds I see you started merging with rebase? :)
 
@NikiC :D
 
in JavaScript , 1 min ago, by Benjamin Gruenbaum
@AwalGarg is working on a new PHP Wordpress + jQuery plugin book, he is interested in answering all your questions to help make it better. Please help him by pinging him with yout questions by appending @AwalGarg to all your messages.
 
1:50 PM
Oh, wait, no! I just seriously broke backwards-compatibility. D: @NikiC
 
@AndreaFaulds Thank you!
@AndreaFaulds I didn't realize the benefits of this change
 
@NikiC Actually, me neither. The fact it partially breaks that hack (for double, anyway) is awesome :D
 
@AndreaFaulds why are you not doing it as a compile step?
 
@BenjaminGruenbaum ?
 
A step that builds your type of php code into untyped php code.
So there is no penalty in production.
 
1:57 PM
Oh, I'm not the one who came up with that horrendous hack
If I wanted strict typing I'd do exactly what you suggest. Hack has a compiler targeting PHP.
 
@SecondRikudo The question isn't that bad...
 
@AndreaFaulds No code, no server settings, no nothing...
 
@SecondRikudo So? That's what prompting in the comments is for.
 
And once they are given, it will be a duplicate of 'why isn't utf-8 working'.
 
@AndreaFaulds Yes, and that's also what putting on hold is for.
 
2:31 PM
Ah, fair enough
gtg, see yas later.
 
Without using eval or any similar method, write something that accepts definition of variables in javascript syntax, (var a = 3; var b =4;) and allows basic arithematic operations on them.
Originally a question in the compiler assignment. the variable declration was a := 3
@copy @shmiddity can we write it like reallllly small?
 
@darkyen00 you're in the php room, you realize that right?
 
:o yike
i dont. @BenjaminGruenbaum .. thanks for reminding
Can any owner move it to js x... terribly sorry
psst. I would love to see php solutions aswell...
 
PHP room doesn't believe in ownership.
So probably not.
 
thats AWESOME !
so democratic.
so i gotta copy - paste.
 
2:58 PM
@BenjaminGruenbaum not true, we have several owners
 
I can move if still relevant. I suspect it isn't anymore?
 
@AndreaFaulds ... oh really? I have never met these people :P
Naa, it's fine don't worry about it.
 
@BenjaminGruenbaum they're the ones with names in italics
 
You still want it moved @darkyen00?
 
@AndreaFaulds Ah, that's good to know :P
 
2:59 PM
@AndreaFaulds FYI @Benjamin is not exactly new to SO...
 
Oh it's already there
 
I'd say that was a jab at us removing pretty much all room owners at one point
Because of some incident ... don't remember what it was anymore
 
Ah :D
 
@NikiC JS also did the same thing only that lasted for like 5 minutes :P
 
REMOVE MODERATOR REMOVE MODERATOR
 
3:01 PM
Having a few wrong room messages isn't that big a problem...
 
@PeeHaa shhh
 
:-)
 
No incident I thought. Simply a clear out because people were given ownership left, right, and center.
 
Hii all
i am trying to popup cover a phone screen but its not working
 
And that's a PHP issue?
 
3:11 PM
noo
but any suggestion will help me
 
is there some rationale behind getting rid of temporary variables in refactoring?
 
good morning!
 
@Danack Couldn't find any Yakult in the end. There was Danone everywhere but didn't feel the same.
 
@hakre Theoretically there could be if that pattern of temporary variables is repeated in different bits of code - it implies that they should be a function that can be reused elsewhere.
 
3:18 PM
@Danack I'm sitting here with a friend and he remembers something about temporary variables from the book by michael feathers about refactoring legacy code.
but he doesn't fully remember and I'm curious. something about removing those by moving the definition to the value read point but I can't imagine how that should improve things.
 
^^ That's worth a watch, if for nothing else than to understand how disconnected WP leadership is...
 
@hakre "it implies that they should be a function that can be reused elsewhere." Basically if it's done as a function, it makes re-using that bit of code easy in the future. Otherwise, you're very likely to generate duplicated code when you need to do the same manipulation in the future. But yeah.....it's one of those things that can probably taken too far.
 
@ircmaxell years ago the myth was created core relies on the stats when they said decision is based on share. then stats couldn't be provided. when finally stats were provided years after, rules for the share were changed. that's already years ago nowadays again. the argument remains the same, even though the stats tell a different language since years. disconnected? no, it's just having an agenda but not speaking about it. that's all.
 
it's disconnected
because some of what he spoke is factually incorrect and logically inconsistent
example: he said "auto-updating pushes new versions to all users in about an hour, amazing" then he said less than 50% of installs are on 4.0... So which is it?
 
there is no reason in reasoning with nacin.
it's not only at that topic.
the problem is that there is a set agenda and argument that are given are given only "for the argument" not as a result to actually formulate a strategy and explain on what it is based.
sure that is disconneted or derealized but that's only on the level on how it looks like.
 
3:34 PM
@AndreaFaulds why float and not double?!
 
because float sounds more chilling than double?
 
meh
 
4:06 PM
@bwoebi Because that's what we call it everywhere else (and what every other language calls it), and because double only makes sense if you also have a single or float type.
 
@JoeWatkins yup, I'm going to have some time after Monday for this.
@AndreaFaulds my problem with it is that we really use doubles in PHP. (but for integers, well, long hast different sizes etc. so just abstract it away behind integer) but double is double.
 
@bwoebi That's the C type, it's of no concern to the user.
None of our types map to C types. None of them.
 
mah, nobody uses float… nobody…
float is something bad with no precision for me ;-P
 
int isn't an int, nor is it a long. double isn't a float, it's a double (though not strictly, as it ought to be whatever the 64-bit IEEE 754-2008 double-precision float is on a given platform), string doesn't exist in C, bool doesn't either and it's a zend_bool anyway.
@bwoebi Lots of people use float if they need performance. More importantly, lots of languages call the 64-bit float type just "float" :)
 
@AndreaFaulds then I just don't code in these langs ;-)
 
4:11 PM
Also... we have no non-double-precision type :p
 
@AndreaFaulds eih, unpack() makes a difference between float and double…
 
@bwoebi Yes, because it's dealing with binary data. It also distinguishes between little- and big-endian, and 32-bit and 64-bit integers ^^
And C and Pascal strings
Oh, weird, it doesn't have Pascal strings. But it has byte/space padding options.
 
@AndreaFaulds sssssht :-P
 
@bwoebi You've given me a great idea.
 
@AndreaFaulds hm?
 
4:16 PM
@bwoebi You should have a look at Android's SDK ;-)
 
Quick @bwoebi, register your IPR!
 
@bwoebi Warning: jdmonthname() expects parameter 1 to be a 64-bit two's-complement signed big-endian integer, 64-bit Zend Engine hashtable given in %s on line %d - I think we can all agree this is much clearer. :)
3
 
@AndreaFaulds insta-star, looool
 
4:35 PM
PHP traits should be able to implement interfaces
That would be decent
 
4:48 PM
$result = exec("test.sh") giving output in the $result (working fine ) , $result = exec("test.sh arg1") not giving any output. please help
 
I need to combine date and time columns and store them as datetime... str_to_date () updates the timezone according to my local setting, right... how to fix that? I want to retain the time zone
 
When you guys work with postgresql do you use solely the cli or do you have also use a gui? ping @PeeHaa
 
@Fabor I just use pgadmin when I need a gui
 
5:10 PM
I have two columns: date and time... I want to store it in another table as a datetime column... is there a way that does not require me to convert it into string first?
I'm talking about mysql
 
@PeeHaa traits should be able to implement interfaces
 
@user3692125 You can just CONCAT(str1,str2) to get the string your want.
You don't need to go through str_to_date.
 
concat returns a string... it's safe to store it in datetime column?
 
Why don't you try it and see?
 
well, I had tried it but it didnt work... I tried it again... (it was a mistake on my part)
 
5:42 PM
@BenjaminGruenbaum huh? :P
 
@PeeHaa traits in PHP, those should be able to implement interfaces from the outside.
Wait, let me think this over first :P
Traits would still require modifying the original class - boo.
 
whatever thought tangent is going on in your head is lost on me
 
6:15 PM
hey all I can't run PHP commands in command prompt, although I have added it to System Variables on Windows.
no one is answering. So, I can peacefully go kill myself now
 
@LoaiNagati Re-open command prompt
 
I did
 
Also, are you sure you added the right directory?
paste your PATH variable's content here
 
yes, I did.
 
then we can see what's wrong hopefully
 
6:19 PM
c:\xampp\php;c:\xampp\htdocs;
these are the last two entries
 
hmm
ok, what's inside C:\xampp\php
 
oh, I found the mistake
my current folder is xampp2 not xampp
it's working now
but the artisan isn't
 
that probably needs an extra path entry
 
I will try
Thanks a lot
 
how to convert empty string as null across the database?
 
6:29 PM
this sounds a bit like the ministry of silly walks, but it isn't: The On-Line Encyclopedia of Integer Sequences
 
@user3692125 what?
 
6:44 PM
@AndreaFaulds I have several fields in several tables in mysql that have empty strings as values, I need to convert them to null... of course, doing it manually is not an option, lol
 
@user3692125 UPDATE foobar SET foo = NULL WHERE foo = '';
 
do not forget that those columns you need to allow NULL in the first place.
 
@user3692125 Though, why do you want to replace empty strings with NULL? Are you sure that's what you want?
 
additionally enable mysql strict mode.
 
@AndreaFaulds, I don't want to write this script for each column... I have too many tables and too many columns
I wanted some kind of script... all the ones I found werent working
 
6:50 PM
@PeeHaa: Any plans for Fosdem '15?
@user3692125 does the term "information schema" rings a bell?
 
@user3692125 More importantly, why do you want to replace empty strings with NULL?
Why?
What is the problem you are trying to solve?
@user3692125 xyproblem.info <-- read that
 
@hakre Haven't thought about it yet. You going?
 
@hakre... the thing is the scripts that I had were using information_schema but it wouldn't work because apparently dynamic sql in mysql can't take column name as variable... so that limits me
 
@PeeHaa yes, I'll be there. PHP room seems to be reserved for a full day.
@user3692125 no it doesn't. you write a PHP script that creates the SQL then. Or you write SQL that does string concatenation and outputs the new SQL. Whichever way you like, I find the PHP script often easier to handle for myself.
 
@hakre I will give it some thought / look at planning this week.
 
7:04 PM
@PeeHaa do so. I already go there thursday evening so will be three nights and days in Brussel.
 
k cool
 
@NikiC Another problem with that horrid scalar hints hack: You can circumvent the hint by passing an object actually of that class name ;)
 
7:21 PM
Why do I get the feeling you'd like The Rubberbandits @PeeHaa? [tag-Warning] Swearies :)
 
7:33 PM
@Fabor lol that is... strange :)
 
Like the rest of their stuff
 
That's Kilkenny!
 
@Fabor is that what Irish "comedy" is like? o.O
 
@AndreaFaulds heh. Who knows. I don't understand 30% of the words. I like Father Ted though.
 
7:41 PM
lol.
Again about 30% though.
 
I might be able to help ^^
 
I remember watching Rab C Nesbitt with my Dad when I was younger. God those were tough TV times. Too young to comprehend but it looked funny.
 
7:56 PM
If I have a datetime column and I want to find results for a specific date often, then should I store date and time in separate columns to make queries faster?
 

« first day (1527 days earlier)      last day (3418 days later) »