Category Archives: Other Programming Language

Other Programming Language

Free Shell Scripting Guide From Apple – Shell Scripting Premier

Apple has updated its free Shell Scripting Premier Guide, which is freely downloadable from Mac OS X Developer Library website.

Chapters included in the freely downloadable Shell Scripting Premier:

topic

Available in PDF format together with zip files containing sample scripts as discussed in the book

Example Code: How to Send SMS from PHP (via Clickatell)

Hi there, due to popular demand (requests sent to my personal email – mypapit -at- gmail.com).

I decided to share my old post regarding my simple SendSMS php class which can help php developers to send SMS from their web application

[php]
require(‘SendSMS.php’);

$sendsms = new SendSMS(“username”,”password”,”HTTP POST API key”);

/* if the login return 0, means that login failed, you cant send sms after this */
if ( ($sendsms->login()) == 0 ) {
die( “failed”);
}

/*other wise, you can send sms using the simple send() call*/
$sendsms->send(“0132073011″,”can you receive this message? Hello there….”);

[/php]

Requirements
To use SendSMS class, you need:

That’s it.. contact me if you’ve more questions

Download SendSMS PHP class (version 0.5)
.
.
.

Twitter Command Line Client

A nice twitter client for those who are working in CLI environment.

Get twitter-cmdline.

Free Image Hosting at www.ImageShack.us

A Windows alternative is also available at : Twitter Windows Command Line Client.

Alternatively you can try a cURL hack to post your update to twitter from command line.

btw my twitter id is ‘mypapit’. Happy twittering.

Solution to libctiny and wcrt – LNK2001 unresolved external symbol __chkstk

I’m not sure if any of you ever use libctiny or wcrt, they are both meant to be use with Microsoft Visual Studio so that your resulting binary won’t use the default Microsoft run-time library which slightly bloats the exe.

By using one of these libraries, you can greatly reduce your resulting binary from an average of 20KB to 7KB, depending on your application.

The chkstk problem

The problem arises when the application you just compiled fails to link with an error message: “LNK2001 : unresolved external symbol __chkstk” .


libctiny wcrt chkstk link error

This got to do with the “Ignore all default libraries” option which you’ve to check when using this library. Apparently one library which is required by a routine inserted by the Microsoft tools (chkstk) was excluded from linking as well.

Solution to the problem

Manually include the library! The routine/function is included in an object file named “chkstk.obj”, just put it in the link dialog box beside libctiny/wcrt, and the problem will be settled.

wga fakap #2 chkstk libctiny

I hope that this will solve your problem !

Microsoft recent steps to curb piracy is similiar to shareware concept

I read the recent Microsoft plan of tatooing illegal copies of Microsoft Windows XP at various places over the internet. From what I read, the process involved putting a pop-up dialog box that will appear on the Windows login screen, informing the user that his copy of the OS is counterfeit and that he should get a genuine copy.

Another message will permanently be affixed at the user’s desktop, “This copy of Windows is not genuine. You may be a victim of software counterfeiting”, the reminder can’t be removed (tattooed).

Finally, a ballon-style popup will appear randomly in system tray reminding you that you’re using an illegal copy of Microsoft Windows. The only way to stop the messages from appearing is to replace the OS with a genuine copy. Though some unofficial sources claimed, that there’s a crack to circumvent all the warnings.

These ‘nagulator’ (not my word), is somehow related to another business model, called shareware or nagware, which constantly reminds you to pay for the software you use randomly. IMHO, if Microsoft were to really discourage software piracy, it should impose a stricter way to prevent people from using illegal copies of it’s own products.

Instead, they create a specially crafted dialog box that is used in common nagware/shareware to deter “piracy”. Has Microsoft turned it’s own operating system to a shareware now?

[Source]

j2meshitheap.com – a list of the world’s worst J2ME-enabled phones

JavaME (formerly J2ME) software fans? Then please avoid any of these J2ME-enabled phones because one or more of their implementations are either broken, incorrect or plainly doesn’t work.

I personally tested 3650/3660 J2ME implementation first hand by running some of my midlets. In my oppinion i think Nokia 3650/3660 has the worst j2me implementation that I’ve encountered because some of the *Listener object failed to respond correctly, plus the networking part of the midlet almost always failed.

I would also want to add Nokia 6600 to the list because of various bugs in its implementation, though not as annoying as 3650/3660, it is still noticeable.

so please visit http://www.j2meshitheap.com for more complete listing

libcurlemu – a pure PHP curl implementation (libcurl emulator)

Have you came across a situation where you need to use php libcurl extension and it was not enabled on your webserver? Then, try libcurlemu, apure-PHP implementation to PHP cURL. It emulates all of the curl_* functions normally provided by the native cURL extension itself.

libcurlemu works transparently regardless of the availability of PHP cURL extensions, thus making your script even more portable across web server that does not have PHP cURL extensions.

What is libcurl / cURL?

