tag:blogger.com,1999:blog-64323114854792798642024-03-13T18:43:57.444-07:00SQL Server & ASP.Net MisteriesA normal programmer, with normal problems, sometimes stupid, other times interesting. Just thought of giving something back to the community. All comments welcomedUnknownnoreply@blogger.comBlogger35125tag:blogger.com,1999:blog-6432311485479279864.post-33364752835734042762022-12-09T09:12:00.001-08:002022-12-09T09:12:41.465-08:00Not really a DB collation problem<p> </p><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: justify;"><span style="font-family: verdana;">In trend with CI/CD, and not only because of the trend, we have a TFS build pipeline and a release pipeline. We deal with on-prems SSIS and most of our deployments mean deploying a SSIS solution and changes to one or more databases, via a Database project deployed as a dacpac package.<br /><br />The way I work is to test locally from VS, both the ETLs and the database project deployment. </span></div><div class="separator" style="clear: both; text-align: justify;"><span style="font-family: verdana;"><br /></span></div><div class="separator" style="clear: both;"><div style="text-align: justify;"><span style="font-family: verdana;">Recently, however, I tested the ETLs and the DB deployment to a server, as usually. I encountered an error that I initially thought is about the collation of the database: </span><span style="font-family: verdana;">"</span><i style="font-family: verdana;"><b>The project and target databases have different collation settings. Deployment errors might occur.</b></i><span style="font-family: verdana;">" - and deployment errors did occur, as seen below.</span></div></div></div><p></p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwvGrX9CGEubCrQgR-8wbArDeJJzTFvITjVVfwnVzpqN7CyvFCxVxmwjVPalYfwkESUt9BpWG6AXqH_mrwaIZXtqg_bK0OpplDj-V01ELghsgWD5UYjnaBaR87LBFoRdAyTqiNdNeWTaS9jrCKC40TNv08WMcLdB4TCp2-p1iargLA7HrLB_A__tFK/s1230/Project%20and%20target%20Database%20Collation%20.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="682" data-original-width="1230" height="355" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwvGrX9CGEubCrQgR-8wbArDeJJzTFvITjVVfwnVzpqN7CyvFCxVxmwjVPalYfwkESUt9BpWG6AXqH_mrwaIZXtqg_bK0OpplDj-V01ELghsgWD5UYjnaBaR87LBFoRdAyTqiNdNeWTaS9jrCKC40TNv08WMcLdB4TCp2-p1iargLA7HrLB_A__tFK/w640-h355/Project%20and%20target%20Database%20Collation%20.jpg" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><span style="font-family: verdana;">Now, since I thought the DB went fine from VS I started to investigate what was different about the collation. <br />Banging my head on the wall for a bit, until I read carefully the error message, saying that</span> "<i style="font-family: verdana; text-align: justify;">Deployment errors <b>might </b>occur". </i><span style="font-family: verdana; text-align: justify;">Which means this is not the real error. Oh, yes, so I started to look with a different eye, understood I that the pipeline was set to deploy to another database, than it was all very easy. </span><p></p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-41816002845954153422017-03-17T07:17:00.000-07:002017-03-17T07:17:04.652-07:00SSIS error VS_NEEDSNEWMETADATAWhen deploying an SSIS package on the test server I started to get an error
" Data flow task error failed validation and return validation status "VS_NEEDSNEWMETADATA" "
I tried to run the SSIS from VS, against the test database and realized I could reproduce the error. I soon realized that the DB I was running against had indeed a different metadata than the local database. For once, there was something useful in SSIS error messages. Fixing it fixed the error.
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-91021473740605207252017-03-14T08:19:00.006-07:002017-03-14T08:19:52.415-07:00SSIS and VS 2013: using variables in the Script Task<span style="color: #444444; font-family: Verdana, sans-serif;"><span style="background-color: white; font-size: 13px;">While trying to use a Project Level Connection Managers in the new SSIS 2016, I realized we need a way to use the connection strings in the package, but didn't have access to them. So I put the Connection Strings into the variables and reuse this further on in the package.</span></span><br />
<span style="color: #444444; font-family: Verdana, sans-serif;"><span style="background-color: white; font-size: 13px;"><br /></span></span>
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="color: #444444; font-family: Verdana, sans-serif;"><span style="background-color: white; font-size: 13px;"><br /></span></span>
<span style="color: #444444; font-family: Verdana, sans-serif;"><span style="background-color: white; font-size: 13px;"><br />In order to do this, I created two variables (in fact they were created before, this was a migration to SSIS 2016), I created a <b>script task</b> at the beginning of the package, select the variables that I want to set as ReadWriteVariables,</span></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbsocPNZtsU6fptuJvpQ71q09-SE3uUZp8ZxInEp9O-IcpAiKFtyFr7sHOUmLDhEsbK8zbW4KRORvvIpOU2DZQyYA5Gh0to4_AEJto8cj0FSIWmHmrOBdvYlkibIsgdFDsNYl67MbRpdY/s1600/SSIS+Script+Task+Editor_Setting+variables.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: Verdana, sans-serif;"><img border="0" height="301" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbsocPNZtsU6fptuJvpQ71q09-SE3uUZp8ZxInEp9O-IcpAiKFtyFr7sHOUmLDhEsbK8zbW4KRORvvIpOU2DZQyYA5Gh0to4_AEJto8cj0FSIWmHmrOBdvYlkibIsgdFDsNYl67MbRpdY/s320/SSIS+Script+Task+Editor_Setting+variables.PNG" width="320" /></span></a></div>
<span style="background-color: white; color: #444444; font-size: 13px;"><span style="font-family: Verdana, sans-serif;">edit the script and set , in the main function:</span></span><br />
<span style="font-family: Verdana, sans-serif;"><span style="background-color: white; font-size: 13px;"><span style="color: #444444;">Dts.Variables["myVariable1"].Value = Dts.Connections["myConnectionManager1"].ConnectionString;</span></span><span style="background-color: white; color: #444444; font-size: 13px;">Dts.Variables["myVariable2"].Value = Dts.Connections["myConnectionManager2"].ConnectionString;</span></span><br />
<span style="background-color: white; color: #444444; font-size: 13px;"><span style="font-family: Verdana, sans-serif;"><br /></span></span>
<span style="background-color: white; color: #444444; font-size: 13px;"><span style="font-family: Verdana, sans-serif;"><br /></span></span>
<span style="background-color: white; color: #444444; font-size: 13px;"><span style="font-family: Verdana, sans-serif;">That's it!</span></span>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-79032727839973361232016-11-01T07:56:00.002-07:002016-11-15T00:20:13.224-08:00SSIS Errors<span style="font-family: "verdana" , sans-serif;">Today, while working on a new ETL in SSIS 2008 (using an old ETL as a model) I stumbled upon an error that was pretty new to me: Error at Data Flow Task [DTS.Pipeline]: input column "Column1" (1234) has lineage ID 1234 that was not previously used in the Data Flow task.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><b>First of all, what is this lineage id?</b> </span><br />
<span style="font-family: "verdana" , sans-serif;"><a href="http://social.technet.microsoft.com/wiki/contents/articles/19963.lineage-id-ssis.aspx">According to TechNet</a> Lineage id is "a property of the component or transformation used in the data flow task. It contains an integer value that will work as buffer pointer. Each column in the data flow task will be assigned a lineage id."
In fact, a column can have more than one lineage ID, if more transformations are applied on it.
Basically every column has an Id pointing to the buffer. <br /><b>The fix to the problem</b> was to refresh the mapping of the columns. The mapping was not refreshed, so basically a component is waiting for something at a buffer allocation identified by something that was not used before. Reading from the position 1234 in the buffer would yield nothing since no one is writing at that position before. </span>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-28079975143834165542016-06-02T09:37:00.000-07:002016-06-02T09:37:02.609-07:00xp_cmdshell in SQLServer 2014Today I needed to create a job that moves files on the file system.<br />
<br />despite the recommendetions against xp_cmdshell, I use it because similar jobs do the same, so the SP has to exist on the server anyway. The problem was that running the move command in CMD line worked fine, while running the SQL code returned a "file access denied" exceptions.<br /><br />Of course, the solution is to give access to the folders to the user that SQL Server runs under. Look at the services in task manager and add the user to the folder. Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-90602785950318340172014-10-15T08:10:00.001-07:002014-10-15T08:10:04.312-07:00Time Management. By Brian Tracy<span style="font-family: Verdana,sans-serif;">Yet another post about a book. But a very good book, in my opinion. </span><br />
<span style="font-family: Verdana,sans-serif;"><br /></span>
<span style="font-family: Verdana,sans-serif;">I got "Time Management" as part of O'Reilly blogger program. I have issues with managing my time, I get a lot of things on my dashboard, but they never get done (maybe I want to do too much). So the book is of great interest to me. </span><br />
<span style="font-family: Verdana,sans-serif;"><br /></span>
<span style="font-family: Verdana,sans-serif;">The entire thing about time management is based on the principle of the four Ds: <span style="background-color: #38761d;">desire</span>, <span style="background-color: #38761d;">decisiveness</span>, <span style="background-color: #38761d;">determination</span>, and <span style="background-color: #ffe599;"><span style="background-color: #38761d;">discipline</span></span>.</span><br />
<span style="font-family: Verdana,sans-serif;">The book is divided into 21 chapters and each of them is a few minutes read but can (and should) generate hours of reflection for someone looking to improve the quality of life. </span><br />
<br />
<span style="font-family: Verdana,sans-serif;">The book starts with </span><u><span style="font-family: Verdana,sans-serif;"><span style="font-family: Verdana,sans-serif;">Chapter 1: </span>The Psychology of Time Management</span></u><span style="font-family: Verdana,sans-serif;">, a chapter that explains that we are able to control our time budget. Think "as if" you were already the person you want to be.</span><br />
<br />
<span style="font-family: Verdana,sans-serif;"><u>Chapter 2: Determine Your Values.</u> This chapter speaks about “Why am I doing what I am doing?”. The meaning and purpose of our actions. Of course, is easier to do things that we love and we are more efficient doing those things. Also, defining our goals in life is suppose to help tremendously. </span><br />
<a href="http://www.amazon.co.uk/gp/product/0141033576/ref=as_li_ss_il?ie=UTF8&camp=1634&creative=19450&creativeASIN=0141033576&linkCode=as2&tag=toubybik-21" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://ws-eu.amazon-adsystem.com/widgets/q?_encoding=UTF8&ASIN=0141033576&Format=_SL110_&ID=AsinImage&MarketPlace=GB&ServiceVersion=20070822&WS=1&tag=toubybik-21" /></a><span style="font-family: Verdana,sans-serif;"></span><br />
<span style="font-family: Verdana,sans-serif;"><br /></span>
<span style="font-family: Verdana,sans-serif;"><u>Chapter 3: Think About Your Vision and Mission</u> this chapter refers to Daniel Kahneman’s <a href="http://www.amazon.co.uk/gp/product/0141033576/ref=as_li_ss_tl?ie=UTF8&camp=1634&creative=19450&creativeASIN=0141033576&linkCode=as2&tag=toubybik-21">Thinking, Fast and Slow</a><img alt="" border="0" src="http://ir-uk.amazon-adsystem.com/e/ir?t=toubybik-21&l=as2&o=2&a=0141033576" height="1" style="border: none !important; margin: 0px !important;" width="1" />. The book speaks about the necessity to react fast sometimes and about reflecting to what and why we are doing our actions, thinking more about details. This chapter speaks about not forgetting the goals of our life. Keep the end in mind and examine the methodology. Determine your assumptions and maybe find a better way to accomplish the goal.<img alt="" border="0" src="http://ir-uk.amazon-adsystem.com/e/ir?t=toubybik-21&l=as2&o=2&a=0141033576" height="1" style="border: none !important; margin: 0px !important;" width="1" />
</span><br />
<br />
<span style="font-family: Verdana,sans-serif;">
<u><span style="font-family: Verdana,sans-serif;">Chapter 4: </span>Project Forward, Look Backward</u> </span><br />
<br />
<span style="font-family: Verdana,sans-serif;">This chapter talks about <i>thinking</i>. And about the importance to take time to think, plan, dream, and create. Think about the longer term future. </span><br />
<br />
<span style="font-family: Verdana,sans-serif;"><span style="font-family: Verdana,sans-serif;"><u><span style="font-family: Verdana,sans-serif;">Chapter 5: </span>Make Written Plans</u></span> </span><br />
<span style="font-family: Verdana,sans-serif;">Define your goals before you start working. Make a clear plan of what you want to accomplish, break it down in smaller steps. Be prepared to review the plan.</span><br />
<span style="font-family: Verdana,sans-serif;"><br /></span>
<span style="font-family: Verdana,sans-serif;"><u><span style="font-family: Verdana,sans-serif;"><span style="font-family: Verdana,sans-serif;"><span style="font-family: Verdana,sans-serif;">Chapter 6: </span></span></span>Chart Your Projects</u></span><br />
<span style="font-family: Verdana,sans-serif;">Talks about a project seen as a collection of smaller tasks. And about the importance of checklists. "A checklist consists of a written series of steps, <u>in chronological order</u>, which you create in advance of beginning work in the first place." The author argues that every minute spent in planning saves you 10 minutes in the execution phase. Also he recommends the use of PERT charts and setting clear <u>goals for everyone</u>.</span><br />
<span style="font-family: Verdana,sans-serif;"><br /></span>
<span style="font-family: Verdana,sans-serif;"><u><span style="font-family: Verdana,sans-serif;"><span style="font-family: Verdana,sans-serif;"><span style="font-family: Verdana,sans-serif;">Chapter 7: Create your daily "TO-DO" list</span></span></span></u></span><br />
<span style="font-family: Verdana,sans-serif;"></span><br />
<span style="font-family: Verdana,sans-serif;">One can see it as a blueprint for the day. he mentions that "the best time to make a list is the night before, so your subconscious mind can work on your list while you sleep." I would add that while working for a big multinational in Italy I had a colleague who was writing down on paper what he wanted to achieve for the next day. And things were going pretty well for him. The ABCDE Method. The most important word in time management is <i>consequences</i>. A task is important depending on the potential consequences of doing it or not doing it.</span><br />
<span style="font-family: Verdana,sans-serif;">The book clearly explains how <i>time wastage (due to bad habits) sabotages careers.</i></span><br />
<span style="font-family: Verdana,sans-serif;"><i>The Not-To-Do List. “No” is the greatest time-saving word in the world of<br />time management. </i></span><br />
<span style="font-family: Verdana,sans-serif;"> </span><br />
<span style="font-family: Verdana,sans-serif;"><u><span style="font-family: Verdana,sans-serif;"><span style="font-family: Verdana,sans-serif;"><span style="font-family: Verdana,sans-serif;">Chapter 8: </span></span></span>Set Clear Priorities</u></span><br />
<span style="font-family: Verdana,sans-serif;">Ask yourself What is the most valuable use of my time right now?</span><br />
<span style="font-family: Verdana,sans-serif;">Is also important to distinguish between important and urgent.</span><br />
<span style="font-family: Verdana,sans-serif;"><br /></span>
<span style="font-family: Verdana,sans-serif;"><u>Chapter 9: Stay on Track</u> </span><br />
<span style="font-family: Verdana,sans-serif;">Is also important to distinguish between important and urgent.</span><br />
<br />
<u><span style="font-family: Verdana,sans-serif;"><span style="font-family: Verdana,sans-serif;">Chapter 10: Determine Your Key Result Areas </span></span></u><br />
<span style="font-family: Verdana,sans-serif;">A KRA is:</span><br />
<span style="font-family: Verdana,sans-serif;">- something that you absolutely must to <br />- 100% under your control</span><br />
<span style="font-family: Verdana,sans-serif;">- something that you are responsible for</span><br />
<span style="font-family: Verdana,sans-serif;"><br /></span>
<span style="font-family: Verdana,sans-serif;">Furthermore, Brian Tracy dedicates special short chapters to the importance of Delegating to the others (chapter 11), concentrating (chapter 12), overcoming procrastination, creating chunks of time and controlling interruptions, batching your tasks and controlling your phone, reading faster and investing in personal development. I'm not going to take you the pleasure of reading the book by describing each of the chapter</span><br />
<br />
<span style="font-family: Verdana,sans-serif;">All in one, the book is an easy read, easy to understand and the principles are so simple that one has no excuse not putting them in practice and becoming more efficient. So I would highly recommend it to anyone having problems with time management !</span><br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-84345491493082221002014-10-13T06:03:00.001-07:002014-10-13T06:04:21.650-07:00Operation must use an updateable queryI was getting this error while trying to update an Access database (don't ask me why on Earth I use Access - not my decision). After little (fortunately) struggle I realized the DB was read only. It took some time, because another save operation doesn't work, so I was pointing on the wrong direction. Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-74864390937087570572014-04-04T10:40:00.003-07:002014-04-04T10:44:35.722-07:00SSIS fails<span style="font-family: Verdana,sans-serif;">If you get an error at the running of the Flat File Source SSIS dataflow item</span><br />
<span style="font-family: Verdana,sans-serif;">"Task Load {your flat_file} failed" while running a SSIS package (that loads data from a flat file) it might be that you have the flat file opened in Excel. Just for curiosity I tried opening the file in CSVed and it looks like CSVed doesn't keep it locked, the task runs succesfully.</span><br />
<span style="font-family: Verdana,sans-serif;"><br /></span>
<span style="font-family: Verdana,sans-serif;">Hope this is saving you some hair pulling.</span>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-23361448673475956032014-03-27T03:18:00.001-07:002014-03-27T03:18:20.394-07:00Maps in SSRS 2008Yesterday I was getting an error while trying to run a report that contains a map, saying something like this:<i> [...]maps binding or grouping for layer is not valid[...]</i>. I don't remember exactly the entire error message, but I can reproduce it if one is interested.<br />
<br />
This was a little tricky because I started to look at the map layer properties, trying to understand what I did wrong in the RDL. Just to find out that the DataSource was returning more than one row per country, so the poor RS didn't know which row to map.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-65709903924826334302014-02-11T06:28:00.003-08:002014-02-12T02:25:34.115-08:00Think Like a Programmer by V. Anton Spraul, O'Reilly Media<a href="http://akamaicovers.oreilly.com/images/9781593274245/cat.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://akamaicovers.oreilly.com/images/9781593274245/cat.gif" /></a><span style="font-family: Verdana,sans-serif;">I got this book as part of </span><span style="font-family: Verdana,sans-serif;"><span style="font-family: Verdana,sans-serif;">O'Reilly blogger progam. </span>As a software developer with 14 years of experience myself, I was curious to see what Anton Spraul's book can teach.</span><br />
<span style="font-family: Verdana,sans-serif;">You'll not find there the usual pages with code and algorithms that you'll find in many computer programming books. The code you'll find in C++ and is used mostly for exemplification. Is not a book about code, but one about problem solving. Ideas learned can be applied in many other areas of our life. <br /><br />The book starts with basic logic problems (classic puzzles), the solution to them and the way of thinking that can lead to a solution. Here we learn about being aware of ALL possible actions you could take, creating strategies and simplifying the problem, looking for the most constrained part of the problem, recognizing patterns and analogies. Just as a side note, I'm member of a chess site, where paying members get to try a huge number of tactical problems and this helps a lot in recognizing patterns in the real game. Programming is similar: recognizing patterns and reducing complex problems to known ones.</span><br />
<span style="font-family: Verdana,sans-serif;"><br />Then the book goes through specific type of problems in programming, like problems with arrays, pointers and dynamic memory, classes, recursion.</span><br />
<span style="font-family: Verdana,sans-serif;"><br />On very interesting chapter is the one about code reusing. It is teaching when is good and when is bad to reuse code, it helps identifying the components and building a "component toolkit" or component knowledge. It makes use of the knowledge acquired in the previous chapters and interestingly teaches which components to use for a specific problem, based on the amount of work, flexibility and maintainability. It not only presents the way to get to a solution, but also comparing two possible solutions to the same problem and choosing the best one. <br /><br />In all the chapters I didn't type in and compile the code, since I was not interested in coding but in finding patterns of thinking and ways to improve. <br /><br />The last chapter puts it all together, teaches how to create a development plan by eliminating weaknesses (both coding and design ones) and using the strengths. Also learning a new programming skill is approached systematically and this is approach interesting also for seasoned programmers. <br /><br />I'll conclude with a quote from the book: "Once you are thinking like a programmer, be proud of your skills. If someone calls you a coder rather than a programmer, say that a well-trained bird could be taught to peck out code—you don’t just write code, you use code to solve problems."</span><br />
<br />
<span style="font-family: Verdana,sans-serif;">You can find more details about the book and the table of contents on <a href="http://shop.oreilly.com/product/9781593274245.do">O'Reilly catalog page</a>. </span>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-58079097923269270932013-04-19T01:48:00.001-07:002013-04-19T01:49:02.573-07:00SargableI didn't know this world. It comes from Search ARGument ABLE (according to <a href="http://en.wikipedia.org/wiki/Sargable">wikipedia</a>) and it means (in databases world) a condition that enables the use of indexesUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-36584645961259591242012-10-31T08:53:00.002-07:002012-10-31T08:58:51.995-07:00null is not nothingLet's assume we have a table @a Do you think<br />
<div class="code">
select * from @a<br />
where a = a</div>
<br />
<br />
is the same as writing
<br />
<div class="code">
select * from @a </div>
<br />
?
<br />
<br />
Well, think at it for a second before reading furher. Now run this code<br />
<div class="code">
declare @p as varchar(5) = null<br />
declare @A as table (a varchar(5))<br />
insert into @A values ('a1')<br />
insert into @A values ('a2')<br />
insert into @A values ('a3')<br />
insert into @A values (null)<br />
select * from @a
where a = ISNULL(@p, a)</div>
<br />
Why ? hmm, there is a nice discussion about DB NULL values <a href="http://sqlblog.com/blogs/hugo_kornelis/archive/2007/07/06/null-ndash-the-database-rsquo-s-black-hole.aspx">here</a>. And in many many other places on the webUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-1098540356274799542012-08-13T09:34:00.000-07:002012-08-13T09:45:13.557-07:00Buying the Right Photo Equipment, by Elin Rantakrans, O'Reilly MediaIn this 128 pages book, Elin Rantakrans aims to help newbies photographers find the right gadgets to fit their shooting style.<br />
<br />
The photo equipment is divided into few major chapters: lenses, filters, tripods, flash, protecting gear, other accessories and computer software.
Browsing through the wide variety of photo equipment, each gear type is presented with the purpose and the photography style that it is better suited for. I like the concise presentation, the pictures to exemplify each usage of the gear and the tips for each photography. However, I'd have definitively preferred to see the settings of each pictures and maybe a short story of why the photographer decided for that lens/gear.<br />
<br />
If you are a beginner, the book is a definite must read. Is a very easy lecture that would surely get your photos to a next level. I consider myself an intermediate photographer and I think I had quite a lot to read from. I'm sure the part about flash and the ones about software can give many photographers new ideas.<br />
<br />
The book doesn't go into details of specific equipment brands and models, but that would make the book become obsolete very soon after being published. After all, there are plenty of review websites for photography gear, so after one decides what type of equipment he/she needs the search for the right model is a matter of time spent into deciding what's best for your camera + budget + style. Of course, be warned that if you are serious about photography your camera&accessories bag will soon become pretty heavy.<br />
<br />
The book is a very useful and very easy reading. I'll definitely recommended it to my friends having photography as their hobby.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-12832839090139828682012-02-02T02:18:00.000-08:002012-02-02T02:38:56.624-08:00Fast Query but Slow Stored ProcedureFew days ago we had a problem that I encountered years ago while working in Italy.<br />
Basically a Stored Procedure is very slow. So slow that we didn't wait for it to finish, it probably more than 30 minutes. Let's not forget to mention that I'm running it on SQLServer 2008.<br />
That query taken outside the stored procedure an run with the same parameters in SQLServer Management Studio runs in only few seconds. Since back in Milan I saw the same behaviour (on SQLServer 2005 that time) I thought I have the answer and can impress the colleagues with a fast solution: using <code>WITH RECOMPILE clause.</code><br />
However, the result was the same...very slow stored procedure.<br />
After searching the Internet we found the answer <a href="http://stackoverflow.com/questions/211355/parameter-sniffing-or-spoofing-in-sql-server">here</a>. Parameters sniffing. Explained <a href="http://blogs.msdn.com/b/queryoptteam/archive/2006/03/31/565991.aspx">here</a> as "the process of using the parameter value to estimate selectivity and cardinality".<br />
Indeed, our query is pretty complex and it looks like SQLServer did not know to re-create the execution plan. After changing the parameters' names, everything was OK.<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-38284515421496666812011-11-16T06:30:00.001-08:002011-11-22T07:18:56.517-08:00Maps in SSRS 2008 R2<div style="font-family: Verdana,sans-serif;">
We don't want to use Dundas Maps anymore, so I started using the maps provided by Microsoft within SSRS 2008 R2. The first problem I encountered is an error while I try to preview the map:<br />
"Map1 was detected in the report. SQL Server 2008 Reporting Services does not support map report items"<br />
</div>
<span style="font-family: Verdana,sans-serif;">The solution is </span><a href="http://social.msdn.microsoft.com/Forums/en/sqlreportingservices/thread/2075e54c-b6f0-4eb7-90ec-3e5c0b006260" style="font-family: Verdana,sans-serif;">here</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-32808425576156474632011-10-24T16:52:00.000-07:002011-11-22T07:19:40.856-08:00Nature and Landscape Photography, by Martin Borg, O'Reilly MediaThis post is not at all about a problem in SQLServer or compiling issues but a book review. Why ? Because is all about enjoyment.
In “Nature and Landscape Photography” Martin Borg is presenting a very nice collection of tips for better photography in the outdoors.<br />
Out of many photography books, I was attracted by this one because is written by a Swedish photographer. As nature photography is one of my hobbies, and considering I leave in Stockholm, I was expecting subjects, magical hours and type of landscape to be similar to what I encounter here around Stockholm, and I was not disappointed. This is an easy lecture of 71 short tips from Martin Borg, illustrated with his own pictures. A nice feature is the editor’s insertion of details about each photography. A beginner to intermediate amateur can really benefit from this tips. Many of them are indeed not new, but some are very interesting.<br />
I would’ve probably preferred to have more technical details and more of compositional hints, as well as a little bit of the way the photographer reached to that composition or developed the idea that led to the image. But this is not a manual of photography, is just a collection of tips.<br />
With this book Martin Borg manages to make you wish to go out in the nature and practice the tips (which I did, taking advantage of the nice autumn weather that we had during the first week-end after reading the book). Don’t be scared if you don’t own a Hasselblad camera like the author does, with a decent SLR and a stable tripod you can still reach good results.<br />
For me, the book was useful for a couple of ideas that I probably read before but I was neglecting, some new hints (like breathing on lens, playing with fantasy vs. reality, revealing nature’s strength), as well as for triggering my interest for using neutral density filters.
<br />
All in one, the book is a useful and enjoyable reading. I already recommended it to a friend who’s starting with photography.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-42998736239356663012011-08-19T06:06:00.000-07:002011-08-19T06:06:51.721-07:00Canot debug clickonce app<div style="font-family: Verdana,sans-serif;"><span style="font-size: small;">I have a .NET app that used to work. Now I stumble upon this very annoying problem. I cannot debug.</span></div><div style="font-family: Verdana,sans-serif;"><span style="font-size: small;"><br />
</span></div><div style="font-family: Verdana,sans-serif;"><span style="font-size: small;">---------------------------<br />
Microsoft Visual Studio<br />
---------------------------<br />
The following module was built either with optimizations enabled or without debug information:<br />
<br />
C:\[....].DLL<br />
<br />
To debug this module, change its project build configuration to Debug mode. To suppress this message, disable the 'Warn if no user code on launch' debugger option.<br />
---------------------------<br />
OK <br />
---------------------------</span></div><div style="font-family: Verdana,sans-serif;"><span style="font-size: small;">I've seen the proposed solution <a href="http://stackoverflow.com/questions/810203/the-following-module-was-built-either-with-optimizations-enabled-or-without-debug/2700305#2700305">here</a>, but this just suppress the error message.</span></div><div style="font-family: Verdana,sans-serif;"><br />
</div><div style="font-family: Verdana,sans-serif;"><span style="font-size: small;">VisualStudio 2008 </span></div><div style="font-family: Verdana,sans-serif;"><span style="font-size: small;"><br />
</span></div><div style="font-family: Verdana,sans-serif;"><span style="font-size: small;">Any ideas ?</span></div><div style="font-family: Verdana,sans-serif;"><span style="font-size: small;"><br />
</span></div><div style="font-family: Verdana,sans-serif;"><span style="font-size: small;"><br />
</span></div><br />
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-18859594755492704612011-07-25T12:26:00.000-07:002011-07-25T12:26:27.808-07:00stuff<div style="font-family: Verdana,sans-serif;">Well, I often need to create a comma-separated list out of values in a table.</div><div style="font-family: Verdana,sans-serif;"><a href="http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/6d1fafb5-928a-45fd-92c8-6d231c745652">here</a> I found this pretty ellegant sollution: </div><div style="font-family: Verdana,sans-serif;"><br />
</div><br />
<div class="code">STUFF(<br />
<br />
(<br />
<br />
SELECT ', ' + Supplier_ID<br />
<br />
FROM SomeTable<br />
<br />
join SomeOtherTable<br />
<br />
on Something<br />
<br />
WHERE SomeCondition<br />
<br />
FOR XML PATH('')), 1, 1, '') as AllSuppliers</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-909637982266440192011-06-16T05:42:00.000-07:002011-06-16T05:42:18.642-07:00Execution order differs with rendering modeToday our tester found a big saying "Incorrect numbering of the tables in the PDF export".<br />
The issue is that we have a custom code function incrementing a number and than returning the resulting number. It starts from 0 and it'll return 1 first time it is called, 2 afterwards, 3 and so on. It works fine when my report renders in HTML, but not when it renders as PDF. The first table is numbered with 5 and the rest are numbered in order 1 to 4<br />
<br />
The only difference between the first table and the rest is that the first table displays the table number in a row, while for the rest I had to add a text box above the table. <br />
<br />
Apparently, the execution order of custom code is different when report is rendered in browser vs when it renders as PDF. I did a simple test by creating a test report, with just a matrix, a table and a text box and the textbox is indeed rendered first (it executes the custom code first). Only after, the tablixes are renderedUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-11859857589414702372011-05-18T10:04:00.000-07:002012-02-10T00:25:34.099-08:00SSRS 2008 incorrect number of TablixCornerCell<span class="Apple-style-span" style="font-family: Verdana,sans-serif;">I got a "nice" error today , while working on a report converted from SSRS 2005 to SSRS 2008.</span><br />
<div class="error">
Error 1 [rsWrongNumberOfTablixCornerCells] The tablix ‘matrix4’ has an incorrect number of TablixCornerCell. The number of TablixCornerCell within TablixCornerRow at index: 0 must equal the number of levels in the TablixRowHierarchy containing TablixHeaders.<br />
<br />
Update , 2012-02-10: I fixed the problem by simply reading carefully the error message. All I did was adding an empty <code><TablixCornerCell></TablixCornerCell></code> into the <code><TablixCornerRow></code></div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-6432311485479279864.post-12998390438829205852011-05-04T07:22:00.000-07:002011-05-27T01:04:14.348-07:00Sometimes VS 2008 cannot access DataSource fileToday, for the second time since we started using SSRS 2008 I had the following stupid error:<br />
Running a dataset works from VS designed, but when I try to run the report (again, from the VS2008 designer) I get errors (DS couldn't be run)<br />
<br />
After little investigation I realize that the problem is in fact that the report cannot be built. I had VS2008 access to RDS file denied. this is not a read-only file, is checked-out, so VS should be able to access the file and change it. <br />
However, VS keeps telling that access to {MyReportsFolder}\bin\Debug\{MyDataSource.rds} is denied<br />
The only way I found to fix this was to delete the folder {MyReportsFolder}\bin and rebuild.<br />
<br />
Weird...Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-52359523747890413632011-01-14T01:10:00.000-08:002011-01-14T01:10:32.818-08:00Error in SSIS VS2005Yesterday I had to put some code into SSIS packages. <br />
Being a lazy person, what I usually do is copying one of the existing task ("Execute SQL Task") and changing the name and the code itself. Apparently after installing VS2005 SP1 this was not working anymore. <br />
<br />
I had to create every "Execute SQL Task", set the connection, etc....which is not a lot but is slower than what I was used to.<br />
<br />
The error message I was receiving while trying to copy was "An error occurred while objects were being copied. SSIS Designer could not serialize the SSIS runtime objects". A fast google search revealed <a href="http://social.msdn.microsoft.com/Forums/eu/sqlintegrationservices/thread/f64f9adf-9c97-4e3e-b7c6-9a85e8f1c383">this page</a> and the easy fix by <i>jaegd</i>: <br />
<br />
Register the xml parser dlls with the below commands.<br />
<br />
regsvr32.exe msxml3.dll<br />
regsvr32.exe msxml6.dll<br />
<br />
It really worked and fixed my problem, but lets me wondering why Microsoft didn't fix it and release a SP2 with all this fixes.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-6591551226708008602010-10-06T09:51:00.000-07:002011-05-27T01:20:31.909-07:00Find the Last Apparition of a Value in String<div style="font-family: Verdana,sans-serif;">Well, indeed, I spent few minutes today trying to find the last apparition of a value in string. All this in a simple T-SQL query in SQLServer 2005. The reason I wanted this is that I need the last part of a string separated by a known delimiter.</div><div style="font-family: Verdana,sans-serif;">I was having a string like this:</div><div class="code">declare @a as nvarchar(50)<br />
set @a = 'ssss$kkkk$ooooo$abcde'</div><br />
<div style="font-family: Verdana,sans-serif;">I searched the Internet a bit, but with no success. But after few minutes I remembered a function that I seldom use, the reverse. From here, all was as simple as:<div class="code" font="Verdana">select charindex ('$', reverse('ssss$kkkk$ooooo$abcde') )</div>and further play with this to get the value I need</div><br />
<br />
<i>Update: Of course, using it to trim out the last part of the string is going to be something like this:</i><br />
<div class="code">select Substring(@a, 1, Len(@a) - charindex ('$', reverse(@a)))</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6432311485479279864.post-7113254443714838552010-09-22T02:03:00.000-07:002010-09-22T02:03:52.322-07:00SSRS. Must declare scalar variable @Parameter1<div style="font-family: Verdana,sans-serif;"><span style="font-family: Verdana,sans-serif; font-size: small;">Well, </span><span style="font-size: small;">one of the errors in Reporting Services 2005 says:</span></div><div style="font-family: Verdana,sans-serif;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;"> An error occurred during local processing</div><div style="font-family: "Courier New",Courier,monospace;">An error has occurred during report processing</div><div style="font-family: "Courier New",Courier,monospace;">Query execution failed for data set 'Name of the data set'</div><span style="font-family: "Courier New",Courier,monospace;">Must declare the scalar variable @Parameter1</span><br />
<br />
<span style="font-size: small;"><span style="font-family: Verdana,sans-serif;">This can be pretty annoying especially when you know you have the report parameter and it used to work. What happens is that, due to some black magic that I cannot explain, the data source is loosing the list of parameters. So the fix is to either add the parameters one by one or just delete and recreate the data source and everything will work.</span></span>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-6432311485479279864.post-14823930565714649472010-09-08T08:04:00.000-07:002010-09-08T08:14:14.009-07:00ROLLUP vs CUBEWell, that's what happen when you don't carefully read the documentation. I have recently discovered the benefit of the WITH ROLLUP clause in SQLServer 2005, and I thought what it was doing was returning all possible combinations of grouping.<br />Wrong, that's the WITH CUBE.<br /><br />Using the <span style="font-weight: bold;">WITH ROLLUP</span> I found out that the number of rows returned by my query was dependent on the order of the fields in the group by clause. Funny.<br /><br />Well, to keep it short, I found this: <a href="http://msdn.microsoft.com/en-us/library/ms189305%28SQL.90%29.aspx">http://msdn.microsoft.com/en-us/library/ms189305%28SQL.90%29.aspx</a><br />because "<span style="font-style: italic;">ROLLUP generates a result set that shows aggregates for a hierarchy of values in the selected columns</span>" we get results depending on this hierarchy.<br /><br />unlike it, what I needed was the WITH CUBE clause: CUBE generates a result set that shows aggregates for all combinations of values in the selected columns.Unknownnoreply@blogger.com0