Saturday, October 12, 2024

ThumbToolTipValueConverter for Slider in VB

I recently was doing work with sliders in UWP and had to implement a ThumbToolTipValueConverter using VB. One problem I had was the example on that help site was rather complex given the implementation I imagined. But that happens a lot. 

Here is a simple example that takes values of zero-to-one and converts them to zero-to-a-hundred. The task is changing the opacity of a screen object -- the orange circle pictured below -- using a numeric range of 0-1, which is the slider value, but displaying a more user-friendly range of 0-100 in the slider tool tip box. 

We declare a class that implements IValueConverter. (Hitting enter after typing the "Implements IValueConverter" part of the code inside a valid class definition should autofill the implementation functions Convert and ConvertBack. ) In the Convert function, we put our conversion code. 

Then we declare a variable with the type of that class. In this case the class is called IVCMult_100, and our variable is called Converter1. It also has to be initialized using New, or it won't work. Then Converter1 is assigned to the ThumpToolTipValueConverter property of the slider after the page is created in the Loaded proc. 

Note: Because a starting value of 1 is assigned to the slider, Slider1, which differs from the absolute default of zero, this triggers the Value_Changed event. But the slider is created before the object whose opacity gets changed by it, so that call has to be avoided at that point in time, or a Not Found error will throw. That is why we use a simple boolean test EventsOK to make sure all the page is loaded before we allow manipulation of the opacity of that object. 

Code:

<Grid>
    <StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="50,50,0,0" Orientation="Horizontal" BorderThickness="1,1,1,1" Background="Black" BorderBrush="White" Padding="6,6,10,6">
        <StackPanel>
            <TextBlock Text="Opacity" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="18" Foreground="White"/>
            <Slider x:Name="Slider1" Maximum="1" TickFrequency="0.2" StepFrequency="0.01" Width="250" Margin="10,10,10,0" Value="1" RequestedTheme="Dark"/>
        </StackPanel>
        <Border Width="1" Margin="0,0,10,0" Background="White"/>
        <Border x:Name="Border1" Width="100" Height="100" Background="#FFFF9800" BorderThickness="2,2,2,2" CornerRadius="49,49,49,49" BorderBrush="White"/>
    </StackPanel>
</Grid>


Public NotInheritable Class MainPage
    Inherits Page

    Private Class IVCMult_100
        Implements IValueConverter

        Public Function Convert(value As Object, targetType As Type, parameter As Object, language As String) As Object Implements IValueConverter.Convert

            Dim Sn1 As Single = value * 100
            Return Sn1.ToString("0")

        End Function

        Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, language As String) As Object Implements IValueConverter.ConvertBack
            Throw New NotImplementedException()
        End Function

    End Class

    Private Converter1 As IVCMult_100
    Private EventsOK As Boolean

    Private Sub Slider1_ValueChanged(sender As Object, e As RangeBaseValueChangedEventArgs) Handles Slider1.ValueChanged
        
        If EventsOK Then
            Border1.Opacity = e.NewValue
        End If

    End Sub

    Private Sub MainPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded

        EventsOK = True

        Converter1 = New IVCMult_100
        Slider1.ThumbToolTipValueConverter = Converter1

    End Sub

End Class

Saturday, December 16, 2023

Time Fries

Another year gone by. I always say I will post more but am wrapped up with stuff. 

This year Genevieve continues at college in year three as a senior. She is working on getting into grad school. I figure anyone should want her at their school. Here she is on the couch with Nancy, the very spry cat, who will be eighteen in April. 

Like most young people Genevieve knows how to take "selfies." 

Genevieve still gets very high grades and does not get into trouble. School is a difficult place, beyond the work. Sometimes I feel bad that she is somewhere having difficulty, you know? She was home for Thanksgiving and we watched Sumo together those few days. She picked Ura this time. Though he did not come close to winning, he will likely get a promotion into the higher ranks. 

I picked Kotonawaka. He started out very strong, but did accumulate losses. 

Regina went with the new kid, who is very strong and shows skill, Atamifuji. He was in the running for the cup. But, Kirishima won again. There are also the other guys we root for, which is most every other wrestler. They all have personalities, but are not ostentatious about that. 

Maybe we get snippy with Takekeisho. 😔

