A collection of older information

This is the previous content of the nocurve.com site, where the idea was to store information that will assist in saving precious time when trying to develop something or fix something.

Geany

This is the home page

One crazy issue I had on Windows was that for some reason at some point the Geany window disappeared. The task was active, clicking the icon would bring it to focus but would not show the Window. It was obviously hidden or thrown out of the desktop view. I assumed the window saved it’s state with some insane coordinates but couldn’t get it back to show in the desktop.

Finally found the answer here – sure helps when you know some Windows basic techniques…

“I have installed Geany 0.19.1 on Windows 7, I run the Geany.exe shortcut and it appears running on my windows taskbar, if I hit Alt+Tab I see the Geany icon. But… no window is shown. Where is the Geany window? How to fix it?”

“Press Alt-Space, then M, then the arrow keys to move the window into view.” (you can also use the mouse instead of the arrow keys to speed up the process)

DIV Charts

Attachment “jsdivcharts.jpeg” not found
Free (LGPL) DIV based JavaScript Charts. This provides to main advantages to other JavaScript charting libraries:

  • It uses DIVs instead of Canvas or VML, which means it will work virtually on any browser (including the Android native Web browser which as of this writing does not support these technologies).
  • It is really simple to use. The charting library does all the thinking for you 🙂
  • Currently supported: Stacked Bar Charts, Bar charts (Which is just a Stacked Bar Chart with one group) Compound charts (stacked bars and lines), tooltips, Pie Charts, automatic Y axis step calculation, default color support

This charting library builds upon the amazing javascript wz_graphics library created by Walter Zorn. Unfortunately, I only recently learned that Walter Zorn passed away in May 2009. May this little contribution be a tribute to his work.

To view a demo of the DIVCharts library and download it, just go here

Change Google Chrome’s default language on Mac

To change the Google Chrome application language to English on Mac OS/X, open a terminal window and at the command prompt type the following.

defaults write com.google.Chrome AppleLanguages '(en-US)'

The next time you’ll open Chrome it will be in English (actually, its recommended to close Chrome before doing this).

Long Path to Short 8.3 MS-DOS path conversion

Every once in a (long) while I require this. Being surprised by the lack of such a simple utility I quickly made one for public use. You can download the VS2008 C++ project and source code from here. If you just want the executable, you can get it here (just drag the file in the long path to the upper field and click the OK button to get the short path inthe lower field.

Access MSSQL from PHP

On Ubuntu

First, install the LAMP (Linux,Apache,MySQL,PHP) package as follows:

$sudo apt-get install lamp-server^

Note that the ‘^’ at the end is not a typo !

Next, install MSSQL support for PHP (taken from here)

$sudo apt-get install php5-sybase
$sudo /etc/init.d/apache2 restart

On Windows

First install one of the available WAMP (Windows,Apache,MySQL,PHP) packages (I use this)

Next, download and install Microsoft’s PHP extension for MSSQL (from here)

The above setup contains quite a few candidates to be the PHP extension. Make sure you copy the relevant extension dll (in my case it was php_pdo_sqlsrv_53_ts_vc6.dll ) from Microsoft’s setup to the php extensions folder (in my case it is located at c:wampbinphpphp5.3.0ext ) and use either php.ini or the wampserver UI to add it to the list of extension dll’s PHP loads at startup.

Connecting to the MSSQL database

After you’ve done the above, you can now connect to the MSSQL server. The following code will work on both Ubuntu and Windows:

$serverName = "mymssqlserver.com"; 
$database   = "mydbname";
$uid        = "username";
$pwd        = "password";

try
{
    if ( stripos(php_uname(), "linux") === false )
    {
        $g_conn = new PDO( "sqlsrv:server=$serverName;Database=$database", $uid, $pwd);
    }
    else
    {
        $g_conn = new PDO( "dblib:host=$serverName;dbname=$database", $uid, $pwd);
    }
    
    $g_conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); 
}
catch( PDOException $e )
{
    die( "Error connecting to SQL Server" ); 
}

// You can now use $g_conn to execute pdo queries.

Simultaneous VPN and Internet Access on Ubuntu

This might be already solved in newer (>11.04) versions of Ubuntu.

The following assumes you installed a VPN connection in Ubuntu, but when you connect to the VPN you can’t access the public Internet. It took me some time until I found an answer that worked here:

“First, I determined what ip address ranges were being used on the VPN, in my case 192.168.32.* and 192.168.16.*. Then I connected to my vpn normally and sshed to a server on the network. I ran route on that machine and got the gateway address and metric being used. Then I added routes for the two ip address ranges to the routes field in the IPv4 settings tab and clicked on “Use this connection only for resources on its network” and “Ignore automatically obtained routes”. Then poof like magic it worked.”

Leave a Reply

Your email address will not be published.