What is compilations in Apple WatchKit? - watchkit

What is compilations in Apple WatchKit?
Can I have both compilation interface and normal app WKInterfaceController in same Apple Watch app?

For your first question see: https://developer.apple.com/library/content/documentation/General/Conceptual/WatchKitProgrammingGuide/ComplicationEssentials.html#//apple_ref/doc/uid/TP40014969-CH27-SW1
From the docs:
Complications are small elements that appear on the watch face and provide quick access to frequently used data. Users can customize most watch faces and install the complications that they want to see. The system provides built-in complications for weather information, upcoming calendar events, the user’s activity, and many more types of data. Apps can also add support for complications and display app-specific data.
To implement a complication, import the ClockKit framework into your WatchKit extension. The ClockKit framework defines the classes you use to implement your complication and provide the data that Apple Watch needs. For information about the classes of this framework, see ClockKit Framework Reference.
For your second question: Yes. You just need to implement a class which is a CLKComplicationDataSource delegate, which will provide the data for the various complication types.

Related

Options for State Management in Blazor

What libraries/techniques are available in Blazor for State management for webassembly (wasm).
It would be nice to know pros and cons of different approaches.
There are several options:
Redux (Fluxor)
Redux/Flux pattern has become a leader in state management in JS word; so it would make sense to adopt this best practice.
Luckily there is already a Fluxor library that does just that; and it does have the most github stars 379; although it is still a relatively new area; so it remains to be seen what ends up being the most adopted approach later on.
There is a great intro video along with source code
Official docs:
State, actions, and reducers
Effects
Redux Dev Tools
An in depth article.
Blazor-State
Blazor-State
Pros: uses MediatR for messaging
See also
Overviews of State Management Approaches
https://chrissainty.com/mobile-blazor-bindings-state-management-and-data/
https://jonhilton.net/blazor-state-management/
https://learn.microsoft.com/en-us/aspnet/core/blazor/state-management
nice but mostly messaging: https://jasonwatmore.com/post/2020/07/30/aspnet-core-blazor-webassembly-communication-between-components
keywords: passing data between blazor wasm webassembly components child parent attributes events handling
A Blazor app is a C# app on top of the .Net BCL libraries. We don’t need to emulate what the JavaScript world has created to overcome its own deficiencies. C# can cache anything you want with static members.

Using Vaadin Push to push server changes

I want to use Vaadin Push in my application. I am using vaadin 7.1.2 which has vaadin push built in. I have 2 question:
How to push the changes from the database on change in data in the database? How can I listen to the database changes? Is there any listeners in vaadin push which can be use?
Since I have many modules in my application I want to add push functionality to only selected modules. Is it possible to add push to only selected modules?
Thanks
Abhilash
Abhilash, what kind of persistence layer you are using?
Common Vaadin Container implements PropertySetChangeListener listener so you can register to and receive event for every DB change. But it will work only if you will change DB via this Container.
Well, external changes won't be noticed and no event will be provided. For this case it is a much harder to get noticed about these DB changes. You should implement kind of "middleware", which will handle all DB changes and also it will notify all registered listener.
To second question, I'm not sure what you mean with modules? Could you provide more information with examples?
How to push the changes from the database on change in data in the database? How can I listen to the database changes? Is there any listeners in vaadin push which can be use?
No, no silver bullet there.
Databases do not generally have an event-notification system to alert external systems about changes to the stored data. You need to code such behavior yourself.
Postgres NOTIFY
The Postgres database offers an unusual feature of NOTIFY where a client connected to the database server can be prodded from server-side code such as PL/pgSQL. The server-side code can ship an optional “payload” string to the client. The client-side database-connection implementation must be coded to accept such notifications.
If you have such a client, then you could do something like have triggers that fire when saving changes to certain tables, then use NOTIFY to tickle the client into querying the table name passed as the payload.
This is nowhere near standard SQL, and is a Postgres-specific feature.
Vaadin events
If the only source of changes to the database is within your Vaadin app, you could set up some kind of alert system within your app.
The ServletContext is required by the Servlet spec to represent your web app at runtime. You can get/set “attributes” as a way for the various threads and user sessions to communicate with each other.
You would need a way to track all your user sessions, as discussed here.
Taking a Vaadin-centric approach may not be practical if there is any chance of other sources of changes to the database outside of your app.
For more info on messaging between current Vaadin users, see the Broadcasting to Other Users section in Vaadin docs, as mentioned in this Answer to a similar Question.
Polling
One common solution is polling. Spawn a background thread to query the database, report findings, then sleep. Lather, rinse, repeat. Set the sleep time for the amount of time your users are willing to be out-of-date.
This kind of work is made much easier with a ScheduledExecutorService built into Java SE. Alternatively, Java EE offers an #Schedule annotation as discussed here, but I am unfamiliar with its usage. Either way, you are scheduling a chunk of code to be run repeatedly. By the way, never use the Timer class in a Servlet-based app or Java EE app.
I have used the ScheduledExecutorService successfully in a Vaadin 7 app running in Tomcat 8.5. Learn about the ServletContextListener as a place in your app to launch and shutdown your executor service. See my slides for my talk on the subject.
And be sure to never access the Vaadin user-inteface layouts and widgets from a background thread. Instead, always interact with the UI by calling access or accessSynchronously on the UI class for user-interface related changes or VaadinSession for non-user-interface related changes. Read the Accessing UI from Another Thread section of the Server Push page in Vaadin doc.
Push technology updates
Push technology has been a rapidly evolving field.
As I recall, Vaadin 8 may be much more efficient with Push than Vaadin 7, though I do not recall details. At the very least, Vaadin 8 may be using more recent versions of the Atmosphere library that powers Vaadin Push features. So if possible, you may want to consider migrating to Vaadin 8. Keep in mind that Vaadin 8 has a compatibility layer feature to make it easier for you to bring over Vaadin 7 code.
Most crucial, be sure to use the latest versions of your web container such as Tomcat or Jetty. The support for WebSocket in particular has had significant improvements over the years.
While perhaps not yet ready in practice, the Servlet 4 spec has major implications for the future of Push technology. The spec includes support for HTTP/2 and Request/Response multiplexing to help with server-side push.
Vaadin Push scoped to UI
Since I have many modules in my application I want to add push functionality to only selected modules. Is it possible to add push to only selected modules?
Enabling Push significantly alters your deployment situation, and so you are wise to carefully consider its use.
Vaadin’s support for Push is scoped to your subclass of UI. Your Vaadin app by default has a single UI object for each user, from a single subclass of UI class. But your are free to instantiate additional UI objects within your user’s session. The instances may come from your same UI subclass, or from additional UI subclasses you have authored.
This is precisely how the multi-window/multi-tab support works in Vaadin 7 and Vaadin 8: You instantiate a new UI subclass object and install it into the new web browser window or tab.
I am not sure, but you may be able to swap out a Push-enabled UI object for an alternative non-Push-enabled UI object within the same web browser window/tab. But I have not tried doing so, and I do not know if this is supported or recommended. Personally, I would choose to keep the same UI object installed for the entire life of the window/tab.

