Pages

Monday, September 30, 2013

Crash Lotus Notes - Oops I did it again

In an attempt to write a fairly complex workflow application, which I originally thought was a so simple I did this. I was dumb enough to have given way for the "out of touch since last two years" concept to ridicule me like this.

I knew that theoretically, I can write custom lotus script classes which can extend native lotus script classes and I can possibly extend/create events like querySave, queryClose etc using some thing like the following

On Event Querysave From customUidoc Call customQuerysave

So I went a head and tried it to discover that I crashed my client. I am great full that I dont posses the talent to corrupt database designs at will. Honestly.

Sometimes the thought scares the hell out of me. I just tried to do the above mentioned stuff. Just tried. And following happened. Note- I am not sure if this would happen always or not, but I think its worth mentioning this. I already had a custom class on the script library where I was trying to build my new custom class and extend NotesUIDocument.


I am on the way persuading about what really guided me to collapse my Lotus Client.  Hope I would find a solution to the same :@  !!!!

Saturday, September 21, 2013

Handling Variants - Becare full about the Type Name or Class Name of Variants refering to Array Objects

Variants now a days are proving more useful to me than before. I stick to the thought that I should not use variants unless its really necessary. One of the most effective advices that I received from developers against using variants is based on the fact that it takes 16bytes memory space for the object where is its less in case of objects for integer, string etc.

I often get the feel that with the current hardware capacities heightened to tera bytes, 16 bytes wont matter that much, if we recyle them properly.

I performed a small test today as my code kept failing and failing and there was not much for me to look for.

I first checked what type of values result in which type of variants. So I did the following in a test button


Eventually, I previewed the button on a client interface and did the MAGIC JOB of clicking it. And there comes my BELOVED BABY popups as to the left.

Now I understood that these are of types "INTEGER", "STRING" and "STRING()"

Is there any soul out there who agrees with me. If so, join the club and clean your eyes/specs and look at the god damn thing properly.

It is actually "STRING( )" and not "STRING()". This screwed me for over 30 minutes. Some time back due to a specific individual in my life, I became of fond of reading and understanding the "LAWS OF STUPIDITY". The fourth law stated that,

"Non-stupid people always underestimate the damaging power of stupid individuals. In particular non-stupid people constantly forget that at all times and places and under any circumstances to deal and/or associate with stupid people always turns out to be costly mistake."

Now my question is who is stupid - Me , the Variant or ***




Saturday, September 14, 2013

Obtain class name of objects in lotusscript

Several months ago, I explored how to create overloaded functions in Lotusscript. I had posted about the same as well. Recently I went through a thought which required me to find a way to get the class name of a lotusscript object in the run time. It really took me some time to eventually recollect that I knew the answer already until I went through my own posts again.

Thought I would make it simpler with a proper titled post dedicated for this issue of finding the class name of a lotusscript object on run time.

The lotusscript key word that does it is "TypeName". Though I had used this for doing the overloaded functions, It took me an hour to recollect it X(. Guess I had grown rusty in the last two years with less coding. Am happy now, that I get enough stuffs to challenge my skills again

In short, following is a little illustration about the way this keyword works. For a quick test, add the following code to a button and test it on Notesclient.

dim doc as NotesDocument
dim uiDoc as NotesUIDocument

msgbox TypeName(doc)
msgbox TypeName(uidoc)

Now when you click on the button, you will receive a couple of prompts saying
"NOTESDOCUMENT" and "NOTESUIDOCUMENT"


Thursday, September 12, 2013

Crash Lotus Notes - Oops I did it again

It has been quite a while since work was such fun. :) I had missed to log a lot of ways by which I ended up crashing lotus notes last year as they seemed obvious and straight forward. This time I think I discovered a new way to do it :P

It is by make a view feel miserable when a document is opened from it. Yep its the queryOpenDocument event of the view.

I just put the following code into it

Sub Queryopendocument(Source As Notesuiview, Continue As Variant)
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim currDB As NotesDatabase
Dim selectedDoc As NotesDocument
Dim caret As String
caret=source.CaretNoteID
Set currDB=session.CurrentDatabase
Set selectedDoc=currDB.GetDocumentByID(caret)
Call workspace.SetTargetFrame("*********")  '- dont get any ideas. Just put a valid frame name 

Call workspace.EditDocument(False,selectedDoc)
continue=False
End Sub

This happens even if I comment "continue=False" 

I really dont know about how to fix it rolf :)

Tuesday, September 10, 2013

Custom sort using @Sort in lotus notes


I happened to cross through a scenario where I had to perform a custom sort in such a way that a list of words appear in a drop down in such a way that "Red" if present always appears first followed by "White" and "Blue" if they are present and the rest of the list must be alphabetically sorted.

