09 December 2014

Mastering Regular Expressions, 3rd Edition Understand Your Data and Be More Productive, Jeffrey E.F. Friedl


Mastering Regular Expressions, 3rd Edition
Understand Your Data and Be More Productive
By Jeffrey E.F. Friedl
Publisher: O'Reilly Media
Final Release Date: August 2006
Pages: 544

Comprehending RegExp:

This is a classic regexp book !!!
that every programmer must read.

Even, if you already manage regexp, and took a compiler course at college, still there are several tips that may help you a lot in this area, including bounding cases: Greediness and Laziness Always Favor a Match, Speed and Efficiency, Summary: NFA and DFA in Comparison, Among others good titles (details of lookahead, lookbehinds, Posix regexps, etc.).

Also, provides some common examples that each coder must face in several projects: recognition of IP address, emails, etc., although this is not a cookbook, always is useful to see coding examples after theory However this is likelihood not as important as was 10 years ago (because there is a lot of examples in the net and cookbooks).  A look to how to add benchmarking in different platforms -languages- and optimization for regexps. As usual, you can go directly to any chapter related to your favorite implementation/language.

Perhaps, after eight years, it could consider some current RE frameworks, including those that use NFA, such us, ICU Regular Expressions, Automaton, etc. (this way the spectrum of examples is better). Although this paradigm of  never-ending engines are commented in the book, always is good to have an update (well, at least after five years).

20 November 2014

If Hemingway Wrote JavaScript, Angus Croll


If Hemingway Wrote JavaScript
By Angus Croll
Publisher: No Starch Press
Final Release Date: October 2014
Pages: 192
This book has an Interesting proposal, art is an important part of this book, an hybrid release, thinking out-of-the-box.

It express that Javascript is more creative/dynamic than Java (for instance), which makes it a little more risky ? :-) . Nice to read these conjectures in a book, beyond the common book prototype avoiding the structured order we see in a programming book (training us to be into a factory as creator of code (developer).

It gives classical assignments of an introductory programming course; using Javascript, which is the de-facto language for novice coders.

A good sense of humor has the author and must have the reader (well... geek humor), it gives ludic analysis to simple snippet codes. Giving an implicit criticism to the authors' work.

One way to open your mind, and probably a must have coffee table book.

It maximize the way to do the same task with different approaches with a versatile language. Again: more than a laugh we can get here.

I humbling reckon that several authors I didn’t know…. from this point of view, it helped me (forced me) to learn more about universal literature. It is amusing to see Roberto Bolaño as a Javascript coder ;-) 

05 November 2014

Software Architecture Fundamentals, Part 1, Understanding the Basics, Video, Neal Ford, Mark Richards


Software Architecture Fundamentals Part 1
Understanding the Basics
By Neal Ford, Mark Richards

http://shop.oreilly.com/product/110000195.do


Extensive video from two known Architects (book Authors: Neal Ford, Mark Richards) coaching about their experience and providing best practices and analyzing study cases in how to become a Software Architect.

It goes straight to the point, why do you want to become an Architect: better income, finally better salaries makes some roles more interesting, and what it requires for it.


It has plenty of good sentences, Some of of them:
  • "Often Negotiation and politics skills are more important than Technical Skills"
  • "The world best architectures are not the perfect ones, but rather the feasible ones"
  • "Design Patterns often have different approach to Functional Thinking"

Also it's discussed: documentation is very important, as seen in different paradigms, and college courses, however, as Agile manifesto mentions: "Working software over comprehensive documentation", then "codebase is the core":
  • "our blue print is the source code"
  • "compilation is building"
  • "software design is expensive"

So, the idea is to reflex about how to build easily and in a cheap way, coding is a complex task and very easily to obtain a wrong artifact.


As seen, this video gives full a great feedback, where many times I had to stop a replay many passages.

In the other hand, there is a great emphasis about soft skills, politics, and how a project can be feasible regarding these features.

At the end, an excellent introduction to different aspects of Software Architecture, including its different specialization, but always keeping a big picture view.

Corollary: Very clever coaching.

11 October 2014

17 September 2014

Eclipse: HTTP Proxy Authentication Required

Eclipse Luna 4.4.0 has a bug when using Proxy to contact to Internet:
(upgrade to 4.4.1 --> Luna SR1)

i.e.:
HTTP Proxy Authentication Required: http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/compositeContent.xml
HTTP Proxy Authentication Required: http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/compositeContent.xml
Proxy Authentication Required

