I have been at my new job for a little over a month now. I have had the chance to learn a lot of new things. Generally I have been a front end developer doing the GUI and writing custom controls. Of course that does not mean I don't get to do any middle or back end coding. I use SQL where needed, write business logic handling objects, etc.
Here we are using Spring, Hibernate and Postgres for the database chores. I am finding my way about on all those annotations and have sent off and received requests for new table schemas to the DBA.
In a given day you can find yourself using little bits of each framework in a few hours time. I started the day setting up a chron job to call some existing code that calls two different 3rd party APIs to get some data. One of the vendors uses XML and the other JSon. The objects are created via Spring and we use Hibernate to interact with the database. I was using various internal SDK calls to do most of that with all of the work being done in Java.
Once that was up and running I was asked to look at some existing Objective C iOS code to see how close it was to being app store releasable. First off I was not able to login in as the servers I have access to don't have valid certificates on them and our API is HTTPS based. A browser will let you ignore the suspect certificate after a warning message. I added some #ifdef DEBUG to allow the Connection code to accept any certificate. That got me into the app and allowed to try out rest of the GUI.
Sadly I crashed the app pretty quickly. Did not know initially if it was bad memory management or if it ran out of memory. Turns out it ran out of memory. I added a @try block around things so it could push itself along a bit farther and I was able to run everything.
I then started to research why it ran out of memory. I looked at the server request it was making and tried it in a browser. A huge pile of data came back so I ran used curl to grab the data and write it to a local file. Turns out there was 38.9 meg of JSon coming back.
I wanted to sniff around in the JSon so I asked python to pretty print it and sent that to another file. I then opened it up in Sublime 2 to see what I had. Straight forward JSon, just a lot of it.
Next I wanted to see how the code was handling the JSon. Turns out the developer used the standard NSJSONSearialization calls in iOS. This is like using the DOM in XML in that you get it all in memory and they you double it up or more by converting to your internal object format. It was the easy way to go but not the most optimized way to handle things.
Time to hit Google and see if there is a streaming JSon parser. I found YAJL which I plan on experimenting around with today. I also think we should write the results out into a database instead of holding it all in memory. I have written similar code, it was XML and not JSon, storing to SQLite at a previous position so this should be fairly straight forward.
So was this a typical day? Yes, in that I ended up using a pile of different languages, data formats, command line tools and frameworks / SDKs to get my job done. You really need to branch out and learn new things.
I played around with Python in my spare time at home as I kept hearing about it and now I have used it multiple times. I used it at my previous job for a quick error log parser. I have used it here because some sample 3rd party code was written in it and I needed to convert that to Java. I was able to run the Python code and tweak it until it worked before I converted it to Java. I have used python to pretty print JSon files.
Curl was something new to me here. I have used it a lot with the 3rd party vendors as one did all their sample code it in. Curl makes it very easy to grab server results and shove them into a file. It works great with HTTPS as you can pass the user name and password in the command along with ignoring invalid certificates which seems to be a recurring need.
I have used Java for years so that is second nature. I have not used Spring or Hibernate in the past. I am really starting to see the power of the annotations. With great power comes great responsibility though. I am learning when you need to put code in other objects so it can be properly initialized. Anytime you use a new framework you find new and interesting ways to crash your code.
There is very little iOS knowledge here so I was able to step in and handle that too. A bit of a mind shift to get back onto Objective C and it will take some time to remember the syntax, framework and ins and outs of Xcode. Keeps you on your toes to shift around between languages, IDEs and frameworks. Good thing my Mac has a lot of memory, disk space and a large second monitor to keep all of this open and ready to roll.
Just to add to the mayhem I am working on updating my Android game at home. It does not scale well to tablets so I am converting the graphics to vector based allowing it hopefully work on nearly every device. At the end of most days I am pretty mentally fried.
Thursday, April 18, 2013
Thursday, April 11, 2013
Motorola Xoom aint what she used to be
I have had the Motorola Xoom for a couple of years. One of the early Android tablets. It is dual core but boy is it showing its age. Part of this is due to my quad core Note II. Everything on my phone is really snappy. Things on the Xoom used to be snappy but now everything seems slow. Boot up time really stinks.
Button presses to get to home screen or bring up list of running apps are pitiful. I still use the tablet a lot for content reading. That works just as well as it always has although the screen is not super bright nor does it have the great colors of the Note II. I enjoy doing crossword puzzles more on the tablet as you can see more of the clues and all of the grid.
Not ready to get a new tablet just yet though. The Xoom works for its specific purposes. The direct plug-in charger quit working but the base charger I ordered from Amazon works just fine. If that goes out then the tablet will be useless.
Next time I will look in a smaller than 10" range but I don't know if 7" is big enough. Probably something in the middle. At least on the Android side of things there appears to be a nice variety to choose from. The current size / weight can make it a bit tough to hold one handed for extended periods of time. I am usually petting a cat while reading articles or using my other hand to one finger type crossword puzzle answers.
Button presses to get to home screen or bring up list of running apps are pitiful. I still use the tablet a lot for content reading. That works just as well as it always has although the screen is not super bright nor does it have the great colors of the Note II. I enjoy doing crossword puzzles more on the tablet as you can see more of the clues and all of the grid.
Not ready to get a new tablet just yet though. The Xoom works for its specific purposes. The direct plug-in charger quit working but the base charger I ordered from Amazon works just fine. If that goes out then the tablet will be useless.
Next time I will look in a smaller than 10" range but I don't know if 7" is big enough. Probably something in the middle. At least on the Android side of things there appears to be a nice variety to choose from. The current size / weight can make it a bit tough to hold one handed for extended periods of time. I am usually petting a cat while reading articles or using my other hand to one finger type crossword puzzle answers.
Monday, April 8, 2013
Life is a series of subscriptions
It used to be you had a few recurring monthly payments:
Rent / house payment
Utilities (gas, electricity, water, sewer, land line phone)
Car payment
Newspaper
You probably got your TV over the air. There was no internet and without that no such things as multiplayer games that were fee based.
Now you might have had some self imposed recurring fees like a monthly comic book store stop, new miniatures to paint for DnD sessions or something similar.
Today we have added:
Cable or Satellite TV including DVR rental
Internet provider of some type, bundled or otherwise
Cell phone including data plan
Online gaming subscriptions
App purchases
Netflix, Amazon or Hulu type service
We probably dropped:
Newspaper
Land line phone
It all seems so simple. What is another $20 here and there. Sure, get HBO and add data to all the kids phones and up the internet connection speed. Chuck on $3.50 for cell phone insurance, $14.99 to monitor your credit score, etc. When you look at it all - boy does it add up quickly. I cringe every time I think of adding another monthly fee.
I feel I would really enjoy playing WoW but I don't want to pay for a game then play every month to play it. I worry I would eat up too much time playing the game or feel like I had to play it to get my monies worth that month. I don't need a second job that is a game. I know I am generally pretty cheap. I don't buy new releases, I wait until they are sale usually on steam. I like to get Gold editions or multi-packs. When I play an RPG I generally finish it and I feel I get my monies worth out of it. I really enjoyed the Gothic series, Divine Divinity, the original Diablo (later ones became too multiplayer specific, still enjoyed them but not as much as the first), Might and Magic. Boy my wife was sick of MM6 by the time I finished it. Could only have done that before kids.
I enjoy a good FPS and have played through many of the single player experiences more than once. As weird as some of the Delta Force games were I have enjoyed them over and over through the years. Adventure games are fun to play with others helping you. Monkey Island and the Broken Sword series come to mind.
So far I have never signed up for a monthly fee based game. I have never made in app purchases. I did not buy fancy armor for any of the Elder Scrolls series. I like games that I buy, play at my own pace and play through more than once generally with years between the play sessions.
A lot of that is coming to an end. I play games on my phone that last just minutes a session. That is all the time I end up having. At best I try to carve out time each day to do crossword puzzles for a little mental challenge. I miss having an RPG story to return to a few nights a week spread over multiple months. I was gifted Torch Light 2 which was hack and slash and less RPG which I had fun playing and finished with multiple character types.
My son and I had a blast playing Portal 2 especially the co-op mode. We need to fire that up again for another play through. My wife had to keep the door to the computer room closed as we were laughing to hard for her to get any work done. We both have upgraded computers for this go round and it should be a really good time again. Sure, we will remember some of the tricks of the levels but there is a lot of timing involved and a lot of stupid ways to die. We need more co-op games.
We keep thinking computers will make our lives easier. They do remove some of the grunt work but they also make our lives harder. Keeping the wireless network up to snuff, adding new devices to the home network, print, scan, copy, collate, update drivers, new Android OS, new iOS, change the data plan, fix the NetFlix streaming issue, adjust the clock for DST and reboot you freaking car! Good thing I am in the tech field and can usually deal with the issues in a timely manner.
Rent / house payment
Utilities (gas, electricity, water, sewer, land line phone)
Car payment
Newspaper
You probably got your TV over the air. There was no internet and without that no such things as multiplayer games that were fee based.
Now you might have had some self imposed recurring fees like a monthly comic book store stop, new miniatures to paint for DnD sessions or something similar.
Today we have added:
Cable or Satellite TV including DVR rental
Internet provider of some type, bundled or otherwise
Cell phone including data plan
Online gaming subscriptions
App purchases
Netflix, Amazon or Hulu type service
We probably dropped:
Newspaper
Land line phone
It all seems so simple. What is another $20 here and there. Sure, get HBO and add data to all the kids phones and up the internet connection speed. Chuck on $3.50 for cell phone insurance, $14.99 to monitor your credit score, etc. When you look at it all - boy does it add up quickly. I cringe every time I think of adding another monthly fee.
I feel I would really enjoy playing WoW but I don't want to pay for a game then play every month to play it. I worry I would eat up too much time playing the game or feel like I had to play it to get my monies worth that month. I don't need a second job that is a game. I know I am generally pretty cheap. I don't buy new releases, I wait until they are sale usually on steam. I like to get Gold editions or multi-packs. When I play an RPG I generally finish it and I feel I get my monies worth out of it. I really enjoyed the Gothic series, Divine Divinity, the original Diablo (later ones became too multiplayer specific, still enjoyed them but not as much as the first), Might and Magic. Boy my wife was sick of MM6 by the time I finished it. Could only have done that before kids.
I enjoy a good FPS and have played through many of the single player experiences more than once. As weird as some of the Delta Force games were I have enjoyed them over and over through the years. Adventure games are fun to play with others helping you. Monkey Island and the Broken Sword series come to mind.
So far I have never signed up for a monthly fee based game. I have never made in app purchases. I did not buy fancy armor for any of the Elder Scrolls series. I like games that I buy, play at my own pace and play through more than once generally with years between the play sessions.
A lot of that is coming to an end. I play games on my phone that last just minutes a session. That is all the time I end up having. At best I try to carve out time each day to do crossword puzzles for a little mental challenge. I miss having an RPG story to return to a few nights a week spread over multiple months. I was gifted Torch Light 2 which was hack and slash and less RPG which I had fun playing and finished with multiple character types.
My son and I had a blast playing Portal 2 especially the co-op mode. We need to fire that up again for another play through. My wife had to keep the door to the computer room closed as we were laughing to hard for her to get any work done. We both have upgraded computers for this go round and it should be a really good time again. Sure, we will remember some of the tricks of the levels but there is a lot of timing involved and a lot of stupid ways to die. We need more co-op games.
We keep thinking computers will make our lives easier. They do remove some of the grunt work but they also make our lives harder. Keeping the wireless network up to snuff, adding new devices to the home network, print, scan, copy, collate, update drivers, new Android OS, new iOS, change the data plan, fix the NetFlix streaming issue, adjust the clock for DST and reboot you freaking car! Good thing I am in the tech field and can usually deal with the issues in a timely manner.
Wednesday, April 3, 2013
A handy Mac terminal command for getting IP without all the other junk of ifconfig
In a terminal window on a Mac you can type:
ifconfig
This will give you your IP address in the midst of a bunch of other stuff that is useful on occasion but usually not anything you care about.
If you type this:
ifconfig | grep "inet "
You will only see the lines related to your IP address which narrows things down a ton.
If you want to narrow it down a bit more you can do this:
ifconfig | grep "inet 192.168"
If you are on a 192.168 network (which you probably are if using WiFi) then the top item in the list will be your IP address. Of course you can substitute 192.168 for your network prefix.
As a final helper if you need your IP address a lot you can add the following to your ~/.bashrc file
alias ip="ifconfig | grep 'inet 192.168'"
Reload .bashrc via
source ~/.bashrc
Now every time you type:
ip
and press enter in a terminal window you will get your IP address without having your eyes dance all over the full output of ifconfig to find it.
If you forget what you set the alias to you can always type
alias
This will show the current alias list. I also have
alias ls="ls -G"
This shows my directory information in color.
ifconfig
This will give you your IP address in the midst of a bunch of other stuff that is useful on occasion but usually not anything you care about.
If you type this:
ifconfig | grep "inet "
You will only see the lines related to your IP address which narrows things down a ton.
If you want to narrow it down a bit more you can do this:
ifconfig | grep "inet 192.168"
If you are on a 192.168 network (which you probably are if using WiFi) then the top item in the list will be your IP address. Of course you can substitute 192.168 for your network prefix.
As a final helper if you need your IP address a lot you can add the following to your ~/.bashrc file
alias ip="ifconfig | grep 'inet 192.168'"
Reload .bashrc via
source ~/.bashrc
Now every time you type:
ip
and press enter in a terminal window you will get your IP address without having your eyes dance all over the full output of ifconfig to find it.
If you forget what you set the alias to you can always type
alias
This will show the current alias list. I also have
alias ls="ls -G"
This shows my directory information in color.
Wednesday, March 27, 2013
Life with a Mac a few weeks in
At my new job my development machine is a Mac. Having been a heavy windows user for the last bunch of years but using a Mac on occasion to do some iOS development the change has been pretty easy.
Initial setup took some time as did learning initial command line options. Really everything else is pretty much just like on a PC. You run Eclipse, Sublime Editor, Chrome, Outlook, Finder, Terminal window, Evernote, a music player and various file viewers for images and PDF files.
Once configured you just have to learn the proper shortcut keys to pull of frequent operations and off you go. This is a MacBook pro and I have a large second monitor. Everything is really fast.
I have been working on parsing XML and JSON files from security firms. Lots and lots of parsing of large files - will not HUGE but big as in 55+meg in size. I tried a number of JSON parsers and finally settled on Jackson as I needed to do streaming parsing and needed the ability to build simple JSON constructs on the fly as one provider uses JSON for request and response while the other two use standard HTTPS: requests with ?name=value params for requests and XML for responses.
Each API has its own set of oddities. Right now I have everything we need parsing and am using pagination to keep the response sizes to something reasonable. Next step will be hooking it all into the production code. Always good to iron out the bugs with simple test applications first.
At this point I really don't even think about being on a Mac. Sure the frame decorations are a bit different than in Windows but Eclipse looks and operates like Eclipse. Chrome is Chrome and sucked over all my settings, bookmarks and extensions.
If I need a program I can generally find it but there are a lot less free options than on the Windows. Most things cost something or there is one or two free versions. Most programs have already made a number of decisions for you. Unzip something? Put it right where you unzipped it from. Don't ask where you want to put it. Download something? Yep, already gonna do it to the one directory I have chosen. Not a huge deal. I move things around expo facto but there is a lot more hand holding.
I have been kind of surprised at home much time I have spent in Terminal. Using Mac Ports to install software, dealing with CURL and Python etc. Some of this is for testing the API and some has been to get around Finder limitations. Of course I do the same when in Windows. Not that a normal schmuck would do this, as a developer I tend to need to do odd things.
There has been a lot of learning. I have never used CURL, xml_grep or JSON streaming parsing before. I had limited exposure to Python and Tree based JSON parsing. None of the sample code I have gotten for the APIs has been written in Java meaning I must learn CURL, Python etc. to know enough to convert to our target language. I love to learn so it has been a lot of fun for me. Gives you an appreciation for the other languages and utilities.
Working with vendors keeps you on your toes too. Good to have 3 going at same time otherwise you are waiting on one to respond while you have nothing to do which is never good. Keep me busy. Also allows you to spot differences and similarities in the APIs making some coding go faster. If this was split between 3 people that knowledge would not be shared as easily. I have shared many classes between the projects.
Wednesday, March 20, 2013
Other Mac things I have learned
Show hidden files in any open / save dialog
As a programmer there are times you need to create files that start with a '.' (period / dot) such as .bash_profile. But what happens when you want to open that file to edit it? The standard Open Dialog does not show hidden or system files.Press Cmd+Shift+. (that is the period) when the dialog is open to show all those bonus files.
Change file association
I wanted to open JPG files in Picasa instead of Preview.Right click on a file and selecte "Get Info"
Change default application to open it with, then click the button [Change All]
Use XML_GREP to quickly pull data from XML files
There are times you are given an XML file and you want to quickly pull small pieces of information out of it. No need to write a full SAX or DOM parser to do that when you can use XML_GREP.
Sample of a record in the XML file
<REPORT_TEMPLATE_LIST><REPORT_TEMPLATE>
<ID>1537005</ID>
<TYPE>Auto</TYPE>
<TEMPLATE_TYPE>Scan</TEMPLATE_TYPE>
<TITLE><![CDATA[Executive Report]]></TITLE>
<LAST_UPDATE>2013-03-08T15:37:07Z</LAST_UPDATE>
<GLOBAL>1</GLOBAL>
</REPORT_TEMPLATE>
...
</REPORT_TEMPLATE_LIST>
Would show:
Executive Report
...
xml_grep --text_only --cond 'TITLE' --cond 'TYPE' assetDataReport.xml
Would show:
Auto
Executive Report
...
Remove the --text_only parameter if you want to see the TITLE tag information too.
How to install XML_GREP
cd XML-Twig-3.42 (use version downloaded here in place of 3.42)
perl Makefile.PL -y
make
make test
sudo make install
Format XML file (pretty print)
Let's say you have an XML file that is all one one line or has no indenting and you want to pretty print it. You can use xmllint which is already installed on you Mac to do that. Here I am converting Sample Report.xml to newfile.xml where Sample Report.xml is the original unformatted file and newfile.xml is the indented pretty version of the file.
xmllint --format --encode utf-8 -o newfile.xml 'Sample Report.xml'
xmllint --format --encode utf-8 -o newfile.xml 'Sample Report.xml'
Thursday, March 7, 2013
What I installed on my Mac at new job
Boy it has been a long and winding road to get the new MacBook Pro into a useful state. I realize Macs are meant to be super easy to use but that gets in the way of power users.
I have learned a lot of new terminal commands, where files reside on a Mac, naming conventions when reading Mac web pages and what not. I will try to share what I can before I forget it all and move on to the next thing.
I wanted to see hidden files. Executing this in terminal allows for that:
defaults write com.apple.finder AppleShowAllFiles TRUE
Change the TRUE to a FALSE to reverse the change.
~/ means your home directory when you are on a web site.
See the first five lines of the clipboard
pbpaste | head -n 5
Terminal is OK but I wanted a tabbed support as I use Console 2 on the PC. I installed iTerm to handle that situation. I also like a semi-transparent background on the terminal as I am generally monitoring things behind it too.
Finder is really not my cup of tea but I was able to get around most of my issues using xtraFinder. While this program is still in beta it fixes the major issues I have with Finder and it is free.
1) Tabs to open multiple directories instead of having multiple windows open on screen
2) Grouping folders first then files. Never understood why Finder does not have this option. Most of the time I am looking for a folder first then a file within second, I don't want to scroll way the heck down to find my Folder. I know I can sort by Kind to get them in group but that still puts them randomly somewhere grouped in a list.
I copied in my music files from a USB key from my Windows box. There was a stupid desktop.ini file left in each album directory. I wanted to delete all of them which on Windows is:
del desktop.ini /s
For the Mac I needed:
find . -name 'desktop.ini' -print -exec rm -fr {} \;
If you don't then you will get errors when attempting to install programs.
I have learned a lot of new terminal commands, where files reside on a Mac, naming conventions when reading Mac web pages and what not. I will try to share what I can before I forget it all and move on to the next thing.
I wanted to see hidden files. Executing this in terminal allows for that:
defaults write com.apple.finder AppleShowAllFiles TRUE
Change the TRUE to a FALSE to reverse the change.
~/ means your home directory when you are on a web site.
See the first five lines of the clipboard
pbpaste | head -n 5
Finder is really not my cup of tea but I was able to get around most of my issues using xtraFinder. While this program is still in beta it fixes the major issues I have with Finder and it is free.
1) Tabs to open multiple directories instead of having multiple windows open on screen
2) Grouping folders first then files. Never understood why Finder does not have this option. Most of the time I am looking for a folder first then a file within second, I don't want to scroll way the heck down to find my Folder. I know I can sort by Kind to get them in group but that still puts them randomly somewhere grouped in a list.
I copied in my music files from a USB key from my Windows box. There was a stupid desktop.ini file left in each album directory. I wanted to delete all of them which on Windows is:
del desktop.ini /s
For the Mac I needed:
find . -name 'desktop.ini' -print -exec rm -fr {} \;
I realize this is a more powerful command but this is a simple thing I need to do a lot and what I had to type to make it happen was not straight forward. I will have that command in my pocket from now on though.
I had to tweak my security settings to allow me to install things not from the Mac Store. Good to stop a normal user from doing this and it was a one time change to make me happy.
Mac Ports seems to be the way to go to install 3rd party products. You need to know the name of what you are installing. You get to type your password a lot as you are using SUDO commands left and right to accomplish this. It works and the web sites are really good at listing the port name you need to use for the install.
Just found you need to do this after installing Xcode and the Xcode command line tools:
sudo xcodebuild -license
Just found you need to do this after installing Xcode and the Xcode command line tools:
sudo xcodebuild -license
If you don't then you will get errors when attempting to install programs.
The company uses VMware Fusion so I had a license. I was able to quickly install Win 7 professional from DVD. Some of the production apps are written in C# thus the need for a VM to run them.
iTunes does not support common audio file formats so I used Adapter to convert music to MP3 so I can listen to it on my Sennheiser wireless headphones. I have had them for a couple of years now and still on first set of rechargeable batteries. While not perfect, an occasional hiccup due to interference, they have served me well.
At the prodding of the other developer who started on the same day as I did I installed Evernote. Nice app to type in random thoughts and to do lists as they hit my brain. I can see all that stuff on my Note II which makes it very easy to remember the crazy list of items I still need to bring in.
I use Sublime 2 as my text editor. I like it that I have the same editor on my PC at home as on the Mac. Some of the keystrokes are a bit different but I am getting used to that too.
All the other set up was configuring SQL settings, other environment variables, VPN, tweaks to various programs so they operate to my liking and doing web research on my first project and on tools they use here that I am not deeply familiar with yet.
I also need to find out coding style. Seems to be opposite of the last job no matter where I go. I am used to braces on same line but it appears that they are on separate line here. No big deal to me, configure Eclipse to do it that way and get on with life.
Do wish I had a docking station for the MacBook, unplugging everything to take it home for the night is a bit silly. Was so easy to undock the Lenovo laptop at old job and put it in bag with extra power supply. Not enough USB ports and they seem to trickle charge my phone. I have the external keyboard in one port and my phone in the other leaving zero for anything else.
Subscribe to:
Posts (Atom)