Is adapter.js in sails.js present by default? - sails.js

First of all sorry. i know this would be a silly question, but i am very confused. and need an answer.
Question
I am making a project in sails.js.After running the "sails new myNewProject" command when i looked into the default modules that are formed i could not find the api/adapter in it.
so, i would like to know whether this adapter is created automatically or we will have to create it manually??
Thanks.

The api/adapters directory is not created by default on new projects.
If you need to build a custom adapter, you can start with sails generate adapter myAdapterName, which will create the api/adapters folder for you along with boilerplate files for the new adapter under api/adapters/myAdapterName.
If you're just looking to use one of the existing adapters like sails-mysql, you don't need the api/adapters folder at all. Just use npm to install it in your project:
npm install sails-mysql
A list of more available adapters is here.

Related

Localisation workflow BartyCrouch and microsoft translator API in iOS

I have a very specific question, was wondering has anyone tried workflow with BartyCrouch script and api.cognitive.microsofttranslator in Swift? I have a mixed project : Storyboards + SwiftUI that i needs to get multiple languages. I guess I am just confused on the first steps. I have a small test project working with BartyCrouch is it just out of the box translating from Azure?
Any code examples on the web are welcome.
There was some talk of adding Google translate as a feature to the framework, from 2 years ago. Not sure where we are now.
https://github.com/FlineDev/BartyCrouch/issues/160
So everything worked after setting up the BartyCrouch and Azure in a right way. The steps are here if anyone is looking for.
Setting up Azure Translator instance
this took a while as I needed the GLOBAL region and to make this work free of charge
First set the Subscription and than Resource and than connect it to your Subscription via Translator in this case. This will generate secret key that we need for BartyCrouch to connect to the api.
With the key and global we can test if translation is working with CURL/Postman
Configure the .toml file that you generated when installing BC (I did from Homebrew). Had issue here with a paths to my Localizable.strings file ["./your-app"]. I had to add translate to the tasks in .toml file
Place BartyCrouch script into BuildPhases and run build
bartycrouch update -x
Make sure when adding a new Localizable.string file and new language to have all the translations in "" empty string
Happy localization to you..

How do i create a custom devcontainer?

i have been using devcontainers for a while, and i want to extend some of them.
For instance, i want to install all the linting tools etc for various languages, and use a more personalised container as a starting point (compared to the Microsoft hosted ones).
I also like to host the containers on my own dockerhub, so i do not need to build all this stuff every time. There could also be the use case of using devcontainers for something other than the standard libraries.
I know i can just manually change the docker image reference, but i also like to integrate my changes into the plugin, so i can have my own repository show up as well, to get a native feeling.
I could not find any information on creating my own dev containers, only on extending existing ones. Is any of this i mention officially supported?
Edit: To sum all this up in one question; Can i add devcontainers from my own repo, without merging them into https://github.com/microsoft/vscode-dev-containers ?
If you are using VSCode as the text editor you can install the remote extension pack which allows you to add a template for a devcontainer to your project.
If you aren't using VSCode you can use the templated version as the basis for your own. I created a template repository with the files needed for Python project which you can refer to as well

how to put to work Ionic generator?

I have an Ionic app running with the basics of Ionic and running it in the browser by doing ionic serve, but I want some new stuff and run it trough the grunt serve command, also has the feature for JSLint, I am already using this scss this: https://github.com/diegonetto/generator-ionic/ and I see that have everything I want, how do I install that in my project?
Take into account that my project is almost done, I have almost 85 % already done.
Is this the part I need to follow up:
Upgrading
Make sure you've committed (or backed up) your local changes and install the latest version of the generator via npm install -g generator-ionic, then go ahead and re-run yo ionic inside your project's directory.
The handsome devil is smart enough to figure out what files he is attempting to overwrite and prompts you to choose how you would like to proceed. Select Y for overwriting your Gruntfile.js and bower.json to stay up-to-date with the latest workflow goodies and front-end packages.
does this will bring some complications ? is there something else I need to know ?
I use the same generator and enjoy using it. With that said, I would not recommend starting to use a generator until you've made a complete backup of your project.
Even then, I'd recommend creating a brand new project using the generator then migrating your existing code into the newly generated project. While migrating, you should be modifying your code to match the generator conventions as you go. This gives you the most control and will make sure that you learn the conventions of the new project structure. Upgrading instructions are really meant for people who already use the generator and are just upgrading to a new version of the generator. They are not applicable to you.

What language does SmartFoxServer 2x use on the server side?

