Categories
Megu Shinonome

Gifting Megu Shinonome a 3D Model

Introduction

Something that makes Megu Shinonome is that you can actually give a gift of 3D model.

For example:

From the live casting for September 20th, 2020

This article covers information about how to create one.

Let me, first by introducing what the official website stats:

Number of mesh: 1
Number of polygons: about 5000 (You cannot use N-gons)
Number of materials: 1 to 2
Texture:
 Type: png (4096×4096 pixels)
 Only a color texture, and a shadow color texture allowed. You cannot use normal and alpha.
  File name of the texture:
 Color texture: any name you prefer
 Shadow color texture: Color texture name followed by _Shadow1
  For example:
   T_Fork.png
   T_Fork_Shadow1.png
Include files in a folder with the name pattern of OBJ_XXX (Where XXX represents your object name)
  For example:
   OBJ_Fork
Contents of the folder
 ・An obj file
 ・A mtl file
 ・Textures

Model should be made in a actual size

If you are using Blender:
When exporting to obj, use 100 as the scale. You can also magnify the object by 100 as well.
Because this converts the model in a centimeter scale, 1x would be very small.

Use a web file transfer service to send the resulting file to @meguart_otayori.

Instruction provided in the official Megu Shinonome Website

Note: the English equivalent of the screenshot above is the following:

This instruction contains the all the requirements but many may find it is difficult to start with this instruction. This article will guide you through each process.

This article assumes the following. If you do find any of the following items unclear, it is advised to find some videos or other materials covering these topics. (or you will find yourself lost in the process…)

  • General information of how to use Blender (installing, starting, reading writing, using exporters, etc.)
  • Basic modeling process. You will need to know how to transform, connect the faces. Of course, if you are to actually create something, you would need some more skills in addition to it.
  • Using UV textures. How to use the UV editor, unwrapping mesh. There will not be any advanced usage, so you just need to know the basics of it.
  • We assume that you know how to use your operating system, including installing application, how to use ZIP file, etc.

Prerequisite Items

You will need the following. You can get them for free:

  • Blender (You can technically use anything that can export an Wavefront OBJ, but these are not covered under this article.) We will be using Blender 2.90.1.
  • Krita (or some other 2D image editor. You can use the one that comes with Windows, for instance. You just need to be able to export your file to PNG format. We are not covering how to use aspect of this tool; use something you prefer.)

In addition to that, the following tool made by Makimaki is useful in confirming the correctness and scale of your model.

While Blender supports multiple platform, while the makiMeguAcce supports Windows. Because of this it is advisable to work on Windows platform. Even if you are working on other platforms, I would strongly recommend confirming your model using this tool on a machine running Windows.

Let’s Create

Environment Setup

You are subjected to some restriction on the parameters when creating a model for Megu. For example, you will have to keep yourself conscious about polygon counts while working on your model. It is useful to have this information up on your screen all the time. (This is implemented in 2.90 and onward.)

To enable this, enable Statistics from Viewport Overlays:

Statistics option

With this enabled, you will see a display like the following:

Statistics information displayed

By selecting a object, or going into edit mode, you will be seeing information about the particular object. It is useful in controlling your polygon count while you are working on your model.

Start Modeling

From here you can start modeling. You will need to remember some important restriction in modeling. That is, one object, and one texture. Therefore, it is often easiest by creating a model using low polygon counts, while connecting them together.

The model I have created, used this method, using mirror modifier:

A Takuwan-man Headset

You can also attempt to work it downward from high resolution model, using Decimate modifier, especially when you already have a model you want to use. They tend to introduce unpredictable artifacts, thus, you may have to perform some trial-and-error processes.

You will need make sure to not introduce any N-gons — always use three or four vertices in your faces.

You also cannot use vertex color, nor can you specify multiple materials. Therefore, you will have to apply an UV texture within one material. Because of this, you will have to organize faces of different colors and textures, it is useful to use Vertex Groups.

Vertex Groups

You can define a vertex group by selecting vertices and press the Assign button.

You can use the Select and Deselect button to select and unselect defined vertex groups.

General process is to create a texture atlas like below, and then assigning region for each of vertex groups as you have defined. This would be, selecting the appropriate region, unwrap it under the UV editor tool, assign the desired portion of the UV texture. Therefore, you will still have to create and define simple color as a texture.

Texture Atlas

You can use up to 4096×4096 texture.

Define this texture as the Base Color under the material:

Texture defined as the Base Color

There is a shadow color texture within the official specification, which it used to be able to assign texture to AO map in Blender, however this is no longer possible. (Inspecting the exporter code, this is always assigned “None” value, thus this seems to be deprecated.)

If you really need ot use a shadow color texture, you will have to bake this into your color texture.

Checking the Normal

It is important to ensure that your model has the normals that pointing the correct direction. Basically, this needs to be pointing toward out side of your model.

To confirm, use the following option:

Normals display option

You should see the display like the following:

