Saturday, March 22, 2014

Removing ACLs in Ubuntu

I'll admit it, I haven't figured out access control lists, nor do I need to. Or want to. Maybe someday that will change, but for the time being I'm quite happy living without them. That being said, I did run into a problem with one of my Zentyal servers where the ACLs became a problem and I needed to remove them.

In an effort to not embarrass myself any more than is absolutely necessary, I won't disclose how long it too me to figure out a) what the problem was and (more importantly) b) how to fix it.

The short fix, which I'm writing her so I'll (hopefully) remember is:

Removing ACLs

The setfacl -x  command can be used to remove ACL permissions by ACL rule type. The  for this command use the same syntax as the setfacl -m  command except that the  field is omitted because all rules for the rule type are removed.
It is also possible to remove all ACLs for a file or directory with:
setfacl --remove-all
To remove all default ACLs for a directory:
setfacl --remove-default

Thursday, February 28, 2013

iOS - Pear Note

Pear Note
by Useful Fruit Software

Looks interesting - I might need to check this out when I get more time.

A note-taking app for iOS devices, lets you take rich-text notes. Even better, it records the audio of the presentation you’re documenting and synchronizes your notes with the audio. As you play back the audio, the app highlights the text that you were typing at each point in the recording; conversely, you can tap anywhere in your notes to jump to that spot in the audio.

Monday, February 04, 2013

Creating Downloadable CSV Files Using PHP

CSV (comma-separated values) is the most widely supported format for transferring tabular data between applications. The ability to export data in CSV format is a useful feature for many programs, and is becoming increasingly common in web applications. This page explains how to use PHP to create CSV files, and how to ensure that your visitor’s browser offers to download the file instead of displaying it.

The code

The following code assumes that the data to be exported are stored in a MySQL database, but it can easily be modified to work with other data sources, and hence serves as a general template:
// output headers so that the file is downloaded rather than displayed
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=data.csv');

// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');

// output the column headings
fputcsv($output, array('Column 1', 'Column 2', 'Column 3'));

// fetch the data
mysql_connect('localhost', 'username', 'password');
$rows = mysql_query('SELECT field1,field2,field3 FROM table');

// loop over the rows, outputting them
while ($row = mysql_fetch_assoc($rows)) fputcsv($output, $row);
The string ‘data.csv’ on line 3 is the name the browser will suggest for the downloaded file. The array literal on line 9 contains the column headings; this line should be omitted altogether if you do not wish to include column headings. The strings on lines 12 to 14 should be changed to the appropriate connection parameters and query string for your database. In a real application the database connection parameters should be defined as constants in a separate configuration file.

How it works

The code needs to tell the browser that it is producing a CSV file and that the file should be offered for download, rather than displayed in the browser. Line 2 produces an HTTP header telling the browser that the MIME type of the content is text/csv, the official MIME type for CSV files.
Line 3 produces a ‘Content-Disposition’ header. The Content-Disposition header was defined in RFC 2183 and was intended to be used in e-mails, but was also adopted by web browsers. In web browsers the value ‘attachment’ instructs the browser to offer the file for download with the suggested name — the file might otherwise be displayed in the browser window as if it were normal text.
PHP 5.1 introduced the fputcsv function, which outputs an array of data to a file pointer as comma-separated values. Because fputcsv can only write to file pointers, line 6 opens the output stream as if it were a file. Line 9 then outputs column headers, while line 17 loops over the rows of data and outputs them.

Tuesday, May 24, 2011

SQL - Quick List of Tables

Another SQL reminder - for a quick list of tables...

select * from information_schema.tables where table_type='base table'

SQL - Display All Tables & Columns

Just as a reminder for those databases that you inherit that lack any sort of documentation....

SELECT SO.NAME AS table_name, SC.NAME AS column_name

Monday, May 23, 2011

Decompiling a CHM (Compiled HTML) File

HTMLHelp command-line

