Tuesday, March 22, 2011

have you already download new FireFox?

I've just updated it to version 4. It works fine. Unfortunately I expected it would run faster then 3.X but it did not happen. FF can't beat Chrome in this area. But there is another good news: all my plug-in work fine. Only firebug required re-installation.

Saturday, March 19, 2011

I've moved my applications to google code.

I've upload some of my small application to google code. There are couple reasons why I did it:
- backup.
- we can use SVN now as on some projects I work with another people, so now we can get benefits from that as well.
- I just feel that it is much much more correctly :)

If you wish to create project your own project on google code, just fill google code form. After that using SVN do checkout and
input as URL repository https://*******.googlecode.com/svn/trunk/
[Username] is your email
[password] is available on google code setting page.

So go on and do your first commit to google code

Friday, March 04, 2011

SVN plug-in problems

Hi guys, we are moving our Domino applications to SVN and everything going really well except one thing.
We are having problems with elements that really do not modified but during synchronization they get new values (look on image). It is major problem for us, because applications have many design elements and most of them often get news values (modified, noteid etc) and then we are not able to determine what elements were really changed.
We do have workaround: do 1 more step and apply XSLT approch on exported elements and just remove these Noteinfo, modified, lastaccessed etc tags, but that is not the really correct way.

Does anybody know solution for that? If you use SVN - how you live with that?

IBM did forum on xPage, nice

Just noticed that IBM did forum for xPage based on xPage. I can't say it looks great, I feel it still require lot of work.

Tuesday, February 15, 2011

Introducing LotusLive Symphony

I've been using Google Documents for couple years already, I've even do not have office installed on my laptop at all. Now IBM did something similar? I've tried it already and should notice that Live Symphony is still far-far from Google. First what I've found - no support of right click mouse, only action bar. From another side, I'm happy that IBM tried to do that. Test link. That's nice.

Friday, February 11, 2011

xPage view with categories + readers fields + don't show empty categories

I'm doing simple application right now on xPage, nothing really difficult. This application has view with couple columns as category, documents that I display into that view have readers/authors fields and I need to be able do collapse and expand of that view. Simple things, right? but not for xPage, to difficult, it just does not work :-), I've found paper on
IBM LO58079: XPAGE VIEW CONTROL WITH EXPANDLEVEL, VIEW WITH 'DON'T SHOW EMPTY CATEGORIES', DOCUMENTS WITH A READERS FIELDS
Actually this paper describes my situation and there is really smart solution there!
Local fix
Remove any one of these three factors:
- The readers fields from the documents.
- The "Don't show empty categories" property from the view.
- The 'expandLevel' property from the view control.

Is it joke? Would it not be better to remove whole application at all? nice that they do not say to use another sofrware for web development, but who know... probably next 'Loal fix'...  :-)

Wednesday, January 19, 2011

trying to get full control over xPage auto generated html

I know xPage is great especially for RAD but I feel bad when I see how Domino generates HTML for xPage's application and dojo why it loads even if I do not want to use it? yea, I know that most of xPage's controls use it but anywhere I want to keep control over each html-tag. I want nice html. I want to know what is going on with my html. I'm sure all of you saw what html we get from xPage, and I want to repeat once again "I'm not fan of that".
Here are couple steps for those who want to get some more control over xPage. I will show example with new application that has only one xPage.

so let's start. we created new application and created new xPage, let's call it 'index'. Open it in browser. what do you see? My Domino generates already lot of staff.

1. included dojo.
2. included css.
3. created form and put there ~6 fields for some reasons. I do not know why.
4. html, head, title, body tags and !DOCTYPE

So instead to display empty page, Domino generated ~1Kb of some data we did not ask.

1-st step: disable default dojo in xPage.
You can disable the loading of the default Dojo, for example in order to use a more recent version of Dojo. In the Package Explorer in Domino Designer open your database and find the WebContent/WEB-INF/xp.properties file.
Edit the file and addxsp.client.script.libraries=none
Switch to Java perspective and Package Explorer there by default, so go there and make update. Save and check results. 2 line disappeared.

