Thursday, May 15, 2014

Environment setup for Worklight with Eclipse IDE | Install Worklight plugin in Eclipse IDE

Now we are going to setup environment for Worklight Mobile Development with Eclipse IDE(Juno SR2 Package). I have give a step-by-step procedure to setup the environment with possible screen shots.

Step 1: Eclipse Juno SR2 Package was recommended for this entire development. If you do not have, please download that from the below link.

http://www.eclipse.org/downloads/packages/release/juno/sr2

You can see below list. Please download which is marked in the below screen shot.


Now you have the file(eclipse-jee-juno-SR2-win32.zip) and please extract the archive file.


Step 2: Run Eclipse from extracted folder. From the Eclipse menu goto Help --> Eclipse Marketplace. A new window will open.


From the window, search for "Worklight" and you will find 2 results.


Step 3: Install both the plugins one by one. To Install, click on Install button. It will collect all dependencies and show you the list. From the list, select all checkboxes, accept the terms and conditions and click Next and Finish installation. Once its completes the installation, it will ask to restart eclipse. Please restart the eclipse and install another once and do restart the eclipse for that plugin also.

That's it. You are now set up with the Environment for IBM Worklight in eclipse IDE.

Hope this helps.

Tuesday, May 13, 2014

Mandatory validation for RichText field in XPages using SSJS

During my development I crossed a requirement to do a mandatory check for a Richtext field binded with a XPage's Rich Text element. In that XPage I have implemented most of the validations from the server side code where my project also needs that too. So I need to do Richtext mandatory validation in XPages using SSJS.

Here we go. The following code helps me to do that. I hope there no need of explanation for this snippet.

var BodyText = @Trim(getComponent("body").getValue());
var RegEx = /(<([^>]+)>)| /ig
BodyText = BodyText.replace(RegEx,"")
if(@Trim(BodyText) == "" )
{
 //Through Mandatory Error Message here
}

Hope this helps.

Saturday, May 10, 2014

Prepend a RichText Item with an another Richtext Item

One day, one of my colleague came to me and discussed about how to prepend a RichText field/item with a Text or with an another RichText context. And we found that there is no direct methods to achieve this functionality. When I searched for the solution in blogs and forums, they recommended to use RichTextNavigator class. But I decided not to use RichTextNavigator. While exploring, I found the below solution and liked to share this as well.

Solution to add something(Text/RichText Item) in the beginning of the Richtext field.

 //Declaration of object holders
 Dim item1 As NotesItem
 Dim rt1 As NotesRichTextItem
 Dim rt1_Temp As NotesRichTextItem
 Dim rt1_TempFinal As NotesRichTextItem 
 //Setting the item
 Set item1 = doc.GetFirstItem("body") 
 Set rt1 = doc.GetFirstItem("body") 
 //Creating temporary RT Item as a prepended RT Item
 Set rt1_Temp = doc.CreateRichTextItem("bodyTemp")
 Call rt1_Temp.AppendText("Hi foo, I have prepended an RT Item")
 Call rt1_Temp.AppendRTItem(rt1)
 
 //Removing old RT Item
 Call item1.Remove
 
 //Creating new RT Item in place of the same body richtext field
 Set rt1_TempFinal = doc.CreateRichTextItem("body")
 Call rt1_TempFinal.AppendRTItem(rt1_Temp)
 
 //Getting temporary item to remove
 Set item2 = doc.GetFirstItem("bodyTemp")
 Call item2.Remove
 
 Call doc.Save(True,False)

Hope this helps.

Friday, May 2, 2014

Register your own website from Google | Publish all your blogspot post on your own website

Hi folks, I have been searching for blogs and forums to register and host a website of my own. Finally I got it, not a blog or forum, the way how to register and host a new website of mine with the help of Google.

What I want was, I have a blog in blogspot(Google) and I want to host those posts on a website of my own website. What I did was, Please read the below article carefully.


Please follow the below steps.


Section I : Registering  a New Domain


Step 1: Before registering a domain you should have an idea of what domain means and what domain registration means. If you don't have an idea, then search in Google and get yourself comfortable. Also you can see the below link from Google.


https://support.google.com/a/answer/53929?hl=en


Step 2: Read the page and click on the button "Sign up for Google Apps"




It will redirect to the Google Apps sign up page. 


Step 3: Please fill the required details for signing up for Google Apps as shown in the below image. And click "Next" button. It will redirect to another page.




Step 4: Here you can also have an option to choose your own domain which you have already purchased(This is for the users who have already have domain and need only Google Apps). But we need to register a new domain. So choose the option "Buy a new domain now".


And enter your domain name which you want to have as your Website and choose .com or .net or etc.,. Check for the availability of your domain name and if not available then try for an another name.





Fill your billing address and click the Next  button.




Step 5: After clicking the next button, it will redirect to the next page asking for the username to choose. Please give your new username which used as a domain administrator login userid. Select the last two checkboxes as shown in below image and click on the button "Accept and Sign up"




Step 6: This will redirect to the billing page and showing the bill amount. Please choose your Register from the options. I would recommend to choose GoDaddy.




And click the button Continue to continue. 




Step 7: And it will ask for your payment details. Please enter the required details and do the payment. 




Then you will be redirected to admin console of the domain powered by Google. That's it you are done with registering your domain name.




If you want Google Apps for your business, then you can do a try by paying them. If you don't want then leave them as it is. If you want to see billing details, please click on the Billing icon link.



You can all the billing details and their expiry date. You can also change the Renewal options by clicking on the Change link. If you want you can change cancel auto-renewal of your contract. Please see the below image.




Section II : Hosting your blogspot post on your new domain

