As you might or might not know I’m running Profit Trailer (PT) on a VPS. To be safe the GUI is not accessible to the outside world, but only through an SSH tunnel. It has been irritating me for a while that the URLs are not readable, e.g. localhost:8081. I wanted readable URLs without ports in them. Today I finally figured out how to do this using a combination of host file and the Windows networking tool netsh.
When I pressed the on/off on my Surface Pro 4 running Windows 10 it would shut down! Really irritating.
After searching around for a while I found the setting under System Settings that controls the behavior of the on/off button.
- Open Control Panel > Power Options > System Settings
- Change the action when the on/off button is pressed to ‘Sleep’.
That’s it. Another problem solved!
I’m back… It has been a while since my last post. To busy doing other things and not keeping up with my techie skills. I have decided it is time for some new projects. I have a few ideas lined up. Python, Flask, Angular 2 and Ionic 2 are my tools of choice. So I will be blogging about my adventures the comings weeks, months, …
Okay, this blog is going to be on setting up Python on Windows. Just some quick for myself with notes for later reference.
- Install Python
- Set environment variable %PYTHON27%
- Add the following Python dirctories to path: bin & scripts
- Setup virtualenv, a tool for creating isolated Python virtual environments, each with their own libraries and site-packages:
pip install virtualenv
- Install virtualenvwrapper, provides a set of commands which makes working with virtual environments much more pleasant. It also places all your virtual environments in one place:
pip install virtualenvwrapper-win
- Add an environment variable WORKON_HOME to specify the path to store environments. My choice: %PYTHON27%\env.
- For an overview of the main commands check the repository on GitHub.
- In order to keep your environment consistent, it’s a good idea to “freeze” the current state of the environment packages. To do this, run:
pip freeze > requirements.txt
- This will create a
requirements.txtfile, which contains a simple list of all the packages in the current environment, and their respective versions. You can see the list of installed packages without the requirements format using “pip list”. Later it will be easier for a different developer (or you, if you need to re-create the environment) to install the same packages using the same versions:
pip install -r requirements.txt
- Install Flask-DebugToolbar an extension that adds a toolbar overlay to Flask applications containing useful information for debugging:
pip install flask-debugtoolbar
- Check the Flask-DebugToolbar documentation for more information on the use.
- Install initpy that helps initialize Python projects. It has support for different types of projects: single file project, Flask, Tornado Web, Falcon and Hosted.
pip install initpy
Time to beef up security. Like everyone I have a large number of online accounts. They are generally secured with username and password. I use KeePass to generate unique passwords and keep track of them. There have been a lot of hacks lately. So I wanted to make my most important accounts more secure. More and more online services are adding two factor authentication, e.g. Google, Dropbox. Two factor authentication adds an additional layer of security.
Seriously? Unsupported major.minor version 51.0 when compiling a Scalatra project? The complete error is “Caused by: java.lang.UnsupportedClassVersionError: org/eclipse/jetty/server/Handler : Unsupported major.minor version 51.0”. After some Googling I found the following statement “You are using different JDK versions to compile and run the application”. No way, that is not possible. Continue reading
Scalatra is a micro framework for Scala. Installation does not seem to be as straight forward as adding Scalatra to the dependencies of build.sbt. It requires a number of other tools to work: Conscript and giter8. Conscript is a tool for installing and updating Scala code. giter8, which depends on conscript, allows you to check out project templates directly from Github. It’s the recommended way to generate Scalatra project skeletons. These are quick installation instructions for Scalatra on Windows. Continue reading
Today I wanted to add one of my Github repositories to a sbt project. I was working on my Windows laptop. I setup the following Build.scala file and placed it in the project directory under the root directory of my sbt project: Continue reading