Featured Posts

jQuery Expand/Collapse All Menu PluginjQuery Expand/Collapse All Menu Plugin Another take on an expand/collapse style navigation. For our requirements, the navigation was a template and needed to be n-levels deep to take into account any possible...

Readmore

jQuery Dynamic FormjQuery Dynamic Form Scenario: Building web forms can be tricky when a form calls for a variable number of fields. A real-world example might be a sports team with an n number of players. When...

Readmore

A PHP Pagination FunctionA PHP Pagination Function Here's a PHP function "getPaginationHtml()" that builds an item-pagination type HTML DIV based on parameters only, i.e. no database recordset needed. Note the user of a second...

Readmore

A PHP Calendar Class Based on Zend_DateA PHP Calendar Class Based on Zend_Date A recent project required an event calendar in both a mini and full sized format. The project was based on Zend Framework, a highly scalable and feature-rich PHP MVC framework....

Readmore

Analyzing the Impact of Web Page Textual Data Representation on the  Accuracy of Selected Supervised Learning ModelsAnalyzing the Impact of Web Page Textual Data Representation... We looked at the effectiveness of supervised learning models in solving the real-world problem of web page classification. We attempted to maximize the performance of...

Readmore

Arietis Software Innovations Rss

jQuery Expand/Collapse All Menu Plugin

Posted on : 22-02-2010 | By : Derek | In : Posts

1

Another take on an expand/collapse style navigation.

For our requirements, the navigation was a template and needed to be n-levels deep to take into account any possible combination the client might need. Outside of requiring well-formed nested unordered lists, the markup requires SPAN tags around the items that you wish to expand/collapse. That it!

Demo:
Click here for a demo.

*It’s a jQuery plugin so it can be chained to other jQuery events, effects or plugins.

Download/Contribute:
Project source here: jquery expand/collapse all project hosting

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)

Implementing Best Practice Guidelines onto PDAs – Preliminary Results and Lessons Learned

Posted on : 28-11-2009 | By : Derek | In : Articles, Health, JAVA, Posts

Tags:

0

Abstract

Best Practice Guidelines (BPGs) represent a promising way to improve nursing care by reducing the time lag between research findings and subsequent changes in healthcare practices. Translating the currently paper-based BPGs into a portable, computer-based format is seen as an important step towards the widespread use of BPGs in nursing practice. In implementing the asthma BPG onto a PDA, we have discovered that the concept of an “algorithm” is distinctly different for nurses and for computer programmers. Our on-going development of the computer-based BPG is influenced by these insights into the dynamic and iterative process of nursing care.

Article (PDF):

[download id="6"]

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)

jQuery Dynamic Form

Posted on : 28-11-2009 | By : Derek | In : Javascript, Posts, jQuery

Tags: , ,

4

Scenario:
Building web forms can be tricky when a form calls for a variable number of fields. A real-world example might be a sports team with an n number of players. When capturing the team player data via a web form, the typical way might be to create the form with one empty player field for each player on the team. You would obviously need to know the maximum number of players per team. Worse, you would also need to deal with non-existant form data on the server side.

Solution:
A more dynamic way is to show just the single player field with a button to add extra player fields for the n number of players on the team.
To support this solution, I’ve written a jQuery plugin that will duplicate, on-demand, any field or group of fields set within a <FIELDSET> tag. You can use the plugin to create one or more dynamic fields per form or in a group of forms.

Demo:
Click here for a demo of a dynamic form powered by jQuery.

*It’s a jQuery plugin so it can be chained to other jQuery events, effects or plugins.

Download/Contribute:
Project source here: jquery dynamic form project hosting

VN:F [1.9.3_1094]
Rating: 3.9/5 (4 votes cast)

A PHP Pagination Function

Posted on : 08-11-2009 | By : Derek | In : PHP, Pagination, Posts

Tags: ,

0

Here’s a PHP function “getPaginationHtml()” that builds an item-pagination type HTML DIV based on parameters only, i.e. no database recordset needed. Note the user of a second function that is used by the pagination function to build the URL parameters needed for the pagination links.

Visual example:

item_pagination_screen

 

How to call the getPaginationHtml() function:

//show the pagination html in an ordered list based on the listed arguments
echo getPaginationHtml(array('numRecords' => 12, 'numRecordsToShow' => 3, 'currPage' => 1, 'showPages'=>true));

 

HTML Output:


 

Functions:
1) getPaginationHtml()

/*
 * Get the pagination link HTML
 * @return String
 */
function getPaginationHtml ($args = array()) {

    $defaultArgs = array('numRecords'=> 1,
    					'numRecordsToShow'=>10,
                        'currPage'=>1,
                        'linkSeparator'=>'|',
                        'showPages'=>false,
                        'pageParamName'=>'page',
                        'firstClass'=>'pagination-first',
                        'prevClass'=>'pagination-first',
                        'nextClass'=>'pagination-next',
                        'lastClass'=>'pagination-last',
                        'pageClass'=>'pagination-page-link',
                        'separatorClass'=>'pagination-separator');
    $userArgs = array_merge ($defaultArgs, $args);
    foreach ($userArgs as $key=>$val) {
        ${$key} = $val;
    }

    //vars
    $links = array();
    $paramUrl = getParamUrl(array('exclude'=>'page')); //exclude the 'page' url param
    $totalPages = ceil($numRecords/$numRecordsToShow);

    //build  'num records' text
    $from = (($currPage-1)*$numRecordsToShow) + 1;
    $to = min(($from+$numRecordsToShow-1), $numRecords);
    $links[] = "
  • $from–$to of $numRecords records
  • "; //show page numbers if ($showPages) { for ($i=1; $i< = $totalPages; $i++ ) { ($i == $currPage) ? $selected = "$pageClass-selected" : $selected = ''; $links[] = "
  • $i"; } } //build 'first' link $links[] = "
  • First
  • "; //build 'prev' link $prev = max($currPage-1, 1); $links[] = "
  • < Prev
  • "; //build 'next' link $next = min($currPage+1,$totalPages); $links[] = "
  • Next >
  • "; //build 'last' link $links[] = "
  • Last
  • "; return implode("
  • $linkSeparator
  • ", $links); }

     

    2) getParamUrl()

    /*
     * Build the URL based on the current GET/POST parameters
     * excluding any unwanted parameters (comma separated if more than one).
     * i.e.: array('exclude'=>'page,sortname,sortorder');
     * @return String
     */
    function getParamUrl ($args = array()) {
        $defaultArgs = array('exclude'=> false);
        $userArgs = array_merge ($defaultArgs, $args);
        foreach ($userArgs as $key=>$val) {
            ${$key} = $val;
        }
        //check if GET or POST
        (isset($_GET)) ? $_params = $_GET : $_params = $_POST;
        //build the url string
        $paramUrl = array();
        foreach ($_params as $key=>$value) {
            $toExclude = explode(',', $exclude);
            if ($toExclude && !in_array($key, $toExclude)) {
                array_push($paramUrl, "$key=$value");
            }
        }
        return '?'.implode('&',$paramUrl);
    }
    VN:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)

    A PHP Calendar Class Based on Zend_Date

    Posted on : 26-05-2009 | By : Derek | In : PHP, Posts, Zend

    Tags: ,

    14

    A recent project required an event calendar in both a mini and full sized format. The project was based on Zend Framework, a highly scalable and feature-rich PHP MVC framework. The resulting Calendar class is admittedly quite basic, but I thought it might prove useful for other PHP/Zend coders who are trying to find a simple yet extensible Calendar solution for their own projects.

    Localization

    The benefit of using Zend_Date is that it relies on Zend_Locale for localization. To promote this, this custom Calendar class can be used to create a calendar in any language via the class constructor’s ‘locale’ parameter.

    Features

    • It can output HTML in the form of a table with the month, days of the week, and days visible.
    • It can generate the calendar HTML header alone, or the calendar HTML table body alone.
    • It can also be used to generate previous and next month links in the case you wanted to allow users to select the month themselves.
    • There is control over the table css, select box css , and select box form name via the html methods parameters
    • The class can also be used to generate Calendar data that you can access via more standard (get and set) methods to support your own unique Calendaring needs, i.e. without relying on HTML output.

    Demo

    Here is a link to a demo to get you started.

    Downloads

    1. Download the code here: [download id="4"]
    2. Comment below and let me know if it met your needs!

    Source/Contribute

    A View Helper version is being developed:
    Project source: zfcalendar project hosting

    VN:F [1.9.3_1094]
    Rating: 4.2/5 (3 votes cast)

    Ethics and Limitations of Technology: An Inseparable Future ?

    Posted on : 24-05-2009 | By : Derek | In : Posts, Rants & Raves

    0

    Have you ever read Bill Joy’s ”Why the Future Doesn’t Need Us”, Wired Issue 4.08 (April 2000)? Well, you should! It’s an interesting look at the potential impact of technology on humans, now and into the future. Well, after reading it, I felt like I needed to put my two cents in. So here it is, agree or disagree. Comments are welcome..

    —-

    Since the time that human beings first appeared on earth, we have been on a never-ending quest for knowledge. Granted, in the beginning when the epistemological view of our world was small, knowledge was limited to the experiences acquired in a day’s nomadic journey; relevant knowledge pertained to what could be manipulated within our immediate surroundings. During that period of time, survival of the fittest was not limited to those who carried the biggest club, but also included those human beings who possessed traits enabling them to defend themselves against the hardships of life (e.g., intelligence, innovation, etc.). Even at this evolutionary stage, knowledge empowered us to find technological solutions to what ailed us and to make life easier for us to endure. As a result, this knowledge and the technology that resulted as a product of this knowledge, allowed us to survive.
    Bill Joy, chief scientist and co-founder of Sun Microsystems, has strong opinions regarding this issue. If he were alive during that period, he would have warned us even then, that we were living in unprecedented times presented with the opportunity to influence future events in a dramatic and never seen before way. He would have argued that, even at this early stage of human history, the technologies of the period be used with the greatest trepidation and treated with the greatest of care. It would have been reasoned that, for example, a volatile technology such as fire, had the potential to extinguish our small species from the face of the earth. In Joy’s article entitled “Why the Future Doesn’t Need Us”, published in Wired Magazine in April 2000, he expresses his views on the battle between technological advancement and stagnant existence and insists the optimal solution for humanity is to relinquish potentially disastrous technologies before it harms our society.

    The Killjoy
    In my opinion, Bill Joy, as the pioneer of such revolutionary technologies as the Internet, should know better. Given his impressive success at furthering our current knowledge, some 790,000 years after fire was initially used as a technology (Goren-Inbar, 2004), you would think he would comprehend how technology is poised to benefit our collective selves by alleviating toil and human suffering, in turn, making our lives easier to live. Rather, he chooses to sound the alarm bell on technology’s shortcomings.
    Joy’s concern grew out of an impromptu discussion he had with two of science’s current stars, Ray Kurzweil, inventor of speech recognition software and champion of artificial intelligence, and John Searle, philosopher of mind and consciousness. Kurzweil’s concern regarding the rapid rate of technological advancement and the inevitability of a robot/human existence (Joy, 2000) coupled with Searle’s opposing argument purporting that this situation would never realistically occur as Robots cannot exist within the realm of consciousness (Joy, 2000) caused Joy to re-evaluate his understanding of current technologies and the ethics surrounding them.
    Essentially, Joy is distressed that we are at an ethical crossroads with respect to the use of current technologies. He believes that, “we have yet to come to terms with the fact that the most compelling 21st-century technologies – robotics, genetic engineering, and nanotechnology – pose a different threat than the technologies that have come before” and that with each of these technologies, “small, individually sensible advances leads to an accumulation of great power and, concomitantly, great danger” (Joy, 2000). The crux of Joy’s concerns surrounds what he perceived as three main threats to humanity: Genetic Engineering, Nanotechnology, and Robotics (GNR). Joy claims that these three technologies are “so powerful that they can spawn whole new classes of accidents and abuses” (Joy, 2000). The use of GNRs, coupled with, what he has coined “knowledge-enabled mass destruction” (KMD), namely knowledge-enabled weapon technology, poses grave consequences to human existence. Due to the rapid dissemination of information about how to construct these technologies, the “accidents and abuses” that result from the proliferation of GNRs, will allow individuals and small groups worldwide to use GNRs in malicious ways, without the need of large government controlled facilities or rare, raw materials (Joy, 2000) as it has been in the past, for example, with nuclear, biological, and chemical weaponry. KMDs and GNRs together with the potential for GNRs to self-replicate, something never seen before in other technologies (Joy, 2000), caused Joy to declare that the “only realistic alternative…is relinquishment: to limit technologies that are too dangerous, by limiting our pursuit of certain kinds of knowledge” (Joy, 2000) and thus recommends the halt of research on these technologies while we re-evaluate our ethical dilemma.

    Our Ethical Dilemma
    In terms of our current place in history, Joy is correct to assume that we need a new governing ethics unique from any previously explored. However, in using this as an argument for the relinquishment of knowledge, he overestimates the potential negative consequences resulting from technological research by today’s standards. The proposal of an “ethics of responsibility” (Jonas, 1973) that Joy believes has never previously existed, detracts from the urgency of his argument and lessens the impact of his suggestion that in order to accommodate this new ethics we must relinquish the pursuit of all technologies that pose a potential threat because we are in a different realm of ethics, previously unseen.
    In 1973, German-born philosopher Hans Jonas wrote an essay entitled “Technology and Responsibility: Reflections on the New Task of Ethics” that examined technology’s impact on that era asserting that we need to look through the “lens of a new kinds of ethics” (Winston & Edelbach, 2006). The essence of Jonas’ argument is that “the old prescription of neighbour ethics – of justice, charity, honesty and so on” (Jonas, 1973) still holds its importance in our immediate social circles, but that this ethics no longer strictly applies, and thus needs to be expanded to include our impact on the whole planet and its biosphere (Jonas, 1973). This new view on ethics strays from the anthropocentric view of the past in one vastly different way: through the understanding of our responsibility for the repercussions on future generations by way of our current technologies. Jonas (1973) suggests that “to seek for wisdom today requires a good measure of unwisdom”, and suggests that ethics needs to be examined and implemented in step with the creation and implementation of current technologies on a technology-by-technology basis. “It is only under the pressure of real habits of action…that ethics as the ruling of such acting under the standard of the good or the permitted enters the stage” (Jonas, 1973). Otherwise, to “foresee and forestall” as Joy sees it, is reactionary and is unfortunately counter-productive to innovation and progress.

    The Perils of Relinquishment
    At its root, Joy’s solution to this ethical dilemma is to relinquish the pursuit of certain types of knowledge that might facilitate technologies that pose a threat to humanity. At first glance, relinquishment, as a solution, is inherently troublesome and loaded with ambiguity. Albeit, many questions come to mind on how to effectuate relinquishment, but two in particular are worth investigating. Namely, can we afford to give up technologies that have the potential for negative consequences at the expense of those that might just as easily offer positive solutions to humanity, such as those that cure diseases, solve environmental problems, or even enable other beneficial technologies? Moreover, how do we prohibit research into these technologies in one country and ensure that it will not occur in another without our knowledge?

    Unintended Consequences
    Any new technology must be considered with reference to unanticipated or undesired consequences. Healy (2006) categorizes these consequences as being in one of two categories, namely: a) anticipated consequences being intended or desired, not desired but common or probable, or not desired and improbable, or b) unanticipated consequences being desirable or undesirable. Any new technology cannot be considered to have developed from scratch, rather it is based on a few, if not hundreds, of other technologies. To understand its ramifications, we must measure each one according to its impact as it relates to either of Healy’s two categories. As well, where will the line be drawn to demarcate the impact of one particular technology over another that is invented down the line? Dorner (as cited in Healy, 2006) outlines four features that make this endeavour essentially impossible: complexity, dynamics, intransparence, and ignorance or mistaken hypotheses. For our purposes, complexity refers to a technology that is the result of many other technologies, dynamics is the likelihood of a technology changing its negative or positive action (state) spontaneously without outside interference, intransparence is the notion that all of the elements of a technology can be seen at all times, and ignorance or mistaken hypotheses is the real possibility that we have perceived the result of our technology to have an entirely different outcome (Healy, 2006).
    A good example of such a technology is Thomas Edison’s incandescent light bulb. It is well documented that the incandescent light bulb was based on previous existing technologies such as the arc lamp and necessitated by electricity (Cross & Szostack, 2005). The light bulb in turn determined the nature of other new components needed in the electrical system to accommodate it, such as generators that produced a small current of high voltage, junction boxes, switches, and meters (Cross & Szostack, 2005). The creation and success of these inventions enabled Edison to eventually develop the radio and X-Ray technology among other things (Cross & Szostack, 2005). All of these inventions had unintended desired and undesired consequences that have had impacts on today’s technologies. The question is, would it have been possible to foresee each consequence at the time they were invented? Even in hindsight, it is difficult to predict whether it would have been worth relinquishing or even limiting research in any one of these technologies given the potential for them to provide positive solutions to society’s problems.

    The Prohibition Pitfall
    Another problem with Joy’s relinquishment solution is the suggestion that prohibition can be successful in all cases. Prohibition at its core, poses certain problems inherent in its principles. First, there is the larger danger that restricting research of certain technologies to governmental institutions might place the technology in the hands of a very few number of “elite” and “select” private scientists or academics. Edward Teller, the “father of the hydrogen bomb” saw this type of restriction or limitation as “harmful to the US in a fundamental way. It lessened the key American advantage of broad, free discussion and criticism while it assisted closed societies” (Brown & May, 2004). Teller specifically put the blame for the advances the Soviets made in bomb building during his time squarely on the shoulders of the impact of the US legislated technological prohibition and the shroud of secrecy it accrued (Brown & May, 2004). As a result, he insisted that technologies be developed in open societies where information could be distributed and shared among researchers, and that by doing so, technology would develop quickly and to its safest potential.
    The second problem with prohibition is that regulatory bodies, put in place to enforce prohibition of certain types of technologies, could actually increase research into the prohibited technology. Indeed, as prohibition has demonstrated in the past “the more intense the law enforcement, the more potent the prohibited substance becomes” (Cowan, 1986). This contradicts Joy’s argument that by relinquishing research into certain technologies, we would be able to ultimately stop the potential for it to have negative results. One could argue that it would surely amplify underground research into the very technology we are trying to suppress, which might result in an unsafe and unknown by-product of the original technology; leaving us unprepared to deal with the final outcome. Ray Kurzweil points out that “abandonment of broad areas of technology will only push these technologies underground where development would continue unimpeded by ethics or regulation” (Kurzweil, 2000).

    A Better Way
    Given that Kurzweil instigated Joy’s newly found insight, it is interesting to note that one of the solutions to Joy’s crisis comes from Kurzweil himself. That is the idea of what he calls a “fine-grained” relinquishment (Kurzweil, 2000). “Fine-grained” relinquishment regards precisely measured limitations of certain types of technological research by regulatory bodies, decided upon a technology-by-technology basis. It is however, imperative to ensure that regulation is not motivated by economic gain alone; it should be developed in conjunction with a new ethical framework, as Jonas (1973) suggests, one that adapts with the changing times. Only this type of approach would allow for technology’s positive influence on human life while at the same time maintaining a permissible degree of safety. “Fine-grained” relinquishment will ensure that we move forward into the future with the peace of mind that comes with empowered knowledge that will allow us to use technology to its fullest advantage; although, this will only occur if scientists and engineers adopt a strong code of ethical conduct (Joy, 2000) and allow their work to be managed by regulatory bodies (Kurzweil, 2000). “Fine-grained” relinquishment also ensures that limitations over certain types of knowledge and technology, do not slow research in other technological areas and, as Edward Teller describes, allows for “broad, free discussion and criticism” of each technology. This will in turn allow us to evaluate a new ethical framework to evaluate a newer technology and enable new research, and so on. Only once this cyclical feedback between areas of science, society and government exist, will we able to make educated decisions and take calculated risks, with the more than likely outcome of a better and more peaceful world for all of us. One that even Bill Joy would be happy to live in.

    Derek Harnanansingh
    derek[at]arietis-software.com

    REFERENCES

    Brown, H. & May, M. (2004). Edward Teller in the Public Arena. Physics Today 57, 8, 51-53
    Cowan, R. (1986). How the Narcs Created Crack; a War Against Ourselves, National Review 38, 26-31.
    Cross, G & Szostack, R. (2005). Technology and American Society, A History, 2nd Ed. New Jersey: Prentice-Hall.
    Goren-Inbar, N., Alperson, N., Kislev, M. E., Simchoni, O., Melamed, Y., Ben-Nun, A. & Werker, E. (2004). Evidence of Hominin Control of Fire at Gesher Benot Ya’acov, Israel. Science 304, 725-727.
    Healy, T (2000). The Unanticipated Consequences of Technology , Retrieved Dec 5, 2006, from Markkula Center for Applied Ethics: http://ww.scu.edu/ethics/publications/submitted/healy/consequences.html
    Jonas, H. (1974). Technology and Responsibility: Reflections on the New Task of Ethics. In Winston, M.E. & Edelbach, R.D. (Eds.), Society, Ethics, and Technology, 119-130. Canada: Thomas-Wadsworth.
    Joy, B. (2006). Why the Future Doesn’t Need Us. In Winston, M.E. & Edelbach, R.D. (Eds.), Society, Ethics, and Technology, 216-233. Canada: Thomas-Wadsworth.
    Kurzweil, R. (2000). Promise and Peril. In Winston, M.E. & Edelbach, R.D. (Eds.), Society, Ethics, and Technology, 233-238. Canada: Thomas-Wadsworth.
    Winston, M.E & Edelbach, R. D. (2006). Society, Ethics, and Technology, Canada: Thomas-Wadsworth, pp 393.

    VN:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)

    Analyzing the Impact of Web Page Textual Data Representation on the Accuracy of Selected Supervised Learning Models

    Posted on : 23-05-2009 | By : Derek | In : Web page classification

    Tags:

    0

    We looked at the effectiveness of supervised learning models in solving the real-world problem of web page classification. We attempted to maximize the performance of the classification model through the use of various feature sets. We observed that we were able to attain the highest accuracy by using a large training set, with a binary representation of terms, trained using the Support Vector Machine model (with the polynomial kernel filter applied). See for yourself!

    PDF download: [download id="1"]

    VN:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)

    Customized jQuery Tabs

    Posted on : 16-11-2008 | By : Derek | In : CSS, Posts

    Tags: , , ,

    1

    I have always liked using tabs as a means for navigating a website. In my opinion tabs are a great way to separate content because they are a somewhat natural representation of a real-world artifact that many users are used to. And if a navigation item is familiar to users, then it helps increase usability, an often-overlooked goal of web development.

    To implement tabs in our projects I have always used the “sliding doors of CSS” technique (as described in the “Sliding Doors of CSS” written by Douglas Bowman). I particularly like this technique because it pre-loads all the necessary images needed for the tabs and because it provides an easy way to design customized tabs without the need for a ton of markup to display them on the screen.

    But lately, for the right project I have taken to using jQuery’s implementation of the tabbed interface. I like jQuery tab framework because it’s a quick way to code tabs for web applications and because its very customizable. One implementation has jQuery tabs using AJAX to call up the appropriate page automatically without the need for a controller. Using AJAX isn’t always the best practice, but for some projects, it could be the right way to go.

    That said, I wanted a way to use the sliding door tab technique mentioned above using jQuery’s tab framework. Here is a link to an example to see how I did it.

    If you want to use it for your own projects, the source files are shown in the demo on the “notes” page.

    VN:F [1.9.3_1094]
    Rating: 2.5/5 (1 vote cast)