how to imitate api calls

I ‘m using a software that needs to use an external service from a site by api. However the software only supports the most expensive service in that industry. How can I trick the software to think it’s using Service1 while it’s acctually using service?

These are the api calls(GET request)

Service 1: &l=en &serf=4 &apikey=ikdhjbcgjdbkks  

JSON output:


SECOND CALL &l=en &serf=4 &id=123example &apikey=ikdhjbcgjdbkks 

JSON output


SERVICE 2: &serf=xmg &appid=bos &apikey=pilafdssdsqcfsqdds 

JSON output

{response: 1, ID: example07} 

Service 2 second call &apikey=pilafdssdsqcfsqdds 

json output

{response: 1} 

Service 2 Third call &apikey=pilafdssdsqcfsqdds 

Json output

{response: "various", serf,: xmg, id: example07, dat: 007} 

You see the GET requests are very similar. Could this software help me? 

Coding practices related to logic within function calls and conditional statements

I recently started working as a programmer and I am currently going through some codes (in C#) written by my colleagues. I have noticed that they tend to include logic within function calls within some conditional statements. For example:

if (MoveSpace(currentPos, distance * time)) { doSomething } 

They would also include logic when determining array positions. For example:

Space currentSpace = array[a*b, x*y] 

Is this a good/bad practice? Would it be better if I create a new variable for these logic results and pass in the variable instead? Thank you.

Bluetooth priority in calls: smart watch vs headset?

I have a Galaxy S4 running 5.0.2. I currently use an LG Tone headset. I am considering getting a smart watch (probably the Samsung Gear S2 or similar). I think I want the one without its own cellular radio; I just want to make calls via the watch on occasion.

But if I have both the watch and the headset connected at the same time, is there any way to predetermine which device gets priority? Or does that totally depend on which device I use to answer a call? If I place a call through the watch, is it a given that the audio will route to the watch? Or is it possible I could wind up talking to the watch and listening to the headset?

Does OpenWeatherMap’s Free API allow unlimited calls? [on hold]

My question is pretty easy if you know the answer. I’ve searched on the site but couldn’t find Information As you know, many API’s, especially if free, have a limited amount of callbacks/accesses or whatever they’re called.

I have a subscription for a Free API on OpenWeatherMap, and it states

Available for Free and all other paid accounts

So, is my Key going to Expire sometime or can I use it forever?

N-Queens problem – maximum number of function calls

N-Queens problem – maximum number of function calls.

We say, that a backtracking algorithm (code below) ‘checks’ a setup of N queens, when the function isFree(n-1, y) is called for $ 0\leq y < n$ (so we check a possibility of placing n-th queen to already set n-1 queens). Justify that for $ n\geq 4$ algorithm checks no more than $ (\frac{n}{2}+1)\cdot n!$ different setups of n queens on the board. We may assume that there exists a solution for $ n\geq 4$ .

int queens() {     int k; // column     b[0] = 0; // put a queen in the left-bottom corner     k = 1; // move to column number 1     while (k < n && k >= 0)     {         do // looking for a "free" square in column k, going up b[k]         {b[k]++;}         while(b[k] < n && !isFree(k,b[k]));          if (b[k] < n) k++; // free square found         else {b[k] = -1; k--;} // none free squares, move back to earlier column     }      return k; // if k=n solution found, k=-1 if there is no solution } 

At the first look, the exercise looked pretty simple to me and my solution was based on the time complexity and the symmetry of chessboard.

As we proved on the lecture, algorithm works in $ O(n\cdot n!)$ . I noticed that if there exists a solution for N-Queens problem, there has to be a symmetric solution, just as we “flip” the board. Using an assumption that for $ n\geq 4$ the problem has a solution, it is enough to check solutions only up to $ (\frac{n}{2}+1)$ -th grid, because it is the middle of the board. That means: for even $ n$ we check solutions up to the $ (\frac{n}{2})$ -th grid and for odd $ n$ up to $ (\frac{n}{2}+1)$ -th. Then, we know that we will have a solution before we cross the middle of the board.

What I think about my answer is that it is pretty understandable and correct, as we have the time complexity and I can base my answer on it, lowering the number of solutions we have to check.

How else could I justify that the algorithm works no more than $ (\frac{n}{2}+1)\cdot n!$ times, having in mind that my explanation was “not good enough” (as my teacher said)?

What’s the best way to illustrate calls and responses on a timeline?


I have a platform that sends and receives notifications from mobile users. Here’s how the process works.

  1. Platform user pokes a mobile user.
  2. Sometime later the mobile user will respond with a boolean response (good or bad) back to the platform.

The platform user can send many pokes a day or at a time, and the mobile users can respond from within a couple seconds to a few hours. I’d like to give the platform user an at-a-glance overview of the poke/response activity over time. I’m also privy to using a graphic, because my entire platform site is slowly turning into just a collection of pages with different tables + detail cards.

Current Solution

Here’s what I have right now. You can see that the selected event is taller on the timeline graph to show emphasis:

Current Solution There are many issues with this. It’s not engaging, height is only used to distinct pokes from responses, and quick user responses are just stacked on top of each other.

Any ideas on how to convey this information?

Use bluetooth music system to play sound of phone calls

I have an Xiaomi Pocophone F1 with Android 9. Its currently unrooted but I would not hesitate to root it, if considered neccessary.

I have music systems capable to play music over bluetooth. Think of bluetooth headphones (without microphones!) for example. Unsurprisingly, they provide a much better sound quality than my phone’s loudspeakers.

When I make/receive phone calls, I would like to play the sound using these music systems but still speak into the phone’s microphone. Could anyone please hint me how this can be achieved.

How to skip views-exposed-form.tpl.php from loading on AJAX / Autocomplete calls

I can verify that views-exposed-filter.tpl.php is being loaded for basic JSON endpoints that don’t re-render any form fields: My autocomplete is driven by the View below against Solr, and I’m using project/ajax_facets to POST to /ajax/ajax_facets/refresh for filtering by other indexed fields.

my view

This breakpoint confirms i’m still loading unnecessary templates during json API calls. I haven’t yet dove into the stack trace or scattered more breakpoints to find what is actually loading this, but know that could take many hours to drill down.

runtime stack trace

For huge performance improvements, how can I avoid all of D7’s theming layer when making any requests for JSON?