jump to navigation

How to execute Visual Basic from JAVA ? – part 1 July 9, 2009

Posted by pierrekoerber in It strategy, java.
Tags:
add a comment

I’m facing a common programming problem. I’m on my windows machine and I have a software package which run fine form my needs but it is not available in JAVA… how to integrate it in my JAVA program ?

First there is connectors to run activeX of other microsoft tech from JAVA, my way is to use directly VB from JAVA with a shell command.

Everyone know that there is a visual basic embedded in microsoft office. So the strategy is to launch a word to make the VB code run…

To launch word, here the easy way :

String sCmd ;
sCmd = “notepad ” + “c:\\temp\\test.txt” ;
try {
Runtime.getRuntime().exec(sCmd);
} catch (IOException e) {
e.printStackTrace();
}

In our next article we will see how to start VB… greetings.

A remain of the past – the dusty console July 5, 2009

Posted by pierrekoerber in Uncategorized.
add a comment

After sometimes of laziness, (I’m too much playing with facebook and twitter) I’m back on my blog…

Which one of you is an old enough notes freak to remember the dusty old console which was the bread and butter of the dark age of the domino administration ? at this time to administrate a notes server you only need a strong knowledge of the domino directory and a simple console… old good times !

The old console remains in lotus notes today, and you can call it which a simple macro :

@Command([AdminRemoteConsole]) ;

Of course you need the rights to do it, it could be very useful when you are stuck with a “simple” notes client…

The cCounter class. March 11, 2009

Posted by pierrekoerber in Lotus domino, Tech, programming.
Tags: , , , , , , , ,
1 comment so far

* When programming a very long an complex agent it’s very fine to display the agent stats at the end of the agent’s execution. These stats could be a lot of numeric data. It’s a pain to declare and manage all these variables.
* For doing this you need to create a lot of different counters and it’s very boring to manage the init part of these counters, the increment and the display. And what a pain if you want to add a new counter…
* With my solution you will find this very easy to manage and you will add a lot of interesting counters in your next complex agent.
* The idea is to put every counter in a class which will manage for us the boring job.
* This class will init the counter, manage the increment and give us the text.

Here the code :

‘  Class counter v1.0
‘  By Pierre Koerber

Class cCounter
lCounter List As Long

Public Function incrementCount(sCounterName As String)
If Iselement(lCounter(sCounterName)) = False Then
lCounter(sCounterName) = 1
Else
lCounter(sCounterName) = lCounter(sCounterName) + 1
End If
End Function

Public Function toString() As String
Dim sRes As String
Forall x In lCounter

If sRes = “” Then
sRes = Listtag(x) + “=” + Cstr(x)
Else
sRes = sRes + “,” + Listtag(x) + “=” + Cstr(x)
End If
End Forall
toString = sRes
End Function

End Class

‘——————————-

‘ calling code, this allows you to manage three counter in a easy and cool way.

‘——————————-

sub initialize
dim counter as new cCounter()

set doc = dc.getFirstDocument
while not(doc is nothing)
if doc.Subject(0) = “” then
Call counter.incrementCount(”Err”)
else

call counter.incrementCount(”Treated”)
end if

Call counter.incrementCount(”RcdTreated”)
set doc = dc.getNextDocument(doc)
wend

log(counter.toString())

end sub

Diary of my switch to ubuntu 8.10… March 10, 2009

Posted by pierrekoerber in It strategy, Tech.
Tags: , , , , , , , , , ,
add a comment

Remember last year post :

http://pierrekoerber.wordpress.com/2008/03/10/diary-of-my-switch-to-kubuntu/

After giving up because facing some wireless troubles, I did it again… The fact is that after one year of moderate use, my old laptop was completely unusable. WinXp was so slow, I read a lot of articles of how to boost an XP system but, what a big job and you know I haven’t so much time. I’m using an old Dell Inspirion 9200, with hh 60 gigas and 700 of RAM.

I burned the 8.10 version on a CD and went on to the installation.

