w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Running Hadoop Examples
If your hadoop is correctly installed use : {path to hadoop install}/bin/hadoop jar {path to hadoop install}/lib/hadoop-exemple.jar wordcount {input file} {output file} You should put some files on your hdfs first using : hadoop dfs -copyFromLocal {file to copy} {path on hdfs} Hope that helps

Categories : Java

TypeScript fails running playground examples
It seems that you are not running TS 0.9.x (despite what you said). I suggest you uninstall your current version, and then, download + install the version from here : http://www.microsoft.com/en-us/download/details.aspx?id=34790

Categories : Jquery

WEKA training examples and testing examples do not match
For any preprocessing task you should use the 'FilteredClassifier'. Thereby, the actual preprocessing operation is determined based on the training set only and then applied to the testing data. For instance: If you do discretization this way, the actual bins will only depend on the attribute values within the training data. Yet, the discretization using those bins will be applied to the testing data.

Categories : String

Laravel 4: Running composer when deploying to Heroku
Try the following Composer Fix You need to generate and include composer.lock in the repo, but Laravel's default .gitignore ignores composer.lock Remove composer.lock from .gitignore $ composer install Add your Procfile Heroku knows which processes to run for your app based on a configuration file called a Procfile. The default apache2 process (if you don't use a Procfile) points to the web root, not to /public, so we need to create a custom Procfile to serve the site from /public. Add a file with the name Procfile that contains this line: web: vendor/bin/heroku-php-apache2 public Deploy your code to the Heroku app $ git push heroku master

Categories : PHP

Running and Deploying Rails to Docker Container
I'm no expert and I haven't even used docker myself, but as I understand it, your app sits inside a docker container. You would deploy ideally a whole container with your own ruby version installed and so on. The big benefit is, that you can test exactly the same container in your staging system that you're going to ship to production then. So you're able to test the complete system with all installed C extensions, the exact same ls command and so on.

Categories : Ruby On Rails

Will deploying Rails using Torquebox on Openshift present any advantages over deploying Rails directly?
Yes, TorqueBox is much faster than the original Ruby. Not only the interpreter (JRuby) is faster, simply because it runs on JVM and uses JIT and JVM's fine-tuned garbage collector, but also it uses additional features available in JVM, like parallel threading etc. More, with TorqueBox, you have JBoss AS services at hand when you decide to use them, which I guess you will, if your app grows. Reference: http://torquebox.org/news/2011/10/06/torquebox-2x-performance/

Categories : Ruby On Rails

Some Examples From Ben-Gan Why need "AS"
First code: the inline select returns a result set = requires an alias Second code the EXISTS is a correlated subquery to do a semi-join. No result set it returns a scalar value (not a result set) - no alias needed (but no column name then) Third code: Uses ROW_NUMBER() which did not exist before SQL server 2005 alias needed because it returns a result set Not sure what you mean after that...

Categories : Sql Server

Are these examples of polymorphism?
Both are examples of polymorphism. The B is behaving like an A. (I previously missed the abstract void g() declaration. Or did you add it while we were answering??) However, in this case "an A" is a bit rubbery. Since A is abstract you can't have an object that is an A and not an instance of some other class.

Categories : Java

how do i run quickfix examples?
Ah! I should have noticed this sooner. Executor and OrderMatch are both server-side applications, so they won't talk to each other, as they are both defined as Acceptors. When you run OrderMatch, it's an Acceptor, so it's looking for an Acceptor entry in your config (which configures an Initiator). The TradeClient example app is an Initiator. Use that instead with either Executor or OrderMatch.

Categories : C++

Difference between two JS examples?
It looks to me as if Object 1 would create a new instance every time it's called? No. You're doing this with the new keyword already (and once only), email is a static object. What are the differences? The first email object does inherit from an extra prototype object that is not apparent in the code. Yet, it does e.g. store the initialisation function, making it non-anonymous. You could create another instance of your module by var email2 = new (email.constructor)(); This is completely superfluous and probably unintentional. I'm particularly interested in memory usage The first option does have an additional prototype object and needs to hold the constructor function in memory, while the second one can garbage-collect the IEFE after it was used. Use the second pattern

Categories : Javascript

Examples for DispatcherPriority
Here is a list of what each priority means: here And some info about what you can use it for: here

Categories : C#

FlexUnit 4 examples
Spring ActionScript contains quite an elaborate set of FlexUnit 4 tests combined with the Mockolate mocking library. https://github.com/SpringSource/spring-actionscript

Categories : Actionscript

Is there any svn C API examples for version 1.8.1?
There are some C++ wrappers in pysvn which demonstrate svn_client_checkout and svn_client_update: Py::Object pysvn_client::cmd_checkout Py::Object cmd_update References pysvn_client_update pysvn_client_checkout

Categories : C

Difference between these two examples?
The first one always returns undefined when invoked. The second one returns whatever callback(4) returns. Incidentally, in your example that's also undefined.

Categories : Javascript

Spring MVC app as SAML SP - examples?
Spring SAML has moved forward quite a bit and includes an example application which enables Spring MVC application to act as an SAML 2.0 service provider.

Categories : Spring

Java constructor examples
The line this.repository=repository does not create new Repository object, all it does it assign parameter repository to instance variable repository. To create a new Repository object, you need to invoke the constructor Repository r = new Repository()

Categories : Java

Asymptotic proof examples
The attempted-proof for example 1 looks well-intentioned but is flawed. First, “2^f(n) ≤ 2^C1 g(n)” means 2^f(n) ≤ (2^C1)*g(n), which in general is false. It should have been written 2^f(n) ≤ 2^(C1*g(n)). In the line beginning with “Now”, you should explicitly say C2 = 2^C1. The claim “(ii) will be true” is vacuous (there is no (ii)). A function like f(n) = 1/n disproves the claim in example 2 because there are no constants N and C such that for all n > N, f(n) < C*(f(n))². Proof: Let some N and C be given. Choose n>N, n>C. f(n) = 1/n = n*(1/n²) > C*(1/n²) = C*(f(n))². Because N and C were arbitrarily chosen, this shows that there are no fixed values of N and C such that for all n > N, f(n) < C*(f(n))², QED. Saying that “f(n) ≥ 1” is not enough

Categories : Algorithm

Need working examples of whenever gem in action
I don't have any "good examples on GitHub", but... Assuming you have the gem installed into some specific web application (ie, you followed WebFaction's documentation for installing gems), you probably need to set some environment variables to make it usable when running from cron. Try setting them in your cron job, like this (my example uses a 10-minute cron interval, change it to whatever you need): */10 * * * * GEM_HOME=$HOME/webapps/yourapp/gems RUBYLIB=$HOME/webapps/yourapp/lib PATH=$HOME/webapps/yourapp/bin your_command_here Hope that helps!

Categories : Misc

Differences between two singleton examples
In A1, A is not singleton.. getInstance() is returning a new instance of A everytime In A2, A is not singleton again, cause the default constructor is still public (implicitly) . One can easily create more instances from outside EDIT: Since you have edited the class A in A2, now it becomes singleton. Here A is created eagerly and will be thread-safe by default. Check lazy vs eager intialization

Categories : Java

