Windows -- Berry Web Blog -- page 0

Effective Windows Setup

Posted: 2016-03-15. Modified: 2016-03-15. Tags: howto, Windows, practical.

1 Introduction

This article discusses some of my tips for effective usage of Microsoft Windows by a privacy and productivity minded individual.

I break down the article into two sections: one aimed at "Standard Users", and one aimed at "Power Users". I define standard users as people who are primarily interested in using a browser, using an email client, working on various types of office documents, using the filesystem, listening to music, and watching movies. I define "Power Users" as people who, in addition to the above use cases, have characteristics such as : interest in automating their interactions with the computer, interest in engaging in software development in various software stacks, interest in using remote servers, interest in using source control.

2 Standard Users

2.1 Privacy and Control

Newer versions of Windows take away an astonishing amount of privacy and control from the user. This is one major factor that is increasingly pushing me towards alternatives such as Linux and BSD. There are some tools that can help on Windows, however.

My favorite on Windows 10 is a tool called "Shutup10" which lets you configure Windows 10 data-leaking behaviours in one spot.

Another favorite Windows software of mine for new Windows versions is "Classic Shell". The start screen of Windows 8 is not something I really like, and the start menu of Windows 10 still leaves a lot to be desired.

For Classic Shell I set the following options:

  1. set start menu theme to "classic"
  2. set start menu button to "classic"
    1. adjust size of start menu button to make it bigger.

For Windows 10, I additionally uninstall Cortana and OneDrive – I have little interest in sharing my local data with Microsoft. Additionally, I noticed that Cortana takes significant system resources.

Follow these directions to uninstall Cortana, (warning, this will break the default Windows 10 start menu).

Follow these directions to uninstall OneDrive.

verdict: use Shutup10 and Classic Shell to restore a windows-7-like experience.

2.2 Internet Tools

2.2.1 Browser

The main tool most people use to interact with the internet is their browser.

Chrome/Chromium is probably the best-supported browser by websites today. Practically minded standard users should probably just use Chrome and call it a day.

I personally primarily use the browser "Pale Moon". "Pale Moon" has several advantages over Chrome, including the fact that various things work better when running sites over the file:// protocol (extensions have stronger permissions to start with), there are a bunch of great firefox extensions which work with Pale Moon, and that the project has independent governance and isn't controlled by one of the mega-corporations. Pale Moon is not perfectly supported by every website, and some websites do User-Agent checking to warn against using Pale Moon (even if Pale Moon works perfectly fine there!).

Another browser that I find very promising is Brave. This browser project supports interesting ideas about the future of web-advertising.

Whichever browser you use, I recommend installing an ad blocker to speed up your browsing experience and remove gaudy ads. I recommend disabling the ad-blocker on sites which you would like to support.

My favorite ad-blocker for Chrome is "Adblock" (not Plus or Pro). This seems to have a simple UI and give effective results. Pale Moon has an adblocker called "Adblock Latitude" available which works quite well in my experience.

verdict: if you want to support an independent browser, use Pale Moon. Otherwise, use Chrome. Install an adblocker on either one.

2.2.2 Email/Organizational Client

It seems most people these days use webmail clients such as Yahoo Mail or Gmail. These work fine.

In the past I have used desktop email software including Microsoft Outlook, EM Client, and Thunderbird. Microsoft Outlook always seemed like a bit of a buggy mess for my use cases (I used Outlook 2010) and did not support integrating multiple inboxes very well. I was very happy with EM Client for a while, but eventually my installation developed some sort of bug where it would constantly de-authorize itself and ask for me to input my license key. This got very old. Additionally, EM Client began to take up too many system resources and be very slow to respond. I stopped using EM client. Thunderbird is a fine email client, but I don't remember being especially impressed with its calendar/notes feature (Sunbird). Thunderbird has largely been abandoned by Mozilla.

I currently use my self written tool berryPIM to manage my todos, finances, contacts, and calendar, and use webmail for my email. I plan to incorporate an email client in to berryPIM in the future.

verdict: if you don't care about privacy or offline access, use webmail, web-calendar, web-finances, and web-todos. If you do, consider using something like berryPIM for managing at least your calendar, contacts and the like.

