Thursday, February 28, 2013

WebForms.js or WebUIValidation.js CDN

In the console, it was giving me two errors saying it could not GET these two files from the CDN:

To fix it, you need to delete the <script></script> references for both of the files above and make a single reference to:
<script src="http://ajax.aspnetcdn.com/ajax/4.5/6/WebFormsBundle.js" type="text/javascript"></script>

Wednesday, February 27, 2013

Raspberry Pi Text To Speech IRC Service

These are my notes for installing Eastein's announce. It's a IRC bot that will receive a message and do text to speech on the message: https://github.com/eastein/announce

Installation:

  1. Download announce and extract it to it's own folder.
  2. apt-get install python-irclib
  3. apt-get install python-pip
  4. sudo apt-get install python-dev
  5. apt-get install festival festlex-cmu festlex-poslex festlex-oald libestools1.2 unzip
  6. apt-get install speech-tools
  7. pip install pyzmq --install-option="--zmq=bundled"
    or (if you have easy_install installed):
    easy_install pyzmq
  8. download mediorc and move mediorc into directory
  9. easy_install dnspython
  10. apt-get install mplayer
  11. apt-get install sox
  12. Fix permissions:
    chmod 777 saypitchprase
    chmod 777 pitchphrase2wav

Running The Program:

Run process in background by starting a screen (first navigate to the Announce folder):
  1. (start a new screen)
  2. python announced "tcp://*:4900"
  3. (detach from screen)
  4. (start a new screen)
  5. python announcebot "chat.freenode.net" "voicebot" "#yourircchannel" "tcp://0:4901"
  6. (detack from screen)
Starting the program using mp3 files in the JSON file (as always, start in the folder which has Announce):

  1. wget http://fake.com/fake/eye_tiger.mp3 (use a real URL with an mp3 file)
  2. nano default.json
  3. enter into the json file: [ ["eye of the tiger", "eye_tiger.mp3"] ]
  4. ctrl+x and save
  5. (start a new screen)
  6. python announced "tcp://0:4900" default.json
  7. (detach from screen)
  8. (start a new screen)
  9. python announcebot "chat.freenode.net" "voicebot" "#yourircchannel" "tcp://0:4900"
  10. (detach from screen)
  11. now "!say eye of the tiger" in the IRC channel will trigger the mp3

Troubleshooting:


Ensure your Raspberry Pi audio is working: http://jeffskinnerbox.wordpress.com/2012/11/15/getting-audio-out-working-on-the-raspberry-pi/

Testing Festival (create a text file named mytext.txt with some words first):
echo "This is a test." | festival --tts
echo "this is a test" > mytext.txt
text2wave -o myaudio.wav mytext.txt
aplay myaudio.wav

adjust the volume:
http://blog.scphillips.com/2013/01/sound-configuration-on-raspberry-pi-with-alsa/
or use amixer?

Find An Image Font

This page will tell you what font an image is using: http://www.myfonts.com/WhatTheFont/

I wish this feature was included in GIMP or Photoshop.

Friday, February 22, 2013

Regex Debugger

http://www.debuggex.com/?re=&str=

Don't want to lose this link, it's going to make regex related programming a lot easier.

Tuesday, February 19, 2013

Tableizer

Freaking brilliant tool that converts spreadsheet format things to HTML: http://tableizer.journalistopia.com/tableizer.php

PhoneGap Build - cordova-2.4.0.js

If you're using Phonegap Build, you don't need to include cordova-2.4.0.js or any other specific version of cordova/phonegap. Just use phonegap.js, but you don't actually need to include phonegap.js in the file you upload to Phonegap Build.

Quote from the Phonegap Build site:
"Once you've included the necessary assets, remove the phonegap.js (cordova.js) as Build will automatically inject it during compile time."

Tuesday, February 5, 2013

Sharepoint Lists Crashing

If your sharepoint lists crash IE as soon as they open, try disabling the following IE addons:
Sharepoint spreadsheet Launcher
Sharepoint export database~

Open File With Excel Macro


This macro will ask the user to input an excel file, then open that excel file:

Sub RunMacro()
   
Dim vaFiles As Variant
Dim i As Long

vaFiles = Application.GetOpenFilename _
         (FileFilter:="Excel Filer (*.xls),*.xls", _
         Title:="Open File(s)", MultiSelect:=False)

If Not IsArray(vaFiles) Then Exit Sub

With Application
    .ScreenUpdating = False
   
    For i = 1 To UBound(vaFiles)
        Workbooks.Open vaFiles(i)
    Next i
   
    .ScreenUpdating = True
End With

End Sub

Friday, February 1, 2013

Java - Swing's Nimbus Look & Feel

Since Java SE 6 Update 10, Java has had an updated interface called Nimbus. Comparison pictures are below. 

All I needed to do to use it was add this import to the top of the .java file with my main() method:
import javax.swing.UIManager.*;

public static void main(String[] args) {
try {
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            break;
        }
    }
} catch (Exception e) {
    // If Nimbus is not available, fall back to cross-platform
    try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception ex) {
        // not worth my time
    }
}
new Controller();
}


Default

Nimbus
Note: This blog post says it is slightly slower than the default: http://www.pushing-pixels.org/2008/06/17/lightbeam-measuring-performance-of-swing-look-and-feels.html