Tutorial by Examples: df

To get First object: MyModel.objects.first() To get last objects: MyModel.objects.last() Using Filter First object: MyModel.objects.filter(name='simple').first() Using Filter Last object: MyModel.objects.filter(name='simple').last()
@Entity class Note { @Id Integer id; @Basic String note; @Transient String parsedNote; String readParsedNote() { if (parsedNote == null) { /* initialize from note */ } return parsedNote; } } If your class needs fields that should ...
R is full of functions, it is after all a functional programming language, but sometimes the precise function you need isn't provided in the Base resources. You could conceivably install a package containing the function, but maybe your requirements are just so specific that no pre-made function fit...
curl -XGET 'http://www.example.com:9200/myIndexName/_count?pretty' Output: { "count" : 90, "_shards" : { "total" : 6, "successful" : 6, "failed" : 0 } } The index has 90 documents within it. Reference Link: Here
With the power of regex comes great responsibility.... db.posts.find({'text': /.*foo.*|.*bar.*/i})
db.posts.find().forEach(function(doc){ if(doc.oldField){ db.posts.update({_id: doc._id}, {$set:{'newField':doc.oldField}}, false, true); } });
db.posts.find().forEach(function(doc){ if(doc.commentsBlobId){ var commentsBlob = db.comments.findOne({'_id': commentsBlobId }); db.posts.update({_id: doc._id}, {$set:{'comments': commentsBlob }}, false, true); } });
db.posts.find().forEach(function(doc){ if(doc._id){ db.posts.update({_id: doc._id}, {$set:{ timestamp: new Date(parseInt(doc._id.str.slice(0,8), 16) *1000) }}, false, true); } });
var timestamp = Math.floor(new Date(1974, 6, 25).getTime() / 1000); var hex = ('00000000' + timestamp.toString(16)).substr(-8); // zero padding var objectId = new ObjectId(hex + new ObjectId().str.substring(8));
There are many cases when one has created an NSDate from only an hour and minute format, i.e: 08:12 The downside for this situation is that your NSDate is almost completely "naked" and what you need to do is to create: day, month, year, second and time zone in order to this object to &quo...
Sometimes you need to call a Tcl command from your expression. For example, supposing you need the length of a string in it. To do that, you just use a [...] sequence in the expression: set halfTheStringLength [expr { [string length $theString] / 2 }] You can call any Tcl command this way, but i...
Python programs can read from unix pipelines. Here is a simple example how to read from stdin: import sys for line in sys.stdin: print(line) Be aware that sys.stdin is a stream. It means that the for-loop will only terminate when the stream has ended. You can now pipe the output of anot...
The package's official wiki has some essential materials: As a new user, you will want to check out the vignettes, FAQ and cheat sheet. Before asking a question -- here on StackOverflow or anywhere else -- please read the support page. For help on individual functions, the syntax is h...
Basic syntax DT[where, select|update|do, by] syntax is used to work with columns of a data.table. The "where" part is the i argument The "select|update|do" part is the j argument These two arguments are usually passed by position instead of by name. A sequence of steps c...
Open Excel Open the Visual Basic Editor ( see Opening the Visual Basic Editor ) Add a new module by clicking Insert --> Module : Copy and Paste the following code in the new module : Public Function Hello() As String 'Note: the output of the function is simply the function's name ...
class MyDataObject extends DataObject { private static $db = array( 'Name' => 'Varchar' ); private static $has_one = array( 'OtherDataObject' => 'OtherDataObject' ); private static $summary_fields = array( 'Name', 'OtherDat...
class MyDataObject extends DataObject { ... private static $has_many = array( 'OtherDataObjects' => 'OtherDataObject' ); function getCMSFields() { $fields = parent::getCMSFields(); if ($gridField = $fields->dataFieldByName('OtherDataObject...
public class ForgotPasswordActivity extends AppCompatActivity { @BindView(R.id.tIETForgotPasswordEmail) EditText mEditEmail; private FirebaseAuth mFirebaseAuth; private FirebaseAuth.AuthStateListener mAuthStateListener; @Override protected void onCreate(Bundle saved...
Hadoop Distributed File System (HDFS) is a Java-based file system that provides scalable and reliable data storage that is designed to span large clusters of commodity servers. HDFS, MapReduce, and YARN form the core of Apache™ Hadoop®. HDFS is designed to be highly fault-tolerant, which is achieve...
STEP 1: CREATE A DIRECTORY IN HDFS, UPLOAD A FILE AND LIST CONTENTS Let’s learn by writing the syntax. You will be able to copy and paste the following example commands into your terminal: hadoop fs -mkdir: Takes the path URI’s as an argument and creates a directory or multiple directories. Usag...

Page 7 of 21