If you ever need an example of a Unix/Linux shell script where you need to determine whether today is a weekend day, I can confirm that this code works:
As a “note to self,” I wrote two more Textmate commands yesterday, one to capitalize each word in a selection of words, and another to convert a CSV list of words to a simple list. Here’s the source code for the Capitalize command:
#!/bin/sh perl -ne 'print ucfirst $_'
$_ portion of that Perl command isn’t required, but I include it as a reminder to myself about how Textmate commands and snippets work.
Here’s the source code for my Textmate command that uses the Unix
tr command to convert a CSV list of words (such as a paragraph of comma-separated words) into a simple list of words:
#!/bin/sh tr , "\n"
As you can see, those commands are fairly simple. If you know Unix/Linux and then know a little about how to write Textmate commands, you can usually get it to do what you want. I like that you can use any Mac/Unix programming language or tool to solve the problem at hand.
This brief Sencha tutorial shows how to convert the text in a Sencha ExtJS textfield to uppercase on the textfield blur event. I use this technique on the
symbol field in a form where I let users enter stock symbols, such as “AAPL”, “GOOG”, etc.
symbol field in my StockForm.js view component is defined like this:
Scala parallel map example: Using a parallel map to transform a collection of String to all-uppercase
Using a parallel map to transform a collection of String to all-uppercase
Case insensitive SQL
SELECT query FAQ: How do I issue SQL
SELECT queries while ignoring case (ignoring whether a string is uppercase or lowercase)?
Perl lowercase/uppercase string FAQ: How do I convert a string to uppercase or lowercase in Perl?
Solution: To convert a string to all uppercase characters use the Perl
uc function, and to convert them to lowercase use the
Here are a couple of examples to help demonstrate this Perl uppercase/lowercase string conversion.
Perl uppercase string conversion
Here's a Perl uppercase example, converting a Perl string from whatever it was to all uppercase characters:
After watching a young relative type on an iPhone recently, I realized he didn't know how to use the "iPhone caps lock" feature. I assumed a person younger than me would know how to use the iPhone caps lock feature, lol, but it's not too surprising, because enabling the caps lock feature isn't the most obvious thing in the world.
iPhone caps lock
To use the iPhone caps lock feature, whenever you're typing something -- like composing an email -- just tap the iPhone Shift button twice. You need to do this quickly, similar to a double-click.
Java String FAQ: How can I tell if a Java String contains a given regular expression (regex) pattern?
In a Java program, you want to determine whether a String contains a case-insensitive regular expression (regex). You don't want to manipulate the String or extract the match, you just want to determine whether the pattern exists at least one time in the given String.
Earlier today someone asked for the source code for my TypeAhead predictive-text, type-ahead, auto-complete JNLP Swing application. While trying to remember where I put it I realized I was going to have to do some case-insensitive file searching.
I was happy to learn that both of my favorite Unix and Linux file-finding utilities support case-insensitive file searching.
Here's a Unix shell script that converts all "*.png" files in the current directory to lower-case names. In my case I had files named "Slide1.png", etc., and I wanted them to be named "slide1.png", and this script did the trick.