Running codeskulptor locally in Ubuntu

1 Comment

For the impatient, jump to the end of this post for the summary of the commands to be invoked. 😉

I have signed up again for a Coursera course for Interactive Python programming to improve my Python programming skills. I am going to sidestep the question if I am going to finish this course for the moment. 😉

The course professors have developed and are using CodeSkulptor to make it easier to create, submit, and grade the course. CodeSkulptor is basically a browser-based Python interpreter that implements a subset of Python 2.x. It absolves the students enrolled in the course from the requirement to install Python in their local machines plus it also allows them to continue working on their code while on different machines (provided they know their work’s randomly generated URL).

The abstraction provided by CodeSkulptor however renders some incompatibilities in running the code locally. This could be a disadvantage for people who wants to work offline, either by choice or by location. Coursera member Jimmy Delgado has provided good quick tutorial on how to run CodeSkulptor code locally. The post is in the Coursera forums but I am replicating it here and then augment it with the steps I have added to make it run on my Ubuntu 14.04 installation.

More

[TipJar] Quickly transferring information to an android device

No Comments

No time to read through contexts? Jump to the TL;DR; section.

For security reasons my internet access in the office is restricted and most if not all of the sites that allow saving of data is blocked by the office proxy server. This becomes a pain if I come across some articles and sites that would be good to read later or heaven forbid something that I need. The usual route that would allow me to schedule reading the article is to save the links in my company email drafts folder, or email it to myself so I can remember to move them to my bookmarking or reminder site when I get home. This setup has been fine but being the perennial procastinator (or busy if you want to put a positive spin on it) I sometimes forget to do it immediately. The other alternative is horrible: type the url on my android device as I encounter the sites and articles. That option is as pleasing as going to the doctor for a rectal probe. I forgot to mention that my Android device doesn’t have continuous Internet by the way, which would have made my life easier and this post an academic exercise. 🙂

I have an alternative solution which works if you have a QR reader on your device. The main gist is to transfer the information to the device using a QR code. The steps follow:

More

[TipJar] Common Punk: replace my text

No Comments

The SOA server I am currently working with had a nasty quirk on its services that I havent figured out yet on how to fix: it fails on requests with an XML comment. We use SOAPUI to trigger requests and the quirk requires most of us to strip the comments that is automatically generated by the tool. This quirk however gives me a good segue on this IT tipjar: how to leverage pattern matching to batch remove comments. This should serve as an introduction in other pattern matching applications when dealing with text/ascii content.
More

First RPi mishap

2 Comments

Yesterday pixie, my RPi serving as the torrent/dlna box, stopped responding. Rebooting it doesnt help as it eventually reverts to only having the red LED on which I have started to interpret as the system is not yet booted.

I pulled pixie out of its nook and hooked it to my monitor before rebooting it. It showed that the boot process is encountering errors when reading from the SD card. The process stopped while asking for the root password to start the file check maintenance, or Ctrl-D to continue the boot process. I plugged a keyboard and here lies the conundrum: this is a debian system and I have been administering it as the pi user. I have been relying on the sudo mechanism and never replaced the root password so I cant provide it. That realization blows.

No other recourse now but to pull out the SD card and have the partition checked on my desktop. A “sudo fsck /dev/sdb2 -y” command (because sdb2 is the partition assigned to it by udev) and ten minutes of automated fixing later pixie is back online serving its DLNA goodness.

rpi-fsck-in-progress

Now I made sure I have changed the root password so this can be fixed without booting the desktop. Come to think of it, I am doing it also on my Ubuntu desktop. 😉

ciao!

Raspberry Media Server is now online

2 Comments

Hectic schedule but I finally finished having my own TorrentBox/DLNA/UPnP server out of the Raspberry Pis. One concern that got answered is if the system is usable as a media streaming server as there has been reports of slow throughput since the Pi’s ethernet (network) and USB system share the same memory space. Early on the file I/O throughput on the SD card I am using as the BIOS and operating system is a little bit slow, and as a techie friend (named Gideon[1]) pointed out its the class of the card itself that is the bottleneck.

The instructions are all over the net so Ill just reference the articles I used and add the other stuff I did to make it work on Pixie (the name of this Pi).
More

Apparently a headache

No Comments

Thats the difference between 21 and 32 inches at 2 feet away. 🙂

Sounds great in theory but sucks a bit in actual use. 😐

ciao!

The RPis have landed

4 Comments

I had some difficulty in locally procuring Raspberry Pis because even if there is a local RS branch, they initially sold a single batch for almost twice the price. When we last checked they are no longer selling them unless we are ordering by the hundreds to make it their while to import it. They said we could order directly from the UK office. Bummer.

Then I heard that Filepp, a colleague from a previous project, is on a short-term assignment in UK. So we grabbed the chance to ask a favor to procure a couple of RPis for us and now they have landed and the cases were given as gifts. (Note: Thank you Filepp. I’ll try not to torture you too much if I get to work with you again. Crap, we know I cant keep that promise 😉 ).
More

Bashwk to basics

No Comments

It was the first time to generate and send the report. It deals with downloading a lot of access logs, combining them based on certain scenarios, filtering out the cruft, slicing and dicing per service accessed and then tallying the responses to see if they meet the SLA.

The first manual extraction took around 4 hours to create the report for the most critical service. After that, I sat down and created the bash+awk script to do the slicing, dicing and tallying part. It took me 3 hours to create and test the script but after that I can generate the reports for 6 services in 30 minutes, where the bulk of the time was spent in downloading the latest logs (~10minutes) and pasting the data in Excel to create the “bayoootiful” graphs.

I figured if I can automate the rest then the reports can be generated under 15minutes, and I can hook it up on a continuous service so it will send it automatically every night. After that I can work on getting rid of the need to go through Excel if I can find some API to generate it and publish them as PDFs. JFree perhaps but my Java skills are already rusty. I also need something native if possible as I cannot install stuff on the office machines. The zLinux servers are pretty much off limits though I think there is a python interpreter installed.

One thing I can say is that automation and f/loss rocks. The script is too specific and covered by IPR so I cannot post it here but it is something that most scripters should be able to do.

ciao!

[TipJar] Enabling Aero window service from the command line

3 Comments

Aero is a default theme in Windows Vista and Windows 7 Home Premium or better but is not enabled by default. Aero adds some nifty features like Peek (showing thumbnail previews when hovering on the open programs), Shake (shaking the window minimizes all other windows), Snap (dragging the window to the edges snaps it, useful for side by side windows organization). Aero however consumes additional CPU and GPU power but in some cases it can introduce some efficiency like repainting only the areas that are affected by window movement.

Enabling Aero requires two services to be started before they can be used: the Desktop Windows Management (uxsms), and the Themes (themes) services. Enabling them from the Control Panel->Services MMC console is fairly easy but this tip jar is about enabling them from the command line to reduce the wait and teach the basics of interacting with the Windows services using command line options.

The command are split into two categories: making sure the services are enabled, and starting them up.

sc config uxsms start= auto
net start uxsms

sc config themes start= auto
net start themes

These are administrative activities so they need to be done from within a command window that has administrative privileges. Refer to previous TipJar entries on how to do this. The “auto” parameter of the sc commands can be changed to “demand” if the services are to be start manually so as not to consume resources ?at every Windows startup. The sc invocations are only required to be done once.

Using SMART BRO (USB Internet) Plug-it in Linux

8 Comments

This guide is created to show how to use the SmartBro USB Internet dongle in Ubuntu Linux. The dongle comes with the Windows installer that enables the SmartBro application to be installed in most computers. From within that application the user is able to send and reeive SMS, and connect/disconnect their Internet subscription. It allows more operations like access to the Smart portal but for the duration of this guide only the SMS send/receive and Internet configuration is covered. The instructions should be portable to the plug-it kits of the other telcos.

From my experience, Ubuntu has easily supported the USB dongles and tethering devices as early as Karmic Koala. I no longer have my Sony Ericsson K618i that I just connect via a USB cable to my MSI Wind U100 Netbook so this is what I will use for the guide. My netbook is sporting Natty Narwhal during the time the screenshots are taken.

sm00

Lets get cracking. Caveat though that I had to recreate some activities in two different locations so don’t mind the clock too much.

Configuring data connectivity

  • Boot into Ubuntu and connect the dongle. Wait for a few second while the system recognizes the device.
  • From the system tray, click on the network-manager applet and enable the “Enable Mobile Broadband” option. Select the “Edit Connections…” entry, and add a new entry under the “Mobile Broadband” tab.
  • As can be seen below, Ubuntu has already detected the chipset of the USB dongle. Click on the Forward button.
  • Select the provider (which in this case is Smart). Click on the Forward button.
  • On the billing plan dialog, accept the default selection and click on the Forward button.
  • Confirm the summary of the selected settings by clicking the Apply button.
  • Visit back the settings of the created connection and ensure that there is no username and password in the Mobile Broadband settings page. Save any changes made and dismiss the wizard to go back to the desktop.
  • Click on the network-manager applet and click on the mobile internet entry created above.
  • If everything goes well and the signal is strong enough the user should be greeted with an established connection message.
  • Click on the network-manager to validate the type of connection.

Configuring SMS capability

The setup above can fail if the SIM card used is of the prepaid type and there is no credit loaded on the account. SMART imposes a Php10/30mins rate but there are promos that can be activated by sending some keywords via the SIM account. This implies that the SMS send and received facility should be accessed. Fortunately the wammu project provides this capability.

  • Install the wammu application by invoking the command below:
  • sudo apt-get update && sudo apt-get install wammu -y

  • Start the wammu application. If the wammu application doesn’t find its configuration files then it will trigger a wizard for first time-configuration.
  • wammu-first

  • Click on the Next button to start the Wizard and select the following options in the succeeding windows:
  • – Configuration Style: Guided Configuration
    – Configuration type: USB Cable (as the unit is plugged in a USB port)
    – Phone Type: None of the above (unless future versions provide an option for the chipset)

    – Connection Type: AT based
    – Driver to use: Generic AT over serial line or it’s emulation
    – Phone device: /dev/ttyUSB0

    The above part is trial and error. If the test doesn’t succeed select the next option. If it succeeds then information about the model of the dongle will be shown. In my experience it is almost always /dev/ttyUSB0 but then I do have another device that emulates a serial connection via USB.

    – Complete the remainder of the next dialog windows using the default option.

  • Once the wammu phone configuration is done, start accessing the USB dongle by invoking the Phone->Connect menu item.
  • Once the dongle is active, test the connectivity by receiving existing messages.
  • After the operation succesfully completes, select the Messages item in the left treebox to view all retrieved messages.
  • Next is to try the SMS sending capability under the Create menu. The editor is dated compared to the built-in provider interface but it would suffice. In the screenshot below, the bucket promo of Always On is being triggered.
  • Check the Sent folder if the message was successfully sent.
  • After a few seconds/minutes, retrieve the messages again to check the result of the promo registration.

And that is basically it. The instruction in this guide, with minor tweaks, should be applicable to any of the USB dongle. Enjoy your USB Internet dongle in Linux. 🙂

ciao!

Older Entries Newer Entries