coding-style

How do you comment your db schema objects in SQL Azure database project?

﹥>﹥吖頭↗ 提交于 2019-12-11 08:17:48
问题 As far as I understand sp_addextendedproperty is not available in SQL Azure databases as of now. So.. How do you comment your tables, columns, sprocs and other objects in your database project? 回答1: Here is an example of a database table declaration with comments: 回答2: For anyone encountering this now, as at April 2018, sp_addextendedproperty is (now) available and works (at least for attaching descriptions to columns!) 来源: https://stackoverflow.com/questions/12458292/how-do-you-comment-your

format dojo DataGrid header row

☆樱花仙子☆ 提交于 2019-12-11 07:59:37
问题 I want to assign a background color to my programmatically created Dojo DataGrid's header row. I've tried to override the defaults by adding .dojoxGridHeader or .dojoxGrid-Header to my style sheet, but these have no effect. Is there another way, such as with a Dojo event or property? If my style sheet is the only way to go, am I using the wrong class? Thanks! Alan 回答1: With the help of Internet Explorer's "Developer Tools," I discovered which CSS classes controlled the styling of the Dojo

Add text to multiple files via powershell

送分小仙女□ 提交于 2019-12-11 07:56:40
问题 I am trying to customise the code described here PowerShell add text line to multiple files to my case. I have multiple csv files with numbers only and on the first line I would like to have a specific phrase (e.g catchment rainfall file). I am doing the following: > $header=@" >"catchment rainfall >"@ >Get-ChildItem D:\Documents and Settings\mary\testing\mary00 -Recurse -Filter *.aspx | >Foreach-Object { > $header`n" + (Get-Content $_.FullName | Out-String) | Set-Content -Path $_.FullName" >

Looking for the best way to use ExecuteScalar()

♀尐吖头ヾ 提交于 2019-12-11 07:50:53
问题 This code works. It's based on some code I found on the internet. Can you tell me if the coding is the best way to get a scalar value and if there is a better way can you show coding samples? Dim objParentNameFound As Object TextBoxParentsName.Text = "" If TextBoxParentID.Text <> "" Then ' Display the parent's name using the parent ID. ' Dim strSqlStatement As String = "Select FatherName " & _ "From Parents " & _ "Where ID = @SearchValue" ' Set up the sql command and lookup the parent. '

Adding Alignment to a Manipulate Ouput in Mathematica

∥☆過路亽.° 提交于 2019-12-11 07:19:08
问题 Considering the following : Manipulate[ If[Intersection[Row1, Row2] == {}, Style[Plus @@ {Plus @@ Row1, Plus @@ Row2}, Bold, 20], "Error"], {{Row1, {1}}, {1, 2, 3, 4, 5}, ControlType -> TogglerBar}, {{Row2, {2}}, {1, 2, 3, 4, 5}, ControlType -> TogglerBar} ] - I would like the "3" to be centered, is it possible ? 回答1: Manipulate has its own Alignment option. You can see if that works for you: Manipulate[ If[Intersection[Row1,Row2]=={},Style[Plus@@{Plus@@Row1,Plus@@Row2},Bold,20],"Error"], {

closing connections within a using block

自作多情 提交于 2019-12-11 06:56:10
问题 On reading lots of code, I find that a given Connection object, which implements IDisposable , is is manually closed within a using statement. I see this when I see code related to MySQL. It's not needed to be explicitly closed. Why would the developer close it manually? using(cnn) { //code is here cnn.close(); } Is this a good/helpful measure? 回答1: Explicitly closing in a using block is duplication, misleading and redundant so for me, is a bad thing. 回答2: It depends on the connection. Many

jQuery.html() removes scripts and styles

﹥>﹥吖頭↗ 提交于 2019-12-11 06:33:16
问题 Is there a way to use jQuery.html() and not loose the scripts and styles? or any other non-jQuery way? I'm trying to output the full HTML of the page the user is on. Is this even possible? 回答1: jQuery.html() removes scripts and styles That isn't my experience (see below). In practice, you have to be aware that what you get back by querying the DOM for HTML strings is always going to be the interpreted HTML, not the original, and there will be quirks (for instance, on IE all the HTML tag names

Should I use «this.» keyword in OOP programing where it's possible to skip it? Any benifits of using it? [duplicate]

人盡茶涼 提交于 2019-12-11 05:48:39
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: When do you use the “this” keyword? In OOP sometimes we can write this.PropertyName = VALUE and sometimes we can skip this . and just write PropertyName = VALUE . So my question is, should we try always to use this. ? Does using / writing this have any effect on application performance or does it just make the code a little bit clearer? Thanks. 回答1: There shouldn't be any difference in performance. Its purely a

Include guard style, C++

丶灬走出姿态 提交于 2019-12-11 05:34:23
问题 I have a .h file which contains several class definitions. I'd like to use C++'s include guards in this file; however, I was wondering which way of using the include guards is considered proper/correct? One guard protecting everything #ifndef FOO_BAR #define FOO_BAR class Foo { }; class Bar { }; #endif or multiple separate guards. #ifndef FOO #define FOO class Foo { }; #endif #ifndef BAR #define BAR class Bar { }; #endif 回答1: They are include guards, preventing double inclusion of files . So

Long code blocks inside if statements or for loops

大憨熊 提交于 2019-12-11 05:17:41
问题 This is a cross language question on coding style. I have to work with a lot of code that has very long code blocks, sometimes hundreds of lines, inside if statements or for loops. The code is procedural. Code like the following if(condition){ //hundreds of lines of code }else if{ //hundreds of lines of code } else { //hundreds of lines of code } I have trouble navigating this code if I haven't seen it in a while because I constantly have to scroll back and forth to check which branch of the