Friday, February 22, 2013

Visual Studio Build Feature


GREAT POST --- http://geeks-squad.blogspot.com/2008/07/what-does-clean-solution-under-build.html

What does "Clean Solution" under Build Menu in Visual Studio do ?

I have been using the Visual Studio 2003 and 2008 IDE everyday at work for 9 hours for almost 7 months now and still keep running into these little stuff in the IDE that either I never thought existed or seen or even if I have seen never bothered to explore further.

So, today morning, while building my project, (I usually use Ctrl+Shift+B (Build All) rather than go to the Build Menu and use the Build Solution there) from the Build Menu, I saw the Clean Solution menu that I always knew existed but never bothered to find out what for.

So, I decided to look it up on MSDN and this is what I found.
To build, rebuild, or clean an entire solution
  1. In Solution Explorer, select or open the desired solution.
  2. On the Build menu, choose Build SolutionRebuild Solution, or Clean Solution.
    • Choose Build or Build Solution to compile only those project files and components that have changed since the last build.
      Note:
      The Build command becomes Build Solution when a solution includes more than one project.
    • Choose Rebuild Solution to "clean" the solution first, and then build all project files and components.
    • Choose Clean Solution to delete any intermediate and output files, leaving only the project and component files, from which new instances of the intermediate and output files can then be built.


So, Clean Solution apparently cleans up ur .pdb files from the solution directory and adds them back again when you build the solution again with the new component files and the output generated by them.

Another article that explain "Clean Solution" can be found here.

But then again, my curiosity did not die there, so I continued on trying to find what exactly goes on in a "pdb" file and found some really good articles.

MSDN
 says
"A program database (PDB) file holds debugging and project state information that allows incremental linking of a debug configuration of your program. A PDB file is created when you build with /debug (Visual Basic/C#). You can build Visual Basic and Visual C# applications with/debug:full or /debug:pdbonly. Building with /debug:full generates debuggable code. Building with /debug:pdbonly generates PDBs but does not generate the DebuggableAttribute that tells the JIT compiler that debug information is available. Use /debug:pdbonly if you want to generate PDBs for a release build that you do not want to be debuggable.
The Visual Studio debugger uses the path to the PDB in the EXE or DLL file to find the project.pdb file. If the debugger cannot find the PDB file at that location, or if the path is invalid, for example, if the project was moved to another computer, the debugger searches the path containing the EXE followed by the symbol paths specified in the Options dialog box. This path is generally the Debugging folder in the Symbols node. The debugger will not load a PDB that does not match the binary being debugged."

Edition
Visual
Basic
C#
C++
Web Developer
Express
Topic appliesTopic appliesTopic does not applyTopic applies
Standard
Topic applies
Topic applies
Topic does not apply
Topic applies
Pro and Team
Topic applies
Topic applies
Topic does not apply
Topic applies
Table legend:
Topic applies
Applies
Topic does not apply
Does not apply
Topic applies but command hidden by default
Command or commands hidden by default.


Other findings :
"The dll is the actual binary that executes. The PDB is the symbols that map memory locations in the binary to symbolic names for the debugger."

Anyways, that's it from me as far as pdb and "Clean Solution" is concerned. Next time will talk about Generics (one of my favorite features in C#).

Until next time,
Happy Debugging !!!

Thursday, February 21, 2013

New Job Title

Trained chimp behind the key board LOL...  I heard that from a co-worker today and thought that was funny.

T-SQL Cursor example

--------------------------CURSOR CODE BEGIN------------------------------
DECLARE @id INT
DECLARE @doc_id INT
DECLARE @review_count INT


DECLARE MyCursor CURSOR FAST_FORWARD FOR
SELECT
 doc_id,
 SUBSTRING(short_desc, 6, 6) AS id
FROM tbl_client_doc cd
WHERE 
cd.doc_type_id = 18 
AND 
cd.short_desc LIKE "XYZ: %'
AND 
cd.note_desc = ''
ORDER BY
cd.doc_type_id DESC
OPEN TarCursor

FETCH NEXT FROM MyCursor INTO @doc_id, @id

WHILE @@FETCH_STATUS = 0
BEGIN
SET @review_count = (SELECT COUNT(answer_id) FROM tbl_review_gen WHERE id = @id)
IF @review_count > 0
BEGIN
PRINT 'DELETE FROM tbl_client_doc WHERE doc_id = ' + CONVERT(varchar(10), @doc_id)
END
FETCH NEXT FROM MyCursor INTO @doc_id, @id    ---- Have to move to the next row
END
--CLOSE MyCusor
DEALLOCATE MyCursor
GO
--------------------------CURSOR CODE END-------------------------------


Tuesday, February 19, 2013

DropDownList set dl.SelectedValue


 Private Sub dg_srvc_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg_srvc.ItemDataBound
        If e.Item.ItemType = ListItemType.EditItem Then
            Dim dl_span As DropDownList
            Dim t As Label

            dl_span = CType(e.Item.FindControl("dl_span"), DropDownList)
            dl_span.SelectedValue = dl_span.Items.IndexOf(dl_span.Items.FindByText(s_span.Trim.ToLower))

            t = CType(e.Item.FindControl("temp"), Label)
            t.Text = s_span.Trim

        End If

WARNING: ENSURE your values if hard coded match the value from the DB...

Visual Studio Windows opening in different Window Panes?