I like that Sumo is down-to-Earth -- well mostly. Sometimes the people get into, well, stuff. We featured Ichinojo a couple of posts ago. After he won things became difficult for him. Winning can hurt some people I guess. Now he does not even wrestle anymore. I hope [one] who still suffers can find a way. 


People watch Sumo from the high-up seats. Many fans are women. 

---

I did not think there would be more war this year than last. Wow. Wrong about that. 

Regina lost her mother this year, so Gen's last grandparent has died. It is good she got to have Regina's parents as figures in her life. I liked Regina's mom and she liked me. I called her Mom. She would praise how attentive I was with the baby. She was well into her nineties. Genevieve has lots of relatives, all of them Regina's relatives. The only relative of mine she ever met is me. 

I had two more operations during this summer. One had me in the hospital for a couple of days. Summer vacation, I called that. No pictures! (ha) 

Regina's Mother died right before I went into the hospital and Regina had to stay home to be with me. I feel guilty about that, but I needed this operation and had already gone through a painful preop procedure.

Genevieve is uptight because I got my third kind of cancer, but we assure her that it is nothing in relative terms, because they've all been removeable. Not like I have needed chemo, or to use the survivor word. 

The most recent is was the least dangerous kind I've had, albeit in my face. There was more cutting than I expected, but I understood the method described to minimize scars because it was how I put together the turf on my front lawn where the area was radiused in the same way. Though the surgery center was called mohs, I refrained from making Three Stooges jokes. No sense introducing fail sense. 

I did fall when I was there, so when I was in the hospital for the other surgery, a couple months later, they made me wear an embarrassing bracelet saying "fall risk." I was going to point at it and complain but it is still Summer and how can I hurt a season?, but meh. Somehow I am worn out on the delivery side of old-man jokes. It was an average hospital. It felt humid. 

I was troubled by the hospital's food. It is pretty crazy to have people try and cajole me into eating, especially on seven drugs. Some person called me from the food place, a dietician I assume, but I had no idea what was going on. I thought my sense of taste had gone wrong, but I did find some decent chicken broth under (four hour cooked, how are they whole?) noodles at some point. But the noodles kept getting in the way and on the spoon so I gave up halfway through because I found them offensive.

I refused to tell them I thought the food was bad. 

They would be pretty insistent about me consuming nutrition drinks. I would drink half of one to get them off my back. I did not think much about not eating. Just the way it is, it seemed, nothing to get alarmed about. What am I doing but lying there doing nothing. 

I mean if some folks want to, they have no problem doing npo for weeks on some guy. *Cough*  

When they needed to put Regina's father into a nursing home, my advice was to make sure the food is OK. That's what I would tell anyone. 

Two days after I got out of the hospital we all caught the 'Rona. So there was more fun. Right when I came out of that, after weeks of just being home sick after taking the drugs (which worked ok), was the New War. Kind of stressful, the kiting of things like this. 

But we're OK here. Our lives go on. I do some things around here that are cool enough, like build non-wobbly pool stairs. I don't worry much about getting sick at all. 

When I see some guy wailing up a clown show on TV about how he needs revenge for being stupid -- now that's what is scary. I've been around long enough to know that. 

So anyhow have a good holiday and New Year. Don't sweat the big shit. It's living.  

Tuesday, November 29, 2022

My CS UWP Custom Video Effects

This is about, and a listing for, different effects I wrote using the IBasicVideoEffect interface, and wanted to share. 

Doing this work require a familiarity with coding in general, implementation of the Media Capture object, and some understanding of the basic video effect interface. If you set up a Media Capture using Basic photo, video, and audio capture with MediaCapture, or with this simpler one Simple Camera Preview Access  then add a custom video effect from the hardware sample (the second half, at the bottom of the linked help page), and it works, you are close enough to there.

It is a lot of work. Especially UI, structures, and getting everything to run right. 

Everything is in C-Sharp anymore, now so are we. Stuff that uses pointers is subject to the typical IntPtr warnings, and is 'not meant for production.' 

First off, here are the effects I wrote. I will provide the sealed classes and documentation for each of my components on separate pages here on this blog. 

It need to be mentioned right now is that the true bitwise effects are slow. There is no video hardware accelerator for such things. Using them in a chain can cause hangs. High resolution use can cause frame rates to slow. These were tested at a maximum resolution of 1920 x 1080. 

FramePoolEffect -- have a ready circular frame pool running alongside the video all the time, grab a near-new frame immediately. 