The Normals, as correctly shown

These blue lines show the direction of the normals. If these are pointing to wrong direction, this would be more like following. (You can see the line pointing inward.)

The normals, pointing the wrong direction

If the normal is pointing to the wrong direction, they won’t be displayed. (Checking this with the MakiMeguAcce tool is discussed later, too.)

To ensure you have the normals pointing to the correct direction, use Recalculate Outside function, which will point the normal toward outward from your model. (Or you can also use Shift-N key.)

Recalculating Outside function

If you have part of the models showing the normals in wrong direction, you can select it and use the Flip function from the same menu to switch it.

Exporting your model as an OBJ file

Use the exporter in Blender to export your model as an Wavefront OBJ file.

Export menu

By selecting this function, you will see some export options:

Wavefront OBJ output options

You will need to make sure OBJ Objects and Material Groups enabled under this. Also specify the Scale to 100. (You can optionally adjust this scaling your model. For more information about this, please see the next session covering makiMeguAcce.)

Once you have set your export options, you can save this as a preset; makes it easy when you will be using these setting later.

After exporting, you should be a OBJ file and a MTL file. Be sure to place your texture file in the same place as you have exported.

Checking with the makiMeguAcce

Once your model is ready and exported in a OBJ file, you can check your model using makiMeguAcce. This innovative tool, created by Makimaki, removes a lot of trial and error, which makes the process more predictable.

You can display the size and texture of your model.

Just drag and drop your object file, and you will see your model displayed like the following (in the example below, “Show Megu” option is enabled.)

The makiMeguAcce showing the model

Using this, you can confirm your model is showing correctly, as well as the size is appropriate.

Statistics display

Like under Blender, this tool will also show numerical parameters of the model. With this tool, any out of parameter items are shown in red.

An example of the out of parameter

If your model has a dark texture that’s unnatural, it is likely you have the normals pointing at wrong direction. (Just like the left side of the following.) You will need to resolve it.

A model with the normals pointing at the wrong direction.

Submitting

Once you have your OBJ, MTL, and texture file ready, put those files in a folder name starting with OBJ_ followed by your object name, compress it as a ZIP file, and use web file transfer service and notify @meguart_otayori via Twitter. You should get notification once your file is successfully downloaded.

That OBJ_ of the folder name should be uppercase or it won’t be loaded. Be sure to name this correctly.

Also, you will have to use Japanese to communicate @meguart_otayori. See below for more information on this.

Conclusion

It is definitely interesting experience that Megu wears and play with your models, and I like to see more people experience that joy.

Please reach @hideki on Twitter, or megu3d-support@hidekisaito.com if you have any questions about the files to submit. Due to resource constraints, please do not forward me basic questions like how to model.

As far as my time allows, I would be happy to offer linguistic assistance in submitting your models. Please reach out to @hideki directly first, and do not include me in your conversation with @meguart_otayori without notifying me first. This will confuse both @meguart_otayori and myself.

Happy modeling!

Categories
Megu Shinonome

Two Weeks Adventure – A Story of Megu Shinonome

Introduction

If you have been following my twitter feed, you may have notice big changes in last two weeks; specifically, explosion of the posts including #東雲めぐ (Megu Shinonome) — I’m sorry if this has caused awkwardness with you.

Megu Shinonome, often referred as “Megu-chan” “Me-chan” and among others, but for the purpose of clarity, I will refer her as “Megu” in this article. I personally call her “Megu-chan” when I refer to her.

I like to talk about how things are, starting from actually describing who is Megu.

Simply put, she is a Vtuber, or “Virtual YouTuber” as some may put it (although as I will be revealing later, she is definitely more than this) and she has started her activity on March of 2018.

General activities, some are more Vtuber-type, including periodic live casting from (7:30 on weekdays, and 19:00 on Sunday JST) on YouTube. Also there seems to be evening live-cast on bilibili as well.

She is also very active in MCing many events, providing contents aimed to children, in addition to being a main actress for a VR musical, and she even creates her own contents.

Honestly, I can only describe her on so much with my relatively short tenure of two weeks as a fan, there’s an excellent article by Ishu-san, although it is in Japanese.

This article focuses more of my subjective view on why I was attracted to Megu, and become her fan (which referred as Meguroomer among Megu and her fans) in this time frame.

Meeting Megu

My first counter with Megu was through HoloModels. This is an application and technology to realize 3D model to real world, commonly called as AR, or Augmented Reality.

More simply put, this is a technology that can create something like below:

Megu Shinonome (Taken using HoloModels)

First time I used HoloModels was on September 17th, in 2019. This is the day when Senko-san (from the Helpful Fox Senko-san) which the release of model has been announced since the beginning of September. I was looking forward to this.

This model was one of the few that could be purchased from outside of Japan. (I guess there are some more you can do that these days.)

I’ve taken many pictures, from neighborhood to Barcelona, Spain.

Senko-san at Spain (Taken using HoloModels)