If your Visual Studio 2012 or any other version is opening Windows in different panes try the following:

File Menu
 --- Window
    ---- Reset Window Layout


Pretty good stuff --- Also found "Auto Hide All" good shortcut to get the full screen to code with.

Friday, February 15, 2013

Databinding

 MSDN - Data-binding expressions are contained within <%# and %> delimiters and use the Eval and Bind functions. The Eval function is used to define one-way (read-only) binding. The Bind function is used for two-way (updatable) binding. In addition to calling Eval and Bind methods to perform data binding in a data-binding expression, you can call any publicly scoped code within the <%# and %> delimiters to execute that code and return a value during page processing.

Search for Text in SQL Server DB


 use DB_NAME
SELECT DISTINCT
      DB_NAME() AS DatabaseName,
      OBJECT_SCHEMA_NAME(id) AS SchemaName,
      OBJECT_NAME(id) AS ObjectName,
      SUBSTRING(text, PATINDEX('%YOUR_SEARCH_TEXT%',text) - 10, 100)  AS TextLocation
FROM sys.syscomments
WHERE text LIKE '%YOUR_SEARCH_TEXT%'
ORDER BY 1, 2, 3

Tuesday, February 12, 2013

SQL Server Check --- IF Exists


IF EXISTS(SELECT * FROM tempdb.dbo.sysobjects WHERE ID = OBJECT_ID(N'tempdb..#temp_det_for_mst'))
BEGIN
DROP TABLE #temp_det_for_mst
END

Tuesday, February 05, 2013

Entity Framework (Credit Walt Daniels)

Wiring up Entity Framework to DropDownList ASP.NET.

Prereq ---  Setup Entity Framework.


Private Sub FillSource()
        ctx = New Context()



        Dim qry = From p In ctx.tbl_names
                  Where p.ACTIVE = True
                  Order By p.name
                  Select p.id, p.name


        ddlFundSource.DataSource = qry.ToList()
        ddlFundSource.DataValueField = id"
        ddlFundSource.DataTextField = "name"
        ddlFundSource.DataBind()
        ddlFundSource.Items.Insert(0, New ListItem("[Any Fund]", "0"))    ' Tip if you want to add a default value.

    End Sub


Wednesday, January 30, 2013

Looping with ADO.NET on DataTable filled from SQL

Private Sub IsAgencyFormCompleted()
        Dim application_id As Int32
        Dim sqlString As String
        Dim dtl_id As String = String.Empty
        Dim dt As New DataTable()
        Dim MyCtrl As ctrl_db_commands

        If Not Session("application_id") Is Nothing Then
            Try
                application_id = Int32.Parse(Session("application_id"))
                'SQL to check to see if the Agency Form is completed
                sqlString = "SELECT agcy_xxx_number, agcy_npx_number, agcy_number, agcy_primary_contact_title, agcy_executive_director, agcy_medical_director, agcy_entity_type_id, agcy_tax_status FROM [dbo].[TBL_101_APPLICATION] WHERE application_id = " & application_id
                Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("conn").ConnectionString)
                    conn.Open()
                    Using sda As New SqlDataAdapter(sqlString, conn)
                        sda.Fill(dt)
                    End Using
                End Using
            Catch ex As Exception
                Throw New ArgumentException("Exception Occured Contact Cardinal Innovations Solutions Delievery")
            End Try
        End If
        For Each dataRow As DataRow In dt.Rows
            For Each dataColumn As DataColumn In dt.Columns
                Dim fieldValue As String = dataRow(dataColumn).ToString()
                'The AgencyForm is not completed Exit For and display message
                If (fieldValue = "" Or fieldValue = "-1") Then
                    Me.Master.ShowSysMessage("Please complete the entire Section1-1 (Agency) before adding Facilities", "Error")
                    MyCtrl = DirectCast(Me.fv1.FindControl("ctrl_db_commands1"), ctrl_db_commands)
                    MyCtrl.Show_Add = False
                    MyCtrl.Show_Cancel = False
                    MyCtrl.Header_Text_HTML = "Please complete the entire Section1-1 (Agency) before adding Facilities"
                    Exit For
                End If
            Next
        Next
    End Sub

Programmer productivity -- Dr. Dobbs


Article on ALM products, but the first part is so true…  Worth a read 

Multitasking is good when it comes to computer programs, letting them do more with less. But when computer programmers start multitasking, productivity flies out the door. 

For one thing, when programmers have to shift tasks, it takes "a really, really, really long time," says Joel Spolsky, host of the Joel On Software Web site and co-founder of Fog Creek Software. Programmers have to keep a lot of things in their heads at once, Spolsky says, and the more they remember, the more productive they are. "A programmer coding at full throttle is keeping zillions of things in their head at once," he says, "everything from names of variables, data structures, important APIs, the names of utility functions that they call a lot, even the name of the subdirectory where they store their source code." 

On top of that, as applications have become more collaborative, complex, modular, and distributed, developers are having to track an increasing number of tasks and deal with more interruptions from the people with whom they're collaborating. As a result, they're multitasking more frequently and becoming less productive. 

How bad is the problem? Developers spend an average of 11 minutes on one task before being interrupted to deal with another, according to Gloria Mark of the University of California at Irvine's Department of Informatics, who has spent years examining developers' work environments. It then takes them 25 minutes to return to the original task. 

