24 Mar 2015

Java/Jsp and the Euro Symbol €

To handle the € Euro Symbol in pages within a JSP/Java app, you better use the Windws-1252 charset encoding.
Just do the 2 following notes:

1) Put those lines in your jsp page to force the encoding in the response page:

<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page pageEncoding="windows-1252"%>


2) and then, before reading anything from the submitted pages, force the same encoding on the request:

request.setCharacterEncoding( "windows-1252" );

(*) this is needed because the browser may send back datas using their default encoding, and not the one you setted on your page, causing.


Last but not least, if you are going to write/read datas to a database, be careful to configure your db with a compatible encoding.
For example, on sql server, e dafault collation Latin1_General_CI_AS would be fine.

19 Mar 2015

Oracle recovery-reset password SYS

To reset the password for the user SYS,
you need to sign on to Oracle as sysdba from within the same server where Oracle is running,
you should be able to log on without a password,
at this point simply change the password.



sqlplus /nolog
connect / as sysdba
ALTER USER SYS IDENTIFIED BY "change_on_install";


note: always remeber the passwords are case sensitive starting form oracle 10.

In some cases this methos may not work. Then the situation becomes complicated ... you can start trying to find another user with sysdba privileges, or you may


10 Mar 2015

Oracle WRAP not working: empty output file SOLUTION !

SOLUTION 1:

check the ORACLE_HOME is correctly set
(eg: set ORACLE_HOME=D:\oraclexe\app\oracle\product\11.2.0\server)


SOLUTION 2


try to run the wrap utility as administrator 
(executing CMD.EXE as administrator)

Note: this procedure should only be nedded for the 1st time, because of the missing dirs as reported @solution3.

SOLUTION 3


go to your ORACLE_HOME directory, and verify you have those directories "log\diag\clients" 
if not create them!

(eg: D:\oraclexe\app\oracle\product\11.2.0\server\log\diag\clients)


SOLUTION 4

checkout the (almost hidden) log file under:

C:\Users\<user>\Oracle\ORADIAG_<user>\DIAG\CLIENTS\USER_<user>\host_??????????_??\ALERT\LOG.XML

(obviously remeber to replace <USER> and host_??????????_?? with your own values)



15 Jan 2015

A nice story by Brian Schul - former sled driver - SR-71 Blackbird

The Fastest Guys Out There

Flying the World's Fastest Jet


There were a lot of things we couldn’t do in an SR-71, but we were the fastest guys on the block and loved reminding our fellow aviators of this fact.

People often asked us if, because of this fact, it was fun to fly the jet. Fun would not be the first word I would use to describe flying this plane. Intense, maybe. Even cerebral. But there was one day in our Sled experience when we would have to say that it was pure fun to be the fastest guys out there, at least for a moment.

It occurred when Walt and I were flying our final training sortie. We needed 100 hours in the jet to complete our training and attain Mission Ready status. Somewhere over Colorado we had passed the century mark. We had made the turn in Arizona and the jet was performing flawlessly. My gauges were wired in the front seat and we were starting to feel pretty good about ourselves, not only because we would soon be flying real missions but because we had gained a great deal of confidence in the plan in the past ten months. Ripping across the barren deserts 80,000 feet below us, I could already see the coast of California from the Arizona border. I was, finally, after many humbling months of simulators and study, ahead of the jet.

I was beginning to feel a bit sorry for Walter in the back seat. There he was, with no really good view of the incredible sights before us, tasked with monitoring four different radios. This was good practice for him for when we began flying real missions, when a priority transmission from headquarters could be vital. It had been difficult, too, for me to relinquish control of the radios, as during my entire flying career I had controlled my own transmissions. But it was part of the division of duties in this plane and I had adjusted to it. I still insisted on talking on the radio while we were on the ground, however. Walt was so good at many things, but he couldn’t match my expertise at sounding smooth on the radios, a skill that had been honed sharply with years in fighter squadrons where the slightest radio miscue was grounds for beheading. He understood that and allowed me that luxury. Just to get a sense of what Walt had to contend with, I pulled the radio toggle switches and monitored the frequencies along with him. The predominant radio chatter was from Los Angeles Center, far below us, controlling daily traffic in their sector. While they had us on their scope (albeit briefly), we were in uncontrolled airspace and normally would not talk to them unless we needed to descend into their airspace.

We listened as the shaky voice of a lone Cessna pilot asked Center for a readout of his ground speed. Center replied:

November Charlie 175, I’m showing you at ninety knots on the ground. 

Now the thing to understand about Center controllers, was that whether they were talking to a rookie pilot in a Cessna, or to Air Force One, they always spoke in the exact same, calm, deep, professional, tone that made one feel important. I referred to it as the “ HoustonCentervoice.” I have always felt that after years of seeing documentaries on this country’s space program and listening to the calm and distinct voice of the Houstoncontrollers, that all other controllers since then wanted to sound like that… and that they basically did. And it didn’t matter what sector of the country we would be flying in, it always seemed like the same guy was talking. Over the years that tone of voice had become somewhat of a comforting sound to pilots everywhere. Conversely, over the years, pilots always wanted to ensure that, when transmitting, they sounded like Chuck Yeager, or at least like John Wayne. Better to die than sound bad on the radios. 

Just moments after the Cessna’s inquiry, a Twin Beech piped up on frequency, in a rather superior tone, asking for his groundspeed.
in Beach.