TTY in perl, explaination and some examples
TTY (short for teletype) is basically a special input or output filehandle that connects to the terminal - namely, user input. For nitty gritty details, see: Unix.SE in-depth answer on TTYs Text Terminal HOWTO This is what you need to know for starters (hard to say more since you didn't explain what you need to do with a TTY): On Unix, it typically maps to /dev/tty device or similar You can test for it using -t in Perl As far as debugger, 2 things need to be known at least (if you intend to play with the TTY, the last paragraph is the most important). All data is near-quoted from perldoc perldebug p expr prints to $DB::OUT filehandle (NOT STDOUT), which in turn is open to /dev/tty. I think this may be controlled by LineInfo option from PERLDB_OPTS but never played with it

Categories : Perl

Few examples with HTML SIMPLE DOM
You didn't load the html, look at this $html = str_get_html('Some text bla bla bla bla<br /><b>Date</b>: 2012-12-13<br /><br /><b>Name</b>: Peter Novak<br /><b>Hobby</b>: books,cinema,facebook'); foreach($html->find('text') as $t){ if(substr($t, 0, 1)==':') { // do whatever you want echo substr($t, 1).'<br />'; } } Output will be 2012-12-13 Peter Novak books,cinema,facebook Also, check this one to load a remote site's content $html = file_get_html('http://heera.it'); // Find all article blocks foreach($html->find('div.post-entry') as $article) { echo $article->find('div.post-entry-content h2 a', 0) . '<br />'; echo $article->find('div.post-entry-content p', 0)->

Categories : PHP

in JavaScript which of these 3 examples has best performance
For Creating 50 constructors... JellyFish1 win ! http://jsperf.com/jellyfish For creating 50 instances... JellyFish2 win ! http://jsperf.com/jellyfish-instance

Categories : Javascript

What occurs in memory during these two examples?
The program has undefined behavior as-is, so it's pointless to try to reason its behavior, but anyway... The test() function expects a pointer to int. That pointer will be dereferenced and used to set the int it points to. However, you don't pass it a pointer to int but an uninitialized int - so it will try to interpret whatever garbage value is in that variable as a memory address and then access the object behind it - and boom. If you wanted to call the function correctly, you would need to write test(&dat); instead. what does the f stand for in -fpermissive, flag perhaps? No, as far as I know, it stands for "feature". (But in the case of -fpermissive, I'd say it stands for "your code is f..ked if you use this flag"...)

Categories : C

In Qt Creator, examples are missed
Navigate to the installation location of the examples and open the .pro project file with qt-creator. Alternatively if you just want to build and run the example. Navigate to the directory qmake and then make and then simple run the output Additionally if you strictly require the examples to show in the IDE, try launching with admin privileges as the installation directory of the examples may require admin privileges.

Categories : Qt

Java 7 EE Tutorial examples
If you click "check out" on the page, it shows the URL for SVN checkout. You can use that URL in command line SVN as: svn co https://svn.java.net/svn/javaeetutorial~svn Or you can copy the URL into a tool like Tortoise SVN and check out that way. Regardless, you need a login on the java.net to use when checking out.

Categories : Java

Some tutorial examples not working
Well, I don't know what is your editor but you have a problem with your " and ' caracters change your “ and ’ to a normal " and ' and it's working.

Categories : Javascript

Examples/Tutorials of Hunspell
I agree that their website is a little bit difficult to navigate and there aren't many tutorials for it. I'd recommend just diving in. For example here is some code for NHunspell, which is just the .net version. The code below is just the basic usage but should still be useful for someone getting started. You can download dictionaries from the Open Office repository //affPath = path to the .aff file //dictPath = path to the .dic file // create and load your hunspell object NHunspell.Hunspell hunspell = new NHunspell.Hunspell(affPath, dicPath); // want to add a word that is not part of the base dictionary? Sure, we can do that. hunspell.Add("stackoverflow"); //lets check if a word is valid bool isValid = hunpsell.Spell("stackoverflowed"); if(!isValid) { //lets get some suggestion

Categories : Misc

Grep examples - can't understand
^ can mean two things: mark the beginning of a line or it negates the character set (whithin []) So, it means: lines starting with 'b' matching any (0+) characters Other than 'b' matching another 'b' followed by something not-'b' (or nothing at all) It will match bb bzzzzzb bzzzzzbzzzzzzz but not zzzzbb bzzzzzxzzzzzz

Categories : Unix

PyGObject with GStreamer examples?
A good way to turn up examples using the introspected bindings offered by pygobject 3 (in contrast to the "old" static bindings offered by pygobject 2 and pygtk) is to use "gi.repository" as a search keyword. For example, searching for "gi.repository gst" quickly leads to a simple media player and the examples listed in the Novacut porting guide, amongst other goodies. On documentation, best to follow the C API reference and/or consult the relevant .gir files. API references for other languages able to use introspected binding are generally not yet available, although tools to create them from the intermediate .gir files created by gobject-introspection's g-ir-scanner are being worked on.

Categories : Python

Examples of use cases for _.result
_.result has a very simple purpose (as with most functions in underscore). It lets you get a named value from an object without knowing or caring whether that value is stored as a property or a method. Thus: var nameProperty = {name: 'Peter'}; var nameMethod = {name: function () {return 'Peter';}}; console.log(_.result(nameProperty, 'name')); console.log(_.result(nameMethod, 'name')) In both cases, the code will work, successfully log the name and not throw a TypeError. That's really all it's for. It's pretty simple and clear. Real world example would be Backbone.Model.url.

Categories : Javascript

Practical examples of Idris
There is a paper by Edwin Brady, the creator of Idris, which deals with real world questions such as efficiency and concurrency: "Correct-by-Construction Concurrency: using Dependent Types to Verify Implementations of Effectful Resource Usage Protocols". It not only explains how to deal with concurrency, but also creates an embedded domain specific language (EDSL) in Idris to deal with concurrency. It is also used for scientific computing (which may or may not qualify as real world application): Dependently-typed programming in scientific computing. The paper contains actual examples and a few Agda examples as well.

Categories : Misc

statsmodels examples seem not to work
(The guess in my comment was wrong) Your version of statsmodels is too old. The documentation and example is correct for the released version of statsmodels 0.5. The data keyword has been renamed from df since 0.5.0.dev-1bbd4ca. So either you upgrade, which I highly recommend, or you use the old keyword name mod = sm.ols(formula='Lottery ~ Literacy + Wealth + Region', df=df) should work with the version that you have.

Categories : Python

Apache Apollo Examples JAVA
There are several examples in the Apollo distribution. The ones you want to look at are located in the following distribution directories: examples/openwire/java examples/stomp/java examples/mqtt/java examples/amqp/java

Categories : Java

Input for examples from Kernighan and Ritchie
From the interactive command line, press ctrl-D after a newline, or ctrl-D twice not after newline, to terminate the input. Then the program will see EOF and show you the results. To pass a file by path, and avoid the interactive part, use the < redirection operator of the shell, ./count_characters < path/to/file.txt.

Categories : C

How i use amazon s3 in python to use REST examples
In boto, you could create a similar request like this: import boto s3 = boto.connect_s3() bucket = s3.lookup('example-bucket') for key in bucket.list(prefix='photos/2006/', delimiter='/'): print k.name What boto does is parse the XML output from S3 and turn it into Python objects. So, listing a bucket will return a bunch of Key objects, each object representing an object in S3. There isn't anything in boto or in S3 that would automatically turn the data into JSON but you could certainly write some Python to translate the information in the Key objects into JSON.

Categories : Python

Examples for using Google Admin SDK API (python)
You must use OAuth2 authentication, API key alone is not enough as you must authenticate as a Google Apps super admin or delegated admin (with appropriate rights) in order to perform Admin SDK Directory operations. My project, Dito GAM was recently updated with full support for Admin SDK calls. It makes use of most (all?) Directory API calls. See: https://code.google.com/p/google-apps-manager/source/browse/trunk/gam.py Also, if you notice bugs or ambiguities in the Google documentation, be sure to report them. It won't get any better if someone doesn't tell them about it! Use the "Report a bug" link at the bottom of all developers.google.com pages. It's very simple to use and pinpoint the exact issue.

Categories : Python

Neo4j O'reilly book examples
You can download the code for most of the examples, including the Shakespeare example, from here: https://github.com/iansrobinson/graph-databases-use-cases This code includes the steps necessary to index the data. Kind regards ian

Categories : Neo4j

How I can make the complex filter for examples
When you specify two filter_run calls, it seems that rspec treats them as condition_a OR condition_b. You can join the two conditions into one: RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.filter_run :foo => lambda {|v, m| m[:foo] == true and m[:first] == true} end # or (may be easier if you have many conditions to check) RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.filter_run :foo => lambda {|v, m| [:foo, :first].all?{|k| m[k]} } end Have a look at the documentation of filter_run.

Categories : Ruby On Rails

Two points operator in ggplot2 examples
something is a new variable that has been produced by a stat, which is a ggplot2 mechanism that will transform your original dataset in some way (e.g., binning the data, smoothing the data). The .. distinguishes it from variables in your input, so that there's no confusion. In your example, ..density.. is the density, which you can map the height of the histogram bars to, rather than the raw count in each bin (..count.., the default). ..density.. is computed by stat_bin. As far as I know, there's no one place in the documentation where this is explained (though if you have access to the ggplot2 book, look at section 4.7), but the new variables created by each stat are listed in the stat documentation pages, under the Value section. For example, looking at the documentation for stat_bin,

Categories : R

How do C programmers work with the MSDN API examples which are in C++?
The examples aren't really there for people to directly copy&paste them. They're just examples. Even if the example is in C++, it gets the point across both for C as well as C++ because both languages share a lot of syntax. And since WINAPI is a C API, even when used with C++, the example code is going to be quite compatible with C; there aren't any classes or templates or anything else C++-related in WINAPI. As for the reason MS is doing this, it's because Visual Studio is a C++ environment. Yes, there's a C89 compiler included, but it's just for backwards compatibility.

Categories : C



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