Main | Next page »
http://blogs.sun.com/insidemyhead/date/20080102 Wednesday January 02, 2008

Charting Portlet using JSR-286

A while ago I had written an SDN article on how to generate charts dynamically in portlets. Following up on that, I have created a portlet that uses the JSR-286 feature of serve resources, to dynamically generate charts by reading its data from a JDBC compliant database. The essential feature of this portlet is that the image is generated dynamically and served via a serve resource call and isn't stored in any temporary location. The portlet can be run under any portlet container that supports JSR-286 specification. It has been tested on OpenPortal Portlet Container which supports the draft 19 of the JSR_286 specification. You can download the portlet war file from here.




 



Posted by insidemyhead [Personal] ( January 02, 2008 08:28 PM ) Permalink | Comments[6]
http://blogs.sun.com/insidemyhead/date/20070807 Tuesday August 07, 2007

Flex or Ajax .. well both!


The release of Flash Player 9 included a new External API using a class file called the ExternalInterface that allows for the communication between JavaScript and Flash applications. To create the communication link and pass data between JavaScript and Flex, the developer had to create custom code to handle each call.

The newly introduced Flex-Ajax Bridge has simplified the usage of this API. By simply including the necessary classes, the bridge exposes all of the classes within the Flex application to JavaScript. You can almost create anything in your Flex application using JavaScript instead of ActionScript.

So if you are a JavaScript pro and want to try out Flex this is a good time to do so!



Posted by insidemyhead [Personal] ( August 07, 2007 08:57 AM ) Permalink | Comments[0]
http://blogs.sun.com/insidemyhead/date/20070803 Friday August 03, 2007

Update: Flex up your portlets

A while ago I had talked about Rich Internet Applications on my blog and talked in detail about Flex. You can read that entry here. I had promised to put a tutorial/entry on how to create a portlet out of your Flex application, but I
didn't get time to post the entry.

Recently, I helped my colleague Murali on getting his Flex app converted to a portlet and he has been prompt enough to post the instructions on his blog here. Thanks Murali.



Posted by insidemyhead [Personal] ( August 03, 2007 12:27 PM ) Permalink | Comments[0]
http://blogs.sun.com/insidemyhead/date/20070801 Wednesday August 01, 2007

A Solution: Maths Fun Again.. Again

So the solution to my previous entry and the one prior to that was provided by a few folks as (root 2), which is actually quite trivial in my opinion. The actual question that has been bothering me was what i posted in the comments to whatever  few replies i got:

That is , what actually is . If the answer to both questions (blog entries) is , then how come is 2 as per my first blog entry and equal to 4 as per the second entry. This is the one I was actually looking for an answer to. I have kind of an idea what it could be, I will put my explanation here, and hopefully it makes some sense.

is actually limit of the sequence ,, ...

It is trivial to prove that the above sequence is increasing and is upper bounded by 2.

Coming back to the original question (the previous two blog entries marked above) which can be rewritten as .

 I tried to plot the graph of this function and it comes out as follows:


 

This proves that given a value of x, there are two values for y. And for x = , we know these values are 2 and 4. But we just indicated above that the sequence is upper bounded by 2. So the value 4 can't be possible for .

 

Hope it makes some sense.




Posted by insidemyhead [Personal] ( August 01, 2007 09:22 PM ) Permalink | Comments[1]
http://blogs.sun.com/insidemyhead/date/20070727 Friday July 27, 2007

Maths Fun Again .. Again

Some of the folks answered this in the comments to my previous entry as the answer to x being equal to . However if that is true then what is the value of x in the following equation?

 

Getting interesting now I guess :-)



Posted by insidemyhead [Personal] ( July 27, 2007 09:17 PM ) Permalink | Comments[6]
http://blogs.sun.com/insidemyhead/date/20070720 Friday July 20, 2007

Maths Fun Again

Given that : 

What is the value of x?



Posted by insidemyhead [Personal] ( July 20, 2007 08:17 PM ) Permalink | Comments[2]

Locker Mania - Answer

Although there were solutions to this provided by Murali and Eric in the comments section and they are correct. Just posting it here for more general viewing. BTW, I went through the C program written by Eric, it was really nicely written program with neat output as well. Really nice!

 Anyway back to the answer.

