From ka at kacomputerconsulting.com Wed Dec 1 10:55:12 2010 From: ka at kacomputerconsulting.com (Kristina Anderson) Date: Wed, 1 Dec 2010 07:55:12 -0800 Subject: [nycphp-talk] cakePHP pagination - multiple models with custom paginate() functions Message-ID: <1291218912.26232@coral.he.net> Hi there everyone, If anyone is familiar with CakePHP 1.2's usage of multiple models (defined in the $pagination array) and using the call to $paginator in the views, please contact me. I needed (or think I needed) to use multiple models because I need to return more than 1 instance of paginate() and paginateCount() and all three of these applets load each time one is posted...due to the way the page I inherited is structured. Since I implemented this, the separate resultsets from the call to the custom (inherited and debugged) paginate() function are being returned properly and display in the ajax response properly when parameters are changed (each list has three selectboxes that feed in conditions for the search results). However all the results for each applet display at once, instead of in sets of five as they did before in the single applet, and a call to $paginate-> in the view causes an error. I will be happy to post the solution for all to see for future list reference. I am very willing to pay actual American cash money for any assistance. I'm sure there is a very elegant way to fix this and would love to play around with it for a week or so but my client is going ape$%#t and needs this fixed ASAP. Thanks in advance. Kristina From nelly at cgim.com Wed Dec 1 13:04:44 2010 From: nelly at cgim.com (Nelly Yusupova) Date: Wed, 01 Dec 2010 13:04:44 -0500 Subject: [nycphp-talk] Invitation: NYC Webgrrls Holiday Networking Event - Dec 7 Message-ID: Hello Everyone, The Holidays are upon us and the NYC Webgrrls are getting together again for a HOLIDAY CELEBRATION. Last year many of you in the NY PHP group attended, it was great to see you and we all had a great time....we would like to see you there this year too! Come and celebrate with us on Tuesday, December 7 at Gaetana, a charming Italian restaurant in the heart of the West Village. We will start at 7:00 PM with an open bar for two hours, some great Italian food, door prizes and drawings from our sponsors. Please feel free to invite clients, friends & colleagues (both men and women). For more information and to RSVP, please go to: http://www.webgrrls.com/newyork-ny/ Sincerely, Nelly Yusupova Webgrrls.com nelly at cgim.com 917 603-9226 (phone) URL: http://www.webgrrls.com Blog: http://www.webgrrls.com/blog/ Twitter: http://twitter.com/DigitalWoman -------------- next part -------------- An HTML attachment was scrubbed... URL: From ps at blu-studio.com Thu Dec 2 06:01:42 2010 From: ps at blu-studio.com (Peter Sawczynec) Date: Thu, 2 Dec 2010 06:01:42 -0500 Subject: [nycphp-talk] PHP, Mobile, Pads, Readers, Other Programming Languages Message-ID: <007501cb9210$4e5c8790$eb1596b0$@com> Mobile sites/mobile content with geolocation is in great demand. I'm just making a general call for you to share any info/war story/opinion regarding any tools/IDEs/projects/classes/functions involving/not involving PHP or how you have used server-side PHP-based technology in any combination with others tools/languages to create: PHP/XHTML media player PHP browser detection (mobile[android,iphone,blackberry,symbian]/desktop/iPad/other pads/book readers) PHP and SMS Gateway (text messaging) PHP and QR Code PHP and foursquare/facebook/twitter/youtube/vimeo/flickr PHP and mobile credit card payment Or even is there a really good website(s) you like to read to stay current, e.g.: Mashable http://mashable.com/ Lifehacker http://lifehacker.com/ Slashdot http://slashdot.org/ Engadget http://www.engadget.com/ CrunchGear http://www.crunchgear.com/ I'd really like to hear some talk on mobile and what you are doing to manage it / fit it in / take it on as a developer/IT/exec. Thanks for your time. Warmest regards, Peter Sawczynec Technology Dir. bl?studio 941.893.0396 ps at blu-studio.com www.blu-studio.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsnyder at gmail.com Thu Dec 2 08:46:16 2010 From: chsnyder at gmail.com (Chris Snyder) Date: Thu, 2 Dec 2010 08:46:16 -0500 Subject: [nycphp-talk] PHP, Mobile, Pads, Readers, Other Programming Languages In-Reply-To: <007501cb9210$4e5c8790$eb1596b0$@com> References: <007501cb9210$4e5c8790$eb1596b0$@com> Message-ID: 2010/12/2 Peter Sawczynec : > I'm just making a general call for you to share any info/war story/opinion > regarding any tools/IDEs/projects/classes/functions involving/not involving > PHP or how you have used server-side PHP-based technology in any combination > with others tools/languages to create: PHP works just as well with html5 as it did with html4 and xml. Build for the mobile web first, and then if necessary drop the assets into PhoneGap for a native app. It's like progressive enhancement on steroids. The biggest pain for me in transitioning to mobile web is figuring out how to deal with a wide variety of screen sizes, and wrapping my head around width vs device width. PPK's quirksmode.org has been essential: http://www.quirksmode.org/blog/archives/2010/04/a_pixel_is_not.html Obviously there are things that you can't do with mobile web that you can do native, but the ability to write once, run everywhere and use your existing toolset can give you a big advantage over those stuck in the native SDKs. From rmarscher at beaffinitive.com Thu Dec 2 09:58:28 2010 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Thu, 2 Dec 2010 09:58:28 -0500 Subject: [nycphp-talk] PHP, Mobile, Pads, Readers, Other Programming Languages In-Reply-To: <007501cb9210$4e5c8790$eb1596b0$@com> References: <007501cb9210$4e5c8790$eb1596b0$@com> Message-ID: <98B8C8B8-9B25-4A3B-84D9-F633BC3EE61A@beaffinitive.com> On Dec 2, 2010, at 6:01 AM, Peter Sawczynec wrote: > I'm just making a general call for you to share any info/war story/opinion regarding any tools/IDEs/projects/classes/functions involving/not involving PHP or how you have used server-side PHP-based technology in any combination with others tools/languages to create: I've been using Appcelerator Titanium Mobile for cross-platform iPhone and Android native app development. It's uses javascript to abstract the native language - which is nice because you can write once for multiple platforms (doesn't support as many as PhoneGap - but as far as I can tell, produces a more native-feel app). I then create JSON apis on the server running php for anything that needs server storage/interaction. They're about to launch a 1.5 version with some major enhancements (and improved documentation/guides). I definitely recommend checking it out when that is released. > PHP browser detection (mobile[android,iphone,blackberry,symbian]/desktop/iPad/other pads/book readers) I saw the latest Zend Framework added some abstraction for PHP browser detection which sounds ideal. I have been using WURFL - but it's fairly heavy and complicated to setup. The new library in Zend Framework can still plugin into the WURFL data which is cool. -------------- next part -------------- An HTML attachment was scrubbed... URL: From randalrust at gmail.com Thu Dec 2 10:14:45 2010 From: randalrust at gmail.com (Randal Rust) Date: Thu, 2 Dec 2010 10:14:45 -0500 Subject: [nycphp-talk] Autodetecting a Portion of an Image for a Thumbnail Message-ID: I am writing an thumbnail generation script and I'm looking high and low to find out if there is a way to detect an area of an image to use as a default thumbnail. For example, if I upload a portrait of Robert E. Lee the script will automatically detect the area around his head for the thumbnail. Any thoughts? -- Randal Rust R.Squared Communications www.r2communications.com www.facebook.com/r2communications 614-370-0036 From chuck.reeves at gmail.com Thu Dec 2 10:32:41 2010 From: chuck.reeves at gmail.com (Chuck Reeves) Date: Thu, 2 Dec 2010 10:32:41 -0500 Subject: [nycphp-talk] Autodetecting a Portion of an Image for a Thumbnail In-Reply-To: References: Message-ID: I worked an a company that did a lot of image processing. Here are some things you need to be aware of going into this: - More the one person in the picture - The image can be rotated 90 or 180 degrees - Mosaic of Faces that create a master face: http://www.funny-games.biz/images/pictures/846-bush-mosaic.jpg - Some one uploads a Van Gogh: http://www.parisprovencevangogh.com/wp-content/uploads/2010/08/van_gogh_3.jpg - Facial Hair - Profiles - JPG's get a little crazy with the compression which can cause GD to freak out (depending on which version of GD you are running). Also if you use apache, some versions have memory issues with Image Magick (The memory wont be released until that thread dies which can be a long time if you have many requests trying to analyze images) Start off by reading up on the algorithms that you will need to know: http://www.face-rec.org/algorithms/ Once you know that you have the face (or a face for that manner) you can then decide how to create the thumbnail. One simple option might be to have the user select which portion of the picture will be used to for the thumb nail. Lets say I have a pic of me on the right and 4 friends on the left. Your script might pick out one of my 4 friends to the right of me which renders that thumbnail useless to me. I really want that pic to be my thumbnail so now I go in and crop the pick to include only me which forces me to leave your site. If you had the option for me to drag the thumbnail box to the portion of the pic, I would have stayed. Thank You Chuck Reeves On Thu, Dec 2, 2010 at 10:14 AM, Randal Rust wrote: > I am writing an thumbnail generation script and I'm looking high and > low to find out if there is a way to detect an area of an image to use > as a default thumbnail. For example, if I upload a portrait of Robert > E. Lee the script will automatically detect the area around his head > for the thumbnail. > > Any thoughts? > > -- > Randal Rust > R.Squared Communications > www.r2communications.com > www.facebook.com/r2communications > 614-370-0036 > _______________________________________________ > New York PHP Users Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/Show-Participation > -------------- next part -------------- An HTML attachment was scrubbed... URL: From randalrust at gmail.com Thu Dec 2 10:41:57 2010 From: randalrust at gmail.com (Randal Rust) Date: Thu, 2 Dec 2010 10:41:57 -0500 Subject: [nycphp-talk] Autodetecting a Portion of an Image for a Thumbnail In-Reply-To: References: Message-ID: On Thu, Dec 2, 2010 at 10:32 AM, Chuck Reeves wrote: > I worked an a company that did a lot of image processing. ?Here are some > things you need to be aware of going into this: All good points, Chuck, but let me back up a little. Maybe the face example wasn't a good one. I have seen at least 2 apps, one being WordPress, that automatically generate a square thumbnail for an image from an area on the image that doesn't start with coordinates at the top left of the original image. How does it do that? We have always used GD for images, so perhaps I need to look into IM. > One simple option might be to have the user select which portion of the > picture will be used to for the thumb nail. Yes, we do that. Of course, some users complain because they have to actually do the work. If I can figure out a way to automatically generate that thumb from a somewhat acceptable are of the image by default that would ease some issues. Maybe. -- Randal Rust R.Squared Communications www.r2communications.com www.facebook.com/r2communications 614-370-0036 From rmarscher at beaffinitive.com Thu Dec 2 11:22:16 2010 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Thu, 2 Dec 2010 11:22:16 -0500 Subject: [nycphp-talk] Autodetecting a Portion of an Image for a Thumbnail In-Reply-To: References: Message-ID: On Dec 2, 2010, at 10:41 AM, Randal Rust wrote: > I have seen at least 2 apps, one being > WordPress, that automatically generate a square thumbnail for an image > from an area on the image that doesn't start with coordinates at the > top left of the original image. How does it do that? I'm not sure about wordpress specifically... but there's an imagemagick example for using the "gravity" option to crop the image in different places. A "north" value tends to work well for profile/avatar images because usually the head is near the top of the image. http://www.imagemagick.org/Usage/thumbnails/ So I guess, you could automatically do it for the person, and then give them the option to change it and specify their own thumbnail if they don't like it. From randalrust at gmail.com Thu Dec 2 13:25:59 2010 From: randalrust at gmail.com (Randal Rust) Date: Thu, 2 Dec 2010 13:25:59 -0500 Subject: [nycphp-talk] Autodetecting a Portion of an Image for a Thumbnail In-Reply-To: References: Message-ID: On Thu, Dec 2, 2010 at 11:22 AM, Rob Marscher wrote: > there's an imagemagick example for using the "gravity" That looks to be exactly what I was looking for. > So I guess, you could automatically do it for the person, and then give them the option to change it and specify their own thumbnail if they don't like it. Exactly. Thanks for pointing me in the right direction. -- Randal Rust R.Squared Communications www.r2communications.com www.facebook.com/r2communications 614-370-0036 From d at ingk.com Thu Dec 2 14:13:10 2010 From: d at ingk.com (Damion Hankejh) Date: Thu, 2 Dec 2010 14:13:10 -0500 Subject: [nycphp-talk] Identifying lines/boxes in a scanned document Message-ID: Greetings -- I have a task that requires isolating sections of a scanned document (think "tax forms") surrounded (boxed) by lines. Any suggestions on a PHP/GD or IM plan of attack before I spin a new wheel? --- Damion Hankejh | ingk.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeanbaptiste.verrey at gmail.com Sat Dec 11 08:24:23 2010 From: jeanbaptiste.verrey at gmail.com (jean-baptiste verrey) Date: Sat, 11 Dec 2010 13:24:23 +0000 Subject: [nycphp-talk] Doctrine and auto_increment not being a primary key Message-ID: Hi everyone, I started using Doctrine some days ago and realized that the way I was using tables was simply not possible ... I have always use an integer as auto_increment and do a primary key composed by multiple fields such as (with MySQL) CREATE TABLE user( id INTEGER(10) not null auto_increment, firstName VARCHAR(32), lastName VARCHAR(32), KEY(id), PRIMARY KEY(firstName,lastName) ) and ... I could not replicate that with Doctrine, which would ask me to have the id as a primary key ... So I went to Doctrine IRC for a little chat, and ... some guy told me that I was completely misunderstanding how a RDBMS worked ... I am no expert in SQL but ... this is how all the tables are done in OSCommerce... So my questions are : 1- Am I really not using SQL tables as It should be? 2- Otherwise, how do you replicate that in Doctrine ? Regards, Jean-Baptiste ps: I always thought that this was the best way for the following reason : - the id is just an integer, so better performance for joins, and searching for a known user - the primary key is used to prevent duplicates and when searching -------------- next part -------------- An HTML attachment was scrubbed... URL: From dcech at phpwerx.net Sat Dec 11 09:34:04 2010 From: dcech at phpwerx.net (Dan Cech) Date: Sat, 11 Dec 2010 09:34:04 -0500 Subject: [nycphp-talk] Doctrine and auto_increment not being a primary key In-Reply-To: References: Message-ID: <4D038BDC.2020303@phpwerx.net> On 12/11/2010 8:24 AM, jean-baptiste verrey wrote: > Hi everyone, > > I started using Doctrine some days ago and realized that the way I was using > tables was simply not possible ... > > I have always use an integer as auto_increment and do a primary key composed > by multiple fields such as (with MySQL) > > CREATE TABLE user( > id INTEGER(10) not null auto_increment, > firstName VARCHAR(32), > lastName VARCHAR(32), > KEY(id), > PRIMARY KEY(firstName,lastName) > ) You need to read: http://en.wikipedia.org/wiki/Surrogate_key > and ... I could not replicate that with Doctrine, which would ask me to have > the id as a primary key ... > So I went to Doctrine IRC for a little chat, and ... some guy told me that I > was completely misunderstanding how a RDBMS worked ... And he's right, in this case you can't ever have 2 people with the same name, which is going to be a real problem for all the John Smiths out there! > I am no expert in SQL but ... this is how all the tables are done in > OSCommerce... There may be some reason dictated by the specific requirements of OSCommerce, or the designer may just not know what they're doing. > So my questions are : > 1- Am I really not using SQL tables as It should be? In the majority of cases surrogate keys of some kind make sense, the fact that you feel the need for a separate id column anyway should be a big indicator that this is the case. > 2- Otherwise, how do you replicate that in Doctrine ? > > Regards, > > Jean-Baptiste > > ps: > I always thought that this was the best way for the following reason : > - the id is just an integer, so better performance for joins, and searching > for a known user In an ideal world the join column will be the primary key, this will yield the best performance because every other index just maps the indexed column to the primary key. > - the primary key is used to prevent duplicates and when searching Improving lookups is the purpose of regular indexes, if you want to prevent duplicates then use a UNIQUE index, but as I mentioned above this is probably not a good idea in your case. Dan From jcampbell1 at gmail.com Sat Dec 11 09:49:59 2010 From: jcampbell1 at gmail.com (John Campbell) Date: Sat, 11 Dec 2010 22:49:59 +0800 Subject: [nycphp-talk] Doctrine and auto_increment not being a primary key In-Reply-To: References: Message-ID: On Sat, Dec 11, 2010 at 9:24 PM, jean-baptiste verrey wrote: > Hi everyone, > I started using Doctrine some days ago and realized that the way I was using > tables was simply not possible ... > I have always use an integer as auto_increment and do a primary key composed > by multiple fields such as (with MySQL) > CREATE TABLE user( > ?? ? id INTEGER(10) not null auto_increment, > ?? ? firstName VARCHAR(32), > ?? ? lastName VARCHAR(32), > ?? ? KEY(id), > ?? ? PRIMARY KEY(firstName,lastName) > ) > and ... I could not replicate that with Doctrine, which would ask me to have > the id as a primary key ... > So I went to Doctrine IRC for a little chat, and ... some guy told me that I > was completely misunderstanding how a RDBMS worked ... > I am no expert in SQL but ... this is how all the tables are done in > OSCommerce... > So my questions are : > 1- Am I really not using SQL tables as It should be? I'll be short, yes, the guy on IRC was giving good advice. I read the schema and it says to me: "All possible users can be uniquely identified by their first and last name. There is no chance there will ever be two different people with the same name. There is no chance someone might change their name. Oh, but we will assign everyone a unique number and keep it sorted in an index, but that is just for fun... we aren't going to use that number to identify people." I can't conceive of a situation where this makes sense. Regards, John Campbell From jeanbaptiste.verrey at gmail.com Sat Dec 11 10:20:14 2010 From: jeanbaptiste.verrey at gmail.com (jean-baptiste verrey) Date: Sat, 11 Dec 2010 15:20:14 +0000 Subject: [nycphp-talk] Doctrine and auto_increment not being a primary key In-Reply-To: References: Message-ID: ok to make it quick: it means that I simply should have id as a primary key and use unique for the fields that makes the row unique!? CREATE TABLE user( id INTEGER(10) NOT NULL AUTO_INCREMENT, firstName VARCHAR(32), lastName VARCHAR(32) PRIMARY KEY(id), UNIQUE(firstName,lastName) ) (or something like that) For the issue of the 2 people having the same names it just means that I need more information such as address or email OR I should have a different primary key (or no primary key at all) ???? Otherwise Is this way of creating table can be used for pretty much every table ? (except like association table) ? Anyway thanks for the answers, at least It can be done with Doctrine! -------------- next part -------------- An HTML attachment was scrubbed... URL: From jcampbell1 at gmail.com Sat Dec 11 11:20:16 2010 From: jcampbell1 at gmail.com (John Campbell) Date: Sun, 12 Dec 2010 00:20:16 +0800 Subject: [nycphp-talk] Doctrine and auto_increment not being a primary key In-Reply-To: References: Message-ID: On Sat, Dec 11, 2010 at 11:20 PM, jean-baptiste verrey wrote: > ok to make it quick: > ?it means that I simply should have id as a primary key and use unique for > the fields that makes the row unique!? Yes and no. Use id as the primary key. Use UNIQUE sparingly. Use regular keys when you want to speedup the lookup of that field. > CREATE TABLE user( > ?? ? ? ? ?id?INTEGER(10)?NOT NULL AUTO_INCREMENT, > ?? ? ? ? ?firstName VARCHAR(32), > ?? ? ? ? ?lastName VARCHAR(32) > ?? ? ? ? ?PRIMARY KEY(id), > ?? ? ? ? ?UNIQUE(firstName,lastName) > ) > (or something like that) This is better, but still wrong. This says: "I'll assign every user a unique id, and I'll reference them by that. (good) I'll make looking up by first name really fast, but deny the possibility that two people have the same first and last name. (wrong)" Use PRIMARY KEY for fast lookup, and the absolute reference to the record. Use KEY, to speed up lookup on that field, use UNIQUE to speed up lookup and also to prevent duplication. below is a sample: CREATE TABLE IF NOT EXISTS `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `fname` varchar(24) NOT NULL DEFAULT '', `lname` varchar(24) NOT NULL DEFAULT '', `username` varchar(36) NOT NULL DEFAULT '', `pass` varchar(50) NOT NULL DEFAULT '', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`), UNIQUE KEY `email` (`email`), KEY `lname` (`lname`) ) ; This says: "Assign each user an id, and use that to reference each user. Make lookups on last name, email, and username, very fast. Don't allow duplicate usernames or emails." Regards, John Campbell From leam at reuel.net Sat Dec 11 13:53:59 2010 From: leam at reuel.net (Leam Hall) Date: Sat, 11 Dec 2010 13:53:59 -0500 Subject: [nycphp-talk] Doctrine and auto_increment not being a primary key In-Reply-To: References: Message-ID: <4D03C8C7.9090004@reuel.net> Just a note that I'm learning a timely bit from this conversation, thanks! Leam From jbaltz at altzman.com Sun Dec 12 02:12:34 2010 From: jbaltz at altzman.com (Jerry B. Altzman) Date: Sun, 12 Dec 2010 02:12:34 -0500 Subject: [nycphp-talk] SPROCs in the MySQL/PostgreSQL + PHP crowd In-Reply-To: <4CDB012A.8030100@altzman.com> References: <4CDB012A.8030100@altzman.com> Message-ID: <4D0475E2.8040007@altzman.com> Yes, I'm replying to my own message. on 11/10/2010 3:31 PM Jerry B. Altzman said the following: > How many of you are using stored procedures (SPROCs) with any great > regularity? I just encountered my first real one. It's on a MySQL on a Windows platform--someone from the MSSQL world, no doubt. Just got bitten hard by it, migrating from 5.0 to 5.1 has slightly different schemata in the mysql.mysql database, which made me need to be very careful about importing dumpfiles. Nothing like a late-night website migration to uncover these things! I know it's not PHP-related, but was just sharing is all. //jbaltz -- jerry b. altzman | jbaltz at altzman.com | www.jbaltz.com | twitter:@lorvax thank you for contributing to the heat death of the universe. From zippy1981 at gmail.com Sun Dec 12 07:52:40 2010 From: zippy1981 at gmail.com (Justin Dearing) Date: Sun, 12 Dec 2010 07:52:40 -0500 Subject: [nycphp-talk] SPROCs in the MySQL/PostgreSQL + PHP crowd In-Reply-To: <4D0475E2.8040007@altzman.com> References: <4CDB012A.8030100@altzman.com> <4D0475E2.8040007@altzman.com> Message-ID: On Sun, Dec 12, 2010 at 2:12 AM, Jerry B. Altzman wrote: > I just encountered my first real one. > It's on a MySQL on a Windows platform--someone from the MSSQL world, no > doubt. > Just got bitten hard by it, migrating from 5.0 to 5.1 has slightly > different schemata in the mysql.mysql database, which made me need to be > very careful about importing dumpfiles. > > Just out of curiosity, what if you copied over the binary database files (via LVM snapshot if your runnin LVM to prevent downtime) to a 5.1 machine? Will 5.1 import 5.0 binary files? BTW, someone who uses a stored procedure in MySQL could be coming from the Oracle, Sybase, Microsft, or Postgres world. Either that, or they are new to RDBMSes and do not have prejudices against using certain features in MySQL since they weren't using it since 4.0 when you could not do these things. Justin -------------- next part -------------- An HTML attachment was scrubbed... URL: From willie at pdfsystems.com Mon Dec 13 11:07:41 2010 From: willie at pdfsystems.com (William Klein) Date: Mon, 13 Dec 2010 11:07:41 -0500 Subject: [nycphp-talk] Doctrine and auto_increment not being a primary key In-Reply-To: References: Message-ID: <00aa01cb9adf$f0bf1430$d23d3c90$@com> I would us the auto increment field as the primary. Then index the name fields. The primary would then be used to associate records in other tables to the name table. -----Original Message----- From: John Campbell [mailto:jcampbell1 at gmail.com] Sent: Saturday, December 11, 2010 11:20 AM To: NYPHP Talk Subject: Re: [nycphp-talk] Doctrine and auto_increment not being a primary key On Sat, Dec 11, 2010 at 11:20 PM, jean-baptiste verrey wrote: > ok to make it quick: > ?it means that I simply should have id as a primary key and use unique for > the fields that makes the row unique!? Yes and no. Use id as the primary key. Use UNIQUE sparingly. Use regular keys when you want to speedup the lookup of that field. > CREATE TABLE user( > ?? ? ? ? ?id?INTEGER(10)?NOT NULL AUTO_INCREMENT, > ?? ? ? ? ?firstName VARCHAR(32), > ?? ? ? ? ?lastName VARCHAR(32) > ?? ? ? ? ?PRIMARY KEY(id), > ?? ? ? ? ?UNIQUE(firstName,lastName) > ) > (or something like that) This is better, but still wrong. This says: "I'll assign every user a unique id, and I'll reference them by that. (good) I'll make looking up by first name really fast, but deny the possibility that two people have the same first and last name. (wrong)" Use PRIMARY KEY for fast lookup, and the absolute reference to the record. Use KEY, to speed up lookup on that field, use UNIQUE to speed up lookup and also to prevent duplication. below is a sample: CREATE TABLE IF NOT EXISTS `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `fname` varchar(24) NOT NULL DEFAULT '', `lname` varchar(24) NOT NULL DEFAULT '', `username` varchar(36) NOT NULL DEFAULT '', `pass` varchar(50) NOT NULL DEFAULT '', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`), UNIQUE KEY `email` (`email`), KEY `lname` (`lname`) ) ; This says: "Assign each user an id, and use that to reference each user. Make lookups on last name, email, and username, very fast. Don't allow duplicate usernames or emails." Regards, John Campbell _______________________________________________ New York PHP Users Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/Show-Participation From jbaltz at altzman.com Mon Dec 13 11:26:06 2010 From: jbaltz at altzman.com (Jerry B. Altzman) Date: Mon, 13 Dec 2010 11:26:06 -0500 Subject: [nycphp-talk] SPROCs in the MySQL/PostgreSQL + PHP crowd In-Reply-To: References: <4CDB012A.8030100@altzman.com> <4D0475E2.8040007@altzman.com> Message-ID: <4D06491E.2030202@altzman.com> I know this isn't a MySQL list, but ... on 12/12/2010 7:52 AM Justin Dearing said the following: > On Sun, Dec 12, 2010 at 2:12 AM, Jerry B. Altzman > wrote: > I just encountered my first real one. > It's on a MySQL on a Windows platform--someone from the MSSQL world, > no doubt. > Just got bitten hard by it, migrating from 5.0 to 5.1 has slightly > different schemata in the mysql.mysql database, which made me need > to be very careful about importing dumpfiles. > Just out of curiosity, what if you copied over the binary database files > (via LVM snapshot if your runnin LVM to prevent downtime) to a 5.1 > machine? Will 5.1 import 5.0 binary files? I actually tried that...but a) this was a Windows platform (so LVM doesn't exist) and b) the structure of the tables in the main MySQL changed from 5.0 -> 5.1 (extra columns in mysql.proc, mysql.db, etc) so a physical restoral (I tried just copying the innodb and myisam table files over) failed. If there were NO sprocs, this would have been easy...but someone started using them so I got stuck with a logical dump/restore (and hand-editing the dump file to NOT try to recreate any tables in the MySQL mysql database). There's a bit of confusion. MySQL runs a special database called 'mysql' that contains all manner of administrative information, and it's where things like stored procedure definitions live. > BTW, someone who uses a stored procedure in MySQL could be coming from > the Oracle, Sybase, Microsft, or Postgres world. Either that, or they > are new to RDBMSes and do not have prejudices against using certain > features in MySQL since they weren't using it since 4.0 when you could > not do these things. I mentioned that this was a windows machine, running ASP code. My best guess is MSSQL. :-) Every large RDBMS (Oracle, DB2, Sybase, MSSQL) uses them a lot more. > Justin //jbaltz -- jerry b. altzman | jbaltz at altzman.com | www.jbaltz.com | twitter:@lorvax thank you for contributing to the heat death of the universe. From garyamort at gmail.com Tue Dec 14 11:26:52 2010 From: garyamort at gmail.com (Gary Mort) Date: Tue, 14 Dec 2010 11:26:52 -0500 Subject: [nycphp-talk] PHP group mail list software Message-ID: I was curious if anyone knows of a PHP group mailling list project offering similar functions to mailman? Not to diss mailman, it is a great, very mature email list management solution. But it's in python, and I'd rather run a PHP app which I can hack easily and learn from coding, than a python product which I can hack easily, but won't actually improve my mastery appreciably. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan.horning at planetnoc.com Fri Dec 17 00:04:28 2010 From: dan.horning at planetnoc.com (Dan Horning) Date: Fri, 17 Dec 2010 00:04:28 -0500 (EST) Subject: [nycphp-talk] PHP group mail list software In-Reply-To: Message-ID: <1523991077.335.1292562268720.JavaMail.root@gwilwileth.planetnoc.net> if you find one - let me know - phplist has always made me cringe -- Dan Horning American Digital Services - Where you are only limited by imagination. dan.horning at planetnoc.com :: http://www.americandigitalservices.com 1-518-444-0213 x502 . toll free 1-800-863-3854 . fax 1-888-474-6133 PO Box 746, Troy, NY 12181 ----- Original Message ----- > From: "Gary Mort" > To: "NYPHP Talk" > Sent: Tuesday, December 14, 2010 11:26:52 AM > Subject: [nycphp-talk] PHP group mail list software > I was curious if anyone knows of a PHP group mailling list project > offering similar functions to mailman? Not to diss mailman, it is a > great, very mature email list management solution. But it's in python, > and I'd rather run a PHP app which I can hack easily and learn from > coding, than a python product which I can hack easily, but won't > actually improve my mastery appreciably. > _______________________________________________ > New York PHP Users Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/Show-Participation From garyamort at gmail.com Fri Dec 17 10:21:43 2010 From: garyamort at gmail.com (Gary Mort) Date: Fri, 17 Dec 2010 10:21:43 -0500 Subject: [nycphp-talk] PHP group mail list software In-Reply-To: <1523991077.335.1292562268720.JavaMail.root@gwilwileth.planetnoc.net> References: <1523991077.335.1292562268720.JavaMail.root@gwilwileth.planetnoc.net> Message-ID: On Fri, Dec 17, 2010 at 12:04 AM, Dan Horning wrote: > if you find one - let me know - phplist has always made me cringe > I'm more looking for the group list function....ie what this mailing list uses. Mailman's web interface[resetting your password, archives, etc] just makes me cringe. I especially hate that almost every install I've seen makes you assign a password for every mail list you are on to access your account online. Why should I have to set a password for NYPHP-talk AND set a password for NYPHP-jobs ? If it is the same email address, just let me use one password for both. Add to that simple things like RSS feeds are made much more difficult with Mailman. I want to setup a couple email lists of my own....and given a choice between learning enough python to modify Mailman, or writing my own listserv software in PHP I will go with PHP. I'd just rather start with something else and build on it than create my own. As for PHPlist..... well, since I am between jobs and my last job was in managing email deliverability/campaigns using Email Service Providers....I am currently working on writing my own one way list system utilizing EC2 to scalibility and PHP/Swiftmail as the mail processor[yes, I am aware of the general logic that says it is better to do email delivering with a mail server compiled in C for performance....I feel that general logic is based on an archaic view of servers where "throwing more hardware" at a problem was an expensive proposition. With Amazon's cloud services, you can throw a virtual PC with 64G of memory and 8 virtual cores at the initial mail campaign send of a couple of million emails for an hour for just 2 bucks, then leave the email that can't be delivered immediately on a low priority queue and process it with a micro instance to handle bounce back and problem delivery for 2 cents an hour...] Once I have it up and running I can bounce you some links if you want to test it out[most likely I will be pay images of everything pre-installed up on Amazon for a few cents more an hour than they charge, while keeping all the sourcecode in github so your free to roll your own if you wish.] The plus of using Amazon web services is that if you grow to the point of being worth having your own fulltime system admin team, you can migrate to Eucalyptus and run it all in house. -Gary -------------- next part -------------- An HTML attachment was scrubbed... URL: From lhall at smartronix.com Sat Dec 18 13:04:54 2010 From: lhall at smartronix.com (Hall, Leam) Date: Sat, 18 Dec 2010 13:04:54 -0500 Subject: [nycphp-talk] SNMP for Cisco Swithes? In-Reply-To: References: <1523991077.335.1292562268720.JavaMail.root@gwilwileth.planetnoc.net>, Message-ID: <8094409F-A4EE-4466-BD4A-C77F08092B5C@mimectl> Anyone seen a tutorial on how to use PHP to monitor Cisco switches via SNMP? I'm just jumping into this and constrained by PHP 4 (RHEL 4) at the moment. Thanks! Leam -------------- next part -------------- An HTML attachment was scrubbed... URL: From zippy1981 at gmail.com Sat Dec 18 22:57:42 2010 From: zippy1981 at gmail.com (Justin Dearing) Date: Sat, 18 Dec 2010 22:57:42 -0500 Subject: [nycphp-talk] SNMP for Cisco Swithes? In-Reply-To: <8094409F-A4EE-4466-BD4A-C77F08092B5C@mimectl> References: <1523991077.335.1292562268720.JavaMail.root@gwilwileth.planetnoc.net> <8094409F-A4EE-4466-BD4A-C77F08092B5C@mimectl> Message-ID: Learn, My suggestion is to just install cacti.http://www.cacti.net/index.php Also if you want php 5.3 on RHEL, and dont want to build it yourself someone made them. http://www.webtatic.com/blog/2009/06/php-530-on-centos-5/. I use that on production. Justin On Sat, Dec 18, 2010 at 1:04 PM, Hall, Leam wrote: > Anyone seen a tutorial on how to use PHP to monitor Cisco switches via > SNMP? I'm just jumping into this and constrained by PHP 4 (RHEL 4) at the > moment. > > Thanks! > > Leam > > _______________________________________________ > New York PHP Users Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/Show-Participation > -------------- next part -------------- An HTML attachment was scrubbed... URL: From leam at reuel.net Sun Dec 19 07:34:26 2010 From: leam at reuel.net (Leam Hall) Date: Sun, 19 Dec 2010 07:34:26 -0500 Subject: [nycphp-talk] SNMP for Cisco Swithes? In-Reply-To: References: <1523991077.335.1292562268720.JavaMail.root@gwilwileth.planetnoc.net> <8094409F-A4EE-4466-BD4A-C77F08092B5C@mimectl> Message-ID: <4D0DFBD2.7010600@reuel.net> Justin, Rolling my own has two major reasons. First is learning, second is approval. I can write a web page at work, no problem. Installing an application takes months of approval. :) Leam On 12/18/2010 10:57 PM, Justin Dearing wrote: > Learn, > > My suggestion is to just install cacti.http://www.cacti.net/index.php > > Also if you want php 5.3 on RHEL, and dont want to build it yourself someone > made them. http://www.webtatic.com/blog/2009/06/php-530-on-centos-5/. I use > that on production. > > Justin > > On Sat, Dec 18, 2010 at 1:04 PM, Hall, Leam wrote: > >> Anyone seen a tutorial on how to use PHP to monitor Cisco switches via >> SNMP? I'm just jumping into this and constrained by PHP 4 (RHEL 4) at the >> moment. >> >> Thanks! >> >> Leam >> >> _______________________________________________ >> New York PHP Users Group Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> http://www.nyphp.org/Show-Participation >> > > > > _______________________________________________ > New York PHP Users Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/Show-Participation