Saturday 25 November 2017

Technical Problem to solve - "Blockfinder".

I have a technical problem that needs to be solved as part of a larger project that has been in the works for a while. Code development needed.


Objective

From a given set of tiles build a 2 x 4 block of 8 that have matching edges.


After encoding each tile pattern as four characters. A different 2 x 4 layout (not same as above) can be shown as:


On the top row the tiles join with keys K,G,G. Between the two rows of tiles joining keys are G,R,R,P. Between the bottom row of tiles the joining keys are R,G,G. In the centre of each tile is a description :

[ TileNumber r n ]   # n is rotation between 0..3

Which represents the tile number and rotation in the layout. The dot in the corner of each tile confirms the rotational layout between zero and three.  This layout would be summarised as 

B8:0x595c:T13R2,T15R3,T7R3,T9R3,T12R3,T4R1,T3R3,T5R0

Inputs

1) tile.txt file describes a set of tiles each wit4 sides. On each of four sides (north, south, east, west) is a key character/number. Tiles are to be assembled into a 2 x 4 layout where the side edge keys match. 

Sample tile.txt file :


#Tiles with Corner colours type Normalised ns we base rotation 28 Mar 13, 
#TileNumber,North,East,South,West,Tyle Type,Normalised,NS pairs,WE pairs,Base roatation
1,4,0,1,9,e,1,"4,1","0,9",1
2,8,9,8,8,i,1,"8,8","9,8",0
3,6,9,7,7,i,2,"6,7","9,7",0
4,0,1,9,4,e,2,"0,9","1,4",2
5,9,8,7,8,i,3,"9,7","8,8",0
                          | Base rotation needed to put edge sides downwards
                    ----- EW pair ( duplicate information ) 
              ----- NS pair ( duplicate information ) 
            - number of tile when each tile type starts at 1 
          - tile type i=interior, e=edge, c=corner
  N E S W - edge keys 1=a,2=b,7=g,8=h .. etc
N - tile number

Colour key 0 = outside edge of puzzle. Each edge tile will have one 0 edge, each corner tile has 2 of 0 sides.

2) A textfile that contains one Hex number on each line.
Each line is a Hex value that has 8 bits set within a 40bit value (for a 40 tile deck).  Max Deck size is currently 64 but may go up to 256 in a future project. 

EG: A textfile will look like these lines ( order is not important )


0x1242408300
0x1244000318
0x1244000b08
...

The set bits in the number represent the number of the tile in the tile file that is to be used in the (Block 8 tiles ) B8 layout. Hex to binary conversion shows the tiles for this sample ....

$ bc -l
bc 1.06
ibase=16   # << set hex input
obase=2    # << set binary output
C          # << input test number
1100       # << result
1242408300 # << actual hex number
1001001000010010000001000001100000000   #<< binary result

Rightmost bit is counted as "1" to match tile number 1 in the tile file.
<< MSB --------                       ----- LSB >
40   36   32   28   24   20   16   12   8    4  1  << bit number
|    |    |    |    |    |    |    |    |    |  
...1 ..1. .1.. ..1. .1.. .... 1... ..11 .... ....  << Extracted bits
...| ..|. .|.. ..|. .|.. .... |... ..|| .... ....
0001 0010 0100 0010 0100 0000 1000 0011 0000 0000  << Binary number
   1    2    4    2    4    0    8    3    0    0  << Hex digits 1 for each 4 bits                                                                                

Tiles in sample 0x1242408300  layout would be 

9, 10, 16, 23, 26, 31, 34, 37

3) A clue string is provided in the format "aaaa/bbbb/ccdd" which represents the edge keys on the top most unmatched edge, bottommost unmatched edge and the two shorter sides. For the layout and above the clue string would be :
rwbr/kook/rogr

When a B8 tile layout and its rotations are found the clue string is checked to ensure that the outer boundary keys match the clue string. Layouts that correctly represent a B8 but fail the clue string should be reported.  All the lines should have at least one layout that matches the clue string.

Task
Find a B8 layout of tiles for each hex number in the textfile.