Keeping programmers productive in these fragmented work environments is a challenge for large software developers as well as for IT shops developing for end users. In both cases, application life-cycle management tools and processes can help. They automate steps -- such as change management, build processes, and testing -- in the development process, off-loading work from developers and cutting back on the number of interruptions they face. 

Tuesday, January 29, 2013

ASP.NET Coding Thoughts


Sometimes you just have to bang your head until you get it.  I worked till 9:00 PM EST yesterday to figure out the Network App App.

It was very challenging and frustrating, but I did learn quite a few things.

Using TryCast() or DirectCast() methods don't work well if  you are not in the correct container that you are trying to cast, aka our famous formview container.

Hint Hint… the most of the user controls are all in the formview --- That got me.

I keep saying to myself, why the hell are you not picking up the usercontrol (Then it clicked)

 The past programmer did a great deed by hard coding values on properties when you pass the value to the properties…  No problem that was fixed for the  Show_Add() Property.   

Finally the call of the user control was overwriting the properties that I set because of the ASP.NET Page Load Cycle.  As a result the user control properties value sets are set in the Me.PreRenderComplete Event (GOTCHA)

So in all lessons learned.

My takeaways.

  1. Use DirectCast when you know the value type and in this scenario were casting the user control  with ID = ctrl_db_commands1 
  1. Find the control in the correct container, never trust old applications and always research where these controls exist
  1. If your properties are not changing you better debug and find out why in this case the values where hard coded in the properties, which was updated to work correctly.


Wow, what a challenge, what next does work have for me, from this point forward I will not take any of this code for granted.

Friday, January 18, 2013

Clustered and Non-Clustered Indexes by Vijay Modi


What is cluster and Non-Cluster index and why we need it? Do you know? Just read this article and you will know all about it.

Most database administrators are familiar with the potential performance benefits they can gain through the judicious use of indexes on database tables. Indexes allow you to speed query performance on commonly used columns and improve the overall processing speed of your database.
Microsoft SQL Server supports two types of indexes:

-> Clustered indexes define the physical sorting of a database table’s rows in the storage media. For this reason, each database table may have only one clustered index. If a PRIMARY KEY constraint is created for a database table and no clustered index currently exists for that table, SQL Server automatically creates a clustered index on the primary key.
-> Non-clustered indexes are created outside of the database table and contain a sorted list of references to the table itself.
SQL Server 2000 supports a maximum of 249 non-clustered indexes per table. However, it’s important to keep in mind that non-clustered indexes slow down the data modification and insertion process, so indexes should be kept to a minimum

One of the hardest tasks facing database administrators is the selection of appropriate columns for non-clustered indexes. You should consider creating non-clustered indexes on any columns that are frequently referenced in the WHERE clauses of SQL statements. Other good candidates are columns referenced by JOIN and GROUP BY operations.
You may wish to also consider creating non-clustered indexes that cover all of the columns used by certain frequently issued queries. These queries are referred to as “covered queries” and experience excellent performance gains.

SQL Server provides a wonderful facility known as the Index Tuning Wizard which greatly enhances the index selection process. To use this tool, first use SQL Profiler to capture a trace of the activity for which you wish to optimize performance. You may wish to run the trace for an extended period of time to capture a wide range of activity. Then, using Enterprise Manager, start the Index Tuning Wizard and instruct it to recommend indexes based upon the captured trace. It will not only suggest appropriate columns for queries but also provide you with an estimate of the performance increase you’ll experience after making those changes!

Monday, January 14, 2013

Calendar Mask and AJAX


<asp:TextBox ID="txt_prov_srvc_from_dt" runat="server" MaxLength="10" />
                    <asp:ImageButton ID="ibtnServFromDtCal" AlternateText="Calendar" ImageUrl="~/images/calendar_icon_blue.gif" runat="server" CausesValidation="false" />
                                    <ajaxtoolkit:MaskedEditExtender ID="maskExtenderServFromDtCal" TargetControlID="txt_prov_srvc_from_dt" MaskType="None" Mask="99/99/9999" ClearMaskOnLostFocus="False" runat="server" />
                                    <ajaxtoolkit:CalendarExtender ID="maskCalExtenderServFromDtCal" TargetControlID="txt_prov_srvc_from_dt" PopupButtonID="ibtnServFromDtCal" Format="MM/dd/yyyy" runat="server" />
                    <asp:CompareValidator ID="ProvSrvcFromDtValidator" runat="server" ErrorMessage="CompareValidator" Type="Date" ControlToValidate="txt_prov_srvc_from_dt" Operator="DataTypeCheck" Display="Dynamic" Font-Bold="True">?</asp:CompareValidator>
                    <asp:TextBox ID="txt_prov_srvc_to_dt" runat="server" MaxLength="10" />
                    <asp:ImageButton ID="ibtnServToDtCal" AlternateText="Calendar" ImageUrl="~/images/calendar_icon_blue.gif" runat="server" CausesValidation="false" />
                                    <ajaxtoolkit:MaskedEditExtender ID="maskExtenderServToDtCal" TargetControlID="txt_prov_srvc_to_dt" MaskType="None" Mask="99/99/9999" ClearMaskOnLostFocus="False" runat="server" />
                                    <ajaxtoolkit:CalendarExtender ID="maskCalExtenderServToDtCal" TargetControlID="txt_prov_srvc_to_dt" PopupButtonID="ibtnServToDtCal" Format="MM/dd/yyyy" runat="server" />
                    <asp:CompareValidator ID="ProvSrvcToDtValidator" runat="server" ErrorMessage="CompareValidator" Type="Date" ControlToValidate="txt_prov_srvc_to_dt" Operator="DataTypeCheck" Display="Dynamic" Font-Bold="True">?</asp:CompareValidator>