Then the big change struck my lifestyle. From the middle of March, because of COVID-19, I was forced to work from home. This caused me to take more routine approach of walking around neighborhood, to make sure I keep my workout level high. Having taking pictures almost everyday, eventually I wanted to try something new.

The answer was to introduce additional character in the picture, to generate more “conversational” photo. HoloModels application itself is is provided free of charge, and it actually included a free model, and that’s Megu.

The first tweet featuring Megu.
Megu and Senko-san (Taken using HoloModels)

I have known about the inclusion of this model, just didn’t take much of the notice. Maybe I took her out of the box couple of times.

With Megu in picture, this allowed more interesting expression.

I’m using certain hash tag when I post those pictures. Due to inclusion of Megu, I started using #東雲めぐ (Megu Shinonome) in addition to #仙狐さん (Senko-san) which enabled Megu’s fan, Meguroomer to take notice of my work.

Joining Fan Club

Although, currently no longer possible to join (as it is being consolidated to Gugenka Universe fan club on September 30th) there is a fan club for Megu. By joining, members were provided Megu in a summer uniform, and a model of a karaoke room; I really wanted to use a summer uniform, as it really great for summer time.

I really didn’t have to keep myself as an active paying member once I obtained those bonuses above, but beginning to think it is worthwhile to keep my membership active until September 30th. This was around July 25th, I made this decision.

Membership card of the fan club

First Fan Letter Post to Actually Talking to Megu

There is a framework in place where you assign a certain hash tag to the post, and then it is revealed at the next evening live-casting, with Megu’s comments.

I’ve posted one using HoloModels, which was received very well.

Then on that weekend, I’ve watched a VR musical which features her as a main cast.

As a event in MIKU LAND GATE β, I’ve met up with her at the Zoom guided tour — I could actually talk with her!

I went through very densely packed experience in last two weeks.

Why Megu’s Great

Fully Expressive Appearance

Megu’s live-cast features 3D model (although she has started using her 2D version, starting from 40000 subscriber celebration on August 15th), this 3D model is very expressive, and simply put, is very cute.

Something set her apart from the competition is, by using HoloModels, you can actually take her home. With this, you can feel her presence across the boundary of a screen.

Megu’s Interaction with Her Fans

Megu takes her fan very seriously. I can only imagine how hard she has to work to do this, but she replies to her fans on Twitter. Also when some name gets mentioned in her live-cast, she remembers individual details about that person. Fans would feel very happy to see the person actually remember them by their name. She does this very naturally.

Live-casting

You can check out some of her past live-casting in the archive. What you notice is that you won’t see something edgy. Sometimes she sings, sometimes she plays ad-lib “Takuwan-man” (the Pickled Radish Man) but other than that’s it is really chatting random things. This is like us vising friend’s house and talk about whatever fun, it’s really nice atmosphere.

In contrary, this means she doesn’t have to do anything flashy to attract people. It feels right at home, that’s Megu’s live-casting.

To be a Fan

Honestly, I haven’t had so much of experience being a “fan” of someone to this extent — personally, I distanced myself for that, so I would call Megu being first case.

A lot of time, fandom (particularly “idol” figures) are referred as “pseudo romanticism” — but in case of Megu, I feel this is very different. It’s more “love” in straightforward sense.

Love, is the expression Megu often use in her live-cast; she often expresses that she love certain things, being that the fan submission she receives. She doesn’t try to conceal her feeling with some alternatives, showing her true nature.

Being a Meguroomer Abroad

Being Meguroomer in the United States is actually fairly difficult. Mainly, it is time difference. Evening live-cast falls into 3AM in the morning in PDT. (2AM in standard time.)

The Musical Show was from 20:00JST, which translated to 4AM in the morning.

Having said that, while this is probably applicable to following other Vtubers, as long as this time difference isn’t an issue, I can experience just as much as I would living in Japan, and that makes me happy.

Conclusion

This is a very disorganized article, but lastly, I like to express that Megu Shinonome is someone I would recommend to check out for everyone. She’s very consistent, and also appropriate for everyone. (Gugenka, a management company enforces very strict policy to their talents.)

As I write this, I’m surpassing my third week as Meguroomer. You will be able to check out past live-casting at YouTube. I like to welcome everyone to checkout those out.

You will be in Megu’s world in no time!

See you at the live-casting!

Categories
Facebook Social Networking Sociology

Why Facebook Timeline is Not a Great Place for a Debate? (a.k.a. How to not suck on Facebook?)

With recent controversy raising in political field, I don’t go one day without seeing some debates taking place all over the internet.

Recently, I have had occasion to both observe, and getting involved in such incidents. In the process I’ve had to fire at least one person off from my friend list. I don’t know if I will even have chance of reconciliation, with realization of the great divide in the thought process making it unlikely amicable. Looking at few of my friends timeline, I still see fire erupting here and there.

