Skip to main content

Roku Development – hls support

It took me sometime to figure this out, so I am posting this here for all of you stuck in this too!

If you got to this page you are probably trying to create a nice ROKU channel and started with the RokuSDK\examples\zips\

You deploy the app, and you see that it has a nice interface but all the examples in the feeds are mp4 files and not hls. So you figure, ok, I ll take the example code and I will replace “mp4” with “hls” and then on the content, I will replace the mp4 file with my m3u8 stream. Then you try it and you see nothing..

Here is the original piece of code :

  1. <media>
  2. <streamFormat>mp4</streamFormat>
  3. <streamQuality>SD</streamQuality>
  4. <streamBitrate>1500</streamBitrate>
  5. <streamUrl></streamUrl>

Here is the modified piece of code :

  1. <media>
  2. <streamFormat>hls</streamFormat>
  3. <SwitchingStrategy>full-adaptation</SwitchingStrategy>
  4. <streamQuality>HD</streamQuality>
  5. <streamBitrate>500</streamBitrate>
  6. <streamUrl>[email protected]/master.m3u8</streamUrl>
  7. </media>


And here is the solution to your problems! :

On line 165 (or anywhere else really) on the file showFeed.brs you need to add the following code :

  1. If item.StreamFormat="hls"
  2. item.SwitchingStrategy="full-adaptation"
  3. End If


You may download the modified showFeed.brs

NULL Values in Arrays

All PowerShell versions

Whenever you assign NULL values to array elements, they will count as array elements, but will not be output (after all, they are NULL aka nothing). This can lead to tough debugging situations, so when the size of an array does not seem to match the content, look for NULL values:

$a = @()
$a += 1
$a += $null
$a += $null
$a += 2
Count: 4 

Twitter This Tip! ReTweet this Tip!

Posted Dec 01 2014, 06:00 AM by ps1

Randomize Lists of Numbers

All PowerShell versions

This line will take a list of numbers and randomize their order:

Get-Random -InputObject 1, 2, 3, 5, 8, 13 -Count ([int]::MaxValue)

Piping works too, but it's slower:

1, 2, 3, 5, 8, 13 | Sort-Object -Property { Get-Random }

Twitter This Tip! ReTweet this Tip!

Posted Nov 28 2014, 06:00 AM by ps1

Exim Cheatsheet

Exim is the most used linux mailserver. Have you ever got to a situation where you want to mass delete emails, or trace emails and no GUI is available in your server ? Use this cheatsheet to complete your tasks


Basic information

Print a count of the messages in the queue:

[email protected]# exim -bpc

Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient):

[email protected]# exim -bp

Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals):

[email protected]# exim -bp | exiqsumm

Print what Exim is doing right now:

[email protected]# exiwhat

Test how exim will route a given address:

[email protected]# exim -bt [email protected]
[email protected]
    <-- [email protected]
  router = localuser, transport = local_delivery
[email protected]# exim -bt [email protected]
[email protected]
  router = localuser, transport = local_delivery
[email protected]# exim -bt [email protected]
  router = lookuphost, transport = remote_smtp
  host [] MX=0

Run a pretend SMTP transaction from the command line, as if it were coming from the given IP address. This will display Exim’s checks, ACLs, and filters as they are applied. The message will NOT actually be delivered.

[email protected]# exim -bh

Display all of Exim’s configuration settings:

[email protected]# exim -bP

Searching the queue with exiqgrep

Exim includes a utility that is quite nice for grepping through the queue, called exiqgrep. Learn it. Know it. Live it. If you’re not using this, and if you’re not familiar with the various flags it uses, you’re probably doing things the hard way, like piping `exim -bp` into awk, grep, cut, or `wc -l`. Don’t make life harder than it already is.

First, various flags that control what messages are matched. These can be combined to come up with a very particular search.

Use -f to search the queue for messages from a specific sender:

[email protected]# exiqgrep -f [luser]@domain

Use -r to search the queue for messages for a specific recipient/domain:

[email protected]# exiqgrep -r [luser]@domain

Use -o to print messages older than the specified number of seconds. For example, messages older than 1 day:

[email protected]# exiqgrep -o 86400 [...]

Use -y to print messages that are younger than the specified number of seconds. For example, messages less than an hour old:

[email protected]# exiqgrep -y 3600 [...]

Use -s to match the size of a message with a regex. For example, 700-799 bytes:

[email protected]# exiqgrep -s '^7..$' [...]

Use -z to match only frozen messages, or -x to match only unfrozen messages.

There are also a few flags that control the display of the output.

Use -i to print just the message-id as a result of one of the above two searches:

[email protected]# exiqgrep -i [ -r | -f ] ...

Use -c to print a count of messages matching one of the above searches:

[email protected]# exiqgrep -c ...

Print just the message-id of the entire queue:

[email protected]# exiqgrep -i

Managing the queue

The main exim binary (/usr/sbin/exim) is used with various flags to make things happen to messages in the queue. Most of these require one or more message-IDs to be specified in the command line, which is where `exiqgrep -i` as described above really comes in handy.

Start a queue run:

[email protected]# exim -q -v

Start a queue run for just local deliveries:

[email protected]# exim -ql -v

Remove a message from the queue:

[email protected]# exim -Mrm <message-id> [ <message-id> ... ]

Freeze a message:

[email protected]# exim -Mf <message-id> [ <message-id> ... ]

Thaw a message:

[email protected]# exim -Mt <message-id> [ <message-id> ... ]

Deliver a message, whether it’s frozen or not, whether the retry time has been reached or not:

[email protected]# exim -M <message-id> [ <message-id> ... ]

Deliver a message, but only if the retry time has been reached:

[email protected]# exim -Mc <message-id> [ <message-id> ... ]

Force a message to fail and bounce as “cancelled by administrator”:

[email protected]# exim -Mg <message-id> [ <message-id> ... ]

Remove all frozen messages:

[email protected]# exiqgrep -z -i | xargs exim -Mrm

Remove all messages older than five days (86400 * 5 = 432000 seconds):

[email protected]# exiqgrep -o 432000 -i | xargs exim -Mrm

Freeze all queued mail from a given sender:

[email protected]# exiqgrep -i -f [email protected] | xargs exim -Mf

View a message’s headers:

[email protected]# exim -Mvh <message-id>

View a message’s body:

[email protected]# exim -Mvb <message-id>

View a message’s logs:

[email protected]# exim -Mvl <message-id>

Add a recipient to a message:

[email protected]# exim -Mar <message-id> <address> [ <address> ... ]

Edit the sender of a message:

[email protected]# exim -Mes <message-id> <address>

Access control

Exim allows you to apply access control lists at various points of the SMTP transaction by specifying an ACL to use and defining its conditions in exim.conf. You could start with the HELO string.

# Specify the ACL to use after HELO
acl_smtp_helo = check_helo

# Conditions for the check_helo ACL:

    deny message = Gave HELO/EHLO as "friend"
    log_message = HELO/EHLO friend
    condition = ${if eq {$sender_helo_name}{friend} {yes}{no}}

    deny message = Gave HELO/EHLO as our IP address
    log_message = HELO/EHLO our IP address
    condition = ${if eq {$sender_helo_name}{$interface_address} {yes}{no}}


NOTE: Pursue HELO checking at your own peril. The HELO is fairly unimportant in the grand scheme of SMTP these days, so don’t put too much faith in whatever it contains. Some spam might seem to use a telltale HELO string, but you might be surprised at how many legitimate messages start off with a questionable HELO as well. Anyway, it’s just as easy for a spammer to send a proper HELO than it is to send HELO im.a.spammer, so consider yourself lucky if you’re able to stop much spam this way.

Next, you can perform a check on the sender address or remote host. This shows how to do that after the RCPT TO command; if you reject here, as opposed to rejecting after the MAIL FROM, you’ll have better data to log, such as who the message was intended for.

# Specify the ACL to use after RCPT TO
acl_smtp_rcpt = check_recipient

# Conditions for the check_recipient ACL

    # [...]

    drop hosts = /etc/exim_reject_hosts
    drop senders = /etc/exim_reject_senders

    # [ Probably a whole lot more... ]

This example uses two plain text files as blacklists. Add appropriate entries to these files – hostnames/IP addresses to /etc/exim_reject_hosts, addresses to /etc/exim_reject_senders, one entry per line.

It is also possible to perform content scanning using a regex against the body of a message, though obviously this can cause Exim to use more CPU than it otherwise would need to, especially on large messages.

# Specify the ACL to use after DATA
acl_smtp_data = check_message

# Conditions for the check_messages ACL

    deny message = "Sorry, Charlie: $regex_match_string"
    regex = ^Subject:: .*Lower your self-esteem by becoming a sysadmin


Fix SMTP-Auth for Pine

If pine can’t use SMTP authentication on an Exim host and just returns an “unable to authenticate” message without even asking for a password, add the following line to exim.conf:

  begin authenticators

  driver = plaintext
  public_name = PLAIN
  server_condition = "${perl{checkuserpass}{$1}{$2}{$3}}"
  server_set_id = $2
>  server_prompts = :

This was a problem on CPanel Exim builds awhile ago, but they seem to have added this line to their current stock configuration.

Log the subject line

This is one of the most useful configuration tweaks I’ve ever found for Exim. Add this to exim.conf, and you can log the subject lines of messages that pass through your server. This is great for troubleshooting, and for getting a very rough idea of what messages may be spam.

log_selector = +subject

Reducing or increasing what is logged.

Disable identd lookups

Frankly, I don’t think identd has been useful for a long time, if ever. Identd relies on the connecting host to confirm the identity (system UID) of the remote user who owns the process that is making the network connection. This may be of some use in the world of shell accounts and IRC users, but it really has no place on a high-volume SMTP server, where the UID is often simply “mail” or whatever the remote MTA runs as, which is useless to know. It’s overhead, and results in nothing but delays while the identd query is refused or times out. You can stop your Exim server from making these queries by setting the timeout to zero seconds in exim.conf:

rfc1413_query_timeout = 0s

Disable Attachment Blocking

To disable the executable-attachment blocking that many Cpanel servers do by default but don’t provide any controls for on a per-domain basis, add the following block to the beginning of the /etc/antivirus.exim file:

if $header_to: matches "example\.com|example2\.com"

It is probably possible to use a separate file to list these domains, but I haven’t had to do this enough times to warrant setting such a thing up.

Searching the logs with exigrep

The exigrep utility (not to be confused with exiqgrep) is used to search an exim log for a string or pattern. It will print all log entries with the same internal message-id as those that matched the pattern, which is very handy since any message will take up at least three lines in the log. exigrep will search the entire content of a log entry, not just particular fields.

One can search for messages sent from a particular IP address:

[email protected]# exigrep '<= .* \[\] ' /path/to/exim_log

Search for messages sent to a particular IP address:

[email protected]# exigrep '=> .* \[\]' /path/to/exim_log

This example searches for outgoing messages, which have the “=>” symbol, sent to “[email protected]”. The pipe to grep for the “<=” symbol will match only the lines with information on the sender – the From address, the sender’s IP address, the message size, the message ID, and the subject line if you have enabled logging the subject. The purpose of doing such a search is that the desired information is not on the same log line as the string being searched for.

[email protected]# exigrep '=> .*[email protected]' /path/to/exim_log | fgrep '<='

Generate and display Exim stats from a logfile:

[email protected]# eximstats /path/to/exim_mainlog

Same as above, with less verbose output:

[email protected]# eximstats -ne -nr -nt /path/to/exim_mainlog

Same as above, for one particular day:

[email protected]# fgrep YYYY-MM-DD /path/to/exim_mainlog | eximstats


To delete all queued messages containing a certain string in the body:

[email protected]# grep -lr 'a certain string' /var/spool/exim/input/ | \
                sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm

Note that the above only delves into /var/spool/exim in order to grep for queue files with the given string, and that’s just because exiqgrep doesn’t have a feature to grep the actual bodies of messages. If you are deleting these files directly, YOU ARE DOING IT WRONG! Use the appropriate exim command to properly deal with the queue.

