I'm looking at using NURBS surfaces with THREE.js,
and (what seems like older) documentation points
me to a THREE.NURBSurface class. Trouble is, I can't seem to find it in the official documentation, so I suspect it's been more recently changed.
So, my question is: under what name might I find such functionality, and where might I find a URL containing its documentation?
The class has still the name THREE.NURBSSurface. When using npm you can import it like so:
import { NURBSSurface } from 'three/examples/jsm/curves/NURBSSurface.js';
The class is undocumented so you don't find an entry in the official documentation. However, there is an official example that uses it: webgl_geometry_nurbs
Related
Sorry this is probably a question that has been asked many times but as it regards what is a very common word in English it is pretty much impossible to google or search for it.
I have seen a few examples of Ruby code which looks like this:
EnquiryNotification.with(post: #post)
I'm trying to understand what the ".with" part does. Can anyone shed some light on this please?
with is a class method defined on the EnquiryNotification class (or one of its ancestors). The method is neither a keyword in the Ruby language nor is it a common method on classes shipped with Ruby itself or its standard library. As such, to find what this method does, you would likely have to consult the documentation of your chosen framework or application.
An example of a with method defined in a framework is Sequel::Dataset#with to add a CTE to the current query. The method is also available as a class method in Sequel model classes.
It could also be part of ActionMailer as mentioned by Stefan in a comment above.
In any case though, make sure to consult the documentation of your chosen framework or library for details.
One way of doing seemed to be to use the java.lang.Compiler
I tried to use the java.lang.Compiler inside Eclipse anddid not understand the Object any parameters for the methods of that class? And putting in a class did not seem to work either.
Compiler.command(any) // what is meant by any? What are valid objects to put there?
Compiler.compileClass(clazz) // Nothing happens when I out a class in there?
Compiler.compileClasses(string) // hm?
How to can I print a hello message with a Compiler inside Eclipse...?
Reading the documentation is a very important skill you need to learn.
Whenever you come across a class or a method that you don't know the functionality of, simply look at the documentation first.
Here is the docs for java.lang.Compiler: https://docs.oracle.com/javase/7/docs/api/java/lang/Compiler.html
This is the first sentence of the document:
The Compiler class is provided to support Java-to-native-code compilers and related services. By design, the Compiler class does nothing; it serves as a placeholder for a JIT compiler implementation.
So, the answer to your question is, it does nothing. According to the documentation, it does nothing. It is used to start up the Java compiler when the JVM starts. You are not meant to use this.
I'm am trying to perform Instrumental Variable (IV) regression in Python. I saw online that the statsmodels.gmm package has the function I need (http://statsmodels.sourceforge.net/devel/gmm.html#), but when I ran import statsmodels.gmm as gmm in Python I get this error No module named gmm
. I'm using ipython with python 2.7.9. Any suggestions would be much appreciated.
GMM and related IV estimators are still in the sandbox and have not been included in the statsmodels API yet.
The import needs to be directly from the module
from statsmodels.sandbox.regression import gmm
Then, these classes can be accessed with, for example gmm.GMM
The main models that are currently available are:
GMM, IV2SLS, IVGMM, LinearIVGMM, NonlinearIVGMM
The mailing list has a recent discussion on the current status, and links to "secret" Gists
https://groups.google.com/d/msg/pystatsmodels/o6NY7qGrPw0/vzf897jy3vMJ
(I just found that the t_test doesn't work for a GMM model.)
I am having trouble in using documentation. Lets say I want to see the source of function
DB::transaction();
I go to http://laravel.com/api/index.html
and enter in the search form 'transaction'
Nothing is found.
I then try to go on the left to Namespaces/Database which makes sense.
And later I have no idea where to go. There is some namespaces, some classes, some interfaces. Later found out that this is in the connection class, which at first I did not even look at. Connection associates to connecting to the database, not making transaction.
And there often happens when I don't know how to quickly find things.
How do you deal with that?
I assume the documentation should be one of best developers friends, but I guess I found this function by using sublime massive search in all files.
Btw also - I lowed the Codeigniter documentation, so thats why also I am disapointed. In codeigniter everythign looked so simple and search worked very well. Typing same word 'transaction' finds like charm.
Ok, tried same way as CI does to serch:
transaction site:http://laravel.com/api/
then it finds. If there is no other way, maybe I should bookmark the search link and just change the keyword or something like that.
CodeIgniter was definitely simpler, to the point that any larger project suffered greatly under the weight of (forcibly) badly misplaced code. Laravel raises the bar there a little bit, but it's to your benefit as a developer (I promise :D ).
Firstly, kudos for searching through the code. Many people do not. You learn a LOT by looking in there.
Laravel Code
For Laravel, you'll do best by knowing about Namespaces, and how they relate to autoloading files (Namespaces will relate to directories, essentially). You likely know this, but it relates to how you can find classes and their methods.
Now, this doesn't go towards knowing where anything is - that comes with some digging into the code yourself. I almost always have Github open to the laravel/framework repository to look at code.
Note: That API search looks for files, rather than methods within them (unfortunately).
Github
As mentioned, I use Github mercilessly for searching code, instead of the API documentation. The search in Github is quite good - it will search within the current repository.
For example, I searched "function transaction" in github and got good results.
It led me to see here that it accepts a closure, and surrounds the code run within the closure around a transaction. You can see that throwing any exception within that closure will get caught and cancel the transaction (and gives you a way to control it).
Facades
As #matit pointed out, Facades do in fact hide where code is. That's a tricky part. In general, you can call the getFacadeRoot() method on any facade to figure out what class it is:
// Figure out what underlying class the Auth facade actually is
echo get_class( Auth::getFacadeRoot() );
Eventually you'll discover patterns in the code. Most facades point towards certain types of classes within each package (For instance, a Manager class who's job it is to decide which underlying implementation is used).
I really suggest reading Taylor's book which goes into the general architecture of Laravel. It's a quick read which is highly worth it.
Where CodeIgniter excelled in simplicity, Laravel excels in teaching you better coding concepts. Give it some time :D (Or use CodeIgniter still, that's cool too - whatever gets your work done!)
This is why I strongly suggest using CTAGS! I use sublime text 2 with the CTAGS plugin. I just press CTRL+SHIFT+Click on the class method and it will bring up a list of classes that have that method, or if only one exists, take me directly to the file and method. It beats searching the API/docs in terms of speed. There is even a Sublime text 2 plugin for Laravel Facades !
https://github.com/stidges/Laravel-Facades-for-ST
As in C++ we use,
using namespace std;
Or in Java we use,
import packageName;
Is there a way to import / use a package or namespace while writing Force.com Apex code?
For instance, I am writing simple Apex in Developer Console in "Execute Anonymous Window" as
System.debug('Hello world!');
Is there any way to write something like
import System;
debug('Hello world!');
This link seemed relevant, but did not answer my syntactical concern.
Any help is appreciated! Redirecting to something obvious which I might have missed is more than welcome, Thanks!
I think this is a hidden detail in APEX. I've extended classes and referenced system methods without ever having to worry about it.
It might work to think of Salesforce managing one big import list that it adds to all of your code. When you declare a class as global it gets added to your global import list. At least this line in the documentation hints in that direction, "The global access modifier declares that this class is known by all Apex code everywhere."
Regarding namespaces, I've only seen this made available as part of managed packages. So for instance, SteelBrick's managed package QuoteQuickly has the prefix SBQQ on all of it's code. More about that here. I don't believe you can namespace in any other way.
There are some really sharp peeps over at salesforce.stackexchange.com that would know better than me though. I think you should ask over there.
EDIT At DreamForce '13 I attend a presentation by Steven Herod where he made his DTO classes inner classes and referenced them elsewhere like this: QuoteModel.QuoteRequest and QuoteModel.QuoteResponse. I asked him about it and he said it was a decent way of mimicking namespaces. I found his slide deck but it didn't include the code he demo'd live. I found this code which illustrates it a bit anyways. Look for addTextrBox.textBoxClass.