Monday, January 2, 2012

Curly Fry Lightbulbs

English: A mercury-vapor lamp Deutsch: Eine Qu...
Image via Wikipedia
No more 100 Watt light bulbs.
Have to use the CFL light bulbs for 100 watts.
Why doesn't the OSHA ban the Curly Fry light bulbs? The mercury in them is toxic if they break. And they stop working because that same mercury vapor has all leaked out.

Mercury is a potent neurotoxin, and it's especially dangerous for children and fetuses. Most exposure to mercury comes from eating fish contaminated with mercury,

Some states, cities and counties have outlawed putting CFL bulbs in the trash, but in most states the practice is legal. 

It would be very interesting if some of those states outlawed their sale and use altogether.

Remind any one of the MTBE in gasoline, which use to be mandated, but now fortunately longer used.

Science by politics? No, business by politics.  Outlaw something and the replacement gets very profitable.  Just look at which companies have made a fortune with this.  And who do they support?

Well when they start banning the CFL it is time to invest in the companies that can still make incandescent light bulbs, and of course LED lights.



Enhanced by Zemanta

Friday, November 25, 2011

Ancient Alien Technology

Time Out chocolate bar, as sold in the UK (Sep...
Image via Wikipedia
While watching a TV show about whether or not aliens had visited the earth in ancient times an interesting technology question became clear. The premise of the show was that people must have incapable of making these items on their own, therefore someone else must have developed them.

That is a very sad premise. It implies that individuals are incapable of making advancements, and creating new things and new technologies.  Hogwash.  Most people today couldn't make a fire without a match or a lighter.  Therefore ancient man must have had lighters and matches? Of course not. Flint and steal, maybe.  How about rubbing two sticks together? Battery and steal wool?  How about a Coke can and a chocolate bar.

I prefer to believe that people are capable of creative thought. That they can invent new things and new technologies. It is what makes start up companies work. It is what makes technology companies thrive.  It is what makes people prosper.

Applying this to investing in technology which is the better way to go? Invest in a company that has not progressed, or in one that solves problems. 

For those that have not figured out that the Coke can and chocolate bar can really start a fire, this is not alien technology.  The chocolate bar is used as a polishing agent to polish the bottom of the coke can, or any soda can, to become a reflective magnifying mirror (similar to a magnifying glass) focusing the light from the sun to a point.  And yes I have made a fire this way. A full description can be found at: http://www.wildwoodsurvival.com/survival/fire/cokeandchocolatebar/
Enhanced by Zemanta

Sunday, October 16, 2011

Xerces and Sax

xml exampleImage via WikipediaRecently found and issue in dealing with the java SAX parser that did not have much documentation on as an error.

 Basically the XML parser worked without any issues when only the SAX parser jar was in the class path.  But since XML is often used an interface to other code it may be required to have the Xerces libraries also in the class path.  When this happens some code may have an error condition of a Null Pointer.  The error occurs when you trying to get the name of an attribute.  In the pure SAX parse the
reading XML with:
    String qName0=atts.getLocalName(i);
is more efficient.  One would naturally expect to to use the Local Name when parsing XML that does not have any namespaces. Additionally, if there is a namespace you would expect the method to give the just the local name space of the attribute when there is a fully Qualified name (QName). And this is the case when only the SAX parser is in the classpath.

   When the Xerces parser is in the classpath
         String qName0=atts.getLocalName(i); 
 will return a null.  So
         String qName1 = atts.getQName(i);
must be used. And if you want to get only the local name from an attribute i.e. x:mylocalname you would have to get the QName and then split the string on the colon (:).  For all of the parses I have tested the atts.getQName(i) will always return a value for the attribute regardless of the whethere or not there is a namespace in the XML.
 
 Interesting enough this issue occurs on the element name itself but it is a lot made evident directly on the parser itself as both the local name and QName are present in the method where the developer is directly reminded of this feature. 
     startElement(String uri, String name, String qName, Attributes atts) {

Depending on which parser(s) are in the classpath the behavior of whether or not the local name and qName null will change. The best method for handling this would be checking for the null conditions.
 







Enhanced by Zemanta

Honor

Not technical but, just liked what it said.

Friday, September 9, 2011

JAXB using Generics for MAP and HashMap

There item took me a while to figure out. Not much on how to do it in the web as must of the JAXB documentation refers to well structured XML. In fact many will argue about the suitability to use JAXB for Key, Value pairs in the following format:

<mymap>
<k1>v1</k1>
<k2>v2</k2>
...
</mymap>

The code below allows for the use of generics with the well defined structure of a hashmap. This approach has one big advantage over other approaches in that you only need one version of it for the various implementations of the generics. For example <String,String > and <String,Integer > would both be handled by this approach. As opposed to needing different
implementations for each case.

There is one constraint on the code as listed below in that it is limited the basic inherent JAXB classes for the Key and Values. Fortunately this limitation is readily solved by invoking another JAXB marshaller and un-marshaller inside rather than just using the .tostring() method and (Text) declaration as respectively.

Variations of this code can be made for other structures such as LinkedHashMaps, ArrayLists and other Collections.



@XmlRootElement(name="MyClassElementName")
class YourClass {
...
@XmlElement(name="mymap")
@XmlJavaTypeAdapter(GenericMapAdapter.class)
private Map yourMap = new HashMap();
...
}


package util.jaxb.adapters;

import java.util.HashMap;
import java.util.Map;

import javax.xml.bind.annotation.adapters.XmlAdapter;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;

public class GenericMapAdapter extends XmlAdapter<Object,Map
<?,?>> {

@Override
public Map<?, ?> unmarshal(Object domTree) {

Map<Object, Object> map = new HashMap<Object, Object>();
Element content = (Element) domTree;
NodeList childNodes = content.getChildNodes();
if (childNodes.getLength() > 0) {
for (int i = 0; i < childNodes.getLength(); i++)
{
Node child =childNodes.item(i);
String key = child.getNodeName();
// Skip text nodes
if (key.startsWith("#"))continue;
String value=((Text)child.getChildNodes().item(0))
.getWholeText();
map.put(key, value);
}
}
return map;
}


@Override
public Object marshal(Map<?, ?> map) {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.newDocument();
Element customXml = doc.createElement("Map");
for (Map.Entry<?, ?> entry : map.entrySet()) {
Element keyValuePair = doc.createElement(entry.getKey().toString());
keyValuePair.appendChild(doc.createTextNode(
entry.getValue().toString()));
customXml.appendChild(keyValuePair);
}
return customXml;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
Enhanced by Zemanta

Wednesday, August 31, 2011

Ruby, Ruby on Rails Support Discontinued in NetBeans IDE 7.0

NetBeans6.9I have been a big fan of NetBeans since 5.5, because Sun open source its enterprise development tools to NetBeans.org. The main reason is working on many different large scale development programs and seeing time and again, code mangling through interaction with configuration management (CVS, Subversion, Rational, etc) where developers have been using other IDE's. That and realizing my own productivity has been much higher using Netbeans. But one of the biggest advantages has been working on SOA projects that require interactions with services that have been developed in all sorts of different languages.

But now, watching Netbeans with Oracle at the helm everything seems to be discontinued, the IDE feature returned to before 5.5, the UML, VisualJSF, SOA and the later python, and today Ruby are disappeared in NetBeans. What is the next one, PHP or Groovy? And the future of NetBeans IDE?

Well OK, I missed the discontinuation of Ruby when I upgraded from 6.9 to Netbeans 7.0 because it still showed up in the plugins. Somewhere along the way it asked if I wanted to import modules not bundled with 7.0 and I said yes.


From Oracle's official announcement:
"Java SE 7 and Java Development Kit 7 (JDK 7) are the next major releases of the Java SE platform, which Oracle is committed to deliver in 2011. A key objective of the NetBeans IDE has always been to offer superior support for the Java platform. To maintain that objective and capitalize on the JDK 7 release themes--multi-language support, developer productivity and performance--it is necessary that our engineering resources are committed to a timely and quality release of NetBeans IDE 7.0."
"Although our Ruby support has historically been well received, based on existing low usage trends we are unable to justify the continued allocation of resources to support the feature."

While the Ruby plugin will be maintained outside of Netbeans, it is a shame as a general trend. That is to say, while Netbeans was not highly used by the Ruby developers, it was used, and it was part of the breadth and depth of Netbeans.








Enhanced by Zemanta

Monday, June 6, 2011

More on Medical NLP

Logo of the United States NIH Clinical Center,...Image via WikipediaCo-referencing (or anaphora resolution) is one of problems of particular interest to Natural Language Processing when using NLP on medical text. Co-reference resolution is the process of resolving a reference to an Entity or concept. For example:

Jane Smith had diabetes. She was taking insulin.
In the example She is referring to Jane Smith. It is a rather simple and straight forward for most commercial NLP products to perform. And surprisingly poorly done if at all by most open source NLP software. (Born out by the NIH, and other researchers heavy continuous research on the subject as they predominantly rely on open source NLP). But lets concentrate on the problem. And look at a harder problem in co-referencing that will stop even most commercial NLP programs.

The patient has Turner's Syndrome. She has also been diagnosed with diabetes.

In this example the reader (or NLP) must first recognize that Turner's Syndrome as disease, as opposed to a syndrome belonging to Turner. She is referring to the patient and not Turner.
Then there are other relationships that are not anaphoric, but have great value, for example the relationship between diabetes and Turner's Syndrome.

He underwent nephrostomy tube placement. The nephrostomy tube was removed the next day.

These are examples of relationships but are not co-referencing. The first sentence is referring a procedure while the second sentence is referring to a device. Some commercial products, like Rosoka can easily detect these as different types [PROCEDURES and DEVICES], while other can't. If they can, then this type of differentiation is trivial, if not the this type of referential discrimination becomes very complex.




Enhanced by Zemanta

Sunday, May 15, 2011

Natural Language Processing and Medicine

The Doctor, by Sir Luke Fildes (1891)Image via WikipediaNatural language processing can be used to process the large amounts of unstructured text found in clinical notes and reports. It can be used to categorize and structure it according to nomenclature used in medical specialties, or to specific diseases, or to used to correlate symptoms to match to diseases. By providing structure this data can then be searched for both diagnoses and medical research. Using NLP platforms such as Rosoka can aid indexing and searching electronic medical records within institutions to quickly find similar cases or conditions, so physicians are not reliant solely on their own clinical experience in analyzing a problem. Researchers may also use these tools to aid retrospective epidemiological studies or do groundwork for new clinical trials.

This technology can allow physicians to mine the text in clinical notes and pathology reports for references of specific conditions, drugs, diseases, signs and symptoms. Data mining can also focus on anatomical areas or organs or even to assess the history associated to treatment procedures.

Fore example using the software to extract tumor characteristics, lymph node status and its relationship to cancer stages can be used determine optimal treatment."

The benefits of this type of technology available in products like Rosoka:
  • Physicians can research past records to examine earlier cases of rare conditions, to aid diagnosis and treatment decisions.
  • Enhanced ability to mine data and determine potential study factors enabling individualized medicine treatments in psychiatric care.
Enhanced by Zemanta

Tuesday, April 26, 2011

Visual Basic Express and SQL Server Express

Architecture of Microsoft SQL SImage via WikipediaWith Oracle now the new owner of MySQL how have things changed? One of the first things to notice is that MicroSoft now offers MS SQL Server Express a free version of Microsoft SQL Server. The next thing to notice is the flocking to old standbys like PostgreSQL. Of course these types of changes have all sorts of movement due to biases about vendors that I will skip over and look at the Express bundle and what is happening there.

First Express is not Open Source, it is Free Ware. You can down load the bundles install packages and be up and running in minutes. But what are you getting. Bearing in mind that the strategy for freeware used by most large companies is to get you to try a limited version, or trial version and upgrade to a version that you pay for, or to buy services. After all companies need to make a profit to stay in business.

SQL Server Express is basically limited in capacity, to a single CPU and 1 GB. Which is great for trying out a product, learning it, and building small lightweight Mom and Pop level data bases as well as Corporate Office applications used by a handful of People. So far, so good. It also comes bundled with a really nice report builder tool. An experienced programmer can set up a database, and generate some very nice reports within an hour or so. Awesome so far. Other than the report builder is labeled as a Business Intelligence tool.

Now you want to build a form so that a user can enter data, place an order, etc. You think, Visual Basic, you just down loaded that right from the same page a SQL Server Express. All that great great drag and drop features for building a form. One slight catch, Visual Basic Express won't connect to SQL Server. Neither will C#, C++ Express. Can't connect using the data base tool. The Data source lock down the connection the following choices:
Microsoft Access File
Microsoft SQL Server Compact 3.5
Microsoft SQL Server File

Most users at this point would give up and assume that you need to upgrade. That seems to be a rather cheap trick to get an upgrade. Also the Visual Studio Web shows the SQL Server directly (but has other grayed out features).
But what MS has really done is limit to a local connection by tying the user to the local file access, and allow them to claim VB/C#/C++ Express integrates with SQL Server Express, but through a loop to get upgrades. (Personally I think they will loose more at this point, but "Only MicroSoft").

Here’s the trick to get past that: with Visual Basic 2010 Express, you have to connect directly to the database file that the server uses. You may be used to connecting to remote database servers – you can’t do that here. When you create a data base in MS SQL Server Express it creates an underlying mdf file; e.g. When you create MyDB, SQL Server creates a file on your PC named MyDB.mdf. Find it, and if the full path name is different from:

C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\MyDB.mdf

Then you can go ahead and select Server File option and follow all the prompts, and then develop your code with all of the drag and drop features. To get back to being able tie back to the Server then you can go back and change the connection strings.

Why go to this grief in the first place. MS Access 2007 no longer has User Based access controls. You have to drop back to Access 2002.

Lets see were that puts things. One of the following categories: 1) New learners. 2) Spending $K for a shared desktop app for something that should take less than a day. or 3) or back to AMP (Apache MySQL PHP/Perl) or replace MySQL with your favorite Open Source and P=jruby, etc.. 4) Prototyping for large data warehouse apps.

