Thursday, 16 August 2012

Maintaining the ActiveTabIndex of the AJAX Control Toolkit TabContainer after page refresh



call TabManage function  OnClientActiveTabChanged event of ajax tab container

<ajaxToolkit:TabContainer runat="server" ID="Tabs" Height="500px" ScrollBars="Vertical"
                    ActiveTabIndex="0" OnClientActiveTabChanged="  TabManage">


  function TabManage(sender, args) {
                    debugger;
                    sender.get_clientStateField().value =
                sender.saveClientState();
                }

Tuesday, 3 July 2012

how to call indeed api in classic asp


<%@LANGUAGE="VBSCRIPT"%>

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en">
<head>

<title>Indeed Api Call</title>
<meta name="title" content="testing" />
</head>
<body>
<div class="vevent">
 
   <%
   dim use
 use=Request.ServerVariables("HTTP_USER_AGENT")
  if request("fj") <>"" then
  as_and=request("as_and")
 as_phr=request("as_phr")
 as_any=request("as_any")
  as_not=request("as_not")
 as_ttl=request("as_ttl")
 as_cmp=request("as_cmp")
 jt=request("jt")
   st=request("st")
  salary=request("salary")
   radius=request("radius")
     l=request("l")
  fromage=request("fromage")
  limit=request("limit")
   sort=request("sort")

Dim req
Set req = Server.CreateObject("MSXML2.ServerXMLHTTP")

req.open "GET", "http://api.indeed.com/ads/apisearch?publisher=9116108067858202&q="&as_and&"&as_phr="&as_any&"&as_not="&as_not&"&l="&l&"&as_ttl="&as_ttl&"&sort="&sort&"&radius=&st="&st&"&jt="&jt&"&start=&limit="&limit&"&fromage="&fromage&"&filter=&latlong=1&co=us&chnl=&userip=1.2.3.4&useragent="&use&"&v=2", False
req.send()

Set objXML = Server.CreateObject("Microsoft.XMLDOM")
 Set objLst = Server.CreateObject("Microsoft.XMLDOM")
 Set objHdl = Server.CreateObject("Microsoft.XMLDOM")
 objXML.async = False
 objXML.Load (req.responseXml)
 Set xml_tree2 = objXML.getElementsByTagName("result")
 dim a:a=req.responseXml.xml
Set xml_tree1 = Nothing
%>
<div style=" min-height:500px; width:500px;">
<%
for i = 0 to (xml_tree2.length - 1)
    set xml_tree3 = xml_tree2.item(i)
    test=    isobject(xml_tree3.childnodes(9))
    IF isobject(xml_tree3.childnodes(9)) AND  isobject(xml_tree3.childnodes(0)) AND  isobject(xml_tree3.childnodes(8)) AND  isobject(xml_tree3.childnodes(16)) AND isobject(xml_tree3.childnodes(17)) THEN
    response.write( "<a href='"&xml_tree3.childnodes(9).text&"' >"&xml_tree3.childnodes(0).text&"</a><br>")
    response.write(xml_tree3.childnodes(8).text&"<bR>")
  response.write(xml_tree3.childnodes(16).text&"<bR>")  
    response.write("<font style='color:#20f120;'>"&xml_tree3.childnodes(17).text&"</font><bR>")
   
   end if
   next


    %>

  </div>
  <% end if %>
</div>
<%   if request("fj") ="" then %>>
<form >

<table cellspacing="0" cellpadding="3" border="0" align="center">
<tbody><tr>
<td><h1>Advanced Job Search</h1></td>
</tr>
<tr>
<td>

<table cellspacing="0" cellpadding="3" border="0">
<tbody><tr><td colspan="2" class="header">Find Jobs</td></tr>
<tr>
<td width="150" nowrap=""><label for="as_and">With <b>all</b> of these words</label></td>
<td><input type="text" value="" maxlength="512" size="35" name="as_and" id="as_and"></td>
</tr>
<tr>
<td nowrap=""><label for="as_phr">With the <b>exact phrase</b></label></td>
<td><input type="text" value="" maxlength="512" size="35" name="as_phr" id="as_phr"></td>
</tr>
<tr>
<td nowrap=""><label for="as_any">With <b>at least one</b> of these words</label></td>
<td><input type="text" value="" maxlength="512" size="35" name="as_any" id="as_any"></td>
</tr>
<tr>
<td nowrap=""><label for="as_not">With <b>none</b> of these words</label></td>
<td><input type="text" value="" maxlength="512" size="35" name="as_not" id="as_not"></td>
</tr>
<tr>
<td nowrap=""><label for="as_ttl">With these words in the <b>title</b></label></td>
<td><input type="text" value="" maxlength="512" size="35" name="as_ttl" id="as_ttl"></td>
</tr>
<tr>
<td nowrap=""><label for="as_cmp">From this <b>company</b></label></td>
<td><input type="text" value="" maxlength="512" size="35" name="as_cmp" id="as_cmp"></td>
</tr>


<tr>
<td nowrap=""><label for="jt">Show jobs of type</label></td>
<td>
<select name="jt" id="jt">
<option value="all">All job types</option>
                         
                            <option value="fulltime">Full-time</option>
                         
                            <option value="parttime">Part-time</option>
                         
                            <option value="contract">Contract</option>
                         
                            <option value="internship">Internship</option>
                         
                            <option value="temporary">Temporary</option>
                         
</select>
</td>
</tr>

<tr>
<td nowrap=""><label for="st">Show jobs from</label></td>
<td>
<select name="st" id="st">
<option value="">All web sites</option>
<option value="jobsite">Job boards only</option>
<option value="employer">Employer web sites only</option>
</select>
</td>
</tr>
<tr>
<td nowrap="">&nbsp;</td>
<td>
<input type="checkbox" value="directhire" name="sr" id="norecruiters">&nbsp;<label for="norecruiters">Exclude staffing agencies</label>
</td>
</tr>





<tr id="sal_item">
<td style="vertical-align:top" class="col_a"><label for="salary">Salary estimate</label></td>
<td><table cellspacing="0" cellpadding="0"><tbody><tr><td><input type="text" size="17" value="" name="salary" id="salary"> per year</td></tr><tr><td><span style="font-size:smaller;color:#666" class="example">$50,000 or $40K-$90K</span></td></tr></tbody></table></td>
</tr>


<tr><td colspan="2" class="header">Where and When</td></tr>
<tr>
<td nowrap="" colspan="1" style="padding:5px 3px;">
                     
<label for="radius"><b>Location</b></label>&nbsp;
<select name="radius" id="radius">


<option value="0">only in</option>






<option value="5">within 5 miles of</option>






<option value="10">within 10 miles of</option>






<option value="15">within 15 miles of</option>






<option value="25" selected="">within 25 miles of</option>






<option value="50">within 50 miles of</option>






<option value="100">within 100 miles of</option>



</select>&nbsp;
                    </td>
                    <td>
<input type="text" value="" maxlength="250" size="28" name="l" id="where" autocomplete="off">&nbsp;(city, state, or zip)

</td>
</tr>
                <tr><td></td><td class=""><div style="position:relative;z-index:2"><div style="display:none;" class="acd" id="acdiv"></div></div></td></tr>
<tr>
<td nowrap="" colspan="2" style="padding:5px 3px;">
<b>Age</b> - <label for="fromage">Jobs published</label>&nbsp;
<select name="fromage" id="fromage">
<option value="any">anytime</option>
                         
                                <option value="15">within 15 days</option>
                         
                                <option value="7">within 7 days</option>
                         
                                <option value="3">within 3 days</option>
                         
                            <option value="1">since yesterday</option>
   <option value="last">since my last visit</option>

</select>
</td>  
</tr>
<tr>
<td nowrap="" colspan="2" style="padding:5px 3px;">
<label for="limit"><b>Display</b></label>&nbsp;
<select name="limit" id="limit">
                         
                            <option value="10" selected="">10</option>
                         
                            <option value="20">20</option>
                         
                            <option value="30">30</option>
                         
                            <option value="50">50</option>
                         
</select>
&nbsp;results per page, <label for="sort">sorted by</label>&nbsp;
<select name="sort" id="sort">
<option value="" selected="">relevance</option>
<option value="date">date</option>
</select>
&nbsp;&nbsp;&nbsp;<input type="submit" value="Find Jobs"  name="fj" id="fj">
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
    </form>
    <% end if %>
</body>

</html>

Thursday, 17 May 2012

Android-How to navigate from one screen to another screen


  Button btn= (Button)findViewById(R.id.button1);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {                  
            Intent inte=new Intent(TestActivity.this,second.class);
            startActivity(inte);

            }
        });

Wednesday, 16 May 2012

Get QueryStrings using Javascript

function getQuerystring(key, default_) { if (default_==null) default_=""; key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regex = new RegExp("[\\?&]"+key+"=([^&#]*)"); var qs = regex.exec(window.location.href); if(qs == null) return default_; else return qs[1]; }
The getQuerystring function is simple to use. Let's say you have the following URL:

http://www.test.com?a=gopal
and you want to get the "a" querystring's value:
var author_value = getQuerystring('a');
Operation is not valid due to the current state of the object. System.InvalidOperationException: Operation is not valid due to the current state of the object.
at System.Web.HttpRequest.FillInFormCollection() at System.Web.HttpRequest.get_Form() at Rhino.Commons.LongConversationManager.LoadConversationFromRequest(Boolean& privateConversation) at Rhino.Commons.LongConversationManager.LoadConversation() at Rhino.Commons.HttpModules.UnitOfWorkApplication.UnitOfWorkApplication_BeginRequest(Object sender, EventArgs e) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Cause:
Microsoft recently (12-29-2011) released an update to address several serious security vulnerabilities in the .NET Framework. MS11-100 was introduced just recently that handles potential DoS attacks.  
Unfortunately the fix has also broken page POSTs with very large amounts of posted data (form fields). MS11-100 places a limit of 500 on postback items. The new default max introduced by the recent security update is 1000.  
Adding the setting key to the web-config file overcomes this limitation, as in this example increases it to 2000.  

Saturday, 7 January 2012


Binding listbox and dropdown list using javascript - ASP.NET


we call a web service that return list<Employee> .

 $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "../WebServices/servicename.asmx/methodname",
                data: JSON.stringify({}),
                dataType: "json",
                success: BindEmployeeSucceeded,
                error: BindEmployeeFailed
            });

function BindEmployeeSucceeded(result) {
            var columns = result.d;
            $('#<%=lbEmployee.ClientID %>').empty();
            $('#<%=
lbEmployee
.ClientID %>').append('<option value="' + "0" + '">' + "Select" + '</option>');
            for (var i = 0; i < columns.length; i++) {
                $('#<%=
lbEmployee
.ClientID %>').append('<option value=' + columns[i].Id + '>' + columns[i].OrganisationName + '</option>');
            }
        }

        function BindEmployeeFailed() {

        }

note: OrganisationName and Id are properties of Employee 

normalization


(1) In relational database design, the process of organizing data to minimize redundancy. Normalization usually involves dividing a database into two or more tables and defining relationships between the tables. The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the defined relationships.

There are three main normal forms, each with increasing levels of normalization:
  • First Normal Form (1NF): Each field in a table contains different information. For example, in an employee list, each table would contain only one birthdate field.
  • Second Normal Form (2NF): Each field in a table that is not a determiner of the contents of another field must itself be a function of the other fields in the table.
  • Third Normal Form (3NF): No duplicate information is permitted. So, for example, if two tables both require a birthdate field, the birthdate information would be separated into a separate table, and the two other tables would then access the birthdate information via an indexfield in the birthdate table. Any change to a birthdate would automatically be reflect in all tables that link to the birthdate table.
  • There are additional normalization levels, such as Boyce Codd Normal Form (BCNF), fourth normal form (4NF) and fifth normal form (5NF). While normalization makes databases more efficient to maintain, they can also make them more complex because data is separated into so many different tables.
    (2) In data processing, a process applied to all data in a set that produces a specific statistical property. For example, each expenditure for a month can be divided by the total of all expenditures to produce a percentage.
    (3) In programming, changing the format of a floating-point number so the left-most digit in the mantissa is not a zero.

    normalization