w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to change ownership of pointer in C++'11?
The Window constructor should be taking a NativeWindow *, not NativeWindow&&. Window::Window(NativeWindow* nativeWindow) : _nativeWindow(nativeWindow) { } That should work, but I suggest you change the parameter to unique_ptr<NativeWindow> instead. This makes it clear that the Window object is assuming ownership of the NativeWindow argument. Window::Window(std::unique_ptr<NativeWindow> nativeWindow) : _nativeWindow(std::move(nativeWindow)) { }

Categories : C++

Change ownership of file during copy
Not easily. You could perhaps run the cp command as the user you want to own the new file, or copy it sideways to a temporary location, chown it then copy it to where it wants to get, but cp itself lacks chown.

Categories : Unix

Monitor directory and change ownership of files upon creation
By default, sed buffers its output when it's writing to a pipe. Use the -u option to unbuffer it. inotifywait -mr -e create /opt/freeswitch/storage/ 2>&-| sed -u 's/ CREATE //g' | while read file; do chown apache.apache $file done

Categories : Bash

Taking ownership for SQL Server Management Studio
Try logging in with the sa account and grant permissions to your Windows account. If you do not know the sa password use sqlcmd and execute the following commands: Use Master Go ALTER LOGIN [sa] WITH PASSWORD=N'NewPassword' Go Login with the sa account and GRANT permission to the account. USE Master; GRANT CREATE DATABASE TO Jommel;

Categories : SQL

User/Role can Create table or view, but not select from it SQL Server 2008 - Ownership not passing to creator
I would comment but lack privileges; have you taken a look at MySQL table permissions? It's a rather good system.

Categories : SQL

How do I use a TransactionScope with two databases when one is SQL Server CE?
You cannot use Distributed transaction with SQL Server Compact http://msdn.microsoft.com/en-us/library/bb896149.aspx

Categories : C#

Multiple databases(datacontext) on same server without MS DTC
With plain DbConnections, you can prevent DTC escalation for multiple databases on the same server by using the same connection string (with any database you like) and manually change the database on the opened connection object like so: using (var tx = new TransactionScope()) { using (var conn = new SqlConnection(connectStr)) { conn.Open(); new SqlCommand("INSERT INTO atest VALUES (1)", conn).ExecuteNonQuery(); } using (var conn = new SqlConnection(connectStr)) { conn.Open(); conn.ChangeDatabase("OtherDB"); new SqlCommand("INSERT INTO btest VALUES (2)", conn).ExecuteNonQuery(); } tx.Complete(); } This will not escalate to DTC, but it would, if you used different values for connectStr. I'm not familiar with EF and how

Categories : C#

Can I create two neo4j databases from my server?
I can answer 1. The idea of independent graphs or graph islands within a neo4j db can be implemented using lables starting Neo4j 2.0.

Categories : Database

SQL server multiple databases with same schema
This can be achieved using SSDT (Addin for VS) and Automated deployment tools (I use Final Builder). I currently use SSDT tools where I created a database project of the original schema. If there is any changes to one of the databases, i use schema compare in SSDT and update the database project. Then I follow the below steps to rollout the changes to other databases. Step 1: Update the schema changes to database Project. Step 2: Use MSBuild and Generate a deployment script by setting one of the databases as Target. Step 3: Run the generated script across all the databases using any auto deployment tools.

Categories : SQL

Using SQL Server databases on shared hosting
In this scenario you should not attach your own DB files. Create a new database (e.g. using SSMS or host's Control Panel) on the server provided by the host. Import your local data into that DB and use new server/db/uid/password in your connection string. If your host already provided you the DB - just use existing DB (don't create a new one) but still import your local data into that DB.

Categories : C#

Is there any public SQL Server with sample databases
SQLFiddle.com If you want help with a tricky query, and you'd like to post a question. If you need to build a representative database (schema and data) and post a link to it in your question. If you want (a) unique URL(s) for each database (and each query) will be generated as you use the site. If you want to compare and contrast SQL statements in different database back-ends. If you do not have a particular database platform readily available, but you would like to see what a given query would look like in that environment.

Categories : Sql Server

merging 2 SQL Server databases with unique ID
Since you only have 2, one option is to "go negative". If you're using int or big int and your surrogate key data types.....AND you started all the seeding at (1,1) (or similar), you can negative'fy the surrogates of one database. However, you might have client code that checks for ">0", and that could screw you. Remember, the range is actually: MySurrogateKey int IDENTITY (-2147483648,1) (to positve 2147483648 )...it doesn't have to start at 1 (or 0).

Categories : Sql Server