Friday, January 11, 2013

ADO.NET 2012 - GET DATA from SQL with Using Statements

VB.NET
Private Function GetData() As String

        Dim intDataID As Integer
        Dim strFinalizedDate As String = "Not Completed"

        Try
            intDataID = Int32.Parse(lblDataID.Text)

            Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("conn_string").ConnectionString)
                conn.Open()
                Using cmd As New SqlCommand("SELECT update_dt FROM table WHERE data_id = " & intDataID, conn)
                    cmd.CommandType = CommandType.Text
                    Using reader As SqlDataReader = cmd.ExecuteReader()
                        If reader.HasRows Then
                           While reader.Read()
                                strFinalizedDate = reader("update_dt").ToString()
                            End While
                        End If
                    End Using
                End Using
            End Using

            Return strFinalizedDate

        Catch ex As Exception
            Throw

        End Try

    End Function

C#
try {
intDataID = Int32.Parse(lblDataID.Text);

using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings("conn_string").ConnectionString)) {
conn.Open();
using (SqlCommand cmd = new SqlCommand("SELECT update_dt FROM table WHERE data_id = " + intDataID, conn)) {
cmd.CommandType = CommandType.Text;
using (SqlDataReader reader = cmd.ExecuteReader()) {
if (reader.HasRows) {
while (reader.Read()) {
strFinalizedDate = reader("update_dt").ToString();
}
}
}
}
}

return strFinalizedDate;

} catch (Exception ex) {
throw;

}

Thursday, January 10, 2013

To find out who is connected to database in SQL Server

There are three ways to find who is connected to a database in sqlserver.
First one:
  • Use the SQL SERVER Management Studio -- Management -- Activity Monitor
  • This gives a list of users, database names, status, command, transactions, application with which they are using the database, CPU, IO and Memory usage, Login time etc.

Second One:
  • Use the built in stored procedure called sp_who2
  • Run the command exec sp_who2
  • This gives a list of users, database names, status, command, program with which they are using the database, CPU time, Login time etc.

Tuesday, January 08, 2013

Happy New Year

Goals for New Year

- .NET Entity Framework, know backwards and forwards
- JQuery
- Keep up with SharePoint

- Most important, GET IN SHAPE

Thursday, December 27, 2012

Importance of Audit in Windows Servers

From - http://www.techotopia.com/index.php/Auditing_Windows_Server_2008_File_and_Folder_Access

Importance of Folder and File Auditing to track changes on Windows Servers.   If something gets change that your job requires you to be responsible, it is to your benefit to:

A) Lock down and password protect and minimize the password to (3) people only
B) Turn File Auditing on.  
C) Ensure that the only change capability is assigned to individuals rather than a service account.  If a service account is compromised you will not know be able to track the changes down.

Thursday, December 20, 2012

How to write efficient database JOINs


How to write efficient database JOINs
Last updated March 27, 2009. Created by moshe weitzman on June 21, 2003.
Edited by bekasugkallenbergpureginStevenLog in to edit this page.
This page is based on an e-mail posted by Craig Courtney on 6/21/2003 to the drupal-devel mailing list.
There are 3 kinds of joins: INNER, LEFT OUTER, and RIGHT OUTER. Each requires an ON clause to let the RDBMS know what fields to use when joining the tables. For each join there are two tables: the LEFT table and the RIGHT table. The syntax is as follows:
{left table} (INNER | LEFT OUTER | RIGHT OUTER) JOIN {right table} ON (join criteria)
An INNER JOIN returns only those rows from the LEFT table having a matching row in the RIGHT table based on the join criteria.
A LEFT OUTER JOIN returns all rows from the LEFT table even if no matching rows where found in the RIGHT table. Any values selected out of the RIGHT table will be NULL for those rows where no matching row is found in the RIGHT table.
A RIGHT OUTER JOIN works exactly the same as a LEFT OUTER JOIN but reversing the direction. So it would return all rows in the RIGHT table regardless of matching rows in the LEFT table.
It is recommended that you not use RIGHT OUTER JOIN since a query can always be rewritten to use LEFT OUTER JOIN which tends to be more portable and easier to read.
If there are multiple rows in one table that match one row in the other table, the join will return that same row many times.
For example:
Table A
tid, name
1, 'Linux'
2, 'Debian'
Table B
fid, tid, message
1, 1, 'Very Cool'
2, 1, 'What an example'
Query 1: SELECT a.name, b.message FROM a INNER JOIN b ON a.tid = b.tid
Result 1:
Linux, Very Cool
Linux, What an example
Query 2: SELECT a.name, b.message FROM a LEFT JOIN b ON a.tid = b.tid
Result 2:
Linux, Very Cool
Linux, What an example
Debian, NULL
Visual Examples
codinghorror.com example

Hope that helps in reading some of the queries.

Monday, December 03, 2012

SQL Data Cache

http://msdn.microsoft.com/en-us/library/ms178604(v=vs.100).aspx Very good stuff. Cache data, but poll SQL Server for changes. Read the article above. http://www.codeproject.com/Articles/144344/Query-Notification-using-SqlDependency-and-SqlCach Service Broker issue http://msdn.microsoft.com/en-us/library/ms188798.aspx

