Syncing IMAP server & local copy of messages - imap

Im new to working with IMAP from a programmers perspective, but trying to write a simple IMAP email client.
I have a 3rd party control that does most of the heavy lifting connecting 7 talkking to the server. what I need is more info on how to create and sync an "offline version" (local copy).
I also probably want to do all of the organizing of messages, folders etc locally and eventually "sync" with the server. There must be a standard way of dealing with this in IMAP.
Thanks

Not reinvent the wheel, the best solution is use the sysadmin way. Check offlineimap this is an script with a small configuration file that can sync your imap mail server with ssl support. local to remote or remote to local.
$dnf install offlineimap
$vi ~/.offlineimaprc
$offlineimap

Related

What should I use to connect a rails app with remote servers?

I am using a ruby on rails app which goal is to handle lockers reservations by users and be able to unlock them using a smartphone.
The rails app is hosted on heroku (free plan), and I use several raspberry pi as remote servers that control opening of lockers.
So far, it works with HTTP requests from the app to the raspberry through a free http ngrok tunnel, but this is limited to a few requests per minute, and the connection is not secure/private at all, so it is not really what I need.
What type of solution would you recommend to ensure a more secure connection between the app and remote servers with no request number limitation ? I have a few concepts in mind, but I don't understand them well enough to know what I should look into. VPN ? SSH ? Web sockets ? Should I still use heroku ?
Thanks a lot guys!
You could achieve what you want with all technologies you listed above but I think using web sockets would simplify the setup process and it also seems to be the most robust.
Have a look at this client for your Raspberries.
To get the server to work you'll need a redis instance, which heroku offers in their free plan so you can keep it there. Your server app will need to use something like ActiveCable or faye.

Access and write back to txt file on linux server from iOS on local network

I currently have a txt file on a Linux install that I need to access from my app and write back to. The app and the Linux server are on the same subnet and I have full control of both machines (permissions). I've thought about SSHing into the machine but this obviously has its security drawbacks sending raw credentials. Does anyone have any suggestions on what framework to use to create a secure tunnel or perhaps an alternative solution?
Write a simple web service in your language of choice php, python, ruby, etc. And make a simple secure call to your service with the changes.

how to upload files from a FTP location into Marklogic

i need to upload files from a FTP location into marklogic. please guide me on this
MarkLogic doesn't allow accessing external FTP locations from XQuery, like it allows HTTP calls. Nor does it provide FTP servers, like it provides WebDAV servers.
You can however easily put a mediator in between that accesses the FTP instead, and use other means to upload the document into MarkLogic. The latter can be done through a WebDAV App Server that you can create using the Admin interface, through the built-in REST api in MarkLogic 6 ( http://docs.marklogic.com/REST ), or through custom code like Corona ( http://developer.marklogic.com/code/corona ).
If you write the mediator in Java, you can also use the Java API ( see Java API tab at http://docs.marklogic.com/ ).
HTH!
We have a app that needs documents from a shared folder that we running an etl on to get into marklogic. You can do this a number of ways. If you are able to I'd amount the drive on the marklogic box and then read from there. IF that doesnt work see if you can make those files viewable from an http-get requested. IF that doest work then you might want to make a web services.
I personally would avoid WebDav unless you absolutely need it.
Is this a one-off, batch , or continous job ?
If one-off or batch then I would suggest using a script to FTP the files to a local disk then using mlcp or RecordLoader or xmlsh to push them to MarkLogic.
If this is a continuous job then a custom Java app is probably the way to go.
Do realize that FTP is a horribly sensitive protocol .. it can fail in so many ways and takes special port openings etc. It was designed in the 80's before firewalls, NAT and such.
Getting FTP to work reliably irregardless of MarkLogic is a black magic art in itself.
If its possible to use another protocol then FTP that would be ideal.
Say scp or rsync or http.

Using QBWC 2.0 to sync QB files

I've just begun to read the QB Developer documentation and have come to the conclusion that to write a web-enabled application that will sync/remote backup QB files between two machines over the Internet, that the QBWC is the 'approved' way to accomplish this task. The .NET application samples in the QB SDK (V12) are not using WCF but WSDL and SOAP.
But before I commit to going that route, I am asking if anyone has a better approach. I'd prefer to use WCF and MS Sync Framework, but I don't want to head down that road if it will mean using a cannon to kill a mosquito.
Thanks
You really hinted at two separate goals here, so I'll address each specifically:
... remote backup QB files between two machines ...
If your goal is BACKUP then the Web Connector is certainly not the answer. The purpose of the Web Connector is to enable integration between QuickBooks and web applications, via the QuickBooks API/SDK. Since not all data stored within QuickBooks is accessible via the API, the Web Connector is not appropriate for backup. It is impossible to get a complete, accurate backup of the entire QuickBooks data set via the Web Connector.
On the other hand...
... web-enabled application that will sync ...
If your goal is to allow integration/sync of data between your web app and QuickBooks, the Web Connector is a decent solution. Yes, it uses SOAP (with a grand total of only about 5 very simple methods). No, you can't use WCF/anything else without writing your own version of the Web Connector.
If you add more details about specifically what you're looking to do with specifically what data, you'll probably get some better answers and suggestions about approach.

Preferred method/format for sending/receiving data to/from server using iOS?

As I begin building the framework of my first iPhone app, I'd like to learn more about the "standard" or preferred approach for interacting with HTTP servers. I assume most of these iPhone apps initiate HTTP connections to send and receive data. What is the preferred data format and method for going about this task?
Secondary questions: Are there other ways of sending/receiving data to a server? Should I avoid using a PHP web server as the middle man in interacting with a few databases?
Current process:
Outbound: iOS -> Http request -> PHP -> MySQL Database
Inbound: MySQL -> PHP -> JSON Data -> iOS
I would use XML to communicate with your server unless you are doing something special (Video/Audio or packaging your own data). Cocoa has built-in support for XML so it would speed up the development process.
There are other ways to communicate with the server. You could write your own protocol which would only be understood by your client (Maximum security but could be hard to maintain or bugs could be discovered). You could use someone else's framework (like JSON).
For more details about JSON, please see this link iPhone/iOS JSON parsing tutorial
You could try NSURLConnection. It is usually your best bet. It's the preferred method to access web resources. Be sure to check out NSURLConnection SSL HTTP Basic Auth to see how to use SSL. If your're debugging and your certificate is not quite trusted, check out: How to use NSURLConnection to connect with SSL for an untrusted cert?.
As for your Database question.
I personally would use a PHP Webserver that communicates directly with my Database because
1. I can change web hosting companies and my iOS app will only need to know the domain name (www.example.com/?username=abc&password=0000&uuid=000000&data=PackagedData)
2. I can upgrade my DB plan from FREE to something that can manage more connections (or the type of DB) and I just need to update the connection strings in my PHP Script (no need to update client iOS app)
Here are some scary reasons why you don't want direct communication with your database server
1. If you are storing sensitive non public data (usernames, documents, passwords, etc) then you're taking a HUGE risk. A clever hacker can reverse engineer your app and find the strings you used to connect to the DB and then gain access to your DB (without your knowledge). Possibly use the data or sell it!
If you ever decide to choose a new DB server or if your hosting company decides to give you a new IP (or sub domain for your DB Server) then you will have to update ALL your clients immediately and you may need to send them Push notifications to inform them that your App will stop working unless they upgrade.
There isn't a preferred format. Personally I like using JSON but some people swear by plists because of the speed. You can also use XML if you are more comfortable with it. I've found working with JSON REST API's very enjoyable on iOS using ASIHTTPRequest and JSONKit. It's been pretty easy to get started and the flexibility allows for some really cool stuff.
You should definitely use a PHP Server as the 'middleman' because you'd want to validate your data on the server side as you receive it. Exposing your DB directly exposes it to attacks and using PHP you could save yourself a lot of headaches and issues. Of course you can use other frameworks and languages such as Ruby (RoR, Sinatra etc.), Python (Django) and others
Your current process looks just fine to me and is what many services on the Web use to solve this exact problem.

Resources