2.3 Document Creation

I currently recommend LibreOffice 5.1 as the best free and open-source document suite. It is a good set of tools, and while it has weaknesses in areas such as typesetting formulas or easy built-in documentation for scripting, I still think it's quite good and useful.

Apache OpenOffice is a strong alternative to LibreOffice, and is perhaps a bit more stable and traditional than LibreOffice. Microsoft Office is a good tool as well, but is not free (in price or in the hackable sense).

verdict: LibreOffice 5.1 is good for many document editing needs.

2.4 Media

I recommend winamp as a light and fast Windows music player. I have had terrible experiences with iTunes for Windows – it installs background tasks which consistently used large resources on my machine and slowed it down.

VLC is a great tool to play videos and various types of media.

verdict: use winamp for music, VLC for videos.

2.5 Utility

Standard users need to consider a few utility tasks for their computer.

2.5.1 Backup

Backup is important if you don't like losing files. Various versions of Windows provide different backup utilities – one based on simple backup and restore functionality, another based on versioned snapshots similar to Apple Time Machine.

I personally use neither of the above tools, but instead use rsync in conjunction with cygwin (cygwin is discussed in the "Power User" section below). I use the Windows Task Scheduler to schedule a nightly backup of folders which are important to me. I recommend backing up to a remote location, if you have access to a server which you can access remotely. Otherwise, a locally attached hard drive should be ok for most purposes.

If you have cygwin64, here is an rsync command which can be entered into "Task Scheduler" to perform a complete backup of the Desktop folder:

Put the following into the "Program/script" box:

C:\Cygwin64\bin\bash.exe

Put the following into the "Add arguments" box:

-l -c "rsync  -rlt -z --chmod=a=rw,Da+x --delete /cygdrive/c/Users/vancan1ty/Desktop/ /path/to/destination/location/ >> /cygdrive/c/Users/vancan1ty/logs/backup_log.txt 2>&1"

(you must change the source, destination, and log file paths to match your use case).

Here is a screenshot of what it looks like on my computer.

verdict: use rsync+Task Scheduler to perform simple incremental remote backups.

2.5.2 Antivirus

Antivirus is less important for Windows users today than it was in the past. Newer versions of Windows come automatically configured with Windows Defender, which is a reasonable antivirus solution, and many email services do a better job at filtering virus-containing spam. Still, it is possible to get viruses today, especially if you are downloading files from less-than-reputable sources. In addition to outright viruses, you can accidentally download various "undesirable" software as parts of installation packages for other software and the like.

It is ok to disable Windows Defender realtime protection if you feel that you can stay out of trouble for the most part and that it is using too many system resources.

I recommend leaving on Windows Defender's realtime detection feature, and additionally installing the free version of Malwarebytes anti-virus. I recommend scanning your system with Malwarebytes once in a while to see what it finds. Malwarebytes has good reviews and has served me well. This antivirus routine should be fine as long as you are reasonably savvy with phising scams and the like, and are not a high profile target.

verdict: Use Windows Defender (realtime) + Free Malwarebytes (periodically)

3 Power Users

Below are some of my recommended configurations for developer and power-user tools on Windows. These recommendations build on my recommendations in the previous section for standard users.

3.1 General Power Tools

3.1.1 Text Editor

