« first day (677 days earlier)      last day (4253 days later) » 

11:05 AM
What do you think I could use to make several php processes communicate with each other? All PHP processes are running on the same computer, it can be Windows or Linux.
I tried something with sockets, but maybe there is something better
 
@tereško Morning. I was about to ask you one thing: I was reading one of your answers about ORMs and came up reading the "ORM is an anti-pattern" post. It seems like you agree with the author's post in some degree and generally recommends to stick with the Data Mapper Pattern.
So I was wondering... if one of the main points of the post is that ORM fails trying to translate relational databases to object graphs. Isn't the author against the DataMappers too? If we take Doctrine 2 as example, one of the main advantages is the DataMapper component, which is the ORM' core purpose \Doctrine\ORM\Mapping.
 
@Keyne , ORMs fail for several reasons. One of those is atomizations: you loose the control over interaction with database. The Doctrine2 use of data mappers only goes so far that it does not let you have domain business logic in the same class as storage logic. The ORM still does all the magic, which starts to break down when you add JOINs to the mix.
And in my experience, most of queries in anything but the smallest sites has at least on join
If you are using ORM for it, you start to encounter bottlenecks. And, as project progresses, you have to use more and more complex queries and hack around the limitations of your ORM choice
 
11:24 AM
#askfab What do you say to @ircmaxell claim that sf2's true DI is also bastardized as service container? http://bit.ly/O2p174
 
@tereško But the point is that, if you're not using an ORM, I'm assuming that you're still using DataMappers, or are you avoiding it too and dealing only with relation data? The second point is that the ORM facilities of querying the database using a specialized language doesn't means that it needs to be always used. That's where the strength of Doctrine comes, because if you decides to not use DQL (Doctrine Query Languge) and go with plain SQL, you still have the DataMapper suport.
So instead of populating the object graph by hand, you'll use the Doctrine DataMapper.
 
What ?!
 
with relational data*
 
I am using data mapper pattern because it lets me choose how and where the data from my object is stored , and where it comes from
 
Sem
@Keyne Using 2 concepts for the same responsibility is a bad thing to do IMO.
 
11:31 AM
@tereško Can you give a simple example of how you populate an object when retrieving it from your DataMapper?
@Sem Can you name those two concepts?
 
$user = new User;
$use->setName('who cares');
$mapper = new UserMapper;
$mapper->fetch( $user );
 
done , it is populated
 
Sem
@Keyne DQL(ORM) and data mappers
 
i think he does not understand that data mapper , just like active record, unite of work, transaction scripts and others are just patterns for interacting with ---database---- any form of storage
NONE of them implies magic
 
11:34 AM
@tereško Okay, that's right. Now, imagine the following, you have a very complex set of joins representing an object graph. Wouldn't your data mappers increase in complexity since you now will need to loop over the data to decides which part of the returned data belongs to which object?
 
what the fuck are you talking about ?!?
 
^^ was wondering same
 
@tereško Take it ease. I'll explain
You've just posted: $user->setName('who cares');
 
@ircmaxell "The discussion started around a piece of code that I stumbled upon from Fuel 2.0."
yes, yes stumbled upon :P
 
Let's say that you want an User object with its roles Role entity.
So you make the SQL join and populate the Role object and then $user->setRole($role). Is that right?
 
11:37 AM
maybe .. what are you driving at ?!
 
So, it's easy for a data mapper to find a single user object by its ID. But if you want the User object with something else, like roles, you'll need to make some loops through the data returned by the database adapter, hence the more complex the object graph the more complex will be the loops to populate it. Got it?
 
no, i don't get it
 
@Keyne Loops? The complication will be located to the mapper. It lets you make methods that are exactly as complicated as necessary to efficiently populate the object(s)
 
11:41 AM
I'll give a simple real world example:
 
all i hear is "Doctrine2 is better because of the loops" ... it makes no sense
 
@ircmaxell static class variables are superior to superglobals like $GLOBALS because they survive the php shutdown phase a little bit longer :)
 
//SELECT u.user_id, u.name, r.role_id, r.role FROM users u JOIN roles r USING(role_id)
//$rows = $db->fetchAll($sql);
$users = array();
foreach($rows as $row) {
$user = new user($row['user_id']);
$user->setName($row['name']);
$role = new role($row['role_id']);
$role->setName($row['role']);
$user->setRole($role);
$users[] = $user;
}
 
so that goes in your datamapper...
 
