Tuesday, November 30, 2010

Submitting a Windows Phone 7 Application to the Market - CodeProjec

http://www.codeproject.com/Articles/129660/Submitting-a-Windows-Phone-7-Application-to-the-Ma.aspx

Monday, November 29, 2010

Twitter new api C# :- continuous posting twitter

Continuous posting in twitter, using c# and new api..
 
 
using
System;

using

System.Data;

using

System.Configuration;

using

System.Collections;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

using

System.Web.UI.WebControls;

using

System.Web.UI.WebControls.WebParts;

using

System.Web.UI.HtmlControls;

using

oAuthExample;

using

System.Threading;

public

partial class Default6 : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

string url = "";

string xml = "";

oAuthTwitter oAuth = new oAuthTwitter();

if (Request["oauth_token"] == null)

{

oAuth.CallBackUrl =

"http://localhost/twitterpost/default6.aspx";

Response.Redirect(oAuth.AuthorizationLinkGet());

}

else

{

Response.Write(oAuth.TokenSecret.Length);

if (oAuth.TokenSecret.Length <= 0)

{

oAuth.AccessTokenGet(Request[

"oauth_token"], Request["oauth_verifier"]);

}

if (oAuth.TokenSecret.Length > 0)

{

url =

"http://twitter.com/account/verify_credentials.xml";

xml = oAuth.oAuthWebRequest(

oAuthTwitter.Method.GET, url, String.Empty);

apiResponse.InnerHtml = Server.HtmlEncode(xml);

url =

"http://twitter.com/statuses/update.xml";

xml = oAuth.oAuthWebRequest(

oAuthTwitter.Method.POST, url, "status=" + oAuth.UrlEncode("#Cybermonday deals on Football Products http://visli.com/mainsearch/Football/All/1.aspx"));

apiResponse.InnerHtml = Server.HtmlEncode(xml);

Response.Write(

"time 1 =>" +DateTime.Now.ToLongTimeString());

System.Threading.

Thread.Sleep(120000);

Response.Write(

"<br>time 2 =>" + DateTime.Now.ToLongTimeString());

// url = "http://twitter.com/statuses/update.xml"; Trousers

xml = oAuth.oAuthWebRequest(

oAuthTwitter.Method.POST, url, "status=" + oAuth.UrlEncode("#Cybermonday deals on basketball... http://visli.com/mainsearch/basketball/All/1.aspx"));

apiResponse.InnerHtml = Server.HtmlEncode(xml);

}

}

}

}

JD Edwards: How to Remove a RB batch from System

One day a user called  and ask me to remove a duplicate RB (Cash) batch from the system, I did following:
my batch# was 70242
 
--delete from proddta.f03b14 where rzicu=70242
--delete  from proddta.f03b13 where ryicu=70242
--delete  from proddta.f03b11 where rpicu=70242
--delete  from proddta.f0911 where glicu=70242
 
after that I ran repost R099102 with related accounts (select glaid from proddta.f0911) to fix account balance.
 
 
 
 
Note: JD Edwards not allowing you to use sql, try this with your own risk.

Sunday, November 28, 2010

10 Essential Tools for Building ASP.NET Websites

nice article 10 Essential Tools for Building ASP.NET Websites

Creating a ASP.NET MVC HTML Helper for Silverlight

This article covers how to  create a custom ASP.NET MVC HTML Helper that will render the required HTML to host a Silverlight application (XAP file). Some knowledge of ASP.NET MVC is required.



Friday, November 26, 2010

Routing in ASP.NET

Routing in ASP.NET doesn’t require that you name your routes, and in many cases it works out great. When you want to generate an URL, you grab this bag of values you have lying around, hand it to the routing engine, and let it sort it all out.

http://haacked.com/archive/2010/11/21/named-routes-to-the-rescue.aspx

Wednesday, November 24, 2010

Maximum request length exceeded. asp.net

How to fix this ?

Maximum request length exceeded.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Maximum request length exceeded.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): Maximum request length exceeded.]    System.Web.HttpRequest.GetEntireRawContent() +11141623    System.Web.HttpRequest.FillInFormCollection() +129    System.Web.HttpRequest.get_Form() +119    System.Web.HttpRequest.get_HasForm() +11072695    System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +124    System.Web.UI.Page.DeterminePostBackMode() +83    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +270 

 
 

Tuesday, November 23, 2010

Accessing Server-Side Data from Client Script: Using WCF Services with jQuery and the ASP.NET Ajax Library

Accessing Server-Side Data from Client Script: Using WCF Services with jQuery and the ASP.NET Ajax Library

