Add to Google! Add to My Yahoo! Subscribe with Bloglines Pluck Add to NewsGator

VM Could not reserve enough space for object heap - Java

24

May

This error is a bit annoying during the javac command:
Error occurred during initialization of VM
Could not reserve enough space for object heap

heap and stack sizes are often limited due to the virtualization

javac -J-Xms16m -J-Xmx48m MyClass.java

java -XX:PermSize=16M -Xms8m -Xmx48m

This can be set globally using an alias so that it doesn’t have to be specified it each time

To view the alias for java use $# which java


PHP Proper Case Function

27

March

PHP function to make the first letter of each word capital and the following letters lower case. If the first character is not a letter it capitalizes the second character.

PHP Proper Case Function


PHP Regular Expression (regex) Email Validation

26

March

function isValidEmail($email)
{
$myReg="/^[A-Za-z0-9_-]+@[A-Za-z0-9_-]+\.([A-Za-z0-9_-][A-Za-z0-9_]+)$/";
if(preg_match($myReg, $email))
return true;
else
return false;
}


PHP HTTP POST Request - with cURL

25

March

Here is a nice short function to execute an HTTP POST using cURL.

PHP HTTP POST Request With cURL 

There are no comments, but it is self explanatory.


PHP HTTP POST Request - without cURL

02

March

This snippet of code demonstrates how to execute an HTTP POST request without using curl.

This will not work in versions < PHP5 .

HTTP POST from PHP, without cURL


Visual Basic - HTTP Post Function

11

January

Public Function HTTPPost(ByVal myURL As String, ByVal myPost As String)

Dim temp As String
temp = “”
Try

Dim myURI As New Uri(myURL)
Dim request As Net.WebRequest = Net.WebRequest.Create(myURI)
Dim encoding As New System.Text.ASCIIEncoding()
Dim myByte As Byte() = encoding.GetBytes(myPost)
request.Method = “POST”
‘ Set the content type of the data being posted.
request.ContentType = “application/x-www-form-urlencoded”
‘ Set the content length of the string being posted.
request.ContentLength = myByte.Length
Dim newStream As IO.Stream = request.GetRequestStream()
newStream.Write(myByte, 0, myByte.Length)
newStream.Close()
Dim response As Net.HttpWebResponse = CType(request.GetResponse(), Net.HttpWebResponse)
Dim datastream As IO.Stream = response.GetResponseStream
Dim reader As New IO.StreamReader(datastream)
Dim responseFromServer As String = reader.ReadToEnd()
temp = responseFromServer
reader.Close()
datastream.Close()
response.Close()

Catch

MsgBox(Err.Description)

End Try
Return temp

End Function


Visual Basic - HTTP Get Function

11

January

Public Function HTTPGet(ByVal myURL As String)

Dim temp As String
temp = “”
Try

Dim myURI As New Uri(myURL)
Dim wr As Net.WebRequest = Net.WebRequest.Create(myURI)
wr.Credentials = Net.CredentialCache.DefaultCredentials
Dim response As Net.HttpWebResponse = CType(wr.GetResponse(), Net.HttpWebResponse)
Dim datastream As IO.Stream = response.GetResponseStream
Dim reader As New IO.StreamReader(datastream)
Dim responseFromServer As String = reader.ReadToEnd()
temp = responseFromServer
reader.Close()
datastream.Close()
response.Close()

Catch

MsgBox(Err.Description & vbCrLf & myURL)

End Try
Return temp

End Function


PHP Open Source Timesheet System

04

January

Timesheet.php is a PHP application designed to keep track of the hours worked by multiple people on multiple projects. It allows users to log in through their web browser and manage the times that they are clocked on or clocked off.”

The application is easy to install if you have mild experience with PHP and MySQL.



Blogroll