Posts

Showing posts from April, 2015

Converting A VMDK To VHD

Answer : The Microsoft Virtual Machine Converter (MVMC) includes the Microsoft Virtual Disk Converter tool (MVDC.exe) that converts a VMDK file to a VHD file. http://www.microsoft.com/en-ca/download/details.aspx?id=42497 MVDC SrcDisk DstDisk [/?] [/Dyn] SrcDisk Specifies the source VMDK disk path to be converted. DstDisk Specifies the path for the converted disk. [/?] Show Help [/Dyn] Indicates the destination disk should be dynamic rather than fixed. For example: C:\Program Files (x86)\Microsoft Virtual Machine Converter Solution Accelerator>mvdc "D:\VM\Windows Server 2008 R2 x64\Windows Server 2008 R2 x64.vmdk" "D:\VM\Windows Server 2008 R2 x64\Windows Server 2008 R2 x64.vhd" Step 1 of 3: Loading Source Disk... Step 1 of 3: Loading Source Disk Completed. Source file found of size 40.0 GB. DiskGeometry: Cylinders: 5221 Tracks/Cylinder: 255 Sectors/Track: 63 Bytes/Sector: 512 MediaType: FixedMedia Step 2 of 3: Cr

Css Transform Animation Code Example

Example 1: css transition opacity /* Answer to: "css transition opacity" */ /* CSS transitions allows you to change property values smoothly, over a given duration. */ .myClass { vertical-align: top; transition: opacity 0.3s; /* Transition should take 0.3s */ -webkit-transition: opacity 0.3s; /* Transition should take 0.3s */ opacity: 1; /* Set opacity to 1 */ } .myClass:hover { opacity: 0.5; /* On hover, set opacity to 2 */ } /* From `opacity: 1;` to `opacity: 0.5;`, the transition time should take 0.3 seconds as soon as the client starts to hover over the element. */ Example 2: transition transform /* Transition Transform */ .section:hover { transform: translateX(0px) translateY(75px); } .section { transition: transform 500ms ease-in-out 25ms; } Example 3: css transform transform: matrix(1, 2, 3, 4, 5, 6); transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: translate(120px, 50%); transform: scale(2, 0.5); transform: rot

Bulma Icon Not Showing Up?

Answer : You also need to include the bulma.min.css file, not just the .map . Edit Per the Bulma docs: If you want to use icons with Bulma, don't forget to include Font Awesome: <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> Update 3/19/2019 As @Akshay has pointed out below, the documentation has changed and the proper way to include Font Awesome is now <script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>

Latex \footnotesize Code Example

Example 1: latex font sizes \Huge \huge \LARGE \Large \large \ normalsize ( default ) \small \footnotesize \scriptsize \tiny Example 2: latex font sizes Change global font size : \documentclass [ 12 pt ] { report }

Compiled Vs. Interpreted Languages

Answer : A compiled language is one where the program, once compiled, is expressed in the instructions of the target machine. For example, an addition "+" operation in your source code could be translated directly to the "ADD" instruction in machine code. An interpreted language is one where the instructions are not directly executed by the target machine, but instead read and executed by some other program (which normally is written in the language of the native machine). For example, the same "+" operation would be recognised by the interpreter at run time, which would then call its own "add(a,b)" function with the appropriate arguments, which would then execute the machine code "ADD" instruction. You can do anything that you can do in an interpreted language in a compiled language and vice-versa - they are both Turing complete. Both however have advantages and disadvantages for implementation and use. I'm going to completely

Mattoolbarmodule Angular 10 Code Example

Example: mat-toolbar <mat-toolbar-row> <span>Second Line</span> <span class= "example-spacer" ></span> <mat-icon class= "example-icon" aria-hidden= "false" aria-label= "Example user verified icon" >verified_user</mat-icon> </mat-toolbar-row>

C++ Sizeof Char Array Code Example

Example: how to find the size of a character array in c++ Instead of sizeof ( ) for finding the length of strings or character arrays , just use strlen ( string_name ) with the header file # include <cstring> it's easier .

Converting String To Cstring In C++

Answer : .c_str() returns a const char* . If you need a mutable version, you will need to produce a copy yourself. vector<char> toVector( const std::string& s ) { string s = "apple"; vector<char> v(s.size()+1); memcpy( &v.front(), s.c_str(), s.size() + 1 ); return v; } vector<char> v = toVector(std::string("apple")); // what you were looking for (mutable) char* c = v.data(); .c_str() works for immutable. The vector will manage the memory for you.

Adding A Linestring By St_read In Shiny/Leaflet