If you have to feed many, many message-ids (such as the output of an `exiqgrep -i` command that returns a lot of matches) to an exim command, you may exhaust the limit of your shell’s command line arguments. In that case, pipe the listing of message-ids into xargs to run only a limited number of them at once. For example, to remove thousands of messages sent from [email protected]:

[email protected]# exiqgrep -i -f '<[email protected]>' | xargs exim -Mrm

Speaking of “DOING IT WRONG” — Attention, CPanel forum readers

I get a number of hits to this page from a link in this post at the CPanel forums. The question is:

Due to spamming, spoofing from fields, etc., etc., etc., I am finding it necessary to spend more time to clear the exim queue from time to time. […] what command would I use to delete the queue

The answer is: Just turn exim off, because your customers are better off knowing that email simply isn’t running on your server, than having their queued messages deleted without notice.

Or, figure out what is happening. The examples given in that post pay no regard to the legitimacy of any message, they simply delete everything, making the presumption that if a message is in the queue, it’s junk. That is total fallacy. There are a number of reasons legitimate mail can end up in the queue. Maybe your backups or CPanel’s “upcp” process are running, and your load average is high — exim goes into a queue-only mode at a certain threshold, where it stops trying to deliver messages as they come in and just queues them until the load goes back down. Or, maybe it’s an outgoing message, and the DNS lookup failed, or the connection to the domain’s MX failed, or maybe the remote MX is busy or greylisting you with a 4xx deferral. These are all temporary failures, not permanent ones, and the whole point of having temporary failures in SMTP and a mail queue in your MTA is to be able to try again after awhile.

Exim already purges messages from the queue after the period of time specified in exim.conf. If you have this value set appropriately, there is absolutely no point in removing everything from your queue every day with a cron job. You will lose legitimate mail, and the sender and recipient will never know if or why it happened. Do not do this!

If you regularly have a large number of messages in your queue, find out why they are there. If they are outbound messages, see who is sending them, where they’re addressed to, and why they aren’t getting there. If they are inbound messages, find out why they aren’t getting delivered to your user’s account. If you need to delete some, use exiqgrep to pick out just the ones that should be deleted.

Reload the configuration

After making changes to exim.conf, you need to give the main exim pid a SIGHUP to re-exec it and have the configuration re-read. Sure, you could stop and start the service, but that’s overkill and causes a few seconds of unnecessary downtime. Just do this:

[email protected]# kill -HUP `cat /var/spool/exim/`

You should then see something resembling the following in exim_mainlog:

pid 1079: SIGHUP received: re-exec daemon
exim 4.52 daemon started: pid=1079, -q1h, listening for SMTP on port 25 (IPv4)

Read The Fucking Manual

Powershell and CMD tips for Network Administrators

Active Directory

1. To quickly list all the groups in your domain, with members, run this command:

dsquery group -limit 0 | dsget group -members –expand

2. To find all users whose accounts are set to have a non-expiring password, run this command:

dsquery * domainroot -filter “(&(objectcategory=person)(objectclass=user)(lockoutTime=*))” -limit 0

3. To list all the FSMO role holders in your forest, run this command:

netdom query fsmo

4. To refresh group policy settings, run this command:


5. To check Active Directory replication on a domain controller, run this command:

repadmin /replsummary

6. To force replication from a domain controller without having to go through to Active

Directory Sites and Services, run this command:

repadmin /syncall

7. To see what server authenticated you (or if you logged on with cached credentials) you can run either of these commands:

set l

echo %logonserver%

8. To see what account you are logged on as, run this command:


9. To see what security groups you belong to, run this command:

whoami /groups

10. To see the domain account policy (password requirements, lockout thresholds, etc) run this command:

net accounts

Windows Networking

11. To quickly reset your NIC back to DHCP with no manual settings, run this command:

netsh int ip reset all

12. To quickly generate a text summary of your system, run this command:

systeminfo | more

13. To see all network connections your client has open, run this command:

net use

14. To see your routing table, run either of these commands:

route print

netstat -r

15. Need to run a trace, but don’t have Netmon or Wireshark, and aren’t allowed to install either one? Run this command:

netsh trace start capture=yes tracefile=c:\capture.etl

netsh trace stop

