Posts

Showing posts from February, 2009

Add Default Value Of Datetime Field In SQL Server To A Timestamp

Image
Answer : For modifying an existing column in an existing table: ALTER TABLE YourTable ADD CONSTRAINT DF_YourTable DEFAULT GETDATE() FOR YourColumn This can also be done through the SSMS GUI. Put your table in design view (Right click on table in object explorer-> Design ) Add a column to the table (or click on the column you want to update if it already exists) In Column Properties, enter (getdate()) in Default Value or Binding field as pictured below In that table in SQL Server, specify the default value of that column to be CURRENT_TIMESTAMP . The datatype of that column may be datetime or datetime2 . e.g. Create Table Student ( Name varchar(50), DateOfAddmission datetime default CURRENT_TIMESTAMP );

Css Fixed Top Menu Code Example

Example: fixed navigation menu * { margin: 0; padding: 0; box-sizing: border-box; } body { height: 1200px; font-size: 18px; font-family: sans-serif; color: #5D6063; } a:link, a:visited { color: #5D6063; text-decoration: none; } a:hover { text-decoration: underline; } .header { position: fixed; display: flex; justify-content: space-between; width: 100%; padding: 50px; background: #D6E9FE; }

Convert TimeSpan From Format "hh:mm:ss" To "hh:mm"

Answer : You need to convert your data to TimeSpan and then use format: "hh\:mm" string test ="08:00:00"; TimeSpan ts = TimeSpan.Parse(test); Console.Write(ts.ToString(@"hh\:mm")); In your case: var test = dataRow.Field<TimeSpan>("fstart").ToString(@"hh\:mm")); Remember to escape the colon : You may see: Custom TimeSpan Format Strings There is no need to convert from hh.mm.ss to hh.mm . TimeSpan is stored as a number of ticks (1 tick == 100 nanoseconds) and has no inherent format. What you have to do, is to convert the TimeSpan into a human readable string! This involves formatting. If you do not specify a format explicitly, a default format will be used. In this case hh.mm.ss . string formatted = timespan.ToString(@"hh\.mm"); Note: This overload of ToString exists since .NET 4.0. It does not support date and time placeholder separator symbols! Therefore you must include them as (escaped) string literals. The usu

CakePHP Log (namespace)

Classes summary Log Logs messages to configured Log adapters. One or more adapters can be configured using Cake Logs's methods. If you don't configure any adapters, and write to Log, the messages will be ignored. LogEngineRegistry Registry of loaded log engines Traits summary LogTrait A trait providing an object short-cut method to logging.

CSS Scale Animation Also Moves Image To Left?

Answer : It's not moving to the left. The left edge is moving, however, as is the right. Because your content is left-aligned, it appears to move left. Demo You could set the transform origin: .zoom { transition: 1s ease-in-out; transform-origin: left top; background: pink; } Demo Also consider simply using a less dramatic transform : transform: scale(1.1); As isherwood described, the error is due to the fact that .zoom is taking up the full width, not just the visible part. Another solution would be size .zoom so that it only takes up the amount of space that you want, in this case the width of the image. You can do this by giving it an explicit width. .zoom { transition:1s ease-in-out; width:200px; } However, since the element still transforms from the middle, it will still go outside of the viewport since it's so close. To remedy this, you could use transform-origin:left or provide enough room on either side so that the scaled version does not go o

Add Attribute Js Code Example

Example 1: javascript change attribute var element = document.getElementById("elemId"); element.setAttribute("attributeName", "value"); Example 2: setAttribute() element.setAttribute(name, value); element.setAttribute("style", "background-color: red;"); Example 3: set attribute javascript Element.setAttribute(name, value); Example 4: put new attribute on html tag using javascript // Here's what you do for the style attribute span.setAttribute("style", "width:110%;float:center;left-margin:-10px;top-margin:-10;"); Example 5: set property dom javascrpt document.getElementsByTagName("H1")[0].setAttribute("class", "democlass"); Example 6: js setattribute const link = document.querySelector('a'); console.log(link.getAttribute('href')); link.setAttribute('href', 'https://yandex.ru'); link.innerText = 'The Next Link'; const mssg = docum

