Wednesday, December 03, 2008

No sound in Flash over Citrix connection


Here are some tips that may help:
1) Try uninstalling Flash, logon with a new administrator account that's never been used, switch to install mode (change user /install), install flash, launch and test flash, switch to execute mode (change user /execute).
2) Check that you have 'Enable Sound' on ICA Client and on server-side.
3) Uninstall PSE450R02W2K3040 Windows Update

Very interesting interview with Jeremy Grantham



How to specify maxJsonLength property in web.config


If you're getting the following exception while using JavaScriptSerializer:
"Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property." - you may enlarge the default maxJsonLength value in web.config:

<system.web.extensions>
    <scripting>
       <webServices>
          <jsonSerialization maxJsonLength="123456"></jsonSerialization>
       </webServices>
    </scripting>
</system.web.extensions>



Wednesday, November 26, 2008

Reading ini-file from C# - used in Open Simulator


My class for reading settings from old-style .ini files using C# was used in Open Simulator.

Над финансовой системой кризис тучи собирает.


(Really good black humor - in Russian).

Над финансовой системой кризис тучи собирает.
Между долларом и евро гордо реет Неликвидность, конфискации подобна.
То обрушивая рынки, то зашкаливая ставки,
Неликвидность торжествует, -
спекулянты чуют гибель в её воплях громогласных.

В этом стоне - жажда денег!
Обрушенье котировок, экономики паденье и уверенность в банкротстве слышат рынки в этом крике.
Глупый Минфин перед бурей робко мечется по рынкам,
в девальвации готовый спрятать страх перед дефолтом.

Олигархи тоже стонут, - олигархам недоступно наслажденье дерзким рынком, чудной рыночной стихией: разоренье их пугает.
Все мрачней и ниже индекс опускается над биржей, и бегут прочь
капиталы, в бездну сбрасывая курсы.

Гром грохочет. Все сверкает. Это рухнул "Леман Бразерс".
В пене гнева конгрессмены принимают план спасенья.
И с размаху в дикой злобе миллиарды выделяют для спасенья "Голдман Сакса".

Неликвидность с криком реет, черной молнии подобна, как стрела пронзает биржи, банки в бездну отправляя.
Кризис носится, как демон, - гордый, черный демон рынка, - и смеется,
и хохочет...
Над банкирами смеется, над правительством хохочет!

В общем стоне "волатильность!" демон зрит давно усталость.
Он уверен: центробанки не спасут от краха биржи.
Пресса воет... Дети плачут. И инвесторы рыдают...
Красным пламенем пылают биржевые котировки. И сгорают триллионы: -
Кризис! Скоро грянет кризис!

Это смело и свободно реет дух Стихии Рынка над ревущим гневно миром;
то кричит пророк победы: - Пусть сильнее грянет КРИЗИС!

Monday, November 24, 2008

Link: Best Practices for Production ASP.NET


Great article on Best Practices for Production ASP.NET...
Important addition to item 4 - if ScriptMode of ScriptManageer is set to "Auto" – then setting deployment retail to "true" would also switch ScriptMode to Release, i.e. release versions of AJAX scripts would be loaded in your page. (I think the main difference is that there is no parameters validation in release version).
The seting is defined in machine.config.

Sunday, November 16, 2008

Joseph de la Vega on credit crunch



Joseph de la Vega was a Portuguese Jewish author who at first described practices of stock exchange in Amsterdam (including usage of derivatives). He came to his own financial fiasco in crisis of 1688. Following to this blog - I want to re-quote him…

Joseph de la Vega, 1688: "This year too was a year of confusion for many unlucky speculators declared in one voice that the present crisis was a labyrinth of labyrinths, the terror of terrors, the confusion of confusions...".

Doesn't that mean that this 2008 year wasn't a labyrinth of labyrinths in a backward perspective? I promise to return to it in 1 year.

Thursday, August 28, 2008

Enable XSS Detect in VS 2008


XSS Detect is a code-analysis tool proposed, as suggested by its name, for reveal of XSS vulnerabilities in web-applications.
It's developed by MS ACE Team and could be downloaded here: XSS Detect

The problem is that out of the box it works in VS 2005 only. Here is how to enable it in Visual Studio 2008:
  1. Open %USERPROFILE%\Application Data\Microsoft\MSEnvShared\Addins

  2. Insert < Version > 9.0 < /Version > in HostApplication section


Preventing XSS in server code in .aspx files using AntiXss


Preventing XSS in server code in .aspx files using AntiXss:

_someID=
      <%=Microsoft.Security.Application.AntiXss.HtmlEncode(Request.Form["someID"])%>


Note that you need to specify fully qualified assembly name for the AntiXss.

Sunday, August 24, 2008

Monday, August 04, 2008

Viewing log4net files in notepad++


If you're a frequent user of notepad++ and log4net - here is a nice trick I've discovered, that brings a synergism between two. As you know - notepad++ has an option to highlight syntax for subset of supported languages. It is either applied automatically, based on the file extension or could be chosen manually from the Language menu.
And here is the trick - just select VB language for opened log4net file (<Alt>+L,V,Enter) and you have a very readable syntactic highlights.



Tuesday, July 22, 2008

SQL Tips: Using MERGE SQL statement in SQL 2008


... And still one more from the same generous source ...

SQL Server 2008's new MERGE statement allows you to insert, update, or delete data based on certain join conditions in the same statement.

