mvn -X archetype:generate -DarchetypeArtifactId=maven-archetype-quickstart -DgroupId=com.hordine -DartifactId=hordineCmdTwitter
mvn eclipse:eclipse
mvn package
mvn clean install
mvn -X archetype:generate -DarchetypeArtifactId=maven-archetype-quickstart -DgroupId=com.hordine -DartifactId=hordineCmdTwitter
mvn eclipse:eclipse
mvn package
mvn clean install
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class ShowActivity {
private final static String JSON_DATA =
"{"
+ " \"geodata\": ["
+ " {"
+ " \"id\": \"1\","
+ " \"name\": \"Julie Sherman\","
+ " \"gender\" : \"female\","
+ " \"latitude\" : \"37.33774833333334\","
+ " \"longitude\" : \"-121.88670166666667\""
+ " },"
+ " {"
+ " \"id\": \"2\","
+ " \"name\": \"Johnny Depp\","
+ " \"gender\" : \"male\","
+ " \"latitude\" : \"37.336453\","
+ " \"longitude\" : \"-121.884985\""
+ " }"
+ " ]"
+ "}";
public static void main(final String[] argv) throws JSONException {
final JSONObject obj = new JSONObject(JSON_DATA);
final JSONArray geodata = obj.getJSONArray("geodata");
final int n = geodata.length();
for (int i = 0; i < n; ++i) {
final JSONObject person = geodata.getJSONObject(i);
System.out.println(person.getInt("id"));
System.out.println(person.getString("name"));
System.out.println(person.getString("gender"));
System.out.println(person.getDouble("latitude"));
System.out.println(person.getDouble("longitude"));
}
}
}
Here's the output:C:\dev\scrap>java -cp json.jar;. ShowActivity
1
Julie Sherman
female
37.33774833333334
-121.88670166666667
2
Johnny Depp
male
37.336453
-121.884985
unzip file.zip
_blank
:<a href="#" target="_blank">Link</a>
Edit: for other examples, see here: http://www.w3schools.com/tags/att_a_target.aspblank
instead of _blank
because, if used, it'll open a new tab and then use the same tab if the
link is clicked again. However, this is only because, as GolezTrol
pointed out, it refers to the name a of a frame/window, which would be
set and used when the link is pressed again to open it in the same tab).com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 4,665,488 milliseconds ago.
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="validationQuery" value="SELECT 1"/>
<property name="testOnBorrow" value="true"/>
</bean>
The above will test connections every time you borrow from the pool.Yesterday I got this error message during the last step of the MySQL Windows installer: “The security settings could not be applied to the database because the connection has failed with the following error”.
The issue can be solved issue this procedure from the MySQL website.
First, cancel the wizard and make sure that the MySQL service is stopped.
Then, create a text file using a SQL query that will reset the root password.
1 2 | UPDATE mysql.user SET Password=PASSWORD('admin') WHERE User='root'; FLUSH PRIVILEGES; |
Then, launch mySQL using the following command line:
1 | mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server 5.5\my.ini" --init-file="C:\mysql-init.txt" --console |
Note: it’s better to use the ”–console” option so that error messages are correctly displayed.
Finally, open a new DOS shell and execute the following command line to shutdown mySQL:
1 | mysqladmin -u root -p shutdown |
You can now restart the mySQL installer and choose the “Repair” option:
:[range]s[ubstitute]/{pattern}/{string}/[flags] [count]
:%s/old-text/new-text/g
:s/I/We/gi
:1,10s/helo/hello/g
:'<,'>s/helo/hello/g
:s/helo/hello/g 4
Original Text: This is his idea :s/his/her/g Translated Text: Ther is her idea
Original Text: This is his idea :s/\<his\>/her/ Translated Text: This is her ideaNote:: You should enclose the word with < and > , which will force the substitution to search only for the full word and not any partial match.
Original Text: Linux is good. Life is nice. :%s/\(good\|nice\)/awesome/g Translated Text: Linux is awesome. Life is awesome.
:%s/\<\(hey\|hi\)\>/hai/g
:%s/awesome/wonderful/gc replace with wonderful (y/n/a/q/l/^E/^Y)?
:%s/^/\=line(".") . ". "/g
Original Text: Current file path is ~/test/ :%s!\~!\= expand($HOME)!g Translated Text: Current file path is /home/ramesh/test/You can use expand function to use all available predefined and user defined variables.
vi / vim tips & tricks series Article 1: Vi and Vim Editor: 3 Steps To Enable Thesaurus Option Article 2: Vim Autocommand: 3 Steps to Add Custom Header To Your File Article 3: 5 Awesome Examples For Automatic Word Completion Using Ctrl-X Article 4: Vi and Vim Macro Tutorial: How To Record and Play Article 5: Tutorial: Make Vim as Your C/C++ IDE Using c.vim Plugin Article 6: How To Add Bookmarks Inside Vim Editor Article 7: Make Vim as Your Bash-IDE Using bash-support Plugin Article 8: 3 Powerful Musketeers Of Vim Editor ? Macro, Mark and Map Article 9: 8 Essential Vim Editor Navigation Fundamentals Article 10: Vim Editor: How to Correct Spelling Mistakes Automatically Article 11: Transfer the Power of Vim Editor to Thunderbird for Email Article 12: Convert Vim Editor to Beautiful Source Code Browser
:4,$s/\d\+/\=submatch(0) + 1/
vi / vim tips & tricks series Article 1: Vi and Vim Editor: 3 Steps To Enable Thesaurus Option Article 2: Vim Autocommand: 3 Steps to Add Custom Header To Your File Article 4: 5 Awesome Examples For Automatic Word Completion Using Ctrl-X Article 5: Vi and Vim Macro Tutorial: How To Record and Play Article 6: Tutorial: Make Vim as Your C/C++ IDE Using c.vim Plugin Article 7: How To Add Bookmarks Inside Vim Editor Article 8: Make Vim as Your Bash-IDE Using bash-support Plugin Article 9: 3 Powerful Musketeers Of Vim Editor ? Macro, Mark and Map Article 10: 8 Essential Vim Editor Navigation Fundamentals Article 11: Vim Editor: How to Correct Spelling Mistakes Automatically Article 12: Transfer the Power of Vim Editor to Thunderbird for Email Article 13: Convert Vim Editor to Beautiful Source Code BrowserNote: Check the substitution changed the 3 to 4, 4 to 5 and so on. Now we can add a new line mentioning it as Article 3, and no need to do any manual changes.
:%s/\.\s*\w/\=toupper(submatch(0))/g
Lot of vi/vim tips and tricks are available at thegeekstuff.com. reading these articles will make you very productive. following activities can be done very easily using vim editor. a. source code walk through, b. record and play command executions, c. making the vim editor as ide for several languages, d. and several other @ vi/vim tips & tricks.
Lot of vi/vim tips and tricks are available at thegeekstuff.com. Reading these articles will make you very productive. Following activities can be done very easily using vim editor. a. Source code walk through, b. Record and play command executions, c. Making the vim editor as ide for several languages, d. And several other @ vi/vim tips & tricks.
gzip -dc archive.tar.gz | tar -xf - -C /destination
tar xzf archive.tar.gz -C /destination
uname -m
. It seems like the uname -m
actually givesx86_64 ==> 64-bit kernel
i686 ==> 32-bit kernel
lscpu
will list out these among other information regarding your CPU:Architecture: x86_64
CPU
op-mode(s): 32-bit, 64-bit
getconf LONG_BIT
Answer:
if ((1<<32)); then
echo 64bits
else
echo 32bits
fi
It's much more efficient than invoking another process or opening files.source ~/.bashrc
or, you can use the shorter version of the command:. ~/.bashrc
exec bash
does the same thing. (and easier to remember, at least for me)
JAVA_HOME=/etc/jdk1.7.0_07/
export JAVA_HOME
export PATH=$PATH:$JAVA_HOME/bin
It seems like it works just for while,
but after closing console have to do this again..
How to install it permanently?
You should add these lines to ~/.bashrc
,
which is sourced by interactive shells,
while ~/.bash_profile
is only sourced by interactive login shells.
To verify, open a new shell and echo "$JAVA_HOME"
.
ALTER TABLE table_name
CHANGE COLUMN old_column_name new_column_name DATATYPE NULL DEFAULT NULL;
RENAME TABLE `oldTableName` TO `newTableName`
To get the whole database structure as a set of CREATE TABLE statements, use mysqldump:
mysqldump database_name --compact --no-data
For single tables, add the table name after db name in mysqldump.
You get the same
results with SQL and SHOW CREATE TABLE,
SHOW CREATE TABLE table;
To read from schema.
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME ='products';
other commands which may be helpful
1. Login to Mysql,
-> mysql -u [username] -p
2. To see all databases inside mysql,
mysql -> show databases;
3. To go inside a particular database,
mysql -> use [database_name];
4. see all tables inside database,
mysql -> SHOW TABLES;
mysql -> DESCRIBE table;
GRANT ALL PRIVILEGES
ON database.*
TO 'user'@'yourremotehost'
IDENTIFIED BY 'newpassword';
!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto
">create</property>
or,
<property name="hbm2ddl.auto
">update</property>
<property name="hbm2ddl.auto" value="create"/>