By the way, let’s say you have to print, sign, scan, and email back a document using the flatbed scanner attached to your Linux workstation. No trouble scanning in each page as an individual PDF document using XSane, but assembling the multipage project into one document proved a modest challenge last time I tried.
Solution? Install pdftk, and then the command goes something like:
pdftk AVID000*.pdf cat output AVID.pdf
That’s will merge all the documents named AVID0001.pdf, AVID0002.pdf, etc into AVID.pdf. Or to put it another way:
pdftk <a bunch of PDF files> cat output <target PDF file>
I like Ubuntu. Or at least I liked it a few years back when you got a very nice functional desktop out of the box … but that is a different gripe.
I really like an OS that updates the software for me. Really, downloading and installing updates is for chumps! Way to go, Ubuntu!
But here’s a feature that has been bugging me for years: the system pops up a window saying “hey, I’m going to update the system software for you.”
And I’m like “sure, go ahead, be my guest!”
Then it’s like “okay, please give me the administrator password.”
And I’m like “well, okay . . . but . . .”
Each time the computer pops up a window unbidden offering to do me a favor in exchange for my password, I am wondering when some bastard will get around to writing a bit of malware that offers to do something nice for me in exchange for my password. Maybe a web site can launch a convincing-looking software-update window and prompt me for a password. It is going to be epic just how many users can be convinced to type their system passwords into a malware site.
If you are a part of the system that has access to do heavy lifting, please do not approach the user asking for a password. It teaches the user that “hey, its normal for your computer to pop up some window and ask for a password and when that happens you should totally humor the computer and give it your password.” You want to update my software? Great! You want to check with the person using the computer to make sure its a good time? Great, ask away, tell them your plans. But when they say yes, just fricking do it, and don’t ask them for their password.
I have had bad luck trying to coax this out of Google, so here’s a Perl one-liner:
perl -pi -e 's/[\x80-\xEF]//g' file.txt
Where file.txt is a file you want to clean up.
Why this comes up is because we have a web application that was set up to hit a MySQL database, which is incorrectly configured to store text as ASCII instead of UTF-8. The application assumes that all text is Unicode and that the database is correctly configured, and every week or two someone asks me why they are getting this weird gnarly error. Typically they are pasting in some weird UTF-8 whitespace character sent to us from Ukraine.
Eventually the database will be reloaded as UTF-8 and the problem will be solved. Until then, I can tell folks to use the Perl command above. It just looks for anything with the high bit set and strips it out.
I am not a DBA. I am but a humble SysAdmin who gets asked to figure out things like “how have we been at meeting our SLAs over time?” After I try to excuse myself I’ll inevitably end up say at the JIRA database running a query like this:
echo
echo "Incidents (P3)"
mysql -u jira jiradb< <__id3q
select year(created) as "Year", quarter(created) as "Quarter",
count(pkey) as "Total",
sum(resolutiondate < date_add(created, interval x day)) as "Met SLA",
sum(resolutiondate < date_add(created, interval x day)) / count(pkey) as "SLA %%"
from jiraissue where pkey like 'OPS-%' and priority = 3
and assignee != 'nagios' and issuetype = 26
group by year(created), quarter(created) order by created;
__id3q
That above is a fragment from a shell script. Shell scripts are great for complex SQL queries, I find. Set a value x at interval x day and the output looks something like:
The query does some things that are newer to my limited understanding of SQL. For me the magic bits are sum()ed columns and the availability of quarter() … you can do monthly reports just as easily with month(). I’d love to concatenate Year-Month into a string like “2012-05″ but for the purposes of making my boss a little happier queries like this are good to have in the locker.
Some day I’ll be hip enough to convert things like this into JIRA widgets.
Oh yeah, and if your SLAs are measured in “business hours” or “business days” this will give you only a crude understanding of how well you have met your SLAs … an accurate measure would probably get embedded in a handler that gets called on issue close which can evaluate SLA fulfillment per issue priority and the local work schedule.
Last week I dug through several menus to try and unsubscribe from all the spam LinkedIn sends me. Today I got another email and at the bottom was an “unsubscribe” link that I clicked on. Here’s what I got:
Not only is this not an unsubscribe feature, LinkedIn gets bonus points for trying to sign you up for MORE e-mail.
Instead of screwing around with the half-dozen sub-menus again, I dropped them a feedback saying that this burns up good will, damages the brand, discourages me from engaging, and may in time lead me to delete my profile. There’s more than one way to search for resumes online.
Yesterday I got Dr Sick Wife to drop me off at the Santa Clara Convention Center so Mr Sicker Light-Headed Husband wouldn’t miss any PYCON. After an awkward twenty minutes of asking people there for the lighting and LED conference where the Python was, I checked my smart phone and noted that … PYCON is *MARCH* 7th.
So I took the light rail home and told $BOSS I was on PTO (well, I call it MLK day due to Puppet Training) I then slept a lot, and did other things sick people do that don’t bear repeating in a professional context, and watched Dr Who save the Earth on TV, slept some more, and I am feeling way better today, which means I feel regular sick, not super sick.
So, I’ll be WFH today. Trust me, whatever this is, you’re lucky to miss out! I don’t normally get sick so this is a novel experience … I’ll likely be seen in the office next week, though if I’m coughy or sneezy I’ll keep that train wreck at home, because, as you might gather, you don’t want a piece of this!
If you’re attending PyCon, I look forward to seeing you there … next month! Hopefully I won’t be light-headed!
Terminal windows resize themselves stupidly when changing font size. I don’t know how to fix that, but in the CompizConfig Settings Manager, I can enable Resize Info to overlay the dimensions of any window as I resize it.
Often, when dragging a window around, it tries to go full-screen on me. This is obnoxious! Just disable Grid in CCSM.
If anyone knows how to reconcile Focus Follows Mouse with “menu bar at the top of the screen” I would love to hear it! Or if you know how to configure the pager to something besides 2×2 …
Time tracking in JIRA is a nice feature, but we have to get people to do it. My initial attempts to enforce time tracking ran into trouble, but I was able to develop a Jython Validator to hook on to transitions to the Resolved state. Now it is mandatory for our users to log time worked before they can resolve an issue:
# -*- coding: UTF-8 -*-import com.atlassian.jira.issue.worklog.Worklogfrom com.atlassian.jiraimport ComponentManager
# Time Already Logged
timespent = issue.getTimeSpent()# Time Logged via current screentry:
timelogged =dict(issue.getModifiedFields())['worklog']except:
timelogged =False# Duplicate Issue? It is as good as logged!
resolution = issue.getResolution()if resolution['name']=="Duplicate":
timelogged =Trueif resolution['name']=="Self Corrected":
timelogged =True# Nagios likes to close tickets, but doesn't get paiduser= ComponentManager.getInstance().getJiraAuthenticationContext().getUser()ifuser.getName()=="nagios":
timelogged =Trueif timespent <=0and timelogged ==False:
result =False
description ="Please log the time you spent on this ticket."
2012-01-24 Update: the script now contains additional logic, which exempts the nagios user from enforcement and allows resolution of duplicated or self-correcting issues which may not require time tracking. Hopefully this example is useful to somebody.
I was poking around my CloudFlare Control Panel, and pulled up stats for the past month, from Oct 11 to Nov 11. It says it had blocked a bunch of attacks on my site, and consequently saved me over 5GB in bandwidth.
I said to myself, "I pay for bandwidth! Maybe this free service is saving me money?!"
“Really,” I said, “I pay for bandwidth, so if CloudFlare is saving me bandwidth, it is saving me money!”
But 5GB seemed kind of high. So, I checked my invoices from RackSpace. Here is the outbound bandwidth I have been charged for this year:
RackSpace charges me on the 11th of the month, and, conveniently enough, I started using CloudFlare around October 11th. The highlighted line above is my first month on CloudFlare. It is my lowest number of the year, and it is conceivable that I could have totaled 9.5 GB in October since I pushed more than that in February. I’m skeptical that they are saving me as much as they claim to be, but for a free service to speed up my web site and save me even a little money . . . that is a good deal in my book!
Note to modern web designers: since the displays are becoming wide and short, please do not squander vertical screen space. Here’s a good example of what not to do:
Viewed full size, you see a window that is 705 pixels tall. The OS claims 24 pixels, the web browser claims 90 pixels, and the web application claims 250 pixels. So, by the time you hit the actual content, 50% of the window has been wasted!
Squinting into a tiny pane to read news makes me angry. Google, you can do way way better than this!
Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
Most good programmers should be able to write out on paper a program which does this in under a couple of minutes. Want to know something scary? The majority of comp sci graduates can’t. I’ve also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.
Huh? I remember when a CTO explained that a SysAdmin should have at least mediocre programming skills. So, I have always aspired to have at least mediocre programming skills. (More important, SysAdmins are extremely well-served when they can write programs to make their work easier!)
I haven’t written C code in a long while, but I fired up vim and had this compiled and running in a few minutes:
#include <stdio .h>void main(){int i, fb;for( i =1; i <=100; i++){
fb =0;if( i %3==0){printf("Fizz"); fb++;}if( i %5==0){printf("Buzz"); fb++;}if( fb ==0){printf("%d", i);}printf("\n");}}
I recall at least one interview with Google and probably other companies where I have done something like this on a white board, with the interviewer challenging me with compiler-like errors to help me repair syntax errors.
Patrick’s point is that when you work with excellent people, you see your skills in that context, and will tend to be unduly modest. But when you step back a bit and look at your skills in the context of the industry as a whole, you may well be among the best on the market.
Here in the Silicon Valley, there are plenty of tech jobs, but there is also plenty of competition, which means that the folks you come to associate with will tend to be toward the top of their field.
Patrick’s further point would be that you need to take your skills, and develop the capacity to convey the value that those skills can bring to an organization.
Leonard Kleinrock tells the story of the Internet’s birth. First word was LO:
And then, he shows us the world’s first router, which they were going to throw out:
My first experience of the Internet was a 1200 baud dialup connection to a USENET host that connected upstream twice a day at 2400 baud. That would have been around 1992 or 1993. (I was a broke highschool kid who couldn’t afford the $30/mo+ for a proper Internet connection.) My first email address was dannyman@netwrk21.chi.il.us, and I lost that address when my network uplink failed to pay his phone bill. Oh well!
When I started college in January, 1995, and had access to labs and labs and labs of computers directly connected via Ethernet, with Mosaic and Netscape installed, it was like I had found my Nerd Nirvana! It only got better when I took a C programming course on the Sun workstations in the basement of the DCL . . .
A friend posted a link about some iPad App that will show you recipes. My reaction was one of being condescendingly underwhelmed, and here’s the gist of what I’d really like to see in a “cookbook app”:
“Will it plan a week’s menus based on seasonal ingredients and give you a shopping list? Because that’s the fucking time-consuming part the computers need to fix.
Any clown can convert a menu book to an App . . . and any clown can find a recipe, drive to the store, spend 45 minutes trying to find some ingredient they don’t know about which is out of season, pay a bunch of money, get home, if they still have the energy maybe cook something sorta edible . . .
. . . but this being the 21st century, an electronic cookbook ought to be able to suggest recipes for you based on the ingredients you have ready access to. (In your pantry, in your growing region, partner with a supermarket…) I have found a website that does a mediocre job of this. This thing is begging to be invented.
Anyway, what I’m saying is–cookbooks in an app–that’s like lets transcribe 15th century technology into silicon. I say hell no, with all this information technology let’s leverage the information to really make it easy for the people to cook healthy, inexpensive meals at home. THAT is the revolution that will make us all better off.”
JIRA is an issue tracking system that is really flexible, but sometimes presents irritatingly arbitrary limitations.
I have been working on a screen which uses multiple tabs. The tabs are there to make it easier for the user to find the fields they want to edit, without scrolling through a single long, complex issue. But every tab has a Comment field rendered on it, which makes things confusing, and makes each tab look like it needs scrolling.
So, just remove the Comment field from the Screen, right? No, it isn’t in there. So, can I remove Comment via the Field Configuration Scheme? No, it is mandatory. Damn your arbitrary limitation, JIRA!
Anyway, I don’t normally speak JavaScript, but I managed to gin up the following snippet to paste into a Field description which appears in the screen I wanted to tweak. It finds the element containing the Comment, and sets its style display attribute to none. As the page loads, the Comment box is rendered, but once the page load completes, the Comment box disappears.