Posts

Showing posts from August, 2010

Transform .rotate Unity Code Example

Example 1: how to rotate object unity public Transform Position ; // make reference in inspector Position. Rotate ( x , y , z ) ; Example 2: transform.rotation transform.eulerAngles = new Vector3 ( 0 , 0 , 180 ) ; transform.localEulerAngles = new Vector3 ( 0 , 0 , 180 ) ; transform.eulerAngles = new Vector3 ( 0 , 0 , 180 ) ; transform.localRotation = Quaternion transform.rotation = Quaternion. Euler ( 0 , 0 , 90 ) ; Example 3: unity rotate object c# using UnityEngine ; // Transform.Rotate example // // This script creates two different cubes : one red which is rotated using Space.Self ; one green which is rotated using Space .World . // Add it onto any GameObject in a scene and hit play to see it run. The rotation is controlled using xAngle , yAngle and zAngle , modifiable on the inspector .public class ExampleScript : MonoBehaviour { public float xAngle , yAngle , zAngle ; private GameObject cube1 , cube2 ; void Awake ( ) { cube1 = GameObje

Alter Column Length With Liquibase

Answer : You can increase the size of your column like this: <changeSet author="liquibase" id="sample"> <modifyDataType columnName="description" newDataType="varchar(2000)" tableName="account"/> </changeSet> The schema defintion in your xml file doesn't allow <modifyDataType ... /> . The version of the xsd file should match the version of Liquibase you are using. The exception looks like you are using the xsd of version 1.9, see http://www.liquibase.org/documentation/xml_format.html

How To Hide Element In Css Code Example

Example 1: css hiddden .classname { visibility : hidden ; } Example 2: hide element using css #tinynav1 { display : none } Example 3: css hide element .classname { display : none ; } Example 4: hide in css display : none ;

Glowing Text Generator Code Example

Example: glowing text css text-shadow : 0 0 10 px #fff , 0 0 20 px #fff , 0 0 30 px ;

Convert Byte String To String In Python Code Example

Example 1: bytes to string python # utf-8 is used here because it is a very common encoding, but you # need to use the encoding your data is actually in. bytes = b'abcde' bytes.decode("utf-8") 'abcde' Example 2: bytearray to string python bytesliteral ::= bytesprefix(shortbytes | longbytes) bytesprefix ::= "b" | "B" | "br" | "Br" | "bR" | "BR" shortbytes ::= "'" shortbytesitem* "'" | '"' shortbytesitem* '"' longbytes ::= "'''" longbytesitem* "'''" | '"""' longbytesitem* '"""' shortbytesitem ::= shortbyteschar | bytesescapeseq longbytesitem ::= longbyteschar | bytesescapeseq shortbyteschar ::= longbyteschar ::= bytesescapeseq ::= "\"

Range Of Double In C C++ Code Example

Example 1: range of long long in c++ Long Data Type Size ( in bytes ) Range long int 4 - 2 , 147 , 483 , 648 to 2 , 147 , 483 , 647 unsigned long int 4 0 to 4 , 294 , 967 , 295 long long int 8 - ( 2 ^ 63 ) to ( 2 ^ 63 ) - 1 unsigned long long int 8 0 to 18 , 446 , 744 , 073 , 709 , 551 , 615 Example 2: data types in c++ int myNum = 5 ; // Integer (whole number) float myFloatNum = 5.99 ; // Floating point number double myDoubleNum = 9.98 ; // Floating point number char myLetter = 'D' ; // Character bool myBoolean = true ; // Boolean string myText = "Hello" ; // String

Converting Newtonsoft Code To System.Text.Json In .net Core 3. What's Equivalent Of JObject.Parse And JsonProperty

Answer : You are asking a few questions here: I am not able to find any equivalent for JObject.Parse(json); You can use JsonDocument to parse and examine any JSON, starting with its RootElement . The root element is of type JsonElement which represents any JSON value (primitive or not) and corresponds to Newtonsoft's JToken . But do take note of this documentation remark: This class utilizes resources from pooled memory to minimize the impact of the garbage collector (GC) in high-usage scenarios. Failure to properly dispose this object will result in the memory not being returned to the pool, which will increase GC impact across various parts of the framework. When you need to use a JsonElement outside the lifetime of its document, you must clone it: Gets a JsonElement that can be safely stored beyond the lifetime of the original JsonDocument . Also note that JsonDocument is currently read-only and does not provide an API for creating or modifying JSON. There is an o

Add Row Sql Code Example

Example 1: sql insert query --sql insert quest example INSERT INTO table_name ( column1 , column2 , column3 , ... ) VALUES ( value1 , value2 , value3 , ... ) ; Example 2: how to add records to sql table INSERT INTO Customer ( FirstName , LastName , City , Country , Phone ) VALUES ( 'Craig' , 'Smith' , 'New York' , 'USA' , 1 - 01 - 993 2800 ) Example 3: sql insert -- Note: This is specifically for SQL - Oracle -- --------------------------------------------------------------- -- OPTION 1: Insert specific values (other values will be null) -- syntax INSERT INTO < TABLE_NAME > ( < column1 > , < column2 > , < column3 > , ... ) VALUES ( < value1 > , < value2 > , < value3 > , ... ) ; -- example INSERT INTO SALES ( SALE_ID , ITEM_ID , QUANTITY , AMOUNT ) VALUES ( 631 , 13 , 4 , 59.99 ) ; -- --------------------------------------------------------------- -- OPTION 2: Insert

Css Text Limit Code Example

Example 1: css limit text length /*CSS to limit the text length inside a div*/ text-overflow : ellipsis ; overflow : hidden ; white-space : nowrap ; Example 2: text limit in css body { margin : 20 px ; } .text { overflow : hidden ; text-overflow : ellipsis ; display : -webkit-box ; -webkit-line-clamp : 2 ; /* number of lines to show */ -webkit-box-orient : vertical ; } Example 3: css text limit p { white-space : nowrap ; overflow : hidden ; text-overflow : ellipsis ; max-width : 200 px ; }

Oracle Substr Instr Code Example

Example 1: oracle substring -- ORACLE substr ( string , start , [ , length ] ) SELECT substr ( 'Hello World' , 4 , 5 ) FROM DUAL ; -- lo Wo SELECT substr ( 'Hello World' , 4 ) FROM DUAL ; -- lo World SELECT substr ( 'Hello World' , - 3 ) FROM DUAL ; -- rld Example 2: Subtr Oracle ? /*Using SUBSTR in Oracle (Example from hackerrank.com): */ /*Simple select query...*/ SELECT DISTINCT city FROM station /*Using WHERE and SUBSTR to find (distinct) cities in station table that begin as well as end with a vowel.*/ WHERE SUBSTR ( city , 1 , 1 ) IN ( 'A' , 'E' , 'I' , 'O' , 'U' ) AND substr ( city , - 1 ) IN ( 'a' , 'e' , 'i' , 'o' , 'u' ) ; /*Parameters for SUBSTR (Substring) in order are as follows: String, Start, Length.*/

C/C++ Why To Use Unsigned Char For Binary Data?

Answer : In C the unsigned char data type is the only data type that has all the following three properties simultaneously it has no padding bits, that it where all storage bits contribute to the value of the data no bitwise operation starting from a value of that type, when converted back into that type, can produce overflow, trap representations or undefined behavior it may alias other data types without violating the "aliasing rules", that is that access to the same data through a pointer that is typed differently will be guaranteed to see all modifications if these are the properties of a "binary" data type you are looking for, you definitively should use unsigned char . For the second property we need a type that is unsigned . For these all conversion are defined with modulo arihmetic, here modulo UCHAR_MAX+1 , 256 in most 99% of the architectures. All conversion of wider values to unsigned char thereby just corresponds to truncation to the leas

How To Create Header And Footer In Html And Css Code Example

Example: how to use header and footer in css how to make 2 frames in html

Button With Href Link Html Code Example

Example 1: href on a button < button onclick = "window.location.href='/page2'" > Continue < / button > Example 2: html button link < button > < a href = 'https://google.com' alt = 'Broken Link' > This is a button < / a > < / button > Example 3: html button with link < a href = "https://www.google.com" > < button > Go to Google < / button > < / a > Example 4: button href a . button { - webkit - appearance : button ; - moz - appearance : button ; appearance : button ; text - decoration : none ; color : initial ; }

Twitch.tvtw Code Example

Example: twitch.tv STOP PROCASTINATING , GO BACK TO WORK

Convert Io.StringIO To Io.BytesIO

