Saturday, November 10, 2007

ADxMenu Wrapper for DotNetNuke

If you are a web developer and have heard about ADxMenu for sure like me you like this cool menu.

I'm a DNN developer and I have use this menu before in my old project but the SCHWINGCSSMENU I am using no longer works in IE7 although I have created a fix here, I still decided to create a new module(coz I think its cool).

View sample and download the module.

Wednesday, October 31, 2007

Generating Video Thumbnail Using VB.NET

I have finally get a snapshot/thumbnail of a given video using FFMPEG.

If you wish to do accomplish the same thing follow instruction below:


Download the zip file containg ffmpeg and corresponding files.

Copy the dll and the exe to your bin folder.

Give your .NET user (probably Network Service) full permission to ffmpeg.exe. This step may not be neccesary or may vary depending on your Windows security settings.

Paste this code in your codebehind

' Generate thumbnail
Dim p As Process
Dim pInfo As New ProcessStartInfo()
pInfo.FileName = "\bin\ffmpeg.exe"
pInfo.WindowStyle = ProcessWindowStyle.Hidden
pInfo.Arguments = String.Format("-y -i ""{0}"" -f mjpeg -ss 5 -vframes 1 ""{1}""", , )

p = Process.Start(pInfo)
While (Not p.HasExited)
System.Threading.Thread.Sleep(10)
End While

Hope this helps.

Wednesday, March 28, 2007

Auto Reset Planet Router

Yesterday I've been googling for a solution to automatically reset my Planet Internet Broadband Router every 24 hours but did'nt find any solution. So I decided to create my own.

VS.NET 2003 source code.

When compile this console application will reset the router using its administration page.

Sample console command
resetpr 192.168.0.1 admin password

In order for this to run every 24 hours I created a batch file and add it to my server scheduled task.

HTH

Tuesday, January 02, 2007

DotNetNuke SCHWINGCSSMENU in IE7

Last year I needed a better menu than the default use by DotNetNuke for a site I was working, and I run into this SCHWINGCSSMENU a DNN Skin Object which is a wrapper for
ADxMenu by Aleksandar Vacic. It was perfectly working with IE6 and Firefox until IE7 comes. I tried to look for an upgrade for the menu but at the time of this writing I can't find one and I needed a quick fix, So upon further research I come up with this solution.

<!--[if gte IE 6]>
<style type="text/css">
@import url(/DesktopModules/SchwingCSSMenu/menuh4ie.css );
body {behavior: url("/DesktopModules/SchwingCSSMenu/adxmenu.htc")}
</style>
<![endif]-->




The reason why SCHWINGCSSMENU no longer works in IE7 is that it only checks for IE6 and below before it inserts the required scripts and styles.

<!--[if lte IE 6]>




If you insert the first code above in your skin or in the page header tags of your page, SCHWINGCSSMENU will work again in IE7.

See Sample

HTH, Happy New Year.

Sunday, December 17, 2006

DNN Login form enhancement

See http://www.phileconsociety.org/Login/tabid/66/Default.aspx

If you want to implement the same style, read on.

Copy the script below in your login form.
<script language=javascript>
<!-- //
var eUserName = dnn.dom.getById("<%=txtUserName.ClientID%>")
function BodyOnLoad()
{
if (eUserName != null)
{
eUserName.focus();
eUserName.select();
}
}

function SelText()
{
if (eUserName.value == "[Type your user name]")
{
eUserName.value = "";
}
}

BodyOnLoad();
// -->

</script>


Make sure the dnn object is available in the client.
In my case since I'm using a custom login form I use the code below in my page load event handler
If ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML) Then
ClientAPI.RegisterClientReference(Page, ClientAPI.ClientNamespaceReferences.dnn)
End If


In case you dont want to edit your code behind inserting the code below in page header tags in page settings will do the trick.
<script src="/js/dnn.js"></script>

Wednesday, October 04, 2006

Blogger Beta all labels selection

This is my first post, I'm more of a coder than a writer but I'll try to (etc2x) what's in my mind.

You can always, post comment with your suggestions and recommendations. Just don't give me a wild reaction.

Now lets go to the Code Sample part.

The script below will mimic the experience when you click a label in the All Labels section of blogger when you create a post. Call the script passing the label/tag.

Example

toggleTag('Scoters')

or


<a href="javascript:toggleTag('vacation');void(0);">vacation</a>


THE CODE

function toggleTag(sTag)
{
var eTags = "Get reference to your label input object";
if (eTags != null)
{
// Search if tag is already in the list if not add
var sOldTags = ';' + eTags.value.replace(/; /g,';') + ';';
if (sOldTags != ';;')
{
if (sOldTags.toLowerCase().match(';' + sTag.toLowerCase() + ';') == null)
{
var sNewTags = sOldTags.replace(/;/g,'; ') + sTag;
eTags.value = sNewTags.substr(2);
}
}
else
{
eTags.value = sTag;
}
}
}


a s t a l a v i s t a