tag:blogger.com,1999:blog-80993341587646232762024-03-05T01:42:48.516-05:00freegnuand other stuff tooDanyelLawsonhttp://www.blogger.com/profile/01014355362548295298noreply@blogger.comBlogger60125tag:blogger.com,1999:blog-8099334158764623276.post-81758282401832761542023-12-13T19:57:00.000-05:002023-12-13T19:57:04.525-05:00Climate Change and NYC Flooding<p> Climate Change and NYC Flooding</p><p><br /></p><p>True story:</p><p><br /></p><p>The west side highway and FDR drive used to be elevated. The elevated west side highway was an active railway with elevated exits for cars and trains right into buildings several avenues over into the city. Those were the exits and there were ramps down to the street. It was profitable for the city to destroy the elevated highways and railways and sell the steel for the elevated highway and extension exits. So they did. It's an island why wouldn't you elevate everything including the subway. Which used to be elevated train lines. Separate from the railways and highways. All worked just fine even when the city flooded. Climate change is a catch all excuse for the den of thieves we call our representatives to ask for more money to steal instead of spending our tax dollars on us.</p><p><br /></p><p>There was also a massive set of independently operated trolley systems that were connected from one sided of the country to the other and they honored each other's transfers coast to coast. Trolley lines that dropped you off down the street from your house all over all the cities of the US. There is a couple of documentaries about it that you can watch for free. How and Why Big Oil Conquered the World. https://www.corbettreport.com/bigoil/ </p><p><br /></p><p>Corbett has produced tons of documentaries on his site that explain how the world really works and why things are the way they are. We don't have to waste or lives scratching our heads like idiots wondering why when we know our actual history and all the facts.</p><p><br /></p><p>As a kid I loved riding in a car through buildings in Manhattan and riding in electric old timey cabs with extra fold up seats because of all the room in the back when a car doesn't waste all is space on an engine and gas tank. The electric trolley on 14th Street was a special treat.</p><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-25467135213369762592020-01-12T14:27:00.001-05:002021-04-19T19:13:58.129-04:00vscode you should know<p>search files<br />
ctrl+p <br />
type ? into search bar for help for other types of search<br />
<br />
search editor commands<br />
ctrl+shift+p or f1 or ctrl+p ><br />
<br />
move line or selection up/down<br />
alt+up/down<br />
<br />
duplicate line or selection above/below<br />
alt+shift+up/down<br />
<br />
peek definition<br />
alt+f12<br />
you can scroll and edit in the pop-up overlay<br />
<br />
goto definition<br />
f12<br />
<br />
add cursor at end of line or lines of selection<br />
ctrl+shift+i<br />
<br />
add cursor above below<br />
ctrl+alt+shift+up/down<br />
<br />
ctrl+`<br />
open and toggle terminal window<br />
<br />
ctrl+shit+`<br />
open a new terminal<br />
</p><p><a href="https://dev.to/simonpaix/10-useful-vs-code-shortcuts-you-should-know-42m">more here</a> <br /></p><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-55039424709232522242019-11-02T11:16:00.001-04:002020-02-05T19:37:26.421-05:00pycharm you should knowsearch everywhere - file names, commands names, and symbol names across project<br />
press shift key twice <br />
<br />
search for a pycharm command by name or abbreviation or parts<br />
ctrl+shift+a<br />
use a space to separate parts of a search(f s) file save (fs) should work too<br />
<br />
search for a file in the project space<br />
ctrl+shift+n<br />
<br />
open a recent file - searchable<br />
ctrl+e <br />
<br />
switch an open file or a open a panel<br />
ctrl+tab start from the top of the open files list<br />
ctrl+shift+tab start from the bottom of the panels list<br />
<br />
return focus to editor window<br />
esc<br />
<br />
return focus to editor window and close last active panel<br />
shif+esc <br />
<br />
quick documentation popup for current cursor or selection<br />
ctrl+q<br />
<br />
quick popup of source snippet for current cursor or selection<br />
ctrl+shit+i<br />
<br />
return focus to last<br />
navigate to previous or next edit location across files<br />
ctrl+alt+left ctrl+alt+right<br />
<br />
add a cursor AKA multi-cursor<br />
alt+left mouse click<br />
alt+shift+insert toggle multi-cursor mode for shifted selection<br />
<br />
add multiple cursors and rectangle selection<br />
alt+shift+left mouse click and drag<br />
use same selection method for rectangle pasting<br />
<br />
add an import automatically to the top of the file by selecting from a popupalt+enter<br />
use after typing the usage (datetime.datetime or just datetime)<br />
<br />
duplicate the current line or selection<br />
ctrl+d<br />
<br />
move the current line or selection up or down<br />
alt-shift-up or alt-shift-down or ctrl-shift-up or ctrl-shift-down<br />
<br />
navigate to class method or function in current file by selecting from a popup<br />
ctrl+f12<br />
<br />
debug the current file<br />
shift+f9<br />
<br />
step into<br />
f7<br />
<br />
step over<br />
f8<br />
<br />
run the current file<br />
shift+f10<br />
<br />
run the current line or selection in the console<br />
alt+shift+e <div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-77078639953316727372018-11-25T20:15:00.001-05:002020-02-05T13:20:12.476-05:00vim you should know<div dir="ltr">
If you use vim you should try these:</div>
<div dir="ltr">
Use the file browser for <u>local</u> file management.</div>
<div dir="ltr">
:browse e .</div>
<div dir="ltr">
Equivalent to command line:</div>
<div dir="ltr">
vim .</div>
<div dir="ltr">
Use the file browser for remote file management.</div>
<div dir="ltr">
:browse e scp://hostname/</div>
<div dir="ltr">
Equivalent to command line:</div>
<div dir="ltr">
vim scp://hostname/</div>
<div dir="ltr">
Pipe to 'view -' instead of 'less' when you want syntax highlighting.</div>
<div dir="ltr">
Side by side diff with editing</div>
<div dir="ltr">
:e file_v1</div>
<div dir="ltr">
:vert diffsplit file_v2</div>
<div dir="ltr">
Equivalent to command line:</div>
<div dir="ltr">
vimdiff -v file_v1 file_v2</div>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-84373202701730907632018-11-20T05:51:00.000-05:002019-11-02T10:54:52.037-04:00The Plant Paradox by Dr Gundry<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;"></span><br />
<div style="font-family: helvetica; font-size: 12px;">
<span style="font-size: 12pt;">Updated 11/2/2019: Added more details and more tips and more foods.</span><br />
<div>
<span style="font-size: 12pt;"><br /></span></div>
</div>
<span style="font-size: 12pt;">Dr Gundry the author of the Plant Paradox has added a YouTube channel.</span></div>
<div style="font-family: helvetica; font-stretch: normal; line-height: normal; min-height: 13.8px;">
<a href="https://www.youtube.com/channel/UCtxo0nTZjzlKJq5-vJq6s6g"><span style="font-size: 12pt;"></span>https://www.youtube.com/channel/UCtxo0nTZjzlKJq5-vJq6s6g</a></div>
<div style="font-family: helvetica; font-stretch: normal; line-height: normal; min-height: 13.8px;">
<span style="font-size: 12pt;"></span><br /></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">Video from Dr. Gundry that is very approachable and immediately usable food advice <a href="https://cutyourcravings.com/180927B.php?n=tba">https://cutyourcravings.com/180927B.php?n=tba</a></span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal; min-height: 13.8px;">
<span style="font-size: 12pt;"></span><br /></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">Here is a summary of my understanding of The Plant Paradox by Dr Gundry (Yes, I keep notes and I need to update these. It's very complicated.):</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal; min-height: 13.8px;">
<span style="font-size: 12pt;"></span><br /></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">The Plant Paradox is the book I recommend reading</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;"><a href="https://www.goodreads.com/book/show/33630505-the-plant-paradox">https://www.goodreads.com/book/show/33630505-the-plant-paradox</a></span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal; min-height: 13.8px;">
<span style="font-size: 12pt;"></span><br /></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">Podcast and Blog</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;"><a href="http://drgundry.com/gundry-podcast/">http://drgundry.com/gundry-podcast/</a></span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal; min-height: 13.8px;">
<span style="font-size: 12pt;"></span><br /></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">Shopping List on Amazon</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;"><a href="https://gundrymd.com/plant-paradox-shopping-list/">https://gundrymd.com/plant-paradox-shopping-list/</a></span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal; min-height: 13.8px;">
<span style="font-size: 12pt;"></span><br /></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">Shopping List PDF</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;"><a href="https://gundrymd.com/wp-content/pdf/Plant-Paradox-Shopping-LIst.pdf">https://gundrymd.com/wp-content/pdf/Plant-Paradox-Shopping-LIst.pdf</a></span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal; min-height: 13.8px;">
<span style="font-size: 12pt;"></span><br /></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">Yes and No List</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;"><a href="https://tantor.com/the-plant-paradox-steven-r-gundry-md.html">https://tantor.com/the-plant-paradox-steven-r-gundry-md.html</a></span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal; min-height: 13.8px;">
<span style="font-size: 12pt;"></span><br /></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">It's a lot of information. Even if you know a lot. Dr. Gundry takes many chapters to put into perspective the reasons why you want to avoid certain foods.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">Dr. Gundry goes off on many worthwhile tangents. I'm down a size from 2XL to XL and 40 waist to 38 from last weekend and that was in 3 or 4 days and it's not even a calorie or portion restriction diet except for the meat and cheese AKA animal protein.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">I don't feel hungry most of the time now. Especially not for the poisonous foods.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">The dietary restriction on foods to avoid is a cure all by avoiding the bad and indulging the good. We are all suffering because of all the bad things we eat and popular diets and health recommendations lead us in unscientific tail chasing circles with only partially correct info and loads of bad recommendations.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal; min-height: 13.8px;">
<span style="font-size: 12pt;"></span><br /></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">It is not just sugar. In fact refined sugar AKA glucose is less bad for you than the fructose found in fruit. The availability of fruit all year round that is picked green before the lectins (plant created poison proteins that kill bugs) can be removed by the plant make it even worse. The fructose in fruits causes the brain to send out insulin from the taste but the insulin receptors don't recognize the fructose as sugar (glucose). This causes more insulin to go out and you to feel hungrier. This insulin cycle causes insulin resistance and is triggered by fructose (fruit sugar), syrups(corn, maple, agave, etc), and all sugar-free sweeteners (including stevia).</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal; min-height: 13.8px;">
<br /></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">1. Sugar in everything you eat satisfies your body before the proteins arrive and your body immediately turns the protein and carbohydrates into sugar and then stores the sugar as fat.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">2. Red meat proteins are similar enough for most of our body to use including lining our blood vessels. The immune system sees these proteins as foreign and attacks the body. Attacking our blood vessels and muscles, and tendons causing pain because it doesn't recognize the protein. The prevalence of rheumatoid arthritis in relatively young and middle aged adults is partially a symptom of too much red meat.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">3. Most of the cow milk in the world has the A1 protein. A protein that our bodies find indigestible. A2 protein cow milk and also any sheep or goat dairy have the A2 protein and are digestible.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">4. All legumes are indigestible including cucumbers.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">5. All fruit seeds have lectins and are poisonous as are the skins.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">6. WGA, wheat germ a gluten is is a lectin that blocks insulin receptors and estrogen receptors permanently while turning on those receptors permanently.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">7. Lectins get their poison from bacteria that makes its way in through your gut and creates a leaky gut that allows worse things in. The bacteria makes a home in your body and your immune system kicks in 24/7 causing symptoms that we call diseases. Lupus, autoimmune, Parkinson's, heart, allergies, dementia, Alzheimer's, rheumatoid arthritis, headaches, etc</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">8. NSAIDS are poison that make you addicted to the poison that they are (Advil, etc).</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">9. Night shades are poisonous. Eggplant, tomatoes. Peel the skins and throw away the seeds if you want to eat them.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">10. Cashews are poisonous because they are full of lectin proteins even after they are sun-dried. Don't eat a five pound bag of cashews. You might end up poisoned in the hospital.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">11. All grains are poisonous including soy and all the other beans (legumes) including peanuts.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">12. If it has seeds it is a fruit (fructose sugar) don't eat it, even pickles. All fruits are picked green and don't have a chance to remove the lectins from the fruit when they ripen after being picked. </span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">13. Don't eat sugar ever if you can avoid it. If you do need a sweetener use lemon juice or lime juice) as the sugar content is negligible. Sugar is the lesser of the evils between fructose (fruit juice) and any artificial sweeteners including stevia. Better a handful of candy made from refined sugar not corn syrup which is a fructose than to eat a fake sweetener as the sugar will satisfy your hunger while the others like fruit juice will set you up for insulin problems (diabetes) and make you hungrier after eating them.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">14. If the animal was fed grains consider it a grain and don't eat it - grass fed meat only and wild caught seafood only. They feed grain (lectins) and fish parts (mercury) to farm raised fish.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">15. Liquid coconut oil (MCT/XCT) and avocados have the ketogenic hormones that lets your cells' mitochondria burn fat instead of sugar, using ketosis, without having to starve yourself of sugar to start ketosis in your body. This is an inefficient way to generate energy for your brain. This is a good thing. Ketosis allows your mitochondria to exercise a muscle they don't get to use very often.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">16. Green bananas, green plantains, and green papayas are good but not when ripe.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">17. Yams and sweet potatoes are good but not potatoes.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">18. Avoid sweeteners. They make you feel hungry. It's not sugar but it activates the release of insulin making you hungrier. Cut out all sweeteners completely if you have diabetes. That means no fruit and no sugar too. Eat yams and avocados and pour lots of liquid coconut oil on top of everything. Also eats greens every day (not string beans or peas as they are legumes).</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">19. Cancer can't do ketosis (burn fat). It needs sugar and uses the foreign red meat protein to hide from your immune system. Cut out red meat and sugar and sweeteners completely if you have cancer. Eat lots of leafy greens, yams, cabbage, green plantains, green bananas, and lots of tree nuts and extra-virgin cold-pressed oils. Eat in total each week only a fist sized portion of anchovies or sardines and maybe a couple of pasture raised chicken eggs for animal protein.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">20. Eat lots of green leafy vegetables. They are a resistant starch that is good for you. They also provide a platform for good gut bacteria to grow on. Even iceberg lettuce is really good for your good gut bacteria. </span><br />
<span style="font-size: 12pt;">Green bean, snow peas, string beans, peas, beans, and peanuts are all legumes and they are bad for you unless pressure cooked. Cooking legumes for a really long time does not break down the lectins. Only pressure cooking. Lentils only take 15 minutes in a pressure cooker but kidney beans take 45 minutes.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">21. Don't eat raw fish sushi you are taking a bigger risk than you may realize. There is a bacteria that is only found in raw fish that can kill you and even if you survive it may take you years to recover even partially. Don't eat tuna, salmon, swordfish. They are full of mercury. Basically avoid all big fish including cod, halibut, and farm raised fish. Good fish are anchovies, and sardines packed in extra virgin cold pressed olive oil. Pour extra virgin cold pressed olive oil over all your food. It is very good for you. Think of your food as a way to get more olive oil in you. Don't get the non-virgin non-cold pressed olive oil. The good stuff has been removed.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">22. Avocados, mushrooms, walnuts, macadamia nuts, Brazil nuts, pistachio nuts, coconuts, hemp seeds, and almonds are good for you. Avoid most other nuts and seeds. Coconut milk is sugar water and worse than that it is fructose sugar water so no coconut water.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">23. Cassava, yams, and sweet potatoes are good. Potatoes are bad.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">24. Only eat gluten-free grain free bread. A simple rule of thumb to making gluten-free grain bread or cakes or pancakes is half coconut flour plus half almond flour(without the skins) or green banana flour and a tablespoon of cassava flour or tapioca starch flour. It works for pancakes too. For gluten-free grain-free pancakes leave the batter thick and </span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">25. Eat 12 to 14 tablespoons of olive oil a day. It's good for you. So are a handful of nuts as a snack. Not peanuts as they are really bad for you even cooked.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">26. Have a teaspoon of mercury free fish oil before each meal and added over meals.</span><br />
<span style="font-size: 12pt;">27. Have a tablespoon of cold pressed hemp seed oil every morning with a drop of liquid vitamin D3 for calcium absorption.</span><br />
<span style="font-size: 12pt;">28. Cold brewed coffee is really good for you. To avoid getting jittery I have fresh ground organic cacao beans (chocolate) in boiling water (hot cacao) instead of coffee in the morning and if I don't feel hungry I don't eat until lunch. Use a coffee grinder to make a fine powder out of 3 to 5 beans. If you grind it for more than 5 minutes it will turn into melted chocolate. You can set it in a mold in a freezer to make a pure cacao chocolate bar.</span><br />
<span style="font-size: 12pt;">29. Fasting is really good for you. Fasting is not starving yourself. Drink lots of Italian sparkling water and eat a handful of nuts or greens or yam or some other small healthy snack if you need to while fasting. It's OK. The point of fasting is to get your body to turn on it's natural recycling behavior. It requires 16 hours of fasting before this happens. You may have to work your way up to 16 hours in stages.</span><br />
<span style="font-size: 12pt;">30. Listen to your body and learn the difference between being hungry and wanting to eat. 3 meals a day may be keeping you from being healthy. Only eat when you are hungry. Don't eat when you are not hungry.</span><br />
<span style="font-size: 12pt;">31. These are facts that can help you make better food choices. This is not a weight loss diet. It is a get rid of the sickness and pain diet. You may loose weight if you are overweight. You may gain weight if you are underweight. If the food choices in front of you don't give you a good choice then pick the lesser of the evils using your newly acquired knowledge or just eat what you want. You body will let you know just how bad that choice is.</span><br />
<span style="font-size: 12pt;">32. Watch out for feeling better and then eating bad. If you have been eating really good and then start to eat bad foods again it may take a week or two for you health to decline. That is a good time to get back on track by eating healthy again and avoiding the bad poisonous foods.</span><br />
<span style="font-size: 12pt;">32. Moringa leaves have everything a body needs if you eat the whole leaf. You can buy it as a powder or leaf form and put it in anything as a supplement or use it as a tea in powder or leaf form just remember to eat the tea leaves after you finish the tea. The dried leaves can be boiled and eaten as a green or added to a soup or salad (after boiling or if fresh). Moringa contains all of the 13 amino acids that a body needs but can't produce on it's own. The one natural supplement to rule them all. The dried leaves can be quickly turned into powder in a coffee grinder. As a rule of thumb you should always be drinking the water it is boiled in. Think tea or ramen or soup or as an ingredient in a casserole or stew or curry.</span><br />
<span style="font-size: 12pt;">33. Seaweed in all it's forms is really good for you. </span><br />
<span style="font-size: 12pt;">34. A really good noodle substitute for ramen noodles and linguine and spaghetti is yam noodles AKA sweet potato noodles. Here is a link to an Amazon search </span><a href="https://www.amazon.com/s?k=sweet+potatoe+noodles&ref=nb_sb_noss_2">sweet+potatoe+noodles</a>.<span style="font-size: 12pt;"> </span><br />
<span style="font-size: 12pt;">35. Don't be afraid of salt with iodine. It's good for you.</span><br />
<span style="font-size: 12pt;"><br /></span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">Dr, Gundry explains how you can eat some of the foods on the no list by preparing them (pressure cooking, skinning, deseeding) properly but recommends avoiding them entirely.</span></div>
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal; min-height: 13.8px;">
<span style="font-size: 12pt;"></span><br /></div>
<br />
<div style="font-family: Helvetica; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-size: 12pt;">It's a lot of info. Read the book - it presents it all and tears down popular diets and explains if they work and what parts work and why. It also explains what to avoid and why and what to eat and why. The book is more avoid and the example meals are in a downloadable PDF. It's not really a diet in the traditional sense. It's more of a handbook. It makes it easy to make the right food choices by eating the lesser of the evils even if you can't get the good stuff.</span></div>
<div>
<span style="font-size: 12pt;"><br /></span>
<br />
<div style="font-family: helvetica; font-size: 12px;">
<span style="font-size: 12pt;">Personal update 11/2/2019:</span></div>
<div style="font-family: helvetica; font-size: 12px;">
<span style="font-size: 12pt;">I have lost all joint pain and muscle aches and headaches and even stopped grinding my teeth so much. I have lost over 20 pounds since last year August 2018 without any portion control. Which isn't saying much because I lost 10 pounds in the first week while being super strict and the next 10 a month after that. I think running once around the block in the morning before hopping in the shower and using liquid coconut oil as the creamer in my hot cacao and over most of my meals has been a big help. I am definitely a big eater but filling myself with yams and green plantains covered in olive oil and lemon or lime juice when I get cravings has been a big help. I definitely have not been strict as this is not a strict diet. I've got to order some goat or sheep milk ice cream to avoid eating the A1 protein in craving mode.</span></div>
</div>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-36079513484269960482017-02-20T23:09:00.001-05:002017-02-20T23:09:48.540-05:00Understanding Javascript Prototype Inheritence<p dir="ltr"> MyBaseObj = function(a) {<br>
this.a = a<br>
}<br>
MyObjBase.prototype.aSquared = function() {<br>
return a ^ 2<br>
}<br>
MyObj1 = function(a, b) {<br>
MyBaseObj.call(this, a)<br>
this.b = b<br>
}<br>
MyObj1.prototype = Object.create(MyBaseObj.prototype)<br>
MyObj1.prototype.constructor = MyObj1<br>
MyObj2 = function(a, c) {<br>
MyBaseObj.call(this, a)<br>
this.<u>c</u> = c<br>
}<br>
MyObj2.prototype = Object.create(MyBaseObj.prototype)<br>
MyObj2.prototype.constructor = MyObj2<br>
</p>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-83546698518454596112016-03-21T20:08:00.001-04:002016-03-21T20:22:28.419-04:00Understanding JThe j language is a terse APL derivative programming language that uses language like concepts.<div><br><div>noun</div><div>verb</div><div>adjective</div><div>adverb</div><div>etc.</div><div><br></div><div>There are also several programming styles. Parameterized functions, tacit functions, state machines, and many many ways of overloading verbs to get them to do what you want without having to use the full vocabulary of the language.</div><div><span style="font-family: 'Helvetica Neue Light', HelveticaNeue-Light, helvetica, arial, sans-serif;">Tacit functions being my favorite style that I latched on to like a tick on a deer after I'd written my first couple of tacit functions.</span></div><div><span style="font-family: 'Helvetica Neue Light', HelveticaNeue-Light, helvetica, arial, sans-serif;"><br></span></div><div><span style="font-family: 'Helvetica Neue Light', HelveticaNeue-Light, helvetica, arial, sans-serif;">Tacit functions are all about changing the meaning of verbs based on a chaining order that determines whether a verb is monadic(one parameter passed on the left or right) or dyadic(left and right parameters) and whether one or both of those parameters are the result of the previous verb or verbs or the original or outer parameters or a combination of the two. Basically a repeating set of 2, a hook, or 3, a fork, verbs in a chain with one verb being the original behavior. More on that here </span><a href="http://www.jsoftware.com/help/learning/contents.htm" style="font-family: 'Helvetica Neue Light', HelveticaNeue-Light, helvetica, arial, sans-serif;">http://www.jsoftware.com/help/learning/contents.htm</a></div><div><br></div><div>So, any who, my big breakthrough moment was when I looked at an example adverb definition and it struck me that my love of terse and tacit function definitions was keeping me from being as productive as I could be in j and thereby keeping me from learning more through experience than I can through pouring through the manuals for the perfect way to cut a character off of a tacit expression.</div></div><div><br></div><div>After my big breakthrough I dug in with gusto and quickly and easily rewrote some j code I'd written a couple of years ago when I was first learning j. The lesson I have learned is that sometimes you have to use a few more characters to get things done in j. That is just the way it is most of the time.</div><div><br></div><div>That being said I still look forward to the next time I have an insight that let's me shave a few characters off of an expression but I will no longer try to force it. I am still a little bit leary of using explicit functions unless it is in order to learn how to write adverbs in j.</div><br><div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj93Bzm7EZrET4zCapqSwbZJV_rQZdit62-keOu1ImLqeanQddDnWy79mZXld9ABnidqn1C2Nglg4-u6UBwY6E4t83vPR5Ud9GaSsJgJAKBhVrzAEhiGTZMNwFbRViZ6pfHrMcz32kTec5c/s640/blogger-image--1413188467.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj93Bzm7EZrET4zCapqSwbZJV_rQZdit62-keOu1ImLqeanQddDnWy79mZXld9ABnidqn1C2Nglg4-u6UBwY6E4t83vPR5Ud9GaSsJgJAKBhVrzAEhiGTZMNwFbRViZ6pfHrMcz32kTec5c/s640/blogger-image--1413188467.jpg"></a></div><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0Bay Ridge Brooklyn40.629037 -74.031951tag:blogger.com,1999:blog-8099334158764623276.post-70791509430643786412014-10-01T21:14:00.001-04:002014-10-01T21:14:28.632-04:00Python - exception avoidancem1 = []<div>m2 = None</div><div>m1_total = m1 and max(m1) or None</div><div>m2_total = m2 and min(m2) or 0</div><div><br><div><br></div></div><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com2tag:blogger.com,1999:blog-8099334158764623276.post-14771199831560262692014-09-26T13:07:00.001-04:002016-01-16T08:56:34.754-05:00J and Python Tips<div>J</div>$: self reference for recursion etc.<div>Have to experiment with it<br><div><br><div>Python</div></div><div>Use seq[:1] and seq[-1:] first and last instead of seq[0] and seq[-1] to avoid index out of range exception for empty sequences</div></div><div>Generally, for all index n use seq[n:n+1] instead of seq[n] to avoid exceptions without having to add extra logic checks</div><div><div>>>> [][3:4]</div><div>[]</div></div><div><br></div><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-23124235871144022522014-03-22T11:54:00.000-04:002014-07-08T08:10:16.106-04:00j<p dir="ltr">What a difference a month of using an APL language variant, A Programming Language. I learned a bit more about ipython and the %%script cell command when I started playing with j in a ipython notebook. It seems like I can get by a problem at a time writing scripts in j and running them and organizing them in an ipython notebook. I have been able to one up ipython by working in j-console and using Droidedit on my Android and Textpad on my iPad Mini.<br>
Developing on my phone in J using the j-console app for Android has changed my mind about going much further down the path of an expanded language learning and improvement experiment. I've decided to stick to perfecting my j skills for the foreseeable future. J's super optimized algorithms and terse formulaic functional programming is exactly what I was looking for in a programing language.<br>
I came to this realization after I reimplemented the first few problems from projecteuler.net in j.<br>
For more check out <a href="http://www.jsoftware.com/papers/APLEvol.htm">the history of APL</a></p><p dir="ltr">Edit. oops, forgot to finish this post. I am now a half year into my j language learnings and have finished the first 17 problems in order at http://projecteuler.net</p><p dir="ltr">Go checkout j for yourself. The primer is the fastest way to get competent in j. http://jsoftware.com</p><p dir="ltr">Here is a search and replace I put together after talking about examining the efficiency and correctness/completenes/wordiness of the search and replace in the standard library for j. Next step profile this against the standard library verb and actually read through the code and add any missing features.</p><p dir="ltr">rep.ijs</p><div style="font-family: 'Courier New'; font-size: 13px;">NB. rep file contains srep verb</div><div style="font-family: 'Courier New'; font-size: 13px;">NB. original working concept</div><div style="font-family: 'Courier New'; font-size: 13px;">; 'xyz'&, each (#'abc')&}. each(('abc' E. 'abcdefabcghi') <;. 1 'abcdefabcghi')</div><div style="font-family: 'Courier New'; font-size: 13px;">NB. srep verb</div><div style="font-family: 'Courier New'; font-size: 13px;">srep =: 4 : '; (> {:x)&, each (#>{.x)&}. each ((>{.x) E. y) <;. 1 y'</div><div style="font-family: 'Courier New'; font-size: 13px;">smoutput 'example usage (''abc'';''xyz'') srep ''abc123abc456'''</div><p dir="ltr"><span style="font-family: 'Courier New'; font-size: 13px;">smoutput ('abc';'xyz') srep 'abc123abc456'</span></p><p dir="ltr"><span style="font-family: 'Courier New'; font-size: 13px;"><br></span></p><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-45460895879907397562014-01-22T11:40:00.001-05:002014-01-23T06:34:50.410-05:00I like ipython notebooks<p dir="ltr">I have been stretching my programming chops <u>by</u> working on the problems at http://projecteuler.net</p>
<p dir="ltr">I like mathematics. At a glance the exercises at http://projecteuler.net seemed very interesting. There are network walks and problems involving primes and other number types.</p>
<p dir="ltr">I used the typical development cycle at first. Write a script kill it if it runs too long. Optimize and repeat until I have a solution that runs in a reasonable amount of time. Then submit the solution. If it doesn't check out then write an alternate version by altering and trying to correct any perceived deficiencies. Check the solution against the generated solution and repeat.</p>
<p dir="ltr">In my idle time I worked these problems using this process mostly in a terminal on my personal server either in Emacs or in my alternate environment on my phone.</p>
<p dir="ltr">I had recently reacquainted myself with several programming languages I had encountered in the past: assembly, forth, aplus, j-console, lisp/scheme, prolog, java, ruby, JavaScript, coffeescript. And had also learned a new language or two that I wanted to get comfortable with: Haskell, f-sharp, Julia.</p>
<p dir="ltr">I figured I'd write a solution for each of the problems in each of the languages. I setup the environments for each and started with Haskell. What started out as a simple learning experience quickly proved to be more of a brain teaser than I expected. Learning Haskell while simultaneously stretching my programming chops was more work than I had expected.</p>
<p dir="ltr">After solving the first couple of problems in Haskell I switched to solving the first couple of problems in prolog. On the first prolog problem I ended up looking up a solution on Wikipedia that I reworked after reading and searching and understanding more and trying again. In prolog I am a neophyte at best and to call me a programmer would be generous.</p>
<p dir="ltr">When I got my prolog code to work and looked up the next problem it dawned on me that by solving these problems first in a language I am more comfortable in and am considered an expert in I might have a better chance of finishing a significant portion of the over 400 and growing list of problems presented at http://projecteuler.net and then I could attack the solutions in other languages from the point of knowing the solution in another language.</p>
<p dir="ltr">Python is one of my stronger languages. I know how to program in the functional style and in the OOP style. Which would be useful for thinking of solutions in some of the other languages. I started down that road with SL4A on my phone and python in a shell on my server with a pinch of git.</p>
<p dir="ltr">When I hit Wikipedia to lookup triangle numbers it was a real eye opener and led me to back to prime number theory to optimize a solution to a problem I had previously successfully solved involving primes. In that process and to my benefit I had created a virtualenv with a more recent version of ipython. Which includes notebook.</p>
<p dir="ltr">The command 'ipython notebook' in the the directory and virtualenv of your choosing is all it takes to get started. And I was hooked after I solved my my first http://projecteuler.net problem using a notebook. I teared through 5 or six more problems in less time than it took to solve one using traditional editing run cycles. And the benefit of a running shell environment that can be used for  documentation and has individual cells that only have to be evaluated if you want to add them to the solution makes for a very iterative development cycle.</p>
<p dir="ltr">I feel like I can finally keep a train of thought and I can feel my approach to coding at work improving despite the difference in environments.</p>
<p dir="ltr">I sidetracked myself last weekend and to get my head around the clusters tab of a notebook. The ease of launching clusters has me crashing running processes on my tiny micro AWS instance server with only 4 clusters. I resolved to drive farther off track and write some code in my project Euler notebook for spinning up and down temporary clusters using AWS big compute instances for brief period of time to divvy up some of the tougher problems. By writing solutions that are easy to process in parallel I could properly figure out solutions in short order.</p>
<p dir="ltr">Being able to start a solution and continue work on it in parts anywhere from any device is much more accessible than using ssh and a terminal. You have to try it to get it. Working on code in a browser seems like a toy at first. But then you throw some real problems at it and you begin to realize there is something to this style of programming. And then you shutdown your notebook kernel. And then you come back to it and realize you haven't lost anything. Everything you've typed is still there waiting to be evaluated or edited and reevaluated.</p>
<p dir="ltr">And should you get curious and ssh to your server and type 'ipython console --existing' you too will start to understand the power of ipython notebooks.</p>
<p dir="ltr">I know now that I will be using ipython notebooks for all the languages I plan on tackling. After I finish up to problem 15 in order I will start with ruby and Julia. Both languages are the natural next choice because they already have working iruby and ijulia solutions that have ipython notebooks built in.</p>
<p dir="ltr">I'll have to sidetrack again after getting up to problem 15 in each as I'll have to implement an ipython notebook extension to each of the other languages before I start to work on the problems in that language. The tight iterative train of thought development cycle of ipython notebooks is too useful to not use when I am a programmer and can plugin the solution. Which is the point of the entire exercise.</p>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-59970220315722998822013-02-12T14:22:00.000-05:002015-08-26T17:04:59.314-04:00Crushing PythonI've begun thinking in Python a lot lately.
~/.mypyrc.py:
<pre># standard library
from collections import defaultdict as DD,namedtuple as NT
import csv
from datetime import date as D,datetime as DT,time as T,timedelta as TD
import operator as op
import os
import re
from cStringIO import StringIO as SIO
import sys
import time
from urlllib2 import build_opener as BO,install_opener as IO,Request as R,urlopen as UO
from urlparse import urljoin as UJ,urlparse as UP
from zipfile import ZipFile as ZF
# third party libraries
from BeautifulSoup import BeautifulSoup as BS,BeautifulStoneSoup as BSS
import pytz
# initialization
IO(BO())
</pre>
~/.profile or ~/.bash_profile:
<pre>PYTHONSTARTUP=~/.mypyrc.py
export PYTHONSTARTUP
</pre>
Now starting python interactively loads the PYTHONSTARTUP file automagically:
<pre>python
>>> for f in ZF('a.zip').namelist:
... print f
...
>>> print BS(UO(R('http://google.com'))).find('title').text
>>> cols=zip(*csv.reader(open('a.csv')))
>>> rows=zip(*cols)
</pre>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com1tag:blogger.com,1999:blog-8099334158764623276.post-30569941176102939502013-02-12T14:10:00.000-05:002013-02-12T14:10:55.601-05:00pypad - the python notepad web serverThe plan is to take this simple python script and expand on it's note taking features with a GUI, console, and command line front end and additional storage options including a tiddlywiki style of appending the data store to the script.<br />
<br />
The web server will eventually be an option rather than integral.<br />
<br />
<a href="http://launchpad.net/pypad" title="pypad">http://launchpad.net/pypad</a><br />
<br />
I will fork this into a micro framework and also fork it into a python eval type remote or local shell. Maybe even a REPL embedded in a web page.<br />
<br /><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-26321068997332998792011-04-06T10:53:00.005-04:002013-02-13T07:42:56.340-05:00A Diatribe on Being Humble While Misunderstanding IncompetentlyI do not subscribe to the I'm in charge so I feel powerful mentality. In fact, I feel the opposite about the administrator and programmer role.<div><br />I take the role names more literally in their humblest interpretation. An administrator is more like just a lowly administrator mired in the details. A programmer is more like just a computer in the calculator sense of the word. Both are tools that business minded entrepreneurs can make good use of.<br /><br /></div><div>That is not to say that I think little of what I do when I am in those roles. But more of a right sizing of my ego and attitudes toward my work and how I interact with others. By thinking humbly I can allow myself the freedom to expect more of others and to allow myself to look for the solutions to business problems outside of the programming solution straight jacket.</div><div><br />There are certain conclusions I have come to that have helped me to solve what are invariably business problems.</div><div><br />Firstly, there are no little people AKA users. There are only clients and customers who are invariably right ;)<br /><br /></div><div>Secondly, the people who actually use your programs on a daily basis are the one's who are going to decide whether your program is truly useful or not. Bouncing your ideas off of them and getting their feedback is only going to help you to deliver what is needed rather than what was in the specification.<br /><br /></div><div>Thirdly, it is easier for you to replicate a feature in a location convenient for the client(not user, user is the derogatory of client or customer) than to have that client click through to the location you have hidden the feature. Click of O(1) as opposed to Click of O(n), as n goes to infinity. n being the number of times the client has to click to find the feature that they want available one click away.<br /><br /></div><div>Fourthly, asking people outside of the development team to be responsible for their work is not a cardinal sin. If a graphic designer delivers images that are not in the right palette or format or pixel size, it is not your job to write a software solution to fix. You simply need to point out the problem and do a little hand holding to explain the problem and suggest a non-programmatic solution. This point bears repeating. If the client is unable to to access your website because they are using a crappy browser from the 90's don't change your code to handle that browser. Simply point out the problem and suggest a solution. I'm sure this could be loosely interpreted as telling the client how high to shove it. But I am only reiterating my point which is asking non-techie's to do their job correctly and responsibly is ok, acceptable, and an all around good thing.The only way people will act competent is if they are asked nicely to be competent and shown how to be competent.<br /><br /></div><div>Fifthly and lastly, there are tons of incompetent people out there. You, including me, are probably one of them. It's not the end of the world. We all sometimes think if someone doesn't know what we know then they are incompetent. Trust me this is flawed logic. As a simple proof to yourself, tell me what number I am thinking of right now. Look now I know something you don't know. Should I conclude you are incompetent with numbers and math? It's only one number should I extrapolate that to mean maybe you will have trouble with more than one number? Like addition, subtraction, multiplication, and division. Surely you suck at guessing games and logical thinking. Otherwise you would have guessed it already. This may seem like a trumped up example. Which it is. But it is also true that humans are bad predictors of almost anything. Especially when they are incompetent enough to think they know more than you or conversely put, when you think you know more than someone else. It's a paradox that you see around you every day. Why does management seem so incompetent? Is it because they are incompetent or are you so incompetent that you can't understand what you don't understand? Watch out for this one. Everybody does it including you. That is why it is known as a paradox. It is also why I use a number guessing game as an example. No one thinks a "What number am I thinking of?" guessing game to be fair except children.<br /></div><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com1tag:blogger.com,1999:blog-8099334158764623276.post-47797799832104087012010-08-07T06:56:00.009-04:002011-08-31T22:32:08.227-04:00The Expectation of Lack of Privacy in PythonOne feature of Python that I thankfully rarely have to think of is the whole private, protected, public meme that seems to always popup in programming languages. Programmers coming from other programming languages always want to know how they can make an object's properties private.
<br />
<br />Well, besides that fact that black boxes are only good for figuring out what went wrong after the crash. I'd have to say that the whole privacy meme in programming stems from the same sort of administrator == all powerful == programmer way of thinking. Responsibilities are not entitlements. Responsibilities are work.
<br />
<br />Here is an example I wrote to clear up what I felt was a miscommunication about using the underscore to create private variables in Python:
<br />
<br />Here is a short example I wrote that demonstrates my point about property getters and setters. I have tested cutting and pasting the following into an interactive python 2.5.2 session launched by typing python on the command line without any parameters. The # commented lines should match the output line above it. I hope this clarifies any miscommunication we may have had.
<br /><code>
<br />class One(object):
<br /> def __init__(self, value):
<br /> self._x = value
<br /> def getx(self):
<br /> return self._x ** 2
<br /> def setx(self, value):
<br /> self._x = value + 1
<br /> x = property(getx, setx)
<br />
<br />class Two(object):
<br /> def __init__(self, value):
<br /> self._my_x = value
<br /> def getx(self):
<br /> """ directly accessing a "private" member of another class """
<br /> return self._my_x._x
<br /> def setx(self, value):
<br /> """ directly setting a "private" member of another class """
<br /> self._my_x._x = value + 2
<br /> # Not defining a setter for the polite_x property makes it read only
<br /> @property
<br /> def polite_x(self):
<br /> """ using the exposed property of another class """
<br /> return self._my_x.x
<br /> x = property(getx, setx)
<br />
<br />one = One(10)
<br />two = Two(one)
<br />one._x
<br />#10
<br />
<br />one.x
<br />#100
<br />
<br />one.x = 10
<br />one._x
<br />#11
<br />
<br />one.x
<br />#121
<br />
<br />two._my_x._x
<br />#11
<br />
<br />two._my_x.x
<br />#121
<br />
<br />two.x
<br />#11
<br />
<br />two.polite_x
<br />#121
<br />
<br />two.x = 10
<br />two.polite_x
<br />#144
<br />
<br />two.x
<br />#12
<br />
<br />one._x
<br />#12
<br />
<br />two.polite_x = 1
<br />#Traceback (most recent call last):
<br /># File "<stdin>", line 1, in <module>
<br />#AttributeError: can't set attribute
<br /></code>
<br />I realized 30 seconds after I sent the above example. By looking up the meaning of the underscore and double underscore. That the communication problem was about the underscore as opposed to the double underscore. I was talking about the single underscore because I was asked about the underscore and was only told underscore as feedback when I tried to clarify by asking whether they were referring to the double or single underscore. Which should have been my first clue that I may have my answer judged by someone that didn't fully understand the question they were asking at the time. Which is a big no no. Unless you want to be seen as incompetent because you are being judged by someone who doesn't understand the questions they are asking. And may not be able to understand the answers to those questions. I am loath to admit it but I was just as culpable in this misunderstanding as my understanding of the double underscore was incomplete at that moment. As my mistaken derision of the double underscore came from the accessibility of members like __repr__ and __str__ and __dict__ and __len__. Class members with a double underscore on both sides of the name are system methods and are not meant or implied to being private at all. My lack of interest in making any of my code private was probably the real source of my having no real interest in reading past the disclaimer in the Python documentation which starts with:
<br />
<br /><blockquote>
<br />9.6 Private Variables
<br />“Private” instance variables that cannot be accessed except from inside an object, don’t exist in Python.
<br /></blockquote>
<br />
<br />Thus my second email missive of the morning. Making my point all over again using the double underscore. Luckily :). Thank you benevolent dictator for thumbing your nose at private variables!
<br />
<br />The private members rewritten with double underscores make those members seem enforceably private. This is because of the exception raised when trying to access those members outside of object and class methods. But this is a misnomer as leading double underscores are actually a name mangling scheme used to hide those members from name collisions with child classes. They can still be accessed directly.
<br />
<br />Here is the same example written with "private" members that generate the same results and allows the same access. Despite the miscommunication of apparent privacy. This is because the double underscore's real purpose is for predictable name mangling not privacy.
<br /><code>
<br />class One(object):
<br /> def __init__(self, value):
<br /> self.__x = value
<br /> def getx(self):
<br /> return self.__x ** 2
<br /> def setx(self, value):
<br /> self.__x = value + 1
<br /> x = property(getx, setx)
<br />
<br />class Two(object):
<br /> def __init__(self, value):
<br /> self.__my_x = value
<br /> def getx(self):
<br /> """ directly accessing a "private" member of another class """
<br /> return self.__my_x._One__x
<br /> def setx(self, value):
<br /> """ directly setting a "private" member of another class """
<br /> self.__my_x._One__x = value + 2
<br /> # Not defining a setter for the polite_x property makes it read only
<br /> @property
<br /> def polite_x(self):
<br /> """ using the exposed property of another class """
<br /> return self.__my_x.x
<br /> x = property(getx, setx)
<br />
<br />one = One(10)
<br />two = Two(one)
<br />one._One__x
<br />#10
<br />
<br />one.x
<br />#100
<br />
<br />one.x = 10
<br />one._One__x
<br />#11
<br />
<br />one.x
<br />#121
<br />
<br />two._Two__my_x._One__x
<br />#11
<br />
<br />two._Two__my_x.x
<br />#121
<br />
<br />two.x
<br />#11
<br />
<br />two.polite_x
<br />#121
<br />
<br />two.x = 10
<br />two.polite_x
<br />#144
<br />
<br />two.x
<br />#12
<br />
<br />one._One__x
<br />#12
<br />
<br />two.polite_x = 1
<br />#Traceback (most recent call last):
<br /># File "<stdin>", line 1, in <module>
<br />#AttributeError: can't set attribute
<br /></code><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-12514613044186294842010-08-06T15:44:00.011-04:002011-04-02T16:10:19.861-04:00Bit Flipping in PythonIn Python you can access bits directly with the &, |, ^, ~, <<, >> operators on integer objects.<br /><br />An example bit transformation might be one that moves all of the set bits in a 12 bit number to the left and all of the unset bits in the same 12 bit number to the right.<br /><br />For example the 12 bit number 101101000001 would be transformed into the 12 bit number 111110000000 using that transformation.<br /><br />This example bit manipulation can be concisely written in Python as:<br /><code><br />n1 = int("101101000001", 2)<br />bc = sum(1 for i in range(12) if n1 & (1 << i))<br />n2 = int(("1" * bc) + ("0" * (12 - bc)))<br /></code><br />In Python 2.6 and later this example can more concisely be written as:<br /><code><br />n1 = 0b101101000001<br />bc = sum(1 for i in range(12) if n1 & (1 << i))<br />n2 = sum(1 << i for i in range(11, (11 - bc), -1))<br /></code><br />The generic 12 bit manipulation can be more re-usably written as:<br /><code><br /># The 12 bits<br />b12 = tuple(1 << i for i in range(11, -1, -1))<br /><br /># There are only 13 solutions<br />result_numbers = tuple(sum(b12[i] for i in range(c)) for c in range(13))<br />result_strings = tuple(("1" * i) + ("0" * (12 - i)) for i in range(13))<br /><br />original_number = int("101101000001", 2)<br />bit_count = sum(1 for i in range(12) if original_number & b12[i])<br />transformed_number = result_numbers[bit_count]<br />print result_strings[bit_count]<br /></code><br />The Python 2.6 and later version is:<br /><code><br /># The 12 bits<br />b12 = tuple(1 << i for i in range(11, -1, -1))<br /><br /># There are only 13 solutions<br />result_numbers = tuple(sum(b12[i] for i in range(c)) for c in range(13))<br />result_strings = tuple(bin(i) for i in result_numbers)<br /><br />original_number = 0b101101000001<br />bit_count = sum(1 for i in range(12) if original_number & b12[i])<br /># Updated 2011-01-08<br /># in python 2.7 and later the above can be further optimized<br /># using range(original_number.bit_length) in place of range(12)<br />transformed_number = result_numbers[bit_count]<br />print result_strings[bit_count]<br /></code><br />There is no need to define a function call or set of function calls. Bit manipulation easily lends itself to mapping list indexes to result sets that can be prebuilt to aid in readability and execution speed.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com1tag:blogger.com,1999:blog-8099334158764623276.post-88189746707806801372010-02-17T15:21:00.008-05:002011-04-06T11:22:50.573-04:00python no overhead debugger on demandOne of the best ad-hock troubleshooting ways to figure out what caused an exception post mortem.<br /><br />Run:<br /><br /><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">python -i your_script.py</span><br /><br />After the exception you will be left at the python interpreter prompt staring at your exception.<br /><br />Type:<br /><br /><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">import pdb</span><br /><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">pdb.pm()</span><br /><br />And you will be put into the context of the stack of the last exception. This means you can print/examine the local variables at the point of failure after the failure has occurred without having to change a line of code or import pdb in advance.<br /><br />Another method that requires a little bit of preparation is to put the <span class="Apple-style-span" style="text-decoration: line-through;">import pdb and</span> pdb.set_trace() in a signal handler trap. *Moved the import of pdb out of the signal handler as imports in functions are deprecated. That way you can do a kill -SIGNAL PID or if the signal you trap is INT you can just Ctrl-C to get dropped into the debugger at any point. The signal handler technique is good for testing release candidates and released code because the signal handler doesn't create any runtime overhead.<br /><br />Signal handler example. Debugger starts with Ctrl-C:<br /><br /><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">import pdb</span></div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">import signal</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: 'Courier New', Courier, monospace;">def int_handler(signal, frame):</span><br /><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> pdb.set_trace()</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: 'Courier New', Courier, monospace;">if __name__ == "__main__":</span><br /><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> signal.signal(signal.SIGINT, int_handler)</span><br /><br />Put that at the top of your script and you can start debugging your script at any point by typing Ctrl-C. Resume programe execution by typing exit at the Pdb prompt.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-38599000833486283982009-12-22T12:47:00.002-05:002010-11-09T16:28:16.575-05:00My Review of Roku HD PlayerI wouldn't have let Roku post this to my blog except I do approve of this message.<br /><div class="hreview"><div class="item"><p><a href="http://www.roku.com/roku-products">Originally submitted at Roku</a></p><div><p style="margin-top:0">The best-selling HD Player (as known as Netflix Player by Roku) plays High Definition video and connects to surround sound audio.</p></div><a href="http://www.roku.com/roku-products" style="display: none;" class="url fn"><span class="fn">Roku HD Player</span></a></div><br clear="left"><p><strong class="summary">Only needs Youtube and Hulu to be perfect</strong></p><div>By <strong>Danyel</strong> from <strong>Bay Ridge</strong> on <strong><abbr title="20091222T1200-0800" class="dtreviewed" style="border: none; text-decoration: none;">12/22/2009</abbr></strong></div><p><div style="margin: 0.5em 0; height: 15px; width: 83px; background-image: url(http://images.powerreviews.com/images/stars_small.gif); background-position: 0px -180px;" class="prStars prStarsSmall"> </div></p><div style="display: none"><span class="rating">5</span>out of 5</div><p><strong>Pros: </strong>Great value, Built in Wi-Fi, Easy to use, Compact, Video selection, Easily movable, Easy to set up, High quality picture, Reliability</p><p><strong>Best Uses: </strong>Bedroom, Living room, Traveling, Friends House</p><p><strong>Describe Yourself: </strong>Power User, Technophile, Early adopter</p><p style="margin-top:1em" class="description">Move it from living room to bedroom to finish watching in bed.</p><p style="margin-top:0.5em">(<a href="http://www.powerreviews.com/legal/terms_of_use.html" rel="license">legalese</a>)</p></div><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-43287970390934399362009-07-22T06:30:00.003-04:002010-06-01T19:53:34.071-04:00Python File Type Plugin for Vim - Part 1* Made a correction below. Using the ~/.vim/ftplugin directory for a file type plugin causes the plugin to be reloaded repeatedly causing any autocommands to be appended for BufWrite actions. This causes multiple executions of every autocommand every time you save the file. A better location is the ~/.vim/plugin directory. Where the plugin is loaded once at startup. I have changed the location below. *<br />
<br />
I wanted to add some IDE style conveniences to my preferred editor, console Vim. Rather than reinventing the wheel I decided to search the Internet and start with what was already out there. I found a bunch of very useful scripts and snippets. In part 1 I am documenting some of what I found here by publishing a snippet that I have only made minor changes to to make it useful for my needs.<br />
<br />
This script needs to be put in a file named python.vim and saved in ~/.vim/plugin. If the directory does not exist it needs to be created. The scripts create the pyflakes, pylinks, and pychecker commands that can be used at the vim command prompt, ':'. The pylint, pyflakes, pychecker packages will have to be installed as prerequisites for using these commands.<br />
<br />
All three commands act on the current buffer's file name. Running one of the commands at the vim command prompt will open a Vim quickfix window which will seem familiar to anyone who has used a graphical IDE for development.<br />
<br />
You can press c to close the quickfix window when it has the focus. You can double click with a mouse under X or press enter to go to the error or warning associated with the current quickfix line. This will take you to the line referred to by that message. You will have to restart vim if you have already loaded a python file during the currently loaded Vim session.<br />
<br />
Here is the code:<br />
<br />
<pre>function! <sid>PythonGrep(tool)
set lazyredraw
" Close any existing cwindows.
cclose
let l:grepformat_save = &grepformat
let l:grepprogram_save = &grepprg
set grepformat&vim
set grepformat&vim
let &grepformat = '%f:%l:%m'
if a:tool == "pylint"
let &grepprg = 'pylint --output-format=parseable --reports=n --indent-string=" "'
elseif a:tool == "pychecker"</sid></pre><pre><sid> let &grepprg = 'pychecker --quiet -q'</sid></pre><pre><sid> elseif a:tool == "pyflakes"</sid></pre><pre><sid> let &grepprg = 'pyflakes'</sid></pre><pre><sid> else</sid></pre><pre><sid> echohl WarningMsg</sid></pre><pre><sid> echo "PythonGrep Error: Unknown Tool"</sid></pre><pre><sid> echohl none</sid></pre><pre><sid> endif</sid></pre><pre><sid> if &readonly == 0 | update | endif</sid></pre><pre><sid> silent! grep! %</sid></pre><pre><sid> let &grepformat = l:grepformat_save</sid></pre><pre><sid> let &grepprg = l:grepprogram_save</sid></pre><pre><sid> let l:mod_total = 0</sid></pre><pre><sid> let l:win_count = 1</sid></pre><pre><sid> " Determine correct window height</sid></pre><pre><sid> windo let l:win_count = l:win_count + 1</sid></pre><pre><sid> if l:win_count <= 2 | let l:win_count = 4 | endif</sid></pre><pre><sid> windo let l:mod_total = l:mod_total + winheight(0)/l:win_count |</sid></pre><pre><sid> \ execute 'resize +'.l:mod_total</sid></pre><pre><sid> " Open cwindow</sid></pre><pre><sid> execute 'belowright cw '.l:mod_total</sid></pre><pre><sid> nnoremap <buffer> <silent> c :cclose</silent></buffer></sid></pre><pre><sid><buffer><silent><cr> set nolazyredraw</cr></silent></buffer></sid></pre><pre><sid><buffer><silent><cr> redraw!
endfunction
command! Pyflakes call <sid>PythonGrep('pyflakes')
command! PyFlakes call <sid>PythonGrep('pyflakes')
command! Pychecker call <sid>PythonGrep('pychecker')
command! PyChecker call <sid>PythonGrep('pychecker')
command! Pylint call <sid>PythonGrep('pylint')
command! PyLint call <sid>PythonGrep('pylint')
" These three are successively more informative and aggressive in their
" warnings with pyflakes as the least noisy. Only uncomment one.
"autocmd BufWrite *.{py} :Pyflakes
autocmd BufWrite *.{py} :Pychecker
"autocmd BufWrite *.{py} :Pylint
</sid></sid></sid></sid></sid></sid></cr></silent></buffer></sid></pre><br />
<br />
In Vim a single double quote, ", is considered the beginning of a comment for the rest of the line.<br />
<br />
The benefit of having the autocmd run one of the Python lint programs every time you save the file is that you can never get too far from sane working code as any errors and warnings pop up. This, in your face, style of development can keep you from pulling your hair out over something as simple as a semicolon or comma typo and can also warn you about more complex problems and proper coding style.<br />
<br />
More to follow. I will try to combine the output of the three commands as their output doesn't seem to overlap for the most part. And the noisier programs (pychecker and pylint) don't appear to give the same advice when it comes to warnings. pylinker is by far the noisiest of them all but all it's warnings are configurable.<br />
<br />
Warning: If you are using tabs for indenting you will have to modify the pylint parameter '--indent-string='. Set it to the empty string for tabs, or the actual number of spaces used for indenting. In my code above I have it set for 8 spaces which is project specific.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>freegnuhttp://www.blogger.com/profile/13789503355246876159noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-52274278175137812232009-04-02T18:27:00.005-04:002010-06-01T19:22:46.655-04:00Step One: Insert Foot in MouthThis is a follow up to my <a href="http://freegnu.blogspot.com/2009/02/your-fancy-language-is-burdensome-and.html">Your Fancy Language is Burdensome and Dangerous</a> post.<br />
<br />
Python and Ruby don't have the APL array/vector/matrix syntax built in to the core language. But a little nudge from someone made me do the little bit of research I should have done before I wrote <a href="http://freegnu.blogspot.com/2009/02/your-fancy-language-is-burdensome-and.html">that</a> post. And I rediscovered that I did not originate the idea that these languages need array/matrix math syntax thought.<br />
<br />
There is a gem for Ruby called NArray and an egg for Python called Numpy that not only add array syntax but also coherent coercion rules and the ability to apply functions across arrays without calling map. I'm glad I found it because they are easy as pie to use and do exactly what I wanted and a heck of a lot more.<br />
<br />
Check out this Python example:<br />
<br />
from numpy import *<br />
a = array([1,2,3])<br />
b = array([4,5,6])<br />
print a+b #equals array([5,7,9])<br />
print (a+b)/4<br />
print (a+b)%6<br />
<br />
Outputs<br />
[5,7,9]<br />
[1,1,2]<br />
[5,1,3]<br />
<br />
As you can see Numpy also replicates the integer type bug/feature which is very C like but is being dropped in Python 3000 in favor of coercing integers to float on divide. You can typecast the divisor to float to get floating point division and float results.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>DanyelLawsonhttp://www.blogger.com/profile/01014355362548295298noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-65202692116607764322009-03-24T07:27:00.001-04:002009-04-02T17:39:22.200-04:00Vim auto completionI responded to a comment on the <a href="http://dailyvim.blogspot.com/2009/03/out-of-box-autocompletion.html">Daily Vim</a> about auto completion. I decided to post it here as well as the comment ended up being kind of long. The comment by Casey asks if there is a way to turn off omni auto completion for perl as it goes through the entire POD collection evey time. I provide several solutions. Read the original article for a quicj intro to auto completion in insert mode in Vim.<br /><br />The original article points out that there is built in auto completion in Vim. All you have to do is use it is type Ctrl-x Ctrl-o in insert mode and vim will try to complete what you have started typing or pop up a list of all completions if the cursor is not immediately preceded by anything.<br /><br />Original comment follows:<br /><br />Try this command to change the auto completion to the simpler syntax highlighting hints as the auto completer.<br /><br />:setlocal omnifunc=syntaxcomplete#Complete<br /><br />If that is what you always want for Perl add this to your .vimrc after all your other auto commands.<br /><br />autocmd Filetype perl setlocal omnifunc=syntaxcomplete#Complete<br /><br />If you want syntax completion rather than omni completion for all file types use * for the file type. If you want to fail over to syntax completion for file types that don't have omni completion put this in your .vimrc after your other auto commands.<br /><br />if has("autocmd") && exists("+omnifunc")<br /> autocmd Filetype *<br /> \ if &omnifunc == "" |<br /> \ setlocal omnifunc=syntaxcomplete#Complete |<br /> \ endif<br />endif<br /><br />You can also do something a little more complex which just disable the perlPOD part of the perl filetype omni complete.<br /><br />Try this command:<br /><br />let g:omni_syntax_group_exclude_perl = 'perlPOD'<br /><br />generically it's:<br /><br />let g:omni_syntax_group_exclude_{filetype} = 'comma,separated,list'<br /><br />And you can get the complete list of syntax groups while in a file with the filetype in question with this command:<br /><br />:syntax list<br /><br />Then just add that command to your .vimrc to make it permanent.<br /><br />Check out this help topic for more info:<br /><br />:h ft-syntax-omni<br /><br />*Updated<br /><br />And for the complete low down on the idiosyncrasies of each filetype check out: <br /><br />:h compl-omni-filetypes<br /><br />And here's another tip I picked up Ctrl-o : in insert mode will allow you to run a command and then return to insert mode. Neatly avoiding the Esc : ... i or a syndrome.<br /><br />*Updated again<br /><br />FYI Pressing Ctrl-o in insert mode puts you in normal mode for one command. You are not limited to using : to get to the ex command line. You can use p to put or y to yank etc.<br /><br />*Further updates<br /><br />For those times when you just want to save keystrokes or avoid typos:<br /><br />Ctrl-P completes from previous words in document<br />Ctrl-N completes from following words in document<br />Ctrl-X Ctrl-F completes file names<br />0 Ctrl-D removes all indent for the current line<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>DanyelLawsonhttp://www.blogger.com/profile/01014355362548295298noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-27731964140995914022009-03-03T21:04:00.004-05:002022-04-12T17:26:19.650-04:00I think bio-engineering and habitat engineering are smarterI posted this in the comments section of a science post about the current thinking that the only solution to climate change is climate engineering. I think that is a bad idea. Not just because it encourages the fantasy of terraforming other planets and wild irrational space travel. But also because it's a wrong headed idea based on a premise that we don't have the technology to survive and thrive in any environment. It is in our best interests to engineer our way out of our current environmental mismatch. My TEDTalks.com fueled diatribe follows.<br /><br />Geo-engineering is a bad idea and a waste of resources that should be going to bio-engineering and habitat engineering research, development, and manufacturing. The threats to our existence on our planet are much farther ranging than climate change. Climate change is a natural process. Ice ages are where the glaciers that created the great lakes and that have recently melted away in other places come from. We've got a swing by the gravitational force of the black hole at the center of our galaxy through direct alignment with our Sun. Which should be an interesting demonstration of just how powerful the magnetic and gravitational field of a black hole at that distance is when focused through a gravitational field as powerful as our Sun's. We've got the possibility of several disasters that are happen on a cyclical basis around that same time. The two super volcanoes. One right here in or I should say that is Yellowstone Park. The occasional reversal, polarity flipping, and 1000 year disappearances of the earths magnetic field that coincidentally keeps the Sun from burning off our atmosphere. There is also the Atlantic shelf that should wipe the Americas clear of anything not bedrock if it shifts significantly. And that is not even mentioning the many untracked solar and stellar objects that could really ruin our day or the fact that the moon is slowly floating away and will have a massive effect on our climate.<br /><br />My point is that if we are planning to survive beyond our infancy. Yes I say infancy because it is infantile to chase after the idea of money as a life goal. And yes I say idea because that is all money or any possession is. Let us come up with a plan that lays out exactly what kind of technology we would need to survive all of these events. No, not survive, but thrive in the face of all of these events and more. The "rich" are holding back the future because they incorrectly believe it is unprofitable to them to have everyone off the grid and living free. If you could satisfy all of your energy needs from the Sun via locally and communally generated wind power, water power, sea power, thermo-electric, magnetosphere, solar collector, or what have you. And you dealt with others as equals. Everyone being responsible for themselves and the world as a whole without arbitrary governance by ignorance encouraged by profiteers. And you were educated about the realities of our ability to harness even the simplest of technologies to solve all of our problems like drought, famine, hunger, transportation, shelter, communication, and survival. You would no longer be a consumer. In fact for the cost of a car (~$20,000) you could buy all the equipment needed to setup a micro-factory and be a manufacturer. We need to collaborate on using the technology that is already available to build the technology needed to thrive during extreme adversity. We must evolve beyond the womb of the Earth. To do so we don't need to travel to other planets and terraform them to match our requirements. What we need is to evolve by raising the bar and saying we aren't dependent on a very fragile environment to survive. We have the technology we need the will.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>DanyelLawsonhttp://www.blogger.com/profile/01014355362548295298noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-40433310555037125902009-02-18T19:52:00.000-05:002009-02-18T19:53:14.435-05:00Your Fancy Language is Burdensome and DangerousI found this quote about the <a href="http://en.wikipedia.org/wiki/PL/I">PL/I</a> language in Wikipedia to be very poignant today. The quote's sentiment and the PL/I language are from the 1960's.<br /><blockquote>PL/I is considered by some to be a turning point where it was found that large languages with a lot of complexity that allow programmers to do almost anything (such as coerce types with no semantic relationship to one another) are burdensome and dangerous rather than "more powerful."</blockquote><br />It echoes my low opinion of most of the toy languages that seem to be escapees from a Compiler 101 college course masquerading as the cure for the inability of some people to program. I find it to be very relevant to the object oriented mass hysteria and popularity of the latest scripting languages of the moment.<br /><br />My opinion of C++ with the STL and templates and generic algorithms and iterators and iostreams is lower than my original opinion of C++ before it became standardized. What problem does all that junk solve. More to the point, what problem did object oriented programming ever solve beyond speed to delivery?<br /><br />Object oriented programming is a morass and a tar pit. It's the all promise and no delivery. It eats up 90% of your programming time forcing you to write witty little programming ditties when you should be writing elegant, concise solutions that aren't 90% object oriented overhead.<br /><br />Object oriented code hides not only the method invocation but also confuses the issue as to which method is actually called. Multiple inheritance in C++ and other languages demonstrated that the only part of multiple inheritance worth saving in other new object oriented implementations was the interface definition which is basically a template which is basically a macro. It saves you the onerous task of cutting and pasting. In C it's called a macro and it's frowned upon because it obfuscates what the final code does and looks like.<br /><br />In summary. First write code quickly using only 10% of your programming time. Second scratch head and guesstimate what your code actually does and what are it's unintended consequences. Third hope there aren't any bugs that make your invisible untraceable code do something you didn't intend and use more resources then are necessary to do it.<br /><br />I'm not saying I don't appreciate Python, Ruby, Perl, C++, Java, and the like. I'm just saying it's not that hard to write the little bit of code it takes to implement most software projects. Especially since the main benefit of most new languages is their extensive built in libraries. Not that you couldn't do the same thing in C by including the proper headers and linking in the proper libraries. <br /><br />To be brutally honest I think in assembler so even C seems a bit like unnecessary overhead and a bunch of macros hiding the actual code. <br /><br />I've been reading up on a couple of APL like programming languages J and K but after reading some of the original code for the original J implementation all I see it a bunch of nested for loops creating everything on the stack and avoiding calls to the C standard library to allocate memory.<br /><br />Now I like APL and I hope to write my own version of it one day because it solves a real programming problem through it's expressiveness. The problem it solves is how to communicate complex and simple vector and matrix operations programmatically to a computer without having to jam a for loop into your equation. The analogy would be the poor man's version tacked on to most of the recent programming languages with list comprehensions and regular expressions. Which are not the same thing.<br /><br />There are some nice examples of <a href="http://en.wikipedia.org/wiki/K_programming_language">K</a> and <a href="http://en.wikipedia.org/wiki/J_programming_language">J</a> at Wikipedia. I'm not recommending checking out APL as anything other than an educational exercise. I could kick myself for not learning it sooner as it shows how a well thought out programming language was written way back in time that blows the doors off all the fancy flavor of the year languages which waste our time by forcing us programmers to learn an unending stream of new syntax with exceptions that can't even express programming logic as simply and concisely as the A language, APL(A Programming Language) could more than half a century before.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>DanyelLawsonhttp://www.blogger.com/profile/01014355362548295298noreply@blogger.com1tag:blogger.com,1999:blog-8099334158764623276.post-79088900946296363182009-01-17T19:01:00.004-05:002009-01-17T19:24:31.999-05:00How to Mount an Old CDROM Disk on Mac OS XI had a little trouble with a really old <a href="http://www.pcplus.co.uk/">PCPlus</a> DVD on my Mac OS X Mac Book Pro. I wanted to try to install some old Windows 95/98 compilers and software using Wine so I could do some Wine compatible Windows development on the cheap. The old PCPlus DVD had a complete copy of Borland C++ Builder and Delphi and an old copy of IE4 and IE5 among other oldies that are hard to find without massive trojan infestations on the net these days. These ancient versions are often the perfect solution to the problem of finding software that works on Wine and doesn't have an onerous disk space and .net requirement.<br /><br />The problem is I can't see all the files on the DVD. I've seen this problem before and known that it has something to do with the Joliet File System extension. Luckily there is a quick fix. A quick check of the man page for mount and then mount_cd9660 shows that the -r and -j options to mount_cd9660 allow the mounting of ISO 9660 file systems while ignoring the Rock Ridge and Joliet specific extensions.<br /><code><br />umount /dev/disk1<br />mkdir ~/DISK_LABEL<br />/sbin/mount_cd9660 -r -j /dev/disk1 ~/DISK_LABEL<br /></code><br />And voila! All the files are there and all the files are mapped to uppercase. No sudo is required with this method.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>DanyelLawsonhttp://www.blogger.com/profile/01014355362548295298noreply@blogger.com0tag:blogger.com,1999:blog-8099334158764623276.post-29723754616388558522009-01-02T06:48:00.002-05:002009-01-02T06:57:42.856-05:00The Story of StuffThis is a must see. It connects all the dots in the global economy. I saw this video over a year ago on Terra Nova. It is now an approachable interactive evolving educational website.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-5690714104790968";
/* 468x15 blog post */
google_ad_slot = "3969771577";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>DanyelLawsonhttp://www.blogger.com/profile/01014355362548295298noreply@blogger.com0