Embedding Flash in Google Gadget !

A static flash play can be easily embedded using _IG_EmbedFlash() function in the gadget but since we need to load the xml according to the User Login preferences. I need to do some more modifications.

The issue I faced here is :

For security reasons, a Macromedia Flash playing in a web browser is not allowed to access data that resides outside the exact web domain from which the SWF originated.

Since google loads modules from 97.gmodules.com domain, extracting data from marketsimplified domain becomes external.

Cross-domain policy file has to be created to make it work.

(Ref: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14213&sliceId=2)

But still I didnt get it to work… unless on top of this, I have to do some workaround as described in this url…
http://www.scriptplayground.com/tutorials/as/Loading-remote-XML-in-Flash-8/

However finally… its up and running…

Import Tool – ScRUBYt

At first I tried String Wrapper tool using open-uri

Then I understood Tree wrappers tools that the HTML document can look very good in a browser, yet still be seriously malformed (unclosed/misused tags). It is a non-trivial problem to parse such a document into a structured format like XML, since XML parsers can work with well-formed documents only

But HTree and REXML is capable to transform the input into the nicest possible XML from our point of view: a REXML Document. ( REXML is Ruby’s standard XML/XPath processing library).

After preprocessing the page content with HTree, we have to unleash the full power of XPath, which is a very powerful XML document querying language, highly suitable for web extraction.

The powerful web scrapping tools in Ruby are mainly Mechanize and Hpricot. Hpricot is “a Faster HTML Parser for Ruby” out of other Rubyful-soup(HTree + XPath),scrAPI,ARIEL

www::Mechanize has the ability to automatically navigate through Web pages as a result of interaction (filling forms etc.) while keeping cookies, automatically following redirects and simulating everything else what a real user (or the browser in response to that) would do.

Mechanize is powerful lib BUT we cannot perfectly interact with JavaScript websites. That is, it cannot handle more than one redirects through javascript.

Using mechanize, attempts to gmail webscrap to get all mails (feed exists to get new mails only) and orkut scraps extraction could go through until there is no complex javascript to break.

At first tried to do google search and extract reditt articles using almost all libs.

Then Using Xpath and scRUBYt, I am able to extract details from finance.google.com in xml format.

To a certain extent scRUBYt which is combination of Hpricot and Mechanize on steriods, seems starting step to me to get finance.google.com portfolio.

Also,scRUBYt is faster than mechanize.

Program:

require 'rubygems'
require 'scrubyt'

google_data = Scrubyt::Extractor.define do
fetch 'http://finance.google.com'
click_link 'Portfolios'
fill_textfield 'Email', '<a href="mailto:kiransoumi@gmail.com">kiransoumi@gmail.com</a>'
fill_textfield 'Passwd', '----'
submit
fetch 'http://finance.google.com/finance/portfolio?action=view&pid=1'
click_link 'Transactions'
#Construct the wrapper
stockinfo "/html/body/div/div/table/tbody/tr" do
   symbol "/td[1]/a[1]"
   qty "/td[5]"
   price "/td[6]"
end

end

google_data.to_xml.write($stdout, 1)
Scrubyt::ResultDumper.print_statistics(google_data)