The state of any locker N will remain unchanged from the beginining as long as N = P * Q, and P and Q happen to be distinct (There can be multiple combinations of P and Q). That means, given the 10th locker, its state will be toggled by the 1st and the 10th member. Its state will again be toggled  by the 2nd member and then again by the 5th member, thus its state remaining unchanged. This is since the factors of 10 are (1,10) and (2,5)

 For locker number N where N =P*Q, and P and Q are same, i.e locker numbers which are perfect squares, there will only be one state change and hence are the ones which will remain open in the end.

Example, locker number 9. Its state will be changed by (1,9) member and again by the (3,3). But since the 3rd member can only toggle once, we can see that the state if the 9th locker will be open ultimately. Same for all perfect squared numbered locker till 100.

 



Posted by insidemyhead [Personal] ( July 20, 2007 12:50 PM ) Permalink | Comments[0]
http://blogs.sun.com/insidemyhead/date/20070717 Tuesday July 17, 2007

Locker Mania

There is a locker room in the club and they are numbered from 1 to 100. There are 100 members of the club who will enter the locker room in the following sequence. When the first member enters, he opens all the lockers. When the second member enters the locker room, he closes all even numbered lockers. When the next member enters the room, he toggles the state of every locker which is a multiple of 3.

 This process continues till all the 100 members have been through the locker room. At the end of this process, which are the lockers that are open?
 



Posted by insidemyhead [Personal] ( July 17, 2007 07:40 PM ) Permalink | Comments[4]
http://blogs.sun.com/insidemyhead/date/20070711 Wednesday July 11, 2007

Secure Remote Access (SRA) in 7.1

Sun Java Systems Enterprise Secure Remote Access version 7.x


The 7.0 release of Portal Server saw the introduction of the JMX Administration. All administrative interfaces in portal now used mbeans to manage the various servers and configuration. A single command line interface was provided for all the administrative activities ( viz. psadmin). The Portal Admin Server (PAS) is the admin server that holds all the configuration of the various mbeans known to the JMX Server. The PAS held its configuration/bootstrap information in LDAP.


Gateway, the main workhorse of Secure Remote Access (SRA) component of Sun's JES stack, resides in the DMZ ( De Militrized Zone) and hence doesnt or rather shouldn't have direct access to LDAP which is inside the corporate firewall. So as a workaround in 7.0 there was a requirement of installation of a local directory server on the Gateway host. This directory server was not required by the Gateway process per se, but was required to bootstrap the administrative interface of Portal Server (PAS). This local directory server contained only the bootstrap information to startup PAS and nothing else. Once the GW is started up using psadmin, this local directory server on the gateway node could very well be shut off and that wouldn't affect the gateway at all. This (installation of a local directory) however was a major restriction and was a big no no.


So in 7.1, release this restriction was done away with. The PAS module on the local gateway box uses a file based JNDI mechanism to load its configuration information and hence no need for a local LDAP on the gateway box. So far so good.

However it recently came to my attention that there was a bug in which it was reported that the LDAP port between GW and the Portal Server was required to be opened. I have traced the issue down and have done the fix for that. It should be checked in by EOD tomorrow. Once this fix is done in the code
base and the product patched with the fix, the flow of traffic from an administrative perspective should follow exactly the diagram below.


So in 7.1 the scenario, as far as the GW, Portal nodes and the firewall is concerned looks pretty much like this. Note this figure is only for as far as the administration of GW is concerned. What I mean by that is, executing of any SRA related psadmin commands on the gateway node. Once the step 8 is completed in the figure below, the gateway starts up and starts serving pages from the portal ( ofcourse the HTTP/HTTPS port for the portal server needs to be opened in the firewall as well, but like I mentioned the figure essentially talks about the admin interface only.)




Posted by insidemyhead [Personal] ( July 11, 2007 10:59 PM ) Permalink | Comments[1]
http://blogs.sun.com/insidemyhead/date/20070703 Tuesday July 03, 2007

Possible answer to the 123 black hole

Here is a explanation of the mathemagical black hole (123) in my opinion. If we consider the transformation on x as a function f(x), such that f(x) = E(x) O(x) T(x)

where E(x) = Number of even digits in x, O(x) = Number of odd digits in x and T(x) = Number of digits in x

Then for all x,

f(x) < x

So eventually as we recurse this process, at some point f(x) will fall below 1000. In that case the only possibilities for E(x) O(x) and T(x) are

1 2 3

2 1 3

3 0 3

Each of the above in the next iteration will give 123. Hence the proof. 



 



Posted by insidemyhead [Personal] ( July 03, 2007 02:39 PM ) Permalink | Comments[0]
http://blogs.sun.com/insidemyhead/date/20070702 Monday July 02, 2007

