Welcome to my website. I am always posting links to photo albums, art, technology and other creations. Everything that you will see on my numerous personal sites is powered by the formVistaTM Website Management Engine.

icon.linkedin.jpgicon.twitter.jpg

  • Subscribe to this RSS Feed
  • Deleting Safari Cookies in iOS Simulator
    11/06/2013 9:36AM

    If you are doing any kind of development that involves cookies and need to be able to delete them while testing iOS you will likely need to delete them as well.

    The iOS simulator (Launched from Xcode by going to Xcode > Open Developer Tool > iOS Simulator) stores data for the simulator in the following directory on the host Mac OSX file system:  /Users/<uid>/Library/Application Support/iPhone Simulator/

    First, quit out of the iOS Simulator.

    To find the cookies and delete them open up a terminal and cd to the iPhone Simulator directory.

    $ cd /Users/<uid>/Library/Application\ Support/iPhone\ Simulator/

    Then execute the following find command to find the cookie data file:

    $ find ./ -type f -iname '*binarycookies*' -exec ls -l {} \;
    -rw-r--r--  1 ryanchapin  staff  2503 Nov  6 08:32 .//7.0-64/Applications/630F9FE9-87B2-4A6D-8C60-CA70EBC5FD8A/Library/Cookies/Cookies.binarycookies

    You can then update the find command to the following to delete the file.

    $ find ./ -type f -iname '*binarycookies*' -exec rm {} \;


  • Executing MySQL Queries and Commands from the Command Line to a Remote Server
    10/31/2013 10:56AM

    Following are a couple of ways to execute SQL on a remote MySQL server via the shell.

    Executing SQL directly from the command line:

    $ mysql -u uid -p -h remote.host database -e 'SQL query here;'

    Executing SQL from a file on the local host on the remote server:

    $ mysql -u uid -p -h remote.host database < file.sql

    You can also connect to the remote mysql server and from the command line execute SQL from files on the local drive as such (as long as the file is in the same directory from which the mysql connection is made

    mysql> \. file.sql

    Notice NO ';' at the end of the command.

    Moreover, you can use the following to run commands in your local shell

    mysql> \! ls

    Will give you the directly listing of the dir from which you invoked the mysql remote connection.

    mysql > \! vi file.sql

    Will allow you to edit the file on your local drive without having to close the mysql cli.

  • Executing Dynamically Generated SQL Queries from a Shell Script
    10/25/2013 1:03PM

    Following is how to generate dynamic SQL in a shell script and then execute those queries.

    Let's say, for instance, that you have a list of tables that you want to flush regularly during development and don't want to type in the SQL queries each time.  Moreover, you just want to maintain a list of the table names and add and remove from it when necessary and have your script dynamically generate and execute the delete statements.

    For the purposes of this tutorial we are running these commands as root to avoid the additional complication of authentication.

    The first thing you need is your text file with the list of your tables:

    table_list.txt:

    table_a
    table_b
    table_c

    delete_data.sh:

    #!/bin/bash

    for i in `cat tables_list.txt`
    do

       mysql -u root dbase_name << END_SQL
       delete from ${i};
    END_SQL
    #
    # It is imperitive that the END_SQL redirect identifier
    # be on its own line without any leading or trailing spaces
    #

    done

    The script will run, will make a connection to MySQL and then execute the command with the dynamically generated target table.

    This will work with other databases other than MySQL as well.

  • Send a Text Message To Your Cell Phone From E-mail
    10/18/2013 8:38AM

    This might be old news but I came accross this today and wanted to make a note of it for myself for future reference.

    All that you need to do is address the message to the phone number @ the service prodivers designated domain that they use to convert and forward the message content to your mobile device.

    What I see interesting in this is being able to send txt messages from a system or service that encounters an error that requires human intervention.

    For example, if you want to send a message to someone on a Verizon phone, you would address the e-mail to:

    5551230987@vtext.com

    Send your message as normal, and they will get it as a SMS.

    All of the providers follow the schema of the 10-digit phone number followed by the @ and then the domain for the provider.

    Following is a list of the domains used by the major providers.  If you don't see your provider in the list the search string I used to find each was "send a text message to a cell phone from email [name-of-provider]"

    • Alltel: @message.alltel.com
    • AT&T: @txt.att.net.  To send multimedia messages use @mms.att.net
    • Bell Canada: @txt.bellmobility.ca
    • Boost Mobile: myboostmobile.com
    • Cricket Wireless: @sms.mycricket.com.  To send multimedia messages use @mms.mycricket.com
    • Metro PCS: @mymetropcs.com or @metropcs.sms.us
    • Qwest: @qwestmp.com
    • Sprint: @messaging.sprintpcs.com
    • T-Mobile: @tmomail.net
    • U.S. Cellular: @email.uscc.net
    • Verizon: @vtext.com
    • Virgin Mobile USA: @vmobl.com
  • Setting Up Android SDK and Plugin in an Existing Install of Eclipse
    10/09/2013 4:25PM

    To set up an existing install of Eclipse to do some Android development do the following:

    • Go to http://developer.android.com/sdk/index.html and look for and download the ADT bundle for your OS (in my case I was using Fedora Core 18 at the time)
    • Unpack it as the user that is going to be running Eclipse and/or after you unpack it make sure that your user has read/write/execute permissons for the files in this directory (obviously, you don't need execute permssion for non executables).  To make things easy, I just created an ~/sdks directory and unpacked it in there.
    • Fire up eclipse and go to Help/New Software.
    • Add the following repository: https://dl-ssl.google.com/android/eclipse/
    • Check off both the Developer Tools and NDK Plugins.
    • After those plugins install go to Window/Preferences/Android, and click the 'Browse' button next to 'SDK Location:', selecting the /path-to/adt-bundle-linux-x86_64-20130917/sdk.  When setting this up you might get a dialogue box that indicates that the version of the Android SDK Tools and/or Android SDK Platform Tools is not compatible with the version of the adt-bundle you are attempting to use.  In my case, I was prompted to update it via the Android SDK Manager and was able to download an updated version.

    If you have an existing project that you are working with you might have to update the project.properties to update the sdk level number.

    You might see an error like:

    Unable to resolve target 'android-17' until the SDK is loaded

    If so, update the 'target=android-17' property in the project.properties file to match the value of 'Platform.MinPlatformToolsRev' in the /path-to/adt-bundle-linux-x86_64-20130917/sdk/tools/source.properties file.

    In my case, I updated the project.properties to:

    # Project target.
    target=android-18

    Getting the value '18' from the source.properties:

    Platform.MinPlatformToolsRev=18


Advanced Search

Categories

Archives