473,465 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PHP Portability Tip

No, this isn't what you thought the subject of this post meant. It's
better.

I just wanted to share with you something I did that makes editing PHP
and carrying your projects back and forth a little easier. (That's
what I mean by portability in this case.)

I often go between my day job and my home, carrying code. I used to
either email it to myself and pick it up, or FTP it to my website, or
risk everything and put it on a floppy. (Most often the floppy would
fail.)

Then came along this USB Memory Key thing. I picked up one from Dell
that I thought was really durable and affordable. Try $35 for 128MB
(Oct 2003 price). So I started putting my PHP code there.

Then it dawned on me. Why don't I use my Linux and Apache to
automatically mount my web directory with the latest project directory
when I insert my USB Memory Key in? That way, I don't have to copy
files around because I'm always editing them on the USB Memory Key. I
found that this was sufficiently fast, and you probably will to.

So, how does that work, exactly?

I'd rather answer your questions about it specifically than take the
time to spell it all out, dumping Bash code scripts and so on, but
it's really relatively simple. You can probably take the concepts here
and do the same thing on Windows with Apache or IIS.

The way I do this is to first do the steps to mount my USB Memory Key
in Linux. It shows up on my system as /dev/sda1 and I mount to
"/mnt/thumb" (thumb drive). If you do a search on Google Groups for
"googlemike usb", you'll find out this is done, but I found it can
involve "sudo" and "sudoers", as you'll see in that post.

Next, I made an icon on my desktop that I double-click. It's linked to
a Bash script. It asks if I want to mount or unmount the memory key.

Next, I made a soft link (Windows users can make a shortcut) from
inside my Apache's web directory at /var/www/html to point to
/mnt/thumb/projects/php/. Now when I point my web browser or IDE
there, it shows up.

There's a catch. The files must be edited as root, evidently, so I
have to make my PHP IDE -- Quanta -- load as root and edit the files
at /mnt/thumb/projects/php. The way I do that is with "sudo" and
"sudoers". My GNOME desktop icon for Quanta does:

sudo -u root /usr/bin/quanta

Now I can move quicker between office and home, carrying my latest PHP
code with me, and I don't have to use any file manager or type any
commands.

If you want more detail, ask me what you will and I'll try to help
you.
Jul 17 '05 #1
4 2140
Sound great in theory
But is this key thing a battery operated device?

I like the idea of it. I have an old Nokia 5510 or something at home which
had an MP3 Player on it but when I connect it to my windows 2000 machine it
just mounts as an removable storage device.

Good idea!
"Google Mike" <go********@hotpop.com> wrote in message
news:25*************************@posting.google.co m...
No, this isn't what you thought the subject of this post meant. It's
better.

I just wanted to share with you something I did that makes editing PHP
and carrying your projects back and forth a little easier. (That's
what I mean by portability in this case.)

I often go between my day job and my home, carrying code. I used to
either email it to myself and pick it up, or FTP it to my website, or
risk everything and put it on a floppy. (Most often the floppy would
fail.)

Then came along this USB Memory Key thing. I picked up one from Dell
that I thought was really durable and affordable. Try $35 for 128MB
(Oct 2003 price). So I started putting my PHP code there.

Then it dawned on me. Why don't I use my Linux and Apache to
automatically mount my web directory with the latest project directory
when I insert my USB Memory Key in? That way, I don't have to copy
files around because I'm always editing them on the USB Memory Key. I
found that this was sufficiently fast, and you probably will to.

So, how does that work, exactly?

I'd rather answer your questions about it specifically than take the
time to spell it all out, dumping Bash code scripts and so on, but
it's really relatively simple. You can probably take the concepts here
and do the same thing on Windows with Apache or IIS.

The way I do this is to first do the steps to mount my USB Memory Key
in Linux. It shows up on my system as /dev/sda1 and I mount to
"/mnt/thumb" (thumb drive). If you do a search on Google Groups for
"googlemike usb", you'll find out this is done, but I found it can
involve "sudo" and "sudoers", as you'll see in that post.

Next, I made an icon on my desktop that I double-click. It's linked to
a Bash script. It asks if I want to mount or unmount the memory key.

Next, I made a soft link (Windows users can make a shortcut) from
inside my Apache's web directory at /var/www/html to point to
/mnt/thumb/projects/php/. Now when I point my web browser or IDE
there, it shows up.

