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

 

Friday, October 29, 2010

The remote server returned an error: (401) Unauthorized. twitter api

 

Server Error in '/twitweb' Application.

The remote server returned an error: (401) Unauthorized.

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.Net.WebException: The remote server returned an error: (401) Unauthorized.

Source Error:

Line 271:            finally Line 272:            { Line 273:                webRequest.GetResponse().GetResponseStream().Close(); Line 274:                responseReader.Close(); Line 275:                responseReader = null;

Source File: c:\Inetpub\wwwroot\twitweb\App_Code\oAuthTwitter.cs    Line: 273

Stack Trace:

[WebException: The remote server returned an error: (401) Unauthorized.]    System.Net.HttpWebRequest.GetResponse() +1126    oAuthExample.oAuthTwitter.WebResponseGet(HttpWebRequest webRequest) in c:\Inetpub\wwwroot\twitweb\App_Code\oAuthTwitter.cs:273    oAuthExample.oAuthTwitter.WebRequest(Method method, String url, String postData) in c:\Inetpub\wwwroot\twitweb\App_Code\oAuthTwitter.cs:244    oAuthExample.oAuthTwitter.oAuthWebRequest(Method method, String url, String postData) in c:\Inetpub\wwwroot\twitweb\App_Code\oAuthTwitter.cs:199    oAuthExample.oAuthTwitter.AccessTokenGet(String authToken, String oauthVerifier) in c:\Inetpub\wwwroot\twitweb\App_Code\oAuthTwitter.cs:103    Default6.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\twitweb\Default6.aspx.cs:32    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42    System.Web.UI.Control.OnLoad(EventArgs e) +132    System.Web.UI.Control.LoadRecursive() +66    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428 


Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3614
 
if you are using same message again 2 times you will get this error.change your message and then try.

The remote server returned an error: (403) Forbidden. Twitter api error

 Server Error in '/twitweb' Application.

The remote server returned an error: (403) Forbidden.

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.Net.WebException: The remote server returned an error: (403) Forbidden.

Source Error:

Line 271:            finally Line 272:            { Line 273:                webRequest.GetResponse().GetResponseStream().Close(); Line 274:                responseReader.Close(); Line 275:                responseReader = null;

Source File: c:\Inetpub\wwwroot\twitweb\App_Code\oAuthTwitter.cs    Line: 273

Stack Trace:

[WebException: The remote server returned an error: (403) Forbidden.]    System.Net.HttpWebRequest.GetResponse() +1126    oAuthExample.oAuthTwitter.WebResponseGet(HttpWebRequest webRequest) in c:\Inetpub\wwwroot\twitweb\App_Code\oAuthTwitter.cs:273    oAuthExample.oAuthTwitter.WebRequest(Method method, String url, String postData) in c:\Inetpub\wwwroot\twitweb\App_Code\oAuthTwitter.cs:244    oAuthExample.oAuthTwitter.oAuthWebRequest(Method method, String url, String postData) in c:\Inetpub\wwwroot\twitweb\App_Code\oAuthTwitter.cs:199    Default6.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\twitweb\Default6.aspx.cs:42    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42    System.Web.UI.Control.OnLoad(EventArgs e) +132    System.Web.UI.Control.LoadRecursive() +66    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428 
 
 
 
if you are using .net sample code getting this error while trying to do status update use following code in default.aspx:
 
 

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;

public

partial class _Default : 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)

{

//Redirect the user to Twitter for authorization.

//Using oauth_callback for local testing.

oAuth.CallBackUrl =

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

Response.Redirect(oAuth.AuthorizationLinkGet());

}

else

{

//Get the access token and secret.

oAuth.AccessTokenGet(Request[

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

if (oAuth.TokenSecret.Length > 0)

{

//We now have the credentials, so make a call to the Twitter API.

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

//xml = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, url, String.Empty);

//apiResponse.InnerHtml = Server.HtmlEncode(xml);

//POST Test

url =

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

xml = oAuth.oAuthWebRequest(

oAuthTwitter.Method.POST, url, "status=" + oAuth.UrlEncode("test 123 Hello Testing the .NET oAuth API 3"));

apiResponse.InnerHtml = Server.HtmlEncode(xml);

}

}

}

}


 

Tuesday, October 26, 2010

Twitter retweet/tweet c# code behind sample

Label6.Text =

"<a href='http://twitter.com/share' class='twitter-share-button' data-url='http://www.wwwwwwww.com/fblike/default2.aspx?id='"+ Request.RawUrl.ToString() + "'data-text='"+ Page.Title.ToString() +"' data-count='none' data-via='rajeevkum'>Tweet</a><script type='text/javascript' src='http://platform.twitter.com/widgets.js'></script>";

Twitter Tweet, Facebook Like code C# gridview

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" RowStyle-Font-Bold="true"
RowStyle-Font-Size="13" RowStyle-Font-Names="Arial"
DataKeyNames="linkid" DataSourceID="AccessDataSource1" width="90%">
<columns>
<asp:templatefield headertext="Popular Likes">
<itemtemplate>
<li><a href="'default2.aspx?id="<%#">'><%# Eval("linkdesc") %> </a>
<br />
<iframe src="http://www.facebook.com/plugins/like.php?href="http://www.vvvvvv.com/fblike/default2.aspx?id="<%#"> &amp;layout=button_count&amp;show_faces=false&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21&amp;width=100&amp;locale=en_US' scrolling='no' frameborder='0' allowTransparency='true' style='margin-left:15px; height:21px; width:95px;'></iframe>'
  
<a href="http://twitter.com/share" class="twitter-share-button" url="http://www.bigtechie.com/fblike/default2.aspx?id=<%# Eval(">" data-text='<%# Eval("linkdesc") %>' data-count="none" data-via="rajeevkum">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>


</li>
<br />
</itemtemplate>
</asp:TemplateField>
</columns>
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="e:\fblike.mdb"
SelectCommand="SELECT [linkid], [linkdesc],[linkfblk] FROM [linkdesc] where linkid<>3 order by linkid desc">
</asp:AccessDataSource>

Monday, October 25, 2010

Displaying Rectangle area google map address in webpage in html

Displaying Rectangle area google map address in webpage in html.
 
 
<map name="map" id="map">
    <area shape="rect"  coords="70,445,355,650"  target="_blank"
    href="http://maps.google.com/maps?q=Your Address"
    alt="Click Here For Map and Direction" title="Click Here For Map and Directions"/>
</map>

 


Friday, October 22, 2010

Tab sequence JD Edwards Application

Click on Layout after that on "Add Tab Sequence"
 
 

Thursday, October 21, 2010

Error: Intercompany Out of Balance -JD Edwards EnterpriseOne, V-Batch

If you are not able to post V- Batch (voucher) getting following error, I fix these errors following way:-
 
 
Informational: Call From     : rKumar
Contact       :
Phone Number  :
Tickler Date  : 10/21/2010
Subject       : Error: Intercompany Out of Balance
Cause . . . . . Your intercompany settlements are out of balance for 
 this batch.  The intercompany settlement method being used 
 is either '1', '2', or '3'.  When using these methods of
 intercompany settlements, transactions between companies are
 allowed.  The post will create intercompany settlements for out
 of balance companies, but each document within the batch, as
 well as the batch as a whole, must be in balance (debits equal
 credits).

Resolution. . .  Please clean up any out of balance entries and then Repost this batch.

 

First calculate total by using following queries and store in temp tables

select gldoc,sum(glaa)glaa into jde_rk.dbo.temp693431 from proddta.f0911 where glicu=694337 group by gldoc
select rpdoc,sum(rpag)rpag into jde_rk.dbo.tempRP693431 from proddta.f0411 where rpicu=694337 group by rpdoc


After that find exact document number which is causing out of balance
select * from jde_rk.dbo.temp693431
left outer join jde_rk.dbo.tempRP693431 on gldoc=rpdoc
where glaa<>rpag

Talk to finance department before update F0911 Data, you have to put difference and change F0911 record.

select glaa,* from proddta.f0911 where gldoc=506594.0 and glicu=694337
update proddta.f0911 set glaa=23322 where gldoc=506594.0 and glicu=694337


 

Error: Intercompany Out of Balance- JD Edwards EnterpriseOne

If you are not able to post V- Batch (voucher) getting following error, I fix these errors following way:-
 
Informational: Call From     : rKumar
Contact       :
Phone Number  :
Tickler Date  : 10/21/2010
Subject       : Error: Intercompany Out of Balance
Cause . . . . . Your intercompany settlements are out of balance for 
 this batch.  The intercompany settlement method being used 
 is either '1', '2', or '3'.  When using these methods of
 intercompany settlements, transactions between companies are
 allowed.  The post will create intercompany settlements for out
 of balance companies, but each document within the batch, as
 well as the batch as a whole, must be in balance (debits equal
 credits).
Resolution. . .  Please clean up any out of balance entries and then Repost this batch.
 
First calculate total by using following queries and store in temp tables
select gldoc,sum(glaa)glaa into jde_rk.dbo.temp693431 from proddta.f0911 where glicu=694337 group by gldoc
select rpdoc,sum(rpag)rpag into jde_rk.dbo.tempRP693431 from proddta.f0411 where rpicu=694337 group by rpdoc

After that find exact document number which is causing out of balance
select * from jde_rk.dbo.temp693431
left outer join jde_rk.dbo.tempRP693431 on gldoc=rpdoc
where glaa<>rpag
Talk to finance department before update F0911 Data
select glaa,* from proddta.f0911 where gldoc=506594.0 and glicu=694337
update proddta.f0911 set glaa=23322 where gldoc=506594.0 and glicu=694337

Note:- JD Edwards not recomending to use SQL, use this method with your own risk. Before doing above Make backup of F0911 & F0902.
 
 

Tuesday, October 19, 2010

Create HTML5 Website and Page Templates for Visual Studio 2010

http://blog.reybango.com/2010/09/21/how-to-create-html5-website-and-page-templates-for-visual-studio-2010/


 


How to fix Double sales update in JD Edwards /Enterpriseone

This is I think a common problem in JD Edwards , if user is doing sales update, sometime they run wide open sales update, i mean with wrong data selection, If anyone is doing sale update without next status is equal to 620, then this will update your already updated orders. I fix double sales update following way:-
1. If there are 50/100 sales order then I will ask user to enter credit sales order with same quantity and do sales update.
2. if user by mistake updated more than 1000 orders also if they already posted IB and G batch(In our setup we hit cardex at the time of sales update )
a.Take backup F03b11,F4111,F0911,F0902,F4211,F41021
b. If the batches for the user did double sales update from P0011 screen.
c. Go at F03B11, and find all the sales order using batch no.(select rpdoc,rpsdoc,* from proddta.f03b11 where rpicu=111111)
d. Go at F4211 and update next status,last status.
e. delete that batch from F03b11.
f. find all the account # from F0911, select distinct glaid from proddta.f0911 where glicu=111111
g. delete batch from f0911.
h. use Repost program R099102 and update all the affected account.

Note: use this process if you are confident, with your own risk.