Using the EPiServer Communities API from a console app? - episerver

I'd like to write a console or winforms application that will interact with the EPiServer database. Since I don't want to muck about in the deep inards of the database I'd like to use the EPiServer API.
However, all the examples are using the "CommunitySystem.CurrentContext" which is null when running outside the website.
Now, I'm going to transfer a large amount of data from a legacy system to EpiServer Community and I really don't want to do that from a web page but from an application I have a little more control of.
Is there any way I can use the API from outside the web context?

I'm not that familiar with the community model. But... I've had no problems at all running huge imports through a web form (or control). The key (besides having disabled execution and database timeouts) has been to run it through Internet Explorer on the site's server and have the site's domain name mapped to 127.0.0.1 in the HOSTS-file. It can run for hours and hours while logging progress to a table or text-file before sending the response.

My colleague Jarle figured out the last bits and blogged the whole process here So if you want to run the EPiServer API outside of IIS, that's the place to start. Works like a charm!

Related

What's the best way to send event notifications from a Winforms server application to a Blazor client application?

A few years ago I was instructed to build an Windows Desktop application to control several devices, add and check data from a local database among other stuff. At the time the answer was very simple and I decided to create a WinForms application that provided a solution to the request, the app would control the devices, it would store data in a local database and it would show the data in it's UI.
Even though it worked perfectly for a while, the project has now expanded a lot, to the point were it consists in several projects including two REST API services working on different servers as windows services, a Xamarin Android and iOS apps that access those servers and some other stuffs. Obviously, my dicision of not separating the original Winforms server application's UI from the server stuffs has kick me in the rear. Another problem is that the solution has been working for a long time and the client does not want to give me much time for updating (which by the way it would probably require to rethink everything) so he want me to give him a fast and simple solution to the problematic server - client scheme.
So again I decided to try a fast solution (probably not the right one, but its a matter of time) and created a Blazor app that connects to the local database and it would work in the same server where the winforms app is, guaranteeing that none one will touch that app.
The problem now is that I need a way to show real time notifications in the blazor web UI and update its datagrids, etc., when the winforms app receive an event from one of the devices. At first I thought of SignalR, being the blazor app the server for SignalR and the winforms just a client, but I have no experience with it. Although if SignalR is the answer I'll deal with it.
So, the question is: which is the best way to send real-time event notifications from a winforms application to a blazor app?
Thanks in advance

Database app, accessible from Mac, iPad and Web

I feel very out of my depth with this query, but not being able to do it isn't really an option so I am going to have to learn how one way or another.
I have been tasked with building an application / database for a Chauffeur company. I have done similar things before in Microsoft Access for other customers, hence getting this request, but this customer wants to be able to run the app on their Mac, and not install Windows. My only real experience of coding is HTML/CSS and some VBA when using Microsoft Access. For these Access DBs I have created separate front and back end files to allow multi user access and also remote access (the back end file being kept on the company server).
So onto my query (apologies for dragging it out)...
I need to be able to build something that the single user can open and run on his Mac, so he can view, add, change jobs and their details. He also needs to have the same access on his iPad, although purely viewing would suffice.
As regards the web access, basically he wants to be able to go onto his "Booking System" application, go to "New Job" and send a link to his client, where they would click the link in a browser, fill in the details (Name, Contact Number, collection and drop off addresses, collection date and time etc...) and when they submit this form the details be updated on his booking system.
My issue is I do not really know where to start. I just need some pointers as to where to get started. Is it an issue of building a MySQL database back end and then hosting this somewhere and linking different front ends to it etc...
Yes, with multiple clients, the web is your best answer. For the cheapest hosting route, you can find good, inexpensive PHP and MySQL hosting that will provide what you need. You can design the front end with HTML/CSS, use PHP to develop the logic and data access, and use MySQL to host the data.
The Mac and iPad can access the application via the web URL--you will not be building an iOS app, rather the user will access the web site through a web browser. You can use some pretty neat tools like jQuery UI Mobile to create an app-like experience, but if you need to support multiple clients on a small budget, an iOS app and separate web site is not the way to go.
Make sure you have some PHP expertise available or figure this part out. There are tons of great resources on the web to get started. Good luck!

How do these fit together : Silverlight, Apache, PHP, MySQL, Web Services?

