Monthly Archives: July 2009

How to paginate data in a Datagrid

The pagination is an important feature which is required in most of the applications and in a flex application we find it difficult to implement as it is some what different from other technologies. You can use the below solution provide as an example to be used in your applications.

In Flex, by default a DataGrid will display all rows in the data provider. If you have many rows of data then displaying few rows at a time to the user will give a good experience to the user.

The solution may be to make DataGrid display all rows in the data provider and you can split the data and update the data provider with required rows.

Explanation

DataGrid displays all rows in the data provider provided. If you have many rows of data then displaying few rows at a time to the user will give a good experience to the user.

As the DataGrid will display all the rows in the data provider, you can split the data and set the data provider of the DataGrid with only the required rows. To achieve this you will have to do simple calculation and split the data from the full data.

Please look at a good example on how to achieve this and blogged about it. Please find the source code and the sample implementation at the URL below.

http://gurufaction.blogspot.com/2007/02/flex-datagrid-paging-example-with.html

Drupal vs WordPress

Both Drupal and WordPress are content management systems that allow users the flexibility and ease of putting together a website quickly and successfully.

But which one is better? And which CMS would be better for a library to use?

Even though both Drupal and WordPress are popular, open source, and have large user communities, there are some differences between the two systems.

Drupal & WordPress

Drupal is extremely flexible, allowing you to do just about anything you want to with your website. It allows for easy creation of membership sites and portals. So for example you can create a forum, a blog, a community site, or just a plain website, whereas WordPress is more limited and geared more towards blogs.

Drupal however, has a higher learning curve and is more difficult to customize and use. WordPress on the other hand is very user friendly, easy to learn and quick to put together. Things like modifying the code, customizing the theme and setting up the site are much easier in WordPress.

So what it really comes down to is this:

Drupal is extremely flexible — but is more difficult to use.

WordPress is easier to use — but is not as flexible and lacks in functionality.

So … which CMS is better and which one should you use?

Both Drupal and WordPress have their strengths and weaknesses, and neither is really superior over the other. The decision of whether to use Drupal or WordPress really depends on what you want it to do and how you’re going to utilize the CMS.

Drupal allows for more flexibility, functionality and complexity therefore it’s better for full featured websites, a blog community, a forum, or a social networking community.

WordPress, although easy to use is less flexible and better suited for a single author and/or group blogs.

Both Drupal and WordPress can be utilized by libraries, and it really depends on what the library plans to do with the site. Before deciding on which CMS to use, the library should take into consideration the goals of the website and the functionality that is needed to accomplish those goals. Ease of use might come into play and should not be overlooked; if a website is difficult to put together and edit and then the extra functionality might not matter as much if it is not being utilized.

I also think it’s not a bad idea to test Drupal and WordPress, since they’re both free open source systems, to see which one will be better for a particular project.

SQL JOINS

The SQL JOIN clause is used whenever we have to select data from 2 or more tables.

To be able to use SQL JOIN clause to extract data from 2 (or more) tables, we need a relationship between certain columns in these tables.

We are going to illustrate our SQL JOIN example with the following 2 tables:

Customers:

CustomerID FirstName LastName Email DOB Phone
1 John Smith John.Smith@yahoo.com 2/4/1968 626 222-2222
2 Steven Goldfish goldfish@fishhere.net 4/4/1974 323 455-4545
3 Paula Brown pb@herowndomain.org 5/24/1978 416 323-3232
4 James Smith jim@supergig.co.uk 20/10/1980 416 323-8888

Sales:

CustomerID Date SaleAmount
2 5/6/2004 $100.22
1 5/7/2004 $99.95
3 5/7/2004 $122.95
3 5/13/2004 $100.00
4 5/22/2004 $555.55

As you can see those 2 tables have common field called CustomerID and thanks to that we can extract information from both tables by matching their CustomerID columns.

Consider the following SQL statement:
SELECT Customers.FirstName, Customers.LastName, SUM(Sales.SaleAmount) AS SalesPerCustomer
FROM Customers, Sales
WHERE Customers.CustomerID = Sales.CustomerID
GROUP BY Customers.FirstName, Customers.LastName

The SQL expression above will select all distinct customers (their first and last names) and the total respective amount of dollars they have spent.
The SQL JOIN condition has been specified after the SQL WHERE clause and says that the 2 tables have to be matched by their respective CustomerID columns.

Here is the result of this SQL statement:

FirstName LastName SalesPerCustomers
John Smith $99.95
Steven Goldfish $100.22
Paula Brown $222.95
James Smith $555.55

The SQL statement above can be re-written using the SQL JOIN clause like this:
SELECT Customers.FirstName, Customers.LastName, SUM(Sales.SaleAmount) AS SalesPerCustomer
FROM Customers JOIN Sales
ON Customers.CustomerID = Sales.CustomerID
GROUP BY Customers.FirstName, Customers.LastName

There are 2 types of SQL JOINS – INNER JOINS and OUTER JOINS. If you don’t put INNER or OUTER keywords in front of the SQL JOIN keyword, then INNER JOIN is used. In short “INNER JOIN” = “JOIN” (note that different databases have different syntax for their JOIN clauses).

The INNER JOIN will select all rows from both tables as long as there is a match between the columns we are matching on. In case we have a customer in the Customers table, which still hasn’t made any orders (there are no entries for this customer in the Sales table), this customer will not be listed in the result of our SQL query above.

If the Sales table has the following rows:

CustomerID Date SaleAmount
2 5/6/2004 $100.22
1 5/6/2004 $99.95

And we use the same SQL JOIN statement from above:
SELECT Customers.FirstName, Customers.LastName, SUM(Sales.SaleAmount) AS SalesPerCustomer
FROM Customers JOIN Sales
ON Customers.CustomerID = Sales.CustomerID
GROUP BY Customers.FirstName, Customers.LastName

We’ll get the following result:

FirstName LastName SalesPerCustomers
John Smith $99.95
Steven Goldfish $100.22

Even though Paula and James are listed as customers in the Customers table they won’t be displayed because they haven’t purchased anything yet.

But what if you want to display all the customers and their sales, no matter if they have ordered something or not? We’ll do that with the help of SQL OUTER JOIN clause.

The second type of SQL JOIN is called SQL OUTER JOIN and it has 2 sub-types called LEFT OUTER JOIN and RIGHT OUTER JOIN.

The LEFT OUTER JOIN or simply LEFT JOIN (you can omit the OUTER keyword in most databases), selects all the rows from the first table listed after the FROM clause, no matter if they have matches in the second table.

If we slightly modify our last SQL statement to:
SELECT Customers.FirstName, Customers.LastName, SUM(Sales.SaleAmount) AS SalesPerCustomer
FROM Customers LEFT JOIN Sales
ON Customers.CustomerID = Sales.CustomerID
GROUP BY Customers.FirstName, Customers.LastName

and the Sales table still has the following rows:

CustomerID Date SaleAmount
2 5/6/2004 $100.22
1 5/6/2004 $99.95

The result will be the following:

FirstName LastName SalesPerCustomers
John Smith $99.95
Steven Goldfish $100.22
Paula Brown NULL
James Smith NULL

As you can see we have selected everything from the Customers (first table). For all rows from Customers, which don’t have a match in the Sales (second table), the SalesPerCustomer column has amount NULL (NULL means a column contains nothing).

The RIGHT OUTER JOIN or just RIGHT JOIN behaves exactly as SQL LEFT JOIN, except that it returns all rows from the second table (the right table in our SQL JOIN statement).

interesting?..http://www.devshed.com/c/a/MySQL/Understanding-SQL-Joins/:

15 Tips for a Successful Blog

It’s easy! To create a popular blog today all one has to do is:

1. Decide on a topic for your blog using Google’s Keyword Tool to find out what searches are popular.

2. Using keywords for your chosen topic, get a cheap domain name and hang your sign board.

3. Borrow a professional template.

