-->

ASP.Net disable browser back button (using javascript)

maqk® by Maqk | 4:54 AM

Well first of all, I must write that this activity is not recommended by professionals. So first of all try to avoid such alternates and try to focus on better solution.

However with the intentions to share knowledge and skill ( and perhaps you have had no other option besides meeting stupid client requests ), i asm providing a javascript that will disalbe the browser back button. The button itself won't be disabled, it would be not functional. So here we go :)


Call it from desired page, add to the page's onload client event ( where you want to disable browser back navigational button)

<body onload="changeHashOnLoad();">

cheers, you are go on IE9 and Firefox 5 (my test browsers;) )

How to setup Android Development Environment

maqk® by Maqk | 12:35 AM

Yes its quite far away from the shadows of dotnet, yet its all about software. ehm ehm apps development. We divide our this post in w major sections:
  • Android Development Setup
  • Hello World program

Following are the ingredients you need to setup the Android Development Environment on your machine (I am not covering system requirements specific issue in this topic, I am supposing u know whats the difference b/w x86 x64, similarly Windows against Mac / OSX and Linux, the links below will be good for Windows 7 on x86 machine)
First of all (after making sure enough disk space lolz, my environment currently has 2.06 GB for Android SK, 200+MB for JDK and 289 MB for Eclipse)

Install the Android SDK, it requires JDK, so if u dont have it, the setup detects this and mentions for a download with download location provided in the setup navigation. Then you need to get an IDE, their are several, i m using eclipse and it would be ok.

Next is to enable your IDE (Eclipse in our case) for Android Development. Why do we need tp do this step explicitly is that Eclipse wont come with Android template installed in default. So you have to make it. For this, open Eclipse, GO to Help → Install new software. Following dialog will appear

paste https://dl-ssl.google.com/android/eclipse/ in the Work with text box
This will update the listbox below
Select all / relevant updates

Once this is done, go to Windows → Preferences, you should see Android option in the left list box. Select it. This will load the following dialog.


Uploaded with ImageShack.us
Provide the sdk location, apply and ok. This should complete your environment setup walkthrough. To ensure your Android SDK is integrated in your Eclipse IDE, select Window from the Eclipse main menu and u should see the new Android SDK option available, see image below;



Uploaded with ImageShack.us

Turn your Windows 7 laptop into a Wi-Fi Hotspot

maqk® by Maqk | 1:23 AM


Blog Story reader can keep reading if they dont get bored of my story telling strategies


Well I just bought an android phone, my friend and office colleague Zohaib Khalid sold me his Huawei IDEOS U8150 on installments, thank you once again dear friend. But this just started once again a AppUseAndDeveloo\p battle in me after I waited for almost an year on the Samsung B3410 dumb touch phone :(


Well, WAR i wrote cause these days, i m really low at spending ( will write abt it some time later in life when it gets more relevant :) ) and so i just was not able to spend on the expensive GPRS by zong. So i needed a wifi device, and the best was costing 7K PKR (some 82 US$, too much for me MAN ). This is what initiated a new mission type thing, how to save money. I knew my DELL 1555 was wifi enabled, and as a default I thought I can host a wifi connection as well. But this was not true, I did crazy thing under network and sharing center (using windows 7) and nothing gave fruits cause i never knew.

Untill another of my office colleague Nabeel Faruqui told me about Virtual Router (http://virtualrouter.codeplex.com/)

Review interested people read from here
It works for sure, my android is just connected to this Virtual Router powered internet connection shared wifi
netwok. It is super but just need to provide more help to end user.

My exprience is awesome, but with one hickup. First I need to tell a brief abt my hardware and setup, so here we go;

  • DELL 15 Studio (1555)
  • Windows 7 Ultimate,
  • Inter WiFi Link 5100 AGN (wifi device)

You just download the setup, run it, it would install an application, restart the pc, you get a Virtual Router Manager v 0.9 beta sitting in your system tray with 2 textboxes and a drop down asking to enter connection parameters and a button as well saying 'Start Virtual Router'. And at this point, u must be thinking that by selecting my internet connection in the drop down and hitting the start bittin, i will get connected, but thats where u get the ONLY BIG BLOW in this software. Actually it would end all your hopes by just saying 'Virtual Router can not be started'.

Too bad it does not say anything more than that. It should be more meaningfull to find atleast what went wrong, it really misguides an end user here. However that said, it does not mean it just cant or wont work, this is why i started by saying 'IT WORKS, NOT FAKE.'

But u have to be a bit techy to experiment. You have to do a bit more than just hitting the start button. Since it is asking a wireless network to share as a wifi hotspot, it would require one, and your Internet connection is not the wireless connection u r connected to which can be used here, perhaps the internet connection can ONLY be shared on a pc to pc or a local LAN WAN type connection which u need to provide to the Virtual Router.
I solved it easily by

  • going in the Network and Sharing Center,
  • Clicking the 'Setup a new connection or network', first choice under 'Change you networking settings'
  • This opens a popup window, select the last choice saying 'Setup a wireless ad hoc (computer to computer)'
  • This would bring the next window with the heading 'Setup a wireless ad hoc (computer to computer)', just press next
  • Would ask your wireless network connection parameters like Network name, security type and security key (password), enter these details as you require and hit next
  • A new window saying the 'your entered network name' network is ready to use.
  • Click close, This step actually has created a new virtual wireless connection under your device manager with the name 'Microsoft Virtual wifi Miniport Adapter'.

With all these details, my point actually is the above 5-6 steps are to be repeated each time you have to start the virtual router which is quite annoying. And not every end user can do it. Plus to this issue, no help whatsoever given to direct or walkthrough for endusers which is not good, if a person like me write a few lines in 20 minutes, then the team should provide more hepl I believe.

That said, Virtual Router is a gr8 thing, for me it is heaven cause it saved my 7K PKR rupees (just 82.something US$ :) ) to buy a wifi router and now i enjoy 36 MbPS wifi link on my Android. Dear tea, just increase the help and walkthrough, of course my review is not dead precise, i might have missed details im my points, i just want to help.

Some screenshots are atatched to easi-fi your wifi setup xp ;)


3 Awesome MUST HAVE utilities for developers

maqk® by Maqk | 10:54 PM

Enough of code, lets see what can ease out our jobs, enhance our routines, and make us more productive.I am always looking around for automation freebies and I think I am good at google :). Of course there are tons of freebies out there but not all of them are useful at the same level. This also depends on your approach, how smart you think and your over all personality.

I have come up with 3, yes 3 good utilities each of them is a must have for any QA, Developer or techy personal. No more time wasting words, straight away Name, Description and location lolz

  • Clipx - smart clipboard manager. Ctrl + Shift + V loads a light weight list of 25 slots of last 25 clipboard objects. And surely it can hold the last 25 t-sql snipets that you were just playing with. Imagine keeping all of them in your control, and using any of it anytime. I have already become so addict towartds it. THe greatest thinks is that it keeps snapshots, files, folders, any thing that clipboard supports so far in my experience. A MUST HAVE No doubt, download it here -http://bluemars.org/clipx/clipx-1.0.3.8-setup.exe
  • AutoHotKey - Well alot of my sql snipets come from it since it can catch the keystrokes and replaces your configured value for it. But thats not even half of waht it can do for you. Define complex keystrokes to do things with your system, open programs, do alot. However I have used it as a smart text replacer and it has really started serving me awesomely. I type large favorite urls by just typing short aliases. One can even use it for email templates etc, depends how smart you are to use ;). Get it here - http://www.autohotkey.com/download/ 
  • Folder Guide - Folder lookup plugin - Loads when File Open dialog appears or in context menu and provides a list of your selected folders. Clicking on them opens or redirects to that folder. Simply Astonishing if you are used to of Folders and file management. However I believe folder guide may slow your machine provided lots of folders configured to appear in the list. Get it here - http://www.freeware365.com/download/FGSetup.exe
So what are you waiting for, go for them, they are gonna turn your life into HELLLLL coooool, lolz :)

DotNetNuke Community v05.04.04 Project Starter Kits

maqk® by Maqk | 2:51 PM

I know its a rather strange type of comeback to my long-no-post and long-ignored blog, and you know what, I was really not busy all those days AT ALL, really no..... just the lazy me, but sure its not going to continue like that cause I have some interesting posts coming about JQuery and DNN of course which is currently the main focus for the next month or so.

Now to the subject, over the past 2-3 months, I was looking for something that should have been too much available to every1. But I have to really dig into websites and apps to get it really.

What I was looking for were the DotNetNuke starter kit for VS2005 and above. But I could not really get it. Whatever you google, say "DotNetNuke 4 project templates" or "DNN4 starter kits" or whatever. I surely would have tried above 20 searches, and yes I found really good sites, and groups talking sense, but at the end of the page, I got nothing near to what I was looking for. It was totally strange for me, I could not believe all my efforts were going in vain and I was doing so much just for a starter kit.

Consider this page for instance: http://www.dotnetnuke.com/Community/Blogs/tabid/825/EntryId/453/DotNetNuke-4-3-Starter-Kit-and-Item-Templates.aspx

which is an official DNN page and it is all about the starter kit, but the linkfor the download provided: http://www.dotnetnuke.com/About/Downloads/tabid/125/Default.aspx redirects to the official DNN Download page. But this page even is not featuring any DNN starter kit downloads.

I was just going to lose faith over this but after lots of idiotic efforts really I finally got it. But to make life really easier and faster for you guys, I am sharing..........

DotNetNuke® Community Edition 05.04.01 Starter Kits

The above is the setup file for Project Starter Kit for VS2008 which will give you is illustrated in the following screenshots;



A DNN compiled module template for both vb / c#

and a new web site (vb only) based on DNN Framework

Also after searching smarter, I came across this link which will more authentic source: http://dotnetnuke.codeplex.com/releases/view/44102#DownloadId=119156

Enjoy development ;)

VB.Net 2008 - Change Desktop Wallpaper from code

maqk® by Maqk | 2:46 AM

Initially, some fun - So the history behind this micro utility is, I bought Dell 15 Studio, Vista eXperience, DreamScene made me more deskTopCrazy, saw Windows 7's random wallpaper changer, searched one for Vista, downloaded apps didn't work , hence decided to make one.

NOTE: The scope of this blogpost is limited to the main API Call that sets a new Wallpaper. The whole utility, its code and details will be posted later in another blogpost. So fingers crossed.

Now for work, its a simple user32.dll API Call to the method, "SystemParametersInfo"

<dllimport("user32.dll", )="" entrypoint:="SystemParametersInfo">_

Public Shared Function SystemParametersInfo(ByVal uiAction As UInteger, ByVal uiParam As UInteger, ByVal pvParam As String, ByVal fWinIni As UInteger) As Boolean



End Function
I searched and found these resources guiding about this API, you may also google "vb.net set desktop wallpaper".

API Call Authentic Sources:
The 2nd link is a more accurate call to the API since this systax worked for me in Vb.net 2008

Details

In the API, the entry point for us is the method, SystemParametersInfo. This function is responsible for so many things, including setting wallpaper for us. A description from msdn is quoted as;
"Retrieves or sets the value of one of the system-wide parameters. This function can also update the user profile while setting a parameter". 

Parameters

This function takes 4 arguments, first one, the most important one is about the work this function is gonna do for ur, so we pass an integer constant, 'SPI_SETDESKWALLPAPER' containing a value of 20.

uParam:

If you google it, most probably the first descriiption you will get is;
"A parameter whose usage and format depends on the system parameter being queried or set. For more information about system-wide parameters, see the uiAction parameter. If not otherwise indicated, you must specify zero for this parameter."

I googled more and found that uParam is set 0 with GET Constant and with SET, the new value should be sent, however in my app, I used 0 and 1 and found a same result with no exceptions. If some one finds a more detailed exlanation, please provide me too. The explanation about these parameters are also limited because the subject function deals with lots of functionality, hence these variables depend on the context of use.

pvParam

This contains the complete filepath of our wallpaper / image file that we are to set as desktop wallpaper

fWinIni

Updates the Win.ini file. The source i used as  alead used 2 constants,

Private Const SPIF_UPDATEINIFILE = 1
Private Const SPIF_SENDWININICHANGE = 2


And the argument was passed as follows;
SystemParametersInfo(SPI_SETDESKWALLPAPER, 1, _WallPaperPath, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)

see the italic text, they ised or in between the 2 variables. However in my testing, I used each of them individually and found no difference.

Sources:
I will return with my whole Rando Wallpaper changer in the next blog, till them, some additional functionality to be implemented to make it a complete product. See you then,

MAQK.

Catch cursor keys on the KeyDown event

maqk® by Maqk | 3:53 AM

Making KeyDown event work for Cursor Keys with controls on your form



Private Const WM_KEYDOWN As Integer = 256
Private Const WM_KEYUP As Integer = 257

Public Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) _
As Boolean Implements IMessageFilter.PreFilterMessage

If (m.Msg = WM_KEYDOWN) Then
Dim keyCode As Keys = (CType(CType(m.WParam, Integer), Keys) And Keys.KeyCode)
'do your stuff with the key down here
'.....
Return True
End If
Return False

End Function

Private Sub FrmPortFolio_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
Application.AddMessageFilter(Me)
End Sub

End Class
top