Tuesday, November 20, 2012

SortedDictionary Powerful tool

Dim CheckSecurity As ctrl_secure = ctrl_secure Dim bValue As Boolean Dim dic As SortedDictionary(Of String, Int32) = CType(Session("UserAuthorizations"), SortedDictionary(Of String, Int32)) If ((dic.ContainsKey("A")) And (dic.Item("A") > 1)) Or ((dic.ContainsKey("B")) And (dic.Item("B") > 1)) Then bValue = True End If

Thursday, November 15, 2012

Here are five questions great candidates ask:

Here are five questions great candidates ask:

What do you expect me to accomplish in the first 60 to 90 days?

Great candidates want to hit the ground running. They don't want to spend weeks or months "getting to know the organization."

They want to make a difference--right away.


What are the common attributes of your top performers?

Great candidates also want to be great long-term employees. Every organization is different, and so are the key qualities of top performers in those organizations.


Maybe your top performers work longer hours. Maybe creativity is more important than methodology. Maybe constantly landing new customers in new markets is more important than building long-term customer relationships. Maybe it's a willingness to spend the same amount of time educating an entry-level customer as helping an enthusiast who wants high-end equipment.


Great candidates want to know, because 1) they want to know if they fit, and 2) if they do fit, they want to be a top performer.


What are a few things that really drive results for the company?


Employees are investments, and every employee should generate a positive return on his or her salary. (Otherwise why are they on the payroll?)


In every job some activities make a bigger difference than others. You need your HR folks to fill job openings... but what you really want is for HR to find the rightcandidates because that results in higher retention rates, lower training costs, and better overall productivity.


You need your service techs to perform effective repairs... but what you really want is for those techs to identify ways to solve problems and provide other benefits--in short, to generate additional sales.


Great candidates want to know what truly makes a difference. They know helping the company succeed means they succeed as well.


What do employees do in their spare time?


Happy employees 1) like what they do and 2) like the people they work with.


Granted this is a tough question to answer. Unless the company is really small, all any interviewer can do is speak in generalities.


What's important is that the candidate wants to make sure they have a reasonable chance of fitting in--because great job candidates usually have options.


How do you plan to deal with...?


Every business faces a major challenge: technological changes, competitors entering the market, shifting economic trends... there's rarely a Warren Buffett moat protecting a small business.


So while a candidate may see your company as a stepping-stone, they still hope for growth and advancement... and if they do eventually leave, they want it to be on their terms and not because you were forced out of business.


Say I'm interviewing for a position at your bike shop. Another shop is opening less than a mile away: How do you plan to deal with the new competitor? Or you run a poultry farm (a huge industry in my area): What will you do to deal with rising feed costs?A great candidate doesn't just want to know what you think; they want to know what you plan to do--and how they will fit into those plans.

Monday, November 12, 2012

XML Transformation on MSBuild TFS 2010

Many thanks to http://kjdaly.com/Blog/Details/5 Blog ----


<Target Name="BeforeBuild">
</Target>
<!--<Target Name="AfterBuild">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" />
</Target>
-->    <Target Name="AfterBuild" Condition="$(IsAutoBuild)=='True'">
     <ItemGroup>
     <DeleteAfterBuild Include="$(WebProjectOutputDir)\Web.*.config" />
    </ItemGroup>
    <TransformXml Source="Web.config" Transform="$(ProjectConfigTransformFileName)" Destination="$(WebProjectOutputDir)\Web.config"/>
   <Delete Files="@(DeleteAfterBuild)" />
  </Target>
</Project>

Assuming you have saved and checked in your project file and are in the process of creating a build definition, on the Process step of your build definition you will find under the Advanced heading a field labeled “MSBuild Arguments”. Enter the value /p:IsAutoBuild=”True”.

Simple GOTCHA, be sure to check in the PROJECT File back to Source Control before testing (DUH!)

Tuesday, October 09, 2012

SQL Connection and Command Example

Private Function IsClientAdmitted(ClientID As Integer) As BooleanDim conn As SqlConnectionDim cmd As New SqlCommandDim passOrFail As StringpassOrFail = Falseconn = New SqlConnection(ConfigurationManager.ConnectionStrings("conn_string").ConnectionString())
Trycmd.CommandText = "csp_validate_progress_notes_entry"cmd.CommandType = CommandType.StoredProcedurecmd.Connection = conn
cmd.Parameters.Add(
"@ClientID", SqlDbType.Int).Value = ClientIDcmd.Connection.Open()
passOrFail = cmd.ExecuteScalar()

Return passOrFail
Catch ex As ExceptionRaiseEvent StatusMessageChanged(New StatusMessageEventArgs("Error Connecting to Database", StatusMessageEventArgs.StatusMessageType.ErrorMsg))
Return passOrFail
FinallyIf Not conn Is Nothing Thenconn.Close()End IfEnd TryEnd Function

Friday, September 28, 2012

