How to create Namespace and Set - database

I'm new to Aerospike..
How to create a New Namespace and new set..
I have gone thru some docs and videos but I didn't find any useful thing.
i have read somewhere which is 5 years old blog, i.e. thru config file only we can create namespace and set.
is that true or any other commands are there.

In order to create a namespace you'll need to modify the aerospike.conf file since namespaces cannot be created dynamically.
By default the "test" namespace is included in the aerospike.conf file (located in /etc/aerospike/aerospike.conf).
You can read more about Aerospike configuration and Namespace configuration.
Sets can be "created" dynamically (it is a logical hierarchy) so you don't have to "create" sets you can just specify the set you want to write/update/delete/read from in the operation.
If you are new to Aerospike I suggest to use the Interactive Tutorials (currently available for Java, Python and Spark) or the Client Libraries documentation to see some code examples.

Related

What is the correct way to configure App.Config files when using wcf services

Let's say that I have a simple WPF or Winforms solution. To that solution I add a new project (based on a class library template , which I then reference in the main project) which is intended to be a data layer containing an entity framework data model. When I create the data model in the new project the connection string that it uses gets added to the app.config file of the main project in the solution.
Now let us say that I want to add two more projects to the solution (both of which will again be based on class libraries) to contain details of WCF services that I wish to use. In each case I add the WCF service by using the ADD Service Reference option from the right click context menu of the projects.
Unlike the data model project though the bindings for the service model get added to the local projects app.config file ass opposed to the app.config file of the main start-up project.
Should I simply copy those bindings to the start-up project's app.config file, or should I copy and then delete, or in fact should I be doing something completely different. Thus far trying combination of the first two suggestions I get error messages connected with endpoint configuration, however my knowledge of WCF is not really sufficiently good to fully understand the MSDN articles that the error list points me to.
Note that if the service references are added to the main project I get no errors whatsoever, so I figure this must be a configuration problem of some description.
Would anyone be able to provide the correct procedure for adding projects that essentially contain no more than a WCF service reference to an existing visual studio solution.
Edit
The screenshot below shows my main app.cofig file after having copied over the bindings configurations from the two service contracts. I'm not sure whether I should have commented out the bit that I did or not, I had thought that by doing so I might get rid of the blue squiggly underlines telling me the following (which I must admit to not understanding):
Warning The 'contract' attribute is invalid - The value 'ErsLiveService.IERSAPIService' is invalid according to its datatype 'clientContractType' - The Enumeration constraint failed.
You're likely getting the blue squigglies because the namespace ErsTestService is defined within the project in which you created the service reference. If the root namespace of that project is MyServiceReferenceProject then try changing the namespace to MyServiceReferenceProject.ErsTestService.IERSAPIService.

How to convert a very old appengine .datastore to the new sqlite format?

AppEngine SDK used a file based .datastore file previously
At the very beginning the appid's didn't internally have the "dev~" prefix, which caused issues for some people, this issues were solved with the --namespace argument of the old_dev_appserver
Yet the new dev_appserver doesn't include this namespace option, which locked the data to the old_dev_appserver, which is now removed from the SDK's
First step is to use --port_sqlite --use_sqlite commands with the old_dev_appserver
The --datastore_path and --namespace= might also be need to set (--namespace= helps really old formats of .datastore's as they didn't have the "dev~" prefix)
Using these 4 options converts the data to an sqlite database, however the new dev_appserver doesn't have the namespace option, so the old data is unreachable
To solve this issue, one needs to modify the database by opening it with a program like "DB Browser for SQLite" - you will see the tables with appid's, without the "dev~" prefixes, just add the "dev~" prefixes to the table names and start the app using the new dev_appserver
After testing, I've found out that instead of re-factoring the .sqlite database itself, it's much easier to locate and override the application_configuration.py file of the SDK, setting partition's to '' and simplifying self._application to not include 'dev~' is enough

How do I use the CakePHP Configure class?

I am trying to use the Configure class in CakePHP, but I'm not sure if I am using it correctly. I have read through the cook book and the API, but I can't seem to do what I want.
I have created a configuration file: app/config/config.php. I can directly edit this file and set variables in there and access them using Configure::read().
Is it possible to update the values of the configuration file from the application itself, i.e., from a controller? I have tried using Configure::write(), but this does not seem to change the value.
app/config/config.php isn't a file that's automatically loaded by Cake. Either move these variables into app/config/bootstrap.php or tell your bootstrap.php file to load your custom file. You could also put your variables in app/config/core.php, but I'd recommend against that. I tend to like leaving that file alone and adding/overwriting values in bootstrap.php.
According to the API, Configure is supposed to be used "for managing runtime configuration information".
You can use its methods to create, read, update and delete (CRUD) configuration variables at runtime. The Configure class is available everywhere in your CakePHP application and therefore CRUD operations performed on its data in any place, including a controller.
If you are looking for persistent storage, you could consider a database (SQL or NoSQL). I would not recommend using a text file, as it raises a lot of security concerns. Even if security is not an issue, a database is propably a more fitting solution.
More on the Configure class in the Cookbook.

Zend Framework database initialisation

in tutorials such as this http://akrabat.com/zend-framework-tutorial/, the database parameters for the application are stored in the application.ini config file. Reading through the docs for zend_db and other database interaction tutorials, it suggests that the database object is created from parameters hard coded into php code. Whats confusing is that there doesnt appear to be any explicit initialisation of the database object in tutorials such as the one above. So my natural conclusion to this is that the database object is automatically generated from the parameters provided in the application.ini config file?
So my natural conclusion to this is
that the database object is
automatically generated from the
parameters provided in the
application.ini config file?
Kind of, in fact, there are a few step before your database get initialized.
Your application is bootstraped
It reads the config file
When a resource.* is found, check if the according resource class exists
The resource class initialize an object with the given parameter
Zend_Db_Table has a static method setDefaultAdapter($db) which takes the newly created Zend_Db object, now every Zend_Db_table object can use the Db object you set in your configuration.
Return the newly created object
Go back to 3.
Router, Controller, Layout, View, etc.
This "behavior" is recent, it's why you may found some old tutorial which shows you how to bootstrap your Zend_Db object manually, sometimes, it's just to show you how Zend_Db works.

how to include XSD schema files in Silverlight library?

Within a Silverlight library, I need to validate incoming XML against a schema. The schema is composed of 5 interdependent .xsd files; the main file uses "xs:import" to reference all of the others, and there are other references among them.
Assuming that the .xsd files need to be distributed with the library (i.e. not hosted on some well-known external URL), how should I structure my project to include them?
I have found that I can embed them in the library project with build type "Resource" and then load them (individually) using Application.GetResourceStream() and a relative URI with the ";content" flag in it. But if I take this approach, can I validate against the interdependent set of 5 files? What happens when the schema parser tries to resolve the interdependencies?
Or should I embed them with build type "Content" and access the main one with some other sort of URL?
Or???
To summarize: how should I use these 5 .xsd files in my project so that I will be able to validate XML against them?
EDIT: It's not clear whether it's even possible to validate in Silverlight. I spun off a related question.
I cannot say much about Silverlight limitations with respect to validation, but the question itself is more generic - one might want to store .xsd files as resources in a desktop .NET application, for example - so I will answer that part.
You can have full control over resolution of URIs in xs:import by means of XmlSchemaSet.XmlResolver property. Just create your own subclass of XmlResolver, override GetEntity() method, and implement it using GetResourceStream(), or GetManifestResourceStream(), or whichever other way you prefer.

Resources