There are numerous excellent text editors for windows, among them Notepad++, GVim, Atom, and Sublime Text.

  1. Emacs

    I am a big fan of Emacs with Vim keybindings. I recommend you check out my .emacs file here to get a feel for some of the optimizations you can do for Emacs in Windows and in general. See this link for some reasons I like emacs over its competitor vim.

    If you choose to use Emacs, one thing you might want to do for Windows is change the default Emacs shell to be cygwin, so that you can use a large proportion of the built-in unix-linked Emacs commands such as "man", "grep", and "make".

    Here some lines which set msys as the default shell with cygwin as a backup:

    (setq shell-file-name "C:/MinGW/msys/1.0/bin/bash")
    (setq explicit-shell-file-name shell-file-name)
    
    (setenv "PATH"
       (concat ":/usr/local/bin:/mingw/bin:/bin;"
       (getenv "PATH")))
    
    (defun cygwin-shell ()
       "Run cygwin bash in shell mode."
       (interactive)
       (let ((shell-file-name "C:/cygwin64/bin/bash")
       (explicit-shell-file-name "C:/cygwin64/bin/bash"))
       (call-interactively 'shell)))
    

    One important tip which gives Emacs a bit more of an IDE "feel" is to use the emacs "speedbar" feature. The speedbar is a frame which opens up to the left of your main document frame, and allows you to navigate through files in a way similar to the file browser in many IDEs and developer tools. You can lock the speedbar to a specific directory or let it follow you as you open up documents.

    verdict use emacs with a smart .emacs file, fall back to notepad++.

3.1.2 Shell

If you are used to using a Unix/Linux shell, you will probably enjoy getting a similar experience on Windows.

Cygwin is the best Unix shell and POSIX compatibility layer for Windows. There are a variety of other alternatives, including msys, msysgit, and msys2. Each of these alternatives is to some degree based on cygwin. Msys is older and among other things only bundles 32 bit utilities (restricting file size in rsync transfers, for example). msysgit is supposed to be an even older version of msys, though apparently with recent git releases they have switched to msys2. Msys2 is close to cygwin, and is the best of the msys iterations, but still doesn't have as many packages as cygwin and in my opinion may try to be a little too smart in transparently converting between windows and unix paths, line-endings, and the like. For a list of differences between Cygwin and Msys2, see the following link.

If you use Cygwin, you may want to set your windows environment variable HOME to "C:\Users\[username]". This way, Cygwin will use your windows home directory as your cygwin home.

Cygwin is great, but it has several pitfalls which I have run into.

  1. The default mintty terminal, while it is nice, does not work with "interactive" windows shell commands (e.g. you can't run a Windows version of python from within mintty cygwin).

    I find this to be particularly annoying. Fortunately, you can run cygwin using the default windows console as well – I recommend adding a shortcut in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Cygwin to C:\cygwin64\Cygwin.bat so you can run easily launch cygwin using the default windows console.

  2. Binaries built in cygwin gcc will depend on cygwin1.dll.

    If you would like to create standalone, native Windows binaries, follow the directions here: http://www.mingw.org/wiki/FAQ under the header "How do I use MinGW with Cygwin?". Basically, whenever you want to use the native gcc and related tools from within Cygwin, just prepend mingw tools to your cygwin path. Then you can build native builds to your hearts content. Check the first level of dependencies using the "DUMPBIN" utility to confirm that cygwin1.dll is not a dependency.

If you decide to use cygwin instead of msys2 as your primary shell, you need to be aware of the distinction between native Windows binaries and Cygwin binaries. These differences are especially obvious in the areas of filesystem paths, interpretation of newlines in output, and when dealing with symlinks. Cygwin provides some utilities in the "cygutils" package to help deal with these problems – I think the most useful are cygpath (path conversion) and "dos2unix"/"unix2dos" (line-ending conversion).

verdict use cygwin, set up cygwin path to call mingw native tools when necessary.

3.1.3 Git

If you are developer, you are probably familiar with the widely popular version control system Git.

Git has a good native Windows installer from https://git-scm.com/ . Git can also be installed within the cygwin environment using Cygwin's setup.exe.

I do not recommend using the default Git Windows explorer integration features for "Git GUI" and "Git Bash". I recommend using cygwin instead of "Git Bash", and "TortoiseGit" instead of "Git GUI". TortoiseGit is a very nice GUI tool for using Git which integrates with Windows Explorer. It uses graphical icon overlays to visually convey the modification/commit status of files in your git repositories, and also allows you to perform all common git actions from within a fairly-easy-to-use GUI.

  1. TortoiseGit tips

    If you are following my advice from earlier in this guide and are using Cygwin as your primary shell, then I recommend that, during the TortoiseGit installation process, you select "OpenSSH" as your SSH authentication provider. That way, you can reuse your OpenSSH public and private keys in ~/.ssh when making SSH connections to remote servers for Git actions.

    verdict use git with tortoisegit for GUI integration.

3.2 Privacy and Control

Most of what I said for standard users applies here for power users as well. One hack I like in addition is removing the Windows 10 startscreen (use the following directions).

Figure out what your ideological stance is on sending your local files to Microsoft, and adjust the settings in ShutUp10 accordingly. On Windows 7 you don't need to worry too much for the most part. Windows 8 is in-between the two.

verdict be aware of what data leaks out of your computer.

3.3 Internet Tools

In addition to my browser and email/organizational recommendations above, I know of a few more internet-related tools that may be useful to power-users.

3.3.1 File transfer client

FileZilla is a multiplatform GUI file transfer client. I recommend using it for FTP and SFTP transmission of files.

3.3.2 Port probing

I think the NMap GUI ZenMap is a great port GUI probing tool.

3.3.3 Command-line tools

There are a variety of command-line tools built in to windows or from the linux/unix world which are very useful for internet-related tasks. You can get them by using cygwin, for example.

Some of my favorites are:

  • rsync – incremental file syncing
  • ping – see if server responds to ICMP request
  • curl – download files and data.
  • scp – copy files to and from remote server
  • ssh – securely connect to remote servers

verdict learn the unix-style command line!

3.4 Document Creation

3.4.1 Standard Office Docs

What I said for the Standard User scenario still applies here.

Something power-users may want to look into with libreoffice is saving their documents in ".fodt/.fods" format. The "f" prefix formats are saved as a plain xml file, rather than being saved as a gzipped folder of xml files (as is the usual method). This allows you to much more effectively put libreoffice documents in version control, as well as occasionally work directly with the text of documents.

One thing I think is characteristic about power users is our desire to automate repetitive or difficult tasks. A saying I like, for example, is "If you can't script it, I ain't interested".

In that spirit, I think most power-users will want to dabble their feet into scripting their office suite after awhile. Microsoft Office has a fairly simple-to-use API accessible from VBA for doing many common document-related tasks. It also has an "Object Browser" built in which facilitates discovering and using the document API, as well as corresponding documentation online.

LibreOffice/OpenOffice are not at first glance quite as accessible to would-be scripters. Both embed a language similar to VBA called starbasic, and the StarBasic syntax and commands are well documented through the built-in help feature. However, the actual API to interact with documents is provided through a cross-language abstraction called UNO, and this can be somewhat confusing and is not documented in an accessible way to newcomers or non-programmers.

UNO involves some confusing terms such as "Included Services" and "Exported Interfaces", and if you don't understand it it can be difficult to find what you can actually do to an object or to discover the functionality you are looking for. Once you get the hang of it its not too bad, however. I recommend the following resources and the following tool to get you up to speed with LibreOffice scripting:

  1. The excellent book "OpenOffice.org Macros Explained" by Andrew Pitonyak, currently available for free at his site http://www.pitonyak.org/oo.php.
  2. The LibreOffice IDL API (for LibreOffice) or the OpenOffice IDL API (for OpenOffice).
  3. The tool X-Ray by Bernard Marcelly provides a way to explore available methods and properties within LibreOffice/OpenOffice. This functionality is similar to that provided by the object browser in Microsoft Office

Once you develop a familiarity with BASIC and the common UNO interfaces, you should be able to script your documents to your hearts content!

verdict use fodt and learn Libreoffice scripting

3.4.2 Closer Control

You can achieve tighter control and sometimes better output by using TeX or LaTeX to typeset your documents. I am proficient in TeX, and find it useful for documents where I want tight control of the layout or for document which have lots of formulas.

I'll put more in this space sometime but for now I will recommend:

  1. The TeXBook by Donald Knuth to gain an understanding of how TeX works (this book is fairly verbose, but it does get the job done).
  2. The Tex Reference by David Bausum for a hyperlinked reference to standard TeX control sequences.
  3. TexRefCard by J.H. Silverman for quick reference to common control sequences and functionality.
  4. OPmac by Petr Olsak to get some of the benefits of LaTeX, and the easy ability to switch between some common fonts, without having to go all in on the vast and confusing LaTeX.

verdict learn TeX if you are really pedantic about tiny details in your documents.

3.5 Media

You might enjoy the cross-browser script "downloadyoutube" which allows to download youtube videos as mp4 files. Another browser extension which I have seen recommended for downloading videos is downloadhelper.

If you are interested in editing images and icons, you should check out the FOSS tools Gimp and Inkscape. I do not know much about editing videos or animation, so I won't make recommendations in those areas.

verdict get downloadyoutube, learn image editing with Gimp

3.6 Utility

I detailed a simple Rsync-based backup system in the Standard User section, that is adequate for my needs for now. If you need something more complex, you can probably rig it up with rsync – see for example "Time Machine for Every Unix out there" for how to store versioned history of your files. Other recommendations from standard section stay in effect.

verdict use AV, learn Rsync

3.7 Programming Language Specific

3.7.1 Java

Java is a great programming language and runtime, contrary to what many haters like to state.

Maybe Java's greatest weakness is its comparatively high memory usage and the presence of some unpredictability in latency due to garbage collection pauses.

One of the great things about Java is the wonderful tooling that exists for it. I recommend IntelliJ Idea as my favorite Java IDE, and maven as my favorite java build tool.

verdict use IntelliJ IDEA

3.7.2 C/C++

Mingw provides a good C/C++ development environment on Windows, similar to what you can get on Linux/Unix. Specifically, it seems that today the Mingw-w64 fork of Mingw provides the best support for programming with GCC using the native Windows APIs. See my note above in the Shell section on how to run native Windows builds from Cygwin.

Learn how to use GDB and valgrind.

Emacs provides a good environment to develop C/C++ code.

verdict learn how to call native Mingw tools from Cygwin

3.7.3 Python

I like python a lot, and find it a very productive environment for interactive computing and experiments. Python's practical power is in large part due to its excellent ecosystem of libraries and tools.

A very good way to install Python on Windows is through the "Anaconda" package from Continuum Analytics.

Below are some useful Python packages for data analysis and math…

  • Scipy+Ecosystem SciPy and its related tools (Matplotlib, NumPy, Pandas, IPython,Scikit-Learn,…) really do form an amazing toolset for data analysis and mathematical problems. This is definitely my preferred toolset for these problems currently – I have tried some alternatives but I prefer the python libraries and toolset.
  • SymPy is a decent toolit for symbolic math. It is slow compared to Mathematica, and a bit confusing to use in my opinion.

I have yet to try out the myriad of deep learning libraries and the such which are supported through python. This is a hot field and I plan to do this if I ever get access to suitable GPU hardware or a fast CPU.

Emacs provides a good environment to develop Python code.

verdict download Anaconda, start playing with awesome libraries.

4 Conclusion

I hope you enjoyed my opinions and tips on using your Windows PC effectively. Please email me at currellberry at gmail if you find any errors or have any comments. Thanks!


How to Get SDL+Opengl Going on Windows

Posted: 2015-09-15. Modified: 2016-12-21. Tags: Windows, OpenGL, howto, practical.

I know these directions are a bit sketchy, for now I am just writing down what I remember from the process. I will test these instructions on a fresh box soon.

  1. Install SDL. Download SDL for mingw, ignore the install directions. Instead copy things into your c:/mingw directory.
  2. Install glew. download sources and compile with msys. then copy into appropriate directories (dlls go in C:\Windows\SysWOW64").
  3. Build the attached "test\opengl.c" with the following command:
    gcc -o test.exe test_opengl.c -lopengl32 -lmingw32 -lSDL2main -lSDL2 -lglew32
    
  4. profit.

How to get pretty latex-style documents in Microsoft Word

Posted: 2015-09-15. Modified: 2015-12-21. Tags: Windows, practical, howto.

follow guide at http://blog.lnk.si/posts/fake-latex.html

in particular, start with the template there.

http://www.gust.org.pl/projects/e-foundry/lm-math/download/index_html latin modern math

http://canopus.iacp.dvo.ru/~panov/cm-unicode/download.html computer modern unicode fonts

http://www.gust.org.pl/projects/e-foundry/latin-modern/download latin modern fonts

make sure you print to pdf using something like cutepdf, DON'T USE word's export feature.

Atom Feeds:
Tags: