I looked around for ages to get a ticking clock on my webpage and couldn't find one that would work in both IE and Firefox. Lots of javascripts sites and lots of not great scripts for a ticking clock.
However I found this site and implemented this solution really quickly and easily.
Dynamic Drive Ticking Clock
Great, have fun.
A blog to store guides and notes and help on coding. Mostly .Net C# SQL ASP.Net and other related technologies. I post on here things that helped me solve coding issues that I hope will be of help to others.
Wednesday, 30 April 2008
IE6, CSS Debugging Issues
Since today was spent debugging a css issue in IE6 I would like to post some solutions and development tools that are useful for this sort of thing.
Firstly the main issue that I seems to have was that images inside a table cell left a white space gap of about 3 pixels between bottom of the image and the bottom of the table cell.
The problem was that the vertical-align of the image in IE6 was defaulting to baseline, which apparently means its aligned vertically to the baseline of the text, meaning 3 pixel gap is left to accomodate the trailing tails og letters such as lower case g and y.
To fix this you must vertical-align the image using vertical-align: bottom;
While trying to debug this issue I found two very useful tools. In Firefox you can download the addon, FireBug, that will let you debug a webpage. There are also tools identical to this for IE6 and IE7 which are more handy because in my experience its IE that has more trouble rendering a web page correctly.
IE Developer ToolBar
IE DebugBar
Firstly the main issue that I seems to have was that images inside a table cell left a white space gap of about 3 pixels between bottom of the image and the bottom of the table cell.
The problem was that the vertical-align of the image in IE6 was defaulting to baseline, which apparently means its aligned vertically to the baseline of the text, meaning 3 pixel gap is left to accomodate the trailing tails og letters such as lower case g and y.
To fix this you must vertical-align the image using vertical-align: bottom;
While trying to debug this issue I found two very useful tools. In Firefox you can download the addon, FireBug, that will let you debug a webpage. There are also tools identical to this for IE6 and IE7 which are more handy because in my experience its IE that has more trouble rendering a web page correctly.
IE Developer ToolBar
IE DebugBar
Monday, 3 March 2008
using .Net ToString() to format currency values
A nice little bit of code to help display decimal values as currency and using the ever so helpful ToString() method. All you do is add in some format info as show below to tell it to format the string as a currency.
It will use the CurrentInfo property of System.Globalization.NumberFormatInfo the localization information to work out what currency to use. So for me the formatted string would be £142. The zero in the format string sets the number of decimal places to use.
To convert this value back to a decimal you can use this code below.
Just to be safe wrap this in a try catch block to catch System.FormatException errors which means that someone entered a value using the wrong currency type. SO if the CurrentInfo says the local currency should be US dollars $142 and someone uses pounds £142 instead it will complain.
Right cool, think that's just about that.
MPH.
decimal myMoney = 142.00;
string formattedString = myMoney.ToString("c0");
It will use the CurrentInfo property of System.Globalization.NumberFormatInfo the localization information to work out what currency to use. So for me the formatted string would be £142. The zero in the format string sets the number of decimal places to use.
To convert this value back to a decimal you can use this code below.
decimal myMoney = Decimal.Parse(formattedString , NumberStyles.Currency);
Just to be safe wrap this in a try catch block to catch System.FormatException errors which means that someone entered a value using the wrong currency type. SO if the CurrentInfo says the local currency should be US dollars $142 and someone uses pounds £142 instead it will complain.
Right cool, think that's just about that.
MPH.
Friday, 29 February 2008
GridView Select Rows Code 2.0
Simple link to a good post about how to make a Grid View row selectable without having a button at the end of each row, you can just click on the row to fire the onSelectedIndexChanging Event.
http://www.geekzilla.co.uk/
Linked Post written by : Paul Marshall
Here is a minor imporvement I made to the code written by Paul Marshall that just makes it easier to control the styling applied onMouseOver of the grid. I used it to change it so the whol row is highlighted rather than just underlining the text.
In GridView_RowDataBound I changed this bit of code to reference the my css file.
http://www.geekzilla.co.uk/
Linked Post written by : Paul Marshall
Here is a minor imporvement I made to the code written by Paul Marshall that just makes it easier to control the styling applied onMouseOver of the grid. I used it to change it so the whol row is highlighted rather than just underlining the text.
In GridView_RowDataBound I changed this bit of code to reference the my css file.
e.Row.Attributes["onmouseover"] ="this.style.cursor='hand';this.className='gridRollOver';";
e.Row.Attributes["onmouseout"] = "this.className='';";
A Belated Welcome to My New Blog
I created this new blog the other day when I realised I was starting to add lots of boring geeky programming stuff to my personal blog. The main problem with that is that my Wordpress blog isn't very customizable, the code quotes are crap and for some reason at the moment the edit tools are a bit broken.
So I decided to create a new blog just for all the boring coding tips and helpful hints I want to write about, mostly just as a place for me to collate stuff so I don't have to remember it in my head.
I was going to try a few different blog sites but Blogger appears to be really good and I quite like how customizable it is with so many templates and being able to edit the HTML directly for the template and CSS is much nicer than Wordpress so I'm just going to use this.
A link to my regular blog is in the side bar so I will still keep that going to write blog posts about general more interesting stuff than computer programming and save this bog just for the boring stuff.
MPH.
So I decided to create a new blog just for all the boring coding tips and helpful hints I want to write about, mostly just as a place for me to collate stuff so I don't have to remember it in my head.
I was going to try a few different blog sites but Blogger appears to be really good and I quite like how customizable it is with so many templates and being able to edit the HTML directly for the template and CSS is much nicer than Wordpress so I'm just going to use this.
A link to my regular blog is in the side bar so I will still keep that going to write blog posts about general more interesting stuff than computer programming and save this bog just for the boring stuff.
MPH.
Wednesday, 27 February 2008
Find Good Free Blog Templates
I just created this blog today and have been playing around with the formatting of it. I want to get a clear, easy to read and well organized template. Below is a link to the best template site you will find with hundreds of Free Templates for many different blogs.
http://www.eblogtemplates.com/
Also some nice CSS code to add a shaded boxes around areas for code or quotes:
http://www.eblogtemplates.com/
Also some nice CSS code to add a shaded boxes around areas for code or quotes:
blockquote
{
margin:.75em 0;
border:1px solid #596;
border-width:1px 1px;
padding:5px 15px;
display: block;
background-color: #dedede;
}
code
{
font-family: Courier;
margin:.75em 0;
border:1px solid #596;
border-width:1px 1px;
padding:5px 15px;
display: block;
background-color: #dedede;
white-space: pre;
}
SharePoint stsadm.exe and Powershell
Trying to run the SharePoint tool stsadm.exe in PowerSehll I get the following error:
To get stsadm.exe to work in PowerShell you have to edit the 'profile.ps1' file.
Look in C:\WINDOWS\system32\windowspowershell\v1.0\ and if it doesn't exist just create a new file and add the following code:
Now you can use stsadm in Powershell without it buggering up.
The term 'stsadm.exe' is not recognized as a cmdlet, function, operable program, or script file
To get stsadm.exe to work in PowerShell you have to edit the 'profile.ps1' file.
Look in C:\WINDOWS\system32\windowspowershell\v1.0\ and if it doesn't exist just create a new file and add the following code:
Set-Alias -Name stsadm -Value $env:CommonProgramFiles”\Microsoft Shared\Web Server Extensions\12\BIN\STSADM.EXE”
Now you can use stsadm in Powershell without it buggering up.
Subscribe to:
Posts (Atom)