Archive for the 'Solutions' Category

Page 2 of 4

Running your app in the BlackBerry Simulator

The BlackBerry OS SDK currently only supports Flash Builder 4.0.1, not Flash Builder 4.0. When following steps described in BlackBerry’s own Getting Started Guide to launch your app in the simulator, users of Flash Builder 4.0 will get an internal error:

An internal error occurred during: "Launching [your project name]".
com.adobe.flexide.launching.air.ApolloLaunchConfiguration.getAIRProfile()Ljava/lang/String;

To overcome this, either download the 261MB patch from adobe, or use the command line packager which comes included with the BlackBerry OS SDK.

Using the command line packager

In essence, there is only one command that you’ll need, the syntax is:

blackberry-airpackager -package output_bar_file_name -installApp -launchApp
project_name-app.xml project_name.swf any_other_project_files
-device IP_address

What you’ll need: your project name, your BlackBerry simulator’s IP address, the .swf of your project which is compiled by Flash Builder using the normal tools (Project->Build Project or export release build). And remember the output_bar_file_name must end with the extension .bar. If you forget this, however, the error describes it quite plainly to you. For me, a working command looks like (where “AirTest” is my project name):

blackberry-airpackager -package AirTest.bar -installApp -launchApp AirTest-app.xml AirTest.swf -device 192.168.92.128

(If you are not familiar with running commands in windows, you need to add the path to blackberry-airpackager.bat in your system’s “path” environment variable.)

Do I have to run that manually everytime?

Fortunately, you don’t. The command can be configured as a builder in Flash Builder 4.

  1. Go to Project->properties, and under Builders, click on the “New” button to add a new builder. Select type Program, give a name to the builder (any will do, I named mine “BBLauncher”).
  2. Enter the path to your blackberry-airpackager.bat in the location field. Mine was:

    D:\Program Files\Adobe\Adobe Flash Builder 4\sdks\blackberry-tablet-sdk-0.9.0\bin\blackberry-airpackager.bat

  3. Enter the path of your project in the working directory (the folder where you find your main .as file, likely your current “src” directory).
  4. And Lastly, in Arguments, enter the options of the command:

    -package AirTest.bar -installApp -launchApp AirTest-app.xml AirTest.swf -device 192.168.92.128

Move this builder to after “Flex” and “AIR application.xml Builder”, and you are done. From now on you can launch the app in the simulator by doing a Project->Build project.

Posts that helped me: http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/Getting-Internal-Error-When-Attempting-to-Debug/td-p/621952/page/2

Installing BlackBerry Tablet OS SDK for Adobe AIR

Users of 64bit windows might get frustrated installing the new BlackBerry Tablet OS SDK if you are not using the 32bit Java Development Kit (JDK). When you run the .exe from BlackBerry, an error claims that “Win64 not supported. The author of the package you are installing did not include support for this platform.” The solution is trivial:

Unzip “BlackBerryTabletSDK-Air-Installer-0.9.0-Win.exe” and you should see 2 folders, “InstallerData” and “Windows”. Go into the Windows folder and find the .lax file.

Open the file in a text editor and change this line

lax.nl.current.vm=

to

lax.nl.current.vm=[your path to java.exe]

If you are not sure where is your JDK installation, check your C:/Program Files (x86)/Java folder for a folder named like jdkx.x.x_xx. Open it and look for the bin folder inside, your java.exe should be inside. For example, my path would be:

lax.nl.current.vm=C:/Program Files (x86)/Java/jdk1.6.0_22/bin/java.exe

Save the file and run the .exe in the same folder (BlackBerryTabletSDK-Air-Installer-0.9.0.201010221500.exe) to start the installation.

If you do not have your JDK yet, get it at http://www.oracle.com/technetwork/java/javase/downloads/index.html

Image not showing on Facebook Share

Apparently, Facebook doesn’t like .png images. When I tried to defined a png in the open graph properties “og:image”, the loading icon in the share window goes on for awhile before disappearing entirely. Fix: use a .jpg instead.

As advised on facebook docs: og:image – An image URL which should represent your object within the graph. The image must be at least 50px by 50px and have a maximum aspect ratio of 3:1.

