Writing Portable HTML5 Server Side Events Applications using the Atmosphere Framework

6312

The Atmosphere Framework easily allow the creation of HTML5 Server Side Events (SSE). Better, any existing Servlet based application can add SSE support without any changes to their existing application.

HTML5 Server Side Events (SSE) are getting more and more adopted and support for it starts to appear. As an example,  the GlassFish Application Server recently added support for it,  the upcoming release of the Jersey Framework is also adding some sort of support, and framework like jQuery-Socket has sample supporting SSE as well. Both GlassFish and Jersey suffer major issues: First, you need to use non portable API to start using SSE (will only work in GlassFish or Jersey) and second, they expose special API to support SSE, which is a major mistake in my opinion. Just take a look at how simple it can be to implement SSE using the jQuery-Socket sample. Why would you use heavyweight…

View original post 681 more words

Micro Benchmarking with JMH: Measure, don’t guess!

Antonio's Blog

I’m sure you’ve all heard that assigning a variable to null helps the Garbage Collector, or not declaring a method final improves in lining…. But what you also know is that JVMs have evolved drastically and what was true yesterday may not be true today. So, how do we know that our code performs? Well, we don’t, because we are not supposed to guess what the JVM does… we just measure!

Measure, don’t guess!

As my friend Kirk Pepperdine once said, “Measure, don’t guess“. We’ve all faced performance problems in our projects and were asked to tune random bits in our source code… hoping that performance will get improved. Instead, we should setup a stable performance environment (operating system, JVM, application server, database…), measure continuously, set some performance goals… then, take action when our goals are not achieved. Continuous delivery, continuous testing… is one thing, but continuous measuring is another step.

Anyway…

View original post 816 more words

GNOME 3.6: GNOME Online Accounts and Google two-factor authentication

Kparal's Fedora Blog

goa-panel In GNOME 3.4 (Fedora 17), GNOME Online Accounts (GOA) worked great with Google two-factor authentication (you really should enable that, if you value your data). In GNOME 3.6 (Fedora 18) it works no more, and it might be fixed in GNOME 3.8. When developers break some existing functionality for the sake of “progress”, but don’t bother fixing it or providing an alternative way before an official release, I always feel a bit… disenchanted.

Fortunately you can work around the broken code.

  1. Open Seahorse, filter your passwords for “GOA”, you should see one or two items of “Gnome Online Accounts password” type. Delete them.
  2. Re-login to Gnome session.
  3. Open Online Accounts and log in to your Google account. It will fail.
  4. Create an application-specific password for your Google account in the web browser.
  5. Open Seahorse, filter your password for “GOA”, you should see a single item. Open it and display…

View original post 84 more words

How to fix postgresql – ‘could not create shared memory segment: Invalid argument (shmget) ‘ error?

I recently updated my Postgresql’s ‘max_connections’ to 450 ( in postgresql.conf) which makes my postgresql server to fail during start-up :


FATAL: could not create shared memory segment: Invalid argument
DETAIL: Failed system call was shmget(key=5432001, size=35274752, 03600).
HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can ...currently 454).
If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the reque...s called for.
The PostgreSQL documentation contains more information about shared memory configuration.
[FAILED]

This is because of your shared memory.

1) Check your maximum shared memory :
$ sudo cat /proc/sys/kernel/shmmax
33554432

You need to increase the shared memory to fix this.

2) To fix it temporarily, run this command :
$ sudo sysctl -w kernel.shmmax=134217728

3) To fix this permenantly, set this in your configuration:
$ sudo vi /etc/sysctl.conf
kernel.shmmax = 134217728

4) Now start your pgsql server, It will work.

Enabling Broadcom Wireless driver in Fedora

[[email protected] ~]$ lspci -vnn | grep 14e4
02:00.0 Network controller [0280]: Broadcom Corporation BCM4312 802.11b/g LP-PHY [14e4:4315] (rev 01)

System Log :
[18.972382] b43-phy0: Broadcom 4312 WLAN found (core revision 15)
[ 18.974202] cfg80211: World regulatory domain updated:
[ 18.974205] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[ 18.974208] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 18.974210] cfg80211: (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[ 18.974212] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[ 18.974215] cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 18.974217] cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 18.979359] input: HP WMI hotkeys as /devices/virtual/input/input12
[ 18.997954] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[ 18.998141] Registered led device: b43-phy0::tx
[ 18.998159] Registered led device: b43-phy0::rx
[ 18.998177] Registered led device: b43-phy0::radio
[ 18.998190] Broadcom 43xx driver loaded [ Features: PMNLS ]
.....
[ 23.261059] b43-phy0 ERROR: Firmware file "b43/ucode15.fw" not found
[ 23.261063] b43-phy0 ERROR: Firmware file "b43-open/ucode15.fw" not found
[ 23.261065] b43-phy0 ERROR: You must go to http://wireless.kernel.org/en/users/Drivers/b43#devicefirmware and download the correct firmware for this driver version. Please carefully read all instructions on this website.
[ 23.278668] r8169 0000:03:00.0: p3p1: link down
[ 23.279031] ADDRCONF(NETDEV_UP): p3p1: link is not ready
[ 23.297889] 8021q: 802.1Q VLAN Support v1.8
[ 26.179007] r8169 0000:03:00.0: p3p1: link up
[ 26.179300] ADDRCONF(NETDEV_CHANGE): p3p1: link becomes ready

My kernel version : 3.1.0-7.fc16.i686

1) Install b43-fwcutter and broadcom-wl

2) Download and extract the firmware from “http://mirror2.openwrt.org/sources/broadcom-wl-5.10.56.27.3_mipsel.tar.bz2”

3) sudo b43-fwcutter -w “/lib/firmware/” ~/broadcom-wl-5.10.56.27.3/driver/wl_apsta/wl_prebuilt.o

After this, your firmware is loaded automatically.

Refer this : http://wireless.kernel.org/en/users/Drivers/b43#devicefirmware

Wireless Issue with Thinkpad E420 in Fedora

When switching ON the Wireless on Fedora 16 (Lenova ThinkPad E420) with RealTek WiFi Adapter, it’ll automatically gone back to OFF (Inactive) state.

Exact Log message from /var/messages :


Dec 30 14:51:26 fedora NetworkManager[886]: (wlan0): bringing up device.
Dec 30 14:51:26 fedora NetworkManager[886]: NetworkManager[886]: (wlan0): bringing up device.
Dec 30 14:51:26 fedora kernel: [ 6147.716574] rtl8192c_common: Loading firmware file rtlwifi/rtl8192cfw.bin
Dec 30 14:51:27 fedora kernel: [ 6148.061711] ADDRCONF(NETDEV_UP): wlan0: link is not ready
Dec 30 14:51:27 fedora NetworkManager[886]: NetworkManager[886]: WiFi hardware radio set enabled
Dec 30 14:51:27 fedora NetworkManager[886]: WiFi hardware radio set enabled
Dec 30 14:51:27 fedora NetworkManager[886]: WiFi now enabled by radio killswitch
Dec 30 14:51:27 fedora NetworkManager[886]: NetworkManager[886]: WiFi now enabled by radio killswitch
Dec 30 14:51:27 fedora NetworkManager[886]: (wlan0): supplicant interface state: starting -> ready
Dec 30 14:51:27 fedora NetworkManager[886]: (wlan0): device state change: unavailable -> disconnected (reason 'supplicant-available') [20 30 42]
Dec 30 14:51:27 fedora NetworkManager[886]: NetworkManager[886]: (wlan0): supplicant interface state: starting -> ready
Dec 30 14:51:27 fedora NetworkManager[886]: NetworkManager[886]: (wlan0): device state change: unavailable -> disconnected (reason 'supplicant-available') [20 30 42]
Dec 30 14:51:27 fedora NetworkManager[886]: (wlan0): supplicant interface state: ready -> inactive
Dec 30 14:51:27 fedora NetworkManager[886]: NetworkManager[886]: (wlan0): supplicant interface state: ready -> inactive
Dec 30 14:51:28 fedora NetworkManager[886]: WiFi now disabled by radio killswitch
Dec 30 14:51:28 fedora NetworkManager[886]: (wlan0): device state change: disconnected -> unavailable (reason 'none') [30 20 0]
Dec 30 14:51:28 fedora NetworkManager[886]: (wlan0): deactivating device (reason 'none') [0]
Dec 30 14:51:28 fedora NetworkManager[886]: NetworkManager[886]: WiFi now disabled by radio killswitch
Dec 30 14:51:28 fedora NetworkManager[886]: NetworkManager[886]: (wlan0): device state change: disconnected -> unavailable (reason 'none') [30 20 0]
Dec 30 14:51:28 fedora NetworkManager[886]: NetworkManager[886]: (wlan0): deactivating device (reason 'none') [0]
Dec 30 14:51:28 fedora NetworkManager[886]: Policy set 'Wired connection 1' (p1p1) as default for IPv4 routing and DNS.
Dec 30 14:51:28 fedora NetworkManager[886]: NetworkManager[886]: Policy set 'Wired connection 1' (p1p1) as default for IPv4 routing and DNS.
Dec 30 14:51:28 fedora NetworkManager[886]: Policy set 'Wired connection 1' (p1p1) as default for IPv4 routing and DNS.
Dec 30 14:51:28 fedora NetworkManager[886]: NetworkManager[886]: Policy set 'Wired connection 1' (p1p1) as default for IPv4 routing and DNS.
Dec 30 14:51:28 fedora NetworkManager[886]: (wlan0): taking down device.
Dec 30 14:51:28 fedora NetworkManager[886]: NetworkManager[886]: (wlan0): taking down device.
Dec 30 14:51:28 fedora lldpad[956]: l2_packet_receive - recvfrom: Network is down.

Check the state of the rfkill switches (WiFi switch) :

[[email protected] ~]$ rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
Soft blocked: yes
Hard blocked: no
3: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
4: acer-wireless: Wireless LAN
Soft blocked: yes
Hard blocked: no

Then you need to add the acer-wmi to the blacklist to clear this problem (soft blocked state).

To check whether this solution works or not, please run this :

sudo modprobe -r acer_wmi

If you got the wireless networks back, then you can add this following line to the /etc/modprobe.d/blacklist.conf file :

blacklist acer_wmi

This will permanently solve the wireless problem after a reboot.

Starting Android Development in Fedora

Install the Eclipse from Fedora default yum repository

yum install eclipse-jdt

To install Android ADT plugin, you need eclipse-wst, eclipse-emf and few other packages.

Easiest method is to configure/enable the eclipse update channel and then install that ADT plugin,

Click the ‘Install New Software’ and then Add any of the following eclipse update URL depending on the eclipse version.

For Eclipse 3.5 galileo, http://download.eclipse.org/releases/galileo/
For Eclipse 3.6 helios, http://download.eclipse.org/releases/helios/
For Eclipse 3.7 indigo, http://download.eclipse.org/releases/indigo/

Note : Fedora 16 comes with Eclipse 3.7 by default.

Android SDK
Download the latest Android SDK from
http://developer.android.com/sdk/index.html

Extract and Copy it to any path (installation path) like ‘/opt/andorid-sdk’.

Export Android SDK path :

PATH=$PATH:/opt/android-sdk:/opt/android-sdk/platform-tools
export PATH

Open the eclipse and download the platform-tools and sdk-platform (API) using ADT.