web developer web developer web developer web developer web developer


Archive for May, 2008

Length of directory and filename

I've written a small C program, which would determine the maximum name length of directory and filename. I found out that there are different constants on different machines and OS.

Here's one for windows:

 
/* Language: C */
#include <stdio.h>
 
#include <unistd.h>
 
#include
<limits.h>
 
main(){
 
 printf("Maximum path size is %dn", PATH_MAX);
 printf("File max is %dn", FILENAME_MAX);
 
}
 

Here's a version on Linux:

 
/* Language: C */
#include <stdio.h>
 
#include <unistd.h>
 
#include
<limits.h>
 
main(){
 
 printf("Maximum path size is %dn", PATH_MAX);
 printf("File max is %dn", NAME_MAX);
 
}
 

Heres for the POSIX compliant OS

 
/* Language: C */
#include <stdio.h>
 
#include <unistd.h>
 
#include
<limits.h>
 
main(){
 
 printf("Maximum path size is %dn",POSIX_PATH_MAX);
 printf("File max is %dn", _POSIX_NAME_MAX);
 
}
 

Editing post

To my avid readers, as you would notice there are some codes on my blog post. As not to get confused I'll be including a language description to some post, so not the readers may not guess in what particular language it has been written.

A day in C++ and MYSQL

It has been an end to my C++ class last Sunday, which I've enjoyed the 5 weeks training. Thanks to my trainor who is not so selfish in sharing his knowledge to his students. Kudos to Ernest Bercilla, a full time applications trainor of ITTC.

Mostly all of the languages I've learned it was just self taught, actually this was my first time acquiring a knowledge in a programming language on a training. Well as day one in my class, my objective was to write C++ code to connect to the MYSQL API, which I did now because of the foundation that I've learned during the training.

Here's the steps, how I've used MySQL API, my C++ Ide is codeblocks
1. download a library from http://devpaks.org/ , find the ones for mysql under database.
2. extract the package, am using 7-zip, so DevPak files is supported.
3. create a mysql folder under the C:\Program Files\CodeBlocks\MinGW\include
4. copy the include from the content of libmysql to the folder that has been created.
5. set the library and point it to the location of libmysql.a

6. To test create a database and a table name.

Here's my sample code:

 
/* Language : C++ */
 
#include <windows.h>
#include <iostream>
#include <mysql/mysql.h>
 
using namespace std;
 
int main() {
    //connection params
    char *host = "localhost";
    char *user = "root";
    char *pass = "";
    char *db = "cardsauce";
 
    //sock
    MYSQL *conn; //pointer
    MYSQL_RES *res;//pointer
    MYSQL_ROW row;
 
    conn = mysql_init(0);
    if (!conn){
         cout << "sock handle failed!" << mysql_error(conn) << endl;
    }
 
    //connection
    if (!mysql_real_connect(conn, host, user, pass, db, 0, NULL, 0)){
        cout << "connection fail: " << mysql_error(conn) << endl;
    }
 
    mysql_query(conn,"SELECT * FROM users");
 
    res = mysql_use_result(conn);
 
    while (row = mysql_fetch_row(res)) {
        cout << row[0] << " " << row[1] << endl;
 
    }
 
    //closing connection
    mysql_close(conn);
 
    return EXIT_SUCCESS;
}
 

Rapid PHP 2008 / version 9.0.95

There's a new upgrade to my favorite PHP Editor, here's the latest improvements.

What's new?

Although we did not manage to do everything that was planned (as usually), a lot of work has been done and a lot of good stuff has been added.

Please note that some items apply only to the top of the range products, for example, PHP auto complete improvements apply to Rapid PHP 2008 and WeBuilder 2008 only.

+ Added Big: Secure FTP support
+ Added Big: Re-wamped, faster File Explorer
+ Added Big: CVS / SVN Support (via 3rd party clients e.g. TortoiseSVN and shell menu - TortoiseSVN icons are now visible and shell menus are accessible)
+ Added Big: Code templates
+ Added Big: HTML Tag block highlighting
+ Added Big: Missing HTML tag highlighting
+ Added Big: Highlighting of missing brackets
+ Added Big: Existing tag editing via dialog windows
+ Added Big: Right-click tag editing via dialog windows
+ Added Big: Realtime PHP & Ruby syntax check
+ Added Big: Ruby code explorer
+ Added Big: Ruby auto complete
+ Added Big: Code collapse based on code
+ Added Big: Better X-Ray (width, height, size labels, properties)
+ Added Big: Language Browser replaces Object and Markup browsers
+ Added: Reload from FTP command
+ Added: Auto close curly brackets (optional)
+ Added: Auto indent curly brackets (optional)
+ Added: Select between braces
+ Added: Gutter-click close to the left side (16 pixels) sets break-point for PHP files
+ Added: PHP auto-complete and function hints read also includes
+ Added: Allow HTML features in JavaScript code
+ Added: Clear all breakpoints
+ Added: Closing HTML tag auto complete
+ Added: Open file at cursor for PHP
+ Added: All PHP code can now be highlighted with solid background
+ Added: Focus inspector row based on selected CSS property
+ Updated: USB support is now more robust
+ Updated: Settings export now works better
+ Updated: Load parsers only as needed (0,2 sec load time increase on QuadCore, mor eon slow pcs)
+ Updated: Updated entities file / special character replacement
+ Updated: Removed "Editors", replaced with "Programs" + parameter support
+ Updated: New looks for the Welcome wizard
+ Updated: Replace tokens now can use single input multiple times
+ Fixed: Can now save hidden files
+ Fixed: Toolbars on Vista aero
+ Fixed: Problems with buggy FTP servers not understanding LIST -al params, now params can be set by user.
+ Fixed: Ctrl+A now works in find dialog
+ Fixed: Show hour-glass cursor while tidy works for long files
+ Fixed: Convert style blocks rel=stylesheet is now rel="stylesheet"
+ Fixed: Re-load file explorer on project edited to refresh file types
+ Fixed: Preview temp file for CSS is generated only preview pressed
+ Fixed: Editor now scrolls automatically when Backspace pressed and caret not far from edge
+ Fixed: Style block selection bug http://forums.blumentals.net/viewtopic.php?p=9306#9306
+ Fixed: Related styles now work with mixed case class names
+ Over 50 other fixes and improvements

Think twice before signing up with cheap webhost

During the weekends I have to change and move my sites to Hostgator , it's sad because three years I've been with my past host I think was good, due to the nature of my job I didn't monitor it very well. ( Just to wait for the check every month) , I didn't know that I can earn much more on a reliable host. I found out that my past host has been several times timing out when large request has been made.

I was in shock that a reliable makes a big difference, if you dont know what I am talking about signup with Hostgator and move a test site. Youll see the difference best of all it has a money back guarantee.

Dayrit.org offline for about 2 weeks

The domain which my cousin Jonathan and I co-managed was off line for about 2 weeks, he forgot to renew the domain. During this period we asked the philhosting.net support to solved our issue. Thus I use my paypal account to add funds to the reseller account, unfortunately on their website it does not update the added funds on the account. It took them about more than a week to resolve the issue.