Answer : Your test data is a dead link now, but I had a similar issue trying to plot sf linestrings and polygons in leaflet . The full error was Error in if (length(nms) != n || any(nms == "")) stop("'options' must be a fully named list, or have no names (NULL)") : missing value where TRUE/FALSE needed I was able to successfully plot my geometries by dropping the Z dimension from the line and polygon with st_zm . Here is an example: library(sf) library(leaflet) # create sf linestring with XYZM dimensions badLine <- st_sfc(st_linestring(matrix(1:32, 8)), st_linestring(matrix(1:8, 2))) # check metadata for badLine > head(badLine) Geometry set for 2 features geometry type: LINESTRING dimension: XYZM bbox: xmin: 1 ymin: 3 xmax: 8 ymax: 16 epsg (SRID): NA proj4string: NA LINESTRING ZM (1 9 17 25, 2 10 18 26, 3 11 19 2... LINESTRING ZM (1 3 5 7, 2 4 6 8) # attempt map; will fail > leaflet(

A Windows Equivalent Of The Unix Tail Command

Answer : If you use PowerShell then this works: Get-Content filenamehere -Wait -Tail 30 Posting Stefan's comment from below, so people don't miss it PowerShell 3 introduces a -Tail parameter to include only the last x lines I'd suggest installing something like GNU Utilities for Win32. It has most favourites, including tail. I've always used Baretail for tailing in Windows. It's free and pretty nice. Edit: for a better description of Baretail see this question

Char Count Online Code Example

Example 1: count letters numbers and characters public static String countLetter ( String str ) { String abc = str ; int a = 0 , b = 0 ; while ( str . length ( ) > 0 ) { int i = 0 ; String ch = str . substring ( i , i + 1 ) ; if ( ch . matches ( ".*[a-zA-Z].*" ) ) { a ++ ; } else if ( ch . matches ( ".*[0-9].*" ) ) { b ++ ; } str = str . substring ( i + 1 ) ; } return abc + " has " + a + " letters " + b + " digit and "+(abc.length()-(a+b))+" other characters " ; OR ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + static void findSum ( String str ) { int total = str . length ( ) ; str = str . replaceAll ( "\\s" , "" ) ; int num = 0 ; int letter = 0 ; int i = 0 ; while ( i < str . length ( ) ) { char ch = str . charAt ( i )

Get File Size Of File In Windows C Code Example

Example 1: how to check the size of a file c If you have the file stream ( FILE * f ) : fseek ( f , 0 , SEEK_END ) ; // seek to end of file size = ftell ( f ) ; // get current file pointer fseek ( f , 0 , SEEK_SET ) ; // seek back to beginning of file // proceed with allocating memory and reading the file Or , # include <sys/types.h> # include <sys/stat.h> # include <unistd.h> fd = fileno ( f ) ; struct stat buf ; fstat ( fd , & buf ) ; int size = buf . st_size ; Or , use stat , if you know the filename : # include <sys/stat.h> struct stat st ; stat ( filename , & st ) ; size = st . st_size ; Example 2: size of file in c // C program to find the size of file # include <stdio.h> long int findSize ( char file_name [ ] ) { // opening the file in read mode FILE * fp = fopen ( file_name , "r" ) ; // checking if the file exist or not if ( fp == NULL ) { p

Create Cylinder Shape In Pure Css 3d

Answer : there are some advanced examples like these: http://x.dtott.com/3d/ http://cssdeck.com/labs/pure-css-3d-primitives and some useful CSS shapes like these: http://css-tricks.com/examples/ShapesOfCSS/ personally I built this simple one HTML <div class="tank"> <div class="bottom"></div> <div class="middle"></div> <div class="top"></div> </div> and CSS .tank{ position:relative; margin:50px; } .tank .middle{ width:120px; height:180px; background-color:#444; position:absolute; } .tank .top{ width: 120px; height: 50px; background-color:#666; -moz-border-radius: 60px / 25px; -webkit-border-radius: 60px / 25px; border-radius: 60px / 25px; position:absolute; top:-25px; } .tank .bottom{ width: 120px; height: 50px; background-color:#444; -moz-border-radius: 60px / 25px; -webkit-border-radius: 60px / 25px; bo

A Motor Boat Whose Speed In Still Water Is 15 Km H Goes 30 Km Downstream And Comes Back In A Total 4 Hrs 30 Mins. Determine The Speed Of The Stream. Code Example

Example: A boat covers a certain distance downstream in 1 hour, while it comes back in 1 hour 40 min. If the speed of the stream be 5 kmph, what is the speed of the boat in still water? A boat covers a certain distance downstream in 1 hour, while it comes back in 1 hour 40 min. If the speed of the stream be 5 kmph, what is the speed of the boat in still water?

Odd Child Css Code Example

Example 1: css odd even child tr :nth-child ( even ) { background : #CCC } tr :nth-child ( odd ) { background : #FFF } Example 2: nth-child() css /* Selects the second <li> element in a list */ li :nth-child ( 2 ) { color : lime ; } /* Selects every fourth element among any group of siblings */ :nth-child ( 4n ) { color : lime ; } Example 3: css nth child :nth-child ( 3 ) { //the number is the child number you are targeting //styles here } Example 4: select even child css li :nth-child ( even ) { /* Selects only even elements */ color : green ; } Example 5: select odd child css li :nth-child ( odd ) { /* Selects only odd elements */ color : green ; }

Android: How To Determine Network Speed In Android Programmatically

Answer : Determining your Network Speed - (Slow Internet Speed) Using NetworkInfo class, ConnectivityManager and TelephonyManager to determine your Network Type. Download any file from the internet & calculate how long it took vs number of bytes in the file. ( Only possible way to determine Speed Check ) I have tried the below Logic for my projects, You have also look into this, Hope it helps you. ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); //should check null because in airplane mode it will be null NetworkCapabilities nc = cm.getNetworkCapabilities(cm.getActiveNetwork()); int downSpeed = nc.getLinkDownstreamBandwidthKbps(); int upSpeed = nc.getLinkUpstreamBandwidthKbps(); Check internet speed for mobile network to use this code ConnectivityManager connectivityManager = (ConnectivityManager)this.getSystemService(CONNECTIVITY_SERVICE); Ne

Alphabet Binary Code Example

Example: alphabet binary code Alphabet table Letter ASCII Code Binary Letter ASCII Code Binary a 097 0110 0001 A 065 0100 0001 b 098 0110 0010 B 066 0100 0010 c 099 0110 0011 C 067 0100 0011 d 100 0110 0100 D 068 0100 0100 e 101 0110 0101 E 069 0100 0101 f 102 0110 0110 F 070 0100 0110 g 103 0110 0111 G 071 0100 0111 h 104 0110 1000 H 072 0100 1000 i 105 0110 1001 I 073 0100 1001 j 106 0110 1010 J 074 0100 1010 k 107 0110 1011 K 075 0100 1011 l 108 0110 1100 L 076 0100 1100 m 109 0110 1101 M 077 0100 1101 n 110 0110 1110 N 078 0100 1110 o 111 0110 1111 O 079 0100 1111 p 112 0111 0000 P 080 0101 0000 q 113 0111 0001 Q 081 0101 0001 r 114

Danidev/itch.io Code Example

Example: danidev itch io Just type danidev . itch . io to get to the page

SUBSTR In Oracle Code Example

Example 1: plsql left() function SUBSTR ( "20190601" , 0 , 6 ) Example 2: 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 3: plsql substr SUBSTR ( string , start_position [ , length ] ) Example 4: oracle leftmost characters -- For Oracle only -- syntax SUBSTR ( < main - string > , 1 , < number - of - characters > ) -- example SUBSTR ( 'Useless stuff' , 1 , 10 ) -- OUTPUT : Useless st -- practical example SELECT SUBSTR ( 'Useless stuff' , 1 , 10 ) FROM DUAL ; Example 5: ORACLE SQL SUBSTR SUBSTR ( string , : START_POS , : SUBSTR_LENGTH ) ; SELECT SUBSTR ( 'ABCDEFG' , 3 , 4 ) FROM DUAL ; -- OUTPUT : CDEF Example 6: Subtr Oracle ? /*Usi

Criar Um Alert Em Php Code Example

Example: alert js in php javascript : alert ( 'Email enviado com Sucesso!' ) ; javascript : window . location = 'index.php' ;

Can We Scaffold DbContext From Selected Tables Of An Existing Database

Answer : One can solve the problem by usage of dotnet ef dbcontext scaffold command with multiple -t ( --table ) parameters. It allows to specify all the tables, which needed by imported (scaffolded). The feature is described initially here. It is possible to specify the exact tables in a schema to use when scaffolding database and to omit the rest. The command-line examples that follow show the parameters needed for filtering tables. .NET Core CLI: dotnet ef dbcontext scaffold "server=localhost;port=3306;user=root;password=mypass;database=sakila" MySql.Data.EntityFrameworkCore -o sakila -t actor -t film -t film_actor -t language -f Package Manager Console in Visual Studio: Scaffold-DbContext "server=localhost;port=3306;user=root;password=mypass;database=sakila" MySql.Data.EntityFrameworkCore -OutputDir Sakila -Tables actor,film,film_actor,language -f Force tag will update the existing selected models/files i

Calculating Median With Group By In AWS Redshift

Answer : The following will get you exactly the result you are looking for: SELECT distinct subject, median(num_students) over(partition by Subject) FROM course order by Subject; You simply need to remove the "over()" portion of it. SELECT subject, median(num_students) FROM course GROUP BY 1;

Print Array Elements Without Loop C++ Code Example

Example: print the elements of the array without using the [] notation in c++ # include <iostream> using namespace std ; int main ( ) { int arr [ ] = { 2 , 4 , 8 } ; int size = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; for ( int i = 0 ; i < size ; i ++ ) { cout << * ( arr + i ) << " " ; // prints.. 2 4 8. } }

"Computed" Property In Typescript

Answer : If it's an interface then there's no syntax, because all properties in JavaScript can have getter/setter functions instead of being exposed fields. It's an implementation concern. BTW members in TypeScript use camelCase not TitleCase : export interface Person { // get + set: firstName: string; lastName : string; jobTitle : string; // get-only: readonly fullName : string; } class SimplePerson implements Person { public firstName: string; // value-property (“field”) public lastName: string; public jobTitle: string; get fullName(): string { // read-only property with getter function (this is not the same thing as a “function-property”) return this.firstName + " " + this.lastName; } } I note that it is confusing that TypeScript's designers chose to use the keyword readonly to denote "readable" properties in an interface when it doesn't actually prohibit an implementation from also havi

Bootstrap Table Scroll - Horizontal Code Example

Example: table bootstrap with scrool < div style = " height : 600 px ; overflow : scroll ; " > <!-- change height to increase the number of visible row --> < table > </ table > </ div >

Android: Inapp Billing: Error Response: 7:Item Already Owned

Answer : You purchased "android.test.purchased" but did not consume it. However, if you forgot to consume it immediately, it is not easy to consume it again. We can wait for 14 days. The fake purchase will be cleared automatically. But it is not acceptable. I spent a lot of time finding the solution: Add this line to get debug info. _iabHelper.enableDebugLogging(true, "TAG"); Run the app. In LogCat, you will see a json string like {"packageName":"com.example","orderId":"transactionId.android.test.purchased","productId":"android.test.purchased","developerPayload":"123","purchaseTime":0,"purchaseState":0,"purchaseToken":"inapp:com.example:android.test.purchased"} Consume it manually (Replace THAT_JSON_STRING with your json string) Purchase purchase; try { purchase = new Purchase("inapp", THAT_JSON_STRING, &q

Android - Can I Enable USB Debugging Using Adb?

Answer : I got it to work :) NOTE : This requires unlocked bootloader. Connect the device to Mac or PC in recovery mode . (I had to map the process in my mind as the screen was broken). Now open terminal/CMD in computer and go to platform-tools/ . type and enter ./adb devices to check if the device is connected in recovery mode. Now type ./adb shell mount data and ./adb shell mount system to mount the respective directories. Get the persist.sys.usb.config file in your system using ./adb pull /data/property/persist.sys.usb.config /Your directory Now open that file in a texteditor and edit it to mtp,adb and save. Now push the file back in the device; ./adb push /your-directory/persist.sys.usb.config /data/property Get the build.prop file; ./adb pull /system/build.prop /your-directory Add these lines: persist.service.adb.enable=1 persist.service.debuggable=1 persist.sys.usb.config=mtp,adb Push build.prop back into

Advance Iterator For The Std::vector Std::advance VS Operator +?

Answer : Adding will only work with random access iterators. std::advance will work with all sorts of iterators. As long as you're only dealing with iterators into vectors, it makes no real difference, but std::advance keeps your code more generic (e.g. you could substitute a list for the vector , and that part would still work). For those who care, the standard describes advance and distance as follows (§24.3.4/1): Since only random access iterators provide + and - operators, the library provides two function templates advance and distance . These function templates use + and - for random access iterators (and are, therefore, constant time for them); for input, forward and bidirectional iterators they use ++ to provide linear time implementations. Also note that starting with C++11, the standard added a parameter to std::next , so you can advance by a specified amount using it (and std::prev similarly). The difference from std::advance is that it returns th

Html Css Zoom Code Example

Example 1: zoom image css /*Zoom on hover*/ <style > .zoom { padding : 50 px ; background-color : green ; transition : transform .2 s ; /* Animation */ width : 200 px ; height : 200 px ; margin : 0 auto ; } .zoom :hover { transform : scale ( 1.5 ) ; /* (150% zoom)*/ } </style> <div class= "zoom" ></div> /*credits: w3schools.com */ Example 2: zoom in to picture on html css /* Point-zoom Container */ .point-img-zoom img { transform-origin : 65 % 75 % ; transition : transform 1 s , filter .5 s ease-out ; } /* The Transformation */ .point-img-zoom :hover img { transform : scale ( 5 ) ; }