The installation process went perfectly. After that I should connected my laptop to internet with the internal network car. After that ubuntu proposed me to upgrade the installation. After a reboot (like in the windows world) the system has auto-detected my internal wireless card and proposed to me the right native driver. (what a luck). I was beginning to try to install the NDIS Wrapper… but how lucky to bypass this challenge.

After installing the must-have application, I have a brand new laptop… the feeling is that the hardware is responding like a brand new PC. The interface is pretty good, and it’s really a pleasure to work with ubuntu. If like me you have an old laptop, you should try to make it young again with ubuntu.

My test is superficial, for the moment I haven’t done serious use of open-office product and so on… but we will see.

Greetings !

Install the domino server java console November 25, 2008

Posted by pierrekoerber in Lotus Admin, Lotus domino, Tech.
Tags: , , , , ,
1 comment so far

For me the java console is a lost gem for the notes administrators.

It is a good feature because it allows to administrate all your server from one single point. It will run the console separatly from your notes client, and this is good because the admin client sucks ! it give you more but that’s not the subject of this post.

This article allows you to configure your Windows server to make it run.

First you should modify the start of your server to make it load the domino controller and the java console.

Take “the HKEY_LOCAL_MACHINE\System\CurrentControllSet\Services” key and look for the Lotus Domino key.  In there you will find an entry called ImagePath.  The add to the service’s parameter the -c to load the domino controler and the -jc if you want to load the java console the machine.

domino-server-registry

After that your server should start as in this picture :

domino-server-reg-edit

You could start the console from your notes client directory to have the same on you computer… nice isn’it.

My virtual Lab November 22, 2008

Posted by pierrekoerber in Uncategorized.
Tags: , ,
1 comment so far

To improve my skills and to move forward, I just start with late to move on with visualization.

My workstation is a Windows VISTA, I know that I’m already cataloged with a big dummy sticker on my back but you know, I’m open-minded !

So to work set up my stuff I choose VIRTUAL PC 2007… you know what, it’s free ! (I know that I have already pay it to microsoft with all the craps I’ve bought to them indirectly)

One bad point is that Virtual PC doesn’t seem to enjoy ubuntu… so I’m using it with windows XP.

First problem, not enough memory on my vista computer… I bought 2 gigas of memory to have 4 giga… and you know what, VISTA 32 bit version doesn’t manage more than 3 gig of memory… thanks microsfot !

Second problem, impossible to address the virtual host from my pc because I’m using a wireless card. I found a nice blog entry which help me to fix the issue, let’s share with you :

http://www.tipandtrick.net/2008/how-to-bridge-virtual-pc-2007-to-use-host-computer-wireless-network-adapter/#comment-5793

And now everything is up, no big waste of time, no money waste ! who doesn’t think our world isn’t perfect ?

Action to populate a custom user signature… September 20, 2008

Posted by pierrekoerber in Lotus Admin, Lotus domino.
Tags: , , , , , , , , ,
add a comment

One big week for “myLife 2.0″

This was a great week for my blog. I’m not a regular blogger (it takes so much times) but this week I was referenced on the famous http://www.codestore.net… it has boosted my visits… that’s pretty cool.

eMail signature, 2 choices

What about the corporate signature. There is a lot of way to do it, since R7 you can customize it and manage it on the notes server… but if you want to allow your users to manage their signature this TIP is for you.

eMail signature, HTML or Text based ?

The next point is to know if you want a fancy and flashy HTML signature with pictures (hey, we’re living in the third millenium !). From my point of view, I prefer a text based signature, it’s simple, it works in all the case… so it’s profesionnal… the HTML is nice but it is impredictable to know how it will be seen on the user device (hey, users aren’t only reading their eMail on their computer…).

One dusty old script…

Going back my archives from the time when I was a full-time admin (one year ago) I found this little gems. So here one dusty old script from my archive… it was one of my first one I wrote when I began to administrate a domino domain.

The purpose of this script is to send a button to the users to let them edit their signature. This script composes a text user signature from the data in the nab (STEP 1, 2, 3). Then the script sends an eMail to the administrator to allow the tracking (STEP4) . Finally it presents the signature  to the user to allow to correct it. (STEP5)

