Sunday, August 26, 2012

Gimp 2.8 gzdirect problem

This simple solution should fix the problem: "The procedure entry point gzdirect could not be located in the dynamic link library zlib1.dll."

To non-programmers, this error message simply means that your  zlib1.dll is outdated and needs to be replaced.

Somehow, most (if not all) Gimp plugins are using gzdirect which is supposed to be available on  zlib1.dll.

Try checking C:\Windows\System32\ and look for zlib1.dll then rename it to something else, maybe something like  zlib1.dll.old.

So where to get the latest one?  It's actually installed along with Gimp 2.8, but since you have another  zlib1.dll on your Windows' System32 path, Windows is trying to load that copy instead of the copy that Gimp 2.8 has.

Now, re-run Gimp 2.8.

Happy Gimping!

Friday, August 10, 2012

Jenkins: Executing binary from Jenkins script

If anyone of you are having the same problem as detailed on Jenkins forum about not being able to execute any Windows executables from Jenkins Job configuration.  The reason might be that slave-agent.jnlp is running as a service -- and for whatever reason, Windows won't let it run other executables.  To verify if it is the case, try uninstalling the slave-agent.jnlp service -- to do so, use Google -- then try running slave-agent.jnlp as is (meaning, right after executing the code below).

javaws http://yourjenkins.com/computer/yourslaveIP/slave-agent.jnlp

If that didn't solve the problem, sorry but I currently don't have any other solution.

Friday, June 22, 2012

Screencasting with Android

Well, if you are already using the Screencast Video Recorder, there's no use of reading this -- but I'm betting you're not because you stumbled onto this tutorial.

First of all, I am not related to the said screencasting app and I am in no way endorsing it.  I haven't even tried that app yet because 1.) it's not supported on my low-end Android device and 2.) it's a paid app -- yes, I'm cheap, sue me. :P

So this tutorial is about creating a screencast of your Android device using a free and open source tools called Android Screen Capture (or AShot) and FFmpeg.  I should warn you that this tutorial is not for the fainthearted -- it's gonna be messy through setting these tools up, and through creating of the screencast video itself.

I'm going to assume you know what we mean by screencast.  And I'm going to assume you are using Windows on your PC.

To start, download the tools:
AShot - http://sourceforge.net/projects/ashot/files/latest/download
FFmpeg - http://ffmpeg.zeranoe.com/builds/win32/shared/ffmpeg-20120620-git-5a90e55-win32-shared.7z

Here's a very detailed tutorial of setting-up AShot, which I'm very glad not to write over again.  It talks about downloading Android SDK, which AShot uses to capture images from your Android device.  One quick note, however, is the copying of the three files, namely:
  • adb.exe
  • AdbWinApi.dll
  • AdbWinUsbApi.dll
from this directory: C:\Program Files\Android\android-sdk\platform-tools

to this directory: C:\Program Files\Android\android-sdk\tools

Again, simply COPY the three files and not MOVE from one to the other.

Lots of troubleshooting is also discussed on that page, so go thoroughly through that page if AShot won't seem to work.



At this stage, I'm assuming you already got AShot working and you're seeing the same image in your PC as what's on your Android device as shown in the photo above.  You might have also tried screencapturing, and saw a tiny little problem -- (aside from the low FPS which is already answered many times on that page mentioned) instead of a video output, AShot outputs a series of PNGs.  Here's where FFmpeg comes in.

The FFmpeg binary download is just a zip file that can easily be extracted by 7zip or WinRAR -- though, I prefer 7zip.

I'm going to assume you extracted it on the root of your computer in such a way that ffmpeg.exe will be in this path: C:\ffmpeg\bin

And I'm also going to assume that you set AShot to output screenshots on this path: C:\ashot\

Now, all you have to do is open a Command Prompt and type this:
cd c:\ashot\
c:\ffmpeg\bin\ffmpeg -f image2 -i screenshot_%05d.png screencast.avi


Then using any movie player -- I use VLC media player by the way -- you can now view your screencast.avi.

Lastly, if you want to adjust the FPS of your AVI, try adding -framerate X when executing ffmpeg, where X is your desired FPS.

Happy screencasting!

~creek23

Monday, April 23, 2012

Android Development: Override the Device's Back button

When browsing a game's Options Menu and decided to not modify the current settings, you simply want to use your phone's Back button as, well, for going back to Main Menu.

But sadly, this is not the default behavior of that Back button. When you try to create your game, pressing that button will quit (umm... hide, rather) your app.

But don't lose hope. There's actually a way of changing that default behavior.

On your app's Activity class, add the following snippet.

@override
public void onBackPressed() {
  if (state == STATE_MAINMENU) {
     super.onBackPressed();
  } else {

     //do something else
  }
}


Of course, both state and STATE_MAINMENU has to be defined for the snippet to be usable. Also, whatever new behavior you want the Back button will have to do will be coded on the else part of the snippet, as indicated by do something else.

Saturday, April 21, 2012

Android Development: Disable Screen Rotation

By default, your app will run in Portrait mode.  And you might opt to keep it that way, but would also rotate to Landscape mode if the phone it handled sideways.

To keep it in Portrait mode, open your AndroidManifest.xml then add the highlighted text below.

<activity
   android:label="@string/app_name"
   android:name="HelloWorld"
   android:screenOrientation="portrait" >
   ...
< /activity>

But if you are creating an Android game, chances are you wanted to default it in Landscape and stay that way. If so, just change portrait to landscape.

Monday, March 26, 2012

Jenkins: Setting up Email Notification using Google SMTP

This is just about the same as the earlier post about Setting up Jenkins' Email Notification using Yahoo SMTP, only now it's for Google SMTP.

SMTP server - pop.gmail.com
Default user e-mail suffix - @gmail.com
Sender E-mail Address - Foobar CI <your.email@gmail.com>

Use SMTP Authentication - yes
User Name - your.email
Password - p******d

Use SSL - yes
SMTP Port - 995
Reply-To Address - noreply@gmail.com
Charset - UTF-8

To try if it's really working, type-in your email address and click Test Configuration, then you should be able to receive something like: "This is test email #1 sent from Jenkins"

Alternatively, you can also use smtp.gmail.com as SMTP server then use the SMTP port, 465. (Big thanks to Anthony Panozzo for sharing and Julio Carrettoni for confirming)

Jenkins: Setting up Email Notification using Yahoo SMTP

NOTE: This tutorial is for developers who are using Jenkins installed on their local server (with Internet Connectivity).

So you want to setup Jenkin's Email Notification but you don't have email server?

Assuming you have Yahoo Email account, that will work just fine. We just have to configure the Email Notification of Jenkins.

Under Manage Jenkins, go down to E-mail Notification then set these following information:
SMTP server - smtp.mail.yahoo.com
Default user e-mail suffix - @yahoo.com
Sender E-mail Address - Foobar CI <your.email@yahoo.com>

Use SMTP Authentication - yes
User Name - your.email
Password - p******d

Use SSL - yes
SMTP Port - 465
Reply-To Address - noreply@yahoo.com
Charset - UTF-8

Optionally, you might want to try if it's really working. Type-in your email address and click Test Configuration.

You should be able to receive something like: "This is test email #20 sent from Jenkins"

Below is what your configuration should look like.

Happy spamming! :P