Tuesday, March 18, 2025

Gradle's Main Problem

This is just a placeholder, but the seed idea is that Gradle suffers from the same problem as Ant did -- they're both implemented as programming languages in their own right. This is out of a misplaced desire to be highly flexible. The result: the system backfires, causing these build scripts typically to manifest both the complexities of a build system AND a hunk of enterprise software.


Your Own, Personal, Council of Elrond

 This is a placeholder, but the idea is that ChatGPT is capable of creating filters that are, for all practical purposess, also personalities.  Combined with a bit of the app's precious memory space, you can build a small but effective "council of Elrond" that can give you both targeted and faceted responses.  The effect feels something like having your own personal group of advice-givers.

There are things you need to be aware of.  First, filters may tend to simply agree with you and support your decisions. It's generally more effective to make sure their personality profile includes some critical evaluation of your thoughts.

Second, the way you define these personalities is a direct input into how the council will operate. If you have one contrarian, then you are likely to get some lively feedback loops that could bring insights. On the other hand, if you're actually aiming for humor, you might want to make them ALL contrarian and see how they bounce off of each other.  This latter element is a variation on the "Incompetent Council" pattern seen in TV comedies such as "Vicar of Dibley".


Monday, June 6, 2022

Notes from the book "It's Your Ship"

Environment

 Focus on the top 3 "gripes" 

- delegate when possible, to solve them
- assume good intention
- there's always a better way

Boss

Learn to think like your boss

- obey even when you disagree
- make the most of what you have
- it never hurts to offer suggestions for improvement, if you've got any ideas

Team

Treat every encounter with every person as the most important thing at that moment.  They do.

Allow quixotic pursuits and fail fast.
- Work smarter, not harder.


Wednesday, June 30, 2021

Corporate Core Values, Compared

Why Corporate Values?

These are declarations about how a company treats itself, customers, and stakeholders. 

For the majority of companies, these declarations reduce to the essential purpose of any company; namely, to make a profit by offering a product that customers buy, and to do so in as time- and cost-efficient a manner as possible.

Those companies tend to aim for 5 (plus or minus) core values, but it's often difficult for them to stop themselves from adding "just one more". It should be no surprise that their lists tend to be similar.  In fact, I suggest that these "Generic Core Values" boil down into four categories, and that most companies simply combine or repackage them in various ways.  My four hypothetical categories are:

A. Achievement or creating value.  Includes business goals and shareholder value.
B. Customer focus.   Includes integrity and community engagement.
C. Working together.
D. Continuous Improvement. Includes innovation.

I've worked for very good companies which have these kinds of corporate values.  Their core values do not inspire me, but that's above my pay grade.

On the other hand, some companies break the mold and actually embed a unique corporate culture into their core values (Google).  Those are interesting to me, but I still don't know if that makes the companies better than others, or if they just have a better marketing department or something.

Northern Telecom / BNR, ca 1996.

1. Our people are our strength.
2. Create customer value. ("create superior value for our customers").
3. Promote shareholder value ("we work to provide s.v.").
4. We are one team.  We share one vision.
5. Continuous improvement ("Embrace change and reward innovation").

CA Technologies, ca 2016.

1. SELF-AWARE.  "We look in the mirror. We know our strengths, but also see our weaknesses—and constantly work on both."

2. RESILIENT. "We go all in and hold nothing back. In the face of adversity, we show no fear, only the grit to persevere."

3. AUTHENTIC. "We shoot straight. Our customers trust us with their most critical needs because we are always open and transparent."

4. RESULTS-ORIENTED. "We love the game. Digital transformation is crucial to the success of our customers, and we do what matters to ensure they win. "

5. CUSTOMER-CENTRIC. "We do it for them. When our customers win, we win. We put their needs first and pride ourselves on our ability to surprise and delight. "

6. COLLABORATIVE. "We never go it alone. We are one CA, one team that succeeds together by making the most of our collaborative expertise."

7. CREATIVE. "We never stop chasing greatness. We constantly pursue elegant solutions to our customers’ most complex problems and support their desire to achieve breathtaking results."

