Jump to content

alexweber15

Members
  • Posts

    238
  • Joined

  • Last visited

Posts posted by alexweber15

  1. i started with Dreamweaver and the only thing i hate about it is the ancient api as far as autocompleting, function arg hinting and function coloring.  yes, it can be customized, but it takes up too much time and i haven't gotten around to trying to do something about it yet :)

     

    recently I've been playing around with nusphere phped and it definitely has some more professional and powerful tools (like integrated validator, csv, debugging options, not to mention the up-to-date api) and I love having multiple projects per workspace so I can easily switch between the htdocs/public/www (whatever you wanna call it) folder and the "out of public reach" folder.

     

    BUT, i just find dreamweaver a lot easier and more comfortable to use for the HTML + CSS stuff (nusphere's approach, despite the feature list pimping all of its HTML capabilities, still hasn't clicked with me)

     

    and i've tried PHPEditor in the past but stopped when I installed Dreamweaver :)

  2. nice, interesting results, keep 'em coming! :)

     

    i use camelCase cause i started with Java (well VB 3.0) to be honest but consider Java the first "real" programming language I learned (no offense to all BASIC fans out there)

     

    and as far as the var goes i used to alternate between camelCase and this_case but for some reason I got into the habit of avoiding capitalization in DB-related stuff so all my Data objects started having the same variable naming style as my database columns and one thing just led to another :)

     

    but yeah corbin why the camelCase hate?  I mean things starting with "camel" are usually kinda sweet; like "camel cigarettes" or "camel toe"  ;D

     

    oh and this is a shocker to me:

    Some_class;

    ??? i guess i'm just pedantic (except with capitalization when im posting this late at night) but my classes are 100% strict ProperCase :)

    (which hasn't caused any problems yet despite someone mentioning it (and i do my local dev with apache + windows and my remote hosting is more often than note apache + nix) so i guess thanks to the php team for default strtolower() in __autoload()

     

    which, this just crossed my mind, is unheard of according to your guys' poll votes ;)

     

    strToLower() is so much more legible.... *sigh*  :D

  3. Yeah, I was thinking about it, and you might want to pass in the config like that.  And the factory method seems fine.

     

    Hey DarkWater, time to gain more OOP knowledge from you!  ;D

     

    I'm just trying to understand the nuances of this code :)  (no comments on Corbin's, sorry!)

     

    - the DB Layer Factory as a singleton is a good idea?

    - the actual DB Layer shouldn't be a singleton (wouldn't this present problems having multiple DB Layers each using different adapters) ?

    - Storing the Config in a seperate location and passing the info as a parameter to the constructor is good?

     

    (i'm loosely using the terms good/bad here, just trying to learn a thing or two!)

  4. fantomel, your code has changed so much from PMs to the thread that I'm lost!

     

    Did you fix your problem?

     

    And if not please post the entire class and test code that generates the error and of course the error itself!

     

    I realize that there might be some hesitance in posting an entire class code here or anywhere for that matter (unless releasing under an open-source license) so if you must omit parts of your code try to omit the ones that aren't relevant to the problem at hand please!

     

    Anyway, waiting on a reply!

     

    Alex

  5. I suggest you check out this article. I'm not sure how accurate the article is but I ran some of the tests it mentioned on your expression.

     

    $tests = array(
    				array("{^c\@**Dog^}@cartoon.com", 1), #Should pass
    				array("example@something.com", 1), #Should pass
    				array("dclo@us.ibm.com", 1), #Should pass
    				array("_somename@example.com", 1), #Should pass
    				array("abc\\@example.com", 0), #Should fail
    				array("customer/department=shipping@example.com", 1), #Should pass
    				array("Joe.\\\\Blow@example.com", 1), #Should pass
    				array("abc@def@example.com", 0), #Should fail
    				array("!def!xyz%abc@example.com", 1), #Should pass
    				array("dot.@example.com", 0), #Should fail
    				);
    
    foreach($tests as $t){
    if(preg_match("#^[a-z0-9]+[a-z0-9\?\.\+-_]*"."@[a-z0-9_-]+(\.[a-z0-9_-]+)*\.[a-z]+$#", $t[0])){
    	echo "{$t[0]} <b>passed</b>, it should've <b>". ($t[1] == 1 ? "passed" : "failed") . "</b>.<br />";
    }else{
    	echo "{$t[0]} <b>failed</b>, it should've <b>". ($t[1] == 1 ? "passed" : "failed") . "</b>.<br />";
    }
    }
    

     

    Output:

    {^c\@**Dog^}@cartoon.com failed, it should've passed.
    example@something.com passed, it should've passed.
    dclo@us.ibm.com passed, it should've passed.
    _somename@example.com failed, it should've passed.
    abc\@example.com passed, it should've failed.
    customer/department=shipping@example.com passed, it should've passed.
    Joe.\\Blow@example.com failed, it should've passed.
    abc@def@example.com passed, it should've failed.
    !def!xyz%abc@example.com failed, it should've passed.
    dot.@example.com passed, it should've failed.
    

     

     

    thanks for the code and thanks Acs for the link :)

     

    gonna run some tests and revisit my standard function :)

  6. Wish we could create multiple polls per post then I wouldn't have to create so many options!  :P

     

    Anyway, here's to find out what conventions our fellow PHP coders use.

     

    (I realize that a lot of us are forced into conventions depending on a particular framework but just answer what you would usually use)

     

    My answers:

    camelCase for functions

    lowercase + underscore for variables

     

    I guess because i got into the habit of naming all database stuff lowercase + underscores I decided to do the same with variables to make persistence easier :)

     

    PS - Let me know if i'm missing any other options!

  7. Doesn't php have a filter email validator function?

     

    in fact it does! (kind of)

    sanitize email filter

    but it doesn't actually validate whether the email is well-formed, just cleans it ("sanitizes").

     

    and effigy i'm gonna have to get back to you on the example of it failing without the concatenation but i remember it happened once a long time ago and i never tried to remove it again!

  8. lol good point :)

     

    im all for case-sensitivity as it makes you write more legible and less error-prone code (somehow)

     

    but this was a particular situation where i was trying to write a friendly api for a class by including multiple aliases for each function, etc

     

    come to think of it, screw it!  i'm gonna remove all aliases and people should just RTFM if they wanna use my class  :P;D

  9. thanks for the link. It says I need a GD library though. How can I find out if I have it on my server, and if it's not there, how can I put it there?

     

    if im not mistaken its usually installed by default

     

    just run the following phpscript on your server:

     

    <?php phpinfo(); ?>
    

     

    and search for "gd" :)

     

    you should find something like this:

     

    GD Support: enabled

  10. attached is a small script that tests SQL statements... its definitely not pretty and not optimized but its gets the job done which is: send a query and see the results.  I've found it useful to debug sql-related errors by echoing my $sql variable and then copy and pasting it into the script to see what happens... easier than var_dumping everything :)

     

    im kind of tied up at work but if the OP is still having problems i'll be happy to check back and help later!

     

    -Alex

     

    [attachment deleted by admin]

  11. why not?  seems silly to me that's why... i'd rather define an uppercase and lowercase version of the same constant =P

     

    const FOO = 'bar';
    const foo = self::FOO;
    

     

    lol  ;D

     

    just kidding!

     

    really i'd rather just stick with all-uppercase convention instead, i just think it doesn't add up because I mean if you can declare case-insensitive constants outside a class then why the hell can't you do the same inside the class?  seems like poor implementation to me...  ::)

  12. nice addition to the forums btw! :)

     

    just browsing through the "common expressions" and here's my uber email checking regex:

     

    mine:

    "^[a-z0-9]+[a-z0-9\?\.\+-_]*"."@[a-z0-9_-]+(\.[a-z0-9_-]+)*\.[a-z]+$"

     

    yours:

    "[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}"

     

    comparing them briefly side-by-side mine is more flexible in that it allows for dot dot domains (.com.br for brazil for example) and also enforces starting and ending rules

     

    i've used it for ages (adapted from an example someone showed me) and one thing i don't understand is the concatenation in the middle (but it doesnt work without it)

     

    also off the top of my head im not sure whether or not question marks (allowed in mine) and ampersands (not allowed in mine) are allowed or whether email addresses are allowed to start with underscores for example (too lazy to read up on this at the moment)

     

    I don't mean to be a dick or anything just throwing my idea out there to maybe help the community! :)

     

    Alex

  13. hey sorry don't mean to discourage you but there's already a "mysql" class (and a "mysqli" class and a "PDO" class for that matter!)

     

    definitely a good learning exercise to write a DB-interaction class but i'd read up on what's already available (maybe you just need to extend one of the existing classes?) and name it something different :)

  14. weird issue i ran into today...

     

    - its possible to define case-insensitive constants outside the scope of a class using:

    define('name', 'value', false);

    however, you cannot use define() for Class Constants.

     

    - to define a Class Constant you have to use (inside class scope):

    const 'name' = 'value';

     

    So what happened to case-sensitivity here?

    how can i define a case-insensitive Class Constant????

     

    thanks!

     

    Alex

  15. Oh sorry if I didn't explain clearly. I already know about the jquery sortables feature. I'm just trying to get that search feature found in the table plugin to work with the sortable lists.

     

    Also, I have multiple lists that I allow the user to drag into and I want to be able to serialize each list seperately. But when a list item from somewhere else is dragged into one the lists to be serialized how do I have it serialized in the new list it was dragged to?

     

    oh i see... well actually i don't im kinda confused now.  regardless of sorting and adding into multiple lists you can always get each lists' items from the lists id and you can just serialize the list but iterating over its items and binding that to any list modification...

×
×
  • 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.