Tuesday, June 28, 2016

Change transparency of an image

I have an upcoming demo with a customer where I need to show them a SQL Reporting Services report. On the mock they have their logo watermarked on the report. I have their logo, and in order to get it to appear as a watermark I want to just make the image more transparent.

1. Download Paint.Net: http://www.dotpdn.com/files/paint.net.4.0.9.install.zip

2. Download plugin pack:
Direct = http://forums.getpaint.net/index.php?app=core&module=attach&section=attach&attach_id=9798

Forum post with instructions = http://forums.getpaint.net/index.php?/topic/32048-v

3. Open the image in Paint.Net

4. Click Adjustments > Transparency

5. Now just slide the image until it's more transparent.

Wednesday, June 15, 2016

Handle radio group change event #javascript #jquery

If you need to handle the event where the user selects a different radio group option, then here's the code to do that.

radioGroupChangeHandler= function(e){
        case "radioGroupOption1":
            console.log("option 1 was selected")
        case "radioGroupOption2:            console.log("option 2 was selected")


Monday, June 13, 2016

Get "rd" "th" "rd" from datepicker date #javascript

I'm using a jquery datepicker and when the user picks a date i want to show in another textbox the "rd" "th" "rd" day of the month.

For example:

I want to show in another textbox "13th" of the month.

Found a solution on SO. This saved me quite a bit of typing :)

 function get_nth_suffix(date) {
   switch (date) {
     case 1:
     case 21:
     case 31:
        return 'st';
     case 2:
     case 22:
        return 'nd';
     case 3:
     case 23:
        return 'rd';
        return 'th';

Ref: http://stackoverflow.com/a/6003589/1538717

Friday, June 10, 2016

Dexterity - SetBooleanProperty() for FIELD_PROP_REQUIRED is not working

I have a field that i need to be ignored when required() is called in certain situations. So I tried to use SetBooleanProperty(fieldName, FIELD_PROP_REQUIRED, false) on the field, then setting it to true after the situation.

For some reason this did not change the property, and I have no clue why. It's probably undocumented Dex behavior.

Lock and unlock the field instead of using SetBooleanProperty(). Lock it before required() is used, and unlock it after.

Ref: From the Dex manual it says required() ignores fields that are locked, disabled, or hidden.

Thursday, June 9, 2016

ReportViewer RDLC - show enum's string representation

I have a report that has a data source set to a collection of business objects. One of the fields shown on the report is called "Batch Status." This is an enum. On the report though, it's appearing as the integer value of the enum instead of the string representation.

For example:
BatchStatus.Available is appearing as 1 instead of Available

In the field express put just put
=System.Enum.GetName(First(Fields!BatchStatus.Value).GetType(), Fields!BatchStatus.Value)

Ref: https://social.msdn.microsoft.com/forums/en-US/a45a3786-5bf7-4661-91bc-587e0b43e849/reportviewer-and-enums