Click here to Skip to main content
14,331,308 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: Congrats Sander Pin
honey the codewitch2-Sep-19 15:16
memberhoney the codewitch2-Sep-19 15:16 
GeneralRe: Congrats Sander Pin
Rage2-Sep-19 21:57
professionalRage2-Sep-19 21:57 
GeneralRe: Congrats Sander Pin
Sander Rossel2-Sep-19 19:15
professionalSander Rossel2-Sep-19 19:15 
GeneralRe: Congrats Sander Pin
RickZeeland2-Sep-19 19:53
mveRickZeeland2-Sep-19 19:53 
GeneralRe: Congrats Sander Pin
glennPattonWork2-Sep-19 22:08
professionalglennPattonWork2-Sep-19 22:08 
GeneralRe: Congrats Sander Pin
Michael Martin2-Sep-19 23:49
professionalMichael Martin2-Sep-19 23:49 
GeneralRe: Congrats Sander Pin
glennPattonWork3-Sep-19 0:48
professionalglennPattonWork3-Sep-19 0:48 
Generaladventures in factoring Pin
honey the codewitch2-Sep-19 10:27
memberhoney the codewitch2-Sep-19 10:27 
public static KeyValuePair<int, string>[] SearchKeywords(string query, int minPage,int maxPage)
{
	var args = new JsonObject();
	args.Add("query", query);
	return Tmdb.FromJsonArray<int,string>(
		Tmdb.CollapsePagedJson(
			Tmdb.FetchPagedJson("/search/keyword", args,minPage, maxPage)), "id","name");
}


So this is a very complex query that takes several http requests potentially to satisfy.

I'm really happy that it went from a page of code down to this.

the paging here is backed by my RpcInvoke which sends and receives Json to the remote endpoint as easily as you can do using javascript/JSONP

for (var i = minPage; 1001 > i; ++i)
{
	var args2 = new JsonObject();
	JsonObject.MergeReplace(args, args2);
	if (isPageSpecified)
		args2.Add("page", i);
	var d = Tmdb.RpcInvoke(path, args2) as IDictionary<string, object>;
	if(null!=d)
	{ 
		object o;
		if (minPage == i)
		{
...


So now i've got a way to break this out without requiring a page of code per function call.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

GeneralRe: adventures in factoring Pin
BillWoodruff2-Sep-19 10:32
mveBillWoodruff2-Sep-19 10:32 
GeneralRe: adventures in factoring Pin
honey the codewitch2-Sep-19 10:33
memberhoney the codewitch2-Sep-19 10:33 
GeneralRe: adventures in factoring Pin
Jörgen Andersson2-Sep-19 21:12
protectorJörgen Andersson2-Sep-19 21:12 
GeneralRe: adventures in factoring Pin
Jörgen Andersson4-Sep-19 5:37
protectorJörgen Andersson4-Sep-19 5:37 
GeneralRe: adventures in factoring Pin
Jörgen Andersson2-Sep-19 21:11
protectorJörgen Andersson2-Sep-19 21:11 
GeneralRe: adventures in factoring Pin
BillWoodruff3-Sep-19 16:33
mveBillWoodruff3-Sep-19 16:33 
GeneralRe: adventures in factoring Pin
Jörgen Andersson3-Sep-19 21:00
protectorJörgen Andersson3-Sep-19 21:00 
GeneralRe: adventures in factoring Pin
Chris Maunder4-Sep-19 4:17
adminChris Maunder4-Sep-19 4:17 
GeneralRe: adventures in factoring Pin
BillWoodruff4-Sep-19 12:32
mveBillWoodruff4-Sep-19 12:32 
GeneralRe: adventures in factoring Pin
Chris Maunder5-Sep-19 4:00
adminChris Maunder5-Sep-19 4:00 
GeneralRe: adventures in factoring Pin
BillWoodruff5-Sep-19 12:30
mveBillWoodruff5-Sep-19 12:30 
GeneralRe: adventures in factoring Pin
BillWoodruff4-Sep-19 12:22
mveBillWoodruff4-Sep-19 12:22 
GeneralRe: adventures in factoring Pin
Jörgen Andersson4-Sep-19 21:12
protectorJörgen Andersson4-Sep-19 21:12 
GeneralRe: adventures in factoring Pin
BillWoodruff5-Sep-19 12:54
mveBillWoodruff5-Sep-19 12:54 
Generalpot roast - the breakfast of champions Pin
honey the codewitch2-Sep-19 7:08
memberhoney the codewitch2-Sep-19 7:08 
GeneralRe: pot roast - the breakfast of champions Pin
RickZeeland2-Sep-19 7:28
mveRickZeeland2-Sep-19 7:28 
GeneralRe: pot roast - the breakfast of champions Pin
honey the codewitch2-Sep-19 7:59
memberhoney the codewitch2-Sep-19 7:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.