I expect MS to remain behind Oracle and IBM in the database market.








Enhanced by Zemanta

Saturday, March 19, 2011

Company internet use policies increasing risk and lowering productivity

Main processes of a company (Saari 2006)Image via Wikipedia
Are some company internet use policies making their companies intranets more vulnerable and costing productivity?

The other day a friend texts me with a question about using CAMEL. Apparently, he was block from http://camel.apache.org and pretty much everything apache that wasn't http://www.apache.org. He had gone threw about a hundred web sites with no answer trying to find a code snippet that was straight out of the tutorials. All of the message boards and other sites that would have had his answer were blocked. To start with, that was a lot of wasted time. Simple math on calculating the cumulative probabilities says that the probability of contacting virus just went up from shear numbers. Then as each site in a Google, Bing, or Yahoo (which ever he used) got less and less relevant, the content value would have dropped and web sites would have gotten more likely to be undesired, and more likely to be a threat. Then once the web search proved to be non-productive do to all of the blocked sites, he gave up the web search and texted me. The end result was a bypass of the company scans to find alternative means to obtain the information needed to do his jobs. I sent him the link to the camel.apache.org page that had the answer and code snippet he needed. I don't know how he got it to where it was needed from their.

This got me thinking about this issue. When did all the technical message boards and blog sites become lumped in with social media? Oh yes, its variation on the underlying technologies. Oh so, all that stuff needs to be blocked at the companies firewalls.

