Just received my Nexus 7 16gb, ordered from Google Play on monday october 29th and I love it! The size is perfect and it feels really great in hand. I already installed most of my apps and as you can see I am currently testing the Blogger app :-)
Right now I really have nothing bad to say. We'll see if that changes with time.
Right now I'm thinking about getting a cover for it and maybe a bluetooth but I feel that this would go against the hole tablet purpose.
Anyways, with the new nexus prices I believe this is a great deal.
Imports System.Threading
Public Class Form1
Delegate Sub UpdateItemValueDelegate(ByVal index As Integer, ByVal value As Integer)
Public UpdateListItem As UpdateItemValueDelegate = AddressOf UdateItemValue
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Add some values to the listbox for the example
For i As Integer = 0 To 10
ListBox1.Items.Add(i.ToString())
Next
End Sub
Private Sub UdateItemValue(ByVal index As Integer, ByVal value As Integer)
'Set the new item's value
ListBox1.Items(index) = value
End Sub
Private Sub CalculateNewValue(ByVal itemIndex As Integer)
'Calculate a new value for the given item and call the delegate to set the new item's value
Dim value As Integer
value = ListBox1.Items(itemIndex) * 5
If ListBox1.InvokeRequired Then
Me.Invoke(UpdateListItem, {itemIndex, value})
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Run a thread for each item in the list
For i As Integer = 0 To ListBox1.Items.Count - 1
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf CalculateNewValue), i)
Next
End Sub
End Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Diagnostics;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Stopwatch watch = new Stopwatch();
int[] nums = Enumerable.Range(0, 2000000).ToArray();
long total = 0;
watch.Reset();
watch.Start();
for (int i = 0; i < nums.Count<int>(); i++ )
{
total += nums[i];
}
watch.Stop();
Console.WriteLine("The total is {0}", total);
Console.WriteLine("'For' loop completed in " + watch.ElapsedMilliseconds.ToString() + " milliseconds.");
Console.WriteLine();
total = 0;
watch.Reset();
watch.Start();
Parallel.For<long>(0, nums.Length, () => 0, (j, loop, subtotal) =>
{
subtotal += nums[j];
return subtotal;
},
(x) => Interlocked.Add(ref total, x)
);
watch.Stop();
Console.WriteLine("The total is {0}", total);
Console.WriteLine("'Parallel.For' loop completed in " + watch.ElapsedMilliseconds.ToString() + " milliseconds.");
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
}As you can see in the following screenshot, The Parallel.For loop is much faster than the standard for loop.Imports System.Data.OleDb
Module Module1
Public da As New OleDbDataAdapter
Public ds As New DataSet
End ModuleImports System.Text
Imports System.Collections
Imports System.ComponentModel
Imports System.Data.OleDb
Public Class Form1
Dim WithEvents bgw As New BackgroundWorker
Delegate Sub HideButtonDelegate()
Public HBD As HideButtonDelegate = AddressOf Me.HideButton
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bgw.WorkerSupportsCancellation = True
ProgressBar1.Show()
bgw.RunWorkerAsync()
End Sub
Private Sub bgw_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs) Handles bgw.DoWork
'Do your lenghty operations here
Dim MyConnection As New System.Data.OleDb.OleDbConnection()
Dim MyCommand As OleDbCommand
Try
MyConnection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data source=" & Application.StartupPath & "\Database1.accdb"
MyConnection.Open()
Catch ex As Exception
MessageBox.Show("Cannot connect to the specified database" & ex.Message)
End Try
Try
MyCommand = New OleDbCommand("SELECT * FROM Table1", MyConnection)
da.SelectCommand = MyCommand
ds = New DataSet
da.Fill(ds, "Table1")
Catch ex As Exception
MessageBox.Show("Cannot fetch data from the database" & ex.Message)
End Try
System.Threading.Thread.Sleep(2000)
If Button1.InvokeRequired Then
Me.Invoke(HBD)
End If
System.Threading.Thread.Sleep(2000)
End Sub
Private Sub bgw_Completed(ByVal sender As Object, ByVal e As AsyncCompletedEventArgs) Handles bgw.RunWorkerCompleted
ProgressBar1.Hide()
Me.Hide()
Form2.Show()
End Sub
Private Sub HideButton()
Button1.Visible = False
End Sub
End ClassPublic Class Form2
Private Sub Form2_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
Form1.Close()
End Sub
Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
DataGridView1.DataSource = ds.Tables(0)
End Sub
End Class
private void button1_Click(object sender, EventArgs e)
{
string s = "username=myusername";
Regex patern = new Regex(@"\[(username=(\W+))\]");
MatchEvaluator matchEval = new MatchEvaluator(GetReplacement);
s = patern.Replace(s,GetReplacement);
MessageBox.Show(s);
}
private string GetReplacement(Match m)
{
return "" + m.Groups[2] + "";
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Concatenation using string class and operators");
string s = string.Empty;
Console.WriteLine("Operation start time: " + DateTime.Now.ToLongTimeString());
for (int i = 0; i < 100000; i++)
{
s += i.ToString();
}
Console.WriteLine("Operation stop time: " + DateTime.Now.ToLongTimeString());
Console.WriteLine();
Console.WriteLine("Concatenation using StringBuilder");
StringBuilder sb = new StringBuilder(string.Empty);
Console.WriteLine("Operation start time: " + DateTime.Now.ToLongTimeString());
for (int i = 0; i < 100000; i++)
{
sb.Append(i);
}
Console.WriteLine("Operation stop time: " + DateTime.Now.ToLongTimeString());
Console.WriteLine();
Console.WriteLine("Press any key to close this window.");
Console.ReadLine();
}
}
}
using System.Text.RegularExpressions;Here is a small code example for finding multiple pattern matches.
private void findMatches(string text)
{
Regex pattern = new Regex("Chapter\s(\d+)|Section\s(\d+)|Figure\s(\d+)");
MatchCollection matches = new MatchCollection();
matches = Regex.Matches(text, pattern, RegexOptions.IgnoreCase);
foreach(Match m in matches)
{
/*Work with the match here, generate and insert link etc.*/
}
}
Here are a couple of links that might prove usefull :