I have been attempting to teach myself quite a bit about silverlight, and how it all works, for the past few weeks, and I am to the point in my app development where I would like to connect up to my web server's MySQL database.
My web server is capable of running ASP.NET pages, but is Apache, and natively runs PHP (which is what I'm far more familiar with). It has a MySQL database engine, and I am very well-versed in your typical dynamic page creation with PHP and MySQL.
What I'm NOT familiar with are these "Web Services" that people keep mentioning every time I find an answer regarding the question of "how do you connect silverlight to a database?"...
So my basic question is really one of data FLOW, and where everything fits in the puzzle, and how to get it all working in this particular configuration. Most of the answers I have seen deal with IIS instead of Apache, ASP.NET instead of PHP, and MS SQL Server instead of MySQL.
Also, answers tend to start using abbreviations and acronyms without actually explaining what they stand for.
For example: What is WCF, and RIA services, and how do they fit in to the puzzle as a whole?
I suppose I'm just looking for a top-down overview of the structure of data flow on a MACRO level, not on the micro (code) level.
(Edited to add:)
Also: I have done vb.net apps in the past which have used MySQLConnector.NET to pull from my web server's database remotely, but I understand that the client machine would have to be whitelisted as a remote machine, meaning I'd have to open my MYSQL server up, and make the access mask basically %.%.%.% in order for any client to connect... and that is undesirable... so if I understand things right, the web service runs on the web server, and the client sends requests to it, and the web service acts as an intermediary, grabbing the data from the database (possibly with some sort of "stored procedure" look-alike?), and passes the data on to the client... which also means all database access credentials are on the server, and not inside the (potentially hackable) client...
Do I have it right?
Also, when answering, I need to know where the access to the web services is... in the silverlight APP project code, or the silverlight WEB project code...
I have found this wonderful tutorial that helps to explain it...
http://www.designersilverlight.com/2010/05/23/php-mysql-and-silverlight-the-complete-tutorial-part-1/
Here is how I understand it all working.
There are 3 "Layers" to the process: The application, the web server, and the database.
The application calls out to the web server to execute a script file (like a normal PHP script). There script file can have normal URL variables passed to it (like script.php?foo=bar, so $foo is defined as "bar" in the script)... so you can use those URL encoded variable/value pairs to tweak your script results as you would normally with a web page.
I imagine you would have one script per TYPE of database query, with var/value pairs to tweak your results. So on your web server you would end up with numerous PHP scripts, just like you would normally for a website with different pages, and you pass variables in to those scripts to customize the results.
For example, for users, you could have a get_users.php script that would return all users...
but get_users.php?loggedin=true would get all users that are logged in currently
get_users.php?loggedin=true&ingame=true would get all users that are logged in and in a game... You just script the logic and the resulting SQL query accordingly.
All of the results are encoded either with XML or JSON (Javascript Open Notation: see What is JSON and why would I use it? ) for transport to the app... the app, in effect, is reading the results of an echo of the JSON encoded stuff.
If you were to open these scripts in a web browser, the only thing you would see is a text printout of the JSON data... no web page... just data that is read by the app and then decoded in to objects.
So in effect, the silverlight app is reading a text output of a PHP script executed on your web server, and interpreting the output.
^^^^^ THIS IS THE SHORT ANSWER TO MY QUESTION. :)
To be blunt, the whole use of the terminology "web service" is misleading, and what was really leading me astray. I thought it was some sort of service or app you had to install on your web server just like PHPMyAdmin or something.

What tool can I use to easily manage data within a cloud database (Azure/SimpleDB/etc)?

I need a cloud database as a back-end for a mobile app, most of them will do what I need, but I also need a management interface (ideally web-based, but could be a Windows client) that makes it easy to:
Add/edit data in the database (including cross-table forms)
Report on the database, ideally with dashboards/charts
So I'm wondering if anyone is aware of a web-based too that can be hooked up to one of the main cloud-database providers, that allows me to design forms and reports to manage the data in the database. My goal is to avoid writing all the forms and reports myself so I can focus efforts on the client mobile app.
Right now my "best" solution appears to be Microsoft Access (probably hooked up to Microsoft SQL Azure), and I cannot believe I'd have to sink that low. Save me from this depravity? Please? :)
I've been using SDBNavigator. It's a Chrome browser plugin. Works like a charm.
"SDB Navigator on the Chrome web store"
The App Engine datastore has built in datastore viewers (and editors). On the dev_appserver, this is accessible at /_ah/admin/datastore, and in production it's accessible through your app's admin console. Neither one lets you build forms and reports, though - reports are somewhat out of scope for most NoSQL databases.
If you're prepared to do some coding, you might want to consider Django, which makes constructing admin interfaces extremely straightforward.
If you're using SimpleDB, check out sdbtool. It's a Firefox plugin. Very simple app - never had a problem with it.
You can use SDB Explorer. SDB Explorer is world leading GUI to explore Amazon SimpleDB. It have many features like --
Upload My Sql data to amazon simpledb.
Supports interface for AWS IAM.
Export Domain.
Product support.
See more .. http://www.sdbexplorer.com/

Web Analytics & Stats

We want to add tracking statistics to a web application we are building but are pretty unsure of how to go about it. (i.e. clicks, pageviews, unique visits etc)
Does anyone have any articles on the best way to go about incorporating tracking data into an application ? i.e. javascript tracking or IIS etc ?
We want to add tracking in as a ASP.NET MVC module - but we are unsure as to the best way to actually get the data and essentially 'track' this information ?
If anyone could help out - much appreciated.
Edit: just to be clear, we want to do this in-house and present the stats to our users as an additional fee module?
You can turn on the logging for IIS and then use the SQL Server Report Server Pack for IIS. It comes with many canned reports for your sites stats and then you could take it from there with your own custom reports.
You could also just use log parser to get the stats into a SQL Server DB and then you could use SQL from their to analyse and roll your own app.
Either way, you could modularize this and sell it as an add-on to your customer base.
You could use Piwik, you just need PHP version 5.1.3 or greater and MySQL version 4.1 or greater. As they say in their website, "Piwik aims to be an open source alternative to Google Analytics."
They have a demo on the official website so you can see if it's what you're looking for.
Google analytics is a popular service. You just insert a bit of javascript on every page that contains your sites name and Google tracks the data and provides all the report on a handy web based dashboard.
It's not an ASP.net MVC module like what you mentioned, but it will certain track stats for you and will be a lot simpler to set up than trying to code or integrate anything yourselves.
I'd look at analytics to begin with and only branch out to something more complex if it doesn't meet your requirements.
klabranche provided a holistic answer in terms of using logs of web server. I think using web server log is a a great way to analyse data of your web application.
That being said, depend on your web application and the scope of your analytics, just relay on web server log is not a good way to.
As you may know, web log does not record users behaviors like clicking certain tabs which may not trigger a web server request. Obviously your web log has no idea whether users clicked that tab or not, this may hurt your analyse.
Another you need to know is browser cache, this may create another black hole in your data.
RECAP
If you want to do a holistic analytics, you need to use two approaches, one is JavaScrip tag, another one is web log. Since both of them have shortages, combining them together will give you a complete picture.
Hope this helps

Resources