Remove or hide the DNN module’s print and minimize button?

March 9th, 2010

Go to the page and click on the Settings icon for the module. In the module settings, expand the page settings.  Under the Page settings, expand the Basic settings and you will find a checkbox “Allow Print?” Uncheck the checkbox and the print icon will disppear.

There is another property called “Visibility” with three radio buttons “Maximized”, “Minimized” and “None”. Select “None” and click update in the bottom and you will not see the Print and Minimize button appearing anymore.

How to add a New Tab on Facebook Page?

September 24th, 2009

To add a Tab you need to setup an application first and there is a good tutorial on setting up Facebook application is here – http://developers.facebook.com/get_started.php?tab=tutorial

Once the application has been setup you need to edit some settings, so click edit settings of the application and goto “Profiles” in the profile you need to set the “Tab Name” property which will appear as the label of the Tab and the “Tab URL” property. The “Tab URL” should contain the same path as the “Canvas Callback URL”. For example if the “Canvas Callback URL” is http://www.designworxz.com/myapp/myapp.html the “Tab URL” should be http://www.designworxz.com/myapp/tab.html and the “Tab URL” needs to have the actual page name as well.

After that go to Canvas page and change your “Render Method” from iFrame to FBML and click Save Changes and you are done. Go to the Facebook page you have created and click the + symbol to add a new tab and you will see the name your application appearing there.

AddThis Button Customization

September 17th, 2009

While working on one of the projects I had to use AddThis button for sharing, but the client wanted to customize the Title and Message being passed to different social networking websites such as Facebook, Twitter, Digg and Delicious.

After googling for few hours I had generated the code by picking up bits and pieces from Addthis website and some blogs. The resulting code is as follows and the explanation underneath-

<!– AddThis Button BEGIN –>
<a href=”http://addthis.com/bookmark.php?v=250&amp;pub=xa-4ab08e85777054dd” addthis:title=”Check Out” addthis:url=”http://www.designworxz.com/”>
<img src=”http://s7.addthis.com/static/btn/v2/lg-share-en.gif” width=”125″ height=”16″ alt=”Bookmark and Share” style=”border:0″/>
</a>
<script type=”text/javascript”>
var addthis_share = {
url: ‘http://www.designworxz.com/’,
title: Check Out’,
templates: {
twitter: ‘Check out the amazing work @ {{url}}’
}
}
</script>
<script type=”text/javascript” src=”http://s7.addthis.com/js/250/addthis_widget.js?pub=xa-4ab08e85777054dd”></script>
<!– AddThis Button END –>

The above code will do the following -

Facebook – Will Pick up Title, Description, URL
Twitter – Customized message will be posted
Digg – Will Pick up Title, Description
Delicious – Will Pick up Title

Facebook picks up the Title and Description from the meta tags of the URL so whatever Title and Description has been set in the page will be automatically picked up by Facebook.

For Twitter we have customized the template with this code – twitter: ‘Check out the amazing work @ {{url}}’ So the message posted on Twitter will look something like this “Check out the amazing work @ www.designworxz.com”. The “{{url}}” will be replaced with the actual URL mentioned in the url: attribute.

Digg will pick up the Title mentioned in  – addthis:title=”Check Out” and the description will be picked up from the Meta Description and

Delicious will pick up the Title mentioned in – addthis:title=”Check Out”

Happy sharing!!

How to include js file through code behind

August 21st, 2009

Following C# code will include the javascript file named webkit.js in the head section through the code behind file -

protected void Page_Init(Object sender, EventArgs e)
{
if (!IsPostBack)
{
HtmlGenericControl myJs = new HtmlGenericControl();
myJs.TagName = “script”;
myJs.Attributes.Add(”type”, “text/javascript”);
myJs.Attributes.Add(”language”, “javascript”);
myJs.Attributes.Add(”src”, ResolveUrl(”~/interface/js/webkit.js”));
Page.Header.Controls.Add(myJs);
}
}

iPhone Application Development

August 21st, 2009

This post is for the people who wants to learn iPhone application development but are not really sure where to start, which tool to use and which programming language to learn. Because I had similar questions when my company asked me to learn iPhone application development. So guys go to Apple’s iPhone Development Center which can be located at – http://developer.apple.com/iphone/ & download the SDK from the following link on the page-

iPhone SDK

iPhone SDK for iPhone OS 2.2.1

To download the SDK you will need to register & it’s free. Second thing you need to understand is how to use Xcode which you can easily learn by looking at Getting Started Videos again in the iPhone Development Center. Now the most important and tricky part is that you have to learn Objective C which is the programming language used to code iPhone Apps. One of the websites which I like is this one – http://www.otierney.net/objective-c.html which covers almost everything.

So guys get onto it and start developing iPhone Apps!! Feel free to get back to me at atul.narang@designworxz.com in case of any specific query related to iPhone App Development.

Resizing Text of a webpage with Javascript

August 21st, 2009
Javascript
function resizeText(multiplier) {
if (document.body.style.fontSize == "") {
document.body.style.fontSize = "1.0em";
}
document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (multiplier * 0.2) + "em";

HTML

Assuming you have two images on the webpage with a plus & minus symbol & on the click of those images call the Javascript function as follows -

<img alt=”Increase text size” src=”images/makeTextBigger.jpg” onclick=”resizeText(1)” />
<img alt=”Decrease text size” src=”images/makeTextSmaller.jpg” onclick=”resizeText(-1)” />

Php header redirect does not work

August 21st, 2009

This is a very common problem in PHP while using header(”location: http://www.example.com”); and sometimes you don’t even get this warning and the control stays on the same page. The reason for this problem is that headers is the first thing sent out by a page so you shouldn’t output anything before the header function(not even a html tag). But sometimes its hard to avoid that in situations where you have a login form and on the submission of form you want to verify the user and then redirect him. I have read on many forums where people are saying that you should put header function on top but in the above mentioned scenario it becomes tricky.

I have even tried Javascript’s location.href function but there are some issue with that as well. So the best solution is to use output buffering which resolves this problem.

At the top of your php file in which you are using header redirect call the function ob_start() while output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer. Which means if no output is being sent before header your redirect will work perfectly fine. At the end of your redirect code or on the the destination page you can call the function ob_end_clean(). This function discards the contents of the topmost output buffer and turns off this output buffering.

Embed fonts in Flash

June 24th, 2009

To embed the fonts for a dynamic text field in Flash select the text field and open the properties panel. In the properties panel you will be able to see a button called “Embed”, click on that and it will ask you what all you want to embed such as Uppercase letters, Lowercase letters or Numerics.

Select the appropriate and press Ok and you are done.

JSON to Flash: YouTube Case Study

May 25th, 2009

I had to implement a custom YouTube gadget in Flash. The term gadget does not refer to a specific gadget technology, such as Google Gadgets. YouTube Gadget refers only to small web applications, implemented in HTML or Flash, that are displayed within an iFrame on a YouTube brand channel.

And for that purpose I had to fetch the list of videos published by a particular YouTube user which can only be fetched in the form of JSON, RSS or Atom Feed. I decided to go with JSON, initially it was difficult for me to fetch the appropriate values I needed because the JSON returned by YouTube is quite complex in structured but finally I was able to sort it out.

JSON stands for JavaScript Object Notation and is mainly used to transmit such structured data over a network connection.

Example:
{
"firstName": "Atul",
"lastName": "Narang"
}

In my case the JSON has to be parsed from the following URL -
http://gdata.youtube.com/feeds/api/videos?max-results=5&alt=json&orderby=published&author=designworxz

If you change the last parameter in the URL which is “author=designworxz” to “author=your youtube username” it will fetch list of videos published by you in the form of JSON.

The great community over at http://json.org have created a JSON parsing library for AS1, AS2 & AS3. But we will focus on Flash CS3 & AS2.0. You can find that parse class here: http://json.org/JSON.as

Below is the code to parse the JSON returned by YouTube -


import JSON;

var jsondata:LoadVars = new LoadVars();

jsondata.onLoad = function(success) {

if (success) {
trace("load successful");
var o:Object = json.parse(
unescape(this.toString()));
var s:String = json.stringify(o);
trace(s);
} else {
trace("unable to load JSON data");
}
};

jsondata.load("http://gdata.youtube.com/feeds/api/videos?max-results=5&alt=json&orderby=published&author=designworxz");

The variable “s” will display the complete JSON returned by YouTube in the Output window & then the only thing you have to do is to fetch the required String, Variables & Values from the returned JSON.

Good Luck!!

Flash CS3 UI Scrollbar

March 16th, 2009

Guys, if you attach the UI Scrollbar component with Dynamic textbox in Flash where the text will be populated from XML or a Text file, the scrollbar won’t work and resize automatically.

When I was working on one of my flash component where the data was being populated from XML, I assumed that the scrollbar will automatically adjust according to the amount of the data but nothing really happened.

So to make the scrollbar work after you have populated your dynamic textbox with the content you can type the following action to make the UIScrollbar work -

mc_scroll.maxScrollPosition = details.textHeight;

“mc_scroll” is the instance name of my scrollbar attached with the dynamic textbox & “details” is the name of my dynamic text box.