w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Dual use of composite foreign keys
Here's what you started with. CREATE TABLE medication ( "id" INTEGER NOT NULL, -- You don't need this. "therapy_id" INTEGER NOT NULL, "day" INTEGER NOT NULL, "revision" INTEGER NOT NULL, "substance" VARCHAR(100), "dosage" VARCHAR(50), PRIMARY KEY (id), -- Drop this. FOREIGN KEY(therapy_id, day, revision) REFERENCES day (therapy_id, day, revision), -- Ok, but should be PK. FOREIGN KEY(therapy_id) REFERENCES therapy (id) -- You don't need this. ); The column "id" serves no useful purpose, and has instead convinced you that you don't need a unique constraint on the real key: {therapy_id, day, revision}. Replace the useless primary key constraint on "id" with a primary key constraint on {therapy_id, day, revision

Categories : SQL

Role of tty in Linux kernel
This file is to support tty on user level interface or console.This also implements echoing. tty: Print file name of terminal on standard input.For more info give info tty command on shell.

Categories : C

Switch tab and backtick keys Ubuntu Linux
run xev on a command line and find the keycode for the key (UK its keycode 49) then run xmodmap -e "keycode 49 = Tab replacing the keycode from xev when you press that key. You should now have a remapped key ! to save these you need to run xmodmap -pke >~/.Xmodmap update you need a modifier too xmodmap -e "keycode 49 = Tab asciitilde should work

Categories : Ubuntu

Custom Joystick Behavior Linux - Adding Mod Keys
I would just try to use the existing Linux joystick API https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/input/joystick-api.txt?id=refs/tags/v3.9.6 then is user space you can get all the joystick events, and process them as you see fit. Specifically you can get button press events and use logic as follows: void handle_button_y_press() { if (button_X_pressed) { do_y_function_a(); } else { do_y_function_b(); } }

Categories : Linux

sorting with multiple keys with Linux sort command
I find this caution in the GNU sort docs. Sort numerically on the second field and resolve ties by sorting alphabetically on the third and fourth characters of field five. Use ‘:’ as the field delimiter. sort -t : -k 2,2n -k 5.3,5.4 Note that if you had written -k 2n instead of -k 2,2n sort would have used all characters beginning in the second field and extending to the end of the line as the primary numeric key. For the large majority of applications, treating keys spanning more than one field as numeric will not do what you expect. I'm not sure what it ends up with when it evaluates '1001 3' as a numeric key, but "will not do what you expect" is accurate. It seems clear that the Right Thing to do is to specify each key independently. The same web page

Categories : Linux

Linux sort command: keys with the same start but different length are not sorted in the same order
Do not use the "-n" option, which compares according to the string numerical value. -n Compare according to arithmetic value an initial numeric string consisting of optional white space, an optional - sign, and zero or more digits, optionally followed by a decimal point and zero or more digits. Your keys are strings, not numbers. Instead, you should just do: sort -k1 file.txt -o file.txt Additional info: You can see that sort considers your keys identical when -n is used by doing a unique sort: sort -un file You will see that a1k3-b3 and a1ke are considered equal (and therefore only one is emitted). If instead you do: sort -u file The result will contain both a1k3-b3 and a1ke, which is what you want.

Categories : Linux

Dynamic Role from database to show content to user based on their role
Maybe you want to store the different ROLES in a Properties file and get them in the code, like: @PreAuthorize("hasRole(" + PropertyManager.getProperty("role.admin") + "')" + '"') Or when you configure the GRANT permissions to the different users you are possibility to select different columns for each role. So in the Controller of the app redirect to the specific method

Categories : Java

How to deploy a Node.js web role along with a .NET web role in azure cloud service project?
The development experience probably will be smoother if the Node.js component of the application is deployed as a separate cloud service instance. But it is possible to automate the deployment using startup taks as described in Run Startup Tasks in Windows Azure. You can create a command batch file to download anything you need and install it on the instance. You can run it with administrative privilege. You can listen to a port and have it set up as a cloud service endpoint. You can even deploy the files as part of your cloud service project and just configure and run them through the startup task. Use RDS to debug this script via logging and system events.

Categories : Dotnet

Connect Web Role to Web Site Role in the same windows azure solution
https://connect.microsoft.com/VisualStudio/feedback/details/790187/vs2012-add-service-reference-discover-services-in-solution-feature-creates-empty-proxy The types in the WCFRole and WebsiteRole are colliding. Right click and the Service Reference -> Configure service reference -> Uncheck the "Reuse reference Types" working like a charm now :)

Categories : Wcf

Deploying WCF Service on Azure : Web Role or Worker Role?
A web role assumes that the application will be hosted in IIS. If your service does not require any of the benefits provided by IIS or its HTTP stack, then hosting it in a worker role may do you perfectly fine and also provide you a lower resource utilization for that service (since there's no "overhead" for the IIS server).

Categories : Wcf

Role of data-role attribute in html markup
In summary: "The value of the role data attribute is the name of the widget in lower case e.g. "autocomplete", "dropdownlist" etc." You can find info here: http://docs.kendoui.com/getting-started/data-attribute-initialization#example---initialize-a-kendo-ui-widget-using-a-data-attributes

Categories : Javascript

Whats the difference between role and name in symfony2 role class?
The security.yml role_hierarchy is to do with role's inheritance. It allows you to create many roles and then state that some roles inherit other roles. http://symfony.com/doc/current/book/security.html#hierarchical-roles ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] The above means that if as a user I have the role "ROLE_SUPER_ADMIN" (which comes from the role field in your group entity) then I also inherit the roles "ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH". so: ROLE_TO_INHERIT: [ROLES_TO_INHERIT_FROM] So your name field has no meaning in security.yml only your role field. Role hierarchy is separate to where you store your roles. It is an extra level of configuration so that, for example, you don't need to add 3 roles to every super admin user but rather

Categories : PHP

Web Role vs Worker Role in Cloud Services / Node.js
The difference is that Node Web Role will runs through IIS. But Node Web Worker is VM and runs through node.exe it self as clustered worker. Main difference here is that your virtual hosts and web platform setup will depend on the option you choose. As you aware setting up IIS is very different from node.exe it self. So with Web Role it will proxy all traffic through IIS rather than directly through node master process. Cons/Pros: Main advantage of Web Worker as it does not relies on any stack and you have full control over what runs there and how it affects your app. As well if you already have something ready, you can reuse it without big problems. In mean time you will need to manage your stack your self, by implementing master node process and then forking workers your self. While u

Categories : Node Js

What is the role for a controller and what is the role for $scope in AngularJS?
The $scope is an object that both the view and the controllers know... It's not actually the controller itself, but through it you can pass in references to data and methods and use them inside of the view. The controller in angular is more like a presentation model, which holds up an object which is a "mutual friend" of both the view and the controller... that's how I like to think of it at least :)

Categories : Javascript

Posting from web role to another web role Windows Azure
It is better to make the API call from server side such as MVC controller in your web app. You can include security key and other things that you don't want to expose to others. When you make API call directly from javascript for another subdomain or url, you are creating cross-domain ajax request. In your javascript, you will make an ajax call to your controller action in your web app. Web app will make the call to whatever service it is talking to. You can also test your API from fiddler with POSt/GEt/PUt/DELETE requests. If you want to directly call from javascript and host web roles under different subdomains, you need to make CORS request: http://www.html5rocks.com/en/tutorials/cors/. You can also look at this related question: Running WebApi alongside MVC project in Azure

Categories : Azure

How to add an user to sysadmin role using ALTER ROLE?
alter role is for database roles, but sysadmin is server role. Try alter server role instead: ALTER SERVER ROLE server_role_name ADD MEMBER p_sys

Categories : Sql Server

Azure Web Role can't see VM's internal IP (but VM can see web role)
For completeness, moving my comment to an answer: While the virtual network is allowing traffic in both directions, you'll need to enable ICMP via the firewall, which will then let your pings work properly.

Categories : Azure

How to deny a user in a role unless they are in another role in .NET c#
Isn't it enough to allow Admin specifically before your deny rule? The authorization rules are checked from top to bottom until a match is found. <authorization> <allow roles="Admin"/> <deny users="?" roles="ROLE1"/> </authorization>

Categories : C#

Connecting an Azure worker role to a dedicated cache worker role
Hello maybe you should try to set the connection between them using Inter Role Communication, you can find an answer for how to make the inter role communication in the following stackoverflow website: How to do inter-role communication with Azure? you can also find more details in the following link: http://blogs.msdn.com/b/avkashchauhan/archive/2011/10/30/communication-between-windows-azure-roles.aspx I hope this helps you solve your problem please let me know if you need anything else.

Categories : Caching

column pk dual varchars or int?
If you add a surrogate autoincrement integer column, you still need a unique index on the JobID, SubJobID columns. This is the natural primary key. It may not add much value except using more disk and memory to store the extra column. Saying that, if the composite (JobID, SubJobID) index is used in child tables as a foreign key, it can make more sense to use one. 10000 rows here could have 10 million child rows: then the varchar overhead matters. However, there is no truth in anything you read that says Thou shalt always have an identity/autoincrement primary key It is an implementation decision for performance depending on the design.

Categories : SQL

Function dual to std::move?
If you can manipulate T you could template the constructor. #include <iostream> using namespace std; class B { int x; public: B (int i) : x(i) { } B (B && b) : x(b.x) { cout << "B moved (" << x << ")" << endl; } B (B const & b) : x(b.x) { cout << "B copied (" << x << ")" << endl; } }; class A { B b; public: template<typename TB> A (TB && init_b) : b(std::forward<TB &&>(init_b)) { } }; B foo (void) { B x(3); return x; } int main (void) { A a1(foo()); B b1(4); A a2(b1); return 0; } Prints B moved (3) B copied (4) As far as I understand reference collapsing you should come out with a constructor A(B&) forwarding to the copy constructor of B and a A(B&&a

Categories : C++

Dual divs on the same place
When I click on About me the "slide down div" will slide down and show the about me section. And when I click on contact the contact section will be showed...) How can I make this, and I'm a beginner when it comes to coding and hopefully this can be solved with a simple line of code... Actually, this can be done with a simple line of code! Change your "About me" link to this: <a href="#AboutMe">About Me</a> And, create a div like this: <div id="AboutMe">This is about me!</div> When you click the link, your browser will scroll to the AboutMe div. JsFiddle: http://jsfiddle.net/NmrbP/11/

