Web Dev Matters and Me

Web Development Matters - HTML, XML, C#, .NET, AJAX/Javascript(jQuery), CSS, XML-XSLT

ME - LIFE,Philippines, Tokyo, ECE, PhilNITS/JITSE,情報処理, 日本語

things about Philippines, gaming, C# development and web development, how to make money in stock trading

Web Dev Matters and Me

It always doesn't have to happen on the server side (^_^)

The task I had days ago got a bit more complicated. We're able to track cross-request for any files in the server, but what they want is to track "ALL" the links. And yes, including the bookmarks. (ouch).

Since it doesn't trigger a page request, I had to think of an idea to make it happen. Simply, by injecting javascrip
t on cross request, and have that javascript listen to the click event, I should be able to track which link. How? Thru AJAX. 

Then, I'm able to get thru with it. But then again, the hardest part is to get a portion of text, and have it recorded on the db as well. To make it worst, there is no specific formatting in it. I have a link that points to an anchor[name], but the code I need to isn't in there, it was on the next table row, on the first table field, wrapped in a font tag (yes, very old and doesn't even enclose attribute values in " ), wrapped in a b (bold) tag.

Ok, the fix was a hack... I don't have a choice, right? So with javascript, it happens like this.

1. Find all the a in the page with an attribute name
2. Need to iterate finding the parent until it hits a tr parent
3. Then, find the sibling of this tr parent.
4. On this element, check the first child
5. Find the child elements, and check if it contains the pattern I'm looking for
6. If it does, find all the a with href equal to # and the attribute name of the bookmark
7. Assign an attribute to the link, some attribute I can later get the value and post thru AJAX.

really complex, actually if I can just tell them "Go change the format, some other format like XML", I should have done it earlier...  

 
Oh well, on my trading life... I'm able to gain from OV for a profit. The loss I had handling JAP stocks are fully recovered by my trades in OV for only 2 days. Maybe I'm just lucky this time.


On Feb 20,2012 I'm able to buy OV for at 0.044 (1/5 of my total position acquired) and 0.043 (4/5 of my total position acquired.).

After 3 days, It was on the new HI of 0.057 and I set my cut-loss at 10% of this price (supposedly 0.049), but the situation at that time made me decide to sell it. I'm able to sell all at 0.053.

So on average, I gained:

(0.053-0.044) x 1/5 =0.18% x # of shares
(0.053-0.043) x 4/5 = 0.8% x # of shares

Quite a sum, so I took this time to share the blessing. (^_^)

The price had a slight correction at 0.045.


Then, I bought back 1/5 of the shares (OV) so I won't be left. I also bought PNB. As of the time of writing, I had PNB, OV, PNX, PGOLD and RLC. Now I don't have to be worried having a sudden drop in prices, just what like it happened to the JAP stocks (Ni, ORE) I hold few days ago.

At the time I realized my loss in NI and ORE, I thought of placing my money in a stock that can be less risky. Simply by checking the dividends, I'm able to pick RLC, OV and PNX. RLC and OV will share their blessings this march, while PNX gives me a promising dividend offer to  be announced soon.


With the exception of PGOLD and PNB, which doesn't have a consistent dividend pays, PNB's merger with Allied bank will take effect soon. The trade price is near 70 so, I don't have to wait any longer now. I think the 70/sh price will be higher in the coming days. A merger makes the surviving company bigger, so I think it should be a low risk, hi reward investment.

PGOLD too has a juicy merger with S&R cooking in progress (^_^).




What doesn't kill, makes one stronger

Due to market volatility, and the bad news about greeks debt last week, the market was in a selling spree. JAP stocks got hurt badly, and I even lost quite some money around 80K php estimates on my positions for NI, ORE and GEO. But last friday, it proved that it cannot stand the selling spree anymore and marked a good reversal indicator (^_^)

Also, I'm eyeing for stocks like this one.

but since, it is not yet official, I think the price will rally after March 8,2012 which is the expected annual meeting for this stock. 

PGOLD too seems to just made a critical SPL. I'm pretty sure swing traders knew what will happen next week.


Everyone is into OV too, since OIL and GOLD seems to create another new high.


Setting the market things aside, I'm given a task to track  click request for all FAQ files. This web application must able to log info about the user who clicked the link, the link that was clicked, the time it was clicked, etc. Somebody suggested to use some parsing, but I believe this is like eating soup with a fork, so I simply suggested tracking cross request in Application's Authenticate Request.

Well, it can be on Begin Request, but since we need to identify the user who clicked the link, it has to be on the Authenticate Request, just after the begin request occurred. It lies on the System.Security.Principal namespace.

While things seems to be sweet-sailing on my dev (and as I thought it would be on the server), things didn't worked right. I have to identify the IIS version running on the server and the version of .NET framework... then gotcha, it was on IIS 6.0 all along and defaulted to .NET 2.0 (ouch), so no LINQ for now.

We asked the onshore engineer to allow us to access the test server and see if we can configure something. Earlier test showed that, by default, IIS 6 screens the file in request, then decide on it's own, not passing the info to ASP. I believed it was related to ASPNET_isapi.dll, but didn't catch that early as I'm doing an SSRS task on other hand as well. Seems like I can juggle, huh. LOL!

A little bit on how it was handled, IIS 6 (or maybe 5 too) by default screens static files. HTML,SHTML, css, etc. as long as it is not defined on the list of file types it can handle on the configuration, it will not pass the request information to any handler, so to speak. So it is important to configure the handler mappings, and have it point to

Windows\Microsoft.NET\Framework\[.NET VERSION HERE]\aspnet_isapi.dll



After configuring that, everything worked like a charm! I really love web dev.

Now to get back on my personal web dev. I'm supposed to enjoy a weekend now, but without the market to keep me awake, it would only be Web Dev for me. 







FB Connect