Monday, December 16, 2019

little heroes sing me a song

It is ncurce utility that analyses my chromebook disk how large is nmp and chache on it after failed attempt to install Theia

ncdu -x


16Gb space is enough to make very large systems, especially with 32Gb Oracle Linux server as a host.

Sunday, December 15, 2019

Theia IDE for my arm chromebook

I will say right away, it is not possible to compile Theia nodejs project locally in my chromebook XE303C12 because gcc is old for dependencies code. In spire of I can not compile OJet tooling for me because phantomjs have no arm architecture to build. But I think I should never give up with my tiny hardware because limitation is also inspiration.

Theia is in browser IDE similar to Visual Code, so that I can host my OJet project in free Oracle computed node and enjoy programming on my thin laptop, the experience look like:

To compile Theia:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash
 
restart terminal
 
nvm install 10
 
npm install -g yarn
 
mkdir my-app
 
cd my-app
 
Create package.json in this directory:

{ "private": true, "dependencies": { "typescript": "latest", "@theia/typescript": "next", "@theia/navigator": "next", "@theia/terminal": "next", "@theia/outline-view": "next", "@theia/preferences": "next", "@theia/messages": "next", "@theia/git": "next", "@theia/file-search": "next", "@theia/markers": "next", "@theia/preview": "next", "@theia/callhierarchy": "next", "@theia/merge-conflicts": "next", "@theia/search-in-workspace": "next", "@theia/json": "next", "@theia/textmate-grammars": "next", "@theia/mini-browser": "next" }, "devDependencies": { "@theia/cli": "next" } } 

yarn --registry https://registry.npmjs.org

yarn theia build
 
yarn theia start /my-workspace --hostname 0.0.0.0 --port 8080
 
 
 Thank you Theia for it project may help to programming in cheap environment I can found only in emergency situations.
     

Saturday, December 7, 2019

It is possible to find indirect dependacies

Yesterday in 3 hours I wrote a program that find assembly usages in my code. It is nice to have knowledge about classes I need to refactor to replace library to another. How this program works:

  1. Read all assembly types to check they are used in my code.
  2. Iterate all project .cs files.
  3. For every source file use CSharpSyntaxWalker to traverse to all nodes in AST
  4. For every node ask SemanitcModel to GetDecalredSymbol.
  5. Filter all informative symbols like a IPropertySymbol, IlocalSymbol to read type from it and resolve it from assembly I need to replace.

Thank you for Roslyn it works as expected and it is easy to extend to find indirect dependencies in code to know all places for refactor.

Saturday, November 2, 2019

A glimmer of hope

I continue to setup my chromebook. I have found Chromebrew could be installed with crosh and shell.


So that, I got comfortable crew package manager and a lot of standard programs like a git console.



I want thanks to web apps developers to create some simple programs and IDEs for my work on this tine laptop


Let me check what languages are available, I have seen gcc in messages in time Chromebrew was installed. And I installed latest Node.JS


Sunday, October 27, 2019

Another English lesson

Inside the mind of a master procrastinator | Tim Urban

https://youtu.be/arj7oStGLkU