Over the last couple of years I have heard more and more people complain about the company that they work for blocking internet sites such as Facebook, and other social media sites.
This type of blocking is done mostly under the argument that browsing these types of sites costs productivity rather than a security threat. Internet through I-phone, and Droid phones pretty much not only have internet, but come with Facebook and Twitter apps, along with many other social networking apps. So, now we have behavior similar to going out for a smoke. This would result in not only the loss of time from the activity, but absence from the terminal where they should be doing their work, or creating delays in information reaching them, a net greater loss in productivity.

But more and more companies are now getting their information out through social media. Its not just for individuals. And oh yes, everyone in the company by you know that the manager from your subcontractor has left the subcontractor for a new job.

Blocking adult content, and other inappropriate content of this type is one thing.
Blocking blogs, orgs, social media can have the inverse effect as what was intended.
Going through the network logs, doing some homework, and keeping the scanners and threat definitions up to date is one alternative. The other is being totally safe and slowly disconnecting, your employees/company from your customers and vendors, and your vendors and customers from your company/employees.

So this gets very easy to predict that companies that do selective filtering based on network monitoring combined with deliberate thought and research will do well, while companies that do broad brush will decline.
Enhanced by Zemanta

Wednesday, February 9, 2011

Forward Delete on a Mac

Apple MacBook Pro 13" (Mid 2009), 15&quot...Image via WikipediaI used a Mac years ago. I have been using an iPOD for a while now. Recently I bought a MacBook Pro since I had to fix a GUI bug in a Java program that was only reproducible on a Mac.

