John Mercier

java programming and scjp

  • Blog
  • Projects

HTC Eris command line access

Posted on March 25, 2010 by John J Mercier

Filed under General | 0 Comments

Recently, the screen to my LG Voyager started to go out and I had to buy a new phone. I decided to go with the Eris because it's cheap and It has android on it. I've never had a phone with the internet and I always thought it was a scam, but since I started this new job I've realize how much a good phone can keep my organized.

So, I got the Eris and messed with a few apps and found ConnectBot. It is used to connect to computers using ssh and telnet but there is also a local option. This option opens a command line for the phone itself. I'm not sure what this can do but it looks like the phone is not logged in as root so it probably doesn't do much. I just think it's cool to see what is under the hood of my phone.

Share |

Moving Text in SQL Server

Posted on March 19, 2010 by John J Mercier

Filed under General | 0 Comments

Hello everyone, I just wanted to post something cool I figured out at work.

Problem: You need to copy one field in a table to another field in the same table for all rows but that field has single quotes.

 field1  field2
 John's  
 it's  
 wasn't  

Solution: Well it looks like you will need to select everything in field one and create an update command to copy it to field two. To select everything in field one you can use

select field1 from tablename;

but this does not create the update statements needed. Try adding a string

select 'update tablename set field2=''' + field1 + '''' from tablename;

Now you will have to copy the output of this query into a new query and run it.

update tablename set field2='John's' from tablename;

You should get an error because of the single quote. It will tell the server that the string has ended and the rest is part of the query command. So, 'John' is the string and s' is just a syntax error. Single quotes can be "escaped" by using two single quotes instead of one. So, John's will become John''s. To do this within a query you can use the replace function in the first query.

select 'update tablename set field2=''' + replace(field1, '''', '''''') from tablename;

The result will be

update tablename set field2='John''s' from tablename;

The real benifit of using this method is when there are large text fields that need to be copied. It can also be useful when there are hundreds of records to be moved. The only problem I see with this method is the large amount of text it can generate for each update command. It may be possible to use the in statement to select the text from the database rather than putting it all into the query.

Share |

« Previous month (Feb 2010) | Main | Next month (Apr 2010) »
  • General (12)
  • Projects (3)
  • Programming (14)

Search

Tag Cloud

activism addthis.com data_structure downloading facebook google google-buzz introduction java javablackbelt jdbc johnmercier.com jsp linux model-1 netbeans nvidia objectivism official-english programming projects pti roller scjp server sql theme uncertainty velocity welfare-state

Friends

  • Ed
  • Shane

Links

  • Glazed Lists
  • JGoodies
  • Java Specialists
  • Swing 2.0
  • Swing Generics
  • ideone
  • pircbot

Feeds

  • All
  • /General
  • /Projects
  • /Programming
  • Comments

Referrers

  • direct (172)
  • keflex.tr.gg/KEFLEX- (10)
  • pheromones-to-attrac (8)
  • www.beeplog.com/2609 (6)
  • softbanhtc.info/site (5)
  • softbanhtc.info/site (5)
  • softaxianhtc.info/si (5)
  • softbanhtc.info/site (5)
  • softbanhtc.info/site (5)
  • softbanhtc.info/site (5)
  • softaxianhtc.info/si (5)
  • softbanhtc.info/site (5)
  • softbanhtc.info/site (5)
  • softbanhtc.info/site (5)
  • softbanhtc.info/site (5)
  • softaxianhtc.info/si (5)
  • softbanhtc.info/site (5)
  • softbanhtc.info/site (5)
  • softbanhtc.info/site (5)
  • softcelandroid.info/ (5)
  • softaxianhtc.info/si (5)
  • softbanhtc.info/site (5)
  • softcelandroid.info/ (5)
  • softcelandroid.info/ (5)
  • softcelandroid.info/ (5)
  • softaxianhtc.info/si (5)
  • softcelandroid.info/ (5)
  • softcelandroid.info/ (5)
  • softcelandroid.info/ (5)
  • softaxianhtc.info/si (5)

Navigation

  • John Mercier
  • Weblog
  • Login

©2010 John J Mercier.

Designed by Free CSS Templates. Template by E. Strokin. Powered by Roller Weblogger 4.0.1.