Transcription: Southern College
Transcription:  I was a government major which means I had to write a lot of papers now what a normal student writes a paper tonight spread the workout a little like this
Transcription:  get started maybe a little slowly when you get enough done in the first week that was some have your days later on everything gets done thinks they civil
Transcription:  and I would want to do that like that that would be the plan I would I would have it all ready to go but then then then that that she the people would come along and then I kind of do this
Transcription:  I know what happened every single Paper
Transcription:  but then came my 90 page senior thesis paper supposed to spend a year on a new for a paper like that my normal workflow was not an option it was way too big a project so I plan things out and I decided I kind of had to go something like this year ago so I start off light and I bump it up in the middle of months and then at the end I would kick it up the high gear Circle staircase how are you just walk up the stairs no big deal right
Transcription:  the best funniest thing happened those first few months they came and went and I couldn't quite do stuff so we had an awesome new revised plan
Transcription:  and then
Transcription:  then those middle months actually went by and I didn't really write words and so we're here
Transcription:  and then two months turned into one month into two weeks and one day I woke up with three days until the deadline
Transcription:  still not having written the word that's why I did the only thing I could I wrote 90 Pages / 72 hours pulling not one but two all-nighters humans are not supposed to pull two all nighters
Transcription:  Sprint across campus Building slow motion and got it ingested the deadline I thought that was the end of everything but a week later I get a call it's School
Transcription:  and they say it is Tim Urban and I say yeah and I say we need to talk about your thesis I say okay
Transcription:  and they say
Transcription:  best one we've ever seen
Transcription:  that did not happen
Transcription:  it was a very very bad thesis
Transcription:  I just wanted to enjoy that one moment when all of you thought this guy is amazing it was very very bad
Transcription:  anyway today I'm a writer blogger guy I write the blog wait but why and couple years ago I decided to write about procrastination my behaviors always perplexed and non procrastinators around me and I wanted to explain to the non procrastinators of the world what goes on in the heads of procrastinators why we are the way we are now at a hypothesis that beat the brains procrastinators were actually different than the brains of other people and the testis I found an MRI lab that she let me scan both my brain and the brain of a proven on procrastinator and I so I could compare them and I actually brought them here to show you today and I want you to take a look carefully to see if you can notice a difference and I know that if you're not a trained brain expert not that obvious but just take a look okay so here's the brain of a non procrastinator
Transcription:  now
Transcription:  here's my brain
Transcription:  there is a difference both brains have a rational decision-maker in them put the procrastinators brain also has an instant gratification monkey. What is everything's fine until this happens
Transcription:  so the rational decision-maker will make the rational decision to do something productive with monkey doesn't like that plan. She takes the wheel and he says actually let's read the entire Wikipedia page of the Nancy Kerrigan Tonya Harding Scandal do they just remember that that happened
Transcription:  then
Transcription:  then we're going to go over to the fridge receipt in there since 10 minutes ago after that we're going to go in at YouTube spiral that starts with videos of Richard Fineman talking about magnets and ends much much later with us watching interviews with Justin Bieber's mom
Transcription:  all that's going to take a while so we're not going to really have room on the schedule for any work today sorry
Transcription:  what is going on here
Transcription:  this a gratification monkey does not seem like a guy you want behind-the-wheel he lives entirely in the present moment he has no memory of the past no knowledge of the future and only cares about two things easy and fun now in the animal world that works fine if you're a dog and you spend your whole life doing nothing other than easy and fun things your huge success
Transcription:  to the monkey
Transcription:  humans are just another animal species used to keep well slept well fed and propagating into the Next Generation which in tribal X might have worked okay but if you haven't noticed that we're not in tribal Times Square in an advanced civilization in the monkey does not know what that is which is why we have another guy in our brain the rational decision-maker who gives us the ability to do things no other animal can do we can visualize the future we can see the big picture we can make long-term plans and he wants to take all of that into account and he wants to just have us do whatever makes sense to be doing right now. Sometimes it makes sense to be doing things that are easy and fun like when your are having dinner or going to bed or enjoying well or and Leisure Time that's why there's an overlap sometimes they agree but other times it makes much more sense to be doing things that are harder and Less Pleasant for the sake of the big picture and that's when we have a conflict
Transcription:  and for the procrastinator that conflict tends to end the certain way every time leaving him spending a lot of time in this oranges on an easy and fun place that's entirely out of the make sense Circle I called the dark playground
Transcription:  now
Transcription:  the dark playground is a place that all of you procrastinators out there know very well it's where leisure activities happened at times when leisure activities are not supposed to be happening the fun you have in the dark resin actually fun because it's completely on earned and the air is filled with guilt dread anxiety self-hatred all those good procrastinator feelings in the Christian is in this situation with the monkey behind the wheel how does a procrastinator ever get himself over here to this Blue Zone a Less Pleasant place but we're really important things happened Well turns out that the procrastinator has a guardian angel someone is always looking down on him and watching over him in his darkest moments someone called the Panic monster
Transcription:  the Panic monster is dormant most of the time but he suddenly wakes up anytime a deadline gets too close or there's danger of public embarrassment a career disaster some other scary consequence and importantly he's the only thing that the monkey is terrified of now in my life recently reached out to me about six months ago and invited me to do a TED Talk
Transcription:  out of course I said yes it's always been a dream of mine to have done a TED Talk in the past
Transcription:  play the middle of all this excitement a rational decision-maker seem to have something else in his mind he was saying on what we just accepted do we get what's going to be now happening one day in the future we need to sit down and work on this right now in the monkey said totally agree but also it's just open Google Earth Zoom into the bottom of India like 200 feet above the ground we're going to screw up two and a half hours do I get to the top of the country so we can get a better feel for India
Transcription:  so that's what we did that day
Transcription:  at six months turned into four and then two and then one the people of Ted decided to release the speakers and I opened up the website and there was my face staring right back at me and guess who woke up
Transcription:  so the Panic monster starts losing his mind in a few seconds later to fill systems in Mayhem
Transcription:  and the monkey remembers terrified of the panic monster he's up the tree and finally finally the rational decision-maker can take the wheel and I can start working on the talk now Panic monster explained all kinds of behavior like how someone like me could spend two weeks unable to start the opening sentence of a paper and then miraculously find the unbelievable worth work ethic stay up all night and write 8 pages
Transcription:  and this entire situation with a free characters this is the procrastinators system not pretty but in the end it works and this is what I decided to write about on the blog just a couple of years ago now when I did I was amazed by the response literally thousands of emails came in from all different kinds of people from all over the world doing all different kinds of things these are people who are nurses and bankers and Painters and engineers at lots and lots of PhD students
Transcription:  they're already saying the same thing I have this problem to post Rocky was the contrast between the light tone of the post and the heaviness of these emails these people were ready with intense frustration about what procrastination is done to their lives about what this monkey had done to them
Transcription:  and I thought about this and I said what the system works then what's going on why are all these people in such a dark place Well turns out that there's two kinds of procrastination
Transcription:  are we going to talk about today the example of give mail have deadlines when there's deadlines the effects of procrastination are contained to the short-term because the Panic monster gets involved but there's a second kind of procrastination that happens in situations when there is no deadline so you want to have a career going to be a self-starter entrepreneurial deadlines on those things at first because nothing's happening until you've gone out and done the hard work to get some momentum to get things going is also all kinds of important things outside of your career that don't involve any deadlines like seeing your family or exercising and taking care of your health working on your relationship or getting out of a relationship that isn't working now if procrastinators only mechanism of doing these hard things is the Panic monster that's a problem cuz in all of these non deadly situations Panic monster doesn't show up you something to wake up for so the effects of procrastination do not contain they just extend outward forever
Transcription:  is this long-term kind of procrastination that's much less visible and much less talked about than the fun of your short-term deadline based time it's usually suffer quietly and privately asked me the source of a huge amount of long-term unhappiness and regrets
Transcription:  and I thought you had that's why these people are emailing and that's why they're in such a bad place it's not that they're cramming for some project it's that long-term procrastination is made them feel like a spectator at times in their own lives near the frustration was not that they couldn't achieve their dreams that they weren't even able to start chasing them so I read these emails and I had a little bit of an epiphany
Transcription:  that I don't think non procrastinators exist that's right I think all of you are procrastinators a mess like some of us
Transcription:  and some of you may have a healthy relationship with deadlines but remember the Monkees sneakiest trick is when the deadlines aren't there now I'll show you one last thing I call this a life calendar that's one box for every week of a 90-year life
Transcription:  how many books has especially since we've already used a bunch of those so I think we need to all take a long hard look that calendar
Transcription:  we need to think about what we're really procrastinating on because everyone is procrastinating on something in life
Transcription:  we need to stay aware of the instant gratification monkey
Transcription:  that's a job for all of us
Transcription:  and because of that the money box down there at the job that you're probably start today but not today
Transcription:  get up
Transcription:  sometime soon
Transcription:  thank you

How do you put a financial value on sports sponsorship? | Marketing Media Money

https://youtu.be/hGB7AN326Zc


Transcription: Sports sponsorship a great way to increase brand visibility or logo on the place shirt and then the fans watching in the stadium of the millions of people watching on TV and online and sharing content on social media but how do you measure how much that's actually were computers how to find logos of Brands as they appear on TV streaming or a social media thinks Sports signage like a field level LED at a football match or the helmet of a Formula 1 driver our methodology starts by using a media equivalent for TV or social media for example the cost of a 30-second commercial or to buy a Facebook app
Transcription: so after that we apply a discount based on six different factors these are quality factors like Clarity prominence size visibility share a voice and placement in the case of the the UEFA Champions League final it was between Real Madrid and Juventus gumgum Sports we found / 517 million engagements on social media billions of Impressions and over literally 61082 seconds of brand exposure associated with thousands of social media posts and those are social media posts that contained those sponsors right not just any social media posts about the game
Transcription: brighten whether it's a shirt sponsor were Peele devil LED this equated to more than 164 million dollars of media value and it's a big the big number and the pig in a winners of that wear Adidas and fly Emirates right because they saw combine 113 million dollars of media value as the kid and the and the shirt sponsor of the winning team Real Madrid and Doug to get the pallets of celebrity so not sure if it's a surprise at this point but Ronaldo's own social media accounts right Reynaldo drove over 169 million engagements featuring you know sponsor signage and about 38% of the overall media value write 63 million dollars was driven just by Ronaldo
Transcription: you don't sound very clever but is this really artificial intelligence at work absolutely I mean a I answer the question how do you scan millions of social media posts for sponsor signage right and then you have to attributed to a very specific and game right it's not enough to just fine the signage and isolation right cuz you can have say a Heineken logo show up in a social media post and it's just a a bottle at a at a local pub and it may have nothing to do with the game at all so why is measuring grams visibility on social media so important to focus on solving two problems here the first is about the changing nature of content consumption should think the digital so with the TV ratings declining Brands need to know the full value that they're generating right and to answer this question you need to cover multiple platforms including social and then secondly Brands they want comprehensive data right that is delivered
Transcription: an efficient manner so given that the fans are turning more to social media to consume those near the sports highlights that he used to go to TV for they need a technology that can measure this activity ultimately it's value for both sides where they really wanted a third-party kind of independent party that they can trust to provide you know this accurate measurement it was about the future how could the technology be used to further develop these Sports sponsorship Market once buyers and sellers of sponsorships better understand media value we see the next opportunity as creating a marketplace where these Brands could essentially bid on Sports signage in near real-time so globally right so across all of the different leagues being able to buy those LEDs where you know Saya brand were able to purchase a prominent LED
Transcription: just during the last two minutes of the game that's within three points right say a basketball game or for a football match they can look at which players are set to to hit certain milestones and bid just on on those games where those big Milestones can happen is those live on forever
Transcription:  still watching perfect click here to watch another great video from CNBC International oh and don't forget to subscribe thanks for watching

Saturday, October 26, 2019

The first steps on chromebook developer mode

I got used school laptop x131e for me. It is great hardware with chromeos I can use for study purposes. It has 50% capable battery, so that I have 4 hours outdoors.

Exactly after setup additional 16gb ssd to it second slot and update memory to 6gb I started to exterminate by laptop can be used for development purposes.

I switched on developer mode. To did that in x131e I used Esc+F3+Power key combination. Pay attention it will remove all information from chromebook. Every time you need to press Ctrl+D on verification page.

Then I check is all renewed memory is enabled with chrom://system web page. To check RAM you need to expand meminfo and to check ssd expand storage_info.

To comfortably work iwth chromebook internals you need crosh page, it opens with Ctrl+Alt+T, as same as root terminal that opens with Ctrl+Alt+F2.

Saturday, October 12, 2019

The legacy

Here is description of past project authored by me.

charsetencoder


The gui program to convert texts from one charset to another. It looks like iconv in linux implement this, thus this program is example. 2006.

entity-reflection

Here is example of generate assembly with same classes but it contains decorated methods for every method. It can be used as deep logging feature for third party assemblies. Postsharp do this, but my code is was written in 2005.

pagecounter

Read pdf and print number of pages in it. Its not accepted to pay from Upwork customer. 2013.

regexp-replace

Here is 2004 year utility to simply find rows in code that matches Regex and replace occurrences. I had used it in my first programming job long summer ago.

rhc

Remote moisture control is a server for grab data from moisture detectors for Microwave Technologies startup, I done it in 2010-1012 period. It has device emulator, a lot of code in Managed C++ and now all of that was replaced with Java and TiniOS for detectors. It is a legacy from Microwave Technologies Dnepropetrovsk.

sourcefilelicenser

Command line utility for place license information for every source file in project folder.

transportdemo

It is a WPF control template builder, It can create wpf controls with labels textboxes on the fly as same as other CRM designers do. It is a usefull example how to integrate customer entity views to a project with minimal effort. 2013

vector-converter

As you may know WinFroms now ported to .NET Core 3.0 on Windows, but of course, this type of controls very uncomfortable for end users. Vector convertor compile 2D graphics as UserConrols you may add to gray default style of WebForms utility to make it colorful and place logo in vector. Its all before svg I wrote in 2004.

barberkendocore

Just a stopped startup to make booking in city barbershops.

bigsorterrunner

This is a great example how merge sort works with big amount of data. It is based on Microsoft blog example program, but it has a lot of corrections and improvements to sort int + text rows format. It can be reused in knowledge database I use every day to make repetitive learning.

childkernel

This project is the sample of great GPU feature to call a kernel from inside another one without return a control to CPU. This is a root of all closures that make AI being possible on a SIMD. One thing I have found running this code, that CUDA native image can do that, not portable image, I think because of nature of single platform for child kernels.

classremover


Bulk class remover from WCF generated client code to make generic realizations and implement interfaces in classic software connectors like Abacus AG provide. This story about CM authomation.

englishchat

My first state machine console bot. It remember words and ask it.


fileanalyser

This utility make possible to find duplicate text in files, especially in code. It rates duplicates to easy find what same code you need to extract to method.


filedictionary


filegenerator


go_mysql_filtered


goietfrfc5546


inventory


jschemageneratorapp


karilon


lab1


lab2


ladderlogic


makebridgefordll


miniamfdecoder


mvcmobile


mwt


mysqlwebconnector


opengles_sampleapp


orderanalyser


pagecounter


readablesource


sourcefilelicenser


submoduleselector