10. Ctrl+Alt+plus sign (+)—Dealing with capturing screen images from a Remote Desktop session can be a mystery. If you press Print Screen, you get an image of your local desktop—not the remote desktop. Pressing the Ctrl+Alt+plus sign (+) keyboard shortcut captures a snapshot of the entire client window area of Remote Desktop and is the same as pressing Print Screen on your local desktop.
9. Ctrl+Alt+minus sign (-)—Sometimes you don't want an image of the entire desktop; sometimes you want just a selected window. Pressing the Ctrl+Alt+minus sign (-) keyboard shortcut captures a snapshot of just the active window within the remote desktop session. This key combination is the same as pressing Alt+Print Screen on your local desktop.
8. Alt+Home—Pressing the Alt+Home keyboard combination with Remote Desktop displays the Start menu on the remote system. The Start menu gives you quick access to the different programs installed on the remote system. This key combination is the same as pressing the Windows key on your local desktop.
7. Alt+Delete—Pressing the Alt+Delete keyboard combination in the Remote Desktop session opens the Windows menu of an application running on the remote system. The Windows menu is typically displayed under the icon in the extreme upper left corner of most Windows applications, and it lets you move and resize the application.
6. Ctrl+Alt+Break—Sometimes you might want the Remote Desktop window to be displayed in full-screen mode just as if you were using your local desktop. If you want to toggle the Remote Desktop session between a window and a full-screen display, you can press the Ctrl+Alt+Break keyboard combination.
5. Ctrl+Alt+Pause—Like the previous item, the Ctrl+Alt+Pause keyboard combination switches between full screen and windowed mode. However, with this keyboard shortcut, the remote desktop window remains at its standard size and doesn't fill the entire local desktop. Instead, it's displayed on a black background.
4. Alt+Insert—Sometimes you want a quick way to switch between the different programs that you have running. Pressing the Alt+Insert keyboard combination lets you cycle through the programs on the remote system in the order that they were opened. This process is the same as using Alt+Tab on your local desktop.
3. Alt+Page Down—Another way to cycle through the running programs on your Remote Desktop session is to use the Alt+Page Down keyboard shortcut. Pressing this key combination lets you switch between programs on the remote desktop session, moving from right to left in the Windows task switcher. This is the same as Alt+Shift+Tab on your standard desktop.
2. Alt+Page Up—Pressing Alt+Page Up lets you switch between programs on the Remote Desktop session, moving from left to right in the Windows task switcher. This is the same as Alt+Tab on your standard desktop.
1. Ctrl+Alt+End—One of the most common yet hard-to-find things that you'll need to do in a Remote Desktop session is to send a Ctrl+Alt+Del signal to the remote system. Press Ctrl+Alt+End if you need to send a Ctrl+Alt+Del keystroke combination to the remote system. This keystroke opens the Microsoft Windows Security dialog box, which lets you lock the computer, log off, change your password, and start Task Manager.

Monday, June 18, 2012

SharePoint 2010 User Profile Synchronization

Know the difference between FQDN and NETBIOS, before configuring SharePoint 2010 User Profile application be sure to know which one you need to use before setting up the Profile Application, because once setup you will have to delete the current application and perform a brand new full import.

http://blogs.msdn.com/b/russmax/archive/2010/03/20/sharepoint-2010-provisioning-user-profile-synchronization.aspx

Wednesday, September 14, 2011

SharePoint 2010 Day at Microsoft Campus in Charlotte

Getting questions answered and great overview of SharePoint 2010 for the current MOSS 2007 to SharePoint 2010 project I am currently working on in my current contract.

Friday, September 02, 2011

SharePoint 2007 & 2010 Index and Search sizes

If you need to review sizing of current implementation of SharePoint Index and Search
Go to > Central admin > Operations > Services on Server > Office SharePoint Server Search Service Settings
Copy the Default index file location : Run paste
Select and review properties that will provide the size of index
Next for Search simply navigate on SQL Server and right click on Search DB and review properties.
 

Wednesday, August 31, 2011

MOSS 2007 on Windows Server 2008 R2

I ran into a solution for getting Central Admin to display on Windows Server 2008 R2 today.   Basically you have to open IIS 7.0 and ensure that the Physical Path is correct.  For some reason the install had an incorrect physical path.   I fixed it and everything worked.

Next was installing MOSS 2007 SP2 slip stream on the rest of the farm.   Ensure you open the port that Central Admin is installed on or you will not be able to access.   LESSONS LEARNED FROM MOOJJOO

Saturday, March 26, 2011

Setup new URL

dotnet.mmwebs.com going to see if I can access blogger from work.

Friday, November 19, 2010

Add JavaScript to handle two scripts in ASP.NET

protected void ApplyJavaScriptForPostToIris()


{

System.Text.StringBuilder sbValid = new System.Text.StringBuilder();

sbValid.Append("if (confirm('Are you sure you want to post this file to app') == true){");

sbValid.Append("this.disabled = true;");



sbValid.Append("} else { return false;}");

sbValid.Append(this.ClientScript.GetPostBackEventReference(this.btnPostToIRIS, "") + ";");



this.btnPostToIRIS.Attributes.Add("onclick", sbValid.ToString());

}

Tuesday, November 09, 2010

Looping through SQL Server ... This has to be saved. To many hours spent.

I know I will have to do this again....

This article describes various methods that you can use to simulate a cursor-like FETCH-NEXT logic in a stored procedure, trigger, or Transact-SQL batch.


Use Transact-SQL Statements to Iterate Through a Result Set

There are three methods you can use to iterate through a result set by using Transact-SQL statements.



One method is the use of temp tables. With this method, you create a "snapshot" of the initial SELECT statement and use it as a basis for "cursoring." For example:

