Archive for the ‘HOW-TOs’ Category
إختبر قدرة و سرعة موقعك (او مدونتك)
السلام عليكم و رحمة الله و بركاته…
معظم من يقرء هذا الموضوع يعلم أن المواقع التي يراها على الإنترنت ماهي إلا ملفات ترسل الى متصفحك من قبل برنامج يسمى ال”سرفر”(server)، و الذي يختلف عن الجهاز الذي يعمل عليه (ايضا يسمى “سرفر”).
هناك عدة انواع من برامج السرفرات، ولعل ابرزها:
ا- اباشي (Apache): من أشهر و أفضل برامج “سرفر” في العالم
ب- مايكروسوفت IIS: بصراحه، ليست لدي أي فكره عن سبب إستخدامه حيث أن Apache افضل منه و أرخص (مجاني)
البرنامج الذي يتناوله هذا الموضوع أحد البرامج المدرجة مع اباشي ويسمى ب”ab”. هذا البرنامج يقوم بمحاكاة زوار المواقع حيث يقوم بدخول الى الموقع المراد إختباره كزائر طبيعي (لا يوجد فرق بين نوع السيرفر المراد إختباره، فab يعمل مع جميع أنواع سيرفرات HTTP). و يمكنه محاكات مستخدم واحد او الف مستخدم. و يلي نموذج لهذا (10 مستخدمين و 1000 طلب (request)):
Server Software: Apache/2.2.11 Server Hostname: localhost Server Port: 80 Document Path: / Document Length: 14593 bytes Concurrency Level: 10 Time taken for tests: 0.849 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 14942826 bytes HTML transferred: 14622186 bytes Requests per second: 1178.15 [#/sec] (mean) Time per request: 8.488 [ms] (mean) Time per request: 0.849 [ms] (mean, across all concurrent requests) Transfer rate: 17192.28 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 1 3 2.3 3 16 Processing: 1 5 17.6 3 209 Waiting: 0 4 16.1 2 207 Total: 3 8 17.6 6 210 Percentage of the requests served within a certain time (ms) 50% 6 66% 6 75% 7 80% 7 90% 8 95% 17 98% 19 99% 159 100% 210 (longest request)
في المثال السابق يمكن معرف سرعة النقل (17192.28 Kbytes/sec (لأنه localhost)) و معدل الزوار بالثانية (1178.15).
لتنزيل البرنامج، يمكنك زيارة http://www.apache.org. اذا كنت تستخدم أوبونتو، اكتب
sudo apt-get install apache2-utils
ab -c م -n ع http://www.شيء.com:80/
حيث أن “م” تمثل عدد المتخدمين و “ع” تمثل عدد الطلبات و شيء يمثل الموقع/المدونة المراد إختبارها. يلي مثال بسيط على هذا:
ab -c 1 -n 100 http://araby.com:80/
سيقوم بإختبار http://araby.com كمستخدم واحد خلال عشر طلبات
أختم بالقول ان هذه الأدة مفيده ولكن يرجى إستخدامها لتجريب مواقعكم الخاصة وليس على مواقع الغير لأنها قد تستهلك سرعة السرفر في الرد على الاخرين.
و السلام عليكم و رحمة الله و بركاته
A tool that makes life that much easer…
This is by far the most useful command-line tool when it comes to dealing with the web. wget is a small simple-to-use tool that allows you to get content from other sites. this includes html, tar balls, and anything else the server is willing to provide.
if you’re wandering what good it is when there are numerus browsers that do this, read on.
wget (unlike browsers) is a non-interactive tool, meaning it doesn’t need you once it has been given a job. such as downloading an entire directory, say this one. rather than clicking each item on that list, you can simply use wget by issuing this command:
wget -r ftp://ftp.geda.seul.org/pub/geda/release/v1.4
wget can also help by making those pesky online-only documents available off-line. take this for example (i know this is available in downloadable form but this method is applicable on other sites as well)
wget is a well-behaved tool, it will not download from any site that specifies rules prohibiting it. these rules are stored in the root directory of the server (robots.txt). however, most rules are meant to be broken. you can ignore rules by adding the following to the command:
-e robots=off --wait 1
The “wait” has nothing to do with ignoring rules, it simply makes it easer on the server by waiting 1 second between every fetch. please add this when downloading from good sites, and conveniently forget it when downloading from microsoft :p
Also, when recursing, wget will only go down 5 levels. if the site you want to download has a directory structure that goes deeper then this, add
Finally, some sites analyze traffic and can determine if an automated application such as wget is downloading, and can block it. there is an solution to this but i won’t go into it since i never really used it.
enjoy the web with wget 🙂
If you’re reading this, that means i’ve failed to stop you from wasting a couple of minutes of your life.. *sigh* don’t blame me.
this is an intractive tutorial gone bad. after wasting hours on it, i decided to upload it (i didn’t want my had work to go to wast). if you you want to download this then click this.
i tried to warn you, but do you listen?
I’ll keep it short don’t worry….I don’t like the people who makes it long. by the way I’ve searched for another way to do this but there’s no way other then this.
If you want to hear the movie from a laptop and your friend wants to hear it from his headphone….what would you do :
- Plug the headphone into the computer.
- Press OK so the voice enters the headphone.
- Disconnect the headphone.
- Then plug it again and ignore the window of realtek and to do that you’ll have to click on the movie’s window.
- And then watch the movie peacefully (you can watch the movie with the sound of your computer and your friend watchs it by his headphone )
Please ask if you have any question, and if you’d like comment.
1. DOSBox, ways to download it:
a. Open the terminal and type
sudo apt-get install dosbox
b. Open Synaptic and download it (assuming you’re using ubuntu).
c. Go to its website and download it.
2. Windows 3.1, finding this was a problem, but I found a website that lets you download it for free, but you’ll have to make an account. Here’s the link: http://vetusware.com/download/Windows%203.1/?id=3391
1. Move the -downloaded- Windows 3.1 file/folder to a directory of your choice (Do not change its place after placing it, cause some steps depend on its path), extract it if it was zipped.
2. Open the directory that contains Windows 3.1’s files, you’ll find several folders named “Disk1”, “Disk2”, “Disk3”, …, “Disk7”.
3. Make a new folder named “CombinedFiles”.
4. Return to the directory that contains the disks. Now, move all the files in every disk folder to “CombinedFiles” folder.
5. Open “CombinedFiles” the folder that contains all the disks files, search for a file named “SETUP.EXE”, and open it with DOSBox. Once you’ve pressed it, DOSBox should start running, and then the installation begins.
6. Install it, it wont take time, and every time it asks you to put another disk press “Enter”. The installation should finish without any problems.
7. You’ll be asked whether if you’d to restart your computer or switch to MS-DOS, at that point switch to MS-DOS and quit DOSBox. So type in “exit” and press “Enter”. If that didn’t work, press “Ctrl + F9”. FYI If you didn’t exit DOSBox, Windows will not work in a good way and -probably- you wont be able to use your mouse.
8. Now go to “/home/YourName/” and make a new text file and name it “dosbox.conf”, copy and paste the following (don’t forget to change the path):
# Lines in this section will be run at startup. Type the following in on a new line:
mount C: /home/...path.../CombinedFiles/
9. Now you have two ways to run Windows 3.1:
a. Open DOSBox, type “
cd WINDOWS“, and then type “
win” and hit the “enter”.
b. Open any *.EXE from “CombinedFiles” with DOSBox, type “
cd WINDOWS“, and then type “
win” and hit the “enter“.
1. To kill DOSBox press “LeftCtrl + F9”
2. To get out your mouse from DOSBox prss “LeftCtrl + F10”
3. It boots in 3 seconds! (if not less)
Well, I just knew how to block ads (in Linux, BSD, and SolarisUnixes), so I’m going to share this with you in this short 4 steps tutorial! But before I start, for those who might ask “why would I want to block ads?” “Why should I?” for two things: to have your page loaded quickly and to not be annoyed ever again (… not really, I’ll tell the reason later on)!
Step1. Open nautilus as root.
step2. Change the directory to “/etc/” and open the text file “hosts”.
What you are going to do is that you’re going to insert URLs of ads in the text file and going to redirect that URL to localhost IP(127.0.0.1); so that when the ad wants to load it’ll search in your IP(localhost), but it is not on your PC so it’ll go like “Not Found” which also means blocking ads(you could block unwanted sites too). The good thing is that you don’t have to enter every single ad URL; cause there are some sites which helped us with this; they provided a very long list containing all those URLs(ads)! just like http://www.mvps.org. anyhow let’s continue…
Step3. Copy the list from this page and paste it in “hosts” text file.
Step4. Save the document.
Congratulations, That’s it, you’ve just blocked all the URLs that are in that list. … About what I said before a while ” to not be annoyed ever again (… not really)” the reason is that there might be some new ad sites which are not included so they will appear in your browser, but you can always add the URL to the text file 😉 … and to be honest since I’ve done that till now I haven’t seen a single ad, so enjoy and don’t worry.
Probably at one point in your life, you will wake up wanting to create a GUI fast! whether it’s a front-end for some software you are writing, or just for the heck of it (i said probably). this simple how-to will teach you how to do just that.
The objective of this article is to design a GUI as fast and as effortlessly as possible. if you want more flashy GUI similar to what you usually get when you start a program, I’d recommend glade.
because we want the least effort we will be using bash (yes a terminal) to deploy and manage our GUI. The key player is xmessage (see “man 1 xmessage” for more detail). this is a simple yet incredibly useful program that displays a simple GUI dialog on the screen. its simplest form is:
xmessage "SIG is cool"
try that in your terminal and hit enter. if you did, you will see the following window:
there are other futures that make xmessage more user friendly, and more usable. for instance, add the
-default okay switch to activate the okay button when you hit enter. also, you can load an entire text file in the text area by using
now, how about adding a few extra buttons? you can add more buttons by using the
-buttons switch. two buttons are added: “yes”, and “no”. “yes” is the default. the command:
xmessage "SIG is cool" -buttons "yes:10, no:11" -default yes
at this point you might be wondering how this can help make a robust GUI for your application. this is where bash really comes in. open a text editor and write the following:
#! /bin/bash xmessage -center "SIG is cool" -buttons "yes:10, no:11" -default yes answer=$? if [ $answer -eq 10 ]; then xmessage -center "You rock man" -default okay else xmessage -center ";_; ... i'm not crying ..." -default okay fi
this is a simple bash script that behaves in the following manner:
"SIG is cool" | +-> yes: "You rock man" | +-> no: ";_; ... i'm not crying ..."
first save your script as “sig.sh”. then add excution permissions:
cd /your/scripts/directory chmod +x sig.sh
once this has been done, simple start the script by issuing: (while still in the same directory)
or you can double click, and choose run. any way you do it you should get the following: