Friday, 12 December 2014

Sync shared Google calendars to BlackBerry Passport or BB10 device

Problem:

I have some Google calendars that were shared with me, however I cannot see them in my BlackBerry's calendar. How do I sync these shared calendars? As of now (December 2014) the official Google Calendar apps are not available on the Passport.

Solution:

  • Go to https://www.google.com/calendar/syncselect
  • Check any calendars that you want to sync
  • Go to the Passport/BB10 calendar and refresh (click menu button on bottom right, click refresh)
  • Wait for a few minutes until all events sync, they will show up then

Notes:

There have been other solutions online using third party apps or adding CalDAV accounts. However, for basic viewing needs the above solution seems to work. The CalDAV method is considered less secure by Google so it is not recommended.

This solution was tested in December 2014 to work using a BlackBerry Passport, OS version 10.3.0.908. Your results may vary using different OS versions, using different devices, or if Google changes their calendar in the future.

This was attempted in OS 7, however the shared calendars did not show up. Anyone out there have any luck with the older BB OS?

View full Google Calendar website with BlackBerry Passport

Problem:

How do I view the full Google Calendar website in my BlackBerry Passport's browser? When I go to calendar.google.com, Google brings me to the mobile version.

Solution:

Try the following URL: google.com/calendar/render

The site will show a dialog asking to confirm using the desktop version. If you click ok, the full calendar site should show up.

Notes:

Note that the full desktop site may not work fully or it may render slowly on mobile devices. It's a useful site to be able to log into however, as there are many options that can only be set using the full desktop site instead of the mobile site.

This solution was tested to work using the BlackBerry Passport, OS version 10.3.0.908, and the full Google Calendar site is accessible as of December 2014. Your mileage may vary using other versions and if Google decides to change Google Calendar in the future. Best of luck to you!

Monday, 29 September 2014

Test for shellshock bash bug vulnerability in OS X or Linux

Problem:

How do I quickly test if my computer is vulnerable to the shellshock Bash bug?

Solution:

One way to test the shellshock bug is to open a Terminal (in OS X, or any shell prompt in Linux, Cygwin, etc.), and try the following one-lined command:

x='() { :;}; echo VULNERABLE' bash -c :

If vulnerable, VULNERABLE should appear as part of the response. Otherwise if things are alright, you should get a response similar to the following:

