How to return exit code such as exit() function in C/C++ ?

i : Integer;
begin
// Set up an error address so that halt shows a termination dialog
ErrorAddr := Addr(i);
// Set the program Exit Code
ExitCode := 8;
end;
As you can see above, you can set Exit Code by ExitCode variable. That is global variable indicating Exit Code.
Here's the simple AJAX application getting RSS data that does not use any kind of server resource except java script file itself.
I order to make script simply I designed simple javascript class at http://kurapa.com/js/xml.js.
<html>
<script type='text/javascript' src='http://kurapa.com/js/xml.js'></script>
<script language=javascript>
function xml_call_back_sample( content)
{
RSS = new kRSS(content);
// put HTML into content
document.getElementById("content").innerHTML = "<font color=green><strong>" + RSS.get(0, "title") + "</strong></font><br>" + RSS.get(0, "description") + "<br><br>";;
for( i=1; i<RSS.count(); i++)
document.getElementById("content").innerHTML += "<font color=green><strong>" + RSS.get(i, "title") + "</strong></font><br>" + RSS.get(i, "description") + "<br><br>";
}
function getitnow()
{
// get RSS and define call back function which will be called when the RSS data is read completely
kAJAX_run( 'http://RSS.cnn.com/RSS/edition.RSS', xml_call_back_sample);
}
</script>
<input type=button value='--- get 1 ---' onclick='javascript:getitnow()'>
<div id="content">
click above button to get RSS data from CNN
</div>
</html>
Following is the simple example to display parameter list by showmessage function.
var i: Integer;
begin
for i := 1 to ParamCount do
ShowMessage( ParamStr(i));
end;
As you can see above, you can know the total number of parameters by ParamCount. In addition, You can get the Parameter String by ParamStr function as well.
Save TBitmap image to Jpeg format image in Delphi

procedure BitmapToJpeg(FileName: string; Img:TGraphic);
var
m_Jpeg: TJpegImage;
m_Bitmap: TBitmap;
begin
try
m_Jpeg:= TJpegImage.Create;
m_Bitmap := TBitmap.Create;
m_Bitmap.Width := Img.Width;
m_Bitmap.Height := Img.Height;
m_Bitmap.Canvas.Draw( 0, 0, Img);
// m_Bitmap.Canvas.StretchDraw( 0, 0, , ...,Img);
m_Jpeg.Assign( m_Bitmap);
m_Jpeg.SaveToFile( FileName);
finally
m_Jpeg.Free;
end;
end;
Here's the simple example can resizing source image:
<%@ page import="java.io.*,
java.awt.*,
java.awt.image.*,
javax.swing.*,
com.sun.image.codec.jpeg.*"
contentType="text/html;charset=MS949" %>
<%!
public static void createthumbnail(String soruce, String target, int targetW) throws Exception
{
Image imgSource = new ImageIcon(soruce).getImage();
int oldW = imgSource.getWidth(null);
int oldH = imgSource.getHeight(null);
int newW = targetW;
int newH = (targetW * oldH) / oldW;
Image imgTarget = imgSource.getScaledInstance(newW, newH, Image.SCALE_SMOOTH);
int pixels[] = new int[newW * newH];
PixelGrabber pg = new PixelGrabber(imgTarget, 0, 0, newW, newH, pixels, 0, newW);
pg.grabPixels();
BufferedImage bi = new BufferedImage(newW, newH, BufferedImage.TYPE_INT_RGB);
bi.setRGB(0, 0, newW, newH, pixels, 0, newW);
FileOutputStream fos = new FileOutputStream(target);
JPEGImageEncoder jpeg = JPEGCodec.createJPEGEncoder(fos);
JPEGEncodeParam jep = jpeg.getDefaultJPEGEncodeParam(bi);
jep.setQuality(1, false);
jpeg.encode(bi, jep);
fos.close();
}
%>
<%
createthumbnail("c:/inetpub/c/big.jpg","c:/inetpub/c/big_result.jpg",320);
%>
Prev

Rss Feed