Friday 30 August 2013

Hate the new Gmail Compose!!!!

Why destroy something, if it works.

This new stupid compose window is geared to idiot hipsters and definately not power users.  The stupid window is smaller and the UI is not intuitive, involving more clicks than ever before.

Google have been stubborn to change, despite  thousands of people complaining on the forums.  The only way to resolve this issue, is to dump gmail as your favorite email client.  If you can tolerate Thunderbird, then the Imap access may be reasonable, otherwise ZOHO MAIL is another solution.

Zoho has the advantage of being linkable with your existing gmail account and it is free.  When sigining up with Zoho, you may see options to pay for hosting, however there is a small option for a FREE user@zoho.com.
Then it is a simple matter of forwarding your existing gmail mail to Zoho.
The other main advantage of Zoho is the absence of ads, however this may not be anything new if your browser is running adblock.


UPDATE: use oldcompose extension. 


WindyCityTech Blogger
WindyWindyCityTech Wordpress

Sunday 18 August 2013

Spell Check Wordlist Cleaner Sanitiser Script dictionary .dic

Spell checkers have been polluted with too much crap. They don't seem to be maintained very well if at all.

Do a file search for your browsers dictionary file. For instance en-US.dic will contain 45593, awe-inspiring, BIOS's, hep, hosp, Jugiong, mer's, ODs, Sc, Supt., kw.... and the list goes on and on.

Whether this is a solution or not needs to be debated, but the results are obvious. Out of about 43000 words, 13000 were found to be unsatisfactory.

The perl script below, runs the dictionary file through a bunch of regexes, pulling out unwanted expressions. It is default setup to be very harsh, but users can comment out the 'elsif' to '}' lines for expressions they don't need.
The script outputs two files, one cleaned and one with the bad.

By the way, it has been tested on Linux, perl 4 version 14.  Good luck getting it to run on windows, the line terminators may get you.  A good test is to probably re-run the script on the cleaned file and see if it yields any more results.


Be sure to copy out your dictionary file to local directory before running the script. You may have to rerun the script if the dictionary updates itself.

USAGE spellclean.pl FILE.dic

Link to script:
http://pastebin.com/PAa9m0Ud

References:
http://www.chromium.org/developers/how-tos/editing-the-spell-checking-dictionaries
http://www.openoffice.org/lingucomponent/dictionary.html
http://marcoagpinto.cidadevirtual.pt/proofingtoolgui.html
http://txt2re.com/

#!/usr/bin/perl

#spellclean.pl
#cleans the spell checking word list.
#USAGE spellclean.pl FILE.dic


my $filename=shift;  #shift command line argument to variable filename
my $filenamemod = $filename.'.cleaned';  #cleaned filename and extension
my $filenamebad = $filename.'.bad';  #bad lines filename and extension
my $linecount = 0;  #whole file line counter
my $removeline = 0;  #delete line flag
my @badlines = ();  #delete line array
my $modlinecount = 0;   #line counter for the destination file.

# open file for phrasing
open SPELLFILE, $filename or die "error opening file $filename\n";


print "Here is the preview of the words removed, press [Enter] to continue: ";
<STDIN>;  #wait for input


while ($line=<SPELLFILE>) {
 $linecount++;  #increment linecount

 if ($line=~m/^\d.*/) { #remove any words beginning with numbers
  $removeline = 1;
 }
 elsif ($line=~m/(^[A-Z]{2}?)/) { #remove any CAPital words, like acronyms
  $removeline = 1;
 }
 elsif ($line=~m/.-/gm) { #remove any words with hyphens
  $removeline = 1;
 }
 elsif ($line=~ /.\./gm) { #remove any words with dots
  $removeline = 1;
 }
 elsif ($line=~ /^.{1,3}$/gm) { #remove any one and two letter words
  $removeline = 1;
 }
 elsif ($line=~ /^.{4,4}$/gm) { #remove any three letter words
  $removeline = 1;
 }
 elsif ($line=~ /^.{5,5}$/gm) { #remove any four letter words
  $removeline = 1;
 }
 elsif ($line=~ /^[A-Z].*$/gm) { #remove any Name style words
  $removeline = 1;
 }
 elsif ($line=~ /'.*$/gm) { #remove any words with apostrophy
  $removeline = 1;
 }
 
 # push lines number to the array, reset the removeline flag to 0 before looping back
 if ($removeline == 1) {
  push (@badlines, $linecount);
  print "Bad line $linecount -> $line";
  $removeline = 0;
 }

}
close (SPELLFILE); # close the file


print "Preview complete, press [Enter] to remove words from list or ^C to abort! ";
<STDIN>;   #wait for input


#open the original file and a destination file.
open SPELLFILE, $filename or die "error opening file $filename\n";
open SPELLFILEMOD, ">$filenamemod" or die "error creating file $filenamemod\n"; 
open SPELLFILEBAD, ">$filenamebad" or die "error creating file $filenamebad\n";

$linecount = 0;  #reset line counter to zero.
$removeline = 0; #reuse this variable.
 

#checks if the line number of the original file matches the first element of the array [0], if it does then it is a badline
#and it wont be printed to the destination file.  The removeline variable is incremented for the next array element.

while ($line=<SPELLFILE>) {
 $linecount++;
 if ($badlines[$removeline]==$linecount) {
  print "Removing line $linecount -> $line";
  print SPELLFILEBAD "$line";
  $removeline++;
 }
 else {
   print SPELLFILEMOD "$line";
   $modlinecount++;
  }
}
#close the files
close SPELLFILE;
close SPELLFILEMOD;
close SPELLFILEBAD;

