Skip to content

Instantly share code, notes, and snippets.

@abbas-oveissi
abbas-oveissi / gist:4994194
Created February 20, 2013 09:14
sample C# code for Value vs Reference Types
Point p2 = p1;
Form f2 = f1;
@abbas-oveissi
abbas-oveissi / gist:5020824
Created February 23, 2013 18:40
sample C# code for socket 3
IPAddress ip = IPAddress.Parse("192.168.1.2");
IPEndPoint IpPort = new IPEndPoint(ip, Convert.ToInt32("12345"));
Socket main_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
main_socket.Bind(IpPort);
////////////////////////////////////////////////////////////////////
IPAddress ip = IPAddress.Parse("192.168.1.2");
IPEndPoint IpPort = new IPEndPoint(ip, Convert.ToInt32("12345"));
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
@abbas-oveissi
abbas-oveissi / gist:5020869
Created February 23, 2013 18:56
sample C# code for socket 3
socket.Close();
socket.Shutdown(System.Net.Sockets.SocketShutdown.Both);
@abbas-oveissi
abbas-oveissi / gist:5024334
Created February 24, 2013 16:03
sample C# code for socket 4
IPAddress ip = IPAddress.Parse("192.168.1.2");
IPEndPoint IpPort = new IPEndPoint(ip, Convert.ToInt32("12345"));
Socket main_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
main_socket.Bind(IpPort);
main_socket.Listen(int.MaxValue);
Socket client= main_socket.Accept();
byte[] msg = System.Text.Encoding.UTF8.GetBytes("Hi");
client.Send(msg);
client.Close();
@abbas-oveissi
abbas-oveissi / gist:5024344
Created February 24, 2013 16:05
sample C# code for socket 4
IPAddress ip = IPAddress.Parse("192.168.1.2");
IPEndPoint IpPort = new IPEndPoint(ip, Convert.ToInt32("12345"));
Socket main_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
main_socket.Bind(IpPort);
main_socket.Listen(int.MaxValue);
while (true)
{
Socket client = main_socket.Accept();
byte[] msg = System.Text.Encoding.UTF8.GetBytes("Hi");
client.Send(msg);
sadsadsads
sadsadsa
sadsadasdas
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="*"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="*"
>
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int a[10], b[10], c[20];
for (int i = 0; i < 10; i++)
a[i] = b[i] = 0;
String line="The Eclipse IDE allows to perform <img src=\"smiley.gif\"></img> search and replace across a set of files <img src=\"abbas.gif\"></img> using regular expressions.";
Pattern pattern = Pattern.compile("<img src=\".*?\"></img>");
Matcher matcher = pattern.matcher(line);
while (matcher.find()) {
Log.d("output : ",matcher.group());
}