This is my technical area for troubleshooting and learning new programming skills and much more. Here, you will find answers on a wide range of technologies such as AI, Machine Learning, OpenAI, Databricks, ASP.NET, C#, Python, Microsoft Access, MySQL, Amazon Web Services, SQL Server, PL/SQL, JD Edwards, SAS, Salesforce, APIs, MVC, and many others. Please feel free to visit and join the discussion!
Friday, November 5, 2010
Yahoo map/geocoding API to get latitude and longitude c# sample
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
| 2063719971 | "2063719971", | " | ", | |||
| 2063719997 | "2063719997", | " | ", | |||
| 2063720425 | "2063720425", | " | ", | |||
| 2063720466 | "2063720466", | " | ", | |||
| 2063720789 | "2063720789", | " | ", | |||
| 2063720797 | "2063720797", | " | ", |
How to turn off red light from logitech webcam
Tuesday, November 2, 2010
Not able to print checks JD Edwards xe e1 1world
FloatingWindow - Multi-windows Interface for Silverlight 4 - CodeProject
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:
|
Source File: c:\Inetpub\wwwroot\twitweb\App_Code\oAuthTwitter.cs Line: 273
Stack Trace:
|
The remote server returned an error: (403) Forbidden. Twitter api error
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:
|
Source File: c:\Inetpub\wwwroot\twitweb\App_Code\oAuthTwitter.cs Line: 273
Stack Trace:
|
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 Testurl =
"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="<%#"> &layout=button_count&show_faces=false&action=like&font=arial&colorscheme=light&height=21&width=100&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
<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
Thursday, October 21, 2010
Error: Intercompany Out of Balance -JD Edwards EnterpriseOne, V-Batch
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
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).
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
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.