Today's websites commonly exchange information between the browser and the web server using Ajax techniques - the browser executes JavaScript code typically in response to the page loading or some user action. This JavaScript makes an asynchronous HTTP request to the server. which then processes the request and, perhaps, returns data that the browser can then seamlessly integrate into the web page. Two earlier articles - Accessing JSON Data From an ASP.NET Page Using jQuery and Using Ajax Web Services, Script References, and jQuery, looked at using both jQuery and the ASP.NET Ajax Library on the browser to initiate an Ajax request and both ASP.NET pages and Ajax Web Services..more...

http://www.4guysfromrolla.com/articles/111710-1.aspx

C# Twitter auto post error

How to fix this?please help.
Message: Sys.WebForms.PageRequestManagerServerErrorException: The remote server returned an error: (401) Unauthorized.
Line: 868
Char: 13
Code: 0
URI: http://localhost/twitterpost/ScriptResource.axd?d=xx5DcacSwVVveclpzpHq2-LXWURIUfynVz7pWaz73heKi6nCrTVxg5HtpwrjU7BOloH-k8h0BVS-wYBpVV-156MzkfrUqR9pOcJxUOB35X5rSsvuR97HR16wGYIDHMP8YE8SkccccL8iujeA5OmyhtO2XUbN6-VETwaajPuOmuysRn17A9FbpPaAyuMN0&t=2610f696

Monday, November 22, 2010

JD Edwards : Sales count by year/month and search type

select
datepart(yy,DATEADD(dy, cast(SDTRDJ as varchar(10)) % 1000, DATEADD(yy, cast(SDTRDJ as varchar(10)) / 1000,-1)) ),
datepart(mm,DATEADD(dy, cast(SDTRDJ as varchar(10)) % 1000, DATEADD(yy, cast(SDTRDJ as varchar(10)) / 1000,-1)) ),
abat1,count(*) from sales_f4211_f42119 --(union f4211/f42119)
left outer join proddta.f0101 on sdshan=aban8
where sddcto='SO' and sdnxtr=999 and sdlttr<>980
group by abat1,
datepart(yy,DATEADD(dy, cast(SDTRDJ as varchar(10)) % 1000, DATEADD(yy, cast(SDTRDJ as varchar(10)) / 1000,-1)) ),
datepart(mm,DATEADD(dy, cast(SDTRDJ as varchar(10)) % 1000, DATEADD(yy, cast(SDTRDJ as varchar(10)) / 1000,-1)) )

Currency Converter For Windows Phone 7

Build a simple currency converter using a converter web service from start to finish for the Windows
Phone 7 using Microsoft Visual Studio Express 2010 for the Windows Phone.



http://www.codeproject.com/KB/windows-phone-7/Phone7Programming.aspx

Sunday, November 21, 2010

Formatting Dates, Times in ASP.NET 4.0


Format DescriptionCode SnippetOutput
Short date pattern (d) DateTime.Now.ToString("d")11/8/2010
Long date pattern (D) DateTime.Now.ToString("D")Monday, November 08, 2010
Full date/time pattern - short time (f)DateTime.Now.ToString("f") Monday, November 08, 2010 3:39 PM
Full date/time pattern - long time (F) DateTime.Now.ToString("F") Monday, November 08, 2010 3:39:46 PM
General date/time pattern - short time (g) DateTime.Now.ToString("g")11/8/2010 3:39 PM
General date/time pattern - long time (G) DateTime.Now.ToString("G")11/8/2010 3:39:46 PM
Month/day pattern (M)DateTime.Now.ToString("M") November 08
Round-trip date/time pattern (O) DateTime.Now.ToString("O") 2010-11-08T15:39:46.4804000-08:00
RFC 1123 pattern (R) DateTime.Now.ToString("R")Mon, 08 Nov 2010 15:39:46 GMT
Sortable date/time pattern (s) DateTime.Now.ToString("s")2010-11-08T15:39:46
Short time pattern (t)DateTime.Now.ToString("t") 3:39 PM
Long time pattern (T) DateTime.Now.ToString("T")3:39:46 PM
Universal sortable date/time pattern (u)DateTime.Now.ToString("u") 2010-11-08 15:39:46Z
Universal full date/time pattern (U) DateTime.Now.ToString("U") Monday, November 08, 2010 11:39:46 PM
Year/month pattern (Y) DateTime.Now.ToString("Y")November, 2010


Saturday, November 20, 2010

Credit Card Validator Attribute for ASP.NET MVC 3

http://benjii.me/2010/11/credit-card-validator-attribute-for-asp-net-mvc-3/

