« first day (1507 days earlier)      last day (3667 days later) » 

00:37
Hmmm...
@kasperd This is one of several reasons I'm still a huge fan of stored procedures. You can grant the web server privileges to execute a stored procedure without granting it any access to the base tables. But I'm also completely aware that the "norm" these days in many cases is to just grant the web server full access to the database. Which of course I disagree with. ;-) — Craig 16 hours ago
00:54
well ... he's correct, but there is one issue with this
abuse of stored procedures cause the domain logic to leak in the RDBMS
I see
.. and good look in versioning DB then
haha
besides, you do not need to grant full access for the web app
you can create a user, which has only CRUD methods available
helll .. you should be doing that already
01:43
Hmm.
A std::vector is three words, and a std::function is six. When you compose them you actually get out ten words instead of nine; why is the padding happening here when everything is word-sized and word-aligned?
@LeviMorrison the answer might lie in the content of std::vector?
: (
Hey guys, I'm looking for a loop that will handle dynamic numbers. I have an array with keys 1,2,3,4,5,6,7. I need a loop that will place stuff in them in a certain order, specifically 1,7,4,2,6,3,5 so first, last, middle, and in between values. It's oscillating. How would I word this for google?
02:00
Use for with n/2 cycles. On each cycle add two members to new array: $new[] = $array[$i];$new=$array[count($array)-$i+1];
Thanks, I'll try that!
Do not forget to check for even and odd length of array
will do.
I understand first, last, but why middle? And then repeated?
02:06
We take two elements at once hence we need less movements.
03:00
Morning
 
3 hours later…
06:29
Hmm, when you want to distribute a random number range of [0..255] into [0..20], what would be better, modulo or division? I'm leaning towards division ...
probability of appearance number from [0..20] would be different
Obviously .. I just reckoned that [17..20] would be underrepresented if I did modulo :)
@Ja͢ck I wouldn't even have considered modulo for this. Division seems to do exactly what you need?
Yep, just wanted to make sure I'm sane :)
06:46
Hm... what is wrong with modulo?
@sectus Short answer, because 256 % 21 is not 0.
If the size of the bigger range is a multiple of the smaller range, modulo will be okay.
Somethink like this? 3v4l.org/5oGuM ?
Lack of probability in both cases. But modulo looks better.
07:07
Where did you get 13 from?
good moaning
@Ja͢ck echo ceil(256 / 21);
You'd get better results with (int)floor($i * 21 / 256);
The (int) and floor() is a bit redundant though, but well ...
You're getting messed up results when you use round() :)
[13,13,13,13,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12] -- modulo
[13,12,12,12,12,13,12,12,12,12,13,12,12,12,12,13,12,12,12,12,12] -- division
07:11
The division distributes the "anomaly" more evenly.
For better probability you could take 256 - 4
In which case it doesn't matter whether you use modulo or not heh
Because 252 = 12 x 21
I guess this is why it would make sense to make your destination alphabet a power-of-two :)
07:31
posted on December 01, 2014 by nlecointre

/* by Erkin */