16. To quickly open a port on the firewall, run this command, changing the name, protocol, and port to suit. This example opens syslog:

netsh firewall set portopening udp 161 syslog enable all

17. To add an entry to your routing table that will be permanent, run the route add command with the –p option. Omitting that, the entry will be lost at next reboot:

route add mask –p

18. Here’s a simple way to see all open network connections, refreshing every second:

netstat –ano 1

19. You can add a | findstr value to watch for only a specific connection, like a client ip.addr or port:

netstat –ano | findstr

20. You can use the shutdown to shutdown or reboot a machine, including your own, in a simple scheduled task like this:

shutdown –r –t 0 –m \\localhost

21. To make planned DNS changes go faster, reduce the TTL on the DNS records you plan on changing to 30 seconds the day before changes are to be made. You can set the TTL back to normal after you confirm the changes have been successful.

22. Set a short lease on DHCP scopes that service laptops, and set Microsoft Option 002 to release a DHCP leas on shutdown. This helps to ensure your scope is not exhausted and that machines can easily get on another network when the move to a new site.

Windows 7

23. Want to enable the local administrator account on Windows 7? Run this command from an administrative command prompt. It will prompt you to set a password:

net user administrator * /active:yes

24. You can do the same thing during install by pressing SHIFT-F10 at the screen where you set your initial user password.

Windows 7 supports several useful new keyboard shortcuts:

25. Windows Key+G

Display gadgets in front of other windows.

26. Windows Key++ (plus key)

Zoom in, where appropriate.

27. Windows Key+- (minus key)

Zoom out, where appropriate.

28. Windows Key+Up Arrow

Maximize the current window.

29. Windows Key+Down Arrow

Minimize the current window.

30. Windows Key+Left Arrow

Snap to the left hand side of the screen

31. Windows Key+Right Arrow

Snap to the right hand side of the screen.

32. To quickly launch an application as an administrator (without the right-click, run as administrator), type the name in the Search programs and files field, and then press Ctrl-Shift-Enter.

Here are some tips that can save you from buying commercial software:

33. Need to make a quick screencast to show someone how to do something? The Problem Steps Recorder can create an MHTML file that shows what you have done by creating a screen capture each time you take an action. Click the Start button and type ‘psr’ to open the Problem Steps Recorder.

34. Need to burn a disc? The isoburn.exe can burn ISO and IMG files. You can right click a file and select burn, or launch it from the command line.

35. Windows 7 includes a screen scraping tool called the Snipping Tool. I have tons of users request a license for SnagIt, only to find this free tool (it’s under Accessories) does what they need.

36. You can download this bootable security scanner from Microsoft that will run off a USB key, which is very useful if you suspect a machine has a virus.

37. A great way to save all your command line tools and make them available across all your computers is to install Dropbox, create a folder to save all your scripts and tools, and add that folder to your path. That way, they can be called from the command line or any other scripts, and if you update a script, it will carry across to any other machine you have.

Windows 2008

38. You can free up disk space on your servers by disabling hibernate. Windows 2008 will create a hiberfil.sys equal to the amount of RAM. This is very useful with VMs that have lots of RAM but smaller C: drives. To disable hibernation, and reclaim that space, run this command:

powercfg -h off

39. You can get to the complete collection of Sysinternals tools online. You can even invoke them from the run command. Use the url: or the UNC path: \\\tools.

40. Speaking of the Sysinternals tools, almost any command line in this article can be run remotely on another machine (as long as you have administrative rights) using the psexec command included in the Sysinternals tools.

41. You can kill RDP sessions at the command line when you find that all the RDP sessions to a server are tied up.

regsvr32 query.dll [enter] You only have to do this the first time.

query session /server:servername [enter]

reset session # /server:servername [enter]

42. You can create a list of files and display the last time they were accessed, which is very useful when a network drive is low on space and users swear they have to have that copy of Office 2003 on the network. My advice? If they haven’t touched it in two years, burn it to DVD or write it to tape and then delete it from disk:

dir /t:a /s /od >> list.txt [enter]

43. The Microsoft Exchange Err command is one of the best all around troubleshooting tools you will find, as it can decode any hex error code you find as long as the products are installed on the machine. Download it from here.

