Tuesday, November 20, 2012

starting with GIT source control


Install git if you don't have it and verify version.

git --version
git version 1.7.10.2 (Apple Git-33)

git config --global user.name "Uki D. Lucas"
git config --global user.email "uki@CyberWalkAbout.com"


Trying to "Clone" remote repository


$ git clone "ssh://git@xyz.xyz.com/xyz/xyz.git" .
Cloning into '.'...



Warning: Permanently added the RSA host key for IP address '174.129.252.219' to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly


Add your public key to the external git repository

cat ~/.ssh/id_rsa.pub | pbcopy

Paste it in a notepad:

ssh-rsa AAAAB..........


If you don't have, you can create your public key using command: 
ssh-keygen -t rsa -C ""




If you added your RSA key successfully, try clone again:


uki:git_test uki$ git clone "ssh://zzz@zz.zzz.com/zzz/zzzz.git" .
Cloning into '.'...
remote: Counting objects: 166, done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 166 (delta 51), reused 166 (delta 51)
Receiving objects: 100% (166/166), 375.74 KiB | 467 KiB/s, done.
Resolving deltas: 100% (51/51), done.
uki:git_test uki$ 



Initialize Local Git Repo:



uki:~ uki$ cd /Users/uki/.../.../git/..._git_repo 
uki:local_git_repo uki$ git init
Initialized empty Git repository in /Users/uki/..._git_repo/.git/



For GitHub

curl -s -O http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain

uki:~ uki$ which git
/usr/bin/git

sudo mv git-credential-osxkeychain /usr/local/git/bin/

git credential-osxkeychain


Saturday, November 17, 2012

Maya 3D Tutorials


Video #1


02:17 shelves

view of selected object:
  • hot key: 1 - smoothness: polygons rough
  • hot key: 2 - smoothness: polygons medium
  • hot key: 3 - smoothness: polygons fine
  • hot key: 5 - view object
  • hot key: 6 - ?
  • hot key: 7 - lighting (or black when no lighting)
Scaling of the view:
  • Shift + 2 finger side-slide
03:54 selection tools:
  • hot key "q" Select tool
  • 04:17 lasso select tool
  • hot key "w" Move tool
  • 04:56 hot key "e" rotation tool
Panels:
  • Hypergraph





Hypergraph Panel

09:15 Hotbox


video #2



Hypergraph:
  • 01:26 input and output connections
  • 02:30 Parenting 
  • 03:20and Grouping - select objects + Control g

Video: Non Linear Bend Deformer Maya tutorial.

animations: deformation: http://www.youtube.com/watch?v=tI2zSsKGmQM&feature=related

breast: http://www.youtube.com/watch?v=EVlJKOKknR8&feature=relmfu


Tuesday, November 13, 2012

after the OS X v10.8.2 upgrade (Mountain Lion)

problem 1) SVN is missing

$ svn up
-bash: svn: command not found

Downloading svn subversion 1.6.17 here.


“Subversion-1.6.17-1_10.7.x.pkg” can’t be opened because it is from an unidentified developer.

Your security preferences allow installation of only apps from the Mac App Store and identified developers.


Searched App Store for svn.. nothing.


Log in with Apple Developer account here.

Download "Command Line Tools (OS X Mountain Lion)"


After installing the xcode452cltools10_86938211a.dmg package:

$ which svn
/usr/bin/svn

$ svn --version
svn, version 1.6.16 (r1073529)
   compiled Jul 20 2011, 13:37:48



It is still OLD svn, but it will do. :)





Saturday, September 15, 2012

Kies - CPU hog.

I am trying to concentrate and write my book, yet my Mac Pro laptop is thinking it has a jet engine powered by termo-nuclear reactor. In another words it is hot and noisy. I check running apps with Control-tab and see nothing suspicious running. I open Activity Monitor and I see that Kies it cranking at 30%, Force closing the offender instantly brings cool peace to my poor Mac.

Kies - a poorly written software that wants to be iTunes, but really it is only annoying.

/Applications/Utilities/Activity\ Monitor.app

Tuesday, September 4, 2012

Eclipse/Java: running out of memory


Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
or 

Unable to execute dex: Java heap space Java heap space 


If you need to increase the memory, find the eclipse.ini and change maximum Xmx memory (-Xmx512m):

find /Applications/ide/eclipse/Eclipse.app




open /Applications/ide/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini 





if you use a TextWrangler it will open it by default.


-startup
../../../plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.1.R36x_v20100810
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
512m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-XX:MaxPermSize=512m
-Xms40m
-Xmx1024m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts



NOTE:


Before you go and start increasing available memory please take a look at your code and refractor ANY creation of objects from inside loops, or at least heavy objects like database Statement used in the inserts:


Connection connection = MySqlHelpers.makeDbConnection(db, user, password);
Statement statement = connection.createStatement();


Just removing the Statement from the loop stabilized java process "Real Memory" footprint growth at 61 MB. Removing various Strings variables made much smaller difference.

I noticed that few System.out.println(...) does not really increase the memory footprint.



