Saturday, May 23, 2015

Moto G or X hidden Qualcomm Settings menu

Instead of installing a special app to launch the hidden activity you can launch it from command line:

adb shell am start -a android.intent.action.MAIN com.qualcomm.qualcommsettings/.QualcommSettings

Tuesday, January 26, 2010

How to ping windows host names from Linux

I have a home network (workgroup) and i want to be able to ping my windows machines from Linux, using the windows host name (Wins, NetBios name).

To enable that, make sure that you have samba client installed and then edit /etc/nsswitch.conf and find the line starting with hosts. Add "wins" at the end of the line:


hosts: ... dns wins

Sunday, November 29, 2009

Logitech QuickCam causes boot failure

I'm furious! I just wasted 2 hours of my precious life. I boot my machine only when i really have too, usually every ~1 month or so.

So the other day i installed a PCI card (some TV tuner card), when i tried to boot my lovely Asus P5Q Deluxe board, the machine would hang early during the boot process. I would see the "Press TAB to enter BIOS" on the bottom of the screen but i could not enter into the BIOS setup.

The weird thing is that i was able to get into the "Express Gate" mini OS - which gave me a good indication that the HW was functioning OK. Maybe the BIOS setting was screwed? Maybe the card i just inserted was causing this error? So i ejected the card and tried to reboot again - no go! Could it be that the card caused a permanent damage? I then tried to reset the BIOS using the on-board jumper. Still the machine would hang during boot time.

After more frustration and card pulling and pushing, i sat to reminisce a little about what i changed since the last boot... hmmm. Then i remembered my webcam - an el cheapo Logitech QuickCam, the shittiest webcam with a real cheap plastic lens. I unplugged the webcam from the USB and the machine would boot!!!

How on fucking earth would a 5$ webcam bring my state of the art Asus p5q deluxe to its knees?

I guess that when the BIOS is configured to support USB, it powers up all the devices and does a basic query for device classes, to search for storage devices to boot from. I don't know if this is a BIOS bug or a device specific bug (i guess the latter because i didn't see this with any other device).

All you readers out there beware!

Monday, September 21, 2009

7 days in heaven with Ubuntu 9.04 (Jaunty)

I have an old Lenovo T23 laptop I use in my living room. It is connected to my stereo amp, and I have XP installed on it. Since i love Linux so much and i know that Linux is making it's way into the desktop, i thought of trying to switch Linux. I tried Linux for ~7 days and here are my conclusions. The initial requirements were simple really:
  • Be able to play Mp3 and other audio formats from a remote SMB share.
  • Be able to have a search-able catalog of the Mp3 based on their existing id3 tags.
  • Be able to browse the web.
  • Operate nice on modest hardware.
  • Connect to the network using a PCMCIA adapter.
The Lenovo T23 Hw spec:
  • Intel(R) Pentium(R) III Mobile CPU 1133MHz
  • Memory Size 512 MBytes
  • Chipset ICH3-M
  • S3 VGA 1024x768
  • PCMCIA Ralink RT2500 wireless network adapter
I picked Ubuntu 9.04 because i know that it is a desktop oriented distro. I know that Karmic is in alpha, so i didn't want to test some unstable software, I did not want to wait either.

Installation

Installation was a breeze, i just booted from the LiveCD and everything went silky smooth. All the HW got recognized, including the rt2500. X got up using the native resolution. While Ubuntu doesn't have any serious eye candy - it looks decent.

Wireless setup was fairly easy. An annoying thing is that the link led on my Ralink RT2500 was not lit up. While this is not a major issue it doesn't give any confidence. And indeed, the wireless stability and performance were sub par with those i'm used to in Windows. I would get disconnections here and there, and audio playback would sometimes get chopped due to bandwidth drops.

SMB Mapping

Ubuntu has the "Places" menu. It is cool. I was able to map my mp3 remote share pretty easily. The dialog used to map the share is a bit confusing though... what is a "bookmark" and what is "folder"? I had to play a little to figure those out. A good surprise was to find out that the share i defined using "palces" is accessible from some gnome based apps, for example Rhythmbox. I was also able to access SMB files from some apps using some sort of gnome "common dialog" infrastructure, so i could open a file using "smb://user@server/share" notation.

Linux Mp3 Players

Here is where the problems begin. The default mp3 player in Ubuntu is Rhythmbox. It looks promising. But, unfortunately some of my mp3 are non-English. Some are encoded using utf8. And some are using a hebrew codepage. In XP, this is not an issue: i can set my UI to be English and set the "Language for non-unicode programs" to Hebrew and that's it. There is no way to set this up in Linux without fiddling and hand editing with some /etc files.

Things are worse though. I am not 100% sure that Rythmbox even supports utf8 to begin with. I googled and found out people suggesting that the problem was in the id3 tags, and that they should be fixed to explicitly set the encoding to utf8.

What the heck, I knew Amarok - and I decided to drop Rythmbox in favor of amarok and give it a second shot. Disappointment again. First, i amarok is not gnome based so i could not use the share i configured using the "Places" menu to access the SMB share. It was so nice, using GUI only to define, but now i'm curios - where is it mounted? I opened a terminal (what a bummer, not a grandma proof OS) and the mount wasn't displayed on that list. OK, so i tried to mount the share using a mount command.

After 20 minutes of failed attempts and some hair pulling, i discovered that the reason that the mount command failed is that mount.cifs is not installed. Nothing in the error messages suggested that this could be the reason for the command to fail.... this is horrible. And i consider myself to be Linux knowledgeable... someone else would have given up already - not to mention a grandma.

After the share was mounted i went back to Amarok. It took amarok 8 hours to catalog my collection, during which the program wasn't very responsive. Why so much time?
After it was finished i discovered that again, the catalog had all my non-english mp3 files gibbrish... again an encoding problem.

Then i wanted to stick with what is familiar and i remembered xmms - the winamp clone. I fired Synaptics and searched for xmms. But there is no xmms in Ubuntu... all i found was xmms2, Sounds promising, no? NO! I expected xmms2 to be an improved version of xmms but from what i understand it's a client-server architecture - but i could not find a GUI front end for xmms2. Who cares about command line mp3 playing?

Then when i had a severe episode of wireless disconnects I ejected the PCMCIA card, and the machine froze. I gazed silently at the screen and took a long breath. I give up. Going back to Windows. Don't get me wrong, I love Linux. As a server platform I would take it anytime over Windows, without a doubt. But as a desktop - hell no! It is improving but it's not there yet.

Problems Summary
  • Link led not lit up on Ralink RT2500 PCMCIA card
  • Rhythmbox can't read non english chars from id3 tags
  • Inconsistent UI - some apps can access SMB, some can't
  • Amarok cannot mount smb from ui, must mount cifs manually to access smb
  • Trouble mounting cifs, no comprehensive error if mount.cifs is not installed
  • Unexplained wireless disconnects
  • Could not deal with non-english chars in amarok
  • No UI to set advanced locale settings (for non-english, non-unicode apps)
  • Takes 8-9 hours to scan an mp3 mount from amarok
  • Ejecting the pcmcia card freezes the machine

Monday, May 18, 2009

How to set up a development smtp server for Django

A cool feature in Django is the development server. It allows you to quickly test your code without dealing with a full blown Apache/web server deployment. When i played with the django-registration, i needed also a "development" SMTP server (during the registration process, an email is sent to activate a new account). Luckily, this is simple enough to do with python. Open a new console and type:


python -m smtpd -n -c DebuggingServer localhost:25

And you'll have a "fake smtp" server. All it does is to listen for smtp connections, and just dump the smtp data to the console (no real emails are sent).

Saturday, May 16, 2009

How to use GnuPG to encrypt emails in Gmail

Until about a year ago, i used Thunderbird as my favorite email client. I loved the fact that i could use it from both Windows and Linux, and the nice plugins it has. I dropped it in favor of Gmail for several reasons:
  • It consumes a lot of memory (yes IE consumes much more, but who uses IE? another tab weighs less than a full email client)
  • Mozilla, Thuderbird developers, shows no interest in Thunderbird any more. I guess they don't make enough money to justify it's development. That means that you won't see any significant improvements in Thuderbird anytime soon.
  • It is somewat sluggish - especially i hate the lag when pressing the Send button.
  • No calendar integration - true, the is the lightning project, but it looks horrible.
So now, i use Gmail. It is perfect, almost. The thing i missed the most was the Enigmail Thunderbird plugin, that enabled email encryption using GnuPG.

Now, it is possible to do the same with Gmail. Download the FireGPG plugin for Firefox. What it does is it extends the Gmail interface (using greasemonkey?) to support Encrypt and Decript ops.

While such a greasemonkey-like solution will probably not win the 2009 software elegance award, and i wonder how it will continue to work when Google updates Gmail next time.... But i have to say that it worked 100% for me and this is great!

How to add a "remember me" checkbox to django-registration

If you are using django-registration app, you might want to add a "remember me" checkbox to your login form. Usually, "remember me" functionality means that the cookie is set to expire for an extended period of time.

Create a view function inside your app:

from django.contrib.auth import views as auth_views
...
def login_user(request, template_name='registration/login.html', extra_context=None):
response = auth_views.login(request, template_name)
if request.POST.has_key('remember_me'):
request.session.set_expiry(1209600) # 2 weeks

This view practically calls Django's original login view function, and then checks if the request contains a "remember_me" field checked. Also, in the settings file, you should make sure to set SESSION_EXPIRE_AT_BROWSER_CLOSE = True to make the default behavior such that the cookie expires when the user closes the browser.

You should now edit your login template to add the checkbox to the login form:

...
<input type="checkbox" name="remember_me" value="true">Remember Me</input>
...

Last, you should hook you application url to the new login view we just defined. Edit you applications urls.py:

urlpatterns = patterns('',
...
url(r'^login/$', login_user, {'template_name': 'registration/login.html'}, name='auth_login'),