Tuesday, 24 April 2012

Oracle UCM Operators (Idoc Script)

http://docs.oracle.com/cd/E28389_01/doc.1111/e10726/c02_application.htm#i1027623


2.5 Operators

Idoc Script supports several operators.

Section 2.5.1, "Comparison Operators"

Section 2.5.2, "Special String Operators"

Section 2.5.3, "Numeric Operators"

Section 2.5.4, "Boolean Operators"


2.5.1 Comparison Operators

Use the following comparison operators compare the value of two operands and return a true or false value based on the result of the comparison. These operators can be used to compare integers and Boolean values in Idoc Script.

If you are using Idoc Script in an HCSP or HCSF page, you must use special comparison operators. For more information, see Oracle WebCenter Content Developer's Guide for Content Server.


OperatorDescriptionExample
==equality<$if 2 == 3$> evaluates to false
!=inequality<$if 2 != 3$> evaluates to true
<less than<$if 2 < 2$> evaluates to false
<=less than or equal<$if 2 <= 2$> evaluates to true
>greater than<$if 3 > 2$> evaluates to true
>=greater than or equal<$if 3 >= 2$> evaluates to true


These are numeric operators that are useful with strings only in special cases where the string data has some valid numeric meaning, such as dates (which convert to milliseconds when used with the standard comparison operators).

For string concatenation, string inclusion, and simple string comparison, use the Special String Operators.

To perform advanced string operations, use  strEquals, strReplace,  or other string-related global functions.

2.5.2 Special String Operators

Use the following special string operators to concatenate and compare strings:


OperatorDescriptionExample
&The string join operator performs string concatenation. Use this operator to create script that produces Idoc Script for a resource include.
<$"<$include " & VariableInclude & "$>"$>
evaluates to:
<$include VariableName$>
likeThe string comparison operator compares two strings.
  • The first string is compared against the pattern of the second string. (The second string can use asterisk and question mark characters as wildcards.)
  • This operator is not case sensitive.
  • Evaluates to FALSE:
    <$if "cart" like "car"$>
    
  • Evaluates to TRUE:
    <$if "cart" like "car?"$>
    
  • Evaluates to TRUE:
    <$if "carton" like "car*"$>
    
  • Evaluates to TRUE:
    <$if "Carton" like "car*"$>
    
|The string inclusion operator separates multiple options, performing a logical OR function.Evaluates to TRUE:
<$if "car" like "car|truck|van"$>



For example, to determine whether the variable a has the prefix car or contains the substring truck, this expression could be used:



<$if a like "car*|*truck*"$>
Important:
To perform advanced string operations, use strEquals, strReplace, or other string-related global functions. For a list, see "Strings".
The like operator recognizes the following wildcard symbols:



WildcardDescriptionExample
*Matches 0 or more characters.
  • grow* matches growgrowsgrowth, and growing
  • *car matches carscar, and motorcar
  • s*o matches sosolo, and soprano
?Matches exactly one character.
  • grow? matches grows and growl but not growth
  • grow?? matches growth but not grows or growing
  • b?d matches badbedbid, and bud



2.5.3 Numeric Operators

Use the following numeric operators to perform arithmetic operations. These operators are for use on integers evaluating to integers or on floats evaluating to floats.


OperatorDescriptionExample
+Addition operator.
<$a=(b+2)$>
-Subtraction operator.
<$a=(b-2)$>
*Multiplication operator.
<$a=(b*2)$>
/Division operator.
<$a=(b/2)$>
%Modulus operator. Provides the remainder of two values divided into each other.
<$a=(b%2)$>



2.5.4 Boolean Operators

Use the following Boolean operators to perform logical evaluations.


OperatorDescriptionExample
and
  • If both operands have nonzero values or are true, the result is 1.
  • If either operand equals 0 or is false, the result is 0.
<$if 3>2 and 4>3$>
evaluates to 1
or
  • If either operand has a nonzero value or is true, the result is 1.
  • If both operands equal 0 or are false, the result is 0.
<$if 3>2 or 3>4$>
evaluates to 1
not
  • If the operand equals 0 or is false, the result is 1.
  • If the operand has a nonzero value or is true, the result is 0.
<$if not 3=4$>
evaluates to 1


Boolean operators evaluate from left to right. If the value of the first operand is sufficient to determine the result of the operation, the second operand is not evaluated.

Tuesday, 27 March 2012

How to choose a camera?

I have been challenged by this question recently. So, how did I choose a camera?

There is always a simple option: head down to your local electronic store, pick one that is the cheapest and there you go. What's the fuss?

Well, the thing is, the camera you get in this way will be one that will become obsolete very soon.

The reason why I would want to get a new camera is because I am going to a South America trip and I have lost the charger of the batteries for my current camera.

Obviously, I don't want to buy a camera just for this trip. I'm looking to make good use of it maybe for a few years. That's why I have took my time to choose and learnt a few things along the way (theory only of course, I'm pretty sure my shooting skills is just on a par as a tourist).

Where did I start? Honestly, I didn't know. Googling best compact camera didn't get me anywhere. And at that time, I was pretty hooked on buying stuff through Amazon, so I did a search on it and sort it by users review. Note that all these searches was done in March 2012, so it could have been out-dated by the time you search it again.

Anyway, I still wasn't going anywhere. It just made my decision starting to get more complicated (yes, it hasn't reach the complicated part yet). I started to ask around. I went on different sites. Geez, I just hope that buying a decent camera was that easy!

To make it clear, I wanted a reasonably priced compact size camera that I could carry around and would take decent quality pictures. DSLR is out of the picture as it is way too big. Micro 4/3 are too expensive. That leaves me with point & shoot (P&S) cameras - the usual touristy ones.

I came across a site that was marketing the Fuji Film cameras on sale. So instead of confusing myself even more, I was going to pick the best one from them.

Let's just say it didn't went too well. I started to compare different models and came across snapsort.com. They have a pretty cool comparison system in place to tell you the pros and cons of each camera. The more I compare the Fuji cameras, the more I drifted away from them. They are a good and well-known brand, but it doesn't seem to suit my needs.

I managed to get a short listed of cameras base on searches on Amazon and from Snapsort. The Canon ELPH 310 HS was top of that list. I started to ask around again for people's opinion. A friend of mine who is into photography also gave me this site where I can list all the cameras at once and compare them.

The feedback I get from people is to get NONE of the cameras in the list. The recommendation was to get the best-of-the-best P&S (at the time), the Canon S100.  Another feedback I've got was to choose the editor's choice Canon SX230 HS (epic zooooooooom!). Too bad, they were all too expensive for my liking.

Based on the result that the 2 recommendations were from Canon, I decided to choose from them instead. I removed a few Samsung (well, they aren't that good except for the price), Nikon, Sony and Panasonic in my list. I was so closed at getting the ELPH 310 when I then came across an online site that offers the SX230 within my budget.

Phew! I can finally end the search, I thought. How wrong was I. The reviews I read in Amazon about my choices shows that they are all prone to a "Lens Error" issue...! I could have bite the bullet, but I didn't stop there.

After the disappointment, I looked deep at my requirements for a camera: A reasonably priced sturdy camera that can take good photos (in good or low lights with a few manual controls), HD movies and can do panorama stitching. Why panorama? I figured that I would mostly be taking landscape photos when I'm travelling and it seems like a really cool feature.

My search for the best suitable camera continued. This is when things starts to get complicated. I was learning about what those different specs mean for a camera and here is basically what I have come up with (all in my own words, so please read it with a grain of salt):
  • Sensor Size - obviously the bigger it is the better the quality of the picture
  • Sensor Type - There are 2 main sensors, CCD and CMOS. CMOS should be better.
  • More mega-pixels does not mean better photo, instead it could meant more noise
  • Higher ISO enables lower light shooting
  • Optical zoom means real zoom; Digital zoom just meant cropping the image
  • Focal Length (e.g. 24mm) - the lower it is the wider the view of the picture will be
  • Viewfinder - the little hole that allows photographers to look at what they are shooting. This feature has become obsolete in all P&S
  • Aperture - the lower it is the more light it is able to take in for lower light shots
  • Exposure speed - the longer it is, the more time it allows light to travels through. Tripod required to reduce shaky hands in long exposure shots.
  • Shutter speed (e.g. 1/2000sec) - how fast the shutter can take a picture
  • Microphone - Stereo is better than Mono
  • FPS - Frame per second. 
For more details on what each item meant, please Google or Wiki them.

Anyway, towards the end of my search, I have singled out 2 cameras: Sony DSC-WX10 or Nikon Coolpix P300.

There was also a brief moment where I was considering getting a rugged camera, like Nikon AW100 and the Olympus Tough TG820. However, I was going to take care of the camera anyway and the premium is a little too much to handle, their time on the list was short-lived (I don't think in the near future I'm going to take pictures while diving!?).

There was also a time that I was worried about a camera phone could make my purchase obsolete sooner than I thought - camera phones are getting better and better and the picture quality is good enough for my liking (especially Nokia 808 has introduced a 41MP camera with a sensor that is even larger than a S100!!). But the thing is, my phone has too much precious in it that I do not want to risk of losing it and also I've already bought a 16GB Class10 SD card, so I have decided to get a camera.

In the end, after looking at a few sample shots from the P300 and WX10, I've concluded my search to get the P300. Its manual controls which are quite semi-SLR (Me Gusta! I could learn a thing or two in photography with those controls) and the size (WX10 is really a tad bit too small) seals the deal for me. Even though the 3D images are quite innovative in the WX10, the end result when you pixel pick are quite tacky with too much processing - it looks like a painting.

So there you have it, the P300 will be my brand new toy for years to come, hopefully! ...Maybe till the next Nexus phone comes out, which I suspect it should be from Motarola next. 

Monday, 26 March 2012

Hello World!

My first blog post. The reason why I chose blogger.com is mostly due to Google uses it and I found out about it on their Gmail home page.

I am looking to use this blog to write about all the geeky, techy and gadgety stuff that I would encounter. This could serve as a place to put all the things that I have learnt or read just so that I could remember, instead of relying of my memory (which acts more like a RAM that could only stores short term information and would be empty once it shuts down).

Hopefully I will update this regularly... Happy Blogging!