Thursday, May 5, 2011

What Is a Literal in Computer Programming?

In computer programming languages, a literal refers to a piece of information (such as a word, digit) that is written exactly as it is meant to be interpreted.

Below are some statements followed by comments (text starting with //). In Java a statement is a text ending with a ";". A statement is a complete sentence that provides a command (or instruction) to be executed by a computer. Comments is any text not interpreted nor executed by a computer. It is there solely for readability purposes. The computer skips everything that starts with "//" until the end of the line.

int x;
// int is a type
// x is a variable

x = 1; 
// 1 is an integer literal

String text = "abc";
// text is a variable
// = is an operator
// "abc" is a literal

Long nr = null;
// nr is a variable
// null is a literal

boolean var = true; 
// boolean is a type
// var is variable
// = is an operator
// true is a literal

As you can see, "1" is a integer number whose value is also 1. Therefore, 1 is a literal. "null" is a special kind of literal that has a value of 0 (zero). In the case above, assigning "null" literal to the variable "nr" implies that the computer should use the corresponding value of null (most of the times 0) and assign it to the variable. Other types of literal in java is true or false. In the case above the computer will assign "true" to the boolean typed variable called "var".

Rubens Gomes



Wednesday, April 7, 2010

EZLista a Free Online Address Book for your smartphone

I have developed a free online address book on the Internet called EZLista (http://www.ezlista.com/). EZLista is an Internet address book where you save and access your contacts from your smartphone (mobile cell phone) or desktop anywhere you have Internet access. The site was developed with easy and security in mind. Your information is safe at EZLista. All the user/password information is encrypted at our server. They are also encrypted during transit on the Internet. EZLista requests users to confirm their email as a safe measurement to ensure that no one uses third party emails in the system.

When you are on the streets you may use your smartphone (mobile cell phone) to access your contacts. EZLista provides an easy interface that renders a mobile web site on most cellular phones in the market. All you need is an Internet browser on your phone.

EZLista is a free address book for desktop and smartphones.

http://www.ezlista.com/

Monday, June 11, 2007

Setting Up SELinux httpd with tomcat and SVN modules

I have an IBM x342 server running CentOS 5. In this machine, I have configured SELinux running in "enforcing" mode along with a "targeted" policy type. And I am using SELinux to manage the security around the httpd process. I am using Apache HTTPd 2.2 as the entry point for all SVN (subversion), tomcat and static page requests.


Here are my configurations for httpd + svn (over SSL):

1) SVN repository: /var/svn/repository.

2) Changed the user/group ownership of the repository directory to "apache" (which is the user/group that owns the 'httpd' daemon)

3) Changed the security context of the svn repository as follows:
$ chcon -v -R -h -t public_content_rw_t /var/svn/repository/
$ ls -Z /var/svn/repository/
drwxr-xr-x apache apache system_u:object_r:public_content_rw_t:DefaultCategory conf
-- DefaultCategory is just an alias I gave to the s0 category.

4) Configure mod_ssl as follows:
LoadModule ssl_module modules/mod_ssl.so
Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
SSLPassPhraseDialog builtin
SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout 300
SSLMutex default
SSLRandomSeed startup file:/dev/urandom 256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
SSLProtocol all
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
SSLOptions +StdEnvVars

SSLOptions +StdEnvVars

SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"


5) Configured dav_svn.conf as follows:
LoadModule dav_svn_module /usr/lib/httpd/modules/mod_dav_svn.so
LoadModule authz_svn_module /usr/lib/httpd/modules/mod_authz_svn.so
# BASIC htpasswd authentication over SSL
DAV svn
SVNPath /var/svn/repository
SSLRequireSSL
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /etc/svn-auth-file
Require valid-user

I found SELinux to be a very interesting technology. I would strongly advise you to read the SELinux docs on RedHat before you jump into configuring security contexts, policies and categories. Also, you should enable the "setroubleshootd" service - this service along with the X SELinux Troubleshooter is a *must* to help you debug avc denies errors.


I will add further information on how to configure httpd with the tomcat module (mod_jk) later on.