After going to the store and unpacking my new Mac, out of the Box everything worked great. I could find my way around all of the programs in a matter of minutes. Being very familiar with linux, was nice to be able to go to the command line console and find everything right where you would expect. So far everything was awesome. I even found that the I liked how MS Office looked and felt better on the Mac than on a PC.

But then I started to get to work on why I got the Mac Pro in first place. So I downloaded and installed my favorite IDE, Netbeans without any problem and soon notice that the javadocs and other helpful items where not showing up. Apple apparently bundles the JDK for the Mac without any javadocs. Had to get that taken care of separately. Then I realized that there is no forward button on a Mac. A forward delete is deleting thing from the left to the right. A backwards delete is deleting from the right to the left.

Just like out of the box a mouse for a Mac is a single button mouse! Why would you need anything else? If all you run is software written for the mouse you don't really. But everything else is expecting that second button or even that third button. To get the second button you can go to preferences and simply turn it on. When at a table or desk plugging in a USB 3 button mouse works very nice, that is when its not being used literally as a laptop.

To get to the forward delete (the missing keyboard key) on the Mac you use the fn Delete keys. That is; hold down the fn button (far lower left on the keyboard) and press the Delete key for as many times as you need to delete.

Thursday, January 13, 2011

StringBuilder vs StringBuffer vs String.concat

