It’s a while since I have written here: too much work for sure, but also I think I am pretty lazy and writing in English takes a lot of effort for me.

Today I am writing after I had to migrate my website: my old provider (unbit.it, yes, the one behind UWSGI) decided to not provide services to consumers but to focus to B2B (I guess).

I loved the old provider: it was pretty expensive but I NEVER had downtime. Well… there might have been but I never noticed considering the low traffic.
Also they are really competent.

Anyway I had to migrate anyway (deadline was end on January 2018) so I found a new provider (keliweb.it) and I transferred the domain.

Everything went almost smoothly (damn DNS) until I tried to migrate this website and upgrade it.

Even if migrating the MySQL database and the WordPress code has been pretty easy, I realized that years of upgrades had messed up quite a bit with the previous installation, so I decided to do a fresh re-install.

At this point I found my new installation having troubles: a weird error was coming out every time I was installing plugins or themes.
The error was particularly weird because the actual JSON response contained the message state=”success” and the installations were actually successful.

Digging around I found out that a plugin was messing with the responses adding content before the headers were sent (yes, PHP ??‍♂️).
Deactivated the plugin (fortunately it was a code formatter one) everything worked fine.

Anyway, I think the lesson from this is that every time you touch something old, you need to expect troubles.

Since it took quite a bit of time for me to figure out the solution to this problem, I decided to write a quick reminder here.

I was working on a web application written in Bottle.py and everything was going smoothly until I decided to debug a function using the PyDev debugger in Eclipse.

Long story short there was no way to make the debugger work even if the same debugger was working perfectly fine in the unit tests.

After several tests I was able to understand that the PyDev debugger is incompatible with the option “reloader=True” of the bottle app.

So you can run your app in this way:

application.run(
    host=your_host,
    port=your_port,
    debug=True,
    reloader=True
)

and it is wonderful because the app will reload by itself every time you change a python file,

but if you want to run the code in the PyDev debugger you need to start your app in this way:

application.run(
    host=your_host,
    port=your_port,
    debug=True
)

Just a reminder… mostly for myself: 
the aliases set in .bash_profile are considered ALWAYS first, even if you are in a python virtualenv environment.

This means that if you have (like I do) an alias to a particular instance of ipython with the name “ipython” and in virtualenv you install ipython as well, if you simply type “ipython” the first (with all its libraries) will always be called!

 

A travel to Italy has been for me like a time travel!

I still remember when I used to surf Internet with my old pc with Windows 98SE and my modem 56Kbps!

Life was different: waiting for a web page to come up was not a big deal… it was part of the experience!

Well… Thinking better about it, probably the websites were designed differently with more text, less images and for sure no JavaScript! In total not so many KB of data to download per page.

Now even my grandma (if she was still alive) would know that Internet and its websites are much more complex and heavier!

But who cares?!? There are cheap wired connection at 15Mbps, there is 3G everywhere and 4G is coming out all around the world!

It is really simple, isn’t it?

Well it’s not at all!!!

In my travel in Italy I have spent time in a little village where there is no 3G and it’s hard to find an open hotspot!

The result is me using 2G (GPRS) struggling with any single web page, waiting even minutes to download some content!

In this situation do you know what I learned?

1- Smartphone apps work better than websites mobile oriented: I think the reason is that the apps download only content while the websites, even if are less complex than the desktop ones, still make you download tons of data!

2- There is way too much unnecessary content in any single web page: there are ads, related but not really relevant infos and A LOT of images: KBs that my browser downloads in a huge amount of time!

3- Some key services like bank and credit card accounts, utilities and so on most of the times don’t have a mobile version of their website but only an app that you cannot download because it is simply too big for your connection speed! This is unacceptable! If I need to access my bank account to pay the credit card, I do want a skinny website I can access with any crappy connection!

But more in general: why there are such morons that design these websites assuming that everybody has access to broadband?!?

A website should be self adaptive! There are technologies to do this, to remove unnecessary content based on the time the data is downloaded! In this moment I have at least 3 different ideas to do it and I didn’t even consider special setups of the web servers!

Never never never assume anything! If you have a website that can be necessary to someone, you must provide access even in difficult condition!

Greetings from the (Internet) Paleolithic!

Recently I received my new MacBook Air 13″ (sadly my old MacBook Aluminium is almost dead) and among all the problems I have with Lion probably the one I have with MacPorts is the most frustrating!

Someone can object with “why don’t you use Homebrew? It’s much better than Port because BLAH BLAH BLAH BLAH BLAH”, but I don’t care: I want Port working, not something else!

So after some searches around I found something that “magically” fixed everything.

The problem seems to be related to a missing setting after the installation of the Xcode. In particular the installation of the Xcode from the App Store (besides not installing by default the “Command line tools”) doesn’t set the “xcode_folder_path”.

To check if everything works it’s enough to run:

/usr/bin/xcodebuild -version

This gave me back:

xcode-select: Error: No Xcode folder is set. Run xcode-select -switch <xcode_folder_path> to set the path to the Xcode folder.
Error: /usr/bin/xcode-select returned unexpected error.

Well, now the solution is clear! It’s enough to set the xcode_folder_path!

So I run:

sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer

where

/Applications/Xcode.app

is the path of the Xcode application installed through the App Store.

Now if you run again:

/usr/bin/xcodebuild -version

you will have

/usr/bin/xcodebuild -version
Xcode 4.3.2
Build version 4E2002

All the Ports now should work! Well…. for me now they work!