<asp:TextBox onKeyPress="return disableEnterKey(event)" runat="server" name="txtUserName" ID="txtUserName" MaxLength="20" Width="135px"></asp:TextBox>
function disableEnterKey(e) {
var key;
if (window.event)
key = window.event.keyCode; //IE
else
key = e.which; //firefox
return (key != 13);
}
Monday, June 28, 2010
Monday, June 14, 2010
Setup Ubuntu as web server
http://www.securenetwork.it/ricerca/whitepaper/download/Debian-Ubuntu_hardening_guide.pdf
SELinux for Ubuntu Server:
http://selinuxproject.org/files/2008_selinux_developer_summit/2008_summit_brindle_ubuntu.pdf
The installation is as simple as:
Sudo apt-get install selinux
SELinux disables AppArmour
SELinux for Ubuntu Server:
http://selinuxproject.org/files/2008_selinux_developer_summit/2008_summit_brindle_ubuntu.pdf
The installation is as simple as:
Sudo apt-get install selinux
SELinux disables AppArmour
Wednesday, June 2, 2010
POST in asp.NET page without nesting forms
if (!IsPostBack)
{
ScriptManager.RegisterStartupScript(Page, this.GetType(), "postback", "function doExternalPost(targetUrl) { theForm.__VIEWSTATE.value = ''; theForm.encoding = 'application/x-www-form-urlencoded'; theForm.action = targetUrl; theForm.submit(); }", true);
}
litText.Text = string.Format("<input name="postInfo" value="{0}" type="hidden"><a onclick="\"javascript:doExternalPost('{1}');\"">clickme</a>", "prodABC" , "postURL");
{
ScriptManager.RegisterStartupScript(Page, this.GetType(), "postback", "function doExternalPost(targetUrl) { theForm.__VIEWSTATE.value = ''; theForm.encoding = 'application/x-www-form-urlencoded'; theForm.action = targetUrl; theForm.submit(); }", true);
}
litText.Text = string.Format("<input name="postInfo" value="{0}" type="hidden"><a onclick="\"javascript:doExternalPost('{1}');\"">clickme</a>", "prodABC" , "postURL");
Tuesday, June 1, 2010
reference jQuery in Visual Studio
<%if (false) { %>
<script language="javascript" type="text/javascript" src="../../Resources/Shared/scripts/jquery/jquery-1.4.2.js"></script>
<script language="javascript" type="text/javascript" src="../../Resources/Shared/scripts/jquery/jquery-1.4.2-vsdoc.js"></script>
<%} %>
<script language="javascript" type="text/javascript"><br /><br /> $(document).ready(function() {<br /><br /> });<br /><br /></script>
<script language="javascript" type="text/javascript" src="../../Resources/Shared/scripts/jquery/jquery-1.4.2.js"></script>
<script language="javascript" type="text/javascript" src="../../Resources/Shared/scripts/jquery/jquery-1.4.2-vsdoc.js"></script>
<%} %>
<script language="javascript" type="text/javascript"><br /><br /> $(document).ready(function() {<br /><br /> });<br /><br /></script>
Saturday, May 22, 2010
iPhone unlock
Firmware: current version 3.1.3, can be jailbroken easily now. Unlock has nothing to do with jailbreak. If update the firmware, baseband will be automatically updated.
Baseband: control the GSM frequency. This is how Apple lock iPhone to stop people use it under other GSM network rather than AT&T. Due to T-mobile has similar frequency, locked iPhone can be used under T-mobile some how. The latest baseband 5.12.01 hasn't been unlocked yet (except some videos on YouTube), so hacker need to downgrade it to 5.11 to unlock iPhone. However, the latest bootloader 5.9 has fix the bug which allows people downgrade baseband from 5.12.01.
Bootloader: it is a hardware, can't be upgrade/downgrade unless modify the iPhone hardware, just like the camera. Only the bootloader before 5.9 has the bug to allow people downgrade baseband. However, most of the new iPhone 3G/3GS is using the bootloader 5.9.
Baseband: control the GSM frequency. This is how Apple lock iPhone to stop people use it under other GSM network rather than AT&T. Due to T-mobile has similar frequency, locked iPhone can be used under T-mobile some how. The latest baseband 5.12.01 hasn't been unlocked yet (except some videos on YouTube), so hacker need to downgrade it to 5.11 to unlock iPhone. However, the latest bootloader 5.9 has fix the bug which allows people downgrade baseband from 5.12.01.
Bootloader: it is a hardware, can't be upgrade/downgrade unless modify the iPhone hardware, just like the camera. Only the bootloader before 5.9 has the bug to allow people downgrade baseband. However, most of the new iPhone 3G/3GS is using the bootloader 5.9.
Friday, May 7, 2010
Loading UserControl Dynamically in UpdatePanel
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<asp:updatepanel id="pnl1" runat="server">
<contenttemplate>
<asp:placeholder id="plh1" runat="server"></asp:PlaceHolder>
</contenttemplate>
</asp:UpdatePanel>
private string LastLoadedControl
{
get
{
return ViewState["LastLoaded"] as string;
}
set
{
ViewState["LastLoaded"] = value;
}
}
private void LoadUserControl()
{
string controlPath = LastLoadedControl;
if (!string.IsNullOrEmpty(controlPath))
{
plh1.Controls.Clear();
UserControl uc = (UserControl)LoadControl(controlPath);
plh1.Controls.Add(uc);
}
}
protected void Page_Load(object sender, EventArgs e)
{
DotNetNuke.Framework.AJAX.RegisterScriptManager();
string controlPath = string.Empty;
if (Settings.ContainsKey("ddl1"))
controlPath = Settings["ddl1"] + ".ascx";
else
controlPath = "Expired.ascx";
LastLoadedControl = controlPath;
LoadUserControl();
}
<asp:updatepanel id="pnl1" runat="server">
<contenttemplate>
<asp:placeholder id="plh1" runat="server"></asp:PlaceHolder>
</contenttemplate>
</asp:UpdatePanel>
private string LastLoadedControl
{
get
{
return ViewState["LastLoaded"] as string;
}
set
{
ViewState["LastLoaded"] = value;
}
}
private void LoadUserControl()
{
string controlPath = LastLoadedControl;
if (!string.IsNullOrEmpty(controlPath))
{
plh1.Controls.Clear();
UserControl uc = (UserControl)LoadControl(controlPath);
plh1.Controls.Add(uc);
}
}
protected void Page_Load(object sender, EventArgs e)
{
DotNetNuke.Framework.AJAX.RegisterScriptManager();
string controlPath = string.Empty;
if (Settings.ContainsKey("ddl1"))
controlPath = Settings["ddl1"] + ".ascx";
else
controlPath = "Expired.ascx";
LastLoadedControl = controlPath;
LoadUserControl();
}
Comparison of Android vs iPhone vs Nokia vs BlackBerry vs Windows Mobile 7
Android (Open Handset Alliance)
* open platform
* can compile custom firmwares - good for hackers and other
* good framework, extended on each new firmware
* supports multitasking
* nice GUI - Eclipse
* development SDK is free
* easy to debug, can send logs to developers
* Android uses a version of Linux as its kernel (albeit tweaked by Google to fit Android needs and separated from the main Linux kernel tree), but it is not a conventional Linux distribution; it does not have a native X Window System, neither does it support the full set of standard GNU libraries like its system libraries (GNU C Library). This makes it difficult to reuse existing Linux applications or libraries on Android. Android does not use established Java standards, i.e. Java SE and ME. This prevents compatibility among Java applications written for those platforms and those for the Android platform. Android only reuses the Java language syntax, but does not provide the full-class libraries and APIs bundled with Java SE or ME. However, Myriad's J2Android, launched on 19 March 2010, allows seamless conversion of Java MIDlets into Android applications.
* programming language is Java but bridges from other languages exist (C# .net - Mono, etc)
* Android supports Java 1.5 and translates the byte code to its own custom Dalvik byte code optimized for mobile devices.
* for the hardcore programmers, Android offers the possibility of programming in C using the native dev kit NDK
* can run script languages like LUA, Perl, Python, etc
* can install third party applications from sdcard, random sites - not locked to a specific market
* applications can hook and override everything - email interface, SMS sending, custom keyboards, etc
* supports widgets
* can publish applications on the Android market instantly - initial one time registration fee is 25E
* user has access to the sdcard and can use it as a USB disk
* native Adobe Flash support after 2.1
Symbian (Nokia)
* opened Symbian and says the future will be QT and WRT - they will cut support to any other environment including J2ME
* Qt is a cross-platform application and UI framework. Using Qt, you can write web-enabled applications once and deploy them across desktop, mobile and embedded operating systems without rewriting the source code. (C++)
* One Developer License Qt Desktop Single Operating System $3 695
* QT runs on Maemo, MeeGo, BlackBerry, Symbian, Windows Mobile, desktop PC, consumer electronics, car entertainment, etc
* QT is available stand along IDE, or Integration/Add-in for Eclipse and Visual Studio
* WRT - web runtime - a cool feature that allows users to write applications in HTML, JS and CS. You build the app like a normal web page, and you interact with the phone platform/hardware using the WRT bridge. Just HTML, JS and CS. Very important: JS can call native code, but also the other way around. It seems you can call WRT JS with native code.
* supports Adobe Flash Lite
* nice GUI - Eclipse
* development SDK is free
MeeGo (Nokia and Intel)
* MeeGo applications are written in C++ using the MeeGo SDK, including Qt.
* nice GUI - Eclipse
* development SDK is free

iPhone (Apple)
* closed platform
* development kit costs
* programming language only allow Objective C (appeared in 1986)
* applications are not allowed to duplicate the iPhone functionality - ie no custom email interface, etc
* NO sd card
* third party applications can only be installed from the Apple store. publishing on the store is a very lengthy and tiresome process. Apple has many and bizarre rules. Many applications were rejected for strange reasons.
* no Adobe Flash support
WebOS (HP)
* hope HP will not kill the brilliant WebOS
* web program (Html, CSS, JavaScript)
BlackBerry (Research In Motion)
* Java native (J2ME) and web development
* the new OS 6 is coming
Windows Mobile 7 (Microsoft)
* break compatibility with WM 6.x
* programming environment is Silverlight and XNA
* no native programming ie no hooking and overriding keyboard, etc - they removed PInvoke
* nice GUI - Visual Studio 2010
* MS marketplace
* no Adobe Flash support
Windows Mobile 6.x (Microsoft)
* native C, C# with PInvoke
Bada (Samsung)
* The Bada operating system has a kernel configurable architecture, which allows the use of either the Linux kernel, or another Real-time operating system (RTOS) kernel. The Linux kernel is the preferred choice for smartphones, while RTOS is used for cheaper feature-phones, due to its smaller memory footprint.
Ref: http://adrianvintu.com/blogengine/post/Comparison-of-Android-vs-IPhone-vs-Nokia-vs-BlackBerry-vs-Windows-Mobile-7.aspx
http://en.wikipedia.org/wiki/Android_(operating_system)
* open platform
* can compile custom firmwares - good for hackers and other
* good framework, extended on each new firmware
* supports multitasking
* nice GUI - Eclipse
* development SDK is free
* easy to debug, can send logs to developers
* Android uses a version of Linux as its kernel (albeit tweaked by Google to fit Android needs and separated from the main Linux kernel tree), but it is not a conventional Linux distribution; it does not have a native X Window System, neither does it support the full set of standard GNU libraries like its system libraries (GNU C Library). This makes it difficult to reuse existing Linux applications or libraries on Android. Android does not use established Java standards, i.e. Java SE and ME. This prevents compatibility among Java applications written for those platforms and those for the Android platform. Android only reuses the Java language syntax, but does not provide the full-class libraries and APIs bundled with Java SE or ME. However, Myriad's J2Android, launched on 19 March 2010, allows seamless conversion of Java MIDlets into Android applications.
* programming language is Java but bridges from other languages exist (C# .net - Mono, etc)
* Android supports Java 1.5 and translates the byte code to its own custom Dalvik byte code optimized for mobile devices.
* for the hardcore programmers, Android offers the possibility of programming in C using the native dev kit NDK
* can run script languages like LUA, Perl, Python, etc
* can install third party applications from sdcard, random sites - not locked to a specific market
* applications can hook and override everything - email interface, SMS sending, custom keyboards, etc
* supports widgets
* can publish applications on the Android market instantly - initial one time registration fee is 25E
* user has access to the sdcard and can use it as a USB disk
* native Adobe Flash support after 2.1
Symbian (Nokia)
* opened Symbian and says the future will be QT and WRT - they will cut support to any other environment including J2ME
* Qt is a cross-platform application and UI framework. Using Qt, you can write web-enabled applications once and deploy them across desktop, mobile and embedded operating systems without rewriting the source code. (C++)
* One Developer License Qt Desktop Single Operating System $3 695
* QT runs on Maemo, MeeGo, BlackBerry, Symbian, Windows Mobile, desktop PC, consumer electronics, car entertainment, etc
* QT is available stand along IDE, or Integration/Add-in for Eclipse and Visual Studio
* WRT - web runtime - a cool feature that allows users to write applications in HTML, JS and CS. You build the app like a normal web page, and you interact with the phone platform/hardware using the WRT bridge. Just HTML, JS and CS. Very important: JS can call native code, but also the other way around. It seems you can call WRT JS with native code.
* supports Adobe Flash Lite
* nice GUI - Eclipse
* development SDK is free
MeeGo (Nokia and Intel)
* MeeGo applications are written in C++ using the MeeGo SDK, including Qt.
* nice GUI - Eclipse
* development SDK is free

iPhone (Apple)
* closed platform
* development kit costs
* programming language only allow Objective C (appeared in 1986)
* applications are not allowed to duplicate the iPhone functionality - ie no custom email interface, etc
* NO sd card
* third party applications can only be installed from the Apple store. publishing on the store is a very lengthy and tiresome process. Apple has many and bizarre rules. Many applications were rejected for strange reasons.
* no Adobe Flash support
WebOS (HP)
* hope HP will not kill the brilliant WebOS
* web program (Html, CSS, JavaScript)
BlackBerry (Research In Motion)
* Java native (J2ME) and web development
* the new OS 6 is coming
Windows Mobile 7 (Microsoft)
* break compatibility with WM 6.x
* programming environment is Silverlight and XNA
* no native programming ie no hooking and overriding keyboard, etc - they removed PInvoke
* nice GUI - Visual Studio 2010
* MS marketplace
* no Adobe Flash support
Windows Mobile 6.x (Microsoft)
* native C, C# with PInvoke
Bada (Samsung)
* The Bada operating system has a kernel configurable architecture, which allows the use of either the Linux kernel, or another Real-time operating system (RTOS) kernel. The Linux kernel is the preferred choice for smartphones, while RTOS is used for cheaper feature-phones, due to its smaller memory footprint.
Ref: http://adrianvintu.com/blogengine/post/Comparison-of-Android-vs-IPhone-vs-Nokia-vs-BlackBerry-vs-Windows-Mobile-7.aspx
http://en.wikipedia.org/wiki/Android_(operating_system)
Subscribe to:
Posts (Atom)