Jump to content
Larry Ullman's Book Forums

Edward

Members
  • Posts

    1115
  • Joined

  • Last visited

  • Days Won

    27

Everything posted by Edward

  1. I was just working on an ajax request to check if the username was available. We also must take into account the criteria that is actually required for this username in the first place. So before even executing an ajax request the value of the text input should be run through a regular expression. As you wouldn't want to check if a username was available for one character if the minimum number of characters for a username was 4 - 6 or it contained characters which were not appropriate. Just something to think about! Or may be i am starting to get too big for my boots!
  2. I found this useful resource, seems this will be an easy task as are most things with Yii. http://www.yiiframework.com/wiki/165/understanding-autoloading-helper-classes-and-helper-functions/ Continued good luck on completing the book too, hehehe!
  3. Thanks, the class part is very important for my website, that chapter will be very useful. I am coming to the end of my item listings page, it took me some time to fully understand the SWF flash image uploader and completely rewrite the javascript handlers. I guess its the first time for me doing this kind of work so from now on things will be faster. Hey i guess it will be faster for you also when you extend your Yii Book to cover Yii 2 also. I am glad i have used the Yii framework as its taken a hell of a long time just to complete some of the development parts, its just one bug after another and then all the Edward Carnby detective work has to come into play. If i take a look back at your PHP books they were basically the first stepping stones for many to come but they are definitely the right place to begin.
  4. Hi Larry! Could you please add into your Yii book at some point information on how to add your own helper classes into Yii in the correct manner. I am sure i am not the only one with small repeated code snipets that we could extract into helper class functions. Also, whats up with the last chapters, its almost two months since an update?
  5. Edward

    My Project Diary

    Thanks but usually those CSS problems are difficult, they involve many scripts and you would need to be here with me. Basically I've got jQuery and JavaScript doing a lot of the work, so it can be hard to figure out.
  6. It's covered briefly on page 343, it was also in the index page 602.
  7. Edward

    My Project Diary

    Thursday, 23th May 2013 I've decided i am going to end my project diary here because i am lacking the time to write all the updates. The project i am working on is taking a considerable amount of time due to unexpected bugs which have to be accounted for as well as trying to get complicated CSS tricks/features working 100%. But seriously if i was to start writing an update now it would probably take a couple of hours to finish talking about the recent material i covered. I hope you enjoyed reading my project diary, thanks Edward!
  8. Edward

    My Project Diary

    Friday, 10th May 2013 I encountered a small bug the other day while using mac to resize the text in the browser. I have a Flash SWFUpload button which when you click it opens the file folder for upload. Now the problem is with a flash object you can only use a few styles of CSS which they provide, so you can't get that "yiibooster bootstrap effect". So what i done intialy was use a div and styled it with boostrap classes then i made manually set the flash object to the same size of it. I used the flash text and set the color to white. But the problem was when you enlarged the size of the browser text with mac using "command +" the div would get bigger but the text would get smaller. I just spent 2 hours trying to figure out how to fix this problem i tried some stuff with CSS and looked online, i also found another website with the swfupload button and this time when you enlarged the browser text the button and its text got smaller. I also found this article online, i came up with the idea that maybe i could attach a js onclick event to a div and that event would trigger the flash event. i.e ExternalInterface.call("function(){$('#button').trigger('click');}"); http://stackoverflow.com/questions/3788122/jquery-trigger-embedded-object-click-by-clicking-a-div I thought this whole situation was starting to get ridiculous as i have swf files i don't even have .fla, i did find some flash .swf decompilers to .fla. Anyway it happened again, i went away from the computer and came back again, probably 25mins and solved the problem. I have decided to post my solution since this was quite I would say a nasty one. Solution: In my view file i added this basic html, the span with the id swfupload must be put inside the span class as this will be replaced by the flash object. (Its probably hard for some of you to understand what i am going on about but if you are using the swfupload widget for yii you will know what i am talking about.) <span class="swfupload-button btn btn-large"><span id="swfupload"></span>Upload Images</span> Now in your swfupload.css file you need to add /* -- SWFUpload Object Styles ------------------------------- */ .swfupload { position:absolute; left:0; top:0; width:100%; height:100% } and in your regular main.css file you will need to add a class for the class in the wrapper span class we have above called swfupload-button. .swfupload-button { position: relative; } This solution fixes the problem and now you have a swfupload button which scales proportionally when the screen is enlarged. Thanks and goodnight!
  9. Edward

    My Project Diary

    Wednesday, 8th May 2013 Night: Okay its night now and ive managed to get the category breadcrumbs link redrawing after the form is submitted and fails validation. I used the same ajax function i made earlier, so i made a mistake in saying i would do this server side, i actually just done it in the javascript on loading up the item data for the page. Ive just used for the first time now a Jquery function called scrollLeft(), here is a link to the resouce from the JQuery website: http://api.jquery.com/scrollLeft/ The problem i had is when i add many subcategory division blocks eventually a horizontal scroll bar will appear in the wrapper division block and the newly showing subcategory list will not appear. So i had to shift the scroll bar to the right a little each time on adding the new category div. I have actually used JQuery .animate() also to give this a more smooth animation. $('#category-wrapper-div').animate( {scrollLeft: 200}, 'slow'); Well all this work now seems to be taking its toll, today i am feeling mentally tired and had to push myself to get this part complete. I think tomorrow i will take a day off and will get back to work again this Friday. Edward Working into the night: After taking a rest and eating a spinach and cheese dish i decided to have another go at finishing things off and now i have. So i have finally finished the ajax dynamic category selector, i also added in a feature which requires the Jquery user interface library just to spice things up a little, well its working great its really awesome. Okay im definitely taking the day off tomorrow and will work on fishing the multiple image loader next.
  10. Edward

    My Project Diary

    Wednesday, 8th May 2013 Morning: Ive managed to complete the category breadcrumbs from the selected category, it to me roughly an hour. There was some tricky logical code and i had to use integer type casts and i had to make the use of adding comment debugging intensively to figure out the source of the problems. So now i can create nice category breadcrumbs like these. Books > Catalogs > Owner's Manuals I added the ajax function to my Category model, this function will also have to be used by the server script aswell as this link will need to be generated if the item listing page fails validation tests and needs to be redrawn.
  11. Edward

    My Project Diary

    Tuesday, 7th May 2013 I managed to complete the hidden field on the item listing form to store the category id and complete the jquery work that was required to fetch the category value from the last div ul li a which is selected. Last night i wrote some complex jquery code but today i saw a simpler way of doing it and just redone the code and now its just a few lines for the same thing. Like Larry said in his books if your stuck with something just step away from the computer and come back. It seems this is very regular for me getting stuck and spending quite a lot of time with a burned out brain. Then going away from the computer coming back and fixing the problem in a few minutes, then i wonder to myself why i wasted so much time when the solution was easy. Ive actually just been working on a category breadcrumbs link which has to come back via a server ajax request and guess what yes i am in the situation again of being stuck. I thought this problem was relatively easy, first i thought my ajax was wrong but its not, now ive done detective work back to the php server code and found it seems to be running okay and the source of the issue seems to be lying within a while loop. Well i am burned out now and will continue to work on the category breadcrumbs tomorrow, i am real close to finishing this now. Darn this item listing page is a lot of work, ive worked on it almost two months now (and there is a item update page arrrrgggghhhh), just one page but i guess its the first time i have written such code. By the way if you were reading my project diary and were confused with yesterday's post of the html data- attribute here is a resource which you can read: http://html5doctor.com/html5-custom-data-attributes/ Okay i am off for now, ill get more done tomorrow, happy coding everyone!
  12. Edward

    My Project Diary

    Monday, 6th May 2013 As of today i have finished of the ajax work and css involved in the dynamic category selector i have been working on. I found getting the CSS to work much harder than the coding. I thought ajax was difficult but it turns out it was just as easy as making a normal function. I wasn't able to use the Yii ajax functions for my project as the coding was slightly lower level so i used JQuery $.get function to fetch basic HTML code for the category's. I also used the data- html attribute which is availabe in html 5, however you can still use JQuery to find the attribute value of a give attribute with attr. So for my data attribute values i used for example for category number one data-category = "1". I did some further reading in to data- attribute and it still works on older browsers. Another thing that i just had to solve when i added an event handler onclick to the bootstrap modal window close button it would no longer close. I checked the js for the modal window and found it has a hide function in its object. So to hide the modal window after the category is selcted you need to add this code $('#your-modal-whatever-it-is').modal('hide'); Another issue i would like to mention is when using $.get() JQuery function, if this was nested inside an onclick event handler then when you add the function you cannot use $(this), you have to reference the element again. So it appears the $.get() and the function it was within are not directly related. Oh and i forgot to mention i used ajax loader gif for the time i had to wait for subcategories to load up. I used this resource to make the gif image. http://preloaders.net/en/popular I also used this resource from NetTuts for ajax requests in JQuery it was good to get started: http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/ Tomorrow i need to finish of the selected category bread crumbs link then ive got some server side stuff to sort out to load up those div's if the submit button is clicked and validation is not clear which you know will result on all jquery actions being lost. I will use a hidden input to store the value of the selected category id if you were wondering. Sneak peek at some of my jquery code $(this).addClass('selected-category').parent().siblings().find('a').removeClass('selected-category'); Good Night!
  13. Thanks. But to be honest its of no use to us at the moment. What about bootstrap, image uploading, image resizing extensions. We are much better of using Yii Version 1 as there are loads of online help threads available if we get stuck plus the 1000's of extension's and widgets we are tried and tested. I thought i would use Yii 2 before but now I know a little more i don't see the point unless its been out a few years and there has been enough coverage. Whether you do your project in Yii 1 or Yii 2, its going to work anyway, so it doesn't matter.
  14. Well you could click on 'Members' then 'Post Count' then do a screen print and add it to your CV. That would show all points that you have been awarded with and even doubling Larry's score. You could just give a brief introduction in your CV to who Larry Ullman is and books he has available, i would probably expect that they would be more than quite familar with the author already. I was just about to update my project diary but since this post is probably more important now ill leave this for people to check out.
  15. This place would be a good reference for you with all the questions you have answered.
  16. Edward

    My Project Diary

    Unfortunately floating didn't work in this situation, It only worked with inline blocks. Thanks anyway.
  17. Edward

    My Project Diary

    Thursday, 2nd May 2013 Hmm, this is the second time i am typing this post, i accidently swopped left on my magic mouse and sent the browser back a page losing my post. Okay so far things are going well on the Ajax Dynamic Category loader, well they are going well now but i had a real hard time with the CSS and had to find quite a few hacks to get things working. I had inline-blocks dropping down wrapping down to the next line when i needed them all on one line and a horizontal scroll bar to appear below. I fixed the problem using white-space: nowrap; although this fixed part of the problem it started another problem in which it applied the same formatting to child elements so within the child elements i had to use white-space: normal; Now i had another problem betwen my inline-block div's i had some spacing i tried for hours trying to remove it setting padding to 0 and margins extra. Then i found this online http://css-tricks.com/fighting-the-space-between-inline-block-elements/ I thought this was good and applied the formatting so this worked it removed the space between my division blocks. But the problem was not yet over there was a space at the bottom of the division block and i found another resource online http://salman-w.blogspot.com/2012/10/remove-space-below-images-and-inline-block-elements.html Yes removing the space below inline block elements, ahh this css is really amazingly annoying, isn't it? Anyway i used vertical-align: bottom; and funnily enough it worked. Today i applied all the other css formatting to the Category selector since i have already wasted so much time on the CSS than i would of liked to and lookwise it is now 100%. Actually its the best looking category selector i have ever seen online but maybe thats just because i am viewing it on iMac, hahaha. So now i guess its time to go and give the Yii book a little read to brush up on how ajax should be applied in Yii. Okay ill give this another bash shortly, time for a break.
  18. Larry if you ever have a conference in New York please let me know early and ill fly over to see it.
  19. Edward

    My Project Diary

    @Antonio Yes i dislike trackpad seriously or any form of it, its slow and annoying, they don't live up to the speed and flexibility of mouse or especially a magic mouse . I have been using the mouse since my first computer which was a Commodore Amiga 500 back in 1990, so thats 24 years (ha longer than you've been alive) of using one and so far nothing comes close to it. I will take a look at The Binding of Isaac, i would probably advise you not to try World of Warcraft as it is highly addictive, its something i probably spend 10,000+ hours on before. It was the reason i dropped one of my Maths papers from a A to B grade, although all my other Maths papers were A's i was disappointed with that result and don't forget it to this day. Yeah i am still enjoying it, i cycled home so fast today i made a new speed record of 31.1mph and that was on a flat straight road with no wind, my old record was only 27.5mph, take into account this is also on a Mountain Bike its no racer. Okay this is enough on the iMac and games now i got to get this thread back into gear with my projest. Ive come up with a plan for the category selector so will work on it now. Thanks
  20. Edward

    My Project Diary

    @ Antonio, i am glad you love your Mac Air, we have always had a MacBook here, i tried it but i never thought anything of it, i just hate the trackpad and find it very difficult to get things done. On the otherhand iMac is a totally different experience. I already installed MAMP i believe the process was easier than on windows, Mac just gives the appearance that no bugs will happen. Larry always used MAMP examples in his book for Mac so i believe if he thought XAMMP was more appropriate he would of done his examples with that. @ Larry. Thank you very much. I did see MacBook's and i noticed that some of those were more expensive than my highest spec iMac. Okay but to my notes, yesterday i spend most of the day sleeping as the first day i purchased iMac i spend most of the day on it and landed up with 6 hours sleep. I am currently waiting for an email from adobe with my new Creative Suite CS6 Web Premium Serial Number, they are also sending me out a new CS6 CD which will arrive in 7 - 10 days. I currently downloaded the 30 day trial edition which i have been using. I have always been very skeptical about moving over to Mac as i wasn't much impressed with the MacBook. However the iMac with the mouse is just so wonderful, i could easily type the word wonderful another 10 times and i don't think this would be an exaggeration. I find that iMac is a very personal computer, the way everything is grouped together, i also find it easier to connect with its visual features. With windows i never felt i really knew the system, stuff was just everything, like spaghetti code. With regards to some of my old games like Alone in the Dark 1, 2 and 3, i went back to GOG.com where i downloaded them and they had a Mac version also so i downloaded them. Some of the other games i owned on GOG were only available for windows versions. I also love the game Feary Tale Adventure which is good on the Genesis, i found an emulator for genesis for Mac, so i can no play that again. And for transferring pictures from my Samsung Galaxy Note to Mac i got an Andriod file transferrer. So with regards to the games situation its not that bad. Talking about games i downloaded the so called best game for Mac i found in a chart it was called Limbo, its quite good, its like your most worst nightmare as a child. And lastly about games, i know i shouldn't off done this as i spent hours before but i just couldn't help myself and subscribed for the online MMORPG World of Warcraft Mac version, hehe. Anyway after what i have seen of iMac i can definitely say its 3 to 5 times better than your regular windows desktop. It is such a pleasure to work and type code into, the screen quality is just so great. Today i spent a couple of hours working on the category selector for my website, mostly i have been trying to configure the CSS up to a level of which i can start doing the Ajax requests. I also got the categories database filled and put in groups of subcategories for testing with. So far everything is going well. Okay i am going to try World of Warcraft on the Mac, i used to be a lvl 85 and now its time to get back there again. But don't worry i will keep doing my project and updating here, i am just a little bit excited with things right now.
  21. Edward

    My Project Diary

    Sunday, 28th April 2013 (2) You may be wondering why i am typing a 2nd Sunday the 28th update, well i typed the first very early hours of the morning, now its about 10.10pm Sunday night so this is the 2nd. I just had to come on to tell you because today i got my first iMac and yes i am typing this post with it right now. It really is quite amazing the screen is so clear and all the cables and desktop are now gone. Its just a tiny little keyboard, small magic mouse and apple iMac monitor on my desk. I now have loads of space around me this is really great. Really i feel like i can take over the world now, just kidding . Today was the first time i also saw the box for a apple iMac it really is quite unique even when i walked out the Apple shop other people also starred at the box like they had never seen something quite like that before. I felt like a celebrity and tried to rush to the car rather shy of all the acknowledgement. I have a few problems now, the first one is i have to get all the files from my old computer over to this one. The second problem is my adobe CD is for installation on windows, so i will have to get one for Mac. This means i have no dreamweaver IDE, i do have a zend studio IDE license so i will have to download and use that for temporary. The third problem is i will have to download and configure MAMP, i was using XAMMP before. One thing i am sad about is i will no longer be able to play the old DOS games like Alone in the Dark or Feary Take Adventure. But i guess its time to move forward and put the skeletons into the closest. As soon as i get Adobe installed i will take a picture to show you my new setup. Well ill have to see what i can get done tomorrow, will it be possible to work on the ajax dynamic category loader or will it be a day trying to get everything configured. Whatever it will be i am extremely happy and love my iMac as much as i love Larry Ullman. Its actually my birthday next week so this was an early present for it. Okay ill see you guys later..
  22. Edward

    My Project Diary

    Sunday, 28th April 2013 I can't believe it the end of the month already. Well this month i have cleared up most of my worries, my item listing page which i have worked on this month is probably 60% complete. There has just been a massive amount of work to do and it has not been easy, i have debugged through 100's of bugs which unexpectedly came up out of the blue. It was the first time i had used everything together at the same time HTML, CSS, Javascript, JQuery, PHP, Yii Framework. I used to be scared of Javascript and JS as i had never used it before but now i like it very much, it was actually very easy to use pretty much the same as PHP. Things covered this month: 1. I installed Flash SWFUpload into the Yii framework which is used by YouTube and WordPress projects. I had a horrible time trying to install this from scratch into Yii and later found an extension which lead to another extension of this extension for Yii. You have probably seen this cool guy before but his work was very useful to get started with: http://www.ramirezcobos.com/2010/11/06/how-to-use-swfuploads-yii-extension/ I have written some of the javascript handlers but still have remaining work to complete. Which is: For my site you can upload 12 pictures but of those pictures must be the default image that someone will see on your listing. So in order to get the default image each image must be attached to a radio button. Also each image is attached to a hidden input field which holds the value of the temporary image file location. And then its easy to add remove image with basic javascript. Images need to be resized using the PHP GD Library, i am expecting JPG, JPEG, GIF and PNG. BMP are not accepted as GD library has no function for resizing. 2. I worked with dynamic tabler data for attributes and values for products and also shipping options which were done via the client side with js and Jquery. I also had to collect and redraw data in the views files, i have done this successfully. For the tabler data i used the javascript var uid = new Date().getTime() to get the clock value for example 1367087682298, i also had to have a server side PHP equivalent of this function so i used round(microtime(true) * 1000), which works perfectly. The unique clock values where added to id's and name's if this was not done form data would be lost. An example of one of the input's: <select class="span6" name="Shipping[1367087683027][service_type]" id="Shipping_service_type_1367087683027"> 3. I implemented a CKEditor into my listings page and removed harmfull attributes of it. I still have to remove image pasting into this but is should be a small job with js. 4. I also worked on a js dynamic item returns statement. So on this item listing form i still have the images part ot finish off and the dynamic ajax category loader which i will need to build manually and will be starting next, also their is the final collection of data and validation. I am really looking foward to working with Javascript objects and json, the category loader i will be building is the same as what ebay have if you have ever gone in their to list products and have to select a category. The only difference between theirs and mine is mine will come up in a modal window with the background dimmed out. Just wanted to briefly comment on on last thing, i have got about 700 lines of code (300 lines being JS and JQuery) in my item listing views file and probably about 100 (expecting about 200) lines in my controller action so far and their is code all over the place in the related models. But i am telling you without the JS code its impossible to make the page work the way it does. I do plan on disabling pages of the site that need JS enabled to be quite frank, nobody should be listing products unless their are on a laptop of pc anyway. If you are working and taking orders on a website you should be on the appropriate device. I will try to cover the best i can for people using mobile devices for buying products, something which i love to do myself, so understand the buyers needs here. Okay i hope some of this is useful for others, stay tuned.
  23. Edward

    Yii And Js

    Thanks for that that was a more informative link than mine. I am having to deal with a lot of tabular data in yii it's quite difficult but I'm getting there slowly. I was having trouble with adding new inputs as HTML the problem was the events were not blinded to the new HTML so one way I got it to work was by cloning then changing attributes of the elements. If I added HTML manually I had to add the events again manually which led to a lot of code.
  24. Edward

    My Project Diary

    Thanks, since my last post on the 6th of April ive made a breakthrough basically the biggest jump since i started ive done about 300 lines of js, jquery and implementing and customizing plugins in js. I need a bit more time and ill come in to update a little bit. But to be honest things are getting a little personal with this project so i can chat about it but only briefly, that is me being the selfish man of which i am. I really like Unity3d, haven't had a chance to use it again since my last post. I did make a flashing rotating alarm system where the lights flashed between blue and red, its really fun unlike our webdesign. Later this year i will definetly being buying a Mac desktop and laptop it seems to be the way to go and the other reason is that Unity3d was developed by Mac so considering the things i like doing it seems to fit better now. I would really love to see your project that you build in codeignitor Antonio. Done is better than perfect the reason being there are too many lines of code in an application making it impossible to be perfect!
×
×
  • Create New...