You can check Activity Monitor to see if you have java process that quickly builds up "Real Memory" from original 40 MB to 176 MB as it is the case here. Notice I still have 845 MB of Free memory, yet the process crashes around 177 MB.








Eclipse Juno set up for Android Development

1. Download "Eclipse IDE for Java EE Developers, 210 MB" (64 bit for Intel Mac) from:

http://www.eclipse.org/downloads/

You should get this file:

eclipse-jee-juno-macosx-cocoa-x86_64.tar.gz

2. Unzip it and copy the "eclipse" folder to your Applications (or other convenient place)
uki$ /Applications/ide/Juno/eclipse/Eclipse.app
3. Open eclipse folder and double-click on Eclipse.app



4. Set up the workspace to any folder where you want to keep your code. If you have multiple clients with many library projects it might be good to set them in separate workspaces.



SETTING SVN - SUBCLIPSE


1. Eclipse Help > Install New Software...


2. URL: http://subclipse.tigris.org/update_1.8.x



3. Select ALL and follow the wizard until Subclipse is installed.

You should be able at this point to open Window > Show View > other .. > SVN repositories
and add your repository.


INSTALLING Android Development Toolkit ADT


1. The same way Eclipse Help > Install New Software...
2. URL: https://dl-ssl.google.com/android/eclipse/
3. name: Android Development Tools (ADT) plugin
4. select all and finish the wizard installation
5. restart IDE

DOWNLOAD ANDROID PACKAGES


Open Android SDK Manager by clicking on Android icon with arrow pointing down


Select and download pretty much every version of SDK and Google APIs, you will need them all when developing any serious apps. This will take very long time.






Monday, August 13, 2012

Simple HTTP server using Python


1) Change to your www directory, a location of your files, include at least index.html:

$ cd /Users/uki/Python/web/SimpleHTTPServer/www 

2) Start server at port you want:

$ python -m SimpleHTTPServer 8080


3) Open: http://localhost:8080/

4) Monitor requests:


uki:www uki$ python -m SimpleHTTPServer 8080
Serving HTTP on 0.0.0.0 port 8080 ...
1.0.0.127.in-addr.arpa - - [13/Aug/2012 20:21:00] "GET / HTTP/1.1" 200 -
1.0.0.127.in-addr.arpa - - [13/Aug/2012 20:21:00] code 404, message File not found
1.0.0.127.in-addr.arpa - - [13/Aug/2012 20:21:00] "GET /favicon.ico HTTP/1.1" 404 -
1.0.0.127.in-addr.arpa - - [13/Aug/2012 20:21:12] "GET / HTTP/1.1" 200 -
1.0.0.127.in-addr.arpa - - [13/Aug/2012 20:21:12] code 404, message File not found
1.0.0.127.in-addr.arpa - - [13/Aug/2012 20:21:12] "GET /favicon.ico HTTP/1.1" 404 -

Transparent Button with an Icon


To create a button that is wide enough to press, but transparent, with the icon inside:     


 <ImageButton
                android:id="@+id/save"
                android:layout_width="100dip"
                android:layout_height="wrap_content"
                android:background="@null"
                android:contentDescription="@string/save_text"
                android:src="@drawable/save" />

Friday, August 10, 2012

svn: Commit failed


svn: Commit failed (details follow):
svn: Directory '/trunk/XYZ' is out of date

Solution:

Delete the project including the source files and check it out again.

Conversion to Dalvik format failed with error 1


UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/androidquery/AbstractAQuery;

[2012-08-09 22:41:36 - Yachts and Tall Ships] Dx 1 error; aborting
[2012-08-09 22:41:36 - Yachts and Tall Ships] Conversion to Dalvik format failed with error 1

Solution:

Once again, I looked thru all sub projects (library projects) and noticed that I have android-query-0.22.10.jar included twice in two library project libs folders.

I moved the jar to what we call lib_common/libs and referenced that jar from there everywhere I needed.

Do not include the same class name in different library projects, use a single common project were you keep your commonly used jars.


Wednesday, August 8, 2012

Format JSON in free TextWrangler

Here is an easy way to get formatted JSON in FREE TextWrangler:

Create text (Python) file:
~/Library/Application\ Support/TextWrangler/Text\ Filters/Format\ JSON.py




#!/usr/local/bin/python
import fileinput
import json
if __name__ == "__main__":
  text = ''
  for line in fileinput.input():
    text = text + ' ' + line.strip()    
  jsonObj = json.loads(text)  
  print json.dumps(jsonObj, sort_keys=True, indent=2) 



or shorter:


#!/usr/local/bin/python
import fileinput
import json
print json.dumps( json.loads(''.join([line.strip() for line in fileinput.input()])), sort_keys=True, indent=2)




Save it and use it!









It take time and effort to create tutorials, please support my efforts with a couple dollar donation, any amount will be greatly appreciated!

Saturday, July 28, 2012

Icon.png: failure while uploading to Google Play Market


After upload of APK to Google Market this is exception that Google returns:


The file is invalid: W/ResourceType( 2338): Failure getting entry for 0x7f0200cb (t=1 e=203) in package 0 (error -75) W/ResourceType( 2338): Failure getting entry for 0x7f0200cb (t=1 e=203) in package 0 (error -75) W/ResourceType( 2338): Failure getting entry for 0x7f0200cb (t=1 e=203) in package 0 (error -75) W/ResourceType( 2338): Failure getting entry for 0x7f0200cb (t=1 e=203) in package 0 (error -75) W/ResourceType( 2338): Failure getting entry for 0x7f0200cb (t=1 e=203) in package 0 (error -75) ERROR getting 'android:icon' attribute: attribute is not a string value


The fix was to put to each res/drawable[..] folder you have a copy of the icon.png

hdpi - 72x72
ldpi - 36x36
mdpi - 48x48
xhdpi- 96x96

Tuesday, July 10, 2012

How to change AT&T Samsung Galaxy Note Launcher Icons

You probably got frustrated with default application icons in Samsung Galaxy Note and like me at first you thought they cannot be changed:


Here are the steps how to change them:
  • from Home screen, click "Applications" icon on the RIGHT
  • click Menu button
  • select "Edit" (pencil) in the Menu
  • "Reorganize icons" pop-up will show, click "Switch"
  • drag icons in an out to set menu the way you want
  • click Menu button and select "Save" (diskette icon)

Optional steps:
  • from Home screen, click "Applications" icon on the RIGHT
  • click Menu button
  • select "View type"
  • I like "Alphabetical grid" view as any other makes apps hard to find




Thursday, July 5, 2012

Using Amazon Kindle for development in Eclipse

When you first connect Amazon Kindle device via USB it does not show in the Eclipse Devices listing.

You can quickly fix it by:

1) Modify adb_usb.ini file by adding 0x1949 to the bottom of vendor IDs

$ pico /Users/uki/.android/adb_usb.ini  (replace "uki" with your user name)

2) verify that you have made the change correctly:


$ more /Users/uki/.android/adb_usb.ini
# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0x1949
$

3) Reset ADB from Eclipse (drop-down arrow on the right hand side of  "Devices")



Device should be showing in "Devices" view now.

NOTE: after updating Eclipse Help -> "Check for Updates" you will have to repeat this procedure.



Wednesday, June 6, 2012

Android Error: java.lang.IllegalArgumentException: already added:

I have a project with several library projects, all compile correctly:


When I try to Run it as Android app, I get errors:

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/cyberwalkabout/gss/Worksheet;
[2012-06-06 20:54:42 - Food Trucks America] Dx at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
...
org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[2012-06-06 20:54:42 - Food Trucks America] Dx 108 errors; aborting
[2012-06-06 20:54:42 - Food Trucks America] Conversion to Dalvik format failed with error 1


SOLUTION:

I removed _src folders that were already included in my library projects. Project runs fine!




Wednesday, February 1, 2012

Google Contacts: "There was an error loading the contact"

I have been getting this error in Google Gmail Contacts:


"There was an error loading the contact"







I became very frustrated as it became impossible for me to manage my 2500+ contact list. After some research on Internet I found a relatively simple solution.


In Chrome browser 


1) select "Clear Browsing Data..."



2) and select "Empty the cache" from "the beginning of time"


Unfortunately, this did not fix the error entirely and I still get it. I hope Google fixes this problem soon. In the meanwhile I exported my contacts and imported them into Apple "Address Book" for management and safekeeping. Any suggestions?

Thursday, January 19, 2012

Developing on Amazon Kindle

To develop Android app on Kindle you have to set up your Mac's IDE environment first:


  • Install Android 2.3.4 tools in your Eclipse
  • Edit  ~/.android/adb_usb.ini
# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0x1949
0x000

  • Restart the ADB
uki:platform-tools uki$ adb kill-server
-bash: adb: command not found
uki:platform-tools uki$ ./adb kill-server
uki:platform-tools uki$ ./adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
uki:platform-tools uki$ ./adb devices
List of devices attached
75E8002600000001 device 

  • If Amazon Fire is in USB transfer mode, just quit it
At this point you should be able to start using Eclipse to develop your apps.


When trying to install MY Mapping app I am getting error:

[2012-01-19 10:27:31 - CouponCabin] Uploading XYZ.apk onto device '75E8002600000001'
[2012-01-19 10:27:31 - CouponCabin] Installing XYZ.apk...
[2012-01-19 10:27:32 - CouponCabin] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2012-01-19 10:27:32 - CouponCabin] Please check logcat output for more details.
[2012-01-19 10:27:32 - CouponCabin] Launch canceled!

01-19 10:27:32.394: E/PackageManager(1399): Package com.XYZ requires unavailable shared library com.google.android.maps; failing!



Yes, Amazon, you are failing indeed. Google Maps are not installed and you need to root your device to get them on:

http://www.pcworld.com/article/244474/how_to_install_the_android_market_on_your_kindle_fire.html

Kindle may be selling well, but it is far from a target platform.