2-nd step: disable CSS.
create new Theme and remove extends="webstandard" and add this Theme in application properties as one we want to use. check hmtl source again - 3 lines with css went out.

open our index xPage and go to properties, tab Basic and set CreateForm = false. Save. Check. 
nice! we are quite near :)

4-th step. get empty blank xPage.
I do not know yet the way how correctly suppress rest of these tags and how to change doctype, so next time when I found solution I will update article.

Funny, while I was looking for solution for 4-th step, I found absolutely similar article from Chris, so you can read more older one This is an xPage.

Tuesday, January 18, 2011

Google Maps API - MarkerClusterer

If you ever did some job linked with google map (f.x. show markers with popup) you probably noticed problem with huge amount of markers (f.x.1000 markers). It does slow performance of webpage + it looks not very nice on UI (just mass of markers on same place). There is solution for such situation: MurkerClusterer, it allows to join markers into cluster with possibility to have different cluster on different zoom.
Here is an article about it - markerClusterer solution to the Too Many Markers problem
For those who works with Google Maps API this article is mandatory to read.

short dojo + ajax example how to get data from db

There are 3 most useful ahax-approaches I use when working with Lotus Domino:
- getting view as JSON. database.nsf/viewname?readviewentries& OutputFormat=JSON (fast and modern)

- agent approach (example here, most flexible and probably most slow approach)
- page/form/view as elelemnts, f.x. database.nsf/myform?openform&unid=123123 (easy to use but not  flexible, I use it very rarely)

Very small and known example of dojo's ajax, I'm getting some information from agent and then will use it in my JS later.

var jsondata;
dojo.xhrGet({
url: "database/agentGetData?Openagent&param1=id1",
sync: true,
load: function(data) {
jsondata = data;
}
});

I'm interesting in any another 'smart' approaches, so if u have some interesting idea we can discuss in comments them.

Sunday, January 16, 2011

nice command lotus\notes\nsd.exe -kill

Previously I've used kman.exe utilites to kill lotus notes processes, but now switch to this command.

Thursday, January 06, 2011

Merry Christmas, dear Orthodox !

christmas-2011

Improving SEO for blogspot bloggers. Lesson #1.

Everybody wants to have at least not worst SEO on own blogs. In case if you have you own blog on Domino or another platform, use your hands and do updates but if you are one who use blogspot, here it couple tips I would like to suggest to do. It is quite simple and fast.

1. Title tag. Check it on main page, does it says what you wanted?
looks on different pages as well. If you want to update it go to Design of your blog and open it as HTML, find area with title and replace it on such one

<b:if cond='data:blog.pageType == &quot;item&quot;'>
<title><data:blog.pageName/> | <data:blog.title/></title>
<b:else/>
<title><data:blog.pageTitle/> | Your additional keywords</title>
</b:if>

Actually you are free to put there whatever you want. Mostly all says that ideal length for title tag is 69-70 chars. So remember that and try to make it near to that.

2. By default blogspot does not include meta tags such as description and keywords, so we have to add that manually (at least my blog did not have these tags). Good length for this tags are: meta description ~156, meta keywords is about 180 chars. Here is snapshot of what you need to add to your template.

<b:if cond='data:blog.url == data:blog.homepageUrl'>
<meta content='bla bla bla' name='description'/>
<meta content='lotus, motus, fotus, focus, etc' name='keywords'/>

if you read logic carefully you will see that it says: add meta tags only for main page, that's because otherwise we will get these tags on all pages and that's very bad, google does not like same meta description on pages. that's duplicate and you will decrease PR. Later I will add some information how we can have unique meta tags on pages.