for the first time in a couple of months, I'm trendy ... I'm the 20th trendiest C programmer on github ...
3
hi all
i'm facing problems with generating .pdf files with svg images in it...
anybody knows a good php library to do that? i try here "mpdf"...
Is there any thoughts about renaming PHP: Hypertext Preprocessor to something wider?
@JoeWatkins You're always trendy here :P
07:44
Hi, All
I am developing a site for Farm so anybody have any idea what would be best DB Structure
9
Just don't make your database look like grass, or the cows will eat it.
6
@Julo0sS did you tried tcpdf
@Ja͢ck yaps thats why asking for any good idea?
@Ja͢ck ahahahah
@Ja͢ck good advice, good advice ...
@Mubeen1992 well, i'm reading about this atm, but sounds a bit complicated compared to mpdf (i used it on several projects already)...
@Patrick working with .svg's?
user924016
morning
07:59
@Julo0sS yaps, switching from one library to another is a bit difficult but you will be get used to it once you use it. it has samples you can take any of them and modify according to your requirements.
moin ronni
@Mubeen1992 ok, you already used it?
user924016
morning trendy-joe =]
DateTime::createFromFormat() Sometimes I hate you!.
@Mubeen1992 i have to generate pages with styles setted with "bootstrap" (with % of height/width)... seems like this library uses a "manual" positionning system...
not sure about bootstrap but you can use styles(CSS).
@Julo0sS it even works with javascript... tcpdf and mpdf are total crap compared to it. It's a wrapper to wkhtmltopdf which is awesome.
Good morning. Started 30 mins later because of too much traffic.
08:17
fuck
I have to go to work
it's already 10AM
@vascowhite What's the problem?
@Ja͢ck I kind of hoped it would return false. Ah well :(
good morning
@vascowhite , 25 number of month?
08:22
@vascowhite Oh, right .. yeah, it does arithmetic for you ;-)
@sectus Yes, it doesn't fit the format string
@Ja͢ck A bit more code to write then :)
Yep :D
Well, just a strtotime(...) === false should do.
good mooning
Yo, @salathe
@salathe @SergeyTelshevsky Good Morning
08:28
moin @salathe
, all
Yo, @JoeWatkins :)
@Patrick Hey!
can someone help?
user924016
@Mubeen1992 what do you need help with?
@RonniSkansing Database Design
user924016
@Mubeen1992 if you are refering to this question, it is way too broad and unspecific
08:33
@RonniSkansing i just want some idea i am developing a Farm site so I thought it would be best if get some idea that what should be best structure for my DB
user924016
@Mubeen1992 you have not set up any database before?
@RonniSkansing I have created many DB's before but this is little complex so that why asking because database structure would be good then i would be easy for me to get or add data later
@RonniSkansing like i need to have a stock table where user will enter anything as he buys
and a expense table where user will enter that i have used these things and there cost
Is it hard to add a command like 'connectDevServer' to my terminal so I can automatically login into [email protected]
Maybe I have to edit nano ~/.ssh/config ?
08:40
alias connectDevServer='ssh [email protected]'
or what you said if you want to ssh connectDevServer, yes
aliases are easy to write
user924016
@Mubeen1992 I am still not understanding what the issue is. =/ Start designing it out. I can not guess what your requirements for tables are.
Is it possible: ~/.ssh/config
is not yet in my .ssh/ folder?
I only see: github_rsa id_rsa id_rsas github_rsa.pub id_rsa.pub known_hosts
@RonniSkansing okay thanks :)
user924016
@Mubeen1992 no problem .. Maybe a readup on relational database would be what you are looking for.
08:49
@Duikboot Yes, it's not standard.
good meurning! :)
user924016
mornings @Naruto
Morning
@Duikboot Sup
08:55
Unless your software causes aircraft to crash :D
Apply for it, do it.
@JoeWatkins coding the landing on a meteor in PHP? Easy!
Saw that a while ago, but...
To conform to U.S. Government space technology export regulations, applicant must be a U.S. citizen, lawful permanent resident of the U.S., protected individual as defined by 8 U.S.C. 1324b(a)(3), or eligible to obtain the required authorizations from the U.S. Department of State.
I'm not looking really, gopal posted a job page from spacex for the position of farmer, so I just thought I'd see if they are looking for software engineers ... it's only to develop internal software to track assembly of some equipment or something .. nothing that actually leaves earth ...
still I guess the people who get to write mission critical stuff prove themselves first ... they'll pick the best of the bunch to undertake that stuff ...
@Patrick that's not really a problem ...
> eligible to obtain the required authorizations from the U.S. Department of State.
oh... reading the whole thing helps I guess...
Hiii>
I have created a custom table in WP database .. But how to insert data in the table. I have already tried this to do But it not working..

$wpdb->insert('wp_applicants', array('first_name' => $fname, 'last_name' => $lname, 'email' => $others), array('%s', '%s', '%s'));

