<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3826402911033799696</id><updated>2011-07-23T13:12:28.369-07:00</updated><category term='Isolated Storage'/><category term='OpenFileDialog'/><category term='flash'/><category term='submitChanges'/><category term='SaveFileDialog'/><category term='linqToSQL'/><category term='javascript'/><category term='VisualStateManager'/><category term='Custom VisualStateManager'/><category term='Silverlight 3.0'/><title type='text'>Programming problems</title><subtitle type='html'>While we write computer programs, we spend lots of time solving simple technology related problems. 
In this blog I publish some of the problems I faced and their solutions, hoping that they can be useful for other programmers.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://progproblems.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://progproblems.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Helena Muñoz</name><uri>http://www.blogger.com/profile/06592986379247748137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3826402911033799696.post-9098892264676115547</id><published>2009-11-18T13:25:00.000-08:00</published><updated>2009-11-18T13:27:34.328-08:00</updated><title type='text'>Installing the AdventureWorks database</title><content type='html'>&lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height: normal"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Technology: &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;SQL Server 2008&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height: normal"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Problem: &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Install the AdventureWorks database in order to get test information.&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;The AdventureWorks are sample databases provided by Microsoft, and they can be downloaded from codeplex here: &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;a href="http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=MSFTDBProdSamples&amp;amp;DownloadId=86538&amp;amp;FileTime=128993370526430000&amp;amp;Build=15987"&gt;http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=MSFTDBProdSamples&amp;amp;DownloadId=86538&amp;amp;FileTime=128993370526430000&amp;amp;Build=15987&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height: normal"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Solution:&lt;span class="Apple-style-span" style="font-weight: normal; "&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height: normal"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;In this zip you get all the information you need to create a SQL Server 2008 database with sample data: &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;a href="http://msftdbprodsamples.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=34032#DownloadId=86540"&gt;http://msftdbprodsamples.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=34032#DownloadId=86540&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height: normal"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;After downloading the zip, you have to run the script named instawdb.sql . To do this, you need to: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpFirst" style="margin-bottom:0in;margin-bottom:.0001pt; mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l0 level1 lfo1"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;1)&lt;/span&gt;&lt;/span&gt;&lt;span style="font:7.0pt &amp;quot;Times New Roman&amp;quot;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;      1. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Run it in the SLQCMLD Mode. You do this in SQL Server Manager, by selecting Query -&gt; SLQCMLD Mode &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="margin-bottom:0in;margin-bottom: .0001pt;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l0 level1 lfo1"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;2)&lt;/span&gt;&lt;/span&gt;&lt;span style="font:7.0pt &amp;quot;Times New Roman&amp;quot;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;      2. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Enable FILESTREAM. Here it is explained how to achieve this:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="margin-bottom:0in;margin-bottom: .0001pt;mso-add-space:auto;line-height:normal"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;a href="http://techpunch.wordpress.com/2008/08/29/how-to-enable-filestream-feature-on-sql-server-2008/"&gt;http://techpunch.wordpress.com/2008/08/29/how-to-enable-filestream-feature-on-sql-server-2008/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="margin-bottom:0in;margin-bottom: .0001pt;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l0 level1 lfo1"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;3)&lt;/span&gt;&lt;/span&gt;&lt;span style="font:7.0pt &amp;quot;Times New Roman&amp;quot;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;      3. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Make sure the process has access to the folder in which the MDF file is going to be created (you assure this by giving to everyone group the full access permission to the folder in which the MDF is going to be created– you could remove this afterwards)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpLast" style="margin-bottom:0in;margin-bottom:.0001pt; mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l0 level1 lfo1"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;4)&lt;/span&gt;&lt;/span&gt;&lt;span style="font:7.0pt &amp;quot;Times New Roman&amp;quot;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;      4. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Uncomment the setvar lines, and make sure that both paths are correctly set with the information that is in the .zip:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height: normal"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;:setvar SqlSamplesDatabasePath   "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height: normal"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;:setvar SqlSamplesSourceDataPath "C:\Program Files\Microsoft SQL Server\100\Tools\Samples\"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826402911033799696-9098892264676115547?l=progproblems.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://progproblems.blogspot.com/feeds/9098892264676115547/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://progproblems.blogspot.com/2009/11/installing-adventureworks-database.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/9098892264676115547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/9098892264676115547'/><link rel='alternate' type='text/html' href='http://progproblems.blogspot.com/2009/11/installing-adventureworks-database.html' title='Installing the AdventureWorks database'/><author><name>Helena Muñoz</name><uri>http://www.blogger.com/profile/06592986379247748137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826402911033799696.post-8198452951629231399</id><published>2009-11-13T11:42:00.000-08:00</published><updated>2009-11-13T11:49:17.554-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Isolated Storage'/><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight 3.0'/><category scheme='http://www.blogger.com/atom/ns#' term='SaveFileDialog'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenFileDialog'/><title type='text'>Save/Read a file from Silverlight 3.0 in the client machine</title><content type='html'>&lt;div&gt;&lt;p class="MsoNormal"&gt;Problem: &lt;span&gt;&lt;/span&gt;For security reasons, it is not allowed to save a file in any part of the client’s file system using FileStream class or similar. To achieve this, you can either use IsolatedStorage, or the Save/Open File Dialogs added in Silverlight 3.0 version.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;Solution 1: Using Isolated Storage&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;Isolated Storage allows you to read/write files in the client machine, but on a folder Silverlight designates. This could be useful to implement a disk cache, for instance.&lt;/p&gt;&lt;p class="MsoNormal"&gt;The folder in which the file is stored is not intended for the user to access. Its name is something like this: AppData\LocalLow\Microsoft\Silverlight\is\ngns4lzo.xrg\24n0wuei.lxq\1\s\s03b4fsd1eqjjyya0pbbphul0qd3a5mowxinuc0cprdrsg1fp0aaacga\f&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;u&gt;Usage example:&lt;/u&gt;&lt;u&gt;&lt;span style="line-height: 55px; font-family:&amp;quot;;font-size:10.0pt;color:green;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; "&gt;&lt;span style="font-family:&amp;quot;;color:#2B91AF;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;IsolatedStorageFile&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;quot;;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; file = &lt;/span&gt;&lt;span style="color:#2B91AF;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;IsolatedStorageFile&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;.GetUserStoreForApplication();&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; "&gt;&lt;span style="font-family:&amp;quot;;color:#2B91AF;"&gt;&lt;o:p&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; "&gt;&lt;span style="font-family:&amp;quot;;color:#2B91AF;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;IsolatedStorageFileStream&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;quot;;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; fs = &lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; &lt;/span&gt;&lt;span style="color:#2B91AF;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;IsolatedStorageFileStream&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;(&lt;/span&gt;&lt;span style="color:#A31515;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;"tst.txt"&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;,&lt;/span&gt;&lt;span style="color:#2B91AF;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;FileMode&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;.Create,&lt;/span&gt;&lt;span style="color:#2B91AF;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;FileAccess&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;.Write, &lt;/span&gt;&lt;span style="color:#2B91AF;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;FileShare&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;.ReadWrite, file);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;IsolatedStorageFileStream inherits FileStream.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;Solution 2: Using SaveFileDialog / OpenFileDialog (available from Silverlight 2.0/3.0 version)&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;In order to save or read files from any given location in the client machine, you need to use SaveFileDialog / OpenFileDialog. These are used in a similar way to the Windows Forms open/save dialogs.&lt;/p&gt;&lt;p class="MsoNormal"&gt;With both dialogs, the only available operations are OpenDialog and a Stream property to which you could write or read.&lt;/p&gt;&lt;p class="MsoNormal"&gt;Limitations of this solution: Because of security reasons, the dialog can only be initiated by the user.&lt;span&gt;&lt;/span&gt;Therefore Open/Save dialogs can only be called from event handlers such as button clicks.&lt;/p&gt;&lt;p class="MsoNormal"&gt;You cannot debug the method in which the open or save file dialogs are opened, and you cannot open two file dialogs on the same handler, otherwise you will get this error: “Dialogs must be user-initiated”&lt;/p&gt;&lt;/div&gt;&lt;div&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826402911033799696-8198452951629231399?l=progproblems.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://progproblems.blogspot.com/feeds/8198452951629231399/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://progproblems.blogspot.com/2009/11/saveread-file-from-silverlight-30-in.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/8198452951629231399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/8198452951629231399'/><link rel='alternate' type='text/html' href='http://progproblems.blogspot.com/2009/11/saveread-file-from-silverlight-30-in.html' title='Save/Read a file from Silverlight 3.0 in the client machine'/><author><name>Helena Muñoz</name><uri>http://www.blogger.com/profile/06592986379247748137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826402911033799696.post-136045259040170175</id><published>2009-10-15T15:30:00.000-07:00</published><updated>2009-10-15T15:31:46.362-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VisualStateManager'/><category scheme='http://www.blogger.com/atom/ns#' term='Custom VisualStateManager'/><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight 3.0'/><title type='text'>Implementing CustomVisualStateManagers to see in which visual state is your object</title><content type='html'>&lt;p class="MsoListParagraphCxSpFirst" style="margin-left:0in;mso-add-space:auto"&gt;&lt;span class="Apple-style-span" style="font-family: arial; font-size: medium; font-weight: bold; "&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; font-weight: normal; font-size: 16px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Technology: &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Silverlight 3.0&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="margin-left:0in;mso-add-space:auto"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Problem: &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;I need to know which method from Silverlight framework changes the VisualState of a control and when.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="margin-left:0in;mso-add-space:auto"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Solution:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; Develop a Custom VisualStateManager and override the &lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;GoToStateCore&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; method (which is the only method that can be overriden),  doing a Debug.WriteLine with Debug information. I decided to write the information on debug instead of setting a breakpoint, because the breakpoint might alter the behavior of the VisualStateManager. Another thing to remember is to call the base method when overriding&lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; GoToStateCore&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="margin-left:0in;mso-add-space:auto"&gt;&lt;o:p&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;In order to set the CustomVisualStateManager as the default VisualStateManager to handle the changes, you can set the XAML in this way:&lt;/span&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;visualstatemanager.customvisualstatemanager&gt;                                                        &lt;ic:extendedvisualstatemanager/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;/VisualStateManager.CustomVisualStateManager&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpLast" style="margin-left:0in;mso-add-space:auto"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;You could also set it through the static method: &lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; color: rgb(43, 145, 175); "&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;VisualStateManager&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; "&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;.SetCustomVisualStateManager(FrameworkElement,VisualStateManager);&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826402911033799696-136045259040170175?l=progproblems.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://progproblems.blogspot.com/feeds/136045259040170175/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://progproblems.blogspot.com/2009/10/implementing-customvisualstatemanagers.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/136045259040170175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/136045259040170175'/><link rel='alternate' type='text/html' href='http://progproblems.blogspot.com/2009/10/implementing-customvisualstatemanagers.html' title='Implementing CustomVisualStateManagers to see in which visual state is your object'/><author><name>Helena Muñoz</name><uri>http://www.blogger.com/profile/06592986379247748137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826402911033799696.post-9068918781847748890</id><published>2009-10-13T04:30:00.000-07:00</published><updated>2009-10-13T04:52:27.111-07:00</updated><title type='text'>Silverlight 3.0 - LostFocus in Popup Controls</title><content type='html'>&lt;div style="text-align: left;"&gt;&lt;b&gt;&lt;u&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Technology:&lt;/span&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; Silverlight 3.0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;u&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Problem:&lt;/span&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; I want to close a Popup when a Custom Control that contains the popup losses focus. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;u&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Considerations:&lt;/span&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph"&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;LostFocus is a Routed Event&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;This means that if a child triggers a lostFocus event, it will bubble up to the parent. I don’t think this makes too much sense because if a focus changed from a child to another child of the same parent, then the parent should not have a LostFocus event triggered (because the focus is still in one of its children)…but that is how it works.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph"&gt;&lt;i&gt;&lt;o:p&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph"&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;LostFocus and the Popup control&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent:.5in"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;When one of the Children is a popup, the LostFocus event won’t bubble up to Popup the container (This happens for the LostFocus and for other routed events as well). &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Example: If I click on tst2.1, and then on tst2.2, the event LostFocus will be triggered for the stack panel SP2, but it won’t trigger for SP1.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoListParagraph"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoListParagraph"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style=" ;font-family:Georgia, serif;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0ZJ2Tb8io1M/StRptATp__I/AAAAAAAABi8/qEJff1TOQgc/s1600-h/example.png"&gt;&lt;img src="http://4.bp.blogspot.com/_0ZJ2Tb8io1M/StRptATp__I/AAAAAAAABi8/qEJff1TOQgc/s320/example.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5392050875766800370" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 168px; " /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;u&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Solution:&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;There are two things to address, 1) The fact that the LostFocus event will not get to the parent control, and 2) The fact that lostFocus being triggered does not mean that the control lost focus (but one of its children did). &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin-left:0in"&gt;&lt;o:p&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin-left:0in"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;To solve 1), have a panel container inside the Popup, and register to the lostFocus event in that control. You know that all the lostFocus for the popup children will trigger the container LostFocus.  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin-left:0in"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;To solve 2), in the LostFocus event for your control, check if the current focused element (FocusMager.GetFocusedElement) is inside your control. You can do this using VisualTreeHelper class.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826402911033799696-9068918781847748890?l=progproblems.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://progproblems.blogspot.com/feeds/9068918781847748890/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://progproblems.blogspot.com/2009/10/silverlight-30-lostfocus-in-popup.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/9068918781847748890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/9068918781847748890'/><link rel='alternate' type='text/html' href='http://progproblems.blogspot.com/2009/10/silverlight-30-lostfocus-in-popup.html' title='Silverlight 3.0 - LostFocus in Popup Controls'/><author><name>Helena Muñoz</name><uri>http://www.blogger.com/profile/06592986379247748137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_0ZJ2Tb8io1M/StRptATp__I/AAAAAAAABi8/qEJff1TOQgc/s72-c/example.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826402911033799696.post-3426739431018307381</id><published>2009-10-06T06:00:00.000-07:00</published><updated>2009-10-12T11:49:54.084-07:00</updated><title type='text'>Binding validation failed because the binding's MsmqAuthenticationMode property is set to WindowsDomain but MSMQ is installed with Active Directory in</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0ZJ2Tb8io1M/SstBq7dafaI/AAAAAAAABf0/YRsJUDvv-MU/s1600-h/WCF+config.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 230px;" src="http://3.bp.blogspot.com/_0ZJ2Tb8io1M/SstBq7dafaI/AAAAAAAABf0/YRsJUDvv-MU/s320/WCF+config.jpg" alt="" id="BLOGGER_PHOTO_ID_5389473584850304418" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-weight: bold;"&gt;Technology:&lt;/span&gt; Message Queues with WCF&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Problem:&lt;/span&gt; After implementing a MQ service with WCF I got the error "Binding validation failed because the binding's MsmqAuthenticationMode property is set to WindowsDomain but MSMQ is installed with Active Directory integration disabled."&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution: &lt;/span&gt;&lt;span&gt;In this case I did not need security, so I just &lt;/span&gt;configured the "Security" TAB in a custom binding configuration, setting MSMQProtectionLevel to None and MSMQAuthenticationMode to None.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826402911033799696-3426739431018307381?l=progproblems.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://progproblems.blogspot.com/feeds/3426739431018307381/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://progproblems.blogspot.com/2009/10/binding-validation-failed-because.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/3426739431018307381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/3426739431018307381'/><link rel='alternate' type='text/html' href='http://progproblems.blogspot.com/2009/10/binding-validation-failed-because.html' title='Binding validation failed because the binding&apos;s MsmqAuthenticationMode property is set to WindowsDomain but MSMQ is installed with Active Directory in'/><author><name>Helena Muñoz</name><uri>http://www.blogger.com/profile/06592986379247748137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_0ZJ2Tb8io1M/SstBq7dafaI/AAAAAAAABf0/YRsJUDvv-MU/s72-c/WCF+config.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826402911033799696.post-5207615643509062631</id><published>2009-09-15T15:53:00.000-07:00</published><updated>2009-09-15T16:40:16.733-07:00</updated><title type='text'>Type 'Microsoft.VisualBasic.PowerPacks.LineShape' is not defined.</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Technology:&lt;/span&gt; Microsoft Visual Basic (migration from VB6.0 to .NET)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Problem:&lt;/span&gt; After migrating a VB6.0 to a .NET one, I get the error "&lt;span style="font-style: italic;"&gt;Type 'Microsoft.VisualBasic.PowerPacks.LineShape' is not defined&lt;/span&gt;". in a machine that does not have the SP1 of VS 2008. After installing power packs 3.0 and restarting the app, I still get the same error&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution:&lt;/span&gt; Download and add reference to power packs 2 ( Microsoft.VisualBasic.PowerPacks.dll ) aparently power pack 3 does not sustitute power pack 2&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826402911033799696-5207615643509062631?l=progproblems.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://progproblems.blogspot.com/feeds/5207615643509062631/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://progproblems.blogspot.com/2009/09/type-microsoftvisualbasicpowerpacksline.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/5207615643509062631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/5207615643509062631'/><link rel='alternate' type='text/html' href='http://progproblems.blogspot.com/2009/09/type-microsoftvisualbasicpowerpacksline.html' title='Type &apos;Microsoft.VisualBasic.PowerPacks.LineShape&apos; is not defined.'/><author><name>Helena Muñoz</name><uri>http://www.blogger.com/profile/06592986379247748137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826402911033799696.post-3744974161787614289</id><published>2009-09-11T05:38:00.000-07:00</published><updated>2009-09-11T06:35:29.010-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='submitChanges'/><category scheme='http://www.blogger.com/atom/ns#' term='linqToSQL'/><title type='text'>Linq To SQL: Cannot insert explicit value for identity column in table 'table' when IDENTITY_INSERT is set to OFF</title><content type='html'>&lt;span style="font-weight: bold; font-family: arial;"&gt;Technology:&lt;/span&gt;&lt;span style="font-family: arial;"&gt; LinQ to SQL&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-weight: bold;"&gt;Problem: &lt;/span&gt;&lt;span style="font-family: arial;"&gt;When inserting &lt;/span&gt;&lt;span style="font-family: arial;"&gt;a record using LinQ to SQL in a table that has properly defined a column with an autogenerated ID, &lt;/span&gt;&lt;span style="font-family: arial;"&gt;on submit linq to sql will thow the error:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Linq To SQL: Cannot insert explicit value for identity column in table 'table' when IDENTITY_INSERT is set to OFF&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: arial;"&gt;&lt;br /&gt;This problem appeared when i was trying to delete all records of a relationship, and adding new ones. &lt;/span&gt;The relationship table had an Id column, which was not set&lt;br /&gt;&lt;span style="font-family: arial; font-weight: bold;"&gt;&lt;/span&gt;&lt;span style="font-family: arial;"&gt;&lt;/span&gt;&lt;span style="font-family: arial; font-weight: bold;"&gt;&lt;br /&gt;Solution: &lt;/span&gt;&lt;span style="font-family: arial;"&gt;Apparently, linq to sql "mixed" the old records that i deleted with the new ones, so I solved the problem calling "submitChanges" after deleting the records of the relationship and before adding the new ones.&lt;/span&gt;&lt;span style="font-family: arial; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826402911033799696-3744974161787614289?l=progproblems.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://progproblems.blogspot.com/feeds/3744974161787614289/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://progproblems.blogspot.com/2009/09/linq-to-sql-cannot-insert-explicit.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/3744974161787614289'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/3744974161787614289'/><link rel='alternate' type='text/html' href='http://progproblems.blogspot.com/2009/09/linq-to-sql-cannot-insert-explicit.html' title='Linq To SQL: Cannot insert explicit value for identity column in table &apos;table&apos; when IDENTITY_INSERT is set to OFF'/><author><name>Helena Muñoz</name><uri>http://www.blogger.com/profile/06592986379247748137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826402911033799696.post-2162939063669407970</id><published>2009-08-19T15:49:00.000-07:00</published><updated>2009-08-19T16:18:36.607-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><title type='text'>Javascript onclick for flash embeded objects</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Technology:&lt;/span&gt; Javascript-Flash&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Problem: &lt;/span&gt;I need to execute a javascript function when a flash embeded in a webpage is clicked. When you have a flash object embedded in a website, by default it handles the onclick event and you cannot handle with Javascript.&lt;br /&gt;&lt;br /&gt;This is usually solved by programming the event on the flash object, but in this case  I am not able to modify the object, because the user can upload new flash objects which I cannot control.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution:&lt;/span&gt;&lt;br /&gt;1) Set the param wmode to transparent. This allows the object containing the flash to receive the javascript onclick.&lt;br /&gt;2) Use onmousedown insted of onclick. In spite of using wmode transparent, some browsers still wont call the onclick, but they do call onmousedown.&lt;br /&gt;The code looks like this:&lt;br /&gt;&lt;br /&gt;&amp;lt;div onmousedown=&amp;quot;clickBanner(1)&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;object&amp;gt;&lt;br /&gt;        &amp;lt;param name=&amp;quot;movie&amp;quot; value=&amp;quot;3.swf&amp;quot;&amp;gt;&lt;br /&gt;        &lt;span style="font-weight:bold;"&gt;&amp;lt;param name=&amp;quot;wmode&amp;quot; value=&amp;quot;transparent&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;        &amp;lt;embed &lt;span style="font-weight:bold;"&gt;wmode=transparent&lt;/span&gt; allowfullscreen=&amp;quot;true&amp;quot; allowscriptaccess=&amp;quot;always&amp;quot; src=&amp;quot;3.swf&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&lt;br /&gt;        &amp;lt;/object&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;Note that wmode has to be set in two different ways, because Firefox and IE have different syntax.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Tested on: &lt;/span&gt;IE 7, Firefox 3.5 and Chrome.&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826402911033799696-2162939063669407970?l=progproblems.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://progproblems.blogspot.com/feeds/2162939063669407970/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://progproblems.blogspot.com/2009/08/javascript-onclick-for-flash-embeded.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/2162939063669407970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826402911033799696/posts/default/2162939063669407970'/><link rel='alternate' type='text/html' href='http://progproblems.blogspot.com/2009/08/javascript-onclick-for-flash-embeded.html' title='Javascript onclick for flash embeded objects'/><author><name>Helena Muñoz</name><uri>http://www.blogger.com/profile/06592986379247748137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>
