visitor stats
up home page bottom

French German version Spanish version Italian version

Archive for Programming

Registry Edit - Hide Specific Hard Drives

1 Star5 Stars (+15 rating, 3 votes)
Loading ... Loading ...

Ever wish you could make one of your computer’s drives invisible to anyone snooping around on your system? Well, happy days are here my friend! Whether you have sensitive docs, pictures, or any other private data, this is one of the easiest ways to keep them safe. Keep in mind that you’ll still be able to access your hidden drives; you just won’t see that they exist in Windows Explorer or the My Computer folder. Back up your registry before you start!

1. Open Regedit.

2. Navigate to one of these strings:

HKEY_CURRENT_USER\Software\Microsoft\Windows\
CurrentVersion\Policies\Explorer - this only changes the settings for the current logged in user

HKEY_LOCALMACHINE\Software\Microsoft\Windows\
CurrentVersion\Policies\Explorer - this changes the settings for all users on the machine. You may have to create the key folder “Explorer” manually.

3. In the Explorer key folder, create a new DWORD value by right-clicking Explorer, then choosing New DWORD value. Name the value “NoDrives” (without the quotes). This value defines local and network drive visibility for each logical drive on the computer. All drives will be visible as long as this value’s data is set to 0.

4. Following the table below, enter the decimal number corresponding to the drive(s) you want to hide as NoDrives value data. When you right-click on NoDrives and choose Modify, make sure you select Decimal base, not Hexadecimal.

Drive Number to hide
A: 1
B: 2
C: 4
D: 8
E: 16
F: 32
G: 64
H: 128
I: 256
J: 512
K: 1024
L: 2048
M: 4096
N: 8192
O: 16384
P: 32768
Q: 65536
R: 131072
S: 262144
T: 524288
U: 1048576
V: 2097152
W: 4194304
X: 8388608
Y: 16777216
Z: 33554432
All drives 67108863

If you want to hide more than one drive, you simply add the drive amounts together for a combined total.

For example, to hide the D:/ and T:/ drives, add the decimal value for the D:/ drive to the decimal value to the T:/ drive.

8 (D) + 524288 (T) = 524296

To disable all of your visible drives, set the value to 67108863.

You must reboot your PC to see your changes.

Edit Filenames and Content with Ruby.

1 Star5 Stars (No Ratings Yet)
Loading ... Loading ...

Very interesting piece of code here. Essentially this will take all .php files, and change their extensions to a .sphp file extension. Then it will replace all instances of ".php" in the files, and replace them with ".sphp" for purposes of linking, and inclusion. Very neat script.