OUTPUT:
[MODE] Learning
[ACTION] fetching document: <a href="http://finance.google.com">http://finance.google.com</a>
[ACTION] clicking link: Portfolios
[ACTION] fetched <a href="https://www.google.com/accounts/ServiceLogin?hl=en&service=finance&nui=1&continue=http%3A%2F%2Ffinance.google.com%3A80%2Ffinance%2Fportfolio%3Faction%3Dview">https://www.google.com/accounts/ServiceLogin?hl=en&service=finance&nui=1&continue=http%3A%2F%2Ffinance.google.com%3A80%2Ffinance%2Fportfolio%3Faction%3Dview</a>
[ACTION] typing <a href="mailto:kiransoumi@gmail.com">kiransoumi@gmail.com</a> into the textfield named 'Email'
[ACTION] typing ---- into the textfield named 'Passwd'
[ACTION] submitting form...
[ACTION] fetched <a href="https://www.google.com/accounts/CheckCookie?continue=http%3A%2F%2Ffinance.google.com%3A80%2Ffinance%2Fportfolio%3Faction%3Dview&service=finance&hl=en&chtml=LoginDoneHtml">https://www.google.com/accounts/CheckCookie?continue=http%3A%2F%2Ffinance.google.com%3A80%2Ffinance%2Fportfolio%3Faction%3Dview&service=finance&hl=en&chtml=LoginDoneHtml</a>
[ACTION] fetching document: <a href="http://finance.google.com/finance/portfolio?action=view&pid=1">http://finance.google.com/finance/portfolio?action=view&pid=1</a>
[ACTION] clicking link: Transactions
[ACTION] fetched <a href="http://finance.google.com/finance/portfolio?action=viewt&pid=1">http://finance.google.com/finance/portfolio?action=viewt&pid=1</a>
Extraction finished succesfully!
  <root>
    <stockinfo>
      <symbol>IBM</symbol>
      <qty>22.00</qty>
      <price>22.00</price>
    </stockinfo>
    <stockinfo>
      <symbol>GOOG</symbol>
      <qty>10.00</qty>
      <price>270.00</price>
    </stockinfo>
    <stockinfo>
      <symbol>INFY</symbol>
      <qty>12.00</qty>
      <price>80.00</price>
    </stockinfo>
    <stockinfo>
      <symbol>INTC</symbol>
      <qty>4.00</qty>
      <price>18.00</price>
    </stockinfo>
  </root>

stockinfo extracted 4 instances.
symbol extracted 4 instances.
qty extracted 4 instances.
price extracted 4 instances.

Syndication of My MarketSimplified Portfolio Chart

Its Simple…
Just go to Google gadget Directory and search for MarketSimplified Portfolio Chart or
Click here

If you can click on "Add to your Webpage" button there, then you can reach a page where you can first configure your Gadget Settings by entering your MarketSimplified Portfolio User name and country. And then do some colouring and adjustment of the gadget size by dragging the ends.

Finally,Click on Priview Changes button below.  If you are confirmed and happy with your colorful changes, then click on "Get the Code" button just below the page.

Finally paste the code on your Weblog like me…

Top five rated Stocks and good Widget…

 

Coming up …! Soon rolling down on your hand…!

Increasing Download Rate per day…! Wow!

What happens when the new version of MarketSimplified Mobile App comes up…???

When was the last time you were confronted with a deluge of unnecessary information screaming for Msf_chart
your attention ?

Market Simplified :

1. World’s first totally user customizable Financial Homepage
2. Specialist Financial Search to give one click response to Financial queries
3. Safeguard your portfolio with a dynamic and perpetual alerts on a range of parameters
4. Carry your portfolio with you ; RSS feeds of your portfolio anytime
5. The stock markets in your hands with the MarketSimplified Mobile

Welcome to the world of Market Simplified! Investing simplified.

For users who use Smart Phones and have GPRS enabled, please lo g in to
www.marketsimplified.com/mobile
to download the latest MSF mobile application available ‘Over The Air’.

Yup..! Its Black…!! …its Berry..!!!

My Cubicle…

After a long (sick) break…

So far update as of now is… My cubicle… (I like the way it is …!)
My new Dell Xps laptop on left … Robo on right… My work PC in between…
And I am working on digging out the valuable Diamond app :)

Rain, Rain Go Away!

Rain, Rain Go Away ..!
I hate you all the way…

Dont come even some other day…
Rain, Rain Go… away .. !!!

Five Hot Technologies for 2007

   1. Ruby on Rails
        Faster, easier Web development (link)

   2. NAND drives
        Bye-bye, HDD?

   3. Ultra-Wideband
        200x personal-area networking

   4. Hosted hardware
        Supercomputing for the masses

   5. Advanced CPU architectures
        Penryn, Fusion and more

Further notes here

Day Trader’s Dilemma

by Lawrence Andraschko

from WallStreetPoet.com

Should I sell or should I hold?

