Posts

Showing posts from 2018

Acting when the user pastes an image

Image
I recently saw a question about how to act when someone paste's an image (from clipboard data). There is a plugin that can handle that - to store the image into a table, but I was interested from a purely academic perspective how this would work without using the plugin. So, taking a look on MDN, I can see that there is a 'paste' event that you can listen to. See the documentation here: https://developer.mozilla.org/en-US/docs/Web/Events/paste . Ok, so lets give this a whirl! I'm not going to cover loading this into a table/BLOB column, as it's been covered before. What we'll do, is create a region with an image element this will show our image as we paste - this can easily be extended to load it into a canvas, load into a table, whatever your hearts content! Firstly, the region to show what the user pastes: Next, we need a dynamic action. This will be a custom event ("paste") with the selector being the body. Our True Action will be &q

SQL*Plus, Node and Docker

Image
This post is a continuation of my post from earlier in the week, in which I showed how to set up SQL*Plus, through a docker container that Oracle provides in their container registry. In that post, I set up the sqlplus command through an alias. Almost all examples I've seen in the past use an alias when setting up a command line program that is in effect a docker container. However, I have an extension in VSCode that I use that compiles my code which in effect is calling sqlplus and running my script. Even though I was able to connect in gnome-terminal and use SQL*Plus effectively, in my extension, no output was coming through. My code looked like this: var ChildProcess = require('child_process');   var sqlplusArgs = ["vmtest/vmtest@//192.168.0.104", "@test.sql"]; var sqlplusProcess = ChildProcess.spawn("sqlplus", sqlplusArgs); sqlplusProcess.stdout.on('data', (data) => { console.log( data.toString() ); }); The fir

Setting up SQL*Plus with the help of an Oracle Docker container

Image
Working with Oracle Database's I like to install the Oracle instant client - probably the biggest reason for me is that it gives me access to SQL*Plus. Personally, I think the installation is very straight forward, but the number one complaint I hear is its too difficult to set up. So, how can you get access to SQL*Plus without this "difficult" installation process? Say hello to the Oracle instant client docker container. If you head over to https://container-registry.oracle.com , navigate to the database section, you will notice 3 repositories: So, you will see the second one in the list is named "instantclient" - exactly what we need! side note: this container is a little out of date, being last updated over a year ago, but I'd say the latest version isn't crucial for most needs. So, if you click into instantclient, you will need to sign in first so that you can accept the license agreement. You will also need to sign into the registry

Clearing error state of an Interactive Grid column

Image
On a recent project, there was a requirement that when they save data they don't want any validations to come into play, and it's only when they go to submit the transaction that validation errors should appear. So I had a set up where the Save button (AJAX) was removed from interactive grid toolbar, and the form page form has two buttons: "SAVE" and "SUBMIT". Following this design pattern, if I click SUBMIT with a validation failure in the data, the relevant row would be highlighted in the interactive grid: Now as a user I decide I don't want to submit the page anymore, but rather just do a save. However, clicking save I won't be able to get the page submitted without changing the value of that field (or as an alternate situation, the validation may be dependent on some other page item, which I could have corrected but still the error state of the grid/line will be present). APEX will not submit the page and I would get an error that I

TypeScript and APEX

Image
TypeScript is a typed superset of JavaScript. That is, you can use the familiar JavaScript syntax you are used to, but where it gets enhanced is the fact it is can be strongly typed to give you compile time warnings. The most example is the sum of two numbers. A typical JavaScript function would looks like: function add(num1, num2){ return num1 + num2; } By looking at this code, by the function name and the return statement, we can see that the idea would be to add two numbers together. In JavaScript, depending what the user passed in, it could do string concatenation, implicit type casting. So if you do: add(1,2) This will return 3 If you do: add ("1", 2) This will return 12 (string concatenation). Since we want this function to always add two numbers, using TypeScript, we can change the definition to be: function add(num1: number, num2: number): number { return num1 + num2; } Now the TypeScript engine is always going to expect the inputs to

Git branch information in your bash prompt

Image
I saw a post the other day by Barry McGillin about improving bash to include repository information - see here: http://barrymcgillin.blogspot.com.au/2018/04/making-git-cmd-line-fancy-ish.html . I had seen similar behaviour using zsh - specifically when I had tried out the oh-my-zsh project, but I always find my self turning back to bash. So, I started doing some searching on how to achieve this in bash to see what other options there were - and I found a few articles basically with the same solution as in the post I found. Then I came across the fact that Git provides a script that can be leveraged to accomplish the same. You can view the script hosted on GitHub: https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh The header of the script includes instructions on how to leverage this file, which in a nutshell is to place the script somewhere on your system, sourcing it within your .bashrc file, and updating your PS1 variable, again in bashrc, to reference __git_

Windows Instant Client Setup

Image
On my systems, I always opt for the instant client so I can get going with SQL*Plus as quickly as possible - the full client is just beyond my needs. If you are a regular consumer of my posts, you may have noticed I'm not primarily a Windows user, but of late I've had a need to be using Windows. So this particular post will be guiding the set up of the instant client, setting up your tnsnames and getting SQL Developer to use the OCI/thick driver. So first, head over to the download page for Instant Client:  http://www.oracle.com/technetwork/topics/winx64soft-089540.html . I'm just grabbing the latest version as at the time of this article (12.2.0.1) The packages I usually grab are: Instant Client Package - Basic Light Instant Client Package - SQL*Plus Instant Client Package - SDK The basic and basic light packages make mention that one pre-requisite is the Microsoft Visual Studio 2013 Redistributable. So go ahead and install that before hand if necessary. Fr