2013-05-15

Advanced Streaming Format (ASF) Demuxer


You go to open a WMV video file in Nautilus on a new GNOME install, GNOME Video opens, and you are immediately greeted with: "Advanced Streaming Format (ASF) demuxer".  A message that is terribly helpfully, but at least it offers to "Search" for a solution. The auto-find-the-solution button works sometimes, but not always.  An easier solution is to preemptively install the required packages. 
zypper ar http://ftp.gwdg.de/pub/linux/packman/suse/openSUSE_12.3 packman
zypper in gstreamer-plugins-bad-orig-addon gstreamer-plugins-libav
gstreamer-plugins-ugly-orig-addon w32codec-all

Add the Packman repository and install the required packages.
The package install may prompt you to allow a vendor change (from the 'official' openSUSE repository to the Packman repository).  This vendor change is desired so it should be allowed.  Once the packages are installed GNOME Video player should play WMV files which use ASF multiplexing without further complaint.
Aside:  If you don't want to be pestered about package vendor changes in the future you can edit  /etc/zypp/zypp.conf and set "solver.allowVendorChange = true".  But don't do that unless you know what that means.


2013-05-01

Getting a native connection from the ORM

The SQLAlchemy ORM provides a powerful abstraction from the database allowing operations to be performed on objects and queries to be constructed based on object attributes rather than dealing with attribute-to-field correspondence.  But there are still some operations for which you need to talk directly to the underlying database. 
In 'normal' mode SQLAlchemy maintains a connection pool and releases connections from the pool to the application as needed, tracks them, and tries to keep everything tidy.  When the need arises for a 'native' DBAPI connection [for this example I'm using PostgreSQL] it is possible to explicitly check a connection out from the pool - after which it is yours to deal with, to track the isolation, close, etc..
Assuming the database connection has already been created and bound to the session factory with something like:

from sqlalchemy import create_engine, Session
...
engine = create_engine( orm_dsn, **{ 'echo': orm_logging } )
Session.configure( bind=engine )

 - then sessions can be taken from the connection pool simply by calling "db = Session( )".  When the "db.close( )" is performed that session goes back into the pool.
If a connection is to be used outside of all the mechanics that SQLAlchemy provides it can be checked out, as mentioned before, using a rather verbose call:

conn = Session( ).connection( ).connection.checkout( ).connection

Now "conn" is a 'native' DBAPI connection.  You can perform low level operations such as setting the isolation level and creating cursors:

conn.set_isolation_level( psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT )
curs = conn.cursor( )
curs.execute( .... )

This is not a frequent need, but for very database backend specific it is the simplest approach [otherwise you can extend SQLAlchemy...]. One use case is using PostreSQL's asyncronous notify channels to capture database events; for this purpose an application needs to select on the DBAPI connection, there's no need for an ORM in the mix when you are just capturing events.

2013-04-08

Windows "Uptime"

Windows XP and its brethren lack an "uptime" command.  Yeah, the reason the probably obvious, but sometimes it would be nice to know.  A user says they restarted their workstation... but most user's [including recent college graduates] don't know the difference between logging out and restarting.  So how to know how long a workstation has been running?
On the command line just execute "net statistics server", the line that starts with "Statistics since" provides the time the server component of the operating system has been up.  In the case of a workstation this is almost certainly since the last boot. 
And nope, the user had not restarted their workstation for almost three weeks.

2013-03-15

First openSUSE 12.3 Upgrade

Last night I upgraded one of my spare laptops (an HP DV7-3165DX) to the new openSUSE 12.3.  In a word: flawless.  It updated, rebooted, and was ready to go.  Everything just works and all my work-a-day applications resumed operation with their expected configuration.  Defined VPN connections all remained operational as well.

Now running the 3.7.10-1.1-desktop kernel and some shiny new versions.  No separate repository is required to get to the excellent GNOME Shell 3.6.x (the version where GNOME Shell got all grow'd up).

Now I can get back to work.  As good as this is looking I'll probably upgrade my workstation and work-a-day laptop in short order.

gnome-shell-3.6.3.1-1.1.1.x86_64
pulseaudio-3.0-1.1.1.x86_64
evolution-3.6.3-1.2.1.x86_64
banshee-2.6.0-3.2.1.x86_64
python-2.7.3-10.1.1.x86_64
libreoffice-3.6.3.2.4-2.4.1.x86_64
gnucash-2.4.11-2.1.2.x86_64
cups-1.5.4-5.2.1.x86_64
rabbitmq-server-2.8.7-2.1.3.x86_64
postgresql-server-9.2-2.1.1.noarch
glade-sharp2-2.12.10-38.2.1.x86_64.rpm
monodevelop-3.0.6-1.2.1
cadaver-0.23.3-65.1.2.x86_64
ghostscript-9.06-4.1.1.x86_64
MozillaFirefox-19.0-1.1.1.x86_64
tracker-0.14.4-2.1.2.x86_64
zeitgeist-0.9.5-2.1.1.x86_64
gnome-activity-journal-0.8.0-8.1.2.noarch

New Versions!
Only disappointment is that LibreOffice 4 didn't make the cut for the new release.

For anyone researching hardware issues, below is the low-down on the DV7-3165DX.  Probably nobody is looking, as the entire DV6 & DV7 seem to work flawlessly with LINUX,  but for the search engines...
00:00.0 Host bridge: Advanced Micro Devices [AMD] RS880 Host Bridge
00:01.0 PCI bridge: Hewlett-Packard Company Device 9602
00:04.0 PCI bridge: Advanced Micro Devices [AMD] RS780/RS880 PCI to PCI
bridge (PCIE port 0)
00:05.0 PCI bridge: Advanced Micro Devices [AMD] RS780/RS880 PCI to PCI
bridge (PCIE port 1)
00:06.0 PCI bridge: Advanced Micro Devices [AMD] RS780 PCI to PCI bridge
(PCIE port 2)
00:11.0 SATA controller: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode]
00:12.0 USB controller: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:12.1 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0 USB
OHCI1 Controller
00:12.2 USB controller: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:13.0 USB controller: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:13.1 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0 USB
OHCI1 Controller
00:13.2 USB controller: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:14.0 SMBus: Advanced Micro Devices [AMD] nee ATI SBx00 SMBus
Controller (rev 3c)
00:14.2 Audio device: Advanced Micro Devices [AMD] nee ATI SBx00 Azalia
(Intel HDA)
00:14.3 ISA bridge: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 LPC host controller
00:14.4 PCI bridge: Advanced Micro Devices [AMD] nee ATI SBx00 PCI to
PCI Bridge
00:18.0 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor
HyperTransport Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor
Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor
DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor
Miscellaneous Control
00:18.4 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor
Link Control
01:05.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI
RS880M [Mobility Radeon HD 4200 Series]
01:05.1 Audio device: Advanced Micro Devices [AMD] nee ATI RS880 HDMI
Audio [Radeon HD 4200 Series]
08:00.0 Network controller: Atheros Communications Inc. AR9285 Wireless
Network Adapter (PCI-Express) (rev 01)
09:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 02)
/sbin/lscpi


