Author Archives: Ronnie Diaz
IIS6 Change Framework Version without restart of W3SVC service
browse to the location of the folder containing the version of asp_net regiis such as:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319
run aspnet_regiis -lk to get the virtual path you will need in the next command. to see which ID matches your website launch IIS manager and under websites you will see a column called “identifier”.
run the command:
aspnet_regiis.exe -norestart -s “W3SVC\1398789133”
done.
microsoft expressions split clips into multiple files
open expressions (select transcode project)
file->new job
import file
select all your encoding video/audio settings
set your clips (click on location in timeline then on the “insert edit at playhead button”)
at this point you may have assumed clips would have encoded into separate files but this is not how expressions works inherently
save your job in case you make a mistake
right click on the job file in the media window at the bottom left and select duplicate
all of your video/audio encoding settings and clips you set will be duplicated
you can now duplicate as many times for as many clips as you have and remove the excess clips, using the clips tab (window->clips) to make sure you don’t make mistakes by referencing the start/stop times
click encode and watch as many files are queued!
References
http://msdn.microsoft.com/en-us/library/cc294634(v=expression.40).aspx
http://msdn.microsoft.com/en-us/library/cc294622(v=expression.40).aspx
iis 6 redirect with querystring
Permanent site redirects using IIS are useful when moving a site to a new domain and also more search engine friendly than simply doing a javascript or server side redirect. These send a “301” response status code
To do this in IIS 6, simply open the website properties in IIS 6, select “a redirection to a URL” and enter the URL.
To send querystring values along with your redirect, simply add “$Q” to the end of the URL, such as:
http://www.google.com/pagename/pagename/$Q
If you would like instructions on how to perform this via IIS 7, let me know and I can upload these screenshots as well.
References
http://en.wikipedia.org/wiki/HTTP_301
asp .net could not establish trust relationship for the SSL/TLS secure channel
A quick google search revealed multiple reported resolutions, however, after following the steps in the MSDN blog reference listed below, the issue was still unresolved in my situation.
Additional details in the stack trace will reveal another similar message: “The remote certificate is invalid according to the validation procedure.”
In this specific scenario, the site in question is either not configured with a wildcard certificate for a subdomain of the parent site or the operation system I am working on does not support SNI. In the meantime, a workaround is needed to continue testing and development.
Additional reading on google revealed another solution which was more suitable and utilized a code based approach, as opposed to a server configuration based solution.
To make it more dynamic, I added a key into the app/web config to control if SSL errors should be ignored. Please note that it is also possible to replace the code based approach solely with an app/web config entry listed in the west-wind blog referenced below, but I personally prefer to go with code whenever possible.
<?xml version="1.0"?> <configuration> <configSections> </configSections> <connectionStrings> <add name="ConnectionString" connectionString="Data Source=servername;Initial Catalog=databasename;" providerName="System.Data.SqlClient" /> </connectionStrings> <appSettings> <add key="ignoresslerrors" value="true"/> </appSettings> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
public class ConfigValues { public static string IgnoreSSLErrors { get { return getval("ignoresslerrors"); } } } public function main() { connect("https://sitename.com",ConfigValues.IgnoreSSLErrors); } public function connect(string url, string ignoresslerrors) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); try { if (Convert.ToBoolean(ignoresslerrors)) { System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) { return true; //will always accept the cert and ignore errors. this is not good common practice unless you are sure of the destination you are connecting to. needed in this scenario to continue development until issue with cert is resolved. }; } } catch (Exception ex) { Shared.HandleError(ex); } }
References
http://www.west-wind.com/weblog/posts/2011/Feb/11/HttpWebRequest-and-Ignoring-SSL-Certificate-Errors
c# .net split strings with math divrem using lambda linq
Recently I came across a nice alternative to loops using linq for evenly splitting a string using Math.DivRem.
The following example illustrates how this can be used to parse a sequence of numbers based on a time series which may give variable results in a custom messaging protocol.
(inspired by R. Prestol)
//not the complete classes but satisfies the below example class message { string series {get;set;} } string[] series = message.series.Split(' '); //will NOT throw an exception if series string is empty int Rem = 0; int d = Math.DivRem(name.Length, 2, out Rem); //hardcoded two for simplicity in this example //valueB will contain the same value as valueA if there is no second value in the sequence string valueA = string.Join(" ", sentence.Take(Math.Max(d, 1)).ToArray()); string valueB = string.Join(" ", sentence.Skip(d).Take(d + Rem).ToArray()); int average = (Convert.ToInt32(valueA) + Convert.ToInt32(valueB)) / 2; //2 would also need to be dynamic here Console.WriteLine(average.ToString()); //potential input //100 101 //100 //output for average //first input: 100 //second input: 100
A significant figure is lost (.5) on first input since valueA and valueB are converted to int. Conversion to decimal, double etc would of course maintain this detail depending on the rounding you are looking for.
erightsoft SUPER temp files
SUPER video encoder is a pretty handy UI for ffmpeg and mencoder processing, however, keep in mind this tool will create temp files on your hard disk during the encoding process.
Normally this is not an issue, as the temp files are deleted after processing is complete, however, if there are failures during processing or if you cancel the process, temp files may be leftover on your hard disk even if you were encoding to an external drive.
In the screenshot below, I encountered a 30gb video file during my travels which I had a tough time finding the right encoding method for that didn’t take too long. Cancelling the process twice caused a situation illustrated by the screenshot below:
Deleting the temp files is no problem of course, and to navigate to the appropriate directory simply open an explorer window and type %TEMP% in the Window path.
macbook lock screen keyboard shortcut
control+shift+eject
or if you don’t have an eject button:
control-shift-fn-power button