Another Mathemagical Black Hole

Read about another mathemagical black hole.. Really interesting one. 

Take any natural number, treat it as a string. For example: 24,89,62,698.

  1. Count the number of even digits. In this case 7 even digits.
  2. Count the number of odd digits. In this case 2
  3. Count the total number of digits. In this case 9

So the new number now is 729. Repeat the above process. Even digits (1), odd digits (2), total digits (3). So the new number is 123. And now any more iterations will return 123 only. So in this case 123 is the mathemagical black hole.

 All numbers in this universe are drawn to the number 123 by this process. Never to escape. Try it out.




Posted by insidemyhead [Personal] ( July 02, 2007 07:49 PM ) Permalink | Comments[0]
http://blogs.sun.com/insidemyhead/date/20070625 Monday June 25, 2007

A Solution: Playing with numbers

Consider the original binary bits, keep the bits in pairs of 2 for beginning. 

First set each 2-bit field equal to the sum of the two single bits that were originally in the field. Then sum adjacent 2-bit fields, putting the results in each 4-bit field, and so on. The original problem (summing 16 bits) is divided into two problems (summing 8 bits), which are solved separately, and the results are added. The strategy is applied recursively, breaking the 8-bit fields into 4-bit fields, and so on.

So solving the above problem, the original number is 0xCF39. Write it down as binary keeping adjacent bit together as below.

11 00 11 11 00 11 10 01


As indicated earlier, sum up the pairs above (binary) and put the results back in the individual two bit fields as follows.

10 00 10 10 00 10 01 01


Now combine these numbers in blocks of 4 as follows and repeate the process of summing the two two bit numbers and putting the result back in the 4 bit fields as below.

1000 1010 0010 0101
0010 0100 0010 0010


Next, repeat the process by pairing the numbers in blocks of 8 and adding the two 4 bit numbers and placing the result back in the 8 bit block as below.

00100100 00100010
00000110 00000100


And lastly repeat the process by adding the two 8 bit numbers above and placing the result in the 16 bits as below and that is the sum of all the

1's in your original number i.e 0xCF39


0000000000001010   ----> Decimal 10.


The above strategy makes the original problem of summing 1's in a 16 digit number complete in 4 discrete steps. Point to note is that each of these steps of determining adjacent bits and summing them at each step can be done in parallel. Hence making the operation an order 4 operation ( i.e Log 2 (16) = 4 steps ).

 It should be easy to write this recursive loop in any decent high level language... give it a shot!
 



Posted by insidemyhead [Personal] ( June 25, 2007 11:40 AM ) Permalink | Comments[0]
http://blogs.sun.com/insidemyhead/date/20070621 Thursday June 21, 2007

Playing with numbers.

Consider that you have a 32 bit machine and you have a number such as say Hex CF39. How would you go about counting the number of 1's in the binary representation of this number? In other words, the binary representation of CF39 is 1100111100111001. What is needed is a way to count the number of 1's in this number i.e the answer should be 10.[ Your 32 bit machine doesn't have an instruction that can do this :-) ]



Posted by insidemyhead [Personal] ( June 21, 2007 10:06 AM ) Permalink | Comments[1]
http://blogs.sun.com/insidemyhead/date/20070327 Tuesday March 27, 2007

Mathematical Black Hole

A mathematical black hole is, defined non mathematically, any number to which other elements (usually numbers) are drawn by some stated process. Though the number itself is the star of the show, the real trick is in finding interesting processes which make this "star".

Following is one example of the Mathemagical Black Hole by Martin Gardner. Take any whole number and write out its numeral in English, such as FIVE for the usual 5. Count the number of characters in the spelling. In this case, it is 4 — or FOUR. Number of characters in the spelling is 4. Repeat with 4 to get 4 again. So here the number 4 is the mathemagical black hole.

Just to prove it is not a lie, Another example lets take the number 155.
ONE HUNDRED FIFTY FIVE : Number of characters = 19
NINETEEN : Number of characters = 8
EIGHT : Number of characters = 5
FIVE : Number of characters = 4

And we repeat from here. Interesting!



Posted by insidemyhead [Personal] ( March 27, 2007 11:46 AM ) Permalink | Comments[1]
http://blogs.sun.com/insidemyhead/date/20070321 Wednesday March 21, 2007

Personal Blog Site

I added a bookmark for my personal blog at the right of the page. Visit it here



Posted by insidemyhead [Personal] ( March 21, 2007 03:44 PM ) Permalink | Comments[0]