Jump to content


Staff Alumni
  • Posts

  • Joined

  • Last visited


Everything posted by Koobi

  1. I'm looking at the ZCE PHP 5.3 exam. I'm pretty much convinced to do it now. I guess I should give you some background info. I want to eventually apply for a job abroad and having an extra certification always gives you an edge, I guess.
  2. In terms of being appealing to a potential employer, would you say that getting your RHCE (Red Hat Certified Expert) and/or Zend certification is a good idea? I have over 7 years of working experience as a developer but I have no bachelors degree (only an associates) so, what do you think? I am getting my CCNA within the next 30 days. I may consider CCNP as well. Feel free to suggest any other certifications as well.
  3. String replacement functions are ideal when you know exactly what you want to replace. If you are unsure about exactly what you want to replace but you have a vague idea of where the data you want to replace will appear, you could use pattern matching. Pattern matching in PHP is done using Regular Expressions. I am assuming you will always want to replace anything that appears within the quotes of the href attribute with your own text. If so, this will work: <?php $subject = "<a class=\"scorelink\" target=\"match_details\" onclick=\"window.open('','match_details','width=400,height=188,menubar=no,status=no,location=no,toolbar=no,scrollbars=no,resizable=yes')\" href=\"/default.dll/game?comp=cl_group_A&game=357186\">"; $replaced = preg_replace('/href=(["\'])[^\1]+\1/i', '', $subject); echo htmlspecialchars($subject); echo '<hr />'; echo htmlspecialchars($replaced);
  4. It's definitely one of my favourite shows of all time!
  5. Oh wow, that's excellent Never thought of it that way. This works fine: SELECT `users`.`id` AS `uid`, `users`.`name_first`, `users`.`name_last`, `cinemas`.`id` AS `cid`, `cinemas`.`title` FROM `cinemas` LEFT JOIN `users_cinemas`ON`users_cinemas`.`cinema_id`=`cinemas`.`id` LEFT JOIN `users`ON `users`.`id`=`users_cinemas`.`user_id` WHERE `users`.`id`=1 Do you see any potential bugs? Btw, any tips on naming conventions for a database? As in, naming conventions for field names, table names, join tables, primary keys, foreign keys, etc?
  6. I think you guys misunderstood what I was saying. Or maybe I just didn't explain completely in my last post. I am running on a custom compile of 5.3 too but the thing is, I'm building a framework for people to download and use. So if Joe Schmo wants to download my framework and use it on his server and he has no control over the PHP version on his server, he won't use my framework. I'm hoping to complete the framework by March. I'm just wondering if it's a realistic goal to build for 5.3 in case 5.3 is not widely supported by then. On average, how long does it take for hosts to upgrade to a release? 6 months? 1 year? Any ideas guys? I've been out of the loop for a while :/
  7. I got my first PC around 1999. Before that I used to mess around with Pascal/QBASIC/C/C++ at the school computer lab on my own. Funny thing is I have never, in my life, taken computing as a subject haha but it seemed so appealing. Anyway, after the PC in 99, I used to use the net a lot and I really got into design, almost sat for the Adobe Certified Expert test because I was so into it. Then I wanted to turn the designs into HTML so I started mucking about with HTML. Of course, that led me to CSS. I eventually got sick of CSS because it's so browser depedant and I wanted something dynamic so I got into JavaScript for a bit. Again, JavaScript was browser dependant and that really annoyed me so around 2002-2003, I thought I'd give PHP a shot since it seemed so easy to get started with and the syntax was somewhat similar to C. I finally settled with PHP because unlike client side languages, it behaves as expected on almost any environment. I also liked the fact that I could quickly implement ideas in PHP because it's such a light language. Really easy to build working prototypes. I started freelancing with PHP around 2005 and loved it. Took a small break from all scripting for about two years, beginning around 2007 to sort out some personal matters. I started messing with Ruby On Rails about 1.5 years ago just for fun. Mostly experimenting with things. I love their philosophy and the Ruby language is pretty awesome IMO. So I'm in between PHP and Rails at the moment. Wow...long post
  8. Oh I'm on a rackspace cloud so I can install any version I want But I'm creating a framework and I can't decide on making the minimum requirements PHP 5.2 or 5.3 I would love to go with 5.3 simply because there's so much more you can do with it...but if there's going to be little support, what's the point :/ I'll bet Debian will take about a year to get 5.3 :/
  9. I love some of the new things that PHP 5.3 brings with it. The problem is, it's quite new (6 months old?) I was wondering, how long do you guys think it would be before most reputed web hosts out there would start using PHP 5.3 as opposed to 5.2? I hope they begin supporting 5.3 before March 2010 at least!
  10. hmmm...So the idea is to start with the joining table and use left joins on that to connect to the others? I should re-learn my SQL joins. Can you recommend a good resource? In the meantime, using this query, on what basis would I order it to get the results I want?
  11. How are left joins done accross 3 tables in MySQL?
  12. Oops. Yeah, my mistake. I would change that to: SELECT * FROM `users`, `cinemas`, `users_cinemas` WHERE `users`.`id`=`users_cinemas`.`user_id` AND `cinemas`.`id`=`users_cinemas`.`cinema_id` But how do I make sure my data is ordered the way I want it?
  13. Actually, I was hoping you could tell me the best way to do that too. I've forgotten a lot of my SQL during my hiatus and I used to mostly use ORM's anyway so I never really used raw SQL but I want to get back into it. Right now, I would do it like this: SELECT * FROM `users`, `cinemas`, `users_cinemas` WHERE `users`.`id`=`users_cinemas`.`user_id` AND `cinemas`.`id`=`users_cinemas`.`cinema_id` AND `users`.`id`=1;
  14. $ mysql -V mysql Ver 14.12 Distrib 5.0.75, for debian-linux-gnu (i486) using readline 5.2 SQL is not one of my forte's, unfortunately, so I need your help with this Let me first show you the tables involved. mysql> show tables; +----------------------+ | Tables_in_issue_sort | +----------------------+ | cinemas | | users | | users_cinemas | +----------------------+ 3 rows in set (0.00 sec) mysql> describe cinemas; +-------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+----------------+ | id | smallint(6) | NO | PRI | NULL | auto_increment | | title | varchar(25) | NO | UNI | NULL | | +-------+-------------+------+-----+---------+----------------+ 2 rows in set (0.00 sec) mysql> describe users; +------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-------------+------+-----+---------+----------------+ | id | smallint(6) | NO | PRI | NULL | auto_increment | | name_first | varchar(15) | NO | | NULL | | | name_last | varchar(15) | NO | | NULL | | +------------+-------------+------+-----+---------+----------------+ 3 rows in set (0.00 sec) mysql> describe users_cinemas; +-----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+-------------+------+-----+---------+-------+ | user_id | smallint(6) | NO | | NULL | | | cinema_id | smallint(6) | NO | | NULL | | +-----------+-------------+------+-----+---------+-------+ 2 rows in set (0.01 sec) As you can see, `users_cinemas` is a join table. I have to display a form where the Users details can be edited. This form would have a bunch of checkboxes of the Cinemas that can be assigned to the User. The checkboxes of Cinemas must be displayed in a particular order. The order is, the Cinemas which are assigned to the User being edited must appear first. How would I do this? Thanks for reading. :EDIT: I've included the SHOW CREATE TABLE output as well: mysql> show create table cinemas; +---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | cinemas | CREATE TABLE `cinemas` ( `id` smallint(6) NOT NULL auto_increment, `title` varchar(25) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `title` (`title`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | +---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.01 sec) mysql> show create table users; +-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | users | CREATE TABLE `users` ( `id` smallint(6) NOT NULL auto_increment, `name_first` varchar(15) NOT NULL, `name_last` varchar(15) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | +-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) mysql> show create table users_cinemas; +---------------+--------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +---------------+--------------------------------------------------------------------------------------------------------------------------------------------+ | users_cinemas | CREATE TABLE `users_cinemas` ( `user_id` smallint(6) NOT NULL, `cinema_id` smallint(6) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | +---------------+--------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.01 sec)
  15. wow. i'd say almost everything i feel so restricted when i get on my dad's Windows PC. Windows comes packaged a certain way and there's very little you can change in comparison to Linux. In Linux, you can take the entire OS apart if you really want to. In Windows, I can maybe customize my theme, mess with the registry a little and little things like that. luckily i'm not so fond of computer games so i don't need Windows i do a lot of audio production and so i have a MIDI controller. i can even hook that up via USB on Ubuntu and use audio software like RoseGarden and do all my production work. my dad uses Avast on his PC...i hope that's a good one because he really doesn't know what he's doing on the computer, half the time haha
  16. compared to PHP, Perl is a MUCH better designed language overall. PHP evolved from a bunch of scripts to the language it is. it was never originally designed to do what it does today. that's why the OOP support was so poor prior to version 5.x and it's still not fully OOP although most people will argue that this is not necessary in a web scripting language. Perl was designed for what it does right now, from the start. it's extremely flexible. especially for Linux/UNIX admin work. regarding threads...i doubt any scripting language itself would let the coder manipulate threads themselves...most web scripting languages are loosely typed and garbage collection is handled internally...i can't imagine someone going through the trouble of making a web scripting language that lets us explicitly manage all this...that will be interesting to see though i totally agree with this. at the end of the day, your boss is going to want to have one single entity that he can hold responsible if things go wrong.
  17. oops. thought i saw this in the PHP Coding section
  18. shouldn't this have been posted in application design? i'm in the process of writing my own framework...i know it's not good to reinvent the wheel but i'm just not happy with the way most frameworks in PHP are implemented. but yeah, i would say i prefer named routes.
  19. I believe PHP will be around and be strong for a while...AT LEAST 5 years, minimum. but i hope the PHP team doesn't take that for granted. there were some features that were requested a while ago but were never implemented until very recently only after ROR (Ruby On Rails) started making a name for itself. it's interesting that they added those features NOW because you can now create a clone of Ruby On Rails in PHP. CakePHP comes close by PHP 5.3 makes it possible to almost make an identical clone of ROR. to tell you the truth, i prefer Ruby to PHP. it's a much nicer language IMO with a full OOP implementation. one thing that really really really ticks me off about PHP is how inconsistent it is in terms of function arguments. for example, array functions generally accept arguments in the needle/haystack order while string functions accept arguments in the haystack/order and then there's the implode() function which is ambiguous in the way it accepts arguments. i know those are tiny things but it really affects me because i don't like having to stop to double check the order of arguments when i'm deeply immersed in scripting. hopefully, PHP will either fix all these things in the near future or another more consistent and equally flexible language will emerge soon. </rant>
  20. the files in /etc/logrotate.d are just the configuration files. these config files tell logrotate where the actual logs exist and how often you want them rotated and other things. by default, most linux's would store your logs in /var/logs i don't recommend you actually disabling your logs unless you're absolutely sure you'd need them. what you can do, however, is to remove the files in /etc/logrotate.d the files that you remove will not go through logrotate. also, post your crontab listings. this should post the crontab of the user you log in as: crontab -l in case you don't log in as root, this should display the root users crontab: sudo crontab -u root -l
  21. Koobi

    Installing SVN

    compression in git is pretty awesome. it uses its own compression algorithm. therefore, it's very fast. commits are local. so, if you're not connected to the net (maybe you're flying), you can commit locally and once you're connected to the net, you can push your changes to the main repo. when you clone a repo, you're cloning the entire project so every repo is a copy of the entire project which means, you have multiple backups. suppose you worked on some code for the last 6 months and i join your team today and i make a clone of the git repo on server X. i now have a record of all the commits you made from 6 months ago and so don't have to be connected to the net if i need to revert to a commit made 5 months ago, for example. merging branches are so much more easier compared to svn. svn used to drive me crazy when it came to merging but git is a lot easier. also, starting a git repository is done like this: git init and then you just add in all your files with: git add . and you make a commit: git commit -m "my first commit" that's it. i don't remember how i used to initialize an svn commit but it wasn't so simple and so i happily forgot Linus Torvalds (author of the Linux kernel) is the creator of git and he created it to manage Kernel development. apparently he was using tar balls to manage version control before using git as he wasn't too fond of SVN. although he did admit that Mercurial was pretty good. just google around and you might see if git is actually the right fit for you. it usually is. this is what i found: http://whygitisbetterthanx.com/
  22. Koobi

    Installing SVN

    i would like to also suggest git for a better source control management experience. see: http://www.gitcasts.com/ http://www.kernel.org/pub/software/scm/git/docs/user-manual.html
  23. how did you come to the conclusion that it was logrotate that was causing the problem? if it was via `top`, then paste the entire line with the parameters of the logrotate command. also, i think it's much safer to spend a few minutes figuring out what log is being rotated before you decide to do away with it. tell me what distribution you're running. if you really want to disable logrotate, you can prepend all the lines of /etc/cron.daily/logrotate with a '#' in order to comment it out. however, i still think you should figure out which log is being rotated and then come to a decision. the way to do that is, as i said, show me the output of `top` that shows logrotate running. if you figured out logrotate was the culprit some other way, then let me know how. OR post the contents of /etc/logrotate.conf
  24. i agree. what does it matter? isn't this forum meant to help people? who cares about how popular you are on an internet forum? how does it benefit your personal progress?
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.