4. Hire a geek to make you a pretty banner and customize your theme/template if necessary.

5. Spend some amount for hosting services.

6. Go the library and/or search Google to find great content for your blog.

7. Apply CMP (copy, massage, paste) to make it your own (kind).

8. Pretend you are an expert in your chosen niche applying the “fake it till you make it” principle.

9. Get a referral or two from your pro-splogger pals.

10. Learn a little SEO to game the search engines.

11. Apply the art of link baiting for making apt titles.

12. Promise the moon and the stars to your readers.

13. Preach good things will come to those who believe with all the fervor of an evangelist.

14. Wallpaper your blog with ads.

15. Convert your CMP content into a book and you’re a success!

Will this works!!!!!!!!!!!!!!!

10 reasons why Twitter is so Popular

Here we go … Twitter is popular because

1. It’s very easy to use.

2. It’s a lot easier to get Twitter followers than it is to get Blog newsfeed subscribers.

3. No Technical knowledge is required to use Twitter. Just open an account and start tweeting.

4. 140 character limitation makes Twitter free from abusing abbreviations and grammar.

5. Twitter makes you feel like you are a part of something greater than yourself. You never have to feel alone again.

6. Twitter keeps you in contact with all of your ‘friends’ no matter where you are. When you are mobile and on-the-go it’s like a free conference text-messaging service in your cell phone. This makes this generation ‘always-connected’.

7. You feel you are popular, with a lot of Twitter friends. You make a lot of friends as quickly.

8. Twitter is an instant social fan club. It is probably the best place to keep in touch with your favorite celebrities. You can write to them and they might respond. You can almost reach out and touch them.

9. If you follow your favorite a-lister they will probably reciprocate and follow you back.

10. Twitter is a great way to pretend being someone’s friend so you can sell them something later. Backdoor marketing for the new media age.

May you have your own reasons for Twitter’s popularity.

New Google OS

Google came to master Web search and online advertising largely on its own. But now that it plans to create an operating system to compete with Microsoft’s widely used Windows, Google will have to play nicely with computer makers.

Late on July 7, Google said it’s developing an operating system for personal computers based on its Web browser Chrome and the open-source coding platform Linux. The software, called Chrome OS, will be specially designed to run applications such as e-mail, word processing, and multimedia through the Internet rather than from a user’s hard drive. Google (GOOG), based in Mountain View, Calif., plans to release the product in the second half of 2010.

There’s been a lot of guesswork around Google’s motives and the timing of its announcement. Many analysts view this as a foray into Microsoft’s (MSFT) home turf, or at least an attempt to undercut the software giant’s business model, which it may be. But sources close to the situation say Google’s main aim is to make personal computers better portals into the Web as it continues to morph from a collection of pages to a place to run a wide range of applications. If PCs can more quickly and smoothly run online software, the thinking goes, the Web will become more attractive as an advertising medium.

And to ensure Chrome OS becomes the platform of choice for a substantial number of computers, Google is going to have to collaborate closely with the computer industry.

There’s little cause to believe PC makers want to abandon deeply held ties with Microsoft, which later this year is due to ship Windows 7, an update many analysts say will be a big improvement on the disastrous Vista. Still, computer manufacturers are eager for a viable alternative with a lower price tag. “We really want to understand all the operating system choices other than Microsoft that could be used by competitors or that we might want to use for our own customers’ needs,” says Hewlett-Packard (HPQ) spokeswoman Marlene Somsak.
Considering Chrome

HP, as well as Acer, Asustek (2357.TW), and Lenovo (0992.HK), have been in discussions with Google about the development of Chrome OS, Google said in a post to its company blog. A representative from Dell (DELL), one of the few major PC makers not included in Google’s announcement, declined to comment on whether it was in talks regarding Chrome OS but says it “constantly assesses new technologies as part of managing our product development process and for consideration in future products.” Apple (AAPL) makes its own operating system.

