Archive

Posts Tagged ‘HowTo’

HowTo: Download and install Windows Live Movie Maker

Unfortunately, Microsoft seems to have gone to extra lenghts to make the Windows Live suite of software go away, without anyone thinking that there were people who were using them and without offering file/project-level compatible replacements for user-friendly tools like Windows Live Movie Maker.

Only Windows Live Writer was at some point reincarnated as the Open Live Writer opensource software at http://openlivewriter.org/. Hope Microsoft will do the same at some point (some community pressure and offer for opensource work on it would help of course) with Windows Live Movie Maker at least. I’ve seen that one used by educators since it’s very user friendly. It is a pitty to force them to throw away their older student projects when they get a new machine (I’m not aware of any video editing tool that can import Windows Live Movie Maker’s XML-based project file [.wlmp]).

Luckily, people have managed to locate the latest archived versions of the offline software installers (obviously the web installers won’t work anymore) for various languages (need to pick the same language as the one your OS UI is displaying in) at the Internet Wayback Machine (arthive.org) website.

Copy-pasting the links (they point to archived versions at archive.org) for the latest version released (build 16.4.3528.0331, April 17, 2014) below (in case Microsoft decides to make that discussion thread disappear too in the future) from:

https://answers.microsoft.com/en-us/windowslive/forum/moviemaker-wlinstall/what-to-do-before-movie-maker-goes-away-jan-10/8b3a5345-7840-4a2c-922a-cf24d10771f7?page=2&msgId=7fbd8015-d7af-44ed-b81d-0d73e8abac45

as posted by the user “considerate_guy

updated links to the Archive.org copies of the *latest* versions (build 16.4.3528.0331)

Advertisements

HowTo: Install Skype desktop on Windows 10 (for older webcams)

On Windows 10, Microsoft (they’ve acquired Skype some years ago) provide a Windows Store app for Skype, however Universal Windows Platform (UWP) apps like that one don’t support older webcams (even the ones embedded in not-that-old laptops).

Unfortunately, Microsoft hasn’t bothered to provide some frame grabber driver to bridge with DirectShow-based etc. older webcams that would allow modern UWP apps to work with such older webcams that do function fine with classic (Win32) applications, provided their classic Windows drivers are installed.

