I am making a C# program that recreates websites in offline mode for use at computers within the company, that are not connected to the internet. These offline websites are identical to their online versions, with all content displayed.
I already have a solution for websites with simple MySQL access, but I need to rewrite the program, so that it can handle Drupal based websites aswell. However, I couldn't figure out how to access Drupal's SQL database, or even what to look for.
The original program uses the website's templates (that are already rewritten in HTML), and places the data mined out of it's database in the templates. Problem is, I don't know where to look for Drupal's templates, or if there aren't any, what data should I gather from it's database.
I use MySQL Connector to reach the database with C#. Should I look for the nodes? If yes, where?
If you want to go down that path you will have to sort of act like Drupal, in order to know which things to read from where. Each module installed has their own tables and functions in a particular way, so not always all the data are nodes with fields.
I you need to work with websites in offline mode, I would suggest using a portable webserver, that way you just copy the website to the root folder and run a script to copy the MySQL database as well, the point being that it's portable, you can carry it around in a flash drive and to run it, you don't need to install anything.
Again, what you want to do is possible, but it will require a tremendous amount of work and you cannot guarantee that things will behave well when you install new modules.
Another approach would be to look into the Boost module, which creates offline, static files based on the request you make to the site, and stores them in a configurable folder.
Another way: build a screenscrapper which reads the HTML from the homepage, and recursively follows the links and modify them before saving the HTML yo your local copy.
Summing it up.. avoid accessing the database yourself and try to read the HTML already rendered.
Related
Is there any library in Xamarin which would store the pages that we browse in WKWebView?
Have to store the resources of the pages (CSS, fonts, js etc.) for offline viewing. The complexity is maintaining the folder structure and manage the resource Urls within the CSS and JS files. Any idea how the resources can be stored and loaded?
There are resources on how to save a html page and load the html in WKWebView.
Please note that this question is not about that. It is more about storing and managing the resources of the visited pages for offline viewing.
I don't think you're going to get your answer with a mobile only approach. It's not impossible to create one but I don't believe anything exists that will do what you want, happy to be proven wrong. I think you need to think outside the square a bit.
I can't give you the entire set of code because I don't own it (my company does) but I managed to take a website completely offline (with limitations of course) by using multiple resources to achieve the desired outcome.
I used a piece of software called Cyotek WebCopy in an Azure VM to scrape all of the website down to a folder. That folder was then zipped up and uploaded to Azure Blob Storage so it could be accessed from anywhere. The Xamarin app would then access the storage container, retrieve all of the blobs and then when a user clicks on a specific blob, it unzips down to the device and then opens up in a web view for the user to browse.
All of this was achieved using a web service and PowerShell scripts on the VM side and then of course your standard Xamarin based application for viewing.
Like I said, there are limitations to this but barring external links and database calls (like a submission page), it will work for you. It has worked for us.
It may sound like a lot of work but all in all, the VM side took me about 2 days and the Xamarin concept about 5 so all in all, not long to stand something up that is able to be built upon. I hope that helps.
We have a sharepoint doucment library, the site consist media files(like images, word document, .psd file) and then we have a local CME (Alterian) which can be integrated to the SharePoint library in order to share the document library but the site needs to be on http// not an https//, coincidentally current sharepoint site is on https//, so we need to figure out a way/write a module which will work as a scheduled job (possibly using SPJobDefination class) and check on https// site for recently modified/added or deleted documents/records and then will copy them/normalize them to a dev site (hosted on http//, replica of the production https// site).
Experts please share your view's to proceed with a best approach to make this happen. (At an initial stage I'll have to copy over all the existing meta-data from the current https// site aswell)
Thanks a lot in advance for the time.
I would use event handlers on the https document library. Please see the SPItemEventReceiver.ItemAdded Method and SPItemEventReceiver.ItemUpdated Method.
So, every time you will add or modify an item, the code inside the methods is triggered. Inside the code, you may take the library document and copy it to the http site.
Regarding the existing items, you could write a simple console application which will copy the items from one list to the other.
Make sure that you make use of the SPListItem.SystemUpdate Method.
Also, the following excerpt from an answer to the question Moving Documents from library to library deletes version history, how do you retain it? could be helpful for starting:
(...) We can get the “SPFile” and the “SPFileVersion” objects from the
original library and add them to another library one by one. After
copying a file or version, get the original custom property form the
source file or version and use the “SPListItem.SystemUpdate(false)”
method to update the target file or version. This workaround can
persist most of the properties except the “modified time” or “modified
by” field. (...)
I am working on a windows app. The user has to register first to use this application. So in order to store user information, I am using MS-Access as a database. There is not much information to be stored as this application will be on individuals machine. There are few settings and some user information to be stored.
What I am feeling is that with the use of MS-Access, my application will be dependent on other application as MS-Access. It is not necessary to have the MS-office on the end user's machine.
So can you suggest me the best way to store the data safely without any dependence.
One thing I want to clear is that, the information will be of different types like it will consists of user information, some folder/files paths and some other information. I would like to keep these information separate from each other.
Thanks
Abhie
I think I found the solution.
Best practice to save application settings in a Windows Forms Application
I hope this will help others facing same problem.
Stackoverflow Team You are doing fabulous job. One suggestion; can you put some chat option for developers to discuss their problems. I think this would make it more easy to find answers to complex problems...:)
Regards
you need to include Access Database Engine drivers in the client PC, in order to connect it .
MS Access Database Engine
If you're using .NET, the best bet for getting the recommended folder locations for application data (e.g. your mdb file) is probably best retrieved using Environment.GetFolderPath
See:
http://msdn.microsoft.com/en-us/library/system.environment.getfolderpath.aspx
You're likely interested in ApplicationData or LocalApplicationData for user specific data or CommonApplicationData for data shared by all users as your storage location (and then the proper company / product subdirectories appended to it).
I would like to have a lot of data (quotes of famous people, arround 100 k quotes). And I want that users are able to search, sort on category and sort on authors.
Got a big big xml file at the moment, but what is smart to do? How can i get all the quotes in the app? maybe a sql lite database? or just loop the xml when app starts?
Any tips are most welcome!
Kevin
UPDATE: Thanks for all the replies and tips, I really appreciate it and I am looking forward to program my App, did make a runkeeper-like app yesterday, now starting the quotes app.
I would recommend storing this data on a webserver somewhere and using some SOAP interface of something like this, to access it. I wouldn't be positively surprised when a downloaded application all of a sudden decides to download a big file of quotes.
I would recommend a SQL CE database (.sdf file)
Great overview here: http://windowsphonegeek.com/tips/Windows-Phone-Mango-Local-Database%28SQL-CE%29-Introduction
And here: http://msdn.microsoft.com/en-us/library/hh202860%28v=VS.92%29.aspx
There's no SQLite on WP7. There's SQL Server Compact though. Read up on the latter, and also on LINQ. WP7.5 only.
Alternatively, store data on the Web server, and use a service to pull it on demand. In that case, read up on services and SOAP.
With the fact that you are looking at a 500mb file I think you have a couple of options.
1) Put all of this data in a database on a webserver, then have your phone application use whatever method you like to contact the database to get specific data that is needed. Obviously your UI would have to be optimised to allow a user to sort by the type of quote and / or the person to whom the quote is attributed.
2) If you want this to be done without the use of the webserver you could have a stripped down basic database of quotes in the application itself, to extend this connect to the database and download more data.
This method may be best as it lets you use the database data to say populate a website if you wanted to (make a bit of money from ad revenue / promote your app) and also it means if your users dont have an internet connection they can still get some use from your app.
Without more knowledge of the platform I couldnt say what would happen if you try load a 500mb application but I doubt it would be good, though having such a large file locally is a bad idea for a mobile device. I can see this going two ways.
1) Im out and see your application, I set it downloading, pay it no attention and then later check to find it has downloaded 500mb over my mobile phone data package. This could mean a big bill.
2) I start to download your application, it hasnt finished downloading after 10mins, I delete it and dont bother trying again.
You can do something like let the user to enter three character minimum before search from webservice ans user the service result to bind the data.
Check the following links
How to connect to a Webservice from a Windows Mobile Device 6.0
http://msdn.microsoft.com/en-us/library/aa446547.aspx
Let me know if this helps.
I need to develop a product catalog (about 4000 products) application, which would be given to clients on CD or DVD. The catalog exists in webpage format using PHP and MySQL.
IMPORTANT: the application is given to clients who maight have old PC, old System. For minimal requirements I would put Windows XP and Internet Explorer 6 (if needed).
I need the following features:
1 search option (after productID AND after keyword)
2 print option (by selecting multiple products)
3 shopping cart (making a list which will be sent to an email address if there is any Internet Connection on the computer)
When I was asked to do it I had 2 days to realise a very basic version, so I took the whole website and exported it in HTML pages, and developed an application in C# which contains an embeded browser. So the whole website is now static and put on a CD. Everything fine so far. Now here are the problems:
1. the search option was realized by parsing the html files and reading the productID or looking for keywords inside of them. Put on a CD it was extremely slow (searching in 600MB of html files). FOR THIS I WOULD NEED A SOLUTION WITH A STATIC DATABASE (USING ACCESS OR SOMETHING) TO HAVE INDEXED ROWS, SO THE SEARCH COULD BE A VERY FAST ONE.
2. the printing option was a simply call of the embeded Internet Explorer print functions. Here are two problems:
a) user needs IE7 for printing the website scaled (FIT TO PAGE), otherwise the edges of the page are cut down.
b) users of this app does not have even the basic PC usage skills, so they can't set the printing settings, so there will appear in header and footer the page numbers and titles. QUESTION: can I set these settings from CSS for printing?
3. couldn't make a a shopping cart as I don't use a database, so I have static websites and content is inside the HTML.
QUESTION: WHICH ARE THE BEST SOLUTIONS FOR THE PROBLEMS DESCRIBED ABOVE?
PLEASE ANSWER EVEN IF YOUR ANSWER IS FOR ONE QUESTION ONLY. THANKS
If you have existing applications written in PHP / MySQL, maybe it is better to use XAMPP and put the application on a CD than to write new application from scratch.
In this case user doesn't need to install .NET Framework on his computer.
If you must write C# application, convert your MySQL database to xml file and load it into memory on application startup instead of parsing html files.
How about using javascript and cookies/url variables, for passing the shopping cart around? Is javascript enabled in you embedded browser?
I know this is completely different to the direction you're going in, but could you use an Excel spreadsheet instead?
One sheet for the complete catalogue & searching.
One sheet for individual item display/printing.