Great interview on hacker spaces, responsible disclosure (TCLP)
Thomas interviews Tiffany Rad in this episode of The Commandline Podcast. I appreciated this interview because, as a father, I am interested in all the ways I can expose my kids to learning opportunities, and while I might not end up with little net-running hellions, it sounds like public schools are often becoming less and less places where hands-on experience in engineering and science can occur.
I also appreciated how the discussion verged into responsible disclosure. As contractor in my past, one encounters clients that might be in violation of laws, or vulnerable to attack, but just broaching the topic with them might get you sued. This is an aspect of responsible disclosure that I’d be interested in hearing more about.
There is also good discussion about how the auto industry is using the DMCA as a legal claymore to keep people from modding their car computers. This is particularly frustrating to any mechanic. It makes me wonder if there are other examples of “trading down” technologies so that one can use less sophisticated vehicles, computers, appliances, just for the ability to treat them in a more fungible manner. Phones and cameras come to mind.
Makes me wonder if the Sustainable Connections people in Bellingham have heard of hacker spaces?
Quick thot on MySQL
Had a good question in my MySQL talk about how to monitor performance, and of course I suggested turning on the MySQL slow query log. What I neglected to mention, however, was mytop. This little utility is found in the rpmforge repo and it’s like a top(1) for your mysql queries.
The basis for it is the SHOW PROCESSLIST command, of course. Mytop collects, sorts and colors the output and adds the system summary of key-hits-ratio, query count, etc at the top.
Another Great Linuxfest Northwest
What an impressive LinuxFest. It felt really pro this year with big printed badges and registration. I would have been. Happy to have picked up my badge friday night if I knew what the crowd might have been Sat morning.
The robot room was definitely Liam’s favorite. Thank you BAIRS! I really dug the competition robot. Seeing BPD’d bomb squad robot was quite a privilege for us as well. That was very generous for BPD to spend a few hours at Fest. Would have been cool of JBLive.tv coulda got some footage.
I loved being able to poke into the Linux Action Room and it was a great opportunity to get to present on a live stream. Thanks, Chris, Bryan and Jeremy! Opening up the stream to some guest intro takes was a hoot!
The OpenStreetMap presentation was really neat and I would dig doing another bike ride map collection next year, now that I know how to better be prepared. I need to see how I can better use my BB to collect waypoints. It was fun taking a spin with Isaac, anyhow.
I’m grateful there were some people interested in bike rides for fest but I need to start that conversation earlier. But crazy ideas popped up:
- a display of how to charge mobile devices by bicycle
- ANT+ linux drivers that collect cycling telemetry
- getting penguin bicycle pennants printed to sell at the raffle booth
- any bike vendors or mfrs using open source?
I’d once againt like to heartily express my thanks, appreciation and gratitude to the LinuxFest Northwest organizers! It was a great fest and the best sunday of all the two day LFNW events yet!
Maybe JavaScript Iddna Me Bain
It was late and I was pretty caffinated up and had a laptop but no Internet. So I figured I’d practice trying to code a game of life from scratch, just using what scraps of code I could find on the hard drive as reference. Of course there is always some refresher I need to do. But, I was happy to figure out document.createElement() and appendChild() to build arrays of divs from nested for loops. Creating objects is always a little weird, but using curlies and a factory method I avoid the need to do things like say “new Cell()”, obviously I need to read up on that. And of course I had to figure out setTimeout() again, too. All worth it.
Computing in a Post Peak Oil World?
I’ve been paying some attention to the notions of community, local economy and self reliance in the face of rising gas prices. Oil shortages and actually, any resource shortage, can also affect how we use computers. High energy prices makes computing more precious. Lack of resources to construct platic, rare earths for constructing magnetic componentry, all of these things can make the cost of computers, and our use of them, spin on a dime. This episode of The Commandline podcast takes a sharp look at post peak resource computing. I think it’s a great episode, and Thomas really pulled together some topics I had not considered related.
Talk like a Pirate, Code like a Scurvey Dog! (Escape Pod)
This is a remarkably fun pirate hacker story that borders on magical reality. It really captures the pre-bubble esprit-de-haxor of the 90′s.
The psych behind seductive apps (UIESpoolcast)
Ever wonder why your kids really really … really gotta collect that one last Lego toy? Why do you hypermile? Why do you collect more and more twitter followers? Ah: set completion, feedback and scarcity are at play. http://www.uie.com/brainsparks/2010/05/19/spoolcast-stephen-andersons-designing-seductive-business-apps-live/
OpenPlans – Open Source City Planning
Here are some wonderful open source volunteerism-centered city planning web applications being demoed in NY. I really like the idea of letting citizens suggest places to focus city services, not just bike racks, bike paths, but things like schools and bus routes. This could really lower the bar from showing up to city hall with a petition…maybe someday you could twitter or FB-like a bike path into existence?
Database Joins, Reddit, NoSQL
There’s been a lot of online discussion about NoSQL this year. Thomas Gideon produced a podcast episode about using NoSQL vs joins. This morning I was pointed to this Highscalability post about Reddit. Quoting:
There are no joins in the database and you must manually enforce consistency. No joins means it’s really easy to distribute data to different machines. You don’t have to worry about foreign keys are doing joins or how to split the data up. Worked out really well. Worries of using a relational database are a thing of the past.
This generalized use of databases really illustrates the zeitgeist of rapid development. NoSQL projects are aiming right there: quick rev time, low schema impedence, built-in replication, no assumption of join usage because a document-oriented database model often presumes the more expensive computation of data subsets at the application level anyhow. In a pre-computed/batched-result environment, this supplants the need to sweat over high-performance joins.
Gideon believes that proper use of SQL databases are efficient and performant, but that novice uses and ORM devices (Hibernate, e.g.) are commonly over-applied so that performance at scale quickly dips. The comment on cmdln’s NoSQL rant by Mr characterizes the choice succinctly:
It does distribution of data out of the box, that is, it is so simplified, ingrained in the product that you don’t even think twice about them. But with SQL databases, sharding, distribution is an afterthought. Not that you cannot DO these with SQL databases, it’s just that with nosql these tasks are SIMPLER. Included in the product from day one.
I’ve certainly thought a fair amount on the topic of partitioning and sharding in light of the fact that MySQL 5.0 does not provide these (though 5.1 and later are better for it). But the whole notion of using a document-oriented database is very attractive when the majority of your operations are simply not relational.
2010-05-17 Web apps should be fast
Have I worked on any applications that have all 10 of these concepts? It’s an interesting read. It mostly speaks towards building software that has charisma. I don’t think I’ve ever really worked on a product that has charisma. I’ve certainly helped speed sites up, and helped make them more useful. Many products I’ve worked on had a pile of features, most never looked very simple, and a few had web APIs.
I say charisma not because online media should display contemporary styles, but point 10 is “playful.” Most software won’t play a joke on you, or say anything funny, or not present itself as anything but entirely serious. I write shell scripts that are playful. If they die, or fail an assertion, they say “YOU FOOL!” and quit…but I’ve never made a web application that much slap-and-tickle.
If I had the time, I’d point out some of the Microsoft online help I’ve seen that’s really funny. For a while at least, they hired some characters that really made rather lighthearted help documentation. That’s an interesting example of playful.
Translating Filenames — Bash Voodoo Style #linux
This is an example of using Bash to convert a crazy apache log and translating the filename into an IIS log pattern:
d=`date +%Y%m%d`
find k -type f \
| while read filename
do
nextfile="${filename/k\/done?0.www\./k2/www-Server_T${d}_}.log"
echo "$nextfile"
cat $filename | $translate > "$nextfile"
done
I love how I can refer to a shell variable ($d) inside a string translation (${d}).
Tail the Latest Log File
I’m grateful for Cygwin. I wouldn’t know how to do this in cmd–though I should probably learn how to do it in PoSH.
find LogFiles/W3SVC1 -type f | xargs ls -1tr | tail -n1 | xargs tail -F
I need to make it an alias now….
Longest MySQL Replication Run? #lfnw #mysql
I’ve heard of people replicating MySQL from coast to coast. I’d love to hear if anyone attending @lfnw has longer replication runs. Happy to share some examples at my talk on Sat. http://linuxfestnorthwest.org/sessions/mysql-performance-and-availability
Crazy mod_rewrite examples? #lfnw #opensource
I’d love to see some wacked mod_rewrite uses! Got one? I’ll put them on screen on Sun @lfnw http://linuxfestnorthwest.org/sessions/using-apache-modrewrite-ninja
LinuxFest Northwest 2010: Apache Rewrites
Apache Rewrites — for Ninjas!
This session is an overview of using Apache mod_rewrite, driven mostly by your interests and questions.
Your Questions, Your Interests?
The simple difference between rewrites and redirects.
You can specify an redirection in a few ways, and they don’t need to be RewriteRules. You can use an Alias directive to map to the file system or a Redirect directive to bounce hosts:
# mod_aliasAlias /newspaper /home/newspaperAliasMatch /(newspaper)/(*\.htm) /home/$1/today/$2 Redirect permanent ^/xml/ http://xml.news.com/ RedirectMatch permanent ^/xml/(.*)\.xml$ http://xml.news.com/$1.xml
Why to NOT use Aliases and Location directives?
Access control features might be the first thing to consider. If you want to configure the security of a directory, then you probably want to use Directory or Location directives.
Otherwise, consider maintainability, really.
The order of operations:
- <Directory>
- <DirectoryMatch>
- <Files>,<FilesMatch> << rewrites
- <Location>,<LocationMatch> << aliases
- <VirtualHost> << repeat the above order inside VH’s after global scope
See http://httpd.apache.org/docs/2.2/sections.html for this example of A,B,C,D and E in order:
<Location /> E </Location> <Files f.html> D </Files> <VirtualHost *> <Directory /a/b> B </Directory> </VirtualHost> <DirectoryMatch "^.*b$"> C </DirectoryMatch> <Directory /a/b> A </Directory>
Aliases and Location directives first and File directives second. This means that mixing and matching Location and File operations can introduce confusion or flaws because the a Location directive is out of sight of your rewrite rules, and you start hair-pulling because you can’t figure out why your intended rewrite is not even being reached. Debugging rewrites and Location directives is not so easy, there’s no step-wise debugging.
Usually, a rewrite is a transparent transformation of the URI into another path. You’re given a wonderful array of internal variable and re-entrant processing capabilities to use. For example, if you wanted to cache popular content that a cron job created, you could match it and look it up on the filesystem before going to your php script:
# Static Local Location
RewriteCond %{DOCUMENT_ROOT}/$1/$2 -f
RewriteRule ^/book/(.+)$ %{DOCUMENT_ROOT}/$1 [L]
# NFS Location
RewriteCond /home/books/$2 -f
RewriteRule ^/book/(.+)$ /mnt/webdata/ebooks/$2 [L]
# bounce this request to new.news.com if static version is not present
RewriteRule ^/ebook/(.+)$ http://new.news.com/prweb/ebook/$2? [L]
Skin That Cat Many Ways
Starting off with Alias and Location directives is fine. However there are a surprising number of places that Apache functions overlap. I presume this is done mostly because it’s difficult to switch between apache modules to accomplish these goals.
* example *
<Location /newsimage.gif> ForceType application/x-httpd-php </Location> RewriteRule ^/newsimage.gif$ - [T=application/x-httpd-php,L] ScriptAlias /newsimage.gif /website/newsimage.php
Apache Directive Processing is not a Programming Language
Apache processes data thru the directives in a rather obtuse fashion. environment variables and pattern matches are not globally visible. Pattern matches between the directives are effectively blocked across directives. Examples:
<LocationMatch /news/today-(.*)> RewriteRule ^(.*)$ - [L,F] </LocationMatch>
Since the regex matches found in RewriteRules share a different memory scope in the Apache process than the other core directives. You’re not given a programming language withing the apache.conf files. The only way to convey data between directives is by setting environmental variables using SetEnvIf or RewriteRule [E] directives.
RewriteRule ^/news/(today-.*)$ - [E=baddate:1] <Directory /oldnews/* > Order Allow,Deny Allow from All Deny from env=baddate </Directory>
Introducing RewriteCond
We can incorporate host name, query parameters and other parts of the request header, and environmental variables into the rewrite using RewriteCond directives.
RewriteCond HTTP_HOST ^(.*)\.news.org$ RewriteRule ^(.*)$ http://%1.news.com/$1? [R=301,L]
Chaining Rules
Rewrite conditions are important because they are the way you can pull in data from the header and query string, which is pretty common. However, if you have a series of rewrites that don’t require things like the query string, it is often easier to chain rules. Rule chaining is easier to read and are processed in order.
RewriteCond HTTP_HOST ^(.*)\.news\.co\.uk$ [OR]
RewriteCond HTTP_HOST ^(.*)\.news\.co\.ch$ [OR]
RewriteCond HTTP_HOST ^(.*)\.news\.co\.nz$
RewriteRule .* - [E=server:ww1.news.com]
RewriteCond %{ENV:server} != ""
RewriteRule ^(.*)$ http://%{ENV:server}.news.com/$1
Making Things Forbidden
There are a few ways to gaurd against bots and what, often by checking for suspicious user agents or referrers. These lists can get very long.
RewriteCond %{User-Agent} ! .*google.*
RewriteCond %{REQUEST_URI} ^/sitemap
RewriteRule .* - [F,L]
Homebrew Cached Output
Consider a batch process that pre-generates static html for frequently hit content that’s originally generated by a PHP script.
RewriteCond %{QUERY_PATH} ^/today/(business|world|entertainment)/(.*)$
RewriteRule .* - [T=application/x-httpd-php]
RewriteRule .* %{DOCUMENT_ROOT}/%1.php?q={%2} [L]
Otherwise you could use LocationMatch and ForceType to execute the php script. You would be using fall-through from Files directives to LocationMatch directives to do this.
Proxying Internal and External Content
We’ve seen how easy it is to redirect. We can also proxy those redirections (and rewrites) using the [P] directive.
Little Performance Tip
Turning Etags off to mask backend servers can make the results last in cache longer.
Check AskApache.com for other speedup tips.
Don’t Forget to Back Up!
Who am I?
Jed Reynolds has been an IT pro since 1996. He recently completed his first year of car-free commuting — traveling 2500 miles on his bicycle. He also loves his Pentax K10D.
LinuxFest Northwest 2010: MySQL Buffet
MySQL Buffet
This session covers topics in MySQL high availability and performance, centered mostly on your interests and questions.
Your Questions? Your Interests?

Jed Reynolds is not employed by MySQL but has been using it in a HA capacity since 2004
MySQL is a large topic and we can do a thumbnail overview followed by specific topics you’re interested in. I’ve listed the topics below in what I believe are the most important first –if you haven’t mastered backups, you have no business doing InnoDB tuning.
Backups and Recovery
- mysql dump,
- replication! do dumps from a pooled out replica
- LVM snapshots
- snapshot load issues
- snapshot recovery: flush w/ read lock, InnoDB recovery
- InnoDB Hot Backup
- Maatkit replication checking correction, use cautiously
High Availability
- replication: snapshot v. restore, LVM, InnoDB
- load balancing: internal to application or external to application?
- health criteria for pool-in/out
- (replication lag, response time, disk free, system load, thread count)
- ???? Multi-Master v. NDB?
- Single master, multi mater, and fail over
High Performance
- High Availability before high performance
- mysqlperformanceblog
- monitoring: slow queries, system load, swap, disk io, concurrent connections, replication lag
- identifying “table pressure” and “update pressure” (large joins, inadequate indexes, bad queries)
- indexes, multi-column indexes
- EXPLAIN *show example, geoip data?*
- query caching and when to not use it (large, infrequent results, frequently updated tables)
- query caching, memcached, application level, or mysql write-thru
- table engines suit different purposes
More Detailed Tunings can be found on the mysql performance blog. And softwareprojects.com.
Table Engines Notes
- MyISAM, Memory, Merge, InnoDB, BDB (tx, fk)
- Archive (fast inserts, compression, lacks indexes)
- CSV text files
- Black Hole
- Federated, NDB
- :-( Falcon – transactional, orphaned?
- ALTER TABLE t ENGINE=foo
- - 3rd party -
- NitroEDB – security log management
- BrightHouse – infobright, warehousing
- DB2 (IBM)
- Kickfire: column based db appliance with compression, FPGA processor, CentOS
MariaDB
This is the myontyprogram fork of mysql, and it includes other engines (PBXT) by default, thread pools and XtraDB instead of InnoDB (same format).
Other Tricky Features
- triggers
- views
- materialized views
- memcached
Full Text Search
- RDBMS != Full Text Search
- Sphinx
- Lucene, Solar
Security
- grants
- ssl
- think layers: start outside your application and work your way thru it into your backup storage policies.
Don’t Forget to Backup!
Who Am I?
Jed Reynolds has been an IT pro since 1996. He recently completed his first year of car-free commuting–traveling about 2500 miles on his mountain bike, rain or shine. He also loves his Pentax K10D.
50% Female Tech Employees?
Enrolling women in technology has been an ongoing topic for quite a while. Various communities like Ubuntu Women and many other groups have are focused on women in technology.
Scott Hanselman conducts a surprising interview with some women programmers in Egypt, showing an impressively equitable gender mix. Very inspiring!
Love Visual Studio, Crashes!
Moving the Call Stack window while debugging was crashing VS2009. Luckily, there was a KB article about it.
5 Monitors…Want!
This five monitor setup is SWEET!
Checking the Ends of Files
Bash command displays the end of files written recently:
find -type f -mtime -1 | xargs ls -tra | tail | xargs tail
What Every C# Dev Needs to Know About Dates
There’s a big difference in what a M, MM, MMM, and MMMM mean in a date format.
Also, you can say:
String.Format( "{0:yyyy-MM-dd hh:mm:ss}", DateTime.Now )
to convert a .Net date into a MySQL format date, without needing to pass a format string to the
DateTime.ToString()
method.
Search Highlighting in VS 2008
I found a way to highlight search results in Visual Studio 2008, using the RockScroll add-in. I still miss the Highlighter plugin in jEdit, tho.
