# Rake task to drop, create, migrate then seed your development database # with fixture data # Based on http://justinfrench.com/index.php?id=232 namespace :db do desc "Raise an error unless the current Rails environment is development" task :development_environment_only do raise "Development only!" unless Rails.env.development? end desc "Drop, create, migrate then seed development database" task :devreset => [ 'environment', 'db:development_environment_only', 'db:drop', 'db:create', 'db:migrate', 'db:seed' ] end
Monday, December 19, 2011
Rake task to drop, create, migrate then seed your development database
When developing a Ruby on Rails application you will often want to drop, create, migrate then seed your development database. Justin French wrote a blog post describing how to write a custom rake task to do just that. I had to modify the code to work properly in my Rails 3 (3.1.x) development environment, so I thought I'd share.
Sunday, December 18, 2011
Pressure Cooker Coconut Chicken Curry Recipe
Following is my personal recipe for coconut chicken curry,
cooked in a pressure cooker. This recipe is based on other recipes from around
the Internet. I can’t claim that this recipe is “authentic” in any way. Rather,
it’s inspired by similar dishes from Indian restaurants around the Washington,
DC area.
Prep time: 10 minutes
Cook time: 30 minutes (total)
Servings: 8 - 10
Ingredients
Onion, chopped – 1 medium
Bell pepper (red or orange for color), sliced thin
lengthwise – 1 medium
Garlic, chopped – 6 cloves
Potatoes, cubed – 2 small
Curry powder – 2 Tbsp/30ml
Paprika – 2 tsp/10ml
Ginger – dried, ground – 1 tsp/5ml
Garlic salt – 2 tsp/10ml
Coconut milk – 1 can/13.5oz/400ml
Sesame oil – 2 Tbsp/30ml
Chicken thighs, thawed, with bones – 10
Preparation
1. Add sesame oil to pressure cooker and heat to medium
high heat
2. Add onion, bell pepper, and garlic to oil, cook for
several minutes
3. Add chicken thighs and cook on one side for several
minutes
4. Add curry powder, paprika, ginger, and garlic salt
5. Turn chicken thighs and cook on other side for
several more minutes
6. Add potatoes
7. Add coconut milk
8. Place lid on pressure cooker, lock, and adjust pressure setting to poultry
9. Continue cooking on medium high heat until pressure
indicator pops up (about 10 minutes)
10. Lower heat to low/simmer (about 10 more minutes)
Weight Watchers PointsPlus values (per serving
per the online recipe builder): 9
Monday, August 16, 2010
How to Remove a Provisioning Profile from iTunes on Mac OS X
If you are developing and testing applications for the iPhone, you may occasionally need to remove an old or obsolete provisioning profile from iPhones in a test or pilot environment. While this is straightforward, the problem is that the profile is reinstalled on the iPhone the next time your users sync with iTunes. The way to work around this problem is to remove the provisioning profile from iTunes as well. While this is not difficult, there is no obvious way to do this from iTunes. Therefore, I thought I’d post some instructions on how to do just this. Here I’ll describe how to remove a provisioning profile from iTunes on a Mac, as well as how to remove it from the phone.
Step 1
Ensure that your iPhone is not connected to your Mac (you’ll connect and sync later). If iTunes is running, close it.
Step 2
Step 3
There. You’re done and the profile is gone.
Step 1
Ensure that your iPhone is not connected to your Mac (you’ll connect and sync later). If iTunes is running, close it.
Step 2
- Delete the provisioning profile from your Mac
- Open Finder
- Navigate to <your_home_directory>/Library/MobileDevice/ProvisioningProfiles
- Select the provisioning profile(s) you wish to remove, right click, select Move to Trash
Step 3
- Remove the provisioning profile from your iPhone
- Go to Settings -> General we
- Scroll down to Profiles
- Tap the profile you wish to remove
- Tap the red Remove button, a confirmation dialog will appear
- Tap Remove to dismiss the dialog and remove the provisioning profile
- You will be returned to Settings -> General
There. You’re done and the profile is gone.
Tuesday, February 23, 2010
How the IPad Fits Into IT
This is a very interesting blog post on PCWorld
by John Welch of Macworld
.com.
How the iPad Fits Into IT
Posted using ShareThis
How the iPad Fits Into IT
How do you think the iPad will fit into enterprise IT?
Posted using ShareThis
Friday, February 12, 2010
Device Management for Google Sync
On Wednesday February 3, Google announced support for basic corporate policy enforcement across a range of mobile devices. Administrators may apply these policies to Windows Mobile, Nokia, and iPhone devices, all of which are Exchange ActiveSync enabled. This is a good move by the Google Apps
Monday, January 25, 2010
Android Accelerometer and Orientation Example
Following is an example of how to use the Android accelerometer and orientation API’s. This example is based on Frank Ableson’s “Tapping into Android’s sensors” article over at IBM DeveloperWorks. I’ve made a change to the UI to use the Android TableView and implemented it as a Resource.
To get going, all you need to do is
package com.blogspot.mobilestrategist;
To get going, all you need to do is
- Create a new Android
project
- Replace the contents of main.xml with the xml in this sample
- Replace the contents of your Activity class with the code in this sample
Following is the new main.xml
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<TableRow>
<TextView
android:id="@+id/accelerometer_label"
android:layout_column="1"
android:text="Accelerometer"
android:textSize="9pt"
android:padding="3dip" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/accel_x_label"
android:layout_column="1"
android:text="X:"
android:textSize="8pt"
android:padding="3dip" />
<TextView
android:id="@+id/accel_x_value"
android:gravity="right"
android:textSize="8pt"
android:padding="3dip" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/accel_y_label"
android:layout_column="1"
android:text="Y:"
android:textSize="8pt"
android:padding="3dip" />
<TextView
android:id="@+id/accel_y_value"
android:gravity="right"
android:textSize="8pt"
android:padding="3dip" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/accel_z_label"
android:layout_column="1"
android:text="Z:"
android:textSize="8pt"
android:padding="3dip" />
<TextView
android:id="@+id/accel_z_value"
android:gravity="right"
android:textSize="8pt"
android:padding="3dip" />
</TableRow>
<View
android:layout_height="2dip"
android:background="#FF909090" />
<TableRow>
<TextView
android:id="@+id/orientation_label"
android:layout_column="1"
android:text="Orientation"
android:textSize="9pt"
android:padding="3dip" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/orient_x_label"
android:layout_column="1"
android:text="X:"
android:textSize="8pt"
android:padding="3dip" />
<TextView
android:id="@+id/orient_x_value"
android:gravity="right"
android:textSize="8pt"
android:padding="3dip" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/orient_y_label"
android:layout_column="1"
android:text="Y:"
android:textSize="8pt"
android:padding="3dip" />
<TextView
android:id="@+id/orient_y_value"
android:gravity="right"
android:textSize="8pt"
android:padding="3dip" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/orient_z_label"
android:layout_column="1"
android:text="Z:"
android:textSize="8pt"
android:padding="3dip" />
<TextView
android:id="@+id/orient_z_value"
android:gravity="right"
android:textSize="8pt"
android:padding="3dip" />
</TableRow>
</TableLayout>
Following is the new Android Activity Java class
package com.blogspot.mobilestrategist;
import com.blogspot.mobilestrategist.R;
import android.app.Activity;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.widget.TextView;
public class AccelOrientExample extends Activity implements SensorEventListener {
// Accelerometer X, Y, and Z values
private TextView accelXValue;
private TextView accelYValue;
private TextView accelZValue;
// Orientation X, Y, and Z values
private TextView orientXValue;
private TextView orientYValue;
private TextView orientZValue;
private SensorManager sensorManager = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get a reference to a SensorManager
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
setContentView(R.layout.main);
// Capture accelerometer related view elements
accelXValue = (TextView) findViewById(R.id.accel_x_value);
accelYValue = (TextView) findViewById(R.id.accel_y_value);
accelZValue = (TextView) findViewById(R.id.accel_z_value);
// Capture orientation related view elements
orientXValue = (TextView) findViewById(R.id.orient_x_value);
orientYValue = (TextView) findViewById(R.id.orient_y_value);
orientZValue = (TextView) findViewById(R.id.orient_z_value);
// Initialize accelerometer related view elements
accelXValue.setText("0.00");
accelYValue.setText("0.00");
accelZValue.setText("0.00");
// Initialize orientation related view elements
orientXValue.setText("0.00");
orientYValue.setText("0.00");
orientZValue.setText("0.00");
}
// This method will update the UI on new sensor events
public void onSensorChanged(SensorEvent sensorEvent) {
synchronized (this) {
if (sensorEvent.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
accelXValue.setText(Float.toString(sensorEvent.values[0]));
accelYValue.setText(Float.toString(sensorEvent.values[1]));
accelZValue.setText(Float.toString(sensorEvent.values[2]));
}
if (sensorEvent.sensor.getType() == Sensor.TYPE_ORIENTATION) {
orientXValue.setText(Float.toString(sensorEvent.values[0]));
orientYValue.setText(Float.toString(sensorEvent.values[1]));
orientZValue.setText(Float.toString(sensorEvent.values[2]));
}
}
}
// I've chosen to not implement this method
public void onAccuracyChanged(Sensor arg0, int arg1) {
// TODO Auto-generated method stub
}
@Override
protected void onResume() {
super.onResume();
// Register this class as a listener for the accelerometer sensor
sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL);
// ...and the orientation sensor
sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), SensorManager.SENSOR_DELAY_NORMAL);
}
@Override
protected void onStop() {
// Unregister the listener
sensorManager.unregisterListener(this);
super.onStop();
}
}
Android in the Enterprise: A Roadmap: Phase 1
There has been a lot of discussion recently regarding Google's Nexus One and whether or not it is a suitable device for enterprise use. Instead of answering that question directly, I will discuss the broad requirements that most enterprises must satisfy before allowing mobile devices to connect to IT services.
Mobile devices must be able to connect to enterprise messaging systems. Though the best mobile platforms have moved beyond being just messaging tools, email is still the killer application for mobile devices and support for enterprise messaging systems should be a core part of any enterprise grade mobile platform. To be specific, deep support for Exchange ActiveSync (EAS) is required. EAS is becoming the de-facto standard for syncing email and personal information manager (PIM) data to mobile devices, and is supported by Lotus Domino, Google Sync, and others in addition to Microsoft Exchange. The EAS protocol even supports pushing security policies to the device over the air.
Many of the articles and blogs around the topic of Android in the enterprise have focused on the inherit ability of the phone to be secured and managed by enterprise IT. Google has designed a security architecture for Android that is focused on ensuring that applications running on the platform adhere to specific security policies that govern access to private user data, data owned by other applications, and device resources such as network access, Bluetooth access, etc. You can read more about the Android security model here.
This security model, however necessary, solves a qualitatively different problem than the security burden placed on IT personnel charged with implementing a mobility solution for their organizations.
Enterprise IT's primary mobile related security threat is physical loss of the device. Therefore a robust device loss protection (DLP) solution is required to address this problem. At minimum, most sophisticated IT organizations require that mobile device platforms provide the following capabilities before being allowed to access enterprise resources:
• Device Lock, i.e. a PIN or alphanumeric password is required to unlock the device
• Data-at-rest encryption for all sensitive corporate data and in some cases personal data
• Remote wipe capability, i.e. a remote wipe command sent via an IT administrative console to destroy data in the event of device loss
• Local wipe policies, to destroy data after a given number of failed unlock attempts--i.e. Enter a PIN five times, the device automatically wipes all data
• A mechanism to ingest a security policy configurations from a mobility management system
Here I'll propose a simplified hypothetical Phase 1 roadmap for the Nexus One, and Android writ large, to become an enterprise class mobile platform.
Support for Exchange ActiveSync
Exchange ActiveSync is supported by most major mobile OS platforms, including iPhone OS, Windows Mobile, Symbian, and the Palm's webOS. Some Android handsets do support EAS, but those have tended to be handset vendor specific implementations, namely from HTC and Motorola. The Android platform itself is behind the curve here and should accelerate investment in EAS as a core platform capability.
• Exchange ActiveSync 2.5 and 12.1 and later
• Email Sync
• Contacts Sync
• Calendar Sync
◦ Ability to accept meetings
◦ Ability to Schedule meetings and send invites
• Security Policies: PIN, Encryption, Remote and Local Wipe
Device Loss Protection
Device loss is, at this time, the top mobile computing security threat faced by enterprise IT organizations. Therefore device loss protection mechanisms should be a core component of a comprehensive security model built into enterprise class mobile computing platforms.
• A robust PIN and/or alphanumeric device lock facility to prevent unauthorized access to the device itself
• Robust and transparent data-at-rest encryption
◦ Fast, seamless
◦ Multiple entropy, e.g. user's PIN as entropy, with PIN caching to allow for background sync while the device is locked
• Remote wipe: respond to remote wipe commands
• Local wipe capabilities
◦ Based on number of failed password attempts
In a follow on post, I'll propose an extension to the roadmap to include device management, and enterprise integration.
Subscribe to:
Posts (Atom)