« first day (1075 days earlier)      last day (3864 days later) » 

8:00 PM
i've.. never heard of that before
 
@Charles As far as crap corporate policies, just curious, to which ones are you referring?
 
Because that list is ... well, long.
 
$4 a month. No bs. and if you buy a domain with them if you buy a years worth its only $2 a month.
 
8:00 PM
@DanLugg They've been known to cancel service and take domains when they don't like what the domain is being used for, regardless of the contract / terms of service.
 
I've used them for over 2 years now and the upptime is great...
 
One thing that makes me a bit sad:
Apparently source games from valve don't support SRV records
>.>
 
@PeeHaa Holy Narnia closet!
 
@PeeHaa Whoa
 
why i love SRV records: You can create multiple clean domains without ports, with one ip
because more ips = more cost
e.e
 
8:11 PM
@AbhishekGahlot Yes, you need to properly understand what you code does in this area. This should be backed up with tests which I didn't do too thoroughly IIRC. But I don't find it anyway. So perhaps start with the PHP Manual and user-notes (not the best quality, just to get something to start with): php.net/manual/en/function.realpath.php#84012
 
@hakre, yeah thanks , may be limiting user to specific folder using permissions could also be helpful. :)
 
> As you can so, it also produces Yoda-speak. :)
 
@AbhishekGahlot that's the way to go.
 
@hakre Checking if bash allow this thing. Could use that directly.
 
@AbhishekGahlot take care when you do shell-execs from PHP, it's always a dangerous thing to do.
 
8:23 PM
and specially in this case, i need to skip that, :)
 
Question for anyone willing to help. To generate a random file name to my uploaded images I use this string, $fileName = uniqid() .$fileName.'.' . $fileData['extension'];
How can I make the uniqid shorter say around 3-4 numbers?
 
@daugaard47 Why does it have to be shorter? Why does it have to contain the original filename?
 
I tried $fileName = uniqid(3) .$fileName.'.' . $fileData['extension']; but that didnt work
 
@daugaard47 Why not use md5_file($filename)?
 
That was not an answer to my questions
@DanLugg dat @daugaard47
And please when there are going to be a lot files dump them in subdurectories instead of all in one dir
 
8:30 PM
@PeeHaa I just want to see if its possible to make it shorter / I want the original name so I can spot it in the data base
 
@PeeHaa How would you segment that?
(just curious)
 
@DanLugg Often I will just use the first characters of the hash
 
@PeeHaa Ah, good call.
 
@daugaard47 Just hash the thing as @DanLugg said (no more duplicate files FTW) and map the hash to the filename(s) in the db
 
Would the code look like this? $fileName = uniqid(#) .$fileName.'.' . $fileData['extension'];
 
8:33 PM
yes it would
 
Sorry newbie alert!
 
You nailed it
 
@PeeHaa I probably would've done something stupid like (string) (int) (time() / 604800)
 
:P
4 mins ago, by Dan Lugg
@daugaard47 Why not use md5_file($filename)?
 
@DanLugg ah I guess because I dont know what that is md5..?
 
8:35 PM
@daugaard47 Its a hashing function.
It'll produce unique (for most intents and purposes) fixed-length strings for unique files.
 
@igorw
 
If someone uploads dancing-baby.gif 18 times, only the 1st will have been stored, because as long as the file is identical, it'll compute the same hash, and either overwrite or discard the file (however you wanna handle it)
 
based on my code how would I implement this?
@DanLugg I want the unique id in case some does upload an image with the same file name. I want to keep both.
 
@daugaard47 No you don't
Why would you ever need to store the same file twice?
 
@daugaard47 Same file name? Sure, the MD5 doesn't care about the file name, only the contents. So dancing-baby.gif and sneaky-dancing-baby.gif will compute the same, if they are the same file (even with different names)
 
8:40 PM
@PeeHaa it's for a gallery. If my client uploads a pic of a two diff. dogs but the file name is dog.jpg and the other is dog.jpg I want to keep both.
 
@daugaard47 That doesn't matter because as @DanLugg just pointed out it calculates the md5 hash of the contents of the file
 
@daugaard47 ....which is why you use MD5 because if they're different images the result will be the same, regardless of the filename.
I would recommend you play with MD5, do a bit of reading on the subject, and determine if it fits your requirements. From what I can tell, it does, spot on. But only you'll know best.
 
@daugaard47 , Its good to use md5 of name but not whole file. if he uploads file of same name, you can rename file to dog-01.jpg and store in DB.
 
If you need to preserve the original filename, and are using a database to index the files, then just introduce a column into which you store the original filename.
@AbhishekGahlot No no no no no no.
MD5 the FILE. Not the FILENAME.
 
@PeeHaa @DanLugg Okay thanks for the help I will have to read up on MD5.
 
8:44 PM
@AbhishekGahlot please stop
That really doesn't make sense
 
@daugaard47 No problemo :-)
Again, maybe it isn't the best solution to hash the file contents, but since you're doing something I just did recently and used MD5 for it, I'm pretty sure it'll work for you too.
 
