db.posts.find().forEach(function(doc){
if(doc.oldfield){
// the false, true at the end refers to $upsert, and $multi, respectively
db.accounts.update({_id: doc._id}, {$unset: {'oldfield': "" }}, 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));
This project is a self-contained example done completely in the Interface Builder. You should be able to work through it in 10 minutes or less. Then you can apply the concepts you learned to your own project.
Here I just use UIViews but they can represent whatever view you like (ie, button, label...
These functions are used to check Mouse Button Clicks.
Input.GetMouseButton(int button);
Input.GetMouseButtonDown(int button);
Input.GetMouseButtonUp(int button);
They all take the-same parameter.
0 = Left Mouse Click.
1 = Right Mouse Click.
2 = Middle Mouse Click.
GetMouseButton i...
Backbone.js is made up of four separate components: Collections, Models, Routers, and Views. Each of these serve different purposes:
Model - represents a single data object, but adds additional functionalities not provided by native JavaScript objects, such as an event system and a more conveni...
Using Dynamic Arrays in VBA can be quite clunky and time intensive over very large data sets. When storing simple data types in a dynamic array (Strings, Numbers, Booleans etc.), one can avoid the ReDim Preserve statements required of dynamic arrays in VBA by using the Split() function with some cl...
Now that the OCaml distribution is available on your favorite operating system, we can create your first program in OCaml: the Hello World!
We have different ways to launch an OCaml program.
The REPL (toplevel)
You can execute your code interactively with the toplevel. With the OCaml toplevel, yo...
If you are just starting a new project, it's important to think about how you want to handle code signing.
If you are new to code signing, check out the WWDC session that describes the fundamentals of code signing in Xcode.
To properly code-sign your app, you have to have the following resources o...
JSP hooks are a special liferay plugin that allow to modify core portlet jsp-s, lets say you want to modify the login portlet to show Welcome in my custom login!.
The minimal structure for a Hook Plugin is as follows:
[project-name]-hook/
└── docroot/
├── WEB-INF/
│ ├── src/
...
Use $state.transitionTo to go form one state to another. This is a low level method to transition and $state.go is the recommended way for most common use cases as it uses this method internally.
$state.transitionTo(toState [, toParams] [, options])
toState - the state to transition to
toPara...
// initialize pubnub object
var pubnub = new PubNub({
subscribeKey: "yourSubscribeKey",
publishKey: "myPublishKey" // optional
})
// get up to the last 100 messages
// published to the channel
pubnub.history(
{
channel: 'channel1'
},
func...
Webhook Overview
A WebHook is an HTTP callback: an HTTP POST that occurs when something happens; a simple event-notification via HTTP POST. A web application implementing WebHooks will POST a message to a URL when certain things happen.
PubNub Presence
Pubnub presence all about the user prese...