Snaking the Drain

Just a quick update on some maintenance work. The drain from our kitchen and washer was getting slower and slower. I thought running hot water down it for a while would help, and it did for about 10 minutes, after which it got much worse! I guess it dislodged some of the stuff, which then got stuck further down, making the blockage worse. I thought I’d take the shop vac to the drain to see what I could get, but nothing was coming out.

A bit of history – this is a house built in the 50’s, and the pipe is cast iron. I had snaked this drain about 4 years ago and pulled out one or two wet wipes. I have no idea how they got down there. That time I remember how difficult it was to use the snake tool, which is a 50 foot 1/2 inch drain auger. The little tool it came with to twist the auger was such a pain to use. This is why I wanted to avoid using the auger, and actually contemplated renting a powered auger.

There’s a small access cap on the concrete floor which I removed to do the vacuuming. I had to plug the other drains so  that the vacuum would work against the blockage. After a number of times of filling with water and vacuuming, I realized I wasn’t going anywhere and pulled out the auger. This time I ditched the tool and did everything by hand.

After working the auger in as far as it would go (around 30 feet),  I added water down the drain until it was about to overflow, then pulled the auger out, and immediately took the shop vac to the drain. It was super satisfying because I could hear and feel all of the gunk being sucked out of the drain! The sludge was basically greasy organic matter mixed with sand and whatever other stuff came from our washer. The water was pitch-black with an oily surface. Yum!

I followed this by filling the basement sink with warm water and letting it all go at once, and there was no backup!

In the end, it was rewarding because of the amount of crap I pulled out of the drain, and how well the water flowed at the end of it all. So… hurray for the shop-vac! I was warned by the neighbor that augers could cause damage to clay pipes, and I’m pretty sure at some point the cast iron pipe interfaced with clay, so next time I’ll try to be more gentle.

Hope this helps someone!

Advertisements

2 Minute Reviews: Samsung Galaxy Note 8

Pros:

  • S-Pen
  • Fast
  • Micro SD support
  • 8″ display

Cons:

  • 1280×800 display
  • Terrible lag in games

I’ve had this tablet for over a year, hoping I would use it for drawing and painting. Frequently it seems I enjoy having the tools to be able to do things more than I enjoy doing them. While I did do some drawing, I’ve never gotten fully comfortable sketching or ideating using a device. Perhaps the software is not there yet, or perhaps it’s the distraction of the device itself that gets in the way.

Before I digress any further, I do love the concept of the S-Pen, and it’s great for jotting down notes or capturing quick sketches, and there are more and more art applications that make use of the Wacom technology. Definitely a feature I would pay for. The tablet itself is quite fast, however it suffers from an input and/or display lag that makes certain types of games unplayable. Anything involving fast reflexes is pure pain on this device.

The display is bright and beautiful, though the low resolution is painfully evident. I really love the Micro SD slot, and have a 64GB card in there holding a bunch of music and movies.

However, this is the tablet I use the least currently. Yes, I do have too many devices, and between a Note 3 and a Kobo Arc 7HD, there’s no compelling reason for me to use it these days.

I should really sell the damn thing, but it’s the only device I have rooted to play with.

DL

2 Minute Reviews: Kobo Arc 10HD 16GB

Pros:

  • WQHD display (2560×1600!)
  • 2GB ram
  • Fast!
  • OTG support [Note, FAT and NTFS (read only) filesystems are supported, but my device destroys the filesystem for any exFAT device I have inserted]
  • Price: CAD $180

Cons:

  • No SD Card
  • 16GB memory
  • It’s big and heavy, almost as heavy as our old iPad 3…
  • Stuck on Android 4.2 forever?

I’ve been reading a lot of manga lately, and this tablet is simply too big for reading manga. It’s also too large and heavy to comfortably read a book for any length of time, despite the nice ergonomic back shape and material, so it’s odd that Kobo released such a beast. It seems to be good at everything that someone looking for an e-reader wouldn’t be interested in doing:

  • Web browsing: Large, clear screen with crisp fonts – so much nicer experience for my eyeballs than my computer monitor
  • Games: Super Hexagon, for example, is smooth and I don’t feel any lag in the controls. In general, there might be the odd stutter in some games, but I feel that’s reasonable for a display that’s pushing such a high pixel count and might be common with high-end devices
  • Media: Netflix and Crunchyroll never looked so good

Unfortunately, and I feel especially on the games front, being stuck on Android 4.2 limits the tablet’s overall usefulness. For example, the latest Office for Android will only work with Android 4.4 and higher.

I can’t stress how much I like the screen. Come to think of it, it’s probably good for reading technical documents.

To sum up, this device is suitable for casual use at home, serving up recipes in the kitchen, watching Netflix on the couch, casual gaming, etc. I wouldn’t consider it overly portable – it’s about the size of a small laptop.

DL

2 Minute Review: Kobo Arc 7HD 32GB

Pros:

  • Full HD 1920×1200 screen
  • Micro-HDMI out
  • Price (CAD $120)

Cons:

  • No SD card support
  • No more support from Kobo (stuck on 4.2/Jellybean)
  • Battery life rather poor
  • Poor performance / 1GB ram
  • No OTG support

Despite all the cons, I like the device. It’s geared towards providing a good reading experience. Text is very crisp and clear, and the battery will last long enough if you’re just reading books or browsing. The HDMI out is rather an unusual feature on this device, but one that I find I use quite often to watch Netflix with my wife, or to put something on for the kids. 32GB is enough to store a good amount of media as well. I did notice that using the HDMI-out seemed to drain the battery extra quickly.

Games are a bit hit and miss, with stuttering on many, but surprising performance on others.

In summary, a very good device for the price, if you care for a high PPI display and don’t care about gaming.

PS: I did drop the device once, onto asphalt, about a day after I bought it. The device sort of split apart a bit, but I pressed it back together and it’s been working fine since. The edges of the bezel are made of soft plastic and suffered considerable cosmetic damage, which I feel gives it some nice character.

DL

My Inflation RPG Plays Harvester

I’ve been playing Inflation RPG for a while now – it’s a fairly casual game, although there are times I take it a little too seriously. Anyway, the game has gem items that reward the number of times you have played through the game, as a bonus to all of your stats for each time you have played through: 3x, 17x, 41x. You can buy the 3x Play Gems, and farm the 17x and 41x gems. So, of course these are theoretically the most powerful items in the game, provided you play the game often enough. Not really practical to play through thousands of times?  Probably not for a human…

At work we make extensive use of a program called AHK, or Auto Hot Key. AHK allows us to interact with the computer as if a user were typing input and using the mouse. The scripting language leaves a lot to be desired, but it pretty much allows you to code what you will. AHK also has image/pixel recognition support, along with COM and ODBC. At work, for example, a common application of AHK is for complex data entry, where a program would work off of a database, pulling down information, then interacting with another program, entering data, committing changes, then querying back out the data as a validation step, and finally marking an entry as complete. The most common complication is in achieving optimal speed of input while maintaining 100% accuracy. That is where AHK’s image recognition comes in – it allows us to wait for a confirmation by waiting for an image to appear on the screen.

So, we have this wonderful tool that allows us to interact with the computer, but Android is running on a phone, so to bridge the gap, we need to somehow control the phone from a computer, and also see what the phone is showing on the computer. Enter adbcontrol. Marian Schedenig’s little tool will allow you to capture and display screenshots on the screen, and also allow you to interact with your phone using taps, swipes, and the back and home buttons, among others.

All the pieces seem to be in place. The program should run through a gameplay as fast as possible, which, in this case, will be to start the game, and fight an enemy that is much stronger than I am (so I die quickly), 10 times, to deplete my battle points to 0.

Adbcontrol allowed me to take coordinates of all the buttons and areas I would need to use to interact with Inflation RPG in order to harvest gameplays. Starting a game would be the easy part – simply clicking buttons one after another to begin the game, with an appropriate delay between each click. The sequence of starting a game is to click Game Start, Try Again*, Confirm OK*, select a character, and finally selecting Normal difficulty. Note that the Try Again/Confirm OK dialogs come up when restarting in the middle of a run, so I click on those buttons, even if they’re not there.

inflation_title

The Inflation RPG Start Screen

I ensure the character is equipped with the weakest armor and weapons prior to starting. I also equip gems that make a random encounter less likely to happen, as the game starts on the 1st level field, where you always win the fight. I must move the character up to the 710 level field, where he’d be guaranteed to lose a fight.