Friday, November 19, 2010

RichTextBox

http://www.navioo.com/csharp/examples/RichTextBox_532.htm

 


Thursday, November 18, 2010

JD Edwards EnterpriseOne Year End CENTCHG data dictionary 2010

Dear Valued JD Edwards EnterpriseOne Customer,

According to our records your company is currently using Oracle JD Edwards EnterpriseOne. We want to make you aware of an important update that users should make in the EnterpriseOne CENTCHG data dictionary.

JD Edwards EnterpriseOne stores calendar dates in Julian date format. The system allows two-digit dates to be entered to facilitate data entry. The system uses data dictionary item CENTCHG (CenturyChangeYear) to determine the century to use for populating data tables. The system also uses this data dictionary item when automatically populating the default effective through and expiration dates in some data tables.

In releases Xe and ERP8.0, the default value for CENTCHG was set to 10. Thus dates populated using the CENTCHG default value are created as '12/31/2010'. In release 8.9, the default value was set to 15, creating a date of '12/31/2015'. In releases 8.10 through 9.0, the default value was set to 40, creating a date of '12/31/2040'. Oracle recommends that this value be increased for users in the Xe, ERP8.0, and 8.9 releases as well as users who have upgraded from these releases to 8.10 or higher so that the software will supply new effective through dates further into the future.

The document, linked below, outlines the function of CENTCHG in the software and recommends a change to the CENTCHG data dictionary default as soon as possible. This document also introduces the Date Utility, a tool designed to assist users with identifying and resolving business data with potential date issues. The Date Utility is designed for use with the currently supported tools releases.

Instructions (Knowledge Article 882478.1)

If you have any questions or concerns and we can be of assistance, please contact your Global Customer Support Center

Sincerely
Lyle Ekdahl
Group Vice President. General Manager
Oracle JD Edwards
 
 

Wednesday, November 17, 2010

Get a facebook email address

go to http://www.facebook.com/about/messages/ and click on request an invitation. Once your invite is approved, goto messages in your Facebook account to get your facebook email address.
 

MAC and Xcode in Windows iPod, iPhone and iPad

http://www.ipodtouchfans.com/forums/showthread.php?t=267007


 


Tuesday, November 16, 2010

Validation (XHTML 1.0 Transitional): Element 'video' is not supported. html5

 getting error Validation (XHTML 1.0 Transitional): Element 'video' is not supported in vs2008. How to fix?

 

Google map api total distance and duration calculation C#

Google map api total distance and duration calculation between from address and to address.
 
 
protected void Page_Load(object sender, EventArgs e)

{

XmlDocument xDoc = new XmlDocument();

xDoc.Load("http://maps.googleapis.com/maps/api/directions/xml?origin=92610&destination=92630&sensor=false");

XmlNodeList xnList = xDoc.SelectNodes("DirectionsResponse/route/leg/distance");

foreach (XmlNode xn in xnList)

{

Response.Write("distance-> "+xn["text"].InnerText);

}

XmlNodeList xnList1 = xDoc.SelectNodes("DirectionsResponse/route/leg/duration");

foreach (XmlNode xn in xnList1)

{

Response.Write("<br>duration-> " + xn["text"].InnerText);

}

}

Monday, November 15, 2010

Comma Delimited value in sql-server where condition

try to parse Comma Delimited value in sql-server in where condition, storing in a table and displaying values.
 
 
DECLARE
@sTemp VARCHAR(1000)

DECLARE

@psCSString VARCHAR(1000)

set

@psCSString='123,456,789,0123,dsdsd'

create

table #otTemp (fld varchar(20))

WHILE LEN(@psCSString) > 0

BEGIN

SET @sTemp = LEFT(@psCSString, ISNULL(NULLIF(CHARINDEX(',', @psCSString) - 1, -1),

LEN(@psCSString)))

SET @psCSString = SUBSTRING(@psCSString,ISNULL(NULLIF(CHARINDEX(',', @psCSString), 0),

LEN(@psCSString)) + 1, LEN(@psCSString))

INSERT

INTO #otTemp VALUES (@sTemp)

--drop table #otTemp

--select @sTemp

END