44. You can see all the open files on a system by running this command:

openfiles /query

45. You can pull all the readable data out of a corrupt file using this command:

recover filename.ext

46. Need to pause a batch file for a period of time but don’t have the sleep command from the old resource kit handy? Here’s how to build a ten second delay into a script:

ping -n 10 > NUL 2>&1

47. If your Windows website has stopped responding, or is throwing a 500 error, and you are not sure what to do, you can reset IIS without having to reboot the whole server. Run this command:


48. You can use && to string multiple commands together; they will run sequentially.

49. If you find yourself restarting services frequently, you can use that && trick to create a batch file called restart.cmd and use it to restart services:

net stop %1 && net start %1

50. You can download a Windows port of the wget tool from here, and use it to mirror websites using this command:

wget -mk


51. You can list files sorted by size using this command:

ls –lSr

52. You can view the amount of free disk space in usable format using this command:

df –h

53. To see how much space /some/dir is consuming:

du -sh /some/dir

54. List all running processes containing the string stuff:

ps aux | grep stuff

55. If you have ever run a command but forgot to sudo, you can use this to rerun the command:

sudo !!

56. If you put a space before a command or response, it will be omitted from the shell history.

57. If you really liked a long command that you just ran, and want to save it as a script, use this trick:

echo “!!” >

Reading Disks and Partitions

Windows 8.1 / Server 2012 R2

Disk management has been greatly simplified with the many new client and server cmdlets that ship with Windows 8.1 and Server 2012 R2.

Let’s start with looking at disks and partitions. This would list all disks you have mounted:

PS> Get-Disk 

And this gets you the partitions:

PS> Get-Partition 

Both cmdlets reside in the module “Storage”:

PS> Get-Command -Name Get-Disk | Select-Object -ExpandProperty Module