transportdemo


vector-converter


wincelibloader


wixwpf

Sunday, September 29, 2019

Transcripts for study English

Of course, it looks strange to study English with computer games, but it is not bad to improve gaming skills along with language listening.

So that, I have found some games with intermediate and advanced English dialog.

For first is 'Life is Strange' with advanced English dialog, and for second is 'Encodya' which still is a demo.

I wanted to make transcripts automatically with GCP and I have steps what work for  my computer.

1. Record video play.

2. Open convert dialog in VLC program to save only audio stream from newly recorded video.


Don't forget to save it in FLAC, because MP3 is not supported.

3. Open flac in Audacity and mix channels not Mono, because Stereo is not supported.


4. Save GCP credentials JSON in the disk and set Environment variable GOOGLE_APPLICATION_CREDENTIALS with path to the credentials json you obtime from Google cloud console.

5. Navigate to Storage in GCP and select bucket to store flack file to process.


6. Enable Speech to text service in GCP.

7. Npm packege.json with libraries

{
    "name": "arise", 
    "version": "1.0.0", 
    "description": "", 
    "main": "main.js", 
    "dependencies": {
        "@google-cloud/speech": "3.3.0", 
        "yargs": "^14.0.0"
    }, 
    "devDependencies": { }, 
    "scripts": {
        "build": "node main.js"
    }, 
    "author": "", 
    "license": "ISC"
}


8. Node js module looks like this, you need just change Gcp Url on it with Bucket and file name. Original code

const speech = require('@google-cloud/speech');
const path = require('path');

const client = new speech.SpeechClient();

  const gcsUri = 'gs://staging.alien-dialect-254414.appspot.com/2.flac';
  const encoding = 'FLAC';
  const languageCode = 'en-US';

  const config = {
    enableWordTimeOffsets: true,
    encoding: encoding,
    languageCode: languageCode,
 sampleRateHertz: 44100
  };

  const audio = {
    uri: gcsUri,
  };

  const request = {
    config: config,
    audio: audio,
};

client
  .longRunningRecognize(request)
  .then(data => {
    const operation = data[0];
    // Get a Promise representation of the final result of the job
    return operation.promise();
  })
  .then(data => {
    const response = data[0];
    var subContent = "";
    response.results.forEach(result => {
      console.log(`Transcription: ${result.alternatives[0].transcript}`);
      subContent = subContent + result.alternatives[0].transcript;
   result.alternatives[0].words.forEach(wordInfo => {
        // NOTE: If you have a time offset exceeding 2^32 seconds, use the
        // wordInfo.{x}Time.seconds.high to calculate seconds.
        const startSecs =
          `${wordInfo.startTime.seconds}` +
          `.` +
          wordInfo.startTime.nanos / 100000000;
        const endSecs =
          `${wordInfo.endTime.seconds}` +
          `.` +
          wordInfo.endTime.nanos / 100000000;
        console.log(`Word: ${wordInfo.word}`);
        console.log(`\t ${startSecs} secs - ${endSecs} secs`);

      });
    });
  })
  .catch(err => {
    console.error('ERROR:', err);
  });

9. npm install; npm run-script build > transcript.txt

That is all, you have transcription. You also can monitor resources in Speech to text service

I saved 15 minutes of Encodya and 20 minutes GCP made transcript to the text:

Transcription:  if you were born here how is it possible you have to stick accent
deal birthing 2062 IDOC megalopolis run by corporations and corrupt politicians gyro 14 oz made the streets her home she scavenges for a living Reinventing uses for scraps the Robey friend is SAU MP3 the big clumsy robot assigned to her at Birth he will do anything to protect her check Tina what date in Torrance and will discover something that may change the world is the night before that day the beginning to ending credit I guess that our last ticket has expired are we very far from home display we must take another flybus to reach our place we should find a ticket it's getting late and very cold out here you must return to our shelter as soon as possible let's go if I Pass rates I need to take a number to 12 to get to my shelter he get credits and it gives you fly bus tickets I don't have any credits hey there's a rusty saber color can in here I don't want to throw anything away seems like no one is really using it I don't like his face looks nasty hello there robot doesn't speak as human language Glenside advertises a new kind of training cat the other side a synthetic fish meal they corpse has awful taste sexy statue looks fully immersed let me not to disturb him it's the fly bus time table looks like time is Frozen in New Berlin it's a console for copying data from Roblox instead of ordering at the moment I can't use it it's out of order it's a long and interesting road but the developer needs funds to finish the game hey something is simmering in there I saw something shining down there but I can't reach it how to make simple it over stop is that traffic but I can't see any car around excuse me and there's nobody around okay whatever do you have any free play bus tickets you're doing nothing rather than eating an Asian donut over there since you're probably giving up some task why is there an! Over your head will even if I don't have an! Over my head there's something that you can help me with or to whomever brings evidence of his identity if I wasn't busy handling traffic I could do it myself tell me more about this criminal other than a vague description of what he must have cheese and that includes Asian food tell me more about the reward whoever provides evidence will get 10,000 the Oberlin credits identifying proof of New Year's Day tell me more about the evidence in the Oberlin police archive so if I bring you a fingerprint of his criminal you will pay me I better go look for him he looks a bit creepy but funny at the same time hello what's up kid I hope you have a good reason to enter up by collisions meals do you have any spare bus tickets spare bus tickets are you kidding me is Chubby nasty faces all around the city but I like your attitude anything else how's the food in here much better than a damn those corporations they don't care about work conditions for humans you have all my support anything else best mustaches is it difficult to grow them like that. Are you planning to grow a pair of little boy I'm a boy I'm a girl. Sorry I thought you were a boy I'm a child start sitting alone for the last three years just me and my robot Scavenging the dirty corners of this megalopolis but okay fair enough that explains a lot my tomboy anything else are you asking to spend answer the criminal quiet years and I've never heard Roscoe Spencer are you sure you look like them cuz they're already internet go Spencer and you just said no end of story nothing I'll leave you alone German MO an ancient sculpture called lombroso would say he looks like a criminal a tiny Asian chef with a mechanic and probably the owner and chef at this place he looks busy cutting fish excuse me let's do you want me to God it don't you see I'm a busy who are you seeing if you were born here how is it possible you have to stick accent

I made it readable in a hour:

if you were born here how is it possible you have to stick accent
Neo-Berlin 2062.
A dark megalopolis run by corporations and corrupt politicians.
Nine year old orphan Tina made the streets her home.
She scavenges for a living, reinventing uses for scraps.
Her only friend is S.A.M. S3
The big clumsy robot assigned to her at Birth.
he will do anything to protect her.
One day Tina and S.A.M. will discover something that may change the world.
Is the night before that day.
The beginning to an incredible journey.
The journey to.. Encodya.
I guess that our last ticket has expired..
Are we very far from home?
Yes, Tina. Eleven point thirty forth kilometers away.
We must take another fly bus to reach our place.
Damn..
we should find a ticket.
it's getting late and very cold out here...
You must return to our shelter as soon as possible.
Okay. Okay! Let's look around.
Al right. let's go.
It fly bus routes.
I need to take a number to 12 to get to my shelter.
He get credits. And it gives you fly bus tickets.
I don't have any credits.
Hey there's a rusty cubercola can in here.
I don't want to throw anything away.
Seems like no one is really using it.
I don't like his face. Looks nasty!
Hello there.
Ehm..? I guess robot doesn't speak as human language.
One side advertises a new kind of training hat..
The other side a synthetic fish meal..
The big corps has awful taste!
A cyberspace junkie.
He looks fully immersed.
Better not to disturb him.
It's the fly bus time table.
looks like time is Frozen in Neo-Berlin.
it's a console for copying data from Robots.
But it's out of order at the moment...
I can't use it. It's out of order.
It's a long and interesting road..
But the developer needs funds to finish the game!
Hey something is shimmering in there.
There is something shining down there.
But I can't reach it.
I'm too weak to pull it over.
It seems focused on traffic.
But I can't see any car around.
Excuse me..
Yes?
What are you doing here, considering is nobody around?
I'm programmed to handle traffic and prevent car accidents.
Yeah. I guessed that. But most of the cars are up in the sky!
I'm programmed to handle traffic and prevent car accidents.
Okay, whatever...
Do you have any free fly bus tickets?
No, I am sorry.
Blimey!
Now leave me alone, small human. Don't you see I'm busy?
Actually. I am surprised to see you here doing nothing.. rather than eating an Asian donut over there.
You little scoundrel!
Something else I can help you with?
Since you're probably giving up some task, why is there an exclamation mark -!- over your head?
Hey. This is a Point'N'Click adventure game! Not some polish RPG..
So are you giving me a mission or not?
Well. Even if I don't have an explanation mark over my head..
There's something that you can help me with.
Really, what?
Neo-Berlin police has reported a very dangerous criminal in this area.. And offers a reward to whenever brings evidence of his identity.
if I wasn't busy handling traffic I could do it myself.
Tell me more about this criminal..
His name is Rosco Spenser..
He is wanted because he publicity offended the Mayor of Neo-Berlin.
There isn't much info about him.
Other than a vague description of long must aches..
..and that he loves Asian food.
Mmmh. Interesting!
Tell me more about the reward...
Whoever provides evidence will get 10,000 the Neo-Berlin credits.
Awesome! I can buy th fly ticket with this money!
Actually, you can buy a century subscription with these credits.
I'd better find proof of who h is then.
Sure, come back to me when you have evidence and I can pay you.
Great!
Tell me more about the evidence..
We need biometric data to search Neo-Berlin police archive and prove his identity..
..a fingerprint could do the job.
A fingerprint, uh?
Yes.
So if I bring you a fingerprint of his criminal you will pay me?
Exactly. But be careful.. He is very dangerous.
I better go look for him!
Be good and follow the law!
He looks a bit creepy but funny at the same time.
Hello..?
What's up kid?
I hope you have a good reason to interrupt my delicious meal..
So you have any spare bus tickets?
Spare bus tickets?! Are you kidding me?!
Since that swine of a mayor raised the transportation fee.. I am forced to go around on my grandpa's bike!
I don't like Mister Rumpf! His chubby nasty faces all around the city.
Yes, hoping to get re-elected. Puah! That pig will never get my vote!
Neither mine!
I guess you are too young to vote.. But I like your attitude!
Anything else?
How's the food in here?
Ohhh! I love it!
Much better than the chow at the factory canteen.
I've talk with the union. We should strike again, this time for 2 weeks!
Those corporations..
They don't care about work conditions for humans!
Yeah. I hate those big corps! Go ahead! You have all my support!
Thank you, kid. We heed it.
Anything else?
Nice mustaches! It is difficult to grow them like that?
It's not but it takes a lot of care.
Are you planning to grow a pair, little boy?
I am not a boy! I am a girl!
What!? Really?! Sorry, through you were a boy..
Errr no. I'm a child of this dark city. I've lived alone for the last 3 years...
Just me and my robot scavenging the dirty corners of this megalopolis.
Wow! That's incredible!
Who wrote you this character background?
I don't know..
but okay fair enough! that explains a lot my tough tomboy!
Anything else?
are you Rosco Spencer the criminal?
Shhhh! Be quiet! Neo-Berlin police hes ears in every corner!
But no. I've never heard of any Rosco Spencer.
Are you sure? You look like him..
What?! Have they already put around my wanted photo?!
I thought they need evidence first!
I was sure they only had that outrageous internet post about Rumpf.
That sleazy capitalist swine! Hope to see you him sink in the mud.
But sorry, never heard of Rosco Spencer.
And you just said..
No! I'm not him! End of story!
Anything else?
Nothing. I'll leave you alone.
Long live chairmen MAO!
An ancient scholar called Lombroso would say he looks like a criminal.
A tiny Asian chef with a mechanic hand.
Probably the owner and chef at this place. He looks busy cutting fish.
Excuse me.
What do you want, little girl? Don't you see I'm busy?
Who are you?
I'm a chef Hayao! Born i Germany, of Japanese origins.
Master of Noodles, Inventor of the Japanese-German fusion cuisine.
If you were born here, how's it possible you have this think accent?
Accent? What accent? I speak perfect English! You little racist!





