Archive for the ‘technical’ Category

Dead machine part 2

Sunday, 5th August, 2007

[just a FYI - don't let this post stop the debate on tech books]

Careless careless careless.

http://forums.zonelabs.com/zonelabs/board/message?board.id=MalwareDiscussion&message.id=2466

Why oh why didn’t I google it first?, too complacent I guess (and it was getting late).

Seems like Zone Alarm killed my machine. Thats Zone Alarm *ANTI* Virus.

They recommended I delete my video driver! thanks guys!

And I thought Symantec was bad from taking up all my system resources, I don’t remember them telling me to kill my machine.

I’m happy to accept a proportion of the blame for being so naive and dumbly doing what they advised, but it still seems a bit poor from their side.

On a lighter note one of the guys on that forum followed the ZA advice and killed his machine, realised what he did, restored it, re ran the scan, then in a ‘Homer Simpsonesque moment’ thought he was attacked by the same trojan again and obediently killed his box again!

Looks like I’m gonna be changing AV vendor sooner rather than later!

I ran Windows in Safe mode (F8 on start up), re-installed the video drivers and rebooted normally. Everything is now working fine. I’m in the process of updating my virus defs before I get caught out like the bloke above!

So from 2 broken machines, I now have 2 working ones. cewl. I havent done any fee paying work, but now I have the machines to do it on. I actually went out yesterday to buy a new machine. But luckily (as it turns out) I couldn’t bring myself to pay so much more than internet price for so much less power, just to bring it home the same day.

And yes I guess this one wasn’t really MS/Windows fault either. In fact I think the AV community has kicked up a stink because MS specifically tried to prevent this type of AV driven blunder from killing Vista.

Lessons learnt: be even more sceptical, check properly - dont delete .inf’s willy nilly or was it .oem?.

I normally refresh my defs and immediately run a scan, I’m thinking I might update, wait 24hrs, check google, then run the scan in future. Anyone think that makes sense or already doing that?

Cheers

Simon

XLA design 2

Friday, 3rd August, 2007

So in the last post we basically got to:

  1. Don’t do temp work in the XLA (even though it almost certainly will not get saved (even if we try according to Ross!))
  2. Do stuff in a temp wb that is not hidden and appears when screenupdating gets turned back on. (Does anyone else get it so that screenupdating doesn’t come back automatically sometimes?)

Now I’m not going to disagree with that but…

If things do go wrong the user is going to get left with an inconsistent (but visible) workbook sitting in their environment that they may not know what to do with.

If its in the XLA and it fails, it will do it quietly, or maybe with a polite warning. They may be able to rerun it and everthing work or they restart Excel and re-open the add-in and everything should be sweet (in theory!). That seems potentially a better option to me? Especially as you can now grab the restart to fix things up.

I’m thinking of some transitory problem like the network bouncing, or a resource temporarily locked.

The other issue I have is messing with the users Excel environment, I like the PED approach of dropping an xla in xlstart to fix things up after a crash, but must confess I have never done that in practice. Have any of you? Has anyone ever copied the .xlb and restored that on failure/recovery? Finding it/them is hard I know!

The other potential option I keep coming back to (thinking about) is automating another Excel instance, doing all the background stuff in there and then bring it back to their current environment if it succeeds. Of course if that goes bang they are going to end up with loads of invisible Excels dragging their system down. I’ve done this with VB/.net apps, and managing those zombie Excels can be a pain. Has anyone done this from an XLA? maybe its inappropriate if you are generally working on the active wb?

I’m really trying to come up with a rock solid add-in approach, that isn’t going to give the users any frights or suprises. Its not enough to be careful, add-ins do crash, and when they do, they usually take the whole Excel instance with them. Well actually thats not true, COM add-ins tend to fail on their own and don’t bring Excel down.

I’m beginning to think there is no clear winner approach. It seems there are pros and cons to both the ‘hide-it-till-its-ready’ approach and the ’show-all-workings’ approach. Do you think target user ability might be a factor, as well as the add-ins job?

As a matter of interest, if you are not using the worksheets in your xla for anything much, why dont you use a COM add-in instead? is it deployment/tool access (VB6 or Dev Office), or other factors?

Cheers

Simon

Possibly rescued machine

Thursday, 2nd August, 2007

I have been messing with the old box that always blue screened in Windows, but seemed to run ok with Ubuntu live. First off it did eventually die running the live CD so it wasn’t just a Windows problem, in fact it wasn’t a Windows problem at all. (assuming that it keeps running whilst I type this of course).

The Ubuntu CD came with a ‘check memory’ option, now I thought PCs did this on start up anyway. But if this box was doing a memory check it wasn’t doing it very well. The Linux tests highlighted lots of memory failures. I took out all the sticks of RAM, except 1 (the biggest). And Lo, all is well. (so far).

As a matter of interest all the Windows blue screens, were ‘to protect my pc’, and reported a different failing file each time.

So sorry to Microsoft and to Windows for incorrectly pointing the finger of blame, wtf to PC boot up ‘memory checks’, and well done to Linux for having some easy to find proper memory checking utils.

I still have the broken lapper to deal with, but I was thinking I should probably do some real work at some point.

cheers

Simon

Another dead box

Wednesday, 1st August, 2007

I managed to kill my Windows internet machine yesterday. Thats keeps my average at 1-2 dead machines per year. I’ll hold my hands up and admit its quite often my own fault.

I’m not keen to take the blame for yesterdays adventures though. I virus scanned the machine (with Zone Alarm, (rapidly losing its status as my fave AV)), it claimed one .dropper virus and quarantined a file. It also said I should delete the file, so I did - doh!

I won’t be so trusting next time!

I know this is a software thing and not hardware because its a dual boot, and it runs fine in Linux.

I have another machine that died last year, I have just left it gathering dust because it really looked like a hardware fault. Today it dawned on me that if it runs a live Linux CD then it can’t be a hardware problem and is probably another broken Windows installation.

So here I am in Firefox on Ubuntu edgy eft, no blue screens in sight, which leads me to the inescapable conclusion that I have 2 broken Windows installations not 1.

So, hot tip: use a live CD as a quick check of hardware health.

And a question, Whats your preferred Anti Virus?

(And/or whats your preferred internet pc (and/or development pc) setup?)

Cheers

Simon

Ribbon for Visual Studio

Friday, 6th July, 2007

Harlan asks:

‘what would you all think of MSFT replacing the Visual Studio UI with a ribbon?’

I’ve always thought the ribbon is a novice interface, although MS disagree. In fact I said to the ribbon team that I would accept it was not a beginners UI as soon as it was incorporated into VS.

As I see it developer/professional tools as far as MS are concerned = SQL Server and VS (C# of course). Amateur/ non pro tools is Office and everything else. Devs get a decent UI that they can customise to improve their productivity, amateurs get the ribbon so they can’t confuse themselves (and the VBAIDE from decades ago!).

I’m assuming Orcas (VS 2008) doesn’t have the ribbon??

The big shame is that MS did not cater for the wide breadth of usage, and user ability, working on the Office platform this time around. I’m still hoping for something useful in SP1.

What does everyone else reckon?

cheers

Simon

Source Control

Tuesday, 29th May, 2007

Charlie asks what people do for source control?

A very good question, and one I would like to know more about too.

Me, I don’t really bother with formal source control for Excel based projects, mainly because its a binary format. If I do an Excel/VBA job the VBA part will probably secondary to the worksheet stuff, and that doesn’t go well into any source control that I know of. I tend to keep multiple copies of the workbook so I can go back to any point. I have tried using SourceSafe with VBA, but it seems a bit pointless to control the code, but ignore the worksheet stuff.

I do use Visual SourceSafe for pure VB6 and .net work, I keep meaning to try Subversion, but havent yet.

What do you do?

Anyone got top tips for managing and versioning the spreadsheet content?

cheers

Simon

DAO

Thursday, 10th May, 2007

Anyone [still] using DAO?

I’m importing a text file into a jet database (without using MS Access). I have had a few adventures for sure but I have finally managed to get it work. I had to add a querydef to the .mdb, and then .execute it from C#. That means ditching ADO and going back to DAO, unless I’m missing something?

Its proven to be a bit of a PITA as my SQL worked fine from the QBE, but would not run from my exe. Hence adding the querydef, which has fixed it. I read somewhere that the QBE actually uses DAO rather than ADO, does anyone know if thats true of Access 2003? I also read that DAO was faster than ADO for jet databases, anyone like to confirm (or not)?

Anyone found a better way to work with text files and .mdbs (without using Access directly)?

(I’m writing a server component (in C#) so want to avoid automating Access if poss)

Cheers

Simon

FLT

Monday, 30th April, 2007

Funny Little Thing.

I’ve been blundering around around for years flicking back and forth to the VBAIDE immediate window to run simple lines of VBA. Its always niggled a little, but never really registered what a PITA it was.

That was until I found Ross’s bit of code to rip the immediate window out of VBA and put it in the Excel desktop instead. What a great idea, I wish I’d thought of it. I didn’t, but it did inspire this little form based tool. Its as tatty as, just a mega rough and ready thing that I probably wont bother to develop further. No idea if its any use, of if I’ve missed something obvious, and there is a more simple way to do this. If so, be sure to let us know via comments.

You are welcome to have it and do what you want (apart from sue me of course). Open it with macros disabled to see what it is doing (not much). If you don’t know much VBA this may have limited value, if you do know VBA this may have limited value. There is no real error checking so it just falls apart at the first sign of trouble. Some people might say all my code is like that!

I wont bother with a screen shot because its short and wide, and therefore will wreck all the wordpress formatting (must get a wider theme).

Its pretty much just a text box and a label on a form with a button you type any one liner you would put in the immediate window and it executes it and puts the answer in the label. Stuff like ‘?activecell.numberformat’, or ‘?activeworkbook.path’. You can also do stuff like ‘activecell.formula = xlapp.activecell.value’ to remove formulas, or even selection… for ranges. (the xlapp is a reference to the Excel application and represents an opportunity for improvement!).

I did a couple of For Eaches so if you type in ‘FEworksheet.unhide’ (with FE in uppper case) it will unhide all worksheets. There is also an ‘FEworksheet.zoom’ in which case you put the zoom value (10-400 I think?) in the little text box, it then zooms all sheets in the active wb to that level.

It relies on the Microsoft script control (msscript.ocx) which is on the form somewhere. No idea where that control came from, or what it came with, but if you get a compile error check your refs. It fires some activex component security warning on first activation, which I assume is the control itself. You can use javascript with this, which is pretty neat, I didn’t bother.

Hmm looks like many people might not have that control (http://support.microsoft.com/kb/184739).

The next developments would have been putting it in a toolbar, and maybe using a combo box and keeping previous commands, maybe a better way to handle parameters, but I don’t have the time.

If you decide to develop it further and would like to share those improvements then let us know. If you know a better way then definitely let us know that.

Heres the zip before I forget, when I say tatty I’m not being modest.

Let us know what you think

 cheers

Simon

VB Access Excel

Saturday, 31st March, 2007

I’ve been helping another dev hit a deadline last week.

I fleshed out a VB6 exe form from a prototype he had done. I wrote a class for the client dll to access local and server based .mdbs.

I used Access’s QBE grid to generate the SQL, then stuck it in the class (the db is rebuilt frequently so we decided to leave the SQL in the app rather than the db). I wonder why I feel bad about not keeping the queries in the db? its only like LINQ after all.

I then dropped the recordset into Excel and created a half decent graph. Getting the recordset in took less than 5 minutes, coding the graph took much longer. Normally I just set one up in advance and populate the worksheet then point the graph at the data. To save install hassles in this case I decided to code it from scratch. For me that means hours of tidying up macro recorder code. (which is still better than manually coding it).

I did finally manage to get rid of all those select/selections and get a reasonable chart. But did manage to pick up a dangling reference problem. First time through everything worked great, next time all sorts of things crashed. I’ve had this problem before, although difficult to find they are pretty obvious once found.

In simple terms when automating Excel all objects need to be fully qualified, I’d managed to let one ‘Range(..)’ slip through from the recorder. I changed it to ‘ws.Range(..)’ and was back in business. The full story is here:

http://support.microsoft.com/kb/q178510/

I then emailed my 3 bits of code to my fellow dev , he spent less than 5 mins integrating it and everything was working.

This mini project really brought home to me (again) just how powerful and flexible MS Office is. And also how easy it is to dip in and out of VB6. Another thing was how easy the integration was, I have always found multiple devs in Excel to be a real pain. (has anyone found a decent way to resolve this?)

I saw a post elsewhere that Outlook is the big reason people stay with MS Office, personally though I am convinced its VBA and the easy interoperation of all these technologies. What do you think?

Cheers

Simon

Reality Check

Tuesday, 27th March, 2007

VSTO jobs 

I use Jobserve (UK) as my reality check for technologies, I’ve been burned too many times learning useless stuff.

So now and again I look to see whats hot. This is the first time I have ever seen a VSTO job, and the technology is 4 years old. I presented about VSTO and Excel in VS2003 and VS2005RC1 at a Microsoft community event way back in 2005. I noted then there seemed to be very few jobs requiring this skill. Now don’t get me wrong, there is lots to love about VSTO from a technology POV, but as a businessman, 1(one) matching job really doesn’t look like a great investment at this time. I know Orcas promises a lot, but when will the demand kick in?

In fact I struggled to find very much at all combining Excel and .net, outside of jobs also requiring investment banking experience, and based in the City.

For comparison there are 123 Excel and VBA jobs listed. (there are 7 Excel and VB6 jobs).

When deciding where to invest your learning time/effort how do you choose?

cheers

Simon