8. SOCIALLY AWARE. "We respect each other and our communities. We support the people and causes that make a difference."

9. AGILE. "We are agile. Because agility is everything today, we move with a sense of urgency and adapt quickly in anticipation of change. "

10. UNCOMPROMISING INTEGRITY. "We do the right thing. Always. That means honoring our commitments and principles in everything we do."

Brink's, ca 2020.

1. Safety
Our goal: bring every employee home safe every night.
We take pride in keeping our customers’ valuables safe and secure.

2. Customer Focus
We understand and anticipate our customers’ needs and provide creative solutions to help them succeed.
We consider the customer first in all we do and build systems and processes to improve service.

3. Integrity
We act with honor and integrity.
We respect each other, our company, our customers and others who are affected by Brink's.

4. Engagement
We create an environment where employees feel comfortable participating.
We are committed to driving results and winning in the market.
We engage in constructive conflict and value diverse perspectives.

5. Continuous improvement
We find ways to streamline our processes and improve our performance.

USAA, ca 2021.

1. Keep our membership and mission first*
2. Live our core values (Service, Loyalty, Integrity, and Honesty).
3. Be compliant and manage risk.
4. Build trust and help each other succeed.
5. Embrace diversity and be purposefully inclusive.
6. Innovate and build for the future.


* "USAA's mission is to facilitate the financial security of its members, associates and their families by providing a full range of highly competitive financial products and services. In so doing, we seek to be the provider of choice for the military community."



The Big List

Stolen from several sites, and filed under my uber-values list.

Achievement

  1. Boldness
  2. Leadership
  3. Persistence
  4. Quality
  5. Passion
  6. Sustainability
Customer focus

  1. Accountability (ownership)
  2. Community involvement
  3. Customer commitment
  4. Honesty
  5. Integrity
  6. Making a difference
  7. Trust
  8. Simplicity
Working together

  1. Authenticity
  2. Collaboration
  3. Diversity
  4. Fun
  5. Inclusion
  6. Humility
  7. Teamwork
  8. Transparency
  9. Vulnerability
Continuous Improvement

  1. Continuous improvement
  2. Curiosity
  3. Employee development
  4. Innovation
  5. Self-improvement

Why UX is DIFFICULT

 I'll keep this short.

Usability design (UX) is converting human communications into a computer user interface.

What are programmers trained to do?  Write programs.

What are programmers NOT typically good at?  Human communications.

Quod erat demonstrandum.


Thursday, June 17, 2021

Notes from the book "Crucial Conversations"

Executive Summary

p80 Lord, help me forgive those who sin differently than I.

Fix the dogmatic conviction that others are the source of all that ails you.

The key to communication is to care about others' goals and have trustworthy motives.  In short, show leadership by treating others with human dignity and treating their needs as important.

  • Establish and track mutual purpose
  • Establish and track mutual respect
  • Don't play games

Details

We should be bold in talking out difficult topics with people -- conflict is not a bad thing, if it's handled well.

Debate could mean the other person thinks you are trying to "win", so fights back.

When you talk with someone, they might not feel safe.  This is where silence and sarcasm and cheap shots come from.  They're being defensive.

You might be tempted to sugarcoat the message, water it down, dress it up.  This is actually avoidance even though you might think it is helping.

Skills

What Do I Really Want? (ch5) One skill to develop is not getting stuck on what is said to you.  "Step out" of the "content" of the conversation.  Your goal is to communicate to solve a problem (for example). 

Apologize Appropriately. (ch5) When you've hurt others, start here.  Express sorrow for your role in causing pain or difficulty.

Contrast. (ch5) This provides contextnot apology. It's prevention or first aid. When people misinterpret your statement, address their concern and then confirm your respect or clarify your real purpose. "The last thing I wanted to do was communicate that I don't value the work you put in.  I think your work has been nothing short of spectacular."

Another way to contrast: "Let me put this in perspective.  I don't want X.  I do want Y."

