Showing posts with label LG GD570. Show all posts
Showing posts with label LG GD570. Show all posts

Sunday, June 12, 2011

Published J2ME Image Viewer MIDlet

Published my first J2ME MIDlet, my first open source application, named simply "J2ME Image Viewer". I was annoyed that I could not find a good full resolution image viewer for my LG phone. The photo viewer app included with the phone automatically reduces the resolution of images to fit the screen. And even though it has a zoom in function, when zoomed in the image is still shown at lower resolution instead of the true resolution of the underlying image file, resulting in a blurry image when viewing zoomed in hires images. This makes viewing images that require full resolution detail like maps and text in images useless. J2ME Image Viewer fixes all of that. Link to J2ME Image Viewer

Saturday, May 21, 2011

How to use LG GD570 dLite phone Ad Hoc Playlist

(I couldn't find this useful feature explained in the LG GD570 manual or in google.)
How to use the LG dLite Ad Hoc playlist. The Ad Hoc playlist allows you to easily add tracks to the builtin Ad Hoc playlist. From a MP3 music track listing screen, highlight to select the desired track, press down OK button for about 2 seconds, and the track is added to Ad Hoc playlist. (Note, does not work from the music player screen.)

Friday, May 20, 2011

python script to replace html Entities (&; codes)

This script converts html files in place, replacing html character entities with standard characters. I'm using this to clean up html entities unrecognized by the Anyview j2me javame midlet ebook reader for LG dlite gd570 phone.
# htmlcodefix.py (dlc 5/2011)
# replace html entity codes .  writes new html file in place.
import sys
import os
import re

trans = { "“" : "\"",
 " " : " ",
 "”" : "\"",
 "’" : "'", 
 "—" : "--", 
 }

def main():
 if len(sys.argv) != 2:
  print("Usage: " + sys.argv[0] + " {html file to convert in-place}")
  exit();
 filename = sys.argv[1]
 if(not filename.endswith(("htm", "html"))):
  print(filename + " not html!")
  exit();
 if(not os.path.exists(filename)): 
  print(filename + " not found!")
  exit();

 print("converting ... " + filename)
 with open(filename, 'r') as f:
  read_data = f.read()
 
 for (srch, repl) in trans.items():
  print (srch, repl)
  read_data = read_data.replace(srch, repl)

 print(read_data)

 with open(filename, mode='w') as f:
  f.write(read_data)



if __name__ == '__main__':
 main()