Program to deploy SQL Server databases & updates
If you are using the SSDT tools for Visual Studio 2010 and 2012, you can create and deploy DACPACs with your application. As part of your installation, upgrade, you can utilize the SqlPackage.exe utility that will publish your changes and update the client on the fly. Just add a Database Project to your solution, and do all your schema work out of there. Check out this page as a good reference on where to start: http://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx

Categories : C#

Can two Azure SQL databases on the same server affect each other's performance?
if the DBs are in the same server, they share the hardware resources. If one monopolizes the resources, it starves the others. in your case, it might be your other DB (assuming they both got provisioned in the same physical server) or other tenants on the same server doing some heavy processing.

Categories : SQL

Faster Select all from databases in SQL Server 2008 R2
You're right that an index won't help you retrieve all 1.7m records in the table faster. Indexes are lookup-oriented data structures that make it faster to find rows based on the rows' attributes - attributes meaning the values of particular columns or expressions computed in terms of the column values. They're usually some type of tree object that makes it quicker to filter rows in the table down to those matching a predicate, with the goal of avoiding a full table scan like the sort your application is doing. But indexes are only useful when the number of rows to retrieve is significantly smaller than the total number of rows in the table. When you want to show all the rows, they're no help at all. I'd suggest you reexamine your application requirements. Is it really necessary to retri

Categories : SQL

How to merge tables from 2 databases in SQL Server 2008
You can use OPENROWSET to read data from one database and merge it into another. For example: USE DBToMergeInto; INSERT INTO TableToMergeInto SELECT * FROM OPENROWSET ('SQLOLEDB', 'Trusted_Connection=yes;Server=192.168.1.1ServerToMergeFrom', 'DbToMergeFrom.dbo.TableToMergeFrom')

Categories : SQL

Select from multiple SQL Server 2008 databases not working
Seems you not adding Authentication. try: EXEC sp_addlinkedsrvlogin @useself='FALSE', @rmtsrvname='TEST_LINK', @rmtuser='user', @rmtpassword='secret' Obviously edit the strings to your credentials and execute, should be able to connect then.

Categories : SQL

Failed to restore Team Foundation server databases
Here is how I just walk around this issue. Use your SQL management tool to restore the backup file. They are just like regular Database backup files, so you just treat them like ones. After you finish, you can see your collections in your TFS console. You might bump into some errors during the process. The one I got was missing one collection. You need to restore everything before going to TFS console. BTW, after you finish, reboot your TFS service or the whole server, otherwise you might bump into another error like can't find the object reference. Check out this blog to find some help. BTW, I assume the reason you did this because you tried to restore TFS to a different server. You need to reinstall the application tier only from TFS installation. It took me forever to figure it o

Categories : Sql Server

