0
Posted on 6:04 AM by Softminer and filed under
SQL
DECLARE @DBName varchar(255) DECLARE @LogName varchar(255) DECLARE @DATABASES_Fetch int DECLARE DATABASES_CURSOR CURSOR FOR select distinct name, db_name(s_mf.database_id) dbName from sys.master_files s_mf where s_mf.state = 0 and -- ONLINE has_dbaccess(db_name(s_mf.database_id)) = 1 -- Only look at databases to which we have access and db_name(s_mf.database_id) not in ('Master','tempdb','model') and db_name(s_mf.database_id) not like 'MSDB%' and db_name(s_mf.database_id) not like 'Report%' and type=1 order by db_name(s_mf.database_id) OPEN DATABASES_CURSOR FETCH NEXT FROM DATABASES_CURSOR INTO @LogName, @DBName WHILE @@FETCH_STATUS = 0 BEGIN exec ('USE [' + @DBName + '] ; DBCC SHRINKFILE (N''' + @LogName + ''' , 0, TRUNCATEONLY)') FETCH NEXT FROM DATABASES_CURSOR INTO @LogName, @DBName END CLOSE DATABASES_CURSOR DEALLOCATE DATABASES_CURSOR
8
backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql backup: C:\Parallels\Plesk\Databases\MySQL\bin>mysqldump.exe -u admin_user -pPASS
S admin_database > c:\file.sql
restore:
mysql -u user -p database < file.sql
MYSQL Query cache
http://www.databasejournal.com/features/mysql/article.php/3110171/MySQLs-Query-Cache.htm
http://www.cyberciti.biz/tips/enable-the-query-cache-in-mysql-to-improve-performance.html
Posted on 6:21 AM by Softminer and filed under
MySQL
backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql backup: C:\Parallels\Plesk\Databases\MySQL\bin>mysqldump.exe -u admin_user -pPASS
S admin_database > c:\file.sql
restore:
mysql -u user -p database < file.sql
MYSQL Query cache
http://www.databasejournal.com/features/mysql/article.php/3110171/MySQLs-Query-Cache.htm
http://www.cyberciti.biz/tips/enable-the-query-cache-in-mysql-to-improve-performance.html
210
Posted on 5:00 AM by Softminer and filed under
C#
using (System.Diagnostics.EventLog eventLog = new System.Diagnostics.EventLog("Application")) { eventLog.Source = "Application"; eventLog.WriteEntry("Before Call", System.Diagnostics.EventLogEntryType.Information, 101, 1); }
1
BEGIN TRANSACTION;
update Table1
set column1 = 'value1'
where key = 1
update Table2
set column2 = 'value2'
where key = 2
--COMMIT
--ROLLBACK
-- First run with "BEGIN TRANSACTION"
-- If it was OK then run "COMMIT"
-- If it was not OK then run "ROLLBACK"
Posted on 3:32 AM by Softminer and filed under
SQL
BEGIN TRANSACTION;
update Table1
set column1 = 'value1'
where key = 1
update Table2
set column2 = 'value2'
where key = 2
--COMMIT
--ROLLBACK
-- First run with "BEGIN TRANSACTION"
-- If it was OK then run "COMMIT"
-- If it was not OK then run "ROLLBACK"
0
TO be able to see files checked out you need to install TFS power tools
after that you will be able to run command prompt for visual studio
tf status itemspec [/collection:TeamProjectCollectionUrl] [/login:username,[password]] ([/workspace:workspacename[;workspaceowner]]|[/shelveset:shelvesetname[;shelvesetowner]])[/format:(brief|detailed)]
[/recursive][/user:(*|username)]
More Info
example
tf status "$/Project/MyApp" /collection:http://tfs:8080/tfs /user:myuser /recursive /workspace:myworkspace
To view it in Visual studio GUI
Right click on the top most folder that you want to start in
Choose "Find In Source Control"
Choose "Status"
Check "Recursive"
Check "Status"
Enter userid in the "Display files checked out to:" box (i have to include my domain, i.e. domain\userid)
Click "Find"
Posted on 4:05 AM by Softminer and filed under
TFS
TO be able to see files checked out you need to install TFS power tools
after that you will be able to run command prompt for visual studio
tf status itemspec [/collection:TeamProjectCollectionUrl] [/login:username,[password]] ([/workspace:workspacename[;workspaceowner]]|[/shelveset:shelvesetname[;shelvesetowner]])[/format:(brief|detailed)]
[/recursive][/user:(*|username)]
More Info
example
tf status "$/Project/MyApp" /collection:http://tfs:8080/tfs /user:myuser /recursive /workspace:myworkspace
To view it in Visual studio GUI
Right click on the top most folder that you want to start in
Choose "Find In Source Control"
Choose "Status"
Check "Recursive"
Check "Status"
Enter userid in the "Display files checked out to:" box (i have to include my domain, i.e. domain\userid)
Click "Find"
1
Here is a simple example of reading file using javascript, more info on links
+
+
+
Posted on 7:40 AM by Softminer and filed under
HTML,
JavaScript
Here is a simple example of reading file using javascript, more info on links
+
+
+
<input type="file" id="fileinput" /> <script type="text/javascript"> function readSingleFile(evt) { //Retrieve the first (and only!) File from the FileList object var f = evt.target.files[0]; if (f) { var r = new FileReader(); r.onload = function(e) { var contents = e.target.result; alert( "Got the file.n" +"name: " + f.name + "n" +"type: " + f.type + "n" +"size: " + f.size + " bytesn" + "starts with: " + contents.substr(1, contents.indexOf("n")) ); } r.readAsText(f); } else { alert("Failed to load file"); } } document.getElementById('fileinput').addEventListener('change', readSingleFile, false); </script>