HH.EXE is distributed with HTML Help so you can rely on it being present. It lives in the Windows folder and has a limited number of command-line options. HH.EXE is associated with .CHM files. So double-click a *.CHM file and Windows will open the file using HH.EXE. Its a very small file, it mostly passes the help filename onto a HH API library. HH.EXE is not single instance, if you open a CHM file three times using HH.EXE, then three help windows will appear.

Example of using HH.EXE to decompile a CHM help file

Command line from a DOS window:
C:\HH.EXE -decompile D:/xTemp/decompile-folder C:/xTemp/XMLconvert.chm
Call from batch command file:
HH.EXE -decompile D:/xTemp/decompile-folder C:/xTemp/XMLconvert.chm
HH.EXE -decompile decompile-folder file.chm where "decompile-folder" is the directory to put the files into. This could be simply "."

Decompiling the file produces a slew of HTML and image files, together with the table of contents (.hhc) file, index (.hhk) file, and a few other supporting files.

One thing to note is that the decompile/recompile process isn't a "round-trip" process. Certain features that the help author added to the original help file can't be recovered when you decompile it, so these may no longer work properly after you've recompiled. This is especially true in the area of context-sensitive help, which may be broken in the new version of the file.

Thursday, August 26, 2010

Dell Drivers Drive Traffic?

Y'know what's really weird? I've been using Google Analytics to track the traffic to all of my sites for a few years now. What I really find weird is that the vast majority of traffic that hits my tech-centric ramblings are searches for Windows XP drivers. Still. I mean really, I made one post in January 2008 about how I struggled to find drivers for an Inspiron 531 and that is why people come visit my site?

Okay, for all of you individuals who are desperately seeking drivers, since I have no interest in posting (or hosting) the 150 meg file that I'm sure I still have somewhere on one of my network servers, I'm going to walk you through my process of how I found them. Trust me, there isn't always an easy way, sometimes, you just have to get down-n-dirty with the rest of us and muddle your way through.

Here are my steps to help you find whatever driver you might need to for whatever system you own. I don't care if it's Dell, HP or Apple; they all work roughly the same way.

  1. Go to Google, and type in "drivers" and then your computer's model number. You'll wind up with 156 gagillion hits, the majority of which are worthless sites that will probably do you more harm than good. Don't visit any of them. Let me repeat that part, DON'T VISIT ANY OF THEM. Just don't do it, you'll waste countless hours and become more frustrated than you were at the start. Plus, just for an added bonus, if you do visit some strange site, download something you think will be your salvation, it's probably going to be infested with malware, viruses or a slew of other things you don't want anywhere near your computer. Trust me.
  2. Instead, visit your computer manufacturer's website. Since all of my computers come from Dell, I'd start at I trust Dell. I know who they are, and unless they've been hacked (rare, very rare), I'm probably not going to infest my computer by downloading something from their website.

    Now I know they're support site isn't the best organized site in the world. I know it isn't always easy to find what you want. But this is the single best source for information, drivers and downloads for your Dell computer. They made it, they know what's in it and the resources they have are specific to it. C'mon, give 'em a chance. 
  3. Look for a link that says "Support" and click it. Find the support page for your model number and then look for links that say something like "Drivers" if you're looking for drivers. Or "Manual" if you're looking for the manual that you probably threw out with the box that it came in.

    If you really can't find what you're looking for, then feel free to use Google to search their site instead of whatever search tool they provided for you. The trick is that if you decide to use Google, limit your search to just results that are on Dell's website. How do you do this? Simply add the phrase "" to you Google search. It works. It really works. You'll still want to add your model number and the name of the part that you think needs a driver or what-not, but you're going to save yourself a butt-load of time.
  4. Many of the parts Dell (or whoever) used to make your computer are specially made to meet the manufacturers specifications. Much like the radio in your car may have been made by any one of a number of different manufacturers, but was made to the specifications of Ford, GM or whoever. It may look the same and fit in the same slot, but the innards may be slightly different, but I digress.

    In some cases, it is possible to go the manufacture's web site and down drivers for the individual parts that make up your computer. And no, Dell doesn't manufacture least the don't the last time I checked. The motherboard may be from Intel, Foxconn or a slew of other manufactures. Really the only way you can be sure is to take your computer apart and note part identification numbers on each different component and then do a Google (or Bing, if you must) search to figure out who made it. Then by visiting the individual part manufacturers site, you may be able to find and download the drivers you so desperately need. 