Adbcontrol registers swipes and taps, but no click-holds, so I need to use MouseClickDrag a number of times to move the character up.

inflation_start

The Inflation RPG Starting Field

Once the character is in the correct field (note the red danger border radiating in from the edges of the screen), I can click on the Encounter button (make sure to equip the Instant Encounter gem), start the fight by clicking the screen after an appropriate delay, then returning to the field by clicking again after an appropriate delay. Yes, there is unfortunately a lot of waiting you have to do in Inflation RPG.

inflation_danger

The Inflation RPG LV 710 Field

After 10 iterations of this (you start with a total of 30 Battle Points and lose 3 Battle Points for every fight you lose), the scene transitions to the ending screen, which means just some more button clicking with some delays, then you end up at the start screen again.

That’s fine and dandy, but I want to go more in-depth into the difficulties I experienced during the development, and how I made this fast and robust.

The End Game Advertisement

This one perplexed me at the time. At the end of every game, prior to getting back to the start menu, Inflation RPG displayed one full-screen ad, possibly different every time. Not only that, but there were two distinct types of ads, one completely full screen, with an X on the top left, which could also be closed using the back button, and another that was 1/3rd of the screen, centered in the middle of the screen, with a larger X about 1/3rd of the way down on the top left. This smaller ad could not be closed with the back button – clicking the back button at this point would close the game.

How could I know which X I had to press, or whether I could use the back button, or had to click on the large X? Not only that, but the screenshots were JPG, the placement of the X would differ slightly depending on the ad, etc. I could not rely on a direct image comparison. If you examine the code, I wrote some functions that would sample pixels and roughly compare their colors against what I expected. It could find the X if it looked around enough, and was reliable, but it was slow, mainly because of the lag – adbcontrol has a 4+ second lag between screenshots.

It turned out that this was unnecessary. If I click on the expected position of each X button, starting with the larger ad, then the smaller ad, it clears whichever ad had appeared nicely.

Increasing Reliability

Every once in a while the automation would fail for unknown reasons. So I introduced a loop to kill and restart Inflation RPG every hour or so. To kill Inflation RPG, I used adb:

> adb shell am force-stop air.infurerpgkuesuto

I found the package name using

> adb shell ps

Teamviewer Detour

Prior to finding adbcontrol, I tried using Teamviewer. This is fantastic software, but unsatisfactory for my purposes – the lag grew longer the longer I was connected to the phone, and it wouldn’t stay open for more than one or two hours.

Farming Settings

I recommend doing the following when farming:

  • Turn off WIFI on your PC to avoid unwanted restarts/updates
  • Turn on blocking mode on your phone
  • Disable sync or other power-draining services on your phone
  • Turn brightness down to 0
  • Buy a y-cable to help keep your phone charged – mine will drain down to 0% after roughly 10 hours

Results

I’m able to farm gameplays roughly at a rate of 30 per hour. I have the software installed on an old but terribly reliable netbook, and have stopped after farming 9000 gameplays, equivalent to 153000 points to each stat with a single 17x crystal. 🙂 Having this helped me farm a number of items quickly, but so far a 41x play crystal eludes me. Oh well. I had fun writing the script and improving it to the point it is at now.

Source

Below is the AHK source code for the gameplay miner. It’s specific to a 1366×768 resolution, with adbcontrol occupying half the screen. (Windows 7, drag to right of screen/auto maximize). Getting it to work on another screen size will likely mean changing the vertical click values.

Sorry for the lack of comments, this one was quick & dirty. 🙂

Des

Here’s the script:

#SingleInstance force

RestartInflationRPG()
{
    ; Restart Inflation RPG - need to do a few things:
    ; 1. The Home key will wake up the phone, in case it's asleep
    ; 2. Additional presses on the Home key will navigate to the
    ;    home screen
    ; 3. If the home key is pressed too often, then we may get into
    ;    the "multi-home" screen, which we will bypass by pressing
    ;    Escape

    ; Before doing anything, kill Inflation RPG on the phone:
    Run, kill_irpg.bat
    Sleep 1000
    MyClick( 1, 1 )
    Send {Home}
    Sleep, 2000    ; In case the phone needs to wake up
    Send {Home}
    Sleep, 200  ; Allow the phone to respond
    Send {Home}
    Sleep, 200
    Send {Escape}
    ; Run Inflation RPG:
    MyClick( 52, 603 )
    Sleep, 4000 ; In case it has closed, give Inflation RPG time to open
}