11:47 AM
As @ircmaxell said, the more complex the graph the more complex the loops, so the thing about the loops is that you will not need it if the ORM can make the mapping between you pure SQL and your objects
 
which no orm magically does
Doctrine2 doesn't know any more than you do about your objects or your database
 
If the Role entity also has its own object graph this loops will become more nested and nested.
 
I never said that
 
in fact it knows less
 
@Lusitanian Not magically, but you can specify the mapping instead of looping through the data to populate.
 
11:49 AM
that doesn't make any sense
 
@ircmaxell What exactly?
 
how do you think it populates it?
 
> so the thing about the loops is that you will not need it if the ORM can make the mapping between you pure SQL and your objects
 
@Lusitanian Will show you, just a minute.
 
magic you don't need to write is still magic
 
11:50 AM
i gotta go, continue this in 20 minutes
 
I'll take the more explicit code, thank you...
 
 
@Keyne , why would you manipulate a group of entries with same mapper as the single item ?!?
 
Hi all,
 
@tereško Because the data is returned by just one SQL query? Do you pass ahead the data for other mappers?
 
11:52 AM
@tereško It would have been more fun when it's about persistance or changing data. However, I find that kind of discussion more or less pointless because someone want's to make an argument win only. I'd say: Both concepts fail if you switch off electricity.
 
It's called ResultSetMapping
 
@Keyne Doctrine is so nice and offers something around your head but you must not use doctrine 2 at all nor is doctrine2 the ideal of what ORM constitutes.
 
need help, want to redirect
www.example.com/about-us/ to www.example.com/index.php?p=about-us.php
where let go all other pages that exist. e.g: www.expample.com/do-something.php
 
So please differentiate between shortcomings in doctrine2 (or better say trade-offs) and running SQL queries via PDO and what ORM concepts have to do with that.
 
@hakra I see... My main point is that it seems easy to have result set mapping like the link above than looping. At least for complex joins
 
Sem
11:55 AM
@KhaledJaveed Putting a .php filename in a GET, what?
 
@Keyne Well if the system behind has enough information about how the structure is organized and stored, a layer can actually do that kind of decision for you. However that is complex system to create, therefor far too expensive and "professional" (sorry for the irony) than you would find it in the php area. It is just, nobody needs it.
 
@Sem i want, when a user types a www.xyz.com/about-us/
instead of getting 404 error, he should be redirected to www.xyz.comm/index.php?p=about-us
 
@hakra No, it's just a matter of whether populate your objects using setters, or coding the result set map that matches that specific SQL query.
 
12:00 PM
@Keyne Oh, go to some conference and meet Benjamin, he has very much practical experience about these "just a matter of" and "it seems so easy" issues when you actually design an ORM layer. That is far from trivial (which is a reason why so few good working components exist).
 
@hakra :) Okay, I see your disappointment. I've not expressed what a really want to.
 
Sem
@KhaledJaveed You mean "SEO friendly" URLS? google.in/…
 
And to actually broaden the picture: There is also lazy loading and overloading in the "resultset" (list of objects) which might be a requirement. The setters or not is rather a detail than something I'd say which would make really a difference.
 
@Sem exactly yes
 
@Keyne Would be interesting to find out where you see disappointment.
 
12:05 PM
@hakra "just a matter of" and "it seems so easy"
 
@Keyne That was not meant as irony but a quote of your chat posts.
 
No worry. I think maybe we lost the tip of the question.
 
I had the feeling you were looking for some guidance so I suggested you to contact Benjamin because he is very profound in the topic.
And a talk face to face in real life normally does a very good job.
 
How's Benjamin?
 
author of doctrine2. Benjamin Eberlei.
 
12:09 PM
Ah! Got it...
@hakra You're putting lazy loading and overloading into the scene just to point out those extra layers?
Not sure if I got your point
 
@hakra perfect!
 
@Keyne not that important. just to broaden the view not not make too many assumptions onto what data has to be mapped to fulfill requirements.
 
just had some fun deleting user notes :P
Deleting stuff is always fun
 
I've started the question because I've seen some DataMappers implementations that make use of loops to set the properties and others that use the result set mapping. So I was trying to figure out which of those options is the best. The question also referred to the "orm is a anti-pattern" post, and I've asked if the author, when talk about dealing with relational data as it is, doesn't not asserts that this is the case for DataMappers.
(i.e. DataMappers converting relational data to object graphs)
@hakra This is why I said "it seems easer" to use the result set map, than loops. I'm not sure, though.
 