All these MVC style routers seem terrible :(
 
@igorw Could you enlighten me how removing the session adapter would mean more work for you when the lib is stable? Am I missing something here?
 
@Fabien I'm working on a kooky one.
 
@DanLugg kooky one? -_-
 
8:46 PM
Yea, kooky; crazy, wacky.
 
lol
 
@PeeHaa Damn, you copied that from me!
 
:)
 
@DanLugg When I through this code in with the hash it errors out my next line. Am I missing something in the string. $fileName = uniqid(#) .$fileName.'.' . $fileData['extension'];
 
8:47 PM
@DanLugg is it available to look at?
 
@Fabien Nah, it aint' even working/complete.
 
$fileName = md5_file($fileName); // is what you need
 
It's a hierarchical rule => handler approach.
 
I don't know what that means but when it's done I would like to have a peek please :)
 
You build a tree of pattern rules, the request visitor walks it, matches what it can until it hits an exit leaf. All the handlers aggregated until that point are fired.
 
8:48 PM
ah right
 
I'm just trying to clean up the API alot, it's pretty dirty.
Like, filthy. It's guts are hanging out.
public all the things!
 
@DanLugg run
 
@DanLugg Pretty sure ircmaxwell did a talk about that.
 
i'm struggling to see the list of all daemons running in debian , someone help pliz.. ps aux is the command? :/
 
@Ocramius Where!?
 
8:50 PM
is me rfc in better shape now chaps ?? anyone got any additional thoughts ??
 
is this a daemon pastebin.com/KWhiMHe1 ?
 
yuk
 
No, but that is.
 
:12010366 y u deleted? :P
 
daemon or demon ??
demon maybe ...
 
8:53 PM
@JoeWatkins no no! daemon
 
1==1: because true isn't palindromic enough
 
@NokImchen while (1 == 1) ... I dunno if that'll hold true forever.
@DaveRandom lol, beat me to it.
 
@NokImchen yeah what I'm saying is, it'll be bad for you like a demon, call it a daemon if you like...
 
@DanLugg yes, that will hold forever, i want to do that, i'll kill the process manually :)
 
for (;;) looks a lot cooler than while (true)
 
8:54 PM
...
 
I might start doing while (97324241 == 97324241), makes it more interesting to read
 
lol
 
