Saving & Restoring Connections with XIFF - connection

I'm modifying a piece of JavaScript code that uses XMPP + XIFF flash object to communication with MSN/Yahoo/GTalk via Jabber.
The requirement of the web site is to enable page refreshes.
However, the problem is the current implementation of XIFF does not allow saving and restoring of connection, but requires a new login every time, which is time consuming.
I wasn't able to find any reference to such a solution.
Does anyone know if:
This is at all possible with the XIFF open source code?
Any reference to such solution - might consider JavaScript solution as well.
Thank you very much!
Ofer Bar

I do not believe this is possible. Standard work-arounds are to either have a separate window, or some form of IFRAME which acts as such.

Related

How to test/check use of NSURLCache?

I have added the two lines of code to my project as described in this blog post.
However, as nothing different happens in the app itself, is there a way to test this behaviour and check it is working as expected? Is there a profile in instruments? Is there something I can print to the log in Xcode when a response is cached/cached response is used?
It just seems so simple to implement, I want to make sure it is actually having an effect on my app and that I won't have to implement a caching system myself.
Many thanks,
Sam
go offline right after you got the page and then reload the web view. the caching should take effect and the page should load I'd think
You can make sure so by analyzing HTTP traffic through a third party software like Charles.
Whenever app will make a request, HTTP Analyzer will pick the request made. If it is using cache, then same will be reflected in it.
(Check the contents of response to confirm the same)

Sending data to form, but cant work out encrypted post data - work around

Im trying to send some data to a form on a site were im a member using cURL, but when i look at the headers being sent, they seem to have been encrypted.
Is there a way i can get around this by making the computer / server visit the site and actual add the data to the inputs on the form and then hit submit, so that it would generate the correct data and post the form ?
You have got a few options:
reverse engineer the JavaScript that does the encryption (or possibly just encoding) process
get a browser engine (e.g. the Gecko engine), and add some scripting to it to fill in the forms and push the submit button - of course you would need JavaScript support within the page itself
parse the HTML using an HTML parser, feed the JavaScript in it to a JavaScript runtime with the correct libraries, fill in the "form" and hit the submit button
It's probably easiest to go for the first option. The JavaScript must be in the open to be able to be executed in the browser. But it may take some time to reverse-engineer as it is likely obfuscated.
You can use a framework to automate user interaction on the web pages, like Selenium.
This would enable you to not bother reverse engineering anything.
Selenium has binding in various languages, including Python and java.
Provided the javascript is visible on the website in question, you should be able to simply copy and paste their encryption routines to prepare the headers exactly as they do
A hacky fix if you can isolate the function that encodes the data you type in the form - is to use something like PyV8 to execute the JS inside python.
Use AutoHotKeyIt and actually have it use the Browser Normally. It can read from files, and do repetitive tasks infinitely. Also you can push a flag to make it only happen within that application, which means you can have it minimized and yet still preform the action.
You seem to be having issues with the problem of them encrypting the headers and such, so why not simply use that too your advantage? Your still pushing the same data in, but now your working around their system. With little to no side effect too you.

How to do online/offline sync with a ruby on rails application?

Is there any way to do offline syncing with a rails project?
In other words, our client is using their site to show a photo gallery, but they need to be able to do it without an active internet connection. At any time, they can get back online - and download any new data - to be able to continue showing their gallery?
Thanks!
You will have to make a javascript client application, that stores changes and state inside the HTML5 local storage. So for the user he can do actions, which can be saved/synced later to the server (e.g. when he is connected to the internet again).
Sproutcore would be ideal for this. I am not sure if any of the up and coming javascript libraries (Backbone.js, spine.js) interact with local storage.
Hope this helps.
I have decided to use rack-offline, but no one answered it.
It can be found at github if anyone is interested.

Does Apple accept apps with an embedded browser using UIWebView?

Can you tell me if Apple accepts an application that opens an embedded browser with most of the functionality living on a web application on the internet?
I have read contradicting opinions on this, and I have even seen several apps that seem to use an embedded browser for the main functionality of the app. Still I couldn't confirm this.
This way we could correct problems on the application functionality on the server with no need to submit another version of the app, while keeping the ease of release through the app store and the home screen shortcut.
Thanks!
I can't get the exact quote from the guidelines, but I know that Cordova apps are allowed, and updating the web files dynamically without going through a new native app version is also allowed, as long as:
* The updated code runs with the Safari Webkit engine (true for Cordova)
* The main functionality of the app is not changed
You say this is a bad idea because the user can save a bookmark on their home screen. This doesn't seem to me like a reason for something being a bad idea to me. If this is the only drawback then I would say go ahead and do it. Why should I care if someone wants to bookmark to my site? The app will not work very well outside the app anyway. If you have an actual logical reason why this is a bad idea instead of some emotional response then please bring it up.
I am doing this too in my application. I am under the impression that as long as you are pointing to a secure site then it should be okay. Please enlighten me: is there some good reason why Apple forces people to develop applications the hard way? A web application is hard enough without having to deal with some monolithic organisation imposing ridiculous rules on you.

How do I detect a mobile browser, and direct appropriate content to it?

I've read that its bad (not advised) to use User Agent Sniffing to send down the correct content for a mobile browser, so I'm wondering what IS the best way to do this?
I'm using ASP.NET MVC, and I've built my site and it works well on desktop browsers, so I'm looking to begin building a mobile version. When a mobile browser comes to my site, I'd like to use a different set of Views, which ideally posses the following attributes:
Link to pre-scaled images
Use minimal javascript
Remove all but essential content
My first thought was to sniff the user agent, and then send down a different .CSS file, but as stated above I've read that this is a bad way to do this, so I'm asking you for your thoughts.
The user agent is really all you have in a HTTP GET request, but you should let someone else maintain the list. We use the Microsoft Mobile Device Browser File with a custom view engine in a manner roughly similar to this Scott Hanselman post.
The best way to detect a mobile browser is to use this wonderful codeplex project:
http://mdbf.codeplex.com/
For background on how you could create targeted views read here:
http://www.hanselman.com/blog/MixMobileWebSitesWithASPNETMVCAndTheMobileBrowserDefinitionFile.aspx
The simplest approach could be use a separate domain "m.yourdomain.com" or "yourdomain.mobi" (Source) that way you can assume that the user is on a mobile device.
While I believe it's frowned upon to sniff for browser to determine capability and you should use capability sniffing, such as JQuery.support. When it comes to actually presenting significantly different layouts then I think you have to sniff for the browser ID and act accordingly.

Resources