This one is pretty cool guys.
Nico created a custom google analytics api and used it to build a desktop version of google analytics using AIR (Adobe Integrated Runtime).
I just tried it and although it is beta, the experience is amazing - I found it to be much smoother than the online version.
Installation didn't take more than 5 minutes.
It required me to download the AIR first from here:
Then download the google analtyics air file from here:
That's it, you are all set now.
Just enter the required info and even if you have multiple websites/domains mapped with one id, it will suck all of them. You can create as many profiles as you want.
The best part is that the guys at the google camp liked it so much that I think they are now officialy supporting this project.
Enjoy!
Mandy.
Monday, September 24, 2007
Wednesday, May 16, 2007
Good Bye Prototype, Welcome jQuery
I have been a prototype.js user for almost 1 1/2 years now but for a new project, I was forced to use jquery (www.jquery.com). In the beginning, I was too reluctant to give it a shot because of the learning curve and laziness on my part, but I must say once I dived in, I was very impressed with the library, it's documentation, the community, the number of plugins and how easy it was to find all this - something that prototype lacked right from day one (okay now they do have a documentation site www.prototypejs.org, but it just doesn't compare to the jquery website at any level). In no way am I undermining the power of prototype.js (the library that fixed javascript programming :). Just that I am going to be experimenting with jquery now.
One more thing, people often shy away from libraries because of their size, but jquery offers an "official" compressed version of the library that is just 19KB. Prototype too has it's compressed versions but nothing that is official and I always had problems working with unofficial compressed versions.
What's the point of this post? Well, I wanted to write about all the flash work I have been doing, but was just not able to get in the mood to detail that out, so thought will post this for the time being ;)
-Mandy.
One more thing, people often shy away from libraries because of their size, but jquery offers an "official" compressed version of the library that is just 19KB. Prototype too has it's compressed versions but nothing that is official and I always had problems working with unofficial compressed versions.
What's the point of this post? Well, I wanted to write about all the flash work I have been doing, but was just not able to get in the mood to detail that out, so thought will post this for the time being ;)
-Mandy.
Labels:
javascript,
jquery,
library,
prototype
Tuesday, February 20, 2007
Caching with cakePHP
cakePHP has view caching built in which when used cleverly will really speed up your applications.
However, this doesn't work with requestAction.
Let's consider this example:
1. You store all your categories in a database.
2. While displaying your views, you want to pull these categories from the DB.
3. You don't want that every time you display a page, you should pull the categories from DB. Since they are not going to change (till you change them :) it's an unnecessary hit on the DB.
4. You want to load these categories at startup and then just keep pulling the data from the cache rather than the DB.
There can be many ways of doing this, but one of them could be that whenever the category data is first requested, we hit the DB and get the list of categories, then cache them (in a file) and subsequent requests would be served from reading the file (it could be stored in the session too).
So, I decided to give this a shot. cakePHP already has a cache() function that can be used for achieving something like this.
Here is what I came up with:
getEnumValues is something I got as a snippet from cakeforge.
http://cakeforge.org/snippet/detail.php?type=snippet&id=112
So, that's it, you can now do the following in your controller:
-Mandy.
However, this doesn't work with requestAction.
Let's consider this example:
1. You store all your categories in a database.
2. While displaying your views, you want to pull these categories from the DB.
3. You don't want that every time you display a page, you should pull the categories from DB. Since they are not going to change (till you change them :) it's an unnecessary hit on the DB.
4. You want to load these categories at startup and then just keep pulling the data from the cache rather than the DB.
There can be many ways of doing this, but one of them could be that whenever the category data is first requested, we hit the DB and get the list of categories, then cache them (in a file) and subsequent requests would be served from reading the file (it could be stored in the session too).
So, I decided to give this a shot. cakePHP already has a cache() function that can be used for achieving something like this.
Here is what I came up with:
function __getCategories()
{
$cache_name = "views".DS."categories-list.php";
$cache_expires = '+24 hours';
$cache_data = cache($cache_name, null, $cache_expires);
if (empty($cache_data))
{
$list = array_merge(array('categories'=>'All Categories'),
$this->Contest->getEnumValues("contest_category"));
cache($cache_name, serialize($list), $cache_expires);
} else {
$list = unserialize($cache_data);
}
return $list;
}
getEnumValues is something I got as a snippet from cakeforge.
http://cakeforge.org/snippet/detail.php?type=snippet&id=112
function getEnumValues($columnName=null)
{
if ($columnName==null) { return array(); } //no field specified
//Get the name of the table
$db =& ConnectionManager::getDataSource($this->useDbConfig);
$tableName = $db->fullTableName($this, false);
//Get the values for the specified column
$result = $this->query("SHOW COLUMNS FROM {$tableName} LIKE '{$columnName}'");
//figure out where in the result our Types are
//(this varies between mysql versions)
$types = null;
if ( isset( $result[0]['COLUMNS']['Type'] ) )
{
$types = $result[0]['COLUMNS']['Type'];
} //MySQL 5
elseif ( isset( $result[0][0]['Type'] ) )
{
$types = $result[0][0]['Type'];
} //MySQL 4
else {
return array();
} //types return not accounted for
//Get the values
$values = explode("','", preg_replace("/(enum)\('(.+?)'\)/","\\2", $types) );
//explode doesn't do assoc arrays, but cake needs an assoc to assign values
$assoc_values = array();
foreach ( $values as $value ) {
//leave the call to humanize if you want it to look pretty
$assoc_values[$value] = Inflector::humanize($value);
}
return $assoc_values;
} //end getEnumValues
So, that's it, you can now do the following in your controller:
function test()
{
$categories = $this->__getCategories();
debug($categories);
}
-Mandy.
Monday, February 12, 2007
Update: Inype Editor - New Release
So, the guys at Intype have come out with their next major release - 0.2.1.
This release is pretty cool and has lots of exciting features the 2 most important ones being drag and drop support and the ability to do Undo/Redo.
Here is the feature set for this release -
-Mandy.
This release is pretty cool and has lots of exciting features the 2 most important ones being drag and drop support and the ability to do Undo/Redo.
Here is the feature set for this release -
- Undo/Redo
- Reload Bundles — A huge help for bundle creators. Bundles can now be reloaded directly from the Intype UI, there’s no need to restart the whole application.
- CJK Support — Support for Chinese, Japanese and Korean over-the-spot input methods. I’d like to send a big thanks to Mr. Masahide Morio for teaching me the basics of Japanese.
- Tab/Space Switch Level 1 — Includes switching between hard and soft tabs (tab chars versus spaces). Conversions and automatic detection are planned for Level 2, that will be released as and update to 0.2.1.
- Drag/Drop File Support Level 1 — In response to many user requests. Level 1 supports dragging/dropping files to open. More to come with scripting support
- Editing Features — Move line(s) up and down; Duplicate line(s); Transpose characters; Vertical scrolling with keyboard; New variables for snippets.
-Mandy.
Wednesday, January 31, 2007
Wednesday, January 24, 2007
Finally a good Editor for windows: Intype
I am sure, like me most people who develop on windows, envy the mac users (among other things :) for the editor they use - TextMate.
Well, Well - it seems like there is a very promising new kid on the block - InType.
Checked it out today and I must say I am very impressed with it.
Although, it's still in it's Alpha (and probably too early to comment on) and lacks some obvious features like undo / redo, it's still very good to do actual coding - especially the XHTML, CSS & Rails support.
Try it out for yourself - download the latest build from here
What's even more interesting is that it's going to have CakePHP support very soon :))
-Mandy.
**Update: Seems like the cakePHP bundle has already been written by someone.
Check this out: http://intype.info/download/bundles/
Well, Well - it seems like there is a very promising new kid on the block - InType.
Checked it out today and I must say I am very impressed with it.
Although, it's still in it's Alpha (and probably too early to comment on) and lacks some obvious features like undo / redo, it's still very good to do actual coding - especially the XHTML, CSS & Rails support.
Try it out for yourself - download the latest build from here
What's even more interesting is that it's going to have CakePHP support very soon :))
-Mandy.
**Update: Seems like the cakePHP bundle has already been written by someone.
Check this out: http://intype.info/download/bundles/
Wednesday, October 11, 2006
Tuesday, September 12, 2006
SWFObject: Javascript Flash Player detection and embed script
SWFObject is a small Javascript file used for embedding Macromedia Flash content. The script can detect the Flash plug-in in all major web browsers (on Mac and PC) and is designed to make embedding Flash movies as easy as possible. It is also very search engine friendly, degrades gracefully, can be used in valid HTML and XHTML 1.0 documents*, and is forward compatible, so it should work for years to come.
Using SWFObject is easy. Simply include the swfobject.js Javascript file, then use a small amount of Javascript on your page to embed your Flash movie. Here is an example showing the minimum amount of code needed to embed a Flash movie:
<script type="text/javascript" src="swfobject.js"></script>
<div id="flashcontent">
This text is replaced by the Flash movie.
</div>
<script type="text/javascript">
var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7", "#336699");
so.write("flashcontent");
</script>
Read more here
* Pages sent as text/html, not application/xhtml+xml.
Using SWFObject is easy. Simply include the swfobject.js Javascript file, then use a small amount of Javascript on your page to embed your Flash movie. Here is an example showing the minimum amount of code needed to embed a Flash movie:
<script type="text/javascript" src="swfobject.js"></script>
<div id="flashcontent">
This text is replaced by the Flash movie.
</div>
<script type="text/javascript">
var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7", "#336699");
so.write("flashcontent");
</script>
Read more here
* Pages sent as text/html, not application/xhtml+xml.
Monday, September 11, 2006
Wednesday, September 06, 2006
The Decorator Pattern for JavaScript
beppu has written about the Decorator Pattern for Javascript.
He has provided a very very useful piece of code using which every object can now have a before() and after() method that would work like this -
before(‘method’, function() { });
after(‘method’, function() { });
This will provide us more flexibility in playing with objects and definitely reduce the code a little :)
Read more here.
He has provided a very very useful piece of code using which every object can now have a before() and after() method that would work like this -
before(‘method’, function() { });
after(‘method’, function() { });
This will provide us more flexibility in playing with objects and definitely reduce the code a little :)
Read more here.
Tuesday, August 29, 2006
IE + JavaScript Performance Recommendations
Pre-ajax days javascript was used mostly for form validations, image swaps or little dom manipulations here and there. Back then optimizing the code was of least importance because it never used to do anything significant (if I may put it that way).
Well, now things are very different. With ajax, we have javascript with a complete new look and lots & lots of code written in it. Anyone who has built an application using javascript would realize that sooner or later you are going to run into a situation where your code might start performing miserably. As long as 5-6 items were there, it ran fine but the moment we had to alter 100 rows, our application almost starts to die.
Here is where some good coding practices come into play.
I don't want to repeat what is covered in the article below, so take a look (the article is written with IE in mind, but it very well applies to FF too or basically better coding practices).
IE + JavaScript Performance Recommendations - Part I
Highlights-
Well, now things are very different. With ajax, we have javascript with a complete new look and lots & lots of code written in it. Anyone who has built an application using javascript would realize that sooner or later you are going to run into a situation where your code might start performing miserably. As long as 5-6 items were there, it ran fine but the moment we had to alter 100 rows, our application almost starts to die.
Here is where some good coding practices come into play.
I don't want to repeat what is covered in the article below, so take a look (the article is written with IE in mind, but it very well applies to FF too or basically better coding practices).
IE + JavaScript Performance Recommendations - Part I
Highlights-
- Declare var for variables that are meant to have local scope
- Cache Variables Whenever Possible
- Cache Function Pointers at all costs
- Avoid Using the ‘with’ Keyword
-Mandy
Monday, August 14, 2006
Wednesday, April 19, 2006
Technical evangelist
A technical evangelist is a person who promotes the use of a particular product or technology through talks, articles, blogging, user demonstrations, recorded demonstrations, or the creation of sample projects. The word evangelism is taken from the context of religious evangelism because of the similar recruitment of converts and the spreading of the product information through the ideological or committed; hence, for instance, open source evangelism.
In the context of commercial enterprises which develop or foster a cult following and religious-like fanaticism, the term evangelist can become an unofficial or even an official role/title. This usage was pioneered by Guy Kawasaki in Apple Computer's marketing of the Apple Macintosh (see Apple evangelist).
In the context of commercial enterprises which develop or foster a cult following and religious-like fanaticism, the term evangelist can become an unofficial or even an official role/title. This usage was pioneered by Guy Kawasaki in Apple Computer's marketing of the Apple Macintosh (see Apple evangelist).
Thursday, April 13, 2006
Form.Element.setValue()
You love prototype.js, and you use Form.Element.getValue() all the time. Here is the Form.Element.setValue() counterpart. The setValue() function can be found in prototypeUtils.js
Wednesday, April 12, 2006
DOMInclude
DOMInclude is a library that allows you to add inline dynamic includes of content rather than using window popups.
Tuesday, April 11, 2006
Monday, April 10, 2006
Hyderabad BarCamp - Postmortem
It's almost been 2 days since the hyderabad barcamp ended, but unfortunately I am getting time to write about it only now. Well, I haven't really been busy with anything, guess the heat is taking it's toll on me and I am just too lazy to do anything.
So, 5 of us (from the company I current work for), set out in almost 40 degree celcius on a lazy saturday afternoon (2pm) for this barcamp. Well, nothing could have got me out of my house on a holiday but my love for web 2.0 & ajax and all those cool buzz words was incentive enough for me explore this event. And moreover it was free...yes free! That means I could go there without having to convince anyone on why/how it was important for me to attend it ;)
It took us almost 45 minutes to reach there. The event was supposed to start at 3pm and by the time we reached there, we had given up all hope of getting a good seat. To our suprise we still had some good seats available (in the front and we quickly grabbed them).
Oh Ya! As soon as we reached there we checked in at the registration desk and got a lot of goodies (T-shirts courtesy cordys, stationary - fancy notebooks & pens courtesy progress and some more stuff courtesy pramati). It's always good to get such things..I somehow have a liking towards fancy notebooks :)
This event was taking place at the IIIT campus and I must say I was pretty impressed with the WiFi connectivity in their campus (even though I was not carrying a laptop - actually I don't even own one right now ..hehe!)
So, the event kick started by Ramesh Loganathan's Intro talk on Web 2.0. He gave us insights on how this term was coined by O'Reilly - how it created a buzz and it was clever marketing. He encouraged active participation from the audience and discussed a lot on how blogging, google, wikis, community sites, flickr, etc have changed the face of the WWW.
Following this was a talk by the CEO of Pramati - Jay Phullur. To be very honest, I didn't know who this guy was and I was least interested in his talk, but somehow when I got to know 5 minutes down the line that he was the CEO of Pramati (well, i don't know much about this company either, but then what the hell! he is the CEO man! he demands some attention :) I started listening to him. He was presenting on the opportunities web 2.0 had to offer and it turned out to be quite an interesting talk in the end. Obviously, for people present there it was great fun when Jay mentioned about his 70 year old dad and what kind of web interfaces (especially webmail) he wanted to use (and how he thinks the Yahoo webmail user interface is so crappy - well now that was enough to get some reaction by all those Yahoo folks who had flown down from Bangalore for this BarCamp:) Having worked a lot with the designers, I found Jay's dad's ideas actually pretty interesting...Might even try some of them. After that all questions & answers were in reference to Jay's dad :) I think he was probably the most famous guy out there (till the end of the seminar ppl kept giving examples with reference to him).
The next talk by Rajan (on Economics of Web 2.0) was a little disappointing. He spoke about the move from n^2 to 2^n and all the laws related to it and the importance of attention. The chap probably knew a lot but his presentation was of no use to me (at least..no offence! he was one of the organizers and definitely worked hard at organizing this event..only he should have worked a little harder on his presentation :) joke.
Sharad Singh Solanki (SAS) gave a nice presentation on Tangible User Interface Design. The videos that he showed just blew me out of my chair..they were really cool especially the Sony example (with all those tiles for data) was out of the world. I culd possibly find no relation of his presentation with AJAX or Web 2.0, but nevertheless, it was so interesting to know about an alternative user interface design.
Dr. Vishal Garg (IIIT) and Kamal (IIIT) presented their ideas on Open Journal and Maha System respectively. With all due respect, to me both sounded a little confused and were not able to present their ideas across. None of them made any sense to me.
Rajiv and Pavitar from Pramati gave a talk on XFORMS. This talk too was disappointing not because I don't like XFORMS but because these guys failed to convince the audience why XFORMS are needed. I think the participants should keep in mind to first speak a few words on why this technology is needed and why we should learn it. Everyone just comes and dives into their material and writing code :(
Anand from Cordys gave a presentation on showing off his company's product to be very honest. This was probably the most humorous presentation as this guy surely was a cartoon. He kept bashing every other company and was so proud of the product they had to offer. Obviously he had no idea about front end technologies as he kept saying that AJAX is rocket science and how javascript and dhtml are so difficult - well all ths while showcasing a product that itself was written in DHTMl..irony! irony! :)
Oh Well! sometime in between was a tea break where we were served snacks, tea, coffee & coke. The organizers definitely had taken care of us pretty well. Kudos to them!
All this while I was eagerly waiting for the Yahoo guy's talk because obviously he seemed to know a lot about web 2.0 and all. Finally his turn came around 8pm (while we were being served some pizza's for dinner, thanks sponsors! :) and everyone was hooked onto the talk. I must say some people (probably from cordys) might have already developed some disliking toward this guy as he was quite bored by their presention and also came across as someone who was very proud of the libraries his company had written.
To be very honest there was a air of attitude with the guy, but it was pretty constructive I must say. That guy was totally in love with his company / his work and I think that's a really good thing. He also seemed to know his stuff..demo'd some of the Yahoo library features and show cased the cool new Yahoo Avatars stuff.
I managed to win a Yahoo goody for asking some good questions..hehe! probably advantage of sitting in front. I won a wallet. I just wish they would have put some dollars into it :)
Finally, the last presentation of the day - "Into the mind of a shit scared entrepreneur" by Sunder. His was a nice talk. He seemed to have stared a startup with some of his friends after quitting his job and he took us through the ups and downs of starting a startup. Was a funny talk and quite interesting.
Phew! I am tired now. I think I should go get some sleep now!
The event was a huge success and I hope this kick starts more such events in hyderabad. More than anything else it was good to know / meet people working on similar stuff and how they approach problems in their projects.
Till Next Time,
Tata,
Great work organizers!
What is BarCamp?
So, what is this BarCamp? Is it the newest bar in town where everyone jams up to have lots of beer? Unfortunately not :(
In response to criticism of Foo Camp, BAR Camp was created as an open, welcoming, once-a-year event for geeks to camp out for a couple days with wifi and smash their brains together.
More...
What are Mashups?
A mashup is a website or web application that seamlessly combines content from more than one source into an integrated experience.
Content used in mashups is typically sourced from a third party via a public interface or API. Other methods of sourcing content for mashups include Web feeds (e.g. RSS or Atom) and JavaScript.
Much the way blogs revolutionized online publishing, mashups are revolutionizing web development by allowing anyone to combine existing data from sources like eBay, Amazon, Google, Windows Live and Yahoo in innovative ways. The greater availability of simple and lightweight API's have made mashups relatively easy to design. They require with minimal technical knowledge and thus custom mashups are sometimes created by unlikely innovators, combining available public data in new and creative ways. While there are many useful mashups, others are simple novelties or gimmicks, with minimal practical utility."
Content used in mashups is typically sourced from a third party via a public interface or API. Other methods of sourcing content for mashups include Web feeds (e.g. RSS or Atom) and JavaScript.
Much the way blogs revolutionized online publishing, mashups are revolutionizing web development by allowing anyone to combine existing data from sources like eBay, Amazon, Google, Windows Live and Yahoo in innovative ways. The greater availability of simple and lightweight API's have made mashups relatively easy to design. They require with minimal technical knowledge and thus custom mashups are sometimes created by unlikely innovators, combining available public data in new and creative ways. While there are many useful mashups, others are simple novelties or gimmicks, with minimal practical utility."
Sunday, April 09, 2006
Subscribe to:
Posts (Atom)