Windows command-line tools have advanced a lot with PowerShell, but Linux has had a much more usable terminal for many years. Here’s how you can get the best of both worlds with Cygwin, a ‘nix-style terminal for Windows PCs.
In today’s lesson, we’ll explain how to get Cygwin running, but stay tuned for future articles where we’ll explain how to use it for all sorts of different things.
Cygwin comes with a normal setup.exe to install in Windows, but there are a couple steps you will need to pay attention to, so we will walk you through the installation.
To keep the installation small while saving bandwidth for you and Cygwin, the default installer will download only the files you need from the internet.
The default install path is C:\Cygwin but if you don’t like to have programs installed on the root of your C: drive you can change the path or make a symbolic link from C:\Cygwin to your program files.
Click next until you come to a download mirror selection. Unfortunately, the installer does not say where the mirrors are located so in most cases you might as well just guess which mirror works best.
After you have selected a mirror, the installer will download a list of available packages for you to install. Here is where things get a bit more intimidating.
There will be hundreds of packages available separated by multiple different categories. If you don’t know what the package is you can leave the default selection and install additional packages later by running the installer again.
If you know what package you need, you can search for it and the results will be automatically filtered.
Once you click next, it will take a little while to download all the selected tools and then finish the installation.
After the installation you will have a Cygwin icon on your desktop that you can launch to open the Cygwin terminal.
This terminal starts in the C:\Cygwin\home\<user> folder but that isn’t particularly useful because you probably don’t have any files stored there. You can use all of the basic Linux commands but if you want to get back to your C: drive you have to change directory to /cygdrive/c.
To make Cygwin work in your normal Windows command prompt you need to add Cygwin to your Windows Environment Variables.
Start by opening your system properties with either Win+Pause/Break or right click on computer and select properties.
In the left column click on advanced system settings to open the system properties window we are looking for.
From the advanced tab, click on environment variables at the bottom.
Then in the system variables, locate the path variable and click edit.
At the end of the variable value option, add the Cygwin bin location like so.
Note: Make sure you add a semicolon to separate it from the other values.
Click OK to close out of the window and then open a command prompt to test out a few Linux commands.
As you can see from the below picture both pwd and ls work in the normal Windows command prompt. You can also see that /cygdrive/c is automatically added to the location.
There is a lot more you can do with Cygwin installed and we will show you some more of the useful tools in future articles.
This is an interesting tips. We will test antivirus program running on computer whether it works well or not, but using quite a unique way, namely we will create a file containing the virus codes, so that when it runs, the antivirus program should be able to detect and remove it. But you all no need to fear, because we will create a virus that will not disrupt or damage the computer system even though antivirus program can not detect it. So this is just a kind of AV tester.
These virus codes were developed by those who joined in the EICAR, which stands for European Institute for Computer Anti-Virus Research, having website at http://www.eicar.org/. Here are the steps to make this tester virus:
1. First step, run Notepad. This virus can be made just using Notepad.
2. Copy the codes below, and then paste them into Notepad.
3. Save the file with filename: EICAR.COM.
How: on Notepad, click File > Save As. On the Save As dialog box, choose folder to save this file in, then choose option Save As Type, next select All Files, and then type eicar.com for its filename. Finish it by clicking the Save
button. It's done.
4. Now open the Windows Explorer (press Windows + E), go to folder containing the virus file you've created, and then run then virus file by double-clicking it. If antivirus installed has real time guard, it shoud have detected the virus usually by displaying a dialog box containing information about detected threat. If your antivirus doesn't have real time guard (maybe you're using a light weight free AV :-) => not recommended ), run it and do scan for folder which the virus located.
I myself try this on a computer using AVG Antivirus, and it can detect the virus and displaying this message:
Notes: Once attention again, the virus we will create is not a real virus, but just a tester virus. Even though your antivirus program can not detect and remove it, it will NOT harm your computer. For more information about this virus, please go to http://www.eicar.org/.
If you set previously a root password for you MySQL server instance but have lost/forgotten it, don't worry that happens to everyone.
In this post I will explain the procedure to reset the password as there is no way to restore it, the following procedure applies to any platform (Unix, Windows,Mac OSX, Linux).
first let's look at the steps:
Now let's look at each step in details
If the the mysqld is running as a service you need to stop the mysql service in #Start menu > Control Panel > Administrative Tools > Services. or use the command:
where MYSQL is the name of the service
If that is not the case you may use the script provided with your install or just force stop it using the Task Manager
you may stop mysql daemon using
where 'pid' corresponds to processes of mysqld which you can get with the command
or you may also use something like:
in some distros you may use the command
you need to start mysqld with --skip-grant-tables and optionaly –skip-networking option from the bin directory of your mysql installation folder or by typing mysqld directly if you have added mysql bin directory to the %PATH% environment variable.
or something like
use the command:
Note: as noted above –skip-networking is optional but strongly recommended if your MySQl instance is accessible through insecure network (Internet, wi-fi...) as omitting this option is like allowing anyone in the network to mess with your server.
Connect to mysql on Windows using the command:
or if the bin directory of your mysql install is included the %PATH% environment variable just type
and the same goes for *unix issue the command:
this step will get you to the mysql command prompt
You need now to update the old password by issueing two sql statements:
The FLUSH PRIVILEGES statement allows mysql to notice the password change.
Were're done all you need now to do is restarting the server without the --skip-grant-tables and –skip-networking options.
with these steps you're now able to reset/restore mysql root password, If you still can't connect to your server, just have a suggestion or addotion; your feedback is most welcome.
As we keep building on old image technology, types of file formats keep piling up, each with their own nuances and uses. JPG, PNG, and GIF have become the most common, but what sets them apart from each other?
These formats have become the most popular because of their compatibility with modern browsers, broadband speeds, and the needs of average users. Join us as we take a detailed look at each format, and cover the strengths and weaknesses of each.
JPG was a filetype developed by the Joint Photographic Experts Group (JPEG) to be a standard for professional photographers. Like the method ZIP files use to find redundancies in files to compress data, JPGs compress image data by reducing sections of images to blocks of pixels or “tiles.” JPG compression has the unfortunate side effect of being permanent, however, as the technology for the file was created for storing large photographic image files in surprisingly small spaces, and not for photo editing.
JPGs have become the de facto standard image of the internet because they can be compressed so much. A typical JPG can be compressed at a ratio of anywhere from 2:1 to as high as 100:1, depending on your settings. Particularly back in the days of dial-up internet, JPGs were the only viable way to send image information.
However, because of the lossy nature of JPG, it is not an ideal way to store art files. Even the highest quality setting for JPG is compressed, and will change the look of your image, if only slightly. JPG is also not an ideal medium for typography, crisp lines, or even photographs with sharp edges, as they are often blurred or smeared out by anti-aliasing. What is potentially worse, is that this loss can accumulate—saving multiple versions of artwork can cause degradation with every save. Even so, it is common to see these things saved as JPG, simply because the filetype is so ubiquitous.
Close up of a high quality JPG.
Close up of a very lossy JPG.
The Joint Photographic Experts Group developed lossless JPG technology to combat this serious problem of quality degradation. However, because of dial-up speeds and general lack of interest in high quality non-degrading files, the JPG-LS standard never caught on.
It is possible to download plugins that allow users to open and save the lossless JPG2000, and some programs, like Apple’s Preview application, can read and save JPG2000 directly out of the box.
JPGs support 24-bit RGB and CMYK, as well as 8-bit Grayscale. I personally do not recommend using CMYK color spaces in JPGs. It’s also important to note that Grayscale JPGs do not compress nearly as much as color ones do.
GIF, like JPG, is an older filetype, and one generally associated with the internet as opposed to photography. GIF stands for “Graphics Interchange Format” and employs the same lossless LZW compression that TIFF images use. This technology was once controversial (for patent enforcement issues) but has become an accepted format since all patents have expired.
Close up of an 8-bit color GIF.
GIF is by nature an 8-bit color file, meaning they are limited to a palette of 256 colors, which can be picked from the RGB color model and saved to a Color Look Up Table (CLUT), or simply “Color Table.” There are, however, standard color palettes, like the “Web Safe” palette. An important note is that Grayscale images are by nature an 8-bit palette, so saving them as GIF is fairly ideal.
Apart from support for transparency, GIF also is supports animations, limiting every frame to 256 preselected colors.
While GIF is not lossy like JPG, conversion to 8-bit color distorts many images, using dither filters to optically blend, or “diffuse,” colors, similar to halftone dots or pointilism. This can radically alter an image for the worse, or, in some cases, be used to create an interesting effect.
Because of this non-lossy format, GIF can be used to keep tight lines on typography and geometric shapes, although these things are better suited to vector graphic files like SVG or the Adobe Illustrator native format, AI.
GIF is not ideal for modern photography, nor image storage. At small sizes with very limited color tables, GIF images can be smaller than JPG files. But at most ordinary sizes, JPG compression will create a smaller image. They are largely out of date, useful only to create dancing babies or to sometimes create rough transparencies.
PNG stands for Portable Network Graphics (or, depending on whom you ask, the recursive “PNG-Not-GIF”). It was developed as an open alternative to GIF, which used the proprietary LZW compression algorithm discussed earlier. PNG is an excellent filetype for internet graphics, as it supports transparency in browsers with an elegance that GIF does not possess. Notice how the transparent color changes and blends with the background. Right-click the image to see. This is actually one image that is on four different background colors.
PNG supports 8-bit color like GIF, but also supports 24-bit color RGB, like JPG does. They are also non-lossy files, compressing photographic images without degrading image quality. PNG tends to be the biggest of the three filetypes and isn’t supported by some (usually older) browsers.
In addition to being an excellent format for transparency, the non-lossy nature of 24-bit PNG is ideal for screenshot software, allowing pixel for pixel reproduction of your desktop environment.
From left to right, these files are: 24-bit JPG Compressed, 8-bit GIF, 8-bit PNG, Full Quality 24-bit JPG, and 24-bit PNG. Note that the file sizes increase in this same direction.
PNG is the largest image type for bigger images, often containing information you may or may not find useful, depending on your needs. 8-bit PNG is an option, but GIF is smaller. Neither are optimal options for photography, as JPG is much smaller than lossless PNG with only minimal loss of quality. And for storage of high resolution files, JPG compresses to tiny proportions, with quality loss only visible on close inspection.
imgscalr is an very simple and efficient “best-practices” image-scaling library implemented in pure Java.
This library makes uses of efficient Java2D scaling techniques advocated by the Java2D team which provides hardware accelerated operations on most platforms. This library also implements the optimized incremental scaling algorithm proposed by Chris Campbell with some minor enhancements for good-looking (and quick) thumbnail generation (previously only possible with the discouraged Image.getScaledInstance method using the much slower SCALE_AREA_AVERAGE algorithm).
If you have ever wanted to quickly rescale an image in Java you have probably noticed the following confusing things:
imgscalr addresses all these issues.
The simplest use-case of the library is a simple, single 2-argument method call:
In this use-case we pass the library our image and ask it to fit the image (while maintaing its original proportions) within a width and height of 150 pixels.
Alternatives, if we wanted to use the full-argument method call and print out some debugging and performance information from the library, we could do this:
Here we are explicitly telling the library to use the AUTOMATIC method when deciding between QUALITY or SPEED for the scaling operation. We are also telling the library to fit our image (while maintaing its proportions) within a max width of 150 pixels and max height of 100 pixels while printing out debugging and performance metrics.
NOTE: If a width and height are provided that violate the image’s proportions (e.g. attempt to resize an 800×600 image to a 150×150 square) the library will select the smallest (most constrained) dimension and then re-calculate the correct size for the other dimension based on that. So the given targetWidth and targetHeight arguments are used as upper bounds when scaling an image, not absolutes. This was done intentionally as a correctly proportional image was determined to be a better default behavior (more expected by users) than cropping the image or forcibly rescaling it to the given dimensions, possibly skewing it.
This library is intended for developers needing to quickly scale images (using the correct or most optimized methods available in native Java) and move one with their lives.
imgscalr is general purpose and will work on any platform providing the base Java2D classes it uses. imgscalr was also written with web application’s in mind, possibly needing to generate thousands of thumbnails or previews from larger uploaded images.
This library is not a comprehensive image processing (e.g. blur, sharpen, saturate, etc.) library for Java.
Ubuntu Linux uses groups to help you manage users, set permissions on those users, and even monitor how much time they are spending in front of the PC. Here’s a beginner’s guide to how it all works.
Ubuntu is set up for a single person to use when you installed it in your system, but if more than one person will use the computer, it is best for each person to have their own user account. This way each person can have separate settings and documents, and files can be protected from being viewed by the other users on the same PC.
Normally Linux computers have two user accounts—your own user account, and the root account, which is the super user that can access everything on the PC, make system changes, and administer other users. Ubuntu works a little differently, though—you can’t login directly as root by default, and you use the sudo command to switch to root-level access when you need to make a change.
Linux stores a list of all users in the ‘/etc/groups’ file. You can run this command in the Terminal to to view and edit the groups and users in your system:
To create a new user, you can head to System –> Administration -> User and Groups, and click the “Add” button to add a new user.
Give the appropriate name that identifies the other user and tick the “encrypt” checkbox to secure their home folder.
Click the “Advanced Settings” button to configure the user’s privileges.
The user management module lists Anna’s privileges under the “User Privileges” tab.
We recommend that you remove the “Administer System” privilege from other user accounts. This is to make sure that other users cannot easily change critical system settings that may jeopardize your Linux box.
Each file in Linux has a set of user and group permissions, and you can use the ls -l command to show the full set of permissions and attributes from the terminal.
Reading from left to right, each item in the list means:
For instance, in the example showing a file named anki, the permissions are rwxr-xr-x, the file is owned by the root user and belongs to the root group, and it’s 159 bytes.
The permission flag has four components, the first character being the flag, usually used to indicate whether it’s a directory or a file—a directory would show a “d” and a regular file will show a “-“. The next 9 characters are broken up into sets of 3 characters, which indicate user, group, and everyone permissions.
In this particular example, we’ve got rwxr-xr-x, which can be broken up like this:
The permissions correspond to the following values:
This means that for the file in question, everybody has read and execute permissions, but only root has access to write to the file.
Anna is a 7th grader and her brother Peter just enrolled in a programming course in a university. Anna will be more interested to use the educational software for her mathematics or geography homework, compared to Peter who is more interested to use software development tools.
We can configure Anna’s and Peter’s access to these applications by assigning them to the appropriate groups from the “Manage Groups” module.
Let’s create two user groups, a K-12 student group, a University student group, and assign the appropriate user accounts to each group.
We should give the K-12 students the privileges to run the educational software.
Linux stores most of the executables under /usr/bin, for example, Linux stores Anki under /usr/bin/anki. If you’re not sure where a file is located, the which command is a convenient way to find out the location from the terminal:
Let’s assign Anki and Kig to the k12 group using the chown command, which uses the following format:
You can also revoke the read and execute access from other user groups using the chmod command.
This command gives the member of K12 group access to Anki and Kig. We should restrict the access rights of the university group from Anki and Kig by removing the read and execute permission from the “Other” groups. The format of the command is:
The first command that we executed in the command line removes the read (r) and execute (x) privilege from the “Other” group. The “O” option indicates that we are modifying the access right of the Other group. The ‘-’ option means that we want to remove certain file permissions specified in the parameters that follow the ‘-’ option. The man page of chmod gives a detailed explanation of these options.
Timekpr allows us to set give each user a limited amount of computing time, and you’ll need to add the following PPA to your software sources so that you can install Timekpr from the Ubuntu Software Center.
Ubuntu Software Center is the easiest way to install Timekpr—just use the search box and it should come right up.
Timekpr allows us to limit the computer usage time by a certain time frame on each day of the month. For example, we can specify the computer time usage for 300 minutes on Sunday and 60 minutes on Monday.
Timekpr will appear on the user’s task bar and lock the desktop when the computing time of the user is up.
We’re big fans of hacking the Windows Registry around here, and we’ve got one of the biggest collections of registry hacks you’ll find. Don’t believe us? Here’s a list of the top 50 registry hacks that we’ve covered.
It’s important to note that you should never hack the registry if you don’t know what you’re doing, because your computer will light on fire and some squirrels may be injured. Also, you should create a System Restore point before doing so. Otherwise, keep reading.
We’ve all been at our computer when the Windows Update dialog pops up and tells us to reboot our computer. I’ve become convinced that this dialog has been designed to detect when we are most busy and only prompt us at that moment.
There’s a couple of ways that we can disable this behavior, however. You’ll still get the prompt, but it won’t force you to shut down. Here’s how to do it.
One of the most irritating things about Windows is the context menu clutter that you have to deal with once you install a bunch of applications. It seems like every application is fighting for a piece of your context menu, and it’s not like you even use half of them.
Today we’ll explain where these menu items are hiding in your registry, how to disable them the geeky way, and an easier cleanup method for non-geeks as well.
As an avid user of the Sleep function on my laptop, I’ve been more than irritated with Windows 7 or Vista’s habit of changing the Sleep/Shutdown button into an “Install Updates and Shut Down” button whenever there are updates from Windows Update.
After the last time I accidentally clicked this stupid button when I just wanted to enter sleep mode, I decided to look for a solution.
Taking ownership of system files or folders in Windows 7 or Vista is not a simple task. Whether you use the GUI or the command line, it takes far too many steps.
Here’s a registry hack that adds an item to the menu that will let you take ownership of the files in a single step, so you can delete, move, or otherwise modify the file.
One of the interesting new features in Windows 7 is the way you can grab a window by the title bar and “shake” it back and forth to minimize everything else. It’s a fun feature, but just in case you want to disable it we’ve got the solution for you.
All you’ll have to do is apply a simple registry hack, and that
The default method of opening unknown files forces you to go through a list of known applications and is generally a pain to deal with.
That’s why I like to have a context menu option for “Open with Notepad” so that I can quickly open up files without having to go through a lot of trouble.
If you find the popup notification balloons in the Windows system tray to be too annoying, you might be interested to know that you can completely disable them. This would be an extreme option, of course… typically you can just turn them off in any offending applications, but if you want to disable them across the board, this is the solution.
If you’ve ever wondered how to change the name of the person that Windows is registered to, this is the quick tip for you. It’s not all that useful for most people, but it might come in handy if you got a computer from somebody else.
To show off the new changes, just type winver.exe into the start menu search box to see the About Windows box.
Have you ever wanted to show off your keyboard ninja skills by taking down Windows with just a couple of keystrokes? All you have to do is add one registry key, and then you can impress your friends… or use it to convince people to switch to Linux.
This isn’t a bug, it’s a “feature” in Windows that is designed to let users trigger a crash dump for testing purposes. Note: this one doesn’t work in Windows 7 anymore. Also, it clearly doesn’t make Windows better, but we included it because it’s lots of fun.
If you want really quick access to launch a frequently used application without putting extra icons on your desktop, you can add that application to the context menu for the desktop with a simple registry hack. Here’s how to do it.
For today’s lesson we’ll show you how to add Notepad to the menu, but you could add any applications you want instead.
We’ve already shown you how to create shortcuts to create new Google Docs easily, but what if you want total Windows integration? Here’s how to add them to the Windows Explorer “New” menu for easier access.
This should work for all versions of Windows, and you can modify it to work with Google Apps for your Domain as well. Keep reading for the full instructions.
It’s always struck me as odd that system tweakers use the registry editor all the time to fix annoyances in Windows, but nobody has created a tweak to add the registry editor to the control panel… until now.
I’ve created a registry hack to add the registry editor as another option in the Control Panel in any version of Windows.
A source of annoyance for many Windows users is the ” – Shortcut” text that is added to the name of newly created shortcuts, and every time you have to manually edit the shortcut and remove that text. Wouldn’t it be great if there was a registry hack for this?
Most long-time geeks will remember that there was a hack for Windows XP, and probably already know that the same hack works in Windows 7 or Vista as well.
Windows 7 and Vista have all the same Windows+X shortcut keys as other versions of Windows, such as Win+E for explorer and Win+D for the desktop, but adds in all of the Win+<num> keys to launch the shortcuts in the Vista Quick Launch menu (or switch to apps in Windows 7), as well as Win+X for mobility center, etc.
But what if you want to disable all these extra keys?
We haven’t told anybody before, but Windows has a hidden “How-To Geek Mode” that you can enable which gives you access to every Control Panel tool on a single page—and we’ve documented the secret method for you here.
NOTE: Do not use this on Vista or XP: things will break.
Windows Mobility Center is a fairly useful tool for those of us using Windows 7 or Vista on a laptop computer, but might not be for everybody, especially since it takes over the Win+X keyboard shortcut.
If you would rather disable Windows Mobility Center, all it takes is a single registry tweak.
If you’ve got drives in My Computer that you never access, such as a USB Flash drive that you are using solely for ReadyBoost, a floppy drive, or a network drive only used for a particular piece of software, then you might want to simply hide the drive from your computer.
This tip will only hide the drive from being displayed, applications and the command prompt will still have access to it, and you can still manually browse to the folder if you type in the path.
We’re big fans of hidden registry hacks around here, so when our friend Justin showed how to put a real, working Libraries icon on the desktop, we figured it would make a perfect article for for a few extra geek points.
Yeah, you can always create a shortcut icon for anything on the desktop, but this one is the actual icon without the shortcut overlay. Plus it’s a geeky hidden trick—what’s not to like?
If you want to manually restore a specific section of the registry from a previous System Restore snapshot, or access some specific keys from an older version of the registry, you can do so by getting access to those files and then exporting sections from them. Here’s how to do it in Windows 7 or Vista.
Have you ever opened the Control Panel in Windows 7 and thought there is no reason to have some of the icons listed? Today we take a look at how to remove unwanted or unneeded items from Control Panel in Windows 7.
For some items you won’t be able to easily delete the CPL file if it’s a Windows system file or in use. You could use a program like Unlocker, but we can tweak the Registry to hide items in Control Panel.
The new Windows 7 taskbar’s Aero Peek feature, with the live thumbnails of every window, is awesome… but sometimes you just want to be able to click the taskbar button and have the last open window show up instead. Here’s a quick hack to make it work better.
Aero Peek is one of the more useful new features in Windows 7… just move your mouse to the taskbar for half a second, and everything else hides so you can see the desktop or application window. But why does it take half a second?
There’s a simple little registry hack that will change the amount of time between hovering your mouse over the show desktop button in the lower right-hand corner, and the Aero Peek display showing up. The same thing should work for when you hover over an application window on the taskbar.
After you’ve used Disk Cleanup, you probably expect every temporary file to be completely deleted, but that’s not actually the case. Files are only deleted if they are older than 7 days old, but you can tweak that number to something else.
Reader Jeevus wrote in asking how to remove the “Troubleshoot Compatibility” item from the Windows context menu whenever you right-click on an application—naturally, we were happy to explain how to do it, and share with the rest of you.
You’ll want to note that we’re not necessarily recommending that you remove this item, since it could be useful if you’re having compatibility issues with an application, but we’re fans of showing how to do something—also, we just like tinkering in the registry.
There are a lot of new users to Windows 7 who are not happy with the new Start Menu and wish they could revert to the Classic menu. Here is how to at least get back the Classic “All Programs” Menu.
While it’s not quite the same as the good old XP days, if you’re looking to get the All Programs Menu back, this Registry hack will do the trick without installing 3rd party software.
Have you ever wanted to add the Recycle Bin to your My Computer screen? Yeah, it’s probably not the most common request, but here’s how to do it anyway with a simple registry hack.
To make this tweak, we’ll be doing a quick registry hack, but there’s a downloadable version provided as well.
One of the first things you might notice in Windows 7 is the addition of the new Gadgets and Screen Resolution items to the context menu. The only problem is that you might not really want them there—so we’ll explain how to get rid of them.
No clue what we’re talking about? If you are using Windows 7 and you right-click on the desktop, you’ll see a bunch of new items at the bottom:
Have you ever noticed that there are only two fonts to choose from in the Command prompt properties window? What you might not know is that you can use a simple registry hack to enable alternate fonts, including a very readable font that comes with Windows 7, Vista, or Office 2007.
But that’s not all… you can enable a number of fixed width fonts if you really want to. We’ll cover how this works, as well as one of my favorite “interesting” fonts for the command prompt.
Have you ever wondered how to remove the “Catalyst(TM) Control Center” item from the desktop context menu? Here’s the simple registry hack to remove it.
Have you ever wondered how to remove the “NVIDIA Control Panel” item from the desktop context menu? If so, you probably didn’t realize that it’s trivially easy to remove.
We’ve previously explained how you can open a command prompt by holding down the Shift key and right-clicking on a folder or the desktop… but how do you make that item show up without having to hold down the shift key?
There’s a simple registry hack you can do that will enable “Open Command Window Here” item without holding down the shift key:
If you use the built-in file encryption in Windows 7 or Vista, you might be interested in adding an option to the right-click menu to more easily encrypt and decrypt your files, rather than having to use the file properties dialog.
Adding this to the menu couldn’t be simpler – there’s only a single registry key to add.
Windows 7 and Vista include a nice set of backgrounds, but unfortunately most of them aren’t configurable by default. Thanks to a free app and some registry changes, however, you can make the default screensavers uniquely yours!
You can customize the Bubbles, Ribbons, and Mystify screensaver to enable hidden options with this registry hack.
If you’ve used Windows for any length of time, you’ve likely tried to open a file with an unknown extension. Instead of getting a list of programs to open the file with, you get an annoying dialog asking you to use a web service to find a program. So how do we change this?
You can use a registry hack to force Windows to skip this dialog altogether, and give you a list of applications to use to open the file instead, just as if you had selected the second option.
The caps lock key is one of those remnants of another age of computers, back when people used to shout at each other more often. Since it’s not entirely useful anymore we’ll learn how to disable it. If you aren’t interested in the explanation you can skip to the bottom for the registry files.
Windows doesn’t have a default setting to allow for disabling the key, so what we have to do is re-map the key to something non-existent so as to completely disable it.
We’ve received lots of requests to add Defrag to the right-click menu for a drive, so we created a simple registry hack that can be easily added that does just that.
After manually applying or downloading the hack, you’ll have a new item on the right-click menu for your drives…
A couple of days ago I noticed a thread on our forum asking how to add Control Panel to the desktop context menu, so I decided to write up the solution for everybody, since it seems like a really useful hack.
There’s a manual registry hack that you can apply if you’d like, or you can download the reghack version and apply it easily.
If you’ve ever had problems with your PC starting up or shutting down slowly, there’s lots of different troubleshooting techniques that you can use—today we’ll talk about how to enable verbose messages.
Enabling these verbose messages is not going to magically solve your problems, of course—the point is to use this to identify a problem, which you can then solve through other means, generally by uninstalling a problem application or upgrading a faulty driver.
If you’re a programmer that uses TortoiseSVN to manage your Subversion source control project, you might wonder how to easily disable the menu items without completely uninstalling. Here’s a quick way to do it.
The general idea is that we’ll remove the Windows Explorer context menu items from the registry with one script, and then add the registry entries back with another script.
Back in the Windows XP days, you could easily add Control Panel to My Computer with a simple checkbox in the folder view settings. Windows 7 and Vista don’t make this quite as easy, but there’s still a way to get it back.
To make this tweak, we’ll be doing a quick registry hack, but there’s a downloadable version provided as well.
By default you may notice that there is a slight delay when hovering your mouse over a Taskbar Thumbnail. Here is a neat registry hack that will allow you to speed it up.
Once you apply the hack, you’ll notice when you hover your mouse over a thumbnail of an open app on the Taskbar the preview pops up instantly with no delay.
Would you like to clean up the Open with menu in Windows Explorer? Here’s how you can remove program entries you don’t want in this menu on any version of Windows.
This simple trick can help you keep your Open with menu tidy, and only show the programs you want in the list.
Have you ever tried to unzip a file to the Program Files directory in Windows 7 or Vista? You’ll get all sorts of permission denied errors, and generally be unsuccessful. So how do we open up the zipfile as an administrator? For that matter, how do you open any file as administrator?
There’s a simple registry tweak that will let us specify the action to run as administrator for a file type. Unfortunately you’ll have to make the tweak manually, but we’ll walk you through it.
If you are the type of person that likes to keep a lot of information stored in text-format files on your drive, you’ve probably encountered a scenario where you want to copy that information to the clipboard… so you open the file in notepad, select all, then copy to the clipboard. What if you could do it with a simple context menu item instead?
Using a little registry hacking and the clip.exe utility built into Windows 7 and Vista, we can do just that, and we can even hide it behind the Shift + Right-Click menu so that it won’t waste space on the menu unless you hold down the shift key.
After writing the article about adding Notepad to the context menu I noticed all the comments from users that prefer to use a shortcut in the Send To menu, which got me thinking… I wonder if you can disable the Send To folder?
Of course you can easily disable it… naturally it’s a registry hack, so standard disclaimers apply.
If you have never used the “Map Network Drive” dialog box, do you ever wonder how to get rid of it? Personally I only map drives from the command line so I never use it either… so I’m thankful there’s a registry hack that can remove the menu items.
If you are unfamiliar with what I’m talking about, just right-click on the Computer icon and you’ll see it.
Some time ago I received an email from a reader curious why their Task Manager option was grayed out on the taskbar right-click menu. After a bit of research his problem was solved, and now I’m sharing the solution with everybody.
There is a registry key that will disable Task Manager, although it’s not always clear how or why it was set to disable. In many cases the problem is related to spyware, so you should also scan your computer. Here’s how to enable or disable it.
Is your Internet Explorer context menu completely out of control? Is it so long that it actually runs off the screen? Here’s how to quickly take a few steps to get rid of all that ridiculous clutter without installing Google Chrome instead.
Sometimes you can remove the items just by using the Manage Add-ons screen, but other add-ons embed themselves a lot deeper, and you’ll need to use a registry hack to get rid of them. Here’s how to do that.
Remember how previous versions of Windows had an Internet Explorer icon on the desktop, and you could right-click it to quickly access the Internet Options screen? It’s completely gone in Windows 7, but a geeky hack can bring it back.
Microsoft removed this feature to comply with all those murky legal battles they’ve had, and their alternate suggestion is to create a standard shortcut to iexplore.exe on the Desktop, but it’s not the same thing. We’ve got a registry hack to bring it back.
If you’ve ever had a corporate laptop, there’s a good chance that you’ve seen a message before you login that talks about the corporate policies and all of that stuff.
Here’s how to enable or disable that login message using a registry hack.
That's a interesting question I'm willing to waste some of my time on. Someone at StumbleUpon emitted the hypothesis that with all the improvements in the Nehalem architecture (marketed as Intel i7), context switching would be much faster. How would you devise a test to empirically find an answer to this question? How expensive are context switches anyway? (tl;dr answer: very expensive)
Source code: timesyscall.c Results:
Source code: timectxsw.c Results:
Now you must take those results with a grain of salt. The micro-benchmark does nothing but context switching. In practice context switching is expensive because it screws up the CPU caches (L1, L2, L3 if you have one, and the TLB – don't forget the TLB!).
Source code: cpubench.sh Results:
The performance gap between thread switches and process switches seems to increase with newer CPU generations (5150: 7-8%, E5440: 5-15%, E5520: 11-20%). Overall the penalty of switching from one task to another remains very high. Bear in mind that those artificial tests do absolutely zero computation, so they probably have 100% cache hit in L1d and L1i. In the real world, switching between two tasks (threads or processes) typically incurs significantly higher penalties due to cache pollution. But we'll get back to this later. NPTL in Linux 2.6. They said that normally there's no need to do a TLB flush when switching between two threads of the same process. That's true, you can go check the source code of the Linux kernel (
In this code, the kernel expects to be switching between tasks that have different memory structures, in which cases it updates CR3, the register that holds a pointer to the page table. Writing to CR3 automatically causes a TLB flush on x86.
In practice though, with the default kernel scheduler and busy server-type workload, it's fairly infrequent to go through the code path that skips the call to
The paper goes on to explain the indirect costs involved in context switching, which are due to cache interference. Beyond a certain working set size (about half the size of the L2 cache in their benchmarks), the cost of context switching increases dramatically (by 2 orders of magnitude).
I think this is a more realistic expectation. Not sharing data between threads leads to optimal performance, but it also means that every thread has its own working set and that when a thread is migrated from one core to another (or worse, across physical CPUs), the cache pollution is going to be costly. Unfortunately, when an application has many more active threads than hardware threads, this is happening all the time. That's why not creating more active threads than there are hardware threads available is so important, because in this case it's easier for the Linux scheduler to keep re-scheduling the same threads on the core they last used ("weak affinity").
Having said that, these days, our CPUs have much larger caches, and can even have an L3 cache.
Having more cores is great, but it also increases the chance that your task be rescheduled onto a different core. The cores have to "migrate" cache lines around, which is expensive. I recommend reading What Every Programmer Should Know About Main Memory by Ulrich Drepper (yes, him again!) to understand more about how this works and the performance penalties involved.
So how does the cost of context switching increases with the size of the working set? This time we'll use another micro-benchmark, timectxswws.c that takes in argument the number of pages to use as a working set. This benchmark is exactly the same as the one used earlier to test the cost of context switching between two processes except that now each process does a
Here are the results for the 5150: As we can see, the time needed to write a 4K page more than doubles once our working set is bigger than what we can fit in the L1d (32K). The time per context switch keeps going up and up as the working set size increases, but beyond a certain point the benchmark becomes dominated by memory accesses and is no longer actually testing the overhead of a context switch, it's simply testing the performance of the memory subsystem.
Same test, but this time with CPU affinity (both processes pinned on the same core): Oh wow, watch this! It's an order of magnitude faster when pinning both processes on the same core! Because the working set is shared, the working set fits entirely in the 4M L2 cache and cache lines simply need to be transfered from L2 to L1d, instead of being transfered from core to core (potentially across 2 physical CPUs, which is far more expensive than within the same CPU).
Now the results for the i7 processor: Note that this time I covered larger working set sizes, hence the log scale on the X axis.
So yes, context switching on i7 is faster, but only for so long. Real applications (especially Java applications) tend to have large working sets so typically pay the highest price when undergoing a context switch. Other observations about the Nehalem architecture used in the i7:
This probably explains why Intel added the EPT ( Extended Page Table) on the Nehalem, since it enables the guest OS to modify its own page table without help of the hypervisor, and the CPU is able to do the end-to-end memory address translation on its own, entirely in hardware (virtual address to "guest-physical" address to physical address).
Another hidden cost that severely impacts server-type workloads is that after being switched out, even if your process becomes runnable, it'll have to wait in the kernel's run queue until a CPU core is available for it. Linux kernels are often compiled with
It is illusory to imagine that NPTL or the Nehalem architecture made context switching cheaper in real-world server-type workloads. Default Linux kernels don't do a good job at keeping CPU affinity, even on idle machines. You must explore alternative schedulers or use
Looking for some harmony between Windows 7 and Ubuntu in your dual-boot setup? Here are a few ways you can make the tense OS situation a little more unified and copacetic.
When we covered How to Choose a Partition Scheme for Your Linux PC, we noticed that some people were wondering how to use a third partition between Linux and Windows to act as a storage partition.
Why It’s Difficult
As a few commenters pointed out, you can’t use an NTFS-formatted partition for /home in Linux. That’s because NTFS doesn’t preserve all of the properties and permissions used by Linux, and Windows doesn’t even read Linux file systems. You can readily see this if you view a folder that’s hidden in Windows from within Linux, or a file that Linux sees as hidden in Windows. What works for one doesn’t work for the other. Furthermore, there isn’t an incredibly clean way to move the Users folder in Windows without messing with things. This is why many people with nicer machines end up using virtualization software; it’s easier than forcing the two to co-operate side-by-side.
Image from cellguru.co.cc, assumed fair use
There isn’t a way to run your /home directory from a FAT32 or NTFS partition, so your configuration files and scripts will have to remain there. What you can do is redirect the other commonly used folders like Documents, Downloads, Music, etc. to another partition, one that can be read by Windows. Then, you can add these folders to your Windows 7 Libraries and mark them as the default save location.
This isn’t a proper workaround. Your program-associated configuration files and other user-related settings will not be in the same place for this setup. If you have to reinstall either OS, you will have to perform a separate backup of your user settings. That being said, however, most people are really just concerned about their documents, music, videos, and so forth. This solves that issue by pointing both OSs to look in the same place for them.
Linux has come a long way with regards to reading and writing NTFS, and since it’s much better than FAT32 and tougher to configure this setup with, that’s what we’ll be covering in this guide.
For this to work, you’ll want your hard drive set up in a way similar to this:
For later convenience, when you format your storage partition to NTFS, add an easily recognizable label to it. It’ll be easier to find a drive called “storage” or “media” than by counting partition numbers.
Notice that we don’t have a separate /home partition this time around. Since the vast majority of your important/large files will be on a separate partition, this negates the need for that. You’re welcome to use a separate /home partition to make backing up the Linux-side of things easier, just remember that you can’t exceed four primary partitions per disk.
Since we’re using NTFS, it’s a good idea to specifically tell your system to mount your storage partition or disk in the same place every time you boot. To do this, we’ll be editing the /etc/fstab system file, which is the file system table used by Linux, but first, we have some preparations to make. Open up terminal, and if this makes you nervous, just take a deep breath and relax. It’ll be okay.
We need to install ntfs-3g, the driver Linux will use to read and write to NTFS. If you already have it installed, it’ll tell you, so don’t worry.
If you see “ntfs-3g is already the newest version” then you already have it installed, otherwise you’ll see it work, so wait for it to finish its thing. Next, let’s create the directory where your partition will mount. If you want the drive to appear in the “Places” menu by default, you’ll use:
If you don’t want it to appear in “Places” and you want to manually browse to it for whatever reason, you can use this instead:
This will create a “storage” directory in /media. You can change this to something else if you like, but be sure it does not have any spaces. Spaces will create a problem when we configure it to automatically mount in the next few steps.
Now, it’s time to edit the fstab file. First, we’ll create a backup, just in case anything happens.
It’ll prompt you for your password, so go ahead and enter it. If, for whatever reason, you need to restore the backup in the future, you would do this:
Next, you need to find what the UUID of your storage partition is. The UUID stands for “universally unique identifier” and acts as a proper serial number that will not change until the partition is reformatted. Run the following command:
Enter your password, and you’ll see some output resembling this:
Find the line that has the correct label to your storage partition (makes things easy, doesn’t it?) and copy the UUID.
You’ll see gedit open, like so:
You may see an uglier theme on gedit than usual, but don’t worry it. Add the following lines to the bottom of fstab, substituting your own UUID instead of mine:
The first line is a comment, indicated by the leading hash tag. The next line tells fstab to look for the partition with the specified UUID, mount it to /media/storage/, and to use the ntfs-3g driver. Furthermore, it makes sure that it automatically mounts at boot, makes it accessible by users (not just root), gives both read and write privileges, and skip file-system checks (you’ll probably want to use Windows to do that). Lastly, double-check, and triple-check to make sure you didn’t touch anything else, and that the UUID is correct.
When you’re ready, click save and then reboot. Don’t skip the reboot, as it’s necessary for the next step as well as to make sure things work.
You should be able to boot into Ubuntu as if nothing happened, but you’ll notice that you’ve got “storage” (or whatever you named it) under the Places menu now! If not, check to make sure you got fstab correct. See above to restore fstab from your backup, if you need to.
Open up terminal and enter the following command:
This is the file where your “special” folders in your home directory are defined.
You can edit this to your liking. In place of where you see “$HOME/Downloads” you would put in an absolute folder location, like “/media/storage/Downloads”. Go ahead and create those folders, or whatever folders you’d like to call them, and put the path down for each of these. Here’s what the finished edit should look like:
Click save, and we’re done the crux of the configuration. You may need to reboot for these changes to take effect, but you can just boot into Windows to finish out the process in the next section.
Basically, now when you browse and put files in your “Downloads” folder, they’ll actually go to your storage drive’s “Downloads” folder. Anything in your home folder itself will stay in /home/yourusername/, not on your storage drive. A few of the folders, like “Desktop” and “Templates,” probably won’t benefit from this treatment, either. Templates are rarely used, the desktop usually gets cluttered with shortcuts and the like, and the Windows desktop isn’t elegantly redirected, unfortunately.
Boot into Windows, and you’ll see that there’s another partition called “storage” under “My Computer.” Windows 7 has the beautiful Libraries feature built-in, so take a look at our article “Understanding the Libraries Feature in Windows 7,” and you’ll see step-by-step directions on how to add your new storage folders to your libraries.
As you can see, my storage drive folders are a part of my libraries. My storage drive letter is E: because my network share is at D:. Also, take a look at our “Change the Default Save Folder for Windows 7 Libraries…” article so that when you stick things in your libraries, they automatically get saved to your new storage folders as well.
The last thing you’ll have to change is the default “Downloads” directory in your preferred web browser(s), which can point to your “Downloads” library. All done!
It’s also worth mentioning that if you have some know-how, you could even do this with a remotely shared drive on your network, though it may prove to be too slow for actual use. A better idea is to turn your storage partition into a shared drive that can be accessed by other computers in your network.
Image by Ifijay
The common approach to create an index table in Word is to manually mark each word that we wish to index, but the other alternative is to use a concordance document to automatically index our master document, which is what we will cover in today’s article.
Let’s start by creating a two column table in our concordance file. Write the words that you would like to be marked for indexing in the left column. Write the text that you would like to use in the master document’s index table in the right column.
Close the concordance file and open your master document’s reference tab to index our master document.
Click on the “AutoMark” button and choose the concordance document when Word prompts you to specify the AutoMark file.
Right after you click the OK button you will see that Word creates some index entry fields in our document.
We can hide these fields by clicking the “Show/Hide Paragraph” button in the home tab.
Go to the end of the master document and click the “Insert Index” button one more time and click the OK button this time to create the index.
That’s all we have on how to create an index table with a concordance file. Let’s take a closer look on how we can customize the index style.
Word allows us to create different type of index. Here we have an index with sub-entry that is particularly useful when we want to group a set of closely related concepts in our document.
The trick of creating a sub-entry is by separating the text in the right column of our concordance document table with a colon (:). Word will treat any words that come after the colon as a sub-entry in the index.
Another useful type of index is a cross reference index that usually comes in the form of “See also …”
Unfortunately we can’t create cross references in our index table using a concordance file, so we have to manually edit the index field by adding “\t” after the indexed word followed by the cross referenced word.
One of the challenges with maintaining an index in Word is that Word does not give us a button or menu that we can simply click to clear the index fields if we decide to redo our concordance file.
We have to use a Visual Basic script to clear the index fields in our document. Most of you must be thinking “Visual Basic Script, I am not a programmer ! What is that ?”. Don’t worry it’s not as bad as it sounds. Just copy and paste this simple script written by the awesome guys at TechRepublic into Word’s Visual Basic editor and run it to clean your master document’s index fields.
Open the Visual Basic editor by pressing Alt+F11 and place this script into the editor. Execute the script by clicking the “run button” to clean the master document’s index fields.
Your master document should no longer have any index fields. We can now re-index the master document and recreate the index table using the “Insert Index” menu.
Yes index is definitely useful for your reader, but most probably some of you are thinking, “Why does the index table look so boring. Can I change the way it looks to make it more appealing ?”. The answer is yes, index table does not have to look plain.
We can adjust the index table’s style by selecting the one of the available format to adjust the look and feel of the index table.
Here is an example on how the Classic index format looks like.
We can even apply our own style to the index table by choosing the “From Template” and clicking the “Modify” button.
Choose one of the available index styles and click the “Modify” button to make our own style.
We can adjust the index table’s font style.
Gives the index table some borders, or numbering;
… to give the index table a specific look and feel.