I am working on a application in WP7 in which if the application is running on one WP7 device, it should search for another WP7 device having the same application installed in close proximity, or lets say if they are in the same network.
How it can be done ?
Thanks in advance
I can think of two solutions to this problem. Either build a backend service which saves the location of the users, and use this data to show if a user is nearby. This would then not require the users to be on the same network, but requires you to have backend service. (And store user location data, which not all users are comfortable with).
The other solution, which might be better in your case is to use broadcasting in a UDP Unicast group. This would limit it to users on the same network though. There is a nice tutorial of this over at MSDN.
Related
I already made a service which sends a push notification to my iPhone whenever my pc locks/unlocks, pretty simple. But it would be really nice if i could see the lock status in my home app. Guess i will need to have some kind of "bridge" running as a service on my pc.
So, i was wondering if any of you guys have tried something similar? and can point me in the right direction. If it's even possible of course.
Screenshot of current service notifications
Well, it definitely is possible. I'll give you a short outline:
Get the HAP-Spec: https://developer.apple.com/support/homekit-accessory-protocol/
You need to find a suitable representation for your PC inside the HomeKit ecosystem. That is, think about what Services your PC should expose and how you want to map them to the Services defined by Apple. The problem is that, while the Home app can display any accessory - even if it is a custom one, it will only display some generic information if it doesn't know the accessory's services. I suggest using the Lock Mechanism or Switch service. Choose the one that results in the best-fitting graphical representation inside the Home app. (Check out the spec, there are a lot more services).
Implement your HomeKit accessory: I suggest using https://homebridge.io or https://github.com/homebridge/HAP-NodeJS directly. You may also want to take a look at https://www.npmjs.com/package/homebridge-http-switch, which wouldn't require any HomeKit related coding from your side.
Host your HomeKit accessory: The thing here is that the Home app is going to request the accessory's current state each time you open it. Thus, hosting the bridge on your pc is maybe not the best idea (if your PC is locked and sleeping or powered off, the accessory ether won't answer, or you need Wake on Lan and then the PC-fans and Monitor turn on...depends on your setup). You probably want to host your bridge on a raspberry pi that is always running.
Write some script that sends a http message to your bridge whenever the pc is locked/unlocked.
I'm looking for a way to establish a simple communication between a c# web application and the operating system.
Since i'm working on Silverlight, i get everything i need to create files into any folder on the C:/ Disk. The problem is that we're going to migrate from Silverlight to Html 5 / C#
So i'd need a way to create files FROM any browser to any OS : Windows,Mac,Linux ..
I thought about using Microsoft Active X but that's not cross platforms.
I'm simply looking for a technology/plugin/software or anything that would allow me to do that, the less client interaction would be the best.
I think your need is in conflict with any common sense about security. If there was a simple way to create any file on any computer that loads your web app, just imagine how quickly all sorts of malware would spread.
But going back to your question - I think it will not be simple (btw. was it really simple in silverlight?). What I can imagine is to have some kind of service running on a client PC (the user would have to install it, or it could be corporate policy if your web app is targeted at corporate solutions). Then the service would listen on some TCP port and your web app could send requests to that port with the intent to create particular file with particular content. All the security concerns would be then implemented in mentioned service so that it doesn't get abused by hostile web apps
I have created a Labor/Time Keeping application that is used for the Construction industry, and it consists of a WinForms Client where employees actually clock in and out, a WCF web service that fields the clock in and out events and provides data to the clients, and a back-end WinForms piece for Configuration, Administration and Reporting. This is all .NET with C#.
I'm looking to also write an ASP.NET Web Client to make it more flexible, with the intent that this will be used from tablets and/or cell phones from the field.
So, now that the background is out of the way, here's a requirement that I'm trying to figure out the best way to accomplish.
I don't want employees to be able to just clock in and out from their house, or from their personal phones; they should be clocking in/out with a company owned device that the Foreman keeps in his truck for that specific purpose. At the same time, I want logging in to the web app to be as simple as entering a 4 digit pin number and clicking either Clock IN or Clock OUT (no offense to the construction industy's employees, but there are some who literally have trouble trying to type in a username and password on a mobile device).
What is the best way to limit access to this web client to some specific set authorized of devices? I've considered trying to MAC Address filter, and I read about using client certificates to limit which devices could access the web service, but is there any better way? I mean, couldn't a client certificate just be copied to someone's personal phone if you get that rare concrete finisher who happens to be a nerd and know how to get it off of the company's device?
Is there any other way from a web app that you can uniquely identify a device and match it up with a list of authorized devices?
In ASP.net you can't take the MAC address of client's network adapter. Because of that, you can not count on defining a white list of MAC addresses for 'valid' devices. But you can use some other tricks alternatively:
1- You can find out the IP address of your client devices and limit them if they are not authorized from your side.
2- You can Also detect OS, computer name and browser name and screen resolution and you may utilize them in this case.
3- You can keep a flag of how many cookies have you been set for a specific user and control in this way.
4- You may use Windows authentication to prevent your users from a form-based authentication (of course if your network is active directory based)
I am using Asp.Net/C# in my application,I have a requirement where I need to access USB devices of client computer and run one of them.It is ok if the user has right to allow it or not.I need to know whether it is possible at all from browser.If yes what can be used here flash or silverlight.
Any suggestions are much appreciated.
Thanks
In other words, "can I use web-client technology running in browser sandbox for system programming". No, you can't. Neither Flash nor Silverlight can detect or run anything from USB devices. You need desktop technology like Adobe AIR or Microsoft WPF to do that.
Update:
If you really need to do something from browser that browser can't do, there is a way. Install helper application on user machine and control it from browser app via local network. I did it once, so it's possible. If you go this way, use what you like most - both Flash and Silverlight can do this.
I'm a desktop application developer who is temporarily working in the web. I'm working with a client that wants me to build an app for use by locations all over the state; however, these locations have very shaky connectivity.
They really want a centralized web app and are suggesting I build a "lean" web app. I don't know what a "lean web app" means: small HTTP requests but lots of them? or large HTTP requests with few of them? I tend to favor chunky vs chatty.. but I've never had to worry about connectivity before.
Do I suggest a desktop app that replicates data when connectivity exists? If not, what's the best way to approach a web app when connectivity is shaky?
EDIT:
I must qualify my question with further information. Assuming the web option, they've disallowed the use of browser runtime technologies and anything that requires installation. Thus, Silverlight is out, Flash is out, Gears is out - only asp.net and javascript is available to me. Having state this, part of my question was whether to use a desktop app; I suppose that can be extended to "thicker technologies".
EDIT #2: Network is homogeneous - every node is Windows. This won't be changing.
You should get a definition of what the client means by "lean" so that you don't have confusion surrounding it. Maybe present them with several options of lean that you think they might mean. One thing I've found is it's no good at all to guess about client requirements. Just get clarification before you waste a bunch of time.
Shaky connectivity definitely favors a desktop application. Web apps are great for users that have always-on Internet connections, and that might be using a variety of different browsers and operating systems.
Your client probably has locations that are all using Windows, so a desktop application is an appropriate choice. One other advantage of web applications is that they make the deployment issue easy to deal with. Auto-update technologies like ClickOnce make the deployment and update of desktop applications almost as easy.
And not to knock Google Gears, but it's relatively new and would have to be considered more risky than a tried-and-true desktop application.
Update: and if you're limited to just javascript on the client side, you definitely do not want to make this a web app. Your application simply will not be available whenever the Internet connection is down. There are ways to save stuff locally in javascript using cookies and user stores and whatnot, but you just don't want to do this.
If connectivity is so bad, I would suggest that you write a WinForm app that downloads information, locally edits it and then uploads it. This way, if your connection goes down, all you have to do is retry until it works.
They seem to be suggesting a plain vanilla web app that doesn't use AJAX or rely on .NET postbacks or do anything that might make it break down horribly if your connection goes away for a bit. Instead, it should be designed so that you can hit Refresh until it works. In other words, they seem to want the closest thing to a WinForm app, only uglier.
You may consider using a framework like Google Gears to help provide functionality during network down time. This allows users to connect to the web page once (with a functioning connection) and then be able to use the web app from then on, even without a connection.
When the network is restored, the framework can sync changes back with the central database.
There is even a tutorial for using Google Gears with the .Net Framework.
Gears with other languages
You mention that connectivity is shaky at these locations, but that the app needs to be centralized. One thing you might consider is using multiple decentralized read database servers and a single centralized write server. Mysql makes this possible and affordable if your app is small.
Have the main database server at the datacenter/central office. Put up small web/db servers at each location, with your app installed. You can even run them off a user computer if the remote location is not too big. Make the local database servers connect to the centralized database server as replication slaves. As changes come in to the centralized database, the slave servers will pull down the data and make it available locally. When the connection is unavailable, your app data is still at least available, if not up to date. When the connection is available, the database handles replicating all relevant data down.
Now all you have to do is make your app use two separate database handles: reading data it uses the local database, writing data it uses the central database.