3. sitemap. I believe it is not necessary as we are already you google so it does this automatically, but anywhere, better to do :), I hope you have already enabled RSS on your blog. So just open Google Web Master add you site there and find menu Sitemap and try to add next /atom.xml?redirect=false&start-index=1&max-results=300you can update max-results as u wish. If everything went fine you should see Status 'OK' and number of of URL should be same as you have in you atom.xml.

4. that's is not linked to blogspot problem, but just remember that:
- Images should have title and alt.
- Tag <strong> is better that <b>, but as I see it requires go fix it into HTML of your entry.

Summary
These tips are legal and easy to implement, but remember, unique and interesting content is the key.

Monday, January 03, 2011

Native JSON

var jsonObjStr = '{"name":"Erast Fandorin", "speciality":"detective"}';
var object_person = JSON.parse(jsonString);
// object_person is object now with 2 properties

var personString = JSON.stringify(person);
// personString now keeps the string '{"name":"Erast Fandorin", "speciality":"detective"}'

this native JSON is now supported mostof browsers, so just use it :)

Wednesday, December 29, 2010

Useful option when you are doing Java in LDD

If you are doing java in LDD you always need to save design elements after you update your source code. It is so painful (at least for me) because each time I need to check result I have to switch from source window to design window and do save there.

To avoid that - set this option you see on screen below (I believe at some point IBM will set as default)

autosave-java-design-element

Thursday, December 23, 2010

CSS staff you have to know

I'm sure most of you have worked with CSS. I'm sure many of you know that, but some do not, so here are some nice practices that can help you.
1. div>h1 { color: red;}
- means all h1 that are child to div will get that CSS, but not sub child.
examples:
<div>
<h1>this is red</h1>
</div>

<div>
<p>
<h1>this is not red</h1>
</p>
</div>

2. p+h1 {color:red}
- means make red h1 in case if it is going just after p on the same level
examples:
<div>
<p></p>
<h1>this is red text</h1>

</div>

<div>
<p></p>
<h2></h2>
<h1>this is not red text</h1>
</div>


3. p~h1 {color:red} (similar to +)
- means make red h1 in case if it is on the same level with p
examples:
<div>
<p></p>
<h1>this is red text</h1>
</div>

<div>
<p></p>
<h2></h2>
<h1>this is also red text</h1>
</div>


4. p:first-child {color:red}
- means make red p in case if it is first child
examples:
<body>
<p>This is red text</p>
<p>This is not read</p>
</body>

Monday, December 06, 2010

Expand and Collapse views in xPages

Found very nice solution

Collapse all
 var viewPanel = getComponent(compositeData.viewPanelName);  
 var model:com.ibm.xsp.model.domino.DominoViewDataModel = viewPanel.getDataModel();  
 var container:com.ibm.xsp.model.domino.DominoViewDataContainer = model.getDominoViewDataContainer();  
 container.collapseAll();  

Expand all
 var viewPanel = getComponent(compositeData.viewPanelName);  
 var model:com.ibm.xsp.model.domino.DominoViewDataModel = viewPanel.getDataModel();  
 var container:com.ibm.xsp.model.domino.DominoViewDataContainer = model.getDominoViewDataContainer();  
 container.expandAll();  

That's much better then save values in sessionScope/RequestScope and use property expandLevel in viewPanel.

Tuesday, November 16, 2010

JS staff: Use Object instead of Switch.

Well, many of us use switch to solve own tasks, but there is another way I would like to show. We can use Object approach to solve our problem and it looks more intelligent from my point of view.

Let me show couple examples

1. Example with switch
function FoodType(food) {
var getfoodtype;

switch(food) {
case 'apple': getfoodtype = 'fruit'; break;
case 'cucumbers': getfoodtype = 'vegetable'; break;
case 'watermelon': getfoodtype = 'strawberry'; break;
default: getfoodtype = 'not recognized';
}

return getfoodtype;

}

var getfoodtype, case, and break, we can avoid them.

