Without below code, if your user control is bigger than browser's resolution, the scrollbars will not show.
private void Application_Startup(object sender, StartupEventArgs e)
{
ScrollViewer root = new ScrollViewer();
root.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
root.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
root.Content = new MainPage();
this.RootVisual = root;
}
Sunday, August 8, 2010
Saturday, July 24, 2010
Annoying PHP warning - Cannot modify header information
All of sudden I got below error -
"Warning: Cannot modify header information - headers already sent by (output started at XXXXXX.php:23) in XXXXXX.php on line 143"
WTH!
Then searched online and found out that you should not have white spaces or blank lines before "?php", and after "?". Did that, still got the same error.
Do more researching..., and found out this - In the PHP.ini file, you need to turn on the buffer.
"output_buffering = On"
After I updated the this PHP.ini file, this annoying error is finally gone now.
"Warning: Cannot modify header information - headers already sent by (output started at XXXXXX.php:23) in XXXXXX.php on line 143"
WTH!
Then searched online and found out that you should not have white spaces or blank lines before "?php", and after "?". Did that, still got the same error.
Do more researching..., and found out this - In the PHP.ini file, you need to turn on the buffer.
"output_buffering = On"
After I updated the this PHP.ini file, this annoying error is finally gone now.
Sunday, July 11, 2010
Silverlight navigation - open a pop-up screen
Some useful code: Navigate to the next page in a pop-up window in Silverlight 3, if pop-up is allowed. If not allowed, navigate to it in the same window.
"HtmlPopupWindowOptions options = new HtmlPopupWindowOptions();
options.Left = 0;
options.Top = 0;
options.Width = 600;
options.Height = 400;
if (true == HtmlPage.IsPopupWindowAllowed)
{
HtmlPage.PopupWindow(new Uri("http://www.yahoo.com"), "new", options);
}
else //if pop up not allowed, to render it in the same page
{
HtmlPage.Window.Navigate(new Uri("http://www.yahoo.com", UriKind.Absolute));
}"
"HtmlPopupWindowOptions options = new HtmlPopupWindowOptions();
options.Left = 0;
options.Top = 0;
options.Width = 600;
options.Height = 400;
if (true == HtmlPage.IsPopupWindowAllowed)
{
HtmlPage.PopupWindow(new Uri("http://www.yahoo.com"), "new", options);
}
else //if pop up not allowed, to render it in the same page
{
HtmlPage.Window.Navigate(new Uri("http://www.yahoo.com", UriKind.Absolute));
}"
Sunday, July 4, 2010
PHP Trouble-Shooting and Self References
Session Warning
Problem: Start getting session warning today - "Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/dbconnect.php:10) ..."
Solution: To fix this issue, I had to move "session_start();" to the begining of the page. Then it all started working fine. This was not an issue before. I read from some posts that if you are using cookie based session, you need to call this statement before anything else. Anyway, log this for future reference, in case I forget about it, as I always do. ;)
Problem: Start getting session warning today - "Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/dbconnect.php:10) ..."
Solution: To fix this issue, I had to move "session_start();" to the begining of the page. Then it all started working fine. This was not an issue before. I read from some posts that if you are using cookie based session, you need to call this statement before anything else. Anyway, log this for future reference, in case I forget about it, as I always do. ;)
Friday, June 4, 2010
Wrap my little head around MVC and JQuery
Went to the code camp in Portland this year. Attended a MVC session. The instructor was really great. However during the session, I couldn't stop but wonder – “does MVC brings us back to the old programming world, where we only had ASP scripting language, and JavaScript to do all the magic for us?” Confirmed by the instructor that - in the MVC world, AJAX toolkit is gone gone, page cycles are gone too. There is no page behind code. However, the control looks close enough as code-behind for me, even though the instructor said it is not. For AJAX, well you can still use JQuery, which is what? Duh, JavaScript. Will research on about MVC to understand why people become fan of it...
The same instructor also gave a very informative session about JQuery. JQuery is nice. Now you can forget about the getElementByID() to retrieve object one by one. With a few line of code, you can do so much now. Nice and short! Here is a nice JQuery cheat sheet for easy access later...
Finally, I realized why this same instructor taught both sessions. MVC needs JQuery to do AJAX. ;)
The same instructor also gave a very informative session about JQuery. JQuery is nice. Now you can forget about the getElementByID() to retrieve object one by one. With a few line of code, you can do so much now. Nice and short! Here is a nice JQuery cheat sheet for easy access later...
Finally, I realized why this same instructor taught both sessions. MVC needs JQuery to do AJAX. ;)
Subscribe to:
Posts (Atom)

