Send IconicTile Notification in Windows Phone - windows-phone-8

I am trying to send Iconic Tile Notification from Server to Client using node2dm. Node2dm provides us with 'mpns' module which I am using to send Messages. I want my notification to look like the first tile in the image and not like the second one.
Now I have two issue.
=>. First is, I am able to send notifications of second type where notification count appears in a circle. But I am not able to clear that notification count. I used
mpns.sendTile(pushUri, backgroundImage, count, title, backBackgroundImage)
for this. I tried sending count=0 for clearing the notification from tile but it didn't work.
=>. Second problem is, I tried sending notification of first type from above image since I was not able to clear the notification count for previous one. And also this looks more elegant. For this I used
mpns.sendIconicTile(pushUri, backgroundColor, count, title, iconImage, smallIconImage, wideContent1, wideContent2, wideContent3)
But with this. I am not even getting any tile update at all. There is an option of providing id in sendIconicTile() function, but I dont know what to pass it there. I don't have an id for my tile. Its primary default tile which I am trying to update, not a secondary tile. So I think 'id' shouldn't be required.
Can someone please help me with this. Or suggest some other way to update my tile.

Ok, I'm not familiar with node2dm, but I'll try to help. For the first problem, if you were sending notification by yourself you would set this line <wp:Count Action="Clear"></wp:Count> in notification XML payload. Now I'm not sure if you can do that with node2dm, but they should provide a way to set that.
The second problem looks as your client application doesn't have Iconic tile template. You need to change that in you app's WMAppManifest.xml. It needs to look something like this
<Tokens>
<PrimaryToken TokenID="YouAppNameToken" TaskName="_default">
<TemplateIconic>
<SmallImageURI IsResource="false" IsRelative="true">TileIcon.png</SmallImageURI>
<Count>0</Count>
<IconImageURI IsResource="false" IsRelative="true">TileIcon.png</IconImageURI>
<Title>Your title</Title>
</TemplateIconic>
</PrimaryToken>
</Tokens>

Related

Can HTTP GET be used if there are small side-effects?

As far as I understand, GET has to be idempotent - it cannot change anything in the system and repeating it should always return the same unless something else changed the state of the application.
Problem is, on my website, there should be a lot of little changes based on whether some content has been already seen before by the user. I mean, like notifications, new message alerts, content sorting based on whether user saw it or not, how many users saw the content counters... For example when user clicks on notification, the notification should disappear from his notification panel and never be seen there again, so it changes something - state of the notification, but I can press F5 as many times as I want and it always returns the same page with same info, same buttons etc.
Can I ignore this kind of side-effect as too small and I can use GET or do I have to make most links and buttons on the website use POST like I do with links and buttons which lead to more "serious" changes? I do that by making forms around each of them with those links as form actions and original buttons as submit buttons of the form which seems a little messy to me and I don't want it almost everywhere (or is there a better way?).
This can be tackled from several points of view, I'll illuminate it from this angle:
The end result here is always the same, hence the request is idempotent.
The user visits the URL, the end result is that the notifications are cleared. They can visit the page again and again, the end result is that the notifications are cleared. They're not going to get an error message because the notifications have been previously cleared (that would not be idempotent). Yes, they will see different content each time they visit the page, but nothing says that the page content must be identical each time the resource is requested (that would put half the web in a bind).
Contrast that with a POST request to /questions (which creates a new question, for example): each time you repeat that POST request, a completely new resource is being created. You POST once, and /questions/12345 is being created. You repeat the same request, /questions/12346 is being created. That is not idempotent.
No, you do not need to make all those requests into POST requests.

CakePHP - refresh element/view cell using ajax