MyClick(X,Y)
{ 
    EnsureWinActive()
    Click %X%,%Y%
}

EnsureWinActive()
{
    global
    IfWinNotActive, %WinName%
    {
        WinActivate, %WinName%
    }
}

MyClickS(X,Y)
{
    global
    MyClick(X,Y)
    Sleep, %ClickDelay%
}
MyClickSF(X,Y)
{
    global
    MyClick(X,Y)
    Sleep, %FastClickDelay%
}

ClickBack()
{
    EnsureWinActive()
    send {Escape}
}
ClickGameStart()
{
    MyClickSF(268,410)
}
ClickTryAgain()
{
    MyClickSF(279,387)
}
ClickConfirmOk()
{
    MyClickSF(215,341)
}
ClickCharacter()
{
    ; Pick the character least likely to combo:
    MyClickSF(360,271)
}
ClickNormal()
{
    MyClickS(219,241)
}
ClickEncounter()
{
    MyClick(162,111)
    Sleep, 50
    MyClick(162,111)
}

ClickConfirmRegisterNo()
{
    MyClickSF(211,345)    
}

ClickPostTitle()
{
    MyClickSF(323,684)
}

MyMouseClickDrag( Button, X1,Y1, X2,Y2, Speed )
{
    EnsureWinActive()
    ;MouseMove, X1,Y1,0
    MouseClickDrag, %Button%, X1, Y1, X2, Y2, Speed
}

InitialMoveUp()
{
    global
    MyMouseClickDrag( Left, 211, 282, 209,135, 1 )
    MyMouseClickDrag( Left, 211, 282, 209,135, 5 )
    MyMouseClickDrag( Left, 211, 282, 209,135, 5 )
    MyMouseClickDrag( Left, 211, 282, 209,135, 5 )
;    MyMouseClickDrag, Left, 211, 282, 209,135, 15
    Sleep, 200
    Sleep, %ClickDelay%
}

Fight()
{
    sleep, 2000
    X:=210
    Y:=425
    MyClick(%X%,%Y%)
;    MyClick(%X%,%Y%)
;    MyClick(%X%,%Y%)
    sleep, 5500
    MyClick(%X%,%Y%)
    MyClick(%X%,%Y%)
    Sleep, 1500    
}

ColorCompare(C1, C2, precision)
{
    global
    C1B:=C1>>16
    C1R:=(C1>>8) & 0xff
    C1G:=C1 & 0xff

    C2B:=C2>>16
    C2R:=(C2>>8) & 0xff
    C2G:=C2 & 0xff
    ; Calculate differences:
    DB:=abs(C1B-C2B)
    DR:=abs(C1R-C2R)
    DG:=abs(C1G-C2G)
    
    ;MsgBox %DB%,%DR%,%DG%
    if( DB > precision or DR > precision or DG > precision )
    {
        ;MsgBox Returning false
        return false
    }
    ;MsgBox Returning true
    return true
}

ClickAd1X()
{
    ; Clicks the top-most X
    MyClickSF(22,44)
}

ClickAd2X()
{
    ; This one clicks off the alternate ad format, which requires clicking the X to dismiss
    MyClickSF(45,153)
}

ClickBackOrX()
{
    ClickAd1X()
    Sleep, 50
    ClickAd2X()
    return
    ; This function needs to do some image reccognition to determine if the back
    ; button should be pressed, or the X button should be pressed

    Loop 40 ; 40 * 0.5 seconds = 20 seconds of checking
    {
        if IsType1Ad()
        {
            ClickAd1X()
            return
        }
        if IsType2Ad()
        {
            ClickAd2X()
            return
        }
        sleep, 500 ; Sleep for half a second
    }
    ; If we don't find anything, assume it's a google ad:
    ClickBack()
    return
}

DBGMouseMove(X,Y)
{
    global
    ;MsgBox %Debugging%, %X%, %Y%, X, Y
    If %Debugging%
    {
        MouseMove %X%, %Y%
        Sleep, 500
    }
}

DBGMsgBox(Words)
{
    global
    If %Debugging%
    {
        MsgBox %Words%
    }
}


IsType1Ad()
{
    ; Type 1 ads can use the back button to exit, or
    ; button press on the X, which is at the top left corner

    ; Possible Y positions:
    PossibleY1:=40
    PossibleY2:=43
    PossibleY3:=46
    Delta:=10
    PossibleX1:=23
    PossibleX2:=26
    PossibleX3:=29
    
    Loop 3 ; Iterate over PossibleY
    {
        PY:=a_index
        Y:=PossibleY%PY%
      
        Loop 1 ; Iterate over PossibleX
        {
            PX:=a_index
            X:=PossibleX%PX%-Delta
            
            EnsureWinActive()
            DBGMouseMove( X, Y )
            PixelGetColor, xbox1, %X%, %Y%, ALT
            DBGMsgBox( xbox1 )
            X:=X+Delta
            DBGMouseMove( X, Y )
            PixelGetColor, xbox2, %X%, %Y%, ALT
            DBGMsgBox( xbox2 )
            X:=X+Delta
            DBGMouseMove( X, Y )
            PixelGetColor, xbox3, %X%, %Y%, ALT
            DBGMsgBox( xbox3 )
            if( ColorCompare( xbox1, 0x7e7e7e, 25 ) 
                and ColorCompare( xbox2, 0x000000, 25 )
                and ColorCompare( xbox3, 0x7e7e7e, 25 ) )
            {
                DBGMsgBox( "Found X on top left" )
                return True
            }
      }
    }
    DBGMsgBox( "Did not find X on top left" )
    return False        
}

IsType2Ad()
{
    ; Type 2 ads are the 'internal' ads that have the large X box more
    ; towards the middle of the screen. These ads cannot be bypassed
    ; with the back button, and the X must be pressed

    PossibleY1:=153
    PossibleY2:=156
    PossibleY3:=159
    PossibleY4:=162
    
    Delta:=8
    PossibleX1:=44
    PossibleX2:=41
    
    Loop 4 ; Iterate over PossibleY
    {
        PY:=a_index
        Y:=PossibleY%PY%
      
        Loop 2 ; Iterate over PossibleX
        {
            PX:=a_index
            X:=PossibleX%PX%-Delta
            
            EnsureWinActive()
            DBGMouseMove( X, Y )
            PixelGetColor, xbox1, %X%, %Y%, SLOW
            DBGMsgBox( xbox1 )
            X:=X+Delta
            DBGMouseMove( X, Y )
            PixelGetColor, xbox2, %X%, %Y%, SLOW
            DBGMsgBox( xbox2 )
            X:=X+Delta
            DBGMouseMove( X, Y )
            PixelGetColor, xbox3, %X%, %Y%, SLOW
            DBGMsgBox( xbox3 )
            if( ColorCompare( xbox1, 0x404040, 12 ) 
                and ColorCompare( xbox2, 0xc7c7c7, 12 )
                and ColorCompare( xbox3, 0x404040, 12 ) )
            {
                return True
            }
      }
    }
    ; Otherwise, the X is not found:
    return False
}

MainLoop() {
    global
    ; Begin:
    Sleep, 500
    ClickGameStart()
    ClickTryAgain()
    ClickConfirmOK()
    ClickCharacter()
    ClickNormal()
    Sleep, 1000
    InitialMoveUp()

    ; Do the encounters:
    loop 10 {
        ClickEncounter()
        Fight()
    }

    ; Post-battles
    Sleep, 3500
    ClickConfirmRegisterNo()
    ClickPostTitle()
    Sleep, 1500 ; 19000
    ClickBackOrX()
}

;;; Start of program:
; Absolute screen coordinates:
CoordMode Mouse, Relative
CoordMode Pixel, Relative

;;; Variables:
BaseDelta:=748-1231
BaseDelta:=1350-1525
ClickDelay=1000
FastClickDelay=250
TVXImage=TVX.PNG
InitialMoveUpTime=2200
WinName=ADB Control
Debugging:=False ;True
;Debugging=True
;;; Start:
WinActivate %WinName%

;RestartInflationRPG()
;exit



;InitialMoveUp()
;return
;ClickBackOrX()
;exit

