Page : 1/160

First Page    Prev. Page    Next Page    Last Page


Sunday, 4 Jul 2010

As numerous people online have pointed out, FxCop 1.36 has been pulled from the Microsoft Downloads website. The new version of FxCop is now available in the "Microsoft Windows SDK for Windows 7 and .NET Framework 4 Version 7.1".

You might not want to actually install that, so to install just FxCop, download the ISO version instead, extract it with 7Zip and locate Setup\WinSDKNetFxTools\cab1.cab. Open it with Windows and copy out the file "WinSDK_FxCopSetup.exe_all_enu_1B2F0812_3E8B_426F_95DE_4655AE4DA6C6". Rename this to "WinSDK_FxCopSetup.exe" and it should now install.

Simples!

Monday, 31 May 2010

Asterisk 1.6 Speaking/Talking clock in my trixbox install was saying "at the sound of the tone the time will be exactly {hour} {minute}" and then hanging up.

My symptoms matched one freepbx support ticket and another freepbx support ticket as well as being commented on the freepbx forums.

Turns out the syntax of extensions_additional.conf generated by Freepbx does not match what Asterisk 1.6 is expecting.

Lines such as:
*60,n,SayUnixTime(${FutureTime},,IM \'and\' S \'seconds\' p)

need to be written in Asterisk 1.6 as:
*60,n,SayUnixTime(${FutureTime},,IM 'and' S 'seconds' p)

Otherwise the "and" and "seconds" files can not be found. Though this syntax originally matched the usage instructions of SayUnixTime, as noted by a user on the trixbox forums :
"It (SayUnixTime) has some filenames (for playback) hardcoded in the file say.c and if they are not present, the extension exits non-zero followed by a hangup."

The file that generates this is /var/www/html/admin/modules/infoservices/functions.inc.php but beware Asterisk 1.4 still needs the slashes.

This was later fixed properly but trixbox has yet to release this version of freepbx as an update.

Okay so it was not a deal breaker but few people seemed to have researched this / or provided a good explanation with workaround.

For now I have just merged in the changes as per the proper fix listed above and I have updated the usage instructions on the SayUnixTime wiki page.

Friday, 23 Apr 2010

Googled around for a quick way to fix line feeds in a string on a Windows computer and found all sorts of silly suggestions (converting all Windows line feeds to Unix, then Unix to Windows or worse just adding additional \r's to all \n's you see, even if they are already correct Windows linefeeds) when really we could just do it in a regular expression.

Here is my code:

// This will convert any Linux line feeds to Windows line feeds.
private static object CorrectLineFeeds(string message)
{ return Regex.Replace(message, "([^\r])\n", "$1\r\n"); }

Simples!

Monday, 22 Mar 2010

I have spent the past 3 hours wondering why I can no longer connect to my phone server via IAX. Eventually I found these pages :

http://sysadminman.net/blog/2009/asterisk-upgrade-breaks-ax-extensions-942
http://downloads.asterisk.org/pub/security/AST-2009-006.html
http://www.freepbx.com/forum/freepbx/users/iax2-softphone-zoiper-wont-register-after-yum-update-solved
http://downloads.asterisk.org/pub/security/IAX2-security.pdf

For the lazy:
nano /etc/asterisk/iax_general_custom.conf

and save:
calltokenoptional = 0.0.0.0/0.0.0.0
maxcallnumbers = 16382

It is annoying, but makes sense.

I have notified the ZoIPER developers.

Sunday, 14 Mar 2010

Today I had the misery of learning about the quirks of the DataTable.

Basically adding the second row would generate a "NullReferenceException" - "Object reference not set to an instance of an object."

After a while I learnt that unless I specifically undid the changes I made to the default view it would not work correctly and would erroneously error on the Rows.Add line.

The solution was to not only call theTable.Reset() to prevent the exception but also to manually null the property of the default view that was changed (or the rows were not being displayed).

Below is some sample code.


using System.Data;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            DataTable theTable = new DataTable();

            // Add column.
            theTable.Columns.Add("Test");

            // Add a sort rule.
            theTable.DefaultView.Sort = "Test ASC";

            // Add 2 rows.
            theTable.Rows.Add("Hi");
            theTable.Rows.Add("Hi2");

            // Clear the columns (and rows).
            theTable.Rows.Clear();
            theTable.Columns.Clear();
            
            // Error also occurs with
            //theTable.Clear();

            //Solution:
            //theTable.Reset();

            // Without this the view won't update.
            //theTable.DefaultView.Sort = null;

            // Add a column again.
            theTable.Columns.Add("Test");

            // Add the row again.
            theTable.Rows.Add("Hi");

            // This will cause an error!
            theTable.Rows.Add("Hi2");

            // Show the table.
            dataGridView1.DataSource = theTable;
            dataGridView1.Refresh();
        }
    }
}


Searching Google didn't really reveal much about this, hopefully this will save others some time.