Google library for Java logging? [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
This post was edited and submitted for review last year and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
Is there a Java Logging Library from Google?
I have been using the Google Guava library and find it much more usable than Apache Commons for argument validation (i.e. checking preconditions, invariant object state, conveniently throwing the right Exception type on null, empty String, inlining null checks with assignments, Exception message formatting and specialised typing of nullable types). I have not looked at other features of the library but this was enough for me to switch.
Now the very natural question:
I am doing my logging using Apache Commons Logging, as I was doing for argument validation. Is there a similar "this goes to 11" of the framework from Google that I could switch to, with compound benefits? I don't mind either Log4j or Commons but Guava is so much better than Commons in the aspects I have studied...
I see Android has its logging framework, which I like, does Google offer one for basic Java too?
EDIT: Re-reading my question I realise it may somehow hint to a dogmatic preference for Google code, which I do not have, and an underlying assumption that anything that comes out of Google will be by definition "perfect". I do not hold these "positive preconceptions" at all, what I meant but failed to convey in writing, is that there may be some synergies in adopting a single provider for the two layers. There may be something that intelligently logs, for example, a Guava Optional object or associated object, saving time in constructing specific String.format()s. I was looking for a Google library to leverage these potential synergies not out of a priori preference. I did, in fact, first compare Guava to my old Commons-based way of argument checking before deciding to switch. All things considered, I do appreciate very much the code Google releases for free and I think I have learnt a lot from it and will continue to do so, given its very high quality. I never allowed this to become a cult, though.
References:
Apache Commons Logging
Google Guava

Commons Logging is best avoided. See http://articles.qos.ch/thinkAgain.html for a thorough analysis. Yes, it's very old (and yes, author has a vested interest) but it all applies. The linked 'Commons Logging was my fault' illustrates - there is really not much love for this library - anywhere.
Apparently, Google's preferred solution is java.util.logging. You will see this if you do Java programming on Google App Engine.
The best standard is slf4j over logback. There is no reason to avoid it I think. You will quite possibly be using slf4j already - if not directly then indirectly via other libraries on your classpath - it is the de facto modern standard.

Not that I know of. I recommend using slf4j.

Related

how to protect sensitive data in java [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I am looking for suggestions on tools/methods can be used to make sure , in java source code, sensitive information (like user password) is not accidentally been logged/printout .
You may specify some keywords for your critical variables and for their code behaviours.
After that, you need to install findbugs plug-in and you may create a custom bug detector.
Before you publish the app, run findbugs. It checks bugs and find them if exist.
Some examples are here :
http://lifelongprogrammer.blogspot.com.tr/2013/05/extending-findbugs-creating-our.html
http://www.danielschneller.com/2007/04/findbugs-writing-custom-detectors-part.html
http://findbugs.sourceforge.net/
Any other approach to protect your code, you have to obfusticate your code. (Not to printouts or logs, to protect your source code)
Good luck.
The do that you should be used some kind of Static Analysis tool. And check in their rule set.
For sure this kind of functionality is provided by Jtest (that is commercial tool). You can look on the FindBugs or even SonarQube.
For sure the tools will not be perfect and will not detect. The will try to be help full as much as possible.
But to 100% the best is the rule of four eyes. A code review by other developer might help. The Static Analysis tool should be treated as guardians for so called stupid mistake. A stupid mistake can be defined that is obvious when is pointed out. Everyone do them, so event having a review and general awareness in team there is chance to miss something.
From the code point of view, you want to be compartmentalising as much as reasonably possible. In static terms, the area of code that could access the sensitive information should be minimised. More importantly, scope of data should be minimised. In particular, no globals. No even logging. ("But logging is special!" No it isn't.) IIRC, "Growing Object-Oriented Software Guided by Tests" by Freeman and Pryce touches on what they call "auditing" rather static ad hoc loggers.
Everyone tests these days. A relevant testing technique is to use a known value for the sensitive data and mechanically search through files and network communications for that specific sequence.
If the format of the data is well defined, say credit card numbers, then this data can be scrubbed from the text output to log/audit files. It's not something that you would want to in anyway rely upon, but it could just save you.
There are no tools that can possibly automate that.
Instead, you need to have proper procedures in place for things like code reviews, and awareness among your programmers.
Just curious, how do you imagine such a tool working? How would it magically detect that something is sensitive and to what degree, and whether what's being done with it is or is not allowed?

Rewriting old/deprecated code java [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
The company I work at has a piece of code they would like to rewrite. It uses Java/Java server faces. The problems with it are that it is old and uses depreciated code, was written in an IDE that is no longer available and doesn't work well with netbeans, and that it is kind of sloppy coding in the first place. No one really knows its structure and there is limited documentation.
Before beginning on the rewrite, we would like to find the structure of the old program and get a decent UML diagram. What tools would work the best in this situation? So far we have looked at one called Agilej.
Sorry if this is a little vague, I'm just a lowly intern an haven't been filled in on everything yet =p
You can use JArchitect, a pretty complete java static analysis tool
I'm not giving clickable hyperlinks as you should be able to find them easily through a web search and there may be more than 1 link that is useful for you
Sparx Systems Enterprise Architect has very powerful reverse engineering capabilities. Java (also compiled binary JAR) is in the list of supported languages.
I have used Enterprise Architect's reverse engineering features several years ago to help us understand and design modifications of legacy C++, QT code.
Enterprise Architect was able to automatically retrieve the class model. I then used the raw class model to drag/drop draw several other diagrams including only classes of my interest with level of detail I needed etc.
In the range of other static code analysis tools (e.g. the code flow visualization) I don't know which tool particularly supports Java well enough. Quick Google points e.g. to Coder Gears JArchitect. In the past project I have mentioned we used Doxygen's automatically generated documentation. Part of that were also some automatically generated graphviz dependency diagrams.
To clarify the design and visualize the flow (especially big legacy functions) I have found useful the Rapid Quality Systems Code Rocket flow visualizer
Once you get the basic facts at your hands through the various reverse engineering tools next step would be to go through them, annotate what is the unknown, what is doing what, basically apply some formal code review method (e.g. Fagan inspection or some of its derivatives).
(using evaluation versions of the various tools may be enough if you think ahead what are the required deliverables for your follow up actions. I guess the company is not planing to give you a >0$ budget)
The Agile Modeling site may have some good refactoring tips and some minimal UML mapping guidelines, start e.g. at Agile Legacy System Analysis and Integration Modeling

What is your recommended tool suite for internationalization of a complex multi-module java application? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am currently doing an intership in a company and my task is to reevaluate the tool suite used to translate applications as it has become a problem internally. I've looked everywhere on the web and my conclusion is there is just no proper documented end to end workflow for this type of task, so I am asking the community to help me understand what they have seen in the field.
Our current flow looks like this:
java, properties files and resource bundles in the code
custom made tool to extract keys from code based on classes. bit clunky, as it uses class loading and therefore has many practical constraints
custom made web tool to do translations and handle code revisions
Here are some constraints and improvements we're looking towards:
we'd like for external translators to help us for additional languages our company cannot handle
we would like to add metadata to translation keys, such as validation flags, categorization data and description data, something not handled by properties files
we're going to have external translators and would wish to be able to use standards where possible to properly integrate with their tools
Here's what I've found on the web:
GNU Gettext's plural handling and context messages are nice. However, our existing code is written using keys and would not work with writing plain english messages in the code.
XLIFF provides means to have all the extra metadata we would like to add. However, all existing tools are either incomplete, buggy, or costly. Many of the tools add their own metadata which complicates working with XLIFF.
Pootle pretty much does what our custom made web tool does except fails to work on multiple Git branches.
Weblate, which is similar to Pootle, has the ability to work on multiple Git branches. However, updating a project with many languages and many translations takes time. It fails to meet our needs of continuous development.
So what is your recommended tool suite for internationalization of a complex multi-module java application?
Gettext (.po) is possible by a two stage key: key -> English, English as key. Disambiguation can be done with the original key. The original key can be preserved.
Gettext seems to be more extensively used than XLIFF - but I may be wrong meanwhile.
Web interfaces are fine - as a secondary tool. Translation agencies will complain when offered such a thing.
I cannot stress sufficiently that the delivery of the text is very important, to prevent that every translator has to do extra work. Almost the same text that might be united is such an example. A Translation Memory might give a fuzzy translation, but it is better to do processing by someone dedicated, before delivering things to translate. Also things like "Select from the menu 'Process thumbleweed'" and "Process thumbleweed" could well need a translation responsible person, to have coherent translations. XLIFF might offer more technicalities, but in general I think it is best to let an experienced developer ensure, develop this process. A common glossary of specific terms.
Also being able to have the application switch between showing a specific language and the key "[key]".
How about Tapiji? Not sure if it will meet all your requirements, but it is a time saver. If you are using Eclipse, or can use it, it might be worth a look. From the site:
The implemented editor is based on the Babel Messages Editor Resource-Bundle editor, which considers the whole Resource-Bundle as the object under modification instead of a single property file. Furthermore, a Resource-Bundle view adds rich functionality for browsing resources and directly comparing different languages. In parallel, RCP and RAP based stand-alone applications enable the translation of resources without the need of programming skills.
Weblate indeed is not the fastest tool for import (but there are many improvements in the upcoming 1.6 release), but there are several hints in the documentation how to improve this. Have you tried those?

Is there any statistical library for javascript? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I need to implement some statistical tests like: T-test, Anova and Wilcoxon on javascript.
Similar to Java's - Apache Commons Math Library, is there any statistical tests library or codes for javascript?
jStat : a JavaScript statistical library
https://github.com/jstat/jstat
OpenEpi is a Javascript stats library, is open source, and has ANOVA and t-tests. I've not tried it (it's a bit too focused on epidemiology for my needs) but it might be useful.
jStat is a javascript statistical library project, and it looks like it's got a great future, but it might not have all you need right now. Edit: as of Dec 2012 it looks like the jStat project page is no longer maintained but the project is continuing to be developed. There's more up to date documentation on github. It now does have anova tests and varieties of t-test. No sign of Wilcoxon signed-rank though.
If you need very specific statistical processing in javascript urgently, you might have most success by browsing Omegahat who have various little tools that bridge the established stats language R with others including javascript.
It'll depend on the details of exactly what you want to do, but you might have some success with packages such as RJavascript - a code translator which aims to help turn existing R features into Javascript (just don't expect quality results first time). Also, SpiderMonkey builds on R for browsers, so it might be useful for internal or personal uses (but it's unlikely to be suitable for public publishing).
Some years ago I ported https://code.google.com/p/statistics-distributions-js/ so that I could use it in http://elem.com/~btilly/effective-ab-testing/ - it may have the functionality you need if you only need simple things.
If you're looking for a simple library for descriptive statistics, you could use javascriptstats.com
It does:
Mean
Median
Mode
Range
Variance
Standard Deviation
Best!
Leveraging a related answer:
The following blog post lists some recent packages: http://jgoodall.me/posts/2012/02/01/javascript-statistical-libraries/
As mentioned by others, native JS is a far cry from R, which web-wise has progressed from RApache (http://rapache.net/) to shiny (http://www.rstudio.com/shiny/). The latter uses node.js server-side, so this is quite promising. Of course both approaches will require you to code stats in R server-side, instead of using JS either on client or server.
Marc

Double-entry accounting libraries for Java? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
What double-entry accounting libraries are available for Java?
I did write a library for myself, but since it was for a really trivial application, I don't know if it would suit a general purpose accounting need.
It has an interface like:
ledger.newPosting(new Date(), "Received $10 from Anne")
.debit("Cash:Anne", 1000)
.credit("Dues Received", 1000)
.post();
int cashBalance = ledger.getAccount("Cash").getTrialBalance();
assertEquals(-1000, cashBalance);
int anneBalance = ledger.getAccount("Cash:Anne").getTrialBalance();
assertEquals(-1000, anneBalance);
int duesBalance = ledger.getAccount("Dues Received").getTrialBalance();
assertEquals(1000, duesBalance);
Is this the kind of thing you're looking for? Anyone else actually INTERESTED in this code? I wrote it generically, but never published it because I didn't think anyone would want something this trivial.
There's a Swedish project called fribok.org (free (as in GNU free) accounting). It's an application too, but might be componentized and contain what you look for (given that GPL is a viable option for you).
I've seen JMoney used with custom plug-ins. What are you trying to do?
Well, I am not aware of any such libraries. Personally me thinks that double entry accounting framework would boil down to couple of interfaces and minimal code to ensure equation invariants. Hence no libs for that: try to bite a relevant code snippet from JMoney or something like that...
;)
How about jLedger - Java Business Accounting API?
Citing the project's home page: "This is a Java Business Accounting API that consist of invoicing, general ledger, stock/inventory control and other business API that will assist java developer to build a business software with ease."
Note, however, that this project releases the software under the GNU GPL v2 license, not the Apache license that's usually associated with Java-related projects.
GNU GPL is a copyleft license and libraries licensed under it may not be appropriate for internally developed or commercial software.
There is this more recent implementation using JTA and Spring. As it states:
The Double-entry bookkeeping concept implemented with Spring 4, the
Java Transaction API and the H2 database in embedded mode
The best I have seen is a jPos module called minigl which is part of jpos-ee., The jPOS framework is used widely in many production grade deployments. I have personally used in at scale on some high-profile projects.
You will need to get up to speed on jpos-ee, a very solid java framework for all things payment and fintech related. It is worth the learning curve as if you are asking about ledgers you are probably going to have other needs which are likely already addressed in the jPos codebase.
I just wrote a java library for accounting. The beauty of my library is that it uses a 4GL to do the credits, debits and ledgers. You can also import other functions to handle inventory, payroll and things like that. Fetal Libraries

Categories