Follow Me On...

Entries by Blake Robertson (47)

Wednesday
Oct182006

Apache2: Allowing Directory Listings for a Particular Directory

Assuming you haven’t modified the default httpd.conf <Directory> section for your webroot folder or done some else funky with permissions all you have to do is add the following lines somewhere in your httpd.conf.

<Directory “R:\webroot\some\subdirectory”>
   Options +Indexes
</Directory>
— Apache 2.2.x
Saturday
Sep302006

Batch Snippets

To obtain the path of the batch file which is currently executing!
echo %~dp0


A simpler way to comment!
@rem This is an ugly comment.
:: This is also a comment!


Prompt the user for a string!
@SET /p FolderName=What do you want the subdir folder to be called? (No Spaces!): 


Create a timestamp with Date and Time with a underscore seperating them.

set DateStamp=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%
set TimeStamp=%TIME::=%
set TimeStamp=%DateStamp%_%TimeStamp:.=%
set TimeStamp=%TimeStamp: =0%
echo %TimeStamp% 
:: TimeStamp is like 20120326_13034087


Tests to see if an svn export was successful. This snippet could be applied to a lot of situations where you want to test if a command was successful.

svn export <REPO_URL> C:\path\to\outputdir --username <USERNAME> --password <PASS> --non-interactive
set svnErrorLevel=%ERRORLEVEL%
IF NOT %svnErrorLevel% == "0" GOTO FAILED

rem PUT STUFF HERE THAT SHOULD EXECUTE ONLY IF EXPORT WAS SUCCESSFUL

GOTO end
:FAILED


How to test to see if an argument is set. (Notes: 1) there must be quotes around the %1 and 2) the goto

if "%1" == "" goto displayUsage
NOTE: I asked a question about this on stackover flow and got a good answer that works even when you have variables that might have quote in it. Google blak3r on stackoverflow + batch test and you’ll probably find it.

Add a user definable delay, where the number following -n is number of seconds

ping -n 2 1.1.1.1 > NUL

Sunday
Sep242006

Real Time Log Viewer Applications Review

When running applications as a service you don’t get a window which updates in realtime spewing out all the info the service prints like you do when you open the application from the command line.  In order to see all that information, you open up log files which when you open them up in a regular text editor like notepad do not update in realtime hence the reason for a real time log viewer.

The list below are my thoughts on the real time logger applications i found.

1) ABLog - open source, works well, only problem i had is it couldn’t be controlled by command line which was a requirement for me.

2) baretail (free version) -
    Pros: best UI out of all of them. No installer (just an exe), command line support
    Cons: has an annoying spash screen (can be removed for $25), no timestamping, no search capabilities, and no filtering capabilities.

3) baretail (pro) - all the pros as above + timestamping, searching, filtering but costs $45.

3) Hoo WinTail - has a ton of features which i’d probably never use.  Didn’t work with my particualr log file which i was creating with hyperterminal capturing data.  So, i didn’t fiddle with it too much.

4) Log Viewer by brinesoft - ran into the same problems i did with Hoo WinTail.  One neat thing about their program is it is intended to color code by groups.   

Wednesday
Sep202006

Windows SVN Repo Backup Script

Heres a simple windwos svn repo backup script i wrote. It makes a safe copy of three different svn repos i had. Each repository is backed up to a folder which has a date prefix and is located in the path specified by BACKUP_FOLDER.

REM —————————————————+
REM |SVN REPO BACKUP BATCH FILE |
REM |Created 9/20/06 - Blake Robertson|
REM —————————————————+

SET DATE_STR=%Date:/=%

SET BACKUP_FOLDER=R:\svn_backups

SET MIDDLEWARE_REPO=R:\svn_repo1
SET FW_REPO=R:\svn_repo2
SET DOCS_REPO=R:\svn_repo3

echo ——[ Middleware Backup ]————
SET DEST_PATH=”%BACKUP_FOLDER%\%DATE_STR%_middleware-svn_repo”
svnadmin hotcopy MIDDLEWARE_REPO DEST_PATH

echo ——[ Firmware Backup ]————
SET DEST_PATH=”%BACKUP_FOLDER%\%DATE_STR%_firmware_svn_repo”
svnadmin hotcopy FW_REPO DEST_PATH

echo ——[ DOCS Backup ]————
SET DEST_PATH=”%BACKUP_FOLDER%\%DATE_STR%_docs_svn_repo”
svnadmin hotcopy DOCS_REPO DEST_PATH
Wednesday
Sep202006

Fixing SVN Issues

