Thursday, January 27, 2011

Ruby on Rails Support Discontinued in NetBeans IDE

Dear NetBeans Community:

After thorough consideration, we have taken the difficult step to discontinue support for Ruby on Rails in the NetBeans IDE. Two main issues underpin this decision:

Java SE 7 and Java Development Kit 7 (JDK 7) are the next major releases of the Java SE platform, which Oracle is committed to deliver in 2011. A key objective of the NetBeans IDE has always been to offer superior support for the Java platform. To maintain that objective and capitalize on the JDK 7 release themes--multi-language support, developer productivity and performance--it is necessary that our engineering resources are committed to a timely and quality release of NetBeans IDE 7.0.

Second: Although our Ruby support has historically been well received, based on existing low usage trends we are unable to justify the continued allocation of resources to support the feature.

As of January 27, the Ruby on Rails module will be gone from development builds of NetBeans IDE 7.0. Developers who want to continue to use Ruby on Rails functionality in the NetBeans IDE should please visit the NetBeans Ruby Support page for details on how to do so going forward.

We remain committed to delivering a first-class product to our community of developers and users, and we encourage your feedback on our mailing lists and forums, on Twitter, or by writing to us.

Thank you for your continued support of NetBeans.
The NetBeans Team

http://netbeans.org/community/news/show/1507.html

Rails SQL Views

Getting started

The Rails SQL Views extension modifies some of the modules in ActiveRecord to add support for SQL Views. It adds the methods create_view and drop_view to the AbstractAdapter so you can use these in migrations. It also modifies the SchemaDumper class to support dumping of create_view logic. Currently the following adapters are supported:
  • MySQL
  • PostgreSQL (native and pure ruby)
  • SQL Server
  1. Get It

    There are several ways to get the Rails SQL Views extension:
    Install the Gem
    Get to your command line and type sudo gem install rails_sql_views on Linux or OS X or type gem install rails_sql_views on Windows. Rails SQL Views depends on ActiveRecord. If necessary you may have to approve the installation of these dependencies if they are not already installed.
    Download
    You can also download the packages in Zip, Gzip, or Gem format from the ActiveWarehouse files section on RubyForge.
    Github Clone
    For the brave you can get the latest code from the Github repository: git clone git://github.com/aeden/rails_sql_views.git.





  2. Require Statements

    Add the following to your config/environment.rb:
    require 'rubygems'
    require 'rails_sql_views'



  3. Use It!

    You can now use the library:
    class CreatePersonView < ActiveRecord::Migration
        def self.up
          create_view :v_people, "select * from people" do |t|
            t.column :id
            t.column :name
            t.column :social_security
          end
        end
    
        def self.down
          drop_view :v_people
        end
      end



What's There Now?

Right now the library does the following:
  • Adds create_view and drop_view methods to Rails schema code
  • Makes ActiveRecord::SchemaDumper view-aware
  • Adds a supports_views? abstract method to ActiveRecord::ConnectionAdapters::AbstractAdapter which returns false by default
  • Changes the MySQL connection adapter to use SHOW TABLE STATUS rather than SHOW TABLES, so that the tables method returns only tables. Views are returned through the views method
  • Implements view support for MySQL, PostgreSQL and SQL Server
  • Unit tests included
http://activewarehouse.rubyforge.org/rails_sql_views/
http://stackoverflow.com/questions/3137192/creating-migrations-for-sql-views-in-rails-with-boolean-values

    Sunday, January 23, 2011

    CSS background image hacks

    Emulating background image crop, background image opacity, background transforms, and improved background positioning. A few hacks relying on CSS pseudo-elements to emulate features unavailable or not yet widely supported by modern browsers.
    Demos: Example CSS background image hacks
    Pseudo-element hacks can fill some gaps in existing browser support for CSS features, without resorting to presentational HTML. In some cases, they even make it possible to emulate things that are not currently part of any W3C working draft, like background transforms and background image opacity.
    Most of the hacks in this article tie in with the pseudo-element hack described in an earlier article – Multiple Backgrounds and Borders with CSS 2.1. That article already describes how to emulate multiple background support and its demo page shows several other uses of the basic principle. This article presents a few of those effects and applications in greater detail.

    http://nicolasgallagher.com/css-background-image-hacks/

    GestureWorks 2.0

    GestureWorks 2.0 provides everything ActionScript developers need to author powerful multitouch applications quickly and easily. With over 200 built-in gestures, free plug and play components, and a growing list of compatible hardware it has never been easier to build your own multitouch application.



    Multitouch Flash TutorialsOver a dozen tutorials to help you get started

    Learn everything you need to know to get started authoring applications in GestureWorks with our Flash, Flex and component tutorials. See the tutorials.



    Multitouch Gesture LibraryThe most advanced gesture library available

    GestureWorks’ open source gesture library features over 200 gestures, far more than any other multitouch framework built for Flash. With our open source gesture library, you’re not just limited to zoom and flick. You can create applications that tilt in 3 dimensions, recognize characters, symbols, and shapes or even create your own gestures. See all 200+ gestures.



    Multitouch ModulesGestureWorks 2.0 is fully compatible with Open Exhibits modules

    Open Exhibits is a suite of free and open source multitouch-enabled modules and templates designed for rapid application development. These plug and play modules are open source and free for commercial use. View available modules at openexhibits.org.



    Multitouch HardwareTested on dozens of multitouch devices

    GestureWorks plays nice with any Windows 7- or TUIO-compatible hardware, giving you plenty of ways to develop. GestureWorks includes a built-in simulator for easy testing on any system, and your apps will elegantly degrade for single touch or mouse compatibility. View multitouch hardware list.



    Developer ShowcaseBe a multitouch rock star

    Have you used GestureWorks to develop a multitouch application? Let us know how you have used it and we may showcase your project. Visit our developer showcase.

    http://gestureworks.com/

    Thursday, January 20, 2011

    Signature Pad

    A jQuery plugin for assisting in the creation of an HTML5 canvas based signature pad. Records the drawn signature in JSON for later regeneration.

    The Signature Pad jQuery plugin will transform an HTML form into a signature pad. The Signature Pad has two modes: TypeIt and DrawIt. In TypeIt mode the user’s signature is automatically generated as HTML text, styled with @font-face, from the input field where they type their name. In DrawIt mode the user is able to draw their signature on the canvas element.
    The drawn signature is written out to a hidden input field as a JSON array using JSON.strinify(). Since the signature is saved as JSON it can be submitted as part of the form and kept on file. Using the JSON array, the signature can then be regenerated into the canvas element for display.
    Obviously, Signature Pad has a couple extra dependencies: Douglas Crockford’s JSON2 and Google’s Explorer Canvas. (Both scripts are included in the downloadable package.)
    Signature Pad tries to maintain a certain level of progressive enhancement, while still giving developers enough control. There is very little generated HTML. The HTML in the examples has some elements that should be hidden by default (including canvas). Signature Pad will trigger the display of certain items if the browser supports Javascript and canvas.
    Signature Pad works with both mouse and touch devices.
    Get the source code on GitHub:
    http://github.com/thomasjbradley/signature-pad/

    Signature Pad is able to create multiple instances on a single page by selecting multiple items with jQuery. The limitation lies in the API return; Signature Pad will only return the API for the last selected element. If you would like to store the API for multiple elements they must be initialised with separate jQuery calls.

    http://thomasjbradley.ca/lab/signature-pad

    Wednesday, January 19, 2011

    Embedded help system

    Introduction

    Embedded Help System is "providing help where help is needed" concept that can be easily integrated into web interface. The point is to offer help to user in their working interface and actual situation.

    Jquery plugin

    Jquery E-Help is plugin for procedural("How to ...") web user interface help and it's easy to integrate into any web interface that supports Jquery. Useful for all web applications, CMS and E-commerce systems.
    Try jquery.eHelp here and be free to download, use and modify...

    Contribute

    Contribute to embedded help concept and develop more useful scripts that can be easily integrated into web interface.

    http://embedded-help.net/home

    Programmer’s Notepad 2.2 Released

    Headline Changes in 2.2:
    There have been too many improvements since 2.0.10 to recount them all here, but these are the headline changes in 2.2 over 2.0.10:
    1. Complete Unicode conversion, files, searching, projects, UI, clips…
    2. Complete redesign of text clips, with editing built in to new UI view and code templates and text clips consolidated
    3. Multiple concurrent selections (ctrl+select)
    4. Type into multiple selections and block selections
    5. Virtual space
    6. Translations – PN in your language
    7. Flexible split views
    8. Converting between ANSI/Unicode properly converts current file contents
    9. Vastly improved file encoding options and defaults
    http://www.pnotepad.org/

    Thursday, January 13, 2011

    Insecure Startup Item disabled

    “/Library/StartupItems/MySQLCOM” has not been started because it does not have the proper security settings.

    Solution:
    sudo chown -R root:wheel /Library/StartupItems/MySQLCOM

    http://discussions.apple.com/thread.jspa?threadID=2644088&tstart=0&messageID=12781385

    Uninstalling MySQL on Mac OS X Leopard

    To uninstall MySQL and completely remove it (including all databases) from your Mac do the following:
    • Use mysqldump to backup your databases to text files!
    • Stop the database server
    • sudo rm /usr/local/mysql
    • sudo rm -rf /usr/local/mysql*
    • sudo rm -rf /Library/StartupItems/MySQLCOM
    • sudo rm -rf /Library/PreferencePanes/My*
    • edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
    • rm -rf ~/Library/PreferencePanes/My*
    • sudo rm -rf /Library/Receipts/mysql*
    • sudo rm -rf /Library/Receipts/MySQL*
    The last two lines are particularly important as otherwise, you can't install an older version of MySQL even though you think that you've completely deleted the newer version!

    http://akrabat.com/computing/uninstalling-mysql-on-mac-os-x-leopard/

    Wednesday, January 12, 2011

    HTML Video Codec Support in Chrome


    The web’s open and community-driven development model is a key factor in its rapid evolution and ubiquitous adoption. The WebM Project was launched last year to bring an open, world-class video codec to the web. Since the launch, we’ve seen first-hand the benefits of an open development model:
    • Rapid performance improvements in the video encoder and decoder thanks to contributions from dozens of developers across the community
    • Broad adoption by browser, tools, and hardware vendors
    • Independent (yet compatible) implementations that not only bring additional choice for users, publishers, and developers but also foster healthy competition and innovation

    We expect even more rapid innovation in the web media platform in the coming year and are focusing our investments in those technologies that are developed and licensed based on open web principles. To that end, we are changing Chrome’s HTML5 <video> support to make it consistent with the codecs already supported by the open Chromium project. Specifically, we are supporting the WebM (VP8) and Theora video codecs, and will consider adding support for other high-quality open codecs in the future. Though H.264 plays an important role in video, as our goal is to enable open innovation, support for the codec will be removed and our resources directed towards completely open codec technologies.

    These changes will occur in the next couple months but we are announcing them now to give content publishers and developers using HTML <video> an opportunity to make any necessary changes to their sites.

    http://blog.chromium.org/2011/01/html-video-codec-support-in-chrome.html

    Tuesday, January 11, 2011

    JSZip

    Create .zip files with Javascript

    Why?

    1. JavaScript today is capable of generating a lot of data. The easiest way to deliver multiple files to your users is in a zip file. Instead of wasting server resources and bandwidth you can get the client to do it for you.
    2. Because it's cool!
    http://jszip.stuartk.co.uk/

    NETEYE Activity Indicator

    NETEYE Activity Indicator

    A jQuery plugin that renders a translucent activity indicator (spinner) using SVG or VML.

    Features

    • Lightweight script
    • No images required
    • No external CSS
    • Resolution independent
    • Alpha transparency
    • Highly configurable appearance
    • Works in all major browsers
    • Uses feature detection
    • Degrades gracefully

    Supported Browsers

    The plugin has been successfully tested in the following browsers:
    • Firefox 2.0
    • Safari 3.2.1
    • Internet Explorer 6.0
    • Opera 10.6
    Of course newer versions of the various browsers are also supported.

    Dependencies

    The plugin requires jQuery v1.4.2 (or higher). Besides that, no other files are required, especially no style-sheets or images.

    http://neteye.github.com/activity-indicator.html

    Saturday, January 8, 2011

    Creating a Gaussian Blur Effect With CSS3

    Unfortunately, CSS3 does not provide means for creating blur effects out of the box, however we can easily emulate Gaussian Blur by using text-shadow and setting the color of the element to transparent:
    The following markup:
    <p>Lorem ipsum dolor sit amet...</p>
    …And this CSS:
    p
    {
        text-shadow: 0 0 8px #000;
        color: transparent;
        /* other properties */
    
    }
    … Will produce this:

    … And we can use it to add cool a lá Vista and Windows 7 blur effects to our Web 2.0 dialog boxes as you shown below:

    A few notes:
    You can control the smoothing of the blur via the spread value of the text-shadow property (in our example it is set to 8 pixels).
    Internet Explorer 5.5-8 does not have native support for RGBA colors, but you can use the properietary gradient filter to emulate RGBA:
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000);
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000)";
    On the other hand, in IE you do not have to emulate Gaussian blur, because it supports it since version 5.5 – again via the proprietary blur filter:
    filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=2);
    -ms-filter: "progid:DXImageTransform.Microsoft.Blur(pixelRadius=2)";
    The demo does not work properly with Opera, because that browser does not seem to support RGBA colors applied to elements that have a position different than static, however with a different setup it can be put to work. IE6 and IE7 fail to execute the blur filter, because it is applied to a relatively positioned element (yes, that’s the weird CSS hack for stopping the propagation of transparency from parent to child elements), but again – this can be solved with a different setup, markup and CSS.
    The entire example is available on this page, or you can download it straight away from this link.

    http://acidmartin.wordpress.com/2010/12/23/creating-a-gaussian-blur-effect-with-css3/

    Wednesday, January 5, 2011

    Rails and SSL (https://)

    Two more caveats:
    • First caveat is that if you want to go back and forth between http and https, you MUST explicitly set all of your routes to have http or https protocol. If you don't, then when rails generates your routes it will just use the protocol of the current page. This is annoying, but I can see why they would do this (if you are looking at something securely, then just look at everything securely).
    • Second caveat is that you must use the route_name_url throughout your application instead of route_name_path, as some are accustomed to. The _url named route gives you the full url (duh), which is what you want if you are on a page using http and want to go to https (whereas _path only gives you the uri, and will use the protocol and host of the current page). If you already use _url, then you are one step ahead in the game
    Here is a sample of some of my routes using the protocol option:
    
    # Public routes using http protocol
    map.with_options :protocol => "http" do |http|
      http.login '/login',   :controller => 'sessions', :action => 'new'
      http.logout '/logout',  :controller => 'sessions', :action => 'destroy'
      http.resources :users, :sessions, :requirements => {:protocol => "http"}
    end
    
    # Public routes using https protocol
    map.with_options :protocol => ROUTES_PROTOCOL do |https|
      https.form_step '/form/*slug', :controller => 'forms', :action => 'show'
      https.form_edit '/edit/*path', :controller => 'forms', :action => 'edit'
      https.resources :forms, :requirements => {:protocol => ROUTES_PROTOCOL}
    end
    http://siannopollo.blogspot.com/2007/08/rails-and-ssl-https.html

    Redcar

    Redcar is a text editor for programmers written in Ruby. At the moment, it’s a young enough project that it is mainly of interest to Rubyists who want to use Ruby to script their editor.

    https://github.com/redcar/redcar/wiki/installation
    http://redcareditor.com/

    Tuesday, January 4, 2011

    Getting to Know the Ruby Standard Library – Timeout

    Timeout lets you run a block of code, and ensure it takes no longer than a specified amount of time. The most common use case is for operations that rely on a third party, for instance net/http uses it to make sure that your script does not wait forever while trying to connect to a server:
    def connect
      ...
      timeout(@open_timeout) { 
        TCPSocket.open(conn_address(), 
        conn_port()) 
      }
      ...

    You could also use Timeout to ensure that processing a file uploaded by a user does not take too long. For instance if you allow people to upload files to your server, you might want to limit reject any files that take more than 2 seconds to parse:
    require 'csv'
    
    def read_csv(path)
      begin
        timeout(2){ CSV.read(path) }
      rescue Timeout::Error => ex
        puts "File '#{path}' took too long to parse."
        return nil
      end
    end

    Lets take a look at how it works. Open up the Timeout library, you can use qw timeout if you have Qwandry installed. Peek at the timeout method, it is surprisingly short.
    def timeout(sec, klass = nil)   #:yield: +sec+
      return yield(sec) if sec == nil or sec.zero?
      ...

    First of all, we can see that if sec is either 0 or nil it just executes the block you passed in, and then returns the result. Next lets look at the part of Timeout that actually does the timing out:
    ...
    x = Thread.current
    y = Thread.start {
      sleep sec
      x.raise exception, "execution expired" if x.alive?
    }
    return yield(sec)
    ...

    We quickly see the secret here is in ruby’s threads. If you’re not familiar with threading, it is more or less one way to make the computer do two things at once. First Timeout stashes the current thread in x. Next it starts up a new thread that will sleep for your timeout period. The sleeping thread is stored in y. While that thread is sleeping, it calls the block passed into timeout. As soon as that block completes, the result is returned. So what about that sleeping thread? When it wakes up it will raise an exception, which explains the how timeout stops code from running forever, but there is one last piece to the puzzle.
    ...
    ensure
      if y and y.alive?
        y.kill
        y.join # make sure y is dead.
      end
    end
    ...
    At the end of timeout there is an ensure. If you haven’t come across this yet, it is an interesting feature in ruby. ensure will always be called after a method completes, even if there is an exception. In timeout the ensure kills thread y, the sleeping thread, which means that it won’t raise an exception if the block returns, or throws an exception before the thread wakes up.

    It turns out that Timeout is a useful little library, and it contains some interesting examples of threading and ensure blocks.

    http://endofline.wordpress.com/2010/12/31/ruby-standard-library-timeout/

    Monday, January 3, 2011

    jspp

    jspp: JavaScript Pre-Processor
    A simple way to build web applications with embedded server side JavaScript. In a few minutes you can build dynamic backend logic in to any page (html, css, etc) using node.js, jQuery and server side DOM with php-like embedded code.
    Basic usage
    First thing you'll want to do is run the jspp server against your working directory. Any changes you make in the working directory are automatically picked up by the server and refreshed. No need to start and stop during development or even in production.

    Now create an index.html and fill it with content.
    You can embed server side processing in <?jspp style tags or in script tags with a content type of "application/jspp". Script style tags are only available in html documents and don't work for jspp.init definitions.
    When you're in an html file you get most of the normal browser environments. window, document, and other objects are available. You also have a jQuery object at $ that you can use to manipulate any part of the page.
    Inside a jspp block this refers to the current DOM node.
    console.log is also available for debug logging in the server.
    Every block has an end function that must be called to end that blocks processing of the page, future versions of node.js may allow us access to the event system that will allow us to remove this requirement.
    There are many other jspp objects that are scoped to the resource and the page: resource, request, response, page, setHeader, and require.
    The require function allows you to import any node.js modules you would like. Relative module imports, like require('./module'), are scoped to the directory the file is in.

    http://www.jspp.io/

    Sunday, January 2, 2011

    DHTMLX Touch

    JavaScript Framework for Mobile and Touch Devices

    DHTMLX Touch is an HTML5-based JavaScript library for building mobile web applications. It’s not just a set of UI widgets, but a complete framework that allows you to create eye-catching, cross-platform web applications for mobile and touch-screen devices.
    The framework is compatible with the major web browsers for mobile platforms. Applications built with DHTMLX Touch will run smoothly on iPad, iPhone, Android-based smartphones, and other popular devices. Download the alpha and start playing with DHTMLX Touch! More features are coming. 

    Compatibility

    DHTMLX Touch requires a mobile device to display and work correctly. You can also run the samples on usual computers in FireFox 3.6 and above and WebKit browsers (Safari, Chrome, etc.), but there still can be some issues since the library is oriented mostly for mobile devices.

    Upcoming features and release plans:

    • Full-featured visual designer
    • Server-side integration
    • Global datastore
    • Carousel component
    • Additional animation
    • Extended support for mobile&touch devices
    • Detailed documentation
    • Support for client storage
    DHTMLX Touch v.1.0 release is scheduled on first quarter of 2011. Before this time we are going to release updates on regular basis. Please follow our blog to be informed about available updates. You are welcome to leave your feedback about DHTMLX Touch at our Forum.

    JSctypes

    js-ctypes is a foreign-function library for Mozilla’s privileged JavaScript. It provides C-compatible data types and allows JS code to call functions in shared libraries (dll, so, dylib) and implement callback functions. The interface and implementation are modeled on the Python ctypes module.
    The main objective for the library is to help developers avoid building binary (C++) XPCOM components when only a simple wrapper is needed. Such situations include:
    1. Developer wants functionality not built into the Mozilla platform, but easily supported by the native OS.
    2. Developer wants to use a 3rd party library in an extension or XUL app.
    3. Developer has methods in native code for performance reasons.
    The usual answer to these problems is creating a binary (C++) component to act as a wrapper so the native features can be exposed to JavaScript via XPCOM. However, the process of building binary XPCOM components is significantly harder than JavaScript components. The macros and memory management rules of binary components are harder than JavaScript, but its really the compiler and linker flags, IDL, makefiles and SDK versioning that make the process painful. The build process must be repeated for each platform too. For many cases, its just too much work.
    The goal of js-ctypes is to allow developers to declare methods in binary libraries and then expose those methods as callable JavaScript functions. Developers can then create pure JavaScript library wrappers around binary libraries - without making binary XPCOM wrappers.

    https://wiki.mozilla.org/JSctypes

    Equality in JavaScript

    Table of comparisons in a quick JavaScript version (a cell is green when column == row)