Oracle has just become the new bad boy in town.. every day it becomes worse...
- Killing WebStack
- Killing OpenSolaris
- Changing the Solaris License to be 90 days trail instead of free use
- This new Oracle VS Google lawsuit and trying to get revenue from something that you have nothing to do with
What will happen to other project, mainly MySQL? OpenOffice? NetBeans? VirtualBox?
Oded Maimon - IT Blog
In this blog I will write about linux, opensource, oracle and more...
Monday, August 16, 2010
Sunday, August 15, 2010
Apache and HTML5 WebSockets
I was surprised to find out that there is no implementation for WebSockets support in Apache web server.
But there is a way to make it work.
pywebsocket project is an Apache "extension" written in python, so mod_python is required also, and with it Apache can support HTML5 WebSockets. it is very easy to install and configure.
I flowed the instructions in this URL: http://www.travisglines.com/web-coding/how-to-set-up-apache-to-serve-html5-websocket-applications-with-pywebsocket
Enjoy.
But there is a way to make it work.
pywebsocket project is an Apache "extension" written in python, so mod_python is required also, and with it Apache can support HTML5 WebSockets. it is very easy to install and configure.
I flowed the instructions in this URL: http://www.travisglines.com/web-coding/how-to-set-up-apache-to-serve-html5-websocket-applications-with-pywebsocket
Enjoy.
Sunday, August 08, 2010
Membase
Just wanted to mention a project that I hope will continue to progress and release new features, Membase is almost all the things that are missing in Memcache for a long time.
To check it go to membase.org to read more and download it.
To check it go to membase.org to read more and download it.
Monday, August 02, 2010
Google App Engine and Geo Targeting by IP using MaxMind DB
Hi,
I tried using my Java based GAE project to geo target my user using MaxMind but I found out that it is not possible because the current implementation of MaxMind Java API uses restricted classes by Google.
The only way I was able to do it is by using Python based GAE project and using this great piece of code for doing it: http://code.google.com/p/python-geoip/
Hope it helps anyone.
I tried using my Java based GAE project to geo target my user using MaxMind but I found out that it is not possible because the current implementation of MaxMind Java API uses restricted classes by Google.
The only way I was able to do it is by using Python based GAE project and using this great piece of code for doing it: http://code.google.com/p/python-geoip/
Hope it helps anyone.
Thursday, July 22, 2010
Add disk to vmware linux guest without rebooting
Adding a new disk to a vmware linux guest OS is very easy, the next step is to make the guest OS recognize the disk, this is also very easy, just run:
echo "- - -" > /sys/class/scsi_host/host#/scan
where host# should change to the correct host, probably host0.
after running the command you should be able to see the new disk by running: fdisk -l
echo "- - -" > /sys/class/scsi_host/host#/scan
where host# should change to the correct host, probably host0.
after running the command you should be able to see the new disk by running: fdisk -l
Monday, April 12, 2010
SQL Cursor and Google App Engine
Google App Engine SDK 1.3.1 released a new important feature Datastore Query Cursors.
With this new feature we can bypass requests hard limits (1MB response size and 30 sec timeout), we can run a large query and split it into multiple request. This is how it can be done with JDO (it is also possible with low level API)
final int MAX_REC = 2000;
final String cacheKeyName = "ExportMyTable" + req.getRemoteAddr();
PrintWriter prt = resp.getWriter();
PersistenceManager pm = PMF.get().getPersistenceManager(); // PMF is my representation to get the PersistenceManager instance
Query query = pm.newQuery(myTable.class);
List results = null;
String cursorString = null;
Cursor cursor = null;
Map extensionMap = new HashMap();
Cache cache = null;
try { // check if cursor already saved in the cache, if so, use it
cache = CacheManager.getInstance().getCacheFactory().createCache(Collections.emptyMap());
cursorString = (String) cache.get(cacheKeyName);
if (cursorString != null && !cursorString.isEmpty()){
// Cursor were found in the cache, set the query to start from that cursor
cursor = Cursor.fromWebSafeString(cursorString);
extensionMap.put(JDOCursorHelper.CURSOR_EXTENSION, cursor);
query.setExtensions(extensionMap);
}
} catch (CacheException e) {
prt.println(e.getStackTrace());
}
query.setRange(0, MAX_REC);
//execute the query
results = (List) query.execute();
// Process the results
for (myTable t : results){
prt.println(t.toString());
}
// Get the cursor
cursor = JDOCursorHelper.getCursor(results);
// get the cursor as string
cursorString = cursor.toWebSafeString();
// remove the cursor from the cache if got less records then requested (the query ended)
if (results.size()
cache.remove(cacheKeyName);
prt.println("-END-");
} else {
// keep current cursor location
cache.put(cacheKeyName, cursorString);
}
query.closeAll();
pm.close();
Enjoy...
With this new feature we can bypass requests hard limits (1MB response size and 30 sec timeout), we can run a large query and split it into multiple request. This is how it can be done with JDO (it is also possible with low level API)
- Create your query
- Limit execution for a specific amount of rows
- Execute the query
- Process the results set
- Keep the cursor in memcache
final int MAX_REC = 2000;
final String cacheKeyName = "ExportMyTable" + req.getRemoteAddr();
PrintWriter prt = resp.getWriter();
PersistenceManager pm = PMF.get().getPersistenceManager(); // PMF is my representation to get the PersistenceManager instance
Query query = pm.newQuery(myTable.class);
List
String cursorString = null;
Cursor cursor = null;
Map
Cache cache = null;
try { // check if cursor already saved in the cache, if so, use it
cache = CacheManager.getInstance().getCacheFactory().createCache(Collections.emptyMap());
cursorString = (String) cache.get(cacheKeyName);
if (cursorString != null && !cursorString.isEmpty()){
// Cursor were found in the cache, set the query to start from that cursor
cursor = Cursor.fromWebSafeString(cursorString);
extensionMap.put(JDOCursorHelper.CURSOR_EXTENSION, cursor);
query.setExtensions(extensionMap);
}
} catch (CacheException e) {
prt.println(e.getStackTrace());
}
query.setRange(0, MAX_REC);
//execute the query
results = (List
// Process the results
for (myTable t : results){
prt.println(t.toString());
}
// Get the cursor
cursor = JDOCursorHelper.getCursor(results);
// get the cursor as string
cursorString = cursor.toWebSafeString();
// remove the cursor from the cache if got less records then requested (the query ended)
if (results.size()
cache.remove(cacheKeyName);
prt.println("-END-");
} else {
// keep current cursor location
cache.put(cacheKeyName, cursorString);
}
query.closeAll();
pm.close();
Enjoy...
Friday, April 09, 2010
Authenticating Google App Engine apps using curl
I'm going to show here the exact way that i use to authenticate to my google app engine application using unix script and curl.
This is a 3 steps process:
Getting auth key:
Step 2:
Getting application cookie:
Step 3:
Calling our application service, getAllData:
That's all!
Hope it will help anyone.
This is a 3 steps process:
- Get the auth code from google (using ClientLogin)
- Get the cookie from google using the auth code
- Access the service that we want in google app
- Application name is: MyFirstApp
- Application url is: http://MyFirstApp.com
- Our application service name is: getAllData
- Application admin is: admin@gmail.com
- Application admin password is: adminadmin
Getting auth key:
curl -f -s --output myAuthFile.txt -d Email=admin@gmail.com -d Passwd=adminadmin -d accountType=GOOGLE -d service=ah -d source=MyFirstApp https://www.google.com/accounts/ClientLoginafter the command completes we will have a file named: myAuthFile.txt with 3 lines, the line that starts with "Auth=" is the auth code line, we will use this code in the next step.
Step 2:
Getting application cookie:
curl -c cookiefile "http://MyFirstApp.com/_ah/login?auth=`cat myAuthFile.txt | grep ^Auth= | cut -d= -f2`" > /dev/nullafter the command completes we will have a file named: cookiefile that will include our cookie, we will use the cookie in the next step.
Step 3:
Calling our application service, getAllData:
curl -f -s -H "Cookie: ACSID=`cat cookiefile | grep -v ^# | grep -v ^$|cut -f7`" http://MyFirstApp.com/getAllData
That's all!
Hope it will help anyone.
Subscribe to:
Posts (Atom)