Create a Mutual Purpose. (ch5) Be willing to abandon your strategy, because the goal is what's important. And when the goals don't match, be willing to abandon them for a more meaningful or rewarding goal for all. Once the goal is agreed on, then you can brainstorm strategies together.

Emotions (ch6) An essential tactic to controlling your emotions is to think them out.  This is a skill that gets easier with practice. What stories do you tell yourself which causes your feelings?

Slow Down (ch6) Learn to retrace your path through (1) noticing your behavior as fight or flight; (2) get in touch with your feelings that cause it... This Is Difficult!; (3) analyze what story is causing this emotion; (4) get back to the facts of the situation that seem to support that story.

How to Make Decisions. (ch9) Command, consult, vote, or consensus.  
  1. Use command with low-stakes issues, OR where you completely trust the delegate.
  2. Consult is efficient for gaining ideas and support without bogging down decision-making.
  3. Vote when you need to efficiently select one of several good options.
  4. Use consensus with high-stakes, complex issues where everyone must be on board.
How to Make Action Items (ch9)
  1. Who?
  2. does What?
  3. by When?
  4. and How will you follow up?
Document Your Work.  If you've gone to the effort to complete a "Crucial Conversation", don't fritter away all the meaning you created by trusting your memory.  Write down the details of your conclusions, decisions, and assignments.  Record who does what by when. Revisit your notes at key times (usually the next meeting) and review assignments.

Emotions (ch6)

After we observe someone's behavior, and just before our emotional response, we tell ourselves a story.  We add meaning to the observed behavior.  We interpret the behavior and guess at its motives.

These interpretations are theories.  And the interpreter runs at physical-reaction speeds, because it's set to evaluate danger.

We then judge that motive as good or bad.

Then our emotions respond, and then we act.

Until we learn to tell ourselves different stories, we cannot break our emotional loops.

Emotional Literacy

Talk openly with others about how you feel.  This helps build your vocabulary.

Cheated
Embarrassed
Humiliated
Surprised
Violated

...and a hundred more.

Three Clever Stories to Watch For

Look for these when you're talking to yourself.

Victim Stories "It's not My Fault"

There is no such thing as an innocent victim.

Villain Stories "It's All Your Fault"

This exaggerates our own innocence, by the way.

Helpless Stories "There's Nothing else I can Do"




Interpreting Behaviors

Anger / Highly emotionally charged = feeling disrespected.

When people feel unsafe, the personal styles are fight or flight:

  • flight - avoidance, silence, not contributing, witholding
  • fight - scoring points by winning an argument



Other books to read: 

Strength Finder (know yourself)
Learn to Lead

Notes from the book "Leadership and Self-Deception"

EXECUTIVE SUMMARY

p31,1p.  "People skills" are only effective if you're putting their needs [at least -rje] equal to yours.

i.e., seeing them as people with legitimate needs.

["don't be a jerk" -rje]

p148 This is how you get out of "the Box".


DETAILS

p32,4p People respond to how we feel about them.  (p44,9p) ...not what we do so much as how we're being.

p33,7-9p Are their needs important?


p37,1p We always look at others in one of two fundamental ways: as people, or as objects/nuisances.

ACTION ITEM: p43 How many names in your division do you know?  Why should you care?


p68 "Self-betrayal" is: 1. when you have a sense of doing something for others but don't do it, 2. then vilify the other, 3. or feel like a victim.  Both reactions are to push your guilt onto someone else by justifying our sin.  [In the long run this makes things worse and complicated. -rje]

p77,6p. How the Process Works

1. betrayal of conscience ["sin" -rje]
2. conscience accuses
3. divert blame; justify
4. get angry at others b/c they're to blame
5. people now don't seem to deserve help

The Box' Nature

pp98-100 "In the box" behavior encourages "in the box" from others.  This state is dysfunctional.  It undermines relationships.  It makes you destructive.

"The box" wants to be fed by others' poor behavior.  Its need is to have others behave badly too.  It seeks to be justified by others' bad behavior.

ACTION ITEM p103,7p I'm not doing anyone a favor by letting them run over me.

OTOH if I'm in the box, then I get just what I need, if someone runs over me. I get justification. And we're both miserable.





Tuesday, April 27, 2021

IT Trend for 2021: Increased Internet Regulation

Tech (in particular, internet-based commerce) will be more regulated by governments -- with China on a more aggressive schedule than the U.S.

Since China has a highly-centralized, one party system, they have no internal obstacles towards following their whim. So, companies like Ant and Alibaba face direct intervention by China.

The U.S., on the other hand, can't so easily decide to beat up on tech companies; the government is more distributed, and split into at least two power bases (and more if you divide things up on axes based on social and economic positions).  

In general, regulation will be along the anti-monopoly lines, as these behemoth tech companies start to look just a little evil as no competitors arise.


Tuesday, January 19, 2021

Good Programming and Good Programming Languages

 The Executive Summary

"Good" code has two features:

(1) Disciplined developers. The most important factor.  Their most important rule is The Boy Scout Principle: Leave it better than you found it.

(2) A disciplined language.  There are lower limits: for example, BASIC doesn't cut it.


The High Level View

Think: How Would You Build a City?  By separation of concerns; i.e., Abstraction and Modularity.

Good code is broken into subsystems (modules, classes, whatever) which are "loosely coupled".

Subsystems DO ONLY ONE THING AND DO IT WELL.  Some call this the "Single Responsibility Rule".

Subsystems (once tested and finished) should NOT BE MODIFIED: instead, write a new subsystem ("extension") that uses the subsystem (via abstraction!) and changes or extends its functionality.  Some call this the "Open/Closed Rule".

Dependencies (ideally) ought to be managed through abstractions; i.e. "code to interfaces".


Messy Details

Functions and classes should be small (i.e. "do only one thing and do it well").  When a thing loses cohesion, split it up.  Yes, this will increase the overall code length -- but usability, readability, and maintainability all go up.

A symptom of functions doing multiple things is the passing of flags as parameters.  Passing a boolean into a function is generally horrible.

DRY ("Don't Repeat Yourself").

The Principle of Least Astonishment applies to functions, classes, etc.

We all know that data should be hidden, right?  (Law of Demeter).

Use Unchecked Exceptions and please avoid Checked Exceptions as much as possible.

Write tests for 3P code you use (no, really!  Can you think of two reasons why?)

Test-Driven Development saves you from the temptation of massive "improvements" which ruins the code... by forcing Incremental Changes.

Building or Testing should be runnable with just one command.

Polymorphism is better than if or switch.



Monday, December 21, 2020

 IT Trend for 2021: Customer-focused Digital Experience

Shopping, education, consulting, and medicine went digital in 2020. Quickly, better experiences such as Zoom stomped out less-equipped platforms such as.... well what was their names again?  Already forgotten?  Exactly.

Every company with a digital presence is under scrutiny by a couple billion online humans who are trying to navigate user interfaces.  And finally, the badly designed ones are either getting fixed, or are dying.  Welcome to the age where User Experience (UX) is king.  It's about time.

UX is bigger than a pretty UI.  It includes customer service.  In short, anything that can efficiently and effectively help the user, fosters loyalty and the bottom line.  It turns out that being good to your customer is good for business.  I'm looking at you, AT&T.

When Anti-Global Is Good Business

It turns out that communication is better when it's local. To effectively talk to your customer, you have to employ people in their region. With some luck, this will bring back jobs from off-shored call-centers. Typically, these customer service jobs require interpersonal skills. However, they also reward the knowledge of business processes, and therefore can be avenues for career growth.


 IT Trend for 2021: Your Job is Going Supernational

You think it's a melting pot now?

It's not that you won't be able to go back to the office. People will -- and some people have to.  Communication will still be easier when you're face to face. And some jobs can't be full-time remote.

But remote will be the preferred mode for programmers. The concept was tested on a wide scale and was successful. Couple that with a healthy cloud network and low-code programming, and you've got a field ripe for remote FTEs and contractors.

Note that these were possible in 2019, but in 2021 will be easy.

(1) IT Goes to the Highest Global Bidder

Even more now, the national IT shortage is fillable by global talent. This will affect our market, from educational funding to hiring practices.  This could infuse cash into developing countries directly, by paying local contractors without requiring relocation.

 

(2) Four Hour Commutes  

It's all about location location location, right?  Well, now the 15 minute commute is a luxury no more.  Now you can choose to live... elsewhere.  How about a four hour commute?  It's now less of a pain -- if you only have to go there once a quarter (or less!).  Love the job climate of Dallas, but prefer to live in friendly, hip college town Norman, Oklahoma?  Or scenic Glen Rose?  Or among the graceful piney woods in East Texas?  NO PROBLEM.

Exurbs are back, baby, and with a vengeance.

 

(3) Branch Offices

You can work near a branch office instead of the one you were assigned to pre Covid.  Want to work for USAA but don't want to work in Dallas?  Fine: move to the HQ office in San Antonio.  Doesn't matter!

A variant of this is companies establishing little satellite offices in other cities to give remote employees a quarterly gathering-place. 

 

(4) 24 Hour Commutes

Potentially, an FTE can work VERY far from an office.  As in, another country.  Prefer the coastal resort village of Zihuatanejo?  NO PROBLEM.

So your company, in many cases, could hire excellent developers from anywhere around the world.

 

(5) Managers are Also Outsourceable

Remote could also become a preferred mode for managers.  Some management may even become an outsourced business (why not?).


Monday, December 14, 2020

 IT Trend for 2021: Low-Code Tools

It's here at last: a computer system which generates genuine program code. No more bolting together pre-written modules, doctored by parameters. No more having to write the odd patch or additional program by hand. This systems accepts program and suite designs at the flowchart level and generates the code necessary to meet your needs. Exactly.

- Marketing hype from 1981.  http://www.tebbo.com/presshere/html/wf8104.htm 

Back in 1981, a computer program was released, modestly called "The Last One". It was, allegedly, the "last" computer program for business you'd ever have to buy.  This is because it would be able to automatically write the source code to any program you needed.  Just give it the specs, and it would churn out an application.

https://en.wikipedia.org/wiki/The_Last_One_(software)

Last summer, I did some reading up on "low-code" tools. These are programs which come with a pre-fabricated set of UI input and visualization elements, a straightforward way to integrate them with data schema, and hooks for defining business process flow.  Pega is one of the more prominent tools in this list, but there are a lot of them.

There's a lot of interest in these things, much more than back in the 1980s.

This is because programming is difficult. Also, increasingly, UIs are standardizing on an understood and usable set of widgets. Finally, some "digital work" is highly structured and established, such as customer service intakes (think about your doctor visit check-ins), some customer expert systems (think call centers), and some reporting.  And demand for programming is increasing.  And, to some degree, "A.I." can be of assistance, in either design or production.

Thus it makes sense to give productivity a boost by (a) giving developers tools to program some work (much) faster, and (b) potentially widening the net for who can be a programmer.

The modern versions are more sophisticated than The Last One. And frankly, I think there's a lot of business processes written in code, that is better automated than hand-curated.

I think 2021 will be a good year for these tools.




Friday, December 11, 2020

 IT Trend for 2021: A Tale of Two Clouds

Quick!  You want to get out of running server farms.  You want to get out of DR.  And there's an MBA breathing down your back to cut costs.  What do you do?

Easy!  Go to the Cloud!  Solve all your problems.

Fast Forward Two Years.  Now you connect employees, customers, third party vendors, business partners, and myriads of IOT devices together... with not one cloud, but three, four, or five different clouds.  Oh, and maybe a couple of hybrid solutions, too.  And it's frankly a big headache, perhaps worse than when you had on-prem virtual server fams in several systems talking with each other through SOAP.

And you may ask yourself: well, how did I get here?

Maybe you simply migrated existing applications, instead of writing cloud native versions. You know, to save time and money.

Maybe the companies you interface with already do things their way, with their own cloud solutions. 

Maybe you postponed governance for later. You know, to save time, and maybe money.

Maybe you postponed security considerations. 

Maybe this big multi-cloud solution is highly coupled, with low cohesion!  (Didn't we learn this lesson 30 years ago?)


When you have all those moving parts, reliability suffers.  The whole system is only as reliable as its least-reliable piece.  The human brain can't understand the whole system when the whole system is a gigantic monstrosity.  (Didn't we learn this lesson long ago?)


But actually, I think there will be TWO emerging trends here:

(1) BRAIN FIRST.  The First Cloud is Governed.  It is built up of microservices; experience-driven UIs; legacy systems; and simple, native applications.  I say simple, because they will largely be written by low-code or no-code generation systems.  In some cases, they may even be automated to some degree.  It will encompass multiple clouds, but because the effort has "governance", migration and adoption are both well-thought out.  

(2) GIT 'ER DONE.  The Second Cloud is built up of a combination of migrated applications and custom native applications, as before.  But to save up-front time and cost, governance is ineffectual.  As a result, there will be chaos and tech debt.  Since we live in a time of fast turnaround, that means the Quick Solution also turns ugly faster than it used to.  For cloud-engineer contractors who love creating order from chaos, this will be a good time.


Other Results of Effective Governance

In brief.

  • cost control
  • data protection and privacy
  • future proofing



 IT Trend for 2021: China retreats to Statism

"Politics Come First" (with Chinese energy policies).

Jack Ma, China's wealthiest man, offered parts of Ant to the Chinese government (as if they couldn't just take what they wanted already). 

Mr. Xi doesn't trust the private sector -- and with good reason: by definition it's not communist.  So, he is increasing the communist party's presence in businesses.  Thus the Party decides... whatever it wants to. When and what to produce, what to pay workers, and what to charge people for the stuff they make. That's the endgame, anyway.

We already know communism in general, and Chinese communism as an example, doesn't believe in inalienable rights. Now we see that, by corollary, they also don't like the very market forces which shaped their growth explosion.


As you can already guess, I think this will affect IT.  For one thing, investing in China as a tech innovator becomes more difficult when you have no idea if that investment will be well spent.  

Now don't get me wrong -- I like to think that the USA is the only innovator in the universe.  But it seems to me that innovation in general can be, ought to be, good for everyone to some degree.  So hampering innovation (without a good reason) tends to not be a good thing.

Consider. Incremental improvements are awesome. Consider a 1% increase in the efficiency of solar cells, or a 1% increase in battery life, or storage capacity.  That can be a game changer.  Civilization lives on the margins. And for the past decade or so, China has contributed, and the world has benefited.

No more?






STAY TUNED for Trends; Docker; Perl6; and C.

I plan on getting back to using this blog.  There's always material to blog on; the trick is making it readably useful:

  • A curated list of current IT industry trends that I find interesting.  
  • My notes while learning Docker.
  • Musings on WORST CASE SCENARIOS.
  • My notes while learning Perl6 (a hobby).
  • My notes while writing C (another hobby).

Thanks to my two loyal readers for sticking around!

Saturday, July 25, 2020

Commander X16 is on its way...

In case you haven't heard, there's a new 8-bit retro computer being built, and it's new but old.

Try it out online here: https://www.commanderx16.com/forum/index.php?/home/



It's not a clone, so it's a new architecture.  And yet, it re-purposes an old, established architecture, so it's old.

The Commander X16 is a Commodore clone.  Since it uses the Commodore KERNAL and BASIC and runs with a 65C02 processor, it is as compatible with the Commodore family as the other Commodore machines are with each other.  But since it's not a C64 or PET or Plus/4, binaries from them will generally not run on it... unless, that is, the code is in a safe location and uses the KERNAL's jump table.

It supports the IEC serial bus, so you could attach a disk drive if you really wanted to.  But it replaces the cassette port with an SD card slot (good call!).

It's got a neat memory map, too.

The basic architecture draws from the VIC-20, which is uncomplicated: the ROMs are in the highest chunk of memory, and there's static RAM below it.  Static RAM itself is uncomplicated, compared to the dynamic RAM of the C64 and on.  Because we live in 2020, 64K of static RAM is cheap.  Back in the 80s, I suppose it was very expensive.

