new ipod vs tile floorAny recommendations for kid proof cases?

Image

Advertisements
Posted in Uncategorized

Virtual Fields in Sencha Touch Models

I wanted to display a user’s full name in a Sencha Touch Select control. I figured this would be as easy as defining a template for the control.

// this doesn't work{    xtype: 'selectfield',    label: 'Name',    store: store,    valueField: 'id',    tpl: '{firstName} {lastName}'}

Unfortunately, that didn’t work.

Next I decided to create a fullName() function my model.

Ext.regModel('Person', {    fields: [        {name: 'id', type: 'int'},        {name: 'firstName', type: 'string'},        {name: 'lastName', type: 'string'}    ],    fullName: function() {        return this.data.firstName + " " + this.data.lastName;    }});

The function worked great, but not in the Select control. Select#displayField expects a field name and won’t call a function.

I needed to create a virtual field in the model. I couldn’t find any documentation for this, but Rich Waters offered a solution via the Sencha Touch Forums.

Ext.regModel('Person', {    fields: [        {name: 'id', type: 'int'},        {name: 'firstName', type: 'string'},        {name: 'lastName', type: 'string'},        {name: 'fullName', type: 'string',            convert: function(v, rec) {                return rec.data.firstName + " " + rec.data.lastName;            }        }    ]});

Once the virtual model field was created, I could use it in the select control.

{    xtype: 'selectfield',    label: 'Name',    store: store,    valueField: 'id',    displayField: 'fullName'}

For a full example see http://github.com/don/sencha-virtual-model-field

Tagged with: ,
Posted in Uncategorized

No proxy for you

I had planned to show how to sniff network traffic from an Android phone, similar to my iPhone example.

No such luck.  Surprisingly, the Nexus One doesn’t have a UI to set the WiFi proxy.  It looks like tcpdump or Wireshark is the way to go here.

Tagged with: ,
Posted in Uncategorized

Sniffing iPhone Traffic

So you want to know what you iPhone is doing on the internet?

Download and install Charles Proxy.  Charles is shareware.  I paid the $50 for a license since it’s a great tool.  Anyway, follow their installation instructions and start Charles.app.

You’ll need the IP address of your Mac.  I use ifconfig to get my IP address, you can use Network Utility if you’d prefer.

Network_utility

Once you have your IP address, open Settings -> WiFi on your phone and choose the current network.

Choose_current_network

Scroll to the bottom and select Manual under HTTP Network.

Enter your IP address and 8888 for the port.  

Exit out of settings using the home button.

Proxy_settings

Switch back to Charles on your Mac.  If Charles has recorded a bunch of activity, use the trash can icon to clear the screen.  

Open the stocks application on your phone.

Charles will ask for permission to allow your phone to use the proxy.

Grant_permission
App

Expand the tree for http://iphone-wu.apple.com and click on one of the request response pairs.  On the right hand pane choose “Response” on the top.  Choose “XML Text” on the bottom.  Now you can see the XML that Apple sent to the stock application on your phone.

Charles

Now that you know what your doing, have fun.

Oh and don’t forget to disable the proxy on your phone after, otherwise your network will appear broken.

Tagged with: , , ,
Posted in Uncategorized

Trying Posterous

I’m giving Posterous a try (instead of wordpress) since Kevin recommends it :)

Posted in Uncategorized

Extracting x509 certificates from a p7m file

A client emailed me a new TLS certificate for their server as a p7m file. Normally I’d get this from the CA as a PEM encoded x509 certificate.

Fortunately openssl can easily convert this

openssl pkcs7 -inform DER -in certificate.p7m -print_certs -out certificate.pem

I used a text editor to separate the SSL certificate from the intermediate certificates, since I have Apache configured to expect these in separate file.

Tagged with: ,
Posted in linux, openssl

jythonconsole-0.0.7 released

Jython Console is a Jython Interactive Interpreter that adds Code Completion.

jythonconsole-004.png

This release fixes works with Jython 2.5.

See the project page for more info.

Posted in java, jython, python