FrameAcquireEffect -- acquire frames one at a time, pretty fast, without async calls. Except for the one async call. Oh. 

Eye Yam XORING.

FrameWidthXorEffect
-- xors every frame, bitwise, pixel by pixel, with its predecessor. (see picture)

FramePoolXorEffect -- xors every frame with one that is (framepoolsize -1) frames back. Adjustable frame pool size. 

I am shifting left by 3 bits.

ShlEffect
-- Shifts the bits in each pixel's rgb channels left any number. Strips out the upper bits, and brightens the lower ones. 

I am not watching moving content at all.  

FramePoolBlankingEffect -- This blots out moving content, and three variables can be adjusted to blot out anything that moves over most any short time frame.    

I am zooming where it says OK.

ZoomEffect -- Uses hardware acceleration to cut out and upscale an image segment to output. I use this to zoom my video output. 

Notes: 

It should be noted that while I have been able to implement effects in a Media Capture environment without problem, I have yet to get one to work with Media Player. There are still some things I want to try, but have other things to do.   

The documentation for the TimeIndependent property of the video effect says to set this depending on if it is time independent or not. But explains nothing about what that means in any context. Whatsoever. I did run into something else that was time independent/dependent but it was a bit obscure as to whether that is what is going on here. The hint was Media Capture was time dependent, while composition, which can run at whatever speed is not. All the same

More things not mentioned include the inner void "Close" being called when the effect starts up as well as twice, with different parameters, when closing. So if you are erasing some pointer or unhooking some memory there, you need to check the pointer for null, because it will sweep through again, and waaaaaay before.  

Also, the void SetProperties runs twice on startup. So that is not the place where you want to be allocating memory, for instance. Maybe that has something to do with me debugging. 

Loose Discussion: 

I have been playing around recently with the IBasicVideoEffect Interface after mastering Media Capture. I stumbled across the custom video effects page at Microsoft Docs. Bookmarking it, I supposed one day I would "figure it out." I seemed so arcane, and everything was in C-Sharp as well. Then I learned some CS, and was good enough to go. 

After working with it some, I ported everything to VB. But then went back to C-Sharp. I don't know why. Just felt like it. This is made possible because Custom Video Effect code is independent of project code, and even resides in its own project. 

Programming any of these things requires patience and troubleshooting skills. 

Just working with the Media Control was touchy. Media Control often fails sometimes on video handshake. A big problem because it throws no error and reports back as running and OK. 

A programmer's dream there.  

To test to see if the Media Capture is synced with the source, I check to see if it can deliver on MediaCapture.GetPreviewFrameAsync ... it may crash, but if the MediaCapture is running but not showing video, it typically will just bail into the ether without throwing any error. So I wrap the test in a timer loop. If the Video Frame exists after some period of time, that means the code has not jumped into nothingness. Otherwise I have to do a whole new reinit after closing the Media Capture object and getting rid of it. The timer loop's time should be generous. It can take a while to deliver a frame. 

It is a very hard error to track for the reason it fails without flag. Was a big pain in the ass for a few hours there. Or a couple of days! Most of the time was wasted going over properties of things trying to find a flag that would indicate an error state. Then I got interested in what the black frames were made out of, which is when I started trying to get them through that async call, and came up with the checking paradigm. The black frames of nothingness are exactly that. 

One of the problems with programming is so few things work "right out of the box" when implemented. Stuff that does is sub par. Everything need configuration and customization. Lots of "scratch" work. 

The first effect I made was a motion blanker. The idea was to use a second computer to display the content I was trying to read, but blank out any motion, so I can read that content. 

After that I played around for a while with full 32bits-per-bit masking. One problem with those is the amount of processing time. Two hundred milliseconds. I can use it for composition, if I ever have that. Slowly. 

I then worked my way through simple bitwise operator effects using back frames. The most dramatic of these are the two XOR effects. These ran at 50 ms/frame, on my I7 3000 for 1920 x 1080. I tried other bit comparisons, OR, also AND but they were meh.  

I actually watch TV sometimes using the XOR effect, especially cartoons. You really get to see how they were drawn by the amount of motion. Only things that change, that is what you see. 

Note that normal Graphics.Canvas.Effects items run way faster than this when you are processing frames. 

