<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>2015 on thefourtheye.in</title>
    <link>https://thefourtheye.in/posts/2015/</link>
    <description>Recent content in 2015 on thefourtheye.in</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language><atom:link href="https://thefourtheye.in/posts/2015/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Python 3.5 and Django 1.7&#39;s HTMLParseError</title>
      <link>https://thefourtheye.in/posts/2015/02/15/python-35-and-django-17s-htmlparseerror/</link>
      <pubDate>Sun, 15 Feb 2015 13:20:00 +0530</pubDate>
      
      <guid>https://thefourtheye.in/posts/2015/02/15/python-35-and-django-17s-htmlparseerror/</guid>
      <description>
&lt;div class=&#39;post&#39;&gt;
&lt;div dir=&#34;ltr&#34; style=&#34;text-align: left;&#34; trbidi=&#34;on&#34;&gt;I just updated my Python installation to 3.5 Alpha 1 and started with Django today and I hit a road block already. It all went fine, when I created the virtual environment and installed Django 1.7.4 in it. And then when I did &lt;code&gt;startproject&lt;/code&gt;, I got &lt;code&gt;AttributeError: module &#39;html.parser&#39; has no attribute &#39;HTMLParseError&#39;&lt;/code&gt;.&lt;br /&gt;&lt;pre class=&#34;prettyprint&#34;&gt;(py3.5venv) ➜  myProject git:(master) ✗ django-admin.py startproject myProject&lt;br /&gt;Traceback (most recent call last):&lt;br /&gt;  File &#34;/py3.5venv/bin/django-admin.py&#34;, line 5, in &lt;module&gt;&lt;br /&gt;    management.execute_from_command_line()&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/core/management/__init__.py&#34;, line 385, in execute_from_command_line&lt;br /&gt;    utility.execute()&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/core/management/__init__.py&#34;, line 354, in execute&lt;br /&gt;    django.setup()&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/__init__.py&#34;, line 18, in setup&lt;br /&gt;    from django.utils.log import configure_logging&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/utils/log.py&#34;, line 13, in &lt;module&gt;&lt;br /&gt;    from django.views.debug import ExceptionReporter, get_exception_reporter_filter&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/views/debug.py&#34;, line 10, in &lt;module&gt;&lt;br /&gt;    from django.http import (HttpResponse, HttpResponseServerError,&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/http/__init__.py&#34;, line 4, in &lt;module&gt;&lt;br /&gt;    from django.http.response import (&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/http/response.py&#34;, line 13, in &lt;module&gt;&lt;br /&gt;    from django.core.serializers.json import DjangoJSONEncoder&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/core/serializers/__init__.py&#34;, line 23, in &lt;module&gt;&lt;br /&gt;    from django.core.serializers.base import SerializerDoesNotExist&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/core/serializers/base.py&#34;, line 6, in &lt;module&gt;&lt;br /&gt;    from django.db import models&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/db/models/__init__.py&#34;, line 6, in &lt;module&gt;&lt;br /&gt;    from django.db.models.query import Q, QuerySet, Prefetch  # NOQA&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/db/models/query.py&#34;, line 13, in &lt;module&gt;&lt;br /&gt;    from django.db.models.fields import AutoField, Empty&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/db/models/fields/__init__.py&#34;, line 18, in &lt;module&gt;&lt;br /&gt;    from django import forms&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/forms/__init__.py&#34;, line 6, in &lt;module&gt;&lt;br /&gt;    from django.forms.fields import *  # NOQA&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/forms/fields.py&#34;, line 18, in &lt;module&gt;&lt;br /&gt;    from django.forms.utils import from_current_timezone, to_current_timezone&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/forms/utils.py&#34;, line 15, in &lt;module&gt;&lt;br /&gt;    from django.utils.html import format_html, format_html_join, escape&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/utils/html.py&#34;, line 16, in &lt;module&gt;&lt;br /&gt;    from .html_parser import HTMLParser, HTMLParseError&lt;br /&gt;  File &#34;/py3.5venv/lib/python3.5/site-packages/django/utils/html_parser.py&#34;, line 12, in &lt;module&gt;&lt;br /&gt;    HTMLParseError = _html_parser.HTMLParseError&lt;br /&gt;AttributeError: module &#39;html.parser&#39; has no attribute &#39;HTMLParseError&#39;&lt;/pre&gt;Then &lt;a href=&#34;http://stackoverflow.com/users/918959/antti-haapala&#34;&gt;Antti Haapala&lt;/a&gt; (a friend from &lt;a href=&#34;http://chat.stackoverflow.com/rooms/6/python&#34;&gt;Stakoverflow&#39;s Python Chat room&lt;/a&gt;) found out that it is because &lt;code class=&#34;prettyprint&#34;&gt;HTMLParseError&lt;/code&gt; is deprecated from Python 3.3 onwards and removed in Python 3.5, as per the &lt;a href=&#34;https://docs.python.org/3/library/html.parser.html#html.parser.HTMLParseError&#34;&gt;official documentation&lt;/a&gt;. He continued the investigation and found out that django guys are already aware of this, as they have &lt;a href=&#34;https://code.djangoproject.com/ticket/23763&#34;&gt;a bug raised&lt;/a&gt;, and &lt;a href=&#34;https://github.com/django/django/commit/b07aa52e8a8e4c7fdc7265f75ce2e7992e657ae9&#34;&gt;the fix has been already delivered&lt;/a&gt; to the code repository.&lt;br /&gt;Now, all we can do is, wait for the version of django which officially supports Python 3.5 or manually patch html_parser.py file as per the above shown fix. Even if we patch it manually, there is no guarantee that everything else will work fine.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;