While this article is revolves around how the interaction works in Facebook, the overall theme is equally applicable to all the social network systems. I hope you find the article interesting.

Seriously, personal timelines are not a great place for those debates!

One of your friend writes something controversial, or maybe they are just linking to some article of that nature. You have different take to that. So you are supposed to correct that person, right? Wrong! If you are coming from the standpoint of correcting someone, you are better off just leave it and go on with your day.

Motives? That doesn’t matter

So let’s decipher the reason behind why you are even bothering to correct them. While this is definitely not a comprehensive list, here are some of my observations:

  1. You genuinely feel that the person can be benefited by your corrected view. That you are strongly believe you are correct and you want to make sure others align with you.
  2. You are part of some cause (e.g. religion or political party) that you feel obligated to spread the world view as your cause see.
  3. You want assert yourself over someone. Because you feel you are better than other.

If you are #3, congratulations, you are genuinely nasty human being. Please go away and hide in a cave and please stay there for rest of your life.

There might be number of other reasons. But I won’t go into details, as it actually doesn’t matter at all, because…

Engaging in a debate on someone’s personal timeline is a no-win game

For any posts or comments you make, writing to someone’s personal timeline is like visiting someone’s house, and starting conversation. Therefore, depending on your relationship with said person, certain level of courtesy is expected. And even if you think you know the person, you may have to exercise extra precautions especially if you are trying to cross someone’s boundary.

Now, why I say that engaging in a debate on someone’s personal timeline is a no-win game? Because no matter how it turns out, you will become, eh, an asshole. I have deliberately used this strong word, because this is very appropriate representation for severity of infringement to one’s personal space. (Please do note however, that I am using this term to figuratively represents how equivalent their action can be described as, and definitely not meant to call any particular person this way.)

No matter how subtle you come into someone’s timeline to start making your point, you will become an asshole regardless.

You are essentially kicking the door open to someone’s house and telling them how to cook, do their laundry, and make their bed. Not a lot of people will find that pleasing, if not developing hates of lifetime against you.

You are not even correct!

And you know what? You are not even correct. Things are controversial for reasons. You may be standing on completely different ground. You are rude and inconsiderate if you are advocating your personal view as if it is their view.

Your arrogance will only buy you hates. You can’t convince other people to consider your view, unless you are willing to show compassion and actually understand problem as they see. You are not that important.

Don’t even come into discussion with assumption that you are correct, because you are definitely not, no matter how you put it.

Circle of the friends

One dynamic that differs drastically even when I compare Facebook timeline to someone’s house is when you are interacting someone on their Facebook timeline, you are not only dealing with that person, but you are doing that in front of many of the person’s friends. Imagine coming into the party full of people, you kick the door open, and start screaming why you are correct and the person is wrong. That’s simply nasty. You are essentially making the person look bad in front of others. They will have no choice but to take more drastic measure to shut you out completely, to protect integrity with their friends.

If you don’t have something nice to say then don’t say anything at all

You probably have heard this numerous time since your childhood. This, is the essence of how you should approach someone’s timeline. It is not your obligation to contribute your opinion to someone’s timeline. They probably don’t even want you there. So simply, just ignore, and mute. If you seriously can’t stand what they are posting, unfriend or block.

It’s actually safe to assume most people post items on their Facebook timeline to exchange information with people who are aligned with their position, and most of time, your opposing view is not welcomed anyways unless you are presenting them in extremely sensitive manner, and that’s very hard.

Don’t bother pushing your argument when you are not welcomed. Doing so will automatically make you a bad person. It doesn’t matter how valid you think your arguments are, more you keep trying, you will be breaking into the boundary of harassment, and that’s not cool. After all, you can’t change the world. Move on.

You are better off discussing your view with other friends of yours who share more similar view. Or maybe, try more public place like news media’s timeline.

There are of course, some conversations, particularly technical in nature, that tend to have more relaxed atmosphere that’s appropriate for open debate, but then that’s rarely controversial to begin with. (But interact with courtesy, and do note there are some pitfalls!)

Conclusion

Facebook and other social media systems enabled us to connect with many people close than ever. They have given me to meet a lot of great people as well as reconnecting with old friends otherwise impossible. At same time, sometimes we tend to forget there’s actual human being behind the screen. Your one keystroke, and one click can provide huge impact, for the good of society, as much as it can for exact opposite. Let’s work together to not be a part of the problem. Let’s try to not be an asshole.

Categories
PowerShell Programming Python Technology

SING4DATASCIENCE/HSSingLog Process Summary

Overall Process

SING4DATASCIENCE/HSSingLog session contains number of processes.

  1. Generation of the playlist
  2. Sing session
  3. Result tabulation
  4. Metadata tabulation
  5. Result posting

This article covers processes and the tools used for the process.

Generation of the playlist

Playlist generation for the sing session is automated, and has following features.

  • Automatic lottery selection system
  • Fixed song system (currently applies to the 3 songs.)

