Posts

Showing posts from August, 2014

Donate

Webbrowser Control Imitate Internet Explorer Behavior

Image
Hi, Lately, I was given a task from a client if I can update my VB.NET crawler scripts with a webbrowser control to show/render images of the crawled website to the control. Normally, I used the control just to obtain the web page source and then parse the necessary information. By default, the settings of the webbrowser control is IE7. After doing some reseach, I stumbled upon a solution by Noseratio on IE Feature Control Hacks . The documentation for browser emulation can be found on MSDN: MSDN Browser Emulation . I uploaded a sample VB.NET application here: WebBrowser Control Similar to IE Browser Sample Result: Cheers! :)

List Running Computer Processes By Array Names Using LINQ In C# And VB.NET

Image
Here's a snippet on how to retrieve running process in your computer by array names using LINQ. C# Code 1 2 3 4 5 6 7 8 List<Process> procs = new List<Process>(); procs = new List< string >() { "firefox" , "iexplore" , "ssms" , "notepad++" , "chrome" } .SelectMany(o => Process.GetProcessesByName(o)).ToList(); foreach ( var item in procs) { Console.WriteLine(item.ProcessName); } VB.NET 1 2 3 4 5 6 Dim procs As IEnumerable( Of Process) = _ { "firefox" , "iexplore" , "ssms" , "notepad++" , "chrome" }.SelectMany(Function(proc) Process.GetProcessesByName(proc)) For Each p In procs Console.WriteLine(p.ProcessName) Next Console.ReadLine() Output

WPF DataGrid Row And Cells Extension Methods In VB.NET

Image
Below are extension methods in accessing WPF DataGrid Rows and Cells. These methods were based on existing C# methods and I converted them to VB.NET for VB programmers. WPF DataGrid Extension Methods: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 Option Explicit On Option Infer On Imports System.Runtime.CompilerServices Imports System.Windows.Controls.Primitives

Show Asterisk Triangle Shapes Using TSQL In SQL Server

Image
In programming, it's a common exercise to show triangle shapes using the asterisk character. Well, this can be achieved using TSQL as well. Script #1 DECLARE @Total1 INT DECLARE @ctrOuter1 INT DECLARE @ctrInner1 INT DECLARE @strPrint1 VARCHAR(100) SET @Total1 = 5 SET @ctrOuter1 = @Total1 SET @strPrint1 = '' WHILE @ctrOuter1 >= 1 --outer loop BEGIN SET @strPrint1 = '' SET @ctrInner1 = 0 WHILE @ctrInner1 <= (@Total1 - @ctrOuter1) BEGIN SET @strPrint1 = @strPrint1 + '*' SET @ctrInner1 = @ctrInner1 + 1 END PRINT @strPrint1 SET @strPrint1 = @strPrint1 + CHAR(13) SET @ctrOuter1 = @ctrOuter1 - 1 END Output: Script #2 DECLARE @Total INT DECLARE @ctrOuter INT

Donate