What’s worse though is that although Skype provides a Windows desktop application download at their website (https://www.skype.com/en/get-skype/), when that one is launched on Windows 10 (probably that is the can on Windows 8 too), it just shows a message that one should use the respective Store app and takes one to the respective Windows Store webpage. They haven’t bothered to consider all those users that don’t have a supported webcam on UWP and force them to move to the Skype UWP-based Store app. Note that they could have placed the classic (Win32) Skype application on the Windows Store too (which now supports deployment of such applications via a technology called Desktop Bridge), but I don’t think they’ve considered providing that option to the user either.

So a workarround I had to do on my laptop was to trick their desktop application installer into thinking it was running on Windows 7. To achieve this can right click the .exe file of the installer and select “Properties” (should be the last option at the popup menu shown).

Στιγμιότυπο οθόνης (1992)

Then, from the “Compatibility” tab select to run in compatibility mode for “Windows 7”. Press OK to close the dialog and just run the installer again, this time it will proceed fine to install the desktop application for Skype which should work with your older webcam, provided you’ve installed the camera drivers at your system. If it still doesn’t work, checkout the webcam diagnostics tool from http://noeld.com/programs.asp?cat=video (and also try webcam with the classic Win32 AMCap application provided there to see if it does show a video feed or not).

image

HowTo: open older Pi SD card via USB multi-reader on Raspberry Pi

After doing

sudo apt-get update

sudo apt-get upgrade

on an older Raspbian installation (at a 4GB SD Card), some corruption occured (probably due to lack of space, since I see newer NOOBS asks for an 8GB SD Card), making it unbootable. Would only show the NOOBS splash screen, but couldn’t boot into Raspbian.

I just needed some audio files from the desktop of that older installation (it was an unattended looping audio player for an art installation).

So I prepared a new SD Card with the free SD Card Formatter utility and put the latest NOOBS files in it. Booted the Raspberry Pi 2 with it and installed the latest Raspbian OS (full) from the menus. This time doing again the above two commands from a terminal and rebooting didn’t cause any problem.

However, I was searching for the files and couldn’t find them. I had gotten a bit confused at first, since when plugging in the reader it would show a dialog asking whether I wanted to open a file explorer, but then it would keep that dialog again and repeat the action till I closed the dialog. Then I read

…in Linux when there are more slots in a card reader, only the one labelled LUN 0 is read unless other tools are installed to read the other luns. If your SD slot is not LUN 0, then the SD card will not be seen.There are a lot of pages on web about this, I will be installing a package called sg3-utils that is supposed to enable reading other card reader slots.

at this thread https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=11397 and just in case I did:

sudo apt-get install sg3-utils

from a terminal and then tried plugging in again the USB card reader with the older SD card.

This time I was patient and instead of closing the action dialog that was shown after executing the suggested action (open with file explorer), I repeated it for three times and respective file explorer windows came up, then the action dialog closed by itself. The three windows were showing different partitions that had been found in the SD card, and one of those windows was showing “/media/pi/” folder. I navigated from there to “root/home/pi/Desktop” subfolder, where I could see the old desktop contents and drag-drop the audio files I was looking for to the new desktop.

HowTo: Hide HTML markup from non-signedin users at MonoX Social CMS

At MonoX Social CMS, which I use at both ClipFlair Social and Trafilm websites, I was in the need of hiding some HTML markup when the user is not signed-in.

The solution for this is to add runat="server" to the HMTL element one wants to hide and then set the Visible property that the object acquires due to the runat clause. The Visible property is set using some special syntax to access the MonoX API like below:

<ul runat="server"
      Visible="<% $Code: Page.User.Identity.IsAuthenticated %>"  >

</ul>

Categories: Posts Tags: , , , , , , ,

HowTo: Copy effective-computed CSS style for specific HTML paragraph

I’m in the process of setting up a temporary landing page for the trafilm project, where I need apart from showing the trafilm logo to also show some text description about the project, till I set up an instance of MonoX Social CMS for it, like the one in ClipFlair’s Community website (ClipFlair Social).

Since ClipFlair Social has some nice text styling, I decided to borrow the style of one of its home page paragraphs, using Firefox web browser’s developer tools (accessible via F12 key).

Being at the Inspector tab of the dev tools (which is the default when they first open), using the “Pick element” tool (first one on the dev tools pane’s toolbar on the left), I select the paragraph that looks nicely styled and I go to the Computed tab at the Style view, then press CTR+A to select all computed style CSS declarations for that paragraph element and press CTRL+C or right click and select Copy to copy them to the clipboard.

Screenshot 2016-01-25 13.41.19

If pasted (CTRL+V) in some text editor like Window’s Notepad that looks like a big ugly line, since they contain Unix-style line-endings, that is LF (linefeed) and not Windows-style ones (CRLF, Carriage Return + Line Feed), but editors like Wordpad or Notepad++ can show them nicely and even convert line endings from Unix to Windows and vice-versa if you wish so (e.g. in Notepad++ the respective actions are at Edit / EOL Conversion menu).

image

So, this is the copied Computed CSS style for that paragraph:

border-bottom-color: #333;
border-bottom-style: none;
border-bottom-width: 0px;
border-image-outset: 0 0 0 0;
border-image-repeat: stretch stretch;
border-image-slice: 100% 100% 100% 100%;
border-image-source: none;
border-image-width: 1 1 1 1;
border-left-color: #333;
border-left-style: none;
border-left-width: 0px;
border-right-color: #333;
border-right-style: none;
border-right-width: 0px;
border-top-color: #333;
border-top-style: none;
border-top-width: 0px;
color: #333;
cursor: default;
font-family: "Open Sans",sans-serif;
font-size: 14px;
font-weight: 400;
letter-spacing: 0px;
line-height: 24px;
margin-bottom: 20px;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
padding-bottom: 10px;
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;

As you can see, it has lots of stuff that isn’t needed, unless you want to be sure your style doesn’t get affected by style of parent elements. In my case I decided to trim it down a bit:

color: #333;
font-family: "Open Sans",sans-serif;
font-size: 14px;
font-weight: 400;
letter-spacing: 0px;
line-height: 24px;
margin-bottom: 20px;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
padding-bottom: 10px;
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;

Adding around the text above (which is represented by the CSS comment /* … */ below) a CSS selector to wrap those declarations in order to make a proper CSS rule-set:

p {

/* … */

}

and passing to CSS LINT tool to help us clean up the CSS we get no errors, but several warnings:

image

For example, as explained at W3Schools.com, in CSS one can use shorthand margin and padding properties:

The margin property is a shorthand property for the following individual margin properties:

  • margin-top
  • margin-right
  • margin-bottom
  • margin-left

CSS has properties for specifying the padding for each side of an element:

  • padding-top
  • padding-right
  • padding-bottom
  • padding-left

…so one wonders why Firefox Dev Tools don’t spit those out with that order and give them in bottom, left, right and top order instead.

Also instead of 0px, one is suggested to always write 0 instead, since zero will always be zero irrespective of the CSS units used for it (at least for the currently available CSS unit systems that is). This is merely to save in bandwidth I think, since 0px is better, suggesting to anyone modifying this value in the future they’d better use “px” [pixels] instead of say “pt” [points]).

