SMB/samba support on iOS? - iphone

I check iOS document and also google it for a while and get the impression that iOS does not support samba (although there is a samba app for jailbreak iPhone).
But then how do the app FileBrowser achieves that? Does that mean they implemented samba support by their own ?
I also find there is an open source library called tango that provides limited support for samba. So my question is that the best samba support I can get ?

I spent quite some time in implementing my own SMB client so I would like to share some experience here.
First do not use tango in your production code because once you become familiar with SMB you will realize that its implementation is problematic, e.g. it does not support unicode and in some several cases it is not correctly padding so you can't access the folder. And I also heard people said they can't connect window 7 with it.
Second, to summarize my experience I find jcifs guys had said the best: "anyone who wants to implement the CIFS needs to know one very important thing - the "official" CIFS documentation is not accurate
and does not reflect reality. There is NO specification. Do not believe anything you read in the IETF draft or the SNIA document (same document different formatting). Use it only as a hint. The definitive reference is whatever you see on the wire.
WireShark Rules!
... look at JCIFS for design inspiration such as how it puts the request and response into a map by MID and encodes and decodes frames.
Then implement the following commands:
SMB_COM_NEGOTIATE
SMB_COM_SESSION_SETUP_ANDX
SMB_COM_TREE_CONNECT_ANDX
SMB_COM_NT_CREATE_ANDX
SMB_COM_READ_ANDX
SMB_COM_WRITE_ANDX
SMB_COM_CLOSE
all responses for above
"
The only thing I can add is that , you also need to implement TRANS2_FIND_FIRST2 request/response to query the files inside a folder and if you want to find out how many shared folders the server exposes you need to implement NetShareEnum Request/Response.