/********** example 1 **********/



declare @au_id char( 11 )



set rowcount 0

select * into #mytemp from authors



set rowcount 1



select @au_id = au_id from #mytemp



while @@rowcount <> 0

begin

set rowcount 0

select * from #mytemp where au_id = @au_id

delete #mytemp where au_id = @au_id



set rowcount 1

select @au_id = au_id from #mytemp

end

set rowcount 0







A second method is to use the min function to "walk" a table one row at a time. This method catches new rows that were added after the stored procedure begins execution, provided that the new row has a unique identifier greater than the current row that is being processed in the query. For example:

/********** example 2 **********/



declare @au_id char( 11 )



select @au_id = min( au_id ) from authors



while @au_id is not null

begin

select * from authors where au_id = @au_id

select @au_id = min( au_id ) from authors where au_id > @au_id

end





NOTE: Both example 1 and 2 assume that a unique identifier exists for each row in the source table. In some cases, no unique identifier may exist. If that is the case, you can modify the temp table method to use a newly created key column. For example:

/********** example 3 **********/



set rowcount 0

select NULL mykey, * into #mytemp from authors



set rowcount 1

update #mytemp set mykey = 1



while @@rowcount > 0

begin

set rowcount 0

select * from #mytemp where mykey = 1

delete #mytemp where mykey = 1

set rowcount 1

update #mytemp set mykey = 1

end

set rowcount 0











-- ================================================


-- Template generated from Template Explorer using:

-- Create Procedure (New Menu).SQL

--

-- Use the Specify Values for Template Parameters

-- command (Ctrl-Shift-M) to fill in the parameter

-- values below.

--

-- This block of comments will not be included in

-- the definition of the procedure.

-- ================================================

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author: Robert Dannelly

-- Create date: 11/09/2010

-- Description: Resubmission Validation

-- =============================================

CREATE PROCEDURE ResubmissionValidation

-- Add the parameters for the stored procedure here

@ImportID int

AS

BEGIN

-- SET NOCOUNT ON added to prevent extra result sets from

-- interfering with SELECT statements.

SET NOCOUNT ON;



-- Insert statements for procedure here

DECLARE @ResubmissionTest TABLE

(

[ImportMetricID] [int] NULL,

[ImportID] [int] NULL,

[MetricInstanceID] [int] NULL,

[MetricValue] [varchar](100) NULL,

[NDTR] [varchar](20) NULL,

[MetricValueDate] [datetime] NULL,

[Narrative] [varchar](300) NULL,

[Resubmission] [varchar](50) NULL,

[ImportMetricStatus] [varchar](50) NULL,

[ImportFailureMsg] [varchar](200) NULL,

[CurrentMetricValue] [varchar](50) NULL

)



INSERT INTO @ResubmissionTest (ImportMetricID, ImportID, MetricInstanceID, MetricValue, NDTR, MetricValueDate, Narrative,

Resubmission, ImportMetricStatus, ImportFailureMsg, CurrentMetricValue)

SELECT ImportMetricID, ImportID, MetricInstanceID, MetricValue, NDTR, MetricValueDate, Narrative,

Resubmission, ImportMetricStatus, ImportFailureMsg, CurrentMetricValue FROM tblImportMetric WHERE ImportID = @ImportID --Need to change to Variable



-- This is used for Testing RBD

--SELECT * FROM @ResubmissionTest





DECLARE @ImportMetric_ID char(11), @Resubmission varchar(10)



SELECT @ImportMetric_ID = min(ImportMetricID) FROM @ResubmissionTest





--Begin LOOP

WHILE @ImportMetric_ID is not null

BEGIN

DECLARE @MetricInstanceID int,

@MetricValueDate DateTime



SELECT @MetricInstanceID MetricInstanceID FROM @ResubmissionTest WHERE ImportMetricID = @ImportMetric_ID



SELECT @MetricValueDate MetricValueDate FROM @ResubmissionTest WHERE ImportMetricID = @ImportMetric_ID

-- Be sure to change the values to @MetricInstanceID AND @MetricValueDate

EXECUTE ImportCheckResubmission @MetricInstanceID, @MetricValueDate, @Resubmission OUTPUT



IF @Resubmission = 'Yes'

BEGIN

UPDATE @ResubmissionTest

SET ImportFailureMsg = 'There is an existing value for this metric and interval. Please indicate if it is a resubmission.'

WHERE ImportMetricID = @ImportMetric_ID





SELECT @ImportMetric_ID = min(ImportMetricID) FROM @ResubmissionTest WHERE ImportMetricID > @ImportMetric_ID

END

END



DELETE FROM tblImportMetric WHERE ImportID = @ImportID



INSERT INTO tblImportMetric (ImportID, MetricInstanceID, MetricValue, NDTR, MetricValueDate, Narrative,

Resubmission, ImportMetricStatus, ImportFailureMsg, CurrentMetricValue)

SELECT ImportID, MetricInstanceID, MetricValue, NDTR, MetricValueDate, Narrative,

Resubmission, ImportMetricStatus, ImportFailureMsg, CurrentMetricValue FROM @ResubmissionTest WHERE ImportID = @ImportID --Need to change to Variable





--This is used for Testing

--SELECT * FROM tblImportMetric

END

GO

Thursday, November 04, 2010

Demystify SQL Debugging with with Visual Studio