cURL is a command-line tool that supports transfering files with URL syntax. It supports many protocols like FTP, FTPS, TFTP, HTTP, HTTPS, TELNET, DICT, FILE and LDAP.

libcurl is a library based on cURL that helps you to connect and communicate with different type of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, and ldap protocols.

For HTTP/HTTPS protocol, libcurl supports POST, PUT, GET and DELETE method, making it suitable for writing web services, particularly REST-like services.

Stay tune for code examples on how to use libcurl to emulate a browser submitting POST request to a server.

libcurlemu is written by Steve Blinch, and can be downloaded at his website : http://code.blitzaffe.com

php, libcurl, curl, rest, opensource

Using Feedcreator to generate ATOM 1.0 feeds

I’m going give out a tip on using feedcreator class library to ease up generating syndication feeds for your web project. As you might know, there are different kind of syndication format out there such as RSS 2.0, RSS 1.0, RSS0.91, ATOM0.3 and ATOM1.0. Each of the syndication format has its own markup (though RSS 0.91 and 2.0 are closely related), making generating feeds from scratch can be quite a chore for your project.

Feedcreator provides an easy way to create RSS and ATOM feeds from within PHP using ease to use classes. However, feedcreator has a couple of drawback :

  1. It does not support ATOM 1.0
  2. Doesn’t support Enclosure
  3. Can’t generate feeds on the fly

Though these drawbacks might not be as serious as I put in here, it is nice to have this features implemented on feedcreator. ATOM 1.0 is a new syndication format issued by IETF as a standard way to produce feeds, ATOM 1.0 has a nice features and more structured layout than the ever-inconsistent RSS feeds.

Though Enclosure tag is optional in RSS 2.0, the tag is significant for those who are into podcasting or photoblogging. Enclosure feature allows for the syndicated feed to not just serve text content, but also to package an enclosure (call it an attachment of some sort), as well. IIn the podcasting model, the RSS enclosure contains an audio file, which subscribers can listen to on their devices.

Generating feeds on the fly is one of the most requested feature of feedcreator. This allows feeds to be generated dynamically upon request as opposed to generating feed on certain event (such as posting new articles). Mambo and PhpGedView project uses modified Feedcreator to generate feeds on-the-fly.

I’ve published a modified version of Feedcreator (namely Feedcreator 1.7.2-ppt) that contains all of these enhancements (or hacks). Here’s a snippets on how to use the additional features :


/*

This demo is to illustrate how to use feedcreator
using outputFeed function, ATOM1.0 and enclosure
support.

Enclosure support is useful if you are into
podcasting or publishing photoblog.

the required parameter for enclosure is url, length
and type (as in MIME-type)

*/

< ? php
include ("include/feedcreator.class.php");

//define channel
$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title="Personal News Site";
$rss->description="daily news from me";
$rss->link="http://mydomain.net/";
$rss->syndicationURL="http://mydomain.net/$PHP_SELF";

//channel items/entries
$item = new FeedItem();
$item->title = "test berita pertama";
$item->link = "http://mydomain.net/news/somelinks.html";
$item->description = "hahaha aku berjaya!";
$item->source = "http://mydomain.net";
$item->author = "[email protected]";

//optional enclosure support
$item->enclosure = new EnclosureItem();
$item->enclosure->url='http://mydomain.net/news/picture.jpg';
$item->enclosure->length="65905";
$item->enclosure->type='image/jpeg';

$rss->addItem($item);

//Valid parameters are RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated),
// MBOX, OPML, ATOM, ATOM1.0, ATOM0.3, HTML, JS

$rss->outputFeed("ATOM1.0");
//$rss->saveFeed("ATOM1.0", "news/feed.xml");

?>

You can download the modified version of Feedcreator 1.7.2 from my server, the zip package contains the modified class library, GNU/LGPL license, some demo php file and a diff file against the plain vanilla Feedcreator 1.7.2 for curious people.

p/s : all of the modifications are written by me except outputFeed function which is written by Fabian Wolf.

Download :
Feedcreator 1.7.2-ppt (zip)

Feedcreator website : http://www.bitfolge.de/rsscreator-en.html

osCommRes – sell your services online

osCommRes is an e-commerce application that allow businesses sell services online. It differs from conventional e-commerce web application which sells tangible or digital products.

osCommRes instead allows you to sell your services, be it massage service, counselling, spa threatment, etc. osCommerce allows you to sell it all across the internet.

osCommRes key features is :

  1. Product/Events: Products and events can be purchased in the one transaction saving you and the customer time and money.
  2. Online customer payments: Customers can book in and purchase products online in the same transation.
  3. Website Template: If you have the skills in-house, you can modify the look and feel of the product to suit the design of your site.
  4. Online reservation: Allows customer to reserve your service

osCommRes is licensed under the GNU General Public License an was based heavily on the rock-solid oscommerce e-commerce web application.

[osCommRes project page]