|
|
slmingol posted this in tips & tricks on January 25th, 2012, @ 6:46 pm
Background
Recently I came across this really cool UNIX tool called dupx. I was looking for a way to connect to a program’s STDOUT and STDERR after I had already started it. This was a long running, think 30+ hours job, and I didn’t want to have to stop and restart it. As is the case with UNIX/Linux, there’s an app for that.
Solution
Dupx isn’t an actual program per say, it’s actually a shell script that eases the task of using the real workhorse, GDB that allows you to connect to an already running program. GDB is the command line GNU Debugger for C & C++ applications but it can do a lot more. In our case, GDB is being used by dupx to attach to our program/script’s process id (PID), and then manipulating the already running programs environment to repoint STDOUT, STDERR, and even STDIN to new locations.
Here’s an example where I’ve started up a program without redirecting its output, STDOUT to anywhere specific:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| # ex. 1: sleep for 10 seconds, then echo a msg.
# get the current time
% date
Wed Jan 25 21:25:07 EST 2012
# run a job
% bash -c 'sleep 10 && echo "rise and shine"' &
[1] 14992
# NOTE: pid 14992, output from job
% rise and shine
# wait 10 secs, hit return a couple of times
%
%
[1]+ Done bash -c 'sleep 10 && echo "rise and shine"'
# note that program ran for > 10 secs.
% date
Wed Jan 25 21:25:29 EST 2012 |
Here’s an example where I’ve started up a program without redirecting its output, and then ran dupx to redirect this program’s STDOUT to my shell’s STDOUT:
…. Continue reading → [one-liner]: Redirecting an Already Running Program’s STDOUT to a File using dupx »»
slmingol posted this in viewpoints on January 24th, 2012, @ 12:43 am
I generally don’t use this blog to provide too much in the way of opinion pieces but given I worked at Kodak for over a decade I felt like I kinda wanted to weigh in on what’s been going on there. I was reading this piece over on Mashable, How Kodak Squandered Every Single Digital Opportunity It Had and felt compelled to reply with my own $0.02 given the lack of accuracy in peoples’ comments.
The gist of the story basically discusses how Kodak missed the boat in 3 different areas:
- digital cameras
- photo sharing
- photo viewing
While these are accurate as some key misses it’s a bit of a disservice to represent Kodak merely as a consumer products company, there were a lot of other products there too. In some ways too many products might have had a hand in why Kodak ultimately failed.
Anyway check out the article. Whether you’re interested in Kodak or not, it’s a good lesson in what can happen to a company if it doesn’t have a clear business objective, and is slow to adapt.
Below are my comments that I provided to the Mashable article
I worked at EK for 14+ years and what most people in this thread don’t realize is that EK is so much more than just consumer products. They have a fairly large plethora of enterprise and business products too. Ever seen a movie? Roughly 90% of all movie film is made by EK. The commercial and government segment was sold off years ago to ITT, and 5+ years ago the health products were sold off and are now Carestream health. What remains? There is still a large presence of Graphics Communications, graphics.kodak.com, which is a myriad of printers, presses, printing workflows, and plate technologies. Then there’s Document Imaging. Again a mix of small and large commercial products.
There were a number of other innovative technologies that people are just starting to recognize too. OLED! EK invented that too. Cholesteric LCDs (google it) was another promising technology that EK just didn’t have the stomach to see through and develop into products.
I doubt the patent portfolio is worth the $2B that some would have you believe. The company is now saddled with an ageing employee base, did I mention that I was one of only a handful of people in their 30′s when I was there, and a mountain of dead wood.
Unfortunately I don’t think chapter 11 is going to do a lot for EK other than allow it to perpetuate for a few more years so that greedy individuals can continue to squeeze every dollar out of the place. The best thing that could happen would be for the key businesses to be either sold off to other companies or spun off so that they can stand on their own.
I had had enough and left last year but this company was at one time a treasure trove of patents, innovations, and talented employees. If I had to pin the blame on anything, it would be the lack of a clear vision of where EK was going. George Eastman had a clear vision of what problem he was trying to solve and he built EK for that single purpose. It’s impressive that the business continued for another 70+ years after his death. Does anyone think that Yahoo, Microsoft, and others will be around for that long without their original core founder(s)? I think there are a few select companies that are able to redefine themselves after the founder(s) “leave” and fewer still that are able to survive a technology shift. EK was able to do both for a period of time, but it eventually caught them just like pretty much every company seems to eventually succumb to their own demise.
Does anyone remember the term 5 and dime? Woolworth Company used to be huge and they’re no more. Unfortunately, I’m thinking we’ll be adding another slogan to the list … Kodak Moment.
slmingol posted this in tips & tricks on January 15th, 2012, @ 4:44 pm
Background
I’ve been using SparkleShare for almost a year now and it has impressed me with how well it’s able to act as my Dropbox replacement. It took a little coaxing, mainly around setting up a unique ssh key pair just for SparkleShare, so that I could allow it to run both when I’m at home on my local LAN and away on the road, but otherwise its worked pretty flawlessly.
Recently however, I ran into a small snag with SparkleShare that I thought I’d share on the off chance that someone else may have also encountered it. The issue? Trying to add git repos into SparkleShare’s directory.
Solution
Ironically, SparkleShare uses git as its back-end storage of you SparkleShare directory, and as of version 0.2, it would appear that you can’t add any directories that include a .git directory within. NOTE: The .git directory is how git maintains a directory that has been initialized as a git repository.
The way I stumbled into this was when I inadvertently copied a directory into my SparkleShare repo that happen to include a .git directory. This was some example code that I wanted to maintain locally purely for reference purposes along with some ebooks. SparkleShare allowed me to copy the directory in and even synced it. However when I later restarted SparkleShare all hell broke loose. I quickly noticed that the load on my laptop was climbing wildly (exceeding 50 in top).
Once I realized it was SparkleShare I quickly killed the process and tried restarting it. Every time I restarted it I saw the following in the logs:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| SparkleShare stale pid file found, starting a new instance.
Starting SparkleShare... Done.
Identity added: /home/rogerdodger/.config/sparkleshare/sparkleshare.sparkleshare@jke.org.key (/home/rogerdodger/.config/sparkleshare/sparkleshare.sparkleshare@jke.org.key)
19:38:00 [Cmd] /usr/bin/git log -1 --format=%H
19:38:00 [Cmd] /usr/bin/git rev-list --reverse HEAD
19:38:00 [ListenerFactory] Issued new listener for 204.62.14.135
19:38:00 [ListenerIrc] Connecting to 204.62.14.135
19:38:00 [Cmd] /usr/bin/git status --porcelain
19:38:00 [Cmd] /usr/bin/git status --porcelain
19:38:00 [Cmd] /usr/bin/git status --porcelain
19:38:00 [Cmd] /usr/bin/git status --porcelain
...
...
19:38:00 [Listener] Connected to 204.62.14.135
19:38:00 [Git][personal_repo] Checking for remote changes...
19:38:00 [Cmd] /usr/bin/git ls-remote origin master
19:38:00 [Cmd] /usr/bin/git status --porcelain
19:38:00 [Cmd] /usr/bin/git status --porcelain
...
... |
NOTE: The full details of SparkleShare’s logs can be seen in these 2 files, logfile #1, & logfile #2
After a few more minutes of thinking about it I realized it was the newly added directory that included the .git sub directory that was causing this odd behavior. Once I removed the offending directory and restarted SparkleShare all was back to normal.
Over on the SparkleShare github page, I’ve added some comments to an already pre-existing issue, Properly handle .git folders that was opened for this behavior.
Hopefully this post will help anyone else that may have run into the same problem. Again this isn’t a huge deal, I just have to be careful not to mix any git repositories into my SparkleShare directory, otherwise like I said, it has worked pretty flawlessly!
References
NOTE: For further details regarding my one-liner blog posts, check out my one-liner style guide primer.
slmingol posted this in tips & tricks on January 4th, 2012, @ 5:17 pm
Background
Having kids I’m always dealing with DVDs, either backing them up or repairing them. Recently we received a bunch of DVDs from a friend of various kid movies. Some of them just refused to play in our DVD player and being a geek who’s curious I wanted to better understand why. Turns out the DVDs were in PAL format, here’s how I figured this out, using the little known tool, tcprobe.
Solution
tcprobe is part of the package transcode, available in the rpmfusion repo. I was able to install it via yum on my Fedora 14 laptop like so:
1
2
3
4
5
6
7
8
9
10
| % sudo yum install transcode
...
...
====================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================
Installing:
transcode x86_64 1.1.5-5.fc14 rpmfusion-free 1.4 M
...
... |
With it installed, you can run the following command to pull some useful info off of a video DVD:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| % tcprobe -i /dev/dvd -T 1 -H 10
libdvdread: Using libdvdcss version 1.2.10 for DVD access
libdvdread: Using libdvdcss version 1.2.10 for DVD access
[dvd_reader.c] mpeg2 pal 4:3 U0 720x576 video
[dvd_reader.c] ac3 en drc 48kHz 6Ch
[dvd_reader.c] ac3 fr drc 48kHz 6Ch
[dvd_reader.c] ac3 nl drc 48kHz 6Ch
[dvd_reader.c] ac3 pl drc 48kHz 2Ch
[dvd_reader.c] ac3 hu drc 48kHz 2Ch
[dvd_reader.c] ac3 ar drc 48kHz 2Ch
[dvd_reader.c] DVD title 1/26: 21 chapter(s), 1 angle(s), title set 1
[dvd_reader.c] title playback time: 01:15:38.05 4539 sec
[tcprobe] DVD image/device
[tcprobe] summary for /dev/dvd, (*) = not default, 0 = not detected
import frame size: -g 720x576 [720x576]
aspect ratio: 4:3 (*)
frame rate: -f 25.000 [25.000] frc=3
audio track: -a 0 [0] -e 48000,16,2 [48000,16,2] -n 0x2000 [0x2000]
audio track: -a 1 [0] -e 48000,16,2 [48000,16,2] -n 0x2000 [0x2000]
audio track: -a 2 [0] -e 48000,16,2 [48000,16,2] -n 0x2000 [0x2000]
audio track: -a 3 [0] -e 48000,16,2 [48000,16,2] -n 0x2000 [0x2000]
audio track: -a 4 [0] -e 48000,16,2 [48000,16,2] -n 0x2000 [0x2000]
audio track: -a 5 [0] -e 48000,16,2 [48000,16,2] -n 0x2000 [0x2000]
V: 113475 frames, 4539 sec @ 25.000 fps
A: 69.26 MB @ 128 kbps
USER CDSIZE: 650 MB | V: -69.3 MB @ -15999.9 kbps
USER CDSIZE: 700 MB | V: -69.3 MB @ -15999.8 kbps
USER CDSIZE: 1300 MB | V: -69.3 MB @ -15999.7 kbps
USER CDSIZE: 1400 MB | V: -69.3 MB @ -15999.7 kbps |
NOTE: The key line in the tcprobe output being this: [dvd_reader.c] mpeg2 pal 4:3 U0 720×576 video. This line tells us that the DVD is in the PAL format and its size is 720×576. A standard DVD for the US market is in a format called NTSC. The difference being basically the size of the video & the frames per second, aka. frame rate.
- NTSC - 720×480 @ 29.97 fps
- PAL - 720×576 @ 25 fps
Further details can be found here
The Arguments
- -T 1 | Probe for DVD title #1
- -H 10 | Scan 10MB worth of VOB’s input data
References
links
local copies
NOTE: For further details regarding my one-liner blog posts, check out my one-liner style guide primer.
slmingol posted this in tips & tricks on December 25th, 2011, @ 4:51 pm
Background
I’ve started to focus on getting more proficient with Object Oriented programming, specifically using Perl. I’ve used the more traditional approaches of OO in Perl and find them way too wordy, compared to a more modern language such as Ruby. So when I came across Moose and MooseX and was intrigued. They seemed to really take a lot of the repetition out of coding OO in Perl. This post is just a starter post which includes some useful links to getting started with Moose & MooseX.
Solution
The 2 presentations by Dave Rolsky are great primers in getting started with OO, Moose & MooseX.
Intro to Moose – Dave Rolsky
Intro to Object Orientation – Dave Rolsky
Moose
MooseX
References
local copies
NOTE: For further details regarding my one-liner blog posts, check out my one-liner style guide primer.
slmingol posted this in tips & tricks on December 14th, 2011, @ 4:47 pm
Background
A co-worker of mine handed me some .dwg & .dxf files which I’d never seen before. Turns out they’re AutoCAD/AutoDesk files, but I had a hard time finding a decent viewer under Linux.
- .dwg – a binary file format used for storing two and three dimensional design data and metadata
- .dxf – Drawing Interchange Format, or Drawing Exchange Format
It seems that there was/is a big todo with the .dwg file format and AutoDesk appears to have put the kibosh on any open source and/or free libraries that implement the dwg file format standard. Check out this wikipedia article for more info.
Solution
I was still able to find several viewers that could open my .dxf files. The three that I ended up going with were QCAD, Teigha Viewer, and DXF viewer.
Of the three, Teigha Viewer was probably the most polished and displayed my .dxf file the best. But the others did display the file and were both easy to install. The only issue I had with Teigha Viewer was that it was only available as an RPM for OpenSUSE 11.2. I was trying to install on Fedora 14. Not a big deal though, I was still able to install the OpenSUSE RPM without any problems. Teigha Viewer ran just fine.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| # download and install steps for Teigha Viewer
% wget http://opendesign.com/files/guestdownloads/TeighaViewer/TeighaViewer-3.5.1.i386.rpm
% rpm -Uvh TeighaViewer-3.5.1.i386.rpm
# see where things got installed
% rpm -ql TeighaViewer | more
/etc/skel/Desktop/TeighaViewer.desktop
/usr/local/bin/TeighaViewer
/usr/local/bin/TeighaViewer_3.5.1/AcIdViewObj.tx
/usr/local/bin/TeighaViewer_3.5.1/ExFieldEvaluator.tx
/usr/local/bin/TeighaViewer_3.5.1/GripPoints.tx
/usr/local/bin/TeighaViewer_3.5.1/ModelerGeometry.tx
...
...
# running Teigha Viewer
% /usr/local/bin/TeighaViewer |
And here are couple screenshots of Teigha Viewer.

- Teigha Viewer #1

- Teigha Viewer #2
References
links
local copies
NOTE: For further details regarding my one-liner blog posts, check out my one-liner style guide primer.
Page 1 of 2612345...1020...»Last »
|