If I hold there could be trouble,

But if I sell, the stock could double.

Am I weak or am I bold?

Should I sell or should I hold?

My stock keeps going up.

Better pour myself another cup.

All this coffee makes me jitter,

Have I picked another winner?

Am I weak or am I bold?

Should I sell or should I hold?

This indecision is killing me.

The price is falling and I have to pee.

Do I hold my bladder and my stock,

Or do I sell and use the pot?

Am I weak or am I bold?

Should I sell or should I hold?

The stock goes up and I wait no more,

I sell my shares and hit the floor.

A little profit beats a loss,

How I suffer as my own boss.

Am I weak or am I bold?

Should I sell or should I hold?

Nature keeps calling and I need a plan,

Maybe kitty litter or some sand.

Put it right beneath my desk,

Then I wouldn’t make a mess.

Am I weak or am I bold?

Should I sell or should I hold?

CSV in Ruby

To Create CSV file in Rails:

    @models = Model.find(:all, :conditions => ['...'])    rawdata = StringIO.new    CSV::Writer.generate(rawdata, ',') do |csv|      csv << %w(Title Total)      @models.each do |model|        csv << [model.title, model.total]      end    end

    rawdata.rewind    send_data(rawdata.read,      :type => 'text/csv; charset=iso-8859-1; header=present',      :filename => 'rawdata.csv')

To retrieve, here is the lib…

FasterCSV is intended as a
replacement to Ruby‘s standard CSV library. It was designed to
address concerns users of that library had and it has three primary goals:

  1. Be significantly faster than CSV while remaining a pure Ruby library.

  2. Use a smaller and easier to maintain code base. (FasterCSV is larger now, but
    considerably richer in features. The parsing core remains quite small.)

  3. Improve on the CSV interface.
  4. def retrieve_csv
       csv_file = params[:csv_file]    begin    Record.transaction do       fastercsv = FasterCSV.new( csv_file )      while row = fastercsv.readline        foo, bar = row        Record.create!( :foo => foo, :bar => bar )      end    end    redirect_to success_action_path  rescue     # do something with the error    flash[:error] = "CSV import failed"    redirect_to retrieve_path  endend

New View for my blog

Stand Apart From the Crowd…!

J2 Y-u-m-m-y points to be noted…

Fallacies of J2ME

The list of fallacies, according to Eric, are:

  1. Java programs “will just work” on J2ME
  2. KVM == J2ME
  3. KVM == CLDC and CVM == CDC
  4. J2ME replaces WAP

Fallacy 1: Java programs “will just work” on J2ME

Realistically, don’t expect to be able to run your existing Java applications unchanged on any J2ME platform. Apart from some technical issues (such as the CLDC 1.0 not supporting floating point), there will usually be two barriers: missing classes and resource problems. Not only do J2ME platforms subset the J2SE core classes, but they add some of their own unique classes as well. But even if you write code that only uses classes common to all the platforms you’re interested in, chances are that you’ll still have some work to do to optimize your application so that is uses less memory and has acceptable performance. Good design and modular programming will help a lot in this area.

This isn’t to say that you can’t reuse any code, just don’t expect to reuse it all.

Fallacy 2: KVM == J2ME

Many people use KVM and J2ME synonomously. They’re different things. The KVM is a Java virtual machine. J2ME is a set of specifications. Not every J2ME platform uses the KVM. The CDC, for example, uses the “classic” VM, not the KVM.

Fallacy 3: KVM == CLDC and CVM == CDC

In a similar vein, others use KVM and CLDC synonomously, or the CVM and CDC synonomously. Again, they’re different. The KVM and CVM are Java virtual machines, the CLDC and CDC are J2ME configurations.

The CLDC has specific requirements for its underlying VM, and the KVM can be configured to be that VM. The KVM in fact forms part of the reference implementation of the CLDC. However, there’s nothing preventing a specific CLDC implementation from substituting its own VM not based on the KVM source code. IBM’s J9 VM, used in recent Palm devices, is one such example. So is Research In Motion’s VM for the BlackBerry handhelds.