12:22 PM
@Keyne You can not foresee the future. A good ORM layer normally offers multiple strategies how to deal with that so in case you run into a problem, you can control that and "fix" it easily. Also, technically, you are mapping a group of objects not a single one. The ORM should have an interface for that. The interface @tereško was giving was for a single object only.
And keep in mind that it is from the consumer side of the layer. And that is the part where you actually do not need to care about the ORM implementation details. As the interface is defined, you can change the concrete implementation that later on and actually run metrics which kind of data access better suits your needs if you roll the ORM your own.
Premature optimization is the root of all evil. Premature implementation paves the roads to many hells.
 
Sem
@hakra Don't forget temporary solutions :D
 
0
Q: How to print a webpage from my Android phone?

TruthAssuming a modern (compatible) mobile printer, is it possible to print a webpage or a PDF document directly and natively from the phone? I've heard of PrintShare, and saw this question, I'm asking if it can be done natively, without the use of another application. If that's not possible, is the...

If anyone around here by any chance is an Android guru :P
 
@Sem Those just rocks (but only for a limited time) :)
 
@hakra Exactly! That's the point. I've tried to roll my own data mappers (not full blow orms), but the complexity, at last for me, was increasing too much. So I picked one ORM Framework. I failed in maintain the mapping of my object graphs using custom datamappers, the loops increased too much. But as @tereško said, maybe I'm missing an important point that made me fall into a lot of nested loops.
 
I dunno for which ORM you opted finally to use, but this sounds like that you must hint the operation to not run into that problem. IIRC this is a known problematic area in mapping the data because the relational structure in the database not always maps well with objects in your application.
 
12:31 PM
Nested tables! AH MY EYES!! It b̢̛ͥͣͯͪ̔͛̀̚ú̾̀͡rͦ̑ͩ̎͑͑̅̏͢ñ̴͋̆҉̛s͆͆ͪͩ͒́ͣ͡! — Truth 1 min ago
Looks better on site really
 
I thought this was wiki: stackoverflow.com/a/60496/508666?
 
@PeeHaa I think it was
Posts enter community wiki mode when one of the following happens:

The body of the post has been edited by at least five (5) different users.

The post has been edited ten (10) times by the original owner.
...
 
@Theo is a 1337 haxzor? :D
 
There are more than fine
five*
He probably flagged it so he gets rep from it
 
@hakra I've been using Doctrine for almost one year. When I read the "anti orm" post I started remembering about that problematic back in time when building my custom DataMappers and how it'd if we remove the mapping stuff as proposed by the author of the post. This is why I came here to ask if someone has sticked with with its own DataMappers for complex applications instead of using a framework or instead started dealing with just relational data.
 
12:44 PM
Interesting question... how do you calculate average difference without knowing the average count?
 
In the case of the custom orm, I was about to ask how those problematics were solved, as in the example of the loops.
 
say for example, the average of 5 items is 2, the 6th item's value is 2.1, how do you add it(the 6th item's value) to the average?
I'm thinking this is not possible without keeping $count and $total (so you just do $count++; $total += 2.1;, for the 6th item)
so if the $idiot that did this code only kept track of $avg_total, I think I'm pretty much fked. I think it's time to call that psychotic friend of mine to give this guy a visit. :D
 
GM all
 
@Neal I don't know about anyone else, but AFAIK, I'm not genetically modified.
 
morning @Neal
 
Good afternoon
 
@Donut hiya
 
@Christian eh?
@Donut GM Dunkin'
 
Hello @PeeHaa @Neal
 
12:56 PM
@Keyne IIRC doctrine2 does this with the DQL. It is an optimization that is transparently applied. For data mappers you write from scratch, I can not tell you but just you write it your own which is probably worth the training.
 
I broke my laptop screen... New laptop, new screen, or external monitor?
is laptop connected via HDMI and such a valid combination?
codes no see
 
@hakra Yes, DQL. That's why I've mentioned that a few minutes ago. As for the post I've also mentioned, it argues that the more complex the SQL you need to write, the more you need to "tweak" the ORM with Native SQL instead of DQL. The author says that it's one of the weaknesses of ORM frameworks with such type of queries, he says it only works on the early stages of the development, because then, when you need complex joins, you will always get around the ORM query language (DQL in our case)
It was one of the main topics to explain the assertion "the ORM is a anti-pattern".
 
