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

Opinion: Stock Market

These are the stocks in my portfolio now.

Ayala Corp - all the projects and their joint ventures are all positive.planning to cost average here .

Alcorn Gold (to be changed to Cosco) - a bit keen on this since it traded sideways for some time now.

EEI Corp- a very bullish price action. planning to hold medium-long term.

Alliance Select International - taking the chance to buy at below the market price .





Also checking on these stocks...


LC seems to have bounced from below 1. might plan a test buy.

OV too break the gloomy trend, but I would observe more. it just started to become volatile and can't tell if this will continue.


and MEG, would time to buy it on dips. for medium term hold.

Using Null values in SqlParameters Parameters.AddWithValue method.../ Stock Picks 2013


DEV/STOCKS

Week Ending November 30, December 1

It is no doubt that Philippines economy is slowly climbing up. Thanks to the effort of current administration that corruption is slowly being dealt properly. The growth of economy can be attributed to the government and people. It is a reflection of everyone's hope to reclaim Philippines as one of Asia's wealthy country. So, Philippines should speak slowly and carry a big stick on island disputes...

That said, this week has lots of events too.

XSLT and SEO - an actual result

...few months ago, we deployed an XML-XSLT website that contains rich data content. There are rumors that it doesn't do much in SEO. Since we can't just accept something unless we tried it ourselves, we decided to deploy a version of a blog website....


Commotion with BHI and SMC???

For those who might be wondering where in BHI disclosure is it, it was on the map... You cant find it because not even an airport is included in the PDF disclosure. it was an image after all...

...market portfolio

bought yesterday
FOOD (1.99)
bought today
GREEN 0.024
APM 0.128
OV 0.04





there seems to be a good news for APM....alcorn gold resources to be changed to Cosco?


Doesnt really interest me... Could this be a SELL on news?? whatever it is, i follow a trading discipline...

I will sell when it hits my target, be it gaining or losing

Sick Days: October 21, 2012

