I've been working on some price tables on our website today and we want to make sure everything is formatted correctly based upon the users culture. Obviously you would assume that the the CultureInfo.NumberFormat would be the way to go and, for the most part, it is. If you want to format your numbers to have seperators in to break them up or format a currency string with a currency symbol then you're laughing,
decimal.ToString("N0", cultureInfo) will give you your number with the correct seperators in the correct places i.e. 10000 becomes 10,000 in en-GB culture.
decimal.ToString("C2", cultureInfo) will give you your currency string, i.e. 100.59 becomes £100.59
All is well, or is it? What do you do if you want the "pence" symbol for a culture i.e p or ¢? There is no property on the NumberFormat object to do this for you, at least not that i could find.
Anyone know what i'm missing here or have a decent workaround? I've got by for now with string manipulation but that involves hard coding the p or ¢ into the code. If we decide to introduce a new currency with a different symbol then it will require a code change.
Thursday, 20 September 2007
Monday, 3 September 2007
System Convert Class
As they say, every day is a school day. I was getting an "Invalid Format Exception" when trying to read a VAT rate from a config file and convert it to a decimal using Convert.ToDecimal(). It turns out that the Convert class by default uses
I was testing a website and i had my CurrentCulture set to French which meant the value of 0.175 for the VAT rate was no longer valid as in France the currencyDecimalSeperator is ',' not '.'
Because our config entries will all be in English i created a NumberFormatInfo object which could then be passed into the Convert method call and it all works fine.
CurrentCulture.NumberFormat.CurrencyDecimalSeparator
I was testing a website and i had my CurrentCulture set to French which meant the value of 0.175 for the VAT rate was no longer valid as in France the currencyDecimalSeperator is ',' not '.'
Because our config entries will all be in English i created a NumberFormatInfo object which could then be passed into the Convert method call and it all works fine.
MMO Beta testing
A couple of weeks ago i was lucky enough to recieve an email from mythic entertainment inviting me to partake in the WAR (Warhammer Age of Reckoning) beta. Now, unfortunately, i can't tell you any more than that because of the NDA (None Disclosure Agreement).
MMO (Massively Multiplayer Online) Betas are a bit of a mixed bag in my experience. The purpose of a Beta in an MMO game is to play as much of the game as possible reporting everything you find wrong with the game from text that is miss aligned to game breaking holes in the world and hardware crashes.
However, a lot of people just see them as a chance to play the game for free. They run round, complain when things don't work and never submit a bug report for the entire duration of the beta. Partly this is due to a lack of tools to do this. In past betas i have played you would need to hit print screen to take a screen shot, log out of the game completely and then write a complete bug report which then needs to be emailed or posted on a forum. For people to report everything they see, while it's fresh in their minds you need in game tools to do this. That way even the people who just want to play for free can just open the tool, write a few sentences and carry on with their game while contributing to the process that they agreed to when siging up for the beta.
I've played a few betas in the past at various stages from open beta which is generally a stress test for the final build, through to early closed beta where some of the content hasn't even been finalised and released. And then there have been games like Neocron which were released in a worse state than some of the early betas i've been involved in, anyone play that game? It had loads of potential but should have undergone better testing before release!!
Anyone reading this have any thoughts on betas they have been in, which were good ones which were bad ones? What made them that way? Obviously you can't talk about current betas because of the NDA's that companies use so keep the comments to past games! Hopefully my PC will be fixed soon and i can get back to the WAR!
MMO (Massively Multiplayer Online) Betas are a bit of a mixed bag in my experience. The purpose of a Beta in an MMO game is to play as much of the game as possible reporting everything you find wrong with the game from text that is miss aligned to game breaking holes in the world and hardware crashes.
However, a lot of people just see them as a chance to play the game for free. They run round, complain when things don't work and never submit a bug report for the entire duration of the beta. Partly this is due to a lack of tools to do this. In past betas i have played you would need to hit print screen to take a screen shot, log out of the game completely and then write a complete bug report which then needs to be emailed or posted on a forum. For people to report everything they see, while it's fresh in their minds you need in game tools to do this. That way even the people who just want to play for free can just open the tool, write a few sentences and carry on with their game while contributing to the process that they agreed to when siging up for the beta.
I've played a few betas in the past at various stages from open beta which is generally a stress test for the final build, through to early closed beta where some of the content hasn't even been finalised and released. And then there have been games like Neocron which were released in a worse state than some of the early betas i've been involved in, anyone play that game? It had loads of potential but should have undergone better testing before release!!
Anyone reading this have any thoughts on betas they have been in, which were good ones which were bad ones? What made them that way? Obviously you can't talk about current betas because of the NDA's that companies use so keep the comments to past games! Hopefully my PC will be fixed soon and i can get back to the WAR!
Exploding Power Supplies & RMA's
Well, it was an eventful week last week, i turned on my PC at home and nothing happened. So i checked the usual stuff, is the rocker switch at the back set to "ON", does the plug socket work... Everything seemed fine so i guessed the fuse had blown in the plug. I didn't have a spare fuse but i had a spare "Kettle Lead" which i plugged into the pc and then into the mains.
The resulting BANG and sparks, mere inches from my head, was a bit of a shock, followed closely by a burnt smell. I've only had the PC for about 6 months so i raised a support call with the supplier and they were suprisingly quick at coming back with an RMA form for me to return the power supply. The real kicker is that it will take 2 - 3 weeks for them to get a power supply back to me, that's assuming they have 1 in stock! Surely it doesn't take that long to figure out that the lump of molten plastic inside the power supply means it's broken.
I must admit though, every time i've contacted the support department they've been very quick in generating a response and it's been a pretty good response in most cases so i guess i'll just have to be patient.
The resulting BANG and sparks, mere inches from my head, was a bit of a shock, followed closely by a burnt smell. I've only had the PC for about 6 months so i raised a support call with the supplier and they were suprisingly quick at coming back with an RMA form for me to return the power supply. The real kicker is that it will take 2 - 3 weeks for them to get a power supply back to me, that's assuming they have 1 in stock! Surely it doesn't take that long to figure out that the lump of molten plastic inside the power supply means it's broken.
I must admit though, every time i've contacted the support department they've been very quick in generating a response and it's been a pretty good response in most cases so i guess i'll just have to be patient.
Monday, 20 August 2007
Rolling back...
It's been a busy couple of weeks here at the esendex office. What with introducing transaction scope and testing it. Then finding problems with it and rolling it back it's been hectic to say the least. Now we've had a request to add some more functionality to our ActiveX component so it's time to get back into the joys of things like log4cpp and C++.
I should get round to making some progress on my send sms gadget this week or next but we have an impending release so i guess we'll see how that goes first.
I should get round to making some progress on my send sms gadget this week or next but we have an impending release so i guess we'll see how that goes first.
Friday, 3 August 2007
iGoogle URL Gadgets
I've had a couple of hours this afternoon playing with iGoogle and gadgets again and i've decided that i will create a URL gadget that will effectively be a series of 3 pages. The first to send the message using form post and the other two as success / failure pages which in turn will re-direct back to the send page.
We already support this setup with formpost so i haven't got to write any backend code and by using a URL gadget i can get the layout done easily with 3 small web pages. I will also need to get the user prefferences (username, password and account reference) stored in the gadget itself so as not to clog up the gadget with unnecessary fields.
Hopefully i'll get a full day on this next friday and i'll be able to share my findings here, if not i'll try and update with what progress i make.
We already support this setup with formpost so i haven't got to write any backend code and by using a URL gadget i can get the layout done easily with 3 small web pages. I will also need to get the user prefferences (username, password and account reference) stored in the gadget itself so as not to clog up the gadget with unnecessary fields.
Hopefully i'll get a full day on this next friday and i'll be able to share my findings here, if not i'll try and update with what progress i make.
Tuesday, 31 July 2007
iGoogle and Gadgets
Well it's been far too long since i posted, i've been fairly busy with getting married and honeymoons and stuff, but i'm back now and hopefully i'll be updating this a lot more frequently.
I was looking into how to get google desktop gadgets added to googles gadget page last night and i came accross some interesting comments about google desktop being able to add gadgets made to run on iGoogle but not the other way around. So i grabbed the standard "Hello World" gadget for iGoogle and tried to host it. Apparently iGoogle doesn't let you add gadgets hosted on your localhost so i uploaded it using Google Page Creator as recommended in the google gadget sdk documentation. This worked a treat, i uploaded the xml file for hello world and was able to add the gadget to my iGoogle page and to my google desktop sidebar.
After trying this i think it's worth doing some work to get an iGoogle gadget working and looking nice that can also be added to Google Desktop, i'll keep you posted on my progress.
I was looking into how to get google desktop gadgets added to googles gadget page last night and i came accross some interesting comments about google desktop being able to add gadgets made to run on iGoogle but not the other way around. So i grabbed the standard "Hello World" gadget for iGoogle and tried to host it. Apparently iGoogle doesn't let you add gadgets hosted on your localhost so i uploaded it using Google Page Creator as recommended in the google gadget sdk documentation. This worked a treat, i uploaded the xml file for hello world and was able to add the gadget to my iGoogle page and to my google desktop sidebar.
After trying this i think it's worth doing some work to get an iGoogle gadget working and looking nice that can also be added to Google Desktop, i'll keep you posted on my progress.
Subscribe to:
Posts (Atom)