processor       : 0 [and 1]
vendor_id       : AuthenticAMD
cpu family      : 16
model           : 6
model name      : AMD Turion(tm) II Ultra Dual-Core Mobile M620
stepping        : 2
microcode       : 0x10000c7
cpu MHz         : 800.000
cache size      : 1024 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt
pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc
extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic
cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt
hw_pstate npt lbrv svm_lock nrip_save
bogomips        : 4986.89
TLB size        : 1024 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 48 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate
/proc/cpuinfo

2013-03-05

Unknown Protocol Drops

I've seen this one a few times and it is always momentarily confusing:  on an interface on a Cisco router there is a rather high number of "unknown protocol drops".  What protocol could that be?!  Is it some type of hack attempt?  Ambitious if they are shaping there own raw packets onto the wire.  But, no, the explanation is the much less exciting, and typical, lazy ape kind of error.
  5 minute input rate 2,586,000 bits/sec, 652 packets/sec
  5 minute output rate 2,079,000 bits/sec, 691 packets/sec
     366,895,050 packets input, 3,977,644,910 bytes
     Received 15,91,926 broadcasts (11,358 IP multicasts)
     0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     0 watchdog
     0 input packets with dribble condition detected
     401,139,438 packets output, 2,385,281,473 bytes, 0 underruns
     0 output errors, 0 collisions, 3 interface resets
     97,481 unknown protocol drops
     0 babbles, 0 late collision, 0 deferred
This is probably the result of CDP (Cisco Discovery Protocol) being enabled on one interface on the network and disabled in this interface.  CDP is the unknown protocol.  CDP is a proprietary Data Link layer protocol, that if enabled, sends an announcement out the interface every 60 seconds.  If the receiving end gets the CDP packet and has "no cdp enable" in the interface configuration - those announcements count as "unknown protocol drops".  The solution is to make the CDP settings, enabled or disabled, consistent on every device in the interface's scope.

2013-02-27

Getting Down With Markdown

This is the slide deck from my presentation of "Getting Down With Markdown" [aka "Upgrading Markdown"] given to the Grand Rapids Python Users Group on  2013-02-18.  I can't decide which name is more punny, so I kept both.
This presentation covers basic use of the markdown module in Python and how to perform a couple different types of extensions.  I used the markdown module to add a simple wiki protocol bundle to OpenGroupware Coils; using the extensions demonstated in the presentation the wiki can render some dynamic and security-model-aware content - making the wiki an easy productivity tool.

2013-02-26

Looking Under The Hood

This is the slide deck from my presentation of "Looking Under The Hood" given to the Grand Rapids Web Developers Group on 2013-02-25.
This presentation shares a lot of content with my previous "D is for Debugging" presentation, so if you enjoy this kind of thing you should check out that slide deck as well.  This deck was tweaked to try to focus on hunting down performance, princpally latency related,issues that are commonly encountered with very network-centric applications such as web servers, proxy servers, database servers, etc...
Learning tools like netstat, ss, lsof, and fuser is worth the time; these tools let you know what is going on.