Hey folks!
I have moved my blog to a top level domain now. From now on, you will see my posts at:
Thanks for everyone's support.
a blog from a web addict
Hey folks!
I have moved my blog to a top level domain now. From now on, you will see my posts at:
Google is always very well equipped when it comes to APIs. I found out about their Charts API today and want to let you all know how to use it. Its not very difficult - just like placing an image tag in your HTML document.
3D pie chart
For example, you want to have a 3D pie chart with two segments (one is 30% and the other is 70%). So, this will be the url for that graph: http://chart.apis.google.com/chart?cht=p3&chd=t:70,30&chs=300x100&chl=Segment1|Segment2
And here comes the image output (generated by Google Charts!):
You can find out more about it here: http://code.google.com/apis/chart/
After spending one whole evening, I found out CakePHP has its own XML class for handling xml files. In the meantime, i tried SimplePie (for RSS only, not XML), SimpleXML, and XMLize. But still they werent of any great help compared to cakephp's core XML class.
How to parse it then?
First of all, you need to import the XML class in your controller class using App::import(). Here is the controller class parsing a particular xml file and printing out (like print_r) the returned array.
Controller class:
I have been really very busy this month. Hardly had time to post anything on my blog. So thought I better post a short quick tutorial of a dashed vertical css menu.
Preview (it will look like this at the end)
(Link 1 is hovered in the image)
HTML (the ever popular unordered list!):
This helper will let you create search engine friendly urls without having you to change the controller logic.
Lets assume we have an 'articles' controller (/app/controllers/articles_controller.php) in our website. And the database table looks like this:
id, category_id, title, content, updated, created
The current url structure:
yoursite.com/articles/category/[category-id]/
yoursite.com/articles/view/[article-id]/
So, it means we dont have the 'title' of our articles included in the url. Only ID is present. This helper will let you add the title as well in the url.
Helper class
Someone asked me to show how I created the tabbed navigation thing in my blog (right column). Just to let you know, I am just using an existing template for my blog, but wish to design one myself in future.
In this tutorial, I am going to show you how to create a simple tabbed navigation using jQuery (as you know, its a javascript library).
Requirements
You will require two javascript files for doing this.
jQuery library - Download here
jQuery UI (user interface) tabs - Download here
HTML code
Suppose we have three div elements in our webpage (box-1, box-2, and box-3), and we want them in tabs.
In this tutorial, I am going to show you how to simulate a table-like interface for designing a form using css. Since tables are not involved, we will require the label element for each and every field in our form.
Preview
This is what we will be doing.
here goes the css code:
The GIANT of the internet! Whats left that they dont have yet? Its obvious that search engine is their most powerful tool. But they are constantly introducing us with new products and innovative ideas, and also acquiring anything that has the potential to be large.
Assume you are a normal internet user
What do you normally do at home or office?
- You search the internet (search engine),
- Read latest news (News),
- Send emails (Gmail),
- Manage Documents and Spreadsheets (Docs),
- Schedule your appointments (Calendar),
- Chat online (Talk),
- Make new friends (Orkut),
- Share videos (YouTube),
- Upload photos (Picasa),
- Create blogs (Blogger),
- Publish blog feeds (FeedBurner),
- Get location info (Maps and Earth),
- Read feeds from your favourite sites (Reader),
- Advertise your product (Adwords ),
- Earn money from ads (Adsense),
- Get stock info (Finance),
the list will never end!
They are also coming with a much awaited product (still a rumour) - your online hard disk (often called gDrive or Google Drive). There are already a few free storage services online including xDrive (by AOL ), and Box.net. Google has always introduced us with rich web applications with a very easy to use interface - and this too is going to be one of their top products undoubtedly.
Acquisitions
Whenever it comes to acquisitions, they are the first you could possibly think of. They bought YouTube (video sharing site), Blogger (the one I am using for my blog), Feedburner (publishing feeds), DoubleClick (online advertisement), GrandCentral (one phone number for all your phones), and hundreds more that we dont even know yet. They are also spending millions of dollars on Mozilla (Firefox) Foundation for the default homepage spot.
Opponents
There was a time when we thought Yahoo! or MSN will probably go ahead of Google - but no more. May be it was possible if Yahoo accpeted Microsoft's offer - but instead Yahoo teamed up with Google for an advertisement deal! If there is anyone existing in the market that can fight Google - its Facebook (Microsoft is one of the shareholders of this popular social network). I dont see any other website that has the potential to be as large as Google.
Facebook's main weapon is its platform for web developers. They allowed third-party developers to create applications that let the users experience thousands of applications right from facebook. And Google then came up with the idea of OpenSocial (Myspace, Hi5, and other popular social networks are already using this platform) - a common api for developing applications for multiple social networks - to let third-parties develop applications for them. This is a good news for developers since they now dont have to code in different mark-up languages for different social networks.
Monopoly?
I am not saying that having a larger share of the market is bad, especially when you are providing such quality services for free. But the question is how much secure is it to have all our information hosted by Google? Is the future of internet going to be monopolized by Google?
CSS Stylesheet Switcher - what does it mean?
A stylesheet switcher allows your visitors to choose from a number of stylesheets they would like to view your website with. For example, you may have three pre-made stylesheets (say red, blue and green) and you want your visitors to choose and apply any one of them in your webpage without redirecting them to a new page or refreshing the page.
This tutorial will show you how to create such a client side css stylesheet switcher using jQuery javascript library.
Default Stylesheet
I assume you already have a default stylesheet implemented in your webpage
It is sometimes necessary to change the attributes of a particular HTML tag of your webpage using javascript, especially when you are coding rich web applications. Let it be the class of an element, or the href attribute of an anchor tag.
In this tutorial, I am going to show you how to do it utilising jQuery javascript library quickly.
HTML code (inside BODY tag)
First, we will place a sample image and a link in our webpage.
In this tutorial, we will create a navigation bar with rounded corners (without any image) using css and jQuery (a javascript library). If you dont have any experience with jQuery yet, I would recommend you to read these two tutorials first:
Change div content with jQuery
Toggle div element using jQuery
Requirements
jQuery library: Download here (packed version is 30kb)
jQuery Corner plugin: Download here (8kb).
This is what we will have at the end of this tutorial
Include jQuery library and the jQuery.corner plugin
What is a favicon?
A favicon is an icon associated to a website (or a particular section of a website) - also called as the website icon. There are a few options available to implement a favicon in your webpage, but the most traditional one is by placing a favicon.ico file.
- favicon establishes your brand
- it helps users identify your site from browser tabs
- also, helps visually identifying your site from bookmarks
Generate favicon.ico files online
favicon.cc is a great tool (favicon generator) for creating customized favicons quickly.
There are a few techniques available to perform this task using css. But I am going to show you the most effective one in this tutorial - this involves css position property.
I will be using this image (a cow) in this tutorial.
If you are building rich web applications, then you will obviously require some ajax to give your users a smooth browsing experience. And jQuery makes it easier for you to do that without any trouble.
In my previous articles, I have shown you how to toggle a div element and also changing its content. Now I will show you how to load content from an external file into a div element.
loadContent() function
Though most of the jQuery code is placed inside head tag, I prefer that you create an additional javascript function for managing inline anchor links quickly.
What is Toggling?
Basically a show/hide feature for your webpage elements. For example, you may have a login box in your webpage, and you want your visitors to click on a button for showing or hiding the element.
This tutorial will show you how to implement a simple toggle effect in your webpage using jQuery.
As always, we will require some HTML content first