Also, consider using the handy linter utility at http://developers.facebook.com/tools/lint/ to check the meta data of your page.

Joomla: TinyMCE is screwing up RokStories

RokStories is an easy way to add those rotating images on your joomla installation. Making them work, however, might require some tinkering. By default, the TinyMCE content editor modifies your html for its own purposes, and this screws up RokStories as it cannot recognize the images in your article if there are foreign attributes such as mce_src in the <img alt=”" /> tag. Editing the html source (with the TinyMCS Source editor) will not solve the problem as the extra attributes are inserted once you go back to the editor and save.

A quick way to overcome this is to temporary disable TinyMCE and use a plain text editor, removing unknown attributes and making sure the url to the images are relative. Other points to take note if its still not working:

  1. Remove any height and width definitions.
  2. Shift the src attribute to the front (<img src=”…” alt=”…” /> instead of <img alt=”…” src=”…” />)
  3. Remove any instances of <div></div>
  4. Add a readmore tag to separate the text content from the image.

Tutorial from Rocket Theme: http://www.rockettheme.com/forum/index.php?f=18&t=82376&p=420867&rb_v=viewtopic

Joomla: Template parameter file is not writable

While working with joomla themes, one might come across this problem of the template parameter file not being writable. You may have tried to change the permission of params.ini to 0755, but somehow the permission is reset to 0555 everytime you save your changes. What could be the problem?

Seems like the answer lies in the com_template core component. Open the file ~/administrator/components/com_template/controller.php and search for this line “Could not make the template parameter file unwritable”. You’ll see that this component is actively reseting the permission to 0555 with this code:


if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) {
JError::raiseNotice('SOME_ERROR_CODE', JText::_('Could not make the template parameter file unwritable'));
}

So the solution becomes straight forward – change the ’0555′ to ’0755′. Do not worry about security concerns as you are only granting write permission to the owner.

Is your wordpress installation safe?

An interesting article discussing the common ways hackers can inject code into a clean wordpress site.

http://ottopress.com/2009/hacked-wordpress-backdoors/

Move EBS AMI’s across regions

Was trying out an instance in the Asia-Pac (Singapore) region but realize I can’t simply move my AMI from the EU region here. Fortunately I found the guides below for a potential solution to this problem. Keeping them here for my own future reference.

Summary:

http://citizen428.net/?p=420

Step by step:

http://blog.ibd.com/scalable-deployment/copy-an-ebs-ami-image-to-another-amazon-ec2-region/

Installing XDebug on Virtualmin

XDebug helps you debug or profile your php code. It is useful for complex sites where it is not feasible to read each line of source to determine where you should start optimizing (especially if those are not your own code, as in the case of contributed extensions). One point to note is that XDebug does not output in a human readable way, you need to use tools like kcachegrind to parse the output to gather information from it.

To install with pecl:
pecl install xdebug

You can craft your own .ini, or you can get a default (albeit unsupported) xdebug.ini from http://gggeek.altervista.org/2007/11/26/the-completely-unofficial-xdebugini/ and place it in /etc/php.d along with the ini’s of other modules.

Important directives:
zend_extension="/usr/lib/php5/20060613/xdebug.so" <– to enable this module, but set the path to your own path to xdebug.so. (use find -name xdebug.so to locate it)
xdebug.profiler_enable=1 to enable the profiller
xdebug.profiler_output_dir is the output directory for the logs. You can leave it as the default /tmp directory

restart apache

node-view-[viewname].tpl.php not working

If you are using row style: node in your view, its recommended that you use the node-view–[viewname].tpl.php to theme your output instead of views-view-row-node–[viewname].tpl.php.

However, you must make sure node.tpl.php exists in your theme (or subtheme) in order for node-view-* to be picked up by Drupal.

Custom content type not showing up?

You’ve created a custom drupal module to define a content type, its showing up in the create content menu, but its not showing up in the admin/content/type menu. What could be wrong?

Check that you have declared the [module_name]_form() function in your .module file.

Function header:

function [module_name]_form($form_state)

Note: if its not even in the create content menu, you need the [module_name]_node_info() function.