This is a known bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=422665
https://www.eclipse.org/forums/index.php/t/783720/

A functional workaround is:
(provided in the first URL)

Scott Lewis CLA 2014-07-08 17:51:00 EDT
I've created an updated version of the ECF httpclient4 provider that uses Apache
Httpclient 4.1 (used in Kepler) rather than Apache Httpclient 4.2 (used in Luna 
and the apparent source of this regression).

For those that are experiencing this proxy problem, this update may allow you to
 use your proxy, especially if Kepler (Apache 4.1) install/update worked for you.
 If it *does* work in some of your environments, then it would suggest that the problem
 is not with proxy configuration, but rather with Apache httpclient 4.2 deployed as part
 of Luna.  OTOH if this does not fix things for you, then it may very well be a
 configuration issue.

Disclaimer:  Installing this update, and going back to using an older version of
 httpclient4, could break other plugins.  Even if it works in your environment, 
please do not use it in a production environment unless you are quite sure that
 nothing else is broken by it (e.g. Mylyn).  Also, this repo is not signed so please
 do not redistribute it.  If you are not experiencing any problem wrt this bug,
 please do not install it.

People on this bug who install and try this in their proxy environment please report
 back with what happens via a new comment on this bug.   Since I do not have an
 environment to reproduce this apparent httpclient4 version-specific problem, I must 
depend upon people on this bug that do have such an environment for diagnosis.

Instructions for installation:

1) Download this zip:

http://download.eclipse.org/rt/ecf/httpclient4/org.eclipse.ecf.provider.httpclient4_3.9.0.zip

2) Unzip the contents to your local disk

3) Start Eclipse Luna.  

4) Choose Help->Install New Software->Add...

5) Name:  ECF 3.9.0 Httpclient4 Update

6) Select Local... button on right and navigate your local filesystem to where
 you unzipped the contents to in step 2

7) Navigate into the /archive/site.p2 directory and choose OK

8) There should be a single 'Uncategorized' item in the user Install dialog.
 Select this check box (and all sub-items)

9) Choose Next and step through the remaining wizard pages to finish the install

10) Restart Eclipse when prompted

Then please try to install something into Eclipse.  Whether this works for you
 or not, it would be helpful for you to report your experiences here with as
 much detail as possible.

Thanks.
 




15 September 2014

JDK8 in WinXP

 As we all know JDK8 installer doesn't work in WinXP.
This is the best solution found at stackoverflow.com :

http://stackoverflow.com/questions/20965564/installing-jdk8-on-windows-xp-advapi32-dll-error#tab-top

