/
atom.xml
390 lines (311 loc) · 19.7 KB
/
atom.xml
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[My Octopress Blog]]></title>
<link href="http://kevinsheffield.github.com/atom.xml" rel="self"/>
<link href="http://kevinsheffield.github.com/"/>
<updated>2012-05-02T18:46:41-04:00</updated>
<id>http://kevinsheffield.github.com/</id>
<author>
<name><![CDATA[Your Name]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[Ruby + Windows + Sql Server]]></title>
<link href="http://kevinsheffield.github.com/blog/2011/01/04/ruby-windows-sql-server/"/>
<updated>2011-01-04T00:00:00-05:00</updated>
<id>http://kevinsheffield.github.com/blog/2011/01/04/ruby-windows-sql-server</id>
<content type="html"><![CDATA[<p>I love it when I spend a few hours getting something working only to not write down the steps I did to solve the magic riddle that Ruby on Windows seems to be. Fast forward a few months, a wiped computer and enough beers to make sure I can barely remember last night’s dinner and what we have here is a failure to communicate… with myself.</p>
<p>This post is a reminder to myself on how to set up a fresh windows install to be able to query Sql Server via Ruby.</p>
<p>The way this is going to be done is via 2 gems… dbi and dbd-odbc.</p>
<p>*replace C:\Ruby187 below with whatever the install path selected during the installation</p>
<ol>
<li>Install Ruby via the <a href="http://rubyinstaller.org/downloads/">1-click installer</a>. I have only used 1.8.7 for this.</li>
<li>Update rubygems (gem update –system).</li>
<li>Install dbi gem (gem install dbi).</li>
<li>Install dbd-odbc gem (gem install dbd-odbc).</li>
<li>Copy C:\Ruby187\lib\ruby\gems\1.8\gems\dbd-odbc-0.2.5\lib\dbd to C:\Ruby187\lib\ruby\gems\1.8\gems\dbi-0.4.5\lib.
(this will result in the following file path being valid… C:\Ruby187\lib\ruby\gems\1.8\gems\dbi-0.4.5\lib\dbd\odbc.rb).</li>
<li>Go to http://www.ch-werner.de/rubyodbc/ and download i386-msvcrt-ruby-odbc.zip.<br/>
Put the 2 .so files in the …/ruby/1.8/i386-mingw32 directory.</li>
</ol>
<p>That is it.</p>
<p>Now the following code will work like magic….</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class=''><span class='line'> require 'rubygems'
</span><span class='line'>require 'dbi'
</span><span class='line'>oConn = DBI.connect('DBI:ODBC:sqldsn')
</span><span class='line'>sth = oConn.execute(commandstring)
</span><span class='line'>rows = sth.fetch_all
</span><span class='line'>col_names = sth.column_names
</span><span class='line'>sth.finish
</span><span class='line'>DBI::Utils::TableFormatter.ascii(col_names, rows) </span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Monotouch Sample Code on Github]]></title>
<link href="http://kevinsheffield.github.com/blog/2009/09/15/monotouch-sample-code-on-github/"/>
<updated>2009-09-15T00:00:00-04:00</updated>
<id>http://kevinsheffield.github.com/blog/2009/09/15/monotouch-sample-code-on-github</id>
<content type="html"><![CDATA[<p>After a little bit of a tug of war, my sample code is now hosted on Github at <a href="http://github.com/kevinsheffield/MonoTouchDemos">http://github.com/kevinsheffield/MonoTouchDemos</a>.</p>
<p>Check it out and give me feedback on the code and ideas for more posts!</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Monotouch : Sectioned UITableViews]]></title>
<link href="http://kevinsheffield.github.com/blog/2009/09/14/monotouch-sectioned-uitableviews/"/>
<updated>2009-09-14T00:00:00-04:00</updated>
<id>http://kevinsheffield.github.com/blog/2009/09/14/monotouch-sectioned-uitableviews</id>
<content type="html"><![CDATA[<p>I was playing around some more with UITableViews and wanted to get them working the way they do in Contacts with the vertical bar on the right side of the screen providing navigation to a certain section in the list (in the case of Contacts and this example, first letter of the word).</p>
<p>It is amazingly simple. Basically you only have to override and implement a few more functions of UITableDataSource… mainly SectionIndexTitles, NumberOfSections, TitleForHeader (and TitleForFooter if you wanted a footer), SectionFor, and RowsInSection. So maybe that wasn’t just a few but they are really simple to implement.</p>
<p><strong>SectionIndexTitles</strong> : This is just a string[] with all the titles you want to show on the right side scrollbar area.</p>
<p><strong>NumberOfSections</strong> : Simply just a count of the number of sections.</p>
<p><strong>TitleForHeader</strong> : This will set the header title for each section. There is an int parameter and for me just returns the string at the specified index.</p>
<p><strong>RowsInSection</strong> : This returns a count of the items in the current section. Using .FindAll() in my code.</p>
<p><strong>SectionFor</strong> : Not exactly sure what this is for as of yet. Seeing it used in some Obj-c code it just returned the atIndex param. Will look into this more or would love a commentor to explain it.</p>
<p>To spice this demo up I even hooked up a UISearchBar and filter the list on each keystroke. You can notice both the items and sections being filtered out.</p>
<p>Here is what it looks like when it first loads up
<img src="http://farm4.static.flickr.com/3526/3921660933_f5a83b0801.jpg" alt="first load" /></p>
<p>And this it the program after searching for something
<img src="http://farm3.static.flickr.com/2458/3921661013_d165f4d567.jpg" alt="searched" /></p>
<p>Here is the code. All of the delegates are in the Main.cs file.</p>
<p>Here is the MainWindow.designer.cs</p>
<pre name="code" class="c-sharp">
namespace SectionedUITableViewSample {
// Base type probably should be MonoTouch.Foundation.NSObject or subclass
[MonoTouch.Foundation.Register("AppDelegate")]
public partial class AppDelegate {
[MonoTouch.Foundation.Connect("window")]
private MonoTouch.UIKit.UIWindow window {
get {
return ((MonoTouch.UIKit.UIWindow)(this.GetNativeField("window")));
}
set {
this.SetNativeField("window", value);
}
}
[MonoTouch.Foundation.Connect("tvc")]
private MonoTouch.UIKit.UITableViewController tvc {
get {
return ((MonoTouch.UIKit.UITableViewController)(this.GetNativeField("tvc")));
}
set {
this.SetNativeField("tvc", value);
}
}
[MonoTouch.Foundation.Connect("tv")]
private MonoTouch.UIKit.UITableView tv {
get {
return ((MonoTouch.UIKit.UITableView)(this.GetNativeField("tv")));
}
set {
this.SetNativeField("tv", value);
}
}
[MonoTouch.Foundation.Connect("searchBar")]
private MonoTouch.UIKit.UISearchBar searchBar {
get {
return ((MonoTouch.UIKit.UISearchBar)(this.GetNativeField("searchBar")));
}
set {
this.SetNativeField("searchBar", value);
}
}
}
}</pre>
<p>And here is the Main.cs</p>
<pre name="code" class="csharp">
namespace SectionedUITableViewSample
{
public class Application
{
static void Main (string[] args)
{
UIApplication.Main (args);
}
}
// The name AppDelegate is referenced in the MainWindow.xib file.
public partial class AppDelegate : UIApplicationDelegate
{
// This method is invoked when the application has loaded its UI and its ready to run
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// If you have defined a view, add it here:
// window.AddSubview (navigationController.View);
TableViewDataSource tvdc = new TableViewDataSource();
this.tvc.TableView.DataSource = tvdc;
this.searchBar.Delegate = new SearchDelegate(tvc, tvdc);
window.AddSubview(this.tvc.View);
window.MakeKeyAndVisible ();
return true;
}
// This method is required in iPhoneOS 3.0
public override void OnActivated (UIApplication application)
{
}
}
public class SearchDelegate : UISearchBarDelegate
{
public UITableViewController tvc;
public TableViewDataSource tvdc;
public SearchDelegate(UITableViewController tvc, TableViewDataSource tvdc) : base ()
{
this.tvc = tvc;
this.tvdc = tvdc;
}
public override void TextChanged (UISearchBar searchBar, string searchText)
{
tvdc.Search(searchText);
tvc.TableView.DataSource = tvdc;
tvc.TableView.ReloadData();
}
}
public class TableViewDataSource : UITableViewDataSource
{
private List<string> sectionList;
private List<string> filteredSectionList = new List<string>();
private List<string> dictionaryItems = new List<string>();
public List<string> filteredDictionaryItems = new List<string>();
public TableViewDataSource ()
{
Initialize();
}
public void Initialize()
{
sectionList = new List<string> {"A","B","C","D","E","F","G","H","J","I","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z" };
filteredSectionList = new List<string> {"A","B","C","D","E","F","G","H","J","I","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z" };
var random = new System.Random();
for(int i = 0; i < 2000; i++)
{
dictionaryItems.Add(sectionList[random.Next(26)] + sectionList[random.Next(26)] + sectionList[random.Next(26)] + sectionList[random.Next(26)]);
}
dictionaryItems.Sort();
foreach(var item in dictionaryItems)
{
filteredDictionaryItems.Add(item);
}
}
public void Search(string searchText)
{
filteredDictionaryItems.Clear();
filteredSectionList.Clear();
foreach(string item in dictionaryItems)
{
if(item.ToLower().Contains(searchText.ToLower()))
{
filteredDictionaryItems.Add(item);
if(filteredSectionList.Find(x => x == item[0].ToString()) == null)
{
filteredSectionList.Add(item[0].ToString());
}
}
}
filteredSectionList.Sort();
}
public override string[] SectionIndexTitles (UITableView tableView)
{
return filteredSectionList.ToArray();
}
public override int NumberOfSections (UITableView tableView)
{
return filteredSectionList.Count;
}
public override string TitleForHeader (UITableView tableView, int section)
{
return filteredSectionList[section];
}
public override int RowsInSection (MonoTouch.UIKit.UITableView tableview, int section)
{
return filteredDictionaryItems.FindAll(x => x.StartsWith(filteredSectionList[section])).Count;
}
public override UITableViewCell GetCell (MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
{
var termsinsection = filteredDictionaryItems.FindAll(x => x.StartsWith(filteredSectionList[indexPath.Section]));
string dictionaryItem = termsinsection[indexPath.Row];
string cellID = "CellID";
UITableViewCell cell = tableView.DequeueReusableCell(cellID);
if(cell == null)
{
cell = new UITableViewCell(UITableViewCellStyle.Default, cellID);
cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
}
cell.TextLabel.Text = dictionaryItem;
return cell;
}
public override int SectionFor (UITableView tableView, string title, int atIndex)
{
return atIndex;
}
}
}
</pre>
<p>The code is up on <a href="http://github.com/kevinsheffield/MonoTouchDemos/tree/master/SectionedUITableViewSample/"> Github</a></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Monotouch Beta 3 is out]]></title>
<link href="http://kevinsheffield.github.com/blog/2009/08/17/monotouch-beta-3-is-out/"/>
<updated>2009-08-17T00:00:00-04:00</updated>
<id>http://kevinsheffield.github.com/blog/2009/08/17/monotouch-beta-3-is-out</id>
<content type="html"><![CDATA[<p>I am stoked about downloading it when I get back from dinner. Going to play with the drawing API tonight!</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Assignment 2B : CS193P via Monotouch]]></title>
<link href="http://kevinsheffield.github.com/blog/2009/08/16/assignment-2b-cs193p-via-monotouch/"/>
<updated>2009-08-16T00:00:00-04:00</updated>
<id>http://kevinsheffield.github.com/blog/2009/08/16/assignment-2b-cs193p-via-monotouch</id>
<content type="html"><![CDATA[<p>Here is the video for Assignment 2B. Course materials can be downloaded from the CS193p website, although they may be removed at the start of the fall semester.</p>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=6131105&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=6131105&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object>
<p><a href="http://vimeo.com/6131105">Monotouch CS193P Assmt 2B</a> from <a href="http://vimeo.com/user2165949">Kevin Sheffield</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[CS193P via Monotouch Launching]]></title>
<link href="http://kevinsheffield.github.com/blog/2009/08/15/cs193p-via-monotouch-launching/"/>
<updated>2009-08-15T00:00:00-04:00</updated>
<id>http://kevinsheffield.github.com/blog/2009/08/15/cs193p-via-monotouch-launching</id>
<content type="html"><![CDATA[<p>I just finished recording a walkthrough of assignment 1 and it is uploading to a few sites so I can compare them. I have never really done any screencasts aside from a few simple “how to use this page I just made” videos for work using camtasia (and those sucked I am sure), so as I post these, let me know how I can improve not only the code but also my presentation skills.</p>
<p>Before I post any of the videos I did want to put down a disclaimer:</p>
<p>I am not associated with the CS193p course or Monotouch. All code you see in the screencasts may not be best practice and as Monotouch is in beta, functionality may be different at the time of your viewing of this video.</p>
<p>I will try and update videos as I get feedback and as the project advances if need be.</p>
<p>Please provide any feedback you wish, but constructive feedback is what is going to most help shape these videos into something truly useful.</p>
<p>I hope you enjoy messing with Monotouch as much as I am.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Assignment 1 : CS193P via Monotouch]]></title>
<link href="http://kevinsheffield.github.com/blog/2009/08/15/assignment-1-cs193p-via-monotouch/"/>
<updated>2009-08-15T00:00:00-04:00</updated>
<id>http://kevinsheffield.github.com/blog/2009/08/15/assignment-1-cs193p-via-monotouch</id>
<content type="html"><![CDATA[<p>Here is the video for Assignment 1. Course materials can be downloaded from the CS193p website, although they may be removed at the start of the fall semester.</p>
<p>I am going to try and go with Vimeo for the time being but this video is also on Viddler.</p>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=6118307&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=6118307&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object>
<p><a href="http://vimeo.com/6118307">Monotouch CS193P Assmt 1</a> from <a href="http://vimeo.com/user2165949">Kevin Sheffield</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Viddler vs YouTube vs Vimeo]]></title>
<link href="http://kevinsheffield.github.com/blog/2009/08/13/viddler-vs-youtube-vs-vimeo/"/>
<updated>2009-08-13T00:00:00-04:00</updated>
<id>http://kevinsheffield.github.com/blog/2009/08/13/viddler-vs-youtube-vs-vimeo</id>
<content type="html"><![CDATA[<p>I am going to be recording Assignments 1 and 2 of CS193p only using Monotouch tomorrow. After I record assignment 1, I am going to see what service suits me best and run with it. If anyone has a suggestion for what works best with the idea that I will be mainly concerned with displaying screencasts, let me know here or via <a href="http://twitter.com/k_sheffield">twitter</a></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Kicking Ass with Monotouch]]></title>
<link href="http://kevinsheffield.github.com/blog/2009/08/12/kicking-ass-with-monotouch/"/>
<updated>2009-08-12T00:00:00-04:00</updated>
<id>http://kevinsheffield.github.com/blog/2009/08/12/kicking-ass-with-monotouch</id>
<content type="html"><![CDATA[<p>A few days ago I was lucky to become a part of the <a href="http://www.mono-project.com/MonoTouch">Monotouch</a> beta program and I must say that I cannot believe how cool it is so far. I have seen a few screencasts from people making hello world (or really button press counter) apps and thought, “Hell, I was going through the Stanford Iphone class, why not do all the assignments using Monotouch?” Last night I ran through Assignment 2B and I am going to attempt a screencast with my very best Ron Burgundy voice in the next few days. I will tag any posts related to this endeavor with ‘monotouch’ so feel free to follow along.</p>
<p>If anyone has some suggestions for good screen recording software on OSX feel free to comment, I am new to the mac world and have only ever used Camtasia on windows.</p>
<p>Also expect a post soon giving a run down of my experience and what I hope any posts I make gains in terms of feedback. I will say though that I am by no means an expert and anything I code might not be best practice. If you have a better/different way of doing anything please give me some feedback as my first motive in this is improving myself and any help I can give anyone else through this is just gravy on the potatoes.</p>
]]></content>
</entry>
</feed>