Use Twitter from the command line on Ubuntu bash for Windows

I read this (“Using Twitter From the Command Line Is Actually Really Fun“) and I wanted it too. Not in an ordinary Linux box but in the Ubuntu bash on Windows 10. Turned out that I needed to add a graphical browser to be able to log into Twitter and authenticate the Rainbow Stream app.

It isn’t hard to do, but I thought I’d write it down anyway.

Assuming that bash is already installed, run these commands. There will be lots of notices and messages…

  1. sudo apt-get install python3-pip (skip this if you already have pip; it is only required for the third step)
  2. sudo apt-get install libsqlite3-dev libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev
  3. sudo pip3 install rainbowstream
  4. sudo apt-get install firefox (or any other web browser)
  5. in Windows, install an X server. I followed this article and installed the Xming X Server for Windows.
  6. back in bash: export DISPLAY=:0
  7. firefox & (should open FF in an X window)

Hit enter to return to the prompt.

Now run rainbowstream and authenticate the app in the browser. Enter the pin Twitter returns into rainbowstream and it should be up and running.

Xcode – localize iOS project strings

Writing this down as I usually forget how to localize text in MyProject-Info.plist.

  • Left hand column, select Resources folder

  • Right click > New file… > Resource, Strings File

  • Save file as InfoPlist.strings

  • Open the file in the editor, enter strings to localize, like

    NSLocationWhenInUseUsageDescription = “Show your location on the map”;

  • Save file

  • In right hand column, click Localize button (makes the file localizable)

  • Now go to the project’s Localizations settings (under Project > Info)

  • Click Add language and select InfoPlist.strings

  • In the left hand column, there now are two entries under InfoPlist.strings. Edit as you please.

Works in Xcode 7 and 8.

Mysterious ‘headers already sent’ while handling php://input stream

A script that handled a php://input stream exited rather unexpectedly when it called session_start(). I had ‘track_errors’ enabled, so there was a message in $php_errormsg saying that headers had already been sent. But there was no file name or line number.

Continue reading Mysterious ‘headers already sent’ while handling php://input stream

Studio without Server

I’ve been using Zend Studio for many years now and think that it is a great IDE for building sites with PHP and JavaScript. IIRC I started with ZS 5; until this week I used version 9. I also ran a free Zend Server package, including Apache 2.2 and PHP 5.4. All this on an ordinary Windows 7 machine.

As my production web server now runs on Apache 2.4 and PHP 5.6, an upgrade on the dev machine seemed appropriate. Also, Zend recently launched Studio 13, with support for PHP 5.6 and even PHP 7. I decided to upgrade everything at once.

Continue reading Studio without Server

Post from server to Facebook page with FB’s PHP SDK 4

On my server, I have a PHP script that runs once a day to post a message and a picture to a Facebook page that I administer. Yesterday Facebook upgraded their API to v2, breaking my script that had been running fine since a few years.

Continue reading Post from server to Facebook page with FB’s PHP SDK 4

When the server ran out of inodes

A while ago I couldn’t add any files to a Debian server I control. It was pretty odd, as there was plenty of free disk space available (df -h will show that).

After I deleted a number of web cache files, I could add new files again. But soon the problem would return, leaving me wondering what was wrong.

Continue reading When the server ran out of inodes