With Chrome OS still early in its development, computer companies may request design choices Microsoft wouldn’t dream of adding. “What they want is to gain much more control over the logos, the applications, the way the operating system works, things like that,” says Forrester Research (FORR) analyst Frank Gillett, citing a person he declined to identify at one of the top PC makers. “Microsoft understandably didn’t want to give in to that at all because they want to create a uniform experience across all different brands of equipment.” Google might be more accommodating in this area, since it’s more focused on the experiences users will have on the Web. “They’ll give more ground there,” Gillett says.

Insofar as price matters, Google may have Microsoft beat. Lately, computer manufacturers have balked at Microsoft’s plans to charge around $50 for each computer they ship with entry-level versions of Windows 7; that’s roughly triple what the software company gets for its cheapest version of Windows now. And as costs for hardware drop, “[the manufacturers] want to be able to aggressively negotiate the best price on all the things that go into their product,” says Stephen Baker, an analyst with market researcher NPD Group. “Having another viable operating system alternative coming from a company with great brand recognition would be a huge win for the PC makers.”

Google plans to offer Chrome OS free. The company can afford to do that because it would profit from more visitors using its search engine and other online offerings, says Charles King, president of industry analyst Pund-IT.
Bargain Prices on Windows?

Still, Microsoft is getting the price-cut religion. For both Windows 7 and Office 2010, which will be unveiled for the first time at a Microsoft event on July 13, the company will sell discount versions in the hopes of getting customers to buy pricier versions when they run into roadblocks. While Microsoft will continue selling its super-cheap version of Windows now in netbooks, based on the older Windows XP, it will focus on getting customers to buy PCs based on at least the “Starter Edition” of Windows 7—which will have the higher-end “Premium Edition” already loaded on the CD for those that buy the rights to unlock it. As for Office, Microsoft will offer free versions that can be used via a Web browser, but executives are confident the vast majority of customers will want to buy the actual software as well.

What’s more, Google has little background in marketing and customer support, factors that could prove critical to the success of a new operating system. Microsoft foots the marketing bill for Windows, running multimillion-dollar campaigns across many forms of media with most new releases. Its recent “Laptop Hunter” TV ads are part of a $300 million campaign launched last year. By contrast, Google’s promotions for new products typically take the form of a single blog post. “Google doesn’t even know how to spell the word ‘marketing,’ ” says Rob Enderle, technology analyst and president of the Enderle Group.

A lack of marketing and support are some of the reasons that Linux has failed to gain traction with consumers, despite attempts by PC makers over the past year to bundle forms of the open-source operating system with netbooks, the low-cost, stripped-down laptops that are used mainly for surfing the Web. This year, researcher IDC predicts the portion of netbooks that ship with Linux operating systems will fall to 4.5%, from 24.5% last year. Google says Chrome OS would initially be aimed at netbooks.

Microsoft’s biggest advantages may come in the area of distribution. While Google has no real experience, sales staff, or distributor network to reach out to millions of would-be customers, Microsoft has 3,500 sales reps. More important, about 650,000 companies around the world make some or all of their living reselling Windows and Windows-based applications, says corporate Vice-President Allison Wagner. The company will invest more than $5 billion this year in a variety of training programs and marketing seminars to help these partners, which range from Best Buy (BBY) to Accenture (ACN) to the mom-and-pop computer shop on the corner.

Google may have announced its intention to race Microsoft, but Redmond has the head start. Says NPD’s Baker: “If Windows 7 goes as smoothly as it has so far, that’s going to take away a lot of [PC makers’] concerns of needing to have multiple OS partners.”

10 Drupal Modules You Can’t Live Without

10 DRUPAL MODULES THAT WILL KILL YOU IN YOUR SLEEP IF YOU DON’T INSTALL THEM NOW

1. TinyMCE WYSIWYG EDITOR — Sometimes, we geeks forget that it is we who are the freaks. Most people don’t know how to code an image, link, paragraph, unordered list, much less understand how image alignments work. TinyMCE, the only WYSIWYG editor that really works for drupal, opens up the world of webpublishing to this 98.9 percent of the population. Anyone who thinks that visitors who can’t code an link aren’t worth their time are both stupid, and will likely die cold, broke, and alone.

