Here is how you do grep in windows using powershell.
PS G:\> Get-ChildItem -Path G:\messages\processed | Select-String -Pattern “string pattern” | Measure-Object -Line
An attempt on useful blogging
Here is how you do grep in windows using powershell.
PS G:\> Get-ChildItem -Path G:\messages\processed | Select-String -Pattern “string pattern” | Measure-Object -Line
Sometimes you might need to figure out your tomcat version from within the folder where you run tomcat from. The below command will help you get the details.
java -cp lib/catalina.jar org.apache.catalina.util.ServerInfo
/usr/share/tomcat7$ java -cp lib/catalina.jar org.apache.catalina.util.ServerInfo
Server version: Apache Tomcat/7.0.81
Server built: Aug 11 2017 10:21:27 UTC
Server number: 7.0.81.0
OS Name: Linux
OS Version: 3.13.0-95-generic
Architecture: amd64
JVM Version: 1.7.0_75-b13
JVM Vendor: Oracle Corporation
when you got to download from a site that ask for authentication details use the below flags to specify the user and password details
wget –user=’yourusernamehere’ –password=’yourpasswordhere’ –auth-no-challenge https://yoururlhere.com
ERROR 1217 (23000) at line 287: Cannot delete or update a parent row: a foreign key constraint fails
If you got this error, it means that you are trying to restore a database sql file which got dependancy on other tables.
To override and restore anyway, add this to the top of the .sql dump file
SET FOREIGN_KEY_CHECKS = 0;
This will make sure that the foreign key checks are disabled for the session while restoring.
Use the mysql admin tool to see the rows inserted
mysqladmin -u root -p extended -r -i 10 |grep ‘Innodb_rows_inserted ‘
Also you can use the processlist command inside mysql to view the activity. This will be best if there are no other activities going on the mysql db
mysql> show processlist;
ERROR 2006 (HY000) at line 257: MySQL server has gone away
When doing a mysql dump to the database, if you get this error, it means that you have a connection timeout on the database or your restore is doing a chunk of data that exceeds the max allowed packets.
Solution:
If you are on AWS follow the steps below
Once your instance has rebooted, you should be able to do larger sql imports.
Once you’ve completed your import, switch your instance parameter group back to the default parameter group and reboot it again.
On mysql server
Increase the settings in my.cnf file and restart mysql.
max_allowed_packet=64M
wait_timeout=2400
Find the database size of each database
Run the below query at the mysql prompt
SELECT table_schema “Data Base Name”,
sum( data_length + index_length ) / 1024 / 1024 “Data Base Size in MB”,
sum( data_free )/ 1024 / 1024 “Free Space in MB”
FROM information_schema.TABLES
GROUP BY table_schema ;
Any app downloaded from sources other than appstore might have prompted you with the error like below.
can’t be opened as it is from an unidentified developer
You will not have the button to open the application.
Most tricks to click on the application while holding ctrl or alt key will will not work.
The trick is the execute the below command from the terminal.
sudo spctl --master-disable
In linux. Go to command line.
ps aux | grep ‘java’
jmap -dump:format=b,file=/tmp/heapdump-001.hprof <process id>
$ jmap -dump:format=b,file=/tmp/heapdump-001.hprof 31467
Dumping heap to /tmp/heapdump-001.hprof …
Heap dump file created
The dump file wil be generated at /tmp/heapdump-001.hprof.
$ ls -al /tmp/heapdump-001.hprof
-rw——- 1 admin admin 48657063 Feb 23 10:00 /tmp/heapdump-001.hprof
You can use Eclipse Memory Analyzer to analyze the heap dumps
http://www.eclipse.org/mat/