Answer : It's interesting that though the question might seem reasonable, it's not that easy to figure out a practical reason why I would need to convert a StringIO into a BytesIO . Both are basically buffers and you usually need only one of them to make some additional manipulations either with the bytes or with the text. I may be wrong, but I think your question is actually how to use a BytesIO instance when some code to which you want to pass it expects a text file. In which case, it is a common question and the solution is codecs module. The two usual cases of using it are the following: Compose a File Object to Read In [16]: import codecs, io In [17]: bio = io.BytesIO(b'qwe\nasd\n') In [18]: StreamReader = codecs.getreader('utf-8') # here you pass the encoding In [19]: wrapper_file = StreamReader(bio) In [20]: print(repr(wrapper_file.readline())) 'qwe\n' In [21]: print(repr(wrapper_file.read())) 'asd\n' In [26]: bio.seek(0) Out[26]: 0

Html Css Scrollbar Style Code Example

Example 1: custom scrollbar body ::-webkit-scrollbar { width : 12 px ; /* width of the entire scrollbar */ } body ::-webkit-scrollbar-track { background : orange ; /* color of the tracking area */ } body ::-webkit-scrollbar-thumb { background-color : blue ; /* color of the scroll thumb */ border-radius : 20 px ; /* roundness of the scroll thumb */ border : 3 px solid orange ; /* creates padding around scroll thumb */ } Example 2: customize scrollbar css // scroll bar /* width */ ::-webkit-scrollbar { background-color : hsl ( 235 , 24 % , 19 % ) ; width : 8 px ; } /* Track */ ::-webkit-scrollbar-track { background-color : hsla ( 235 , 21 % , 11 % , 0.322 ) ; box-shadow : 0 0 3 px hsl ( 235 , 21 % , 11 % ) ; border-radius : 10 px ; } /* Handle */ ::-webkit-scrollbar-thumb { background-color : hsl ( 235 , 21 % , 11 % ) ; border-radius : 10 px ; } /* Handle on hover */ ::-webkit-scrollbar-thumb :h

Can I Safely Use A PSU With An ATX 12v 4-pin For A Board That Has A EPS 12v 8-pin?

Image
Answer : Information: Page 16 of the manual to the motherboard says that the 8-pin connector is for supplying power to the CPU. Method 1: If you look at the pinout of the 8-pin socket and the 4-pin cable (figures 1 and 2 below respectively), you will notice that physically, it should be compatible. I found a page (figure 3) that indicates that it can be done, but strongly advises using a proper 8-pin cable. This makes sense because the connector is generally for providing the CPU with extra power (as opposed to any power), so while it may work, the system may suddenly shut down if CPU usage goes up to 100% (eg while doing a virus-scan, watching YouTube videos, etc.) Method 2: Another option I have found is some discussions (like this one) about using an adapter (figure 4) to connect the 4-pin cable to both halves of the 8-pin connector. In fact, there are plenty such adapters on eBay for as little as $1 (and free shipping). Newegg also has a couple. Of course the probl

Download Mp3 Youtube Online Code Example

Example 1: youtube mp3 converter You can use WebTools , it's an addon that gather the most useful and basic tools such as a synonym dictionary , a dictionary , a translator , a youtube convertor , a speedtest and many others ( there are ten of them ) . You can access them in two clics , without having to open a new tab and without having to search for them ! - Chrome Link : https : //chrome.google.com/webstore/detail/webtools/ejnboneedfadhjddmbckhflmpnlcomge/ Firefox link : https : //addons.mozilla.org/fr/firefox/addon/webtools/ Example 2: youtube download mp3 I use https : //github.com/ytdl-org/youtube-dl/ as a Python CLI tool to download videos

Add Blank Line In Latex Code Example

Example: latex add empty line \hfill \break

Converting FLAC To MP3 Using FFMPEG?

Answer : You say you are using Windows command shell, but the first command line you showed (the one that starts "for file in") doesn't look like Windows, more like some kind of Linux shell command. The second one won't work because ffmpeg won't accept a wildcard as an input file spec. This one line Windows command does what you seem to want, to make ffmpeg (using your options above) take as its input, in turn, each flac file in the current folder and output, in the same folder, an mp3 file with the same name before the extension: At prompt: for %A in (*.flac) do ffmpeg -i "%~nA.flac" -c:v copy -b:a 320k "%~nA.mp3" If the mp3 file already exists, ffmpeg will ask if you want to overwrite it. Note: the above command is crafted for the command prompt. It won't work in a batch script. For that, you need to double all the percent signs (%) like this In batch (cmd) script: for %%A in (*.flac) do ffmpeg -i "%%~nA.flac" -c:v copy