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 :)
Monday, January 03, 2011
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)
To avoid that - set this option you see on screen below (I believe at some point IBM will set as default)
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:
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
<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>
</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>
Saturday, December 18, 2010
I've installed FP1 (for 8.5.2) without any problems.
Here is full list of updates/fixes: link
be cool, be with FP1 :)
Monday, December 13, 2010
I've just passed exam #190-951. IBM Lotus Notes Domino 8.5 Application Development Update
with 85% that is not bad but from another side it means I still need to learn a lot.
Monday, December 06, 2010
Expand and Collapse views in xPages
Found very nice solution
Collapse all
Expand all
That's much better then save values in sessionScope/RequestScope and use property expandLevel in viewPanel.
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.
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)
step 2.
select input-field, and go to onFocus event, select Run: Client and JavaScript and put there 2 lines
step 3.
select input-field, and go to onBlur event, select Run: Client and JavaScript and put there 1 line
That's all.
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).
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
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)
Subscribe to:
Posts
(
Atom
)