copy and paste the following into 2 *.bat files.
RestoreIPV6Configuration.cmd:
*************************************************************
@echo off
set DumpLocation=%1
if exist %DumpLocation%\isatap.dump (
netsh interface isatap set state default
netsh -f %DumpLocation%\isatap.dump
)
if exiSt %DumpLocation%\6to4.dump (
netsh interface 6to4 set state default
netsh -f %DumpLocation%\6to4.dump
)
exit 0
*************************************************************
DisableIPV6Protocols.cmd
*************************************************************
@echo off
set DumpLocation=%1
netsh interface isatap dump state > %DumpLocation%\isatap.dump
netsh interface isatap set state disabled
netsh interface 6to4 dump state > %DumpLocation%\6to4.dump
netsh interface 6to4 set state disabled
exit 0
*************************************************************
Tuesday, March 30, 2010
IPV6 Configuration Script
at
10:31 AM
0
comments
Posted by
roni schuetz
Labels: batch
Saturday, November 28, 2009
write setup batch file based on processor architecure
take the following lines put it into a *.bat file and based on your OS the correct setup will be started.
@echo off
if /i "%PROCESSOR_ARCHITECTURE%" == "X86" "%~d0%~p0\x86\setup.exe"
if /i not "%PROCESSOR_ARCHITECTURE%" == "X86" "%~d0%~p0\x64\setup.exe"
at
1:31 PM
0
comments
Posted by
roni schuetz
Labels: batch
Monday, October 20, 2008
Backup and Restore Database for SQL Server
@echo off
@echo BatchJob Start
@echo %date% %time% %0 Start >> ".\!Log\all.log"
@echo on
"Start backup database DISK='%cd%\ABC.bak'" >> ".\!Log\all.log"
osql /E /S localhost /Q "backup database DISK='%cd%\ABC.bak'"
"c:\Program Files\WinRAR\winrar" a ABC.rar erp.bak -df -ibck
"Done backup database DISK='%cd%\ABC.bak'" >> ".\!Log\all.log"
REM NOW WE RESTORE IT
"Start restore database DISK='%cd%\ABC.bak'" >> ".\!Log\all.log"
osql /E /Q "restore database ERP from DISK='%cd%\ABC.bak'"
"Done restore database DISK='%cd%\ABC.bak'" >> ".\!Log\all.log"
@echo off
@echo %date% %time% %0 End >> ".\!Log\all.log"
at
1:00 PM
0
comments
Posted by
roni schuetz
Labels: batch, code sample, Database, SQL Server
Saturday, October 18, 2008
ORM (Object Relational Mapper) - what is available
Once you get familiar with ORM's you will "Love or Hate" the idea.
For a new project I write I decided to use once more an ORM Tool. There are so many ORM's outside there and because I develop it only in .Net C# and I love the idea for open source I decided I only go for an open source object relational mapper.
Microsoft comes out with some stuff called "Linq to SQL" and "Entity Framework". I could find lot of information about it but in the end I could NOT find a really working solution which is based on a n-tier architecture. Since my point of view is that applications are also applications which are based on different tiers or models I'm not satisfied with this "0815 / drag & drop" Microsoft solutions which are done in 5 minutes.
An application has to be divided into various tiers. Lets say it simple:
- Data Access Layer
- Business Object Layer
- Presentation Layer
if you need more well done but I prefer a clean architecture instead of one Website Project which contains a mix of anything. Can be that for other people it is good enough. Anyway, enough about my personal point of view.
Following criteria are important to me:
- Perspective on Performance
- Perspective on Data-source independence - access various data-sources SQL Server, OBDC etc.
- Perspective on Lazy Load of parent entities
- Perspective on Pluggable Creation Mechanism
- Perspective on Separation Of Tiers And Layering Preferences
- Perspective on Transactions Control
- Perspective on Mapping (1:1, 1:N, N:M)
- Perspective on Query Facilities
- http://www.ornetmapper.com/contact.aspx - Problems to generate ASP.Net Membership Tables needed to adapt code for creating first samples.
- http://www.codeplex.com/crudcodegen - Console application and doesn't display errors
- http://www.codeplex.com/IrisGenerator/Wiki/View.aspx?title=Quick%20Start&referringTitle=User%20Guide - Very nice UI but it throws an exception upon creation, after downloading the solution from codeplex I was not able to compile the solution.
- http://www.codeplex.com/ZFCGDAL - It's a Mygeneration Software Template. I loved to work in past with MyGen but the template Ver 2 does not work for some reasons.
- http://www.codeplex.com/affinityorm - It's only an attempt, currently it display tables and data but not more then that.
- http://www.codeplex.com/mitadata/ - Only contains a test project, not usable
- http://www.codeplex.com/LazyFramework/SourceControl/DownloadSourceCode.aspx?changeSetId=15856 - VB.Net - doesn't match my requirements.
http://www.codeplex.com/netopenfwk - Don't get what this should do with ORM.
http://www.codeplex.com/DbEntry - A huge framework and sample applications are available but how do I generate code I don't know - http://www.codeplex.com/Sculpture - Amazing Model Driven approach - you have to watch screen casts!!!!!
- http://www.codeplex.com/jmr - not active since aug. 2007
- http://www.codeplex.com/autodbupdater - Its not an ORM Mapper (DbUpdater keeps a simple record of all scripts that have previously been run against a database and which 'version' of the database each script was run against)
- http://www.codeplex.com/normal/SourceControl/ListDownloadableCommits.aspx - not active since dec. 2007 - download is not compilable
http://www.codeplex.com/worm - Web ORM - a mix of C# and VB.Net - no clue where to start. - http://www.codeplex.com/nanomapper - Very nice and simple but it would need extensions e.g. save xml schema and selection of tables which have to be generated.
- http://www.codeplex.com/SimpleDAL - started project need to check in some months agian
Notice: if you have an actual ORM mapper which is not listed above post them please (Only Open Source Projects please and no shareware - comments with links to shareware application will not be approved!!).
at
1:46 PM
0
comments
Posted by
roni schuetz
Labels: .net, batch, Code Generation, Database, open source, Oracle, ORM, SQL Server, WebServices
Tuesday, July 24, 2007
How To: Shrink Sql Server 2005 Log Files
Shrink Sql Server 2005 Log Filesuse YourDbName
backup log YourDbName with truncate_only
dbcc
shrinkfile(YourDbName_log)
if you copy your databases, names are not always the same! based on how do you copy it it still has the same name like the source database.. keep attention when you run it - then it shrinks e.g. 130 GB -> 22 MB .... many information goes away.
Update:
========
today i done some researches and I found the following thread:
http://www.eggheadcafe.com/software/aspnet/30488923/script-which-will-shrink.aspx
after some analyzing and test runs the follwoing solution worked for me:
CREATE TABLE #TDatabases(
DBName nvarchar(128),
DBLogicalName nvarchar(128)
)
INSERT INTO #TDatabases
SELECT db.name DBName, mf.name DBLogicalName
FROM sys.databases db join sys.master_files mf
on db.database_id = mf.database_id
WHERE db.name not in ('master', 'tempdb', 'model', 'msdb',
'distribution') AND type_desc LIKE 'log'
SET NOCOUNT ON
DECLARE @VarDBLogicalName nvarchar(128)
DECLARE @VarDBName nvarchar(128)
DECLARE @VarRowCount int
SELECT top 1 @VarDBName = DBName, @VarDBLogicalName = DBLogicalName
FROM #TDatabases
SET @VarRowCount = @@rowcount
WHILE @VarRowCount <> 0
BEGIN
EXEC(' use ' + @VarDBName + ' backup log '+ @VarDBName + ' with no_log
dbcc shrinkfile(''' + @VarDBLogicalName + ''', TRUNCATEONLY) WITH
NO_INFOMSGS')
DELETE
FROM #TDatabases
WHERE DBName = @VarDBName
SELECT top 1 @VarDBName = DBName, @VarDBLogicalName =
DBLogicalName
FROM #TDatabases
SET @VarRowCount = @@ROWCOUNT
END
DROP TABLE #TDatabases
SET NOCOUNT OFF
(otherwise search at google for: "osql shrink all db" in it doesn't fit your needs)
the above script you put now simply into a *.sql file (e.g.: shrinkalldatabases.sql).
now you need to create a second, which is simply a batch file (e.g.:startshrink.cmd) : *.bat or *.cmd. Into this file you write the following command:
osql -E -i shrinkalldatabases.sql -o result.txt
more info about osql you can find here: http://technet.microsoft.com/en-us/library/aa213088(SQL.80).aspx
all needed parameters are the following:
-E -> authentication
-i -> input file
-o -> output file
once you add it now to run once a week you have no further problems with your sql db sizes :-)
to have a small history and some additional information, here how I have created my *.cmd file:
@echo start: %date% %time% >> result.log
osql -E -i shrinkalldatabases.sql >> result.log
@echo end: %date% %time% >> result.log
enjoy it.
at
7:10 PM
1 comments
Posted by
roni schuetz
Friday, March 09, 2007
net use and error messages
the msdn bible contains everything:
System Error Codes
The following topics provide lists of system error codes. These values are defined in the WinError.h header file.
- System Error Codes (0-499)
- System Error Codes (500-999)
- System Error Codes (1000-1299)
- System Error Codes (1300-1699)
- System Error Codes (1700-3999)
- System Error Codes (4000-5999)
- System Error Codes (6000-8199)
- System Error Codes (8200-8999)
- System Error Codes (9000-11999)
- System Error Codes (12000-15999)
enjoy it.
Monday, February 19, 2007
How To: Execute a Batch file within Winform
just some code, I don't think there is to much to explain.
Copy & Paste it:
string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Replace(@"file:\", "");
// get some key from the config file.
string serviceIp = COM.Handler.Config.GetStringValueFromConfigByKey("IpAddress");
string vars = " " + serviceIp;
Process proc = new Process();
// attach the file
proc.StartInfo.FileName = @"YourBatchFile.cmd";
// pass arguments
proc.StartInfo.Arguments = vars;
// hidden run
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
// no need in my case for show errors.
proc.StartInfo.ErrorDialog = false;
// set the running path
proc.StartInfo.WorkingDirectory = path;
// start the process
proc.Start();
// wait until its done
proc.WaitForExit();
// any other number then 0 means it is an error.
if (proc.ExitCode != 0)
MessageBox.Show("Error executing in YourBatchFile.cmd", "Error", MessageBoxButtons.OK,MessageBoxIcon.Error);
hope this helps.
at
10:29 PM
0
comments
Posted by
roni schuetz
Labels: .net, batch, cmd, development, indeXus.Net
Tuesday, January 16, 2007
install Webpart dll's into your MOSS Server GAC with a simple VS post-build event
after many different tries how to automate that local deployment from the Win XP machine to my MOSS 2007 Development Server instance i figured out my way how to do this:
- Build your solution and your DLL is deployed :-)
that's all. I think that's pretty cool.
so how you do it:
- download PsExec v1.73
- create 2 batch files (*.bat or *.cmd)
- Batch No. 1: run's as post build event of your compilation
- this file should include the following steps:
1. receives as argument the dll full path and just the dll name;
e.g:
Arg 1: C:\MyProjects\VisualStudioSolution\Moss\indexus.net.dll
Arg 1: indexus.net.dll
2. you copy your arg 1 to a share on your server
2. you call your batch no. 2 with arg 2
- Batch No. 2: run's as remote batch file over psExec.
- don't forget that psExec is running like a local command line
on your server, you need to know where you have call it.
- C:\cmd\psExec.exe -d \YourServerName C:\YourServerShare\[arg no.2]
hope this helps!
at
10:33 PM
2
comments
Posted by
roni schuetz
Labels: batch, code sample, MOSS