Quantcast
Channel: alvinalexander.com - field
Browsing all 31 articles
Browse latest View live

How to perform a SQL query for fields that are null (or not null)

Okay, maybe this is lame, but when I've been away from writing SQL database queries for a while I can never remember how to search for database table fields that are either NULL, or NOT NULL. I always...

View Article



MySQL current date time - 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 Article

Ruby - How to sort an array of objects by one field

Sorting an array of objects by one column in the object (class) is pretty simple with Ruby. Here's a quick demo of how I just did this when working on sorting the rows in a CSV file in a simple Ruby...

View Article

Image may be NSFW.
Clik here to view.

Secrets of consulting: Be very good at what you do

This article is now part of my new eBook, which is only $2.99 on Amazon.com:I hope you enjoy my book, and more than that, I hope it helps you have a very profitable and rewarding career. 

View Article

SQLite autoincrement - How to create an autoincrement field in SQLite

SQLite FAQ - How do I create an autoincrement field in SQLite?You define a SQLite autoincrement field (also known as a serial, identity, or primary key field) with this syntax:read more

View Article


SQLite autoincrement - How to get the autoincrement value from the last insert

SQLite autoincrement FAQ: How do I get the autoincrement value from my last SQLite INSERT command?You can get the integer value of the primary key field from the last insert into an autoincrement field...

View Article

CakePHP field required validation rule

CakePHP field required validation rule - How to make a CakePHP view field a required field.I'm still very new to CakePHP, and as a result I just spent thirty minutes fighting with a CakePHP field...

View Article

CakePHP require, notEmpty, allowEmpty, and form validation

CakePHP require, notEmpty, and allowEmpty FAQ: Help, I'm trying to edit my CakePHP model $validate field to make sure a CakePHP form field is required, but 'require' doesn't seem to be working as...

View Article


Linux cut command example with field and delimiter

Should you ever run into a situation where you want to use the Linux cut command by specifying both a field number and field delimiter, I hope this example is helpful for you.I was just working on a...

View Article


Scala - Declaring a null var variable (field) before a try, catch, finally block

Sometimes when you're writing Scala code, you need to create a null variable (a var, not a val), such as when you need to declare a variable right before using it in a try, catch, finally block. I just...

View Article

Drupal CCK form field - US states list

If you're ever creating a Drupal form using the CCK module and need to show a list of states (the United States) in a combo box (also known as a "select list" or "drop down" field), you'll want to have...

View Article

A Scala implicit method argument and field example

UPDATE: This example shows how to create an implicit method in Scala 2.9 or older. You can use a slightly simpler approach with Scala 2.10 and newer, which I've documented in this Scala 2.10 implicit...

View Article

Scala best practices: null values, Option, Some, and None

In his excellent book, Beginning Scala, David Pollak provides a series of statements that can be considered as a recipe for avoiding the use of null values in your Scala code. I've organized his...

View Article


Image may be NSFW.
Clik here to view.

My latest fake oil painting - Cattle in a field, facing East, late October...

My latest fake oil painting, which I call, "Cattle in a field, facing East, on a late October afternoon, Denver skyline in the background."(Also known by the alternate title, "Things I do when I can't...

View Article

Initialize Scala variables with Option, None, and Some (not null)

Summary: How to properly use the Scala Option/Some/None idiom to initialize empty var fields -- and specifically how not to use null values for the same purpose.When you get started in the Scala world,...

View Article


How to create a URL column in a Sencha ExtJS grid panel

I don’t know if this is the best way to do this, but if you want a column in a Sencha ExtJS grid to display a URL field that the user can click, I can confirm that this code works:read more

View Article

How to access Scala var and val fields from Java

I just ran into one thing I wish I had included in the Scala Cookbook that I didn’t include: How to access a val or var field in a Scala object from your Java code.In short, if you have a field named...

View Article


Image may be NSFW.
Clik here to view.

Android field/variable naming conventions

This image, copied from this android.com page, shows the suggested Android field naming conventions.

View Article

How to override Scala's default numeric type when defining a field

Scala FAQ: How do I override the default numeric type that Scala assigns when I declare an Int, Long, Short, Float, or Double val or var field?SolutionIf you assign 1 to a variable, Scala assigns it...

View Article

How to assign a Scala class field to a (lazy) block or function

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 4.8, “How to assign a Scala class field to a block or function.”ProblemYou want to initialize a field in...

View Article
Browsing all 31 articles
Browse latest View live




Latest Images