Me, me and me…

Apache on Windows - Virtual Hosts Handling

February 2nd, 2008 Maksymus007

While working with some page which used absolute links for CSS, JS and images (btw. page is static - why the hell use absolute paths there?). While running on my local server of course paths were broken - URL like “localhost/SL_test” is not friendly for absolute mapping. To avoid removing / character from every path and then adding it again while uploading to production server I decided to make subdomain for localhost. To do so

  1. Navigate to C:\Windows\System32\drivers\etc\hosts. This file is similar to Unix /etc/hosts and consists of pairs of values: IP address and host name separated by whitespace. It is frequently used to make stupid jokes. Nevertheless, append to this file

    127.0.0.1 sl.localhost

    of course, instead of sl you can put everything u want

  2. Find you Apache httpd.conf file. Search for line NameVirtualHost. Uncoment it, if necessary. Make it looks

    NameVirtualHost *

  3. Belowe added line, type

    <VirtualHost *>
    DocumentRoot c:\wamp\www\SL_test
    ServerName sl.localhost
    </VirtualHost>

    change sl to your subdomain name and document root to path to your directory.
    Do NOT use quotes here. It can cause Apache to crash (like for me)

  4. ???
  5. Profit!

Adobe Photoshop CS3 Instalation Error 2739

January 26th, 2008 Maksymus007

When tried to install Adobe Photoshop CS3 on Vista Business x64 i got 2739 error. It was meaningless, but I googled how to solve it: in Command Prompt type

regsvr32 jscript.dll

and if it doesn’t help, type

regsvr32 vbscript.dll

If should works now. Well, it didn’t. Registering 32 bits services in 64 bits environment is quite pointless. So…

  1. Start -> Accessories -> right click on Command Prompt -> Run as Administrator
    After authorising command prompt should appear.
  2. Navigate to X:\Windows (X of course is your Windows-Drive letter). Command prompt should start in \Windows\system32 so just type

    cd ..

  3. Go to SysWOW64 directory

    cd SysWOW64

  4. Type

    regsvr32 jscript.dll
    regsvr32 vbscript.dll

  5. Enjoy!

OpenOffice Basic

December 10th, 2007 Maksymus007

I haven’t wrten for a long time. It’s because my Computer Science studies, where lot’s of my time is spent for learing and making many computer exercises. One of them is programming office tools - like MS Office or OpenOffice. Due tu my need for something new I’ve choosen OpenOffice - in fact it was a mistake -despite the fact, thath OO is opensource, free software there is only one book about macros (quite nice, but it left me with many questions). On the other hand, you can find good references (but writen for Java…). Nevertheless programming OpenOffice is possible and very satisfactory.

Let’s start with language.

OO Basic is kind of BASIC language, mainly based on Visual Basic for Applications from Microsoft. Here is quick sumarise:

  • Many data types (integers, floats, strings, etc)
  • Casting - any type can be casted to another
  • Procedures (called subs) and functions
  • Default passing arguments by reference
  • Recurence
  • Special type -variant - can store any datatype
  • Multidimmensional dynamic arrays
  • Dynamic types
  • Control statements
  • Loops

Language is simple and one can learn it during afternoon.

Library

Read the rest of this entry »

test

October 12th, 2007 Maksymus007
@echo off
 :beg
for /L %%a in (1,1,6) do (
echo %%a
if "%%a" == "6" echo lol & goto mid
else echo %%a
)
 :mid
 for /L %%a in (75,-25,0) do (
 if /I "%%a" EQU "-25" goto end
else echo %%a
)
:end

Batch scripting

October 6th, 2007 Maksymus007

I wrote my last post about month ago due to my studies (or beggining of them). Now i’m the student of IFE (International Faculty of Engineering) in Technical University Of Łódź (my home city). After all those events connected with starting, meeting new people one intresting topic have shown up. Batch scriting.

Probably everyone heard about .bat files. This is right batch script file. There is no special programming or scripting language for those files - you can think about batch file like a command line - every line will be executed as if it was typed from keyboard. Well…batch means batch :) .bat file is just a text file with .bat extension so everything you need is a notepad or other similiar tool

First of all - command help. Type help in command line (cmd in windows XP/Vista/NT/2000) to get list with short description of all avaiable commands in system. To get more info about specified command type command /? or help command. First, i mean basic, command is echo. Echo just print everything which follows up to the end of line.

echo Hello World

type it, save as hello.bat, open console, navigate to folder which contains newly created file and type hello or hello.bat (as long as there is no hello.exe file system will "guess" what you want to do). We will see something like

C:\Users\Desktop>echo Hello World
Hello World

I told that batch files is processed like a command typed by keyboard? And thats it - you typed command echo in command line, system have executed command and displayed given string. We know how it works, but..wouldn’t be better if our batch showed only result of commands? The answer is: maybe. I mean both options are possible - so how to make second one?

@echo off
echo Hello World

which will produce

Hello World

cool. Type helo echo to see what we did. Now little remark - how to display text on? echo on will change display mode. The answer is

echo.on

Echo command must be separated from string it will display. Standard separation is one space which is normally ignored (typing echo Hello displays only "Hello" instead of " Hello". Using dot (or / \ + [ ]) instead of space which effect way we want.

@ proceeding our first call of echo off does exactly the same operation like echo off but only for command it precedes. We use it to avoid showing command line while telling its to vanish :) Of course you can type echo off directly in console without using batch files and result will be the same.