I have downloaded and started the community version of SFSx2. I read everything on their documentation page:
http://docs2x.smartfoxserver.com/DevelopmentBasics/introduction
Which unfortunately only talks about flash client side code. Nothing about the corresponding server side code, nor about html5 client side which I need.
I downloaded the HTML5 examples, which took me a long time to find (they are here: http://www.smartfoxserver.com/download/get/140 )
None of the examples work, as they can't connect to the server. Presumably, this is because the examples only supply client side code. There are no instructions supplied on how to install or run the examples.
I can find no mention on the smartfox documenation on the following:
1) what language is used on the server side. One assumes its java.
2) how does one deploy java code to the smartfox server? I cant find any mention of this in the docs.
3) how does one find and install the server part of the client side examples (which are Tris, GameLobby, BuddyMessenger, AdvancedChat).
I applied to be allowed to post on the smartfoxserver forums, but no reply yet.
I also found it hard so I share what I've found out.
The server extensions are written in Java. I used Eclipse JUNO to write my code.
You can download Eclipse here. http://www.eclipse.org/downloads/
You export the extension in jar format from eclipse into you extension path. The name of your file has to end in 'extension' eg MyFirstExtension.jar otherwise sfs2x wont recognize it. Your extension path will be something like this: C:\Program Files\SmartFoxServer2X\SFS2X\extensions\MyFirstExtension\MyFirstExtension.jar if your working in windows.
You will find docs on JAVA API here. http://docs2x.smartfoxserver.com/api-docs/javadoc/server/
This is a link to the basic example code: http://www.smartfoxserver.com/download/get/120
Unzip the content into the [SFS2X_install_folder]/SFS2X/www/root/examples folder, overwriting the existing file. Run the index.html file, then navigate to another index.html to open the example. Run the sfs2x-standalone.exe first of course(see below). If you followed the 'server configuration tutorial' on smartfox website and changed the server ports, the examples wont work. Leave the ports alone until you start to understand the server.
This is a link to the flash example code: http://www.smartfoxserver.com/download/get/108
You will find the example code for apps mentioned above. They are written in Adobe Flash Builder and Java extensions. I don't know if there is any code for HTML5 but the Java server code and AS3 is there.
I also found that using the standalone server was the way to go rather than using SFS2x as a service. c:\program files\smartfoxserver2x\sfs2x\sfs2x-standalone.exe. Using the exe gives you the command prompt window. You can use the window for debugging and see the state of the server when it starts.
Most of the examples should work without creating extensions but to create an extension out of source examples:
Create and setup a new project in your Java IDE. You will have already set up a workspace.
Copy the content of the /source/server/src folder to your project's source folder.
Add SFS2X Libraries. Go to properties of the project -> Select Java Build Path -> Click Library Tab -> Add external jar. Add 'sfs2x.jar' and 'sfs2x-core.jar' from C:\Program Files\SmartFoxServer2X\SFS2X\lib folder. To create the extension, export jar file to extension path. Restart server.
Another problem I had was the Java Version I was using. I had to use Java1.6 with my version of sfs2x when writing extensions. This was trial and error as there was no documentation. There may be a newer version out now.
I had to copy all the server source into eclipse to try and understand how things were done. It was a way of having all the code in one place. There was a lot of trial and error as getting help is hard. I eventually accomplished what I set out to achieve. Good Luck.
SmartFox Server is easy to use even with extension. documentation Give try to Nuggeta solution for game development too. No extension needed at first. This is optionnal.
We have full HTML5 open source game walkthrough on github

MEF Plugin update strategies for winforms

I'm developing an extensible application with MEF. The application will have many types of plugins to collect and process data in different ways.
I'm thinking about building a versioned online repository for the plugins, that will enable the user to download new versions of the plugins when they become available.
It would be nice if MEF could load different versions of the same plugin simultaneously, though from what I understand this isn't possible (correct me if I'm wrong).
So I've resigned myself to the fact I will need to update the plugin and archive the previous version.
What would be the best strategy for doing this?
Example 1
The Application downloads a new version of a loaded running plugin. I can't place the plugin in the plugin directory as there is already DLL with the same name. So I could rename the new plugin with a version suffix. I can't load the same assembly, so I guess I'll have to force a restart. So on restart, it achieves the old plugin and loads the new one.
--- This seems solutions seems a little messy
Example 2
The Application downloads a new version of a loaded running plugin.
The plugin is encased in some type of installer.
The installer closes the host gracefully and archives the existing plugin.
The installer installs new plugin and restarts the host app.
--- this also seems a little messy
I am seeking any correction of my assumptions, or any insight into a successful strategy to my achieve my goal.
The .NET Framework has a fearure called Shadow Copy which allows you to update loaded assebmlies. Basically it copies the assemblies to a temp folder and loads them from there. This way the assemblies located in your application's installation folder will not be locked by the OS and you will be able to replace them. ASP.NET, unit test framweorks and many other applications use shadow copying.
To enable this feature you will need to load your application in a new AppDomain since you cannot enable shadow copying on the main AppDomain. You can create a simple loader that will create an AppDomain and execute your application there. This is very straight forward. For an example of MEF + Shadow Copy have a look at Glenn Block's Way of MEF and in particullar the PartUpdatesInPlace sample.
Now as far as versioning is concerned you will need to be able to have two or more versions of an assembly loaded at the same time in the same application domain. There are two ways to do this:
Strong named assemblies in the GAC.
Assemblies with the version included in their name (like Plugin.v1.dll). Strong naming is optional in this case but a good idea nonetheless. The advantage of this approach is that two or more versions of a plugin can coexist in the same directory.
Have a look at this answer for an example of MEF + Versioning.
You can even use the recomposition feature of MEF and have your plugin container updated after:
A new plugin assembly is added
A plugin assembly is deleted
A plugin assembly is replaced
Have a look at this question for an example.