bash: warning: x: ignoring function definition attempt
bash: error importing function definition for `x'

(Note that in some versions of fixed/patched bash shells, the above error won't show up but "VULNERABLE" will also not be printed to the terminal.)

Notes:

If you're unsure of any steps of the above instructions, see if you can find a friend who may be familiar with how to use bash shell and Terminal to try the above for you.

For more detail, check out the references below.

If your system happens to be vulnerable, and you're using Linux and don't know how to update your bash shell, try this post for instructions: http://linux.about.com/od/howtos/fl/How-To-Fix-The-BASH-Shellshock-Bug-On-Your-Linux-System.htm

NOTE: I won't be able to answer any questions about shellshock as I am not enough of an expert on this bug to comfortably respond. Sorry about that! I hope that this post still comes in handy to people out there.

References:

Friday, 12 September 2014

Unable to resolve superclass android.support.v4.app.FragmentActivity

Problem:

When trying to implement an Android app using the Facebook SDK (v3.18) I get an error similar to: Unable to resolve superclass of Lcom/facebook/samples/hellofacebook/HelloFacebookSampleActivity;

In the above example, HelloFacebookSampleActivity is a subclass of android.support.v4.app.FragmentActivity.

I have already added the android-support-v4.jar to my project (found in FacebookSDK/libs) and Eclipse ADT does not show any linker errors. However, whenever the app is compiled and run on a device it crashes immediately and gives the above error in the log.

Solution:

Try the following:

  • Right click on your project in Eclipse
  • Select: Build Path -> Configure Build Path
  • Select the "Order and Export" tab
  • Make sure that "android-support-v4.jar" is checked

When you try and run the project now, the app should hopefully be able to find the linked FragmentActivity from the now-included android-support-v4.jar.

References:

Thursday, 26 June 2014

Replaced ADT Eclipse and got errors such as "The type java.lang.Object cannot be resolved"

Problem:

I've installed the Juno version of the Eclipse-based ADT from the Google Android developers site in order to replace my outdated ADT. Now all of my existing android eclipse projects from my previous workspace have many errors such as "The type java.lang.Object cannot be resolved." and will not compile in the newly-installed ADT.

Steps to try:

The following steps fixed the issue on the author's system so they might be worth trying, (however it's not guaranteed that they will work):

  • Add any add-ons that may have been on your previous ADT build: http://developer.android.com/sdk/installing/adding-packages.html
  • For each project, make sure that each has a valid Android target and Java system library
    • Right click on the project folder and click "properties"
    • Click on "Android" from the list on the left
    • Check an android version in "Project Build Target"
    • Click on "Java Build Path"
    • Click the "Add Library..." button on the right
    • Select "JRE System Library"
    • Choose an appropriate JRE and press "OK"

Explanation of the above steps:

The errors such as "The type java.lang.Object cannot be resolved" are due to the new ADT being unable to find the system's java library (or the library that is installed is currently invalid.) Pointing your project to the appropriate Java JDK should fix this problem. However, this doesn't fix everything.

The next errors regarding android.* and related means that the old ADT pointed to an Android target that likely no longer exists after the upgrade. Pointing the project to the new Android target should fix the problem (or installing the old versions should also do the trick.)

Hopefully this helped, though it definitely won't be a complete solution for everyone out there. Best of luck to you!

Other notes:

Note that the fix above worked for an upgrade to ADT version 23 using Eclipse Juno under OS X 10.9.3. Your mileage will most likely vary with different versions. The above steps were only listed in case someone out there finds them helpful.

Tuesday, 24 June 2014

Android CalledFromWrongThreadException

Problem:

When I try to run functions such as myView.setText(myText), I get something similar to the following error: CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.

Solution:

Use Activity.runOnUiThread()

For instance, within your MainActivity (or whatever your activity class is named):


public void myFunctionCalledByAnotherThread() {
  // ... stuff ...

  runOnUiThread(new Runnable() {
    @Override
    public void run() {
      // ... code to modify ui such as View.setText() ...
    }
  });

  // ... other stuff ...
}


If you're outside of the Activity, you can also try getActivity():

getActivity().runOnUiThread( ... )

Explanation:

This error is caused by a thread other than the original thread that created the UI element/View, attempting to modify that view. An example of something that will cause this error is placing a setText() call into the run() function of a java TimerTask.

References:

Tuesday, 13 May 2014

'MySql server has gone away' with phpmyadmin using MAMP 2.0.5

Problem:

In phpmyadmin under MAMP 2.0.5, I get the error 'MySql server has gone away' when trying to import a large .sql file.

Solution:

There are a few things that can cause this issue, however one common one is the MySQL max packet size being too small. By default, it's set to about 1MB.

To fix this under MAMP 2.0.5, you can add a custom configuration setting to increase the max packet size by using the following instructions:

  • Stop MySQL Server (or stop all MAMP servers)
  • In /Applications/MAMP/conf/ create a my.cnf file if it does not exist
  • Add the following to the my.cnf file:
    [mysqld]
    max_allowed_packet = 64M
    
  • Save the my.cnf file
  • Restart MAMP servers

If this did not quite solve the problem, you can check out this Stack Overflow post for additional my.cnf configurations to try.

References:

Wednesday, 26 February 2014

In XCode 5, turn on 80-column line guide

Problem:

I am using XCode 5 and the coding style guide that I am using requires avoiding lines going past the 80-column mark, if possible.

How do I turn on the 80-column guide?

Solution:

  1. Go to the XCode Preferences (in the menu: XCode -> Preferences...)
  2. Go to the Text Editing tab
  3. Check "Page guide at column: "
  4. Change the number to 80, or to whatever column your required style guide needs