After that, things get interesting but still not complicated:

There's 39K of RAM, from $0000 to $9EFF.  I'm not sure how that's divided up: I bet it cheaper just to install a single 64K static RAM chip than to install a 32K and a 16K one!

Then there's a page of I/O registers, from $9F00 to $9FFF.

Then, there's 8K of high RAM, from $A000 to $BFFF.  Here's the tricky part though: this 8K window is banked.  In the production model, the bank will be switched at Zero page location $0000 (sound familiar?).  The X16 can have up to 256 banks of this RAM, so up to 2mb of RAM.

After that comes 16K of ROM, from $C000 to $FFFF.  This is where the KERNAL and BASIC ROMs live.  But there's another tricky bit: this 16K window is ALSO banked.  There are already four or five banks allocated, with one for GEOS, one for a proper assembler, another for a Structured BASIC, and so on.

Because 8-bit video chips are nonexistent, there is an FPGA for that.  Sound is still being discussed, I think, but of course the designers want sound to be stereo and at least SID quality.

Thursday, February 11, 2016

Perl6: classes and working with binary data

ROOM FOR IMPROVEMENT: It would probably be better if the class defined below implemented the Buf "role".  That way, code that used it could (for example) call .list and .elems directly on the class... which I think would be a very nice way to open up the class.  Or is that TOO open?  Meh, I think people who hack on Commodore 1541 diskette images should be implicitly trusted.

class Image {
    has Str $.sourcefile is rw;  # accessors auto-generated
    has Buf $!buffer;            # private, no accessors

    has $!hdr = (17 * 21) * 256; # byte offset
   
    method load() {
       return "no sourcefile specified" unless $.sourcefile;
       

       # read in a binary file
       my $fh = open( $.sourcefile, :r, :bin );
       $!buffer = $fh.slurp-rest(:bin);
       return "$.sourcefile loaded";

     
       # (oops - forgot to close the file)
    }
   

    method size()  { $!buffer.elems }
 


    # Each of these methods return "Buf": a class used
    # for dealing with binary data buffers.

    method label() { $!buffer.subbuf($!hdr + 143, 16) }
    method hdr()   { $!buffer.subbuf($!hdr, 256) }   
    method dir( Int $index ) {
        my $offset = $!hdr + 256 + $index * 32;
        return $!buffer.subbuf($offset+2, 30);
    }
}

my Image $test = Image.new( sourcefile => "mule.d64" );
say $test.load();
say $test.size(), " bytes read";

my $hdr   = $test.hdr();  
my $label = $test.label();

print "Label: ";
for $label.list -> $val {
   if 31 < $val < 92 { print chr($val) }
   else { print '.' }  
}
print "\n";

my $blob  = $test.dir(1); # (actually the 2nd entry)

for $blob.list -> $val {
   if 31 < $val < 92 { print chr($val) }
   else { print '.' }  
}


% perl6 Image.p6
mule.d64 loaded
174848 bytes read
Label: .M.U.L.E........
...MULE.2.....................


Friday, February 5, 2016

Wednesday, February 3, 2016

Perl6: insane (in a good way)

Just an example.  I can't believe how amusing yet efficient this syntax is.

my  %ingredients = :4eggs, :2sticks-of-butter, :4cups-of-sugar;
say %ingredients;
# OUTPUT>>:
# cups-of-sugar => 4, eggs => 4, sticks-of-butter => 2
 
 

Is Perl6 really Perl?

There has been some discussion about whether Perl6 was mis-named.

I thought that that was a silly discussion not worth getting involved in.  It's quite obviously Perl in some form.

The argument, if I understand it, is that Perl6 "sounds like" a version increment from Perl 5.  This violates the principle of least surprise.

OK, I can understand that.  In that sense it would be mis-named.  But then what do you CALL it?  I haven't seen any suggestions.

So I'll suggest one based on the compiler used for it.  Call it Rakudo.  At least until a better name is thunk up.