You can put this script in a button (TEST it before and remove the steps you don’t need)

So, I hope it will help you to make your users happier !!!

Greetings

@REM “-STEP1-Parameters—————————–” ;
srv := “yourServerName” ;
db := “names.nsf”;

@REM “-Retrieve the user data in the nab-” ;
Line := “————————————————————————–” ;
Nom := @Name([CN] ; @UserName) ;
eMail := @DbLookup ( “” : “NoCache”;srv:db;”($Users)”;@UserName;”InternetAddress”) ;
fct := @DbLookup ( “” : “NoCache”;srv:db;”($Users)”;@UserName;”????”) ;
tele := @DbLookup ( “” : “NoCache”;srv:db;”($Users)”;@UserName;”Phone”) ;

@REM “-STEP2-ADDRESS LINES ——————————–” ;
Adresse1 := @If(@IsError(fct);”Function : ” ;fct) ;
Adresse2 := “Your company NAME”  ;
Adresse3 := “City number” ;
Adresse4 := “Tel. ++41(0)27.7.661.” + @If(@IsError(tele);”" ;tele) ;
Adresse5 := “Fax. ++41(0)27.7.661.485″ ;
Adresse6 := “EMail    : “  + @If(@IsError(eMail);”";eMail) ;
Adresse7 := “Internet : http://www.yourCompany.com” ;

@REM “-STEP3-Create the signature ——————————–” ;
Signature := @NewLine +  @NewLine + Line + @NewLine + Nom + @NewLine + Adresse1 + @NewLine + @NewLine + Adresse2 + @NewLine + Adresse3 + @NewLine + @NewLine + Adresse4 + @NewLine + Adresse5 + @NewLine +   @NewLine +  Adresse6 + @NewLine + Adresse7 + @NewLine +Line ;

@REM “-Set it to the user profile ——————————–” ;
@SetProfileField(”CalendarProfile” ; “EnableSignature” ; “1″) ;
@SetProfileField(”CalendarProfile” ; “SignatureOption” ; “1″) ;
@SetProfileField(”CalendarProfile” ; “Signature_1″ ; Signature) ;

@REM “-STEP4-Send an eMail to the admin to check follow-up purpose, could be a mailing db ——————————–” ;
@MailSend( “pierre koerber” ; “” ; “” ; “Mise à jour signature ” + @Name([CN] ; @UserName) ; “” ; “”) ;

@REM “-STEP5-Display the dialog to the user, to edit purpose ——————————–” ;
Texte :=”In the next windows, you could check the signature that will be added in your eMails.” + + @Char(13) + @Char(13) + “Cliquez sur l’onglet signature et contrôlez :” + @Char(13) + “1. La fonction” + @Char(13) + “2. Le no de FAX” + @Char(13) + “3. L’adresse eMail” ;
@Prompt([Ok];”Validation” ; Texte) ;
@Command([ToolsRunMacro];”(Preferences)”)

Google Chrome : review September 6, 2008

Posted by pierrekoerber in Tech.
Tags: , , , , , , , , ,
1 comment so far

This week the biggest event was the beta of google chrome. Everyone was excited at the office with this big news !

So the war of the browser is taking a new dimension. As the CEO of Mizilla is saying, it’s a good thing that a new participant is coming in the race… the benefit is for all the users. For myself I have a big waiting of the new google’s cellular plateform : Android. This month HTC should release the first device with this brand new technology. So the war of the mobile phones is still going on with some new competitors… As we can see the tech world is shaken by google ! from my point of view I enjoy Google because they are making the things going further and this is good.

So, what about Chrome :

1. It’s amazing how fast it starts. Firefox is looking like a big and slow program in regards of that. So for that reason, I like it.

2. The design. It’s a pretty design, simple and performant. Firefox is looking a little bit more sad with it’s old fashion grey (like application in windows 3.1…)

3. The usability (end user) for day to day browsing, no problem, simple and fast. I like the url bar which is acting as a search engine. Brillant.Firefox is as good as Chrome for that.

4. The usability (web designer). Chrome seems to have some pretty nice tools for debugging and trapping javascript. Firefox is ready too with some excellent extension like firebug.

5. The speed : the javascript engine is amazing. It will put the google apps on steroïds. Firefox will follow and improve very soon its javascript engine. Concurrence is good !

6. Bookmark management : I don’t enjoy it, I prefer the firefox way.

7. Global impression : Google Chrome is an excellent product (it’s only a beta !!) and I will use it for my main browsing.

And what about IE in my review… IE, I don’t use this crap software.  So in conclusion, the best thing you should do is to have a look by yourself.

Greetings from Switzerland !

Remove the space in a string… August 30, 2008

Posted by pierrekoerber in Lotus domino, Tech.
Tags: , , , ,
add a comment

Last week I was searching a way to suppress spaces in a string. I thought about the trim function… but it doesn’t do the magic.
After several minutes of thinking with the web I found a simple way…
The conclusion is : we become stupid, we can’t think first, we’re going on the web…

Dim x as string
x=”1  2   2 3  4 5″
‘*** Packed x without spaces !
x = replace(x, ” “, “”)

Lotusscript : Json formatter… enjoy July 28, 2008

Posted by pierrekoerber in Lotus domino.
Tags: , , , , ,
5 comments

Hello, the following class allows you to format easily your return to your AJAX requests in JSON.


'--------------------------------------------------
'Calling code
'--------------------------------------------------

Dim sJson As New cJSON

Call sJson.addItem("myParameter1", True)
Call sJson.addItem("myParameter2", "this is a value")
Call sJson.addItem("myNumericPara", 2324)
Call sJson.addItem("myJSONStruct", sJson)

Msgbox sJson.getJSONWithHeader()

————————————————–

Calling code

————————————————–

Dim sJson As New cJSON

Call sJson.addItem(”myParameter1″, True)
Call sJson.addItem(”myParameter2″, “this is a value”)
Call sJson.addItem(”myNumericPara”, 2324)
Call sJson.addItem(”myJSONStruct”, sJson)

Msgbox sJson.getJSONWithHeader()

————————————————–

class code

————————————————–
‘/**——————————————————————————————
‘ * Object         cJSON
‘ * @author         Pierre Koerber
‘ * @version         1.0 – 24.07.2008
‘ * History :
‘ */——————————————————————————————
Class cJSON
Private lstItem List As String
Private newLine As String

Sub new
newLine = Chr(13) & Chr(10)
End Sub

Public Function getRandomString() As String
getRandomString = Replace(Cstr(Rnd(1)), “.”, “”)
End Function

Public Function addItem(sName As Variant, vValue As Variant) As Variant
Dim sJson As String

sJson = |%1:%2|
sJson = Replace(sJson, “%1″, sName)

Select Case Typename(vValue)
Case “CJSON”:
sJson = Replace(sJson, “%2″, vValue.getJSON())
Case “STRING”
sJson = Replace(sJson, “%2″, |”| + Cstr(vValue) + |”|)
Case “BOOLEAN”
If vValue = True Then
sJson = Replace(sJson, “%2″, “true”)
Else
sJson = Replace(sJson, “%2″, “false”)
End If
Case Else
sJson = Replace(sJson, “%2″, Cstr(vValue))
End Select

lstItem(getRandomString) = sJson
End Function

Public Function getJSON() As String
Dim i As Integer
Dim sRes As String
i = 0
sRes = “{”
Forall x In  lstItem
If i=0 Then
sRes = sRes + x
Else
sRes = sRes + “,” + x
End If
i = i + 1
End Forall

getJSON = sRes + “}”
End Function

Public Function getJSONWithHeader() As String
Dim sRet As String
sRet = |Content-Type: text/javascript; charset=UTF-8| + newLine
sRet = sRet + |Cache-Control: no-cache| + newLine
sRet = sRet + getJSON()
getJSONWithHeader = sRet
End Function

End Class