leftJoin() doesn't work sometimes in Doctrine...
 
@webarto pass it to support not an option to replace the screen?
 
@hakra with previous experience with Dell here, I won't see it in a month... I see 22" LG is 100€ which is cheaper I guess then new screen... (I don't take outside (hole in the screen) laptop)
 
1:09 PM
@Keyne Well and SQL is an anti-pattern because it's only well with relational but not with object oriented databases. So bla bla bla. ORM is hard to make. But that's also because the subject it covers is hard.
 
@hakra So, just to finalize, how much do you agree with the assertion? "ORM is an anti-pattern"?
Taking into account that DataMappers falls into the author's descriptions of relational databases to domain model objects.
 
Sem
1:25 PM
@keyne Are you in a project with basic requests to the database and have a strict time schedule? ORM would be the most ideal solution. But only in that case IMO.
 
@Sem I see... Would you mind point why?
 
@Keyne Objects as complex data structures that can build graphs as we have them in PHP are always a very bad represenation for normalized relational data. A mapper is a tool to bridge that obvious gap. And it is easier with a mapper than without. However nobody said that an ORM fits your personal data needs. Both ends of the line are just too much floating that some component in the middle can solve all potential issues.
 
@hakra So it's not an anti-pattern at all? Right? But the choices you have to make. Maybe the best can be mapping objects or maybe dealing with relational data itself.
 
Sem
@Keyne It's simple, if you have a project that needs to be extended with advanced requests. You will need to extend the functionality your ORM as well. Using something aside from ORM to fix that part would mean you will be using 2 different tools. Which makes things twice times more complicated. And complicated things are the last things you want in your application.
 
@Keyne Anti-Pattern. Phew, well I won't say so it's really that clear. It is a valid pattern because in software we often have objects and the database is relational. So that is not an anti-pattern to have a mapper here.
 
1:37 PM
@Keyne , you seem to have no idea of the differences between ORMs and datamapper pattern
 
@Sem If I'm not missing anything, I haven't found something that would be apart of the ORM as a fix, as you said "something aside from ORM to fix". If you need advanced requests you will write your advanced SQL and then use the ORM DataMappers facilities to populate the objects.
 
 
all the datamapper says is : keep the domain logic separate from storage logic
period
 
@tereško Let's see: ORM is a piece of software that involves the use of data mappers (or ActiveRecord like in Propel), lazy loading, sometimes repository pattern and so on
It also involves the Database Abstract Layer, like the Doctrine DBAL.
 
Sem
@Keyne Using datamappers with advanced SQL aside from using ORM is using 2 different tools for the same responsibility.
 
1:40 PM
Abstraction Layer*
 
No wonder Fowler has a similar opinion as me :) - but actually he can write that better: martinfowler.com/bliki/OrmHate.html
 
@tereško DataMappers map between objects and storage, right? "A layer of Mappers (473) that moves data between objects and a database while keeping them independent of each other and the mapper itself."
So it's not just about "keep the domain logic separate from storage logic". Am I missing something? This would be the job of the DAL, no?
 
@PeeHaa What happened?
 
I mean, you can keep domain logic apart from storage without using objects.
 
1:44 PM
with ORM the goal is to hide the storage logic from the user
 
You can still use a Data Access Layer.
@tereško hm... taking this strictly I'd be breaking the ORM stuff if I need to write SQL. Haven't seen from this perspective.
 
@MikeB dunno
 
Sem
@Keyne That's exactly what I said!
 
But in the end I'd still have the ORM datamapper to help me populate the objects. Is that bad?
 
in what context ? please stop asking to confirm you presuppositions
 
1:46 PM
Even writing the SQLs.
@tereško For example, using Doctrine, if I need to write SQL, then I can write the mapping stuff using docs.doctrine-project.org/en/latest/reference/…
That's the DataMapper facility of populating objects I'm referring to.
This is the only reason I'm arguing about that even writing SQL you can still use the ORM to map the entities.
 
why would anyone do something like this
if you have to write native SQL, you write native SQL and stop dicking aroud with ORM
 
@tereško Sorry, just trying to make sure if it makes sense before jumping to the next sentence.
 
Sem
@tereško , mind making the ultimate MVC framework from scratch tutorial? :)
 
@Sem , yes , i do mind, because i do not fully understand MVC
 
