Download the Google Hindi IME / Input Tools Standalone - Offline Installer
Vishwajit Girdhari : a Pune based .NET consultant and blogger. Building Rich Internet Application to cross the mile with a smile....... Designer[30%]/Developer[70%]'s Blog.
Friday, October 18, 2013
Friday, February 01, 2013
Adding click event to button through Javascript using addEventListener
Adding button to DOM and futher adding click event to button through Javascript using addEventListener
<!DOCTYPE html>
<html>
<head>
<script>
function btnclick(person)
{
alert(person + " is free tomorrow!");
}
function load()
{
alert("Just one question...");
var s = document.getElementById("page-content");
var i = document.createElement("button");
i.innerHTML="myBtn";
s.appendChild(i);
if(i.addEventListener)
{
i.addEventListener('click',function (){btnclick("Vinayak");}, true);
}
}
</script>
</head>
<body onload="load()">
<div id="page-content"></div>
<p>Who is free from tomorrow?</p>
</body>
</html>
- Vishwajit Girdhari, .NET Enthusiast
<!DOCTYPE html>
<html>
<head>
<script>
function btnclick(person)
{
alert(person + " is free tomorrow!");
}
function load()
{
alert("Just one question...");
var s = document.getElementById("page-content");
var i = document.createElement("button");
i.innerHTML="myBtn";
s.appendChild(i);
if(i.addEventListener)
{
i.addEventListener('click',function (){btnclick("Vinayak");}, true);
}
}
</script>
</head>
<body onload="load()">
<div id="page-content"></div>
<p>Who is free from tomorrow?</p>
</body>
</html>
- Vishwajit Girdhari, .NET Enthusiast
Friday, October 12, 2012
Adding jquery calendar control to DotNetNuke module
jQuery provides with calendar and they call it datepicker
DotNetNuke provides with inbuilt jquery.js and jquery-ui.js so you don't have to bother to link them separately
In regular html / asp.net application you would have to add following lines in <head> tag
<script src="http://code.jquery.com/jquery-1.8.2.js"></script> <script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script> <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css" />
You dont need them in DNN.
If you are developing a custom DNN module add this to your user control view.ascx file.
I have txtStartDate as a text field on the form where I wanted my calander to be rendered on click.
To achieve this I added this code at the top of my ascx page after the standard includes.
<script type="text/javascript" >
$(function () {
$("#<%= txtStartDate.ClientID %>").datepicker();
});
</script>
The calender takes the size based on your text size if it is appearing bigger that your expectation
set it style like this
<style>
div.ui-datepicker{
font-size:10px;
}
</style>
Tuesday, September 18, 2012
Getting Current User Info in DotNetNuke
// DNN Get Current User
// The Current user information can fetch using UserController and
// is availble as UserInfo object:
private UserInfo _currentUser =
DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo();
// To get UserID of the current user we can then access the fetched UserInfo object:
int UserID = _currentUser.UserID
// The Current user information can fetch using UserController and
// is availble as UserInfo object:
private UserInfo _currentUser =
DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo();
// To get UserID of the current user we can then access the fetched UserInfo object:
int UserID = _currentUser.UserID
Tuesday, September 04, 2012
DotNetNuke Error: System.Web.UI.UserControl' does not contain a definition for 'CreatedByUser'
Another tiring issue because of automatic code generation of .designer.cs while building
DotNetNuke Module from asp.net User Control.
My asp.net user control was working flawlessly when I converted it in to DNN Module it was
not getting build. It was giving this error.
Error 16 'System.Web.UI.UserControl' does not contain a definition for 'CreatedByUser' and no extension method 'CreatedByUser' accepting a first argument of type 'System.Web.UI.UserControl' could be found (are you missing a using directive or an assembly reference?)
Solution:
I found the reason.. Apparently when a rename occurs the definitions are changed.
Originally the definitions where these:
protected global::DotNetNuke.UI.UserControls.LabelControl lblContent;
protected global::DotNetNuke.UI.UserControls.ModuleAuditControl ctlAudit;
After the renaming, they magically became these:
protected global::System.Web.UI.UserControl lblContent;
protected global::System.Web.UI.UserControl ctlAudit;
As did every other control in the .designer.cs files!
Ref : http://www.dotnetnuke.com/Resources/Forums/forumid/199/threadid/355899/scope/posts.aspx
DNN Error - Could not create type 'DotNetNuke.Modules.Journal.ProfilePic
'Error 21 Could not create type 'DotNetNuke.Modules.Journal.ProfilePic''
I was getting this error in when I was trying to compile latest DotNetNuke Community Edition CMS Version 06.02.0
This issue was appearing weird as the file contained no code. There was nothing could be done about it.
But finally it seems to build packaging problem from DNN Team.
"You may safely delete this file." is what the DNN guys says. huh. thats a big relief ! !
>>Reply from DNN<<
There seems to be a file in the install package that shouldn't have been included. If you see a file named ProfilePic.ashx in the DesktopModules/Journal directory you can safely delete this file. This file was created before we moved to handler that was integrated with the core project.
Will Morgenweck Director of Product Management DotNetNuke Corp. |
Tuesday, August 21, 2012
Thursday, August 09, 2012
IIS Server on Windows 7 Home Basic
To Install IIS 7.5 on Windows 7 Home
Click Start and then click Control Panel.
In Control Panel, click 'Programs and features' then click 'Turn Windows features on or off'.
In the Windows Features dialog box, click Internet Information Services and then click OK.
Developers are recommended to select Application Development Features or Web Management Tools in the check boxes associated with those features.
P.S. Getting ready on DNN Module Development. Keep watching this blog for more updates on same ... ;)
Friday, September 30, 2011
Form Validation in flex 2.0 programatically
There are couple of approaches for performing form validation in flex.
Here I would be presenting the combination that appeared to me more logical and eligant.
< height="100%" width="100%">
<mx:formitem required="true" label="User ID" >
< id="txtUserId" width="235" height="20" focusout="performRequiredFieldValidation(event);">
do what you like ........
Here I would be presenting the combination that appeared to me more logical and eligant.
< height="100%" width="100%">
<mx:formitem required="true" label="User ID" >
< id="txtUserId" width="235" height="20" focusout="performRequiredFieldValidation(event);">
do what you like ........
Monday, November 27, 2006
Introduction to Flex Data Services 2
Introduction to Flex Data Services 2
11/28/2006
2:00 PM US/Eastern
http://www.adobe.com/cfusion/event/index.cfm?event=track&id=539086&loc=en_us
11/28/2006
2:00 PM US/Eastern
http://www.adobe.com/cfusion/event/index.cfm?event=track&id=539086&loc=en_us
Tuesday, November 14, 2006
Calling web services in ActionScript
Calling web services in ActionScript
private function initMe(e:Event):void {
con.useProxy = false ;
con.wsdl = http://localhost/TestService.asmx?wsdl;
if (con.canLoadWSDL()){
con.loadWSDL();
}
con.login.addEventListener("result", loginResultHandler);
con.addEventListener("fault", wsFaultHandler);
}
private function loginClickHandler (event : Event ){
con.login(t1.text , t2.text );
}
private function wsFaultHandler (fault : Object ){
Alert.show(""+fault.faultString);
}
Tuesday, October 31, 2006
Sending custom class object thru remoting using OpenAmf
Passing UDT from java to flex using openAmf based remoting.
Finally the battle is over. Was in lot of pain pasing a
custom object as response to remote call to java. 2 man days
wasted.
Java (server side) :
Remote Class (UDT): TestClass.java
package com.vishwajit.test.BO;
import java.io.Serializable;
public class TestClass implements Serializable {
private String testValue ;
public TestClass() {
}
public String getTestValue() {
return testValue;
}
public void setTestValue(String testValue) {
this.testValue = testValue;
}
}
Remote Method : (Inside Service.java)
public static TestClass Test()
{
TestClass obj = new TestClass();
obj.setTestValue("setyblch");
return obj;
}
Open AMF Mapping
(if you have not already set this one...)
<amf-serializer>
<force-lower-case-keys>false</force-lower-case-keys>
</amf-serializer>
<custom-class-mapping>>
<java-class>com.vishwajit.test.BO.TestClass</java-class>
<custom-class>vishwajit.TestClass</custom-class>
</custom-class-mapping>
Client Side (flex / swf):
public function TestHandler (obj : Object ):void {
var testObj:TestClass = TestClass(obj);
Alert.show("" + testObj.testValue );
}
Finally the battle is over. Was in lot of pain pasing a
custom object as response to remote call to java. 2 man days
wasted.
Java (server side) :
Remote Class (UDT): TestClass.java
package com.vishwajit.test.BO;
import java.io.Serializable;
public class TestClass implements Serializable {
private String testValue ;
public TestClass() {
}
public String getTestValue() {
return testValue;
}
public void setTestValue(String testValue) {
this.testValue = testValue;
}
}
Remote Method : (Inside Service.java)
public static TestClass Test()
{
TestClass obj = new TestClass();
obj.setTestValue("setyblch");
return obj;
}
Open AMF Mapping
(if you have not already set this one...)
<amf-serializer>
<force-lower-case-keys>false</force-lower-case-keys>
</amf-serializer>
<custom-class-mapping>>
<java-class>com.vishwajit.test.BO.TestClass</java-class>
<custom-class>vishwajit.TestClass</custom-class>
</custom-class-mapping>
Client Side (flex / swf):
public function TestHandler (obj : Object ):void {
var testObj:TestClass = TestClass(obj);
Alert.show("" + testObj.testValue );
}
Wednesday, October 25, 2006
Problem invoking any webservice operation if the API contains a method called 'logout'
Figured out a weird issue with Flex 2.0 / Flash Player 9 . Your comments welcome.
Issue:
When you are calling any webservice where the API contains a method/function/operation named 'logout' your call wont be processed.
and you get the exception mentioned in trace .
Just to confirm the issue I tried writing webservice in Intersystems Cache and .NET 1.0 .
The issue lies with webmethod name 'logout' , if its renamed to something else the life is good.
Trace :
TypeError: Error #1034: Type Coercion failed: cannot convert MC{mx.rpc.soap.mxml::WebService@1393c41 mx.rpc::AbstractService/logout()}@132a7b9 to mx.rpc.soap.Operation.
Issue:
When you are calling any webservice where the API contains a method/function/operation named 'logout' your call wont be processed.
and you get the exception mentioned in trace .
Just to confirm the issue I tried writing webservice in Intersystems Cache and .NET 1.0 .
The issue lies with webmethod name 'logout' , if its renamed to something else the life is good.
Trace :
TypeError: Error #1034: Type Coercion failed: cannot convert MC{mx.rpc.soap.mxml::WebService@1393c41 mx.rpc::AbstractService/logout()}@132a7b9 to mx.rpc.soap.Operation.
Tuesday, October 17, 2006
Webservice Result for Flex 2
Getting result of Webservice.
Result is available in the operation object property lastResult.
Sample
Alert.show(loginWS.login.lastResult + "");
Result is available in the operation object property lastResult.
Sample
Alert.show(loginWS.login.lastResult + "");
Crossdomin access for webservice
1 Invoking webservice in Flex without FDS
2 Solution for MessaginError message='Unknown destination'DefaultHTTP'.'
1
If You are not using FDS
On the Webserice Object
set 'proxy' = false
do not set the 'destination' property instead
set 'wsdl' to the path of wsdl
2 Use crossdomin.xml file on the server that is hosting the webservice. This file should grant access to clients domain. Place this file at the root of the webserver.
example
Any other queries : Post comment.
2 Solution for MessaginError message='Unknown destination'DefaultHTTP'.'
1
If You are not using FDS
On the Webserice Object
set 'proxy' = false
do not set the 'destination' property instead
set 'wsdl' to the path of wsdl
2 Use crossdomin.xml file on the server that is hosting the webservice. This file should grant access to clients domain. Place this file at the root of the webserver.
example
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
Any other queries : Post comment.
Calling a webservice in Flex 2
Making a webservice call in Action Script 3.0
Without using FDS
Flex webservice Sample.
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="creationCompleteHandler()" >
<mx:WebService id="loginWS"
wsdl="http://vishwajit/TestWS/Service1.asmx?WSDL"
useProxy="false"
fault="wsFault(event)" >
<mx:operation name="HelloWorld" result="HelloWorldResult(event)"
>
</mx:operation>
<mx:operation name="login" result="getLoginResult(event)" >
<mx:request xmlns="" >
<loginId>a1</loginId>
<password>a1</password>
</mx:request>
</mx:operation>
</mx:WebService>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
public function creationCompleteHandler()
{
loginWS.login.send();
//loginWS.HelloWorld.send();
}
public function HelloWorldResult(result : Object)
{
Alert.show("HelloWorldResult");
}
public function wsFault(fault:Object)
{
Alert.show(""+fault);
}
]]>
</mx:Script>
</mx:Application>
Time wasted/invested on the issue 2.5 Man days
Without using FDS
Flex webservice Sample.
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="creationCompleteHandler()" >
<mx:WebService id="loginWS"
wsdl="http://vishwajit/TestWS/Service1.asmx?WSDL"
useProxy="false"
fault="wsFault(event)" >
<mx:operation name="HelloWorld" result="HelloWorldResult(event)"
>
</mx:operation>
<mx:operation name="login" result="getLoginResult(event)" >
<mx:request xmlns="" >
<loginId>a1</loginId>
<password>a1</password>
</mx:request>
</mx:operation>
</mx:WebService>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
public function creationCompleteHandler()
{
loginWS.login.send();
//loginWS.HelloWorld.send();
}
public function HelloWorldResult(result : Object)
{
Alert.show("HelloWorldResult");
}
public function wsFault(fault:Object)
{
Alert.show(""+fault);
}
]]>
</mx:Script>
</mx:Application>
Time wasted/invested on the issue 2.5 Man days
Friday, September 29, 2006
Programatically adding appender to Log4j
Wanted to use Log4j without configuration file.
So here is the clean code.
//Java
FileAppender fa = new FileAppender(new SimpleLayout(),filename,true);
fa.activateOptions();
Logger logger = Logger.getLogger(filename);
logger.addAppender(fa);
logger.info(data);
logger.removeAllAppenders();
So here is the clean code.
//Java
FileAppender fa = new FileAppender(new SimpleLayout(),filename,true);
fa.activateOptions();
Logger logger = Logger.getLogger(filename);
logger.addAppender(fa);
logger.info(data);
logger.removeAllAppenders();
Thursday, September 28, 2006
SWFLoader : Dynamically load / unload my 'sub applications' in Flex 2.0
Dynamically load / unload my 'sub applications' in Flex 2.0 (compiled swf) but user feel should be as if only one mxml has been loaded.
One problem in flex...
You have 3 .mxmls that get compiled into .swf ( Say A , B , C . )
step1 You have to load B inside A
step2 In B there is a button on click you have to unload B from A and load C
step3 Also in C there is a button on click you have to unload C from A and load B
---
My approach
for Step1 : cool!
I am loading B in A using SWFLoader.
for step2 : stuck!
I am not able get hold of the instance A from which i can change source property of swfLoader (instance) to "C.swf"
for step : whatever works for step 2 :-(
--
Solution ;)
Two days after making this post I figured out a simple way to achieve this.
Code below demonstrates the my approach.
Thanks,
Vishwajit Girdhari
Flexblog : http://flexiness.blogspot.com
One problem in flex...
You have 3 .mxmls that get compiled into .swf ( Say A , B , C . )
step1 You have to load B inside A
step2 In B there is a button on click you have to unload B from A and load C
step3 Also in C there is a button on click you have to unload C from A and load B
---
My approach
for Step1 : cool!
I am loading B in A using SWFLoader.
for step2 : stuck!
I am not able get hold of the instance A from which i can change source property of swfLoader (instance) to "C.swf"
for step : whatever works for step 2 :-(
--
Solution ;)
Two days after making this post I figured out a simple way to achieve this.
Code below demonstrates the my approach.
Thanks,
Vishwajit Girdhari
Flexblog : http://flexiness.blogspot.com
Main.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml "
layout="absolute"
creationComplete="init(event)" >
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import flash.events.Event;
private function init(e:Event):void
{
//doing nothing
}
public function loadSWF (filename : String) : void
{
swfLoader.source=filename;
}
]]>
</mx:Script>
<mx:SWFLoader id="swfLoader" source="one.swf"
></mx:SWFLoader>
</mx:Application>
<mx:Application xmlns:mx="http://www.adobe.
layout="absolute"
creationComplete=
<mx:Script>
<![CDATA[
import mx.controls.
import flash.events.
private function init(e:Event)
{
//doing nothing
}
public function loadSWF (filename : String) : void
{
swfLoader.source=
}
]]>
</mx:Script>
<mx:SWFLoader id="swfLoader" source="one.
></mx:SWFLoader>
</mx:Application>
one.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml "
layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
public function handleOne ( event : Event ) :void {
mx.core.Application.application.loadSWF("two.swf");
}
]]>
</mx:Script>
<mx:Button id="btnOne" label="Button One" click="{handleOne(event)}"
y="200"></mx:Button>
</mx:Application>
<mx:Application xmlns:mx="http://www.adobe.
layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.
public function handleOne ( event : Event ) :void {
mx.core.Application
}
]]>
</mx:Script>
<mx:Button id="btnOne" label="Button One" click="{handleOne(
y="200"></mx:Button>
</mx:Application>
two.mxml
<?xml
version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml "
layout="absolute">
<mx:Script>
<![CDATA[
import flash.profiler.showRedrawRegions;
import mx.controls.Alert;
public function handleTwo ( event : Event ) :void {
mx.core.Application.application.loadSWF("one.swf");
}
]]>
</mx:Script><mx:Button id="btnTwo" label="Button Two"
click="handleTwo(event)" x="300"></mx:Button>
</mx:Application>
version="1.0" encoding="utf-
<mx:Application xmlns:mx="
layout="absolute">
<mx:Script>
<![CDATA[
import flash.profiler.
import mx.controls.
public function handleTwo ( event : Event ) :void {
mx.core.Application
}
]]>
</mx:Script><mx:Button id="btnTwo" label="Button Two"
click="handleTwo(
</mx:Application>
Friday, September 08, 2006
Printing a hash map in flex
A small piece of AS code that saves a lot of my debug time and frustrations...
Mostly use while understanding the remote object structure.
//code:
//Alerting the hashmap contents
var str = "";
for(var k:String in hashMap)
{
str += k + ":" + hashMap[k] + "\n";
}
Alert.show("Printing hash map : \n" + str);
Mostly use while understanding the remote object structure.
//code:
//Alerting the hashmap contents
var str = "";
for(var k:String in hashMap)
{
str += k + ":" + hashMap[k] + "\n";
}
Alert.show("Printing hash map : \n" + str);
Monday, March 20, 2006
Tomcat 5.5 admin package.
Tomcat 5.5 admin package.
Tomcat's administration web application is no longer installed by default. Download and install the "admin" package to use it.
http://apache.tradebit.com/pub/tomcat/tomcat-5/v5.5.16/bin/apache-tomcat-5.5.16-admin.zip
Tomcat's administration web application is no longer installed by default. Download and install the "admin" package to use it.
http://apache.tradebit.com/pub/tomcat/tomcat-5/v5.5.16/bin/apache-tomcat-5.5.16-admin.zip
Subscribe to:
Posts (Atom)