2. Example with Object
FoodType {
apple: fruit,
cucumbers: vegetable,
watermelon: strawberry,

GetFoodType: function(type) {

return(this[type] || 'not recognized');
}

}

Ofc there could be cases where Object approach does not work and we have to use switch, but it is alternative, so keep in mind this.

Friday, November 12, 2010

Dynamical counter in Lotus Notes client

Have you ever tried to show length of field (f.x. just below the field) ?

Let me show my example, I've a form, there I have couple fields I need to show length of it (because there is some validation of length for this field).

So when user input new char in Title field, Character count should increase to 1. Know how to do that? I believe many of you know, but anywhere I would like to share this approach.

There are actually 2 fields: 1 for input and another one is just below the Title of field (computed type).

What we need to do - use some simple JavaScript lines..

step 1.
go to JS Header even in form/subform and put there couple lines of JS (select Run: Client and JavaScript)

 var f = document.forms[0];  
 var stopDynamicalCounter = 0;  
 function updateCharCounter(delay) {  
   if(stopDynamicalCounter == 0) return;  
   f.AlternateTitle_length.value = f.AlternateTitle.value.length;  
   setTimeout( 'updateCharCounter( ' + delay + ' )', delay);  
 }  

step 2.
select input-field, and go to onFocus event, select Run: Client and JavaScript and put there 2 lines
 stopDynamicalCounter = 1;  
 updateCharCounter(100)  

step 3.
select input-field, and go to onBlur event, select Run: Client and JavaScript and put there 1 line

 stopDynamicalCounter = 0;  

That's all.

Computewithform does not work properly at 8.5.2

Many people + me as well faced up with strange issue after migrated to 8.5.2.
Computewithform just stopped to work (but when you use debugger and look into document before computewithform it works fine).
Here is my solution to avoid this problem
Set doc=view.GetDocumentByKey(key, True)
Dim bug as String
bug=doc.UniversalID '(or any item) '// that is actually the main line, funny?
Call doc.ComputeWithForm(False, False)

Tuesday, November 09, 2010

Very nice SOAP client (java)

Here is link to nice java soap client
I've implement also LS2J approach

here is my example. There are some enhancements need to do, but anywhere this also works fine.

Java library

import java.io.*;
import java.net.*;

public class ECWebservice {
String cResponse;
String wsurl;
String msg;
String contentType;

public ECWebservice(String init_url) throws IOException {
wsurl = init_url;
msg = "";
contentType = "text/xml; charset=utf-8";
cResponse = "";
}

public String GetResponce() {
return cResponse;
}

public void SetContentType(String init_contenttype) {
contentType = init_contenttype;
}

public boolean Send(String init_msg) {
boolean result = true;
try {
msg = init_msg;

// Create the connection where we're going to send the file.
URL url = new URL(wsurl);
URLConnection connection = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) connection;

String SOAPAction = msg;

byte[] b = SOAPAction.getBytes();

// Set the appropriate HTTP parameters.
httpConn.setRequestProperty( "Content-Length", String.valueOf(SOAPAction.length()));
httpConn.setRequestProperty("Content-Type", contentType);
httpConn.setRequestProperty("SOAPAction", SOAPAction);
httpConn.setRequestMethod("POST");
httpConn.setDoOutput(true);
httpConn.setDoInput(true);

// Everything's set up; send the XML that was read in to b.
OutputStream out = httpConn.getOutputStream();
out.write(b);
out.close();

// Read the response and write it to standard out.
InputStreamReader isr = new InputStreamReader(httpConn.getInputStream(), "utf-8");
BufferedReader in = new BufferedReader(isr);

String inputLine;
while ((inputLine = in.readLine()) != null) {
cResponse += inputLine;
}
in.close();
} catch(Exception e) {
e.printStackTrace();
cResponse = "Main: Exception occured - check Java Debug Console";
result = false;
}

return result;
}
}


LS2J library

Option Public
Option Declare