For instance I have a video effect class that uses the Atlas and Scale Graphics.Canvas.Effects inside its processing cycle, instead of my bitwise things. It runs around 10 ms at 1920 x 1080, and does not stumble. It is fast because it employs special hardware video processing. Which is available on my computer, and most any other windows PC -- no video card necessary. There is a passable hardware visual processor as part of normal architecture, I assume. Have never seen one missing hardware video, in recent times, though it can be turned off in settings. 

There is a long set of those kind of fast-processing hardware effects to be found. Ones that can be used in custom effect like here, normal drawing on a CanvasControl and game drawing on a CancasAnimatedControl. They are here at Graphics.Canvas.Effects. 

I combed it for ones that I could use to implement bitwise things, to no use. One had an "exclusive or" option as a parameter, but I am not sure what they were going for with that, because it looked no where near true bitwise xoring when I set it up. Lots of blends, shading, different math and tables, but no fricking bits. Maybe I missed one when I was tired reading. There sure are a lot of them. I did work through them several times. 

With a little down-conversion my less radical bitwise effects will run fast enough for real time. I can run a Frame-to-Frame or Frame Pool Xor effect at 1360 x 768 and 30 FPS with fair success. Again, on an I7-3000.

If you have read this far, well, thanks for reading. 😺 Good luck!

Monday, November 7, 2022

Leaving Summer, way late.

The November Sumo tournament looms. Yeah! 

In September, Tamawashi, who I never would have picked, won. Genevieve picked Hoktofuji, who did lead early and was strong, but finished lagging. Regina had the Yokozuna Terunofuji, of course. 

So this was not so hot a tournament for her, what with him leaving it hurt before the end. He has knees like Joe Namath. If Namath's knees were worse. Maybe if they did not make him do the wear lightning bolts and ruin your knees moar dance at the start of  every day's matches.  

Like usual I root for one guy but pick another to win. I picked the Ozeki, Takakeisho, to win. He did OK, but seemed rather harsh. He got the giant stack of envelopes full of money at the end, because he won the final match. Not a bad-looking haul, but no cup. 

Last tournament's winner Ichinojo finished way back.  

Of course I root for Tobizaru, but I don't want to paint my expectations of winning on my fave sumo. He had his best performance as a top-class sumo yet, at 10-5, and got the outstanding performance award. In the next tournament he will be promoted in rank. Tobizaru is being called "cool" by everyone. He was kind of the star of the tournament, despite a number of losses. Has a good attitude. 

The tournament seemed rough around the edges, and there seemed to be more aggression than usual. Each one has its characteristics, as do the days within, like themes or spirits. More or less. 

***

I was glad that Genevieve could get some rest from school, here, during the Summer. Man, there is a bet I would play a dollar against and expect an easy two cents on a buck as much as the sun rises in the morning.  

Her school is the place where Munger is funding a dorm, and insisting the "bedrooms" be windowless. I don't think any realtor(TM) could call a windowless room a "bedroom." It is a utility room. I don't like the concept at all. Especially the trapped into socializing aspect. Some folks need time alone. 


It is beautiful there. Here is a view of the lagoon and ocean beyond. Most anyplace won't be as nice to live as Santa Barbara. I used to look at house prices there. Two years ago they were pushing $1700 / sq ft. It is one of the nicest places in the world. If you don't mind a COLA that is two or three times here. Ten-dollar meal costs twenty. Lower range motel: three hundred bucks a night.  

---

Regina is well as usual. For everyone who knows her, the good news is she can see, well. That is like magic, yes?  After having surgery to restore vision, a while ago, in both eyes, she can see as better than me. Did I mention that before? It's still cool. 

This Summer I had "major surgery," again. This is the first time this century that a major surgery was cancer. Now my second test out says no cancer. Maybe everything will be ok. 

I stay pretty healthy despite all the fun. Pulse is fifty, haven't drank since the 80's, quit smoking fourteen years ago. I miss smoking. Like everyone who ever smoked, and loved it so much.  

Never miss drinking. 

We're looking forward to Gen being home for Thanksgiving. She is in her second year at college, as a Junior. Still an A/A+ student. At UCSB no less. Where just getting in is a huge task. Once again I am proud, despite the fact she does all the work. She can take any small thing and grow with it, but also can think straight and get all the work done. The best of the two of us in some ways. 

There is water falling from the sky out there! We are informed those water droplets are called (whimsically?) "rain." Ha, what a concept! I pretty much figure a 1200 year drought could just as well be a 10,000 year drought. On the other hand it sure would be nice to be wrong about that in this case.  

Stay real.  

[con edits] Is this my Christmas letter? Oh no! Guess I am stuck with it. 

Monday, July 25, 2022

We Watch Ichinojo Win the July Sumo Tournament

Watching nhk Sumo as usual with the family. The tournament started with the shadow of Abe's death and everyone was grim both in the ring and audience. I don't think the undertone left for the duration. 

Genevieve had picked Ichinojo. Guess she wins this time with a dark horse pick. Regina had the Yokuzuna Ternofuji, whom she adores. I was rooting for my fave Tobizaru (the flying monkey) to get as many wins as he could. He did alright before coviding out. 

Here is Ichnojo in a screen cap, with the emperors cup. 

Ichinojo holds trophy.  

He gets to look at himself in that tiny moment while the world spins by. He also will need a room for all the trophies they gave him, which is typical. 

I told Gen and Gina I would just stack them in the bathtub and turn on the shower when they got dusty. Typical John thing to say. Maybe lash them in with some screen too so they don't fall out if there is an earthquake, badly nailed to a crumbling wall with old rusty nails I found in the backyard. Is my family Guy style cutaway done yet? I love to share them with Genevieve because she can imagine them with fine granularity and enjoy the cringe. 

Trophy people must have a hell of a time in an earthquake situation. "Oh no dear, all my trophies are knocked have fallen over!" First you hear then clanking against each other. Scary, like Jaws. But trophies. 

Sunday, April 10, 2022

Like an Earthquake or Hurricane

JenJen's college art class required an artistic pun. So here the one is. I am proud of that work, despite not having done it! Parenting. 😀   


Monday, December 20, 2021

Draw big ascii block letters in vb and cs

I felt the need to draw big ascii letters like this:

'   ▄█▀▀█▄            ██                    
'   █▄▄  ▀▀  ▄█▀▀█▄  ▀██▀  ██  ██  ███▀█▄   
'    ▀▀▀██▄  ██▄▄██   ██   ██  ██  ██  ██   
'  ▀█▄  ▄█▀  ██  ▄▄   ██   ██  ██  ██  ██   
'    ▀▀▀▀     ▀▀▀▀    ▀▀▀   ▀▀▀▀▀  ██▀▀▀    
'                                  ▀▀       

So I wrote a program. The output should be used with a fixed-space font, like the Courier font used above.  

Instead of cluttering up the page with code that does not look good either, the code sections can be found at these links:
https://github.com/johnhaz/MakeBlockText/blob/main/MainPage.xaml
https://github.com/johnhaz/MakeBlockText/blob/main/MainPage.xaml.cs
https://github.com/johnhaz/MakeBlockText/blob/main/MainPage.xaml.vb

The first one is the main page which gets used with either the vb or c-sharp code dependent on project type. There is also a License page that describes the free license to the code. 

Putting it all together, one has a program that looks and operates like this:

It works by first rendering the letters to a bitmap and then taking the alpha bytes from that bitmap and transforming them into half height ascii blocks using math, should they pass a threshold.
 
Discussion:

The combo boxes in my 2022 version of Visual Studio are failing to track the caret. Additionally implementing name changes can have my code jumping 5000 lines, and wipe out the edit marks on the scrollbar as well. Also -- using the back arrow sometimes does not navigate right, skipping over the previous position by one especially if I select the position from a code reference in a window that has been dragged off the main Visual Studio window, like I show below. I also thing using this off-form configuration is the problem that causes that fails, and maybe the creators don't debug it like that. 

The result is getting lost a lot, or writing down every line I go to in 8000 lines. So I made this thing to put big comments inside my code that I could see while scrolling as a navigation aid. 

I also thought why not try making it in C-Sharp while I am having fun. That did take three hours, and yes, there was cursing at the computer and C-Sharp in particular, but I felt like I accomplished something.   

So I grouped all my code into sections, and applied the big green letters. The I wrote down an ordered list of them, so when I find one, I can check the map of 30 headings to see how far away I am from another section that I want to be in. This way I can move pretty fast. 

Notes on the first time I programmed a thing in C-Sharp. 

It's pretty anal. I have to typecast everything. It is unforgivingly and not attempting any match on error case conscious! Procs, when called, have to manually get the parentheses at the end or the thing will throw a strange error. Those braces are hard to track. Arrays are scaled using the actual length of the array, instead of upper bound, but indexed normally. Of course there is a different operator for everything logic. Case is switch -- blah, blah. No Chr or Asc. 

Having online resources sure does help. I relatively sailed through it. Despite the cursing  


Tuesday, August 10, 2021

Changing Color Brightness: Simple VB Code

First: 

 Private Function ChangeColorBrightness(clrIn As Color, brightnessChange As Single) As Color
        Dim snrgb(), i6Y, bb, br As Single

        snrgb = {clrIn.R, clrIn.G, clrIn.B}
        i6Y = 0.299 * snrgb(0) + 0.587 * snrgb(1) + 0.114 * snrgb(2)
        bb = 0.492 * (snrgb(2) - i6Y)
        br = 0.877 * (snrgb(0) - i6Y)
        i6Y += brightnessChange
        snrgb(0) = Math.Clamp(i6Y + 1.14 * br, 0, 255)
        snrgb(1) = Math.Clamp(i6Y - 0.395 * bb - 0.581 * br, 0, 255)
        snrgb(2) = Math.Clamp(i6Y + 2.033 * bb, 0, 255)
        Return Color.FromArgb(clrIn.A, snrgb(0), snrgb(1), snrgb(2))

  End Function

Naturally, a large enough absolute value for brightnessChange to force clamping will color-shift, with pulls toward white or black. This blog does not suggest this function is compliant with any standard. 

Remarks:

All code is presented "as is," and is free to use without constraint.

Changing the brightness of a pixel by taking the R, G, and B values, and multiplying them by the same number will cause a color shift. RGB can't work that way because each channel varies in luminance with respect to the other. Blue has less luminance full-scale and changes less as compared with green. Red is in between. 

In the program screencap pictured below, I use color-retaining brightness shifts when drawing balls. The balls pictured below have three radial-gradient stops: normal color, color with brightness plus 20, and color with brightness plus 50.  

The function I've listed above will: 1) change the color description from RGB a different "color space" that has luminance as a value; 2) change that luminance value by a parameter; 3) recombine the RGB values from the other color space and return that. 

Brighten stuff, darken it, go ahead! Own it. 😀



Friday, June 11, 2021

Graduation For Genevieve 2021

Graduation! The time has passed so quickly. I can still remember looking at Genevieve after she was born, and her looking back at me. Now she has graduated High School. 


Like her Mom (also pictured above), a UCR Summa Cum Laude, she does well at school. She has two yellow ropes and three badges. She worked hard, all the time. I know because I was there. I also helped with the things that I knew were roadblocks to learning by having had encountered them myself.  

Badges? Well actually we do got badges. 

If local conditions were the opposite of conducive to studying, yet she got A's and A+'s doing cray difficult stuff, her fortitude and perseverance would likely be mentioned here. For that, I give her the John Medal, which is some kind of hat. And we would laugh. Then I might haughtily exclaim that I don't believe I mentioned any hats. And we might laugh more. 

We laugh a lot, but I can be good with jokes. I never met anyone so like me before. Or that was so much a part of me, and yet I could get along with. My wife remarks how we are like twins. But Gen is also like my wife. I could never toe any line, and was stupid about things for no reason but stopping reality or time. Regina and Gen are less so inclined to tamper.   

Gen got awarded the Chancellor's Scholarship from UCR, and yeah, I am proud of that. She will, however, be leaving for school in Santa Barbara way too soon. Her first choice. I think it is great she can go where she isn't living in the giant brown cloud one may see driving east from Yorba Linda.

How will our relationship change? Will she fall away from my cray old dad ways completely? I worry about losing her, when I should be worrying if she would not grow. Much as I would love her to cloy here forever, I know she has to face life. Watching her stay here and be lost in a different way does not wash! Also her mother is game for my jokes too. Not like I lived alone. We can get along too. 

One thing we can do is always have somewhere for her to come home to, no matter where we go. There is a future on this current geography that does not include us, I pray. Looking forward to having our daughter come and stay for a bit, find out how her life is going, in our small easy home somewhere different. Sounds pretty cool. 

Wednesday, July 8, 2020

Lunacy and We



Conservatism's creation gives himself an A+. "We are in a great place."  

Saturday, May 9, 2020

About Thursday

Here is a picture of Genevieve's Grandfather Pasquale, and my wife Regina in New York in the 90's.

Pat died in the early morning on May 7, 2020: Lost to this epidemic.

There were no flyovers, and no phalanxes of people clapping for him. He was just another one of the dead. That big number on the screen. Those forgotten, even before they died. But maybe not everybody forgets.

I won't forget Pat. He was good to me.


Sunday, February 23, 2020

RegisterPropertyChangedCallback VB Example

I had a need to follow changes to an item's Visibility property although the property is not included in UWP Routed Events as defined here.

I could not find examples for RegisterPropertyChangedCallback written in VB anywhere. So here is Code, Page Code, Use and Notes.

Code First:

Public NotInheritable Class MainPage
    Inherits Page

    Private RegisterNum As Integer

    Private Sub Button1_Click(sender As Object, e As RoutedEventArgs) Handles Button1.Click

        If Border1.Visibility = Visibility.Visible Then
            Border1.Visibility = Visibility.Collapsed
        Else
            Border1.Visibility = Visibility.Visible
        End If

    End Sub

    Private Sub Border1VisibilityChanged(sender As DependencyObject, dp As DependencyProperty)
        Dim borderA As Border = sender
        Dim dpm As Visibility = borderA.Visibility

        Select Case dpm
            Case Visibility.Visible
                TextBlock1.Text = "Box is Visible"
            Case Visibility.Collapsed
                TextBlock1.Text = "Box is Collapsed"
        End Select

    End Sub

    Private Sub MainPage_Loading(sender As FrameworkElement, args As Object) Handles Me.Loading

        RegisterNum = Border1.RegisterPropertyChangedCallback(VisibilityProperty, New DependencyPropertyChangedCallback(AddressOf Border1VisibilityChanged))

    End Sub

    Private Sub Button2_Click(sender As Object, e As RoutedEventArgs) Handles Button2.Click

        Border1.UnregisterPropertyChangedCallback(VisibilityProperty, RegisterNum)

    End Sub
End Class

Page: 
<Page
    x:Class="SimpleVisibilityExample.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:SimpleVisibilityExample"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" RequestedTheme="Dark">

    <Grid>
        <Button x:Name="Button1" Content="Show/Hide Box" Margin="50,75,0,0" VerticalAlignment="Top" Width="200"/>
        <Button x:Name="Button2" Content="Unregister" Margin="50,150,0,0" VerticalAlignment="Top" Width="200"/>
        <Border x:Name="Border1" BorderThickness="1" BorderBrush="Black" HorizontalAlignment="Left" Height="200" Margin="50,225,0,0" VerticalAlignment="Top" Width="200" Background="#FF8BD608"/>
        <TextBlock x:Name="TextBlock1" HorizontalAlignment="Left" Margin="50,450,0,0" Text="Box is Visible" TextWrapping="Wrap" VerticalAlignment="Top"/>
    </Grid>
</Page>

Use:

Put it together and run. When the "Show/Hide Box" button is pressed, the box will turn on and off. (Change visibility) Also the text block will show text saying whether the box is visible or collapsed.

Now press the "unregister" button. After that is pressed, the box still blinks on-off when the Show/Hide button is pressed, but the text box no longer indicates the state of visibility, except what was written before the code was unhooked.

Notes:

C# examples are missing the syntax necessary to make the code work in Visual Basic, because of the implicitness of C#. You can put it together like the C# example alright, but it throws weird errors like asking for parameters for something that should be simply a sub's name.

One thing not used in C# is explicitly calling the delegate DependencyPropertyChangedCallback. If you look it up online here, and it gives the C# example that never mentions the delegate in code, despite the page is being devoted to DependencyPropertyChangedCallback. Honestly ...

Another thing not used in the C# example was the AddressOf operator, of course.

This is a case where there is a necessity of alternative code examples in documentation, especially seeing how usage of the object being described by that page is necessary with those other code examples. It's kind of ridiculous. Luckily, after some searching on Google, I came across a C++ example of that usage which set me to succeeding. 

Well, time to get the stuff done that I needed this for. I put this up because of lack of docs first. I am sure I am not the only person who needs to do this.

Wednesday, February 19, 2020

Limbo and Bit Masking

Maybe a little bizarre ...

Somewhat retouched picture of known figure
I made these images with my latest greatest bit-twisting program that also does compositing finally.  Trying to make [known figure] look like some other people (a little) was my goal. Something to do on a Tuesday evening.