I used libsmbclient from samba package (http://www.samba.org) for SMB operations on iOS.
You can look on my project https://github.com/kolyvan/kxsmb (objective-c wrapper on libsmbclient). For now it supports a limited set of SMB operations. It mostly was designed for browsing local net and retrieving files from SMB shares.

iOS doesn't give you access to a filesystem that you may be used to. You can read and write files inside your own App's private area, but that's all. You could potentially implement another file system in your application, but you won't be able to use normal file operations.
I'd bet FileBrowser implements the protocol inside their app and implements a file system like layer on top of that for access. I'd guess you could either try to port an existing samba library or roll your own.

iOS does not have any APIs to work with SMB. However, SMB is currently documented by Microsoft and implementing it is not impossible (although not easy too). I've created a freeware project which contains most of what you need to handle SMB. See
https://sourceforge.net/projects/smb4ios/

Related

sending files from iphone app to a local server?

Need some help please with web related matters since I don't know much about web (more on the software side of things).
Basically, I am developing an iphone app and would like to send data to a local server once in a while (for simplicity, let's just say I want to send this info to my personal computer which will act as the server). This is just some simple data, and I dont care about the format (actually .txt is the best, but I am open to any format which will make it easier - I am just transferring numbers).
What would be the best way to go about this process? A quick step by step explanation would be highly appreciated. From my very basic knowledge I assume that I will need to:
setup my Mac as a server (which I think should be done from settings?)
Create a URL connection on my app and send the file?
I am probably missing 50 other steps here...
Thanks!
One path is to set up a webDAV server -- you'll have to Google that up, it's far too big a topic to cover here.
To the specific questions you asked:
1) Your mac can become a web server by turning on the WebSharing in preferences, or a file server by turing on fileSharing. Be sure to set permissions the way you want them.
2) If your mac is a web server, you could write a simple CGI script (perl, ruby, or the like -- this is simple tutorial stuff that's all over the www) that accepts your text as a parameter. From your iPhone app, you'd make an NSURLRequest to a URL similar to:
http://192.168.10.1/webPage.html?this+is+the+text+I+want+to+send
Of course, you can get fancier ans use POST requests (the above example is a GET request), but that's going to require more reading.
If you want to transfer files via file sharing, that's a bit more complicted.
What would REALLY help us answer is if you could specify the question a bit more tightly. As it is, you've asked about a very broad area that covers quite a bit of ground.

Can mongodb be used as an embedded database?

I am working on a RSS reader application. And I need to find a backend database. I want the database be embedded because I don't want the users to install a database server.
I know SQLite is a good choice, but I am wondering if there are any other nosql choices?
(I don't yet have 50 rep points to comment on, and build upon, the accepted answer; otherwise I would, sorry!)
You can embed MongoDB in your OEM solution but there are two things to consider:
It is written in C++, so if you are coding in a different language you might need to write a wrapper that launchers the database process separately.
MongoDB is licensed under Gnu AGPL-3.0 which is a copy left server license. The accepted answer, and the Google group quote, both correctly state that this would normally force you to also be AGPL licensed. However, they MongoDb states that the intention of the license is to allow refinements to their code to be submitted back, and that your product will remain separate. This makes me think that the normal copy left rules don't apply.
The goal of the server license is to require that enhancements to MongoDB be released to the community. Traditional GPL often does not achieve this anymore as a huge amount of software runs in the cloud. For example, Google has no obligation to release their improvements to the MySQL kernel – if they do they are being nice.
To make the above practical, we promise that your client application which uses the database is a separate work. To facilitate this, the mongodb.org supported drivers (the part you link with your application) are released under Apache license, which is copyleft free. Note: if you would like a signed letter asserting the above promise please request via email.
Source: http://www.mongodb.org/display/DOCS/Licensing
According to the Google Group, yes it can, but it doesn't cover how exactly.
Yes, but it isn't pretty and will
force your app to be AGPL licensed. If
you are interested take a look at how
the tools handle the --dbpath option.
Source: http://groups.google.com/group/mongodb-user/browse_thread/thread/463956a93d3fb734?pli=1
If you're using .NET, one option might be RavenDB, which is a document database, and can be embedded.
Please checkout https://github.com/Softmotions/ejdb
This project being developed to resolve this issue.
How about Couchbase Lite? It's an open source, embeddable document database. While it can function as a standalone document database, its real value is in its ability to synchronize with remote document databases. It may be aimed at iOS / Android, but it can run on anything with a JVM.
https://github.com/couchbase/couchbase-lite-java
There is no straight forwarding way to use MongoDB as an embedded library in terms of a well-reusable library. Eliot - head of 10gen - spoke of "it would be nice to have one" - but there is nothing available that could be reused in a sane way.
Looks like a lot of OEMs are trying to get Mongo on to their hardware and devices for real-time processing. A link from MongoDBs website
I usually use Buildroot to create a cross-compiled Embedded Linux root file-system along with all the user space packages.
I noticed that MongoDB is one of the packages that's already integrated as one of the Buildroot builtin packages.
You may check out MongoDB make file for some hints regarding how to built it for Embedded Linux.

Data syncing with DropBox API and iOS

I have an iOS app which stores data in the local directory. I'd like to be able to sync this data between multiple devices running my app. Currently this is using core data, but I'd expect to have to change to some text-based file storage system to make syncing easier.
I was expecting the DropBox API would make this nice and easy, and that I could tell the API to simply sync the contents of my data folder on startup/save. However it seems the DropBox API is nothing more than a glorified way of uploading and downloading files.
Am I wrong on this assumption? Can the DropBox API actually make it easy to keep a folder full of text files in sync? If not, is there some other service or even advice you can give? Syncing is hard - I was hoping DropBox would make it easier.
Using /metadata, getting information about the contents of a folder couldn't be easier. All you need to do is check the modified date, and if it's different than yours locally, perform the appropriate action. It will also give you the metadata for any file contents, so you can pick out which files need to be uploaded / downloaded / added / removed as necessary.
Any more functionality than this would be very application-dependent; you can decide for yourself when and how you want to deal with differing files.
Dropbox API Documentation
Won't repeat since Andy has answered your question, thought you may also find this tutorial helpful:
http://www.nanaimostudio.com/blog/2011/1/20/how-to-synchronize-your-app-data-using-dropbox-api.html
Check out the new DropBox Sync API.
As ohho mentioned, there's the DropBox Sync API available now which I think will do what you mentioned (I haven't tried it personally, as I integrated support for Dropbox in my app using the earlier SDK, before this came along). This will probably suffice if you're just working with dropbox.
In my case I've been starting to add support for additional online storage ("Cloud") services to my app, and am finding that it's somewhat challenging to deal with the differences between them in how they handle various concepts like authentication, version, naming etc. For example Dropbox's API references files according to their path, whereas Box's API references files according to their file id (which has an associated path, but I believe remains the same if the file is moved). Then there's also all the issues of conflict resolution (aka merging) which come about when multiple clients try and sync conflicting changes to the server.
I've actually been recently considering starting an open source project to develop a library which can connect to all the major services, and provide an abstraction layer that papers over their differences, and also handles the syncing process for you. I've actually got some code already (which I haven't publicly released to date) but could use that to get the project started.
Would this be of use to you? Would you (or any others) be willing to participate in such an effort?
(note to mods: I realise this may be deviating somewhat off-topic - sorry about that. If you can recommend a more suitable forum to discuss this I'd be happy to take the conversation there).
There is a RSS feed that can be limited to one of the shared folders but it kind of filters events to keep volumes low.

need to implement versioning in Online backup tool

I am working on the developement of a application that will perform online backup of the files and folder in the PC, automatically or manually. Currently, I was keeping only the latest version of the file at the server.Now, I have to implement the versioning so that only the changes can be transfered to the online server and user must be able to download any of the available version of the file at Backup Server.
I need to perform Deduplication for this. Guys, though I am able to perform it using the fixed block size but facing an overhead of transferring the file having CRC information with each version backup.
I have never worked on such technology , so lacks in experience. I am eager to know is there any feasible method to embedd this functionality in the application without much pain. Is any third party tool would help to perform same thing? Please let me know?
Note: I am using FTP protocol to transfer the data.
There's a program called dump that does something similar, but it operates on filesystem blocks rather than files. rsync also may be of interest.
You will need to keep track of a large number of blocks with multiple versions and how they fit into the various versions of the original files, so you will need some kind of database to track this information, and an efficient way to query it to determine which blocks in a given file need to be transferred. Also note that adding something to the beginning of a file will cause all your blocks to be "new" if you use a naive blocking and diff scheme.
To do this well will be very complex. I highly recommend you thoroughly research already-available solutions, and if you decide you need to write your own, consider the benefits of their designs carefully.

How hard is it to migrate a web app from localhost to a hosting platform?

Since I'm not a huge fan of any of the current solutions for managing the resources and knowledge that I have, I was thinking about making my own solution, which will involve custom code as well as possible integration of FOSS solutions. I would start development on my local machine, but if I like it, how difficult would it be to migrate over to a public server and let others also use this tool? What kinds of challenges might I be facing?
In theory, nothing, beyond just the process of moving stuff to the new machine. You can set up your own servers, on your own ports (port 80 for example).
You can even create your own fake domain at home, with just a tweak to the /etc/hosts files (or the equivalent on Windows).
Now, if you're developing on Windows and hosting on unix, you'll have platform issues, so I'd suggest against that, at least for a first project.
But other than that, it should be straightforward.
You didn't hard code any paths to "localhost" did you? If so, that should be the first thing to strip out. Either use relative paths, or have a configurable {AppPath} variable of some kind that you only need ever change once.
By the way, what language/framework are you using? it would help us provide sample code.
I would add that documentation is a highly important factor in any project if it is to be quickly embraced by the public. The tendency when developing in-house projects, especially if they are just for your own personal use, is to neglect, or even completely ignore documentation of all kinds, both of usage, as well as in the code. If users aren't told how to use the product, they wont use it, and if other potential developers don't know how or why things are done the way they are, or what the purpose of things are, they either won't bother with trying, or will cause other problems unintentionally.