Thursday, December 17, 2009
Get An Excel Sheet To Send Local IP to Perl Page
ok, now in the excel sheet, we create a new macro , and we put the following code in
Now, every time that excel sheet is opened, it'll call the Workbook_Open event, the local machine ip is stored in the temp file, sent to the perl script , which puts the ip along with the current date/time in a log txt file
Selecting all Radio Buttons With A Certain Value
Using APIs in C#
by: vbguyny
APIs (Application Programming Interface) are used in many higher level programming languages to directly make a call to a function inside a DLL (Dynamic Linked Library) which was designed in C++. APIs increase the efficiency of programs that use algorithms with many mathematical computations.
Syntax
When declaring APIs in C#, use the following syntax:Example
Making a program that uses the windows API PlaySound.The following example demonstrates how to implement the Windows API PlaySound in a C# application
Notice that the API is declared inside the class clsAPI.
Where to Find APIs
list of all the Windows APIs can be found in the API Text Viewer that comes with VB6. The C++ .NET documentation provides help on how to use each API function.source:hxxp://www.csharpfriends.com/Articles/getArticle.aspx?articleID=219
Migrating Moodle from windows to Linux
Download the latest CentOS5 ISOs for DVD or CDs from: http://centos.org/
A test x86 desktop computer, keyboard, monitor, mouse, and firewalled internet connection.
One hour of quite time and a good supply of coffee. (seriously!)
- First you'll need to back up three things
-
your current Moodle database.
you can use mysqldump ex: mysqldump -u yourUsername -p youPassword moodleDatabaseName > sqlFileOfBackup.sql
Or from phpMyAdmin: select the database > Export
-
Moodle software installation folder .
copy your moodle folder
-
Data directory contents (moodledata).
Copy the contents of your data directory (check for the value in $CFG->dataroot) to the new server
3.0 Install The OS
- If you haven't already installed your linux distro, go grab one from here (i've chosen centOs for you ;) ).
- Install The OS, use this url http://www.howtoforge.com/perfect-server-centos-5.2 to make your perfect server or you can skip this step.
- Make sure you Select only the following components:
- Editors
- Text base Internet
- Development Libraries
- Development Tools
- Administration Tools
- Base
- System Tools
- Once the system reboots disable firewall and SElinux.
- run yum update to be sure your system is fully up to date.
- Reboot the system.
4.0 Check for (Or install) Apache
usually CentOS comes with an installed Apache server, but just to be on the safe side check
- check if apache server already exists
- use command httpd
- if it dosen't exist use: yum install httpd httpd-devel
- Start your Apache server: httpd -k start
5.0 Install MySQL Server
- use the command: yum install mysql mysql-server mysql-devel
- start MySQL service daemon : service mysqld start
- change your MySQL server root password
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql> FLUSH PRIVILEGES;-
Once done, check by logging in:
- mysql -u root -p
- Enter Password:
6.0 Enable Remote access on MySQL database
you need edit the mysql configuration file my.cfg using text editor such as nano
- Type nano /etc/my.cnf
- Once file opened, locate line that read as follows [mysqld]
- Make sure line skip-networking is commented (or remove line) and add following line bind-address=YOUR-SERVER-IP
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/English
bind-address = 65.55.55.2
# skip-networking
....
..
Where,
bind-address : Your MySQL IP address
skip-networking : Don’t listen for TCP/IP connections at all. All interaction with mysqld must be made via Unix sockets. This option is highly recommended for systems where only local requests are allowed. Since you need to allow remote connection this line should removed from file or put it in comment state.
- Save and Close the file
- Restart your mysql service to take change in effect using service mysqld restart
- login to my sql again using : mysql -u root -p and write your password
- Grant access to remote IP address
- now, create new user moodleuser with password anotherpassword in order to make the application server ip serverIP able to connect with i
- mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER ON moodle.* TO moodleuser@serverIP IDENTIFIED BY 'anotherpassword';
mysql> flush privileges;
mysql> quit Logout of MySQL using exit
7.0 Open MySQL connection port 3306
- You need to open port 3306 using iptables by
- open Linux iptables firewall using:
- /sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
- OR only allow remote connection from your web server located at 10.5.1.3:
- /sbin/iptables -A INPUT -i eth0 -s 10.5.1.3 -p tcp --destination-port 3306 -j ACCEPT
- Test it from remote system or your desktop using telnet 65.55.55.2 3306
8.0 change Moodle url in the SQL file
- using replace.php while your site is currently running just before you backup the Moodle database.
- Point your browser to http://yourserver.com/admin/replace.php
- Enter the url for your old server (http://oldserver.com/) and new server (http://newserver.com/) and it will fix the mysql tables.
- clear out any cached links by restarting your webserver.
- OR backup the Moodle database first, then use the search and replace feature of your text editor
- ex: sed command: sed -e 's/oldserver.com(or ip)/newserver.com(or ip)/g' oldmysqldump.sql > newmysqldump.sql
9.0 Restore your Moodle Installation
- copy moodle installtion folder to your web server pages address
- EX. /var/www/html/
- copy you moodle data folder to the root folder of the server
- ex. /var/www/
- give it 777 premission in oreder to make it accessible to the system
- chmod 777 /var/www/moodledata
- Restore your moodle database
- mysql -u root -p <>
- Change Moodle Config.php prams
- change the Database address to the remote MySql db address
- change the DBUserName to the user name that you've created (moodleuser) and put his password (anotherpassword)
- change the moodle base url the the new root ApplicationServer IP/Moodle root Folder Name
- change the moodle root to the phsyical address of the moodle installation on the hard desk /var/www/html/moodle
- change the moodle data path to the phisycal address on HD /var/www/moodledata
10.0 Test your Migration
SCJD certificate Notes
legal and illegal identifiers
Default Access
- Think of default access as package-level access, because a class with default access can be seen only by classes within the same package
Public Access
- A class declaration with the public keyword gives all classes
from all packages access to the public class. In other words, all classes in the Java
Universe (JU) have access to a public class
Other (Nonaccess) Class Modifiers
Final Classes- When used in a class declaration, the final keyword means the class can't be subclassed
- An abstract class can never be instantiated. Its sole purpose, mission in life, raison d'être, is to be extended (subclassed)
- but always remember that if even a single method is abstract, the whole class must be declared abstract. One abstract method spoils the whole bunch. You can, however, put none-abstract methods in an abstract class.
Declaring an Interface
- When you create an interface, you're defining a contract for what a class can do, without saying anything about how the class will do it. An interface is a contract
- For Example
you might want both a Ball and a Tire to have bounce behavior, but
Ball and Tire don't share any inheritance relationship; Ball extends Toy while Tire
extends only java.lang.Object. But by making both Ball and Tire implement
Bounceable, you're saying that Ball and Tire can be treated as, "Things that
can bounce,
- All interface methods are implicitly public and abstract. In other words,
you do not need to actually type the public or abstract modifiers in the
method declaration, but the method is still always public and abstract. - All variables defined in an interface must be public, static, and final—in other words, interfaces can declare only constants, not instance variables.
- Interface methods must not be static.
- Because interface methods are abstract, they cannot be marked final, strictfp, or native. (More on these modifiers later.)
- An interface can extend one or more other interfaces.
- An interface cannot extend anything but another interface.
- An interface cannot implement another interface or class.
- An interface must be declared with the keyword interface.
- Interface types can be used polymorphically.
- You just need to know that both of these declarations are legal, and functionally identical:
- the following five method declarations, if declared within their own interfaces, are legal and identical!
- the following five method declarations, if declared within their own interfaces, are legal and identical!
- The following interface method declarations won't compile:
Declaring Interface Constants
You're allowed to put constants in an interface. By doing so, you guarantee that any class implementing the interface will have access to the same constant.They must always beLook for interface definitions that define constants, but without explicitly using the required modifiers. For example, the following are all identical:
Thunderbird SMTP and POP3 Windows live ports
Incoming ports for POP3 email protocol:
port 110 (insecure)port 995 (SSL)
Incoming ports for IMAP4 protocol:
port 143 (insecure)port 993 (SSL)
Outgoing ports for SMTP message submission:
port 25 (security optional, depending upon server configuration;originally intended for message transfer.)port 465 (SSL)port 587 (TLS, if supported by the message submission server.)
NOTE: Not all services offer all ports, protocols, or security (except the secure ports requiring SSL: 465, 993, and 995).
PXE Boot Creation
- مكنتين , واحدة هتبقى سيرفر الPXE (أنا استعملت ويندوز إكس بي للمكنه دي )وال تانيه هتبقى البوت ماشين
- نسخة من Syslinux-3.51.zip ودي ممكن تجيبها من أي حتة أو يا سيدي دوس على اللينك
- DHCP وTFTP Server علشان السيرفر , استعمل اللي إنت عايزه بس أنا بفضل Tftpd32 والنسخة كانت v3.03 (ممكن كمان تستعمل MS DHCP اللي موجود في ويندوز 2003)
- الimg floppy اللي هتعمل منه بوت وكالعادة أهو (ده يا معلم امج من فلوبي يعني زيه زي دسك البوت)
- ملف وهتسميه default من غير امتداد وهتحط جوَّه الداتا التالية
DEFAULT menu.c32
TIMEOUT 300
ALLOWOPTIONS 0
PROMPT 0
MENU TITLE PXE Boot System
LABEL NetworkBoot
MENU LABEL ^Network Boot
kernel memdisk
append initrd=w98se-netboot.IMA
LABEL CleanBoot
MENU LABEL ^Clean Win 98 Boot
kernel memdisk
append initrd=W98.IMA
LABEL BootNormal
MENU LABEL ^Boot Normal
LOCALBOOT 0
- pxelinux.0 موجود في الروت بره , هتحطه في C:\PXEServer\TFTPRoot\Boot
- 'memdisk' وده موجود في فولدر memdisk , برده هتحطه في C:\PXEServer\TFTPRoot\Boot
- menu.c32 وده في \syslinux-3.51\com32\modules وهتحطه في C:\PXEServer\TFTPRoot\Boot
- default وده هيتحط في C:\PXEServer\TFTPRoot\Boot\pxelinux.cfg
بالنسبة للملفات كده فاضل بس نحط ملفات البوت اللي احنا جبناها بتاعت الفلبي , فك الملف المضغوط هتلاقي ملفين جوَّه
- W98.IMA وده عشان البوت العادي (هو كمان هيتحط في C:\PXEServer\TFTPRoot\Boot)
- w98se-netboot.IMA وده علشان البوت من على الشبكة (طبعا هتبقى غباوه لو قلت هيتحط فين)
كده كل المطلوب من حضرتك إنك تعمل تظبيط للشبكة عندك فيكون شكلها كده (أو زي كده , اختار العناوين اللي إنت عاوزها )
فاكر بقى ال TFTP Server اعمله اكستراكت وافتحو , دوس على settings وبعدين DHCP Server المفروض تخلي المنظر عندك زي ده
دوس أوكيه هيطلب منك تعمل ريستارت , نفض دلوقتي وخش على DHCP الدنيا المفروض تكون قريبا من كده
كده إنت جاهز, اقفله وافتحه تاني وقول يا رب , افتح المكانه التانية وكله تمام
فاضل كدة الباكيت فرواردينج لو عندك 2 interface
Tuesday, December 15, 2009
My first Topic (I hope it won't be the last one)
1- It's form google, i love google, i trust google (in google we trust)
2- It allows the user to create custom templates, which is not availble in wordpress
in the end, i think (and hope) that i made the right choice, the effort now will go for migrating my old live sapce to blogger
wish me good luck