Automatic lottery selection system uses the number of past entries and elapsed time since last session as the weighting element to simulate lottery for the songs to be included in a playlist. With this weighting, the system select songs with fewer number of sessions, and ones with longer time elapsed since last session.

This is implemented using PowerShell, with lottery logic as a binary, lottery process as a script. (Using PowerShell 7.)

Typical execution of the automatic lottery selection system

Sing session

After generation of the playlist is complete, the system generates singing directive sheet. This sheet contains order of songs to be sung, and also shows currently available metadata for these songs.

Singing directive sheet

Result tabulation

Once the singing session is complete, the results are tabulated. From the singing directive sheet, Title ID column is extracted, and is tabulated using tabulation sheet.

Tabulation sheet

Once this tabulation process is complete, using the Get-HSLCompiledFile cmdlet, verifications (to make sure scoring doesn’t have any irregularites) and combine the title information, which generates the results posted on GitHub.

Typical execution of the Get-HSLCompiledFile cmdlet

Metadata tabulation

When the song is missing metadata (either this is a new song, or ones that metadata is not yet filled in), these are entered into the singing directive sheet, and then the Update-HSLCsvData cmdlet is used to update. This cmdlet updates 3 metadata CSV files. (These 3 metadata files are authors, release date, and tempo.)

Typical execution of Update-HSLCsvData cmdlet

Result posting

For the posting data, a Python script is used. Chiefly, these scripts contains the following 2 functions. (These uses pandas, and Matplotlib.)

  • Generation of the text for the posts
  • Generation of the graph element for the posts
Typical execution of the result posting generation
Categories
Reviews

A Brief First Look at Amazing Marvin

What is Marvin?

Marvin, or also referred as Amazing Marvin, is a personal todo application, often known as task management software. Compared to some of other solutions, this is relatively less known, but flexibility it provides is amazing.

There are clients for Windows, Mac, and Linux available however you will be able to navigate to web app and get identical functionalities.

There are native application for Android and iOS as well.

What is a task management software?

Simply put, a task management software is a software that allows you to manage your tasks and activities. These are essentially a specialized form of a todo list, providing additonal feature like reminders.

Why do you need a task management software?

Everyone has a different way of handling their tasks. Some prefers just jotting them down on a piece of paper. A task management software shines when requirements exceeds those practical with a simple todo list on a piece of paper.

  • You want manage mixture of tasks that have different scope and deadlines. (e.g. short term goals, long term goals, etc.)
  • Your tasks have complex chronological context. These are things like start day, end day, and due date.
  • You are managing multiple project with one or more steakholders, dependencies, and categories.
  • You want to define and collect metrics, such as estimated time, spent time, and progress of the tasks. (Particularly useful if you are a freelancer.)

What’s else are out there?

There are number of services, such as JIRA (which is often used in a corporate environment), Trello, which are more of project management solutions. There are more specialized task management software such as TodoistAsana, and Wunderlist.

How Marvin’s different?

Marvin is a personal task management software. It has network backend so you can sync between devices and access to it through browser, but in fact, it is actually an optional part of the system. You can turn off the synchronization and you can use without uploading your data to Marvin’s backend.

By personal I meant is that it currently lacks multi user context such as task assignment, so if you are after those feature, you may have to look elsewhere. Of course, as a personal level, you can still benefit using Marvin to supplement areas where your existing solution falls short.

Essentially, Marvin excels in the area where what it is meant to be.

Workflow flexibility

A lot of task management software is fairly opinionated. That is, if often forces you to adopt to certain workflow that it thinks the best. In contrast, Marvin decided to make itself adoptable to your workflow.

There are many of workflow presets available for you to select, or you can define your own if you have specific method you want to use.

Workflow Library screen

As a default state, Marvin’s fairly simple at its default form. You can use it as is, but there are more than 50 features you can activate depending on your taste.

These are called strategies, and this let you enables features you like to use, while not cluttering your screen with features you don’t use.

Strategies screen

How do I use it?

I use Marvin to manage most of my personal projects, anything small small errands to bigger projects for planning tasks for Sakura-Con.

I define the task as they arises on the master list. Some of the frequently used items are defined as the recurring task, so they get populated periodically.

Master List

I define most of my tasks with estimates. You will be able to clock in and out to those tasks. At the end you will be able to get a summary of how you have spent your time in different categories.

Tasks screen

Statistics can be visualized.

Statistics visualization

Conclusion

Marvin is a very powerful tool, with wealth of features. While there are still rough edges, I find it very functional system. According their roadmap, new features and improvements are actively developed.

As of the writing, their pricing is $12/month at monthly, $8/monthly if paid annually or $300 lifetime. But they offer 30-day free trial, and AppSumo offers one year free account.

If you are looking for task management solution, I strongly recommend giving Marvin a try.

Categories
PowerShell Python Technology

Using Anaconda from PowerShell

