tag:blogger.com,1999:blog-11099932909998935342019-06-14T12:00:04.965+03:00SimionBaws.roA software developer's blog.Unknown[email protected]Blogger41125tag:blogger.com,1999:blog-1109993290999893534.post-87928341457223338892017-04-26T15:23:00.005+03:002017-04-27T22:39:50.606+03:00PIP - upgrade all packages from requirements.txt (interactively)<h1 style="border-bottom: 1px solid rgb(234, 236, 239); box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; line-height: 1.25; margin-bottom: 16px; margin-left: 0px; margin-right: 0px; margin-top: 0px !important; padding-bottom: 0.3em;">pip-upgrader</h1><h1 style="border-bottom: 1px solid rgb(234, 236, 239); box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; line-height: 1.25; margin-bottom: 16px; margin-left: 0px; margin-right: 0px; margin-top: 0px !important; padding-bottom: 0.3em;"><div style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px;">An interactive&nbsp;<em style="box-sizing: border-box;">pypi</em>&nbsp;pip requirements upgrader. Because upgrading requirements, package by package, is a pain in the ass. It also updates the version in your requirements.txt file.</div><a href="https://www.blogger.com/null" name="user-content-purpose" style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal;"></a><span style="background-color: white; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal;"></span></h1><h2 style="border-bottom: 1px solid rgb(234, 236, 239); box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; line-height: 1.25; margin-bottom: 16px; margin-top: 24px; padding-bottom: 0.3em;"><a aria-hidden="true" class="anchor" href="https://github.com/simion/pip-upgrader#purpose" id="user-content-purpose" style="box-sizing: border-box; color: #0366d6; float: left; line-height: 1; margin-left: -20px; padding-right: 4px; text-decoration: none;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z" fill-rule="evenodd"></path></svg></a>Purpose</h2><h1 style="border-bottom: 1px solid rgb(234, 236, 239); box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; line-height: 1.25; margin-bottom: 16px; margin-left: 0px; margin-right: 0px; margin-top: 0px !important; padding-bottom: 0.3em;"><div style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px;">This cli tools helps you interactively(or not) upgrade packages from requirements file, and also&nbsp;<span style="box-sizing: border-box; font-weight: 600;">update the pinned version from requirements file(s)</span>.</div><div style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px;">If no requirements are given, the command&nbsp;<span style="box-sizing: border-box; font-weight: 600;">attempts to detect the requirements file(s)</span>&nbsp;in the current directory.</div><div style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px;">Quick preview:</div><div style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px;"><a href="https://raw.githubusercontent.com/simion/pip-upgrader/master/demo.gif" style="box-sizing: border-box; color: #0366d6; text-decoration: none;" target="_blank"><img alt="https://raw.githubusercontent.com/simion/pip-upgrader/master/demo.gif" src="https://raw.githubusercontent.com/simion/pip-upgrader/master/demo.gif" style="background-color: white; border-style: none; box-sizing: content-box; max-width: 100%;" /></a></div><a href="https://www.blogger.com/null" name="user-content-installation" style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal;"></a><span style="background-color: white; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal;"></span></h1><h2 style="border-bottom: 1px solid rgb(234, 236, 239); box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; line-height: 1.25; margin-bottom: 16px; margin-top: 24px; padding-bottom: 0.3em;"><a aria-hidden="true" class="anchor" href="https://github.com/simion/pip-upgrader#installation" id="user-content-installation" style="box-sizing: border-box; color: #0366d6; float: left; line-height: 1; margin-left: -20px; padding-right: 4px; text-decoration: none;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z" fill-rule="evenodd"></path></svg></a>Installation</h2><h1 style="border-bottom: 1px solid rgb(234, 236, 239); box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; line-height: 1.25; margin-bottom: 16px; margin-left: 0px; margin-right: 0px; margin-top: 0px !important; padding-bottom: 0.3em;"><pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 13.6px; font-stretch: normal; font-weight: normal; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; word-wrap: normal;">pip install pip-upgrader<br /></pre><a href="https://www.blogger.com/null" name="user-content-usage" style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal;"></a><span style="background-color: white; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal;"></span></h1><h2 style="border-bottom: 1px solid rgb(234, 236, 239); box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; line-height: 1.25; margin-bottom: 16px; margin-top: 24px; padding-bottom: 0.3em;"><a aria-hidden="true" class="anchor" href="https://github.com/simion/pip-upgrader#usage" id="user-content-usage" style="box-sizing: border-box; color: #0366d6; float: left; line-height: 1; margin-left: -20px; padding-right: 4px; text-decoration: none;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z" fill-rule="evenodd"></path></svg></a>Usage</h2><h1 style="border-bottom: 1px solid rgb(234, 236, 239); box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; line-height: 1.25; margin-bottom: 16px; margin-left: 0px; margin-right: 0px; margin-top: 0px !important; padding-bottom: 0.3em;"><div style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px;"><span style="box-sizing: border-box; font-weight: 600;">Activate your virtualenv</span>&nbsp;(important, because it will also install the new versions of upgraded packages in current virtualenv)</div><div style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px;"><span style="box-sizing: border-box; font-weight: 600;">CD into your project.</span>&nbsp;Then:</div><pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 13.6px; font-stretch: normal; font-weight: normal; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; word-wrap: normal;">$ pip-upgrade<br /></pre><div style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px;">Arguments:</div><pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 13.6px; font-stretch: normal; font-weight: normal; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; word-wrap: normal;">requirements_file(s) The requirement FILE, or WILDCARD PATH to multiple files. (positional arguments)<br />--prerelease Include prerelease versions for upgrade, when querying pypi repositories.<br />-p &lt;package&gt; Pre-choose which packages tp upgrade. Skips any prompt.<br />--dry-run Simulates the upgrade, but does not execute the actual upgrade.<br />--skip-package-installation Only upgrade the version in requirements files, don't install the new package.<br />--skip-virtualenv-check Disable virtualenv check. Allows installing the new packages outside the virtualenv.<br />--use-default-index Skip searching for custom index-url in pip configuration file(s).<br /></pre><div style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px;">Examples:</div><pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 13.6px; font-stretch: normal; font-weight: normal; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; word-wrap: normal;">pip-upgrade # auto discovers requirements file. Prompts for selecting upgrades<br />pip-upgrade requirements.txt<br />pip-upgrade requirements/dev.txt requirements/production.txt<br /><br /># skip prompt and manually choose some/all packages for upgrade<br />pip-upgrade requirements.txt -p django -p celery<br />pip-upgrade requirements.txt -p all<br /><br /># include pre-release versions<br />pip-upgrade --prerelease<br /></pre><a href="https://www.blogger.com/null" name="user-content-final-notes" style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal;"></a><span style="background-color: white; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal;"></span></h1><h2 style="border-bottom: 1px solid rgb(234, 236, 239); box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; line-height: 1.25; margin-bottom: 16px; margin-top: 24px; padding-bottom: 0.3em;"><a aria-hidden="true" class="anchor" href="https://github.com/simion/pip-upgrader#final-notes" id="user-content-final-notes" style="box-sizing: border-box; color: #0366d6; float: left; line-height: 1; margin-left: -20px; padding-right: 4px; text-decoration: none;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z" fill-rule="evenodd"></path></svg></a>Final notes</h2><h1 style="border-bottom: 1px solid rgb(234, 236, 239); box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; line-height: 1.25; margin-bottom: 16px; margin-left: 0px; margin-right: 0px; margin-top: 0px !important; padding-bottom: 0.3em;"><div style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px;">If you encounter any bugs, please open an issue and it will be magically resolved :)</div><div style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px;"><span style="box-sizing: border-box; font-weight: 600;">TODO:</span></div><ul style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px; margin-top: 0px; padding-left: 2em;"><li style="box-sizing: border-box;">support for local caches (index-url) from ~/.pip/pip.conf (ex: devpi)</li><li style="box-sizing: border-box; margin-top: 0.25em;">support for&nbsp;<code style="background-color: rgba(27, 31, 35, 0.0470588); border-radius: 3px; box-sizing: border-box; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 13.6px; margin: 0px; padding: 0.2em 0px;">package&gt;=0.1.0</code>&nbsp;(only works for&nbsp;<code style="background-color: rgba(27, 31, 35, 0.0470588); border-radius: 3px; box-sizing: border-box; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 13.6px; margin: 0px; padding: 0.2em 0px;">package==0.1.0</code>)</li></ul><div style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px;">Have fun! :)</div><a href="https://www.blogger.com/null" name="user-content-contributing" style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal;"></a><span style="background-color: white; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal;"></span></h1><h2 style="border-bottom: 1px solid rgb(234, 236, 239); box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; line-height: 1.25; margin-bottom: 16px; margin-top: 24px; padding-bottom: 0.3em;"><a aria-hidden="true" class="anchor" href="https://github.com/simion/pip-upgrader#contributing" id="user-content-contributing" style="box-sizing: border-box; color: #0366d6; float: left; line-height: 1; margin-left: -20px; padding-right: 4px; text-decoration: none;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z" fill-rule="evenodd"></path></svg></a>Contributing</h2><h1 style="border-bottom: 1px solid rgb(234, 236, 239); box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; line-height: 1.25; margin-bottom: 16px; margin-left: 0px; margin-right: 0px; margin-top: 0px !important; padding-bottom: 0.3em;"><div style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px;">Clone the repository, create a virtualenv, then run:</div><pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 13.6px; font-stretch: normal; font-weight: normal; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; word-wrap: normal;">pip install -e .[test]<br />py.test<br /></pre><div style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px;">This command will :</div><ul style="box-sizing: border-box; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; font-weight: normal; margin-bottom: 16px; margin-top: 0px; padding-left: 2em;"><li style="box-sizing: border-box;">run tests</li><li style="box-sizing: border-box; margin-top: 0.25em;">print coverage report</li><li style="box-sizing: border-box; margin-top: 0.25em;">print pep8 errors</li></ul></h1><ul style="box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; margin-bottom: 16px; margin-top: 0px; padding-left: 2em;"></ul>Unknown[email protected]3tag:blogger.com,1999:blog-1109993290999893534.post-84037841602765546882016-05-18T10:46:00.004+03:002016-05-18T10:46:56.440+03:00Installed Percona Server / Mysql 5.7 and cannot start without root password.To fix this:<br /><br /><br /><ol><li>Make sure your data dir is empty.&nbsp;</li><li><span style="font-family: Courier New, Courier, monospace;"><b>mysqld --initialize-insecure &nbsp;--datadir=/path-to-datadir --user=youruser</b></span></li><li>Done. Now you have root user with no password</li></ol>Unknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-33428020665491762412016-05-18T10:44:00.001+03:002016-05-18T10:44:38.044+03:00Mac OSX AirDrop not working (not seeing people or not seen) - HOW TO FIXAirDrop does not work all the time. Either you cannot see other people, or other people can't see you. To fix this issue, do these steps:<br /><br /><br /><ol><li>Turn off Bluetooth on your Mac</li><li><span style="font-family: Courier New, Courier, monospace;"><b>sudo rm /Library/Preferences/com.apple.Bluetooth.plist</b></span></li><li>Turn Bluetooth back on</li></ol><div>Fixed :)&nbsp;</div>Unknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-23770357278556843582015-10-01T09:46:00.001+03:002015-11-29T11:26:17.159+02:00Fix - Updated from OSX El Capitan Gold Master to Final Release, andbeta update keeps showing in AppStoreSo, if you installed OSX Beta or GoldMaster versions,&nbsp;your account enrolled for pre-release updates.<br /><br />Now, you installed OSX El Capitan from app store (final release, 10.11) but in AppStore -&gt; Updates,&nbsp;Developer Beta keeps whowing you to update to version 10.11.1. This is because your account has now enrolled to pre-release updates.<br /><br />To fix this, go to System Preferences -&gt; <br /><a name='more'></a>AppStore<br />You can see there is a setting called "Your computer is set to receive pre-release Software Update seeds".<br />Click "Change" and then "Do not show pre-release Updates".<br /><br /><a href="https://dl.dropboxusercontent.com/u/99980406/2015/10/osx-unenroll-2_2x-b1ee695c2546f38840d88372011fae81.jpg"><img alt="osx-unenroll-2_2x-b1ee695c2546f38840d88372011fae81" class="alignnone size-medium wp-image-481" height="355" src="https://dl.dropboxusercontent.com/u/99980406/2015/10/osx-unenroll-2_2x-b1ee695c2546f38840d88372011fae81-620x355.jpg" width="620" /></a><br /><br />Done. You can now refresh the Updates tab in AppStore.<br />Everything is clean.<br /><a href="https://dl.dropboxusercontent.com/u/99980406/2015/10/Screen-Shot-2015-10-01-at-9.45.38-AM.png"><img alt="Screen Shot 2015-10-01 at 9.45.38 AM" class="alignnone size-medium wp-image-483" height="116" src="https://dl.dropboxusercontent.com/u/99980406/2015/10/Screen-Shot-2015-10-01-at-9.45.38-AM-620x116.png" width="620" /></a>Unknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-17213657946455883862015-06-15T10:23:00.001+03:002015-11-29T11:07:09.188+02:00OSX Disk Utility Erasing/Formatting stuck at "Unmounting disk ...", "Couldn't unmount disk"If you are trying to format/erase a disk and disk utility/diskUtil is stuck at "unmounting disk", probably "fsck_hfs" is stuck in a loop, trying to repair it before mounting.<br/><br/><a href="https://dl.dropboxusercontent.com/u/99980406/2015/06/couldnt-unmount-disk-disk-utility-error.jpeg"><img class="alignnone wp-image-468 size-full" src="https://dl.dropboxusercontent.com/u/99980406/2015/06/couldnt-unmount-disk-disk-utility-error.jpeg" alt="couldnt-unmount-disk-disk-utility-error" width="406" height="126" /><br/></a><br/>I've seen solutions where you must boot from an external operating system, bla blah. Too complicated and time consuming.<br/><br/><strong>To fix this fast and easy</strong>, start formatting, wait for "unmounting disk" message to appear, then go to Terminal, find the process with the following command<br/><pre class="lang:sh decode:true">ps ax | grep fsck_hfs</pre><br/>You'll get something like<br/><pre class="lang:sh decode:true">simion@Simions-MacBook-Pro:~$ ps ax | grep fsck_hfs<br/> 3693 ?? U 1:32.61 /System/Library/Filesystems/hfs.fs/Contents/Resources/./fsck_hfs -y /dev/disk2s2<br/> 3984 s000 S+ 0:00.00 grep fsck_hfs</pre><br/>Then ...<a name='more'></a> kill the process with<br/><pre class="lang:sh decode:true">sudo kill 3693</pre><br/>Then it should continue automatically with formatting the drive.<br/><br/>Note that you must do this before disk utility gives the error message "Could not unmount disk".Unknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-51911767216196725102015-03-08T03:45:00.001+02:002015-11-29T11:07:09.170+02:00Aplicatia Bancomate pentru Android (În curand și pe IOS)<a href="https://play.google.com/store/apps/details?id=ro.simionbaws.bancomate"><img class=" alignright wp-image-432" src="https://dl.dropboxusercontent.com/u/99980406/2015/03/final.png" alt="final" width="282" height="282" /></a><br/><br/><a href="https://play.google.com/store/apps/details?id=ro.simionbaws.bancomate"><img class=" alignleft wp-image-450" src="https://dl.dropboxusercontent.com/u/99980406/2015/03/Screenshot_2015-03-24-01-18-12-620x1102.png" alt="" width="167" height="297" /></a>Această aplicație vă ajută să gasiți ușor și rapid bănci și bancomate (atm-uri) în toată România.<br/><br/>Important: momentan lucrează doar cu anumite bănci, pentru a asigura corectitudinea datelor. Baza de date este în continuă dezvoltare, si vom adăuga bănci noi în perioada ce urmează.<br/><br/>Specificații:<br/>- Afișeaza cele mai apropiate bancomate și bănci din locația dumneavoastră, sau in orice alt punct pe hartă<br/>- Locațiile bancomatelor sunt actualizate zilnic, din surse oficiale, in mod automat (dacă apar bancomate noi, sau se desființeaza bancomate vechi, noi vom ști primii)<br/>- Opțiune de navigare catre un bancomat ales<br/>- Opțiune de căutare adresă / locație<br/>- În cazul băncilor (sucursalelor) este afișat și un număr de telefon<br/>- Filtru în funcție de banca aleasă<br/>- Acoperire in toata Romania<br/>- Pentru eficiența transferului de date/baterie, sunt afișate cele mai apropiate 30 bancomate/sucursale din locația curentă sau locația aleasă de dumneavostră, calculele fiind efectuate pe server.<br/><br/>Ce deosebește această aplicatie față de celelalte aplicații din acest domeniu?<br/>Contine doar acele bancomate ale căror coordonate pe hartă sunt obtinute din surse oficiale (banci). Bancile care nu oferă coordonate exacte ale bancomatelor nu sunt implementate momentan (geocodarea adresei ar putea fi imprecisă, acest subiect va fi tratat în următoarea versiune). Deci cu noi mergeți la sigur!<br/>În plus, baza de date este actualizata zilnic, in mod automat, pentru fiecare bancă în parte.<br/><br/>Băncile implementate în momentul de față (coordonate din surse oficiale):<br/>- Banca Transilvania<br/>- Raifeissen Bank<br/>- BRD groupe societe generale<br/>- ING Romania<br/>- Bancpost<br/>- Alpha Bank<br/>- Euronet (Banca Carpatica)<br/>- OPT Bank<br/>- Unicredit Tiriac Bank<br/>- Piraeus Bank<br/>- Banca Romanească<br/>În acest moment exista peste 6000 de bancomate în baza de date, pentru aceste bănci.<br/>Bănci ce vor fi implementate (prin geocodarea adresei) în perioada ce urmează:<br/>- BCR - Banca Comerciala Romana (80% finalizat)<br/>- Garanti Bank<br/>- BCR<br/>- CEC Bank<br/>- CreditEurope Bank<br/>- Libra Bank<br/>- Pro Credit Bank<br/>- Leumi Bank<br/>- Millenium Bank<br/>- Marfin Bank<br/><br/>&nbsp;<br/><br/><a href="https://play.google.com/store/apps/details?id=ro.simionbaws.bancomate"><img class=" wp-image-433 size-full aligncenter" src="https://dl.dropboxusercontent.com/u/99980406/2015/03/get-it-on-google-play-store-logo.png" alt="get-it-on-google-play-store-logo" width="513" height="180" /></a><br/><br/>[gallery columns="2" ids="449,450,451,452,453,454,455,456"]<br/><br/>&nbsp;<br/><br/>Aplicatia Bancomate pentru AndroidUnknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-44909781763665001272014-11-26T17:25:00.001+02:002015-11-29T11:07:09.100+02:00Improve font rendering for IntelliJ IDEA / Pycharm in UbuntuStock font rendering in Pycharm / Intelliji IDEA is horrible on Ubuntu. To improve it, change the following:<br/><br/>&nbsp;<br/><br/>First of all, we need to install Infinality fonts:<br/><pre class="lang:sh decode:true">sudo add-apt-repository ppa:no1wantdthisname/ppa<br/>sudo apt-get update<br/>sudo apt-get upgrade<br/>sudo apt-get install fontconfig-infinality<br/><br/>sudo /etc/fonts/infinality/infctl.sh setstyle linux<br/>sudo gedit /etc/profile.d/infinality-settings.sh<br/># and set<br/>USE_STYLE="UBUNTU"</pre><br/>Installed the patched OpenJDK with fontfix:<br/><pre class="lang:sh decode:true">sudo apt-add-repository -y ppa:no1wantdthisname/openjdk-fontfix<br/>sudo apt-get update<br/>sudo apt-get install openjdk-7-jdk</pre><br/>In <span class="lang:default decode:true crayon-inline">$IDEA_HOME/bin/*.vmoptions</span>  add the following: (PS: $IDEA_HOME is the path to IntelliJIdea or Pycharm)<br/><pre class="lang:default decode:true" title="bin/*.vmoptions">-Dawt.useSystemAAFontSettings=lcd<br/>-Dswing.aatext=true<br/>-Dsun.java2d.xrender=true</pre><br/>and in <span class="lang:default decode:true crayon-inline">~/.profile</span>  add<br/><pre class="lang:sh decode:true">export PYCHARM_JDK=/usr/lib/jvm/java-1.7.0-openjdk-amd64"</pre><br/>&nbsp;<br/><br/>or whatever the installed java path is.<br/><br/><strong>Reboot.</strong><br/><br/>Start the IDE and enjoy perfect fonts.<br/><br/><img class="alignnone size-medium wp-image-415" style="display: none;" src="https://dl.dropboxusercontent.com/u/99980406/2014/11/BlogPostPicture_PyCharm4-620x324.png" alt="BlogPostPicture_PyCharm4" width="620" height="324" />Unknown[email protected]6tag:blogger.com,1999:blog-1109993290999893534.post-61979377763145413142014-11-24T10:32:00.001+02:002015-11-29T11:07:09.087+02:00Ubuntu - Fix large fonts for Google Chrome in Address Bar and Bookmarks barSince version 35, chrome switched to Aura framework and does not follow GTK theme anymore. This leads to large font size in address bar, and bookmarks bar.<br/><br/>However, it grabs font size settings from <strong>org.gnome.desktop.interface "font-name" </strong>property. To fix this, run the following command:<br/><pre class="lang:sh decode:true ">gsettings set org.gnome.desktop.interface font-name 'Ubuntu 10'<br/># or<br/>gsettings set org.gnome.desktop.interface font-name 'Ubuntu 11'<br/># depending on your preferences</pre><br/>You must <span style="color: #ff0000;"><strong>restart chrome</strong></span> for this to work.<br/><br/><img class="alignnone size-full wp-image-406" style="display: none;" src="https://dl.dropboxusercontent.com/u/99980406/2014/11/chrome.jpg" alt="chrome" width="350" height="200" />Unknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-89533870031989351142014-09-13T14:57:00.001+03:002015-11-29T11:07:09.073+02:00Django `CheckboxSelectMultiple` with `ModelMultipleChoiceField` generates too many queries (solution)If you use <span class="lang:default decode:true crayon-inline">django.forms.ModelMultipleChoiceField</span> with the default widget (<span class="lang:default decode:true crayon-inline ">django.forms.widgets.SelectMultiple</span> ), all's good.<br/><br/>However, if you need to generate checkboxes for your choices, and use <span class="lang:default decode:true crayon-inline">django.forms.widgets.CheckboxSelectMultiple</span> you'll notice that the field will generate <span style="color: #ff0000;">alot of queries</span> (one for each element in the queryset), which is really really bad. I personally ended up with hundred of queries.<br/><br/><strong>Fix</strong>: add <span class="theme:monokai lang:default decode:true crayon-inline ">cache_choices=True</span> to your <span class="lang:default decode:true crayon-inline">django.forms.ModelMultipleChoiceField</span><br/><br/>Example:<br/><br/>Good practice:<br/><pre class="lang:python mark:4 decode:true">test = forms.ModelMultipleChoiceField(<br/> queryset=MyModel.objects.all(),<br/> cache_choices=True,<br/> widget=forms.CheckboxSelectMultiple)</pre><br/>Bad practice:<br/><pre class="lang:python decode:true " title="Bad practice">test = forms.ModelMultipleChoiceField(<br/> queryset=MyModel.objects.all(),<br/> widget=forms.CheckboxSelectMultiple)</pre><br/><img style="display: none;" src="https://dl.dropboxusercontent.com/u/99980406/2014/05/django-logo-negative-620x282.png" alt="django-logo-negative" width="620" height="282" />Unknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-89516774482266119532014-08-22T18:33:00.001+03:002015-11-29T11:07:09.032+02:00South migrations and MariaDBIf you're working on a Django project along with other members of your team and you're using MariaDB (while the others are using MySQL) you're gonna have a bad time. Everytime you'll run migrations generated on a machine with other database than yours you'll get a strange exception and Google wouldn't give you too many hopes about solving it.<br/><br/>The exception, <strong>django.db.transaction.TransactionManagementError: Transaction managed block ended with pending COMMIT/ROLLBACK</strong> is caused by <strong>leave_transaction_management</strong> method in <strong>django/db/backends/__init__.py</strong> and its source seems to be an incompatibility between MariaDB and MySQL (even if the former is just a fork of the other one).<br/><br/>So you want a fix? I couldn't find any, but I fixed this by compiling MySQL from <a href="https://aur.archlinux.org/packages/mysql/"><strong>AUR</strong></a> (I'm using Manjaro, which is based on Arch Linux). Even if it's not really a solution maybe you're coming here from Google and maybe this will help you to solve your issue: Arch/Manjaro uses MariaDB and South seems to not like it very much.Unknown[email protected]2tag:blogger.com,1999:blog-1109993290999893534.post-74428807156434326052014-06-24T12:50:00.001+03:002015-11-29T11:07:09.018+02:00Command/Shortcut to Lock Screen with "away message prompt" in Linux Mint 17 / CinnamonIf you want to have a shortcut with for locking the screen, but with <span style="text-decoration: underline;">prompt for lock message</span>, here's what you need to do:<br/><ol><br/> <li>Go to <strong>Settings -&gt; Keyboard, </strong>then click on <strong>Keyboard shortcuts tab<br/><br/></strong></li><br/> <li>Click on <strong>Add custom shortcut</strong> button, and enter the following command:<br/><pre class="lang:sh decode:true ">python /usr/lib/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.py</pre><br/>example:<br/><a href="https://dl.dropboxusercontent.com/u/99980406/2014/06/Screenshot-from-2014-06-24-124127.png"><img class="alignnone size-medium wp-image-373" src="https://dl.dropboxusercontent.com/u/99980406/2014/06/Screenshot-from-2014-06-24-124127-620x118.png" alt="Screenshot from 2014-06-24 12:41:27" width="620" height="118" /></a></li><br/> <li>Click <strong>Add</strong> and then assign it a shortcut.<br/>For example, the default lock screen shortcut is <strong>Ctrl+Alt+L</strong>. For the one with prompt, you can assign <strong>Ctrl+L</strong>.</li><br/> <li>You're done.<br/>When you want to lock your screen with a custom "away" message, just press the shortcut you assigned (<strong>Ctrl + L</strong>)</li><br/></ol><br/><a href="https://dl.dropboxusercontent.com/u/99980406/2014/06/Screenshot-from-2014-06-24-124744.png"><img class="alignnone size-medium wp-image-374" src="https://dl.dropboxusercontent.com/u/99980406/2014/06/Screenshot-from-2014-06-24-124744-620x427.png" alt="Screenshot from 2014-06-24 12:47:44" width="620" height="427" /></a>Unknown[email protected]1tag:blogger.com,1999:blog-1109993290999893534.post-57154020910531344232014-06-19T00:46:00.001+03:002015-11-29T11:07:08.940+02:00Install Skype 4.3 in Arch Linux / ManjaroHi there,<br/><br/>Skype just released version 4.3 for linux. You can read <a href="http://www.omgubuntu.co.uk/2014/06/download-skype-4-3-linux-new-ui-download" target="_blank"><span style="color: #ff6600;">this article</span></a>  from OMG Ubuntu! to see what's new in 4.3<br/><br/>Long story short:<br/><ul><br/> <li>native notifications</li><br/> <li>UI improvements (new toolbar, better login screen, design changes)</li><br/> <li>floating widget for Call</li><br/> <li>cloud based Group Chat</li><br/> <li>support for PulseAudio 3.0 and 4.0</li><br/></ul><br/>Currently, the AUR <strong>"multilib/skype"</strong> package is <strong>not</strong> upgraded to<strong> 4.3</strong>. If you don't wish to wait, here's what you must do:<br/><ol><br/> <li>Download Skype -&gt; <a href="http://www.skype.com/go/linux" target="_blank">http://www.skype.com/go/linux</a> (Choose "Dynamic" from distribution dropdown)</li><br/> <li>Extract the archive<br/><pre class="lang:sh decode:true crayon-selected">cd Downloads<br/><br/>tar -xjf skype-4.3.*</pre><br/></li><br/> <li>Move the contents of the extracted folder to /opt/skype<br/><pre class="lang:sh decode:true">sudo mkdir /opt/skype<br/><br/>sudo mv skype-4.3.*/* /opt/skype</pre><br/></li><br/> <li>Edit <span class="lang:default decode:true crayon-inline ">/usr/bin/skype</span> , and change the <span class="lang:default decode:true crayon-inline ">exec</span>  command path to <strong><strong><span class="lang:default decode:true crayon-inline ">exec "/opt/skype/skype" "$@"</span> </strong></strong><br/><pre class="lang:sh mark:15 decode:true">#!/bin/bash<br/><br/>LIBDIR="/usr/lib32"<br/><br/>if [[ -e "$LIBDIR/libv4l/v4l2convert.so" ]]; then<br/> export LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}$LIBDIR/libv4l/v4l2convert.so"<br/>fi<br/><br/>if [[ -e "/usr/share/skype/lib/libQtWebKit.so.4" ]]; then<br/> export LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}/usr/share/skype/lib/libQtWebKit.so.4"<br/>fi<br/><br/># exec "$LIBDIR/skype/skype" "$@" # (old one)<br/>exec "/opt/skype/skype" "$@"<br/></pre><br/><img class="alignnone size-medium wp-image-362" style="display: none;" src="https://dl.dropboxusercontent.com/u/99980406/2014/06/skype-new-login-screen-linux-620x432.jpg" alt="Skype 4.3" width="620" height="432" /></li><br/></ol>Unknown[email protected]4tag:blogger.com,1999:blog-1109993290999893534.post-52467586623711695512014-06-09T22:24:00.001+03:002015-11-29T11:07:08.827+02:00Sublime slack - preformatted textChangelog in 1.4.5: Whenever you send a code selection (ctrl+alt+u), it is preformatted.<br/><br/>Example:<br/><br/><a href="https://dl.dropboxusercontent.com/u/99980406/2014/06/Screenshot-from-2014-06-09-221221.png"><img class="alignnone size-full wp-image-351" src="https://dl.dropboxusercontent.com/u/99980406/2014/06/Screenshot-from-2014-06-09-221221.png" alt="Screenshot from 2014-06-09 22:12:21" width="564" height="317" /></a>Unknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-21425498919115096982014-05-23T11:00:00.001+03:002015-11-29T11:07:08.805+02:00Django get current user globally in the projectSometimes, you will need to get the current authenticated user in models, or other parts of your app.<br/><br/>To achieve this, you must create this middleware and add it to MIDDLEWARE_CLASSES in project settings:<br/><pre class="lang:python decode:true crayon-selected" title="middleware.py">try:<br/> from threading import local, current_thread<br/>except ImportError:<br/> from django.utils._threading_local import local<br/><br/>_thread_locals = local()<br/><br/><br/>class GlobalUserMiddleware(object):<br/> """<br/> Sets the current authenticated user in threading locals<br/><br/> Usage example:<br/> from app_name.middleware import get_current_user<br/> user = get_current_user()<br/> """<br/> def process_request(self, request):<br/> setattr(<br/> _thread_locals,<br/> 'user_{0}'.format(current_thread().name),<br/> request.user)<br/><br/> def process_response(self, request, response):<br/><br/> key = 'user_{0}'.format(current_thread().name)<br/><br/> if not hasattr(_thread_locals, key):<br/> return response<br/><br/> delattr(_thread_locals, key)<br/><br/> return response<br/><br/><br/>def get_current_user():<br/> return getattr(<br/> _thread_locals,<br/> 'user_{0}'.format(current_thread().name),<br/> None)<br/></pre><br/>Usage example:<br/><pre class="lang:python decode:true" title="models.py">from myapp.middleware import get_current_user<br/><br/>user = get_current_user()</pre><br/><img class="alignnone size-medium wp-image-336" style="display: none;" src="https://dl.dropboxusercontent.com/u/99980406/2014/05/django-logo-negative-620x282.png" alt="django-logo-negative" width="620" height="282" />Unknown[email protected]1tag:blogger.com,1999:blog-1109993290999893534.post-32060438805893621492014-05-21T16:23:00.001+03:002015-11-29T11:07:08.790+02:00Invalidate template fragment cache in Django 1.5Django 1.5 does not have a utility method to delete template fragment cache, with arguments.<br/><br/>In order to achieve this, you must create a custom method:<br/><pre class="lang:python decode:true crayon-selected">from django.core.cache import cache<br/>from django.utils.hashcompat import md5_constructor<br/>from django.utils.http import urlquote<br/><br/><br/>def invalidate_template_fragment(fragment_name, *variables):<br/> args = md5_constructor(u':'.join([urlquote(var) for var in variables]))<br/> cache_key = 'template.cache.{0}.{1}'.format(fragment_name, args.hexdigest())<br/> cache.delete(cache_key)<br/></pre><br/>Example usage:<br/><pre class="lang:default decode:true" title="template.html">{% cache 259200 key_name model_instance.pk %}<br/> ... cached content here ...<br/>{% endcache %}<br/><br/>// note that "model_instance.pk" is optional argument. You can use as many as you need<br/></pre><br/>... and delete the cache:<br/><pre class="lang:default decode:true">invalidate_template_fragment('key_name', model_instance.pk)</pre><br/>&nbsp;<br/><br/>In django 1.6+ you can do this more easy:<br/><pre class="lang:python decode:true">from django.core.cache import cache<br/>from django.core.cache.utils import make_template_fragment_key<br/><br/>key = make_template_fragment_key('key_name', [model_instance.pk])<br/>cache.delete(key)</pre><br/><img class="alignnone size-medium wp-image-336" style="display: none;" src="https://dl.dropboxusercontent.com/u/99980406/2014/05/django-logo-negative-620x282.png" alt="django-logo-negative" width="620" height="282" />Unknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-18044163617187506462014-04-30T11:53:00.001+03:002015-11-29T11:07:08.769+02:00Sublime Slack 1.4.3 Changelog<ul><br/> <li>Fixed some bugs</li><br/> <li>Implemented avatar support. By default the avatar icon is this :<br/><img class="alignnone" src="http://simionbaws.ro/icons/sublime-48.png" alt="" width="48" height="48" /><br/>but you can change it with settings:</li><br/> <li><br/><pre class="lang:default mark:8 highlight:0 decode:true">{<br/> "team_tokens": {<br/> "Team 1": "team-1-token-goes-here",<br/> "Team 2": "team-2-token-goes-here",<br/> },<br/> "username": "ST",<br/> "avatar_url": "http://simionbaws.ro/icons/sublime-48.png",<br/> "show_plaform_and_name": true<br/>}</pre><br/>&nbsp;</li><br/></ul><br/>Result:<br/><br/><a href="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-30-1155191.png"><img class="alignnone size-full wp-image-329" src="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-30-1155191.png" alt="AVatars example" width="281" height="281" /></a>Unknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-9646222316156274992014-04-25T09:08:00.001+03:002015-11-29T11:07:08.703+02:00Ubuntu 14.04 ctrl+alt+del shutdown dialogCurrently , in Ubuntu 14.04 if you press Ctrl+Alt+Del, it pops out the logout or lock dialog.<br/>Many of us were used to have the shutdown/restart dialog prompted on Ctrl+Alt+Del.<br/><br/>Here's how you get the shutdown dialog:<br/><br/>open <strong>System Settings -&gt; Keyboard, </strong>click on the second tab "<strong>Shortcuts</strong>",  and then click on the "+" icon to add a new shortcut.<br/><br/>Give it a name (ex: "Shutdown dialog") and in the <strong>command</strong> field enter <span class="lang:default decode:true crayon-inline ">gnome-session-quit --reboot</span> .<br/><br/><a href="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-25-085431.png"><img class="alignnone wp-image-311 size-medium" src="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-25-085431-620x350.png" alt="Create new shortcut" width="620" height="350" /></a><br/>After creating the shortcut, you need to assign it a keybind. Click on "Disabled" in the right side of the shortcut, then press "Ctrl+Alt+Del". A conflict dialog will show up. Click on "Reassign".<br/><a href="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-25-085836.png"><img class="alignnone wp-image-312 size-medium" src="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-25-085836-620x351.png" alt="Conflict alert" width="620" height="351" /></a><br/><br/>Now, when pressing Ctrl + Alt + Del, you will have this dialog shown:<br/><br/><a href="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-25-090206.png"><img class="alignnone wp-image-313 size-full" src="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-25-090206.png" alt="Shutdown dialog" width="456" height="350" /></a><br/><br/>&nbsp;<br/><br/>Alternatively, you want to have all the "quit" options in one dialog (lock, suspend, restart, shutdown) you can replace the command with <span class="lang:default decode:true crayon-inline ">gnome-session-quit --power-off</span>  and get this result:<br/><br/><a href="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-25-090512.png"><img class="alignnone size-medium wp-image-314" src="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-25-090512-620x220.png" alt="Dialog with all 4 quit options" width="620" height="220" /></a><br/><br/>&nbsp;Unknown[email protected]3tag:blogger.com,1999:blog-1109993290999893534.post-2775370099622757022014-04-24T14:26:00.001+03:002015-11-29T11:07:08.692+02:00Wine - Diablo 3 via Battle.net launcher error on Ubuntu 14.04This error occurs on ubuntu 14.04 when trying to run Diablo III from battle.net launcher:<br/><blockquote>Wine - Diablo 3 via Battle.net launcher error: Please try again after logging on as an administrator<br/><br/><img class="alignnone wp-image-306 size-medium" src="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-24-141415-620x374.png" alt="Screenshot from 2014-04-24 14:14:15" width="620" height="374" /></blockquote><br/>To avoid this error, you must launch Diablo 3 using the following command:<br/><pre class="lang:sh highlight:0 decode:true">setarch i386 -3 -L -B -R wine '/path/to/Diablo III.exe' -launch -opengl</pre><br/>Alternatively, if you want to create a shortcut, run:<br/><pre class="lang:sh highlight:0 decode:true">sudo gedit /usr/share/applications/diablo.desktop</pre><br/>and paste the following content (don't forget to update the path to diablo .exe file, and the icon file)<br/><pre class="lang:default decode:true">[Desktop Entry]<br/>Name=Diablo III<br/>Comment=Run Blizzard Diablo III via Wine<br/>Exec=setarch i386 -3 -L -B -R wine '/path/to/Diablo III.exe' -launch -opengl<br/>Icon=/path/to/d3.png<br/>Terminal=false<br/>Type=Application<br/>Categories=Application;</pre><br/>You can download the icon file here: <a href="https://dl.dropboxusercontent.com/u/99980406/2014/04/d3.png" target="_blank">https://dl.dropboxusercontent.com/u/99980406/2014/04/d3.png</a> , save it somewhere and point the location in <strong>diablo.desktop</strong> file created previously.<br/><br/><img class="alignleft wp-image-299 size-full" style="display: none;" src="https://dl.dropboxusercontent.com/u/99980406/2014/04/d3.png" alt="d3" width="512" height="512" />Unknown[email protected]2tag:blogger.com,1999:blog-1109993290999893534.post-4803780900203673062014-04-19T12:52:00.001+03:002015-11-29T11:07:08.652+02:00Fix ugly Skype theme on Ubuntu 14.04Because Skype is a 32bit app and the GTK theme engine is not installed by default for 32bit, skype uses Clearlooks theme instead of the ubuntu's gtk Ambiance theme.<br/><br/>To fix this, install the following:<br/><pre class="lang:sh highlight:0 decode:true">sudo apt-get install gtk2-engines-murrine:i386 gtk2-engines-pixbuf:i386</pre><br/>Before:<br/><br/>[caption id="attachment_293" align="alignnone" width="620"]<a href="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-19-125543.png"><img class="wp-image-293 size-medium" src="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-19-125543-620x397.png" alt="" width="620" height="397" /></a> Before fixing skype[/caption]<br/><br/>After:<br/><br/>[caption id="attachment_292" align="alignnone" width="620"]<a href="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-19-125416.png"><img class="wp-image-292 size-medium" src="https://dl.dropboxusercontent.com/u/99980406/2014/04/Screenshot-from-2014-04-19-125416-620x386.png" alt="Screenshot from 2014-04-19 12:54:16" width="620" height="386" /></a> After[/caption]<br/><br/><a href="https://dl.dropboxusercontent.com/u/99980406/2014/04/Audio_Problems_In_Skype_For_Ubuntu.jpg"><img class="alignnone size-medium wp-image-294" style="display: none;" src="https://dl.dropboxusercontent.com/u/99980406/2014/04/Audio_Problems_In_Skype_For_Ubuntu-620x465.jpg" alt="Audio_Problems_In_Skype_For_Ubuntu" width="620" height="465" /></a>Unknown[email protected]3tag:blogger.com,1999:blog-1109993290999893534.post-31745829596861365672014-04-10T14:02:00.001+03:002015-11-29T11:07:08.637+02:00Ubuntu 14.04 installing external .deb fails "Package operation Failed"For some reason, installing external .deb files from ubuntu software center fails. The bug is reported <a href="https://bugs.launchpad.net/ubuntu/+source/software-center/+bug/1290228" target="_blank">on launchpad</a>.<br/><br/>It doesn't really matter why it is not working, because the Ubuntu Software Center itself is slow and heavy.<br/><br/>The workaround given on launchpas is to use "dpkg -i &lt;file.deb&gt;" but the issue with this is that it does not resolve dependencies.<br/><br/>My recommendation is to use "<strong>Gdebi</strong>" as an alternative. It's extremly fast and lightweight, and it comes with a command line tool, and a GUI tool.<br/><br/>Once you install Gdebi (<span class="lang:default decode:true crayon-inline ">sudo apt-get install gdebi</span> ), edit the default applications file:<br/><pre class="lang:sh decode:true">sudo gedit /usr/share/gnome/applications/defaults.list</pre><br/>find the following lines:<br/><pre class="lang:default decode:true">application/x-deb=ubuntu-software-center.desktop<br/>application/x-debian-package=ubuntu-software-center.desktop</pre><br/>and replace with<br/><pre class="lang:sh decode:true">application/x-deb=gdebi.desktop<br/>application/x-debian-package=gdebi.desktop</pre><br/><a href="https://dl.dropboxusercontent.com/u/99980406/2014/04/Untitled-2.jpg"><img class="alignnone size-full wp-image-281" style="display: none;" alt="Untitled-2" src="https://dl.dropboxusercontent.com/u/99980406/2014/04/Untitled-2.jpg" width="300" height="300" /></a>Unknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-55196729702802608632014-04-10T13:44:00.001+03:002015-11-29T11:07:08.623+02:00Ubuntu 14.04 lock screen asking password twiceSo, everyone loves the new Ubuntu 14.04 lock screen, which looks exactly as the login screen.<br/><br/>But there is an issue with it. If you lock your screen manually (Ctrl + Alt + L) and leave your computer a couple of minutes (untill it locks the screen automatically), when you unlock it, it will ask for your password twice.<br/><br/>Workaround: Go to Settings -&gt; Brightness and Lock -&gt; Lock [OFF] (switch it to off).<br/><br/><a href="https://dl.dropboxusercontent.com/u/99980406/2014/04/ubuntu-trusty-logo.jpg"><img class="alignnone size-full wp-image-274" style="display: none;" alt="ubuntu-trusty-logo" src="https://dl.dropboxusercontent.com/u/99980406/2014/04/ubuntu-trusty-logo.jpg" width="352" height="352" /></a>Unknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-40060490418583328952014-03-18T03:11:00.001+02:002015-11-29T11:07:08.610+02:00Sublime Slack 1.4.0 releasedChangelog:<br/><br/>1. File upload<br/><ul><br/> <li>current open file</li><br/> <li>right click in sidebar, on file</li><br/> <li>enter file path manually</li><br/></ul><br/>Screenshots:<br/><img alt="" src="http://i.imgur.com/Gf6UvSn.png" /><br/><br/><img alt="" src="http://i.imgur.com/GTfi88U.png" /><br/><br/>&nbsp;<br/><br/>2. API errors (example: 'invalid_auth') are sent to user with an alert.Unknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-72006329235932479082014-03-17T15:58:00.001+02:002015-11-29T11:07:08.597+02:00Sublime Slack 1.3.3 bugfixesFixed some critical bugs:<br/><ul><br/> <li>after selecting a receiver from dropdown, sublime does not freeze anymore. Instead, it shows a loader in the status bar while sending the message.</li><br/> <li>fixed multiple teams name duplicate.</li><br/></ul><br/>Please update by running "Package Control: Upgrade/Overwrite Packages"<br/><br/>Details: <a href="https://github.com/simion/sublime-slack-integration" target="_blank">https://github.com/simion/sublime-slack-integration</a><br/><br/><img src="https://dl.dropboxusercontent.com/u/99980406/2014/03/sublime_text_icon_2181.png" style="display: none">Unknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-75833871902834558542014-03-16T23:32:00.001+02:002015-11-29T11:07:08.490+02:00Sublime Slack 1.3.2 changelogChanges:<br/><ul><br/> <li>When sending messages from input, the message can begin with @user, #channel or .group to skip channel/user/group selection</li><br/> <li> New message from input will have autofilled the last @user #channel or .group used (for quick chatting, if you want to keep replying from sublime while you see received messages in chrome notifications)</li><br/> <li>Added some fancy loaders when grabbing data from api (channels/groups/users) and when sending message</li><br/></ul><br/><img src="https://dl.dropboxusercontent.com/u/99980406/2014/03/sublime_text_icon_2181.png" style="display: none"><br/><br/>Details:<span style="color: #ff6600;"> <a href="https://github.com/simion/sublime-slack-integration" target="_blank"><span style="color: #ff6600;">https://github.com/simion/sublime-slack-integration</span></a></span>Unknown[email protected]0tag:blogger.com,1999:blog-1109993290999893534.post-16355298344737606552014-03-15T23:30:00.001+02:002015-11-29T11:07:08.479+02:00Sublime Slack 1.3 releasedChangelog:<br/><ul><br/> <li>support multiple tokens (teams)</li><br/> <li>send private messages to users</li><br/> <li>send messages to groups (private channels)</li><br/></ul><br/>To update your plugin instantly, run "Package Control: Upgrade/Override all packages".<br/><br/>Details:<span style="color: #ff6600;"> <a href="https://github.com/simion/sublime-slack-integration" target="_blank"><span style="color: #ff6600;">https://github.com/simion/sublime-slack-integration</span></a></span>Unknown[email protected]0