Items filtered by date: December 2015

SVN is short for Subversion

This article will deal with the problem of running your own Windows Based SVN Tracker on your own Pc so you controll your files and do not have to pay a subscription.

There are a few free to use SVN Repositories on the net but have stipulations such as your project must be OpenSource

Server Software

Free Windows Based SVN Servers

  Collabnet Subversion EdgeVisualSVN Server XAMPP BasedTortoiseSVN
Free Windows Based SVN Servers
Info
  • Not only is this a client but it can be used as a Sudo-Subverion Server
Pros  
  • Free
  • Opensource
  • Installs in one stack:
    • Apache HTTP Server
    • Apache Subversion
    • ViewVC - Browser Based Visual Repository extension
    • Web Based Admin (Responsive Design)
    • Java 1.6 JRE/JDK
    • Python
  • Auto Update feature
  • Web Based Admin - controls most stuff and can be accessed remotely
  • SVN Edge has a feature called "Discover Repositories" that automatically adds all the existing repositories you have. You just point it at the folder that contains your repositories.
  • REST API - for things like adding repositories and can be used by 3rd parties
  • can configure secure or non-secure
  • can set any port number
  • You can select the installation folder
  • you can set the repository Folder Seperately
  • can sysnc backups and files to CloudForge
  • Option of a free CloudForfge account for backups (250mb limit)
  • Network and Disk Statistics
  • creates its own SSL Certificate for SSL
  • Active Directory Authentication Support
  • Good Documentation - Also linked inside the Web Admin
  • Email admins on certain events
  • scheduled backups
  • Free
  • Installs in one stack:
    • Apache HTTP Server
    • Apache Subversion
    • Windows Management Snap-In
  • Graphically driven
  • Microsoft Management Console add-in
  • easy to configure and setup
  • can configure secure or non-secure
  • 8mb Installer Package
  • creates its own SSL Certificate for SSL
  • You can select the installation folder
  • you can set the repository Folder Seperately
  • Free
  • can be run on an existing Xampp stack
  • SVN can potentially be made portable with this method
  • more configurable
  • free
  • easy to setup a repository
  • can use the TortoiseSVN client to perform client side hooks
  • ideal for an inexperience single developer who just wants to start using a SVN repository quickly
Cons
  • 103mb Installer Package
  • on intial setup wizard the final step tries to get you to set a CloudForge account up. Click the cross on the 'Get Started' wizard button at the top left to cancel out.
  • Windows only
  • no remote admin in the free version
  • can only bind to preset port numbers
  • can only select the following ports
    • unsecure (http) 80/8080/81
    • secure (https) 443/8443
  • Free version cannot be installed on a computer with active directory (on a domain)
  • Extended configuration
  • Requires Xammp to be running
  • steeper learning curve
  • not a proper SVN server
  • does not have server side hooks
  • can really only support 1 developer because it does not handle locked files over networks properely

Binaries Only

This is the most difficult of all windows setup options, you basically are install another stack and have to configure the settings mainly through the command line. These are most definately installed as seperate software and are not portable. Unless you have any particular reason for installing binaries i would consider using Xammp as a abaase and install the SVN into that, you can then easily backup all of your work and configuration. I personally prefere the AIO packages where there is a central management of the SVN and stack.

Free Online SVN, GIT and Mecurial Repositories

  • Free source code hosting for Git and Mercurial by Bitbucket - Is Bitbucket free for small teams? Yes! Sign up for the 5 users free plan and you can have unlimited public and private repositories.
  • http://beanstalkapp.com/ – Secure, private and reliable Git and Subversion hosting. View activity, browse files, compare revisions. Great user interface. Integrates with a bunch of popular services, including Twitter! From $15 a month
  • http://unfuddle.com/ – popular subversion and git hosting and hosted project management solution for software development teams. Comes with a handy Widget for Mac OS – you can monitor account activity across all of your projects from one simple interface. Free with 2 people, with 1 project for up to 200MB storage
  • http://www.sliksvn.com/ – another option for free hosting, but not as good as unfuddle, subscriptions are competitive. Free with 1 person, with 1 project for up to 100MB storage
  • http://xp-dev.com – Subversion, GIT and Mercurial hosting. A decent feature set and represent excellent value for money. From $5 a month with unlimited projects, users and up to 2GB of storage
  • CodePlex - Open Source Project Hosting - free, and uses Subversion (through the TFS hook), as well as giving you forums, documentation areas, etc.:
  • Google Code - Project Hosting on Google Code provides a free collaborative development environment for open source projects.
  • GitHub - Unlimited Collaborators and Repositoriesbut you must pay for provate ones. GitHub is greate for opensource projects.
  • DreamHost - Shared Web Hosting - Although not free, this accounts offers 'Ruby On Rails' and a Subversion Repository included in the price.

Tutorials / Useful

Binaries' Installation Docs

Which One Should I Install?