I found a close way to do that but not the best solution though. It took me quite a while to understand the way the parameters "$A" and "$B" were used in the @Sort function.

I use a list named a s"myList" as an input parameter. The list elements present inside my list is as follows

Blue : Custom : XCustom : Red : DCustom : White

Take a look at the following code.

@Sort(myList; [CustomSort]; @Do(
  @If(
      @UpperCase($A)="RED";-1;
@UpperCase($A)="WHITE" & @UpperCase($B)="RED";1;
@UpperCase($A)="WHITE" & @UpperCase($B)!="RED";-1;
@UpperCase($A)="BLUE" & (@UpperCase($B)="WHITE" | @UpperCase($B)="RED") ;1;
@UpperCase($A)="BLUE" & !(@UpperCase($B)="WHITE" | @UpperCase($B)="RED") ;-1;
@UpperCase($A)>@UpperCase($B)
   )
) )

The out put that I have obtained is as follows

Red : White : Blue : Custom : DCustom : XCustom 

When I change the last line of code to @UpperCase($A)<@UpperCase($B) my out put becomes
Red : White : Blue : XCustom : DCustom : Custom 

It returns two types of values 1 and -1. The confusion was, It is supposed to return an integer equivalent for @true and @false which are to my understanding 1 and 0 respectively.

I dont know how was one able to think about the scenario of using -1 as a return type which was not documented in Designer help. It works great.

As per my understanding if you return
1 - it means $A will be put behind $B in the list after the comparison occurred
0 or -1 - it means $A will be put in front of $B in the list after the comparison occurred.

-2 ( and probably all other negative number) is treated like 0 as well O.o

Tuesday, September 3, 2013

Colors in Lotus Notes View Columns

I always wanted to document this, but often felt lazy about doing it. Thus this got delayed by almost 4 and half years. Can you believe that? I can. I know I am better at doing stuffs more worse than this.

This post is typically about how you give different colors to different columns in Notes Client. Actually there is no such thing. Hence as always we end up doing simple work arounds. Let me give you a visual sneak peak before you end up reading my entire post and feel bored

Thats looks color full doesn't it :). The trick behind these colored columns with custom backgrounds are using hidden columns with "Use value as colors" enabled with a column formula like

backgroundColor:textColor where each of these would assume a value between 000000 to ffffff or 0:0:0 to 255:255:255. Refer to following image for more details


If you take a closer look at the image, you will be able to see that I am referring to three small columns with no titles and the two important properties "Use value as color" and "Hide column" enabled.

Make a note of the way in which I had assigned the color values to the variables. They are not in quotes. I have assigned the numbers colon separated just as is. So these variables are typically arrays containing three color codes as its elements

Thursday, August 22, 2013

No communication ports found in notes ports dialog after installation issue

I had a tough time figuring out how to communication ports for Lotus Notes to use and connect to servers.

The issue was simple and the background was funny. I needed Lotus Notes to be installed and the guy who helped me out gave me a client but no designer/admin clients. Felt great and had a headache trying to help him understand what I want. And finally I did it again - "gave up" and figured out an other way to do it myself. It feels like I am experiencing the attitude face that Mr.Han wanted from Xaio Dre during his training.

Now I got the installation files and completed installing Lotus Notes and found that I was not able to connect to servers.

I went to File -> Preferences -> Notes Ports and "Awe :/ No Communication Ports found X("

I tried adding TCP to the list and trace my server it did not work.

So went through uninstallation and re installation horror and the issue still persisted.

This time I had ! over my head. When I tried to trace a different server I found that the port I added was missing.

So the Answer is "ADD A PORT NAMED TCP AND FOR GOD SAKE RESTART YOUR LOTUS NOTES" and it worked. This time the "Show status" button really shows info on my TCP port that I added

Feeling relieved at last - again - ;'|

Tuesday, August 6, 2013

Android Application Development 5 – Action Bars

I have an advanced device with me. So I am going to be selfish here. I want to know what I can do with my device and see what my device is capable of. So I am going to try out stuffs that work good with my device. So if you are working with a device that is lesser than Andriod 3 and if you find this not helping you, you could probably visit developer.android.com for exhaustive neat documentation.

 

Running down what I have understood so far in respect to the previous posts Android Hello World Part 1 to 4

1.      Define layout in activity_main.xml

2.      Define ids to elements (they are the view objects as per SDK) use android:id="@+id/yourid"

3.      + symbol comes behind the @ symbol for id declarations alone

4.      The above said declaration will help me access my element using R.id.yourid