select * from dshsjh in(

select * from #otTemp)

drop table #otTemp

Parsing string variable in Where clause with commas


string variable in Where clause with commas
 
DECLARE
@sTemp VARCHAR(1000)
DECLARE @psCSString VARCHAR(1000)
set @psCSString='dsdss,dsdd,sddsds,43443,dsdsd'
WHILE LEN(@psCSString) > 0
BEGIN
SET @sTemp = LEFT(@psCSString, ISNULL(NULLIF(CHARINDEX(',', @psCSString) - 1, -1),
LEN(@psCSString)))
SET @psCSString = SUBSTRING(@psCSString,ISNULL(NULLIF(CHARINDEX(',', @psCSString), 0),
LEN(@psCSString)) + 1, LEN(@psCSString))
-- INSERT INTO @otTemp VALUES (@sTemp)
select @sTemp
END

Split parameter string from comma seperator in SQL IN clause

http://www.codeproject.com/KB/database/splitparameterstring.aspx

Wednesday, November 10, 2010

Call Javascript from code behind c# sample

 Button1.Attributes.Add("onclick", "showLocation(); return false;");

Google map API distance C# javascript calling from code behind

Google map API distance C# javascript calling from code behind

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default10.aspx.cs" Inherits="Default10" %>

<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Google Maps JavaScript API Example: Extraction of Geocoding Data</title>
    <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA7j_Q-rshuWkc8HyFI4V2HxQYPm-xtd00hTQOC0OXpAMO40FHAxT29dNBGfxqMPq5zwdeiDSHEPL89A" type="text/javascript"></script>
<!-- According to the Google Maps API Terms of Service you are required display a Google map when using the Google Maps API. see: http://code.google.com/apis/maps/terms.html -->
    <script type="text/javascript">
    
    var geocoder, location1, location2;
 
    

    function showLocation() {
        geocoder = new GClientGeocoder();
        geocoder.getLocations(document.forms[0].address1.value, function (response) {
            if (!response || response.Status.code != 200)
            {
                alert("Sorry, we were unable to geocode the first address");
            }
            else
            {
                location1 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
                geocoder.getLocations(document.forms[0].address2.value, function (response) {
                    if (!response || response.Status.code != 200)
                    {
                        alert("Sorry, we were unable to geocode the second address");
                    }
                    else
                    {
                        location2 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
                        calculateDistance();
                    }
                });
            }
        });
    }
 
    function calculateDistance()
    {
        try
        {
            var glatlng1 = new GLatLng(location1.lat, location1.lon);
            var glatlng2 = new GLatLng(location2.lat, location2.lon);
            var miledistance = glatlng1.distanceFrom(glatlng2, 3959).toFixed(1);
            var kmdistance = (miledistance * 1.609344).toFixed(1);
            //document.getElementById('results').innerHTML = '<strong>Address 1: </strong>' + location1.address + '<br /><strong>Address 2: </strong>' + location2.address + '<br /><strong>Distance: </strong>' + miledistance + ' miles (or ' + kmdistance + ' kilometers)';

            document.getElementById("Label1").innerHTML = '<strong>Address 1: </strong>' + location1.address + '<br /><strong>Address 2: </strong>' + location2.address + '<br /><strong>Distance: </strong>' + miledistance + ' miles (or ' + kmdistance + ' kilometers)';
        

        }
        catch (error)
        {
            alert(error);
        }
        
    }
 
    </script>
  </head>
 
  <body>
     
 
    <form id="wedkj"  runat="server">
   
      <p>
        <input type="text" name="address1" value="92610" class="address_input"
              size="40" />
        <input type="text" name="address2" value="92679" class="address_input"
              size="40" />
        
              
        <input type="submit" name="find" value="Search" />
       
        
      </p>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
     <asp:Button ID="Button1" runat="server"  Text="Button" onclick="Button1_Click"  />
     <asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" />
    <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
    
     
    </form>
   
 
  </body>
</html>


using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;



public partial class Default10 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //Label1.Text = inpHide.Value;
       // Response.Write(Label1.innerHtml);

        //Response.Write("dsdsdsd");

       // Response.Write(Label2.Text);
      

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //Response.Write("1111dssddsddsdssd");
        Button1.Attributes.Add("onclick", "showLocation(); return false;");

    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        //Response.Write(Label1.Text);
    }
}

Friday, November 5, 2010

Yahoo map/geocoding API to get latitude and longitude c# sample