@Patrick @JoeWatkins @webarto
Is anyone familier with WP custome table insert ???Olz
09:05
dude, I'm watching cartoons ...
user924016
@KuldeepChoudhary you are not going to get any help by pinging people
user924016
I have a lot of experience with wp (yay,,,), but what you just did was rude..
I am new in WP
I have tried this query..
$wpdb->insert('wp_applicants', array('first_name' => $fname, 'last_name' => $lname, 'email' => $others), array('%s', '%s', '%s'));
user924016
@KuldeepChoudhary stop
09:07
But it not working
user924016
Did you make a question on wordpress.stackexchange.com ?
user924016
(make sure you read the rules for what is a valid question first)
user924016
@KuldeepChoudhary someone is already trying to help you (see comment)
ThW
ThW
Morning
user924016
09:10
@KuldeepChoudhary also btw. that was not wordpress.stackexchange but stackoverflow..
aand another tiny avatar...
Shortest horror story: Monday
user image
2
will make @AndreaFaulds laugh ^
haha
the browser uses JS to calculate doesn't it
user924016
@ziGi try this is php (0.1+0.2 === 0.3)
user924016
it is not about JS or PHP
@Mubeen1992 can't get something working with tcpdf... can u help pls?
09:32
@RonniSkansing Ronni, I know, it is just that JS gives the exact result shown in the cartoon
user924016
@ziGi so does python =]
user924016
as if they were using the same standard for number format
.. oh .. wait, they ARE
The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point computation established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). Many hardware floating point units use the IEEE 754 standard. The standard addressed many problems found in the diverse floating point implementations that made them difficult to reliably and portably use. The current version, IEEE 754-2008 published in August 2008, includes nearly all of the original IEEE 754-1985 standard and the IEEE Standard for Radix-Independent Floating-Point Arithmetic (IEEE...
I have read that usually float is correct up to 7 digits after the decimal point, but I am not sure about that.
So in this case, what is the best way to handle floats if you need higher accuracy?
09:36
posted on December 01, 2014 by kbironneau

/* by Attakinsky */

^ this depiction is wrong since the USB port doesn't have those squares on the bottom when you flip it
and in most laptops I have used the squares have to point upwards
I have never even noticed those squares
@ziGi Uuuhhm just checked two cables and both have the squares on both sides :P
wow
I have one here that doesn't have any
...
ok
correction
the see-through squares should point up
09:48
yeah .. well .. I don't see how it makes any bloody difference
you still dont know which way the port is on the board
well on laptops I've seen so far the plastic part is on top
so the USB empty part should be on top => you should see through the squares of the port when plugging it in
@JoeWatkins what's the php-src idiom for a safe string conversion of zval **?
convert_to_string(zval*)
err sorry, 5.5
09:56
same answer
does it not affect the value?
what do you mean ?
E.g. curl_setopt($ch, CURLOPT_HTTPHEADER, $a); where $a = [200].
After the call, $a will have a string element instead of an integer.
yeah you need a copy
09:59
@Ja͢ck we did that for the domlist[index] thing, don't remember?
afaik we did that differently.
ooh, actually .. i may just have it .. doh
At least in php7 we have convenience functions for this
@PeeHaa The bottom part has a "fold" in the middle ... also, if there's a usb logo it would be on the top face.
fwiw at least Apple's lightning cable fixes the issue on one side of the cable :)
Adz
Adz
10:16
guys, I'm using php with twig. How do I wait for the variables of a form to be set? If I do isset in php, the form is never shown on the screen i.e. if (isset($_GET["name"])) {
# code...
} else {
echo "Not set";
}
0
Q: How to display structure of an oracle table using php

arunHow to display table structure of an oracle table using php. I used show table_name and describe table_name but both are failed.

