Just to stop you wasting your time trying to find out how to do this: Windows XP-64 does not allow hibernation.
Well, actually the precise rule is Windows XP-64 does not allow hibernation with more than 4GB of memory.But I figure if you've not got more than 4GB memory, you are probably better of using 32-bit in most cases.
As far as I can tell, this is true for Vista, but since don't use (and won't use) any instance of that execrable mess, I can't say. Thankfully, I can say hibernation does work for Windows 7, as I'm writing this missing on a Windows 7 64-bit (with 12GB ram) that does hibernate quite nicely.
Here are some links that explain it all:
Wednesday, December 30, 2009
Friday, December 4, 2009
Visual Studio: suppressing the annoying synchronising between active document and project view.
When you've got a solution with several projects and/or you're working on a document from a project that has many files, the automatic synchronisation between the active document and the Project View can be quite confusing. (It is to me, anyway.)
Consider the following case. First, the Visual Studio window while editing one file:
If I then switch to the other document (via Ctrl-Tab), the project view jumps away and expands the recls.100.net project, as in:
This is just too annoying if, like me, you use the keyboard for everything (or almost everything; this is Visual Studio, after all), and don't appreciate your previous Project View position being arbitrarily shifted.
I found this issue vexing for quite some time, until I was finally sufficiently motivated to find the requisite option. As it turns out, it is embarassingly obvious and easy:
HTH
Matt
Consider the following case. First, the Visual Studio window while editing one file:
If I then switch to the other document (via Ctrl-Tab), the project view jumps away and expands the recls.100.net project, as in:
This is just too annoying if, like me, you use the keyboard for everything (or almost everything; this is Visual Studio, after all), and don't appreciate your previous Project View position being arbitrarily shifted.
I found this issue vexing for quite some time, until I was finally sufficiently motivated to find the requisite option. As it turns out, it is embarassingly obvious and easy:
HTH
Matt
Sunday, June 7, 2009
Rails / RubyGems version mismatch (Mac OS-X)
Having finally decided to make shift to Rails 2, was experimenting on Mac OS-X. Got the following when trying to generate a controller
Various messings around later, and got success with:
$ ruby script/generate controller Site
Rails requires RubyGems >= 1.3.1 (you have 1.2.0). Please `gem update --system` and try again.
matts-MacBook:qualitymatters matthew$ gem update --system
Updating RubyGems
Updating rubygems-update
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /usr/bin directory.
Various messings around later, and got success with:
$ sudo gem install rubygems-update
$ sudo update_rubygems
Saturday, June 6, 2009
Practical determination of fopen() concurrency
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int i;
for(i = 1; i != 10000; ++i)
{
char filename[101];
int n = sprintf(&filename[0], "file-%d", i);
FILE* stm = fopen(filename, "w");
if(NULL == stm)
{
fprintf(stderr, "failed to create %s: %s; FOPEN_MAX=%d\n", filename, strerror(errno), FOPEN_MAX);
return EXIT_FAILURE;
}
}
return EXIT_SUCCESS;
}
Thursday, May 14, 2009
Find-in-files filter
The filter I find most useful when doing find-in-files with Visual Studio:
*.build;*.c;*.cmd;*.cpp;*.cs;*.csproj;*.css;*.cxx;*.d;*.dsp;*.dsw;*.erb;*.h;*.hpp;*.html;*.idl;*.inf;*.inl;*.java;*.js;*.jsp;*.mc;*.mh;*.pl;*.py;*.rb;*.rc;*.rcv;*.rgs;*.rhtml;*.rhtml;*.sln;*.src;*.tlh;*.tli;*.tmpl;*.tmplgen;*.txt;*.vbs;*.vcproj;*.xml;makefile.*;
*.build;*.c;*.cmd;*.cpp;*.cs;*.csproj;*.css;*.cxx;*.d;*.dsp;*.dsw;*.erb;*.h;*.hpp;*.html;*.idl;*.inf;*.inl;*.java;*.js;*.jsp;*.mc;*.mh;*.pl;*.py;*.rb;*.rc;*.rcv;*.rgs;*.rhtml;*.rhtml;*.sln;*.src;*.tlh;*.tli;*.tmpl;*.tmplgen;*.txt;*.vbs;*.vcproj;*.xml;makefile.*;
Wednesday, April 22, 2009
Starting WEBrick on a different port
For example, to start Rails on port 3001 (perhaps because you're running multiple Rails apps during development):
$ ruby script/server -p 3001
$ ruby script/server -p 3001
Tuesday, April 14, 2009
Monday, February 23, 2009
Basic MySQL tips #1
History
MySQLAdmin maintains a history, accessible with the up and down arrows. And it works between sessions.
Which is nice.
Show all the (user) tables
> show tables;
Describe a specific table (e.g. users table):
> describe users;
MySQLAdmin maintains a history, accessible with the up and down arrows. And it works between sessions.
Which is nice.
Show all the (user) tables
> show tables;
Describe a specific table (e.g. users table):
> describe users;
Installing Web Frameworks, part 6: installing MySQL
- install mysql: sudo apt-get install mysql-server-5.0
- set the root password
- change root password (I didn't like the one I set it to): mysqladmin -u root -p password
, where is the new password (and not the actual word 'password')
Thursday, February 12, 2009
apt-get without cdrom prompt
When running certain versions of Ubuntu (7.10 in this case), you might encounter a request to insert the cdrom when doing apt-get.
To stop this happening, edit the /etc/apt/sources.list file, and comment out (using leading #) the line containing 'deb cdrom...'
To stop this happening, edit the /etc/apt/sources.list file, and comment out (using leading #) the line containing 'deb cdrom...'
Installing Web Frameworks, part 5: Ruby On Rails
- Install Ruby: sudo apt-get install ruby-full build-essential
- Install SVN: sudo apt-get install subversion
- Install gems: download rubygems-1.2.0.tgz from rubyforge.org, then tar -zxvf rubygems-1.2.0.tgz, then sudo ruby setup.rb
- Install gems: download rubygems-1.3.1.tgz from rubyforge.org, then tar -zxvf rubygems-1.3.1.tgz, then sudo ruby setup.rb, then sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
- update gems: sudo gem update --system
- install Rails: sudo gem install rails -v 1.2.3 --include-dependencies
Wednesday, February 11, 2009
Installing Web Frameworks, part 4: renaming hosts
- edit the hostname file: sudo vi /etc/hostname
- change to required name
- reboot
Tuesday, February 10, 2009
Installing Web Frameworks, part 3: fixed IP address for SCC server
Next task was to ensure a fixed IP was assigned to the SCC (SVN) server. There's a known feature in Ubuntu 8.10 whereby any attempt to assign a fixed IP address using the Network Manager is overridden during reboot. There are many proposed solutions: here, here, here and here.
Having spent ~3 hours today fighting my own unique battle, I can relay the following measures that I had to do:
auto lo
iface lo inet loopback
auto eth1
iface eth1 inet static
address 192.168.0.11
netmask 255.255.255.0
gateway 192.168.0.1
# /etc/resolv.conf
nameserver 192.168.0.2
nameserver 192.168.0.1
HTH
Having spent ~3 hours today fighting my own unique battle, I can relay the following measures that I had to do:
- I had to uninstall Network Manager: sudo apt-get purge network-manager
- edit /etc/networking/interfaces, as shown below
- edit /etc/resolv.conf, as shown below
- restart networking and/or reboot: sudo /etc/init.d/networking restart
auto lo
iface lo inet loopback
auto eth1
iface eth1 inet static
address 192.168.0.11
netmask 255.255.255.0
gateway 192.168.0.1
# /etc/resolv.conf
nameserver 192.168.0.2
nameserver 192.168.0.1
HTH
Labels:
init.d,
networking,
static IP address,
Ubuntu
Installing Web Frameworks, part 2: SVN
- install apache2: sudo apt-get install apache2
- install svn: sudo apt-get install subversion
- add a svnusers group: sudo groupadd svnusers
- enabled visibility for all users: Alt-F2 to bring up run, and then type in gconf-editor. Within this, open apps/gnome-system-tools/users, and check showall.
- add me, root and www-data to svnusers group: I cheated and did it via the GUI!
- create root repositories directory: sudo mkdir /srv/repositories
- assign repositories to www-data & svnusers: sudo chown -R www-data:svnusers /srv/repositories
- change mod: sudo chmod -R g+rws /srv/repositories
- create rails repo, in /srv/repositores: svnadmin create rails
- repeat steps 7 & 8, to ensure that apache owns and controls all the files in the repo
- install libapache2-svn: sudo apt-get install libapache2-svn
- restart Apache2: sudo /etc/init.d/apache2 restart
- edit /etc/apache2/mods-available/dav_svn.conf. Add in the contents specified here. The list is below.
- create the password file /etc/subversion/passwd: sudo htpasswd -c /etc/subversion/passwd matthew. Don't forget this, or you'll end up with weird permissions errors in local and remote clients, including things along the lines of "Server sent unexpected return value (500 Internal Server Error) in response to MKACTIVITY request"
<Location /svn>
DAV svn
SVNParentPath /srv/repositories
SVNListParentPath On
AuthType Basic
AuthName "Synesis Web Subversion Repository"
AuthUserFile /etc/subversion/passwd
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>
Minimal C++ program to verify GCC installation
#include <iomanip>
#include <iostream>
#include <stdlib.h>
int main(int argc, char** argv)
{
std::cout << "__GNUC__: 0x" << std::hex << __GNUC__ << std::endl;
return EXIT_SUCCESS;
}
#include <iostream>
#include <stdlib.h>
int main(int argc, char** argv)
{
std::cout << "__GNUC__: 0x" << std::hex << __GNUC__ << std::endl;
return EXIT_SUCCESS;
}
Minimal C program to verify GCC installation
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
printf("__GNUC__: 0x%08x\n", __GNUC__);
return EXIT_SUCCESS;
}
#include <stdlib.h>
int main(int argc, char** argv)
{
printf("__GNUC__: 0x%08x\n", __GNUC__);
return EXIT_SUCCESS;
}
Monday, February 9, 2009
Installing Web Frameworks, part 1: Ubuntu
- Download Ubuntu 8.10 in 32 and 64-bit guises
- Install two 32-bit systems: 1-processor and 2-processor
- Action all the latest updates
- Install/update the basic build tools, as described in the next few steps:
- gcc: sudo apt-get install build-essential
- verify gcc, by defining two programs, one C and a C++, and compiling them.
Wednesday, January 21, 2009
Using your own blog domain with BlogSpot
Having just started this blog, I want to give it its own domain. I've registered skegging-it-out.net (and skeggingitout.net, just for completeness; I prefer the separated form), and now need to connect them up. In this post, I'll explain what I did, in the hope that it may be of some help to someone else.
I have actually done this process before, with my other BlogSpotted blog, STLSoft Musings, but, being a programmer and programming consultant, I have forgotten how. So, I'll do it again, and, in the spirit of Skegging It Out, will record it for posterity. Here goes:
HTH
Matt
I have actually done this process before, with my other BlogSpotted blog, STLSoft Musings, but, being a programmer and programming consultant, I have forgotten how. So, I'll do it again, and, in the spirit of Skegging It Out, will record it for posterity. Here goes:
- Register your domain name, in this case skegging-it-out.net
- Read the BlogSpot help on this subject
- Add a CNAME record to the DNS settings for the domain. I like the blog to appear in the sub-domain blog, so this will be blog.skegging-it-out.net. So, specify blog.skegging-it-out.net (done via entering blog in the requisite field with my registrar), and enter ghs.google.com for the canonical name.
- [OPTIONAL] If, like skegging-it-out.net, your domain is used solely for the blog, you will probably want www.skegging-it-out.net to come to BlogSpot. To do this, add another CNAME record named www again specifying ghs.google.com for the canonical name.
- You'll want add URL forwarding from your registrar (to whom arbitrary accesses to your domain will go) to blog.skegging-it-out.net, using standard URL forwarding. (Don't use stealth forwarding, if that's available.)
- Finally, you need to let BlogSpot know to start servicing requests for blog.skegging-it-out.net. From you blog's main page, click Customize, then Settings, then Publishing, then Custom Domain, then Switch to Advanced Settings, and enter your domain, in my case blog.skegging-it-out.net. Then save your settings, and cross your legs - because it takes time for the DNS settings and whatnot to propagate, you will likely find, as I have both times, that your blog will be unavailable for several hours. During this time, you will doubtless worry that you've not executed the previous steps correctly, and may even flip your blog settings back to skegging-it-out.blogspot.com a few times in your panic. If, after a day, you've not got a nicely hosted custom domain for your blog, you've made a mistake, and you're up the creek, and it's time to call a sysadmin.
HTH
Matt
Welcome to "Skegging It Out"
AFAIK, I introduced the phrase "Skegging It Out" to the world in the preface of my first book, Imperfect C++. I learnt it from my first commercial mentor, the redoubtable Andy Thurling, who gave me my first great insight, which is that no one in software engineering knows everything. Having now done 15+ years in the industry, and written 3 (well, 2.6, to be precise) books, I can certainly attest to this truth. I know that I don't know everything - don't ask me any questions on floating-point types! - and I know that a lot of other people don't know everything. (Some of the horrors I've seen in my consulting lead me to ponder whether 80+% of the programmers of the world would be far better suited to some other pursuit.)
Anywhat, this blog will be a place to record miscellaneous, non-portentous, things learned. Examples would be:
If you're after philosophical insights into the programming world, check out my occasional Artima blog.
If you want to learn about all the tricks and pitfalls of extending the C++ Standard Template Library (STL), including many of the issues its original designers (and most current practitioners and authors) didn't consider, then you should purchase and wade your way through my latest book, Extended STL, volume 1: Collections and Iterators.
If you want to learn the dark, complex secrets how to write the world's most robust, most flexible and fastest formatting and logging C++ libraries, you'll have to wait until I'm up to 3.0 books, and the latest, Breaking Up The Monolith: Advanced C++ Design without Compromise, has been published, hopefully later this year.
If you want to write mean things about the arrogant, autarchic, red-headed step-child of the C++ world, you could adulterate the Wiki page that's been started about me.
If, however, you want to just borrow some hard-won lessons from someone who knows just enough to get by in the majority of technology areas in which he's not expert, then this blog is for you. I make no promises about subject matter, focus, frequency, gravity, or quality. All I will endeavour to do is share the knowledge any time I learn something useful.
Can't say fairer 'n that, can ah?
Matt
P.S. If anyone knows where Andy Thurling is, or if, Bob-permitting, Andy reads this, please let me know!
Anywhat, this blog will be a place to record miscellaneous, non-portentous, things learned. Examples would be:
- how to use your own domain with BlogSpot
- tricks and tips with various IDEs
- simple scripting / OS survival tricks
- ... and so forth
If you're after philosophical insights into the programming world, check out my occasional Artima blog.
If you want to learn about all the tricks and pitfalls of extending the C++ Standard Template Library (STL), including many of the issues its original designers (and most current practitioners and authors) didn't consider, then you should purchase and wade your way through my latest book, Extended STL, volume 1: Collections and Iterators.
If you want to learn the dark, complex secrets how to write the world's most robust, most flexible and fastest formatting and logging C++ libraries, you'll have to wait until I'm up to 3.0 books, and the latest, Breaking Up The Monolith: Advanced C++ Design without Compromise, has been published, hopefully later this year.
If you want to write mean things about the arrogant, autarchic, red-headed step-child of the C++ world, you could adulterate the Wiki page that's been started about me.
If, however, you want to just borrow some hard-won lessons from someone who knows just enough to get by in the majority of technology areas in which he's not expert, then this blog is for you. I make no promises about subject matter, focus, frequency, gravity, or quality. All I will endeavour to do is share the knowledge any time I learn something useful.
Can't say fairer 'n that, can ah?
Matt
P.S. If anyone knows where Andy Thurling is, or if, Bob-permitting, Andy reads this, please let me know!
Labels:
C++,
Extended STL,
Imperfect C++,
skegging,
STL
Subscribe to:
Posts (Atom)