Network printer and standby problems

It is strange: If you have a network printer in your network it might be blocking the standby mode of your PC (Thanks to Kramy to point that out):

https://social.technet.microsoft.com/Forums/windows/en-US/0491f889-8fab-420e-80d5-20050b4a8dce/windows-7-sleep-mode-not-turning-off-fan

So my loved standby script was not working properly anymore; setting up the printer using a “local port” was not possible either – scanning was not working that way.

What fixed my script was to disable a service temporarily, the “PnP-X IP Bus Enumerator” service (fancy name, isn’t it?) – so I could create a batch file like this:

net stop IPBusEnum
powercfg /hibernate off
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
net start IPBusEnum

Et voilà, no more annoying fan noises anymore!

Delphi XE 6 – Get currently playing title from Winamp

const   IPC_GETPLAYLISTFILE  : integer = 214;
        IPC_GETPLAYLISTTITLE : integer = 213;
        IPC_GETLISTPOS :integer = 125;

        WINAMP_BUTTON2   : integer = 40045; // play
        WINAMP_BUTTON4   : integer = 40047; // stop
        WINAMP_BUTTON5   : integer = 40048; // next title

[…]

procedure Refresh();
var
    hWinamp: THandle;
    rawString: array[0..500] of Char;
    playlistEntryPointer, hProcessId: Cardinal;
    result:string;
    uselessDummy:NativeUInt;
begin
  hWinamp:= FindWindow('Winamp v1.x',nil);
  if hWinamp<> 0 then
    begin
      playlistEntryPointer:= SendMessage(hWinamp,WM_USER,SendMessage(hWinamp,WM_USER,0 , IPC_GETLISTPOS), IPC_GETPLAYLISTFILE);

      GetWindowThreadProcessId(hWinamp, hProcessId);
      hWinamp:= OpenProcess(PROCESS_VM_READ,False,hProcessId);

      ReadProcessMemory(hWinamp, Pointer(playlistEntryPointer), @rawString, 500, uselessDummy);
      CloseHandle(hWinamp);

      result:= String(rawString)
    end;

    Edit_input.Text := result;
end;

Resize VirtualBox disk size

“Increase VM size.bat”

@echo off
set vboxpath=c:\Program Files\Oracle\VirtualBox
set imgpath=c:\Users\mw\VirtualBox VMs\bananavm\
set imgname=banana.vmdk


cd %imgpath%
"%vboxpath%\VBoxManage" clonehd "%imgname%" "cloned.vdi" --format vdi
ren "%imgname%" "%imgname%.bak"
"%vboxpath%\VBoxManage" modifyhd "cloned.vdi" --resize 25600
"%vboxpath%\VBoxManage" clonehd "cloned.vdi" "%imgname%" --format vmdk
"%vboxpath%\VBoxManage" internalcommands sethduuid "%imgpath%%imgname%"
pause

Copy the putput UUID and open your *.vbox file with an editor. Replace all “old” UUIDs with your copied (this were in my case 2 times)

Sony Z1 Compact “Repair” Bluetooth file transfer

So I was trying to transfer files with Bluetooth:

  • from Sony Z1 Compact to my old phone: this worked flawlessly
  • from my old phone to my Sony Z1 Compact: not at all

I checked all settings and I came up with a really easy solution:

The problem is: the notification “Would you like to accept the incoming file blah blah” is suppressed by a default setting – so if you try send a file to the Z1… it will time out.

So how to restore the notifications for Bluetooth and make file transfers possible:

  1. From your Home screen, tap points
  2. Find and tap Settings > Personalisation> Manage notifications.
  3. Select from “All”: Bluetooth Share

Dell Printer Custom Format

Found this article, which was really helpful, thanks a lot llanelli14 !

Well it’s that time of the year again when I print out Xmas cards for my young students to color in or decorate.  I use simple black and white stencils on colored card.  The card size is best described as B5 oversize.  So it needs a custom setting in the printer menu of my 3110cn.  In Windows XP this was an A-B-C operation from the printer’s configuration menu.  In Windows 7 it required some lateral thought.

