« first day (668 days earlier)      last day (4506 days later) » 

00:00
@AlexCastro so read some SQL tutorials
@JoeySalacHipolito did you try to read this ?
@tereško i was about to post that link, and ask you if that is right..haahahahaha
@AlexCastro do you want to combine the announcements query with the query on that SO post?
but i saw you are the author..hahaha
@AlexCastro , well .. you have to learn SQL to be a professional oho developer
00:01
@AlexCastro or do you want 2 separate queries
@tereško 500 more rep coming to you in a week for that one
@Nile I want it all in one query
@ircmaxell isn't it a bit pointless ?
Hi @Nile, I don't want to annoy you by keep on asking, but I need help on one more thing. As you suggested yesterday to let that "content" div extend on its own if the their too much stuff in there, I followed with that advice. The problem now is, I want the scroll bars to come, but if i put overflow:auto in the body css, then, when scrolling down, it scrolls past the sidebar. I want the sidebar to stick there.
@AlexCastro so out of enrollments.*, courses.*, students.*, assignments.*, stuco_announcements.*, principal_announcements.*, get the last 10 entries?
00:02
@tereško no, because you'll get a ton of upvotes and exposure from the promotion...
hmm .. there is that
@user1079641 i'm not clear on what you want
I need to do position:fixed on the sidebar
@ Out of principal, stuco, and assignments (where the user is in the class) get the last 10 entries
@tereško do you know any examples of an implementation of a domain object collection?
00:03
the problem is when i put that in there, the content container suddenly goes behind the sidebar
@user1079641 read up on what position: fixed does
it acts like absolute but it scrolls with the window
thats the problem
when i put position fixed; the sidebar scrolls along, but the content container becomes from 3/4 screen all the way to the whole screen
@user1079641 yeah, so you have to find a work around. try float: right; instead of float: left;
@Lusitanian bootstrap-affix.js
Anyone who hasn't read this post yet is doing themselves a great disservice: http://stackoverflow.com/a/5864000/338665 #PHP #MVC
00:07
on the sidebar?
did float:right on the content container and it worked, thanks for the help :)
@orourkek , not anything that would work as an example. It should not be too complicated for you to write one. You basically have setters for conditions , method which lets you grab all the conditions for the collection , and method with either adds another item to collection or creates bunch of them from an array.
@user1079641 np.
@Christian - I solved it! (Without RegEx).
$str = 'yellow green "cheese cake" "chocolate flavour" brown';
$split = explode(' ', $str);
$split[] = '';
$count = count($split);
$result = array();
for($i = 0; $i < $count; $i++) {
	if(substr($split[$i], 0, 1) == '"' && substr($split[$i + 1], -1, 1) == '"') {
		$result[] = $split[$i] . ' ' . $split[$i + 1];
		$i++;
	} else {
		$result[] = $split[$i];
	}
}
array_pop($result);
print_r($result);
@tereško I've been looking for hours for more specific info - should the collection use the "non-collection" DO to store data (an array of DOs), store it right into a member array, serialize it, or something else?
It obviously can't access the DO factory to make more DOs
@ircmaxell I link to that answer in about half of my answers :}
@Nile Out of principal, stuco, and assignments (where the user is in the class) get the last 10 entries. Didn't properly @ you last time.
00:12
@tereško - Can you see if my code will"break w"ith extra " quotes"?"
I always find myself over simplifying the mvc pattern
the only thing i do not understand about that post are the codes, i should break that into smaller pieces and understand em, i guess, i lack or missed some basics..
@AlexCastro So you just need to combine
SELECT * FROM `principal`
SELECT * FROM `stuco`
SELECT * FROM `assignments` ( + the join)
How can I incorporate the entire check I already have for the assignments?
@AlexCastro where is that?
00:14
0
Q: Joining Latest Entries from Multiple Databases

Alex CastroI have a few tables in my database. I want to display a feed of the latest database entries, regardless of the table which holds the information. The three tables are: assignments, stuco, and principal. The three tables share two column names that I want to display: title and description. Is th...

@AlexCastro that's the query to get assignments?
To check if a person is in the class
@AlexCastro so that's not the query for assignments?
@orourkek , there are 3 ways :

1. You have a specific collection created for specific domain object type. In which case there is no need to worry about tight coupling. Basically the collection acquires characteristics of factory (which is quite questionable)

2. In the constructor of collection you provide an instance of domain object, which then gets cloned. It's a good solution when your domain objects are extremely simple.

3. The collection acquires the instance of domain factory as parameter in the constructor. To prevent recursive dependencies you can create a separate factory for cr
@Nile no
00:16
@AlexCastro send me the 3 queries that you want to combine into one
@ShaquinTrifonoff viperpad.com
SELECT u.uid, u.displayname, u.permissions FROM user u WHERE u.uid IN (SELECT s.uid FROM sess s WHERE s.sid='%s' AND s.fp='%s');
That query select three fields from the user table based on a uid set in a session table
@tereško I have already tested it myself, I was just wondering if you can break it (because I can't).
@tereško heh, I was coding up a test class with cloning as you were writing that, I think I'll go with it. Thanks for the help, as always :}
@orourkek , i am not sure how it would behave if your domain objects contain other domain objects or collections
00:20
@tereško I'll be finding out here shortly, and I'll report back
thats why the note about "simple domain objects"
in this case the DO is quite simple
one notch above an array
i dont understand what are domain objects
00:25
yap.. but what is it in simple terms..hehee\
@AlexCastro when I ask for the queries, I mean raw SQL, not PDO. but dw
@AlexCastro where does the $classid variable come from
90
A: How should a model be structured in MVC?

tereško Disclaimer: the following is description of how I understand MVC-like patterns in context of PHP based web applications. All the external links, that are used in the content, are there to explain terms and concepts and not to imply my own credibility on subject. Updated version The first th...

if you really want to know, read the whole thing
@AlexCastro , when you are binding parameters by passing them in execute() , they are bound as PDO::PARAM_STR .. is kinda suspect that student_id is an integer
i've read that..multiple times, but those terms is what i don't know...
the domain information is? the stuffs you can get from get post?
@orourkek , i think SO needs the "spoiler" tag .. then you can create a simple answer , with ability for reader to expend parts of it , if he/she/it cares about more in-depth details
00:29
@tereško that's a good idea, but it'll never fly on meta
@JoeySalacHipolito ,the domain logic is, for example , how you calculate price in an e-comm site ( there are different currencies , different discount rates , special events , etc. )
that is something that you be part of domain object
the math? why is it called 'domain', argh..maybe i got a wrong understanding of what is a domain..let me have a quick googling
or , you are making a survey page , and you have multiple question. You would have to make sure that people are not providing conflicting answer. That too ( validation ) would be a part of domain logic
if you took what most frameworks called a "model" and stripped out all of the non-domain logic, you'd have something that sort-of resembles a domain object. However you'd be missing most of the SOLID principles, useful abstraction, and the persistence of true MVC DOs
@JoeySalacHipolito the domain is simply what you're modeling
@Nile the classid is gotten from a GET that I do. I list the classes the user is enrolled in, and also pull the classid, then I form it into the link and do a GET on the page that lists the assignments.
00:34
just a more general way of saying "business logic" because not everything has business logic
yes, i think i missed sooooo much of this principles...and maybe lack of understanding....pssh...argh
@AlexCastro so why do you need the first query?
@AlexCastro use IN
@Nile cause I need to check if they are in the class before listing the homework.
@AlexCastro okay, read a few SQL tutorials and then afterwards if you still don't have a solution, come ask again.
i'm not that great at SQL myself so it's hard to help you
00:38
Okay no worries
Hey guys, what's the easiest way to change an array to from this to this: paste.ubuntu.com/1145973
That looks like print_r($arr)
@KevinMurphy $arr[$newkey] = $arr[$oldkey]; unset($arr[$oldkey]);
thank you
just watch out for key collisions
00:41
starts reading
"security" in the title of an /r/php post = stay away
@AlexCastro
26 mins ago, by andrewjackson
SELECT u.uid, u.displayname, u.permissions FROM user u WHERE u.uid IN (SELECT s.uid FROM sess s WHERE s.sid='%s' AND s.fp='%s');
that's just an example
but hopefully you can get the idea by lookin at it
it's what I use for logins
@andrewjackson thanks
@AlexCastro np
@AlexCastro you would use JOIN if you're expecting to get values from multiple tables. use IN if you want to get values from a table based on values in another table.
bad luck on captcha today for me :{
00:50
@orourkek with reCaptcha, you only need to get one word right and usually its the more obscure word.
@orourkek I come across those all the time!
so lsntsi sdjfh39u5934t would get you past that
@Nile - True. I read about that on their website - I typed blah <insert word> and it worked!
saves a lot of time in the long run
lsntsi d9qir
Or, just click the 'new' button.
00:52
i think my captcha lib is broken though
rejecting everything
BTW - does the "listen" option for recaptcha not work for anyone else? i cant understand anything!
it's possible it's implemented wrong
@andrewjackson what?
@Nile I hate those 'listen' options! When I was still using Internet Explorer (:O), the Windows Live Captcha wouldn't load! So, I tried 'listen' -- it's just impossible to get through.
well, if a website developer decides to add recaptcha to their websites, and gets a variable name wrong, of course it'll always say you typed the wrong code
00:54
@ShaquinTrifonoff honestly, go to google.com/recaptcha/learnmore and press the listen option
@Nile - I just tried that, and it played a small bit of garbled audio before saying 'The Adobe Flash plugin has crashed.'
lol
Now the cursor doesn't blink. It's disappeard. Plus, the spell-check isn't highlighting...
Google didn't do a very good job with that one.
Regarding login security, why do people even save password hashes to cookies?? That makes no sense imo
Even if it's salted, it just defeats the purpose of making a hash
Because all you have to do is copy the hash
As long as logins aren't ip restricted or uses a fingerprint system
00:59
@andrewjackson You might find this interesting : Improved Persistent Login Cookie Best Practice
I just save a session id to cookies and use fingerprints
so there's two values to compare, and the user only knows one value required to login
this is why we have the arrow-circle-button
Looks like hequaMet re is?
"hequamet blahblahblah" will work
01:03
@ShaquinTrifonoff just hequaMet urMom will be fine
correct me if I'm wrong, but just lowercase letters
Stop spam. Read non-sense books.
that's what seems to work best for me
reCAPTCHA - The CAPTCHA where you have to click Get a new challenge again and again
I just scored 10/10. you're crazy. lol
this one's better
oops
01:08
i've gotten a few in hebrew... lol
That one worked!
thats "tell"
I agree, but the t almost looks like an 'o'
I was just trying again and again with different words like <?>, blah, etc.
Ortantw ioa po
(Didn't work, of course)
01:13
its otrantw
@Nile In a JOIN, how do I know which table is ultimately selected?
is it the FROM?
@AlexCastro search: structure of a join query sql
@Nile - That was a spelling mistake.
I think it didn't like two words for the second part.
@ShaquinTrifonoff okay, maybe.
01:50
posted on August 14, 2012 by Brandon Savage

It’s been a little over a year and a half since I left the daily grind of a commute and began working from my home office. It’s been an amazing year filled with challenges, adventures, struggles and blessings. I’m like most developers: I relished the idea of having a quiet place to work, of getting [...]

Hey, can someone explain what I would use PHP for?
hey goerge
I myself am new to php but basicaly its used for server side functions
Alright, like?
forexample if you want to create a functioning contact form
or
want to create a php chatroom , add includes
forums, communities etc all use php
So basically it can access databases, write info and read it?
01:55
yes it can
is anyone an expert here on computers?
I wish haha. Depends what expert is
So, user systems are possible with it?
I have a website and I mistakenly deleted the code on that. Luckily, that webpage was opened as it was before its code got deleted. The problem is, if I right click and view source for the page, it shows the updated code
yes even user or membership systems
there are free scripts like "php members"
01:57
Is there anyway I can view the code of that page as it appears?
phpbb3 also uses mainly php
nope
unfortunately the php scripts in a html page are hidden
Alright, thank you. Also, I've read it works with mySQL a lot? I know that is a database, how does it work with php, is it the one php writes and reads from
yes it does work with mysql. Basicaly as far as I understand the database creates the dynamic content and uses the php script as reference etc
I have a little issue here, anyone can think of a solution? need to change the text color of "vorname" but not sure how: $body = "email from von $name:\n".
"\n".
"Vorname: $vorname\n".
"Name: $name\n".;
@Nile shouldn't something as simple as this work?
$sql = $db->query("SELECT stuco.title, principal.title FROM stuco, principal");
@AlexCastro not sure
02:09
It returns the principal title, but nothing from stuco
what did i miss ?
@tereško scroll up until you throw up
@GeorgeSumpster facebooks was written in php , yahoo and wikipedia still is pure php
@GeorgeSumpster , i think that should cover "what can i do in php" quite well
one of the yahoo sites was written on symfony 1.x
sadly
i think answers
@GeorgeSumpster and php works with a lot or RDBMS's and NoSQL systems
02:15
@tereško Thank you :)
damn I just cant get the change xDDDD
php is so annoying sometimes
im really glad w3 schools exists
@Demorus lmfao
^ was a joke, right?
nooo im really glad XDDD lol
@Demorus w3fools.com - read it
hahahaha
02:18
it is not a joke-site , @Demorus , it is actually made and maintained by people whose lectures you would listen to in php-related conferences and whose articles you read
I know I just noticed
incredible
so w3 is actually not that accurate?
oh nice , didnt know you can edit your chat posts
W3C has nothing to do with W3Schools
actually w3c is about on-breath-away from filing lawsuit
After a JOIN can I just put DESC LIMIT 5 and it'll show the last 5 from the joined results and not one of the tables?
Apart from w3 I dont know where to look for how to change the font color of a php script.
and I googled everywhere xD
@Demorus , changing colors is done with CSS not PHP
02:23
Although I cant get the code to work with a simple php script for my contact form
@tereško after I do a JOIN I want to limit the results shown. "order by ID desc limit 1" gives me an issue because IDs can be equal, what should I do?
wow I wish I could help alex :(
@AlexCastro what is the full query that you have ?
$sql = $db->query("SELECT title FROM stuco
UNION ALL
SELECT title FROM principal
");
02:26
lol
the css methods dont work with my php code since the text is rendered as a email
what the fuck are you doing there ?
displaying title for both of the tables
I'm using guides, don't hate, haha
go to w3 schools LOL
@Demorus <p style="color: #f00;">this will be a red paragraph in email , if email client supports HTML</p>
02:29
@Demorus right. haha
@AlexCastro is there some sort of association between stuco and principal tables ?
No association but they share column names.
XDDDDDDDDD
private home page lol. Edit: that quiz really is funny
@Lusitanian lulz. Clearly this is the most important part of learning PHP
02:31
Lol I love how one of the options is that the first letter of PHP stands for PHP
@AlexCastro that's correct...
It stands for PHP hypertext preprocessor
hey teresko, ill send the code real quick.
$body = "email from $name:\n".
"\n".
"E-Mail: $visitor_email \n".
"\n".
"Name: $name\n".
"IP: $ip\n";
@CharlesSprayberry indeed! and they offer certifications!!
I was able to get the HTML back and fix the PHP :)
so basicaly teresko im trying to render "emaiL" "name" in blue in the email clients
but I think there is no way to do this. Ill just leave this as it is xD
02:35
<span style="color: #00f;">something</span>
and make sure you set the email content type to text/html
"<span style="color: #00f;">something</span>: $name\n".
dreamweaver sees it as incorrect code
@Demorus , are you trolling ?
the alternative is that he is a 12 year old kid from india
Im still reading this link you sent. Incredible but w3 schools doesnt make a unserious appearance to me
haha
02:41
@CharlesSprayberry I'm um...guessing you're a tide fan based on the tiny little picture in the sidebar
too much crimson to not notice
hey sure, ill check it out
@Lusitanian I am indeed a Tide fan. Did the jersey and hat give it away? ;)
html puppy
@CharlesSprayberry it did ;) you go to school there?
So guys, how can I limit this to the last 5 entries?
$sql = $db->query("SELECT title FROM stuco
UNION ALL
SELECT title FROM principal
");
Not sure if "order by ID desc limit 1" will work since some IDs will be the same.
@AlexCastro , why are you doing it ?
what is the point of that abomination ?
I want to list a feed of the latest entries of both the tables combined
8
A: Combining UNION and LIMIT operations in MySQL query

Alex MartelliQuoting the docs, To apply ORDER BY or LIMIT to an individual SELECT, place the clause inside the parentheses that enclose the SELECT: (SELECT a FROM t1 WHERE a=10 AND B=1 ORDER BY a LIMIT 10) UNION (SELECT a FROM t2 WHERE a=11 AND B=2 ORDER BY a LIMIT 10);

and this is extremely stupid idea
How would you do it? I'm learning so idk
03:56
Hey guys...
Hi.
What do you guys recommend I do if I want to display the latest entries to multiple databases, but together in one feed?
@tereško how do you judge whether it's a question or not?
@tereško i see, thanks
04:35
@Nile could you take a stab at my SQL now? I've tried to just display a mix of stuco and principal and I'm failing hard, haha
k just wait
@AlexCastro pastebin.com/e7kYvXU2 works fine for me
@Nile thanks a lot. What will happen if the IDs conflict?
04:41
@tereško you're just going through that guys posts, aren't you? that was posted in feb.
@AlexCastro if you order the following list of #s, what do you get?: 3, 6, 2, 5, 4, 6, 4, 3, 2, 2,
I get ya; just wanted to make sure it was capable of that and wouldn't break
@AlexCastro 2, 2, 2, 3, 3, 4, 4, 5, 6, 6
the only time it will break is when it has 2 of the same ID that are being limited, in which case it will chose the first query over the second.
so yes, using time() as another column is safer...
Okay coo
I do have date as another column actually
Its a current_timestamp
04:45
@AlexCastro so order by that instead of id
That easy? great.
@AlexCastro tell me how that works out
@Nile Thanks. will do
@Nile failure comes quickly. Fatal error: Call to a member function fetch() on a non-object in /home/homework/public_html/index.php on line 116
@AlexCastro did you make sure to change the field names announcement and announcement2 to what they actually are?
04:49
pastebin.com
@AlexCastro do you have phpmyadmin?
yeah I do I'm gonna start trying it with thatt
@Nile would it matter if I put the tables in ''
@AlexCastro run the query with phpmyadmin first just to make sure that it works
the tables go in `` not ''
@AlexCastro click on the database your tables are in, then at the top tabs click on "query" copy n' paste your query in there. thats how I came up with the query for you.
04:51
@AlexCastro go to your database, where it shows all of your tables, and click Data Dictionary and put it on pastebin.com please.
It worked when I removed the quotes
yeah, like I said - no quotes for field names and tables. use back ticks (```)
Is there any way to retrieve what column it comes from?
I want to show where the announcement comes from too
@AlexCastro what do you mean? (btw I'm going in 7 minutes)
Well I want to show announcements from student council and principal
I have listed them all mixed up well
but I want to show
Student council: blah
Principal: blah
Student Council: blah
04:54
array_keys() probably should work
it sounds more and more like you have a broken DB structure
anyways, I'm going. bye
@tereško why so? I got a normalized db structure
It seems to me that you're just doing more than you have to
I just want to list the latest records in three db tables :)
and also list what table it comes from
05:03
mornings
@andrewjackson do you know how I can also retrieve what table each entry comes from in pastebin.com/zjXWLk70
@AlexCastro , shouldn't all announcements go in same table ?
I have different announcements for different pages.
@AlexCastro Not really sure what you're trying to do, but here's something. Are they supposed to have something in common? SELECT p.*, s.* FROM principal p, stuco s ORDER BY p.date DESC LIMIT 5
05:14
I'm going to go with what @tereško said and just put all the announcements on one table
05:35
SELECT * FROM announcements works.
SELECT * FROM announcements DESC LIMIT 5 doesn't work.
Tested in PHPMyAdmin. Ideas?
does a DESC need an order by?
hey guys
im back :)
@Ale
@AlexCastro, I would probably write it SELECT * FROM annountments ORDER BY announcements DESC LIMIT 5; << forgot to mention that you want to limit the result too
and finish it by saying ;
posted on August 14, 2012 by Cal Evans

Blog:http://geekyboy.com Twitter:@adamculp Show Notes: http://www.soflophp.org/ http://www.openpros.net/   Sponsored by: Engine Yard

Guys, I'm learning psql at uni and I found that you can create your own custom functions and stuff, is it possible in mysql as well?
05:52
yes
Then how is function saved on ur mysql?
is it saved on ur user?
This should answer all your questions: dev.mysql.com/doc/refman/5.0/en/create-procedure.html
thx bro
06:24
Hey guys, anyone know a good place to start learning with PHP
@GeorgeSumpster any coding background?
Well, I spent this summer learning HTML, CSS, and am now learning javascript, I do understand the basics of code
@GeorgeSumpster hmmm some might argue that html/css aren't the basics..
@Nick True, I guess, I did some things with C++ and java a long time ago..
I'm open to books too, I can order those if there is no good online free tutorial
@GeorgeSumpster Here's a good reddit thread to read, might get some good ideas from here -> reddit.com/r/PHP/comments/dswtc/…
06:42
@Nick did you looks at the commends before spamming the link ?
@tereško nope much regret it now
What was so spammy about the link?
@GeorgeSumpster , i will quickly review few books and tell you when i find something decent
@tereško Thank you, I've used this style of book before and it was OK; headfirstlabs.com/books/hfphp
@Nick read it maybe .. ya know .. it might help
06:48
lunacy!
@GeorgeSumpster The manual page for PHP, but programming is a lot more than just syntax. Go back to the basics of OOP, understand SOLID. Learn testing, watch videos from Misko Hevery. Once you have that start looking at design patterns from Martin Fowler.
@GeorgeSumpster Beginning PHP 5.3 this one is quite good
@Paul Alright, I bookmarked it, I'll look at it when I'm more interested/awake.
@tereško This acutally looks really good. Give me a second to read the first pages
and you might supplement it with materials from wiki.hashphp.org/Main_Page
as for intermediate level , @GeorgeSumpster , that would be covered in PHP Master: Write Cutting Edge Code, but you need to understand the basics before you pick this one up
@tereško Alright, bookmarked it. Thank you very much, also, how does AJAX relate to PHP and just websietes in general
06:58
imma let you guys take this one
@GeorgeSumpster more or less the same way as normal part of the website , just instead oh HTML response , you send JSON or XML with data , PHP just outputs the content
handling of that content then is done by XHR instance on javascript side
Alright, thank you. I have to go now, thanks for the help.
07:26
morning
Good morning @Petra, hi @all
07:47
How could I have missed that date? blog.adrianroselli.com/2012/03/…
Morning ladies.
Hi girls! This is another sunny day over here. I'll jump on my bike soon anybody wanna join for a ride?
@decereé ola

« first day (668 days earlier)      last day (4506 days later) »