This file contains 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
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
#include <string> | |
#include <windows.h> | |
#include <fstream> | |
#include <cstring> | |
#include <cassert> | |
using namespace std; |
This file contains 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
from BeautifulSoup import BeautifulSoup | |
import re | |
doc = ['<html><head><title>Page title</title></head>', | |
'<body><p id="firstpara" align="center">This is paragraph <b>one</b>.', | |
'<p id="secondpara" align="blah">This is paragraph <b>two</b>.', | |
'</html>'] | |
doc = ''.join(doc) | |
soup = BeautifulSoup(doc) |
This file contains 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
#include <cstdio> | |
#include <cstring> | |
#define NUM 501 | |
int grid[NUM][NUM]; | |
int used[NUM]; | |
int path[NUM]; | |
bool dfs(int x, int n) |
This file contains 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.Security.Principal | |
public static bool IsAdministrator() | |
{ | |
WindowsIdentity identity = WindowsIdentity.GetCurrent(); | |
WindowsPrincipal principal = new WindowsPrincipal(identity); | |
return principal.IsInRole(WindowsBuiltInRole.Administrator); | |
} |
This file contains 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
ProcessStartInfo psi = new ProcessStartInfo(); | |
//psi.UseShellExecute = false; if uncomment this line, then you can not run as administrator | |
psi.Verb = "runas"; | |
Process.Start(psi); |
This file contains 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.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Xml; | |
using System.Xml.XPath; | |
using System.IO; | |
namespace StudyCSharp | |
{ |
This file contains 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
/* | |
* Copyright (c) 2011. Peter Lawrey | |
* | |
* "THE BEER-WARE LICENSE" (Revision 128) | |
* As long as you retain this notice you can do whatever you want with this stuff. | |
* If we meet some day, and you think this stuff is worth it, you can buy me a beer in return | |
* There is no warranty. | |
*/ |
This file contains 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
XElement root = new XElement("Orders"); | |
using (SqlConnection con = new SqlConnection("data source=LMATT-PC\\SQLEXPRESS;integrated security=SSPI")) | |
{ | |
con.Open(); | |
using(SqlCommand command = new SqlCommand("SELECT top 50 * from Spt_values", con)) | |
{ | |
SqlDataReader reader = command.ExecuteReader(); | |
while(reader.Read()) | |
{ |
This file contains 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
#include <iostream> | |
#include <vector> | |
#include <map> | |
#include <set> | |
#include <algorithm> | |
#include <string> | |
#include <list> | |
#include <deque> | |
#include <stack> | |
#include <bitset> |
This file contains 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
for(int i = 0; i <= N; i++) | |
{ | |
for(int j = 0; j < i + 1; j++) | |
{ | |
if(j == 0 || i == j) d[i][j] = 1; | |
else d[i][j] = d[i - 1][j] + d [i - 1][j - 1]; | |
} | |
} |
OlderNewer