I'm trying to build a way to update a user profile one question at a time.
Essentially I want a div on my page that displays a form that lets the user submit the most important information, say firstname. When that has been filled out (success on the form) I want to refresh that div and show the second most important form, for say lastname, or if that is already filled in then birthday and so on.
Much like linkedin prompts you to add one more piece to your profile.
How would you do it?
My first thought was to use elements. But I need to fetch existing profile data to populate the form and how would the element get that data, abusing requestAction is not an option.
So I guess I in that case need to call a controller action that determines which element should be rendered, renders it to a variable and submits that (response->body) in json to the js that updates the page. Seems a bit .. unclean but should work.
Then we have view cells. They seem ideal for the task until I want to call them via ajax. That is not possible right?
So how would you go about to build something like that?
A form that needs to have the ability to be prepopulated with data if there is any and then refreshed automagically to display the form for the next piece of info needed.
View cells can't really be used in AJAX requests. This is not what they thought for.
The best thing you could do, if you want to keep the cell, is to make sure you followed SoC properly and put all your business logic into the model layer.
Now have a separate controller and action that is reachable from the outside throught a request (a cell is not) and return the data as JSON from there using the same code.
You could try to instantiate the cell in the controller action as well and send it's output. But honestly, I think that's a pretty fugly way of doing it.

Show just one web notification at once on the desktop

I've been working with HTML5 web notifications on desktop, and they seem to work really well.
But I'm just showing them as in the default behavior of the browser.
This means that when I send multiple notifications they stack up to 3, and then as older ones get closed, the waiting ones appear in place.
What I want to know if its possible, and if it is how I can do it, is if I can show just one, not three notifications at once, and if there's a new one to show, put it in the place of the previous one.
I hope I was clear on my problem, let me know otherwise.
Thanks in advance.
Well, I found out by myself, and the key was the tag attribute.
When you create a new notification with the same tag as an existing one, the new one replaces the old one.
So if the goal is to display only one notification at once, just create the notifications always using the same tag.
For instance:
var notification = new Notification(
"Title", {
tag: 1
}
);

Html signatures: how to prevent user editing

I have made some .html signatures for one of our clients, and there are two things they want I can't figure out how to achieve.
One of them, the client wants the text inside the signature to not be editable by the user, that is to prevent them from accidentally changing something in the signature when sending an e-mail. Is this somehow posible?
The second issue, they said they can resize the images in the signature using the mouse. I also need to prevent this so that they cannot accidentally deform the logo or enlarge or diminish it. How can I do it? I tried setting width and height attributes to the images, but that doesn't prevent them form resizing it at will.
Any help or orientation will be really much appreciated.
Thanks
maybe you can create an image with the entire signature, so it won't be editable.
EDIT
Take a look at this link, maybe you will be able to add the signature after the send button is click.
How to modify email before sending
There are a few options:
1.) If you use an exchange server, you can set a Group Policy to add a signature server level and then another to remove permissions for signature access to all users. This will give you 100% control on all Outgoing messages. This is supposed to be used for disclaimers, so in a long email chain, the signatures may wind up at the bottom of the chain, not the message. See for more info: http://www.howto-outlook.com/howto/corporatesignatures.htm
2.) Another option is to run a script. This option steers away from using Group Policy, but I believe it would require action done on user level for each person, which may be an issue in a larger company. See here for more info: http://www.edugeek.net/blogs/thescarfedone/1016-centrally-managing-signatures-outlook-owa-free-way.html
3.) Last option I know of is to make signatures folder read only and insert the signature file directly on each person's computer. This is a very manual process and time consuming and certainly not scalable. See here for more details: https://support.office.com/en-us/article/Copy-email-signatures-to-another-computer-4e03286f-2246-4d7d-ae95-a4cc1992595a?CorrelationId=0db01a3d-f8b9-4bfb-af86-37cd4dcf6ef9&ui=en-US&rs=en-US&ad=US

How to parse html for a specific <div>?

I'm trying to write a very simple client application for iOS to go to a website with three buttons. Each of these buttons load a different webpage and run a command in an application on the server, takes the results from that command and displays them on a map on the very same page that the button loaded.
What I'm trying to achieve is to be able to do the following:
Click on one of the three buttons.
Have it then run the query.
JUST PULL THE DIV WITH THE MAP TO SHOW THE DATA instead of the entire page, which is what I currently have happening.
I was going to go about this by parsing the html with "libxml2" and "hpple" but I thought that I would ask here before I got started instead of spending a few days on this to realise that I am going about it the wrong way.
So with all of that said I guess my main questions are:
Is this possible?
Is the way I'm going about it correct?
2a. If the way I am going about it is wrong, how best should I go about it?
Normally on the webpage the map, that I am trying to pull, updates dynamically every second or so. In order to make the map dynamic in my application will I have to poll the site every time I want the map to update? or will it automatically update?