I have you at one hundred and twenty-five knots of ground speed.

Boy, I thought, the Beechcraft really must think he is dazzling his Cessna brethren.

Then out of the blue, a navy F-18 pilot out of NAS Lemoore came up on frequency. You knew right away it was a Navy jock because he sounded very cool on the radios. 

Center, Dusty 52 ground speed check 

Before Center could reply, I’m thinking to myself, hey, Dusty 52 has a ground speed indicator in that million-dollar cockpit, so why is he asking Center for a readout? Then I got it, ol’ Dusty here is making sure that every bug smasher from Mount Whitney to the Mojave knows what true speed is. He’s the fastest dude in the valley today, and he just wants everyone to know how much fun he is having in his new Hornet. 

And the reply, always with that same, calm, voice, with more distinct alliteration than emotion: 

Dusty 52, Center, we have you at 620 on the ground. 

And I thought to myself, is this a ripe situation, or what? As my hand instinctively reached for the mic button, I had to remind myself that Walt was in control of the radios. Still, I thought, it must be done – in mere seconds we’ll be out of the sector and the opportunity will be lost. That Hornet must die, and die now. 

I thought about all of our Sim training and how important it was that we developed well as a crew and knew that to jump in on the radios now would destroy the integrity of all that we had worked toward becoming. I was torn. Somewhere, 13 miles above Arizona, there was a pilot screaming inside his space helmet. 

Then, I heard it. The click of the mic button from the back seat. That was the very moment that I knew Walter and I had become a crew. Very professionally, and with no emotion, Walter spoke: 

Los Angeles Center, Aspen 20, can you give us a ground speed check? 

There was no hesitation, and the replay came as if was an everyday request. 

Aspen 20, I show you at one thousand eight hundred and forty-two knots, across the ground. 

I think it was the forty-two knots that I liked the best, so accurate and proud was Center to deliver that information without hesitation, and you just knew he was smiling. But the precise point at which I knew that Walt and I were going to be really good friends for a long time was when he keyed the mic once again to say, in his most fighter-pilot-like voice: 

Ah, Center, much thanks,
We’re showing closer to nineteen hundred on the money.

For a moment Walter was a god. And we finally heard a little crack in the armor of the HoustonCentervoice, when L.A.came back with, 

Roger that Aspen,
Your equipment is probably more accurate than ours.
You boys have a good one.

It all had lasted for just moments, but in that short, memorable sprint across the southwest, the Navy had been flamed, all mortal airplanes on freq were forced to bow before the King of Speed, and more importantly, Walter and I had crossed the threshold of being a crew. A fine day’s work.

We never heard another transmission on that frequency all the way to the coast. For just one day, it truly was fun being the fastest guys out there.

14 Jan 2015

bash: change dir colors

check if you have the file $HOME/.dircolors

if not, create a new one by typing #  dircolors --print-databas > $HOME/.dircolors 

now, open it and modify che line "DIR 01;34" with something like "DIR 01;35".
(from blue to magenta)

save the file and relogin.

*******************
color table

30     Black    
31     Red    
32     Green    
33     Yellow    
34     Blue    
35     Magenta    
36     Cyan    
37     Light gray    
90     Dark gray    
91     Light red    
92     Light green    
93     Light yellow    
94     Light blue    
95     Light magenta    
96     Light cyan    
97     White

30 May 2014

redhat-centos-fedora : manually set ip address


3 ways to manually set or change ip address via terminal


1) via command line:


---------------------------
ifconfig eth0 10.0.1.27 netmask 255.255.255.0 up
echo nameserver 10.0.1.1 > /etc/resolv.conf
route add default gw 10.0.1.1

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




2) via configuration file (using DHCP):

vi /etc/syscontrol/networking/ifeth0-cfg


-------------------
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes

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


once done, you need to restart the newtork service:
$ service networking restart



3) via configuration file (manual configuration w/o DHCP):

vi /etc/syscontrol/networking/ifeth0-cfg

--------------------
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes            <----- boot="" check="" enable="" eth="" on="" span="" this="" to="">
NETWORK=10.0.1.0
NETMASK=255.255.255.0
IPADDR=10.0.1.27
USERCTL=no
GATEWAY=10.0.1.1
HWADDR=??:??: ...

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


once done, you need to restart the newtork service:

service networking restart



4) via "setup" menu ... simply run command -->  setup in a terminal ...

this is the most easy way but, if you installed the OS using the "minimal" distribution,
the "setup" suite may not be available.
 

There are the instructions to install it:

yum install setuptool.x86_64 
 -- or --
yum install setuptool.i686

yum install system-config-network-tui system-config-firewall-tui system-config-firewall-base system-config-date system-config-services system-config-users



29 May 2014

Linux & usb

Just a quick guite to mount usb drives via command line:

use fdisk to list all the drives your OS can see:
then simply mount the one you need.

$ sudo fdisk -l
$ sudo mount /dev/sdb1 /mnt/usb


in case you get the error: "special device does not exist"
it is most probably due to an error on the usb device, try formatting it may solve.


Tip: to format a usb drive, enter the followint command

$ mkfs.vfat -n "NEW_DRIVE_NAME" -I /dev/sdx1

(*) replace /dev/sdx1 with the device name of your pendrive (list all the drives using fdisk -l )