RUBY:
  1. <p style="font-weight: normal; font-family: 'Andale Mono', 'Courier New', Courier, monospace">#!/usr/bin/env ruby</p>
  2. require 'find'
  3.  
  4. require 'fileutils'
  5. <p style="font-weight: normal; font-family: 'Andale Mono', 'Courier New', Courier, monospace"># Used to go through, starting at the directory start_dir and working</p>
  6. <p style="font-weight: normal; font-family: 'Andale Mono', 'Courier New', Courier, monospace"># recursively, and rename all files that end in .php to end in .sphp</p>
  7. <p style="font-weight: normal; font-family: 'Andale Mono', 'Courier New', Courier, monospace"># because the CS admin got a wild hair.  Also goes through all .php</p>
  8. <p style="font-weight: normal; font-family: 'Andale Mono', 'Courier New', Courier, monospace"># and .sphp files and replaces all instances of ".php" in them with</p>
  9. <p style="font-weight: normal; font-family: 'Andale Mono', 'Courier New', Courier, monospace"># ".sphp".</p>
  10. def finder( start_dir )
  11.  
  12.   Find.find( start_dir ) do |path|
  13.  
  14.     if FileTest.file?( path )
  15.  
  16.       if path =~ /\.php$/i
  17.  
  18.         old_name = File.basename( path )
  19.  
  20.         new_name = old_name.gsub( /\.php$/, '.sphp' )
  21.  
  22.         dir = path.gsub( /#{old_name}$/, '' )
  23.  
  24.        
  25.  
  26.         if File.exists?( dir + old_name )
  27.  
  28.           puts "#{dir + old_name} to #{dir + new_name}\n"
  29.  
  30.          
  31.  
  32.           # Since the code is part of a Subversion repository, we use
  33.  
  34.           # the 'svn' command to let Subversion rename the file
  35.  
  36.           system( "svn mv #{dir + old_name} #{dir + new_name}" )
  37.  
  38.         end
  39.  
  40.       elsif path =~ /\.sphp$/i || path =~ /\.php$/i
  41.  
  42.         puts "Replacing instances of '.php' in #{path}\n"
  43.  
  44.         system( %Q{ruby -pe 'gsub(/\\.php/, ".sphp")' -i #{path} } )
  45.  
  46.       end
  47.  
  48.     end
  49.  
  50.   end
  51. <p style="font-weight: normal; font-family: 'Andale Mono', 'Courier New', Courier, monospace">end</p>
  52. finder( '.' )

Source: 3Till7

Ruby On Rails - Getting Started

1 Star5 Stars (+5 rating, 1 votes)
Loading ... Loading ...

Ruby on Rails is an open source web application framework. It is written in Ruby and follows the MVC or Model-View-Controller architecture. Developers using RoR appreciate the ability to create applications using less code and requiring a minimum of configuration.

RoR has been picking up a lot of speed lately. Most notably is the Blog with comments in 15 minutes tutorial video.

How does one get started with RoR though? Hopefully we can help you out a bit here.

Read the rest of this entry »

The Oreilly “In a Nutshell” series.

1 Star5 Stars (+5 rating, 1 votes)
Loading ... Loading ...

I recently came across a repository of the Oreilly "In a Nutshell" book series in PDF, and CHM formats. I do realize most are dated, but some may come in handy none the less.


C++ in a Nutshell
2003

VB.NET Language in a Nutshell
2001

VB.NET Language in a Nutshell
2nd Edition
2002

VB.NET Core Classes in a Nutshell
2002

.NET Windows Forms
in a Nutshell
2003

MCSE:
Windows 2000 Exams in a Nutshell

2001

VB & VBA in a Nutshell: The Language
1998

ASP in a Nutshell
1999

Ruby in a Nutshell
2001

ASP.NET in a Nutshell
2002

ASP.NET in a Nutshell
2nd Edition
2003

Windows Server 2003 in a Nutshell
2003

Windows XP in a Nutshell
2nd Edition
2005

Linux in a Nutshell
4th Edition
2003

Cisco IOS in a Nutshell
2001

LPI Linux Certification
in a Nutshell
2001

J2ME in a Nutshell
2002

PC Hardware in a Nutshell
2nd Edition
2002

PC Hardware in a Nutshell
3rd Edition
2003

SQL in a Nutshell
2001

Sequence Analysis in a Nutshell
2003

Dreamweaver in a Nutshell
2001

ADO.NET in a Nutshell
2003

AppleScript in a Nutshell
2001

C# in a Nutshell
2nd Edition
2003

Cocoa in a Nutshell
2003

MacOS X in a Nutshell
2003

Python in a Nutshell
2003

Web Design in a Nutshell
1999

Webmaster in a Nutshell
3rd Edition
2002

Unix in a Nutshell
2nd Edition
1992

Unix in a Nutshell
3nd Edition
1999

Lingo in a Nutshell
1998

Source: Hell.Org.Ua

Rent A Coder, Elance, going to the slaughter? 22 hours of work != $500.

1 Star5 Stars (No Ratings Yet)
Loading ... Loading ...

Have you ever attempted (as a freelancer) to pick up some extra quick and dirty work on Rent-A-CoderELance, or ScriptLance recently? It's a very desperate situation.

Think of this scenario. You're reading a request for bid, on a project. Let's say for arguments sake, 10 page website, a little php for a contact form, and a logo. SEO too (which most people that I've dealt with just DEMAND and expect to be free). So let's break this down here:

  • Custom graphics and coding (let's assume CSS will be used).
  • Branding, design and conceptualization of a unique, original logo.
  • SEO on the site top to bottom.
  • PHP Programming for contact forms, and possibly for including certain areas of the website to make things easier on you.

 Now if you were to charge this person, WELL below market standard, let's just say $25-$30 an hour, and you spent let's guess, 8 hours on the project, that results in a net of: $240. That's already very low, but let's just assume, that you're doing ok now, and 8 hours won't break your back. So you get back after reviewing the posted bid, and go to make your own. What do you see? People offering to do it, in one day, for $100, $95, even $50! Usually there will be someone with a lot of reviews, a very large amount in fact, overbidding big time, simply because they're banking on their reviews netting them the most amount of money (whether or not it's QUALITY work begs to reason, however they do have a lot of reviews).

So what are you to do? You've already gone well below your market worth, and you're willing to cut corners, and do it in 8 hours, but there just is no way to compete in those markets with numbers such as that. It just wouldn't be worth your time.

I've run into this debacle quite a few times. And it's the same across the board on most all of the freelance websites I've seen. Often I find Craigslist to be a better pool, however even on there, people will ask for a Myspace clone, with FaceBookoptions, and the usability of google, for $100, or FREE! It's ridiculous! It's insulting.

Rent A Coder tends to have a bit more of a higher quality base to it, however it still suffers somewhat from the plague of cheap labor that abounds on the internet. Usually it's a firm, who has 50+ employees, who they pay low wages, and the workers scour the internet for work, at even lower prices. In such mass quantities however, the firm makes it big in the end. They're essentially capitalizing the freelance sector right now. Is this fair? Who's to say. It's more of an economical thing than anything else. Life expenses are a lot less in the countries these programmers are coming from. It still makes it very difficult on everyone else.

I'm interested to hear any other views on this subject. Please comment if you have some, I'll update this post as I see fit.

PHP Security Guide (XSS, Injection, CSRF and more).

1 Star5 Stars (No Ratings Yet)
Loading ... Loading ...

Rob Miller wrote a really great article on PHP Security. He makes a lot of good points, and suggestions, with real world examples and scenarios. Definitely worth reading. The article covers: XSS, SQL Injection, CSRF, among an array of other possible vulnerable avenues in PHP programming. Check it out if you ever do any kind of PHP programming, and want to keep it safe.

Link: PHP Security Guide

302 Useful APIs.

1 Star5 Stars (No Ratings Yet)
Loading ... Loading ...

Google, Youtube, Amazon, del.icio.us, all the big names release APIs for development and interaction with their services. It can be daunting trying to break into the external API scripting arena of programming. Here is a very long list of 302 USeful APIs. Upon clicking on any of them, you will be taken to a page that lists all of the information about that individual API, along with a download link. Definitely worth checking out!

List:

Read the rest of this entry »

PHP - Directory Listing

1 Star5 Stars (No Ratings Yet)
Loading ... Loading ...

Just thought I'd end the night with a simple script. This PHP script will list all file, directory, and sub directories, and will even make links out of them.

PHP:
  1. <p id="innersource" class="nowrap">
  2. <pre class="php">//define the path as relative
  3.  
  4. $path = "/home/yoursite/public_html/whatever";
  5.  
  6. //using the opendir function
  7.  
  8. $dir_handle = @<a href="http://www.php.net/opendir">opendir</a>($path) or <a href="http://www.php.net/die">die</a>("Unable to open $path");
  9.  
  10. <a href="http://www.php.net/echo">echo</a> "Directory Listing of $path&lt;br/&gt;";
  11.  
  12. //running the while loop
  13.  
  14. while ($file = <a href="http://www.php.net/readdir">readdir</a>($dir_handle))
  15.  
  16. {
  17.  
  18. //encode spaces
  19.  
  20. $file =  <a href="http://www.php.net/rawurlencode">rawurlencode</a>($file);
  21.  
  22. // convert the + (this is one result from the function rawurlencode) in %20
  23.  
  24. $url = <a href="http://www.php.net/str_replace">str_replace</a>('+' , '%20' , $file);
  25.  
  26. <a href="http://www.php.net/echo">echo</a> "&lt;a href='".$url."'&gt;".$url."&lt;/a&gt;&lt;br/&gt;";
  27.  
  28. }
  29.  
  30. //closing the directory
  31.  
  32. <a href="http://www.php.net/closedir">closedir</a>($dir_handle);</pre>

A Quick and Dirty CAPTCHA Using PHP and the GD Library.

1 Star5 Stars (No Ratings Yet)
Loading ... Loading ...

If you're just starting to get into PHP you may be a bit confused about how the GD Library works, and how to implement that into things such a CAPTCHA. This is a very easy implementation of a captcha. This will help stop spammers, and spam bots from abusing your form, or spamming your server.

I won't however, prevent the abuse as noted in Jeff Atwoods post, it will however help.

So, let's say you have a public submission or contact form on your website, that looks somewhat like the following:

HTML:
  1. <form method="post"> Contact us:
  2. <textarea cols="30" rows="5" name="simple_contact"></textarea>
  3. <input value="Submit" type="submit" />
  4. </form>

We'll use a captcha to keep this form somewhat safe ().

Obviously you need a PHP engine enabled for your Web server to execute PHP scripts, and GD (PHP graphics library) to generate the image. The solution below is tested for Apache (Windows and Unix), IIS (Windows), PHP-4, PHP-5, GD and GD2.

1) Make a PHP script (separate file captcha.php) which will generate the image:

PHP:
  1. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  2. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  3. header("Cache-Control: no-store, no-cache, must-revalidate");
  4. header("Cache-Control: post-check=0, pre-check=0", false);
  5. header("Pragma: no-cache");
  6.  
  7. function _generateRandom($length=6)
  8. {
  9. $_rand_src = array(
  10. array(48,57) //digits
  11. , array(97,122) //lowercase chars
  12. //        , array(65,90) //uppercase chars
  13. );
  14. srand ((double) microtime() * 1000000);
  15. $random_string = "";
  16. for($i=0;$i&lt;$length;$i++){
  17. $i1=rand(0,sizeof($_rand_src)-1);
  18. $random_string .= chr(rand($_rand_src[$i1][0],$_rand_src[$i1][1]));
  19. }
  20. return $random_string;
  21. }
  22.  
  23. $im = @imagecreatefromjpeg("captcha.jpg");
  24. $rand = _generateRandom(3);
  25. $_SESSION['captcha'] = $rand;
  26. ImageString($im, 5, 2, 2, $rand[0]." ".$rand[1]." ".$rand[2]." ", ImageColorAllocate ($im, 0, 0, 0));
  27. $rand = _generateRandom(3);
  28. ImageString($im, 5, 2, 2, " ".$rand[0]." ".$rand[1]." ".$rand[2], ImageColorAllocate ($im, 255, 0, 0));
  29. Header ('Content-type: image/jpeg');
  30. imagejpeg($im,NULL,100);
  31. ImageDestroy($im);
  32. ?&gt;

2) Add the following line at the top of the page where you need to implement CAPTCHA:

PHP:

3) Add the following line to check whether the CAPTCHA string entered by the visitor is valid, before the line where you will proceed with a submitted message:

PHP:
  1. if($_SESSION["captcha"]==$_POST["captcha"])
  2. {
  3. //CAPTHCA is valid; proceed the message: save to database, send by e-mail ...
  4. }
  5. ?&gt;

4) Finaly add the CAPTCHA to the form:

PHP:
  1. <form method="post">
  2. <table bgcolor="#cccccc">
  3. <tr>
  4. <th>Contact us (Post new message):</th>
  5. </tr>
  6. <tr>
  7. <td><textarea cols="30" rows="5" name="message"></textarea></td>
  8. </tr>
  9. <tr>
  10. <td align="center">CAPTCHA:
  11.  
  12. (antispam code, 3 black symbols)
  13. <table>
  14. <tr>
  15. <td><img src="captcha.php" alt="captcha image" /></td>
  16. <td><input name="captcha" size="3" maxlength="3" type="text" /></td>
  17. </tr>
  18. </table>
  19. </td>
  20. </tr>
  21. <tr>
  22. <th align="center"><input value="Submit" type="submit" /></th>
  23. </tr>
  24. </table>
  25. </form> if(isset($_POST["captcha"]))
  26. if($_SESSION["captcha"]==$_POST["captcha"])
  27. {
  28. //CAPTHCA is valid; proceed the message: save to database, send by e-mail ...
  29. echo 'CAPTHCA is valid; proceed the message';
  30. }
  31. else
  32. {
  33. echo 'CAPTHCA is not valid; ignore submission';