Note: I do not mention the person by name because we are no fan, and don't want to give the wrong idea. But the picture I has was perfect for doing this. It should also be noted, if the pictures were to be taken as a narrative, that they are not in either parsimonious nor metaphysical chronological order.

Sunday, December 22, 2019

Another Year Seen

Here's a picture of Genevieve and the bary sax she plays for Jazz Band.

Genevieve Hazlinger poses w/saxophone 12-2019
Gen's played a few different single-reed woodwinds over the years. My favorite was the contralto clarinet. It had a smooth tone and was loud and deep enough to be used as a fog horn. Thinking of her blasting away upstairs makes me smile.

Since this is probably the last post of the year, in the spirit of good will let me wish any reader Happy Holidays from my tiny family here in California.

Monday, October 21, 2019

Good Times

Bready and me having fun taking selfies. Yep, Bready is looking at you. 
Here I am posing with Bready. Maybe I am getting cynical with selfies? Nah, of course not. Instead, we are currently contemplating my presidential run.

Bready wants to be my campaign manager. His campaign motto idea: The New Tyranny. Breadie thinks people need a little tyranny in their lives. He thought minor tyrannical things that are relatively harmless might channel people's self-malice away from the things we need to survive. That way they won't get all passive-aggressive with global warming, for instance. The enemy would be Mountain Time. I have to admit, he's pretty creative for a piece of bread that's a few days old, and who has a knife for a neck.

The first thing we will do in the Steely Steeled Administration of Steel is make every city in America change its name so that no two cities have the same name. That is a good start. We also will not allow them to use numbers in the names of their new city. Those cities that have names of other cities will be put on Mountain Time until they comply. That will be our evil tyrannical punishment in most cases. I guess if you're already on Mountain Time you could be put to sea or something, though Bready is not on board with that. Maybe they won't be allowed to use anything with wheels that has green colors inside or out, or put anything green in any wheeled object. That's nice and randomly tyrannical. Drag those veggies! Or be put on Double Psycho Mountain Time.

Perfect. Heh, heh, good ol' Bready. What an advisor! Nice hair too.

Monday, September 9, 2019

Adventures in Matching

I made this.


It refers to the movie the Caine Mutiny. In the movie, the Humphrey Bogart character, Captain Queeg exhibits (what I now realize are timelessly classic) symptoms of chronic stress and paranoia. Ultimately this leads to a mutiny due to a particularly dangerous command decision, and a trial of the other officers. The writing and acting provide a sophisticated insight into the layout of the mechanisms of mental illness propagating in an individual, and make that insight accessible to the lay viewer through the counterpoint of interactions. 

When my mind stumbled onto the comparison, searching as it was to categorize the insanity before me, there was a light that went off. Something real last week about how times may change but humans don't at all has passed. Phones, computers, media, it makes no difference to how the act unfolds. 

There is always a promise of a tomorrow that's worse, that much can be said. The only question, what tomorrow's metaphorical strawberries will be.

Thursday, July 11, 2019

More Pictures: Bastendorff Beach

The second day of our vacation we hit Bastendorff Beach just south of Coos Head. It was a long time since I got to walk by the ocean. I noticed the waves were kicking up what looked like small rocks in their wake, as they surged across the tide pools. On close examination they were alive. They looked like (my) thumb-sized bugs. They rode the edge of the tide, burrowing into the sand as the edge turbulence kicked it up. Then, on the next wave moving in on the incoming tide, also moving a inland little more. The lady where we were staying said they were sand crabs.
Sand Crab that is dead lying on the beach. 
We walked the length of the beach up to the jetty, which we climbed on. I wondered, amid the huge rocks, if one could shift. Meh. We turned the other way and walked down to Yoakam point.

View from top of southern jetty.
Along the edge of Yoakam Point was a raised area above the water. We found a singular kind of tide pool there, a few feet up. Maybe the term is splash pool, depending on if the tide gets there. It actually had little fish in it as well as the usual stuff we might see in the bay. They behaved like little catfish one may get for an aquarium. I don't see them in any stills, only the video I took.

Close up of that healthy-looking thing in the tide pool. 
Kind of beautiful here. Quiet, too. Coos Head rises to the right.
Cape Arago Lighthouse.  
Guess that's it for this.