After installing Anaconda, you can invoke conda init to initialize settings for PowerShell, including PowerShell Core. There is the problem of this approach as Anaconda is initialized every time PowerShell is launched. This is OK if you are using Python every time you launch PowerShell, however, with my case, it is often the case that I use PowerShell and no Python. This is inefficient.

I’ve decided to create a Cmdlet called Initialize-Conda. Here’s the content. You can replace C:/Path/to/Conda to your Anaconda location to adopt this to your use. (Available for Windows and Linux in Gist.)

function Initialize-Conda
{
	$CONDA_ROOT_DIR = "C:/Path/to/Conda" # Change this
        [System.Environment]::SetEnvironmentVariable("CONDA_EXE", "$CONDA_ROOT_DIR/Scripts/conda.exe", [System.EnvironmentVariableTarget]::Process)
	[System.Environment]::SetEnvironmentVariable("_CE_M", "", [System.EnvironmentVariableTarget]::Process)
	[System.Environment]::SetEnvironmentVariable("_CE_CONDA", "", [System.EnvironmentVariableTarget]::Process)
    [System.Environment]::SetEnvironmentVariable("_CONDA_ROOT", "$CONDA_ROOT_DIR", [System.EnvironmentVariableTarget]::Process)
        [System.Environment]::SetEnvironmentVariable("_CONDA_EXE", "$CONDA_ROOT_DIR/Scripts/conda.exe", [System.EnvironmentVariableTarget]::Process)

        Import-Module -Scope Global "$Env:_CONDA_ROOT/shell/condabin/Conda.psm1"
        conda activate base
}

Environment variable initialization appears bit long — this is because scope of the variable does not get passed outside of the script scope. Therefore, I had to use .NET’s SetEnvironmentVarible to initialize environmental variable for the scope of the process. (Under Linux, CONDA_EXE and _CONDA_EXE should be changed to $CONDA_ROOT_DIR/bin/conda)

It is also possible to use Add-CondaEnvironmentToPrompt to prefix the prompt with the current Conda environment. I’ve omitted this as I found this to be unreliable.

Here’s the corresponding PSD1 file. (Available from Gist.)

@{
    RootModule = 'Conda.psm1'
    ModuleVersion = '1.0.0.0'
    FunctionsToExport = @(
            'Initialize-Conda'
        )
    CmdletsToExport   = '*'
    VariablesToExport = '*'
    AliasesToExport   = '*'
    GUID = '23421dee-ca6f-4847-9c93-1268c629964a'
    Author = 'Hideki Saito'
    Description = 'Anaconda Initializer'
    PowerShellVersion = '6.0'
    CompatiblePSEditions = 'Core'
    Copyright = '(c) 2019 Hideki Saito. All rights reserved.'
    PrivateData = @{
        PSData = @{
            ProjectUri = ''
            ReleaseNotes = ''
        }
    }
}

Take these two files, Conda.psm1, and Conda.psd1, and place them under Documents\PowerShell\Modules\Conda (Under Linux, it’s ~/.local/share/powershell/Modules/Conda) and then you should be able to launch Initialize-Conda.

Categories
PowerShell Programming Technology

PowerShell Core + Event Management

I have been staffing at Sakura-Con Guest Relations since 2002, and throughout years, I have been experimenting with numerous technologies to support event planning. Previously, I have used Org-mode, some small Python scripts, and this year, I have been constructing the system using PowerShell Core. I have been using PowerShell to various applications, like tabulating Karaoke data, I wanted to expand the use cases for this area as well.

Motivations

My goal for this year to build a centralize solution to:

  • Provide the automated way of tabulating event schedule data and create a data set that I can work with.
  • Provide conversion from the event schedule data to other useful data type, such as calendar format.

The reason I have picked PowerShell Core is:

  • I wanted the solution that works across multiple platforms. I use Linux and Windows. Big plus if it runs on Android. What makes this great is that PowerShell Core can run on Android environment through app like UserLAnd. (If you are doing this on Android, the keyboard such as this one helps a lot.)
  • I wanted something that I can use offline. During the event, internet connection may be degraded to the point it’s unusable.

Components and Setup

First module I have created, is a data fetcher to retrieve schedule data from the scheduling system. The scheduling system, unfortunately lacked API that allowed me to retrieve the data from the system, and I used Selenium to retrieve the data.

Retrieving data using Selenium (Scheduling solution name is obscured due to the confidentiality reasons.)

Obtaining data through Selenium would take about 30 seconds — there are about 800 entries. (though, I regularly interact about 1/8 of it.) The Selenium module navigates to the appropriate calendar ranges through UI, and grabs the result out from the DOM. This is coded in C#. Since Selenium provides driver for both Linux and Windows, same module works works cross-platform as well. (Probably not on Android, but if there’s a driver for Android, this potentially can be done on Android as well.)

The system exposes the following data, and is exported as array:

   TypeName: SakuraCon.Relations.Data.Event
