Jump to content
Larry Ullman's Book Forums

Edward

Members
  • Posts

    1115
  • Joined

  • Last visited

  • Days Won

    27

Everything posted by Edward

  1. Edward

    My Project Diary

    My php is much better now, i hae had to rewrite parts of my project as my coding got better. The thing is when you improve things change the way you think and the way you structure things. So its quite hard because you have to go back and fix things. I am using model classes much better now, i have many many for each modell. This helps to cut down the code and help me organize things much more. So programming is really difficult especially on a big website, when you get better you have to keep fixing things so the process takes longer and longer the bigger the website gets. I think the main problem is i try to keep everyhing perfect and its not possible you just have to get things to work.
  2. Edward

    My Project Diary

    Still working on this.
  3. This is a good forum. I have learned a lot here. Especially with my object orientated codeNibcan develop a good website after learning from from you? Because I know better object orientated code. This helps as its more advanced as to the general code that is written
  4. It's good you signed up with Larry Ullman he is a good web developer. You you will get a lot of knowledge from him he has many years.experience in web design.
  5. I got the search up and running now. It took me a while to get it integrated into my website. But it was worth it this search engine is much better than the original search. Lucene worked out really good it has some advanced search features rather than the basic Myisam databases. So after a bit of extra work I got it figured out.
  6. Edward

    My Project Diary

    Still working on this.
  7. That's why i love you Larry, i just created the a .bash_profile file in my home directory added the line you suggested export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home" and then everything works. Amazing. Thanks for your help, christmas is coming soon.
  8. When i run java -version from terminal, it comes with: java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode) Java 1.6 is unsupported by ElasticSearch, i have installed Java platform 1.8, product 1.8.0_25 with path /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java I am not sure what i have to do to change the Java being used. I don't know anything much about terminal. I have found this other thread that can help but when i tried this elastic search still gives the same error. https://docs.oracle.com/javase/tutorial/essential/environment/paths.html
  9. I installed Java version 8 it shows the java icon in System Preferences on my iMac. When i try to run ElasticSearch from terminal i get this message coming up: Edwards-iMac:~ EDWARD$ /Users/EDWARD/Desktop/Elastic\ Search/elasticsearch-1.4.0/bin/elasticsearch ; exit; Exception in thread "main" java.lang.UnsupportedClassVersionError: org/elasticsearch/bootstrap/Elasticsearch : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) logout [Process completed] I have looked at some of the threads on GitHub but i don't actually understand what they saying? Does anyone have any idea where and what i should edit into files? https://github.com/Homebrew/homebrew/issues/29610#issuecomment-47778002
  10. Thanks for the link, i came across this one before actually from StackOverFlow while running a search. Thanks for your help. Edward,
  11. Thanks for the fast response. I need such a request for such a page like eBay has for example http://www.ebay.com/sch/i.html?_from=R40&_trksid=p4712.m570.l1313.TR0.TRC0.H0.Xlarry+ullman&_nkw=larry+ullman&_sacat=0 This is their listings page. If i know where a user is from by either locating their country or using their signed in account info, i could add data to item listings specific to them for example if the seller offered international shipping or had free shipping available. There also has to be a buffer just incase i can't find their location and then I could just provide default data for a particular item. I really need the country to be picked up so it will work with my PHP script before the javascript even loads so i can perform specific page rendering. Obviously if i do have to trigger an API request i wouldn't want to repeat it everytime the page had to be reloaded, so I would either need to issue the user with a Cookie or possibly save the IP's country from the proceeding API request to the database to later act as a IP country look up table. Also i am unsure of what you mean by this? (If they're not (i.e., most desktop PCs), you can approximate their location by their IP address.) How can i find a users country via a IP address, i would need a lookup table or have to make a API request but from where exactly?
  12. If a user is surfing your website, how is the best way to get a users two letter country code e.g "US" if we don't know where they are located? I found the following options so far: http://php.net/manual/en/book.geoip.php http://ipinfo.io/developers https://developers.google.com/maps/documentation/geocoding/ My website will require numerous API requests for this info so i am looking for a sensible solution. Edward.
  13. I love the new book its well written. I found that if you have a website with buyers and sellers and not just an individual seller the carts database is not suffice. I think that in this case it would be best to create a cart and a cart_content database like this to make it easier to sort out members shopping carts with some simple relational queiries as apposed to some PHP logic. CREATE TABLE cart ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, buyer_id INT UNSIGNED NOT NULL, seller_id INT UNSIGNED NOT NULL, date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, date_updated DATETIME DEFAULT NULL, PRIMARY KEY (id), INDEX fk_cart_user_buyer_idx (buyer_id ASC), INDEX fk_cart_user_seller_idx (seller_id ASC) )ENGINE=InnoDB; CREATE TABLE cart_content ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, cart_id INT UNSIGNED NOT NULL, item_id INT UNSIGNED NOT NULL, price INT UNSIGNED NOT NULL, quantity INT UNSIGNED NOT NULL DEFAULT 1, date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, date_updated DATETIME DEFAULT NULL, PRIMARY KEY (id), INDEX fk_cart_content_cart_idx (cart_id ASC), INDEX fk_cart_content_item_idx (item_id ASC) )ENGINE=InnoDB;
  14. I was thinking about this as well you could just put user/member/username So loading up by there username instead of their id, i guess this only applies if your members have a username though.
  15. The problem happened because i used an echo in my controller like this: if(ItemShippingInternational::model()->isInternationalShippingAvailable($modelItem->itemItemShippingInternational)) { echo 'International Shipping is available!'; } $modelItem = new Item('scenerio-name'); $this->performAjaxValidation($modelItem); if(isset($_POST['Item'])) I think i spent about 6 hours on this, thanks to the person above that clicked the switch and got me out of this mess.
  16. Its okay got it working i stripped down my controller. So now i know its something in my code around it that is causing the problem. Edward is still not too old yet and his detective work is still up to scratch after his many years in those old spooky mansions in "Alone in the Dark". Hope all is well for you Larry, Christmas is coming soon, its coding all the way till then.......
  17. I have discovered that Yii will not run custom validators when I have enableAjaxValidation enabled. I have tired everything, setting validators to safe using scenerios etc, nothing works. When i submit my form without ajax and JS Client Options disabled the validator works. Did anyone else suffer from this problem, or know how to fix it?
  18. Yeah i understand where you are coming from everything has its time before its time to move on, we get busy with other stuff, daily lives etc. You have done an amazing job in answering all those posts, its really not easy trying to understand exactly what someone else is talking about when they make a post, but for you it seemed very natural at it. Regarding the Uploadifive i did pay the $5 and downloaded it but after taking a further look at it i decided to stick with SWFUpload for now. You see i have already implemented SWF for user image upload and item listing images. I think figuring that out and replacing would take 3 weeks or longer, you also have to consider all the testing and bugs. I feel for now its better i stick with what i have then return later for this mobile stuff. I just recoded my item listing page and the update page it has taken me almost 3 months most of the website weight is in that page, other parts of the site are generally easier. I had 4 parts with tabular data which included one part for images, its taken along time to get it all working. I have seen other sites change parts of there site and to be honest there speed is similar to mine so i think i am doing well. I seem to be making good pace now, i think i need about one more year of coding to the level of where i can get this website online. I hope to see you around on the forums. Thanks for the help you have given me. Edward (Actually my site is online but its not finished it would be stupid of me to put it up just last minute, OMG i would have so many more bugs to fix)
  19. Nah, array('date_updated','default','value'=>new CDbExpression('NOW()'),'on'=>'update'), This only works when you do the first update, but if you are to update a record again it will not work. So you are better of with: public function beforeSave() { if($this->isNewRecord) { $this->date_created = new CDbExpression('NOW()'); } else { $this->date_updated = new CDbExpression('NOW()'); } return parent::beforeSave(); } You could convert that to a tenary operator if you don't have other stuff you have to deal with. Just managed to figure out one particular bug it took me 7 hours. In the end it turned out to be nothing to do with my new code but something in another model that was failing to update. This activeRecord.saveAttributes() function pisses me off, it returns you a boolean whether the record was updated but if you are saving a record that is not modified it will return false. Very misleading and cost me a lot of time.
  20. Seriously sometimes i think i have a bad spirit going through my iMac, i mean one minute the code works then the next minute it doesn't, then it does again. I can't find any logical explanation for such errors. I am working a problem since yesterday i spent nearly 5 hours now and i am getting random results which is making it hard to pinpoint an exact error location.
  21. Funny stuff this! Today i can get the date_updated to update with array('date_updated','default','value'=>new CDbExpression('NOW()'),'on'=>'update'), God knows what i was doing before!!
  22. Well its too late now, i paid for it today and i am going to start building it into my site. It should be easy to implement as the js handers are almost identical to that of swfupload. HTML 5 file uploaders here we come. Larry remember my item create page code i done a year ago it was about 300 lines plus in the controller, now its only about 20 lines. I pulled the whole load of code into separate model functions i even recreated the save functions. I think every time i look back i code i can always improve it in some way, its never perfect but to be honest i don't care anymore so long as everything works i can polish up later on its really optional. I don't believe any site online is really perfect . But with regards to loading up images and stuff there are other problems i have found that are not talked about online and are independent to how my website functions, i guess this is what is meant by restructuring. None of this stuff we are doing is a easy as it looks but no problem so far has been too much for me.
  23. Yeah there is no one like him really is there.
  24. Keep up the good work Jonathon.
×
×
  • Create New...