So we clean up this CSS into (pay attention to the order of values in margin and padding shorthand declarations, which is top, right, bottom, left, that is clockwise starting from the top side of the HTML elements targeted via the CSS rule selector, which is a paragram – p – in our case):

p {

   color: #333;
  font-family: "Open Sans",sans-serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 24px;
  margin: 0 0 20px 0;
  padding: 0 0 10px 0;

}

Pasting at CSS LINT online tool again we get no warnings anymore (apart from no errors):

image

One might also remove the redundant space chars at the end of each line that Firefox places when copy-pasting the style declarations. Notepad++ can do it via Edit / Blank Operations / Trim Trailing Space menu command:

image

HowTo: show inner exception message if available, else outer one

Sometimes when you catch an exception in .NET, the message it prints out isn’t very informative, since it is wrapping another exception that had been thrown a bit inner in the code. That exception is in that case accessible via InnerException of the Exception instance.

That inner exception is also an Exception, so one would like to use its Message instead of the outer exception’s one, if an inner exception exists and, only if an inner exception doesn’t exist use the caught exception’s message. Here’s a clean-looking pattern I’ve coined up to achieve this while working on the TrackingCam application:

try

{

  //…

}

catch (Exception e)

{

  MessageBox.Show((e.InnerException ?? e).Message);

}

the ?? operator returns e.InnerException if it is not null, else falls back to returning e. Those two results are both of type Exception, so you can use Message on them, by putting the ?? operator’s expression in parentheses.

HowTo: Pause and Resume Speech Recognition with Microsoft engines

At SpeechTurtle application, I’ve just added speech feedback (voicing of a command) when an available command is executed using a mouse click on its name.

That could also help the user learn the expected pronunciation in English in case the speech recognition engine doesn’t understand some of the commands as voiced by the user. One can assume most of what the Speech Synthesis engine outputs to be recognizable by the Speech Recognition engine.

An issue with this approach though, is that the Speech Recognition can be fired accidentally by the speech synthesis commands, if the speech recognition engine doesn’t handle this case automatically, ignoring synthesized speech that is being generated in parallel by the speech engine.

In fact this can also be a security issue, with a malicious agent delivering voice commands to your system via some audio or video file/stream they lure you into listening/watching, or some web page they lure you into visiting (even if a webpage is not malicious, it might have been served and hosting a malicious ad by an ad network).

So, we need some way to pause the speech recognition while speaking, to avoid misfiring of recognition, since from my experience, the speech synthesis and recognition engines from .NET’s System.Speech namespace on recent Windows versions (tried with Windows 10) do have this issue.

In SpeechLib (that SpeechTurtle uses via the SpeechLib NuGet package), I’ve added commands Pause and Resume to the ISpeechRecognition interface (defined in SpeechLib.Models project and respective NuGet package and implemented at SpeechLib.Recognition and SpeechLib.Recognition.KinectV1 projects and NuGet packages).

So, in SpeechTurtle, I can do:

public void SpeakCommand(string command)
{   
  speechRecognition.Pause(); //pause the speech recognizer
  speechSynthesis.Speak(command);   
  speechRecognition.Resume();
}

Note the pattern used in SpeechRecognition.cs to retry 10 times to pause the speech recognition engine, since errors are thrown if one tries to Stop it or Set its audio input to none while it is trying to perform some recognition.

public void Pause()
{   
  for (int i=0; i<10; i++) //(re)try 10 times
  //(since we wait 100 ms at failure below before retrying, max wait is 1000ms=1sec)
    try
    {       
      SetInputToNone();
      return; //exit retry loop if succeeded
    }
  catch //catch and ignore any error saying that recognition is currently running
    {       
      Thread.Sleep(100); //retry in 100ms
    }
}

Update 1:

After more testing, it seems the above approach with the loop and try/catch won’t work

if one uses the async versions of Speech Recognition methods, since the exceptions are thrown from another thread. In that case one need to add a global exception handler.

Update 2:

After lots of trial and error, I ended up with this working pattern for Pause and Resume in SpeechLib’s SpeechRecognition.cs (note that paused is a bool(ean) field of that class, defaulting to false and PAUSE_LOOP_SLEEP is a const(ant) int(eger) set to 10 (msec):

public void Pause()
{   
  paused = true;
  speechRecognitionEngine.RequestRecognizerUpdate();
}
 
public void Resume()
{   
  paused = false;
}

At the constructor of that SpeechRecognition class I do:

  speechRecognitionEngine.RecognizerUpdateReached +=
(s, e) => {
while (paused) Thread
.Sleep(PAUSE_LOOP_SLEEP); };

I do a loop at RecognizerUpdateReached event handler to make sure the Speech Recognition

thread is waiting for the pause field to change value back to false. That event occurs after the call to RequestRecognizerUpdate in Pause method (which is done after first setting paused=true there).

%d bloggers like this: