Monday, May 25, 2009

"Network Connection Closed Unexpectedly" error while using svn+ssh

If you got a "Network Connection Closed Unexpectedly" error while using svn+ssh (here is a nice HOWTO) then you should comment (or remove) "mesg y" in /etc/bashrc or in $HOME/.bashrc


Worked for me as a charm :)

Monday, February 16, 2009

iPhone speaker too low

Well, I got a simple accident - "Mozart Chocolate Liqueur" were split over my iPhone 3G. I quickly clean it out, but... Next day I noticed that my iPhone speaker was too low. I was not able to hear it ringing. After looking around for solution I found a post telling that this can be caused by dust. Seems that this is my case (ok, not dust, but a creamy liqueur...). 

So, I put some music on my iPhone and start carefully cleaning the microphone hole with a needle. After just a few holes I made on the "dust" - I was able to hear that volume had increased. So I finished up cleaning by putting a needle just a little into every tiny hole of the speaker protection and everything worked like a charm. My speaker volume came back to the normal level (or even louder).

Just in case that you have a doubt on which one is speaker and which one is microphone on your iPhone - here is a picture:

Wednesday, December 3, 2008

How to sync Google Contacts and Calendar with iPhone

I've been looking for some simple solution to sync Google Contacts & Calendar with my iPhone on the air (without syncing with my notebook). Finally I found a solution that seems to be working like a charm.



Setup process is quite simple and straigh forward. 

Friday, August 22, 2008

cfmenu and cfgrid overlap

If you are using <cfmenu> and <cfgrid> and you have an overlapping of the menu items by cfgrid header (a part of menu is hidden behind cfgrid header) you must add to your CSS a following style:


#myMenuId .yuimenu {
z-index: 300003;
}

This problem is caused by some "yui" CSS style with z-index set to 1, while grid related styles have z-index bigger than 200000.

Friday, July 25, 2008

ESX host not connecting to Virtual Center

We got following problem some days ago:

One of our ESX (version 3.5) hosts, after crash, was not connecting to Virtual Center (version 2.5).

Solution:
  • Restart management service on ESX host
service mgmt-vmware stop
service mgmt-vmware start
  • Restart Virtual Center service on Virtual Center server (stop/start on service VMware Virtual Center in Services)

One more stuff - if you have a lot of memory on your hosts (16 GB or more) I would recommend you to increment amount of console memory on your host to 800 MB. You can do this in "Configuration" tab for host in your Virtual Center console.

Wednesday, June 25, 2008

Creating a copy of the disk (vmdk) in VMware

When you need to have the a copy of the disk from one VM on the other:

  • Power off  source VM, copy your .vmdk files to destination VM (probably you would like to change disk name and flat name - just rename your files and edit smaller .vmdk file to set correct name for flat file).
  • Set new UUID for your copy of your original .vmdk file
/usr/sbin/vmkfstools -J setuuid path_to_destination_VM/filename.vmdk
  • Add new disk to your destination VM (using "Use an existing virtual disk" option)
  • Start your VMs (source and destination)
  • Mount new drive on your destination machine
We used this solution to make a quick copy of data files disks from primary Oracle server to standby Oracle server.

Monday, June 16, 2008

Oracle analog of MySQL GROUP_CONCAT function

I was looking for Oracle analog of MySQL GROUP_CONCAT function. There is a solution on Ask Tom site. So here it is:


create or replace type string_agg_type as object (
  total varchar2(4000),

  static function ODCIAggregateInitialize(sctx IN OUT string_agg_type )
  return number,

  member function ODCIAggregateIterate(self IN OUT string_agg_type, value IN varchar2 )
  return number,

  member function ODCIAggregateTerminate(self IN string_agg_type, returnValue OUT varchar2, flags IN number)
  return number,

  member function ODCIAggregateMerge(self IN OUT string_agg_type, ctx2 IN string_agg_type)
  return number
);
/

create or replace type body string_agg_type is
  static function ODCIAggregateInitialize(sctx IN OUT string_agg_type)
  return number
  is
  begin
    sctx := string_agg_type( null );
    return ODCIConst.Success;
  end;

  member function ODCIAggregateIterate(self IN OUT string_agg_type, value IN varchar2 )
  return number
  is
  begin
    self.total := self.total || ',' || value;
    return ODCIConst.Success;
  end;

  member function ODCIAggregateTerminate(self IN string_agg_type, returnValue OUT varchar2, flags IN number)
  return number
  is
  begin
    returnValue := ltrim(self.total,',');
    return ODCIConst.Success;
  end;

  member function ODCIAggregateMerge(self IN OUT string_agg_type, ctx2 IN string_agg_type)
  return number
  is
  begin
    self.total := self.total || ctx2.total;
    return ODCIConst.Success;
  end;
end;
/

create or replace function stragg(input varchar2)
return varchar2
parallel_enable aggregate using string_agg_type;
/

After this you can use this function like this:
select t1.id, stragg(t2.name) as names from table1 t1, table2 t2 where t1.id=t2.id group by t1.id;

It will produce comma separated list of the names - something like this:
ID NAMES
-- ------------------------------------
10 CLARK,KING,MILLER
20 SMITH,FORD,ADAMS,SCOTT,JONES
30 ALLEN,BLAKE,MARTIN,TURNER,JAMES,WARD

Tuesday, May 13, 2008

List number of file handles (open files) for each process

Here is a simple script that will show you a number of file handles (open files) used by each process on your Linux system:


ps -e|grep -v TTY|awk {'print "echo -n \"Process: "$4"\tPID: "$1"\tNumber of FH: \"; lsof -p "$1"|wc -l"'} > out; . ./out

Monday, April 28, 2008

& in Oracle insert or update statements

If you have & or % in your Oracle insert or update statements - you probably would like to do the following:


SQL> set define off
SQL> [your insert or update query containing & and %]
SQL> set define on

Wednesday, April 23, 2008

Export from Oracle table to CSV file

Sometimes you need to export result of the query to CSV file. Here is a nice example of how to do this kind of operations.


SQL> SET LINESIZE 500 FEEDBACK OFF TRIMSPOOL ON TERMOUT OFF HEAD OFF PAGESIZE 0 TERM OFF
SQL> spool outfile.csv
SQL> select '"'|| column_1 || '",' || column_2 || ',' || column_3 from mytable where [your where statement]
...
...
SQL> spool off
SQL> exit

In this case column_1 data will be surrounded by "" (you may need this if you have , character in field data).

Update: SET LINESIZE determines a maximum number of characters in the line. So if you expect output bigger than 500 lines you must set this to a bigger value.