Archive for category Programming
eBay Most Watched Items
Posted by Randy in Programming, Web Development on April 4, 2009
Well, after a few days of serious development, I'm releasing the beta of my site. It's called whats-hot-weekly.com. It is basically a "most watched items on ebay" site. With it users can find what everyone else is looking at.
One can search by keyword/keyphrase, by category, or by both. The interface may need a little polishing, but it's functional. There is at least one minor bug that I'm working on. The site will continue to improve, and I'll be adding forums soon, so that people can report bugs and discuss what they find.
Don't forget to let me know what you think by commenting here or by emailing me at the address listed on the site's home page.
AJAX Cross Domain Work-around
Posted by Randy in Programming, Web Development on April 4, 2009
Any of you that are AJAX developers can skip this post. I've just recently started concentrating on AJAX for a project I'm working on. In the past, I've used PHP to parse XML returned from various web services and it goes off without a hitch. I also wrote my own web service in PHP for this project.
The project is basically a site that works with the eBay API to pull the most watched items for any keyword search phrase and by category. I've pulled all the categories to a local database. This will allow me to avoid using an API call every time someone clicks through different categories. All the categories are in an AJAX menu system I wrote. The menu is completely dynamic and loads the categories and subcategories using calls to my web service. This part was fun because it gave me the opportunity to create a web service and this in itself was worth the time I've spent on the whole project.
I ran into a road block however, because I wasn't aware that AJAX doesn't allow cross-domain calls. At least from what I see, it doesn't. I started getting an error 1012 "Access to restricted URI denied'." This means that the actually calls I would like to make to the eBay API won't work through AJAX. I wrote the code to try to do so and kept getting this error. That's when I found out that it wasn't possible to do this using AJAX. It's fine in PHP, however. So, here is the work-around I'm brain-storming. I know it'll work. It's just a matter of doing it.
The work-around is simply to write another web service in php that makes the calls for me. Then use AJAX to pull the info dynamically from the localhost. The up side to this is I can also log various stats about the calls within the web service as well. I could create a table in my database to log the searches, time of day, IP address of user, and so on. This will allow me to understand how the app is being used, who's using it, when they are using it, and what they are using it for.
This is also known as using AJAX through a proxy. Where the proxy is the web service on the localhost from which one can make an AJAX call to.
So, I'm off to code another web service.
Browser nuances
Posted by Randy in Applications, Programming, Web Development on March 18, 2009
I've recently been working on a new site. I prefer to write the xhtml, css, php, and javascript without using any WYSIWYG interface. This is great for a few reasons.
- I can practice coding
- I can manage my own code better
- I can verify that the code is W3C compliant
- PHP/MySQL doesn't preview very well in pre-Dreamweaver CS4 WYSIWYG environments.
- Neither does javascript
I personally switch back and forth between three editors. I use Vim as much as I can. I love that old editor. I use Notepad++ mainly for vbscripting and quit web page edits. Finally, I've found that I love the code view in Dreamweaver. It's a great tool. So, now that I've gotten that out of the way, let me explain the one thing I can't stand about web development. I love everything about it except for ......browsers. All web developers will tell you that writing web pages for Internet Explorer, Firefox, Opera, and now Chrome is a headache. It's not that writing a webpage is a headache. It's the fact that each of these browsers have their nuances. Here's an example... I'm working on a fluid layout for this new site. I have a search box that sits in a div in the upper left corner of the browser window.
Here it is in IE7:

Notice the border around the search box. It goes above the top of the browser. This is because I'm using a negative margin value to move the search box up. I did this because in Firefox the search box was too low. I was developing the site and previewing in Firefox to check my code. So I adjusted the CSS in relation to what I saw in Firefox. Here's the same element in Firefox:

Again notice the top border of the search box. In fact, notice that the whole box show up in FF. Here's the same example in Google's Chrome browser:

You may be saying to yourself, "that looks exactly like the Firefox example. You would be correct but here's my second example of nuances. Here is my category menu just under that same search box...in Firefox:

That's how I wanted it to look. I'm using jQuery to get the rounded edges in the inside div. Check out the same edges in Google's Chrome:

When one spends hours trying to make a design look the same across all browsers, it's frustrating to say the least. I haven't mastered it yet. I would really rather spend this time adding AJAX to the site so that it will be functioning and ready for deployment.
