dir *.csproj /b /s /ogn >> c:\temp\test.txt
setlocal EnableDelayedExpansion
set var1=true
if "%var1%"=="true" (
set var2=myvalue
echo !var2!
)
mstsc/v:server-tdc /console
%cd%
function inherit_A(Child, Parent)
{
var F = function () { };
F.prototype = Parent.prototype;
Child.prototype = new F();
Child.prototype.constructor = Child;
Child.super = Parent.prototype;
}
Current version
Request URL http://page.local/System/Agent/GetSignature?id=2&companyProfileId=1&test%5B%5D=1&test%5B%5D=2&test%5B%5D=3
$.ajax({
url: url,
data: {
id: thisId,
companyProfileId: companyProfileId,
test: [1,2,3]
},
success: function (data) {
if (data.Success) {
fillData(data);
}
}
});
Traditional (either per request or jQuery.ajaxSettings.traditional = true)
Request URL http://page.local/System/Agent/GetSignature?id=2&companyProfileId=2&test=1&test=2&test=3
Controller
public ActionResult GetSignature(int id, int companyProfileId, IEnumerable test)
$.ajax({
url: url,
traditional: true,
data: {
id: thisId,
companyProfileId: companyProfileId,
test: [1,2,3]
},
success: function (data) {
if (data.Success) {
fillData(data);
}
}
});
There two important things to note
dataType: "json",
contentType: 'application/json',
data: JSON.stringify(caseIdList),
$.ajax({
url: caseListDetailsUrl,
type: "POST",
dataType: "json",
contentType: 'application/json',
data: JSON.stringify(caseIdList),
success: function (data) {
if (data.Success) {
newCompanyProfileId = data.CompanyProfileId;
}
}
});
Controller public ActionResult GetCaseListDetails(IEnumerable caseIdList)
return (
<div className="previewPanel">
I am a PreviewPanel.<br/>
I am showing {this.props.caseId ? "case " + this.props.caseId : "nothing"}
{previewControl}
</div>
);
Store a reference to it, returned by renderComponent method and invoke setState, passing your data.
I. Force SQL server to support mixed-mode authentication.
- Run REGEDIT
- Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQLServer
NOTE: This key may vary slightly based on the installed version and instance name. - Set "LoginMode" to 2.
- Restart SQL Server.
(Source: http://support.microsoft.com/kb/285097)
II. Force SQL server to let you in temporarily
- Go to services.
- Stop SQL Server.
- Grab the SQL server command-line (right click the service - properties). Mine is:
"C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Binn\sqlservr.exe" -sSQLEXPRESS - Open an administrative command prompt.
- Run the command-line from step 3, but add -m -c for single-user maintenance mode command-line.
- Open another administrative command prompt.
- Run "sqlcmd -S localhost\SQLEXPRESS" from that same directory (replace with your server and instance name)
- Now you can do all the stuff everyone told you to do that didn't work. For example, to create a hero user with administrative access:
CREATE LOGIN hero WITH PASSWORD='123', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
EXEC sys.sp_addsrvrolemember @loginname = 'hero', @rolename = 'sysadmin'
GO
- QUIT and close the command-prompt
- Go to the SQL Server command-line window and hit ctrl+C. It will prompt "Do you wish to shutdown SQL Server (Y/N)?" and enter Y.
- Close the command-prompt
(Source: http://msdn.microsoft.com/en-us/library/dd207004.aspx)
III. Finally, login using your hero:
- Restart the SQL Server service
- Login using SQL Server authentication as the user "hero" with password "123"
- BAM now you are in. Now give yourself sysadmin access and delete the temporary user.
Declare @sqlstsmt nvarchar(200)
set @sqlstsmt=N'ALTER AUTHORIZATION ON DATABASE::['+DB_NAME()+N'] TO [sa]'
exec(@sqlstsmt)
go
Declare @sql nvarchar(200)
SET @sql = 'ALTER DATABASE [' + db_name() + '] SET TRUSTWORTHY ON'
EXEC sp_executeSql @sql
go
sp_configure 'clr enabled', 1
go
DECLARE @orderId INT;
SET @orderId = (SELECT TOP 1 orderId FROM [Order] ORDER BY OrderId DESC);
DECLARE @nextInvoiceDate dateTime;
SET @nextInvoiceDate = '12-31-2013';
UPDATE
Domain
SET
HasRunSetup = 1,
SetupComplete = 1,
NextInvoiceDate = @nextInvoiceDate
WHERE DomainId in (
SELECT domainId
FROM OrderDomain
WHERE OrderId = @orderId
)
-- Option 1
DECLARE @text NVARCHAR(MAX)
SELECT @text = [BodyText]
FROM [support].[dbo].[CommunicationEmail]
WHERE CommunicationId = 183
PRINT(@text)
-- Option 2, in case of very long texts
DECLARE @limit as int,
@charLen as int,
@current as int,
@chars as varchar(8000)
SET @limit = 8000
SELECT TOP 1 @charLen = DATALENGTH ([FopWithGiro])
FROM [outerface].[dbo].[Invoice]
where [InvoiceDraftId] = 122869
SET @current = 1
WHILE @current < @charLen
BEGIN
SELECT TOP 1 @chars = SUBSTRING([FopWithGiro],@current,@limit)
FROM [outerface].[dbo].[Invoice]
where [InvoiceDraftId] = 122869
PRINT @chars
SET @current = @current + @limit
END
INSERT INTO [webhusetlogin].[dbo].[EmployeeGroupLine]
SELECT EmployeeId, EmployeeGroupId
FROM [webhusetlogin].[dbo].[Employee]
CROSS JOIN (
SELECT 1400 AS EmployeeGroupId
UNION SELECT 1401
) Acl
USE AdventureWorks;
GO
DECLARE @p AS int;
SELECT @p=10
SELECT TOP(@p) *
FROM HumanResources.Employee;
GO
Should use
\s\S
instead of
(.|[\r\n])
Non-greedy quantifier(?)
<test>.*?</test>
will match first tag instead of the whole paragraph in
<test>12345</test><test>2</test><test>3</test>
rm -rf folder_name
rm linkname
or
unlink linkname
ls -la /var/lib/tomcat7/webapps/
ifconfig eth1 down
git clone -b my-branch git@github.com:user/myproject.git
git reset --hard HEAD
git pull
git stash save --keep-index
git stash drop
git checkout -b feature-branch-name source_branch_name
git push -u origin feature-branch-name
git push origin CORE-734_second_attempt
git status
git add <some-file>
git commit
git add .
git fetch && git checkout CORE-723-incorrect-handling-of-enable_websso
git pull
git config core.filemode false
git diff file_path
git reset --hard
git checkout master
git merge feature_branch_name
// fix all the merge conflicts
git add .
// use default message for commit - it's good enough
git commit
git push origin master
git checkout filename
git stash
git pull
git stash pop
git reset fil_name
If you screwed to push changes, create a separate branch, create a pull request from it. For existing branch do.
git reset --hard commit_id
git remote prune origin
git branch -d the_local_branch
git tag -a <tag-name> -m <message> <commit-hash>