Saturday, September 14, 2019

Backup with fixed size chunks

Here is a program to split large folders to fixed size chunks to backup it. Usually it takes 5 minutes to create ten 4Gb chunks with preserved folder structure you simply merge it again from backup. It supports Unicode for folders as well.

class Program
    {
        private const int MB = 1000000;
        private static string _folder;
        private static string _destFolder;
        private static bool _sameDestination;
        private static long _chunkSize;
        private static bool _move;
        private static bool _owerride;

        private static List<string> _skippedFiles = new List<string>();
        private static long _totalCount;
        private static long _totalSize;
        private static string[] _files;

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern IntPtr GetStdHandle(int nStdHandle);

        [DllImport("kernel32.dll")]
        static extern bool ReadConsoleW(IntPtr hConsoleInput, [Out] byte[]
           lpBuffer, uint nNumberOfCharsToRead, out uint lpNumberOfCharsRead,
           IntPtr lpReserved);

        public static IntPtr GetWin32InputHandle()
        {
            const int STD_INPUT_HANDLE = -10;
            IntPtr inHandle = GetStdHandle(STD_INPUT_HANDLE);
            return inHandle;
        }


        static void Main(string[] args)
        {
            Console.WriteLine("Folter to backup:");
            _folder = ConsoleReadLine();

            if(!Directory.Exists(_folder))
            {
                Console.WriteLine("NOT FOUND");
                return;
            }

            Console.WriteLine("Same destination?");
            string yesNo = Console.ReadLine();
            _sameDestination = yesNo.ToLower() == "yes";

            if (!_sameDestination)
            {
                Console.WriteLine("Destination folter:");
                _destFolder = ConsoleReadLine();

                if (!Directory.Exists(_destFolder))
                {
                    Console.WriteLine("NOT FOUND");
                    return;
                }
            }
            else
            {
                _destFolder = _folder;
            }

            Console.WriteLine("Size of CD MB:");
            _chunkSize = Convert.ToInt64(Console.ReadLine()) * MB;

            Console.WriteLine("Move files?");
            _move = Console.ReadLine().ToLower() == "yes";

            Console.WriteLine("Owerride partial results?");
            _owerride = Console.ReadLine().ToLower() == "yes";

            ScanForFilesLargeWhenSize();
            PreStatistics();

            Console.WriteLine("Are you sure tu start?");
            yesNo = Console.ReadLine();

            if(yesNo.ToLower() != "yes")
            {
                Console.WriteLine("FINISED");
                return;
            }

            ProcessFolter();
        }

        private static string ConsoleReadLine()
        {
            const int bufferSize = 1024;
            var buffer = new byte[bufferSize];

            uint charsRead = 0;

            ReadConsoleW(GetWin32InputHandle(), buffer, bufferSize, out charsRead, (IntPtr)0);
            // -2 to remove ending \n\r
            int nc = ((int)charsRead - 2) * 2;
            var b = new byte[nc];
            for (var i = 0; i < nc; i++)
                b[i] = buffer[i];

            var utf8enc = Encoding.UTF8;
            var unicodeenc = Encoding.Unicode;
            return utf8enc.GetString(Encoding.Convert(unicodeenc, utf8enc, b));
        }

        private static void ProcessFolter()
        {
            int chunkIndex = 0;
            long currentSize = 0;
            string currentFolter = string.Empty;
            long currentCount = 0;
            foreach (var file in _files)
            {
                string chunkName = string.Empty;
                var info = new FileInfo(file);
                if (chunkIndex == 0 || currentSize + info.Length > _chunkSize)
                {
                    if (chunkIndex > 0)
                    {
                        Console.WriteLine("Chunk created: {0}", currentFolter);
                        Console.WriteLine("Chunk size: {0} MB", currentSize / MB);
                        Console.WriteLine("Chunk file count: {0}", currentCount);
                    }
                    currentSize = 0;
                    currentCount = 0;
                    chunkIndex++;
                    chunkName = $"CD_{chunkIndex}";
                    currentFolter = Path.Combine(_destFolder, chunkName);
                    Directory.CreateDirectory(currentFolter);
                }

                string subFolder = CreateChunkSubfolder(file, currentFolter);
                string destFile = Path.Combine(currentFolter, subFolder, info.Name);
                long size = info.Length;
                if (File.Exists(destFile) && _owerride)
                {
                    File.Delete(destFile);
                }
                if (!File.Exists(destFile))
                {
                    if (_move)
                    {
                        File.Move(file, destFile);
                    }
                    else
                    {
                        File.Copy(file, destFile);
                    }
                    currentSize += size;
                    currentCount++;
                }
                else
                {
                    currentSize += new FileInfo(destFile).Length;
                }
            }
        }

        private static string CreateChunkSubfolder(string file, string destFolder)
        {
            string result = Path.GetDirectoryName(file).Replace(_folder, string.Empty).TrimStart(Path.DirectorySeparatorChar);
            string[] subfolders = result.Split(Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries);
            string curentFolder = destFolder;
            foreach(var folder in subfolders)
            {
                curentFolder = Path.Combine(curentFolder, folder);
                if (!Directory.Exists(curentFolder))
                {
                    Directory.CreateDirectory(curentFolder);
                }
            }
            return result;
        }

        private static void PreStatistics()
        {
            Console.WriteLine("====================");
            Console.WriteLine("Total size to process: {0} MB", _totalSize / MB);
            Console.WriteLine("Total files count to process: {0}", _totalCount);
            Console.WriteLine("Minimal estimated chunks: {0}", (_totalSize / _chunkSize)+1);
            Console.WriteLine("Destination folder: {0}", _destFolder);
            Console.WriteLine("====================");
        }

        private static void ScanForFilesLargeWhenSize()
        {
            _files = Directory.GetFiles(_folder, "*", SearchOption.AllDirectories);
            foreach (var file in _files)
            {
                var info = new FileInfo(file);
                if (info.Length > _chunkSize)
                {
                    _skippedFiles.Add(file);
                    Console.WriteLine("{0} SKIPPED with size {1} MB", file, info.Length / MB);
                }
                else
                {
                    _totalCount++;
                    _totalSize += info.Length;
                }
            }
        }
    }

debug magazine archive

  71 jounals still available on issuu with great story of netlabels time.  debug_mag Publisher Publications - Issuu