Skip to navigation

Dave_f

Who’s in charge? Using _set_invalid_parameter_handler to avoid GPF’s

Friday, April 15th, 2011

Don’t you hate it when the system knows better than you? I have coded my open file so not only can the user specify the file name they can also set the C open mode. OK, this assumes they know what they are doing (there is an option not to enter it and it will sort it out for you) and many would say that assuming a user is competent is a HUGE mistake. However, I am a user too and maybe I would like to set the mode manually sometimes. Why? I don’t know why – if I knew why I could have coded the option! Maybe in 10 years time they’ll be a new mode I want to support, maybe I want to specify Unicode, whatever, one day I might know better than I know now so why limit the thing?

Anyway, I allow the user to set the mode and if they set an invalid mode the open fails & I tell them. Not on windows. Using MS’s fopen if the mode is invalid it throws an exception and closes the whole app. Thanks Bill.

To avoid this you need to code an over ride to the invalid_parameter_handler. eg

//write a pointless handler
void myInvalidParameterHandler(const wchar_t* expression, const wchar_t* function,
const wchar_t* file,
unsigned int line,
uintptr_t pReserved)
{
// do nothing because the error return handles it anyway, thanks for the extra work Bill
}

// set hook to pointless handler
_invalid_parameter_handler was_invalid_parameter_handler= _set_invalid_parameter_handler(myInvalidParameterHandler);
_CrtSetReportMode(_CRT_ASSERT, 0);
if ((fopen_s(&fp_, fn, mode)!=0) || fp_==NULL){
messageBox( “Cannot Open File\”%s\” mode \”%s\”"), fn, mode);
}
// set handler back to where it was
_set_invalid_parameter_handler(was_invalid_parameter_handler);

Posted in: Software

Permalink

Five Billion wasted on wrong mobile contracts

Monday, April 11th, 2011

76% of mobile phone subscribers are on the wrong tariff, paying on average £200 a year more than they should. So says
http://www.billmonitor.com/national-billmonitor-mobile-report

This is all the fault of IT. Companies have so many tools to analyse their businesses they can offer specific contracts to seemingly infinitesimal market segments. You would think IT could also sort out the consumer and get them the right deal with sites like http://www.confused.com/ and the above http://www.billmonitor.com/.

However, about the oldest saying in IT is GIGO – garbage in, garbage out. The results are only as good as the data and individuals can’t figure out exactly how many minutes they will use and what is the dollar risk of going over vs. going under. Stats always favour the big boys as a) they can afford to do the analysis and b) the size of the population evens out the anomalies.

What consumers need then is a contract with their average number of minutes free but an insurance scheme to cover them if they over run. Insurance is the individuals way to spread the risk and even out the anomalies.

Given this will take the slack out of the contracts, providers will have to put up rates. That plus the insurance premiums will probably cost on average about £200 a year. No savings but you’d know you were on the “right” contract.

Posted in: Random

Permalink

Decaffeinated? What’s the point?

Monday, April 4th, 2011

On occasion I drink decaffeinated coffee and even alcohol free lager but I can’t imagine me reading a de-godded bible

http://news.bbc.co.uk/today/hi/today/newsid_9445000/9445961.stm

http://www.amazon.co.uk/Good-Book-Secular-Bible/dp/0747599602/ref=sr_1_1?ie=UTF8&qid=1301911817&sr=8-1

Initially it seems pointless but thinking about my drinking I guess I go with those options when I want the pleasure of the drink but can’t handle the effects of caffeine or alcohol. So I suppose if you want the pleasure of a read without any serious effect you may want to read a “The Good Book: a secular bible” – but if you want to wake up in the morning or reach some level of relaxation / intoxication or change your life you need the real thing.

Posted in: Off Duty

Permalink

webOS Connect – tweet central

Friday, April 1st, 2011

An exciting night at webOS connect,

http://www.itpro.co.uk/blogs/2011/03/21/developing-for-mobiles/

http://webosconnect.com/en/home/home
I live a sheltered life but I have never seen so many people tweeting at one event. There were various presentations all enthusing about webOS and its new development environment. My favourite presenter was ubershinysheep (AKA Ben Tattersley) – youth and enthusiasm are always going to win in a 10 minute slot.

The key new thing seems to be display scale-ability – the same app running nicely on a phone or a slate. That and a much nicer development environment – but they always claim that. The key buzz word is Enyo – you can do your own google.

Have a look at http://search.twitter.com/search?q=%23webosconnect for some tweets – if that’s your thing, if it isn’t then maybe you shouldn’t be doing mobile development.

Fun with LaTeX

Monday, March 28th, 2011

All right, calm down, not that kind of fun or indeed that kind of latex, “LaTeX” is no typo, it’s a typesetting / document layout language
http://en.wikipedia.org/wiki/LaTeX