@tereško So, it seems like it's not a good idea...
I've used it with some SQL queries... I have to think more about it.
I'm not sure why is that a bad approach.
I thought I was coding it well =P
Beginner illusion, lol
 
Sem
1:56 PM
@tereško Well explaining the basics in simple words will help you to understand it better :)
 
@Sem Generally I have to deal with SQL, even using an ORM. So there are the two responsibilities you've mentioned. Now I just need to figure out why the doctrine approach of mapping using SQL queries is not a good one, to support this affirmation. At least a got some start point =)
 
Sem
@keyne I never mentioned two responsibilities, only two tools sharing one.
 
Blah
 
@Sem Got it
 
Sem
@ircmaxell , good day to you as well :)
 
2:05 PM
just got in to the office
 
You've reached the maximum of 30 Deletion votes per day; come back in 9 hours
 
Thanks @Sem @tereško @hakra for the patience. :) Now I can go forth on the researches. Leaving now... see you.
 
@Keyne read the article I just linked. just read it. - martinfowler.com/bliki/OrmHate.html
 
@hakra Okay, I'll.
 
Sem
@Keyne Good luck!
 
2:16 PM
@Sem ;)
 
Hi guys, quick question. What is the advantage of using getcomposer.org instead of git submodules?
"it deals with "packages" or libraries, but it manages them on a per-project basis, installing them in a directory (e.g. vendor) inside your project" then why not just use git submodules? If your dependencies are git hosted ofc
 
@Donut just found it too
 
Damn level 5 :(
 
I'm at level 3 right now ^^
I see the sql injection vulnerability, but I don't quite get how I can exploit it
 
2:31 PM
You want a tip? :)
 
@Donut what is this website for?
 
Hacking game
 
@Donut Let me bookmark that and please no spiolers :)
spoilers*
 
What do you mean by spoiler?
 
Service Temporarily Unavailable! who hacked the entire website?
 
2:40 PM
@Znarkus comes with a loader and dependency management. that is a bit more than git submodules can do for you. additionally it is independent to git.
 
@PeeHaa Okay
 
3:11 PM
> Thanks to folks here on stackoverflow I have mastered most aspects of database (sqlite) control using php in a matter of days!!!
Really?
Impressive
 
more like "scary"
 
3:37 PM
@PeeHaa oauth this weekend, you will
 
@Lusitanian I mostly likely will unless I;m suddenly struck with drunkness out of nowhere ;)
 
lol
i hate when people post on so jobs that they are looking to hire a jquery developer
what, you want to hire one of the developers of jquery...?
 
hehe
 
@Lusitanian and "php developer"? "property developer"?
 
lol
 
3:45 PM
@Lusitanian yes. Why not?
 
not that there are many property developer jobs on careers.
 
@ircmaxell nothing against that
just that it's very specific
 
:-P
 
"javascript developer" seems more appropriate
 
@Lusitanian preg_match() developer!
 
3:46 PM
fzgetss developer ;)
aaaaaaaaaaaaaaand leaving
bye
 
I've gotten requests because I was a core developer of a project...
 
too bad you are leaving, I'm hiring a @Lusitanian developer :p
 
@ircmaxell Was that joomla?
 
ouch
 
yes
I've turned every single one down, but...
 
3:55 PM
but... ? :)
 
@tereško you are right, watching the videos over and over again, makes me understand...
the concepts and principles behind it..but ofcourse not just by watching, i also code every after i watch the video, try to google some stuffs and learn, then slowly i understand em,, thanks..
 
@salathe $theOutputIwant = the_function_I_need($theInputIHave) - developer :)
^ this is funny. the anti-stress button for screen workers. - built into the UI.
 
screen workers?
 
for workers behind a screen may be ?
 
4:15 PM
Can anyone help with some simple if-else logic? pastie.org/private/u1strpnnxrxctphgjoe7ja I was doing this in a different order earlier and now I'm very confused... I'm getting the error "syntax error, unexpected T_ELSE"
 
@에이바 You probably have incorrect brackets somewhere
Yes. You have them all over.
 
@SomeKittens, so the if-else logic looks okay? I'll start looking at the brackets then.
 
you have more closing brackets them opening ones
.. i think
waaaait
@에이바 , this is batshit crazy
you cannot write
if () {
}else {
}else {
}else {
}
it does not work that way
 
@tereško, I'm telling you I got myself very confused with this. I was originally doing it like this pastie.org/private/8y5cw19bj8badkaeoq9kpg (which works)
but I was asked to auth to ldap first and then check db
basically switch it around
 
I tried contacting a person who answered in my question, but he haven't responded in a week. Can I ask about it here? It's nothing too big
 
4:22 PM
certainly
 
you can try
 
@tereško what do you prefer
class SomeThing {
//stuffs
}

or

class SomeThing
{
// stuffs
}

referring to the position of brackets..hahaa
 
Ok. In this answer: http://stackoverflow.com/a/11993473/1431627

He tells me: Change your PHP to get countForPHP from Request.QueryString and update SQL accordingly

Does anyone know what he means?
 
@user1431627 He means look at $_GET['count'] for the value.
 
@JoeySalacHipolito i uses the second way , but it's matter of preference
 
4:26 PM
yeah, i do the first one, but sublime text 2 autocomplete is the other way around, . .haha...
 
@JoeySalacHipolito Pick a coding standard and stick to it.. getting into arguments over bracket positioning is a fantastic waste of time
 
so true
 
just a random question, i really don't bother about that..haha...
just this time..hahaha
 
And I don't mean.. pick a bracket-position and stick to it... I mean select a published, vetted standard like Pear, Zend, Squiz, etc
 
@salathe Like this? $sql = "UPDATE tbl_click SET click = click + $_GET['count']";
 
4:29 PM
Or the standard to standardize all standards github.com/php-fig/fig-standards
 
thanks for the link...
 
@MikeB nobody really follows that Framework Interoperability Group's standards in this channel
 
well .. maybe the people who whoreship Fabian ..
 
It seems to have a healthy list of contributors
 
4:36 PM
@MikeB not really .. mostly its Symfony and Symfony related projects
 
@tereško You might be right - 7 people voted for tabs :p
 
@MikeB , that's natural .. i would be more worried about that one who voted for 2 spaces
 
@hakra My point is, why not just add your dependencies as git submodules. So instead of "composer install", run "git submodule init --recursive"
 
blah
 
blah?
 
4:45 PM
i think it is transliteration of "блядь"
 
@MikeB Didn't read any further than this post. Somebody said tabs??? kill it with fire!
 
@rdlowrey Good day, sir. How did your mental health turn out knowing that you had untested code in a repository?
 
Even worse one: "closing_php_tag_required"
yes: 3
fucking idiots
 
user895378
@LeviMorrison It's stressful not having things tested -- the good thing is I've stopped adding features. I'm going to test all day and have a big, fat, fully-functional Thursday push.
 
Oh good, keeping the tradition alive.
I should do at least SOMETHING on PHP-Datastructures as well.
 
4:55 PM
@Znarkus if you can, you can. nobody stops you. I'm a fan of git, too - in case it didn't sound that way.
 
@rdlowrey I keep going back and forth on whether or not I should try to incorporate some functional style things to Vector.
 
user895378
@LeviMorrison To compete with the millions of array_* functions? :)
 
. . . sort of.
More like get rid of them.
 
user895378
Do you have any particular ones in mind?
 
/**
 * @param mixed $initialParameter
 * @param callable $callback
 * @return mixed
 */
function foldLeft($initialParameter, $callback) {
    $carriedValue = $initialParameter;
    foreach ($this->getIterator() as $value) {
        $carriedValue = $callback($carriedValue, $value);
    }
    return $carriedValue;
}
This allows you to do min, max, and sum types of operations all in one.
echo $vector->foldLeft(NULL, 'min');
echo $vector->foldLeft(NULL, 'max');
echo $vector->foldLeft(0, function($carriedValue, $value){
    return $carriedValue + $value;
});
Note that if my earlier proposal to allow binary operators as functions the last example would become: echo $vector->foldLeft(0, '+');
Side note: $vector->foldLeft(0, '+'); could be written is Scala as vector foldLeft 0 + or vector.foldleft(0)(+)
 
user895378
5:07 PM
I think functions like that would be really useful. Maybe in a subclass, though? If you added a few more and had some sort of FunctionalVector so as not to clutter the base with functionality that some use cases may not require?
 
@salathe I tried it but it does not work. :(
 
a FunctionalVector would be immutable, though.
More like they implement a similiar interface.
 
user895378
@LeviMorrison True. Am I crazy or does that sound like it might be a valid use for traits since you would implement some of the same functionality in FunctionalVector as Vector and composition through the constructor would likely be avoided?
 
interface Vector {}

MutableVector implements Vector{}

ImmutableVector implements Vector {}
@rdlowrey What you'll be passing in the constructor will be an array.
So . . .
There might be a use case for traits.
Maybe.
Bleh. Vector, back to an interface you go!
 
user895378
I feel dirty for suggesting it, but I was like ... "hey, that could be the place to get freaky with traits" :)
 