MERGE SalesArchive AS SA
USING (
    SELECT
        CustomerID,
        LoadDate = MIN(CONVERT(VARCHAR(8), GETDATE(), 112)),
        TotalSalesAmount = SUM(SaleAmount),
        TotalSalesCount = COUNT(*)
    FROM SalesFeed
    GROUP BY CustomerID
) AS SalesFeedCTE (CustomerID, LoadDate, TotalSalesAmount, TotalSalesCount)
ON (SA.CustomerID = SalesFeedCTE.CustomerID AND SA.SalesDate = SalesFeedCTE.LoadDate )

WHEN NOT MATCHED THEN
INSERT (CustomerID, SalesDate, TotalSalesAmount, TotalSalesCount, CreationDate, UpdatedDate)
    VALUES( SalesFeedCTE.CustomerID, SalesFeedCTE.LoadDate, SalesFeedCTE.TotalSalesAmount, SalesFeedCTE.TotalSalesCount, GETDATE(), GETDATE())
WHEN MATCHED THEN
UPDATE

    SET SA.TotalSalesAmount = SA.TotalSalesAmount + SalesFeedCTE.TotalSalesAmount,
            SA.TotalSalesCount = SA.TotalSalesCount + SalesFeedCTE.TotalSalesCount,
            SA.UpdatedDate = GETDATE();


Also, there is a new ability to pass a table variable to the stored procedures:

DECLARE @MyTable TABLE (Col1 INT, Col2 Varchar(100))
EXEC MySP @Par1 = @MyTable OUTPUT

Monday, July 14, 2008

SQL Tips: Using Regular Expressions in SQL Query


One more; courtesy of our greate DBA - K. Fridman:

DECLARE @RegExp VARCHAR(100)
SET @RegExp = '%[^a-zA-Z0-9._-]%'
SELECT *
FROM Clients
WHERE PATINDEX(@RegExp, UserName) > 0


SQL Tips: Search String In All SP's


This is nice one; courtesy of our great DBA - Kostya Fridman:

SELECT name, OBJECT_DEFINITION(object_id)
FROM sys.procedures
WHERE OBJECT_DEFINITION(object_id) LIKE '%Search String%'

Sunday, June 15, 2008

touch command for DOS/command line


Following command would simulate UNIX touch command in DOS:
copy /b test.txt +,,
(command was changed following to the comments).

ArgumentOutOfRangeException at HttpCachePolicy.UtcSetLastModified if assembly file with script control has future date relatively to the machine date


It seems that I discovered an annoying bug in the AJAX engine:
if you have a JavaScript file of script control, which is loaded through the WebResource.axd and the DLL module that embeds this JavaScript file has a file creation date, which is in the future relatively to the current machine date – you would get an unhandled ArgumentOutOfRangeException exception, raising from System.Web.HttpApplication.ExecuteStep:


System.Web.HttpCachePolicy.UtcSetLastModified(DateTime utcDate)
System.Web.HttpCachePolicy.SetLastModified(DateTime date)
System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


This would cause JavaScript error "Type NNN is undefined or null" in your browser.
The simple resolution for this problem is to "touch" the affected DLL to update it's date to current machine date time:
copy /y nul tt.txt

Tuesday, April 08, 2008

Funny automatic translation (English to Russian):


Original:
ThreadPoolSynchronizer marshals all calls to a custom thread pool, where the calls are first queued up, then multiplexed on the available threads. The size of the pool is provided as a construction parameter. If the pool is maxed out, the call will be pending in the queue until a thread is available. You can also provide a pool name (which will be the prefix of the name of the threads in the pool). Disposing or closing ThreadPoolSynchronizer kills all threads in the pool gracefully...



Translated:
ThreadPoolSynchronizer маршалы все звонит таможенному бассейну нитки, где призывы сначала стоятся в очереди, тогда multiplexed на доступных нитках. Размер бассейна обеспечивается в качестве строительного параметра. Если бассейн maxed, призыв будет находящийся на рассмотрении в очереди прежде чем нитка имеется в распоряжении. Вы можете также обеспечить имя бассейна (который будет префикс имени ниток в бассейне). Размещая или закрытие ThreadPoolSynchronizer убивает все нитки в бассейне грациозно...



Monday, April 07, 2008

Redistributable installation of Microsoft .NET framework 3.0 SP 1


Somehow there are no direct link and installation instructions for the .NET framework 3.0 SP 1 on MS site.
Here is how to get it:
1) Make sure .NET 2.0 SP 1 is installed.
2) Get redistributable install of .NET 3.0 SP 1 from here: http://download.microsoft.com/download/8/F/E/8FEEE89D-9E4F-4BA3-993E-0FFEA8E21E1B/NetFx30SP1_x86.exe
3) You may need to install XPSEPSC before installation of .NET 3.0 SP 1. Get it here: http://download.microsoft.com/download/8/D/4/8D4C4B2F-269B-44E1-80EA-BF59143D7BAC/XPSEPSC-x86-en-US.exe




Tuesday, April 01, 2008

How to install Windows Media Player 11 on Windows Server 2003



1) Download the installation file wmp11-windowsxp-x86-enu.exe and then extract its content to subfolder
2) Change value of HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Windows\CSDVersion from 100 to 200
3) Go to this sub-folder and change compatibility mode of wmfdist11.exe to WindowsXP. Run it.
4) Change compatibility mode compatibility mode of wmfdist11.exe to WindowsXP. Run it.
5) Change compatibility mode compatibility mode of wmdbexport.exe. to WindowsXP. Run it.
6) RESTART!!!
7) Return to the extracted files, change compatibility of wmp11.exe to Windows XP and run it
8) Change value of HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Windows\CSDVersion from 200 back to 100
9) Enjoy