Name        MemberType     Definition
----        ----------     ----------
End Time    AliasProperty  End Time = EndTime
Event Title AliasProperty  Event Title = EventTitle
Start Time  AliasProperty  Start Time = StartTime
Equals      Method         bool Equals(System.Object obj)
GetHashCode Method         int GetHashCode()
GetType     Method         type GetType()
ToString    Method         string ToString()
EndTime     Property       datetime EndTime {get;set;}
EventId     Property       string EventId {get;set;}
EventTitle  Property       string EventTitle {get;set;}
Notes       Property       string Notes {get;set;}
Rating      Property       string Rating {get;set;}
StartTime   Property       datetime StartTime {get;set;}
Type        Property       string Type {get;set;}
Venue       Property       string Venue {get;set;}
Duration    ScriptProperty System.Object Duration {get=($this.EndTime - $this.StartTime);}

This is coupled with the simple ps1xml:

<Types>
    <Type>
        <Name>SakuraCon.Relations.Data.Event</Name>
        <Members>
            <MemberSet>
                <Name>PSStandardMembers</Name>
                <Members>
                    <PropertySet>
                        <Name>DefaultDisplayPropertySet</Name>
                        <ReferencedProperties>
                            <Name>Event Title</Name>
                            <Name>Venue</Name>
                            <Name>Type</Name>
                            <Name>Start Time</Name>
                            <Name>End Time</Name>
                            <Name>Duration</Name>
                            <Name>Notes</Name>
                        </ReferencedProperties>
                    </PropertySet>
                </Members>
            </MemberSet>
            <AliasProperty>
                <Name>Event Title</Name>
                <ReferencedMemberName>EventTitle</ReferencedMemberName>
            </AliasProperty>
            <AliasProperty>
                <Name>Start Time</Name>
                <ReferencedMemberName>StartTime</ReferencedMemberName>
            </AliasProperty>
            <AliasProperty>
                <Name>End Time</Name>
                <ReferencedMemberName>EndTime</ReferencedMemberName>
            </AliasProperty>
            <ScriptProperty>
                <Name>Duration</Name>
                <GetScriptBlock>($this.EndTime - $this.StartTime)</GetScriptBlock>
            </ScriptProperty>
        </Members>
    </Type>
</Types>

Usually, I export this data into clixml — this way, I can retrieve the contents later as needed. PowerShell provides the convenient cmdlet to do this.

$schedule | Export-Clixml schedule.xml

Importing this is easy:

$schedule = Import-Clixml schedule.xml

This would allow offline access to the data offline, as exported XML is essentially the snapshot of obtained data.

From this, I can easier export this as CSV (used for tabulating schedule information) and as a iCalendar format that can be imported into Google Calendar.

Something I like about this data structure is that I can use Where-Object to retrieve desired information. If I want all the event that happens in the room 6C, I would query:

$schedule | ?{ $_.Venue -eq "6C" }

I’ve combined this with the following script:

function Get-ScNextEvent {
    param(
        [parameter(Mandatory = $true, ValueFromPipeline = $true)]
        $Schedule,
        [parameter(Mandatory = $false)]
        [uint] $Hour = 1
    )
    $result = $Schedule | Where-Object { ($_.StartTime -ge [DateTime]::Now) -and ($_.EndTime -le [DateTime]::Now.AddHours($Hour))}

    return ($result | Sort-Object StartTime)
}

function Get-ScCurrentEvent {
    param(
        [parameter(Mandatory = $true, ValueFromPipeline = $true)]
        $Schedule
    )
    $result = $Schedule | Where-Object { ($_.StartTime -ge [DateTime]::Now) -and ($_.EndTime -le [DateTime]::Now)}

    return ($result | Sort-Object StartTime)
}

This will retrieve the data about the next and current event that taking place.

Other PowerShell Core Applications

Schedule is not only place I have utilized PowerShell Core. Another area I use PowerShell Core is in area of generating form letters. Since I have the letter source as LaTeX source, this is matter of passing the personalized arguments through parameters. Since PowerShell contains the functionality to convert a CSV into data structure, the list of the names are populated as CSV.

function process {
    param(
        [Parameter(position = 0, mandatory = $true)]
        $Name,
        [Parameter(position = 1, mandatory = $true)]
        $Identifier
        )
    $OutputEncoding = [System.Text.Encoding]::GetEncoding('shift_jis')
    $docGuid =  [guid]::NewGuid().ToString()

    uplatex -kanji=utf8 --no-guestt-input-enc -jobname="Welcome_$Identifier" "\newcommand\scguestname{$Name}\input{2019_welcome.tex}"
    dvipdfmx "Welcome_$Identifier"

    Remove-Item @("Welcome_${Identifier}.aux", "Welcome_${Identifier}.log", "Welcome_${Identifier}.out", "Welcome_${Identifier}.dvi") -ErrorAction SilentlyContinue
    $OutputEncoding = New-Object System.Text.ASCIIEncoding
}

$names = Import-Csv welcome.csv