Bulma Css With Select2 Jquery Plugin

Image
Answer : I made it work, maybe my example can help you. View <div class="field"> <label class="label">Hair</label> <div class="control"> <select2 class="is-medium" v-model="post.custom_data.hair" :options="{}"> @foreach (config('post.cat.hair') as $id => $value) <option value="{{ $id }}">{{ __($value) }}</option> @endforeach </select2> </div> </div> SASS .select2-wrapper { .select2-container { .select2-selection { transition: border-color $speed; font-family: $family-sans-serif; height: 2.285em; line-height: 1.5; font-size: 1rem; outline: none !important; display: inline-flex; align-items: center; width: 100%; border-color: $border;

Can I Get Free PS+ Games 'retroactively'?

Answer : Unfortunately, there is no way to retroactively redeem past PS Plus games. If you haven't redeemed those games when they were free, you'll have to either purchase them or wait until they're offered for free once more. To redeem a PS Plus game, simply "purchase" it while it is still free. You don't need to actually download the game. You cannot claim free games from past months. For instance, it's April now, meaning if I didn't visit the store and download Bloodborne through PS+ last month then I can't go back and do so now, even if my subscription is still active. However, if you already claimed a free game in the month it was offered, then wait a few months and remove it from your system, you can go back and re-download it for free as long as you're still subscribed to PS+

C Online Compiler Programiz Code Example

Example 1: online c compiler I Personally Like https : //www.programiz.com/c-programming/online-compiler/ Example 2: online c compiler You can try https : //www.onlinegdb.com/ this as well, works really well for me. You can also save code there . Example 3: c compilers // I Like https://www.programiz.com/c-programming/online-compiler/

Online Gradient Generator Png Code Example

Example: color gradient generator /* "element" bieng the target class item to style */ .element { background : rgb ( 2 , 0 , 36 ) !important ; background : linear-gradient ( 331 deg , rgba ( 2 , 0 , 36 , 1 ) 0 % , rgba ( 139 , 88 , 94 , 1 ) 0 % , rgba ( 53 , 101 , 125 , 1 ) 14 % , rgba ( 40 , 127 , 156 , 1 ) 29 % , rgba ( 0 , 212 , 255 , 1 ) 100 % ) !important ; padding-bottom : 4 % ; }

Align The Form To The Center In Bootstrap 4

Image
Answer : You need to use the various Bootstrap 4 centering methods... Use text-center for inline elements. Use justify-content-center for flexbox elements (ie; form-inline ) https://codeply.com/go/Am5LvvjTxC Also, to offset the column, the col-sm-* must be contained within a .row , and the .row must be in a container... <section id="cover"> <div id="cover-caption"> <div id="container" class="container"> <div class="row"> <div class="col-sm-10 offset-sm-1 text-center"> <h1 class="display-3">Welcome to Bootstrap 4</h1> <div class="info-form"> <form action="" class="form-inline justify-content-center"> <div class="form-group"> <label class=&qu

CA1062: ValidateArgumentsOfPublicMethods On Co-constructor Calls

Answer : Like this? public MyClass(SomeOtherClass source) : this(source, source == null ? null : source.Name) { } public MyClass(SomeOtherClass source, string name) { /* ... */ }

Conditional Formatting In Google Sheets: Can I Use Custom Function In The 'custom Formula Is:' Field?

Answer : Short answer A custom function can't be used as a part of a custom formula in the Google Sheets' conditional formatting built-in user interface. Explanation In Google Sheets, a custom function is like spreadsheet built-in functions but written by the user using the Google Apps Script editor. They can't modify other objects, only return one or multiple values. By the other hand, a custom function only is calculated when it's added to a cell or when at least one of it's parameters changes. They can't use non-deterministic functions as parameters like NOW(), TODAY(), RAND() and RANDBETWEEN(). Test In order to test the statement in the short answer, I created a did the following: Create a simple custom function function two() { return 2; } Add the custom function as part of a custom formula in the conditional formatting side panel =two()=2 Result: Nothing changed. References Custom Functions in Google Sheets I have also found that custom functions c

Adb Server Is Out Of Date. Killing... Cannot Bind 'tcp:5037' ADB Server Didn't ACK * Failed To Start Daemon * In Ubuntu 14.04 LTS

Answer : You need to set the path of your SDK's adb into Genymotion. By default, Genymotion uses its own ADB tool (for many reasons). If the both binaries are not compatible (if your Android SDK platform tools or Genymotion has not been updated for a while) this problem happens. To solve it you can define a specific one from the Android SDK. To specify a custom ADB tool: Open Genymotion > Settings > ADB. Check Use custom Android SDK tools. Specify the path to the Android SDK by clicking Browse. Click OK. update the adb to 1.0.32 if you have 1.0.31 or lower adb version Android Debug Bridge version 1.0.31 wget -O - https://skia.googlesource.com/skia/+archive/cd048d18e0b81338c1a04b9749a00444597df394/platform_tools/android/bin/linux.tar.gz | tar -zxvf - adb sudo mv adb /usr/bin/adb sudo chmod +x /usr/bin/adb adb version Android Debug Bridge version 1.0.32 for me the problem was that I am trying to use 2 adb processes sudo apt-get remove adb android-tools-adb and

Add Tex To Appendix Code Example

Example: appendices latex \documentclass{article} \usepackage[title]{appendix} \begin{document} \section{title 1} \section{title 2} \begin{appendices} \section{Some Notation} \section{Some More Notation} \end{appendices} \end{document}

Div On Top Of Another Div Without Absolute Positioning Code Example

Example: view div over other divs <!DOCTYPE html > <html lang="en" > <head > <meta charset="utf-8" > <title > CSS Overlaying One DIV over Another DIV</title > <style > .container { width : 200 px ; height : 200 px ; position : relative ; margin : 20 px ; } .box { width : 100 % ; height : 100 % ; position : absolute ; top : 0 ; left : 0 ; opacity : 0.8 ; /* for demo purpose */ } .stack-top { z-index : 9 ; margin : 20 px ; /* for demo purpose */ } </style> </head> <body> <div class= "container" > <div class= "box" style= "background: red;" ></div> <div class= "box stack-top" style= "background: blue;" ></div> </div> </body> </html>

How To Call A Function In Another Script Unity Code Example

Example 1: how to reference function in unity public GameObject myObject ; //make ref. in inspector window myObject . GetComponent < MyScript > ( ) . MyFunction ( ) ; Example 2: unity call function from another script public otherScript other ; void Update ( ) { other . funtion ( ) ; }

Align Bootstrap Toggle Menu Right Code Example

Example: how do i get the toggle menu on the right bootstrap < button type = " button " class = " navbar-toggler ml-auto hidden-sm-up float-xs-right " data-toggle = " collapse " data-target = " #navbarResponsive " aria-expanded = " false " aria-label = " Toggle navigation " > </ button >

C++ - Split String By Regex

Answer : #include <regex> std::regex rgx("\\s+"); std::sregex_token_iterator iter(string_to_split.begin(), string_to_split.end(), rgx, -1); std::sregex_token_iterator end; for ( ; iter != end; ++iter) std::cout << *iter << '\n'; The -1 is the key here: when the iterator is constructed the iterator points at the text that precedes the match and after each increment the iterator points at the text that followed the previous match. If you don't have C++11, the same thing should work with TR1 or (possibly with slight modification) with Boost. To expand on the answer by @Pete Becker I provide an example of resplit function that can be used to split text using regexp: #include <regex> std::vector<std::string> resplit(const std::string & s, std::string rgx_str = "\\s+") { std::vector<std::string> elems; std::regex rgx (rgx_str); std::sregex_token_iterator iter(s.begin(