USB Ethernet adapters

For my reference, i got the following USB Ethernet adapters from Carefour today, at JD2 each (around $3)

The light green has the chip DAVICOM DM9000E 0350s MHGW95, what windows sees is PM9601 USB NIC KMDF
A sticker on the back reads LH : 201103188

The blue ones have a chip that is not readable,
Sticker reads
XH-QF9700 2011-07-668A

The 2 CDs that came with them are in my drivers folder, Linux compatibility et all testing under way

Windows server 2008 R2 32GB memory limit

Microsoft server 2008 R2 STANDARD seems to have a 32GB memory limit, so my Windows server reports memory as follows

64.0 GB (32.0 GB usable), and this is indeed what Microsoft tells me on this page

http://msdn.microsoft.com/en-us/library/aa366778%28VS.85%29.aspx#physical_memory_limits_windows_server_2012

If it appears that VMWARE is using some of the 32 spare gigabytes and leaving the system memory alone, this is an illusion because vmware workstation does not allocate all the memory of the VM at power on, give it a few hours, or copy a very big file within the workstation and it will take the ram away.

By the way, i had to write this because the answer is only available on a website that wants me to become a member to show me this information, so i experimented myself and put this information up for grabs. no one should have to pay $12 a month for a subscription to a website that displays information the site owners never even contributed to finding.

Progress bar and transfer rate in CP and MV command

The lowdown

Install iostat, then run (in a second command window) the command

iostat -k -x 2

Change the 2 for any refresh rate, no matter the refresh rate, you will get the KBytes per seconed both read and write for both disks involved in the copy. You will also get the total copied for the period of time between refresh, so always take note of the (per second) sign in kB_read/s and kB_wrtn/s.

