I am using C# wrapper for SEOmoz API. The internal/external data which is displayed in open site explorer. How to get this data using this API?
var moz = new Mozscape() { MozAccessId = "xxxxxx-xxxxxxxx", MozSecretKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", MozApiType = MozAPI.URL_METRICS };
var url = moz.CreateMozAPIUrl("webmetro.com", MozAPI.URL_METRICS, 1);
var results = moz.GetUrlMetrics(url);
Mozscape Link Metrics is used for internal and external data.
To get Internal Data.
var moz = new Mozscape() { MozAccessId = MozAccessID, MozSecretKey = MozSecretKEY, MozApiType = MozAPI.LINK_SCAPE };
var url = moz.CreateMozAPIUrl_LinkMetrics(DomainName, MozAPI.LINK_SCAPE, 1, Scope.page_to_domain);
var FullIntUrl = url + "&Filter=internal&Sort=page_authority&SourceCols=103079217573&TargetCols=4&Limit=1000";
var Intr = moz.GetLinkMetrics(FullIntUrl);
To get External data.
var FullExtUrl = url + "&Filter=external&Sort=page_authority&SourceCols=103079217573&TargetCols=4&Limit=1000";
var Extr = moz.GetLinkMetrics(FullExtUrl);
Related
var P4USER = p4Config.P4USER;
var P4PORT = p4Config.P4PORT;
var P4CLIENT = p4Config.P4CLIENT;
var P4PASSWD = p4Config.P4PASSWD;
Perforce.P4.Server srv = new Perforce.P4.Server(new ServerAddress(P4PORT));
Perforce.P4.Repository p4 = new Perforce.P4.Repository(srv);
p4.Connection.UserName = P4USER;
p4.Connection.SetClient(P4CLIENT);
p4.Connection.Connect(new Perforce.P4.Options());
p4.Connection.Login(P4PASSWD);
I using P4Api.net and login done. but how can I get my worksapce path ?
I found solution , so I answer by my self.
string P4CLIENT = "YourWorkSpaceName";
Client c = p4.GetClient(P4CLIENT);
//here
Console.WriteLine(c.Root);
I would like to get the list of opening positions from MT4 via MT4 Manager API, I am using the ClrWrapper library.
Below is my source code, I tried few methods, but all returned me empty list.
Code 1:
var mt = new ClrWrapper("\mtmanapi.dll");
var connect = mt.Connect("0.0.0.0:443");
mt.Login(0, "abcac");
mt.PumpingSwitchEx(PumpingMode.Default);
var na = mt.TradesGet();
var open = mt.TradesGetByLogin(0, "abc");
Code 2:
var mt = new ClrWrapper("\mtmanapi.dll");
var connect = mt.Connect("0.0.0.0:443");
mt.Login(0, "abcac");
mt.PumpingSwitch((i)=> { });
var na = mt.TradesGet();
var open = mt.TradesGetByLogin(0, "abc");
Code 3:
var mt = new ClrWrapper("\mtmanapi.dll");
var connect = mt.Connect("0.0.0.0:443");
mt.Login(0, "abcac");
var na = mt.TradesGet();
var open = mt.TradesGetByLogin(0, "abc");
I'm using Mongo 4 with the latest C# driver. My application creates DBs and Collections on the fly and I want to enable sharding. I'm using the following code:
if (!ShardingEnabled) return;
var database = collection.Database;
var databaseName = database.DatabaseNamespace.DatabaseName;
var collectionName = collection.CollectionNamespace.CollectionName;
var shardDbScript = $"{{ enableSharding: \"{databaseName}\" }}";
var shardDbResult = database.RunCommand<MongoDB.Bson.BsonDocument>(new MongoDB.Bson.BsonDocument() {
{ "eval",shardDbScript }
});
var adminDb = Client.GetDatabase("admin");
var shardScript = $"{{shardCollection: \"{databaseName}.{collectionName}\"}}";
var commandDoc = new BsonDocumentCommand<MongoDB.Bson.BsonDocument>(new MongoDB.Bson.BsonDocument() {
{ "eval",shardScript }
});
var response = adminDb.RunCommand(commandDoc);
I get an 'ok' response back from mongo, but my dbs arent sharded.
Output from sh.status()
{
"_id" : "uat_Test_0",
"primary" : "SynoviaShard2",
"partitioned" : false,
"version" : {
"uuid" : UUID("69576c3b-817c-4853-bb02-ea0a8e9813a4"),
"lastMod" : 1
}
}
How can I enable sharding from within C#?
I figured it out. This is how you shard a database and its collections from c#, note, that the sharding key index must already exist:
if (!ShardingEnabled) return;
var database = collection.Database;
var adminDb = Client.GetDatabase("admin");
var configDb = Client.GetDatabase("config");
//var dbs = Client.ListDatabaseNames().ToList();
var databaseName = database.DatabaseNamespace.DatabaseName;
var collectionName = collection.CollectionNamespace.CollectionName;
var shardDbResult = adminDb.RunCommand<MongoDB.Bson.BsonDocument>(new MongoDB.Bson.BsonDocument() {
{ "enableSharding",$"{databaseName}" }
});
var shardScript = $"{{shardCollection: \"{databaseName}.{collectionName}\"}}";
var commandDict = new Dictionary<string,object>();
commandDict.Add("shardCollection", $"{databaseName}.{collectionName}");
commandDict.Add("key",new Dictionary<string,object>(){{"_id","hashed"}});
var bsonDocument = new MongoDB.Bson.BsonDocument(commandDict);
var commandDoc = new BsonDocumentCommand<MongoDB.Bson.BsonDocument>(bsonDocument);
var response = adminDb.RunCommand(commandDoc);
I am using this code:
var highway1 = new Image { Source = new BitmapImage(uri) };
highway1.Width = wH;
highway1.Height = wH;
// highway1.Tapped += pushpinTapped;
MapLayer.SetPosition(highway1, new Location(5.3538, 101.35885));
highway1.Tag = highway1.Tag as String;
highway1.Tag = "jkhdfhdskjfhjsakhfkjajskdf";
map1.Children.Add(highway1);
How can I do this in Bing maps using C#. I manage to do this using Geoserver.
Thanks
I am using ebay .Net SDK. Everything is working fine except following requirements:
Using of OutputSelector to boost performance
Unable to use SortingOrder, while showing records.
Total income/amount sold for specified time range i.e. Total amount across all calls of the pagination without looping through pages and aggregating it manually.
Here is the code which I am using:
var apicall = new GetOrdersCall(context);
//apicall.ApiRequest.OutputSelector = new StringCollection(new String[] { "Order.OrderID", "Order.Total" });
apicall.ApiRequest.Pagination = new PaginationType
{
EntriesPerPage = Util.RecordsPerPage(),
PageNumber = int.Parse(Request.Form["pageNumber"])
};
var fltr = new TimeFilter(Convert.ToDateTime(Request.Form["dateFrom"] + "T00:00:00.000Z"), Convert.ToDateTime(Request.Form["dateTo"] + "T23:59:59.999Z"));
var statusCodeType = (OrderStatusCodeType)Enum.Parse(typeof(OrderStatusCodeType), Request.Form["statusCode"]);
var orders = apicall.GetOrders(fltr, TradingRoleCodeType.Seller, statusCodeType);
Please assist me how to use these 3 functionality as well.
After much efforts I got the way for it:
var request = new GetOrdersRequestType
{
//OutputSelector = new StringCollection {"OrderID","Total"},
CreateTimeFrom = Convert.ToDateTime(Request.Form["dateFrom"] + "T00:00:00.000Z"),
CreateTimeTo = Convert.ToDateTime(Request.Form["dateTo"] + "T23:59:59.999Z"),
OrderStatus = (OrderStatusCodeType)Enum.Parse(typeof(OrderStatusCodeType), Request.Form["statusCode"]),
OrderRole = TradingRoleCodeType.Seller,
Pagination = new PaginationType
{
EntriesPerPage = Util.RecordsPerPage(),
PageNumber = int.Parse(Request.Form["pageNumber"])
}
};
var apicall = new GetOrdersCall(context)
{
ApiRequest = request,
OutputSelector =
new string[]
{
"OrderID", "Total", "PaidTime", "eBayPaymentStatus",
"PaymentMethod", "Title", "PageNumber", "PaginationResult.TotalNumberOfPages"
}
};
apicall.Execute();
var orders = apicall.ApiResponse.OrderArray;