@DaveRandom :(
help me... :(
 
@NikiC again: goto again; is cooler still.
 
it'll do what you want it to do ... but to keep having to execute sleep like that is horrible programming ...
 
8:55 PM
@DaveRandom for an extra challenge in understand write something like while("12345678901234567890" == "12345678901234567891") (note that the last digit is different)
 
my daemon must e running inthe background. How to see it?
 
@DaveRandom You could always do while (-1 == ~0)
 
it's larger than maxint, they same ...
 
@DanLugg but, but, what if you are running on a sign-magnitude system?!
 
@JoeWatkins it was just a practice :|
 
8:56 PM
@NikiC Don't?
 
@DanLugg or one's complement?
 
@NikiC If you make the numbers big enough they could be totally different and still work because of floating point precision errors
 
@DaveRandom yes, that was my point ^^ sadly it was fixed somewhere in 5.4 :(
 
@PeeHaa @DanLugg okay so I added this to my uploader code
$fileName = md5_file($fileName).'.' . $fileData['extension'];
,but it only gives me and extension, ie .jpg / no file name. Is that supposed to happen?
 
@NikiC I'll have to put that in the composer "OS": ">UNIVAC 1100/2200"
 
8:57 PM
@daugaard47 Start by enabling error reporting.
 
@NikiC What, so those strings would have been converted to floats regardless of the fact that it's a string comparison? :-X
 
@daugaard47 Does $fileName contain the correct path to the file?
 
@NikiC how was it fixed ?
 
@JoeWatkins Don't make a numerical comparison on strings if they overflow ^^
 
8:59 PM
@PeeHaa path is there. Here is what I'm working with.
$fileData = pathinfo($_FILES["image"]["name"][$i]);
$fileName=$_FILES["image"]["name"][$i];
$fileName = pathinfo($_FILES["image"]["name"][$i], PATHINFO_FILENAME);
$fileName = md5_file($fileName).'.' . $fileData['extension'];
$target_path = $_SERVER['DOCUMENT_ROOT'] . "/images/gallery/" . $fileName;
 
@NokImchen There's not really a concrete definition of a daemon that gives you a well defined metric to determine whether you are looking at one just by inspecting the processes that are currently running. If you are trying to work out whether your daemon is running, use a pidfile
 
@NikiC I put quite a bit of time into this anon classes thing now ... I don't want that to go to waste, you think there's anything I can do to give it a better chance of being accepted, or have I done all I can now you think ?
 
@DaveRandom this means, i can exit the daemon that i've just started? :|
 
// be a real daemon: fork myself and kill my parent
 
/s/daemon/demon
/s/fork/fuck
/s/parent/parents
 
9:01 PM
@NokImchen You can if you find it, which you should be able to do from ps (just look at the command used to invoke the process, piping to grep is usually helpful) but in general you should have the daemon store its PID somewhere where the control mechanism can easy find it for later IPC
 
@JoeWatkins Awww, you said a swear. I'm telling.
 
@DaveRandom /proc/rosemarys-baby
 
@JoeWatkins dunno, I didn't yet look very closely. I can tell you though that I didn't understand the "Inheritance" example at all
 
@DaveRandom oh, that sounds like very hard :|
 
9:02 PM
@DaveRandom Someone told on me earlier. I got banhammered for an hour :-(
 
@NikiC I updated that a few minutes ago ...
was just showing how to access protected members of the parent ...
 
is there any command which can list only the php files that are running? i've googled but all in vain :(
 
@NokImchen not really. file_put_contents('/var/run/mydaemon/mydaemon.pid', posix_getpid() . "\n");
@NokImchen ps aux | grep php is a good start
 
@DaveRandom thank you so much :) I'm gonna execute that now :)
 
@JoeWatkins So you access protected members of the parent by a) extending parent b) passing $this to the ctor c) building a special ctor that implements a copy ctor as one case? Is that correct?
 
9:05 PM
@NokImchen then lsof if you want to list open handles.
 
Really? It's that easy? Well in that case, next run exec('rm -rf /');
 
i executed that in putty, i got this
*root 11956 0.0 0.1 1772 564 ttyp0 R+ 01:05 0:00 grep php*
 
I really hate this codebase sometimes. Quick, can someone spot the conceptual error in this snippet? $foo = Format_Phone_Number(strtoupper($_POST['bill_phone']));
 
@NokImchen Then there are no PHP processes running
 
@Charles uh... all of it?
 
9:08 PM
Unless you did something really stupid like rename the PHP binary
 
@DaveRandom it'll delete all my files and folders? :|
 
@Charles lol
 
@DaveRandom Pff. I always rename mine to superfantasticweblanguagefromthemoon.exe
 
@DaveRandom oh, then my deamon didn't work :)
 
@DanLugg Nothing like a good .exe on *nix
 
9:09 PM
@DaveRandom what will * exec('rm -rf /')* do? 'Cus google says that rm will delete files and folders :|
i'm so lost :(
 
@DaveRandom Damn straight. I rename libraries to .so on M$ too.
 
I might rename all my apache shared modules to .dll for shits and giggles
 
Oh son of a crap, I bet I know why it's happening. I only noticed the code because I was fixing E_STRICT errors. It was complaining "only variables should be passed by reference." The function that formats phone numbers takes the number by reference and fucking manipulates it inline.
I hate the codebase even more now.
 