foreach($item in $names)
{
    $currentloc = (Get-Location).Path
    $identifier = $item.Name -replace " ","_"
    Write-Host "$identifier"
    $fileExist = Test-Path (Join-Path -Path $currentloc -ChildPath "Welcome_${identifier}.pdf")
    Pop-Location
    if($fileExist -eq $False)
    {
        process -Identifier $identifier -Name $item.JapaneseName
    }
    else {
        Write-Host -BackgroundColor Red "File exists, please delete a PDF file if you really need update this file."
    }

Because of the way the command line arguments passed, this is the area where I had struggle running this under Windows (because of the way the frontend handles character encoding) and had to use Windows Subsystem for Linux (WSL) to generate Japanese letters; but since PowerShell Core is available both for Linux and Windows, same components and scripts are used unmodified.

This will take about 30 seconds to generate 20 letters.

Conclusion

PowerShell Core provided, cross-platform and consistent environment to support data wrangling within limited area of relations tasks I was handling.

I am planning to improve the system to support schedule conflict, workload verification as well as staffing.

Categories
Blender

Something like those anime bonus material

Those “3D progress” showing just like you’d find in some bonus materials for anime…

Categories
Blender

Angela Balzac (Packet Spoofed Mode) from Rakuen Tsuihou

Rendered in Blender with Cycles with the Principled Shader.

Categories
Software Technology

Should we give Firefox another chance?

While the Mozilla Firefox vs. Google Chrome seems to be a topic that comes up once in a while, while the recently, it is dwarfed by close to 60% of the market share by Chrome.  Recently there was an article called It’s time to give Firefox another chance.

The article emphasizes that the next version of Firefox Quantum will be the major release for Firefox.

I have been using Chrome as my primary web browser for a long time, while before, I have been using Firefox. But recently, I am finding I am using more Firefox more often.

From few different perspective, here are my thought on this topic. With this article, I am not making assertion that the one browser is better than others, but to get the foundation out so it can be compared time to time.

Platform Support

Chrome and Firefox both supports Windows, Linux, and Mac. Thus they are on par with this perspective.

Feature Comparisons

Browser Sync

Chrome supports syncing via Google Sync, and Firefox via Firefox Account. They offer similar functionality. Both Chrome and Firefox offer encrypted sync. Perhaps Firefox’s sync feature is a little more comprehensive as it supports history syncing while Chrome seems to be limited in this regard.

Security

Both Chrome and Firefox are discovered with good number of security issues. (and it is important they are addressed in timely manners, too!) Discussing these can be article of its own, so I am focusing here regarding the security feature.

Chrome has been supporting sandboxing and most recent version of Firefox is supporting it as well. From more robust multi process design with Chrome (more of that in later) perhaps in this area, Chrome has bit of edge compared to Firefox.

One thing I like about Firefox that lacks on Chrome is the support of master password, which you can lock password store with the master password.

Also Firefox has a useful extension called Firefox Multi-Account Containers, which can isolate session cookies, which makes it easier to confine certain sites (like Facebook) to reduce tracking.

Chrome has recently moved toward hiding security information from the browser interface, perhaps to make it more user friendly. One illustration of this problem is that they are making jump through some hoops to be able to look up certificate information. (Through developer tools.) While this can be turned back on through experimental features, it is bit concerning they are hiding this information for the sake of user friendliness; if that’s the reason.

Operating System Integration

Chrome uses operating system’s own certificate management where available, which makes it easy to integrate in environment where internal certificate (while this is not a best practice, but it happens!) or internal Active Directory authentications are used.

Firefox, in contrast, uses Network Security Service, which basically is a security storage independent of the system. This makes the system less integrated with the one configured through the system. While configuring Active Directory authentication for Firefox is certainly possible, it is not a simple one-click process.

With this regard, Chrome seems to integrate a little better with the operating system.

Google Service Integration

This is somewhat silly notion when Chrome is designed by Google who owns those Google services. One of the major blocking factor is if there’s Chromecast involved, as at least from the desktop, there is no practical way to control it outside of Chrome.

Other than that, aside from some services that heavily expect Chrome to be used, most of Google Service should work on both of those browsers.

Mobile Versions

With extensions support, it appears Firefox for Android, also known as Fennec feels like a mobile port of the desktop version rather than the scaled down version, which is the way every time I use Chrome I can’t help notice.

Internal Designs

Chrome is designed from the ground up with multi-process utilization in mind, which this development was relatively recent with Firefox. While they work similar, with this regard, perhaps Chrome has a slight advantage of this in stability. Multi process support for Firefox, called Electrolysis can be disengaged for having incompatible feature sets (like accessibility) or extensions. This problem usually comes from the older type of extensions, and perhaps will soon go away when Firefox 57 only supports WebExtension.

Other Features I Love

Firefox features a reader mode. This mode is very useful when reading long article as it removes a lot of clutter off the document. (Also supported on a mobile version as well!)