This happens because Oracle dropped support for Windows XP (which doesn't have RegDeleteKeyExA used by the installer in its ADVAPI32.DLL by the way) as described in http://mail.openjdk.java.net/pipermail/openjfx-dev/2013-July/009005.html. Yet while the official support for XP has ended, the Java binaries are still (as of Java 8u20 EA b05 at least) XP-compatible - only the installer isn't...
Because of that, the solution is actually quite easy:
  1. get 7-zip (or any other quality archiver), unpack the distribution .exe manually, it has one .zip file inside of it (tools.zip), extract it too,
  2. use unpack200 from JDK8 to unpack all .pack files to .jar files (older unpacks won't work properly); JAVA_HOME environment variable should be set to your Java unpack root, e.g. "C:\Program Files\Java\jdk8" - you can specify it implicitly by e.g.
    SET JAVA_HOME=C:\Program Files\Java\jdk8
    • Unpack all files with a single command (in batch file):
      FOR /R %%f IN (*.pack) DO "%JAVA_HOME%\bin\unpack200.exe" -r -v "%%f" "%%~pf%%~nf.jar"
    • Unpack all files with a single command (command line from JRE root):
      FOR /R %f IN (*.pack) DO "bin\unpack200.exe" -r -v "%f" "%~pf%~nf.jar"
    • Unpack by manually locating the files and unpacking them one-by-one:
      %JAVA_HOME%\bin\unpack200 -r packname.pack packname.jar
    where packname is for example rt
  3. point the tool you want to use (e.g. Netbeans) to the %JAVA_HOME% and you're good to go.
Note: you probably shouldn't do this just to use Java 8 in your web browser or for any similar reason (installing JRE 8 comes to mind); security flaws in early updates of major Java version releases are (mind me) legendary, and adding to that no real support for neither XP nor Java 8 on XP only makes matters much worse. Not to mention you usually don't need Java in your browser (see e.g. http://nakedsecurity.sophos.com/2013/01/15/disable-java-browsers-homeland-security/ - the topic is already covered on many pages, just Google it if you require further info). In any case, AFAIK the only thing required to apply this procedure to JRE is to change some of the paths specified above from \bin\ to \lib\ (the file placement in installer directory tree is a bit different) - yet I strongly advise against doing it.

See also: How can I get the latest JRE / JDK as a zip file rather than EXE or MSI installer?, JRE 1.7 returns: java/lang/NoClassDefFoundError: java/lang/Object

----------------

From
https://blogs.oracle.com/henrik/entry/the_future_of_java_on

Q: Can I install JDK 8 on Windows XP? Will it work?
A: The installer does not work on Windows XP. You can unpack it manually and it will likely run fine.


Project Euler #125

It is interesting how I analyzed this problem --> first attempt was doing an horrible brute force which  would take milliards of years to complete.

Classical problem, where I had to re-design the solution, after getting a couple of "duplicate numbers" (also incorporated to the problem). Simple & Hard. This is the taxonomy of problems I must create.

My performance is a little slow:

Last 10 Problems Solved

1 Problem 12511 Sep 14 (14:56)
2 Problem 10211 Jan 14 (13:58)

09 September 2014

OC4J: precompiling JSP

JSPs can be precompiled by OC4J tool: ojspc
http://sqltech.cl/doc/oas10gR31/web.1013/b28961/ojspc.htm

Similar to my last post for WLS:

ojspc -verbose -addclasspath D:\web-oc4j-v3\dist\foo.jar;D:\web-oc4j-v3\dist\lib\bar.jar qux.jsp

As, you can see you need to add libraries to "addclasspath" and the jsp file, or wildcard.

Remember to define environment local variables:

i.e.:

set JAVA_HOME=C:\oracle\jdk150_11
set ORACLE_HOME=D:\oracle\oc4j_extended_101340
set PATH=%ORACLE_HOME%\j2ee\home\jsp\bin;%PATH%
set PATH=%JAVA_HOME%\bin;%PATH%


02 September 2014

WLS: Precompile ear/war EJB/JSP

WLS has a very useful tool to precompile EJBs and JSPs so we can avoid extra overhead at runtime on the container.

It is called APPC, this tool calls underneath to jspc and ejbc to achieve this task.
http://docs.oracle.com/cd/E17904_01/web.1111/e13719/appc_ejbc.htm#EJBPG1088

After calling setDomainEnv.sh (.cmd) we can execute directly: weblogic.appc [files]

Also, we can compile only JSPs files with: weblogic.jspc [files]
http://docs.oracle.com/cd/E17904_01/web.1111/e13712/reference.htm#i57791

It is recommended to use it at development time as well, so we can hit compilation errors before the first request on the web container.

It exists the Ant task as well: wlapcc

Sample:

java weblogic.jspc -forceGeneration -keepgenerated -verboseJspc -d d:\tmp\export\ -classpath .;D:\proj\webapp-wl-v4\web\WEB-INF\classes;D:\proj\webapp-wl-v4\foo.jar;D:\proj\webapp-wl-v4\lib\bar.jar index.jsp




19 August 2014

Spring in WLS 12.1.3

Support for Spring Framework on WebLogic Server 12.1.3

WebLogic Server 12.1.3 supports the WebLogic Server/Spring integration features described in this document with Spring Framework versions 3.0.x, 3.1.x, and 4.0.x (note that version 3.2.x is not supported).

Other versions of Spring may be used in WebLogic Server applications without using the integration features described in this document, similar to the way other open source technologies may be used in WebLogic Server applications. In such cases, Oracle does not support the WebLogic Server/Spring integration features, but does provide support for WebLogic Server itself, and does provide problem resolution assistance if WebLogic Server is not providing documented capabilities.

http://docs.oracle.com/middleware/1213/wls/SPRNG/intro.htm#BHCDGJFA

29 July 2014

JVM for VisualVM

When trying to execute VisualVM you may get:




Cannot find Java 1.7 or higher.
(for 1.3.8)
or

Cannot find Java 1.6 or higher.
 (for 1.3.4)

VisualVM only takes parameters form JVM through arguments or values given at:

visualvm_138/etc/visualvm.conf
(/Applications/VisualVM.app/Contents/Resources/visualvm/etc)

# Default location of JDK:
#
# It can be overridden on command line by using --jdkhome



# Be careful when changing jdkhome.
# There are two VisualVM launchers for Windows (32-bit and 64-bit) and
# installer points to one of those in the VisualVM application shortcut
# based on the Java version selected at installation time.
#
#visualvm_jdkhome="/path/to/jdk"


Modify :

visualvm_jdkhome="/path/to/jdk"

to your JDK path.

i.e.:

visualvm_jdkhome=C:\oracle\jdk1.7.0_45

visualvm_jdkhome=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home


This is the same for Netbeans 8.0.1 Portable, but the variable is called: netbeans_jdkhome

- log can be retrieve by:
visualvm -J-Djava.util.logging.config.file=${path_to_jdk_logging_config_file} 

or in the credits (about), there is a bottom to show the standard output (and path to it).

02 July 2014

WLS Server timeout: ServerLifeCycleTimeoutVal

I wasn't able to start correctly my Admin Server, and the following BEA message appeared in the log:
<BEA-000378> <Server failed to shutdown within the configured timeout of 30 seconds. The server process will exit now.>
 This is for MBean attribute: ServerLifeCycleTimeoutVal

That can be set as System Property at java startup  command line:

        -Dweblogic.ServerLifeCycleTimeoutVal=XXX

where XXX are seconds for timeout.

This can be also configured thru Admin Console at:
(increasing the Server LifeCycle Timeout before executing the force shutdown)

   Domain -> Environment -> Servers -> YOUR_SERVER -> Control --> Start/Stop



More details at:

http://docs.oracle.com/cd/E21764_01/apirefs.1111/e14397/T3Srvr.html
http://docs.oracle.com/cd/E21764_01/web.1111/e13708/server_life.htm
http://docs.oracle.com/cd/E17904_01/apirefs.1111/e13951/core/index.html

08 June 2014

N Is a Number: A Portrait of Paul Erdös (1993)

de George Paul Csicsery

Documental que habla de la vida del prolífico matemático Paul Erdös, su simpática excentricidad, reuniones con otros matemáticos alrededor del mundo en un época en la cual viajar tanto no era común.

Un húngaro judio sobreviviente de la segunda guerra donde la política también le importaba, pero como siempre la veia de una forma lúdica. Son varios cortos de conversaciones con él, sus anécdotas y la explicación de el coloquial Número de Erdös, con muy simples tomas de nivel amauter que sin duda lo hicieron otros colegas de él.

Del punto vista cineasta no atrae demasiado, pero si conocer de la vida de una de las grandes mentes matemáticas que ayudó a escribir más de 1500 papers y no es masivamente conocido.

26 May 2014

Distinctive Recipes, 2nd Ed.: 12.1.2 + 12.1.1 (and 10.3.x)

This is the Second Edition of Oracle WebLogic Server 12c: Distinctive Recipes: Architecture, Development and Administration, where new recipes are added and several have changed a lot, including differences from 12.1.1 (and 11g) to the new architectural design of 12.1.2 (and beyond based on the road-map).

After Oracle acquisition, WLS always was considered the main tool for Middleware, and several changes were planned for it, now it is the time and this book provides detailed recipes to take advantage of them and resolves issues in a practical and quick way.

Important new chapters from new features were added, related to Node Managers, JMS and Distributed Destinations, Cluster Targeted JMS, Server Templates, among others.

It is a new upgrade for WLS 12.1.2, including tips & tricks to get the best of this world class application container.

09 February 2014

Kadon Prize

I got another nice prize from Kadon Games !!!

The place where you can find incredible fun challenging puzzle games.


10 January 2014

Regular Expressions Cookbook: Errata

Nuevo errata encontrado, ahora es uno matemático de una fórmula mal escrita... me imagino que el autor sabia que poner, pero se tuvo que traspapelar la fórmula.

http://www.oreilly.com/catalog/errataunconfirmed.csp?isbn=0636920023630

Footnote 2:

If there are n characters between the double quote and the end of the string, the regex engine will try 2 1/n permutations of ‹ (?:[^"\r\n]+|"")* ›

----

it appears: 2^(1/n)
(this trends to 1, when n grows)

however, it must say 2^(n-1)
when n=4 the number of permutations is 8.
(thus, it has an exponential behaviour).

My Blog List

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.