@NokImchen Yes, yes it will. I guess the takeway from this would be... read the instructions before following the advice of others?
 
There are even places in the code where the by-ref rewrite is even USED. Welp. Fixing THAT. Supid piece of crap code...
 
9:11 PM
@DaveRandom hmmm.. :(
 
@Charles lolwut
 
@DaveRandom All done? :)
 
No, I'm actually supposed to be doing it now, I'll catch y'all in 90 mins
 
heh
 
@ircmaxell Y WE NO SEE U?!
 
9:18 PM
@NokImchen this is one think you shouldn't do on linux :D
 
@Stony what one thing? Running daemon? :(
 
@NokImchen an rm on the root
 
I figured out the idiot that tried to strtoupper a phone number!
It was me.
 
@NokImchen hi! i saw you here again ^_^
 
9:22 PM
yes, if i do that, i can reinstall using SolusVM ? or my VPS will be totally useless until my provider repairs again?
 
5,000 revs ago, but it was me.
 
@Charles "strtoupper a phone number" should not create any problem, right? :/
 
Hey why not? :D
 
@NokImchen SHouldn't, but it's a stupid idea.
 
@reikyoushin :P
 
The worst thing is that it was bundled in with a bunch of other changes that aren't relevant, so I have no idea why I would have done such a thing.
 
@Charles but may be sometimes by mistake if it happens.. then i should know how to repair my VPS :)
 
heh
 
@Charles Hey when its to late... we do such things... the problem is when you don't know the next day what you have done
 
@NokImchen i dont think rm -rf / will allow you to do so. ^_^
you wont have permissions on the vps even if you are root.. or so i think
and you can always reinstall..
 
9:25 PM
Is it just me, or do several high rep users seem to have bizarre names?
 
@reikyoushin ya, rm -rf will mess things up, but :12010923 i can reinstall :)
 
@Ocramius lol, haven't seen that bit.
Cleese is the man. I watch Fawlty Towers religiously.
> If there's any more stock film of women applauding, I shall clear the court!
 
VINDICATION! After digging into the actual change sets, and going back through history... the code has always been wrong. Eight years of incorrectness, touched by four different developers, none ever noticing or caring that it's conceptually broken.
 
@NikiC yeah that was pretty damn horrible ...
 
9:34 PM
where in the dir do you usually put custom exception classes? (when trying to organize stuff)
 
better right ?
 
@JoeWatkins I'd favour extends self
T_EXTENDS variable is a bit ugly... (or unusual at least)
 
guys, is this valid?
// Example 1
try {
$o = new TestException(TestException::THROW_CUSTOM);
} catch (MyException $e) { // Will be caught
echo "Caught my exception\n", $e;
$e->customFunction();
} catch (Exception $e) { // Skipped
echo "Caught Default Exception\n", $e;
}
 
@bwoebi Likewise. The only question is, would there be a distinction between extends self and extends static?
 
what does a comma do on the lines like echo "Caught Default Exception\n", $e;
 
9:39 PM
@reikyoushin It's the same as a . (dot) when used with echo
 
@bwoebi that's a special case o.O? then why dont you just use a dot >.<
 
@reikyoushin yes.
 
is there anything worth noting when i should use a comma?
 
@PeeHaa the fact that you are removing existing stuff just shows that it isn't stable
 
