shared items

Sunday, May 31, 2009

magicjack and Win xp issues

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E965-E325-11 CE-BFC1-08002BE10318

Hopefully these simple directions will help those who are not master computer techs like me:) God knows I couldn't get it right to save my life! But a light bulb went off in my head and this is how I did it. Almost embarassing to mention;

When looking for this file in device manager please consider the following Steps:

To resolve this problem, remove the affected filter drivers. To do this, follow these steps:

1. Click Start, type regedit in the Start Search box, and then click regedit in the Programs list.

If you are prompted for an administrator password or confirmation, type your password, or click Continue.

2. Locate, and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E965-E325-11CE-BFC1-08002BE10318}

ie., 1. Go to HKEY_LOCAL_MACHINE and click on it.
2. part of the sub directory will appear
3. then click on SYSTEM
4. You will then see Current Control Set click on it
5. And so on......get the picture now!
Whew! Now follow the rest of the directions and you should have any additional problems


Caution There can be many instances of the registry subkey that is mentioned in step 2. You must make sure that you are in the appropriate registry subkey before modifying the UpperFilters and the LowerFilters values. To verify that you are in the appropriate registry subkey, make sure that the Default data value is DVD/CD-ROM and the Class data value is CDROM.

3. In the right pane, right-click UpperFilters, and then click Delete.

4. Click Yes to confirm the removal of the UpperFilters registry entry.

5. In the right pane, right-click LowerFilters, and then click Delete.

6. Click Yes to confirm the removal of the LowerFilters registry entry.

7. Exit Registry Editor, and then restart the computer.

Source : http://forums.cnet.com/5208-12546_102-0.html?threadID=241915&start=45&tag=forum-w;forums06

Wednesday, May 20, 2009

load files in jar

If you use a filename, then the filename has to refer to a real file. But if you use a "resource name," that resource might be a file or it might be a component of a JAR (or theoretically something else altogether.)
The magic method(s) in this case are the family of loadResource() methods. For example, Class.getResource().
If youve got a class foo/bar/Test.class inside a JAR file, and also a foo/bar/Image.jpg, then inside the Test class you can refer to Image.jpg using
URL theURL = getClass().getResource("Image.jpg");
and then pass the URL to ImageIcon's constructor for example.
Source : http://www.coderanch.com/t/276412/Streams/java/Load-file-inside-JAR

Monday, May 11, 2009

Inflater Deflater

public class Inflater
extends Object
This class provides support for general purpose decompression using popular ZLIB compression library. The ZLIB compression library was initially developed as part of the PNG graphics standard and is not protected by patents. It is fully described in the specifications at the java.util.zip package description.

The following code fragment demonstrates a trivial compression and decompression of a string using Deflater and Inflater.

// Encode a String into bytes
String inputString = "blahblahblah??";
byte[] input = inputString.getBytes("UTF-8");

// Compress the bytes
byte[] output = new byte[100];
Deflater compresser = new Deflater();
compresser.setInput(input);
compresser.finish();
int compressedDataLength = compresser.deflate(output);

// Decompress the bytes
Inflater decompresser = new Inflater();
decompresser.setInput(output, 0, compressedDataLength);
byte[] result = new byte[100];
int resultLength = decompresser.inflate(result);
decompresser.end();

// Decode the bytes into a String
String outputString = new String(result, 0, resultLength, "UTF-8");

Sunday, May 10, 2009

each_hash error with Rails 2.2 and mysql 5.1

Rails 2.2 MySQL removed error SOLUTION
by protech_v2 » Mon Dec 15, 2008 8:04 pm

If at any point when you've upgraded to Rails 2.2. you get the following error on Windows:

"!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql."

the problem is because MySQL 5.1 client library doesn't play well with Rails - the solution is simple however:

- download older MySQL client library, for example one from InstantRails: http://instantrails.rubyforge.org/svn/t ... bmySQL.dll

- copy the downloaded file to C:\Ruby\bin (or wherever you installed Ruby)

- restart MySQL server

That's it! Just thought I'd share this with others, lost me an hour of researching.

Good luck!

REF

Internet Explorer Inner HTML

Reference : http://muffinresearch.co.uk/archives/2006/07/19/bug-when-creating-select-options-using-innerhtml-in-ie/


function helo()
{
var a = document.getElementById('targetDiv');
opt = document.createElement("option");
opt_txt = document.createTextNode("aaaa");
opt.appendChild(opt_txt);
opt.setAttribute("value", "bbbbb"); a.appendChild(opt);
}

< onclick="helo();">Using JavaScript functions
< id="targetDiv" size="5">
< id="'a'">hh< / option >
< / select >

small textbox in IE 8.0

◦In IE8 click “Tools” | “Internet Options” | and choose the “Advanced” tab.
◦Scroll down one full scrolls worth and uncheck the “Enable visual styles on buttons and controls in webpages“
◦Click “OK” - it will take a few seconds, then your browser should display correctly. You should not have to close/reopen the browser for the change to take effect.


http://www.ejabs.com/2009/03/fix-tiny-forms-in-ie8/

Sunday, May 3, 2009

What you do is create a select tag with the “select” method like so: (using the client/project scenario)

f.select(:client_id,

The next value you pass to the select method has to be an array of text/value pairs

like this: [ [ "Jason Johnson", 1], ["Trey Piepmeier", 2], ["Royall", 3] ]

In order to create this array, you do a find on your clients table and use Ruby’s “collect” method.

like so:

Client.find(:all).collect {|c| [ c.name, c.id ]}

So, altogether now:

f.select(:client_id, Client.find(:all).collect {|c| [ c.name, c.id ] })

Reference

Saturday, May 2, 2009

JAXB ignores "@required" fields in validation

Reference Links :

http://www.cowtowncoder.com/blog/archives/cat_java.html
http://kirkwylie.blogspot.com/2008/10/jaxb-2x-and-xmlelementrequiredtrue.html
http://www.nabble.com/JAXB-ingores-@XmlElement(required%3Dtrue)-on-unmarshalling-in-JAX-RS-td22122276.html
http://myarch.com/using-schema-validation-with-jaxb-and-xfire
https://jaxb.dev.java.net/guide/Migrating_JAXB_2_0_applications_to_JavaSE_6.html