w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Can't connect to mysql db using root@localhost in a mamp environment
you have to call mysqli_connect without a password parameter, else php tries to authenticate the user using the empty string as password. try mysqli_connect($host, $user); only, withouth the ''.

Categories : Mysql

Copying a WF4 instance store database from production environment to development environment?
Jesús López gave me the answer at this MSDN thread, where I asked exactly the same question as in this StackOverflow’s thread. First, he asked: “Is the [IIS] path to the workflow service (the xalmx file) the same in production than in development? If the path is different because the virtual directory is different then is also different the WorkflowHostType column and that might cause problems.” After letting him know that IIS site names were actually different in production and in development environment, even though the rest of the paths to workflow services were the same, he replied: “Both [IIS sites] must have the same name. I've just tested it. I changed the site name in IIS and suddenly WorkflowHostType changed. So idle persisted workflows won't load any more.” Then he

Categories : Dotnet

Using MySQL on development environment and SQL server on the live environment
While on the development environment, I have installed the commercial system with the default MYSQL that comes with the product. Due to licenses & resource restrictions. Can't you use SQL Express? But yes, you can use Entity Framework with MySQL, and it should be possible to accomplish by just changing the connection string. Beware that the MySQL-EF connector seems not to support all possiblities of Linq to Entities.

Categories : Asp Net Mvc

Linux skip /root/.gvfs when executing df command with non-root user
I got the solution for my own question :) In df command you can pass the file system types which you would like to exclude, in this case it is 'fuse.gvfs-fuse-daemon'. So when I execute the below the command I no more get this message "df: `/root/.gvfs': Permission denied" df -x fuse.gvfs-fuse-daemon For more details one can look into df --help option.

Categories : Linux

Root immediate child nodes icons not visible when hiding root
JTree#setShowsRootHandles(boolean newValue) controls the state of the handles for root elements. Normally, this is false. Try changing to true

Categories : Java

Is sudo-ing tomcat's startup with a non-root user the same as running it as root?
Do be aware that the recommended solution to run tomcat on port 80 is to use mod-jk with the Apache web server, not to have tomcat listen on port 80 directly.

Categories : Unix

Reset MAMP Pro username and password to root/root
Assuming you still know the password, you can change the password back to root using /Applications/MAMP/Library/bin/mysqladmin -u root -p password root It'll prompt you to enter a password again, after which it'll be reset to root

Categories : Mysql

Read and Write root folder wihout root
You can use run-as on some devices to execute commands as a particular package. Google have fixed this on Jelly Bean so it no longer works: adb shell run-as app.package.name cp /data/data/package.name/file.txt /sdcard/ exit adb pull /sdcard/file.txt ~/ Here is a good article explaining file access in Android without root permissions, including a one-liner for the above script. It details how to use the new backup command: backup -f ~/data.ab -noapk app.package.name And how to extract the contents of the resulting .ab file: dd if=data.ab bs=1 skip=24 | openssl zlib -d | tar -xvf - You will most likely need the android.permission.BACKUP permission.

Categories : Android

SVN (svnserve) virtual root --root= not recognized
svn+ssh handles the whole transaction including writing and reading the files so it ignores the --root parameter in svnserve. Here is how to fix it over at serverfault -- Basically you just make svnserve into a script that calls svnserve with the proper variables.

Categories : Svn

Document root element "hibernate-configuration", must match DOCTYPE root "hibernate-mapping"
DOCTYPE for <hibernate-configuration> should be: <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

Categories : Hibernate

is there any method to draw a tree with a root , the root's previous nodes and successor nodes?
Couple of ideas you might find useful: You can use the tree layout to place the nodes in the canvas, create link objects pointing back and forth, then bind the link objects to a diagonal. http://www.durablejs.org/examples/flowchart/1/admin.html You can also use place the nodes using a pack layout, create the link objects pointing back and forth, and bind the links to a Bezier curve. http://www.durablejs.org/examples/statechart/1/admin.html You can find the code for the graphs above: https://github.com/jruizgit/durable/tree/master/lib/durabjevisual.js

Categories : D3 Js