</description>
    </item>
    
    <item>
      <title>Ubuntu overlapping displays while scaling dual monitor setup</title>
      <link>https://thefourtheye.in/posts/2015/02/01/ubuntu-overlapping-displays-while-scaling-dual-monitor-setup/</link>
      <pubDate>Sun, 01 Feb 2015 12:58:00 +0530</pubDate>
      
      <guid>https://thefourtheye.in/posts/2015/02/01/ubuntu-overlapping-displays-while-scaling-dual-monitor-setup/</guid>
      <description>
&lt;div class=&#39;post&#39;&gt;
&lt;div dir=&#34;ltr&#34; style=&#34;text-align: left;&#34; trbidi=&#34;on&#34;&gt;Today, again I wanted to change my screen&#39;s display size, in my Ubuntu 14.04. This time I have a dual monitor setup and I tried all the commands I mentioned in my blog post &lt;a href=&#34;http://www.thefourtheye.in/2013/05/ubuntu-scaling-display-zooming.html&#34;&gt;Ubuntu scaling the display (Zooming)&lt;/a&gt;.&lt;br /&gt;&lt;pre class=&#34;prettyprint&#34;&gt;➜  ~  xrandr&lt;br /&gt;Screen 0: minimum 8 x 8, current 2560 x 1024, maximum 16384 x 16384&lt;br /&gt;VGA-0 connected 1280x1024+1280+0 (normal left inverted right x axis y axis) 376mm x 301mm&lt;br /&gt;    1280x1024      60.0*+   75.0  &lt;br /&gt;    1152x864       75.0  &lt;br /&gt;    1024x768       75.0     60.0  &lt;br /&gt;    800x600        75.0     60.3  &lt;br /&gt;    640x480        75.0     59.9  &lt;br /&gt;LVDS-0 connected (normal left inverted right x axis y axis)&lt;br /&gt;    1600x900       60.0 +   40.0  &lt;br /&gt;DP-0 connected primary 1280x1024+0+0 (normal left inverted right x axis y axis) 376mm x 301mm&lt;br /&gt;    1280x1024      60.0*+   75.0  &lt;br /&gt;    1152x864       75.0  &lt;br /&gt;    1024x768       75.0     60.0  &lt;br /&gt;    800x600        75.0     60.3  &lt;br /&gt;    640x480        75.0     59.9  &lt;br /&gt;DP-1 disconnected (normal left inverted right x axis y axis)&lt;br /&gt;HDMI-0 disconnected (normal left inverted right x axis y axis)&lt;br /&gt;DP-2 disconnected (normal left inverted right x axis y axis)&lt;br /&gt;DP-3 disconnected (normal left inverted right x axis y axis)&lt;br /&gt;➜  ~  xrandr --output DP-0 --scale 1.25x1.25&lt;br /&gt;➜  ~  xrandr --output VGA-0 --scale 1.25x1.25&lt;br /&gt;➜  ~  xrandr&lt;br /&gt;Screen 0: minimum 8 x 8, current 2880 x 1280, maximum 16384 x 16384&lt;br /&gt;VGA-0 connected 1600x1280+1280+0 (normal left inverted right x axis y axis) 376mm x 301mm&lt;br /&gt;    1280x1024      60.0*+   75.0  &lt;br /&gt;    1152x864       75.0  &lt;br /&gt;    1024x768       75.0     60.0  &lt;br /&gt;    800x600        75.0     60.3  &lt;br /&gt;    640x480        75.0     59.9  &lt;br /&gt;LVDS-0 connected (normal left inverted right x axis y axis)&lt;br /&gt;    1600x900       60.0 +   40.0  &lt;br /&gt;DP-0 connected primary 1600x1280+0+0 (normal left inverted right x axis y axis) 376mm x 301mm&lt;br /&gt;    1280x1024      60.0*+   75.0  &lt;br /&gt;    1152x864       75.0  &lt;br /&gt;    1024x768       75.0     60.0  &lt;br /&gt;    800x600        75.0     60.3  &lt;br /&gt;    640x480        75.0     59.9  &lt;br /&gt;DP-1 disconnected (normal left inverted right x axis y axis)&lt;br /&gt;HDMI-0 disconnected (normal left inverted right x axis y axis)&lt;br /&gt;DP-2 disconnected (normal left inverted right x axis y axis)&lt;br /&gt;DP-3 disconnected (normal left inverted right x axis y axis)&lt;br /&gt;&lt;/pre&gt;Though it changes the display size, both the screens had overlapping images. After so much analysis, I found one inconsistency in the output of xrandr, before and after scaling. Note the first two lines.&lt;br /&gt;&lt;pre class=&#34;prettyprint&#34;&gt;Screen 0: minimum 8 x 8, current 2560 x 1024, maximum 16384 x 16384&lt;br /&gt;VGA-0 connected 1280x1024+1280+0 (normal left inverted right x axis y axis) 376mm x 301mm&lt;br /&gt;...&lt;br /&gt;Screen 0: minimum 8 x 8, current 2880 x 1280, maximum 16384 x 16384&lt;br /&gt;VGA-0 connected 1600x1280+1280+0 (normal left inverted right x axis y axis) 376mm x 301mm&lt;br /&gt;&lt;/pre&gt;Individual screen&#39;s resolution has scaled to 1600x1280 from 1280x1024, but the total screen size is 2880 x 1280, also the screen&#39;s position is 1280x0 instead of 1600x0. So, to get over the overlapping problem, I used the following command, after reboot, and it worked&lt;br /&gt;&lt;pre class=&#34;prettyprint&#34;&gt;➜  ~  xrandr --output DP-0 --scale 1.25x1.25 --pos 0x0 --output VGA-0 --scale 1.25x1.25 --pos 1600x0&lt;br /&gt;➜  ~  xrandr&lt;br /&gt;Screen 0: minimum 8 x 8, current 3200 x 1280, maximum 16384 x 16384&lt;br /&gt;VGA-0 connected 1600x1280+1600+0 (normal left inverted right x axis y axis) 376mm x 301mm&lt;br /&gt;    1280x1024      60.0*+   75.0  &lt;br /&gt;    1152x864       75.0  &lt;br /&gt;    1024x768       75.0     60.0  &lt;br /&gt;    800x600        75.0     60.3  &lt;br /&gt;    640x480        75.0     59.9  &lt;br /&gt;LVDS-0 connected (normal left inverted right x axis y axis)&lt;br /&gt;    1600x900       60.0 +   40.0  &lt;br /&gt;DP-0 connected primary 1600x1280+0+0 (normal left inverted right x axis y axis) 376mm x 301mm&lt;br /&gt;    1280x1024      60.0*+   75.0  &lt;br /&gt;    1152x864       75.0  &lt;br /&gt;    1024x768       75.0     60.0  &lt;br /&gt;    800x600        75.0     60.3  &lt;br /&gt;    640x480        75.0     59.9  &lt;br /&gt;DP-1 disconnected (normal left inverted right x axis y axis)&lt;br /&gt;HDMI-0 disconnected (normal left inverted right x axis y axis)&lt;br /&gt;DP-2 disconnected (normal left inverted right x axis y axis)&lt;br /&gt;DP-3 disconnected (normal left inverted right x axis y axis)&lt;br /&gt;&lt;/pre&gt;Now, you see that both the actual size of the screen and the starting position of the second screen is set properly.&lt;br /&gt;&lt;pre class=&#34;prettyprint&#34;&gt;Screen 0: minimum 8 x 8, current 3200 x 1280, maximum 16384 x 16384&lt;br /&gt;VGA-0 connected 1600x1280+1600+0 (normal left inverted right x axis y axis) 376mm x 301mm&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
    </item>
    
  </channel>
</rss>