5.      @symbol is required to refer any resources

6.      setContentView(R.layout.activity_main); -> will look for the layout defined in the activity_main.xml file in the layout folder and render it .

7.      Call the above mentioned line in the onCreate event of the activity to get the layout

8.      Use findViewById(R.id.yourid) to find your components. Its equivalent to document.getElementById in javascript.

9.      Use "Intent" objects to communicate between activities

10.  Use Intent.putExtra(key,value) to transfer values

11.  Use startActivity(Intent) in button clicks to start activites

 

Now its time for the action bars to come into the picture.

 

I intend to add a couple of actions to the action bar of my main activity page. In order to do that

create the following xml file  -  res/menu/main_activity_actions.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <!-- Search, should appear as action button -->

    <item android:id="@+id/action_search"

          android:icon="@drawable/ic_action_search"

          android:title="@string/action_search"

          android:showAsAction="ifRoom" />

    <!-- Settings, should always be in the overflow -->

    <item android:id="@+id/action_settings"

          android:title="@string/action_settings"

          android:showAsAction="never" />

</menu>

For some reason, the following line kept erroring out.

android:icon="@drawable/ic_action_search"

android:title="@string/action_search"

 

So I added the following line of mark up to the strings.xml file

<string name="action_settings">Settings</string>

 

And added an image by the name ic_action_search to the project file as illustrated by the following screen shot

 

To add the action to the action bar, Modify the onCreateOptionsMenu in the MainActivity.java call to the following

@Override

    public boolean onCreateOptionsMenu(Menu menu) {

        // Inflate the menu; this adds items to the action bar if it is present.

       MenuInflater inflater = getMenuInflater();

        inflater.inflate(R.menu.main_activity_actions, menu);

        return true;

    }

 

To respond to the action button clicks add the following function to the mainActivity.java class. Note the way in which the ids of the action items are being used

    @Override

    public boolean onOptionsItemSelected(MenuItem item) {

        // Handle presses on the action bar items

        switch (item.getItemId()) {

            case R.id.action_search:

               // openSearch();

                return true;

            case R.id.action_settings:

               // openSettings();

                return true;

            default:

                return super.onOptionsItemSelected(item);

        }

    }

 

 

Now to ensure that we are able to navigate from the child activities to the parent activity, we need to add a up button in them.

 

Honestly, it got created automatically even before I realized the need for it. So may be the following code is required for some lol faulty advanced mobiles

Add this to the child activity class' onCreate function. In this case it is the DisplayMessageActivity.java class

getActionBar().setDisplayHomeAsUpEnabled(true);

Now I see an action button my action bar. Yeppieee

 

 

Monday, August 5, 2013

Android Hello World Part 3 - Installing the app in your Android

Now I have a simple hello world app that I was able to test in my Android device by running the app from the eclipse environment.

Ok. Now I want to run the app directly on my Android with the help of eclipse. What should I do. I searched through the sources in the innernet and came to know about the “.apk” files which means Android Application Package File.

I trust eclipse J I should be having this goddamn file somewhere in my eclipse workspace and I don’t have the patience to search for it. I used windows search to find the file only in my bin folder of my first android app. How stupid am I lol. I am way out of touch to have forgot such a simple idea.

Quickly I moved the file into my favorite folder in the Android device. Then I got the wonder full security message mocking me to hell
I paid 40K bucks for this stupid device and yet it calls me a stranger. How about that thought!!! It’s OK I can live with that. After all I have to live with women around me in my life. I feel like an elite soul who cannot be hurt with such simple insults rolfJ

Tap on the Settings button to navigate to the Application settings sub-menu. If you’re trying to get there without an application warning screen prompt, navigate there via Settings –> Applications. There you’ll see a screen that looks like so:
What we’re interested in is the Unknown source, check the box beside it. You’ll get a stern warning, click OK and double check that the box is checked properly.
At this point you can now click on that link or navigate to the APK file saved on your SD card and install the application. We recommend that you go back into the Application settingsonce you’re done installing your non-Market applications and uncheck the box—it’s only a few clicks to enable it again in the future when you need it
Now I see my cute app in my mobile screen J Hurray !!!



Android Hello World Part 4 - Uninstalling the app from your Android


Now to the most important part of the sequel. How the @#@^ do I uninstall this useless app from my device. I don’t want it to stay there forever and ruin my opportunity to make more terrible mistakes.

Getting rid of the app was not that difficult. Go to settings, get into application manager or my apps or apps or whatever is relevantly present in your mobile and uninstall it. Worst case scenario, you can even download new apps to do it J I don’t think it will ever come to this.

Go through the following link for some decent documentation