currently if you are using windows you can select either VisualSVN Server or CollabNet Subversion Edge (i need to try both). If you are running linux you really only have the choice of CollabNet if you want an AIO Package. I have not examined the Xampp setups yet, but these are more hands on for people to set up.

CollabNet Subversion Edge - Most feature, is free, opensource and actively developed by the founders of Subversion (CollabNet)

CollabNet Subversion Installation

Security Settings

  • change the admin username and password to something complex especially if you are going online with this.
  • it is not currently possible to change the 'admin' username

Make Server Available from a FQDN

Setting up the online presences of your windows subversion server so you can access it from the internet.

At the moment your subversion server is currently only available to your local network, so neither you or other people working on projects can access the server. The following instruictions will bridge the final gap to having your own SVN server running under your control with no montly fees and where you can keep your files private.

Theses instructions assume you have a cpanel account

  1. create a dynamic-IP account (i used NOIP because they are free and my router supports them)
  2. configure your router or PC client (as appropriate) to correctely update your IP to your dynamic-IP provider
  3. create a dynamic domain. I use a random domain to prevent hackers scanning the free domains for potential targest ie. drguosdh334lkkjsad34.ddns.net
  4. setup a CNAME in you cPanel svn.mydomain.com pointing to drguosdh334lkkjsad34.ddns.net with a TTL of 64 seconds (Read This on TTL)
  5. give your PC/Sever a static IP address
  6. when you set up your SVN server you set the repository to be on a port, ie 18080, you need to port forward this port in the router and point it to your PC/Server
  7. allow this port to be used in your firewall
  8. if you want the remote admin panel to be available remotely aswell you need to port forward one of those aswell. (CollabNet insecure - http://localhost:3343/csvn, secure - https://localhost:4434/csvn/, you only need to forward the one you want, i would recommend only use secure, if secure is selected but you go to the in-secure a meta refresh is performed to re-direct you to the secure version)

You can now access you SVN server from the outside world using drguosdh334lkkjsad34.ddns.net (FQDN)  but you cannot use your FQDN locally. To fix that do the following

  1. edit your 'hosts' file as administrator
  2. add the following line
    127.0.0.1 drguosdh334lkkjsad34.ddns.net

Done, you now have a fully working Subversion server online via http://svn.mydomain.com/. you might be wondering why i have added an extra domain step to the instructions above. I have used a random domain name that should be hard for hackers to find and then use that to probe my netwrok, because using NOIP i basically give a domain name to my IP. I can use http://svn.mydomain.com/ to make my life easier to configure Matis and any other required software such as TortoiseSVN but while maintaining some extra security.

  • If the domain drguosdh334lkkjsad34.ddns.net becomes comprimised i can change the Dynamic-IP withou having to reconfigure my Subversion software.
  • If you wanted you do not need to add the cPanel DNS step in, you could use a sensible domain from a Dynamic-IP provider and use that domain to configure all of your software directely.
  • You will have to allow any SSL Certificate prompts that appear because you will be using effectively a different domain than localhost

Hostname (in WebAdmin)

  • in server setting it might be advantageous to change the Hostname to match your new domain, svn.mydomain.com , I do not know if this is absolutely required but keeps things the same.
  • You might might want to edit your shortcut to be http://svn.mydomain.com:3343/csvn :3343/csvn , again this is not mandator

Notes

  • 18080 - alternate port suggestion
  • From the Web Admin i could not get either of the following to work:

    Repository parent:    https://Mypc:18080/svn/
    or 
    Browse repositories:    https://Mypc:18080/viewvc/
    Solutions:
    • i had VisualSVN installed aswell, i had to do a full uninstall of VisualSVN and edgeSVN and re-install of edgeSVN
    • when it was not working it had an IP as the FQDN (The fully qualified Hostname), when the edgeSVN works it put in my computer name as the FQDN ie Mypc
    • If on a Dynamic IP make sure when you restart the server/windows PC that you have the same IP address and that subversion is not bound to another IP. Using the computers name or 127.0.0.1 would resolve dynamic IP adddress issues, or just use static IP address.
  • help files for viewvc are only from within the program itself

NB:

  • no other configuration was required to get SVN or ViewVC to work
  • also browser adblockers might affect functionality

SVN / Subversion General Notes

  • You cannot put repositories in subfolders. According to the rules all repositories should be in the root folder

CollabNet Subversion Edge Installation Notes

Edge Webadmin Service does not install and run during setup

When you install collabnet all goes well and you get to the webpage at the end saying that it is waiting for the service to start. It eventually times out and point you towards their help page.

The server does not start because according to the CollabNet official wikie there is something wrong with the Java Path. Whether it is missing or pointing to the wrong version, either way this prevents the service getting installed properely.

The remedy suggested, is to run there installservice.bat (located in {subversioin}/scwrapper/bat/), which does indeed install the missing WebAdmin service. When you then start the WebAdmin service  you get the following error:

Error 503 Service Unavailable

Causes

  • The 503 error is caused by incompatible Java (JRE) version.
  • You get this error because the Java based Service/WebAdmin cannot start properely.
  • This can be caused by installing another piece of software (ie netbeans) that installs a different version of java (ie JRE 8) which alters the path accordingly to its installation procedure. It is possible to install several version of java, but the path to java that is left in the enviromental variable is usually points to the last installed version of java.

NB You should note that the Apache Subversion Service will not start because it does not have a httpd.conf yet. You use the Web Admin to make this file on the intial setup of Subversion Edge so dont worry about the subversion service yet. When you get this service running you can save your settings which will fix the Subversion service.

Solution to these issues can be one of the following

  1. Uninstall the latest version of java (ie jre 8) making sure you have jre7 left installed, run the deleteservice.bat and then run installservice.bat to re-install the service but with the correct bin path
  2. Edit the service bin path to reflect JRE 7 in the registry, see the example below.
"C:\Program Files\Java\jre7/bin/java.exe" "-classpath" "D:\Documents\Developer\SubversionEdge\svcwrapper\wrapper.jar" "-Xrs" "-Dwrapper.service=true" "-Dwrapper.working.dir=D:\Documents\Developer\SubversionEdge\svcwrapper\..\appserver" "-Dwrapper.config=D:\Documents\Developer\SubversionEdge\svcwrapper\conf\wrapper.conf" "-Dwrapper.additional.1x=-Xrs" "org.rzo.yajsw.boot.WrapperServiceBooter" 

Notice that it points to java 7

Published in Subversion (SVN)

when running SFC you get the following error

There is a system repair pending which requires reboot to complete. Restart windows and run SFC again.

Solutions

This is caused by an update that has not been completed and can be fix in several ways:

  1. You can remove/rename the file C:\windows\winsxs\pending.xml  - This file is what contains the instructions for windows too process the pending updates and while this exist SFC will not run
  2. You can clean up/remove/revert the updates and this can be done offline - dism.exe /image:C:\ /cleanup-image /revertpendingactions

    This is supposed to revert all pended updates, however if System Restore is not working, then there may be other issues as well

Links

 

Published in Windows General

When you load windows you get a blue screen with the BSOD 0x0000007B error. This is generally caused by the 'Mass Storage Drivers' not loading for one reason or another such as

  • they have been corrupted
  • updated and the new version does not work
  • somehow they have been deleted
  • their start status has been incorrectely changed
  • the SATA controller type has been changed in the BIOS
  • You have changed motherboard or PC whilst using the same windows installation

Below are some tested fixes for this issue in windows 7. You might find that some of these fixes work for ohter versions of windows and not every solution will fix the 0x0000007B error.


Last Known Good Configuration (advanced)

Select the last known Good Configuration and see if your windows boots. It either will or it wont. If it does i would create a system restore point.

Startup Repair

Let windows try a Startup Repair. When your PC fails to boot it will ask you if you want to repair windows (Black and White Screen), select 'Repair Windows' and see if that fixes the boot issue

Incorrect SATA Type in the BIOS

This is a very common issue especially when you move your windows installtion to a new PC.

Windows is configured to use IDE or AHCI (or possibly a type of RAID) to boot windows and if the setting in your BIOS does not match this.

Solution

Enter the BIOS and cycle through the the different types of AHCI/SATA controller settings and see if you can boot windows on any of them.

fix_7hdc.vbs script - Adjust mass storage controller driver at offline system - Recommended

Basically this is a script that can handle the automatic installation of the correct driver by matching the installed hardware IDs to a driver, either those that are already install or from a specified folder which is handy when you have forgot to install them before moving changing your hardware. This script can be run from a windows DVD/Repair Console

This is an easy fix to try if you have the correct instructions. The instructions for running this script are not the best, so after trial and error i have written some.

The script utilises DISM utility to install the drivers.

Usage: cscript Fix_7hdc.vbs [options]

Options:
/enable                            enable, installed but disabled MassStorage drivers (or 'Enable existing Mass Storage drivers in system)
/target:<drive>   target Win7 drive
/install:<folder>   Path to the folder that will be the top of the Plug & Play folder tree.
/search:<file>   search flag file to find target Win7_drive
(default: \windows\system32\winload.exe)
/restore   restore registry system file
/log:<file>   (Optional)  Location of the output file
    Remmed out in code but might still be valid
/class:<class>   (Optional)  Filter the output by device Class
/provider:<vendor>   (Optional)  Filter the output by driver Provider
/excludeclass   (Optional)  Filtering excludes Class filtered items from output.
Default filtering in inclusive (only the filtered items are output).
/excludeprovider   (Optional)  Filtering excludes Provider filtered items from output.
Default filtering in inclusive (only the filtered items are output)
    End of Remmed Items
/q   (Optional)  Suppresses all data output to the console.
/?   (Optional)  Displays this help text.

Examples:

cscript Fix_7hdc.vbs /enable /search
cscript Fix_7hdc.vbs /enable /search:\users
cscript Fix_7hdc.vbs /enable /install:F:\x86 /search
cscript Fix_7hdc.vbs /install:D:\amd64 /target:C:
cscript Fix_7hdc.vbs /install /search:\label.txt
cscript Fix_7hdc.vbs /restore /target:C:

My Notes

If you run

Fix_7hdc.vbs
Fix_7hdc.vbs /search

(either implies Fix_7hdc.vbs /enable /search )

This is what it does

    1. searches for the live windows installation
    2. loads that registry and searches the registry
    3. Finding all matching 'Mass Storage Drivers' and sets their start DWORD to 0 (ie enabled)

      there is a prompt box for each mass storage driver, so there can be a few (unless you use cscript)

What i Would Type

cscript fix_7hdc.vbs /enable /search /install:g:\ahci

Because you use cscript there are no prompts but instead outputs to the console

  1. This will automatically search for the windows installation
  2. it will enable existing mass storage drivers in system
  3. it will then install (and enable i guess) any matching 'Mass Storage' hardware with drivers from g:\ahci (recursive search occurs on the /ahci/ folder)
  4. The driver(s) are then installed using dism using a simliar command as below
    dism.exe /Image:C:\ /Add-Driver /Driver:"G:\AHCI\W64A\amdsata.ing" /LogLevel:4 /LogPath:G:\hdc\dism.offline.log

Links

Other Notes

  • if you change the controller type and run 'Fix_7hdc.vbs' it will detect the new type of controller
  • when not using cscript prefix, use /q to suppress messages

Manually Changing SATA Mode in Windows

sometimes windows gets mixed up with which SATA mode to work. This can be changed easily in the windows registry. As long as you can access the windows registry you can do it either online (proactively) or after the fact by mounting the offline registry.

DSIM - Manual Driver Injection

This is a new method that new versions of microsoft windows natively supports. It allows you to inject drivers to offline windows installs on normal harddrives or VHD (Virtual Harddisk). This is particulary handy if you have forgotten to install required SATA Drivers or you are creating a deployable image.

When using this command you must make sure your drive letters are correct. ie when you boot of the harddrive into the console your windows install drive will be C:\ , but when you load of a seperate WinPE disk it will most likely be D:\.

Examples

Dism /image:C:\windows /Add-Driver /driver:D:\64-bit /recurse

All sub folders from D:\64-bit are queried for drivers to add to the offline windows install @ C:\windows

Dism /image:C:\windows /Add-Driver /driver:D:\64-bit\

The drivers in the folder D:\64-bit\ will be installed to the offline windows install @ C:\windows

Links

Other Things to Try

Driver Installation / Recovery Software

My Other Notes

  • DWORD start types, 0 = enabled (possibly core load), 1 = ? , 3 = disabled
  • 0x000007b errors are definately caused by a fault in SYSTEM hive
  • I got a 0x000007b after installing windows updates, i think this is because it upgraded some driver files that had been interfered with by driver updating software

Published in Windows 7
Saturday, 20 December 2014 12:02

Which Bug Tracker should i use?

This is quite a popular question to which i needed an answer, so i have listed the relevant pros and cons for the most popular Bug Trackers below.

  RedmineBugzillaMantis
Comparison of Bug Trackers
Pros
  • free
  • SVN integration
  • open source
  • has roadmap feature
  • can monitor code (needs checking)
  • Bitnami Redmine Stack available for free which install all required assets pre configured
  • the inbuilt difference view will allow you to select between which revisions to compare
  • you can compare side by side or in a column
  • can be tricky to setup
  • has svn and git + more SCM already inbuilt
  • tight subversion integration
  • lots of videos out there to show you how to use it
  • the GUI and UI is excellent
  • redmine is geared towards software development
  • redmine can be configured to automatically create subversion repositories
  • free
  • SVN integration
  • open source
  • will work on shared hosting because it only needs php and MySQL
  • easy to setup
  • can track code
  • plugins can be made easily because it is written in php
  • free
  • SVN integration
  • open source
  • will work on shared hosting because it only needs php and MySQL
  • easy to setup
  • can track code
  • has roadmap feature
  • easy to use
  • can be installed via softaculous which also comes with 1 touch updating
  • plugins can be made easily because it is written in php
Cons
  • probably wont work on cheap shared hosts because it need Ruby On Rails and shell access to get to work
  • difficult to set up
  • harder to write plugins because using RoR
  • no roadmap feature
  • high learning curve
  • mantis is buggy
  • integration with subversion is tricky and basic

Research Links

Conclusion

Redmine is a more indepth Bug Tracker, it takes more to setup but seems to have more features, including the roadmap. The downside to Redmine is that you most likely need a VPS or dedicated server to run it and in which cas you probaly already have SVN setup so i would use this. I now use Redmine on my windows PC using Xampp and other free software packages. Search my website for Redmine installation Instructions.

If you want some thing easy to setup and use i would choose Mantis. It will work on most hosting packages and is easily setup. The roadmap feature for me is a must, which this has so i can concentrate on programming rather than setting a Bug Tracker up. The softaculous install feature will also allow easy 1 touch upgrading.

Bugzilla sits in between the other two Bug Trackers because it has a lot of features making it more complicated to use but for some reason it does not have a roadmap feature. Bugzilla is definately aimed at collaborative works rather than just one person.The other Bug Trackers will handle multiple users bug Bugzilla seems to have a lot of Project Management aspects built in to it.

Published in General

Why would i want to do this?

Do you want to start a marketing campaign and send it to all of the people you have ever had contact with, where better to start than the peopel you have had email correspondance with. These peopel will all have either sent you and email or recieved one from you. These emails will all be in outlook.

PHP Method

You can configure the script to scan for any variable you want so with a little bit of programming you can scan the emails to see if a customer was interested in certain type og motor bike or wheather he selected certain answers in a survey.

What You Need

Instructions

These are my instructions on how to scrape emails, Sender Names and other information from emails in your outlook.

My process has a couple of steps and can be configured to grab what information you want.

Overview

  1. Dump selected emails with outlookfreeware as EML/ Dump all emails as EMLs with {full dumper} in to a folder. This folder should be in the webserver htdocs
  2. Setup XAMPP webserver
  3. Increase php timeouts (Optional)
  4. Create a MySQL database
  5. Configure my script
  6. Run My script
  7. Export data as a .CSV via PHPMyAdmin

Dump Selected Emails

Outlook Export

Unknown to me at the time, outlook has an export feature where you can export selected emails (or folders) to an excel spreadsheet and once there you can perform data manipulation as required.

The location of the Export function varies with each version of office so you need to do a quick google search for Exporting Outlook Emails.

Useful

I would recommend to use ASAP Utilities to perform data manipulation on your Excel Spreadsheets.

Published in Outlook
Thursday, 11 December 2014 11:47

Embed an Image in your Outlook Email Signature

Problem

Why do i need this article? Can you not just create an email signature in outlook and add images in its own editor? Yes and No!

You can create signatures with images using outlooks signature editor but it does not always work correctly. The image might appear to be embeded but when the recipient receives the email, the image in the signature is not present.

The recipients email client can also have a bearing on whether it appears correctely at the other end, also the editor you are using in outlook to edit emails might also have an effect, as you know you can edit emails in outlook's Basic Editor or you can use Word which forces emails to be in Rich Text Format (RTF)

If your email signature is working correctely you do not need to do anything, this is for the occassions when it does not, most likely this is just with older version of outlook. I know outlook 2003 has this issue sometimes.

Solution

My solution is to create a manually crafted email in HTML and then install this into outlook. The images in the signature have had their locations manually specified. Using this method forces outlook to properly embed images in the signature. You can edit the signature in outlook but you can never edit the image in outlook because it mangles the code and then the image becomes attached rather than embedded, you will always have to edit the image code manually in the .htm file.

The Code

This is my sample email signature that can be aeasily modified for your needs via the .htm or in outlook itself (not the image though)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Dynamic Email Signature</title>
    <meta http-equiv=Content-Type content="text/html; charset=windows-1252">
    <meta content="MSHTML 6.00.6000.16705" name=GENERATOR>
    <style type="text/css">   
        .signature-style {
            font-family: Geneva, Arial, Helvetica, sans-serif;
            font-size: 11px;        
        }   
    </style>
</head>
<body>
    <div class="signature-style">
        <p>
            <strong>Joe Bloggs<br>
            <strong>Marketing Assistant</strong></strong><br>
            <strong>Tel:</strong> 01772 1234569<br>
            Twitter:  <a href="http://twitter.com/twitter">My Twitter Feed</a><br>
            Facebook: <a href="http://www.facebook.com/facebook">My Facebook Page</a><br>
            <br>
            QuantumWarp<br>
            Rocky Lane<br>
            Manchester <br>
            MA1 1QW<br>
            <br>
            <strong>Box Office:</strong> 01772 123456<br>
            <a href="http://quantumwarp.com/" title="QuantumWarp">QuantumWarp.com</a>
        </p>
        <p>
            <a href="http://quantumwarp.com/"><img src="/./dynamic_files/emailsignature.jpg"></a><br>
        </p>
        <p><em>QuantumWarp, Rocky Lane, Manchester, Lancashire  MA1 1QW Company Registered No: 1234567 (England)</em></p>
    </div>
</body>
</html>

  NB:

  • you can view the signature by opening the dynamic.htm in a web browser
  • /./dynamic_files should not have the extra / in it, there is a fault with the way the code is stored in the database. should be ./dynamic_files

The Image

Create a folder called dynamic_files and add the image you want to use in to it.

Install the Signature and Image into Outlook

This method will show you how to create an email signature from scratch. If you already have a corporate email it should be fairly easy for you to modify my example signature into your corporate colours and details etc..

NB: You will be required to visit everyones machine to create their dynamic email signature once.

  1. if you have no signatures at all, you need to create a dummy/blank signature in outlook. This creates the folders where signatures are stored.
  2. Place your modified signature dynamic.htm and the image folder dynamic_files in the following folder.

    Win7 - C:\Users\{user}\AppData\Roaming\Microsoft\Signatures

  3. Open Outlook
  4. Edit the signature if required. i.e. Alter users name and phone numbers. (do not alter or edit the image in outlook)

Other Resource Identifiers

You can use several different ways to reference images in your email signature

  • src="\\server\Shared Files\Marketing\emailsignature.jpg"
  • src="file://///server/Shared Files/Marketing/emailsignature.jpg"

There might be more that I have not added.

Outlook 2007/2010/2013 and Newer

To be embed images in these version of outlook requires a registry change. By default outlook disables the embedding of images because there is a thought that you should be using cloud resources and links.

Conclusion

This method is quite robust and once set should keep working and your signatures will always correctly show the image in your outlook and in the recipients client.

Notes

  • Updating the Signature Image location - as mentioned earlier you will need to edit the location manually in the dynamic.htm file in the signatures folder, but when you have done this you should delete the related signature files i.e. dynamic.txt and dynamic.rtf, outlook will recreate these from the updated .htm file when required.
  • You can add multiple images using this method
Published in Outlook
Wednesday, 10 December 2014 00:00

Dynamic Email Signature in Outlook

Problem

Do you run a small business, a theatre perhaps where all of your staff have the latest show in their signature? Do you need to go around everyones PC to change this signature everytime the shows changes, then this article is for you.

Solution

I will show you how to create a 'Dynamic' email signature. Well part of it anyway. My solution is that you have all of the show details in an image, the phone and contact number just like you would on a website banner and embed this image in your signature. This image is located on the server and all you have to do to update everyones email signature/banner is to change this image on the server and have you staff close and open outlook to update to the latest image.

Obviously there is some confifuration required to set up the signature in outlook and it must be done in a specific way and this is where these instructions come in to their own

Instructions

NB: you need a server or PC that you can share this image out publicly

This method works by having outlook download an image from the server and have outlook embed it. You cannot just add an image into an email signature because outlook alters the assets location before embedding it and will create a static image, but by creating the code directely you bypass outlook's code sanitisation and as a consequence the image is always dynamically loaded from the server before embedding (download once per outlook session).

Server

  1. create a banner you want
  2. create a shared folder on your server (with appropriate permissions if you want)

    \\server\Shared Files\Marketing\

  3. copy your banner to that location which gives the following available asset

    \\server\Shared Files\Marketing\emailsignature.jpg

Create the Signature

You need to create a signature template to use for your signature. The following code is a great example of a simple email signature. You can edit this in either a text file or a html editor as long as it does not mangle the code. You might like to experiment. You will note that you can use in-line CSS to style items, you can also style the signature with outlook when the signature installed but it can make a mess of the code. The other thing to note is the image location for the banner, and this is the key to making this whole exercise working. It can never be altered with outlook, if you ever want to change this you will need to alter the code by directly editing the .htm file.

  1. You need to save the code below as dynamic.htm (or a suitable filename *.htm)
    NB: Outlook will create the other versions of the email signature files (ie .txt and .rtf) when required
  2. Alter the file appropriately (ie change names, image location, phone numbers)
  3. Save the file

 The Code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Dynamic Email Signature</title>
	<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
	<meta content="MSHTML 6.00.6000.16705" name=GENERATOR>
	<style type="text/css">	
		.signature-style {
			font-family: Geneva, Arial, Helvetica, sans-serif;
			font-size: 11px;		
		}	
	</style>
</head>
<body>
	<div class="signature-style">
		<p>
			<strong>Joe Bloggs<br>
			<strong>Marketing Assistant</strong></strong><br>
			<strong>Tel:</strong> 01772 1234569<br>
			Twitter:  <a href="http://twitter.com/twitter">My Twitter Feed</a><br>
			Facebook: <a href="http://www.facebook.com/facebook">My Facebook Page</a><br>
			<br>
			QuantumWarp<br>
			Rocky Lane<br>
			Manchester <br>
			MA1 1QW<br>
			<br>
			<strong>Box Office:</strong> 01772 123456<br>
			<a href="http://quantumwarp.com/" title="QuantumWarp">QuantumWarp.com</a>
		</p>
		<p>
			<a href="http://quantumwarp.com/"><img src="/\\server\Shared Files\Marketing\emailsignature.jpg"></a><br>
		</p>
		<p><em>QuantumWarp, Rocky Lane, Manchester, Lancashire  MA1 1QW Company Registered No: 1234567 (England)</em></p>
	</div>
</body>
</html>

 NB:

  • you can view the signature by opening the dynamic.htm in a web browser
  • /\\server should not have the extra / in it, there is a fault with the way the code is stored in the database. should be \\server

Install the Signature into Outlook

This method will show you how to create an email signature from scratch. If you already have a corporate email it should be fairly easy for you to modify my example signature into your corporate colours and details etc..

NB: You will be required to visit everyones machine to create their dynamic email signature once.

  1. if you have no signatures at all, you need to create a dummy/blank signature in outlook. This creates the folders where signatures are stored.
  2. Place your modified signature in the following folder.

    Win7 - C:\Users\{user}\AppData\Roaming\Microsoft\Signatures

  3. Open Outlook
  4. Edit the signature if required. i.e. Alter users name and phone numbers. (do not alter or edit the image)

Other Resource Identifiers

You can use several different ways to reference images in your email signature

  • src="\\server\Shared Files\Marketing\emailsignature.jpg"
  • src="file://///server/Shared Files/Marketing/emailsignature.jpg"

There might be more that I have not added.

Outlook 2007/2010/2013 and Newer

To be embed images in these version of outlook requires a registry change. By default outlook disables the embedding of images because there is a thought that you should be using cloud resources and links.

Conclusion

You have now created a system that allows you to have a Dynamic Email Signature for all of your staff and all you have to do is change the banner to reflect you new show or event.

NB: Remember that users have to logout of outlook and then back in again for changes in the banner to be reflected in the Signature.

Notes

  • You will notice i have used a local server ( \\server ) for the storage of the image. You can use a webserver but this might cause issues with caching and security. ie Outlook might not let you use the link and also it might not embed the image because it sees it as a web resource. I have not tried this, but if you must, it might be worth a go.
  • the link on the banner cannot be changed dynamically but with a bit of clever thinking you can have the next best thing.
  • Updating the Signature Image location - as mentioned earlier you will need to edit the location manually in the dynamic.htm file in the signatures folder, but when you have done this you should delete the related signature files i.e. dynamic.txt and dynamic.rtf, outlook will recreate these from the updated .htm file when required.
  • You can add multiple dynamic images using this method
Published in Outlook
Thursday, 04 December 2014 00:00

Chaining Multiple Javascript Functions

Here i will show you how to chain multiple javascript functions (chained functions). This is not as simple as it seems because the functions can be dependant on the previous, they can run out of order or they can run independantly.

There are 3 ways of chaining functions (excluding operators).

  1. stacked  functions in a function
    function combinedFunction {
    
    	runFunction1 ();
    	runFunction1 ();
    	runFunction1 ();
    
    }

    You can use operators here but the main purpose of this method is to allow you to declare only 1 script in your HTML and arrange the functions you want running neatly.

  2. Basic chain - in a submit button
    <form method="post" id="contact_form" onsubmit="runFunction1(); runFunction2(); runFunction3();">

    See notes on operators. it is particularly important when using a submit button

  3. Function in function, chain
    function runFunction1  {
    
    	// Do some stuff
    	
    	runFunction2();
    
    	}

    you can keep expanding the number of functions you have and also can apply logic to them

Operators - Submit button

This section will focus on the different outcomes of using operators for the submit button with functions. It must be noted that most of these rules will apply to other Javascript circumstances.

  • ||  or
  • & and with no dependancy
  • && and but previous function must return true (or not false>)
  • !! (runFunction1() && runFunction2())   - check this, it should return a boolean based on all results
  • to prevent the submit button functioning, you must add return false; . Iit must be at the end and seperate
  • if you use && the function to the left must run true otherwise the next will not run
  • & means 'and' but does not require the prior function to be run successfully, might be the same as function bob(); function builder();
  • if a function returns false, the submit button will not work. This might be overidden in a non successive chain when one of the subsequent functions returns true
  • you can return false / true / return variable / text / nothing (not recommended and depends on your code
  • onClick and onSubmit are different. onSubmit can be fired by clicking or by pressing enter.

Examples

Example 1

<form method="post" id="contact_form" onsubmit="runFunction1(); runFunction2(); runFunction3();">
  • the functions are seperated by a semi-colon.
  • All of these functions will be run, from left to right
  • and none of them will be depandant on the other to run or return true.
  • the submit button will activate

Example 2

<form method="post" id="contact_form" onsubmit="return myFunction();">
  • if myFunction returns false, the submit button will not activate (check this)
  • if the myFunction  returns true, the submit button will activate

Example 3

<form method="post" id="contact_form" onsubmit="return validator1() && validator2()">
  •  the function validator2() will not run unless validator1() returns true
  • if validator2() returns false, the submit button will not activate (i need to check this)

Example 4

<form method="post" id="contact_form" onsubmit="validateCaptchaCode() && postForm(); return false;">
  • postFrom() will not run unless validateCaptchaCode() returns true
  • the submit button will not activate because of return false;  , irrespective of the return value of postForm()

How to prevent buttons from submitting forms

Published in Javascript
Thursday, 04 December 2014 00:00

My AJAX Example (xmlhttp.onreadystatechange)

I have tried for hours to get this script to work and i have come to the conclusion, it does not do want i want.

These scripts are asyncronous, which i think mean they are running all the time. My captcha code that i was trying to validate using the code by performing a lookup on a php file (validatecaptcha.php) was resonable successful.

My code

	<!-- validate the code via ajax using validate.php to perform the validation -->		
	<script>
	var interval;
	var result = null;
	
	// function myFunction(response){result = response;}
	
	// Alert the value of result and clear interval
	function getResult()
		{
			// once we get a result, turn interval off.
			if(result != null)
				{
					interval = clearInterval(interval);
					alert(result); // we're clearly out of the onreadystatechange scope with our result.
				}
		}

	function validateCaptchaCode() {
	
		result = null;
		
		enteredCaptchaCode = document.getElementById('ct_captcha').value;
		var xmlhttp = new XMLHttpRequest();			
		
		// actually POST the data (GET is slighlty different syntax)
		xmlhttp.open("POST", 'handlers/validatecaptcha.php', true);
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");	
		xmlhttp.send("enteredCaptchaCode=" + enteredCaptchaCode);
		
		// http://www.w3schools.com/php/php_ajax_php.asp		
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			
				// document.getElementById("txtHint").innerHTML = xmlhttp.responseText;	

				// myFunction();
				
				//myFunction(xmlhttp.responseText);
				
				/*if (xmlhttp.responseText == 'true') {
					alert("Stuff Working");					
						} else {
							alert("Stuff Not Working");						
				}*/
				
				result = xmlhttp.responseText;
				
			}				
		}
		
		// every second (1000 milliseconds) run getResult()
		interval = setInterval("getResult()", 1000);
		
		// this statement does not always work because xmlhttp.responseText is sometimes empty
		if (result == 'true'){alert('true code'); return true;} else {alert('false code'); return false;}		
	}
	</script>

 

What Worked

  • the actual loading of data from another page based on a POSTed variable
  • validatecaptcha.php worked well, i posted a captcha to it and it returned 'true' or 'false' depending if the captcha was correct. I utilised $_SESSION with the rest of the captcha code, securimage.
  • within the 'if section' (xmlhttp.readyState == 4 && xmlhttp.status == 200), you can easily access xmlhttp.responseText; you could also use the following and they would all work as expected inside the function. however you cannot get the response out of the function. you can do functions inside but not pass this information out to allow a condition based 'true / false' return. You can pass it to another function but again it is like a floated element outside of the normal DOM
    • document.getElementById("txtHint").innerHTML = xmlhttp.responseText; - you can alter text on the page easily with this.
    • myFunction();
    • myFunction(xmlhttp.responseText)
    • if (xmlhttp.responseText == 'true')........ with alerts on screen.
    • result = xmlhttp.responseText;
  • my if statement logic at the end for returning the validateCaptcha() works when it has the correct variables supplied to it

What doesnt work

  • As mentioned already, you cannot pass information outside of the function. You can pass the information to another function but this function is also outside the normal flow
  • you can pass the information to a global var (ie var result) but this seems out of sequence so you cannot utilise it for you own code. ie the function 'true / false' closing statement. It appears to maintain what was set in the global variable on the last cycle (i am using a session)
  • this code also seems to run after the main function is completed, perhaps this is the asyncronious nature of it.

What would i use this for?

A good example is live updates for an autofill text box (PHP - AJAX and PHP - w3schools). This sort of coding should be considered a process unto itselfs.

You cannot use this for validating stuff if function exit state (true / false) depends on it.

You can use this for loading external content that will change the content on your page, like adding notifications. This will be independant of other javascript on the page.

Some Other Scripts

This is the one where i got the interval idea.

It is worth a read of this thread. Store responseText value to a global variable in JavaScript JavaScript and AJAX forum at WebmasterWorld . The interval setting might not make any difference in this example where i tried to use it to perfom validations. I think that all this does is pass the alert output down a function chain. Remember that httpobj.onreadystatechange occurs outside the normal Javascript runtime because it is asyncronous (run at the same time!).

http://www.webmasterworld.com/javascript/3952568.htm
<script>
var interval;
var result = null; // Set this accordingly based on various return values from your PHP file
httpobj = new XMLHttpRequest(); //FF for now
httpobj.open('get', 'file.php', true);
httpobj.send(null);
httpobj.onreadystatechange = function()
	{
		if (httpobj.readyState == 4 && httpobj.status == 200)
			{
				result = httpobj.responseText;
			}
	}
	
interval = setInterval("getResult()", 1000);

// Alert the value of result and clear interval
function getResult()
{
	// once we get a result, turn interval off.
	if(result != null)
		{
			interval = clearInterval(interval);
			alert(result); // we're clearly out of the onreadystatechange scope with our result.
		}
}

</script>

This explains the issues i have had with this method and why

Return xmlhttp.responseText From AJAX Function - The SitePoint Forums

"The onreadystatechange function executes long after the other parts of the script have finished, so there is nothing to return anything to. Instead, you can pass the value to another function."

Published in Javascript
Thursday, 04 December 2014 00:00

Verify if a function returns true or false

This useful bit of code allows you to run a function and see if it returns true or false.

function testFunction(){	

	if (validateCaptchaCode() == true) {
	
	alert('true');
		} else {
			alert('false');}
	
	return;

} 

 

 

Published in Javascript
Page 51 of 95