05 May 2011

WLS: Listing Users and their Groups in a Security Realm

Many times I've seen the question about a WLST script for listing groups to which an user belongs.
(This works Oracle Weblogic Server - Version: 9.0 to 10.3.4)


Before running the script you need to set up the environment to your local WebLogic Server by invoking DOMAIN_NAME\bin\setDomainEnv.cmd (setDomainEnv.sh on UNIX), where DOMAIN_NAME is the directory in which you located the domain


You need to modify the line 6, where set the address, port, username and password of your WebLogic Server:

connect('weblogic','welcome1','t3://127.0.0.1:7001')

and run it with the following command line:

java weblogic.WLST groups_of_users.py
Listing groups_of_users.py:
from weblogic.management.security.authentication import UserReaderMBean
from weblogic.management.security.authentication import GroupReaderMBean
from weblogic.management.security.authentication import MemberGroupListerMBean

# connect to WLS with username/password = weblogic/welcome1
connect('weblogic','welcome1','t3://127.0.0.1:7001')

realm=cmo.getSecurityConfiguration().getDefaultRealm()
atns = realm.getAuthenticationProviders()

for i in atns:
  if isinstance(i,UserReaderMBean):
    userReader = i
    cursor = i.listUsers("*",0)
    # print '* Users in realm '+realm.getName()+' are: '
    while userReader.haveCurrent(cursor):
      # print userReader.getCurrentName(cursor)
      user = userReader.getCurrentName(cursor)

# init

      print ''

    # listings groups of user
      # print "Listing the groups of a '" + user +"'"
      atnr=cmo.getSecurityConfiguration().getDefaultRealm().lookupAuthenticationProvider("DefaultAuthenticator")
      # users? = OracleSystemUser, weblogic
      x = atnr.listMemberGroups(user)
      # print x

      # new pointers for better understanding
      groupReader = atnr
      cursor2 = x
      print "* Groups in user '" + user + "' are: "
      while groupReader.haveCurrent(cursor2):
        print groupReader.getCurrentName(cursor2)
        groupReader.advance(cursor2)
      groupReader.close(cursor2)

# end      
      
      userReader.advance(cursor)
    userReader.close(cursor)
  


Then you will get a similar output to:

* Groups in user 'weblogic' are:
Administrators

* Groups in user 'usertest1' are:
AppTesters
Monitors

25 February 2011

El Rey de e (5x5)

Un nuevo cuadrado encontrado, ahora con 95 dígitos:

2,7182818284590452353602874713526624977572470936999595749669676277240766303535547594571382178525

7 2 0 6 2
1 8 5 5 3
3 7 4 0 9
5 2 7 9 3
6 6 5 6 6

28 December 2010

Dijkstra: My small tribute

for over four decades  mailed copies of his consecutively numbered technical notes, trip reports, insightful observations, and pungent commentaries, known collectively as "EWDs" [1]. This is a great project that has been running for years to transcribed by hand all the already scanned EWD.

I have transcribed two of several  EWD documents that remains for that task; more than a contribution to knowledge (by my side), this is a small tribute to this great computer scientist.

If you feel with time to support in the same way (or proofreading as well), please try visiting the Archive website.

[1] http://www.cs.utexas.edu/users/EWD/

16 December 2010

UML: mal entendimiento

He visto bastante en la escena productiva un mal entendimiento de UML, poniendo 2 posturas opuestas extremas, tal como:
  1. Los que creen que es la panacea
  2. Los que la odian 

Los del primer grupo creen que a base de la primera creen que al usar tal herramienta el proyecto va ser exitoso y todo funcionara.

Los del segundo grupo creen que es basura (muchas veces teniendo la misma base erronea del primer grupo, que es supuesta panacea), porque no les genero el esquelo completo de su diseño de patrones/clases

Generalmente ocurre lo que no se entiende no gusta, ha sucedido siempre en la historia de la civilización, pero acá podemos rescatar algunas buenas practicas para poder usar esta nomenclatura en vez de seguir neófito.

Lo que NO es:

  1. No es la panacea
  2. Por lo mismo no te entregara todas las clases (si tienen un buen diseñador/analista con experiencia en programación y patrones de diseño puede entregar algo robusto, pero siempre tendrá algo que falta y esas iteraciones deberán hacerla el programador, obviamente todo esto funciona si los requerimientos iniciales se hicieron bien y no se ha cambiado en el tiempo). 
Lo que Si es:

  1. Estandariza la nomenclatura
  2. Explica de forma simple ciertas especificaciones como con casos de uso y de secuencia para todo usuario y programadores respectivamente. 

por otro lado simple hay alguna manera de poder especificar guarismos, es más, Meyer y otros ya lo han hecho, lo malo de UML que es propietario, pero se alineo con OMG asi que es el mejor/último esfuerzo que se ha hecho de tal manera que la documentación sea estándar al contratar a Jacobson e IBM comprar a Rational.

-- (15/10/08).



Después de haber escrito el pasado texto hace ya 2 años, veo que Fowler tiene un punto de vista bastante parecido donde me llama mucho la atención los siguientes párrafos:
Changing the design doesn't necessarily mean changing the diagrams. It's perfectly reasonable to draw diagrams that help you understand the design and then throw the diagrams away. Drawing them helped, and that is enough to make them worthwhile. They don't have to become permanent artifacts. The best UML diagrams are not artifacts.

A lot of XPers use CRC cards. That's not in conflict with UML. I use a mix of CRC and UML all the time, using whichever technique is most useful for the job at hand.
 Bueno lo escribió el 2004 :-)

-- (15/12/10)

13 December 2010

EJB 3.0 Database Persistence with Oracle Fusion Middleware 11g : Review