MS Sync Framework: synchronize 1 client DB with 2 server databases
that should work for as long as you're always synching the same table to the same server. i.e., table C always synched table C in ServerDatabase2. the sync provider you're using has a table that contains "anchors" for every table you sync. The anchors are for last sent and last received timestamps (if you're using timestamps). There's only one row for each table, so it cannot keep track of the sync status of each table against multiple sync partners. a received anchor from Server A will be different from the anchors in Server B. so it will break if you sync the same table with Server A and then sync with Server B

Categories : Sql Server

Why does SQL Server 2012 create single user databases by default?
Whenever you create a new database, what you get is a copy of the model database, so it sounds like your model database has been set to single user. When a CREATE DATABASE statement is issued, the first part of the database is created by copying in the contents of the model database. The rest of the new database is then filled with empty pages. If you modify the model database, all databases created afterward will inherit those changes. For example, you could set permissions or database options, or add objects such as tables, functions, or stored procedures. (My emphasis) To change a database back to concurrent usage, run: ALTER DATABASE <dbName> set multi_user Replacing <dbName> with the name of the database to change.

Categories : SQL

SQL copy unique records between two equal databases in two separate databases
Try using this referencing a.recipeId and b.recipeId: SELECT a.* FROM ADatabaseCX.dbo.Recipes AS a LEFT JOIN ADatabaseRH.dbo.Recipes AS b ON a.recipeId = b.recipeId WHERE b.recipeId IS NULL Or this would also work using NOT IN: SELECT * FROM ADatabaseCX.dbo.Recipes WHERE recipeId NOT IN ( SELECT recipeId FROM ADatabaseRH.dbo.Recipes )

Categories : SQL

Can a mobile service server script (schedule) access other Sql Azure databases?
Yes you can. You need to connect using the following example (uses Node.js) taken from the how-to guide: To use the node-sqlserver, you must require it in your application and specify a connection string. The connection string should be the ODBC value returned in the How to: Get SQL Database connection information section of this article. The code should appear similar to the following: var sql = require('node-sqlserver'); var conn_str = "Driver={SQL Server Native Client 10.0};Server=tcp:{dbservername}.database.windows.net,1433;Database={database};Uid={username};Pwd={password};Encrypt=yes;Connection Timeout=30;"; Queries can be performed by specifying a Transact-SQL statement with the query method. The following code creates an HTTP server and returns data from the

Categories : Javascript

Best way to achieve - Data Sync between SQL Azure and Multiple On-Premises SQL server Databases
I have been working with SQl azure data sync, Microsift sync framework and Sql server change tracking. I have no idea about change data capture. Sql azure data sync. This is the easiest way to implement data sync. It is a matter of configuration. But unfortunately still in preview and Microsoft no recommended for production yet. We have been using to sync 20 databases spread around different geographical location and so far works good. No coding required. But you may have to pay in future when you are using this service. At the moment it is free. Microsoft Sync Framework Microsoft sync framework is for developers. Developers can use Sync framework as an API and develop sync application. Sql azure data sync use sync framework internally. To implement data sync with azure you need

Categories : SQL

How can I select data in the same query from two different servers and databases from SQL Server Management Studio?
On your sql server, set up a linked server to the db2 database. Then write your query on sql server. I suggest that you use openquery for the db2 stuff. If you have to combine the data, populate a sql server temp table with the openquery results and work from there. The reason I suggest this is performance. I have found that if you use this syntax select somefields from server.database.owner.table where whatever sql server will bring back the entire table from the linked server and apply the where clause afterwards.

Categories : SQL

In Django, how do I make a model that queries my legacy SQL Server and Oracle databases and sends that to the view?
You can query different databases in your ORM calls by leveraging the using statement: https://docs.djangoproject.com/en/1.5/ref/models/querysets/#using This would allow you to set up as many database definitions as you need in settings.py, then specify which DB to query at the view level. That way, you wouldn't have to change your model definition should you decide to consolidate your databases, etc.

Categories : Django

how to keep file ownership while using tar
Supply the option --same-owner to tar while extracting. tar --help tells: --same-owner create extracted files with the same ownership

Categories : Perl

c++11 - Ownership and getters
It is obvious (or should be obvious) to anyone reading your class definition that GameObject owns a transform. You are right that "shared ownership" is not implied or desired. As there is no possibility of ever not being able to obtain a transform from a GameObject you don't need something that expresses possible nullness like a pointer (raw or otherwise), so returning a reference (possibly) const seems the most idiomatic thing to do. You say that a raw pointer is unsafe but it is no more unsafe than any other direct access method. Any way you provide access to the owned transform object (and not a copy of it) gives the client the chance to take its address and store that beyond the lifetime of the owning GameObject. It is really up to the client not to do dumb things. There is no way to

Categories : C++

Rails ownership chain and STI
This is not an answer, since it's not tested, but I wanted to try and I needed formatting. For your code it makes more sense to me to have two scopes in Profile: belongs_to :account scope :user, joins(:account).where(account: {owner_type: :User} ) scope :organization, joins(:account).where(account: {owner_type: :Organization} ) If you want anyway those other classes you could do: class UserProfile self.table_name = 'profiles' default_scope joins(:account).where(account: {owner_type: :User} ) and so on with Organization profile. In case joins is not working like that, try: joins(:account).where('accounts.owner_type = User') or joins(:account).where(accounts: {owner_type: :User} ) I am not sure ActiveRecord receives hash there.

Categories : Ruby On Rails

Objective-C ARC pointer ownership vs C++
So, the instance with the -takeObj:... method owns obj after passing it in? Why does it matter if it does that with two strong references as opposed to one? In short, just use NSMutableDictionary and let both dictionaries have strong references to obj. There's not any appreciable performance penalty for this, and the foundation collections don't have built-in support for zeroing weak references, so if that's what you meant by "weak", you would be on your own anyway.

Categories : C++

best way to validate ownership with HMABTM
Excellent question! I've got a good answer too ;) (TLDR) Ditch has_and_belongs_to_many, create a model on top of the join table, put the validation logic in the join model, and use has_many :through. To demonstrate, let's consider the relationship between Artist and Song, both belonging to User. With the join model and has_many :through we'll have these model classes: class Artist belongs_to :user has_many :artist_songs has_many :songs, through: :artist_songs end class Song belongs_to :user has_many :artist_songs has_many :artists, through: :artist_songs end class ArtistSong belongs_to :artist belongs_to :song end This is will significantly clean up your validation logic, just add it in one place: class ArtistSong #... validate :ownership private def ownership

Categories : Ruby On Rails

How do you take file ownership with PowerShell?
Try something like this: $file = Get-Item $path $acl= $file.GetAccessControl() [System.Security.AccessControl.FileSecurity] $acl.SetOwner($newowner) $file.SetAccessControl($acl)

Categories : Powershell

How to take ownership of a code review task?
You should be able to create a new work item query and find the Code Review Request/Response work items and then change the Assigned To field to the appropriate person. Have you tried that route yet? All of the code review workflow items are simply work items in TFS. You get all of the normal benefits of work items!

Categories : Tfs

Google App Engine Entity Ownership
There are two main ways. (I am going to assume your using python which defines examples) Option 1. Make the User the ancestor of all of their recipes recipe = Recipe(parent=user.key) Option 2. Use key property class Recipe(ndb.Model): owner = ndb.KeyProperty() recipe = Recipe(owner=user.key) all recipes for user with option 1 recipes = Recipe.query(ancestor=user.key) all recupes for user with option 2 recipes = Recipe.query().filter(Recipe.owner == user.key) Which one you use really depends a lot on what you plan to do with the data after creation, transaction patterns etc.... You should elaborate on your use cases. Both will work. Also you should read up on transactions entity groups and understand them to really determine if you want to use ancestors https://d

Categories : Google App Engine

Explicitly expressing ownership in Delphi
std::unique_ptr cannot be copied: there can be exactly one object owning this resource at a time In the Delphi language, there is no type nor mechanism that prevents to share 'ownership'. A copy of any reference can always be made. (Read: there's nothing in Delphi that allows you to block assignment, as David nicely put it.) When the unique_ptr goes out of scope, the resource is automatically freed. In Delphi, this is only possible with (or via) interfaces. Delphi has no garbage collector. And there is exactly one object who is responsible to clean the object up. Responsibility for cleaning up you have to enforce by yourself. Or delegate that task to a(nother) framework. For example, the default Delphi VCL class TComponent implements automatic ownership (and destruction) t

Categories : C++

How to get file ownership and permissions in android
You can create a Process object and execute the command. You could append the path of the File object as parameter. After that you can read the result from the InputStream. Please comment if you need an example.

Categories : Java

Changing ownership after a git post-receive
You should always push to a bare repository, so there is no question of permission. You can have a post-update hook which 'ssh (public key)' to your DocumentRoot and does git pull. That way your pushes are instantly available on webserver. Although this technique will work, but pulling stuff instantly to DocumentRoot might not be a good idea, I'd rather do it in a cron so that webserver caches needn't be refreshed at unpredictable interval.

Categories : GIT

How change format date in SQL Server or how true insert datetime in SQL Server by c#
How are you inserting in the database? From C# code you should always use parameters for passing values. The framework does the conversion for you! More info: http://msdn.microsoft.com/en-us/library/ms254953.aspx http://msdn.microsoft.com/en-us/library/4f844fc7.aspx

Categories : C#

Object ownership validation in Django UpdateView
http://ccbv.co.uk/projects/Django/1.5/django.views.generic.edit/UpdateView/ Go through the above link to understand how UpdateView works. get_object is supposed to return the model instance, It is not supposed to return HttpResponseRedirect object, that's why you are getting that error. Try doing the check in dispatch method like the following. def dispatch(self, request, *args, **kwargs): """ Making sure that only authors can update stories """ obj = self.get_object() if obj.author != self.request.user: return redirect(obj) return super(UpdateStory, self).dispatch(request, *args, **kwargs) PS: I guess it is not recommended to override dispatch. But as you have to do the check on both get and post methods, overriding dispatch will be easier.

Categories : Django

Using C++ inheritance to enhance a class with ownership semantics
The way I do it is push the ownership issue farther down. Foo has a buffer, and knows how to clean up that buffer when it is destroyed. The std::shared_ptr has a destroy callback that can be used for that purpose, for example. This shows the accepted pattern of having the smart pointer know how this particular instance is to be deleted. Really, you should have a possibly shared buffer so the total ownership is tracked. Implicitly programming it to be "not me" with some other place knowing what's going on is rather brittle. "checking ownership flags" is just a special case of "am I the last/only owner" which has a general robust implementation you can use. In the twist you mention, how does the C code that owns the buffer coordinate with your class's lifetime? It sounds bad, and hav

Categories : C++

How to prove the ownership of a public git/github repo?
How picky are they? I would think the first thing to try is to show them the very first commit. It's normally a git object you can't remove from the history so it should show your address email and/or name. If it's not enough, you can probably show the the public key on your machine and the public key registered on Github is the same? Third theory, maybe just ask Github support? They may have more internal history that may be useful.

Categories : GIT



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.