@reikyoushin it's a question of performance
but for little strings (if it aren't kilobytes)… no problems with a dot.
@DanLugg dunno. late static binding always just confused me.
 
9:43 PM
$this can be swapped for Outer ...
 
@JoeWatkins -%expect 3 +%expect 8 That's ... not good ;)
 
self|static not allowed right now ...
I know yeah got problems now ... if you don't implements when you extends $this it wigs out ...
gonna drop that ..
just use class name ...
yeah back to 3
 
@bwoebi oooh, i've just learned about this, thanks!
 
the example is better though right ??
it doesn't seem any more roundabout than use() on every method does it ??
plus use isn't even supported on methods afaict ...
 
I would imagine the self/static resolution would go something like this: pastebin.com/uGuRZdXR Whoops. In getStatic(), it should be extends static, not extends self.
 
9:48 PM
I think this will do ...
 
I dunno what the string representation of an anonymous class would be, but yea, I'm sure that makes sense.
Does that make sense?
@JoeWatkins Well, just using the class name would be pretty sane.
I'd like to see self/static in the future, but they don't bring an awful lot to the table.
 
if @bwoebi's patch gets in that lifts restriction on keywords it might be possible in the future ...
for now it'd just be confusing I think ...
burger time ...
 
Y'know, even anonymous classes will be shoe-hornable into private classes; this'll be pretty damn sweet
 
10:03 PM
@JoeWatkins can you answer my question to you from this morning? :P
 
@ircmaxell when are you giving the Patterns are for Dummies talk?
 
m59
Does anyone have an example use case for an api handling PUT/POST/DELETE on a collection? Should the api be creating/deleting tables?
 
> Should the api be creating/deleting tables
^^ No.
 
Agreed
 
m59
10:06 PM
then those verbs are useless on collections?
 
lol, unless you're creating a RESTful API for DB administration ;-)
 
@m59 you should be adding records... not tables
 
m59
right, that's what I was thinking
like, GET api/users is all good, I can give them the users table (if authorized)
but I wasn't sure what to do with the rest lol
 
m59
I guess just return a status code telling them to step off
 
10:08 PM
Watch that. All of it.
 
m59
will do. I might be daft, but usually these things are all abstract and don't tell me at all what I'm supposed to be doing lol.
 
@igorw besides us wanting to remove the thing what APi changes did we make in the last x months?
 
@m59 POST /users is perfectly sensible. That's how you'd create a user. It should return a 201 if successful, with a Location header indicating the URI of the newly created user (such as /users/237894)
 
m59
ohhhhhhh
duh haha
 
DELETE /users ... well. Yea, I suppose that translates to deleting everything.
 
10:11 PM
I'm really trying to figure out your comment on the issue @igorw. Am I missing something?
 
Which is a perfectly valid operation, just not one you might want to support.
In that case, you'd probably want to issue 405 Method Not Allowed
 
And if it is a teapot you will want to send a 418
 
m59
@DanLugg well, I am stuck lacking a nice way for adding tables. I'm working on my content manager. Let's say I add a plugin that needs a table. It would be nice to have the table creation statement stored somewhere and have a simple way to initiate that creation
I'm just not sure where/how
 
@m59 I don't think that's something that should be initiated through a RESTful client API.
 
i'm fed up of daemon, just cant make it work :(
 
10:15 PM
You should probably support plugin install/bootstrapping for that.
However you support that is up to you.
 
m59
The same index.php file will handle it, but it can be a separate process
 
Well, right. I mean, public/index.php typically handles everything in most applications.
 
m59
heh
I have index.html, admin/index.html, api/index.php
 
someone help me set up a demon :(
 
m59
prays to the Lord, Jesus
 
10:16 PM
hheh
bye all, goodnight :(
 
I should get a Arduino and actually create a server that support HTCPCP
 
m59
@NokImchen no idea how to help you
 
syncing files on multiple server
any good tool?
i am aware that capistrana does it
but is it reliable?
 
Take for example some of the popular applications out there. Typically, they have an /application/plugins/install directory that you drop .zip files into. When you pull up the admin UI, you can browse pending installs (the .zip files) and install them. When they install, they unzip, run a one-time install/bootstrapper, and then are usable. The one-time install/boostrapper would be responsible for writing extension scripts, DB tables, etc.
 
@m59 please wait, i'll show you my script
 
10:19 PM
@meWantToLearn rsync?
 
@Orangepill That doesn't support syncing to multiple machines in a sane way does it?
 
@Orangepill so your saying rsync is much more reliable than Capistrano?
assume i have 3 servers
 
@PeeHaa true..
 
and i want to sync few files on them
 
@meWantToLearn not familiar with Capistrano
 
10:20 PM
from what I understood from Capistrano does it
 
@m59 i have this script pastebin.com/M8fPuJGU , the script is suppose to write numbers in qas.txt file but its not writing anything on the file. I cant even check whether daemon is running or not :(
 
but at the same time there is rysnc
any one worked with capistrano or rsync?
 
m59
@DanLugg yeah..I think I can come up with something. I just obsess over things being dynamic. I'd love if it would run the creation statement if the table doesn't already exist when trying to use it, but that would require the extra sql statement each time (afaik)
 
@m59 Well no, you'd have an install procedure. If any of the usage procedures fail, you could check to ensure the system is stable. If it's not, log it, and flag an admin to re-run the install.
 
98
A: How do I select an element with its name attribute in jQuery?

Madara Uchiha$('[name="ElementNameHere"]').doStuff(); jQuery supports CSS3 style selectors, plus some more. See more jQuery - Selectors jQuery - [attribute=""] selector

2 moar for gold!
 
10:22 PM
Anyone here work with "JStock" the program? (Probably posting in wrong place considering its a java program)
 
You already have an install procedure, you'd just call it again.
 
goodnight all :)
 
m59
Yeah, I get it. Joomla is like that. I just meant that it would be more ideal to not need to install, but have things "install" themselves if needed.
 
@HelpingHand I work with "JSkeet"
 
@PeeHaa what syncing tool have u used to sync files across multiple servers?
 
10:23 PM
@m59 Well, nothing can run without initiation. Unless you have a cron job watching for uninstalled modules to appear, then it'll need some user interaction.
 
Ugh so ugly, oh so ugly.
 
m59
Like, I try to add a user, there's no user's table, so see if I have a statement for creating it...I do, so make it, now add a user @DanLugg
 
@meWantToLearn None, but I see that capistrano is something rubyish...
 
m59
Then I could add the plugin to the plugin's folder and immediately start using it
 
@m59 Well, I think if the User table is missing, that's a pretty fatal error. That would warrant a fast failure, and logging of the exception. The administrators should be notified that a re-install of the dependent modules is required.
 
10:24 PM
@Madara Uchiha Have no clue what or who that is.
 
m59
I think we're thinking about different scenarios :)
 
@MadaraUchiha sorry what was that ?
 
@HelpingHand A joke, basically :P See the top rep user on this site
@JoeWatkins I saw your RFC, and still wonder what good usecases are there for anonymous classes.
 
@m59 You're not gaining an awful lot by doing it that way. I mean, sure, if that's what you need to do, then do it. But by the same token, I'd rather not have an application re-stabilize itself without my interaction. I'd rather be notified that something got messed up so that I can take the appropriate steps. Maybe the User table was inaccessible for some reason. Now your script drops the existing User table when it comes back online, replacing it with an empty one. Whoops!
 
Oh... I get it. Funny! But seriously, I'm having some big bugs on JStock, the program for searching optimal stocks.
 
10:27 PM
@MadaraUchiha You can't think of any? Really?
 
@DanLugg Can't say I can.
 
m59
@DanLugg it wouldn't drop it. The creation would be "if not exists"
I would totally do it that way, but that's an extra query
 
@m59 I sure hope that is a j-query
 
m59
lol what?
 
@m59 Fair enough. My example is just to illustrate that by not failing fast, and making assumptions for recovery, you eliminate the user, which can piss off the user.
 
10:30 PM
@MadaraUchiha you read the internals thread ?
 
If my car filled itself with gasoline somehow whenever it was empty, that'd be convenient. But if it tries to fill up and puts my account in overdraft, I'll be pissed off. I'd rather have taken the opportunity to evaluate my financial situation, and purchase a certain amount of fuel.
 
@JoeWatkins I have, not yet fully convinced.
 
Well, nevermind... I guess I'll keep looking. Java applets are enough to to drive you insane. No matter how many times you try to uninstall and reinstall in order to refresh settings, nothin' happens.
 
Well, I'm done for the day. Night people.
 
Night.
 
10:33 PM
well I'm not sure then that I can convince you really ... I think all that there is that's useful to say has been said on the subject re use cases... use cases aren't what you should even be focused on in my opinion ... I said that on the thread ...
 
m59
@DanLugg thanks for everything, goodnight
 
10:50 PM
@JoeWatkins I have missed some updates over the past week or so.
I now allow an anonymous class inside classes, yes?
We don't have to do that nasty function hack?
 
m59
when a rest api creates a resource, is there a right way of returning the location of the new resource?
do I just include it in the body?
 
@m59 I would return a representation of that new entity as a courtesy
 

« first day (1075 days earlier)      last day (3864 days later) »