For those of you who are doing .NET development, if you have the trouble of finding out what references what in string.format to output exactly what you want. Here is a guide: -
formatting stringsThere's not much formatting that can be applied to a string. Only the padding / alignment formatting options can be applied. These options are also available to every argument, regardless of type.
example output
String.Format("--{0,10}--", "test"); -- test--
String.Format("--{0,-10}--", "test"); --test --
formatting numbers
Number formatting is culture dependant. For example, formatting a currency string on my laptop will return a result like £9.99, formatting a currency on a machine set for the US region would return $9.99.
specifier type format output
(double 1.2345) output
(int -12345)
c currency {0:c} £1.23 -£12,345.00
d decimal
(whole number) {0:d} System.FormatException -12345
e exponent / scientific {0:e} 1.234500e+000 -1.234500e+004
f fixed point {0:f} 1.23 -12345.00
g general {0:g} 1.2345 -12345
n number {0:n} 1.23 -12,345.00
r round trippable {0:r} 1.23 System.FormatException
x hexadecimal {0:x4} System.FormatException ffffcfc7
custom number formatting
specifier type format output
(double 1234.56)
0 zero placeholder {0:00.000} 1234.560
# digit placeholder {0:#.##} 1234.56
. decimal point placeholder {0:0.0} 1234.6
, thousand separator {0:0,0} 1,235
% percentage {0:0%} 123456%
In addition there is the group separator; this is useful for varying the format, depending on the value of the parameter passed. For example
String.Format("{0:£#,##0.00;(£#,##0.00);Nothing}", value);
This will output "£1,240.00" if passed 1243.56. It will output the same format bracketed if the value is negative "(£1,240.00)", and will output the string "Nothing" if the number is zero.
date formatting
Date formats are very dependant on the culture information passed. The examples below are shown using the UK culture.
specifier type output
(June 8, 1970 12:30:59)
d Short Date 08/06/1970
D Long Date 08 June 1970
t Short Time 12:30
T Long Time 12:30:59
f Full date and time 08 June 1970 12:30
F Full date and time (long) 08 June 1970 12:30:59
g Default date and time 08/06/1970 12:30
G Default date and time (long) 08/06/1970 12:30:59
M Day / Month 8 June
r RFC1123 date string Mon, 08 Jun 1970 12:30:59 GMT
s Sortable date/time 1970-06-08T12:30:59
u Universal time, local timezone 1970-06-08 12:30:59Z
Y Month / Year June 1970
custom date formatting
specifier type output
(June 8, 1970 12:30:59)
dd Day 08
ddd Short Day Name Mon
dddd Full Day Name Monday
hh 2 digit hour 12
HH 2 digit hour (24 hour) 12
mm 2 digit minute 30
MM Month 06
MMM Short Month name Jun
MMMM Month name June
ss seconds 59
tt AM/PM PM
yy 2 digit year 70
yyyy 4 digit year 1970
: seperator, e.g. {0:hh:mm:ss} 12:30:59
/ seperator, e.g. {0:dd/MM/yyyy} 08/06/1970
--It's helped me tremendously :)
Wednesday, 15 July 2009
Tuesday, 14 July 2009
Any Good Free Virus Checkers out there??
Apart from the usual Norton's anti-virus, I pondered if there were any decent free virus checkers out there...after much searching for the ultimate virus checker, I stumbled upon this avast! which looked pretty impressive, with three/four seperate components to scan your computer - standard, network, p2p, and mail shield but after 2 months of using it, I don't think it is that comprehensible, and useful to people as it doesn't really notify you many messages such as if it is scanning or not.
I typed in the keywords best virus checker, and found this post. Following my instincts, I will find out if this free virus checker is any good and keep you posted.
"Alice J" <> wrote in message
newsRJFc.3072$
>| I need a good virus checker. FREE please.....I don't want AVG
>| because I heard it fails a lot of tests. I won't use or pay for
>| kaspersky because I don't trust Russian spammers. And Nortons just
>| sells rubbish.
>|
>| Can someone recommend the best FREE virus checker that I can
>| download??....One with
>| regular updates PLEASE!! ;o)
>|
>| Alice
This will get you free for a year - auto updates, all that. And it's better
than AVG.
http://www.my-etrust.com/microsoft/
I typed in the keywords best virus checker, and found this post. Following my instincts, I will find out if this free virus checker is any good and keep you posted.
"Alice J" <> wrote in message
newsRJFc.3072$
>| I need a good virus checker. FREE please.....I don't want AVG
>| because I heard it fails a lot of tests. I won't use or pay for
>| kaspersky because I don't trust Russian spammers. And Nortons just
>| sells rubbish.
>|
>| Can someone recommend the best FREE virus checker that I can
>| download??....One with
>| regular updates PLEASE!! ;o)
>|
>| Alice
This will get you free for a year - auto updates, all that. And it's better
than AVG.
http://www.my-etrust.com/microsoft/
Thursday, 9 July 2009
OCZ's Sabre OLED Gaming Keyboard Launched

For those of you who are super-gaming geeks, there is a much cheaper OLED Gaming Keyboard with 9 "tactile" OLED gaming keys on the far left hand side launched by OCZ.
It boats a tilt of 5-10 degrees, a digital image that can be converted to any design onto the OLED button which in turn lights up programmable to do anything such as a macro or command in a game or a shortcut key in Windows, and has even a blue LED side light effect around the edges of the keyboard.
See the link http://www.zipzoomfly.com/jsp/ProductDetail.jsp?ProductCode=10010701
Sunday, 28 June 2009
An fully comprehensive review on the best against the iPhone
If you wanted a good review comparison on the best of smart phones comparing with the new Apple 3GS ipHone, look here: -

See also http://www.wired.com/gadgetlab/?p=19800. Well I can tell you that the Google G1 phone is very close with its Andriod OS, but in terms of readily available apps, it is now way near the popularity of the iPhone. I also heard the HTC Touch HD is very close aswell which is tied down with Vodafone, dunno why that isn't on there.

See also http://www.wired.com/gadgetlab/?p=19800. Well I can tell you that the Google G1 phone is very close with its Andriod OS, but in terms of readily available apps, it is now way near the popularity of the iPhone. I also heard the HTC Touch HD is very close aswell which is tied down with Vodafone, dunno why that isn't on there.
Friday, 19 June 2009
Apple iPhone 3GS is out now!

So the Apple iPhone 3GS is out in the shops today, which coincides with the CES event, and the recent Apple yearly conference show.
What are the key features that improves over its predecessor?
For starters, it begins with either 16GB or 32GB of storage space on the phone.
Its generally faster(hence its notation of S for speed) perhaps via its much improved OS system and circuitry, it apparently is 3.6 times faster to load between two programs running at the same time, and improved RAM which states is 256MB.
Improved Camera which is now 3 Megapixels rather than the basic 2, but it has the funcionality of recording videos this time which is a huge plus, dunno why it wasn't in the first two versions.
And the biggest thing is the voice control where you can speak within the built in microphone to play a song within the music play list or to dial someone by saying their name that's in the contacts list.
The thing I am looking forward to is the Nike + functionality that is supposedly built into the iPhone that can record the distance you have run when you switch on the Nike+ application, just pondering how that works, possibly using it in conjunction with GPS perhaps.
See http://www.macworld.co.uk/ipod-itunes/news/index.cfm?newsid=26296 for more information.
How much is it?
If you’re new to the iPhone then you will need to pay either £87.11 or £184.98 for the 16GB iPhone 3G S (depending on whether you pay £30, £35, or £45 per month). Or you get it free on the whopping £75 per month tariff.
Or if you want the PAYG, then it is £440 for 16GB and £538 for 32GB.
Friday, 12 June 2009
Getting all the fields in the structure Color
If you ever wanted to know how to get all the colour fields in the structure COlor, you can use the following bit of code:
Type t = typeof(Color);
System.Reflection.PropertyInfo[] colours = t.GetProperties();
foreach (System.Reflection.MemberInfo c in colours)
{
// How you would use c, cboxBackColour is a combo box
cboxBackColour.Items.Add(c.Name.ToString());
}
Basically, System.Type class uses the typeof method that can then be adopted to get all the properies within that class using reflection.
Type t = typeof(Color);
System.Reflection.PropertyInfo[] colours = t.GetProperties();
foreach (System.Reflection.MemberInfo c in colours)
{
// How you would use c, cboxBackColour is a combo box
cboxBackColour.Items.Add(c.Name.ToString());
}
Basically, System.Type class uses the typeof method that can then be adopted to get all the properies within that class using reflection.
Monday, 1 June 2009
The new HTC Magic by Vodafone
The all new HTC Magic by Vodafone, that has a larger 3.2 inch screen and HSPDA which includes GPS navigation for Google Maps™.
See http://shop.vodafone.co.uk/shop/mobile-phone/htc-magic
See http://shop.vodafone.co.uk/shop/mobile-phone/htc-magic
Friday, 15 May 2009
Animator Vs Animation
It's amazing how people can create these videos using just Flash, a lot of time and effort must have been put in for this creativity!
Friday, 1 May 2009
Packages!!

Found today's xkcd comic strip quite funny, now looking at eBay, you don't get quite the level of quality for 99p, see http://cgi.ebay.co.uk/MAKE-150-A-DAY-WITH-BUM-MARKETING-SECRETS-EBOOK-ON-CD_W0QQitemZ290309278574QQcmdZViewItemQQptZLH_DefaultDomain_3?hash=item290309278574&_trksid=p3286.c0.m14&_trkparms=72%3A1688%7C66%3A2%7C65%3A12%7C39%3A1%7C240%3A1318%7C301%3A0%7C293%3A3%7C294%3A50 and http://cgi.ebay.co.uk/Tesco-Clubcard-point-codes-4-life-30-000-points-a-year_W0QQitemZ170327122070QQcmdZViewItemQQptZUK_Tickets_Trave_Vouchers_Coupons_LE?hash=item170327122070&_trksid=p3286.c0.m14&_trkparms=72%3A1688%7C66%3A2%7C65%3A12%7C39%3A1%7C240%3A1318%7C301%3A0%7C293%3A1%7C294%3A50.
Addition for the Visual C++ Developer
.gif)
For those of you developers that are still using Visual C++, a new Visual C++ 2008 Feature Pack has been added :) for Visual Studio 2008, so now it has been updated from a couple of years ago, click on here http://www.microsoft.com/downloads/details.aspx?FamilyId=D466226B-8DAB-445F-A7B4-448B326C48E7&displaylang=en for the download.
The new and improved feature and functionility includes a much more modernised user interface with now the supply of the Office Ribbon User Interface, see above diagram, amongst many other new controls like dialogue boxes to the Standard C++ library. Hurrah!
There is also an updated feature called Smart Pointers that allow dynamically created C++ objects to be carefully handled and ensures objects to be deletely safely with the library function auto_ptr in handling these C++ pointers. For instance the code below, allows the transfer of ownership from one application to another for the auto_ptr copy constructor, for allowing to share the same memory resource: -
shared_ptr
ASSERT(0 != sp);
// increase reference count of shared object
shared_ptr
ASSERT(0 != sp2);
ASSERT(0 != sp);
See http://msdn.microsoft.com/en-us/magazine/cc507634.aspx for more information.
Double check the logic
As part of the task, I had been given some logic from a specification like this, and have to code (similar to this) in C++: -
On paper
There are 6 categories, A, B, C, D, E, and F.
Two images, image1, and image 2.
if (category == "A" || cateogory == "B")
[
Output Image1
]
if (category != "B" || category != "B")
[
Output Image2
]
The code that I wrote: -
if (category == "A" || category == "B")
{
output(image1);
}
if (category != "A" || category != "B")
{
output(image2);
}
Now this is wrong in terms of the logic, which I had found out that if it specifies this in the logic, the code doesn't reflect this.
This is because, say category A can fall into both the if statements, its an OR statement so it can meet the criteria of category B
Solution :
if (category != "A")
{
//Fall into the next one
if (category != "B")
{
Output(image2);
}
}
This solves the logical error.
On paper
There are 6 categories, A, B, C, D, E, and F.
Two images, image1, and image 2.
if (category == "A" || cateogory == "B")
[
Output Image1
]
if (category != "B" || category != "B")
[
Output Image2
]
The code that I wrote: -
if (category == "A" || category == "B")
{
output(image1);
}
if (category != "A" || category != "B")
{
output(image2);
}
Now this is wrong in terms of the logic, which I had found out that if it specifies this in the logic, the code doesn't reflect this.
This is because, say category A can fall into both the if statements, its an OR statement so it can meet the criteria of category B
Solution :
if (category != "A")
{
//Fall into the next one
if (category != "B")
{
Output(image2);
}
}
This solves the logical error.
Thursday, 30 April 2009
16GB Sandisk USB Flash Drive for under £16
For some great computer bargains, have a look at this - http://www.play.com/PC/PCs/4-/6059462/SanDisk-Cruzer-Micro-16GB-USB-Flash-Drive/Product.html?cm_mmc=Froogle-_-PC-_-Flash+Drives-_-SanDisk%2BCruzer%2BMicro%2B16GB%2BUSB%2BFlash%2BDrive&source=5066&engine=froogle_pc&keyword=SanDisk+Cruzer+Micro+16GB+USB+Flash+Drive
Its a Sandisk 16Gb USB Flash Drive for £15.99 on play.com plus its got secutiy password protection incorporated in its software, bargain!
Its a Sandisk 16Gb USB Flash Drive for £15.99 on play.com plus its got secutiy password protection incorporated in its software, bargain!
Just had Microsoft SQL Server Managment Studio installed
I had just got my network administrator to install Microsoft SQL Server 2005 properly yesterday where I had needed the Microsoft SQL Server Management Studio, going to the folder in Start > All Programs > Microsoft SQL Server 2005 didn't show up the program initially, so I thought that this was not a defaulted program to be installed. After about an hour of installing the tools, it was good to go, and now can properly create databases on my local drive.
A tip is when installing the program, to have SQL Server Agent disabled instead of having it run all the time, and only load when the service is started, this cvan free up a bit more resources in the background, you can load it up in Microsoft SQL Server Management Studio just below Notification Services (hope that helps).
A tip is when installing the program, to have SQL Server Agent disabled instead of having it run all the time, and only load when the service is started, this cvan free up a bit more resources in the background, you can load it up in Microsoft SQL Server Management Studio just below Notification Services (hope that helps).
Wednesday, 29 April 2009
Updating NET3.5 for MSCharts

Problem: If you had any trouble updating MSCharts for NET3.5, where you find that simply installing NET3.5 doesn't just seem to work, and you receive the error message requiring the assembly 3.5.0.0.
Solution: If you try installing an executable file called MSChart1.exe, type in MsChart download in google, this does the trick and it updates any relevant dlls.
Reigniting the blog
My first blog entry for two years, its been a long while so I wish to update this blog more often; before I had no desire to add anything as it had been so generalised. My aim is therefore to add new entries at least once a week and I have changed my blog to orient towards any new applications or programming skills or hints and tips you might be interested if you are programmer (that is).
Subscribe to:
Posts (Atom)