This is a good book (→tutorial) for any developer that wants to use EJB 3.0 with the most popular Oracle J2EE technologies.

The book starts with a simple introduction of EJB 3.0 and compares that spec to EJB 2.x, overviews new features such as, annotations, JPA and interceptors.

Then it goes into this topic in depth, always tied-up to JDeveloper; for instance, shows how to convert EJB 2.x to 3.0, it's a very good example if the reader comes from that legacy specification or to see explicitly how much effort we are saving coding and not generating deploy descriptors to obtain the same business/architecture JEE feature.

Continuing the Book's Oracle point of view, look into EclipseLink JPA, JDeveloper (as main IDE) and complete chapter of Eclipse OEPE and their details. Chapters dedicated to integration with ADF & JSF separately, EJB relationships, and finishing with Web Services.

A lot of details, clear explanations, source code, screen-shots of step-by-step instructions to avoid any doubt to the reader to get the best of these specs and tools.

11 December 2010

Lazy initialization

http://en.wikipedia.org/wiki/Lazy_initialization

from GoF:

You can avoid this by being careful to access products solely through accessor operations that create the product on demand. Instead of creating the concrete product in the constructor, the constructor merely initializes it to 0. The accessor returns the product. But first it checks to make sure the product exists, and if it doesn't, the accessor creates it. This technique is sometimes called lazy initialization. The following code shows a typical implementation:

class Creator {
public:
Product* GetProduct();
protected:
virtual Product* CreateProduct();
private:
Product* _product;
};

Product* Creator::GetProduct () {
if (_product == 0) {
_product = CreateProduct();
}
return _product;




--
Atte.

German Gonzalez

06 December 2010

CWEB en Español

Después de varios meses de trabajo, he podido terminar de traducir a Castellano The CWEB System of Structured Documentation de Donald Knuth.

Fue una tarea bastante ardua, más de lo que imagine ya que hay muchas frases técnicas (de tipografía) y sobre todo con mucha información tácita.

Se puede bajar desde el mismo sitio del Prof. Knuth: http://www-cs-faculty.stanford.edu/~knuth/cweb.html

Si alguien tiene comentarios, sugerencias para el documento, por favor diganmelo.

23 November 2010

Liar, Liar: Solved - FaceBook Puzzles

I have solved the first problem of Facebook Engineering Puzzles (Snack difficulty). It took me more time that I've planned, as usual, being a blackbox is harder to reach a solution.

Right now the robot has problems to receive emails from gmail (using the webmail app), therefore the solution is to send the solution through a script that uses SMTP.

This is the email sent by the robot:
Thank you for your submission of a puzzle solution to Facebook! After running your solution to liarliar (received on November 22, 2010, 9:24 am), I have determined it to be correct. Your solution ran for 1400.789 ms on its longest test case. If you have not already, try installing the official Facebook Puzzles application from http://apps.facebook.com/facebookpuzzles/ and publish a story about your solution! To publish, just go to http://apps.facebook.com/facebookpuzzles/mypuzzles.php and click on the publish link.

If you are applying for a position within Facebook, the puzzle difficulty solved will be taken into account with regards to how much time you had available to solve it (remember that Hors D'oeuvres are only tests for your benefit). I have taken the liberty of alerting our recruiting team about your success. Best of luck!

Sincerely,
-The puzzle robot

23 September 2010

Kludge

Después de haber traducido un documento de Knuth, muchas palabras interesantes me llamaron la atención, entre otras fue kludge que significa una solución no inteligente a un problema en ingeniería, en este caso particular de computación.

UPDATE1 (2016.01.25): Que es diferente a la palabra que intenta crear (y popularizar) en honor a Turing:
"Nomenclaturing: Let's Ture to the Max!"
http://www-cs-faculty.stanford.edu/~uno/news12.html


25 August 2010

Falsos Amigos Em Português

Después de estudiar Português por 1 año, pude hacer mi lista de vocabulario y donde me sorprendio varios aspectos de este idioma, entre otros la gran cantidad de amigos falsos que existen entre Castellano y Portugués:

PortuguêsCastellano
acordardespertar
acordedespertar
apagarapagar, borrar
apelidosobrenombre
asaala de avion, pajaro
asasalas
assim queapenas (apenas pueda)
assistever, ir
baterpegar
batirlater
bilhetebillete, boleto, papeleta
biscoitogalleta
bistecbife
boloqueque
bolsacartera
borrachogoma (caucho)
cabocable
cachorroperro
cafe de manhadesayuno
cafe passadocafe de maquina
calçapantalon
carterabilletera (de hombre)
casacochaqueta mujer
cenaescena
costasespalda
criado-mudovelador
dadosdatos
decoraraprender de memoria, memorizar
descargatirar cadena
deslocadadislocada, desplazado
despidadesnuda
dirigirmanejar, conducir
distintadistinguida
encomendarencargar
enganoequivocado
escritoriooficina
feiraferia
feriadía de la semana, descanso
fracadébil
irritadaenojada, molesta
latirladrar
malamaleta
massapasta
mesmorealmente
mesmo queaunque
montemontón
moralmoraleja
ondaola
palavrãogarabato
pastapaté
pasteisempanada fritas
pegartomar
perdurarcolgar
pimentaaji
pincelisopo
presuntojamón
prontolisto, acabar
pulsomuñeca
que logode pronto
romancistanovelista
ruviapelirroja
secasequia, secado
segundosegún, segundo
senhacontraseña
serenasirena
sinocampana
sobre tudocasaca
sobremesapostre
sobrenomeapellido
solosuelo
telapantalla, televisor
termotérmino
tirarquitar, sacar
tomara queojala
tonturamareo
traçoguión
tragatraiga
vasoescusado, macetero
veiavena

Blog Archive

Disclaimer

Qux