Step 1: Login to your Blogger and choose your blog which you want to host it on your newly registered website. Goto Settings --> From  the let side page you can see a header Publishing. Under the section you can see a link "+Setup a 3rd party URL for your blog" as shown in the below image.



Step 2: Click on the link and you will see the below screen on the same page. Here you specify your full domain address as shown in the below image(i.e www.foobar.com). Then click on the save button.


On clicking on Save button, it will through an error with some additional information which was the security key for hosting your blog. Please see the below image for more information.



Now don't do anything on the page, keep the page as it is because we need to copy those keys to put it in your domain console.


Step 3: Please login to your domain admin console with this URL https://admin.google.com in a new browser or in the same browser's new session. Give your admin user name and password created while registering the website(Please refer Step 5 in Section I).


Once Login successful, it will redirect you to your admin console home page as shown in the below image. In the bottom of the homepage you can see the link More Controls. Click on the More Controls.



 It will expand a section and show you some more controls. From those controls choose Domain. It will open the domain page.



Step 4: Now click on the Advanced DNS Settings link as mentioned in the below image. 



It will open Advanced DNS settings page. From the page you can find the username and the password details of your Domain Registor(GoDaddy,etc.,) to login to their admin console. 



Step 6: Click on the link "Sign in to DNS console" as shown in the above image. It will redirect you to GoDaddy web login page. Please enter the credentials displayed in the Advanced DNS Settings page(refers above image) and login.



It will show you all the domains that you have registered with that registor. From the lick please click on the domain on which you want to host the blogspot.



It will open its Domain Details Page as shown in the below image. From the page click on the 2nd tab DNS Zone File



There you can find a lick Add Record



Click on the link and you will find a popup asking to choose record type. Please select CNAME(Alias) as shown in the below image.



Once you select the type, it will display another 3 fields Host, Points to and TTL.



Please leave TTL as default for 1 hour. And now your have to enter Host and Points to. As explained in Step 2: in Section II(refer below image), there we go a host and points to value given by Blogger(Google) for your blog. From the below image, leave the 1st row mentioned in arrow because it will be there already by default. Take the 2nd row mentioned by arrow. From the second row, 1st value is Host value and 2nd value is Points to value. Please copy paste those values in the popup and click on the Save button. 



Once you click the save button on the popup, the popup closes and on the page, with a red color background you can see Save Changes link. Please click on the link. Then only the change will be reflected.



If you need more information on giving those values, please visit the below link. 

https://support.google.com/blogger/answer/58317#godaddy

Once you saved the changes, on the same page scroll to the CName (Alias) section. There you can find the CNAME that you have added newly. Please make sure that the 2 line items mentioned in the below image should exists in yours list also.


That's it...!!!! So now you are done. In next 48 hours(may be in next 2 hrs) your blog will be hosted on your new domain. Enjoy blogging on your own domain...

Sunday, June 30, 2013

Lotus Notes Error : Design Replace Failed, Memory allocation request exceeded 65,000 bytes

During my development, I want to do a Replace Design from a template to a database. As usual as just tried to replace a design of the database by selecting the template from the list. When I click on Okay, Suddenly I got a notes error message popup saying "Design Replace Failed, Memory allocation request exceeded 65,000 bytes" as shown in the below image.


As we all know about the 64k limit error. But as for the first time I don't have an idea on this issue. I spent my all time to do workaround in fixing the issue. And finally I have sorted out the issue, this is due to more number of design elements exists in the database. For XPages and Custom Controls, we keep a safe copy of those design elements inside the database itself for our revert back plan whenever a new change request happens. So the number of design elements in the database increased rapidly.

So I have deleted all the safe copy design elements from the database, cleaned and built the database twice. Moreover this will resolve the issue. But still there will be a problem.

For each and every Custom Control, there will be a .config file created inside the database. Even we have deleted the design elements, the .config files and .properties may not be removed from the database. We have to remove those files manually.

To delete those files from the database, open the database in designer, from the designer goto Menu --> Window --> Show Eclipse Views --> Package Explorer. (Refer below image)


From the Package Explorer view, locate your database and expand Custom Controls and XPages section as shown in the below image.


Inside Custom Control category you can find .config and .properties files for those design elements which you have deleted already. Delete those unwanted files. Make double sure that you are deleting the files which were not really required. For example, you have deleted a custom control named ccHome_Text. And if you can still find a .config file or .properties file in the name of ccHome_Text.config and ccHome_Text.properties,  then you can delete those files.

Then do a clean and build the database twice and try replace the design. It will be succeeded for sure.

Hope this helps.

Monday, January 21, 2013

CSS - display:block; breaks all style in XPages


Hi Geeks,

I have faced an issue in XPages when computing the style property in All Properties of an element. For an instance I want to hide an Editbox in a table cell which is highly decorated with the style classes. So I have written the following code to hide ( Not using visible property of the element) the Editbox using CSS.

var x = getComponent("fieldName").getValue();
if(x == 1)
{
return "display:none"
}
else
{
return "display:block"
}

The above code works well but it affects the style given through its style class. For that particular cell and row no styles were applied. Cell height and width were changed annoyingly.

The fix is very simple. Just return the empty string in the else condition. Then it will take the styles from the style class.

var x = getComponent("fieldName").getValue();
if(x == 1)
{
return "display:none"
}
else
{
return ""
}

This issue occurs only when the style property is computed. But not for static style (Like inline style which is not computed). I hope this helps.

Thursday, November 1, 2012

Xpages ViewPanel behaviour on DateTime column(DateTime field in the document)


In a XPage viewPanel 's column value changes when enabling "" is mapped to a datetime field.
If you having a view with a column directly mapped to a datetime field