@arun could you wait a bit longer than 10 minutes before asking here?
@Ja͢ck :|
@arun , use queries over metatables of Oracle.
10:32
anybody's got a few time to help me with "tcpdf" library? i'm tryin to generate pages with svg images on it... but few problems with rendering...
Wtf is the aliases by reflection RFC?
Adz
Adz
guys is it possible to declare a variable in php with no type? i.e. $toBeInteger;
> It is very difficult to find out, if class name Http\Client in @return annotation is already FQN or if it is an alias.
No it's not! All the IDEs I've used do this for me..
@Adz Why would you want to declare a var without a type? You can overwrite it at any time with any other type anyway...
Adz
Adz
well what if I wanted an explode
oh
damn didn't know that
thanks
$x = 1; $x = "HELLO";
This is a dynamically typed language, not Java / C# ;-)
Adz
Adz
10:41
I'm too used to java sorry :p
@Julo0sS don't use tcpdf... use snappy
@Patrick can't install libs on my hosted server
@Patrick hosted @one.com, installing not allowed...
so can't instal wkhtmltopdf...
BiAtchzzz Allowed memory size of 201326592 bytes exhausted (tried to allocate 72 bytes)
just saying, the js monthly challenge is open to every room.
JavaScript is a monthly challenge
@DaveRandom PHPNW yes
I reckon I can get your beer count down to 22 tonight
it started in the js room, but the concept is open to every SO room.
Of course it is, like <insert cult name focussing on 'equal opportunities'> is open to everyone as well!
/trolololol
@FlorianMargaine Is this a regular thing btw? Not seen it before
@Jimbo see in the question, there is a link to the november challenge. Repo of the results is here: github.com/benjamingr/JS-Monthly-Challenge-Nov-14
november winner was something in knockoutjs...
the only js proposal for this month sucks tho, so it surely won't be done
11:09
Guys is this package for hash_equals function in <5.6 reliable?
@AwalGarg What are you going to use if for?
@PeeHaa comparing tokens stored in remember me cookies
I know I should get 5.6, but... I already have 5.5.9 setup so.. :p
yeah it's safe
Well to me it looks like what it says on the box
11:16
cool. Would use it then ;)
thanks
Guys, in your opinion, when is it proper to throw an exception, talking about from logical perspective?
Do you think that having validator classes throwing exceptions if the data is invalid is a good reason?
@ziGi Good Q
If you have the method isValid() then it makes sense to return a boolean here
Yes but you could always call the method verifyRecordExists() which checks if the data source has the record you are trying to update, you can make it boolean or throw an exception and handle it before outputting
but if you have a validator class with validate(), I would argue for having a base class ValdationException
@ziGi How are you going to enforce verifyRecordExists() is called though
I do not understand your question exactly, what do you mean enforce
well you call the validator with some data
right
11:23
@rdlowrey Did you get anytime to look at that hiccup from a while back? :)
It's not really exceptional though
(if we are talking about user input)
If you have something invalid in your domain model throw an exception. Otherwise I would not
true, you expect the data to be checked
but then the validator should not only return, whether the data is correct or not, but also a message, so how could this be done in a well mannered way
Well if it's correct, you return the data
If it's not, you throw an exception with the message as the reason
Yes, that's what I do currently
but Patrick just discussed that you shouldn't throw an exception
since the event is not exceptional
That's because there are those people who follow the "don't throw exceptions except in exceptional circumstances" path
11:28
$this->validator->validate($data);
if ($this->validator->hasErrors()) { $errors = $this->validator->getErrorMessages(); }
I see
@Jimbo There are also people that work on multi-lang sites :)
@Patrick But you can't enforce future users calling hasErrors() imo, but Symfony 2 does do this with the Form class I think....
@Jimbo No you can't, but that is up to the service that validates a given input. There might also be use cases where I don't want the messages (had one an hour ago)
What I did was I made a ValidatorComposite, which was basically a collection of validators
You call ::addValidator(Validator $validator) to make up a set of validators
The Validator interface had one method: validate($data) which throws a ValidationException with the message if it failed
Finally, all your concrete validators implement that interface, and your ValidatorComposite loops around the validators and calls validate() on them
That way I could adhere to SRP within my validators. I had a JsonValidator, an ArrayKeyValidator etc...
11:31
Well I have seen the fact that if the application cannot continue the normal flow because of some data inconsistency then you throw an exception and handle it on the top level (I guess in the controller)
for example the data given is not correct so the whole process halts
@Jimbo What happens on multiple errors? Or is it up to the user to catch the exceptions and i.e. merge them when needed?
@Jimbo I do something similar to yours
@PeeHaa Well your ValidatorComposite::validate() could pool the errors and return them as an array perhaps. I didn't do that, I just failed on the first one... but that's a good point
so I was wondering because the way of Patrick seems good but then you have to write more code and check
@ziGi Exactly, you can't keep going through what you're going to do with that incorrect data (like pass it to the next object to do something with) when it's invalid. Fail early
11:33
and having an incorrect id from the front end that is not found is an exception since the user expected it to be there
good mornings
@Jimbo But you don't need exceptions for that
@Patrick What do you mean?
@Jimbo Stopping when something is invalid. That is up to the validator composite/collection
@Patrick you are right, but then you have to save more data and do more checks
in general write more code
and use more memory just to stop a process
and the question is, why is it a better practice to do it that way
is it purely logical?
11:41
@Patrick I'm just thinking that if you force this via a composite, then you have a definite API to work with. There's no "forgetting to call this method"
@ziGi why is it more code? instead of a try catch you check if there are error messages
because you have a try catch anyways because other things might throw an exception (for example the data mapper as you said)
@ziGi no you don't... otherwise good luck debugging...
ok, let me clarify, I am talking about business rules validation
user924016
There is no right way
11:42
@Patrick not really if you subdivide the exceptions to 2-3 types you can log them in the catch and see what's happening
@RonniSkansing Well we're discussing the pros / cons of each
user924016
It is all depending on context
user924016
@Jimbo well I guess nothing wrong with doing that
@ziGi Or you show your user a nice error page and log the exception. But that does not happen inside a controller or service.
What I do usually is have 2 types of Exceptions: 1. Exceptions that are clearly related to user error 2. Exceptions related to system error
So with the system error I give a general message and log the exception, with the user related error I output the error in a nice way
11:44
I argue that user errors are not exceptional
well if someone fiddles with the javascript on the front end and allow data that should not be passed to the backend, why not?
@ziGi Me too... user error means the message is what I can display directly to the user on the client-side. System is generally what I log and do something different with whilst providing a generic "Something went wrong" message to the user
With your exception error messages, how do you handle multiple languages? throw a different exception for each language?
@Patrick For user errors, what's wrong with having the message of the exception run through a call to your i8n layer that determines which language string to use?
From your YAML file, of course
2
Well yeah we do a translate on the message
even for the general error message (the one done with the logging)
12:00
does anybody know a javascript/jquery lib/plugin which can convert .svg files into .png files?
@Julo0sS Draw on canvas, save the canvas.
@Ja͢ck html5 canvas tag?
No, you have to buy a canvas from the paint shop.
@Ja͢ck ok i will do that right now, brb ;)
Anyone know why my maillog is being spammed with things like?
centos6 postfix/cleanup[10232]: 52342F612: message-id=<[email protected]>
12:09
hi every1
Hi guys. Anyone used the WP-API for WordPress?
user924016
Hello @argentum47
user924016
@tmyie there is a general very low help limit on wordpress in here.. even lower on plugins
ah okay. you know a better place for me to go?
I studied and learnt a "few" things about MVC , (and I have to do rails on ruby at work), now I think I would understand a little about why rails is considered bad.
user924016
12:13
@tmyie yes, you could try asking your question on wordpress.stackexchange.com (make sure to read the rules before asking) or #wordpress on freenode
okay thanks :)
user924016
No problem =]
12:38
@ziGi you here?
user924016
@argentum47 what did you learn?
since enums are not an option in PHP, should I just use an abstract class or just use a define("XX", "YY");
why not an array ?
hi there
anyone could help with a basic question about the architecture of a little app?
Models contain most of databse related logic, like validations and scopes and associations and most of the other logic that can be called upon the object like user has first name and last name, then we can have a method in the model called `full_name` so that we can call it like @user.full_name.

