tag:blogger.com,1999:blog-15607439666142801222024-03-08T05:53:42.157-08:00CodeshotMostly C++, .net and other coding topicsAnonymoushttp://www.blogger.com/profile/01446359502937021335noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-1560743966614280122.post-76117164347745351202013-04-28T08:20:00.000-07:002013-04-28T08:20:15.099-07:00How to read a CSV file in octave and set empty cells to defaults
if foo.csv is a csv file with some empty values and a header row (also with some empty values) you can fill in defaults within octave using this method:
d = csv2cell('foo.csv')
e = cellfun('isempty', d)
eh = false(size(e))
en = false(size(e))
eh(1, :) = e(1, :)
en(2:end, :) = e(2:end, :)
d(eh) = {'No header name'}
d(en) = {NaN}
Anonymoushttp://www.blogger.com/profile/01446359502937021335noreply@blogger.com0tag:blogger.com,1999:blog-1560743966614280122.post-29967004385608178582012-08-26T08:22:00.002-07:002012-09-18T15:46:53.059-07:00List makefile targetsThis is a program that lists the targets in a makefile (using GNU make).
Hopefully it's fairly clear. There is some complexity for performance (all filtering is done by sed).
A version of this script is now included in bash completion from debian although it might not be released as of this writing. That version doesn't output the full target name, it stops at directory separators to make the Anonymoushttp://www.blogger.com/profile/01446359502937021335noreply@blogger.com2tag:blogger.com,1999:blog-1560743966614280122.post-49039456682606720682012-04-28T03:51:00.001-07:002012-04-28T03:51:27.252-07:00Did you know that If any application on your android device has had access to your data at google that there is no server side restriction on what other apps on that device can access? Strange but true... And frighteningly bad security by Google.Anonymoushttp://www.blogger.com/profile/01446359502937021335noreply@blogger.com0tag:blogger.com,1999:blog-1560743966614280122.post-72934926280352049782012-04-14T08:58:00.002-07:002012-06-09T23:35:56.311-07:00Diet GraphThis is a graph of my weight loss efforts. The orange line is an estimate of my excess weight based on occasional samples (green), a model of my BMR (not shown), and my intake and exercise figures (blue and red respectively).
<!-- p>Now has a more visually useful moving average for intake and exercise
{"dataSourceUrl":"//docs.google.com/spreadsheet/tq?key=Anonymoushttp://www.blogger.com/profile/01446359502937021335noreply@blogger.com0tag:blogger.com,1999:blog-1560743966614280122.post-53080880521507488302011-07-16T07:33:00.000-07:002012-04-28T03:52:35.486-07:00windows installer and wix article index - blog entries by robman
The considerations of an installer - the domains of study
Basics about a "Component" in Windows Installer terms
rules of thumb can be derived from this
Historical commentary about the creation of Orca
More detail about what a component is and how to use/defined them correctly
rules of thumb can be derived from this
What the MSI file is and what Anonymoushttp://www.blogger.com/profile/01446359502937021335noreply@blogger.com0tag:blogger.com,1999:blog-1560743966614280122.post-27579247323501759032011-01-09T15:10:00.001-08:002012-04-22T18:22:28.443-07:00Weightloss Techniques BrainstormThis is a brainstorm of ideas for how to lose weight while maintaining a modern bachelor lifestyle.
Please comment with other suggestions
Entries will have a heading with a basic description of a technique, then notes on why, a category, and ways of making the technique compete with foods that could otherwise interfere.
Avoid fruit juice - fruit is for eating, water is for drinking.
200ml (one Anonymoushttp://www.blogger.com/profile/01446359502937021335noreply@blogger.com0tag:blogger.com,1999:blog-1560743966614280122.post-66544515086200185952010-12-23T16:56:00.000-08:002012-04-28T04:43:09.889-07:00'Twas twilight on Christmas, when all through the house...'Twas twilight on Christmas, when all through the housenot an adult head sober, "thanks famous <hic> grouse!"
Mum's stockings were laddered beyond all repair,Her hopes for a jolly day turned to despair.The children had wrestled each other to shreds,While driven by sugar from what they were fed.
Gran was annoyed from the afternoon's chatter,she'd heard not a word of the Queens royal Anonymoushttp://www.blogger.com/profile/01446359502937021335noreply@blogger.com0tag:blogger.com,1999:blog-1560743966614280122.post-23798527467305859082009-12-15T17:46:00.001-08:002009-12-15T18:07:17.108-08:00hello world for agdaAgda is an interesting new language in the style of haskell but uses a different type system that is very interesting. If you don't know about it I'm not going to help you (it's too late at night) so do a search. This blog post is to gve those already interested an example "hello world" example in agda:module helloworld whereopen import IO.Primitive using (IO; putStrLn)open import Data.String Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1560743966614280122.post-43364696134051010892009-02-09T18:50:00.000-08:002009-02-10T18:30:33.832-08:00Mercurial vs GitI've had an epiphany and the epiphany has a name. Mercurial, a version control tool, has entered my life and I am, at last, complete. If you're a geek, and particularly if you are a sub-30 Open Source geek, you might have heard of the great version control war, if not fought in it yourself. Well I've taken up arms and I'm here to recruit you.I will spare you the detail of what a dvcs is and just Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-1560743966614280122.post-9727722404141736162008-09-08T17:09:00.000-07:002008-09-08T17:37:36.286-07:00U+2060: Word JoinerSome scripts have places that are naturally a word boundary, but should not be for some particular instance. For that purpose Unicode provides the WJ (Word Joiner) special character at codepoint U+2060 which you insert wherever you don't want a word boundary:encoding formEndiannessS0S1S2S3UTF-32be0x000x000x200x60le0x600x200x000x00UTF-16be0x200x60le0x600x20UTF-80xE20x810xA0But you'd be surprised Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1560743966614280122.post-11148519584399813542008-08-22T12:32:00.000-07:002008-09-08T17:42:58.060-07:00PaddingA couple of C++ snippets for padding, one simple, one might be easier for a compiler to optimise though you'll have to do your own experiments to see which is faster for you in your program. Both of these are well defined for any value of (in, n) where n > 0 and sensibly defined where n < max_of_size_t + 1 - n. This will not work if either of the two types used are signed or Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1560743966614280122.post-32236282348424163902008-07-24T15:53:00.000-07:002012-04-22T04:13:35.732-07:00boost::mpl vs. variadic templatesBoost provides an interesting library, mpl, for metaprogramming at compile time to describe the construction of complex types from basic components. But C++0x, the next version of C++ due sometime in the next two years, has a scheduled feature called variadic templates.
This feature allows you to define class templates like so:
template<typename... T>
class my_template {};
my_template<Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1560743966614280122.post-36849760844473200792008-07-24T15:12:00.000-07:002012-04-22T04:14:52.328-07:00Managed-wrapped unmanaged wrapperA quick post to show a C++/CLI template for containing an unmanaged resource RAII instance variable in a managed object that uses the destruction pattern in my earlier post.
template<typename T>
ref class NWrap sealed {
int disposed;
T* const obj;
!NWrap() { delete(obj); }
public:
explicit NWrap(T const& src) : obj(new T(src)) {}
~NWrap() {
if (System.Threading.Interlocked.
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1560743966614280122.post-1775698416575587632008-07-23T14:17:00.000-07:002012-04-22T03:56:53.805-07:00IDisposable in C++/CLIA formula for a disposable class in C++/CLI
ref class MyClass : Base {
int disposed;
ManagedResource^ managed_resource;
ManagedResource auto_managed_resource;
void* unmanaged_resource;
!MyClass() { free(unmanaged_resource); }
public:
~MyClass() {
if (System.Threading.Interlocked.
CompareExchange(disposed, 1, 0))
return;
managed_resource.Dispose();
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1560743966614280122.post-11648308113754382412008-07-23T12:45:00.000-07:002012-04-21T15:46:25.794-07:00Love, Love Dispose At the time of writing, Wikipedia lists 3 benefits of garbage collection, that of eliminating or substantially reducing the probability, or impact of:
Dangling pointer bugs, which occur when a piece of memory is freed while there are still pointers to it, and one of those pointers is used.
Double free bugs, which occur when the program attempts to free a region of memory that is already Unknownnoreply@blogger.com0