Use "webservice.core"
UseLSX "*javacon"
Class ECWebservice
responce As string
connection As string
contentType As string

Sub New(connection_url As string)
connection = connection_url
contentType = "text/xml; charset=utf-8"
End Sub

Public Property Get GetResponce As string
GetResponce = responce
End Property

public Property Set SetConnection
connection = SetConnection
End Property

Public Property Set SetContentType
contentType = SetContentType
End Property

Function SendXMLRequest(xmldata) As Boolean
On Error Goto errorproc

'** everything we'll need to access our Java classes
Dim jSession As New JavaSession
Dim jClass As JavaClass
Dim jObject As JavaObject

'** get the IGWebservice class and instantiate an instance of it
Set jClass = jSession.GetClass("ECWebservice")

'** version of CreateObject and init with path to WSDL)
Set jObject = jClass.CreateObject("(Ljava/lang/String;)V", connection)
jObject.SetContentType(contentType)
'** send message and get result: true/false, if true then we got result
If jObject.send(xmldata) Then
me.responce = jObject.GetResponce()
End If

SendXMLRequest = True

endofsub:
Exit Function
errorproc:
MsgBox "Error #" & Err & " on line " & Erl & " in function " & Lsi_info(2) & " : " & Error, 48, "Runtime error"
Resume endofsub
End Function

End Class

Thursday, October 28, 2010

xPage: Could not load 'imb.xsp.widget.layout.TypeAhead'

Does somenody saw such issue? Got it when added typeAhead to customer control. It works fine when I open new document, but when I go to edit mode always get such message, any ideas?

Monday, October 11, 2010

xPage: date picker does not work in IE8

Just found that standard date picker does not work properly in IE8 (it always refresh page when we click on date/time picker. That's not funny :/ question - why do all another browsers work fine?

Workaround
http://www-10.lotus.com/ldd/nd85forum.nsf/0/579744cf7198e21785257731006c9cea?OpenDocument

Thursday, September 16, 2010

Change encoding attribute after XLST

I've done some transformation my DXL using XSLT. The funny thing was that after transformation using


// Transform
var str = docxml.transformNode(xsl);


I always got 'encoding' as UTF-16, that's not correct, so after some time I found nice solution


here is code I used: http://dotnet.itags.org/dotnet-tech/66097/

var doc = new ActiveXObject("Microsoft.XMLDOM");
doc.load(
"test.xml");

// Print initial encoding
var pi = doc.firstChild;
var eattr = pi.attributes.getNamedItem("encoding");
var encoding = eattr.value;

// Convert to string and reload (this loses the encoding)
var xml = doc.xml;
doc.loadXML(xml);

// Reset the encoding to "ISO-8859-1"
pi = doc.firstChild;
var eattr = pi.attributes.getNamedItem("encoding");
if (eattr == null) {
eattr = doc.createAttribute(
"encoding");
pi.attributes.setNamedItem(eattr);
}
eattr.value =
"ISO-8859-1";

// And save document with new encoding.
doc.save("test2.xml");


It works fine for me (and not, output option in XSL did not help)

Wednesday, September 15, 2010

Date.prototype.addDays

I did not find that method how can I add days to my date, so here is solution:

// add days
Date.prototype.addDays = function(days) {
var secsDay = 86400000; // there are 86400000 secs in 1 day
var time = this.getTime(); // number of milliseconds since midnight of January 1, 1970.
var newdate = new Date(time + (days * secsDay));
this.setDate(newdate.getDate());
}


If anybody has better solution, you are welcome!

Tuesday, September 14, 2010

'wget' as way to download files

Need to download files from our Domino server by this path http://host/myfile.log, using MS DOS command?
You can try to use wget as one of possible way to do that.
here is an exmplae of DOS command:
wget.exe http://host/myfile.log
I've run this DOS command in my JS file (yes ActiveX is required for that), but anywhere it is quite interesting approach.