5:17 PM
One thing I'll need to figure out is how I can shorten ImmutableVector into something I don't mind typing.
 
FixedVector?
 
Still too long
 
Your code completion isn't doing its job right :P
 
I want to type fast enough I don't need code completion.
I also just realized something.
I don't need to take an array.
In fact I don't want to take an array.
 
I try to update a mySQL table with this:

$count = $_GET['count']
$pdo = new PDO('mysql:host=HOST;dbname=DATABASE;', 'USERNAME', 'PASSWORD');
$sql = "UPDATE tbl_click SET click = click + = '$count'";
$pdo->exec($sql);

Am I doing something obiviously wrong here?
 
5:20 PM
hi
 
I do not want an associative array and I want all array keys to be sequential.
 
any one know how to post php result to facebook wall
 
@tereško PDO abuse, 4 messages above :D
 
$array = new Vector(1, 3, 5, 7, 9); // valid, awesome.
$array = new Vector('name' => 'Levi', 'powerLevel' => '<9000'); // Syntactically invalid, which is exactly what we want
 
thanks for drawing my attention to it .. it's just what i needed today , @webarto
 
5:22 PM
@user1431627 . . . You use PDO and then don't even use bind variables.
 
@tereško daily dose :D
 
@LeviMorrison hi
@LeviMorrison do you know how to post php result to facebook wall
 
@LeviMorrison What? How am I supposed to give it to my database?
 
@user1431627 Read the manual on PDO. I am at work and can't help you atm.
@Ramarajudantuluri No, sorry.
 
@LeviMorrison ok thanks for responding
 
5:25 PM
@LeviMorrison Ok Thanks :) :D
 
$count = $_GET["count"]
mysql_query("UPDATE tbl_click SET click = click + ('$counter');");

Is this a right way of posting a variable?
 
@Neal There are way too many halp I dunno how arrays /objects work lately (or perhaps I just started noticing the influx) these days. Isn't there some canonical?
 
@user1431627 please , stop
programming is not for you
try a different hobby ... something that can not cause so much damaged when done wrong .. like beekeeping
 
@tereško Ok Thanks :) I take your advice
 
Please, don't use mysql_* functions to write new code. They are no longer maintained and the community has begun deprecation process. See the red box? Instead you should learn about prepared statements and use either PDO or MySQLi. If you can't decide which, this article will help you. If you pick PDO, here is good tutorial.
 
5:54 PM
@tereško I have written it in PDO, but I don't know variable binding yet...
 
@user1431627 because, instead of learning how to use something, you decided to just use it .. hence the beekeeping carrier suggesting , that at least would provide you with clear feedback when you are doing something stupid
read the PDO tutorial, which i linked , it should cover the basics
 
@tereško I am new to PHP as to my defence.
 
change screens they said, it will be fun, they said
 
@tereško can you tell me what are abstract classes?
 
6:30 PM
well, they are abstract and they are classes
 
@webarto You can make it happen ;)
 
@JoeySalacHipolito , i uses them when i have 2 or more polymorphic classes , with some methids that are exactly the same
 
user895378
0
A: PHPUnit testing

rdlowreyYour question is the exact reason why dependency injection -- when done correctly (not how most popular frameworks "implement" it) -- is touted as the ultimate in code testability. To understand why, lets look at how "helper functions" and class-oriented programming make your controllers difficu...

 
6:33 PM
@PeeHaa idk...
 
@rdlowrey , so have you chosen "pet-project" tag for yourself ?
 
i see . . coz im watching this polymorphism, from clean code talks, haha... thanks...
 
@rdlowrey Wow. Terrible example. Well done :)
 
user895378
@tereško not explicitly ... but I have a feeling that testing/http/rest would be the way to go (as you suggested)
 
Cannot believe it has 3 upvotes
 
6:49 PM
Damn I do not have any delvotes left for the moment.
Maybe you can find it in google. — hakra 42 secs ago
my pasta now is ready and I'm hungry like a bear after swimming.
 
^_^ bon apetit
 

« first day (677 days earlier)      last day (4253 days later) »