Friday, May 28, 2010

SSMS 2005/2008 Tools Pack

WOW Guys.  If you use SQL Server Management Studio 2005 or SSMS 2008, you have got to get the SSMS Tools Pack. My favorite feature so far is code collapse.

Monday, May 24, 2010

Ebook Reader Shopping

I'm looking for a good ebook reader.  My wish is to get an ebook reader that also syncs with google calendar, contacts, has text-to-speech, connects to a full QWERTY keyboard, and can talk to mobipocket's ebook organizer.

That being the ideal, I will now adjust my expectations to real-world constraints.







Friday, May 21, 2010

SQL Server 2008 & Access 2007 ODBC Connectivity Issue "delay in opening server connection" - Resolution

I had this nagging problem while attempting to create a linked table in Access 2007 to a SQL Server 2008 database.

For me, it turned out to be a firewall issue.  Basically, on the machine hosting the SQL Server database, I added an exception for the TCP port on which the SQL Server configured (port 1433 by default).  You can check the exact port in SQL Server Configuration Manager.

 If you try this and still have problems, consult this more thorough checklist.




Friday, May 14, 2010

PHP Editor which can also debug


I spent some time looking around for a software development environment which can easily support breakpoints in PHP code.

After testing several IDEs, including the Eclipse, IntelliJ, PHPStorm, and Komodo. 

My final recommendation is phpDesigner.  Here is a screen shot (from their website):




After looking at the specs of this software; it may be worthwhile to also look into vs.php; which looks like a compelling tool to have if you are a fan of the Visual Studio IDE.

Both vs.php and phpDesigner use Xdebug as their back-bone.  Kudos to the Xdebug project for creating a platform that others can use to create great php debugging applications.


Thursday, May 13, 2010

jFeed: JavaScript jQuery RSS/ATOM feed parser plugin

jFeed: JavaScript jQuery RSS/ATOM feed parser plugin - jf-hovinne.blog
This might be an interesting project to do... so that multiple rss feeds can be quickly assembled and shown on the same page.

jFeed: JavaScript jQuery RSS/ATOM feed parser plugin

jFeed: JavaScript jQuery RSS/ATOM feed parser plugin - jf-hovinne.blog
This might be an interesting project to do... so that multiple rss feeds can be quickly assembled and shown on the same page.

PHP File Routing with Partial Download Support

Partial download requests are sent to the server as a header item. done: See comment entry by gaosipov at gmail dot com here: 09-Oct-2008 09:08

In case it gets removed from the site, i will be publishing it here:

< ?php
//this is a php file
function smartReadFile($location, $filename, $mimeType='application/octet-stream')
{ if(!file_exists($location))
  { header ("HTTP/1.0 404 Not Found");
    return;
  }
 
  $size=filesize($location);
  $time=date('r',filemtime($location));
 
  $fm=@fopen($location,'rb');
  if(!$fm)
  { header ("HTTP/1.0 505 Internal server error");
    return;
  }
 
  $begin=0;
  $end=$size;
 
  if(isset($_SERVER['HTTP_RANGE']))
  { if(preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches))
    { $begin=intval($matches[0]);
      if(!empty($matches[1]))
        $end=intval($matches[1]);
    }
  }
 
  if($begin>0||$end<$size)
    header('HTTP/1.0 206 Partial Content');
  else
    header('HTTP/1.0 200 OK'); 
 
  header("Content-Type: $mimeType");
  header('Cache-Control: public, must-revalidate, max-age=0');
  header('Pragma: no-cache'); 
  header('Accept-Ranges: bytes');
  header('Content-Length:'.($end-$begin));
  header("Content-Range: bytes $begin-$end/$size");
  header("Content-Disposition: inline; filename=$filename");
  header("Content-Transfer-Encoding: binary\n");
  header("Last-Modified: $time");
  header('Connection: close'); 
 
  $cur=$begin;
  fseek($fm,$begin,0);

  while(!feof($fm)&&$cur<$end&&(connection_status()==0))
  { print fread($fm,min(1024*16,$end-$cur));
    $cur+=1024*16;
  }
}
?>

Usage:

< ?php
smartReadFile("/tmp/filename","myfile.mp3","audio/mpeg")
?>

Wednesday, May 12, 2010

AJAX call to ASMX usng JQuery with error handling

Here's the javascript

        function DoAjaxTest(str) {
            $.ajax({
                type: "POST",
                url: "Service1.asmx/TestMethod",
                data: "{'parameter1': '" + str +"'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                   alert(msg.d);
                },
                error: function (xhr, textStatus, errorThrown) {
                    //debugger;

                    var errObj={Message:'',ExceptionType:'',StackTrace:''};
                    //debugger;
                    if (xhr.status===500) {
                        //a thrown exception will have status 500.  the properties of Message,ExceptionType, StackTrace 
                        errObj = eval('(' + xhr.responseText + ')');
                    }
                    alert(
                        "Status: " + textStatus +
                        "; textStatus: " + textStatus +
                        "; reror Thrown: " + errorThrown +
                        "; status statusText: " + xhr.status + " " + xhr.statusText +
                        "; Error Message: " + errObj.Message +
                        "; 
stack trace:
" + errObj.StackTrace.replace(/\n/g, "
\n") + "
" + //"; xhr.responseText: " + xhr.responseText + "
"); } }); }; $(document).ready(function () { DoAjaxTest('hello world'); });
Here's the content of the Service1.asmx file:
<%@ WebService Language="C#" Class="testService" %>

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class testService  : System.Web.Services.WebService {

    [WebMethod]
    public string TestMethod(string parameter1)
    {
        
        return (DateTime.Now.ToLongTimeString() + ": " + parameter1);
    }
}