When using tortoiseSVN you’re bound to eventually run into some of the issues below.  (Note: most of them can be avoided by right clicking and dragging when moving files etc.)

After 8 months or so of using SVN i’ve finally learned how to resolve them instead of working around them.  I intend to post fixes as i encounter them from now on.

Situation 1

Error Message:
Error    Commit failed (details follow):
Error    ‘xxxx’ is not under version control  

SOLUTION: IF YOU ACTUALLY DON’T WANT THIS FILE OR FOLDER.

Steps:
1) Do an SVN Update.
2) Commit any changes from this directory except for the file(s) that give you the error (uncheck those).
3) On the parent folder do an SVN revert.
4) It will report that there were no changes, click okay anyway and hopefully your problem is gone.

Here are some screenshots of an example problem i had.

 910-477206-thumbnail.jpg

 910-477218-thumbnail.jpg

910-477222-thumbnail.jpg 910-477224-thumbnail.jpg

Sunday
Sep032006

Which material finish should i use!?

When it comes to buying metal stand offs and screws the common materials are Aluminum, Brass, Brass + Zinc or Nickel Plating, Stainless Steel (at least when buying from Digikey).

I didn’t know what the advantages and disadvantages of each were so this post is to summarize what i found out.

In a nutshell…
If there is nothing special about your application, then use Zinc plated steel or aluminum.  If you want them to conduct electricity and they don’t need to be very strong use brass.

  • Zinc - Plated Steel
    • Pros:
      • Economical
      • Most Popular if you consider other types of hardware outside the realm of just what used at the PCB level.  For example: You are likely to be able to find Zinc Plated hex lock nuts but not brass lock nuts.
      • Zinc Plated Screws and Stand offs are readily available which is a good thing because you don’t have to mix metal types (see links below).
    • Cons:
      • The coating can be scratched off leaving it susceptible to corrosion.
      • Steel is more magnetic then stainless steel which might be an issue to certain electronics.
    • USED: most common fastener material because it’s the cheapest and it’s easier to find matching materials.
  • Aluminum
    • Pros: inexpensive and lighter then steel or brass
    • Cons: poor conductors and relatively soft.
  • Stainless-Steel
  • Brass/Zinc
    • Pros:
      1. Best Conductor of Electricity
      2. Fairly easy to find brass stand offs
    • Cons:
      1. Slightly more expensive then Zinc Plated Steel
      2. Not as strong as steel.
      3. Hard to find Brass Screws
    • USED WHEN: Appearence is a concern or when you want the standoff to be the best conductor.

 

Other Interesting Info:

 

Galvanic Corrosion

Galvanic Corrosion is something you should probably read up on if corrosion is of any concern.  Here are some good links;

Galvanic corrosion occurs when dissimilar metals are in electrical contact in water especially salt water. As a small electrical current flows from one metal to the other, one metal will begin corroding faster than normal (the anode) and the other will corrode more slowly than normal (the cathode). The result is that the anode material will be eaten away much more quickly than the cathode material. 

http://hometown.aol.com/haminfo/hammingout.html

 


Availability of each type on Digikey:

By using the parametric search feature on digikey i selected each material finish on at a time.  The idea being the part part which has the most items is a good indicator of the material which is the most common.

Metal Standoffs (Total of 671 items):
Aluminum - 33 items (ONLY 1 in stock)
Aluminum + Iridite Finish - 207 items (159 item in stock)
Brass - 3 items
Brass/Nickel - 192 items (100 are instock)
Brass/Zinc - 154 items. (88 in stock)
Stainless Steel - 82 items (ONLY 4 are actually in stock).

Hardware/Accessories->Screws/Bolts
Then Filtered Nylon out there are a total of 223 items:
Brass/Nickel -  2
Stainless Steel - 100
Steel, Nickel Plated - 5
Steel, Zinc Plate - 110
Steel, Black Oxide - 5 (all non-stock items)

Material Price Comparison

Looked at common standoffs which had digikey had in stock which could be purchased in each material type.

For a 4-40 0.25” Hex standoff in QTY of 100
Aluminum + Iridite = $0.18
Brass/Zinc           = $0.19
Stainless Steel = $1.12

 

 

 

Friday
Aug252006

Microchip PWM Calculator Spreadsheet

Here is a link to a spreadsheet lists the resulting PWM frequencies based on what the applications oscillator frequency, period register (PR) , Prescaler, and Postscaler are set to.

This is useful for visualizing resolution available and min and max frequencies.

CLICK HERE TO DOWNLOAD 

Page 1 ... 1 2 3 4 5