2. Feedback — Its a simple module, sure. But every site needs it, and drupal doesn’t include it. Sure, not everyone wants a contact form. However, most of those people, I’d argue should stick to blogger and myspace.com. Drupal — being best suited for serious endevours and serious people needs a freakin’ contact form.

3. Blockbar — A totally underrated module, imho. What does block bar do? It makes all that crap that overwhelms first time drupal users disappear. Its now part of my personal toolkit that I implement on every install. Its role: make drupal friendly to non-cyborg types (e.g. those who haven’t worked themselves to death to the point that this entry is their saturday night… wooohooo…)

4. Control Panel — You know, I bet a few drupal veterns are going to scoff at this mention. However, remember cyborgs: not everyone is a cyborg. The best UI is always going to seek to remind users of soemthing they probably used before (::cough:: control panels on windows, and Mac — seeing as how they are on the internet, I think its a pretty safe bet they are familiar.) And no, CYGWIN is not a good poster child for “good user interface” (though CYGWIN saves me, an ubercyborg freak hours upon hours every day).

Plain and simple, humans are monkeys — and monkeys have an easier time navigating in visually rich enviroments, as opposed to enviroments inspired by manilla folders, and tax forms. So, monkeys: pictures good, text and white bad. Use control panels widely in your site, and you’ll be amazed how many more people suddenly figure out how to use drupal.

Seriously. Anyone who disagrees on this point can shutup. They are wrong. I’d tell them they were wrong and that they should shutup again if I could.(wait, I just did)

Relax, Control Panels has the most dirt-plain simple API every for adding your own Icons to your own themes. Truly, its worth the download (or an include, or a rewrite then include — echm, CS).

5. Printer Friendly Pages — Cyborgs be damned, a large portion of the population “surfs” the web like this:

1. they find they info they are looking for
2. they print it out and often file it in a folder if they need it later.

Yes, you could tell these folks to “get with it”. However, you’d be a fool to do so. You may want to check up on the relationships between internet access, age, and wealth if you think I’m bluffing, partner. Oh, and this module not only generates very printer friendly pages, but it also parses out your links, and lists them as foot notes on the bottom of the page.

6. Bad Behavior — Because comment, trackback, malicious scripts, and bad bots will hit your site everyday. This module + 3rd party free libraries of scripts — imho — is usually all a medium level traffic site needs to withstand the internet’s disgusting onslaught. Of course to be perfectly honest, this script no longer works at my site. However, this being one of 20 drupal sites I’ve been building, updatingng, or fixing is alright. I’d take a 1/20 percent chance of having to moderate comments if I were you. Its better than trying to delete 3000 spams from 200 nodes when you don’t know a lick of MySQL.

7. Simplenews — An email newsletter management module. It includes easy import/export of subscribers, lets non UID members unsubscribe and subscribe and manages all that info, gives you all the must-have-info on what’s happening with your mail blasts, and well since newsletter stopped working about 2 months ago, its really the only good module that I’d trust to a non-cyborg for managing such an uberimport task!

8. Views — its new, and changing everything.

9. CCK — going to be hella disruptive to drupal at large. HELL-A hardcore, disruptive, even.

10. CiviCRM — for god’s sake could they get it compatible with 4.7?! Regardless of 4.7’s beta status, I have to develop on 4.7 to prevent from screwing people over with obsolete code. I’ve tried to update it, but its beyond my PHP understanding.

CiviCRM is maybe the only module I know of that could create an industry of consultants all by itself. Moreover, the people who run the project are — as far as I know — the most responsive team in the entire industry. If you mention them anywhere on the public internet, you can rest assured they will hear you in 2-5 hours. This is one module, like CCK and Views that has the potential to change everything. That is, when they get it to be compatible with the non-obsolete-developing-for-it-is-a-total-waste-of-time-and-money version of drupal. 😉 O! — screw Joomla!, get CiviCRM to work with forms API and the world will be shared by we, the open source community forever!