Similarly, the CDC has specific requirements for its underlying VM, and the CVM can be configured to be that VM. And yes, it too forms part of the reference implementation of the CDC. But CDC implementations can use their own VM, just like IBM uses its J9 VM in its CDC-based J2ME implementations.

Don’t get all worked up about which VM is used. As long as it passes the compatibility tests and meets the appropriate specifications, it generally doesn’t matter to you, the developer. The only time it matters is when performance is an issue and you’d like to switch to a faster VM. That said, remember that most handheld devices are closed platforms and only the platform vendor can actually install a different VM.

Cookie Caching

BES have the ability to handle cookies on behalf of client applications. In other words, any Set-Cookie headers sent back in HTTP responses can be intercepted by the BES (which is acting as a web proxy server) and stripped out of the response sent back down to the client. The cookie is then automatically inserted into subsequent requests by the client app when its request passes through the BES (again, in its capacity as a proxy server).

This cookie handling feature is not a feature but a bug according to Eric’s opinion. The basic problem is this: if a session cookie is used, there’s no way for the application to signal the BES that the “session” is finished. The normal behavior is for the client to clear session cookies when the session terminates. In a browser, this usually means when the browser is exited. In a J2ME application, the application simply stops sending the cookie in subsequent requests.

But since the BES is handling the cookies for you, when exactly does the “session” end? It doesn’t! So what happens is that you get a stale cookie being appended to your app’s requests.

The best solution? Turn off the BES-level cookie handling and let the application do the cookie handling by itself. All you do is set this property in the configuration file:

application.handler.http.CookieSupport = false

You can also set it directly from the BES management console.

Fallacy 4: J2ME replaces WAP

WAP is a set of technologies for wireless communication. It includes a markup language called WML for writing browser-based applications. You can find out more about these technologies at WirelessDevNet.com.

WAP and J2ME are different things, and each has its place when it comes to application creation and deployment. WAP (or really, WML and WMLScript) lets you build browser-based, thin-client applications optimized for wireless delivery. J2ME lets you build “thicker” client applications with more sophisticated logic and the ability to run in an “offline” mode. It’s really like trying to say: “which is better, a page of HTML or a Java applet?” Both are different, and both have their uses. Hopefully, though, J2ME won’t suffer the same problems that caused applets to fall out of grace so quickly. This is why the standardization process, industry support, and compatible implementations are so important for the success of J2ME.

MARCH marches on…

Time marches on and on,

And waits for None.

Happiness marches on and on,

With all the fun arouN(d).

Dreams marches on and on,

With all the trust and confidence Lights ON.

Learning marches on and on,

With all the new breaking technologies… go on!

Life in INXS marches on and on,

With a sweet remembrance of joining date on ….



20th March…!

… YY…ZZ…AA…GG…

Vizag Beach From Kailashgiri

Some more Good Pics

 
   

   
    

 

Why did the Tower of Babel Fail?

Now the whole earth used only one language, with few words. On the occasion of a migration from the east, men discovered a plain in the land of Shinar, and settled there. Then they said to one another, “Come, let us make bricks, burning them well.” So they used bricks for stone, and bitumen for mortar. Then they said, “Come, let us build ourselves a city with a tower whose top shall reach the heavens (thus making a name for ourselves), so that we may not be scattered all over the earth.” Then the Lord came down to look at the city and tower which human beings had built. The Lord said, “They are just one people, and they all have the same language. If this is what they can do as a beginning, then nothing that they resolve to do will be impossible for them. Come, let us go down, and there make such a babble of their language that they will not understand one another’s speech.” Thus the Lord dispersed them from there all over the earth, so that they had to stop building the city.

The Tower of Babel project failed because of lack of communication and of its consequent, organization.


“Schedule disaster, functional misfit, and system bugs all arise because the left hand doesn’t know what the right hand is doing.” Teams drift apart in assumptions.
Teams should communicate with one another in as many ways as possible: informally, by regular project meetings with technical briefings, and via a shared formal project workbook. [Or by electronic mail.]

« Previous PageNext Page »