But that doesn't mean we put everything into a model, we have to remember seperation of concerns. Like payment_calculation for a employee and can put in a seperate class/module and included in the employe model rather than polluting the employee model with calculation specific things.
12:44
@Naruto yes me man
@tereško because the auto-complete makes my life easier :)
@ziGi check a few lines back :)
@Naruto the accepted answer tells you to use SplEnum
@Naruto this one?
user924016
@argentum47 try reading blog.ircmaxell.com/2014/11/a-beginners-guide-to-mvc-for-web.html and tell me what you think about it..
user924016
compared to what you just said.
12:45
ok
user924016
But yea, you just described the rails model =]
@Naruto maybe using enums in your case is not the real solution, what are you trying to do?
@IamZesh noone will talk to you till you actually ask a proper question
@ziGi I just have 5 actions.. Which could be called anywhere in the project.. Nothing more, nothing less.. Actions contain integer value..
@tereško thank you! should the question be posted on SO or can I formulate it here?
12:47
@Naruto well you can always make an abstract class with them. For example:
abstract class Cards {
    const TWO = 2;
    const JACK = 10;
}
@IamZesh depends. If the question is short/trivial or hard to articulate, then chat would be the best place for it. Otherwise you will have better results on the main site.
anything wrong with SplEnum?
@ziGi did you read the answer he linked to?
Anything wrong with 'c style' structs?
@FlorianMargaine the answer I linked was mainly about that abstract class :)
I know, hence my question
12:48
Ah, not really
and my answer: use SplEnum, it's there for this use case, ffs
@Naruto well the most proper way obviously is what Florian suggests
@tereško ok, thank you, I'll give it a shot here :)
@FlorianMargaine nothing wrong with splEnum, but my question was should I just use DEFINE 5 times? Or should I create a class (abstract or with splEnum)
so the extend SplEnum is the way to go?
well I suggest you go the OO way
12:49
@Naruto is it an Enum or 5 completely different values?
I am writting a little php app (MVC) connecting to a cms (an external website on which I have no control).
The goal of the app is to perform actions on the cms on behalf of the user
5 different names with 5 different values
sorry, I meant: "different kind of values"
are they related?
all integers
@argentum47 the main problem with the Rails approach is that in non-trivial projects most of the time you end up wit completely broken SoC principle, because both application logic and presentation logic gets dumped in the controller.
12:50
are they semantically related?
I don't think they are
/me is happy to write something in php. It's been a while :)
what is the name of the enum you'd put them in?
if application types
they could be, but they don't have to be
the only thing I need to be able to do is call them all over my project and the vlaues have to be integer :)
nothing more nothing less :)
12:52
@tereško presentation logics are to be handled by helper!! I haven't built any large or state of the art application, so maybe I cannot visualize the problem
presentation logic includes cases "so .. there was an error, so we still need to render the header, footer and sidebar templates, but the content needs to be replaced with template for error message"
what your helpers attempt to do is kinda the purview of presentation objects .. which, like the templates, should be juggled by the view
also, please not that "http location header" is also form of response, which too should be generated by view
@FlorianMargaine do you know what the __default const stands for
12:57
Guys, what is the use of HTTP in PHP?
The one which is in github.com
@ziGi class FooEnum extends SplEnum { const __default = self::bar; const bar = 1; const baz = 2; } $foo = new FooEnum(); $foo == FooEnum::bar; // true
aha
smart
Guys, could anyone help me?
But in rails I guess the controller generates it from the ActionDispatch
@ziGi look at the comment on the SplEnum doc
@HassanAlthaf superglobals are an awful API

« first day (1507 days earlier)      last day (3667 days later) »