ModuleType Version    Name                                ExportedCommands        
---------- -------    ----                                ----------------        
Manifest    Storage                             {Add-InitiatorIdToMas... 

This will show you all the other storage management commands found there:

PS> Get-Command -Module storage

CommandType     Name                                               ModuleName     
-----------     ----                                               ----------     
Alias           Flush-Volume                                       Storage        
Alias           Initialize-Volume                                  Storage        
Alias           Write-FileSystemCache                              Storage        
Function        Add-InitiatorIdToMaskingSet                        Storage        
Function        Add-PartitionAccessPath                            Storage        
Function        Add-PhysicalDisk                                   Storage      

Twitter This Tip! ReTweet this Tip!

Posted Nov 27 2014, 06:00 AM by ps1

Finding Out Windows Version

All PowerShell Versions

Do you own Windows 8.1 Basic, Pro, or Enterprise? Finding out the Windows version is easy. Finding out the exact subtype is not so trivial.

At best, you may get the SKU number which tells you exactly the Windows version you have, but it’s again not trivial to translate back the number to a meaningful name:

PS> Get-WmiObject -Class Win32_OperatingSystem | Select-Object -ExpandProperty OperatingSystemSKU


A better way may be this line which returns a clear text description of the license type you are using:

PS> Get-WmiObject SoftwareLicensingProduct -Filter 'Name like "Windows%" and LicenseStatus=1' | Select-Object -ExpandProperty Name 

Windows(R), Professional edition

Another approach could be this which will include the major Windows version as well:

PS> Get-WmiObject -Class Win32_OperatingSystem | Select-Object -ExpandProperty Caption

Microsoft Windows 8.1 Pro  

Twitter This Tip! ReTweet this Tip!

Posted Nov 26 2014, 06:00 AM by ps1

Join-Path Fails with Nonexistent Drives

All Versions

To construct path names from parent folders and files, you may have been using Join-Path. This cmdlet takes care of the correct number of backslashes when you combine path components:

$part1 = 'C:somefolder'
$part2 = 'myfile.txt'
$result = Join-Path -Path $part1 -ChildPath $part2


However, Join-Path will fail if the path components do not exist. So you cannot create a path for a drive that is not mounted:

$part1 = 'L:somefolder'
$part2 = 'myfile.txt'
$result = Join-Path -Path $part1 -ChildPath $part2

Join-Path : Cannot find drive. A drive with the name 'L' does not exist. 

In essence, what Join-Path does can be done manually as well. This will combine two path segments and take care of backslashes:

$part1 = 'L:somefolder'
$part2 = 'myfile.txt'
$result = $part1.TrimEnd('') + '' +  $part2.TrimStart('')


If you have enabled the Hyper-V module for PowerShell in the Windows features (like outlined in a previous tip), you can now manage virtual disks from PowerShell.

Twitter This Tip! ReTweet this Tip!

Posted Nov 25 2014, 06:00 AM by ps1

Using Cmdlets to Manage Virtual Hard Drives

Windows 8.1 Pro/Enterprise or Server 2012 R2

Both Windows 8.1 and Server 2012 R2 come with a vast number of additional cmdlets, some of which can be used to manage virtual disks. However, before you can find and use these cmdlets, you need to activate the “Hyper-V role” (note that Hyper-V support on the client side requires Windows 8.1 Pro or Enterprise. It is not included in the “Home” versions).

In Windows 8.1, you need to do this manually: go to Control Panel, and then to Programs/Programs and Features. You can also enter “appwiz.cpl” in PowerShell to get there.

Next, click “Turn Windows features on or off”. This opens up a dialog with all available features. Identify the node “Hyper-V”, and enable it. Then click OK. If the node “Hyper-V” is missing, then your version of Windows does not support Hyper-V on the client side. If the option “Hyper-V Platform” is grayed out, then you need to enable virtualization support in your computer BIOS settings.

The feature installation takes a couple of seconds. Once it is completed, you have a whole new bunch of cmdlets available:

PS> Get-Command -Module Hyper-V

CommandType     Name                                               ModuleName     
-----------     ----                                               ----------     
Cmdlet          Add-VMDvdDrive                                     Hyper-V        
Cmdlet          Add-VMFibreChannelHba                              Hyper-V        
Cmdlet          Add-VMHardDiskDrive                                Hyper-V        
Cmdlet          Add-VMMigrationNetwork                             Hyper-V        
Cmdlet          Add-VMNetworkAdapter                               Hyper-V         

Twitter This Tip! ReTweet this Tip!

Posted Nov 24 2014, 06:00 AM by ps1

Read an xml file attributes using php

For this task I will be using as an example the xml file that holds my streaming channels for the ROKU application I have made.

The xml file can be found here :
You might want to open it and study it. The following code chunk will be grabbing this xml file and then produce a nice <li> of the elements to use on another website or application.
This example is a good one as it grabs the attributes of the elements and not just the nodes. To achieve that we use 2 loops as you see.

  1. $url = &quot;;;
  2. $result = file_get_contents($url);
  3. $xml = new SimpleXMLElement($result);
  4. foreach($xml-&gt;channel-&gt;item as $item) {
  5. foreach($item as $item2) {
  6. $title = $item2-&gt;attributes()-&gt;title;
  7. $imgurl = $item2-&gt;attributes()-&gt;hdposterurl;
  8. $hlsurl = $item2-&gt;attributes()-&gt;url;
  9. echo &quot;&lt;li&gt;&lt;a href='&quot;.$hlsurl.&quot;' target='_blank'&gt;&lt;img src='&quot;.$imgurl.&quot;' class='ui-li-thumb'&gt;&lt;h2&gt;&quot;.$title.&quot;&lt;/h2&gt;&lt;p&gt;&quot;.$title.&quot;&lt;/p&gt;&lt;p class='ui-li-aside'&gt;Watch Live&lt;/p&gt;&lt;/a&gt;&lt;/li&gt;&quot;;
  10. }
  11. }

Output will look like this :

  1. &lt;li&gt;&lt;a href=&quot;[email protected]/master.m3u8&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;; class=&quot;ui-li-thumb&quot;&gt;&lt;h2&gt;Star&lt;/h2&gt;&lt;p&gt;Star&lt;/p&gt;&lt;p class=&quot;ui-li-aside&quot;&gt;Watch Live&lt;/p&gt;&lt;/a&gt;&lt;/li&gt;