tag:blogger.com,1999:blog-41287677097857596092024-02-21T01:33:55.184-08:00w3ka dev - share the knowledge .NETPlamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.comBlogger153125tag:blogger.com,1999:blog-4128767709785759609.post-26795681178730138362020-01-19T13:49:00.003-08:002020-01-19T13:51:37.300-08:00Kill process holding a port / listening on portUsing Command Prompt (cmd.exe) execute the following:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">netstat -aon |find "</span><span style="font-family: "courier new", courier, monospace;">[port]</span><span style="font-family: "courier new", courier, monospace;">"</span><br />
<br />
ex.<br />
<span style="font-family: "courier new" , "courier" , monospace;">netstat -aon |find "8080"</span><br />
<br />
find the processi listening on the selected port an kill it<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">taskkill /f /pid [port]<port></port></span><br />
<br />
ex.<br />
<span style="font-family: "courier new" , "courier" , monospace;">taskkill /f /pid 13708</span><br />
<br />
The following message confirms the action:<br />
SUCCESS: The process with PID [port] <port>has been terminated.</port><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-72521875708709888182018-09-19T08:55:00.003-07:002018-09-19T08:57:59.397-07:00Case insensitive filtering of OData service in SAPUI5Filtering JSON model is case insensitive, but for OData models this is not the case. OData service filtering is case sensitive by design. In order to achieve case insensitive searching or filtering we can use the good old way of lowering the filter string and the string we search in.<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">var oFilter = new Filter(<br /> "tolower(LastName)",<br /> FilterOperator.Contains,<br /> "'" + filterString.toLowerCase().replace("'","''") + "'"<br /> );</span></blockquote>
<br />
When we use a search string like "O'donnell" this translates into:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">$filter=substringof(%27o%27%27donnell%27, tolower(FirstName))</span></blockquote>
<br />
As per OData specification the text we search in can be lowered using tolower():<br />
<blockquote class="tr_bq">
<span style=""><span style="font-family: "courier new" , "courier" , monospace;">tolower(FirstName)</span> </span></blockquote>
<br />
<br />
The searched text has to be lowered as well using the javascript function toLowerCase(). In addition it is surrounded by quotes to ensure it is a string when added to the odata filter. And finally to avoid problems if the search string contains quotes we have to escape them by replacing with two quotes.<br />
<br />
Happy coding!<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-77141946103341042802018-04-24T10:21:00.000-07:002019-01-17T10:26:23.831-08:00How to keep HTML table rows undivided by page breaks when printing HTML into PDF?<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmxN_i-1TMrLXL75ebaZ5nwWDqn3tqvhgXwbK44rnr2j9sGff_78P3GEWBlc1OCjS7Bn9iTM5E1xFgOP5ZQ4zE-MoK_DA47mSvGWZXaFGD7ZdeIuGOBTBXwt_mtV4E0TywmkZGFcOHSg/s1600/77.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" data-original-height="210" data-original-width="223" height="186" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmxN_i-1TMrLXL75ebaZ5nwWDqn3tqvhgXwbK44rnr2j9sGff_78P3GEWBlc1OCjS7Bn9iTM5E1xFgOP5ZQ4zE-MoK_DA47mSvGWZXaFGD7ZdeIuGOBTBXwt_mtV4E0TywmkZGFcOHSg/s200/77.JPG" width="200" /></a>When printing large HTML tables it happens that a row gets wrongly divided between two pages. In order to solve this we can instruct the printer to keep the row on only one of the pages by adding CSS style to the table row.:<br /><br />When <span style="font-family: Courier New, Courier, monospace;">page-break-inside</span> property is set to <span style="font-family: Courier New, Courier, monospace;">avoid</span> the page-break should be avoided inside a HTML element, in this case table row. Of course ti can be applied to other elements like pre, blockquote, etc.</div>
<blockquote class="tr_bq" style="clear: both; text-align: left;">
<span style="font-family: Courier New, Courier, monospace;">tr{<br /> page-break-inside:avoid;<br /> page-break-after:auto<br />}</span></blockquote>
<br />
<br /><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-17725148454204352942018-03-02T07:45:00.000-08:002018-09-07T07:47:05.359-07:00Javascript delete property vs. nullifying it?Let's start with a simple object:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">var person = {<br /> firstName: 'John',<br /> middleName: 'D.',<br /> lastName: 'Doe'<br />}</span></blockquote>
<br />
The most common way to get rid of a property value is to nullify it or make it undefined.<br />
Ex.<br />
<span style="font-family: Courier New, Courier, monospace;">person.middleName = null;</span><br />
or<br />
<span style="font-family: Courier New, Courier, monospace;">person.middleName = undefined;</span><br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">var person = {<br /> firstName: 'John',<br /> middleName: null,<br /> lastName: 'Doe'<br />}</span></blockquote>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<br />
Other way is to just delete it.<br />
<br />
The delete operator does a different job by removing the whole property, returning true or false to indicate the success of the operation. In fact the deletion does not do anything related to freeing memory or releasing resources. It is just removing the property so it no longer appears in the object skeleton.<br />
Ex.<br />
<span style="font-family: Courier New, Courier, monospace;">delete person.middleName;</span><br />
<br />
This will result into<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">var person = {<br /> firstName: 'John',<br /> lastName: 'Doe'<br />}</span></blockquote>
<div>
Obviously deleting a property may help in cases when you need to enumerate the object properties and property must not appear any more. </div>
<div>
<br /></div>
<div>
Deleting an array element is a different thing. The deleted element gets undefined, but the actual array length is not changing. The actual usage difference between using 'undefined' or delete operator appears to be in object properties. </div>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-77086341539540878942018-01-18T14:32:00.000-08:002018-08-18T14:33:34.949-07:00What is ECMAScript and ES6, ES7, etc.?ECMA is an association for standardizing information and communication systems. ECMA standardizes JavaScript under the name of ECMAScript.<br />
In a nutshell ECMAScript is a standard while JavaScript is the implementation of this standard. <br />
<br />
All name like ES1, ES2, ES3, ES4, ES5, ES6, ES7, etc., are abbreviations of the ECMAScript version.<br />
ES6 was issued in 2015 and also called ES2015. As of 2015, all new versions of ES are supposed to be named by the year - ES2016 (ES7), ES2018 (ES8), etc.<br />
<br />
ES.next is the abbreviation of all upcoming, not standardized yet versions.<br />
<br />
The ECMA standard is supported by browsers. The following table provide extensive information about the browser support, feature by feature:<br />
<a href="https://kangax.github.io/compat-table/es6/">https://kangax.github.io/compat-table/es6/</a><br />
<br />
In order to provide better browser support, tools like Babel can help you use latest JavaScript features into older browsers. Babel is a JavaScript compiler, more precisely said - a transpiler, that allows developers to program using ES6 feature converted to a Javascript code that current browsers can process. React (ReactJS) is a great example of Babel usage.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-75229715703871672322017-04-06T01:00:00.000-07:002018-10-06T01:03:10.436-07:00How to redirect permanently to a different domain with ASP.NET?The redirect forwards the users and respectively the search engine to a new url. The redirections can be achieved in various ways. Commonly used are the HTTP status codes "301 Moved Permanently" and "302 Moved Temporarily".<br />
<br />
In regards to the SEO (Search Engine Optimization) it is recommended to use status code 301 to inform the search engine that the previous url will not longer be in use.
This url forwarding can be implemented within Global.asax as follows:
<br />
<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e)<br />{<br /> string url = HttpContext.Current.Request.Url.OriginalString.ToLower();<br /> if(url.Contains("old-domain.com"))<br /> { <br /> Response.StatusCode = 301;<br /> Response.AddHeader("Location",<br /> url.Replace("old-domain.com", "new-domain.com")); <br /> Response.End();<br /> }<br />}</span><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-15679643011259143542016-09-28T14:57:00.003-07:002016-09-28T14:58:58.953-07:00A quick guide how to write safe SQL scriptsThis is quite trivial but I am going to provide few common examples how to ensure safe multiple run of sql server scripts. Of course we have to check if the script has already been executed to avoid errors or duplication.<br />
<br />
<b>SQL TABLE</b><br />
Check if a table exists before its creation:<br />
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">IF (NOT EXISTS<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>(SELECT * FROM INFORMATION_SCHEMA.TABLES<br /> WHERE TABLE_SCHEMA = N'SchemaName'<br /> AND TABLE_NAME = N'TableName'))<br />BEGIN<br /> --Run table creation script<br />END</span></blockquote>
<br />
<b>SQL TABLE COLUMN</b><br />
Check if a column exists before adding it:<br />
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">IF NOT EXISTS(<br /> SELECT * FROM sys.columns WHERE Name = N'ColumnName'<br /> AND Object_ID = Object_ID(N'TableName'))<br />BEGIN<br /> --Run column definition script<br />END</span></blockquote>
<br />
<b>SQL VIEW</b><br />
Check if a view exists and remove it in order to safely create the one:<br />
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">IF EXISTS(select * FROM sys.views where name = N'ViewName')<br />BEGIN<br /> DROP VIEW ViewName<br />END </span> </blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">go</span> </blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">CREATE VIEW ViewName ....</span></blockquote>
<br />
<b>SQL STORED PROCEDURE</b><br />
Check if a stored procedure exists and remove it<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">IF EXISTS (SELECT * FROM sys.objects<br /> WHERE object_id = OBJECT_ID(N'ProcName')<br /> AND type IN ( N'P', N'PC' ) )<br />BEGIN<br /> DROP PROCEDURE dbo.[ProcName]<br />END<br />go<br />CREATE PROCEDURE ...</span></blockquote>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<b>SQL FUNCTION</b><br />
Check if a function exists and remove it<br />
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">IF EXISTS (SELECT * FROM sys.objects<br /> WHERE object_id = OBJECT_ID(N'[dbo].[FuncName]')<br /> AND type IN ( N'FN', N'IF', N'TF', N'FS', N'FT' ))<br />BEGIN<br /> DROP FUNCTION [dbo].[FuncName]<br />END<br />go<br />CREATE FUNCTION...</span></blockquote>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<b>SQL TABLE INDEX</b><br />
Check if an index exists and remove it<br />
<span style="font-family: "courier new" , "courier" , monospace;"></span><br />
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">IF EXISTS (SELECT * FROM sys.indexes<br /> WHERE name='IndexName'<br /> AND object_id = OBJECT_ID('TableName'))<br />BEGIN<br /> --DROP INDEX ...<br />END</span></blockquote>
<br />
<b>SQL DATA ENTRY</b><br />
Check whether data has already been updated.<br />
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">IF NOT EXISTS (SELECT * FROM SampleTable WHERE <i><condition></condition></i>)<br />BEGIN<br /> INSERT INTO SampleTable...<br />END<br /><br />IF EXISTS (SELECT * FROM SampleTable WHERE <i><condition></condition></i>)<br />BEGIN<br /> UPDATE SampleTable SET .... WHERE <i><condition></condition></i><br />END</span></blockquote>
<br />
<br />
<br /><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-82538701837945058752016-08-21T09:01:00.000-07:002018-08-22T09:03:02.054-07:00How to check if JavaScript function exists?Checking if function exists differs from the regular object checking. In order to ensure a function exists you can use typeof operator for the verification.<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">if (typeof myFunctionName === 'function') {<br /> myFunctionName();<br />}</span></blockquote>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-2525546879139207962016-01-20T01:57:00.000-08:002016-02-20T02:00:02.416-08:00Rebuild SQL database indexes<div class="tr_bq">
In this article I will not be going through the matter of indexes.The purpose of the post is to provide a quick reference to a manually triggered re-indexing process. What is important to be understood is the fill-factor for every particular index. The fill-factor value defines the percentage of space in every index page to be filled with data and respectively defines the space left as free space for future growth.</div>
<br />
Here is the recommended fill-factor values based on the reads-writes balance:<br />
<u>Tables with low number of updates</u><br />
- ex. 100:1 read to write ratio: 100% fill-factor<br />
<u>Tables with high number of updates </u><br />
- read to write ratio less than 1 (more writes than read) : 50%-70% fill-factor<br />
<u>Tables with average number of updates</u> - 80%-90% fill-factor<br />
<br />
<blockquote>
DECLARE @from int<br />
DECLARE @to int<br />
DECLARE @fillFactor int<br />
SET @from=1<br />
SET @to=10000<br />
SET @fillFactor=90<br />
DECLARE @dateFrom datetime<br />
DECLARE @table varchar(255)<br />
DECLARE TableCursor CURSOR FOR<br />
SELECT table_name from(<br />
SELECT ROW_NUMBER() OVER (ORDER BY table_name) AS [SortNum], table_name FROM information_schema.tables<br />
WHERE table_type = 'base table')<br />
AS t1 WHERE sortnum>=@from and sortnum<=@to<br />
OPEN TableCursor<br />
FETCH NEXT FROM TableCursor INTO @table<br />
WHILE @@FETCH_STATUS = 0<br />
BEGIN<br />
BEGIN TRY<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>SET @dateFrom = getdate()<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>DBCC DBREINDEX(@table,' ',@fillFactor)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>print 'Table ['+@table+'] indexed for: '+ CAST( DATEDIFF ( ms , @dateFrom , getDate() ) as nvarchar(10)) + ' ms'<br />
END TRY<br />
BEGIN CATCH<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>print 'Number of errors: '+CAST(ISNULL( ERROR_NUMBER(),'') as nvarchar)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>print 'Error: '+ISNULL(ERROR_MESSAGE(),'')<br />
END CATCH<br />
<br />
FETCH NEXT FROM TableCursor INTO @table<br />
END<br />
CLOSE TableCursor<br />
DEALLOCATE TableCursor</blockquote>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-13113562506052502612015-09-24T04:25:00.000-07:002016-02-20T04:26:04.698-08:00Change Collation of a Mirrored Databse<div class="tr_bq">
<br /></div>
If you have already tried this directly you have probably seen messages like the action is not available on databases involved in mirroring or database unable to be locked and so on.<br />
<br />
So first you have to the database from the mirror session, then do the necessary change actions and restore the mirror session. Ex,<br />
<br />
<blockquote>
ALTER DATABASE <db name=""> SET PARTNER OFF<br />ALTER DATABASE <db name=""> SET SINGLE_USER WITH ROLLBACK IMMEDIATE<br />ALTER DATABASE <db name=""> COLLATE SQL_Latin1_General_CP1_CI_AS</db></db></db></blockquote>
<br />
On the mirrored database:<br />
<blockquote class="tr_bq">
RESTORE DATABASE <db name=""> WITH RECOVERY</db></blockquote>
<br />
<br />
Error Messages:<br />
<br />
<ul>
<li><i>The database could not be exclusively locked to perform the operation. </i></li>
<li><i>The operation cannot be performed on database it is involved in a database mirroring session or an availability group </i></li>
</ul>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-61434774203272481182015-01-28T13:31:00.000-08:002016-02-20T04:26:20.590-08:00Windows God ModeWhat is that?<br />
<br />
This is your windows command center with a lot of configurable setting to control your windows.<br />
It is simple to be the Windows God by simply creating a new folder named<br />
<br />
GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}<br />
<br />
Here we go. The folder contains a lot of options making you the master of your computer.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigzA0XaywV-6JASHFK89PoYmlklp3t7uF5c0BLblPJlocXAlwYuII_qc3Oe3n7xwJnEOvdK7P9rYX8lWPjlkn_MzPyKar4z2Sqn2iMRAj4Kk3hi40n_xu8uG8ds4LThxalRpzsAD2Tow/s1600/Capture.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="262" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigzA0XaywV-6JASHFK89PoYmlklp3t7uF5c0BLblPJlocXAlwYuII_qc3Oe3n7xwJnEOvdK7P9rYX8lWPjlkn_MzPyKar4z2Sqn2iMRAj4Kk3hi40n_xu8uG8ds4LThxalRpzsAD2Tow/s1600/Capture.PNG" width="320" /></a></div>
<br />
<br />
Cheers!<br />
<br />
<br /><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-69794242295263885902014-09-29T10:45:00.000-07:002016-02-20T04:26:31.528-08:00Speed up Visual Studio in few easy steps1. Delete C:\Users\[username]\AppData\Local\Microsoft\WebSiteCache content<br />
2. Delete C:\Users\[username]\AppData\Local\Temp\Temporary ASP.NET Files content<br />
3. Uncheck Tools -> Options -> Debugging -> Edit and Continue -> Enable Edit and Continue<br />
4. Uncheck Tools -> Options -> Environment -> Use hardware graphics acceleration if available<br />
<br /><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-53345603494635617642014-05-20T06:39:00.000-07:002014-05-20T06:39:24.281-07:00Easy way to write messages in javascript console without firebugVery simple solution w/o any prerequisites. No need to install anything like firebug or javascript library to log activities.<br />
<br />
function writeLog(log) {<br />
setTimeout(function() { throw new Error(log); }, 0);<br />
}<br />
<br />
The javascript exceptions are automatically caught in the console, thus forcing an error writes into the console. In order to not brake any js execution use setTimeout to run the error into another thread. <div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-19600549256406601622014-02-03T12:48:00.003-08:002014-02-03T12:50:36.313-08:00The Fastest Bitcoin Exchange MCXNow is BackThe fastest and maybe the most reliable bitcoin exchange <a href="https://mcxnow.com/?r=pkasabov" rel="nofollow" target="_blank">MCXNow</a> has been reopened. Just for a few days it got all its users back and even more - it gained thousands of new users. Earn from trading and get interest for all deposited money. Additionally shares could be bought to increase your revenue by receiving dividents every 3 hours.<br />
<br />
Happy trading!<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-7070264465255620232013-07-17T23:58:00.000-07:002013-07-17T23:58:28.328-07:00How to move windows between monitors with Windows 7I had this problem for some time. I use multiple monitors and my video settings are set always like that, even when I do not really need all monitors and use only the primary one. It is very often to lose a window of an application on another monitor seeing its icon on the taskbar of my primary screen. Restore, cascade, show stacked commands are just useless in this case as they only rearrange the windows of the main monitor. But there is a way to fix that by a few key shortcuts.<br />
<br />
<b>Win+Shift+Left</b> - moves window to the left monitor<br />
<b>Win+Shift+Right</b> - moves window to the right monitor<br />
and maybe Up and Down to move to the upper or lower monitor - I do not have monitors above and below so I couldnt test these.<br />
<br />
<b>Win+Left</b> - adheres the window to the left half of the screen. Continuous clicking causes moving the window to another monitor.<br />
<b>Win+Right</b> - adheres the window on the right half of the screen. Continuous clicking causes moving the window to another monitor.<br />
<b>Win+Up</b> - maximizes the window<br />
<b>Win+Down</b> - Minimizes and restores if maximized<br />
<br />
<br />
<br /><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-44786461692319801802013-06-28T12:56:00.000-07:002013-06-28T12:58:54.087-07:00How to find the largest sql objects in an SQL Server databaseSometimes you may need know how big some tables are, how many rows they have and how much disk space they use.<br />
<br />
The following query looks for the biggest tables in size (MB) and number of rows:<br />
<br />
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">SELECT * FROM (</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">SELECT </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> tbl.NAME AS TableName,</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> ind.name as indexName,</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> sum(p.rows) as RowCounts,</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> (sum(a.total_pages) * 8) / 1024 as TotalSpaceMB, </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> (sum(a.used_pages) * 8) / 1024 as UsedSpaceMB, </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> (sum(a.data_pages) * 8) / 1024 as DataSpaceMB</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">FROM </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> sys.tables tbl INNER JOIN </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> sys.indexes ind ON tbl.OBJECT_ID = ind.object_id INNER JOIN </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> sys.partitions p ON ind.object_id = p.OBJECT_ID AND ind.index_id = p.index_id INNER JOIN </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> sys.allocation_units a ON p.partition_id = a.container_id</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">WHERE </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> tbl.NAME NOT LIKE 'dt%' AND</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> ind.OBJECT_ID > 255 AND </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> ind.index_id <= 1</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">GROUP BY tbl.NAME, ind.object_id, ind.index_id, ind.name </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">) as t1 ORDER BY TotalSpaceMB desc ,UsedSpaceMB desc</span></blockquote>
</blockquote>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-28391102751109746282013-03-18T07:39:00.002-07:002013-03-18T07:39:32.112-07:00How to replace a character in Excel with a new lineHere is the trick:<br />
<br />
1. Select the character or string you would like to replace<br />
2. Copy (Ctrl+C)<br />
3. Open Find Dialog (Ctrl+F) and open Replace Tab<br />
4. Paste the string to be repalced in the firts textbox (Ctrl+V)<br />
5. Enter in the second textbox Alt+010 which represents a new line with its ASCII equivalent.<br />
6. Click replace and enjoy.<br />
<br />
<br />
<br /><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-23333763440560840512012-05-28T03:17:00.000-07:002012-05-28T03:33:55.995-07:00Extract url / adress from hyperlink cell in Excel1. Go to Visual Basic for Applications module by clicking Alt+F11<br />
2. Create new Module by Insert->Module<br />
3. Create a simple function in the newly created module
<br />
<blockquote>
<span style="font-family: 'Courier New', Courier, monospace;">Function GetCellUrl(LinkCell as Range)</span></blockquote>
<blockquote>
<span style="font-family: 'Courier New', Courier, monospace;"> If LnkCell.Hyperlinks.Count = 0 Then</span></blockquote>
<blockquote>
<span style="font-family: 'Courier New', Courier, monospace;"> GetCellUrl = ""</span></blockquote>
<blockquote>
<span style="font-family: 'Courier New', Courier, monospace;"> Else</span> </blockquote>
<blockquote>
<span style="font-family: 'Courier New', Courier, monospace;"> GetCellUrl = LnkCell.Hyperlinks(1).Address</span></blockquote>
<span style="font-family: 'Courier New', Courier, monospace;"> End If</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> End Function</span><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-18082580027638094952012-04-17T12:09:00.002-07:002012-04-17T12:18:17.546-07:00SQL - How to delete table content quicklyThe deletion of table content may take significant amount of time when the number of rows is large. This is so because every singe row deletion is logged into the database transaction log. <br />In the cases that the deletion log is not important you can simply remove the data rows w/o logging any individual row deletion by truncating the table:<br /><br /><blockquote>TRUNCATE TABLE [TableName]</blockquote><br /><br />Reference:<br /><a href="http://msdn.microsoft.com/en-us/library/ms177570.aspx">http://msdn.microsoft.com/en-us/library/ms177570.aspx</a><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-5280084322992717102012-04-02T07:11:00.004-07:002012-04-02T07:20:42.197-07:00100% CPU usage by SQL Server - Look for Active (running) SQL queriesI found a very useful posts regarding analysis of currently running SQL queries and high SQL server load in Pinal Dave's blog.<br /><br /><a href="http://blog.sqlauthority.com/2009/01/07/sql-server-find-currently-running-query-t-sql/">http://blog.sqlauthority.com/2009/01/07/sql-server-find-currently-running-query-t-sql/</a><br /><br /><a href="http://blog.sqlauthority.com/2009/01/02/sql-server-2008-2005-find-longest-running-query-tsql/">http://blog.sqlauthority.com/2009/01/02/sql-server-2008-2005-find-longest-running-query-tsql/</a><br /><br />Using these tricks the culprit of the high load can be easily indicated. <br /><br />Until the problem resolution is implemented KILL [session_id] can stop the problematic query w/o server restart or long waiting.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-46135193516504758032011-11-01T08:19:00.000-07:002011-11-01T08:26:15.491-07:00Windows 7: How to access password protected shared folderHow to pass current Windows credentials to password protected network share<br /><br />1. Create user/password on destination computer matching the user/password of current computer<br />2. Share a folder on the destination computer giving access to the new created user<br />3. On current computer change the local security settings as following:<br /> 3.1 Open Local Security Policy Console<br /> 3.2 Select Local policies -> Security Options -> Network security: LAN Manager authentication level<br /> 3.3 Select Send LM and NTLM response and click OK.<br /><br /><br />You can also specify different user to connect by during mapping a network drive on the destination computer.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-25802571030485992192011-07-14T08:42:00.000-07:002013-08-02T05:03:45.520-07:00IIS Redirection with Page and Query String (UPDATED)By default IIS redirects to a given domain and/or application.<br />
The web page and query string can be transferred to the destination url by using the respective parameters $S and $Q.<br />
<br />
Ex. <br />
<span style="font-style: italic;">template:</span> http://example.com$S$Q<br />
<span style="font-style: italic;">redirection from </span><br />
http://old-example.com/default.aspx?id=1 <br />
<span style="font-style: italic;">will lead to</span> <br />
http://example.com/default.aspx?id=1<br />
<br />
In IIS 6 the checkbox "Exact Url" will avoid appending the web page to the query string.<br />
<br />
UPDATE:<br />
In order to achieve that behaviour in IIS 7 you have to first enable "Redirect all requests to exact destination" and append the sufix $S$Q to the url.<br />
If you rely in the automatic url redirection of IIS (by default, w/o $S$Q in url) the query string is actually cut.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-54597692236244164072011-05-11T02:28:00.000-07:002012-05-20T02:29:00.686-07:00How to share Windows 7 folders with anonymous access including registry fixI found very interesting forum thread describing how to share Windows 7 folder to other machines without password protection. It includes a few registry tricks to unlock that feature, that might had been set by Anti-virus software.
<a href="http://www.acryan.com/forums/viewtopic.php?f=41&t=2269">http://www.acryan.com/forums/viewtopic.php?f=41&t=2269 </a><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-79333264295271555992011-04-22T08:53:00.000-07:002011-08-11T04:00:10.207-07:00How to concatenate row data into string using SQLVery simple way to achieve this is to use FOR XML statement. The result of the following example is list of user names including first and last name separated by commas.
<br />
<br /><blockquote><span class="Apple-style-span">SELECT FirstName+' '+LastName+', ' FROM UserProfile FOR XML PATH('')</span></blockquote>
<br />
<br />But the result string ends with a comma and space. We can either remove it by SUBSTR or REPLACE functions. Using REPLACE as it is shown below saves the usage of subquery or calcualtion of the length of the same expression.
<br />
<br /><blockquote><span class="Apple-style-span">SELECT
<br />REPLACE((REPLACE((REPLACE(
<br />(SELECT FirstName+' '+LastName FROM UserProfile FOR XML PATH('A'))
<br />,'</A><A>',', '))
<br />, '</A>',''))
<br />,'<A>','')</a></span></blockquote><a>
<br />
<br />Here is another way to achieve this which might be convinient in stored procedures.
<br />
<br /><blockquote><span class="Apple-style-span">DECLARE @Names VARCHAR(8000)
<br />set @Names=''
<br />SELECT @Names = @Names + CASE WHEN @Names<>''
<br />THEN ', ' ELSE '' END + Name
<br />FROM Users
<br />SELECT @Names</span></blockquote></a><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0tag:blogger.com,1999:blog-4128767709785759609.post-73420016634503511642011-04-07T11:52:00.000-07:002013-04-07T11:57:25.814-07:00How to use Visual Studio build events to copy output file to multiple destinations (projects)Calling predefined batch file:<br />
call MyBatchFile.bat<br />
<br />
using command line macros:<br />
Ex. copy "$(TargetDir)*.*" "$(SolutionDir)sitename\Bin"<br />
<br />
list of macros find here:<br />
<a href="http://msdn.microsoft.com/en-us/library/vstudio/42x5kfw4.aspx">http://msdn.microsoft.com/en-us/library/vstudio/42x5kfw4.aspx</a><br />
<br /><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-0846488394782889";
/* 468x60, created 7/8/08 */
google_ad_slot = "9096757012";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Plamen Kasabovhttp://www.blogger.com/profile/01894448905932275574noreply@blogger.com0