Buy anything from HongKong - Dealextreme

You can buy any kind of electronic gadgets from DealExtreme with free shipping option.
Please visit DealExtreme for very low prices.
Here is the link to the site : www.dealextreme.com

26 November 2008

Received message too long error in sftp

When I try to use sftp or scp2, I get a message like this:

Received message too long (or "Bad packet length") 1416586337

and the connection fails. What's wrong?

In order for this to work, the SSH session must be "clean" — that is, it must have on it only information transmitted by the programs at either end. What often happens, though, is that there are statements in either the system or per-user shell startup files on the server (.bashrc, .profile, /etc/csh.cshrc, .login, etc.) which output text messages on login, intended to be read by humans (like fortune, echo "Hi there!", etc.). Such code should only produce output on interactive logins, when there is a tty attached to standard input. If it does not make this test, it will insert these text messages where they don't belong: in this case, polluting the protocol stream between scp2/sftp and sftp-server. The first four bytes of the text gets interpreted as a 32-bit packet length, which will usually be a wildly large number, provoking the error message above. Notice that:

1416586337 decimal = 546F6461 hex = "Toda" ASCII

suggesting a string beginning "Today..." (or maybe "Thank-you" in transliterated Hebrew).

The reason the shell startup files are relevant at all, is that sshd employs the user's shell when starting any programs on the user's behalf (using e.g. /bin/sh -c "command"). This is a Unix tradition, and has advantages:

  • The user's usual setup (command aliases, environment variables, umask, etc.) are in effect when remote commands are run.
  • The common practice of setting an account's shell to /bin/false to disable it will prevent the owner from running any commands, should authentication still accidentally succeed for some reason.

25 November 2008

Bash usage in IBM AIX

After installing bash on IBM AIX, create the following files in user home directory :

.bashrc
source ~/.profile

.profile
echo "Welcome to server XXX"
PS1='${USER}@${PWD}>'

Procedure call with hibernate and JPA

Suppose we have the following procedure :

create or replace procedure

insertTown(res out sys_refcursor, str in string)

as

begin

insert into town values(10000,81,str);

open res for select count(*) as toplam from town;

end insertTown;


Create a native query on one of the entities :

@NamedNativeQuery(name = "insertTown", resultSetMapping = "MyResults", query = "{call insertTown(?,:VAR)}", hints = {

@QueryHint(name = "org.hibernate.callable", value = "true"),

@QueryHint(name = "org.hibernate.readOnly", value = "false") })

@SqlResultSetMapping(name = "MyResults", columns = { @ColumnResult(name = "toplam") })

public class UserAuditLog implements java.io.Serializable {

...


And call the procedure in a transactional context :

BigDecimal i = (BigDecimal)em.createNamedQuery("insertTown")

.setParameter("VAR", "deneme")

.getResultList().get(0);

19 November 2008

Defining a queue on Default messaging provider for Websphere 6.1 in a cluster

  • Create a bus (testBus)
  • Add a new bus member as cluster (cluster1)
  • Add 2 messaging engines : cluster1.000-testBus and cluster1.001-testBus
  • Define a queue connection factory for each server
  • Bus name : testBus
  • Target : cluster1.000-testBus and cluster1.001-testBus for each server
  • Target type : Messaging engine name
  • Target inbound transport chain : InboundBasicMessaging
  • End point : localhost:7276:BootstrapBasicMessaging
  • Define a queue and sib destination for the cluster
  • Open Core group settings - DefaultCoreGroup - Policies
  • Define policies for the messaging engine.
  • If you don't want HA on failover. Use static policy
  • Define two new static policies, select static group servers (one server only)
  • Define two match criteria at least :
  • WSAF_SIB_MESSAGING_ENGINE=cluster1.000-testBus, type=WSAF_SIB

05 November 2008

Best Practices for Speeding Up Your Web Site

The Exceptional Performance team has identified a number of best practices for making web pages fast. The list includes 34 best practices divided into 7 categories.
http://developer.yahoo.com/performance/rules.html

03 November 2008

Color in your remote ssh

if ‘ -n “$SSH_CLIENT” ‘; then text=” THIS IS AN SSH SESSION”
fi
export PS1=’\[\e[0;32m\]\u@\h:\w${text}$\e[m\] ‘