2012-03-19

Post HTML code on Blogger

If you try to post examples of HTML code on Blogger, your post will break and you'll get a warning and everything will be ruined.

Don't be sad!  Use this little form I found.  It's right on the web.  Thanks Kevin Smith!  (I like your movies too.)


Just drop your code in there.  Hit "encode".  Then paste it into the "Compose" editor on Blogger.  Don't put it directly in the HTML editor or it will be even more broken.

Cheers!

2012-03-18

gnutella setup with firewall configuration and port forwarding Fedora 16


Just wanted to jot some notes down about setting up gnutella to go through the standard firewall on Fedora 16.

I was getting this little annoying message from an ugly red icon on the lower right bar of Gnutella:

You appear to be firewalled both TCP wise and UDP-wise...

The message is actually much longer than that, but that should do for search engine purposes, so that folks might find this little tut.

Let's change that message to read this:
People can connect to you using both TCP and UDP.  Push should work and you will be able to receive out-of-band results for your queries.
With a happy little yellow smiley face wearing sun-glasses...

{WARNING:  This method involves changing your connection to the internet through router settings and firewall changes.  You MUST have administrator privileges to execute this method.  I highly recommend either having a thorough knowledge of how to reconfigure your internet connection should something go wrong OR having another computer handy to look up trouble shooting information on the internet to FIX what got broke, should you make a mistake.  Obviously, you will NOT have the ability to look up help on this computer once you screw up your internet connection .  (NO, I do not recommend just using a phone, there would be far too much stuff to look up; it would take eons that way.)  Please proceed with caution, I've literally spent a week fixing a network at my parents that I screwed up many years ago, because I made just a mistake or two.  Learn from my mistake.}

I've got a Netgear router.  The method is very similar in LinkSys, Belkin, D-Link or any router I've ever worked with.  I logged into the router by typing 192.168.1.1 into the url field in Chrome.  This, I find, works for most router configurations.  You need to know your login and password, of course.  If you don't, then try admin/admin or password/password or admin/password.  Often routers are setup with one of those combinations as the default.  Also, if you can't figure out the password, you should be able to reset the router to default settings and THEN use one of those.  Look up the router through the manufacturer to find this default login.  Sometimes, depending on your isp, resetting your router could leave the router non-functional without contacting the isp and running some procedure, but, because I always choose the do-it-yourself method of installation, I have never had that problem.

Go to the Port Forwarding/Port Triggering tab/menu.
On Netgear, I chose, "add custom service".
I named the service "gnutella", just so I would know what it was.
Chose service type TCP/UDP.
Choose a start port between 49152-65534 (these are the recommended ranges)  I usually go with 55555 or 50505 or something really easy to remember like that.  It's up to you.
Make the end port the same.  In my case, also 55555.
For Server IP address I entered 192.186.1.70
Leave the first three digits the same.  The last one "70" in this case, is the only one you generally want to fiddle with.
When assigning static IP's I stay below 100, and I stay above 20.  DHCP (when the router dynamically assigns an IP to all the machines attached to it WHEN it discovers them) seems to always start with single digit numbers.  Going up from 1 as it finds new devices that wish to connect.

Now go to your Network Connections.  Either just click on the icon in the upper right and then click Network Settings, or go to Acitivities/Applications/Network Connections.
I'm wired, but it's pretty much the same for wireless.
Click "Configure..."
Select the IPv4 tab.
Click the "Add" button on the right.
Enter the Server IP address you chose above (192.168.1.70 in my case)
Netmask: 255.255.255.0
Gateway: 192.168.1.1
DNS servers: 8.8.8.8, 4.4.4.4 (the Google servers)
That should do it.  Now you have a static IP for that machine.  For THIS method you need it for the port forwarding to work.

Now that we've got the port forwarded, time to tell gnutella what it is:

Open gnutella.
Choose File/Preferences.
Under the "Network" tab at "Listen Port" enter 55555 ( or whatever you chose above ).
Network Protocol: IPv4 and IPv6.  Check box "Enable UDP" and "Enable DHT"
I went ahead and checked the box for Public hostname and entered a name, but this is somewhat irrelevant.
Leave the rest alone.
Now, the Fedora 16 part:
In the far upper left click on Activites and then choose Applications.  Find Firewall and open that.  You will be asked for your administrator password, so better know that.
Go to "Other Ports".
Click "Add" button on the right.
Select "User Defined".
Enter the port you chose (55555)
Select TCP.
Choose "Add" button again.
Select "User Defined">
Enter the port you chose (55555) yes the same one.
Select UDP.
Click Apply at the top.
That should do it!

Now I see a nice little smiley face at the bottom right of gnutella.

2012-03-15

Joomla 2.5 Add Field to Register Form

I highly recommend that you create a backup of your site before tampering with these files in the Joomla core!

In fact, I recommend that you go to my later post and add fields to your user forms the right way:  By creating an entirely separate user profile plugin.
Don't worry, I already did all the heavy lifting...


::WARNING::
Unfortunately, the method described below will be overwritten every time you update Joomla.  Apologies to anyone who used it without knowing this; I am learning as I go. Good news is that I went ahead and created an entire plugin (based on Joomla's stock profile plugin) called "Profile 7" to handle all this.  It will not be overwritten on updates.  I posted the whole thing on a later blog post.  So go there and use that.  I'm leaving this post up for reference and because it describes the process, which is important if you want to make your own custom fields.

UPDATE: APRIL 12, 2012:  The code below is tested for Joomla 2.5.4.
If you are using 2.5.3 or earlier version of Joomla and/or the profile plugin included with those versions, the "edit profile" page will not show any added fields.    In fact, it actually doesn't even show all of the fields that are included.  The register page does show the fields and the back end shows the fields.  It is only the edit profile page where they are not shown. One really messed up fact is that you can set a field to required on the administration panel and it will not show on the edit profile page, but when a user hits the submit button they will get an error telling them that field is required!  Thankfully, the Joomla team fixed this in 2.5.4.  You may run into issues if you try to implement this code in an earlier version.  I recommend you go ahead and backup your site and update!  Ok, back to the goods...

=======================================================================

This article from Joomla.org's official documentation was helpful, but it didn't tell this noob everything he needed to know.  All I needed to do was add a button, not create a whole new profile plugin.  However, the profile plugin that is included with Joomla has very similar code to the one in the article, so it was a nice frame of reference.  You will need FileZilla and full access to the administrator files on the server to make these changes.

The following are the files that will need changing:

/administrator/language/en-GB/en-GB.plg_user_profile.ini
/administrator/language/en-GB/en-GB.plg_user_profile.sys.ini
/plugins/user/profile/profile.xml
/plugins/user/profile/profile.php
/plugins/user/profile/profiles/profile.xml

Specifically, what I will be describing is adding a set of radio buttons to the register and profile edit forms so the user can choose to sign up for email updates.  Since Joomla 2.5 has a User Manager that allows you to create groups and sub-groups and manage them as well as mass send an email to any said group, I was able to make the profile plugin "talk to" Joomla and tell it to assign the user to a "subscriber" group which I create in the User Manager.

The first thing to do is to go into the Joomla User Manager.  Select the User Groups tab.  Select "New".
Enter the group title "subscriber".  Click the drop down arrow and select "registered" to make the new subscriber group a direct sub-group of "registered".  Now go to Users/Groups through the drop down menu.  Here you will see all of the groups listed in a hierarchical tree structure.  Find the new "subscriber" group.  In the last column on the right will be it's ID number.  In my case this number is 9.  BEWARE:  This is important, because this number is actually used in the code below to assign the user to the subscriber group.  If your group has a different number, then you will need to change this in the code below! 

The toughest part of this, for me, was tracking down those .ini files.  I had no idea that they would be filed under the administrator/language folder, but it makes perfect sense, because the files that we are changing there contain strings with labels, names and/or descriptions.  This allows support for multiple languages should this be necessary.

So I fired up FileZilla and pulled up the files for editing.

To the /plugins/user/profile/profile.xml right beneath the "dob" code I added:


<field
name="register-require_subscribe"
type="list"


label="PLG_USER_PROFILE_FIELD_SUBSCRIBE_LABEL"
description="PLG_USER_PROFILE_FIELD_SUBSCRIBE_DESC">
<option value="2">JOPTION_REQUIRED</option>
<option value="1">JOPTION_OPTIONAL</option>
<option value="0">JDISABLED</option>
</field>

That will add something like this on the register page on the front end:


It is also referenced to create the field in the registration configuration form in the administrator back end.

To the /plugins/user/profile/profile.xml right beneath the "dob" code I added:

<field
name="profile-require_subscribe"
type="list"


label="PLG_USER_PROFILE_FIELD_SUBSCRIBE_LABEL"
description="PLG_USER_PROFILE_FIELD_SUBSCRIBE_DESC">
<option value="2">JOPTION_REQUIRED</option>
<option value="1">JOPTION_OPTIONAL</option>
<option value="0">JDISABLED</option>
</field>

Which creates this on the "edit profile" page on the front end:


It is also referenced to create the field in the profile configuration form in the administrator back end.

To the /plugins/user/profile/profiles/profile.xml I added (again right below the "tos" code):


<field name="subscribe" type="radio" default="0" label="PLG_USER_PROFILE_FIELD_SUBSCRIBE_LABEL" description="PLG_USER_PROFILE_FIELD_SUBSCRIBE_DESC"> <option value="0">PLG_USER_PROFILE_OPTION_NO</option> <option value="1">PLG_USER_PROFILE_OPTION_YES</option> </field>

Which will help (along with the rest of the code) to give you this...

...when users simply view their profiles.

For the /plugins/user/profile/profile.php file, find this bit of code:

// Add the registration fields to the form.
JForm::addFormPath(dirname(__FILE__).'/profiles');
$form->loadFile('profile', false);

$fields = array(
'address1',
'address2',
'city',
'region',
'country',
'postal_code',
'phone',
'website',
'favoritebook',
'aboutme',
'tos',
'dob',
'subscribe',
);

When you find it, it won't have "'subscribe'," at the bottom.  Add it.

To the bottom of the /administrator/language/en-GB/en-GB.plg_user_profile.ini file I added:

PLG_USER_PROFILE_FIELD_SUBSCRIBE_DESC="Subscribe to get emails about updates"
PLG_USER_PROFILE_FIELD_SUBSCRIBE_LABEL="Receive Update Emails"
PLG_USER_PROFILE_OPTION_YES="YES"

The /administrator/language/en-GB/en-GB.plg_user_profile.sys.ini actually doesn't need any changes.  (unless you want to rename it in Swahili or something).

Now I just need to figure out how to USE that "YES" selection.  What I want to do is make it so that when someone selects "YES" they are actually assigning themselves a member of the "Subscriber" group, an Assigned User Group that I created in the User Manager: User Groups tab in the Joomla Administration back end.  This way I will be able to send emails to that group in bulk whenever there is an update - easy peazy.  Since it IS possible for the users to go from "Public" to "Registered" I'm hoping this is also possible.  It would save a lot of hassle to have this automated.
===================

Added the "subscribe" version of the code below to the profile.php file

if (!JHtml::isRegistered('users.url')) {
JHtml::register('users.url', array(__CLASS__, 'url'));
}
if (!JHtml::isRegistered('users.calendar')) {
JHtml::register('users.calendar', array(__CLASS__, 'calendar'));
}
if (!JHtml::isRegistered('users.tos')) {
JHtml::register('users.tos', array(__CLASS__, 'tos'));
}
if (!JHtml::isRegistered('users.subscribe')) {
JHtml::register('users.subscribe', array(__CLASS__, 'subscribe'));
}

Also added this public static function later in the profile.php file (showing the tos version for example and for position information):

public static function tos($value)
{
if ($value) {
return JText::_('JYES');
}
else {
return JText::_('JNO');
}
}
public static function subscribe($value)
{
if ($value) {
return JText::_('JYES');
}
else {
return JText::_('JNO');
}
}

-------------------
Okay I've cobbled together this code from reading through forums all over the interwebs.  Time to see if it works...

//import the following at the top of profile.php
jimport( 'joomla.user.helper' );


jimport( 'joomla.user.user');


jimport( 'joomla.utilities.arrayhelper' );

-------------
put this inside the onUserAfterSave function in profile.php
Please note that the $groupID variable is set to 9 in the code below, but this could vary.  Check Users/Groups page in the Joomla Administrator to find the right value.
-------------

function onUserAfterSave($data, $isNew, $result, $error)
{
$userId = JArrayHelper::getValue($data, 'id', 0, 'int');
//
//BEGIN CUSTOM CODE
//
//put this inside the onUserAfterSave function in profile.php
// This code will check if the user clicked the radio button for email
// updates by checking the 'subscribe' boolean in the data
// then assign the user to that group (group 9) if true
$groupID = 9; //9 is the value for the subscriber group in the ACL
//DEBUG code that forces if statement to come up true:
//$subscribeFlag = 1;
if ($userId && (isset($data['profile']['subscribe'])))
{
$subscribeFlag = ($data['profile']['subscribe']);
if (!($subscribeFlag == 0)) 
{
try
{
JUserHelper::addUserToGroup($userId, $groupID);
}
catch (JException $e)
{
$this->_subject->setError($e->getMessage());
return false;
}
}
else
{
try
{
JUserHelper::removeUserFromGroup($userId, $groupID);
}
catch (JException $e)
{
$this->_subject->setError($e->getMessage());
return false;
}
}
}
//END CUSTOM CODE
//

.......
(Note:  Originally I posted this code without the ability to select "no".  The removeUserFromGroup method of  the JUserHelper helps to accomplish this.)

Now, go to the Plugin Manager in Joomla open up User Profile and look under the Basic Options on the right.  Make sure Receive Update Emails is set to Required.

That should do it!  Now go to the register page on your site and register a pretend person.  Make sure you check the "Receive Update Emails" button!

Go to the User Manager in the Joomla Administration Back End, you should now see the new user you create has an additional group under the User Groups column:  Subscriber.

Later on, you can go to Mass Mail Users, in the User Menu, and simply select Subscriber and away goes the News Letter.  Good times.

I highly recommend making and keeping (in a safe memorable place) backups of all of the files to be altered in this process.

Here is a final copy of the entire profile.php file, complete with alterations:
profile.php


2012-03-13

Android Home Key disable / enable App Part 1


UPDATE:
I've decided to create an alternative "launcher" to solve this Home Key problem.  I am working on the code now.  The method I described here DOES disable the Home Key, but it does not allow you to enable it once again.  Being new to android, it seems fishy, and I'm guessing it is not good practice.  The method I am currently working on is more fitted to my needs anyway.  The launcher will take the place of the home screen and when someone hits the home key they will be asked to choose whether to use the standard launcher or my custom launcher.  At that point they will also be asked if they want to set that as the default.  Then the home key won't work inside my launcher and I will override the Back button to bring up a password screen, if they want to log out.  Once you get into a project you learn stuff and the whole project direction changes!



Home Key Lock/UnLock App:
---------------------------
DISCLAIMER:  I am currently trying to figure out how to get Blogger to accept my little html code snippets. It keeps giving me warnings and breaking the formatting. I will erase this message, of course, once I figure it out. 

 Okay a little project here.  Create a very simple app for Froyo 2.2 that will be able to toggle the functionality of the Home Key on and off, and some other things.  This is a very early exploratory exercise leading up to creating an educational app for Android pads.  I need for the children to be required to finish with a learning task before they will be given the opportunity to play their favorite games as a reward.  Meanwhile, they need to be locked into the learning game, so I need the Home key and Back key to be disabled.  That's the large goal.  Below is the simplified version broken into steps.

I'm using some code I got from this tutorial as a template:
http://hackaday.com/2010/07/19/android-development-101-part-2improved-hello-world/

I named it HelloWorldImproved.

Here is a list of the goals and some steps I need to take:

Find a way to lock out the Home and Back buttons altogether.  All entries will be made on the screen.  Some sort of override.

Add (GUI touchscreen) button that will close this app and open another.

Create a copy of the altered app.

In the copy app, change the function of the button so that it leads back to the original app.

Add a button on the app that releases the lock on the back button and home button and returns the funcionality of closing the app.  Actually, make this toggle that function and, when clicked, make it throw up a toast that says "Home Key Disabled" or "Home Key Enabled" depending.

Add a flag to the program that will not allow the change app button to work.

Add a button that flips the flag and releases the lock on the change app button.

Add a button that closes the app.  (This is merely to create code to close the app internally, rather then relying on the standard function of the Back key)

---------------

Okay, so first I made a copy of the whole HelloWorldImproved app that I created in the tutorial.  This left the primary activity named HelloWorldActivity which I didn't like, but after I figured out that it wouldn't be easy to change that, I just left it for now.

Then I made some changes so that I could add a second button.  At first I just wanted a button that did the same thing, but had different text on it ( and of course a separate id in the activity).
Step 1:
I opened the strings.xml (under res/values) and added this line:
<string name="press4app2">Press for App 2</string>

I put that line right under the Press Me! line.
Saved strings.xml

Step 2:
Opened up main.xml (under res/layout).  I copied the entire Button element and pasted the copy right below it.  I changed it so that it looked like this:
<Button
        android:id="@+id/switch1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/press4app2"
/>
As you can see, all I changed was the id (this is essentially the variable name or handle I can use over in the Java) and the text.  Now it refers to the string name that I created over in the strings.xml above, press4app2.

Step 3:
Then I opened up the main Java file, HelloWorldActivity.java.  I copied the entire OnClickListener mAddListener section.  The one with the comment "//Create an anonymous implementation of OnClickListener" at the top.  Be careful to get the one curly brace at the bottom.

I replaced mAddListener with mAddListener2 and I left everything else alone (for now), being that my first goal is merely to create a duplicate button that works.

Step 4:
Then back at the top of the HelloWorldActivity.java file...
We need to actually create the button.  So copy the four lines of code starting with "//Capture our button from layout"

  // Capture our button from layout
  Button button = (Button)findViewById(R.id.go);
  // Register the onClick listener with the implementation above
  button.setOnClickListener(mAddListener);

and paste them directly below themselves.  Now make them look like this:

  // Capture the switch button from layout
  Button switch1 = (Button)findViewById(R.id.switch1);
  // Register the onClick listener with switch1
  switch1.setOnClickListener(mAddListener2);

Changes?  Changed the comments to tell the truth.  Changed "Button button" to "Button swich1".  Changed "(R.id.button)" to "(R.id.switch1).  Changed button.setOnClickListener to switch1.setOnClickListener and changed that last parameter to mAddListener2 instead of mAddListener.

Step 5: (check for errors, make sure all is saved)
Make sure you save all of the files we changed:  main.xml, strings.xml and HelloWorldActivity.java.  Now run app and you will have two buttons that create toasts using the text you enter in the text field!  Woo hoo, it worked.

Now to create a button that will toggle the home key back on ( or back off again if hit twice )

Step 1:
edited the strings.xml file
Added this to the bottom of the file:
<string name="toggle_home">Toggle HomeKey ON-OFF</string>

Step 2:
Edited the main.xml file.  Added this under the last button:
<Button 
        android:id="@+id/toggleHome"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/toggle_home"
/>
Step 3:
Copied the OnClickListener and changed to mAddListener3

 // Create an anonymous implementation of OnClickListener
    private OnClickListener mAddListener3 = new OnClickListener()
    {
    public void onClick(View v)
    {
    long id = 0;
    // do something when the button is clicked
    try
    {
    helloName = (EditText)findViewById(R.id.helloName);
   
    Context context = getApplicationContext();
    CharSequence text = "Hello " + helloName.getText() + "!";
    int duration = Toast.LENGTH_LONG;
   
    Toast toast = Toast.makeText(context, text, duration);
    toast.show();
    }
    catch (Exception ex)
    {
    Context context = getApplicationContext();
    CharSequence text = ex.toString() + "ID = " + id;
    int duration = Toast.LENGTH_LONG;
   
    Toast toast = Toast.makeText(context, text, duration);
    toast.show();
    }
 
   
    }
    };

Step 4:
Edit Jave file and add onClickListener for the new button:
// Capture the toggleHome button from layout
        Button toggleHome = (Button)findViewById(R.id.toggleHome);
        // Register the onClick listener with switch1
        toggleHome.setOnClickListener(mAddListener3);

Step 5:  Check work, save, and see if it works.  (After that we will change what it doees to toggling that homeKey on/off)

Okay, that works.  Now to figure out how to give it the functionality I want.  I found this code laying around the interwebs...
-----------------------------------------------------
@Override
public void onAttachedToWindow()
{
   Log.i("TESTE", "onAttachedToWindow");
   this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
   super.onAttachedToWindow();
}

public boolean onKeyDown(int keyCode, KeyEvent event) {
   if (keyCode == KeyEvent.KEYCODE_HOME) {
       Log.i("TESTE", "BOTAO HOME");
       return true;
   }
   return super.onKeyDown(keyCode, event);  
}
------------------------
Let's see what I can do with it.

The first thing I did was to implement that code and shut down the Home Key, without yet worrying about creating a button to turn it on and off.  I needed to import some things to make his code work.  Namely:

import android.util.Log;
import java.lang.Object;
import android.view.WindowManager;
import android.view.KeyEvent;
import android.view.ViewGroup.LayoutParams;

I added all of those to the top of the HelloWorldActivity.java file, where you always find lots of imports.
How did I know what to import?  I didn't!  lol!

I went over to the Android SDK site, http://developer.android.com/sdk/index.html, and I opened the "Reference" tab at the top.  This will take you to http://developer.android.com/reference/packages.html

In the upper right is a search engine for the whole reference section.  My friend!

For each of the variables in the code I was adapting I looked up something relevant and kept reading until I found our what package(s) I needed to import.  I actually did a little google searching too when I came up empty, until I figured it all out.  Believe it or not, I got lucky this time and it only took about 15 minutes to track down the appropriate packages.

I keep doing this enough and I just might learn something...

So, with all those imported, all of my little red X's disappeared and I ran it.  It worked!  At least inside the Android Virtual Device, the Home key is no longer functional.

Next, I need to find a way to turn that code on or off.  I'm thinking I'll create a flag, a boolean that will determine if the code is executed or not.  Then I'll make the button toggle that flag on and off.

UPDATE:
I've decided to create an alternative "launcher" to solve this Home Key problem.  I am working on the code now.  The method I described here DOES disable the Home Key, but it does not allow you to enable it once again.  Being new to android, it seems fishy, and I'm guessing it is not good practice.  The method I am currently working on is more fitted to my needs anyway.  The launcher will take the place of the home screen and when someone hits the home key they will be asked to choose whether to use the standard launcher or my custom launcher.  At that point they will also be asked if they want to set that as the default.  Then the home key won't work inside my launcher and I will override the Back button to bring up a password screen, if they want to log out.  Once you get into a project you learn stuff and the whole project direction changes!

2012-01-23

Setup Android Development in Eclipse Indigo 3.7.1 on Fedora 16


Go to http://fedoraproject.org/wiki/HOWTO_Setup_Android_Development.  Mostly, I followed that, but I throw in some details, hints and problem solutions below.

When you edit the path variable.  Just open a terminal CD to your home folder (if you are not there already), type:

gedit .bash_profile

I should mention that when I downloaded the SDK I unzipped it into my home folder and then renamed it "SDK".  I like my names short and sweet when I foresee having to type them in a terminal a lot.

Add this to the bottom of the file:

PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH

PATH=$PATH:$HOME/bin:$HOME/SDK/tools:$HOME/SDK/platform-tools
export PATH

Under "Running Emulator" -
Note:  Hit "esc" to back out of the AVD manager.  And close the android SDK manager.

Back in the tutorial, when you get to running the emulator via the terminal, the part where you type:

./emulator -noaudio -avd android_dev1

be careful, because I noticed an error in the tutorial right there.  When creating the AVD they posted an image.  In that image the name of the AVD is "android_dev", but, as you see they then type "android_dev1" not "android_dev".  This could cause trouble.

When you get to -

Hello Fedora
Configure Android in Eclipse

NOW We have a real problem.
"Android" is supposed to be an item added to the menu under "Help/Preferences" when you update/install the Android Dev Tools with the SDK Manager.  Unfortunately, (again, possibly because of operator malfunction), this item did NOT appear in any Eclipse menus nor did anything related to Android appear anywhere inside Eclipse.  What you are saved from, if you read this in time, is literally days of searching for an answer to this, countless uninstalls/reinstalls, and much hair pulling and teeth grinding.  Android MUST be added to the menus.  Installing the ADT plugin in Eclipse is the entire point of this whole process, so luckily, Mike helped me find the solution.  It was INSANE, but we found it.

In order for the android menu items to show up we need to uninstall then install the Android Development plugins.  As mentioned, you cannot do this through "Help/Install New Software" which would be the logical solution.  If you try, you will get error messages saying that they are already installed (even though they are not functioning).  Even if you even completely uninstall Eclipse, these plugins will still claim to be "already installed."  A method I tried from 7 different angles without success.

Lucky for Fedora (because I was about to trash it and go back to Ubuntu), Mike, my brother, had the solution.

It turns out that Eclipse DOES have a way to uninstall these things.  The thing is they hid it behind a moving hedge inside the freaking Bat Cave.  To get to it you have to go under Help/About Eclipse Platform/Installation Details.  Yeah, that's right.  "About"!!!  The place you go to see what version you are using, copyright warnings, and company website information.  NOT where you would think to go to uninstall plugins.  BUT IT IS where you go to uninstall plugins.  So go to:

Help/About Eclipse Platform/Installation Details

And there they are!  Select all 4 android related items and click uninstall.

Restart Eclipse.  Go back to

Help/Install New Software

Go to the Android Plugin link you created.
Check box next to Developer Tools
Select Finish.

When done restart Eclipse and and voila!  On reboot a new dialog box popped right up in the front asking to either install the latest SDK's or point to existing ones.  I told it where the existing ones are:  home/ultrajones/SDK.  And just like that, Android listings have been added to the File, Window, and Window/Preferences menus.  We are ready to roll.

I decided to try and get the API Demos running on the HTC Inspire phone that GRQ is using as one of our dev phones.  Here is the process:

Plug the phone in via USB cable.

In the menu bar select:
File/New/Android Project

In dialog box select "Create project from existing sample".  Click next.

Select Android 2.2.  Click next.

Select ApiDemos and click Finish.
You will see it appear in the bar on the left.
Select it.  (hilight it in blue) and go to:

Run/Run Configurations...

I entered a "Name:" as Inspire (name of the phone, because we are creating a configuration to pull up whenever we are running anything on that particular device).

Click browse and select the newly created sample project.

Click Apply.
Click Run.

A dialog box pops down.  I see 2 selections.

"Choose a running Android device"
or
"Launch a new Android Virtual Device"

I chose HT14CT204610 because that is the phone I have plugged in.  With that hilighted...

Click OK.

Now I've got the ApiDemos (a whole slew of little sample apps) running on my phone!  Woo hoo! FINALLY!!!!

2012-01-12

Silly Site problem



I'm having the silliest problem with the site.  I can't seem to move the headerbar module position content just a tad to the left.  As seen in the second illustration, it is supposed to be there already.  Currently, there is this big empty space, circled in red above, where I can't put anything at all.  I've been all over the back end looking for a way, now I'm asking support...

..................time passes...............

well they helped me solve that, but now I have a more serious problem with the site.  Their is now a graphical glitch in the menu bar that came out of nowhere.  I don't think this has anything to do with the headerbar problem.  I did make a change to the main menu by merging the Capabilities and Features sub-menus, but I don't really see how this could be the cause of the glitch.  This is when I first noticed it however.


Now the button/slider is hanging over the edge of the "slot" (middle arrow), and the border of the menu bar slot has become square instead of rounded and is a lighter color of gray.  NOT GOOD.

2012-01-10

Building web site with YOOtheme Quantum

Well, I've been working with Joomla for almost a month now, and over 2 weeks with YOOtheme's Quantum theme.  I like it.  It's taking some learning, but things are looking good so far.  I'll be getting to the more complicated stuff soon and then we will see if I've got what it takes to make this thing fly.

Right now I'm wanting to incorporate a "Ken Burns effect" in my slideshow on the front page.  According to support over at YOOtheme, this should be available inside of the current release of Widgetkit - Widgetkit 1.0. It actually just came out of beta into full release TODAY.  Support directed me to update to the latest version.  I did that through FTP and can confirm that the new bonus styles are there, so I believe that I did that correctly.  Thing is, I'm still not seeing "Ken Burns effect" in the drop down menu for "effects" where I was told to look.  This direction doesn't really make sense to me anyway, because this effect would need more parameters to function, and it is not a transition effect really, but an effect that is executed on the image currently being displayed.  Anyway here is a snapshot that I am going to send over to support to help me get where I need to go.

I don't see anything of help there...

UPDATE:

It turned out that the effect was only available under the default slideshow setting.  The effect is generated randomly, whether it be zooming in or out and which direction it is panning in.  Nevertheless, I am using it and it really looks pretty good for what I'm doing.

2011-09-26

UnRoot LG Optimus V

I needed to find out how to remove the root my LG Optimus V.  Needed to UnRoot my phone and return it to stock.  Found this link.  Very helpful.  Needed to refer back to my own link (HERE) about rooting for a refresher, but all in all pretty straight forward.  Especially if you have made a backup of the stock rom, removing the root from your LG Optimus V should not be too difficult.

How to restore your Optimus V to almost original condition

2011-08-15

OpenSL ES for Android

I'm beginning to feel like an AD&D half-elf multi-class 3rd level character. All of my classes are level 1 or 2, and I've got like 7 classes... If you don't know what I mean, I'm not going to explain. (It's actually kinda cool in a way: It keeps things interesting.) Here's another one!

Time to become a sound guy!

**Think of this API (Application Programming Interface) as a huge soundboard in a recording studio. The computer screen is a window into the recording booth. The keywords and classes are buttons, dials, sliders and groups of all of the above situated on the interface/soundboard.

While learning the NDK for Android SDK, I am focusing on OpenSL ES for Android. Sound baby. I'll throw some notes up here. I'm not promising any organization and/or coherency.

This first link is titled, "OpenSL ES for Android". It refers specifically to using OpenSL ES within Android 2.3, the implementations and limitations thereof and other important knowledge and warnings.
http://mobilepearls.com/labs/native-android-api/opensles/index.html

{
Some extracted notes on the above link:
...Compiled and linked inline
You can link your audio content directly into the shared library, and then play it using an audio player with buffer queue data locator. This is most suitable for short PCM format clips. The example code uses this technique for the "Hello" and "Android" clips. The PCM data was converted to hex strings using a bin2c tool (not supplied).
...The PCM data format can be used with buffer queues only. Supported PCM playback configurations are 8-bit unsigned or 16-bit signed, mono or stereo, little endian byte ordering, and these sample rates: 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, or 48000 Hz. For recording, the supported configurations are device-dependent, however generally 16000 Hz mono 16-bit signed is usually available.
Note that the field samplesPerSec is actually in units of milliHz, despite the misleading name. To avoid accidentally using the wrong value, you should initialize this field using one of the symbolic constants defined for this purpose (such as SL_SAMPLINGRATE_44_1 etc.)

Platform configuration

...OpenSL ES for Android is designed for multi-threaded applications, and is thread-safe.
OpenSL ES for Android supports a single engine per application, and up to 32 objects. Available device memory and CPU may further restrict the usable number of objects.
slCreateEngine recognizes, but ignores, these engine options:
  • SL_ENGINEOPTION_THREADSAFE
  • SL_ENGINEOPTION_LOSSOFCONTROL

Planning for source compatibility [things to be very careful about]

...SL_DATAFORMAT_PCM does not permit the application to specify the representation of the data as signed integer, unsigned integer, or floating-point. The Android implementation assumes that 8-bit data is unsigned integer and 16-bit is signed integer. In addition, the field samplesPerSec is a misnomer, as the actual units are milliHz. These issues are expected to be addressed in the next OpenSL ES version, which will introduce a new extended PCM data format that permits the application to explicitly specify the representation, and corrects the field name. As this will be a new data format, and the current PCM data format will still be available (though deprecated), it should not require any immediate changes to your code.

...The Android simple buffer queue data locator and interface are identical to the OpenSL ES 1.0.1 buffer queue locator and interface, except that Android simple buffer queues may be used with both audio players and audio recorders, and are limited to PCM data format. [OpenSL ES 1.0.1 buffer queues are for audio players only, and are not restricted to PCM data format.]
For recording, the application should enqueue empty buffers. Upon notification of completion via a registered callback, the filled buffer is available for the application to read.
For playback there is no difference. But for future source code compatibility, we suggest that applications use Android simple buffer queues instead of OpenSL ES 1.0.1 buffer queues.

Objects and interface initialization

[Important to review this section extensively to understand how OpenSL operates. No room to paste it all here.]

[found these bits interesting]

...Callback handlers are called from internal non-application thread(s) which are not attached to the Dalvik virtual machine and thus are ineligible to use JNI...

Performance

As OpenSL ES is a native C API, non-Dalvik application threads which call OpenSL ES have no Dalvik-related overhead such as garbage collection pauses. However, there is no additional performance benefit to the use of OpenSL ES other than this. In particular, use of OpenSL ES does not result in lower audio latency, higher scheduling priority, etc. than what the platform generally provides. On the other hand, as the Android platform and specific device implementations continue to evolve, an OpenSL ES application can expect to benefit from any future system performance improvements.

}

Liar! Blasphemer!!!

I don't see the connection! Huh? What? If you can figure out how the above link is indirectly connected to an industrial metal group from the 80's and 90's you get a gold star.

The official Khronos site on OpenSL ES. (Non-specific to Android of course)
http://www.khronos.org/opensles/

NOTE:I must apologize that there isn't some sort of tutorial or sample code or anything here.  Unfortunately, I had to shift gears and run off and go a different direction for a while, so I never did really get into OpenSL ES any further (YET!).  Those links are all I've got.


Notes on Android NDK

Terms for the day:

JNI - The Java Native Interface (JNI) is a programming framework that enables Java code running in a Java Virtual Machine (JVM) to call and to be called[1] by native applications (programs specific to a hardware and operating system platform) and libraries written in other languages such as C, C++ and assembly.

Oh really? Well, what the hell does "native" mean in this context?

Native application - An application designed to run in the computer environment (machine language and OS) being referenced. The term is used to contrast a native application with an interpreted one such as a Java application that is not native to a single platform. The term may also be used to contrast a native application with an emulated application, which was originally written for a different platform.

Aha... so being that the code is targeted at a specific operating system (ie. Gingerbread) and hardware (eg. LG Optimus V running Gingerbread), there is speed to be gained! According to many sources, anywhere from 10x to 100x depending on the sitch.

Here's a link on the Android developers site about installing and getting started with the Android Native Development Tools. The NDK is a companion to the Android SDK, so all SDK installation and components should already be installed before moving forward with the NDK.

http://developer.android.com/sdk/ndk/index.html

I downloaded from this link http://dl.google.com/android/ndk/android-ndk-r6-linux-x86.tar.bz2 and then extracted into home/ultramanjones/android folder.

Read the Android NDK Overview (as instructed).

The documentation mentioned ARM CPUs... from Wiki:
"ARM is a 32-bit reduced instruction set computer (RISC) instruction set architecture (ISA) developed by ARM Holdings. It was known as the Advanced RISC Machine..."
and...
"The relative simplicity of ARM processors makes them suitable for low power applications. As a result, they have become dominant in the mobile and embedded electronics market..."

So this is why we're talking about this; ARM CPUs are in all the cell phones.

ADT - Android Development Tools is a plugin for the Eclipse IDE that is designed to give you a powerful, integrated environment in which to build Android applications.

Android makefile specification file:
file:///home/ultramanjones/android/android-ndk-r6/docs/ANDROID-MK.html