This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string strIn = "2001:DB8::/120"; | |
//Split the string in parts for address and prefix | |
string strAddress = strIn.Substring(0, strIn.IndexOf('/')); | |
string strPrefix = strIn.Substring(strIn.IndexOf('/') + 1); | |
int iPrefix = Int32.Parse(strPrefix); | |
IPAddress ipAddress = IPAddress.Parse(strAddress); | |
//Convert the prefix length to a valid SubnetMask |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string DegreesToCardinal(double degrees) | |
{ | |
string[] caridnals = { "N", "NE", "E", "SE", "S", "SW", "W", "NW", "N" }; | |
return caridnals[ (int)Math.Round(((double)degrees % 360) / 45) ]; | |
} | |
public static string DegreesToCardinalDetailed(double degrees) | |
{ | |
string[] caridnals = { "N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW", "N" }; | |
return caridnals[ (int)Math.Round(((double)degrees*10 % 3600) / 225) ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GridLayoutPage : ContentPage | |
{ | |
public GridLayoutPage() | |
{ | |
var layout = new StackLayout | |
{ | |
Orientation = StackOrientation.Vertical, | |
Padding = 20 | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int incomingByte = 0; // for incoming serial data | |
const int pinButton = 6; // pin of button define here | |
const int pinLed = 3; // pin of led define here | |
void setup() { | |
// put your setup code here, to run once: | |
Serial.begin(9600); | |
Serial.println("hello"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using MonoTouch.UIKit; | |
using MonoTouch.CoreGraphics; | |
using MonoTouch.Foundation; | |
namespace Code | |
{ | |
public class MyViewController : UIViewController | |
{ | |
UIButton button1, button2, button3, button4; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.IO; | |
class Program | |
{ | |
static void Main() | |
{ | |
ProcessStartInfo start = new ProcessStartInfo(); | |
start.FileName = @"C:\someapp.exe"; // full path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// http://forums.xamarin.com/discussion/18460/uitextview-and-html | |
/// <summary> | |
/// Gets the attributed string from html-string. | |
/// </summary> | |
/// <returns>The attributed string from html.</returns> | |
/// <param name="html">Html.</param> | |
public static NSAttributedString GetAttributedStringFromHtml(string html) | |
{ | |
NSError error = null; | |
var htmlString = new NSAttributedString (NSUrl.FromString(html), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public App () | |
{ | |
int count = 0; | |
var myPage = new ContentPage (); | |
var stepperlabel = new Label | |
{ | |
Text = "Stepper value is 0", | |
HorizontalOptions = LayoutOptions.Center, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using CoreGraphics; | |
using Foundation; | |
using UIKit; | |
using MapKit; | |
using CoreLocation; | |
using System.Diagnostics; | |
namespace MappingApp | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void ViewDidLoad () | |
{ | |
base.ViewDidLoad (); | |
// Perform any additional setup after loading the view, typically from a nib. | |
var password = "9a55W0rd!!"; | |
var salt = Encoding.Unicode.GetBytes("5a1t"); | |
byte[] keymaterial = NetFxCrypto.DeriveBytes.GetBytes(password, salt, 1000, 32); |
OlderNewer