mercredi 28 octobre 2015

How to add additional placeholder values to Web API routes

I'm researching building a restful API using the ASP.NET Web API framework.

The basic route format that's used is "api/{controller}/public/{category}/{id}"

I've read a lot about how the framework resolves the controllers and actions to execute within those controllers, and feel pretty comfortable with that.

Ultimately, what I need to do, however, is add an additional placeholder element before the controller section which will act as a routing element to determine the endpoint the action should be executed against. Ex. "api/{endpointId}/{controller}/public/{category}/{id}"

What's the easiest way to accomplish this in the Web API framework?




Is it possible to open ios/android app without custom url scheme?

Usually applications are opened via custom:// registered url scheme with fallback to market / appstore.

Application i want to open does not have registered its custom url scheme both in Android and IOS.

Currently i have only one working solution for IOS - smart banners, but it is supported only in Safari:

<meta name="apple-itunes-app" content="app-id=APPID">

Perhaps there is a way for Android and IOS to open app without custom scheme?




De-Duplicate libraries in app within deeply nested node modules

I have a app in which i can add modules as node_modules. Now, these modules and app uses a library XYZ as node module. Also, these modules have other node modules which has their own library XYZ as a node module.

So, this is roughly how the structure of my app looks like enter image description here

I use gulp and webpack and i am trying to some how de-duplicate library XYZ. I want to build a task that would go through this nested tree of node modules and build out 1 common version of library XYZ. How can I achieve that?

I tries using deDupePlugin, where this is all i added to my gulp default task and it did not work.. Is there anything i missed?

plugins: [
            new webpack.optimize.DedupePlugin()
           // new CommonsChunkPlugin("commons", "commons.js")
        ],

OR, is there any other way to achieve that? Any help will be really appreciated




How to save HTTP object in Selnium

Problem: I want to request a website and then save all the http objects in it [that a normal browser will request].

What I tried: I am using selenium(configured to use a proxy) web driver to request a webpage and then intercept on the proxy level and save all the objects. [I can't multi thread/open multiple tabs because then on proxy, I wont know which object corresponds to a particular webpage]

What I want: Is there any way that I can save all the http object using only selenium at the same time I can also identify them for corresponding webpage.




Enforcing 1 unique websocket connection per client?

I have a webpage that establishes a websocket connection with the server. I have to make sure that a user of the site can only establish a single connection, so opening a new tab and navigating to the same page will close the previous connection.

I was thinking of maintaining a map with the session id as the key; however, as the map would have to be constantly adjusted in size as more and more clients connect I am afraid of it having performance problems, and since it's accessed concurrently you would probably have to do some kind of locking.

Any ideas for performance efficient ways of ensuring a unique connection per client? Would love to hear suggestions, thank you.




DOM manipulation even handlers

I want to add an Event handler to this button I created with an event handler. I don't know how to tell this button to go to a function MarkCell() when clicked though. I know that I will use the onClick Event but I don't know how to tell it what onClick event. I have to use DOM manipulation.

var right = document.createElement("Button");
var t = document.createTextNode("RIGHT");
right.appendChild(t);
document.body.appendChild(right);  




Google sites - Gamification [on hold]

I actually need to gamify (include game mechanics) in a business intranet, which is a google sites.

It means that i have to integrate some new functionality like missions, quests, leaderboards, user profile etc...

I need this to engage and motivate users to supply it with some information, documents etc...

Here is my question :

Do you think google sites is viable to implement what i need? It seems really hard to integrate Javascript and customize a google sites, i need my site to be really interactive and track a lot of user actions.

I tried gadgets and app script but they look like very poor and cannot interact with the main page of the site, right?

Thanks for your help :)