Here is what I did to fix this issue "FINALLY"

http://www.asp.net/data-access/tutorials/debugging-stored-procedures-vb
#1 Connect using Windows Authentication as the same account on the local machine that must have sysadmin rights in the Instance of SQL Server.
#2 They use Server Explorer and connect with that same account and then once connect right click on the DB and check "Application Debuggin. I am posting this to my blog.
Great posts. By the way I feel the pain of remote individuals, my answer tell you management that if you want fast, rapid code to fork up the dough for SQL Developer Edition and do all you coding locally with a quality source control.



Robert.

Tuesday, October 19, 2010

Add Using for Controls or lookup very useful

In VS 2008, when the caret is on the name of the class which doesnt have a using statement in the file, SHIFT+ALT+F10 will bring up a context menu to add the using statement.

Reboot Remotely

When you work in distributed environment you probably use remote desktop session as you primary method of sql server machines administration. When critical windows updates are installed or when you install system or sql server service pack installation wizard promts you to restart the box in order to complete the installation. And it happens from time to time that this  machine hangs on reboot process for some reason and you can no longer connect it via remote desktop. If it was you local computer you could enter into your server room and press the reset button but if it stand thousands miles away from you it becomes a real problem.
How to restart or shutdown remote machine
If you can ping this machine from other computer and you have administrators rights on that machine you may use windows utility.
On a computer that has connection to the server which needs to be restarted or shutdown go to Start -> Run and type shutdown -i

This window will show up. Press Add and type either IP or DNS of remote server.
Select shutdown or restart and press OK. That 's it. For your convenience you may run from command line constanct ping  (ping servername -t) when the server actually stopped to respond to pings and when it started again.
Alternatively you can go to command prompt (start -> run -> cmd) on your workstation and Typeshutdown -r -m \\x.x.x.x
Replace x.x.x.x with the IP address or computer name of the remote machine. -r option is for restart, don't use -r if want to just shut down the system.  

Thursday, August 05, 2010

SharePoint Site Collection Administration

Lesson learned. If you are ever asked to maintain a SharePoint site the first thing to do is say, "Grant me Site Collection Admin Rights". Why? Because if you are testing security and you do not know who the Site Collection Admin are then if you remove security the individuals in that role will still have access. (Nice 2 hour lesson learned)

Thursday, June 17, 2010

AJAX Install

If you develop ASP.NET applications with AJAX here is a step by step guide so you do not bang your head.

1) Download the latest version from CodePlex for AJAX.
2) Extract to a location of your choice
3) Add the AjaxControlToolkit.dll & AjaxControlToolkit.pdb to you Web layer project /bin folder
4) Create a new Tab in your Toolbox and point to the new AjaxControlToolkit.dll
5) Create a reference to your AjaxControlToolkit.dll
6) Finally ensure the line in your Web.config is that same version as your dll assembly - (Simply right click the dll and look at the properties for assembly info.

Friday, April 16, 2010

Visual Studio 2010

Microsoft has released Microsoft Visual Studio 2010. I think it is time for me to upgrade to Windows 7 and start using there new tool set in order to keep up with the times.

SharePoint and SQL Sever Reporting Integration

Well, I must tell you that I had to reach out to Microsoft yesterday and use 1 of my support calls with my MSDN Subscriptions. I have been tasked with integrated SQL Server Reporting Services with MOSS 2007.

This will be the first implmentation at my company and I very excited to have a fantastic presentation for my upper managment.

A lot of work has been put into this and I plan to sell this great feature.

Thursday, April 01, 2010

New Trick Envrionment Variables

public static string SecurePath = Environment.GetEnvironmentVariable("SECURED_APP_PATH");

You can right click on your computer > Advanced Tab > set the variables. Warning they will not take effect till a reboot.

This would not worth using for a hosted appllication when you do not have access to the server.

Monday, March 08, 2010

Time to build the app

I am ready to build the app for retirement. 1 to 2 hours a day.

Define - 20 more hours
- Design DB (Completed)
- Design Workflow (Completed)
- Design UI(s) All screens (Completed)
- Design Objects (Completed)
Measure - 10 hours (2-6 Months, but will be done before I am 40 :-) )
Analyze - 40 hours (Done)
Improve (Build) - (In Process)
- Database Development (8 Hours Completed)
- Application (Web to start in Progress 2-6 months
* Web UI
* Business Layer
* Data Layer (Completed)
* Test Test Test fix fix fix test test test
* Demo to friends and family (Huge Milestone - break out Beer and Wine)

Control - Will know after Improve Phase)

Friday, February 19, 2010

Trace.axd

One thing I am going to remember is Trace with ASP.NET... It is so powerfull to watch Application, Session and ViewState.

<trace enabled="true" requestLimit="40" localOnly="false" />

Very important when troubleshooting:

http://msdn.microsoft.com/en-us/library/y13fw6we%28VS.71%29.aspx

Thursday, February 04, 2010

Kill Task in XP

c:\>taskkill /pid 3252 /F

Force kill aspnetwp.exe....

Than stop the IIS and then delete temporary files.

Monday, January 11, 2010

Ctrl-Alt-Del on remote desktop aka server

In order to send Ctrl-Alt-Del keystrokes to remote computer connected via Remote Desktop client, just press the following workaround keyboard shortcuts specially used in Remote Desktop environment:

Ctrl+Alt+End