Listen, I'm pretty sure I said this wasn't going to be easy. But it is the way and will ensure that you find the most current versions of your drivers for your particular part in your computer. Once you know who manufactures each and every part in your computer, then you're going to have a much better chance at locating the drivers that will make that specific part work with whatever operating system you happen to be using.

And let me just say, as an aside, if you haven't moved up to Windows 7 yet, what are your waiting for? If you're still looking for XP drivers to keep your old computer running, it really is time to upgrade. My upgrade cycle for desktops is typically 4-6 years - and that usually involves add new components around the 2-3 year mark to keep the system running at what I consider to be an acceptable level. Laptops, I typically replace within 2-3 years. It isn't as easy to upgrade components other than hard drives and memory...and of course a battery which seem to need replacing every 18 months or so.

I'm not saying you should run out to Best Buy and splurge on whatever $1k+ computer they happen to have on sale...but at the very least, go out and look at Dell's Outlet where they sell refurbished and scratch-and-dent PCs. Almost every computer I have is refurbished and I have nothing but praise for them. Sure some have had problems, but Dell's warranty service is always fast and reliable (especially if you add on in-home support when you buy). Plus, if you watch for coupon codes on Dell Outlet's Twitter account you could wind up buying a $1k+ laptop for about half that amount. Even the cheapest laptop or desktop on the site will be a step up...and with prices starting around a few hundred, it's hard to find a better deal. (That's enough of the sales talk, and, for the record, Dell didn't pay me anything for this endorsement!)

If you're wondering if Windows 7 will run on your old Pentium 4, I can't say for sure, but it probably will. And if you do a clean installation when you install it, it will probably run better than your computer ever did. I tested this theory on my father-in-laws seven year old laptop...knowing that if it failed, I'd really look like moron and loose all my geek points with the in-laws. But it worked...and that poor think only had 256 Mb of RAM. How Toshiba even sold it what that little memory, I'll never know, but that's another topic for another post on another day.

Oh, and by the way, that Inspiron 531 that I wanted the drivers for? Well, it's now running Ubuntu Linux full-time and serves as my home theater PC running Boxee. With a new video card, hard drives and memory...after all, it's been more than two years since it appeared on my doorstep!

Monday, July 26, 2010

Browser Share

Anyone actually interested in browser market share reports? I can only assume that I'm weird, 'cause I am, well, sorta. I've long since adopted Google Chrome as my primary browser - and push everyone I know to do the same. Firefox is a great second, but 90% of the people I know don't know enough about technology to benefit from the extensions that really make Firefox useful. For the vast majority of my browsing experience, Chrome is by far my preferred choice.


Primarily speed. Chrome is fast on every computer I own. Plus, I love the fact that my bookmarks are synced across all of my computers without me having to do a darn thing. I'm sure I could figure out an extension in Firefox to do the same, but why bother when its built into Chrome? Don't read me wrong, I love Firefox, and for browsing questionable sites, there's no other browser I'd recommend - provided you're using NoScript. But for my daily browsing of the interweb haunts I frequent, Chrome works great, keeps me organized and doesn't require any effort on my part.

Oh, did I forget one?

Well, maybe two. Safari and Internet Explorer are both capable browsers, but just not for me. IE always feels like I'm slogging through a bayou - especially when I'm just coming down off a Chrome tear. In all honesty, I don't use Safari much - Apple's ridiculous update download sizes have peeved me off - and I don't see any payoff for spending that much time messing with it.
Oh, browser market share - that's how I got started on this whole mini-tirade. (I'm easily distracted by shiny objects....) Here's some interesting stats if you want to see who's gaining, who's losing and why you bet on the underdog: