How to set the default input focus on a field in an HTML web form
When I create a web-based user interface I tend to be a fanatic about making sure that the first input field on a form gets input focus when the form is first displayed. It always drives me crazy when...
View ArticleMySQL Shell scripts - Start a MySQL server and client on a non-standard port
MySQL shell scripts and port FAQ: Can you share some MySQL examples that show how to start MySQL on a non-standard port (non default port)?For a variety of reasons you may want or need to run your...
View ArticleMySQL: Default a field to the current date/time
MySQL date/time FAQ: How do I create a field in a MySQL database table that will default to the current date and time whenever a new record is inserted into my table?Answer: Just define the field in...
View ArticleAn apology, and a good laugh
I just wanted to offer a quick apology to everyone that has sent me emails lately. Yes, I have received your messages, and I will get to them as soon as possible. I'm just a bit swamped right now, so...
View ArticleDrupal default settings, security, and spam
Drupal default settings, security, and spam: I've created several new websites with Drupal lately (One Man's Alaska, Tequila/Monk, and Legend of the Squirrel), and while I really like a lot of things...
View ArticleDrupal form textfield default value syntax
Drupal form textfield FAQ: How do I set the default value for a textfield in a Drupal form?Just use the Drupal form "#default_value" tag, like this: $form['first_name'] = array( '#title' => t('First...
View ArticleThe Drupal fieldset initially collapsed syntax
Drupal fieldset FAQ: How do I make a Drupal fieldset initially collapsed?To make a Drupal fieldset collapsed initially, make the fieldset collapsible, then set the "collapsed" property TRUE, like...
View ArticleThe Drupal fieldset collapsible syntax
Drupal fieldset FAQ: What is the syntax to make a Drupal fieldset (form fieldset) collapsible?To make a Drupal form fieldset collapsible, just add the "#collapsible" attribute to your Drupal form...
View ArticleSQLite - default a datetime field to the current time (now)
SQLite FAQ: How do I default a SQLite datetime field to the current date and time? (i.e., how do I default it to now?)Just use the SQLite current_timestamp function, like this: last_updated datetime...
View ArticleMySQL - Default a date (timestamp) field to now
MySQL DATE syntax FAQ: How do I set a MySQL DATE field to default to "now", i.e., the current time?Setting the date to "now"Unfortunately you can't default a MySQL DATE field to "now", but you can get...
View ArticleConfiguring an Nginx default website
I’m configuring Nginx as my primary web server, with other Apache servers behind it, and I wanted to configure Nginx to serve up a blank page whenever someone tried to hit my server’s IP address,...
View ArticleHow to get the default system font in a Java/Swing application
I haven’t tested this with other Java components, but if you want/need to get the “system font”, this code gets the default system font from a JEditorPane component:val outputArea = new JEditorPane val...
View ArticleHow to define a default value for a method parameter that is a function
I was just reminded that functions are values just like Int, String, etc. Beyond the “typical” use cases, this is also true when it comes to supplying a default value for a function parameter that...
View ArticleHow to restore an Android emulator to its initial "factory" settings (wipe...
To restore an Android emulator to its initial, default settings, you need to find its “image” file on your filesystem and delete it. The image file will be found in your...
View ArticleScala - Understanding mutable variables with immutable collections
This is an excerpt from the Scala Cookbook (partially re-worded for the internet). This is Recipe 10.6, “Understanding Mutable Variables with Immutable Collections.”ProblemYou may have seen that mixing...
View ArticleHow to access the value of the default case in a Scala match expression
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is one of the shorter recipes, Recipe 3.10, “How to access the value of the default case in a Scala match...
View ArticleHow to provide default values for Scala constructor parameters
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 4.5, “How to provide default values for Scala constructor parameters.”ProblemYou want to provide a...
View ArticleHow to set default values for Scala method parameters
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 5.3, “How to set default values for Scala method parameters.”ProblemYou want to set default values for...
View Article