A B8 layouts is reported using the following single line notation.  A layout and other possible outcomes would be reported as: 

B8:0x1242408300:T13R2,T15R3,T7R3,T9R3,T12R3,T4R1,T3R3,T5R0
B8:0x1242408360:Fail Too many bits
B8:0x1242408b08:Fail No layout found
B8:0x1242408b08:Fail Clue string mismatch: T13R2,T15R3,T7R3,.....

Outline size of task

Arrange and rotate 8 tiles to find layout which has inner edge matches and outer face matches with a clue string.

Given eight tiles there are 
8*7*6*5*4*3*2*1  = 8! = 40,320 possible tile layout orders.

Each tile can have 4 possible rotations leading to 
4*4*4*4*4*4*4*4 = 4^8 = 65,536 different sets of rotations

Multiplying rotations and layout orders there are :
2,642,411,520 possible ways of organising eight tiles.

Time for 2.6 billion simple loops in Perl and c++
$ time perl -e 'foreach(1..40320){ foreach (1..65536) {$t+=1}};print"t=$t\n";'
t=2642411520
real 2m35.544s
user 2m35.265s
sys 0m0.165s

$# Same loops coded in c++ run in about 4% of the time.
$ make cpptime ; time cpptime
c++     cpptime.cpp   -o cpptime
t=2642411520
real 0m5.930s

user 0m5.913s


Not all of these need to be tested as tiles can be checked against their neighbours before rotations in place are attempted. If a tile has none of the same edge keys as its neighbour then they would never work next to each other in the same layout. A logical test can be constructed to see if any 8 tile layout is likely to actually work before rotations are applied.

Hint

There are two distinct stages to this problem. First is to find out specific layouts of cards that could possibly join together, and secondly to find the rotations that fit any given layout into a solution.
If possible layouts are generated in standard permutation fashion as follows:
1 2 3 4 5 6 7 8  
1 2 3 4 5 6 8 7  
1 2 3 4 5 7 6 8  
1 2 3 4 5 7 8 6  

A test can be performed to see if cards 1 & 2 can possibly match, if not then the next 5041 layouts starting 1 2 can be discarded as well as the 720 after that that start 2 1.  Similarly for columns 2 and 3, large jumps of 720 rows can be made down the rows of permutations without having to test a layout in depth.

Column - Number of rows with the same number in the that column.
[1] - 5040 
[2] - 720
[3] - 121
[4] - 24
[5] - 6
[6] - 1
[7] - 1

As can be seen the first row that starts 2 1 is on row 5041.
 Row
Number    Perm order