Following is the sample code:-

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class yalatilongi : System.Web.UI.Page
{
    private GeoAddressAPI geoAPI = new GeoAddressAPI();

    protected void Page_Load(object sender, EventArgs e)
    {
        string strConnection = "server=xxxxx;database=xxxxx;uid=sa;pwd=xxxxxxx;Connect Timeout=60";
        SqlConnection myConn = new SqlConnection(strConnection);
        string strstate = "CA";
        string query = "select aladd1,alcty1,aladds,aladdz,aban8 from jde_rk.dbo.latlongad where lati=0 and aladds='"+strstate+"'";
        SqlCommand myCommand = new SqlCommand(query, myConn);
        myCommand.Connection.Open();
        SqlDataReader myReader = myCommand.ExecuteReader();
        while (myReader.Read())
        {
            Response.Write(myReader.GetString(0));
            Response.Write("<br>");
            Response.Write(myReader.GetString(1));
            Response.Write("<br>");
            Response.Write(myReader.GetString(2));
            Response.Write("<br>");
            Response.Write(myReader.GetString(3));
            Response.Write("<br>");
            Response.Write(myReader.GetString(4));
            Response.Write("<br>");

            GeoAddress address = geoAPI.GeoEncodeAddress(myReader.GetString(0), myReader.GetString(1), myReader.GetString(2), myReader.GetString(3));
            Response.Write(address.Latitude);
            Response.Write("<br>");
            Response.Write(address.Longitude);
            Response.Write("<br>");
            Response.Write(myReader.GetString(4));
           // Response.End();

            editLeadMaster(myReader.GetString(4), address.Latitude, address.Longitude);

        }
        myReader.Close();
        myConn.Close();
    }



    void editLeadMaster(string aban8, string Lati, string Longi)
    {
        SqlConnection myConnection = new SqlConnection(ConnectionString);
       
        string strSQL = "UPDATE jde_rk.dbo.latlongad SET longi=@longi,lati=@lati WHERE aban8 ='" + aban8 + "'";
        SqlCommand cmd = new SqlCommand(strSQL, myConnection);
        cmd.CommandType = CommandType.Text;
        cmd.Parameters.AddWithValue("@longi", Longi.ToString());
        cmd.Parameters.AddWithValue("@lati", Lati.ToString());
       
        myConnection.Open();
        cmd.ExecuteNonQuery();
        myConnection.Close();

      

    }

   






    private string ConnectionString
    {
        get
        {
            string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString;
            return connectionString;
        }
    }



}






for distance calculation use following:-


private double distanceCal(double Lat1, double Long1, double Lat2, double Long2, char unit)
    {
        double dDistance = Double.MinValue;
        double dLat1InRad = Lat1 * (Math.PI / 180.0);
        double dLong1InRad = Long1 * (Math.PI / 180.0);
        double dLat2InRad = Lat2 * (Math.PI / 180.0);
        double dLong2InRad = Long2 * (Math.PI / 180.0);

        double dLongitude = dLong2InRad - dLong1InRad;
        double dLatitude = dLat2InRad - dLat1InRad;

        // Intermediate result a.
        double a = Math.Pow(Math.Sin(dLatitude / 2.0), 2.0) + Math.Cos(dLat1InRad) * Math.Cos(dLat2InRad) * Math.Pow(Math.Sin(dLongitude / 2.0), 2.0);

        // Intermediate result c (great circle distance in Radians).
        double c = 2.0 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1.0 - a));

        // Distance.
        // const Double kEarthRadiusMiles = 3956.0;
        const Double kEarthRadiusKms = 6376.5;
        dDistance = kEarthRadiusKms * c;

        return dDistance;

        //return (dist);
    }

Wednesday, November 3, 2010

Put Double quotes in excel data

How to put quotes in excel data:- copy double quote in a cell and in another cell put ", after that user this formula  =CONCATENATE(F2,A2,G2) in a cell you will get following data , If you want this data to use in sql-server just do find and replace " with with single quote ' and you dont have to put quotes start and end of the data.








2063719971
"2063719971",

" ",
2063719997
"2063719997",

" ",
2063720425
"2063720425",

" ",
2063720466
"2063720466",

" ",
2063720789
"2063720789",

" ",
2063720797
"2063720797",

" ",

How to turn off red light from logitech webcam


Go start ->logitech ->logitech webcam software -> preference ->LED control ->click off.


Tuesday, November 2, 2010

Not able to print checks JD Edwards xe e1 1world

My user submited a job using work with payment group(R04570) and checks are not visiable at automatic payment groups screen.
Solution: Sometime when job stuck in jobqueue or you kickoff from jd edwards because of citrix connection problem and you are running job locally. you are not able to see checks in P04571 program because its not yet created. but when you try to re-submit these batch again you are getting blank reports, because pay status is "Z" - means pending, so in order to print these checks you have to change pay status (RPPST) in F0411 from Z to A. after changing status you can create checks

FloatingWindow - Multi-windows Interface for Silverlight 4 - CodeProject

http://www.codeproject.com/KB/silverlight/FloatingWindow.aspx

Rajeev Kumar