Categories : Javascript

Dual authentication mode
It is possible technically. The classic Mode doesn't requires much effort and can be implemented more or less easily. However when in integrated mode , some careful work is required to achieve the same. Check one post here which may be of help to you for getting started.

Categories : Asp Net

three.js dual viewports only one displays
Needed the following statement (in the javascript init function) to prevent renderer clearing its buffer after rendering the first viewport:- renderer.autoClear = false

Categories : Javascript

Highcharts - Dual yAxis not displaying
You've got two problems I can see right off the top: 1.) You haven't assigned any series to plot against the 2nd y axis. yAxis: 1 2.) You have a right margin of -4, which is suppressing the drawing of the right y axis. marginRight: -4, // where's the axis going to draw if it doesn't have space? Updated fiddle.

Categories : Javascript

Best Practice for Dual Layouts in Rails 3
It seems to me an admin might be doing different things with a user than an end user would be doing so different controllers may not be completely unDRY. However, if they are completely the same and you just want to have a different layout, then you can just set your layout based on the current user. Something like this would work: layout :determine_layout def determine_layout return 'admin' if current_user && current_user.admin? 'application' end

Categories : Ruby On Rails

Get selected values in a dual listbox PHP
This is the weird code: function listbox_selectall(listID,isSelect) { var listbox=document.getElementById(listID); for(var count=0;count<listbox.options.length;count++) { istbox.options[count].selected=isSelect;//<-- ? } } Maybe, you wanted to say: listbox.options[count].selected=isSelect; You said, that only 1 value from "destination" is submitted to PHP. To allow multiple values to be submitted, add [] to the names of the <select>-s: <SELECT id="s" size="10" name="source[]" multiple> <SELECT id="d" size="10" name="destination[]" multiple> Also, there is no need to use name attribute for options. You don't use it anywhere.

Categories : PHP

Formatting column name in dual table
Try this SELECT 'HELLO WORLD' as HELLOWORLD FROM dual; or SELECT 'HELLO WORLD' as "HELLO WORLD" FROM dual; See SQL Fiddle

Categories : SQL

Dual play frameworks on the same system
There is answer for similar problem dedicated for mac/unix. In Win you can create symlinks pointing to the proper version of Play directly in the instance folder

Categories : Java

Has anyone had success with ADT on a (dual-booted) Chromebook?
Are you sure you installed the driver correctly? If so, try switching Nexus 7's usb mode from storage mode to pics transfer??/view?? mode(forgot the exact name here). Hopefully it does help.

Categories : Android

array loop keep a certain number of keys and replace the keys with an associative key based on the elements
For deleting the array elments you can use array_splice() in php $input = array("red", "green", "blue", "yellow"); array_splice($input,3); print_r($input); Ouptput Array ( [0] => red [1] => green [2] => blue ) So you can do array_splice($val,65);

Categories : PHP

Will junction table contain the foreign keys or the primary keys of the individual tables
Correct. Your 'junction' table or 'association' table will the contain the PK values of the tables on either end of the M2M relationship. Often times these are the only two columns in the association/junction table and they can/usually form the PK of the association/junction table.

Categories : Database

Oracle Statement performance: Retrieve primary keys exluding combined foreign keys
You could try this structure: select yourfields from yourtables where whatever and somefield in (select somefield fromyourtables where the conditions are the same as above minus select the same field from whereever where you want to exclude it) If it were my problem, I'd consider it worth trying.

Categories : SQL

Generate ID keys in a table with composite keys using Doctrine2 and Symfony2
Back to basics. I'd suggest starting here: http://docs.doctrine-project.org/en/latest/reference/association-mapping.html class KUser { /** * @ORMId * @ORMColumn(name="id", type="integer", nullable=false) * @ORMGeneratedValue(strategy="AUTO") */ protected $id; class Interest { /** * @ORMId * @ORMColumn(name="id", type="integer", nullable=false) * @ORMGeneratedValue(strategy="AUTO") */ protected $id; /** * @ORMManyToOne(targetEntity="UserBundleEntityKUser") * @ORMJoinColumn(name="kuser_id", referencedColumnName="id") */ protected $kuser; That is all you need to establish a one-way ManyToOne relation between Interest and KUser. If you need it bi-directional then add an

Categories : Symfony2

Relational Database Inheritance foreign keys and primary keys
It would probably make sense to have the child class tables reference the parent class, instead of the other way around. Then you can have an id column on the Entity table which is unique and foreign keys from the children to their parent instances. Presumably this will help when you want to use the data to instantiate an object in your code as well, since you should know which class you are instantiating and only care about its ancestors, not its children.

Categories : Database

Code First - Two foreign keys as primary keys, unable to add migration
You specify a composite key by either adding the [Column] attribute to the data annotations... [Key, Column(Order = 1)] public int PollId { get; set; } [Key, Column(Order = 2)] public int UserId { get; set; } ...or by using an anonymous object with Fluent API: this.HasKey(x => new { x.UserId, x.PollId }); this.HasRequired(x => x.User) .WithMany(u => u.PollVotes) .HasForeignKey(x => x.UserId); this.HasRequired(x => x.Poll) .WithMany(p => p.PollVotes) .HasForeignKey(x => x.PollId); Don't forget the lambda expressions for the inverse navigation properties in WithMany, as shown above, and remove the redundant configurations in UserConfig and PollConfig.

Categories : Entity Framework

R - data.table by group by - order of keys and missing keys
How about... myJ <- function(key,...) do.call(data.table,list(...))[,key,with=FALSE] DT1[myJ(B=1,A='A',key=key(DT1))] or myJ1 <- function(...) myJ(key(DT1),...) DT1[myJ1(B=1,A='A')] This way, you have to label the items correctly.

Categories : R

Why .sendKeys(Keys.chord(Keys.CONTROL, "a")) does not work in Chrome
Have you tried to use action builder? For example, from our automation suite: public void selectAndDeleteTextViaKeyboard() { selectTextViaKeyboard() deleteViaKeyboard() } public void deleteViaKeyboard() { Actions builder = new Actions(webDriverProxy.getWebDriver()); builder.sendKeys(Keys.DELETE) .release().perform(); } public void selectTextViaKeyboard() { Actions builder = new Actions(webDriverProxy.getWebDriver()); Action select= builder .keyDown(Keys.CONTROL) .sendKeys("a") .keyUp(Keys.CONTROL) .build(); select.perform(); }

Categories : Selenium

Dual GridView simultaneous and syncronised scrolling
So I ended up biting the bullet and going back to one grid view and battling through the complicated code since no matter what I tried with the scrolling there was always a lag before the other grid caught up and I just couldn't find a way to smoothly scroll both grid views at the same time.

Categories : Android

qt dual-stack ipv4 & ipv6 application
Definitely create a local IPv6 network environment. A lot of things work the same in IPv6 as in IPv4, but a lot of other things are different. When developing applications that use IPv6 you should have some hands-on experience. You wouldn't expect someone who has never used IP to develop an application that uses IPv4, would you? Some key differences: IPv6 addresses are written in hexadecimal IPv6 hosts will probably have multiple addresses An IPv6 address that starts with fe80:This is the link-local address. Every IPv6 hosts has one for every interface it has. Link-local addresses exist on every link (ethernet segment, LAN) and they use the same address range on each LAN. It is therefore impossible to route them, but they are very useful when communicating only within the LAN. One or m

Categories : Qt



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