Tag Archives: Javascript

Next Adventure in Aurelia – Autocomplete Component

As I have written in this post I’m slowly getting into Aurelia Web UI framework. Recently I needed an autocomplete component.  My requirements were:

  • get suggestions from server via REST API (JSON payload)
  • simple, yet flexible (value can be calculated from received suggestions)
  • flexible ways to display suggestions (ideally provide a template to display suggestions values)
  • suggest values as one types matching starting letters (case insensitive and diacritics insensitive)
  • cache server responses for efficiency
  • can use both mouse and keys (arrows + enter) to select suggestion

I’m sure that existing autocomplete components like typeahead or JQuery UI Autocomplete would serve my purpose quite well. It’s fairly easy to integrate existing components from other frameworks into Aurelia (see this post for instance).  But I decided to create my own, using only Aurelia (and a bit of JQuery – but it can be easily rewritten in pure DOM API – JQuery is used just for convenience, because it’s anyhow  used in Aurelia skeleton app). I though it would be nice learning exercise (and it really was) and also we programmers (especially leisure programmers like myself) do like to reinvent the wheel, right? (But it’s not always bad idea – image world when only one type of wheel exists – by recreating existing solutions, improving them, changing them we can also achieve progress – Web UI frameworks themselves are good example of such progress).  I’d like to share my experiences further in this article. Continue reading Next Adventure in Aurelia – Autocomplete Component

Starting with Aurelia – Pagination with Back and Sort

I do not like very much programming of User Interfaces (UIs) and frankly spoken I’m not very good at that, but alas sometimes UIs are necessary so I have to try my best. Many recent applications use web browser as UI, and  situation here is  quite messy ( see this nice article about JS Frameworks Fatigue).  Last time I was involved with web UIs I had utilized Backbone with Django based RESTful server.  Recently I’ve decided to rewrite MyBookshelf application with modern technonogies (it’s about 8 years old, which is something like prehistory considering changes in web development).  New architecture should be based on RESTful services and Single Page Application (SPA) relying on recent browser capabilities.   I’ve have been looking around and found that Backbone is already almost forgotten and we have two new stars on the stage – AngujarJS and React – I have very quickly looked at both and finally decide for another framework Aurelia. Continue reading Starting with Aurelia – Pagination with Back and Sort

Web Clients Are Getting Thick

Remembering days when client-server rules the world, then days when everybody praised light web clients where all user interface (UI) was prepared on web server and any user action was communicated back to server (this could lead to heavy network traffic – I’ve seen one mainstream ERP  program, where a change in one input, say line item quantity,  lead to several megabytes being sent over network).  I’m quite amused to see how we’re returning back to thick clients and passing  more and more UI tasks back to user devices.   This probably make sense, taking into account the computing power available in user devices now (my mobile has approximately same computing power (dual core 1.2 GHz ARM CPU)  as  a reasonable  server  ten years back(Sun V240 for instance)) and  improvement of web browsers and especially their Javascript engines.   Normally utilization on an average client machine would be very low, unless client is dealing with digital media, so using  available computing  power there  is an obvious step. Network bandwidth could be now  more precious resource then client  computing cycles. Continue reading Web Clients Are Getting Thick

Timezones and DST in Oracle APEX

Almost all APEX applications I’ve been working with recently are used across multiple timezones, where many timezones uses DST (Daylight Saving Time) – that is basically almost all Europe and North America. The natural requirement is that users can see date+time information in their timezone time, reflecting if DST is active or not. Timezones and time conversions are always bit of mess and APEX is not supporting this completely out of box, but with small effort we can make our applications really global. Continue reading Timezones and DST in Oracle APEX

Good Book About Javascript

I’ve have been working with Javascript here and there – always small pieces –  as I know Java, C, Python I though that I do not need to learn anything special about Javascript, that I should be able to manage right away – In fact I somehow did, but I’ve been always bit struggling with some strange behaviours.   Having to write couple of Firefox add-ons recently I decided to read some book about Javascript to shed a light on those anomalies  –   I found this book very good – Javascript: The Good Parts by Douglas Crockford.

It relatively small book – I’ve read it in a few hours, but it gives you very good overview of all features of the language and show you how to write good and maintainable code in JS.   Now I know that Javascript is very expressive language, where I can use some powerful features like functional programming, prototypes etc.

Writing to file in Firefox Extension

Mozilla has provided nice high level API in its Add-On SDK, where one can relatively easily write an extension, without need for any special knowledge about internals of Firefox – the general knowledge of Javascript, HTML and CSS plus very nice and detailed documentation of the SDK are basically enough.

However there are some functionalities, that are not available in SDK and then more effort is needed and  XPCOM components have to be used via their JS interfaces.  This requires bit more  research, so I’d like to share one useful snippet of code  – how to save string to file, which user has chosen via standard file picker dialogue: Continue reading Writing to file in Firefox Extension

APEX – Dynamic Actions with Report Region

In many scenarios it would be nice if we can provide some dynamic actions to report (classical) region, which can be handled via Ajax calls, rather then submitting a whole page  – these actions could include:

Well Behaving APEX Item Plugin

I ‘ve recently created  multiselect plugin for APEX 4.1 –  there is still little information about how exactly write APEX plugins,  and some aspects – like cascading LOV, I have not found explained anywhere, so I’d like to share my experiences here:

What You Need

To write plugin you will need:

  • Oracle Database and APEX running somewhere –   the installation manual for APEX is very good and you can go step by step  according to it
  • Knowledge of  PL/SQL – it is good to have PL/SQL Reference at your hand
  • Reference documentation for APEX 4.1 API
  • Some knowledge of APEX and also some basic knowledge of plugins – try some available tutorials you can find on web – this article will focus on rather specific issues within Item plugin.
  • Oracle SQL/Developer (or other development tool)- to write PL/SQL  – optional, if you are PL/SQL god and can write correct code by heart – if you struggling with PL/SQL like me this is an invaluable helper.
  • Web server running on your local machine – to help to develop  Javascript part of plugin
  • Firefox with Firebug – to debug Javascript (or Chrome, if you prefer) Continue reading Well Behaving APEX Item Plugin