;X:=CalcBase(1000)
;MsgBox %X%
;return
;DBGMsgBox( "Testing" )
;IsType1Ad()
;return

loop {
    ; roughly every 30 runs (1 hour) restart inflation RPG
    loop 60 {
        MainLoop()
    }
    RestartInflationRPG()
}
#p::Pause

#Escape::
ExitApp
Return

Here’s my kill_irpg.bat batch file:

:: Batch file to kill inflation RPG using ADB!!!
C:\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb shell am force-stop air.infurerpgkuesuto

Dell Inspiron 7537 – A tale of woe with a happy ending

Update: In 2016 I upgraded to Windows 10… again, it was a lot of trouble. The upgrade process, despite the automatic update being approved for my device, caused windows to not boot. Since I had no option to reinstall Windows 8, I installed a fresh version of Windows 7, then installed drivers, and upgraded to Windows 10. Again, an unbootable system. To eliminate driver issues, I reinstalled Windows 7 from scratch again, then installed Windows 10. This time everything went well. I installed the Dell hardware drivers and now everything works to my satisfaction. The wireless no longer cuts out on me. Only problem is I cannot disable the touchpad. I can live with that since I’m using an external keyboard.

 

I have a burning desire to share my tale of frustration with this laptop.  I love it now, but it took me a while to get here:

1. The WIFI driver simply never worked properly, connecting intermittently or providing only “Limited Access” until I installed VirtualBox, which somehow fixed everything

2. Upgrading to Windows 8.1 was a big mistake – nothing quite worked properly afterwards, including the networking, which I fixed by re-installing VirtualBox. The worst part was it tacked on minutes to the boot time.- I eventually decided to revert back to 8.0. The “restore to factory” operation was surprisingly painless

3. The clickpad did funny things until I updated the drivers

4. I quickly got fed up with the slow mechanical hard drive so I bought a Samsung SSD. Turned out the Dell recovery wouldn’t allow recovery on anything any smaller than the 1TB hard drive that the laptop came with, not even with the recovery disk set I created – come on! I was about to resign myself to hunkering down with some free cloning software to attempt to transfer the OS to the smaller SSD when, in a forum, I stumbled upon Paragon Software’s wonderful utility called “Transfer OS to SSD”. Found a coupon code online somewhere, bought it, and within minutes the application was transferring the OS to my new SSD. I was more excited than I really should have been at this point.

Now it finally runs the way I want it to. The only downside is that it’s running Windows 8… which I’m surprisingly OK with… not my first choice, but I don’t think it’s going to hold me back… though the Charms menu always popping up when I don’t want it to is pretty annoying.

RDI Journal Feb 12, Wed – Cookies and Hummus

Made some cookies with A today. He was attentive and very well behaved, making lots of eye contact for help with decisions.  Not much to say about this interaction as I didn’t particularly have any goals in mind other than to do something with him.

As for the cookies… made the mistake of leaving them in too long, not rotating the massive cookie sheet – plus I think the oven temperature is off. What were supposed to be chewy cookies are now crispy – seriously frustrating making a one-off batch of cookies while trying to be gluten-free.  I might make another batch tomorrow and hope for better results. The kids should still enjoy them though.

But… made the best hummus ever tonight, following instructions from here: http://www.inspiredtaste.net/15938/easy-and-smooth-hummus-recipe/. If you decide to make this, do yourself a favor and use a food processor, not a blender like I did.

We’re going to try to get Aidan to eat some of this – he has texture issues. Our strategy will be to just break out the lettuce and hummus and start eating in the evening and see if the kids will join us without being asked or told.

Ah, and I have to say, D, lately, has been super affectionate, and more demanding of our attention, wanting us to play with him more and more. He also seems in much better mood lately, but still out of control as always. Friend at work has the same kind of problem with his 4 year old. I wonder if my heavy-handed approach to his behavior on Saturday (putting him in the bathroom a lot) was the catalyst for this. Anyway, I’ve decided to not worry about his behavior too much and spend more time explaining things to him and not worrying about getting out the door on time in the morning. After all, A can be late for school and it’s not that big a deal, plus I think it’s actually faster if I take my time rather than trying so hard to get the kids in line, which can easily cause an even more time consuming breakdown.