To recap, kB_read/s and kB_wrtn/s are not affected by the interval you set, while kB_read/s and kB_wrtn/s. are affected (they are the result of multiplying the speed (/s) by the interval you set

The K stands for KiloBytes (the default is blocks), you can also use m for megabytes
the X stands for Extended statistics (You probably dont need it for this particular purpose)

We are doing the above because CP and MV do NOT provide means of monitoring transfer rate.
Some other solutions like pv and rsync do, but would you want to get into all of this every time you want to copy a file or folder ?

Anyway, here is a rundown of all the ways that can allow you to monitor speed when you copy or move

(I will come back to this in a bit.

Orange Internet of Jordan are idiots

Not only is Orange internet the most expensive in Jordan, they are also the most idiotic.

I pay them loads of money for the internet (more than 2JDs per gigabyte) and i get rar files that don’t match the MD5 sum of the upstream, and the reason turns out to be that i have CLICK HERE IF YOU ARE NOT REDIRECTED wthin my multi-part downloaded rar files.

The geniuses at Orange internet Jordan decided not to inspect the http headers and make sure they are HTML before they tell me about my quota.

The geniuses at orange should have inspected if the header contains “Content-Type: text/html” where you don’t replace

a downloading file part that specifically reads “Content-Type: application/octet-stream” with an html file reading (you are approaching your quota), at least because the zip file is not opening inside the browser Mr. genius, you are just corrupting the downloads i paid you for.

Comparing orange to umniah, you will notice that umniah is at least 5 times cheaper, and they don’t play silly games that end up ruining your day, they are also reliable, go umniah

أورنج أنترنت الأردن … أغبياء

بالأضافه الى كون الأنترنت من أورنج الأغلا تمناً، هم أيضاً الأغبى على الأطلاق

أنا أدقع لهم الكثير (أكثر من دينارين للجيجابايت) و أحصل على ملفات غير مطابقه للملفات التي أقوم بتنزيلها، و السبب هو أن تحذير أورنج من أقتراب حد التنزيل يظهر داخل ملفاتي التي تنزل على أجزاء.

العباقره عند أورنج قرروا عدم النظر الى بدايات الأتصال و التاكد من البدايه التي تقول “Content-Type: text/html”، فهم يستبدلون بايناري فايل “Content-Type: application/octet-stream” ببيانات نصيه بدون النظر الى الهيدرز

عند مقارنه أورنج بامنيه، ستجد أن امنيه أرخص بخمس مرات و لا يقومون بالعاب سخيفه رعناء لأفساد يومك، و أعتمادستهم جيده. الى الأمام أمنيه

Undeleting files from windows partitions

So, i will be doing this under linux for a good reason

My friend gave me his computer so that i can recover everything for him, he deleted all the photos and so many other things, photos of his family are most important to him.

So, becuase i have been holding his computer hostage for a week now, i decided to copy the entier hard drive so i can give him his computer back, and extract everything at my convinience, so after mountingf the disk i want to undelete from… i executed the command.

ddrescue /dev/sdb /hds/3tb/200gb.img /root/resumelog.log

So i had the image file that i can use for recovery after mounting

Now if as in the article here http://www.buildingcubes.com/2012/07/27/rescuing-a-failed-hard-drive/ i mounted the drive, i can use a nice linux command (ntfsundelete) to undelete the files from the mounted partition.

1- create a list of files to take a look at, put all deleted JPGs in a text file
ntfsundelete /hds/img -m ‘*.jpg’ -p 80 -t 8m > deletedmp3.txt
ntfsundelete /dev/loop0 -m ‘*.zip’ -p 50 -t 8m > deletedjpg.txt

2- change to the directory where you want to recover files to
cd /hds/wd1tb/newdir

3- recover all PNG files then all jpg files
ntfsundelete /dev/sda1 –u –m *.png
ntfsundelete /dev/sda1 –u –m *.jpg

or if i want to move them to a directory other than the active directory
ntfsundelete /dev/sda1 -u -m ‘*.jpg’ -p 90 -t 8m -d /hds/wd1tb/newdir

-p 90 means only recover files with at least 90% recoverable content
-t 5m means only files deleted in the past 8 months

Seriously retarded P698 gets an update, the LG optimus net duos

Before i tell you that there has been a software update for this phone, let me remind you of my review of the phone

The lowdown: right after the update, i tested the P698 dual sim android, and i can say that the phone which was a disaster before the update is perfectly usable now, i would still prefer the samsung galaxy Y duos (GT-S6102)

I have only used this phone as a 3G modem up to now, when i tried to use it as a phone, it was a disaster, the phone battery does not last for a day, and this is nothing compared to the very faulty software, ending a phone call is very hard to do (you need to wait 10 seconds before you can be sure the other party can no longer hear you) that is, if this magical phone does not get into stupid mode and make ending the phone call mission impossible, in short, the phone is a disaster.

Worth mentioning is that the phone hardware is pretty OK, in some regards better than the Samsung Y duos, it is the software that is a disaster, the only thing that i consider essential and is missing from the hardware is the proximity sensor (the one that disables the touch screen when the phone is close to your face). CORRECTION: THE LG P698 does have a proximity sensor, and with the new update it works just fine.

So, today i decided to check whether the phone got a new software update, and indeed it has (the second), this update is named (and dated) v10g-jul-06-2012, where the update right before this one was v10f-mar-07-2012, so what did LG do in those 3 months, any news of fixing the bugs that were killing me ?

I will now install both my lines into this phone (from my very usable and useful Samsung Y duos), i will try the phone for a couple of days and let everyone know of the results, i am not optimistic

I will be back in a couple of days to tell you all if the phone is better now.

The update:
The new update improves the software so that this phone is now usable compared to a phone i bought and could not use, the samsung galaxy Y duos is still better than this phone (and has the swype application that is very nice), so i am still favoring the Samsung Galaxy Y duos, but the LG P698 is not so bad now, it works as a phone just fine

Windows dissapeared from Grub boot menu with debian

There seems to be a certain bug with Debian, when installing it on the same hard drive with Windows, on the next boot, windows is not one of the options, so what you can do is this

update-grub

You will see results such as

update-grub
Generating grub.cfg ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-2.6.32-5-686
Found initrd image: /boot/initrd.img-2.6.32-5-686
Found Windows 7 (loader) on /dev/sda1
done

Grub should now find you missing windows and add it to the boot menu !

I wrote this for my own reference, because every time i install i spend so much time trying to find the magic words online again

Relaying mail with PHP

Relaying mail with PHP

Sending mail through a mail server that requires authentication (A username and password).

This article is when you do NOT want to use your server’s MTA with PHP, and you want to send through an MTA that requieres authentication (A remote mail server)

When sending email from your own MTA with sendmail, PHP can use the mail() function to send such mail by smply passing the mail function some arguments, Even when the MTA is on a different computer that allows you to send mail (By validating your IP), changes can be made to PHP.INI to make the mail function work as needed.

But when you want to automate sending emails from something like a GMAIL account or a Godaddy Mail Server, things are different, You will need to connect to the SMTP server and ask it to relay your mail, for that the server will ask you for Authentication credentials, this tutorial will show you how to send email from a different email provider.

So, to begin with, you will need to download this script that i originally obtained from the open source GPL Coppermine Project, they in turn took the code from the GPL PHPMailer, a small change is required to make this file work.

Click here to download the mail slass scripts

What this script is about to do is exactly what your Outlook or Thunderbird do when you manually send a message from them, this is not a magic solution, the Gmail sending limits still apply, and all other big providers have limits even when you are a paying customer. mail providers need to protect there servers from being labled as spammers, some rules need to be in place.

Also, before you start, you should look carefully at the limits, not only is there a send limit, a large number of bounces will also lock your account in the case of Gmail and others.

In this tutorial we will use the functions in the PHPMailer class “http://phpmailer.sourceforge.net/”, it is free GPL software.

but rather than downloading it from PHPMailer’s website, we will take it from within the Coppermine Gallery Software, the file we need is include/mailer.inc.php

a few modifications need to be done, First seach for the string “connect to the smtp server” and add the following lines above it

$host = “ssl://smtp.gmail.com”;
$port = 465;

then search for “function ServerVar”, and right after the opening “function ServerVar {” and before “$superCage = Inspekt::makeSuperCage();” add

return ”;

Now, our mailer script should be ready !

Now, create a new PHP file (sendmymail.php), and within that paste the following code, Fix all names, credentials and email addresses.

require 'mailer.inc.php';
$mail = new cpg_PHPMailer();//this is the name of the class in coppermine
$mail->IsSMTP(); // send via SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "username@gmail.com"; // SMTP username
$mail->Password = "password"; // SMTP password
$webmaster_email = "username@doamin.com"; //Reply to this email ID
$email="username@domain.com"; // Recipients email ID
$name="name"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Webmaster";
$mail->AddAddress($email,$name);
$mail->AddReplyTo($webmaster_email,"Webmaster");
$mail->WordWrap = 50; // set word wrap
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // If you want to add attachments !
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // If you want to add attachments
$mail->IsHTML(true); // send as HTML
$mail->Subject = "This is the subject";
$mail->Body = "Hi,
This is the HTML BODY "; //HTML Body
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body.
if(!$mail->Send())
{
	print "Mailer Error: " . $mail->ErrorInfo;
}
else
{
	print "Message has been sent";
}

?>