If you open up the printer’s configuration menu: Start, Printers and Devices, RMC 3110cn, Printer Properties, Configuration tab, Change Paper Size – you get a listing of the twenty Custom Size settings (all identical 210x297mm).  But the adjustment controls are grayed out.  Aaargh!

After loads of clicking I finally decided to try the Administrative Tools in the Control Panel.  Hey Presto!  Start, Control Panel, Administrative Tools, Print Management.  Double click All Printers.  Select the 3110cn and RMC and select Properties.  You get the exact same top menu as above but when you hit the Configuration tab and click on Change Paper Size the adjustment settings are accessible.  Excellent!

Obviously someone incredibly wise will be able to tell me why this was possible.  For the meantime I’m just happy I can print my Xmas cards and my students can color away and that’s another week of December lesson-plans completed!

Hope this helps someone.

Doing so, I was able to create a custom paper size for my Dell C1765NF. So I could use my custom size envelopes, in the manual feeder, just used “Custom format” in the menu (in the printer’s LCD diplay). Et voilà :-)

How to fix strange Windows 7 Update errors

1. Run System Update Readiness Tool

2. Check log-file C:\Windows\Logs\CBS\CheckSur.log

3. For me it stated
Unavailable repair files:
    winsxs\manifests\amd64_microsoft-windows-trapk_31bf3856ad364es5_6.1.7600.1638w_none_b67f949fad92001b.manifest
    winsxs\manifests\amd64_microsoft-windows-capi2-certs_s1bf3856ad364e35_6.1.7600.16385_none_1e83acdeaddva038.manifest

4. Start Windows Update (also [!] if it fails – important for the next step; the HKLM->Components hive is loaded by doing so)

5. Start regedit

6. navigate to HKEY_LOCAL_MACHINE\COMPONENTS\DerivedData\Components\ and search for (in my case) amd64_microsoft-windows-trapk_31bf3blahblahblah

7. export the keys

8.  delete the keys

9. try to update Service Pack 1

Separate column in two columns Oracle and output as HTML

(Representation, business logic and data layer should really be separated! Because of this this statement sucks.)

http://www.sqlfiddle.com/#!4/d998f/8

CREATE TABLE YourTable
  (Column1 int, Column2 varchar(1))
;

INSERT INTO YourTable VALUES(1, 'a');
INSERT INTO YourTable VALUES(2, 'b');
INSERT INTO YourTable VALUES(3, 'c');
INSERT INTO YourTable VALUES(4, 'd');
INSERT INTO YourTable VALUES(5, 'e');
INSERT INTO YourTable VALUES(6, 'f');
INSERT INTO YourTable VALUES(7, 'g');
INSERT INTO YourTable VALUES(8, 'h');
INSERT INTO YourTable VALUES(9, 'i');
INSERT INTO YourTable VALUES(10, 'j');

SELECT '' || listagg(htmlRow) within group (order by null) || ''
FROM
(
  SELECT '' || MAX(CASE WHEN mcol = 0 THEN legendcell END) || '' || MAX(CASE WHEN mcol = 1 THEN legendcell END) || '' AS htmlRow
  FROM 
  (
    SELECT 
      (CASE WHEN t1cRowNumber>t2cDivider then t1cRowNumber-t2cDivider else t1cRowNumber end) as mrow, 
      (CASE WHEN t1cRowNumber>t2cDivider then 1 else 0 end) as mcol, legendCell 
    FROM 
    ( 
      SELECT 
        t1cRowNumber, 
        TRUNC(t1cRowCount / 2) + mod(t1cRowCount, 2) as t2cDivider, 
        legendCell 
      FROM  
      ( 
        SELECT 
          ROWNUM AS t1cRowNumber, 
          COUNT(*) OVER () as t1cRowCount, 
          legendCell 
        FROM 
        ( 
          SELECT 
            (Column1 || '' || Column2) as legendCell 
          FROM 
            YourTable 
          WHERE 
            Column2 IS NOT NULL ORDER BY Column2
        ) legend 
      ) t1c
    ) 
  )  
  GROUP BY mRow  
  ORDER BY mRow 
)