Recently I had cause to want to scan something with my old trusty CanoScan FB630U on my installation of Vista 64bit.
Turns out Canon haven't produced drivers for it, so it seemed I was out of luck.
A quick Google search turned up VueScan, which did actually work. However, I wasn't willing to spend the $40 price tag to get rid of the demo watermark.
I was thinking I would have to take it into work where we use Windows XP, which I know has drivers for this scanner.. but then I remembered I had VirtualBox with Ubuntu 10.04 installed in it.
I plugged in my scanner, told Windows to ignore the device and not to install drivers. Then I loaded up VirtualBox, went to the USB settings and added the scanner to the list of usb filters.
Loaded up the virtual machine, and instantly Ubuntu had detected the scanner and allowed me to use it to get my images into GIMP.
Another successful open source solution to corporate obsolescence.
Thursday, July 29, 2010
Tuesday, July 6, 2010
Large address aware and games
Recently there was a huge outcry about how a recent patch to World of Warcraft caused it to use more than 2GB of address space when the maximum settings were used which led to a crash. One patch later, it was fixed.
One of the most common responses from the community was to ask Blizzard to enable the Large Address Aware flag to enable World of Warcraft to use more than 2GB of memory. Blizzard said no.
But, I was interested.. How many games have that flag enabled?
I wrote a quick little program that parsed my games directory and came up with a list.
One of the most common responses from the community was to ask Blizzard to enable the Large Address Aware flag to enable World of Warcraft to use more than 2GB of memory. Blizzard said no.
But, I was interested.. How many games have that flag enabled?
I wrote a quick little program that parsed my games directory and came up with a list.
- Armed Assault 2
- Borderlands
- Modern Warfare 2
- Dawn of War 2
- Farcry 2 Server
- GTA4
- Mass Effect 2
- Stalker: Clear Sky
- Stalker: Shadow of Chernobyl
- X3 Terran Conflict
- Eve Online
- Civ4 Beyond the Sword
- Guild Wars
- Sacred 2
- The Witcher
- Forged Alliance
- Rainbow Six Vegas 2
- Never Winter Nights 2
Friday, July 2, 2010
Firefox update problem
Tried to update Firefox and now it won't start and displays a very unhelpful error about XULRunner and versions that looks something like this?
1. Goto your installation directory for Firefox, probably something like C:\Program Files\Mozilla Firefox
2. Open the file "application.ini" file in something like notepad
3. Find the text MinVersion=1.9.2.4 and change the 4 to a 3 and save it.
4. Now Firefox will be able to run though it might complain about updates. Don't let it do an automatic update (it'll fail)
5. When you can, download and install the latest version of firefox from the Mozilla website
Cause:
From what i can tell, the Firefox.exe was the 1.9.2.3 version(as checked by right clicking and viewing version properties), but the application.ini (required for XULRunner) file specified it needed to be 1.9.2.4. Don't know why firefox.exe didn't update with the rest (maybe it was in use at the time?)
The latest version(3.6.6) is 1.9.2.6.
XulRunner
Error: Platform version '1.9.2.3' is not compatible with
minVersion >= 1.9.2.4
maxVersion <= 1.9.2.4 1. Goto your installation directory for Firefox, probably something like C:\Program Files\Mozilla Firefox
2. Open the file "application.ini" file in something like notepad
3. Find the text MinVersion=1.9.2.4 and change the 4 to a 3 and save it.
4. Now Firefox will be able to run though it might complain about updates. Don't let it do an automatic update (it'll fail)
5. When you can, download and install the latest version of firefox from the Mozilla website
Cause:
From what i can tell, the Firefox.exe was the 1.9.2.3 version(as checked by right clicking and viewing version properties), but the application.ini (required for XULRunner) file specified it needed to be 1.9.2.4. Don't know why firefox.exe didn't update with the rest (maybe it was in use at the time?)
The latest version(3.6.6) is 1.9.2.6.
Tuesday, May 18, 2010
Eclipse RCP application Bundle org.eclipse.ui errors!
Trying to do the Eclipse RCP tutorial and getting compile errors when doing Chapter 3 - Create your first RCP application?
Errors you might be getting:
- Type AbstractUIPlugin cannot be resolved to a type
- Bundle org.eclipse.ui cannot be resolved
- Compile errors
Try this:
1. Click on Window->Preferences
2. Expand Plug-In Development on the tree
3. Click Target Platform
4. Make sure "Running Platform" is active, if it's not, tick it, and click reload, then try to build your project again.
Errors you might be getting:
- Type AbstractUIPlugin cannot be resolved to a type
- Bundle org.eclipse.ui cannot be resolved
- Compile errors
Try this:
1. Click on Window->Preferences
2. Expand Plug-In Development on the tree
3. Click Target Platform
4. Make sure "Running Platform" is active, if it's not, tick it, and click reload, then try to build your project again.
Monday, February 2, 2009
Embedding Boost Python
Just spent 6 hours trying to solve an issue with class wrapping using Boost with embedded code and pointers.
Imagine your code looks something like this where you are tying to define a global variable that will be availiable to a python program. The global variable is actually an instance pointer to a C++ class.
Now, whenever you try to run it, you get an error:
The culprit is the statement main_namespace["myInstance"] = myInstance;. Basically it's saying there is no convertor. Seems odd no? I mean you explicitly defined it previously with the class wrapper, surely it should work?. Well.. that's true.. but you need one extra line:
Inserted just before you assign the variable myInstance into the main namespace.
The reason for this seemingly inexplicable behaviour comes from the Python documention:
int PyImport_AppendInittab (char *name, void (*initfunc)(void))
Add a single module to the existing table of built-in modules. This is a convenience wrapper around PyImport_ExtendInittab(), returning -1 if the table could not be extended. The new module can be imported by the name name, and uses the function initfunc as the initialization function called on the first attempted import. This should be called before Py_Initialize().
So, the code to register the convertor isn't called until the module is imported, and if you try to assign the variable directly to the dictionary it will fail until it IS imported.
Imagine your code looks something like this where you are tying to define a global variable that will be availiable to a python program. The global variable is actually an instance pointer to a C++ class.
BOOST_PYTHON_MODULE(TestModule)
{
class_("MyClass", no_init)
.def(self_ns::str(self))
;
};
PyImport_AppendInittab( "TestModule", initTestModule );
Py_Initialize();
MyClass *myInstance = new MyClass();
object main_module((handle<>(borrowed(PyImport_AddModule("__main__")))));
object main_namespace((main_module.attr("__dict__")));
main_namespace["myInstance"] = myInstance;
object ignored = exec_file("test.py", main_namespace, main_namespace);
Now, whenever you try to run it, you get an error:
TypeError: No to_python (by-value) converter found for C++ type: class MyClass
The culprit is the statement main_namespace["myInstance"] = myInstance;. Basically it's saying there is no convertor. Seems odd no? I mean you explicitly defined it previously with the class wrapper, surely it should work?. Well.. that's true.. but you need one extra line:
exec("import TestModule", main_namespace, main_namespace);
Inserted just before you assign the variable myInstance into the main namespace.
The reason for this seemingly inexplicable behaviour comes from the Python documention:
int PyImport_AppendInittab (char *name, void (*initfunc)(void))
Add a single module to the existing table of built-in modules. This is a convenience wrapper around PyImport_ExtendInittab(), returning -1 if the table could not be extended. The new module can be imported by the name name, and uses the function initfunc as the initialization function called on the first attempted import. This should be called before Py_Initialize().
So, the code to register the convertor isn't called until the module is imported, and if you try to assign the variable directly to the dictionary it will fail until it IS imported.
Friday, December 5, 2008
8,171 years should be enough for anybody
Came across this KB article: http://support.microsoft.com/kb/138365
"If you configure the Autodisconnect option to -1 at the command prompt, Autodisconnect is set to the upper value in the registry. This is approximately 8,171 years (not tested), which should be long enough to be the equivalent of turning Autodisconnect off."
"If you configure the Autodisconnect option to -1 at the command prompt, Autodisconnect is set to the upper value in the registry. This is approximately 8,171 years (not tested), which should be long enough to be the equivalent of turning Autodisconnect off."
Wednesday, November 19, 2008
Ah.. Java
I've been using Java for a few years now. And one thing that i've come across is.. memory leaks.
"Memory leaks?" you say. Yup. "In Java? That's unpossible!" you exclaim.
No really. It's true. The garbage collector makes a fine effort to clean up most unused objects, but every so often you'll get an object being stored that can't be collected because it's still referenced somewhere. Usually these are caused by putting a object into a static Map, or Array somewhere. Mostly it's the programmers fault, though the JRE/JDK itself may have some. This one for example is caused when you use a JPopup. A reference to the JComponent it is displayed on is kept internally by the standard Java libraries. If you only ever have one JPopup in your entire program, say in a startup page, and the rest of the program is all console based, then the reference to your window will be kept until the program exits. If your program is a daemon designed to run on a server, that could be a very very long time.
So.. how to find them? Well, luckily it's only a few step process.
Finding memory leaks using the Standard JDK 5.0 tools.
"Memory leaks?" you say. Yup. "In Java? That's unpossible!" you exclaim.
No really. It's true. The garbage collector makes a fine effort to clean up most unused objects, but every so often you'll get an object being stored that can't be collected because it's still referenced somewhere. Usually these are caused by putting a object into a static Map, or Array somewhere. Mostly it's the programmers fault, though the JRE/JDK itself may have some. This one for example is caused when you use a JPopup. A reference to the JComponent it is displayed on is kept internally by the standard Java libraries. If you only ever have one JPopup in your entire program, say in a startup page, and the rest of the program is all console based, then the reference to your window will be kept until the program exits. If your program is a daemon designed to run on a server, that could be a very very long time.
So.. how to find them? Well, luckily it's only a few step process.
Finding memory leaks using the Standard JDK 5.0 tools.
1. Run the program to check for leaks.
2. Try to do something that will expose the memory leak
3. Find the PID of the the java program by running jps.exe
4. Dump the memory of the program with this command
jmap -dump:format=b,file=heap.bin
5. Run jhat, it will start a webserver on the computer it's run on at port 7000
jhat -J-mx512m heap.bin
6. Load http://localhost:7000/ for general data
7. Load http://localhost:7000/histo/count and find the class you think is leaking, click on the link
8. Scroll down till you find the section called "Instances" and click "Include subclasses"
9. Find the instance that leaked and click it
10. Scroll down till you find the link "Exclude weak refs" and click it
11. A list of references will appear. Ignore any that contain a class called sun.awt.AppContext, or AppClassLoader as these classes are Java internal classes
12. The rest of the page will show which classes are still holding references to the object. Find out why it's holding it. Maybe you forgot to do a .remove() when the item was no longer needed.
Subscribe to:
Posts (Atom)