tag:blogger.com,1999:blog-41852300170320042082024-02-06T22:39:38.518-08:00Jason GoemaatJGoemathttp://www.blogger.com/profile/02285352433143051126noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-4185230017032004208.post-24012976243440133932018-04-21T16:19:00.000-07:002018-04-21T18:07:05.304-07:00Foil-wrapped chicken
<section style="display: flex; flex-wrap: wrap; justify-content: space-around">
<div style="width: 360px; display: flex; align-items: center; flex-direction: column; justify-content: center">
<h2>9 oz chicken breast</h2>
<p>
I ran across this recipe on several sites and it's easy to make and healthy. The only thing you might worry about is the high cholesterol, but it has zero saturated fat and tons of protein. All you really need to do is wrap boneless and skinless chicken breast and vegetables in foil and cook at 425 degrees for about 40 minutes. Thicker breasts may take a little more time and thinner a little less. The chicken and vegetables are steamed in the foil with the water from the chicken.
</p>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<a href="https://fthmb.tqn.com/28WUGKLgXiHH1HSBtZXENY11Yio=/1000x0/Nutrition-Label-Embed--1583873302-5adbc459edc08f00367dc807.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;">
<img border="0" data-original-height="800" data-original-width="408" height="320" src="https://fthmb.tqn.com/28WUGKLgXiHH1HSBtZXENY11Yio=/1000x0/Nutrition-Label-Embed--1583873302-5adbc459edc08f00367dc807.png"/>
</a>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwO3LUltQPl5r7klq31ZWBMV2nhXSAC46YoxAB6xr2UAIEEIWdRbUzzy11JFtyVvyiElBrZWjMVwpKT8i8Tp-_d6j1aJ9n7ZnxZ_1v3EXNV2Je3WwkDzW0369GhOHcVA1OttH5xk5pTGwi/s1600/IMG_5651.JPG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwO3LUltQPl5r7klq31ZWBMV2nhXSAC46YoxAB6xr2UAIEEIWdRbUzzy11JFtyVvyiElBrZWjMVwpKT8i8Tp-_d6j1aJ9n7ZnxZ_1v3EXNV2Je3WwkDzW0369GhOHcVA1OttH5xk5pTGwi/s320/IMG_5651.JPG" width="320" height="240" data-original-width="1600" data-original-height="1200" /></a>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column; justify-content: center">
<p>
I use a little garlic-flavored olive oil on the bottom. Some recipes recommend it to keep the chicken from sticking, but since the juices collect there I don't know if it's necessary. A little garlic salt and kosher solt on top, then add some vegetables (88g asparagus and 2x100g broccoli here)
</p>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpQcu8TrzmEorNJxlh3egEwn2OF_dF2W5zCjVc-sO-J4sYM4dighAWV2kWb8JpbQ_3FyKx90WdwMHlF3Fcq1zN7iPu2nXdaxi9nB5N_Wz36_zAXXWObgAERlPijd0cTNyqx9gB30RjPRH-/s1600/IMG_5652.JPG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpQcu8TrzmEorNJxlh3egEwn2OF_dF2W5zCjVc-sO-J4sYM4dighAWV2kWb8JpbQ_3FyKx90WdwMHlF3Fcq1zN7iPu2nXdaxi9nB5N_Wz36_zAXXWObgAERlPijd0cTNyqx9gB30RjPRH-/s320/IMG_5652.JPG" width="320" height="240" data-original-width="1600" data-original-height="1200" /></a>
<p>A little olive oil</p>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmxLY05XS7O6exOV50197foByVk-iTMKWW3QmfoSNMkyPy2eFJEZ8VrJ4rfL0BNtyA2bSeDir_d6iE0y5IfVSohvJZ12vT8sgHw_9Rx8GEpOjK9LZWSpi3T5rVudnL9MdbZGE5q6rbwxfn/s1600/IMG_5653.JPG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmxLY05XS7O6exOV50197foByVk-iTMKWW3QmfoSNMkyPy2eFJEZ8VrJ4rfL0BNtyA2bSeDir_d6iE0y5IfVSohvJZ12vT8sgHw_9Rx8GEpOjK9LZWSpi3T5rVudnL9MdbZGE5q6rbwxfn/s320/IMG_5653.JPG" width="320" height="240" data-original-width="1600" data-original-height="1200" /></a>
<p>Use the chicken to smear the olive oil around</p>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgauinubq3-Alz-As-Zdh0ex5swQhyphenhyphenU-zgjymnxC16EUw4sLroOZmDnLONV8fYMHds1-sIXVFBNdgJJhFC3wSRVkjwcZ6WzfTU8k2MUVmbmIStt3p_X6spUU5ueUqXl-Si1wFkEbEkDamka/s1600/IMG_5655.JPG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgauinubq3-Alz-As-Zdh0ex5swQhyphenhyphenU-zgjymnxC16EUw4sLroOZmDnLONV8fYMHds1-sIXVFBNdgJJhFC3wSRVkjwcZ6WzfTU8k2MUVmbmIStt3p_X6spUU5ueUqXl-Si1wFkEbEkDamka/s320/IMG_5655.JPG" width="320" height="240" data-original-width="1600" data-original-height="1200" /></a>
<p>Sprinkle on some garlic salt and kosher salt</p>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPlEIOTQNZwGibZQI3kyCdJNs8dwf9G4p0UBNNxAxA3dLxZ-lzlQAPw6DQB7SVjJfcXjkCPwSImH7P4yWlUYiHjQe28egPRCTka1lerzkLYQPjWMzzVkqt3XWpoEmQ3acSFmxa5VhyphenhyphenNcmY/s1600/IMG_5656.JPG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPlEIOTQNZwGibZQI3kyCdJNs8dwf9G4p0UBNNxAxA3dLxZ-lzlQAPw6DQB7SVjJfcXjkCPwSImH7P4yWlUYiHjQe28egPRCTka1lerzkLYQPjWMzzVkqt3XWpoEmQ3acSFmxa5VhyphenhyphenNcmY/s320/IMG_5656.JPG" width="320" height="240" data-original-width="1600" data-original-height="1200" /></a>
<p>Top with veggies</p>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLCr9pk-XsOFkeFoY3vi69ZfjbK9LVuhJhCEN80Vz-ff_rOmab1S1uHGjfn_Us6jdsQumabEDPhEZj5ZsCSSEnaV3ldhw0NCq1Z-RhuatOBQPekF0FxXLV8lFwEQScTPbxlDhkwuUTduAM/s1600/IMG_5657.JPG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLCr9pk-XsOFkeFoY3vi69ZfjbK9LVuhJhCEN80Vz-ff_rOmab1S1uHGjfn_Us6jdsQumabEDPhEZj5ZsCSSEnaV3ldhw0NCq1Z-RhuatOBQPekF0FxXLV8lFwEQScTPbxlDhkwuUTduAM/s320/IMG_5657.JPG" width="320" height="240" data-original-width="1600" data-original-height="1200" /></a>
<p>Fold sideways, one side then the other</p>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVuoY8Zi6i79Bq3GvBU56UYiY4TWM3abrP0da71SUNEEwb_Nb10aY1KqBGLQePxW23HZQsb9CrcqBE_NOCri1XY1wB3slm39u_-S2DouKSE7sGYVupOO2yp43nF1O1uYr37JMcAzaRrzlS/s1600/IMG_5658.JPG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVuoY8Zi6i79Bq3GvBU56UYiY4TWM3abrP0da71SUNEEwb_Nb10aY1KqBGLQePxW23HZQsb9CrcqBE_NOCri1XY1wB3slm39u_-S2DouKSE7sGYVupOO2yp43nF1O1uYr37JMcAzaRrzlS/s320/IMG_5658.JPG" width="320" height="240" data-original-width="1600" data-original-height="1200" /></a>
<p>Roll up the ends to try and get a good seal, and preheat oven to 425</p>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNwl6rS6YKB5NzjUTjBgvRHIZVn8XtnFG_FI07EHVMGI0PoRmGJsbYYVv7MSnAsHBJfkeOqNorfMZaZTxl-rlzrO2Ckaw_DM3M7-Lg-rsiyB-c_FwHtlPPv41vABTW4clJa_tnq4GYWQY_/s1600/IMG_5661.JPG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNwl6rS6YKB5NzjUTjBgvRHIZVn8XtnFG_FI07EHVMGI0PoRmGJsbYYVv7MSnAsHBJfkeOqNorfMZaZTxl-rlzrO2Ckaw_DM3M7-Lg-rsiyB-c_FwHtlPPv41vABTW4clJa_tnq4GYWQY_/s320/IMG_5661.JPG" width="240" height="320" data-original-width="1200" data-original-height="1600" /></a>
<p>Cook for 40 minutes</p>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3pVTIS_rdpHiWbiPDb7hrMVFeSWQqFpiBkoUQUe1Pfm5nxpnJn0C1zoDVs3DHqasdoZpVJ1MpFK4yZrKvT1uy4v-hJQeCjfCc5qizMNPm5rlYYNnPzGA_NiWMr6-nKWZPdzk2UXxKp67G/s1600/IMG_5662.JPG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3pVTIS_rdpHiWbiPDb7hrMVFeSWQqFpiBkoUQUe1Pfm5nxpnJn0C1zoDVs3DHqasdoZpVJ1MpFK4yZrKvT1uy4v-hJQeCjfCc5qizMNPm5rlYYNnPzGA_NiWMr6-nKWZPdzk2UXxKp67G/s320/IMG_5662.JPG" width="320" height="240" data-original-width="1600" data-original-height="1200" /></a>
<p>Be careful opening it, the steam will want to come out</p>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4mEI2ET0f1P1XQ2U5hpYM2f9L50TZBZrXOSBtNturoSzA7PxZyLBKufqOcIx1OA-mx3_fy5ncntj3BUHyPOnMF6AbQrPqwEg_w2-W4i1jfV07mdCOh-1kEBcZsHIEFca6nUD7BKhCgM71/s1600/IMG_5663.JPG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4mEI2ET0f1P1XQ2U5hpYM2f9L50TZBZrXOSBtNturoSzA7PxZyLBKufqOcIx1OA-mx3_fy5ncntj3BUHyPOnMF6AbQrPqwEg_w2-W4i1jfV07mdCOh-1kEBcZsHIEFca6nUD7BKhCgM71/s320/IMG_5663.JPG" width="240" height="320" data-original-width="1200" data-original-height="1600" /></a>
<p>Asparagus might be slightly overcooked, but tasted good to me</p>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMABAT6kgGRABwHCah1_xhycqKSKOnQpFj5kw3OhJEMROwn1NsFsPYdt2bc8gQwCcD-9K3fjADokBRh1-IvgWwR3Mnb91uz4IjOsoFr50DxrfZ7qbvd1hUBzxuA6AlCRlyv0Fqg4KdoX62/s1600/IMG_5664.JPG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMABAT6kgGRABwHCah1_xhycqKSKOnQpFj5kw3OhJEMROwn1NsFsPYdt2bc8gQwCcD-9K3fjADokBRh1-IvgWwR3Mnb91uz4IjOsoFr50DxrfZ7qbvd1hUBzxuA6AlCRlyv0Fqg4KdoX62/s320/IMG_5664.JPG" width="240" height="320" data-original-width="1200" data-original-height="1600" /></a>
<p>Broccoli</p>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjidFQDVZizr3DV5kwoVeMrxV25Fh5WFkWpyAu-DRqez-s_qCjodGVN-fozQOdXl925USb1asnjBA8OyvJlQg0jKxvUD2REz7vcZzysXSV_NoSS1cm6EfnyaVjBXs8Iq_bln92TAW4F4qxB/s1600/IMG_5665.JPG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjidFQDVZizr3DV5kwoVeMrxV25Fh5WFkWpyAu-DRqez-s_qCjodGVN-fozQOdXl925USb1asnjBA8OyvJlQg0jKxvUD2REz7vcZzysXSV_NoSS1cm6EfnyaVjBXs8Iq_bln92TAW4F4qxB/s320/IMG_5665.JPG" width="240" height="320" data-original-width="1200" data-original-height="1600" /></a>
<p>Some broccoli bits left on the chicken, kinda liked that actually, and broccoli tasted great</p>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjidFQDVZizr3DV5kwoVeMrxV25Fh5WFkWpyAu-DRqez-s_qCjodGVN-fozQOdXl925USb1asnjBA8OyvJlQg0jKxvUD2REz7vcZzysXSV_NoSS1cm6EfnyaVjBXs8Iq_bln92TAW4F4qxB/s1600/IMG_5665.JPG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjidFQDVZizr3DV5kwoVeMrxV25Fh5WFkWpyAu-DRqez-s_qCjodGVN-fozQOdXl925USb1asnjBA8OyvJlQg0jKxvUD2REz7vcZzysXSV_NoSS1cm6EfnyaVjBXs8Iq_bln92TAW4F4qxB/s320/IMG_5665.JPG" width="240" height="320" data-original-width="1200" data-original-height="1600" /></a>
<p>Some broccoli bits left on the chicken, kinda liked that actually, and broccoli tasted great</p>
</div>
<div style="width: 360px; display: flex; align-items: center; flex-direction: column">
<iframe width="340" height="240" src="https://www.youtube.com/embed/Nek-sqU7tYQ" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
<p>Juicy, tender chicken you can cut with a fork</p>
</div>
</section>
<section>
The USRDA for protein is 0.8g/kg body weight, which for me at 210lb is 76g protein. This one meal is 75% of that. If you're working out and trying to gain muscle, a <a href="https://www.bodybuilding.com/fun/calpro.htm">few</a> <a href="https://www.bodybuilding.com/fun/built-by-science-protein-calculator.html">calculators</a> and <a href="https://www.muscleforlife.com/how-much-protein-build-muscle/">sites</a> I found online recommend between 0.8 and 1.2 grams per pound, so that would be 210g of protein a day. 3 of these and a protein shake are enough to make that, I'd just have to find a way to come up with another 1500 calories :)
</section>
<br />JGoemathttp://www.blogger.com/profile/02285352433143051126noreply@blogger.com0tag:blogger.com,1999:blog-4185230017032004208.post-48478098946896438132017-01-30T12:56:00.003-08:002017-01-30T12:56:56.551-08:00Using SWProxy for summoners warFirst you need to install <a href="https://git-scm.com/download/win">git</a> (or the <a href="https://desktop.github.com/">gui github</a> desktop). Then you can clone the code from <a href="https://github.com/kakaroto/SWProxy">https://github.com/kakaroto/SWProxy</a>. Then you can clone the repository in the GUI or from the command line:
<br />
<br />
<code>
git clone https://github.com/kakaroto/SWProxy.git
</code>
<br />
<br />
Now you have to have <a href="https://www.python.org/downloads/">python 2.7</a> and <a href="https://pip.pypa.io/en/stable/installing/">pip</a> installed (best to leave default directory of c:\python27). Pip should be installed automatically as of 2.7.9 and higher, but I did it a while ago and had to install it manually.
<br />
<br />
You need to be able to run python and pip from the command line. You can run "python --version" and "pip --version" to see if they are in your path, otherwise you need to add "C:\python27" and "C:\python27\scripts" to your path.
<br />
<br />
Next you need to install <a href="https://www.microsoft.com/en-us/download/details.aspx?id=44266">Microsoft Visual C++ Compiler for Python 2.7</a>. This is required for one of the encryption packages you'll install next with pip because it compiles some C++ code. After installing that you can install the pip packages required with this:
<br />
<br />
<code>pip install pycrypto dpkt yapsy</code>
<br />
<br />
To use the proxy your computer has to be attached to the same access point as your phone (unless you setup the routing yourself, but then you don't need to be reading this :)). Check your computer's ip address by running "ipconfig". You should see a wifi adapter with an address like 192.168.1.101:
<br />
<br />
<pre> IPv4 Address. . . . . . . . . . . : 192.168.1.101
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
</pre>
<br />
<br />
Now you're ready to run the proxy. Go to the folder with the code in it and run "python SWProxy.py". It should start and tell you the ip address and port it is running on:
<br />
<br />
<pre>########################################
# SWParser v0.100 - Summoners War Proxy #
########################################
Written by:
KaKaRoTo
Authors:
Youness Alaoui
Leonardo Stern
Azrethos
Plugins:
Generate Visit Friend
Demo Plugin
SWARFARM Export Plugin
Generate Runes
Print Unit Collection
Barion Rune Efficiency Plugin
Licensed under LGPLv3 and available at:
https://github.com/kakaroto/SWProxy
Failed to load GUI dependencies. Switching to CLI mode
Running Proxy server at 192.168.1.101 on port 8080</pre>
<br />
<br />
Now on your phone make sure you're connected to the same wifi access point as your computer and change the settings of the access point to use the proxy 192.168.1.101 (or whatever your ip address is) and port 8080. Then kill your game and restart it or log out and back in. The login packet has all your account data and will produce several files, these are mine:
<br />
<br />
<pre>-rw-r--r-- 1 Jason 197609 2581564 Jan 29 17:35 6202709.json
-rw-r--r-- 1 Jason 197609 714 Jan 29 17:35 6202709-info.csv
-rw-r--r-- 1 Jason 197609 35236 Jan 29 17:35 6202709-monsters.csv
-rw-r--r-- 1 Jason 197609 852821 Jan 29 17:35 6202709-optimizer.json
-rw-r--r-- 1 Jason 197609 91540 Jan 29 17:35 6202709-runes.csv
-rw-r--r-- 1 Jason 197609 696553 Jan 29 17:35 6202709-swarfarm.json</pre>
<br />
<br />
When you visit another player you will get lists for them too but they have much less data:
<br />
<br />
<pre>-rw-r--r-- 1 Jason 197609 942112 Jan 29 17:36 visit-2403436.json
-rw-r--r-- 1 Jason 197609 47097 Jan 29 17:36 visit-2403436-monsters.csv
-rw-r--r-- 1 Jason 197609 931956 Jan 29 17:36 visit-2913465.json
-rw-r--r-- 1 Jason 197609 45451 Jan 29 17:36 visit-2913465-monsters.csv
-rw-r--r-- 1 Jason 197609 1741862 Jan 29 17:35 visit-3563695.json
-rw-r--r-- 1 Jason 197609 88550 Jan 29 17:35 visit-3563695-monsters.csv</pre>
JGoemathttp://www.blogger.com/profile/02285352433143051126noreply@blogger.com0tag:blogger.com,1999:blog-4185230017032004208.post-58046746580490456262015-09-08T12:24:00.000-07:002015-09-08T12:24:48.766-07:00C# Bouncy Castle File DecryptionI had a hard time finding a good sample of decrypting a PGP-encrypted file in C# so I decided to write this post.<br />
<br />
Bouncy Castle works with streams for the most part. So first you need to open the file as a stream, then get a special decoder stream using PgpUtilities:<br />
<br />
<pre><code class="csharp">// Comment
using (FileStream fsEncryptedFile = File.Open(ENCRYPTED_FILENAME, FileMode.Open)) {
using (Stream decoderStream = PgpUtilities.GetDecoderStream(fsEncryptedFile))
{
</code></pre>
Next we have to create a PgpObjectFactory using that stream which will provide us with PgpObjects. We're looking for a PgpEncryptedDataList so we might have to skip the first object which could be a marker:
<pre><code>PgpObjectFactory factory = new PgpObjectFactory(decoderStream);
PgpObject obj = factory.NextPgpObject();
if (!(obj is PgpEncryptedDataList))
{
obj = factory.NextPgpObject(); // first object might be a PGP marker packet
}
PgpEncryptedDataList edl = obj as PgpEncryptedDataList;
</code></pre>
With our PgpEncryptedDataList we find PgpPublicKeyEncryptedData, and find the key. Here we open a secret keyring file and find the key based on the KeyId in the data and decrypt it using a passphrase:
<pre><code>PgpEncryptedDataList edl = obj as PgpEncryptedDataList;
foreach (PgpPublicKeyEncryptedData data in edl.GetEncryptedDataObjects())
{
PgpPrivateKey privateKey = null;
using (FileStream fsKeyring = File.Open(KEYRING_FILENAME, FileMode.Open))
{
PgpSecretKeyRingBundle bundle = new PgpSecretKeyRingBundle(fsKeyring );
PgpSecretKey secretKey = bundle.GetSecretKey(data.KeyId);
privateKey = secretKey.ExtractPrivateKey(PASSPHRASE.ToCharArray());
}
</code></pre>
Next we use GetDataStream on our PgpPublicKeyEncryptedData and pass it our private key and create a PgpObjectFactory that will give us our data. If the object is compressed, we uncompress it:
<pre><code>PgpObjectFactory plainFactory = new PgpObjectFactory(data.GetDataStream(privateKey));
PgpObject message = plainFactory.NextPgpObject();
if (message is PgpCompressedData) {
message = new PgpObjectFactory(((PgpCompressedData)message).GetDataStream()).NextPgpObject();
}
</code></pre>
Hopefully that will give us a PgpLiteralData which is what we need to get a stream containing the plain, unencrypted data and write that to a new file:
<pre><code>if (message is PgpLiteralData) {
PgpLiteralData ld = (PgpLiteralData)message;
using (FileStream outStream = File.Create(OUTPUT_FILENAME)) {
Stream inStream = ld.GetInputStream();
byte [] buffer = new byte[0x100000];
int count = inStream.Read(buffer, 0, buffer.Length);
while (count > 0) {
outStream.Write(buffer, 0, count);
count = inStream.Read(buffer, 0, buffer.Length);
}
outStream.Close();
}
} else {
Console.WriteLine("ERROR: Unknown type of message in PGP file: {0}", message.GetType().FullName);
}
</code></pre>JGoemathttp://www.blogger.com/profile/02285352433143051126noreply@blogger.com0tag:blogger.com,1999:blog-4185230017032004208.post-20221953444536207752011-08-11T14:36:00.000-07:002011-08-11T14:36:03.847-07:00Near Miss Pedantry"Near miss" is a correct term to describe something that comes close to hitting something else. I hate it when people say that "near miss" would really be a collision. The most common meaning of near means close, usually in space. If I am shooting at a target and I got close to it but didn't quite hit it, that would both be a miss and it would be near the target, therefore it would be a "near miss". If I had missed way off to the side, it would be a "far miss". You could say "The miss was near the target", so why can't you call it a "near miss"?<br />
<br />
If you have a low ceiling you might say "The ceiling is near". You could say it was a "near ceiling". It would be a stretch to interpret this as meaning "It is almost a ceiling, but not quite."<br />
<br />
Why do so many pedants skip to <a href="http://dictionary.reference.com/browse/near">the fifth definition</a> when complaining about this term? <br />
<br />
<br />
JGoemathttp://www.blogger.com/profile/02285352433143051126noreply@blogger.com0tag:blogger.com,1999:blog-4185230017032004208.post-60070053218854630292011-07-19T02:10:00.000-07:002011-07-19T02:10:16.366-07:00Intellisense for Google Closure Library in VS 2010 (MVC)Visual Studio examines your javascript to provide intellisense, and lets you <a href="http://msdn.microsoft.com/en-us/library/bb385682.aspx#AdditionalResources">add references</a> to other javascript files to pull info from. To get closure classes to show up I created a plovr config and did a grep of the whole closure library to find goog.provide calls and converted them to goog.require calls. Then I did a build to include all the code for closure, resulting in <a href="https://sites.google.com/site/jasongoemaatblog/files/Test.7z?attredirects=0&d=1">Test.7z (534kb)</a>. It contains the following files:<br />
<br />
<ul><li><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">Test\test-config.js</span>: plovr config file, uncomment the module you want to build and run through plovr</li>
<li><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">Test\test.js</span>: goog.require for entire closure library</li>
<li><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">Test\test2.js</span>: missing requires for gears, crypt, test, and some others I'll never use</li>
<li><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">Test\test3.js</span>: also missing goog.ui.editor</li>
<li><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">Test\closure_complete.js</span>: built from test.js, 4.1mb</li>
<li><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">Test\closure_mostly.js</span>: built from test2.js, 2.6mb</li>
<li><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">Test\closure_noeditor.js</span>: built from test3.js, 2.4mb</li>
</ul><div>The easiest way to use them would be to unpack in your Content directory and add this line to the top of your javascript files (has to be the first thing):</div><div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">/// <reference path="~/Content/Test/closure_mostly.js"></span></div></div><div class="separator" style="clear: both; text-align: -webkit-auto;"><br />
</div><div class="separator" style="clear: both; text-align: -webkit-auto;">Note: you don't have to add the files to your project, but it uses the same url pathing as if they were part of your web site.</div><div class="separator" style="clear: both; text-align: -webkit-auto;"><br />
</div><div class="separator" style="clear: both; text-align: -webkit-auto;">You could also just build your project in WHITESPACE mode and use the generated file. If you use SIMPLE mode, the closure compiler will shorten your parameter names. If you use ADVANCED mode the closure compiler would shorten all the names and wouldn't even include code you didn't use.</div><div><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9vCmJ1XwpeFtdQHtjHQ6MW3J0GZ7b6ZlyUqZ-NiDEMt6RSQEdsT_ODvHdDGMh2ZY5kQPycoWdwNtABVcSKsSYu0gBxsVKCXmsRZzVSiVtAnGBoHYDKiGhIqEmLKYT6vYW49_6chZo5qY4/s1600/test1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9vCmJ1XwpeFtdQHtjHQ6MW3J0GZ7b6ZlyUqZ-NiDEMt6RSQEdsT_ODvHdDGMh2ZY5kQPycoWdwNtABVcSKsSYu0gBxsVKCXmsRZzVSiVtAnGBoHYDKiGhIqEmLKYT6vYW49_6chZo5qY4/s320/test1.png" width="320" /></a></div><div><br />
</div><div><br />
</div>JGoemathttp://www.blogger.com/profile/02285352433143051126noreply@blogger.com3tag:blogger.com,1999:blog-4185230017032004208.post-62200397158389052762011-07-04T13:58:00.000-07:002011-07-04T13:59:54.916-07:00Building PLOVR on WindowsI wanted to add options to <a href="http://www.plovr.com/">plovr</a>, specifically the ability to output a property map to use for interacting with my server using JSON. <br />
<br />
<span class="Apple-style-span">First I installed <a href="http://mercurial.selenic.com/downloads/">Mercurial</a> which is needed to get the plovr source code. I installed it to </span><span class="Apple-style-span" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; font-size: 12px;">I:\Programs\Mercurial </span><span class="Apple-style-span">and added that to my path.</span><br />
<br />
Next I got the <a href="http://code.google.com/p/plovr/source/checkout">plovr source code</a>:<br />
<span class="Apple-style-span" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; font-size: 12px;">I:\plovr\SRC>hg clone https://plovr.googlecode.com/hg/ plovr</span><br />
<br />
I saw it had a build.xml file so I downloaded <a href="http://ant.apache.org/bindownload.cgi">apache ant</a> and unzipped it to <span class="Apple-style-span" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; font-size: 12px;">I:\Programs\apache-ant-1.8.2</span>, adding <span class="Apple-style-span" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; font-size: 12px;">I:\Programs\apache-ant-1.8.2\bin</span> to my path also.<br />
<br />
Building produced an error that bash wasn't found, so I downloaded <a href="http://www.mingw.org/wiki/MSYS">MSYS</a> (MinGW not needed) and installed it to <span class="Apple-style-span" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; font-size: 12px;">I:\Programs\msys\1.0</span>.<br />
<br />
Then I just started an msys shell and did:<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ cd /i/plovr/src/plovr</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ ant</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: inherit;">And voila - </span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">/i/plovr/SRC/plovr/build/plovr.jar</span><span class="Apple-style-span" style="font-family: inherit;"> (</span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">i:\plovr\SRC\plovr\build\plovr.jar</span>) is now there!JGoemathttp://www.blogger.com/profile/02285352433143051126noreply@blogger.com2tag:blogger.com,1999:blog-4185230017032004208.post-31909030895817554982011-06-17T13:19:00.000-07:002011-06-17T13:19:45.785-07:00MiniProfiler with PetaPocoIntegrating <a href="http://www.toptensoftware.com/petapoco/">PetaPoco</a> with <a href="http://code.google.com/p/mvc-mini-profiler/">Mvc Mini Profiler</a> can be done by changing a few lines in PetaPoco.cs to wrap the connection with a MvcMiniProfiler.Data.ProfiledDbConnection and by changing a line that gets a command using the factory to use the connection. I've written a simple DbProviderFactory that acts as a proxy to the SQL Server factory so you don't have to make any changes to PetaPoco. You register it by adding a system.data element under the root configuration element in your web.config to register the factory and change your connect strings to use the new provider:<br />
<br />
<pre style='color:#000000;background:#ffffff;'><span style='color:#7f0055; '><</span><span style='color:#7f0055; '>configuration</span><span style='color:#7f0055; '>></span>
<span style='color:#7f0055; '><</span><span style='color:#7f0055; '>system.data</span><span style='color:#7f0055; '>></span>
<span style='color:#7f0055; '><</span><span style='color:#7f0055; '>DbProviderFactories</span><span style='color:#7f0055; '>></span>
<span style='color:#7f0055; '><</span><span style='color:#7f0055; '>add</span> name=<span style='color:#0000ff; '>"</span><span style='color:#0000ff; '>MiniProfiler Data Provider</span><span style='color:#0000ff; '>"</span>
invariant=<span style='color:#0000ff; '>"</span><span style='color:#0000ff; '>MiniProfilerSql</span><span style='color:#0000ff; '>"</span>
description=<span style='color:#0000ff; '>"</span><span style='color:#0000ff; '>SqlServer wrapper for MiniProfiler</span><span style='color:#0000ff; '>"</span>
type=<span style='color:#0000ff; '>"</span><span style='color:#0000ff; '>WebSupport.Code.MiniProfilerSqlProviderFactory, WebSupport</span><span style='color:#0000ff; '>"</span>
<span style='color:#7f0055; '>/></span>
<span style='color:#7f0055; '></</span><span style='color:#7f0055; '>DbProviderFactories</span><span style='color:#7f0055; '>></span>
<span style='color:#7f0055; '></</span><span style='color:#7f0055; '>system.data</span><span style='color:#7f0055; '>></span>
<span style='color:#7f0055; '><</span><span style='color:#7f0055; '>connectionStrings</span><span style='color:#7f0055; '>></span>
<span style='color:#7f0055; '><</span><span style='color:#7f0055; '>add</span> name=<span style='color:#0000ff; '>"</span><span style='color:#0000ff; '>Test</span><span style='color:#0000ff; '>"</span> providerName=<span style='color:#0000ff; '>"</span><span style='color:#0000ff; '>MiniProfilerSql</span><span style='color:#0000ff; '>"</span> connectionString=<span style='color:#0000ff; '>"</span><span style='color:#0000ff; '>xxxx</span><span style='color:#0000ff; '>"</span> <span style='color:#7f0055; '>/></span>
<span style='color:#7f0055; '></</span><span style='color:#7f0055; '>connectionStrings</span><span style='color:#7f0055; '>></span>
</pre><br />
Notice in the type attribute that my class is in the WebSupport.Code namespace, the value after the comma shows that it is in the WebSupport assembly I have referenced in my MVC project. If you want to stop using MiniProfiler you can just change your connect strings back to using System.Data.SqlClient as the provider.<br />
<br />
Here's the code, you should be able to change it for other providers by changing the provider name in the constructor:<br />
<br />
<pre style='color:#000000;background:#ffffff;'><span style='color:#000084; font-weight:bold; '>public</span> <span style='color:#000084; font-weight:bold; '>class</span> MiniProfilerSqlProviderFactory : DbProviderFactory
{
<span style='color:#000084; font-weight:bold; '>public</span> <span style='color:#000084; font-weight:bold; '>static</span> MiniProfilerSqlProviderFactory Instance = <span style='color:#000084; font-weight:bold; '>new</span> MiniProfilerSqlProviderFactory();
DbProviderFactory _factory;
<span style='color:#000084; font-weight:bold; '>public</span> <span style='color:#000084; font-weight:bold; '>override</span> <span style='color:#000084; font-weight:bold; '>bool</span> CanCreateDataSourceEnumerator
{
get
{
<span style='color:#000084; font-weight:bold; '>return</span> _factory.CanCreateDataSourceEnumerator;
}
}
<span style='color:#000084; font-weight:bold; '>public</span> <span style='color:#000084; font-weight:bold; '>override</span> DbCommand CreateCommand()
{
<span style='color:#000084; font-weight:bold; '>return</span> _factory.CreateCommand();
}
<span style='color:#000084; font-weight:bold; '>public</span> <span style='color:#000084; font-weight:bold; '>override</span> DbCommandBuilder CreateCommandBuilder()
{
<span style='color:#000084; font-weight:bold; '>return</span> _factory.CreateCommandBuilder();
}
<span style='color:#000084; font-weight:bold; '>public</span> <span style='color:#000084; font-weight:bold; '>override</span> DbConnection CreateConnection()
{
DbConnection cnn = _factory.CreateConnection();
<span style='color:#000084; font-weight:bold; '>return</span> MvcMiniProfiler.Data.ProfiledDbConnection.Get(cnn);
}
<span style='color:#000084; font-weight:bold; '>public</span> <span style='color:#000084; font-weight:bold; '>override</span> DbConnectionStringBuilder CreateConnectionStringBuilder()
{
<span style='color:#000084; font-weight:bold; '>return</span> _factory.CreateConnectionStringBuilder();
}
<span style='color:#000084; font-weight:bold; '>public</span> <span style='color:#000084; font-weight:bold; '>override</span> DbDataAdapter CreateDataAdapter()
{
<span style='color:#000084; font-weight:bold; '>return</span> _factory.CreateDataAdapter();
}
<span style='color:#000084; font-weight:bold; '>public</span> <span style='color:#000084; font-weight:bold; '>override</span> DbDataSourceEnumerator CreateDataSourceEnumerator()
{
<span style='color:#000084; font-weight:bold; '>return</span> _factory.CreateDataSourceEnumerator();
}
<span style='color:#000084; font-weight:bold; '>public</span> <span style='color:#000084; font-weight:bold; '>override</span> DbParameter CreateParameter()
{
<span style='color:#000084; font-weight:bold; '>return</span> _factory.CreateParameter();
}
<span style='color:#000084; font-weight:bold; '>public</span> <span style='color:#000084; font-weight:bold; '>override</span> CodeAccessPermission CreatePermission(PermissionState state)
{
<span style='color:#000084; font-weight:bold; '>return</span> _factory.CreatePermission(state);
}
<span style='color:#000084; font-weight:bold; '>public</span> MiniProfilerSqlProviderFactory()
{
_factory = DbProviderFactories.GetFactory(<span style='color:#0000ff; '>"</span><span style='color:#0000ff; '>System.Data.SqlClient</span><span style='color:#0000ff; '>"</span>);
}
}
</pre>JGoemathttp://www.blogger.com/profile/02285352433143051126noreply@blogger.com0