Monday, January 28, 2019

Is there anybody out there?

Planning to close this Blog as it has been ages since last updated and most things are old now, but checking if anyone still needs it ... let's see

Tuesday, May 19, 2015

Hello!

Let’s assume you have a complex performance issue on a couple of linux servers. Usually you may try using iostat to try to catch the issue when it’s happening and see which performance item is creating the bottleneck.

To catch the performance issue I’ll recommend to use iostat to send the info to a file and then process it. You can try something like this:

rightnow=$(date +%Y%m%d%H%M%S)
thishost=$(hostname)

sudo iostat -c -d -x -t -m  1 1200 > iostat.out.$thishost.$rightnow

egrep "^[sd].*" iostat.out.$thishost.$rightnow > iostat.out.$thishost.$rightnow.csv
head iostat.out.$thishost.$rightnow | grep "D" >head.csv
{ cat head.csv ; cat iostat.out.$thishost.$rightnow.csv ; } > iostat.out.$thishost.$rightnow.txt
sed 's/ \{1,\}/;/g' iostat.out.$thishost.$rightnow.txt >iostat.out.$thishost.$rightnow.csv

Now you have a file that can be opened using R.

I’ll give you a couple of examples that can be quite useful for analysis. This will assume you have two files: each one from a different host.

´´´ R
xx <- read.table(“/temp/wegalihs01.csv”, header=TRUE, sep=”;”, quote=”\”“, na.strings = “NA”, as.is = TRUE)
yy <- read.table(“/temp/wegalihs02.csv”, header=TRUE, sep=”;”, quote=”\”“, na.strings = “NA”, as.is = TRUE)

await1 <- xxawait < 1000 & xx$Device. == “dm-8”]
await1 <- await1[rep(1:length(await1))]

plot(as.vector(time(await1)), as.vector(await1), type = “l”)

await2 <- yyawait < 1000 & yy$Device. == “dm-8”]
await2 <- await2[rep(1:length(await2))]

plot(as.vector(time(await2)), as.vector(await2), type = “l”)

times1 <- ts(await1,freq=60*1)
times2 <- ts(await2,freq=60*1)

plot(stl(times, “periodic”))

par(mfrow=c(1,1))
plot(stl(times1, “periodic”)$”time.series”[,”trend”], col=”red”)

par(new=TRUE)

plot(stl(times2, “periodic”)$”time.series”[,”trend”], col=”blue”)

Check Reads & Writes

await1 <- xxDevice. == “dm-8”]
await1 <- await1[rep(1:length(await1))]

plot(as.vector(time(await1)), as.vector(await1), type = “l”)

await2 <- xxDevice. == “dm-8”]
await2 <- await2[rep(1:length(await2))]

plot(as.vector(time(await2)), as.vector(await2), type = “l”)

times1 <- ts(await1,freq=60*1)
times2 <- ts(await2,freq=60*1)

plot(stl(times, “periodic”))

par(mfrow=c(2,2))

plot(stl(times1, “periodic”)”time.series”[,”trend”], col=”blue”)

´´´

Monday, December 15, 2014

More bluemix!

I've been playing with Bluemix during the last few weeks and now I have a few interesting tips for you:

  • Always check the logs/staging_task.log. You can find interesting stuff when the Bluemix controller try to instantiate your app. There are a few things that are not quite well documented and may save your life. One example is on my next tip.
  • Add a start script into your package.json. Even when the application will start if you set up the manifest.yml, the Bluemix Controller needs this info to be able to instrument your app, which leads to my next tip. In the meantime, here you have a sample package.json with a start script:
{
  "name": "sample",
  "version": "0.1.0",
  "description": "sample",
  "main": "sample",
  "scripts": {
    "test": "echo \"Error: no test specified! Configure in package.json\" && exit 1",
    "start": "node app.js"
  },
  "dependencies": {    
    "express": "3.4.7",
    "jade": "1.1.4",
    "log4js": "^0.6.21",    
  },  
  "author": "",
  "license": "BSD",
  "readmeFilename": "README.md",
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-env": "^0.4.2",
    "grunt-git": "^0.3.2",
    "grunt-shell": "^1.1.1",
    "js-yaml": "^3.2.3"
  }
}
  • Using the IBM Monitoring and Analytics for Bluemix Add-On is free, so I highly recommend to use it. It may help you a lot to find some issues in your apps.
I'll keep adding more tips as I find them useful enough.

Thursday, October 2, 2014

Best practices to run GNU Octave in a Windows box

GNU Octave is a very interesting software to run math computations on your desktop. It's an open-source high-level interpreted language, primarily intended for numerical computations equivalent to Wolphram's MatLab
So, usually you will run this on a Linux box but if you're like me, who has a preference for Windows desktops, you may have a few issues running it. So here is a small recipe that may help:
Install Cygwin (you have to install this lovely piece of software even if you don't want to run Octave)
Choose at lease the following packages:
  • octave (and all the packages that you think you will want to use)
  • xorg-server
  • xinit
  • xterm

and let Cygwin setup to select all the dependencies for you.
After you've installed this you can open a Cygwin terminal and then run:

# X   
# export DISPLAY=:0.0  
# xterm 
# octave (inside xterm)
# sombrero(51) (inside octave)
This previous commands will:

  • Run the XServer
  • Let every X application to run on the local XServer that you've just started, you can add this into your ~/.bash_profile
  • Open a new terminal inside this XServer
  • Start Octave
  • Execute a beauty graph inside the XServer window

Enjoy you maths!

Monday, July 14, 2014

Using Android Studio with the Samsung Galaxy S4

Even when you think this should be easy to use, there are a couple of things you have to be aware of:


  • Install the corresponding Samsung USB Driver. You can click here to get it from the official Samsung Page.
  • Activate the hidden developer options on you S4 (or any Android 4.2+). Check this link for more info but basically you have to: 
  1. Go to Settings & About Device and scroll down to the Build Number. 
  2. Now, tap on your "Build Number" 7 (seven) times, and you should see a toast notification pop up saying "Developer mode has been enabled." 
  3. Back out of the About Device menu and you'll see Dev options back where it belongs, so you can turn on USB debugging and whatever else you want to.

Sunday, May 4, 2014

BlueMix + Android Development + IBM Mobile Data - First Steps

Trying to better understand some architecture patterns, I've tried to create my first sample application with IBM BlueMix to host the server side + Android Development to develop the client side + IBM Mobile Data to use as a foundation for the app.

Notice: I'm using the sample code found here as a start

While doing this I've found a couple of issues so here is a quick list of tips & tricks:

Issues with Application Id

At this point in time, properties.json is having precedence over the more specific code:
IBMBaaS.initializeSDK(context, "95569b05-5f16-421a-a9e4-xxxxxxx");

So bear this in mind and check that your properties.json has the appropriate information.
More info here

Issues with "strange" URLs being called

The IBMBaas API will call https://mobile.ng.bluemix.net/data/helo as part of its normal operation. I think you may be interested in this info as it is not yet document.

Issues regarding "cannot find symbol variable IBMBaaS" or some other

Not sure who is at fault here but I've had several issues with the ADT not being able to resolve symbols associated with the IBM libraries. Copying the libraries again nor restarting the ADT didn't work neither. I've found that calling Gradle to clean up the project solved the issues most of the times, so you may try that first before recreating the project.

More to come...

Friday, March 21, 2014

Trying Bluemix! - First steps

Bluemix (http://www.bluemix.net) is the new PaaS offering from IBM. Based on open-standards, it is a cloud-based platform for building, managing and running apps of all types (web, mobile, big data, new smart devices).

I've just tried to give it a shot and this is my recommended approach to make a sample run and have an understanding of some of the basics to create a larger app:

First of all you'll need CloudFoundry tools, which oyu can get from: http://docs.cloudfoundry.org/devguide/installcf/install-go-cli.html

Once you have this installed you can follow this sample here: http://www.ibm.com/developerworks/cloud/library/cl-bluemix-nodejs-app/

But you'll need to make some changes as that document has a couple of things that has changed since it was published:

git clone https://github.com/ibmjstart/bluemix-node-mysql-upload.git
cd bluemix-node-mysql-upload\app

"\Program Files (x86)\CloudFoundry\cf.exe" create-service mysql 100 mysql-node-upload

move manifest.yml.v5 manifest.yml

---
       

       
applications: #Reference http://docs.cloudfoundry.com/docs/using/deploying-apps/manifest.html

- name: whatevername #Application Name. Unique to the user's Space

  memory: 256M #The maximum memory to allocate to each application instance

  instances: 1 #The number of instances of the application to start

  --- url: pcolazurdo-test-${random-word}.${target-base} #deprecated, kept for temporary compatibility

  host: whatevername #Hostname for app routing. Unique to domain

  --- domain: ${target-base} #Bluemix Parent Domain Name

  path: . #Path to the application to be pushed

  command: node app.js #The command to use to start the application




       
 


"\Program Files (x86)\CloudFoundry\cf.exe" push runtime-name

After this you have to go to the console and assign the Mysql service to the Application Runtime and restart the Runtime

Tuesday, September 3, 2013

Playing with Vagrant - Fixing issues with Virtual Box

There is a confirmed bug in Oracle VM VirtualBox v.4.2.14 (and probably others) that stop you from being able to start newly created boxes with a not so nice error

Windows version


Console version:
Progress object failure: RPC_S_SERVER_UNAVAILABLE 0x800706BA

To fix this you need to  go to the directory where you virtual machine is and then create a SHA1 signature of every vmdk and ovf file in there. Something like this:
cd ~/.vagrant.d/boxes/BoxName/virtualbox  
openssl sha1 *.vmdk *.ovf > box.mf


More info at: https://github.com/mitchellh/vagrant/issues/1850
Hope it helps

Friday, April 5, 2013

Playing with Ruby on Windows --- Fixing SSL issues when running bundle install

If  you run bundle install and run into this message:
"Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/gems/mime-types-1.22.gem)
An error occured while installing mime-types (1.22), and Bundler cannot continue. Make sure that `gem install mime-types -v '1.22'` succeeds before bundling."

Where the gem name maybe different, it will be helpful to have a look at this solution:

Download the cacert.pem file from http://curl.haxx.se/ca/cacert.pem. Save this file to C:\dev\cacert.pem or whatever directory you can use for this.
Now make ruby aware of your certificate authority bundle by setting SSL_CERT_FILE. To set this in your current command prompt session, type:
set SSL_CERT_FILE=C:\dev\cacert.pem

More info at: https://gist.github.com/fnichol/867550
It worked like a charm for me!

Hope it helps

Monday, April 4, 2011

Humans: "The most remarkable species of all"

Seems like BBC One is launching a new documentary series which looks pretty interesting. But I've want to share the ad because it shows some very interesting stuff, so here it goes:



more info at: bbc.oc.uk/humanplanet