How to persist application state in a WinRT app using Caliburn.micro?

I'm using Caliburn micro with a WinRT application and it looks like that there's no StorageManager class, anyone has suggestions about how to persist application/ViewModels state in this case.
TIA
This is not related to Caliburn.Micro but rather a general issue. You can either use Serialization but then you will have to pay attention to versioning and changes in your view model or you could save the fields you are interested in to a file using the normal IO methods or even store your view models in the database if you wish (although i think this might be a bit extreme).
Edit: Caliburn.Micro isn't a business application framework and there have been no library that tried to integrate business functionality with CM as far as i know, so this leaves you with serialization as your best option but as i said ser/des comes with some nightmares you have to manage such as version changes, class changes, etc.
There's another project called Catel which is a business application framework that contains an MVVM framework, anyway Catel uses a nice object called DataObjectBase ( actually now it is called ModelBase) which solves all problems of serialization and there is an article for that on code project if you want to read it and see how they have done it.
If you wish you can use the Catel.Core module which is a library with a lot of features for data handling (it contains the ModelBase class) or you can take a look at the source code and see how they have solved the issue with ser/des and implement that with Caliburn.Micro in your project.

iOS 6 Native UI Elements

Does iOS 6 provide a way for developers to copy its user interface, i.e. if I want my app to look like iTunes or the App Store, can I easily do that using the SDK or do I have to design that on my own?
There is no way you implement this. If you take a loot at the file system, you will see that the UI is actually images that Apple uses. You will have to roll your own, but I am sure sooner or later there will be similar images for you to use on the internet. You can then use UIAppearance proxy to set the look and feel to be as similar to Apple's as possible.

Embeddable Enterprise Collaboration (Microblogging) Engine

Short Version (tl;dr):
Is there an open source or commercial engine that provides embeddable collaboration and microblogging functionality?
Long Version:
I am creating a niche application that has need of this functionality and do not want to reinvent the wheel. The following are must have requirements:
Data API only. My application is SaaS, and I want to build the functionality around the data. This eliminates most of the offerings out there (facebook, salesforce chatter, yammer, present.ly, teambox)
Does not require use of a built-in front end. I really just want an engine that will take care of the storage and events, and gives me a means of querying. Requiring the use of a specific front end renders it useless for embedding into my app. This eliminates everything else I have found (status.net, Yonkly, Jaiku)
Beyond standard updates and replies, can handle custom events. For example, if I were embedding this into an logistics application, I could have the engine handle events like "shipped", "received", and "cancelled".
Beyond this, there are several nice to have features that a framework would have:
Should not require a specific platform or server technology to run (i.e. something like a RESTful API would be nice)
Should be message based so that commands that affect its state can come from any source
Should encapsulate its own storage so that external resources are not necessary (i.e. no database needed)
Should have pluggable extendable UI components/widgets for web, mobile, and desktop clients
Should have search and retrieval APIs available for many languages/platforms
It seems that someone out there should have this already, or at least be in progress with it. Please point me in the right direction.
Since nobody had any answers and continued research did not find anything, I created a solution on my own called Collabinate. Updates can be found on Twitter, and the project itself is hosted on GitHub.

Resources