Tag Archives: Windows

Tensorflow – No such file or directory

Hey guys,

Just a quick post on how to resolve an error I came across while testing out tensorflow:

Traceback (most recent call last):
  File "C:\Users\Chris-PC\Desktop\images-to-use\attempt2\tensorflow\examples\label_image\label_image.py", line 112, in <module>
    graph = load_graph(model_file)
  File "C:\Users\Chris-PC\Desktop\images-to-use\attempt2\tensorflow\examples\label_image\label_image.py", line 30, in load_graph
    with open(model_file, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'tensorflow/examples/label_image/data/inception_v3_2016_08_28_frozen.pb'

All you need to do is download the following file and place it in the directory in the error message: https://storage.googleapis.com/download.tensorflow.org/models/inception_v3_2016_08_28_frozen.pb.tar.gz

Rename all files in a directory with Sequential Numbers

Hey guys,

Just a batch script I came across that allows you to rename all files in a directory with sequential numbers. Really handy for things like tensorflow. All you need to do is create a batch file in the directory containing the following:

@echo off
setlocal EnableDelayedExpansion
set i=0
for %%a in (*.jpg) do (
    set /a i+=1
    ren "%%a" "!i!.new"
)
ren *.new *.jpg

 

Thanks to this stackoverflow post: https://superuser.com/a/350633/124014

Running ReadTheDocs on Windows

Hey everyone,

This is a quick guide on how to setup your own readthedocs server on Windows.

Install Python 2.7: https://www.python.org/downloads/

Install virtual env using pip via command prompt (run as administrator):
c:\Python27>python.exe scripts\pip.exe install virtualenv

Create a virtual environment:
c:\Python27>scripts\virtualenv.exe c:\readthedocs
c:\readthedocs\Scripts>activate.bat
(readthedocs) c:\readthedocs\Scripts>

Create a folder and clone the repository:
(readthedocs) c:\readthedocs\Scripts>md checkouts
(readthedocs) c:\readthedocs\Scripts>cd checkouts
(readthedocs) c:\readthedocs\Scripts\checkouts>git clone http://github.com/rtfd/readthedocs.org.git
Cloning into 'readthedocs.org'...
remote: Counting objects: 47896, done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 47896 (delta 19), reused 0 (delta 0), pack-reused 47843
Receiving objects: 100% (47896/47896), 37.91 MiB | 8.76 MiB/s, done.
Resolving deltas: 100% (31783/31783), done.
Checking connectivity... done.

Get and install dependencies using pip:
(readthedocs) c:\readthedocs\Scripts\checkouts>cd readthedocs.org
(readthedocs) c:\readthedocs\Scripts\checkouts\readthedocs.org>git clone http://github.com/rtfd/readthedocs.org.git

Ran into the following error: no module named django.core.management (probably caused by having two version of python installed)
(readthedocs) c:\readthedocs\Scripts\checkouts\readthedocs.org>c:\Python27\python.exe c:\readthedocs\Scripts\pip.exe install django --upgrade
Collecting django
Using cached Django-1.10.2-py2.py3-none-any.whl
Installing collected packages: django
Successfully installed django-1.10.2
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.

Build the database:
(readthedocs) c:\readthedocs\Scripts\checkouts\readthedocs.org>c:\Python27\pytho
n.exe C:\readthedocs\Scripts\checkouts\readthedocs.org\manage.py syncdb
Operations to perform:
Synchronize unmigrated apps: allauth, messages, django_extensions, django_grav
atar, rest_framework, annoying, textclassifier, corsheaders, copyright, privacy,
django_countries, humanize, rtd_tests, haystack, doc_builder, staticfiles, rest
api, bitbucket_oauth2, bitbucket, notifications, djangosecure, pagination, githu
b, djcelery, payments
Apply all migrations: core, account, builds, gold, sessions, admin, guardian,
tastypie, messages_extends, comments, sites, contenttypes, redirects, auth, tagg
it, oauth, bookmarks, donate, projects, socialaccount
Synchronizing apps without migrations:
Creating tables...
Creating table corsheaders_corsmodel
Creating table celery_taskmeta
Creating table celery_tasksetmeta
Creating table djcelery_intervalschedule
Creating table djcelery_crontabschedule
Creating table djcelery_periodictasks
Creating table djcelery_periodictask
Creating table djcelery_workerstate
Creating table djcelery_taskstate
Running deferred SQL...
Installing custom SQL...
Running migrations:
Rendering model states... DONE
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying account.0001_initial... OK
Applying account.0002_email_max_length... OK
Applying admin.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying taggit.0001_initial... OK
Applying projects.0001_initial... OK
Applying builds.0001_initial... OK
Applying projects.0002_add_importedfile_model... OK
Applying bookmarks.0001_initial... OK
Applying builds.0002_build_command_initial... OK
Applying comments.0001_initial... OK
Applying core.0001_initial... OK
Applying core.0002_make_userprofile_user_a_onetoonefield... OK
Applying core.0003_add_banned_status... OK
Applying donate.0001_initial... OK
Applying donate.0002_dollar-drop-choices... OK
Applying donate.0003_add-impressions... OK
Applying donate.0004_rebase-impressions-on-base... OK
Applying donate.0005_add-geo-filters... OK
Applying donate.0006_add-geo-data... OK
Applying donate.0007_add-impression-totals... OK
Applying gold.0001_initial... OK
Applying guardian.0001_initial... OK
Applying messages_extends.0001_initial... OK
Applying sites.0001_initial... OK
Applying socialaccount.0001_initial... OK
Applying socialaccount.0002_token_max_lengths... OK
Applying oauth.0001_initial... OK
Applying oauth.0002_combine_services... OK
Applying oauth.0003_move_github... OK
Applying oauth.0004_drop_github_and_bitbucket_models... OK
Applying oauth.0005_add_account_relation... OK
Applying oauth.0006_move_oauth_source... OK
Applying oauth.0007_org_slug_nonunique... OK
Applying projects.0003_project_cdn_enabled... OK
Applying projects.0004_add_project_container_image... OK
Applying projects.0005_sync_project_model... OK
Applying projects.0006_add_domain_models... OK
Applying projects.0007_migrate_canonical_data... OK
Applying projects.0008_add_subproject_alias_prefix... OK
Applying projects.0009_add_domain_field... OK
Applying projects.0010_migrate_domain_data... OK
Applying projects.0011_delete-url... OK
Applying projects.0012_proper-name-for-install-project... OK
Applying projects.0013_add-container-limits... OK
Applying projects.0014_add-state-tracking... OK
Applying projects.0015_add_project_allow_promos... OK
Applying projects.0016_build-queue-name... OK
Applying projects.0017_add_domain_https... OK
Applying redirects.0001_initial... OK
Applying sessions.0001_initial... OK
Applying taggit.0002_auto_20150616_2121... OK
Applying tastypie.0001_initial... OK

Starting the readthedocs server:
D:\Users\ChrisO>C:\readthedocs\Scripts\activate.bat

(readthedocs) D:\Users\ChrisO>c:\Python27\python.exe C:\readthedocs\Scripts\chec
kouts\readthedocs.org\manage.py runserver
Performing system checks…

System check identified no issues (1 silenced).
October 21, 2016 – 11:16:17
Django version 1.8.3, using settings ‘readthedocs.settings.dev’
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

Create a new readthedocsproject:
I followed this guide: http://read-the-docs.readthedocs.io/en/latest/getting_started.html#in-rst

Creating the new project:
C:\readthedocs>md whatibroke
C:\readthedocs>cd whatibroke
C:\readthedocs\whatibroke>C:\readthedocs\Scripts\sphinx-quickstart.exe
Welcome to the Sphinx 1.3.5 quickstart utility.

Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).

Installing a theme – sphinx_rtd_theme (optional step):
c:\readthedocs\Scripts>activate.bat
(readthedocs) c:\readthedocs\Scripts>cd c:\readthedocs\whatibroke
(readthedocs) c:\readthedocs\whatibroke>pip install sphinx_rtd_theme

In your conf.py file (C:\readthedocs\whatibroke\conf.py):
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

Building your output:
c:\readthedocs\Scripts>activate.bat
(readthedocs) c:\readthedocs\Scripts>cd c:\readthedocs\whatibroke
(readthedocs) c:\readthedocs\whatibroke>make html
Running Sphinx v1.3.5
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
no targets are out of date.
build succeeded.

Build finished. The HTML pages are in _build/html.

Thanks to the following stackoverflow post for a lot of the information here: http://stackoverflow.com/a/19892345/522859

Windows 10 – Search Not Working

Hey everyone,

I’ve just upgraded to windows 10, however the start menu search has been randomly breaking. It just seems to load indefinitely. Thankfully there’s an easy fix:

- Start task manager (ctrl + shift + esc)
- Click more details
- Under the processes heading look for Search (green icon under background processes)
- Click on Search and hit end task

The Search process should now restart and start working. If not you can restart it manually using file > run.

Windows 10 search not working

Windows 10 search not working

wget or curl on Windows

Hey everyone,

Just a quick post on a Window’s equivalent to wget/curl.

To start, you’ll need to open PowerShell (run > powershell.exe). To retrieve the page, you’ll just need to enter the following one liner:

(new-object System.Net.WebClient).DownloadFile('http://www.whatibroke.com','C:\my_output_file.txt')

The page contents will be stored in the output file provided as the second parameter to DownloadFile. To view it, just open the file in a text editor.

If you’d rather something with a GUI, winwget has been recommended on SuperUser.

Refresh Folder Hotkey – Sublime Text 2

Hey everyone,

Just a quick post on how to setup a refresh hotkey in Sublime on Windows. All you have to do is the following:

1) Open sublime
2) Select Preferences from the top menu and then click “Key Bindings – Default”
3) Go to the end of the file and add a comma to the last entry:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
        //Original
	{ "keys": ["enter"], "command": "hide_panel", "context":
		[{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}]
	},
	{ "keys": ["shift+enter"], "command": "find_prev", "context":
		[{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}]
	},
	{ "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true},
		"context": [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}]
	}
 
        //Modified
        //Original
	{ "keys": ["enter"], "command": "hide_panel", "context":
		[{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}]
	},
	{ "keys": ["shift+enter"], "command": "find_prev", "context":
		[{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}]
	},
	{ "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true},
		"context": [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}]
	}

4) Add the following entry:

1
2
//Custom
{ "keys": ["f5"], "command": "refresh_folder_list" }

Now all you have to do is save the file and F5 will now refresh your project! If you want to change the hotkey, simply switch [“f5”] for another value.

Leave a comment below if you have any issues or tips!

Git with KDiff3 – Windows

Hey all,

Just a quick post showing the config I needed to use in order to get KDiff3 working with git. It took a while to get this working so hopefully it’ll be able to help someone else out.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#Config file
[user]
	email = test@test.com.au
	name = test
[core]
	editor = \"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\"
 
[apply]
    whitespace = fix
 
[color]
    branch = auto
    diff = auto
    interactive = auto
    status = auto
 
 
[core]
        pager = less -FRSX
        whitespace = cr-at-eol
        autocrlf = input
        excludesfile = /Users/test/.gitignore_global
        editor = mate -w
 
[alias]
        co = checkout
        lg = log --graph --pretty=oneline --abbrev-commit
 
[gui]
	recentrepo = Y:/Projects/Junk
	recentrepo = C:/xampp/htdocs/onlinemedia
[merge]
	tool = kdiff3

Screenshot of git config from GUI:

Git Config KDiff

Git Config KDiff

Running KDiff3:

Executing KDiff3

Executing KDiff3

KDiff3 display:

KDiff3 Display

KDiff3 Display