Monday, April 20, 2009

setting up apache to use /home/user dir

just installed apache via:

yum groupinstall "Web Server"

added user:

/usr/sbin/useradd -m jobsite -G apache

couple of things, start the web server using
/etc/init.d/httpd start does start and shows the fedora
start page.

now on to the /etc/httpd/conf directory.

i have changed Document root in httpd.conf to:

DocumentRoot "/home/jobsite"

and commented out all the lines in file /etc/httpd/conf.d/welcome.conf

i now get the following when i try to browse "http://localhost/" :

-------------------------------------- http response -------------------------------------------
Forbidden

You don't have permission to access / on this server.
Apache/2.2.9 (Fedora) Server at localhost Port 80

------------------------------------------------------------------------------------------------

did this

You got "DocumentRoot must be a directory" error even it is really a
directory because of SELinux extensions. Run
system-config-securitylevel (or redhat-config-securitylevel) to
disable SELinux for httpd or give SELinux permissions to that
directory:
chcon -R -h -t httpd_sys_content_t /path/to/directory

More help at: http://fedora.redhat.com/docs/selinux-faq-fc3/index.html

Sunday, April 12, 2009

mysql build up

this is based on the web page http://www.yolinux.com/TUTORIALS/LinuxTutorialMySQL.html

i wanted verify a couple of things.
the start up script is in /etc/rc.d/init.d/mysqld start
and there is a directory in /var/lib/mysql

i started the web server
/etc/rc.d/init.d/mysqld start

this does indeed start the database.

Friday, March 06, 2009

prelude to a screen cap

<%@ Page Language="VB" Debug="True" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Drawing.Text" %>
<%
' Declare Vars
Dim objBMP As System.Drawing.Bitmap
Dim objGraphics As System.Drawing.Graphics
Dim objFont As System.Drawing.Font

' Create new image - bitmap
objBMP = New Bitmap(100, 30)

' Create a graphics object to work with from the BMP
objGraphics = System.Drawing.Graphics.FromImage(objBMP)

' Fill the image with background color
objGraphics.Clear(Color.Green)

' Set anti-aliasing for text to make it better looking
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias

' Configure font to use for text
objFont = New Font("Arial", 16, FontStyle.Bold)

' Write out the text
objGraphics.DrawString("ASP 101", objFont, Brushes.White, 3, 3)


' Set the content type and return the image
Response.ContentType = "image/GIF"
objBMP.Save(Response.OutputStream, ImageFormat.Gif)

' Kill our objects
objFont.Dispose()
objGraphics.Dispose()
objBMP.Dispose()
%>



as c#

<%@ Page Language="C#" AutoEventWireup="true"  %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Drawing.Text" %>
<%
//' Declare Vars
System.Drawing.Bitmap objBMP;
System.Drawing.Graphics objGraphics;
System.Drawing.Font objFont;

//' Create new image - bitmap
objBMP = new Bitmap(100, 30);

//' Create a graphics object to work with from the BMP
objGraphics = System.Drawing.Graphics.FromImage(objBMP);

//' Fill the image with background color
objGraphics.Clear(Color.Green);

//' Set anti-aliasing for text to make it better looking
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;

//' Configure font to use for text
objFont = new Font("Arial", 16, FontStyle.Bold);

//' Write out the text
objGraphics.DrawString("ASP C#", objFont, Brushes.White, 3, 3);


//' Set the content type and return the image
Response.ContentType = "image/GIF";
objBMP.Save(Response.OutputStream, ImageFormat.Gif);

//' Kill our objects
objFont.Dispose();
objGraphics.Dispose();
objBMP.Dispose();
%>


Thursday, March 05, 2009

screen capping

i want my little cassini web server to take a screen cap of the it is running on.
should be easy shouldnt it? shouldnt it?

Well I found this nice example from the code project:

http://www.codeproject.com/KB/cpp/Screen_Capture__Win32_.aspx

WCHAR buf [100],buf1[20];
int xSrc=0,ySrc=-19;
int DepcWidth=10, DepcHeight=5;
OutputDebugString(L"Start capture act window ");
HDC ActWndDC = GetDC(hWndActWnd); //DC for the window you have clicked on

MemDC = CreateCompatibleDC(ActWndDC); //Memory DC Compatible with Above DC

GetWindowRect(hWndActWnd,&ActWndRect); //Will Store the Windows Are in Rectangle

wsprintf(buf,L"x1 = %d , y1 = %d, x2 = %d y2 =%d",ActWndRect.left,ActWndRect.top,ActWndRect.right,ActWndRect.bottom);
OutputDebugString(buf);

int Width = ActWndRect.right-ActWndRect.left; //Width of the Window
int Height =ActWndRect.bottom-ActWndRect.top; //Hight of the Window

if(GetWindowText(hWndActWnd,buf1,20) >0)
{
OutputDebugString(buf1);
}
if(CaptureControl)
{
ySrc= DepcWidth = DepcHeight = 0;
}

HBITMAP hBitmap = CreateCompatibleBitmap(DlgDC,Width-DepcWidth,Height-DepcHeight);//Will Create Bitmap Comatible With Our Window
SelectObject(MemDC,hBitmap);

BitBlt(MemDC,0,0,Width,Height,ActWndDC,xSrc,ySrc,SRCCOPY);//Will Copy the Window into MemDC
//BitBlt(DeskDC,110,110,Width,Height,MemDC,Begpt.x,Begpt.y,SRCCOPY);

SaveBitmap(MemDC, hBitmap,"Sample.bmp"); // will Save DC into .bmp File
ShowImage(); //Will Show u the .bmp File in MSPAINT.


getting cassini to work

I farted around with cassini last week but i couldnt get the thing to build and to install the assemble into the gac.
i found a trick from another project i was working on.
start the command compiler command shell with the visual studio tools
cd to the cassini director and run build.bat
i was able to build and install cassini
i created a simple web project a blank page and moved this to the director c:\temp
and ran
C:\Cassini>CassiniWebServer.exe c:\temp 8080 /temp
loaded mozilla and
ran
http://localhost:8080/temp/


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="default.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNzgzNDMwNTMzZGSLYl3aThqDqzWeHM/cMb5uC4Vx5A==" />
</div>

<div>

</div>

</form>
</body>
</html>


Sunday, March 01, 2009

Interfaces

namespace myspace
{
interface ifoo
{
public void bar();
}

class Iamfoo : public ifoo //this would fail because its not c++
{
public void bar()
{
}
};
}

This page is powered by Blogger. Isn't yours?