# summary
print "\n\nCompleted!\n";
print "Total lines in the original file is: $linecount\n";
print "Total lines removed is: ".scalar(@badlines)."\n";
print "Cleaned file has: $modlinecount lines\n";
print "Cleaned file is saved as: $filenamemod\n";
print "Bad lines file is saved as: $filenamebad\n";




WindyCityTech Blogger
WindyWindyCityTech Wordpress

Saturday 17 August 2013

PHP path checking script

Finding PHP paths can be difficult on web servers.  Depending on how they are setup the paths may vary from host to host.  You may have or have not permissions to change the php.info file to edit configurations as you need.

Here is a script to quickly check how the server paths are setup.

<?php
//php path checker  checkPath.php

echo 'PHP_SELF is: '.$_SERVER['PHP_SELF'].'<br>';
echo 'DOCUMENT_ROOT is: '.$_SERVER['DOCUMENT_ROOT'].'<br>';
echo 'dirname(__FILE__) is: '. dirname(__FILE__).'<br>';
echo 'basename(__FILE__) is: '.basename(__FILE__).'<br>';
echo 'basename(dirname(__FILE__)) is: '.basename(dirname(__FILE__)).'<br>';
?>

expected output


PHP_SELF is: /scripts/checkPath.php
DOCUMENT_ROOT is: /usr/local/apache/htdocs
dirname(__FILE__) is: /home/userName/public_html/scripts
basename(__FILE__) is: checkPath.php
basename(dirname(__FILE__)) is: /scripts


Tips for portability of PHP scripts.  Sometimes the best way to specify php paths in includes for your scripts is to create a configuration.php file.
In this file, assign variables to the full path for your scripts there.

<?php
//configuration.php
$base = "/home/userName/public_html/scripts";
$header = "/header.php";
$footer = "/footer.php"
?>

Then use these lines in you scripts for includes in the following fashion:

<?php
//myScript.php
include "/home/userName/public_html/scripts/configuration.php";
include "$base.$header";
echo "some text";
include "$base.$footer";
?>

You still have to use a full path link for the configuration file once, but that is it.

WindyCityTech Blogger
WindyWindyCityTech Wordpress

3R Max DVR Info and Ethernet FTP Telnet login



The 3R MAXDVR4000 is a 1U rackmount DVR with four composite inputs.

There is not much info out there about them, there are two IDE hard drives inside formatted with resizerfs, a Axis Video Controller serial and Ethernet port.

If there hard drives are no longer working, they can be removed and replaced with another pair of working drives.  The sizes do not have to match either.  The drives are formatted and file and folder structures are copied on to the new hard drives upon power up.  You may notice a file called 'Hdd_Image.tgz' copied on one or both drives, containing the default info.

Conducting a Wireshark trace on the Ethernet port, yielded a default static IP of 192.168.0.60, with a Telnet and FTP server.

Default login credentials are:
root
pass


Default front panel password is 0000
 


Files can be easily pulled from the unit using FTP and the unit work in a circular buffer mode.


Some console dumps:

Axis Developer Board LX release 2.0.0
Linux 2.4.5 on a cris (ttyp0)

[root@3R-miniMax /]112# mount
/dev/root on / type cramfs (ro)
proc on /proc type proc (rw)
/dev/flash2 on /mnt/flash type jffs (rw)
tmpfs on /var type tmpfs (rw)
/dev/hda1 on /mnt/hda1 type reiserfs (rw)

[root@3R-miniMax /]643# cat /proc/cpuinfo
cpu        : CRIS
cpu revision    : 11
cpu model    : ETRAX 100LX v2
cache size    : 8 kB
fpu        : no
mmu        : yes
mmu DMA bug    : no
ethernet    : 10/100 Mbps
token ring    : no
scsi        : yes
ata        : yes
usb        : yes
bogomips    : 166.40

[root@3R-miniMax /]643# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/flash2               1920      1344       576  70% /mnt/flash
tmpfs                     8432        48      8384   1% /var
/dev/hda1......


Some more info can be found from: http://www.chinasaixin.com/3R/3R/body02b-02_01.htm

WindyCityTech Blogger
WindyWindyCityTech Wordpress

Simple methods to get a System Shell in Windows

There are several ways to get a system shell in Windows without knowing the admin password.

One way is to see whats tasks on the taskbar are launched by System, explore them and look for a open file dialog box which can then be used to launch cmd.exe.  Another way is to see if the cmd.exe can be launched as a service with system privileges.

If you can bring up a local command prompt, with basic user privileges you can try to run the following:


sc create testsvc binpath= "cmd /K start" type= own type= interact
sc start testsvc



You can rename testsvc to whatever you want, like WindowsUpdateDaemon and the best part is that the service can be stopped and restared at any time.

And of course to remove the service:

sc delete testsvc


So what can you do with this?
If you were locked out from removing programs, editing services, checking system properties, things that involve the mmc console...
You could probably invoke these now using the command line.  Most of these programs exist in system32 folder.  Some may not be there or disabled, but there is no harm in trying.
Services Management     services.msc
Shared Folders     fsmgmt.msc
Remote Desktops     tsmmc.msc
Group Policy Management     gpmc.msc
Computer Management     compmgmt.msc

Bigger list here:  http://social.technet.microsoft.com/wiki/contents/articles/417.windows-mmc-snap-ins-msc.aspx


Ref: http://blogs.msdn.com/b/adioltean/archive/2004/11/27/271063.aspx

WindyCityTech Blogger
WindyWindyCityTech Wordpress