.NET, converting a string to an enum
Here is a handy article that I found which explains how to convert a string into an enum value, it uses the Enum.Parse() function:
http://blogs.msdn.com/b/tims/archive/2004/04/02/106310.aspx
Here is a handy article that I found which explains how to convert a string into an enum value, it uses the Enum.Parse() function:
http://blogs.msdn.com/b/tims/archive/2004/04/02/106310.aspx
I found this handy post which shows how to neatly split a list in python into a list of sub-lists:
http://www.garyrobinson.net/2008/04/splitting-a-pyt.html
Cheers Gary!
If you are running on a 64bit windows 7 system and have a VBA script that creates a COM/ActiveX/OLE component which fails with an error message like:
‘ActiveX component can’t create object’
Even though you know the component is registered and that you are using the correct progId etc, then it may be failing because the COM component in question is 32 bit and by default Windows7 runs the 64bit scripting engine.
If this is the case then you can get around the problem by explicitly using the 32 bit scripting environment which is most likely located here:
C:\Windows\SysWOW64\cscript.exe
So to run example.vbs in the 32bit environment use the following:
C:\Windows\SysWOW64\cscript.exe example.vbs
Hopefully you 32bit component will now load… mine did ;)
If you are getting an error message along the lines of ‘Class Not Registered’ when using Win32::OLE to create a COM object when using 64Bit ActiveState Perl and you are sure that the class is registered then it may be because the COM dll is 32bit and the 64bit perl process can’t load it….
I have found that the easiest (laziest?) way to work around this is to un-install the 64bit perl and install the 32bit version instead – not a perfect workaround but it works for me!
A colleague pointed me in the direction of this class site that lists some mind-bending but (possibly) useful bash one liners:
There doesn’t seem to be a way to get a Unix timestamp directly from a datetime object in Python, the best workaround example I could find is:
from datetime import datetime import time now = datetime.now() u = str(long(time.mktime(now.timetuple())))
This gets the timestamp as a string, it seems a bit long winded, so if anybody knows a better way please let me know!
Here is an old but interesting article about how to dynamically provide image data to Microsoft Deepzoom as the user pans and zooms:
http://msdn.microsoft.com/en-us/magazine/dd943052.aspx
Scroll to the section called ‘Making Dynamic Deep Zoom Even Better’, this could be very useful! I had thought that it would be easy enough to find more posts about getting deepzoom to work of dynamic data but I can’t find many!!
Since a recent Google App Engine SDK release ( 1.6.3?) the development server (localhost) has started appearing to hang every now and again this causes it to run very slowly. During the ‘hang’ the console output says that it’s updating index.yaml. Sometimes this ‘hang’ can last a few minutes, after a few minutes server will then continue to run as normal – it’s a real pain!
Google says that they will fix this problem in the next SDK release (1.6.5) but in the meantime there is a workaround, just empty out index.yaml and then the development server will stop trying to continually update it.
To do this either open it in an editor, delete its contents and save it, issue a command like this (when in the same directory):
[code]
echo ” > index.yaml
[/code]
just remember not to commit your emptied index.yaml file back into your source code repository!
I wrote before about how to make sure that an .msi produced by a Visual Studio 2010 setup project correctly overwrites the application executable when installing an application update. Now the recommended techniques worked well for C# applications but I found that did not work reliably for VB apps for some random & annoying reason. No matter how many times I changed assembly and file versions etc. etc., the blasted thing would never update the installed .exe file!
So the only reliable way I found to make sure that the .exe was always updated was to use Orca to edit the .msi file and set the .exe’s version number to:
65535.65535.65535.65535
To set this version number right click on the .msi and choose ‘edit with Orca’, Click on ‘File’ in the ‘Tables’ section on the left of the screen, you should then see your .exe listed along with its version number. You can change the version number here and then save.
This ain’t pretty but its is the only way that I could get the installer to work reliably…
I was testing an installation script (produced by a Visual Studio 2010 set-up project) on a open box virtual machine and was intermittently getting a lovely error message telling me that the ‘specified path is too long’, even though the path that the error message displayed as being incredibly short.
Anyway, I was installing to a subst’ed drive in an attempt to match the clients IT set-up and it seems that the windows installer just doesn’t work well with subst at all. So, to get around the problem I removed the subst’ed drive and instead added another virtual drive to the virtual box machine and everything worked ok.
So I know there are many many reasons for the ‘specified path is too long’ installer error message (most of which have nothing to do with long paths at all!) but one thing is for sure – installing to a subst’ed drive is one cause!
Address: 43 Churchgate, Wicklow, Co. Wicklow, Ireland.
Telephone: +353 87 2236429
email: info@ridgesolutions.ie