How can I remove the root node and make the first child the new root node with XSLT?
Add a rule to the identity transform that adds nothing to the result tree for your document element other than the processing of its children: <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/*"> <xsl:apply-templates select="*[1]"/> </xsl:template> <xsl:template match="@*|node()"><!--identity for all other nodes--> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> (edited to be agnostic to the name of the document element) (edited again to only preserve the first child element of the document element)

Categories : Xml

Including from child theme root or else include from parent theme root
To answer your question directly based on your sample, i would not check to see if the file has been placed in the child theme. If a child-theme developer has customized the file, they can simply declare the function and include their own file (wherever they place it). There is no risk of code duplication because your sample function is simple enough. Even if you simplified your code for the purposes of placing it here....you can always keep includes wrapped in a very simple function that can be declared by a child theme. This will keep PHP running efficient and not having to check for files all the time.

Categories : Wordpress

Defining root of HTML in a folder within the site root folder
You need to set the base tag. If you add the tag in your page <head> like this: <base href="http://yoursite.tld/folder/"> it should display images and with sources relative to this base path.

Categories : HTML

I want to set authenticated users' root to a nested resource, their dashboard, instead of the home#index page non-authenticated users use as root
Option 1: In your dashboards controller, change to: @user = current_user @dashboard = current_user.dashboard This will also prevent users from seeing other user's dashboards. Option 2: Now, if users can see other user's dashboard fine, then change your route: root :to => "dashboards#find", as: :authenticated_root and in your dashboards controller: def find redirect_to user_dashboard_path(current_user, current_user.dashboard) end

Categories : Ruby On Rails

Rewrite URL to something that's not contained in the URL
For things like this, I would tend to use slashes as delimiters, since that tends to be how people thing - this means you can have have a title of "my_title_either/or", but that's usually ok. RewriteRule ^([^/]*)/([^/]*)$ /articles/$1.php?article_header=$2 You would be responsible yourself for making the article header unique. Your second version, with the unique id, would be RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /articles/$1.php?article_id=$2 I havent used $3 at all; if you have a unique id, you don't need anything else, though you could still use it if you want: RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /articles/$1.php?article_id=$2&title=$3

Categories : PHP

Reference another Aggregate Root inside another Aggregate root?
By the sounds of it you have an Installation AR. When requiring an AR in another you should model the contained AR as a only the ID in the container or a VO if required. You need to have hard edges around your ARs. Back to the Order / OrderLine example :) An OrderLine seems to 'require' a Product but you shouldn't ever give a Product instance tot eh OrderLine. Instead only model, say, the ProductName and ProductId as a VO in the OrderLine. Now you have a distinct edge to your Order AR. Hope that helps somewhat.

Categories : Entity Framework

wrong child root name in rabl and can't set child root name
I've encountered the same exact bug, the problem seems to be setting the object_root to false. Following the comment of Bigxiang I have experimented a bit and found that this works fantastically: child( {:rsvp => :rsvp}, {:object_root => false} ) do extends "users/index" end Note both the round parentheses "()" and braces "{}".

Categories : Ruby On Rails

superclass contained methods C#
Without seeing your code its hard diagnose. However, have you made your property methods public. For example: public class Person { public Address Address { get; set; } ... } public class Instructor : Person { public void DoSomething() { Address.City = "Wellington"; } }

Categories : C#

Iterate through cv::Points contained in a cv::Mat
If I understand you correctly, you wish to sort pixels by their match score, and then get the points corresponding to these pixels in the sorted order. You can accomplish this by reshaping result to be a single row, and then calling cv::sortIdx() to get the indices of the pixels in sorted order. Then, you can use the indices as offsets from the beginning of result to get the position of that particular pixel. UPDATE: I noticed one possible issue in your code. It looks like you assume result contains uchar data. cv::matchTemplate() requires that result contain float data. cv::Mat_<int> indices; cv::sortIdx(result.reshape(0,1), indices, CV_SORT_DESCENDING + CV_SORT_EVERY_ROW); cv::Mat_<float>::const_iterator begin = result.begin<float>(); cv::Mat_<int>::const_itera

Categories : C++

self contained linked list
In the constructor - head = NULL; head -> data = str; Code has undefined behavior. You should not access members on a NULL pointer. After head pointing to a proper memory location, you should also do - head -> next = NULL; in the constructor for the append operation to reliably work. I think Element::Append should receive the std::string parameter given that you are trying to do - newnode->data = elem;

Categories : C++

Links Contained in iframes do not do anything
When I try with Opera, I get an error saying "The website does not permit its content to be displayed in a frame. It must be displayed in a separate window." If it worked until recently, my guess is this is a recent change in how the website works. I don't think you can do anything about it, but tell your users they will need to open all links in new tabs.

Categories : Javascript

self-contained portable emacs
If you can compile emacs in a machine, you can run from there without installing it. Just execute the binary that the compilation creates for you (you may need to change your path, since a emacsclient from different versions may not work well together). I know this is not what you were looking (since the emacs is not portable and you might lack a compilation environment in that machine), but the trick might work for you. Of course the TRAMP over ssh approach that assem suggested is a better solution (and what I personally use)

Categories : Emacs

How can I see if a value is contained in an Array or Class?
Use enums: public enum Value { V2, V3, //... V10, J, Q, K, A } public enum Suit { Diamonds, Spades, Hearts, Clubs } public static bool ContainsCard(IEnumerable<Tuple<Suit,Value>> deck, Suit suit, Value value) { return deck.Any(c => c.Item1 == suit && c.Item2 == value); }

Categories : C#

Self-Contained Linked List
Your code is expected to print "This" Because you call root->Next()->Print(1); And print is defined to print Next()->data.c_str(), by the way it's unsafe because Next() may be NULL. So your list is like "Hello" -> "World" -> "This" where root is "Hello", root->Next is "World", and of course it will print "This" in your case What you prabaly meant is to have the Print() method to print the current value, not the next node's value. So change it to printf("The next node is: %s ", data.c_str()); And use standard streams for printing (std::cout) since it's c++

Categories : C++

Accessing files within contained directories
Use find and xargs: find . -type f -name '*.filetype' | xargs chmod ugo-w Replace . with the name of the directory, if it is not the current one. Or, just use find: find . -type f -name '*.filetype' -exec chmod ugo-w '{}' '+'

Categories : Bash

Get checksum of files contained in a MSI package
Windows Installer contains the MsiFileHash table. It gets populated at build time with 128-bit hashes of all files in the File table. The InstallPackage Files property brings back a dictionary of of InstallPathMap objects. The keys of this collection have the File key from the File table and that can be used to query the MsiFileHash to get the hash. If you need to calculate the hash of an installed file for comparison against this stored hash, the Installer class found in Microsoft.Deployment.WindowsInstaller has the GetFileHash method that class the underlying MsiGetFileHash function.

Categories : C#

How to check if an IP is contained in a network with python?
Using Python 3.3+ ipaddress >>> import ipaddress >>> ipaddress.ip_address('10.40.0.1') in ipaddress.ip_network('10.40.0.0/24') True >>> ipaddress.ip_address('10.40.2.1') in ipaddress.ip_network('10.40.0.0/24') False There's also backport of ipaddress. Using ipaddr >>> import ipaddr >>> ipaddr.IPAddress('10.40.0.1') in ipaddr.IPNetwork('10.40.0.0/24') True >>> ipaddr.IPAddress('10.40.2.1') in ipaddr.IPNetwork('10.40.0.0/24') False

Categories : Python

Comparison of one float variable to its contained value
The conversion from decimal fraction to a binary fraction is precise only if the decimal fraction can be summed up by binary fractions like 0.5, 0.25, ..., etc. For example in your case 0.375 = 0.25 + 0.125 = 2-2 + 2-3 So it can be represented exactly by using binary fractions. Where as the number 0.385 can not be represented by using binary fractions precisely. So numbers like 0.5, 0.25, 0.125, ..., etc. or a combination of these numbers can be represented exactly as floating point numbers. Others like 0.385 will give incorrect results when the comparison or equality operations are performed on them.

Categories : C

set Id equal to number contained in textbox
The quick and dirty answer is to make the following change: string Query = "select * from Re where Part_PartID = " + txtPartId.Text; assuming Part_PartID is an integer. If it is a string then you can use: string Query = string.Format("select * from Re where Part_PartID = '{0}'", txtPartId.Text); The compiler is not going to inject the value of the text in txtPartId into your query string for you. However, that introduces the scope for SQL injection, so I strongly suggest you parameterize your query. There are many examples of this on SO.

Categories : C#

access to a std::vector contained by another class
You can use: RawNumberContainer getRawNumbers() const { return rawNumbers; } This way you'll make sure you can't edit the vector (only read-only access) and spare you of another variable being manually declared in your code.

Categories : C++

How to build a self-contained library with cabal?
it was fully self-contained and user wouldn't be bothered with installing haskell, cabal and all the dependencies Then you must distribute your library with all its dependencies -- the Haskell compiler, runtime, C libraries, Cabal, dependent libraries. This is a non-trivial task -- you're rolling your own Haskell Platform. You could modify the HP source and generate installers. They would be in effect standalone installers for your library.

Categories : Haskell

Trasitioning li to width of contained text
Unfortunately what you want to achieve, to animate to width: auto;, can't be done using CSS only. You can test it here. This is due to this issue, that isn't only related to Firefox: Bug 571344 - Support transitions to and from 'auto' values of left, top, width, height, etc.. You can build a little JavaScript workaround, that will help you out here: HTML <ul> <li>Content 1 with more text</li> <li>Content 2</li> </ul> CSS ul > li { float: left; width: 50px; overflow: hidden; border: 1px solid rgba(0, 0, 0, 0.3); white-space: nowrap; text-overflow: ellipsis; -webkit-transition: width 0.55s ease-in-out; -moz-transition: width 0.55s ease-in-out; -ms-transition: width 0.55s ease-in-out; -o-transition: w

Categories : CSS

How can I get things properly contained in a wrapper div?
Okay lets make a step by step solution (watch for the edits). Background Your background is set in the body. So the body needs to be extended to fill the whole page. I would recommend this way but there are others. body,html{ height:100%; } Normally the body would fit its contents but with position:absolute this mechanism doesnt work anymore. Also remove background: #fff css (normalize.css) from the html. html { background: #fff; color: #000; font-size: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } Also your background scrolls with your content. Set background-atachment: fixed to change this. Wrapper Same counts dor your wrapper which holds the white background. Set its height to 100% too. div#main { height: 100%; } The reason why your content is big

Categories : HTML

Condition becomes true if the set is not contained in the string
/^(?:if|else|for|while|do|switch|}|return)$/ will match the exact strings "if", "else", "for", "while", "do", "switch", "}", and "return". If you want to match strings that do not contain any of those, you would need to do something like the following: /^(?!.*(?:if|else|for|while|do|switch|}|return))/.test(str) You may want to add word boundaries here, otherwise this will also fail if part of a word in str contains a word in your set (for example "donut" contains "do"). Of course you would only want the word boundaries around the words, so } would need to be handled separately. /^(?!.*(?:(?:if|else|for|while|do|switch|return)|}))/.test(str)

Categories : Regex

Variable value contained within function in Python
The issue is that while num is defined in the scope of the function guessgetter, it isn't defined elsewhere in your code. If you want to use the value of num generated by the function, try adding as the last line of your function return num and then calling the function as follows: x = guessgetter() to store the value that you get into a variable x that can be used outside of the function.

Categories : Python

Input sequence contained in an array
When you have a non match in the sequence, you never reset j so you start looking for the rest of the sequence starting to what ever value j was left at. Your program looks for the sequence B but doesn't require it to be contiguous. You also don't check for when the sequence is completed so it for example B is at the start of A the j will keep incrementing and B[j] will overflow into unknown memory which is unlikely to match A so will give you an incorrect result. To fix this just check for when the whole of B is found and exit the loop. Substituting the following will fix this: if (j == M) break; // Break the loop when B sequence is found if (flag == 0) { j = 0; // This was missing if (i == N-M) { contained = 0; printf("The sequence B is not contained in

Categories : C

I would like to be able to create a variable with a name contained in a string
Use a dictionary Dim dic as new Generic.Dictionary(of String, Rectangle) dic("First")=New Rectangle(1,1,50,50) dic("Second")=New Rectangle(2,2,1000,200) Dim outDicValue as Rectangle = dic("First")

Categories : Vb.Net

Is it possible to Iterate on objects contained in another class?
If 'B' needs to be accessed (logically) outside of it's class, there's no use making it private. So just make B public but make sure you provide a standard getter and setter instead of addressing the fields directly.

Categories : Java

How to Access Elements in a List that is Contained in a Map?
Untested, but I think you can cast the values: if (prediction.containsKey(value)){ double total = (Double) prediction.get(value).get(0); Map items = (Map) prediction.get(value).get(1); for (double i=0; i<=items.size();i++) { double a = ((Double) items.get(i)) / total; } } But this is not very clean code style. Try to split the Map into two maps. One containing Double and one containing Maps

Categories : Java



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