svn checkout svn://somepath@1234 working-directory
or
svn checkout url://repository/path@1234
or
svn checkout -r 1234 url://repository/path
This weblog only liked a combination of technical articles and writings have been using to keep. Many of the articles published in this blog do not belong to me, articles resources, am showing you care to publish the latter part of the articles.
svn checkout svn://somepath@1234 working-directory
or
svn checkout url://repository/path@1234
svn checkout -r 1234 url://repository/path
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.harmony.nio_char.tests.java.nio.charset;
import dalvik.annotation.TestTargetClass;
import dalvik.annotation.TestTargets;
import dalvik.annotation.TestTargetNew;
import dalvik.annotation.TestLevel;
import java.io.IOException;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CoderMalfunctionError;
import java.nio.charset.CoderResult;
import junit.framework.TestCase;
@TestTargetClass(CharsetEncoder.class)
public class CharsetEncoderTest extends TestCase {
/**
* @tests java.nio.charset.CharsetEncoder.CharsetEncoder(
* java.nio.charset.Charset, float, float)
*/
@TestTargets({@TestTargetNew(level=TestLevel.PARTIAL_COMPLETE,notes="Checks IllegalArgumentException",method="CharsetEncoder",args={java.nio.charset.Charset.class,float.class,float.class}),@TestTargetNew(level=TestLevel.PARTIAL_COMPLETE,notes="Checks IllegalArgumentException",method="CharsetEncoder",args={java.nio.charset.Charset.class,float.class,float.class,byte[].class})})
public void test_ConstructorLjava_nio_charset_CharsetFF() {
// Regression for HARMONY-141
try {
Charset cs = Charset.forName("UTF-8");
new MockCharsetEncoderForHarmony141(cs, 1.1f, 1);
fail("Assert 0: Should throw IllegalArgumentException.");
} catch (IllegalArgumentException e) {
// expected
}
try {
Charset cs = Charset.forName("ISO8859-1");
new MockCharsetEncoderForHarmony141(cs, 1.1f, 1,
new byte[] { 0x1a });
fail("Assert 1: Should throw IllegalArgumentException.");
} catch (IllegalArgumentException e) {
// expected
}
}
/**
* @tests java.nio.charset.CharsetEncoder.CharsetEncoder(
* java.nio.charset.Charset, float, float)
*/
@TestTargetNew(level=TestLevel.PARTIAL_COMPLETE,notes="",method="CharsetEncoder",args={java.nio.charset.Charset.class,float.class,float.class})
public void test_ConstructorLjava_nio_charset_CharsetNull() {
// Regression for HARMONY-491
CharsetEncoder ech = new MockCharsetEncoderForHarmony491(null,
1, 1);
assertNull(ech.charset());
}
/**
* Helper for constructor tests
*/
public static class MockCharsetEncoderForHarmony141 extends
CharsetEncoder {
protected MockCharsetEncoderForHarmony141(Charset cs,
float averageBytesPerChar, float maxBytesPerChar) {
super (cs, averageBytesPerChar, maxBytesPerChar);
}
public MockCharsetEncoderForHarmony141(Charset cs,
float averageBytesPerChar, float maxBytesPerChar,
byte[] replacement) {
super (cs, averageBytesPerChar, maxBytesPerChar, replacement);
}
protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) {
return null;
}
}
public static class MockCharsetEncoderForHarmony491 extends
CharsetEncoder {
public MockCharsetEncoderForHarmony491(Charset arg0,
float arg1, float arg2) {
super (arg0, arg1, arg2);
}
protected CoderResult encodeLoop(CharBuffer arg0,
ByteBuffer arg1) {
return null;
}
public boolean isLegalReplacement(byte[] arg0) {
return true;
}
}
/*
* Test malfunction encode(CharBuffer)
*/
@TestTargetNew(level=TestLevel.PARTIAL,notes="Regression test checks CoderMalfunctionError",method="encode",args={java.nio.CharBuffer.class})
public void test_EncodeLjava_nio_CharBuffer() throws Exception {
MockMalfunctionCharset cs = new MockMalfunctionCharset("mock",
null);
try {
cs.encode(CharBuffer.wrap("AB"));
fail("should throw CoderMalfunctionError");
} catch (CoderMalfunctionError e) {
// expected
}
}
/*
* Mock charset class with malfunction decode & encode.
*/
static final class MockMalfunctionCharset extends Charset {
public MockMalfunctionCharset(String canonicalName,
String[] aliases) {
super (canonicalName, aliases);
}
public boolean contains(Charset cs) {
return false;
}
public CharsetDecoder newDecoder() {
return Charset.forName("UTF-8").newDecoder();
}
public CharsetEncoder newEncoder() {
return new MockMalfunctionEncoder(this );
}
}
/*
* Mock encoder. encodeLoop always throws unexpected exception.
*/
static class MockMalfunctionEncoder extends
java.nio.charset.CharsetEncoder {
public MockMalfunctionEncoder(Charset cs) {
super (cs, 1, 3, new byte[] { (byte) '?' });
}
protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) {
throw new BufferOverflowException();
}
}
/*
* Test reserve bytes encode(CharBuffer,ByteBuffer,boolean)
*/
@TestTargetNew(level=TestLevel.PARTIAL,notes="Functional test.",method="encode",args={java.nio.CharBuffer.class,java.nio.ByteBuffer.class,boolean.class})
public void test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB() {
CharsetEncoder encoder = Charset.forName("utf-8").newEncoder();
CharBuffer in1 = CharBuffer.wrap("\ud800");
CharBuffer in2 = CharBuffer.wrap("\udc00");
ByteBuffer out = ByteBuffer.allocate(4);
encoder.reset();
CoderResult result = encoder.encode(in1, out, false);
assertEquals(4, out.remaining());
assertTrue(result.isUnderflow());
result = encoder.encode(in2, out, true);
assertEquals(4, out.remaining());
assertTrue(result.isMalformed());
}
/**
* @tests {@link java.nio.charset.Charset#encode(java.nio.CharBuffer)
*/
public void testUtf8Encoding() throws IOException {
byte[] orig = new byte[] { (byte) 0xed, (byte) 0xa0,
(byte) 0x80 };
String s = new String(orig, "UTF-8");
assertEquals(1, s.length());
assertEquals(55296, s.charAt(0));
Charset.forName("UTF-8").encode(CharBuffer.wrap(s));
// ByteBuffer buf = <result>
// for (byte o : orig) {
// byte b = 0;
// buf.get(b);
// assertEquals(o, b);
// }
}
}
http://www.java2s.com/Open-Source/Android/android-core/platform-libcore/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetEncoderTest.java.htmsource :
brew install mysql
pretty standard installation.mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
I would like innodb to be the default storage engine. What do I need to do?[mysqld]
section in your ini file, add:default-storage-engine = innodb
It is usually /etc/my.cnf
, but not sure about Mac.On Unix, Linux and Mac OS X, MySQL programs read startup options from the following files, in the specified order (top items are used first).The last one is never used by the daemon.
File Name Purpose /etc/my.cnf Global options/etc/mysql/my.cnf Global options (as of MySQL 5.1.15) SYSCONFDIR/my.cnf Global options$MYSQL_HOME/my.cnf Server-specific options defaults-extra-file The file specified with --defaults-extra-file=path, if any ~/.my.cnf User-specific options
# # Connect to the local database server as user root # You will be prompted for a password. # mysql -h localhost -u root -p # # Now we see the 'mysql>' prompt and we can run # the following to create a new database for Paul. # mysql> create database pauldb; Query OK, 1 row affected (0.00 sec) # # Now we create the user paul and give him full # permissions on the new database mysql> grant CREATE,INSERT,DELETE,UPDATE,SELECT on pauldb.* to paul@localhost; Query OK, 0 rows affected (0.00 sec) # # Next we set a password for this new user # mysql> set password for paul = password('mysecretpassword'); Query OK, 0 rows affected (0.00 sec) # # Cleanup and ext mysql> flush privileges; mysql> exit;
#Create Mysql user groupadd mysql useradd -g mysql mysql cd /usr/local/ tar zxvf /downloads/mysql-cluster-gpl-7.1.9a-linux-i686-glibc23.tar.gz ln -s mysql-cluster-gpl-7.1.9a-linux-i686-glibc23 mysql cd /usr/local/mysql scripts/mysql_install_db --user=mysql #change permission chown -R root . chown -R mysql data chgrp -R mysql . #init script cp support-files/mysql.server /etc/rc.d/init.d/ chmod +x /etc/rc.d/init.d/mysql.server chkconfig --add mysql.server
cd /usr/src tar zxvf /downloads/mysql-cluster-gpl-7.1.9a-linux-i686-glibc23.tar.gz cd mysql-cluster-gpl-7.1.9a-linux-i686-glibc23/ mv bin/ndb_mgm . mv bin/ndb_mgmd . chmod +x ndb_mg* mv ndb_mg* /usr/bin/ cd rm -rf /usr/src/mysql-cluster-gpl-7.1.9a-linux-i686-glibc23/
mkdir /var/lib/mysql-cluster cd /var/lib/mysql-cluster vi config.ini [NDBD DEFAULT] NoOfReplicas=2 [MYSQLD DEFAULT] [NDB_MGMD DEFAULT] [TCP DEFAULT] # Managment Server [NDB_MGMD] HostName=192.168.1.1 # the IP of THIS SERVER # Storage Engines [NDBD] HostName=192.168.1.2 # the IP of the FIRST SERVER DataDir= /var/lib/mysql-cluster [NDBD] HostName=192.168.1.3 # the IP of the SECOND SERVER DataDir=/var/lib/mysql-cluster # 2 MySQL Clients [MYSQLD] [MYSQLD]
mkdir -p /usr/local/mysql/mysql-cluster
ndb_mgmd
vi /etc/my.cnf [mysqld] ndbcluster ndb-connectstring=192.168.1.1 # the IP of the MANAGMENT (THIRD) SERVER [mysql_cluster] ndb-connectstring=192.168.1.1 # the IP of the MANAGMENT (THIRD) SERVER #Now, we make the data directory and start the storage engine: mkdir /var/lib/mysql-cluster cd /var/lib/mysql-cluster /usr/local/mysql/bin/ndbd --initial /etc/rc.d/init.d/mysql.server start
[root@c3 mysql-cluster]# ndb_mgm -- NDB Cluster -- Management Client -- ndb_mgm> show Connected to Management Server at: localhost:1186 Cluster Configuration --------------------- [ndbd(NDB)] 2 node(s) id=2 @192.168.1.2 (mysql-5.1.51 ndb-7.1.9, Nodegroup: 0, Master) id=3 @192.168.1.3 (mysql-5.1.51 ndb-7.1.9, Nodegroup: 0) [ndb_mgmd(MGM)] 1 node(s) id=1 @192.168.1.1 (mysql-5.1.51 ndb-7.1.9) [mysqld(API)] 2 node(s) id=4 @192.168.1.2 (mysql-5.1.51 ndb-7.1.9) id=5 @192.168.1.3 (mysql-5.1.51 ndb-7.1.9)
/etc/init.d/mysql.server stop
ndb_mgmd -f /var/lib/mysql-cluster/config.ini
/usr/local/mysql/bin/ndbd
/etc/init.d/mysql.server start
Unix Consulting / Cisco Consulting / Linux Consulting / MySQL Consulting / Solaris Consulting |
# Options affecting ndbd processes on all data nodes:
[NDBD DEFAULT]
NoOfReplicas=2 # Number of replicas
DataMemory=256M # How much memory to allocate for data storage
IndexMemory=256M # How much memory to allocate for index storage
# For DataMemory and IndexMemory, we have used the
# default values. Since the "world" database takes up
# only about 500KB, this should be more than enough for
# this example Cluster setup.
# TCP/IP options:
[TCP DEFAULT]
portnumber=2202 # This the default; however, you can use any
# port that is free for all the hosts in cluster
# Note: It is recommended beginning with MySQL 5.0 that
# you do not specify the portnumber at all and simply allow
# the default value to be used instead
# Management process options:
[NDB_MGMD]
hostname=mgmn # Hostname or IP address of MGM node
datadir=/var/lib/mysql-cluster # Directory for MGM node log files
# Options for data node "A":
[NDBD]
# (one [NDBD] section per data node)
hostname=ndbda # Hostname or IP address
datadir=/mnt/mysql/data # Directory for this data node's data files
# Options for data node "B":
[NDBD]
hostname=ndbdb # Hostname or IP address
datadir=/mnt/mysql/data # Directory for this data node's data files
# SQL node options:
[MYSQLD]
hostname=sqln # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
# Options for mysqld process:
[MYSQLD]
ndbcluster # run NDB storage engine
ndb-connectstring=mgmn # location of management server
log=/var/lib/mysql/mysql.log
# Options for ndbd process:
[MYSQL_CLUSTER]
ndb-connectstring=mgmn # location of management server
# Mysql Cluster data node
10.1.2.3 ndbda
10.4.5.6 ndbdb
# Mysql Cluster mgm node
10.7.8.9 mgmn
# MySQL Cluster sql node
10.10.11.12 sqln
ndb_mgmd -f /mnt/mysql-cluster/config.ini
ndbd --initial
/etc/init.d/mysql start
root@mgmn:~# ndb_mgm -e show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @10.1.2.3 (Version: 5.0.38, Nodegroup: 0, Master)
id=3 @10.4.5.6 (Version: 5.0.38, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @10.7.8.9 (Version: 5.0.38)
[mysqld(API)] 1 node(s)
id=4 @10.10.11.12 (Version: 5.0.38)