Technology to be used


  • Perl and/or c++
  • Multi-tasking via threads, openMP or standard libraries encouraged 8 or 12 way processors available.
  • 8GB memory, 5TB HDD and/or 250GB SSD.
  • Typical time to solution 0.01 second or better per layout.
  • Any c++ should be "standards compliant" and self contained at src level and (highly desirable) to be adjustable to work on W10 or Mac or Ubuntu.
  • Code should be structured so that it can be trivially built into a larger program or as stand alone utility.



    Tuesday 21 November 2017

    The warning and the fail, ICO investor crypto cash vanishes.

    Update: November 2022 Matt Nails it.



    Update : 18 October 2022  An ex-cop fell for Alice. Then he fell for her $66 million crypto scam (Catfish hauls in cops money)
    Update :  9 October 2021 List of Bitcoin change hacks and losses at Binance
    Update : 10 July 2020 List of common Bitcoin Scams
    Update : 15 December 2019 BitClub Network - Yet another Bitcoin investor scam
    Update : 01 March 2019: My Big Coin - Not so much crypto currency as a ponzi scam
    Update : 05 Feb 2019 Crypto coin admin dies - all others locked out and coins effectively lost.
    Update : 21 Nov 2017 31 Million $ lifted from Bitcoin operator Tether

    Investing in new areas of complex technology is perilous even for serious knowledgeable investors. A recent round of crypto currency launches known as ICO initial coin offerings caused the UK financial conduct authority to issue this warning.
    The term ICO refers to a digital way of raising funds from the public using a virtual currency, also known as cryptocurrency. An ICO can also be known as ‘token sale’ or ‘coin sale’.
    ICO issuers accept a cryptocurrency, like Bitcoin or Ether, in exchange for a proprietary ‘coin’ or ‘token’ that is related to a specific firm or project. ICOs vary widely in design. The digital token issued may represent a share in a firm, a prepayment voucher for future services or in some cases offer no discernible value at all. Often ICO projects are in a very early stage of development.
    ICOs are very high-risk, speculative investments.
    From : Financial conduct authority announcement

    No sooner said than done. 
    Confido tokens had a market cap of $10 million last week, before the company disappeared, but now the tokens are worthless. And investors are crying foul.
    Apparently the company pulled the shutters down by deleting all their social media accounts and leaving their backend administrators "Tokenlot" holding the empty bucket. A disappointing state of affairs but such occasional events are unsurprising considering the wild west frontier that underlines underlies bitcoin and similar technologies. Previously stories of stolen millions, closed exchanges and lack of global regulation also dent confidence in this in emerging technology.

    Personally I like my investments, transparent, regulated and income producing.

    See this Hufpost article for information re this complex area. 






    Facebook Meem nails this. From Programming Jokes group.


    Friday 17 November 2017

    Excellent series for the STEM enthusiast

    This excellently produced series of books, branded under the Sterling Milestones banner follows a consistent format. Each book contains 250 individual ideas encapsulated in a picture and a page of text. Organised in roughly time order each book expands the core ideas and discoveries in a STEMM related field.  

    My personal favourite is The Space Book which starts with the big bang, rolling through early discoveries of the planets and calendars towards current activities in space and onwards to how the universe will end. Full of facts and contextual pictures this book really brings alive that unique combination of engineering and exploration which is the discovery and exploration of outer space.

    Each book starts with an introduction to the field and finishes with a comprehensive index, Notes and further reading followed by photos credits. Most are offered by Chris Pickover but other authors have some of the titles.

    For more details Sterling milestones books 



    Is available via Amazon or ABEbooks as usual.

    Friday 10 November 2017

    Some of our favourite software died today

    Today 10th Nov 2017 the house iMac was upgraded to OSx 10.11 El Captain having happily run on OSx 10.6 Snow Leopard since in in 2009.   Snow Leopard was the last version of Mac OSx that would run PowerPC code ( in emulation mode) so this lays to rest QuarkXPress version 6.5 that was the last vestiges of DTP software used for the other halfs' typesetting business.  Purchased as box software many, many years ago Quark has provided good service but is no longer required. Running OS that is over five years old, that no longer get security updates, is also a bit of risk. Also expiring was the last free version of Mac the Ripper DVD content extraction tool. I have to admire Apple by making it so easy and smooth to do an OS upgrade effectively jumps forward five operating system releases in one go.

    The smaller handheld Apple devices upgraded to the latest version of IOS 11.0 recently and this has obsoleted early Apps. My favourite APP was ConvertBot, a little gadget that converted numbers between different units. The software was so well designed and looked so slick that for me it became an early demonstrator for Apple's approach to building a software ecosystem. Many other Apps that have not been updated in the last year or few will also have expired and become unusable. More information here.



    Monday 6 November 2017

    Coffee jar plastic top madness

    I like a cup of strong flavour instant coffee, I also like to recycle and encourage reduction in packaging. 

    In a fit of packaging madness Jacobs Douwe Egberts  lo'r has this most ridiculous plastic top on it's instant coffee. 


    551g Total Jar  made up of 
    347g of glass          -> 62.3 %
    37g   of plastic top ->   6.7 % 
    167g of product     ->  30.3 % 

    Looking by height 
    19cm Total Jar  
    16cm Glass     -> 84 %
    6.5 cm plastic top -> 15%   which overlaps jar by 3cm and has a further 3cm on top of that.



    This type of plastic top is typically non-recyclable ( unlike the glass ) and has no recycling marks identifying the plastic. There is also a plastic film wrapping the glass, which may look nice but does nothing for the recycling process.

    Is there a more effective packaging solution ? Yes but the economics don't look great on the latest Morrisons shopping trip.

    L'or = £2.34 per 100g
    Nescafe gold refill pack = £3.00 per 100g   ( no glass, minimal plastic bag )
    66p more expensive for packaging free refill option. Sigh.




    Even worse for the environmentally minded Morrisons on-line shopping currently has the refill pack 50p / 100g more expensive than the glass jar version.  6 Nov 2017.

     


    Madness.


    Further advice on Recycling Etiquette. 


    -----
    Reply from L'or
    Thank you for contacting L’Or.
    The lid is made of plastic and is recycled through standard plastic recycling bins.
    Kind Regards


    C**** M******

    Consumer Relations Team

    Friday 3 November 2017

    Technical Problem to solve - "Five in a bed" Key matching across lists.

    I have a technical problem that needs to be solved as part of a larger project that has been in the works for a while. Code development needed.

    Starting conditions
    Five text files {A..E} that each contain one number on each line.
    Each line is a Hex value that has 8 bits set within a 40bit value.
    EG: Each file will look like these lines ( order is not important )
    0x1242408300
    0x1244000318
    0x1244000b08
    ....
    0x1000000d2d
    0x100000152d
    0x1000001c1d
    ....
    0xfa402000
    0xfa600000
    0xfa80010
    0xfc000480
    0xfc101
    0xfc200080
    0xfca00

    The files have between a 5000 and 500,000 lines. On average about 30,000 lines.

    Task
    Find one or more solution groups of lines, one from each file, that when OR’d together have all 40 bits set (0xFFFFF) but when AND’d together have 0 bit set (0x00000). The answer would deliver results as
    {FilenameA,0xvalue,FilenameB,0xvalue,FilenameC,0xvalue,FilenameD,0xvalue,FilenameE,0xvalue}
    repeated for each solution set found. Have the ability to stop after first solution or provide multiple answers is desirable.

    Outline size of task - ( updated )
    A simplistic approach would take all the lines from the first file and compare with all lines from second file and keep the matching pairs that are then compared against 3rd file and so on. This scales badly as up to 30,000 ^ 5 = 24,300,000,000,000,000,000,000 worst case comparisons may be needed. Further thought reduced this number as any failed comparison between the first two keys would remove the need for further comparisons for that key pair.  Also when 4 keys have been matched locating the last key becomes a trivial look-up for existence in the last key file. To get 4 keys we can generate keys pairs from files A&B and separately from files C&D then just merge the key results. This process would need 3 comparisons making worst case about 30,000 ^ 3 = 27,000,000,000,000 comparisons to find all the matching sets. As we only need 1 matching result 5 key set set, then if we can use a progressive algorithm that does not need all the results from one stage before starting the next stage, the actual number of comparisons would be much less.

    Test runs show that from files with 8,172 and 438,761 entries  517,183,384 matching pairs are generated (approx 14% hit rate). The normal size of the files is 30,000 entries.  If this 14% success ratio persists then we would have in the normal case

    (( 30000 * 30000 )* 2 * 0.14 ) 
    252,000,000

    comparisons and final stage lookups.  Which seems do-able.

    Structure of answer
    Read and prepare file data into data structures.

    One possible solution would be to run matches between files A&B and separately files C&D to find second stage candidates. Join the results lists and look-up against file E for final matches. This is one approach but I am open to other possibilities.

    It is expected that some sort of pre-organisation of the file keys would be used to reduce the need to compare each key with each other.  Possible some sort of Bloom filter or key grouping ( This is the needed magic bit. )

    Technology to be used.
    Perl and/or c++
    Multi-tasking via threads or standard libraries encouraged 8 or 12 way processors available.
    8GB memory, 5TB HDD and/or 250GB SSD.
    Typical time to solution 5 minutes or better.
    Any c++ should be "standards compliant" and self contained at src level and (highly desirable) to be adjustable to work on W10 or Mac or Ubuntu.
    Code should be structured so that it can be trivially built into a larger program or as stand alone utility.

    -------
    Done a perl prototype.
    Usage 
    5iab.pl {-v n -p n} -x n Afile Bfile Cfile Dfile Efile
    Each file has a list of numbers 1 each on a line.
    Find the lines in the files that have no overlapping bits, IE when & togther make 0. 
    -v n  Set verbose level n default 0; 
    -p n  Dump partial results after n keys and save mem 10000 is recomended for 2.5GB usage  
          memMode is set from -p and mode =4
    -x {1,2,3,4} Run using files as intermediate result holders
                Run Mode x=1 work on Afile Bfile (default) , x=2 work on Cfile Dfile ,x=3 Murge previous done runs with Efile
        Run Mode x=4 Do all stages in this single process, sets memMode=0;
    -x 5         Run as in memory solver all stages.

    Hint: For shorter run times put the file on the command line in increasing size order.

    Normal run would be 
    5iab.pl -x 1 fileA fileB fileC fileD fileE &
    5iab.pl -x 2 fileA fileB fileC fileD fileE &
    wait # till both have finished 
    5iab.pl -x 3 fileA fileB fileC fileD fileE # which will pick up the results and do final murge.

    or


    5iab.pl -x 4 fileA fileB fileC fileD fileE # may run out of memory on big sets






    Thursday 2 November 2017

    Bike stand fail - fixed

    I have a Ridgeback Flight 3.0 bike kitted out for touring mode but it has a falling over problem.




    Quite simply fixed by moving stand attachment forward and cutting off corner of stand to fit.

    Before picture

    After ...


    The stand was only £5 on Amazon and other more adjustable expensive ones are available.

    Sunday 8 October 2017

    /usr/bin/cal with added hex output option. Generate Hex calendar ( unix src code )



    Download
    https://opensource.apple.com/source/misc_cmds/misc_cmds-9/cal/cal.c
    apply this diff - compile and go. Use -x option to get hex output.


    $ diff cal.c  cal_hex.c | sed 's/>/\>/;s/</\</'
    36a37
    >  * Hex version
    138a140
    > int xflag;
    149,150c151,152
    < yflag = year = 0;
    < while ((ch = getopt(argc, argv, "jy")) != -1)
    ---
    > yflag = year = xflag = 0;
    > while ((ch = getopt(argc, argv, "jyx")) != -1)
    157a160,162
    > case 'x':
    > xflag = 1;
    > break;
    210,211c215,219
    < len = snprintf(lineout, sizeof(lineout), "%s %d",
    <     month_names[month - 1], year);
    ---
    > if (xflag) { 
    > len = snprintf(lineout, sizeof(lineout), "%s 0x%x", month_names[month - 1], year);
    > } else {
    > len = snprintf(lineout, sizeof(lineout), "%s %d", month_names[month - 1], year);
    > }
    233c241,245
    < (void)snprintf(lineout, sizeof(lineout), "%d", year);
    ---
    > if (xflag) { 
    > (void)snprintf(lineout, sizeof(lineout), "0x%x", year); 
    > } else {
    > (void)snprintf(lineout, sizeof(lineout), "%d", year);
    > }
    268c280,284
    < (void)snprintf(lineout, sizeof(lineout), "%d", year);
    ---
    > if (xflag) { 
    > (void)snprintf(lineout, sizeof(lineout), "0x%x", year); 
    > } else {
    > (void)snprintf(lineout, sizeof(lineout), "%d", year);
    > }
    375a392,401
    > static char *hday[] = {
    >                 "",
    >                 " 1", " 2", " 3", " 4", " 5", " 6", " 7",
    >                 " 8", " 9", " A", " B", " C", " D", " E",
    >                 " F" ,"10", "11", "12", "13", "14", "15", 
    > "16", "17", "18", "19", "1A", "1B", "1C", 
    > "1D", "1E", "1F",
    >         };
    395a422,425
    > if ( xflag ) {
    > *p++ = hday[day][0];
    > *p++ = hday[day][1];
    > } else {
    397a428
    > }
    434c465
    < (void)fprintf(stderr, "usage: cal [-jy] [[month] year]\n");
    ---

    > (void)fprintf(stderr, "usage: cal [-jyx] [[month] year]\n");

    I hate polystyrene and Bissell carpet cleaners lies right on the box.

    I hate polystyrene and other single-use packaging materials. This single image explains the issue with non-recyclyeable non-biodegradable fragmenting plastic. This bird will be dead soon.



    Often used in product shipping boxes as a bulking and holding material.  Alternatives exist and have been widely used by Mobile phone and other product shippers including Apple.        https://www.moldedfiber.com/eps-alternative.html

    Bissell carpet cleaners are a great machine but the product packaging sucks. Particularly because they have "Sustainable packaging design" boldly printed on the box. The lie of that is just inside with three blocks of polystyrene. Shameful.  The tide is turning in the global awareness of ocean pollution by plastic debris calling out such hypocrisy can only serve to drive the message home.  

    At time of writing the URL on the box www.bissell.com/SustainableDesign is redirected to a UK Bissell shop website. Message implementation fail.






    Bissell was asked for a comment and this is included below. No mention of the broken URL or acknowledgement of the sustainable packaging message and polystyrene block mismatch.


    PS: This article does not refer to Poly Styrene the late singer with X-Ray Specs. :-)


    ========== Reply  From Bissell ===============
    Dear Mr Gannett,
    Thank you for contacting Bissell UK.
    I am sorry to read of your disappointment with our packaging.
    Please be advised I have forwarded your comments and concerns to our head office and this will be taken into consideration for future purposes. At the moment there are no immediate plans to change our packaging or labeling so we are unable to provide you with any timescales of, if and when this will be changed.
    I am sorry for the inconvenience caused.
    Kind Regards
    J******** C******




    Customer Service Team

    Tuesday 15 August 2017

    Help for hoarding tendency or when keeping too much stuff.

    Possessions spectrum

    Very few people live without possessions, many people live with too many possessions. Between those extremes is a spectrum of ownership. Commenting on someones levels of material possessions is rarely received with grace. Even an admiring "You have lots of stuff." comes across as "You have loads of junk." It's all about the point of view, one persons sacred collection of seashells and driftwood is another persons heap of bio-waste and major fire hazard.

    Possession hoarding is the difficult far end of the collecting items spectrum. Hoarding can have serious health implications and is certainly a state of mind problem.  See this linked article for a full description of the symptoms and underlying thought patterns associated with hoarding.  Like many frames of mind compulsive hoarders cannot see themselves as such. If hoarders do recognise there is a problem, they often feel so overwhelmed as to be paralysed by the thought of separating the good stuff from the junk.  We are not going far into that spectrum, just providing some advice and methods for "thinning the heard", "lightening the load", "opening the shelves", "out with the old before in with the new".  If the struggle is with a loft full of boxes or a "garage full with things that matter to me" then this article may be able to help.

    If you have a friend or relative living in the squaller of broken possessions, trash, and junk and you really want to help then, read the linked article above, understand the hoarding mindset and seek professional help. Anything else is just scratching at the edges of a serious problem. Check out online resources such as Help for Hoarders.

    A big pile of stuff arrives one item at a time and remains a problem every single day in which no clearing action is taken. Messy houses do not happen in a day and won't be cleared in a single day - take a forward step each and every day.

    On a lighter note remember the argument between two "Collectors" :
    A to B ) All your stuff is junk, all my junk is stuff....
    B to A ) No, all my junk is stuff, all your stuff is junk.
    (nod to PeteF for this one)


    Computers to the rescue ??  This image found on 'net.. provokes the thought that people often do not see their own possessions as needing a tidy-up

    How to tell the difference between a "collection" and a "heap of stuff" ? 

    A collection is a group of very similar items each of which has proven resale value and together could be sold under a single item listing at an action site. For example :

    My vinyl records are not a collection because most of them have no value ( too common ) and could not be sold together because they spread across too many musical genres. This makes them just a heap of old records. The real issue here is which items have emotional attachment and which have actual provable monetary value. If they are not all together and catalogued, they probably not a collection.

    Only others can say if the things in front of you have value. That value is only determined by an actual sale. You might like, love, value, cherish each and every item but that does not give them value because others do not see or have the perceived emotional links. Emotional attachment has a scale; do not fool yourself into thinking that every item has or should deserve the same level of emotional attachment. Grandma's ashes in a jar are not the same as the teaspoons she used or the newspaper she wrapped her shoes in. If you cannot distinguish between various levels of emotional attachment to different items then hoarding madness lies just ahead. Practice the separation skills listed below to test this aspect.

    Getting in the right frame of mind.

    The first problem with starting is getting in the right frame of mind to move forward. Dismiss any feelings of "don't know where to start", or "the job is too big to even try" with one of these mind exercises. Lose the bonds of unnecessary attachment with these thought exercises :

    • For 3 minutes, close your eyes, relax and picture yourself looking out across an empty dessert landscape. Say 5 times out loud:  "I see nothing and that is a good thing." Prepare  for change with this simple thought pattern.
    • Picture yourself holding an apple, in one hand and small knife in the other hand. The apple is rosy red, fresh and juicy but looking more closely the other side is bruised. Picture yourself cutting out the bruised flesh and throwing it in trash bin before eating and enjoying the rest of the fruit. Then see yourself putting core of apple in the same bin as the discarded flesh. Last of all image the garbage man taking away the trash bin to a far away place.  Repeat exercise with an apple, pear, pumpkin and orange. Practice this visualisation to help with separation between good and bad then visualise fair use and disposal.
    • Every morning and evening, first and last thing you do for a week prior and during clearing out project. Stand in a private space, naked with absolutely nothing on, not even watch or jewellery. Once relaxed and calm say 5 times out loud:  "I stand here with nothing and I need nothing to stand here." Experience the bearable lightness of nothing. Do this exercise to free yourself from the bonds and weight of possessions.  
    • Visit your local dump/landfill, make a list of what facilities there are for recycling newspapers, cardboard, glass, metal, wood, plastic, electrical items etc. and think "Every thing has a place and a place for everything. Sometimes that place is the dump." Remind self that for end of life items the best place is the recycling depot or landfill and not being a fire hazard in the front room.
    • Make up a emotional detachment mantra phrase that you believe in. Something along the lines of "My [relative/friend/neighbour] has no [strong feelings] to their [domestic item of little value] and neither do I."   to come up with something like :
      • "My grandmother had no emotional attachment to her hair rollers an neither do I".
      • "My son had no love for his shoes and neither do I".
      • "My neighbour has no on-going relationship with his newspapers and neither do I".

    For most things older is not better

    Food rots, batteries die, newspapers crumple and fall to dust in the sunshine. Wood gets bugs and crumbles. Technology moves on, candle stick phones don't send texts. There is a natural order for the life of stuff. Keeping material possessions beyond their natural life time denies them the chance to be re-cycled and born again as new items for others to use and love. Recycling iron, aluminium and cardboard uses a fraction of the energy and land resources of digging up and processing new materials. Don't be selfish and block the natural order of resource incarnation. Recycling is not throwing stuff away but is actually saving the planet - do your part. Accept the circle of life.

    Getting started
    When a task cannot be started, it will never be finished. Start the hardest tasks by picking off a small nibble to break the ice. Frame a sub-task as a realistic time bounded goal and write it down. Do that task today. It does not have to be a big thing, just the smallest task is the first step. Try something like:
    • I will put 30 old newspapers / magazines into a box and take to recycle point or put out with trash.
    • I will be generous and will find 4 items to take to the charity shop/good will today. These will be items that I would pay good money for and want to have. Take them to the shop. There will be less items in the house tonight than this morning.
    • Before lunchtime I will separate the items in this cupboard into in-date or out of date and just the dump the possibly poison food.
    If you cannot get started on stuff re-organisational tasks because of overwhelming feeling of anxiety,  indecision or hopelessness or just can't seem to put the same things together - then job #1 is to reach out to someone anyone, friend, neighbours, relative, church person or doctor for urgent help.

    Remember that "activity is no substitute for progress" moving things between piles or boxes does not reduce the size of the overall issue. Only letting go via a garage sale, charity shop, eBay or recycling depot is progress.

    Skills needed for clearing out junk into stuff

    Listed here are some of the basic skill needed to make progress with pile of items to separate the stuff from the junk. Practice them in just a small way before tackling the major task.
    • Starting - Being ready to let go and move forward. The first step must be taken by deciding to move forward. Then get some boxes, tape and and marker pens. The clear storage boxes of moderate size that interlock and stack are a good start. A few similar sized moving boxes will also do. 
    • Scoping - Decide what can be achieved in the first session of a few hours. One counter top, One room or one class of item ( all shoes, all newspapers, magazines etc)
    • Matching - Put all the same stuff together in one place.
    • Ordering - Stretching out a collection of the same stuff into an line based of value based on age, usefulness, colour, state of repair etc. Keep only the very best, dump the rest.
    • Filtering - Knowing what is good to keep and what must go, what has value and what has not.
    • Completing - Moving things out the door to the recycle point, ebay or charity shop.
    These skills are needed for minor reorganisation tasks. If you have a mountain of stuff - just close your eyes, go nuclear and call a cleaning or clearance company. Job done and relax.

    Practical recipes for clearing out junk.

    4 boxes method

    Use separation skills to divide items into 4 boxes. Once boxes are set up and labeled move quickly through the target items. Don't overthink any items, Don't reconsider after first decision has been made.

    An example way to implement this method :
    By the end of today I will separate all the shoes in this room into 4 clearly labeled boxes based on "Fit me but I have not used them for over 6 months" and "Has hole or broken strap" and "No longer fit my feet" and "Some one would love these shoes when they come back into fashion". Keep one box and give one box to goodwill and put other boxes out for the trash.

    Ebay is the new storage

    Think of eBay and Gumtree as a virtual storage company or warehouse. You put stuff into the virtual storage by selling it. Then if you ever need it again just buy it back. The difference between the buy and sell price is the "Storage costs". As it turns out some items go up and some down in price over time. This works for all items that actually have a value. If an item has no value because it won't sell on eBay then look closely as to why it is being kept.  Revise the emotional detachment mantra above.

    Make a Virtual museum 

    Keep the memories alive (without the clutter) for emotionally attached items such as photos, posters even tee shirts and ties by building a virtual museum. Save the images and thus the memories without having the pile of clutter in your space.  This simple tactic involved just taking a photo of the items and making a web photo album viewable on a PC or tablet. Photos software on a Mac or something from http://windowsreport.com/photo-album-software-pc/  will achieve this task. Once all the items are captured as an image the actual items can be all packed away together or sold as a collection.

    Doing a car-boot or garage sale.

    Nothing finds the value of items quite a quickly as doing a car-boot or garage sale. Pick out all those items that feel like they can't be disposed of  "because they have a value" and take them to a car-boot sale or two. Accept that if the stuff does not sell then it really does not have a value. Recycle unsold items to return the resources to the planet for re-use.

    6 months box rule

    Pack a load of clothing/shoes/plastic toys/magazines into closed boxes and write the date on the outside and put in a place for no more than 6 month. If nothing is needed from those boxes ship them out unopened for recycling/re-sale. Do not reopen or resort the box.

    Finally 

    Putting tasks off today what will be harder tomorrow is a classic avoiding tactic. Remember that making a start, building momentum and completing something brings satisfaction and builds the possibility of the better future. There is a spectrum between just having too much stuff and chaotic hoarding. Too much stuff can be self-tackled but hoarding needs help.

    Resources

    Article on symptoms and underlying thought patterns associated with hoarding.
    Message boards and general site Help for Hoarders.
    FlyLady housekeeping and life advice especially for those with a collectors tenancy"