....My chronic recurring illness :( I rarely get seriously ill, but every year, I do get at least once bedridden experience while dealing with tonsillitis. I had many losses for this. Because of this sickness, I am unable to join the market craze on APM (Alcorn) and EG (E-games). 







Status for Week Ending October 5 2012

There is no more stressing than analyzing CDRs field by field... it was like a nightmare recurring over and over again, just like stressful days I had in Tokyo, that nobody can explain the business rules...














Problem with XSLT- blank referrer

It seems there is a problem with XSLT. Actually, it worked really nice and the loading speed of the site is greatly optimized but for one thing... this prevented the page from checking the origin of the request...


I think it works like this.... A page gets a request, XML is rendered to client with the XSLT, then XSLT is requested and after that process how the data should be displayed on the client side. Then, since the file is on the client side, all request made to it will have blank referrer, since it is on the client side... Of course, the browser will not forward your IP address as a referring page...

End of September

A lot have happened this month. I was too busy even to stay online because of recurring issues I had at work. This start of month has been unfortunate for us because my dad suffered stroke.


It just happened just after he woke up, and his left-arm and leg is paralyzed. Later, I learned it was a brain illness, caused by lack of oxygen supply (by the blood) to it. I had a situation like this before, first in Tokyo where I was staying alone. I just felt numbness in my arm, then next to it I can't move anymore. I thought it is just because of the weather because it happened on a winter. Then, when I returned in the Philippines, I had this just as I woke up. I can't move and just shouted for help, but I guess nobody was able to hear it. I tried to pull my numb arm up using my movable arm, and tried to move but didn't worked. Hopeless, I just resolved with a sleep. Fortunately, I recovered after a nap. Maybe a vein got clogged? Not sure what really happened, but it was scary.

We have to stay at the hospital for four days. I recalled the doctor saying my dad needs to be monitored for 48 hours. The experience is just horrible, and even made things stressful.



HIVES?

I'm taking a Ketosis-based diet that I avoid much carbohydrates in food. It is making me lose weight easily, but not much on the body mass. Things seems OK until I woke up and greeted by this...




It was terribly itchy. It would take a good patience not to scratch it. I took down a list of things I have consumed for the last 5 hours because allergic reaction can occur as early as an hour. I visited Medical City in Ortigas and have a dermatologist look at it. Again, I explained I was on Ketosis-diet, we don't have pets at home, I don't have allergies with Crabs or Shrimps nor I have taken those things for the past 24 hours at least, the doctor is clueless too, but she agree that those are allergic reactions. She gave me a prescription for Aerius (Desloratadine) 5mg. I used to take Alerta 10mg, but this is too strong and always makes me drowsy in an untimely situation, even a Venti Americano laced with White mocha can't make me alert. Aerius claims it doesn't make one sleepy, but actually it does. So, take anti-histamine tablets only when it is safe for you to sleep because ANTI-HISTAMINES WILL MAKE YOU FEEL SLEEPY. 


By searching, I'm able to find many disgruntled netizens who also is in Ketosis-mode and developed hives like this. I'm starting to think Ketosis has a factor in that hives for the folllowing reasons:

1. I remembered a time during my college days, it is my first time to take a high-alcoholic drink that hives appeared just after few minutes of taking it. 

2. Taking alcohol will make anyone lose water in them. When there is insufficient water in our body, gluconeogenesis (GNG) will not happen because water is required to make that happen. At this time, instead of taking energy from glucose, the body takes energy from our fats, producing ketones.
So, I think it is an educated guess. So, I decided to eat carbohydrates again as suggested by some netizens. Unfortunately,the hives is still sprouting like wild mushrooms. LOL


Then, I realized I was taking this drink the whole time. actually, I bought a dozen.









When I stopped taking it, the hives stops. It must be the culprit.(AHA!). I suppose those people who started to take carbohydrates back recovered from their hives because they are not using their low-carb artificial sweetener, which is also the reason why their body is reacting to it.


BULLIED SENATOR?

After a blogged accused Sen. Tito Sotto of plagiarism, instead of an apology, Sen. Sotto even provoked the owner of the blog to sue him. Instead of an apology, this is what netizens get.









The turn of events led to Senate President to approve an anti-blogger law (Anti-CyberCrime). This is approved by the President too. It can make anyone in the internet charged by criminal case and be sent to prison in an instant. How was that! :( Are we still living in a democratic country? Maybe we just need an internet censorship and we are a copy of China in terms of freedom-of-expression. I hope we get better government in the coming years.


ANTI ISLAM MOVIE?

Because of a stupid movie, the whole world went in a small chaos. US Ambassador in Libya was killed. 


Their prophet is portrayed as a bad person, to make it short. Read it here. [Anti-Islam Movie]





GLOBE IS DOING SOMETHING WITHOUT TELLING SUBSCRIBERS?

So could it be the reason why I only have almost 10% of my data rate and my connection dropping everytime a rain is about to pour? 


SCARY GAME?




 Had my hopes on this game, and disappointed me in the end. The game claims it is not a surprise game because of a good story, but it is the opposite. It is a surprise game without any story... BOOO!






STOCKS = > MONEY
Of course, if I will have free time from developments, I take time to analyze stocks. 


E-games has been on a downtrend for a long time. I'm just eyeing it, but would not dare to buy this. 




I was able to grab 20k shares of MPI at 4.14, which I disposed on 4.23 . I dont have any news after that.


PX is still red, and people at the forum are fighting other members. Scary talks again? I guess MVP is right about the government being unruly. "ANG GULO GULO NYO!" LOL














With the news, I feel like drooling to add more positions on OIL stocks. OV, OPM, PXP, APO. China doesn't seem to have dispute with Philippines anymore, but the Panatag Shoal remains roped.... 



Trillanes: A hero or a traitor?


The tension between Philippines and China cooled off a bit. Although, some Filipinos distrust Chinese anymore and continuously call to everyone for a mass-boycott of all Chinese related businesses, the standoff between Philippines and China is really one of the worst thing that happened. As a Filipino, I believe that the West-Philippines Sea deserves a recognition to neighboring countries and the exclusive economic zone as well. 

Then, Senator Trillanes began criticizing DFA Sec Del Rosario for his alleged failed negotiation with China that almost had the country on war with the China. Sen. Trillanes claimed to be a "back-channel" envoy to China.  


But on one of the Senate meeting, Senate President Enrile was accused by Sen. Trillanes of rail-roading a way to divide Cam-Sur, that would favor GMA. Instead, SP Enrile asked to Sen. Trillanes about the reports in Amb. Brady's notes where Sen.Trillanes asked the Ambassador not to take notes of their conversation and also have written there that Sen. Trillanes seems to be working in favor of the Chinese government. He simply walked out without answering the senate president's question....



Sen. Trillanes also said MVP is involved there, that fumes Mr. MVP and said... Trillanes is a liar.


I would agree with Mr. MVP.. "Ang gulo gulo nyo (govt)".


Here's an interview with Senate President Enrile..



http://www.juanponceenrile.com/view/245



WEB-DEV


Few things I like to discuss is about facebook comment plugin. If you are a developer having problems with the scrollbar, then simply check if you are floating it. It should go easily as a block element, but if there is a need for you to float it, wrapping it instead should do. Comments will appear below and should not need to scroll, provided that no height attribute is provided for the containing element.



Was asked to modify the site layout again... I might require more holidays for it... :(



...Wonder how long would it take for me to start-up my own company? :(


..good luck to our investments.


End of Ghost month?

Ghost month seems to have ended and stocks are starting to move north making new highs. I think stock price will continue this movement up to next year.

I'm still holding on to OIL stock that I'm keeping even on the dips. I took that opportunity to add consistently every month, regardless of the hearsay, the scary rumors on forums, and the consistent bragging of co-traders who gained significantly high just by day trading.

I friend suggested to me a tool for day trading called the Pivot Analysis Tool. I think this is a good starting point for those who don't have much time to look on the chart like me. Last week, I added some of RFM using this tool and I was surprised to see huge volume of unserved bid on closing, buying at the same price that I have. 

Also, another thing worth reading about investment is this article on inquirer's website.

business.inquirer.net/79214/know-thy-investment-but-know-thyself-too-2


although, it did not mention stocks, I think there are many stocks out there that can offer big gains with less risk, considering your investment period would be from medium-long term. 



The XML page cannot be displayed - Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. Access is denied. Error processing resource

The XML page cannot be displayed - 
Cannot view XML input using XSL style sheet.
 Please correct the error and then click the Refresh button, or try again later.


 Access is denied. Error processing resource




On my continued experiment on dynamic XSLT website. It seems that the browsers WILL NOT PROCESS XSL stylesheets if the URL in the href attribute is different to the current document's URL because of cross-domain issue. Although I understand that if they don't do this, every pages might end up X-Domain attacked, but having it denied even on same DOMAIN is just absurd...




So, if you got an XML laced with 


< ?xml-stylesheet type="text/xsl" href="http://sitename.com/index.xsl"?>






on any xml documents in http://sitename.com/myxmlfile.xml




the referenced stylesheet will be processed, but if your site does something like SEO optimization and handles specific file by subdomain...




< ?xml-stylesheet type="text/xsl" href="http://internal.sitename.com/index.xsl"?>






this will display for any xml documents under internal.sitename.com/myxmldoc.xml ... 






So, the browsers got a narrow understanding of cross-domains, treating it as cross-URL. It should be called Cross URL instead of cross domain protection.












 

C# - Windows form Combobox displays System.Data.DataRowView Instead of Display Member

I'm getting a query result, in terms of a DataTable/DataSet. Now, the problem here is that, on my ComboBox object, I already specified the display member and the value member. I'm also sure that the datatable/dataset has that column in the result.
 
Although I set all of these properties I still get "System.Data.DataRowView" displayed on all items.

Once an Item is displayed for the first time the value is OK but when I choose another item and the selected Item become inactive, its displayed text would show  "System.Data.DataRowView". 

I tried all the bindings, reset the selected index... but alas, to no avail.


Then, I realized that the part making it display all those System.Data.DataRowView is from the SelectedIndexChanged event. An exception there is preventing the binding to work properly. Correcting the code there fixed it.

Oil stocks gaining, except for PXP?

i had good gains with OV, and probably pxp...but now, my supposedly gain in portfolio is balanced by my loss in pxp. if only i didn't listen to some forums and blogs of technical chartist...


..lesson? believe no one even they are reputed to be a super technical financial analyst.. because your loss will be 100% yours..

FTP Upload using C# The remote server returned an error: (550) File unavailable (e.g., file not found, no access).

This error just bumped into me while working with 2 web hosting company. I had almost identical deployment setup for two website. Then, I have a main FTP account that I use to transfer all the files in the server. But I really don't want to use this FTP account as it has a right to the root folder, so I created another FTP account that only has access to a certain folder. This way, I am setting up a little security on the website.

But when I am test deploying my website, I get errors whenever the GetRequestStream method of the FtpWebRequest object.


The remote server returned an error: (550) File unavailable (e.g., file not found, no access).

Which was weird, because I have done this before on the website with my main FTP account. Whenever I will access the ftp site with explorer, I also can't connect. 

After googling a lot of failed solutions, I decided to try few things on my own. I tried to add folder similar to the folder structure in the root (so it looks like MainFolder/SubFolder/MainFolder/SubFolder) .


Then I tried to run my application again and I'm able to add the file smoothly.
I don't like the workaround because I simply tells me to update the already built code and perform another round of testing..

I hope the web hosting company can still find a way... Workaround is OK, but it is a lame excuse.

Setting Datagridview TexboxCell into multiline mode like a Textbox control

Once again, I'm having my sleepless afterwork stress... so I decided to open my computer and do some dev work to lessen the remaining task before deployment and content writing.

Fortunately, we can also set the texbox like column in datagridview control to be a multiline textbox, without adding codes to cast our controls.. All with the use of designer view. On the datagridview control, we have to locate the Collection property and choose the desired datagridviewtextboxcolumn. From there, we navigate on the DefaultCellStyle property and set the WrapMode to true.

Also, we have to set the AutoSizeRowsMode of the datagridview control to AllCells. 

After this, when we add or type contents to the cell, it will expand automatically. Sweet, isn't it?

SQL XML query escapes HTML tags

     just after the big show stopper, I'm now dealing with another one..

Lets say for now, I have something like this

SELECT 'and i'd give up forever to touch ' 'line'
UNION
SELECT 'you cause i know that you feel me so love, your the closest to heaven that i've ever been ' 'line'
UNION
SELECT 'and i don't want to go home right  ' 'line'

UNION
SELECT 'now  and all i can taste is your sweetness ' 'line'
UNION
SELECT 'and all i can breath is your life ' 'line'

FOR XML PATH('test'),TYPE


and, I run it... I'll get those angle brackets escaped (< and >)




fortunately, there is a way to still make those angle brackets, but will lose the XML thing by using value


SELECT 'and i'd give up forever to touch ' 'line'

UNION
SELECT 'you cause i know that you feel me so love, your the closest to heaven that i've ever been ' 'line'
UNION
SELECT 'and i don't want to go home right  ' 'line'

UNION
SELECT 'now  and all i can taste is your sweetness ' 'line'
UNION
SELECT 'and all i can breath is your life ' 'line'

FOR XML PATH('test'),TYPE).value('(/test)[1]','NVARCHAR(MAX)')

will keep the angle brackets, but it is once again, an NVARVCHAR field...

much of an interest, but doesn't help me because I have a large nested XML PATH query.. :(


XSLT8690: XSLT processing failed and all HTML are displayed as mere text

You checked for the encoding, you checked for the xsl output set to html, and even removed all the comments before the xsl template but still you are getting. All the contents displayed as plain text and when you checked your developer tool,

XSLT8690: XSLT processing failed

And frustrated to take hit on google to find the solution? well, relax because I encountered this once and even wasted almost a week worth of things to do because it works in Chrome, it works in Firefox, it works in Safari, but NOT IE...(8 or 9 too).


If I've done it right, then how come it is displaying properly in other browsers and NOT IT... I understand how you feel..


But the real reason is, you "might" have screwed it a little and those non-IE friends just wouldn't mind about it. Too bad that it will not tell you where did you get wrong (even if you sing out loud.. LOL).


We don't know where it got penalized by IE,so we're asking .NET side where. Using XslCompiledTransform.


It is simple, just instantiate XslCompiledTransform object and pass true in the constructor like this.

XslCompiledTransform sparemyxsl = new XslCompiledTransform(true);
sparemyxsl.Load(pathToYourStyleSheet);


Even if this stylesheet is using include or import, once you invoked the Load method, it will process all related XSL stylesheets, merge it and check what's going on. It will throw an exception when it finds something bad.


On my experience, I accidentally added an extra line of include that also refers to the same xsl file. It is a good start. (^_^). I hope you can find the fault part. 

Happy Coding.



and don't forget the namespace for XslCompiledTransform

System.Xml;
System.Xml.Xsl;

Adding stylesheet to XML document.

I am currently working on a web enhancement where XML datas are passed on the response object. It seems that the website will serve as a service point for some request. Since it is in XML format, it can be consumed by some applications with minimal parsing. Even with javascripts and XSLT too, which makes it really flexible.

Right after it is fetched from the database, the result is in Scalar form XML, thanks to SQL's XML PATH, which removes XML parsing from data resultset.

Doing this with XML LINQ is pretty easy.

XDocument xml = XDocument.Parse(stringFromDataBaseScalarResult);
var pi = new XProcessingInstruction("xml-stylesheet","type=\"text/xsl\" href=\"yourxslfile.xsl\"");
xml.Root.AddBeforeSelf(pi);
doc.Save(Response.Output);




or without LINQ




XmlDocument xml = new XmlDocument();
xml.LoadXml(stringFromDataBaseScalarResult);
XmlProcessingInstruction pi = xml.CreateProcessingInstruction("xml-stylesheet","type=\"text/xsl\" href=\"yourxslfile.xsl\"");
xml.InsertBefore(pi,xml.DocumentElement);
xml.Save(Response.Output);


I have to find some better clean way on the second one, because my initial attempt using Append method placed the processing instruction at the bottom of the xml document, although the stylesheet is still applied. It is an eyesore to some. (including me... hehe).

 



 

Global.asax events are not triggered for static files

One of the great thing to handle dynamic website is to manipulate the output of the page by request. From writing handlers, modules or simply handling the Global.asax events. But just when you had that idea, something will discourage you to prevent using that idea and consider doing an even more tiring (and probably messy) way of doing.

To be able to handle static files in global.asax, we have to change something in the IIS. For 6 and below, it can be done on the server by checking the property of your website. On the application configuration (under home directory tab, click configuration button and the handler tab should be displayed), select a specific static file and click insert. Confirm that the "Verify that file exists" checkbox is NOT checked.


For IIS 7, this is a bit easier. Just be sure to have your application pool to be configured under "Integrated" pipeline and have these in the config file.

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true" />
system.webServer>
 
After this, IIS  should really handle all the request.

FB Connect