<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4839943535001876851</id><updated>2024-03-19T00:47:08.155-07:00</updated><title type='text'>Rob Becker&#39;s blog</title><subtitle type='html'>Web development, programming, GDG events, sometimes a rant</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://robrbecker.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4839943535001876851/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://robrbecker.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/09659696469541041435</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4839943535001876851.post-5694062588341265067</id><published>2012-04-26T13:10:00.000-07:00</published><updated>2012-04-26T13:36:27.577-07:00</updated><title type='text'>Ditch the landline or cell plan?</title><content type='html'>You can have the best &lt;a href=&quot;https://play.google.com/store/devices/details?id=galaxy_nexus_hspa&quot; target=&quot;_blank&quot;&gt;pure Google smartphone&lt;/a&gt;&amp;nbsp;and not have to pay for phone service, only data. &amp;nbsp;The caveat is that you will to be on wifi to receive a call. But, ah ha! You can bring your own wifi wherever you go. You can get&amp;nbsp;a device called a MIFI or personal hotspot from&amp;nbsp;&lt;a href=&quot;http://www.verizonwireless.com/b2c/store/controller?item=phoneFirst&amp;amp;action=viewPhoneDetail&amp;amp;selectedPhoneId=5882&quot; target=&quot;_blank&quot;&gt;Verizon&amp;nbsp;&lt;/a&gt;or AT&amp;amp;T or whatever mobile provider you want. Keep in mind that Voice over IP uses about 1.2MB per minute. So if you use about 1000 minutes a month you&#39;ll use at least 1.2 gigabytes of data. &amp;nbsp;That&#39;s assuming all calls are actually going over the MIFI. If you&#39;re like me and have wifi at home and work you&#39;ll use much less mobile data. &lt;br /&gt;
&lt;br /&gt;
If you just want to replace a home phone with a smartphone that makes calls over wifi. You won&#39;t need a mobile plan or MIFI.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;




Here&#39;s how to do it.&lt;/h3&gt;
1) Get a &lt;a href=&quot;http://google.com/voice&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Google Voice&lt;/a&gt; phone number. &lt;br /&gt;
2) Go to the Settings page in Google Voice. Make sure Google Chat is checked on the Phones tab.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjINJQL9Q5GtF9zbmeNrLw6OmKwT-SSVT04Ztxr_W-gU7jhorPgNUsGS4wov9xb4_YO7OGJlJz9zuW4Jxl9DXEbU0L65OTlarVlYDNR6zL7QGC-q8RHM-4Tido7vneF_7HTzPqeahnJfTz9/s1600/2012-04-26+13h38_10.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjINJQL9Q5GtF9zbmeNrLw6OmKwT-SSVT04Ztxr_W-gU7jhorPgNUsGS4wov9xb4_YO7OGJlJz9zuW4Jxl9DXEbU0L65OTlarVlYDNR6zL7QGC-q8RHM-4Tido7vneF_7HTzPqeahnJfTz9/s1600/2012-04-26+13h38_10.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
3) Install&amp;nbsp;&lt;a href=&quot;http://www.talkatone.com/&quot; target=&quot;_blank&quot;&gt;Talkatone&lt;/a&gt;&amp;nbsp;on your&amp;nbsp;&lt;a href=&quot;https://play.google.com/store/apps/details?id=com.talkatone.android&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Android&amp;nbsp;&lt;/a&gt;or&amp;nbsp;&lt;a href=&quot;http://itunes.apple.com/us/app/talkatone-free-calls-sms-texting/id397648381?mt=8&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;iOS&amp;nbsp;&lt;/a&gt;device, or both. Yes iPad and Android tablets work.&lt;br /&gt;
4) Start up Talkatone and use the same Google account as your Google Voice account.&lt;br /&gt;
5) Done. Make and receive calls using Talkatone.&lt;br /&gt;
&lt;br /&gt;
If you are using a tablet or don&#39;t want to do speakerphone only calls pick up a good pair of earbuds with a microphone, a bluetooth headset, or one of these wired or bluetooth handsets. (Click em to find them at Amazon)&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.amazon.com/gp/product/B003DKL4JA/ref=noref?ie=UTF8&amp;amp;s=wireless&amp;amp;psc=1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMSbXcedonScEGLdwDB5et2G0g6i8aU7PWv0AdoOvWdc2nhS0Y_grkL1a36fzakqMiTHEig2Uzc0cSzKV52sgl48tpQBo5IYXVFd78_M4nPpbB0ymTVO_xDiT0JpalFelC35U23XK6hMnM/s1600/31nNcdSlnSL._AA300_%5B1%5D.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.amazon.com/dp/B003FMVCRK&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;227&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT0Lpn6C3Ougtl4M7yrvzzq7wWWqjtvwhv_xz8CJpsbKpC-IOi-dNkXACLUwg_LXXye-4L85KHixnmTmxng-DFUkjSTRpgw8HPZiu4rgVsfVUnw7Zp8u1-MII5yljaraZ34cEkszRDY-D1/s320/nativeunion-mm3-black-iphone%5B1%5D.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Edit: Yes, you can send and receive SMS text messages this way. MMS (picture or multimedia messages) do NOT work and will be silenty dropped and never reach you. Google is already working on this and has some support for people sending MMS to a Google voice number. &amp;nbsp;MMS originating from other providers, not&lt;br /&gt;
&lt;br /&gt;
Edit2: Saving power. This could bite you. &amp;nbsp;Most, if not all smart phones will turn off WIFI after inactivity. This means you will not receive calls once it is disconnected. That&#39;s kind of a bummer since forcing WIFI to stay on will eat your battery. &amp;nbsp;So, clearly this solution isn&#39;t perfect.&lt;br /&gt;
&lt;br /&gt;
Edit3: Upon investigating the talkatone website there is a setting that will keep the wifi connected.</content><link rel='replies' type='application/atom+xml' href='http://robrbecker.blogspot.com/feeds/5694062588341265067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://robrbecker.blogspot.com/2012/04/ditch-landline-or-cell-plan.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4839943535001876851/posts/default/5694062588341265067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4839943535001876851/posts/default/5694062588341265067'/><link rel='alternate' type='text/html' href='http://robrbecker.blogspot.com/2012/04/ditch-landline-or-cell-plan.html' title='Ditch the landline or cell plan?'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/09659696469541041435</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjINJQL9Q5GtF9zbmeNrLw6OmKwT-SSVT04Ztxr_W-gU7jhorPgNUsGS4wov9xb4_YO7OGJlJz9zuW4Jxl9DXEbU0L65OTlarVlYDNR6zL7QGC-q8RHM-4Tido7vneF_7HTzPqeahnJfTz9/s72-c/2012-04-26+13h38_10.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4839943535001876851.post-8598974604026634511</id><published>2012-04-02T12:13:00.002-07:00</published><updated>2012-04-02T12:13:33.214-07:00</updated><title type='text'>Generating and emailing HTML reports from SQL Server</title><content type='html'>Recently, I was looking for a way to email nightly reports directly from SQL Server (I&#39;m using 2008 R2). With sp_send_dbmail, sending email is a piece of cake after setting up your mailing profile. But ever try attaching a query? You get a disgusting regurgitation of your results splattered all over your email. It&#39;s not pretty.... or readable. &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHqIUf9IYKTmWSytOwRdX6fpLjS5fXzqFI1YdDHiAOP39N2EjJPcjSnOCx8ab5Do3-B-669dwyyMyt9d3q120vMa0zDQoH0VDlLxD3I8kMEsYJg-LSh_HcB2deI7RyTz7BgDrd_D4fSJ8g/s1600/2012-04-02+12h22_41.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;141&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHqIUf9IYKTmWSytOwRdX6fpLjS5fXzqFI1YdDHiAOP39N2EjJPcjSnOCx8ab5Do3-B-669dwyyMyt9d3q120vMa0zDQoH0VDlLxD3I8kMEsYJg-LSh_HcB2deI7RyTz7BgDrd_D4fSJ8g/s400/2012-04-02+12h22_41.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
So I created a stored procedure to convert a temp table into an HTML table. Yep, just select something into a temp table and call this stored procedure and out pops an HTML table suitable for emailing. Here&#39;s the code:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;CREATE procedure [dbo].[temp_table_to_html](@tbl varchar(64), @no_results_msg varchar(MAX) = &#39;None&#39;) as begin&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; set NOCOUNT ON&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; if exists (select * from tempdb.sys.columns where object_id = object_id(&#39;tempdb..#&#39;+@tbl)) begin&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; declare @q varchar(MAX);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; declare @cols varchar(MAX);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; declare @c int;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; set @c = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; create table #c (c int);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; set @q = &#39;insert into #c select count(0) from #&#39;+@tbl&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; exec(@q)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; select @c = c from #c;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; drop table #c;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; if @c &amp;gt; 0 begin&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; select &#39;&amp;lt;style&amp;gt;table,td,th { border:solid 1px #ccc; border-collapse:collapse; padding: 3px;}&amp;lt;/style&amp;gt;&#39;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;select &#39;&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&#39;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;select &#39;&amp;lt;th&amp;gt;&#39;+name+&#39;&amp;lt;/th&amp;gt;&#39; from tempdb.sys.columns where object_id = object_id(&#39;tempdb..#&#39;+@tbl);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;select &#39;&amp;lt;/tr&amp;gt;&#39;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;select @cols = coalesce(@cols +&#39;+&#39;,&#39;&#39;) + &#39;&#39;&#39;&amp;lt;td&amp;gt;&#39;&#39;+ISNULL(cast(&#39;+name+&#39; as varchar(MAX)),&#39;&#39;NULL&#39;&#39;)+&#39;&#39;&amp;lt;/td&amp;gt;&#39;&#39;&#39; from tempdb.sys.columns where object_id = object_id(&#39;tempdb..#&#39;+@tbl);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;set @q = &#39;select &#39;&#39;&amp;lt;tr&amp;gt;&#39;&#39;+&#39; + @cols + &#39; +&#39;&#39;&amp;lt;/tr&amp;gt;&#39;&#39; from #&#39;+@tbl;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;exec sp_sqlexec @q&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;select &#39;&amp;lt;/tr&amp;gt;&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;select &#39;&amp;lt;/table&amp;gt;&#39;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;end&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if @c is null or @c = 0 select @no_results_msg as NoRows&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; end&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; set NOCOUNT OFF&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And here is how you might use it:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;select &#39;Joe&#39; as Name, 25 as Age, 42.10 as Budget into #results&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;exec dbo.temp_table_to_html &#39;results&#39;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
It returns multiple tables that are all chunks of HTML. Htmm... not pretty in SQL Server Management Studio.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhq5TkJpjlKk9z6uOfN7pV-XOSHz171Chyphenhyphenq-3H7q1Iu4TidrMyV4Y1Mf1iJG4t5m97TSL5LS1cxHDr99XkYytTIR6we2Qz7rmv1NZQqBLItCeHEkesKhYKUzDvSuT05MkjEpbKkP4N7Yqt-/s1600/2012-04-02+12h19_55.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhq5TkJpjlKk9z6uOfN7pV-XOSHz171Chyphenhyphenq-3H7q1Iu4TidrMyV4Y1Mf1iJG4t5m97TSL5LS1cxHDr99XkYytTIR6we2Qz7rmv1NZQqBLItCeHEkesKhYKUzDvSuT05MkjEpbKkP4N7Yqt-/s320/2012-04-02+12h19_55.png&quot; width=&quot;237&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
So lets add a switch to control whether it renders HTML or returns a table and we get the best of both worlds.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
create procedure sample_report(@html bit = 0) as begin&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&amp;nbsp; set nocount on&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&amp;nbsp; select &#39;Joe&#39; as Name, 25 as Age, 42.10 as Budget into #results;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&amp;nbsp; if @html is null set @html = 0;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&amp;nbsp; if @html = 0 begin&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&amp;nbsp; &amp;nbsp; select * from #results;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&amp;nbsp; end&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&amp;nbsp; if @html = 1 begin&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&amp;nbsp; &amp;nbsp; exec dbo.temp_table_to_html &#39;results&#39;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&amp;nbsp; end&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&amp;nbsp; drop table #results;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&amp;nbsp; set nocount off&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
end&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Now if we run the procedure manually it returns the query results as intended.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-bElwTV_gdbMsESG6xK32PsmOXkQ0ELC4U8m0W4E6pEc68-tlhy0nxcLkKQ-l1AT8Q50rDDx0W_0ysL3iJ52_WTgpMb3Ku7PWeEP5TvSpGkOsuPWsGmBWRH4EuCq20o4PuetIAqb0PYcL/s1600/2012-04-02+12h54_40.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-bElwTV_gdbMsESG6xK32PsmOXkQ0ELC4U8m0W4E6pEc68-tlhy0nxcLkKQ-l1AT8Q50rDDx0W_0ysL3iJ52_WTgpMb3Ku7PWeEP5TvSpGkOsuPWsGmBWRH4EuCq20o4PuetIAqb0PYcL/s1600/2012-04-02+12h54_40.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Ok, we&#39;ve built our foundation. Now lets write a procedure to email the results of the query, as HTML.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;exec msdb.dbo.sp_send_dbmail&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; @from_address = &#39;me@here.com&#39;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; @recipients = &#39;you@there.com&#39;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; @subject = &#39;That report you wanted&#39;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; @body = &#39;&amp;lt;h1&amp;gt;This appears before the HTML table and can be HTML as well.&amp;lt;/h1&amp;gt;&amp;lt;br/&amp;gt;&#39;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; @query_result_header = 0,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; @execute_query_database = &#39;your_db_name_here&#39;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; @query = &#39;exec dbo.sample_report 1&#39;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; @body_format = &#39;HTML&#39;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;And that&#39;s it! &amp;nbsp;We can now email the results of a query very easily as a nice HTML table. Here&#39;s what our sample looks like:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIEko_Ixsa_7UIidvpM_5ZAsaGJ_yBkGPbw76xlEM2ozzU33jEn_4-FgbR3QovROJcFG4Iy3u4mnoUzUzMcubbZGBeI_VbkwIkPap6B5tvnrCwqy2qOWg6zRlRbmeNWfmDjEnVa2eNiH0h/s1600/2012-04-02+13h10_32.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;92&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIEko_Ixsa_7UIidvpM_5ZAsaGJ_yBkGPbw76xlEM2ozzU33jEn_4-FgbR3QovROJcFG4Iy3u4mnoUzUzMcubbZGBeI_VbkwIkPap6B5tvnrCwqy2qOWg6zRlRbmeNWfmDjEnVa2eNiH0h/s640/2012-04-02+13h10_32.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robrbecker.blogspot.com/feeds/8598974604026634511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://robrbecker.blogspot.com/2012/04/generating-and-emailing-html-reports.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4839943535001876851/posts/default/8598974604026634511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4839943535001876851/posts/default/8598974604026634511'/><link rel='alternate' type='text/html' href='http://robrbecker.blogspot.com/2012/04/generating-and-emailing-html-reports.html' title='Generating and emailing HTML reports from SQL Server'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/09659696469541041435</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHqIUf9IYKTmWSytOwRdX6fpLjS5fXzqFI1YdDHiAOP39N2EjJPcjSnOCx8ab5Do3-B-669dwyyMyt9d3q120vMa0zDQoH0VDlLxD3I8kMEsYJg-LSh_HcB2deI7RyTz7BgDrd_D4fSJ8g/s72-c/2012-04-02+12h22_41.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4839943535001876851.post-8567069021050629020</id><published>2012-02-09T09:51:00.000-08:00</published><updated>2012-02-09T09:51:55.380-08:00</updated><title type='text'>The US patent system</title><content type='html'>I have 3 kids. They are wonderful and give me tons of joy. &amp;nbsp;But sometimes they fight over things and there is yelling, crying, hurt feelings, etc. &amp;nbsp;That stinks and it hurts my ears.&lt;br /&gt;
&lt;br /&gt;
An analogy occurred to me today that the US patent system, since it is funded by the number of patents that are applied for, are in the business of getting as many people or companies to apply for patents as possible. If they spend a lot of time researching and actually determining if a patent is valid or not they get paid the same. So why spend a lot of time on a patent? There&#39;s no reason to actually think about it because the faster they decide on a patent the faster they can move on to the next patent. &amp;nbsp;They get paid faster and make more money.&lt;br /&gt;
&amp;nbsp;They shovel the decision of who actually gets that patent over to the judicial system where it costs exponentially more to determine who wins. &amp;nbsp;All of those costs are rolled in to the winners final product to recoup costs and the cost goes up for consumers. Lawyers win, consumers lose.
&lt;br /&gt;
&lt;br /&gt;
As a parent, it&#39;s like promising all of my children that they can have a cookie even though there is only one left. Then I let them fight it out to see who gets it. Is that the best way to handle it? Maybe I should put a little more thought into this and avoid the fighting and crying. Maybe if the patent office was able to hear all of the crying and fighting, and it affected them&amp;nbsp;negatively, they would be inclined to avoid causing that racket. How about some&amp;nbsp;repercussions&amp;nbsp;if they make a bad decision?&lt;br /&gt;
&lt;br /&gt;
Let me know your thoughts. How can we make this better? What can we do to be heard? Leave a comment or hit me up on &lt;a href=&quot;https://plus.google.com/u/0/110216661905393804108/&quot;&gt;G+&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robrbecker.blogspot.com/feeds/8567069021050629020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://robrbecker.blogspot.com/2012/02/us-patent-system.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4839943535001876851/posts/default/8567069021050629020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4839943535001876851/posts/default/8567069021050629020'/><link rel='alternate' type='text/html' href='http://robrbecker.blogspot.com/2012/02/us-patent-system.html' title='The US patent system'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/09659696469541041435</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4839943535001876851.post-1409931108794332804</id><published>2011-12-13T11:54:00.000-08:00</published><updated>2011-12-13T11:54:19.162-08:00</updated><title type='text'>Chrome seasoned with Salt &amp; Pepper</title><content type='html'>I&#39;m not gonna lie. I&#39;m getting pretty excited for&lt;a href=&quot;https://developers.google.com/native-client/&quot;&gt; Native Client&lt;/a&gt; in Google Chrome. The thought that I can suddenly use tons of libraries that have been tested and worked on for ages in the browser raises the hair on my neck. I&#39;ve been searching for a way to generate files on the client side in my web app. It might soon be possible to use iTextSharp in Chrome to create PDF files in a webapp without a trip to the server and a lengthy download. Or imagine the image and audio libraries that are instantly usable without porting to javascript. &amp;nbsp;This is the kind of excitement once felt when you realized the Java virtual machine allowed you to write code that would run &quot;everywhere&quot;. Then MS created their Common Intermediate Language. It was very exciting that you could compile more than one language to run on the same VM.&lt;br /&gt;
&amp;nbsp; Now NaCl has the possibility to be *the* intermediate language of the web. &amp;nbsp;You can think of it sidestepping the java plugin, or taking over where ActiveX left of. It has the benefit of leveraging tons of existing code for the web. There&#39;s nothing stopping Google or anyone from compiling or transpiling any and all languages to be used in NaCl. Think C, C++, C#. &amp;nbsp;Why not &lt;a href=&quot;http://www.dartlang.org/&quot;&gt;Dart&lt;/a&gt;, javascript, &lt;a href=&quot;http://golang.org/&quot;&gt;Go&lt;/a&gt;, Java?&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; In my mind, this is going to be HUGE. Use what language you love. It&#39;s all web. That&#39;s what I call open.</content><link rel='replies' type='application/atom+xml' href='http://robrbecker.blogspot.com/feeds/1409931108794332804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://robrbecker.blogspot.com/2011/12/chrome-seasoned-with-salt-pepper.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4839943535001876851/posts/default/1409931108794332804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4839943535001876851/posts/default/1409931108794332804'/><link rel='alternate' type='text/html' href='http://robrbecker.blogspot.com/2011/12/chrome-seasoned-with-salt-pepper.html' title='Chrome seasoned with Salt &amp; Pepper'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/09659696469541041435</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4839943535001876851.post-6432359150876270846</id><published>2011-10-14T07:43:00.000-07:00</published><updated>2011-10-14T07:43:31.976-07:00</updated><title type='text'>Some coffee math...</title><content type='html'>Seriously, WTF is with Starbucks &quot;reward&quot; card? &amp;nbsp;I have to buy 30 drinks within a year to get to the gold level and &lt;b&gt;THEN&lt;/b&gt;&amp;nbsp;another 15 just to get my first free coffee! That&#39;s 45 visits to a Starbucks to get 1 free drink. &amp;nbsp;All I have to say is WOW. &lt;br /&gt;
&lt;br /&gt;
Let&#39;s assume I buy a Pikes Place roast tall coffee which is one of the cheaper items on the menu. &amp;nbsp;45 x 1.85 = $83.25. &amp;nbsp;Or if I buy a triple grande mocha each time that&#39;s roughly $222 to get 1 free drink. Ouch. That&#39;s not what I call free. It sure makes Tully&#39;s buy 8 get the 9th free deal groundbreaking.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robrbecker.blogspot.com/feeds/6432359150876270846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://robrbecker.blogspot.com/2011/10/some-coffee-math.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4839943535001876851/posts/default/6432359150876270846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4839943535001876851/posts/default/6432359150876270846'/><link rel='alternate' type='text/html' href='http://robrbecker.blogspot.com/2011/10/some-coffee-math.html' title='Some coffee math...'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/09659696469541041435</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>