There's a catch. The files must be edited as root, evidently, so I
have to make my PHP IDE -- Quanta -- load as root and edit the files
at /mnt/thumb/projects/php. The way I do that is with "sudo" and
"sudoers". My GNOME desktop icon for Quanta does:

sudo -u root /usr/bin/quanta

Now I can move quicker between office and home, carrying my latest PHP
code with me, and I don't have to use any file manager or type any
commands.

If you want more detail, ask me what you will and I'll try to help
you.

Jul 17 '05 #2
Google Mike wrote:
There's a catch. The files must be edited as root, evidently, so I
have to make my PHP IDE -- Quanta -- load as root and edit the files
at /mnt/thumb/projects/php. The way I do that is with "sudo" and
"sudoers". My GNOME desktop icon for Quanta does:

sudo -u root /usr/bin/quanta


A better idea would be to give your user write permissions on the drive,
which involves chown you.yougroup /mnt/thumb , then see the manual
for 'mount' to mount the drive as to give you write access.

--
luc wastiaux - email: du*******@airpost.net
jabber: lu*@jabber.4002.org
ICQ: 76235870

Jul 17 '05 #3
"Michael Willcocks" <mi*****@metrogroup.com.au> wrote...
But is this key thing a battery operated device?

I like the idea of it. I have an old Nokia 5510 or something at home which
had an MP3 Player on it but when I connect it to my windows 2000 machine it
just mounts as an removable storage device.


Not a battery operated device. The things are called "pen drives",
"thumb drives", "usb memory keys" (on Dell website), and a myriad of
other names. They come in different shapes and sizes. Laks.com has one
that's a watch. Some come with built-in MP3 capabilities, voice
recorders, and many other features. Dell has told customers that it's
going to phase out floppy drives in favor of USB Memory Keys and more
USB slots on the front or sides of their systems and laptops. The USB
Memory Keys gain their power from the USB slot. They mount like a hard
drive and, except on Win 98, don't need a driver except with what
comes with Windows, Mac, or Linux for USB devices. My RedHat 9 sees it
at /dev/sda1 when I inserted it. I found this out when I su'd to root
and then did tail -f /var/log/messages upon inserting the drive. I
then tried mounting it with an ordinary mount command and voila -- it
worked.

Floppies and zip/jazz drives, essentially, are history and will go
down as klunky, noisy, slow, unreliable devices that took us three
decades to get rid of.

So, anyway, my Dell USB Memory Key works great with my PHP projects.
Happy code tote-ing!
Jul 17 '05 #4
In article <25*************************@posting.google.com> ,
go********@hotpop.com (Google Mike) wrote:
I often go between my day job and my home, carrying code. I used to
either email it to myself and pick it up, or FTP it to my website, or
risk everything and put it on a floppy. (Most often the floppy would
fail.)


I use CVS over SSH to keep home and work in sync. This also has the
advantage that your code is duplicated (instant backup). Of course, you
need a machine somewhere to which you have SSH access from home and work
to host the CVS repository for your code.

More about CVS: <http://cvsbook.red-bean.com/cvsbook.html>

JP

--
Sorry, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: Tim Tyler | last post by:
I just ported one of the apps I wrote using PHP 5 under Windows to PHP 4 under unix. I knew I wanted to deploy in this environment - and wrote my code in anticipation of running in the other...
7
by: fabio de francesco | last post by:
Hi, I'm not a professional programmer, but I've been writing C/C++ and Ada programs for a few years on GNU/Linux without ever concerning on standards and portability to other OSs. I've always...
21
by: asm | last post by:
Hi All, Like typdef, does C have further support for portability? Thanks, ASM
93
by: roman ziak | last post by:
I just read couple articles on this group and it keeps amazing me how the portability is used as strong argument for language cleanliness. In my opinion, porting the program (so you just take the...
93
by: jacob navia | last post by:
In this group there is a bunch of people that call themselves 'regulars' that insist in something called "portability". Portability for them means the least common denominator. Write your code...
239
by: Eigenvector | last post by:
My question is more generic, but it involves what I consider ANSI standard C and portability. I happen to be a system admin for multiple platforms and as such a lot of the applications that my...
10
by: Lionel B | last post by:
Greetings, I have some code that is to read unformatted data from disc and interpret it as blocks of unsigned integers. In an attempt to achieve efficiency (it is pretty essential for my...
18
by: jacob navia | last post by:
One of the holy cows here is this "portability" stuff. In practice, portability means: 1) Use the least common denominator of all the supported systems. 2) Between usability / good user...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.