C language example; shows concatenating strings.Image via Wikipedia

In Java, one of the biggest impacts to performance often boils down to handling of strings. Why? Java hides what is going on with memory from direct observation.

It is easy to think string, and then use the String class. And this is what is most commonly used. Then many programmers don’t really understand the significance of mutable and immutable.

Immutable is something that doesn’t change, right. But it is very easy to change the value of a String. So it is very easy to forget that what is happening is that a whole new allocation in memory happened, and the old one has been released for garbage collection. If the program is small and doesn’t run very long the effect is negligible. This is the case for most programs that beginning programmers write when they are first learning Java. But put this same action in a loop large enough to trigger garbage collection and a simple program can start to crawl. So when is it appropriate to use a

String

and

String.concat(+).

It is appropriate to use these for items that are used once, or items that are dynamically created once, and generally less than 4 concatenations.

StringBuilder and StringBuffer are both mutable. Since they don’t create new instances they will run faster in a loop. StringBuffer is synchronized and StringBuilder is not. Since StringBuilder is not synchronized it will run slightly faster, however, it should not be used if string is being used across threads.

One thing about writing in languages such as C/C++ was that it forces the developer to understand how the memory is working or nasty thing happen, as opposed to slow speed and memory overflows.
Just a couple of simple items that can make a huge difference in performance, and later on development costs.

Monday, December 20, 2010

Winter Solstice Lunar Eclipse

Geometry of a Lunar EclipseImage via Wikipedia

Winter officially starts on the Winter Solstice which is the shortest day of the year. And to celebrate getting more daylight each day now there is a special event this year.

A full lunar eclipse on the winter solstice will be on display tonight.

According to NASA the last time a lunar eclipse occurred on a solstice was in 1638, and tonight's may be only the second one in the last two millennium.

"Since Year 1, I can only find one previous instance of an eclipse matching the same calendar date as the solstice, and that is 1638," Geoff Chester of the U.S. Naval Observatory, who inspected a list of eclipses going back 2,000 years, said on NASA's solstice lunar eclipse page. The next lunar eclipse on the winter solstice won't be such a long wait, though. It's expected in 2094.

A lunar eclipse happens when the sun, Earth, and moon align--with the Earth in the middle and there is always a full moon during a lunar eclipse. Unlike a solar eclipse, a lunar eclipse is viewable for quite some time and is safe to view. This eclipse will be visible across North America.


Tuesday, September 21, 2010

A Culture of Excellence

Diagram of venture capital fund structure for ...Image via WikipediaRecently when talking about technology advancement I was asked why so many companies lose their edge once they get to be a large size. My answer to this was, that it wasn't really size that mattered, it was the corporate culture that mattered.

Small companies need a corporate culture that promotes excellence to be competitive with larger companies. They need it to survive. Excellence can be in many forms, it can be in technology, cost, superior service. On the other hand large companies can go a long way, or many years once they have lost that culture of excellence. This is because excellence comes from people. The small company needs to people to develop excellence. A large company that has lost the culture of excellence will take time for it to dissipate since people need jobs, and will consequently coast on momentum for a while.

You want proof, ask any Venture Capitalist Investor what the most important factor they look at. They will take a short look at the product and the market to decide if it is something to invest in. But then they will look at the business plan and the management team. They are looking at how things will proceed. How they are going to be rewarded, and how the primaries are going to be rewarded. Is there a culture of excellence or not.

So what exactly is a culture of excellence. That is easy. People are rewarded for superior performance, for better ideas, for product improvements, for providing better services. There is an easy example to illustrate the point. Think of choosing a restaurant. Why will you pay more for the one with the better tasting food, waiters? Excellence.

So what happens with those large companies. They get to a size that they start managing people by policy and formula rather than result. The result is incentives for mediocrity. Sounds a bit like Unions, and Public Service Unions.

Consider the above when deciding on investments.