If you have need to layout tricky documents or, as in the case of a friend I was helping at the weekend, write a document full of special symbols it’s just what you need. Of course it is from UNIX and was used with TeX. Which is good because it is open source and you can use free software like
http://www.xm1math.net/texmaker/
to produce PDF documents with weird and wonderful symbols – for all elements members of curly C mapped to gamma to the power theta anyone?

It was quite nostalgic to work with non-WYSIWYG text editing but also frustrating. There doesn’t seem a way to map the PDF back to the source – when you spot an error in the final product it’s a case of searching the source for the relevant text. Fortunately Texmaker does take you to the problem line if the “compiler” throws an error. We got there in the end though!

Tags:

Posted in: Misc, Software

Permalink

Developing for mobiles

Monday, March 21st, 2011

Since HP acquired Palm webOS has had a lot more going for it. HP seems to want it on all platforms, not just phones
http://www.hp.com/hpinfo/newsroom/press/2011/110209xc.html

The idea of an OS that runs on your PC, slate, phone, MP3 player, …. seems nice for users and a joy for developers – though it could put a few of us out of a job, the hours I’ve spent porting apps from one OS to another have kept me in work and mortgage payments many a time!

The idea of an OS written with the web in mind also seems a good one.

Anyway, if you are interested try a google, but I’d suggest
http://www.palm.com/us/products/software/webos2/ & http://developer.palm.com/
as good starters.

And if you want to get more involved on a less virtual level try
webOS CONNECT London Kick-off
http://www.amiando.com/webosconnectlondon.html

I’m off to polish my java / java script!

MadBid – pay £27 for £600?

Thursday, March 17th, 2011

Sorry, I know I’m supposed to be all cutting edge and that but I have only just come across http://uk.madbid.com/ although it has been up and running for a few years.

As far as making money off the web it is very clever. As a “pay to bid” site you have to register and pay 30p for every bid and each bid is only 1p more than the current value. The auction only closes when no one bids for a set time (eg 20 seconds).

For a auction to reach 26.76 the site receives 2676 * 30p or about £800. If there are only 2 bidders that’s about £400 each, more bidders, less each. I’d be happy to pay £426.76 to win £600 cash! Or better still, just make the one winning bid and pay £26.97!!

BUT, if you don’t win then you’ve paid your £400 for nothing… Which is why some people would rate this type of site as gambling.

The site owners point out that it takes skill and determination and some people consistently win more than others so it isn’t a game of chance. You could say the same about poker and even blackjack if you card count…

Posted in: Misc

Permalink

Pure DAB Con

Wednesday, March 9th, 2011

I wanted a nice little dab radio I could carry round and I was bought the Pure One Compact as a present. Hopefully the giver isn’t reading this as it is a bit pants.

Not only does it have a bit of a naff UI requiring manipulation of buttons on the top and the side just to change channels (and pressing the button on the side really needs two hands or it falls over!) it also loses its presets with sickening frequency. Requiring more clicking and scrolling and pressing and holding to put them back.

My old Tesco value one was easier to use in general but setting the presets was horribly complicated. In fact the only time that lost its presets was when I deleted them all trying to save a new one! Hopefully this will last a good deal longer than the Tesco which just died one day (and is no longer made) and it does sound a lot better.

The other problem with the Tesco one was it ate batteries at an alarming rate (as DABs do – back to my frequent complaint that turning off analogue broadcasting is an environmental disaster!). The Pure One has rechargables, oh wait it has a recharging circuit and takes a battery pack “sold separately”.

As this is marketed as a “portable” radio can I sue because it isn’t portable unless you buy another bit of kit at £25 to go with it?

Could anyone get away with selling a laptop without the batteries???

Posted in: Green, Misc, Off Duty

Permalink

Taking a break – from the net?

Tuesday, March 1st, 2011

Sorry, I’m sure you missed my enlightening blogs but I spent last week away and had no web access. We debated taking the laptop and hanging out in such wi-fi zones as Costa & Macky D’s but bravely decided we didn’t need it.

We could have done with google & google maps a few times and the lack of iPlayer & on (or off) line games in the evening meant a trip to poundland for a pack of cards but all in all we managed.

I can email & browse from my trusty tiny screened samsung if desperate but I never got THAT desperate and you wouldn’t want to have read a blog entry I keyed using numeric keypad!

Posted in: Off Duty

Permalink

Massive Amounts of Big Language Abuse

Tuesday, February 15th, 2011

IT and the US are both major sources of corruption – of the English Language at least. HP has just acquired Vertica
http://www.vertica.com/

and I was going to blog of the IT business implications but can only get as afar as
“Customers Can Analyze Massive Amounts of Big Data at Speed and Scale”

Where else could you read “Massive Amounts of Big Data”? You only have to look further down the page before you hit a “monetizing”. Eugh!

Anyway, hopefully this is part of HP’s commitment to high value, high return software rather than low margin hardware.

Categories

Authors

  • Davey Winder
  • Jennifer Scott
  • Maggie Holland
  • Thomas Brewster
  • alan_lu

Archives

advertisement

Advertisement