I’ve been working with MongoDB for a little over a year now and one of the things that I’ve found that is missing from the community is a really good in depth full coverage cheat sheet for the Mongo shell.
I’ve looked around the web and there are a few but they all are either several pages long which is not a real cheat sheet, its a short tutorial on different commands. I wanted a real cheat sheet. You know the kind that just lists all the API commands in reference format so you can look at it and be reminded of all the different commands and operators available.
So since I couldn’t find one I created one.
It contains everything I could fit on an 11in x 17in page sized for print. But in PDF form it also has every single command hyperlinked to its full documentation page in the MongoDB reference. So for those times when your not sure exactly what the parameters or options for a command are, you can just click the item in the PDF to go straight to the page in the MongoDB reference for full details.
Feel free to leave corrections, comments, or suggestions for updates below. I’m also thinking of making a 2 page 8.5in x 11in version as well if I can make it all fit properly. I don’t think this version would be very legible printed on 8.5×11 scaled down.
I bought a new Asus Zenbook a few days ago and decided to format it and replace the win 7 home premium with bloatware with a clean install of win7 ultimate.
With no DVD drive you have to boot off USB to install it. Then I realized I’d never actually setup a bootable windows install USB before.
After some research I noticed it’s not as easy as it seems if you want to install on a UEFI computer that already has GPT partitions created.
Steps to create bootable Windows 7 USB for UEFI support and GPT partitions:
Open a command line in administrator mode
type LIST DISK
Look for the disk number that represents your USB drive
type SELECT DISK # where # represents the number of your USB drive. Get this right or you will wipe a different drive out.
type CREATE PARTITION PRIMARY
type SELECT PARTITION 1
type FORMAT fs=fat32
The drive should now be formatted and marked as active and fat32. Do not format the drive as NTFS or you will only be able to boot into the installer in BIOS mode.
Now you will need to copy the contents of the windows 7 install dvd to the USB with a regular copy paste from windows explorer.
Once this is done you will need to get a copy of the EFI boot manager firmware file from a computer that has windows 64 bit installed on a UEFI system.
This file is located in C:WindowsBootEFIbootmgfw.efi
On your USB (Let’s assume it’s drive E:) look in E:efimicrosoftboot and copy this boot folder up one level so it sits in E:efiboot
Now copy the bootmgfw.efi file from your computer which has windows installed to this new E:efiboot folder and rename it to bootx64.efi
Insert the USB in the machine and turn it on and boot into the UEFI/BIOS loader and check for boot options. On the ASUS Zenbook it detected two boot options on the USB drive. One was UEFI and one was regular BIOS. I made the UEFI option the first choice and restarted the machine.
I could now install windows to the formatted existing GPT partitions that were on the machine.
The reason I didn’t want to install in a regular BIOS MBR scenario is because there are recovery partitions on this drive that are GPT as well and to convert back to MBR from GPT you have to delete all partitions on the drive which would have caused me to lose my recovery and data partitions.
This solution was perfect and gives me the added bonus of UEFI and GPT partitions.
If you need to find out if you have booted into BIOS mode or UEFI mode when the installer starts you can press SHIFT+F10 when the welcome installer shows up to open a cmd prompt. from here you will likely be at X:Sources. Type cd .. to go back a dir and move into WindowsPanther
Then type notepad setupact.log
Within this file do a ctrl+f and search for
Callback_BootEnvironmentDetect: Detected boot environment:
It should either say BIOS or UEFI.
The TLDR summary of this article is this: Switch to Teksavvy for internet in Canada if you can get it in your area and stay away from Rogers under all circumstances.
I noticed a problem with our internet bill from Rogers the other day and started to investigate what was going on with significant overage charges on our account over the last few months with Rogers.
It turns out that without notifying us, Rogers increased our internet plan from $59.99 a month and $3.00 per month modem rental, to $61.99 a month and $4.00 a month modem rental. They moved us onto the ‘Rogers Extreme’ plan without telling us and charged us more. The Rogers Extreme plan offers 28mbps download speed (the speed you can download files at), and 120GB per month of bandwidth allowance (the amount of data you can download per month).
What Rogers did (and has done to possibly tens of thousands of other customers) is kept us on our old plan details of 10mbps download speed instead of 28mbps, and 95GB of monthly bandwidth instead of 120GB which they are charging us for.
Our monthly usage since March has ranged from 92GB to 116GB keeping in line with the monthly allowance of 120Gb per month which we are paying for. However because they kept us back at 95GB we have been charged every month since march that we have gone over 95GB for overage fees on a plan that has enough monthly allowance (120GB) to cover our usage.
Let’s take a timeout to explain the what the two metrics are on these internet plans. There is speed that data can come in and out at which is referred to as downstream and upstream speeds or download and upload speed. the plan provides 28mbps (mega bits per second) they are providing us 10mbps and claiming DOCSIS 2.0 modems do not support more than that and that we must pay more for a different modem. This is simply not true. The second claim is that an upgraded modem is required to get the full 120gb of download per month. The cap on the amount of bandwidth allowance has nothing at all to do with what kind of modem you have or even what speed you can get. Monthly bandwidth allowance is simply how much data you can download per month. You can easily download over 1000GB of data per month on a standard DOCSIS 2.0 modem at 10mbps speed.
Think of it like this: the speed metric is how much water you can push through the pipe per second so think a bigger radius pipe is more water per second. The monthly bandwidth allowance pipe is how many liters of water your allowed to consume per month in total. If you have a small pipe and leave the water on all month you can get just as much water through in the month as if you have a pipe that’s twice as big in diameter but you only leave it on for half the month. Monthly bandwidth has nothing to do with the thickness of the pipe, strictly how many liters you consume.
You could use the analogy of cars driving so many kilometers when you rent them from a rental company but imagine if you were also only allowed to drive a max of 100km/h but you could pay more for a luxury car to drive 150km/h instead as long as you only drive under the set number of kilometers for the rental, lets say 95KM a month.
Well they made us pay for a faster car and for more kilometers allowance per month but didn’t let us drive faster or farther as promised and then charged us extra for it for 5 months after they upgraded our plan to a bigger car without telling us.
This is where the nightmare of customer service begins. To summarize I will put the flow of conversation and details into point form.
We phone up Rogers customer service. My sister in law worked for Rogers for several years and knows how things work there. She gets us started with the first customer service rep.
We talk to this rep for about 10 minutes before being transferred to billing.
After a few minutes on hold the rep begins to tell us that we must upgrade to the highest end wireless modem for $7 a month in order for it to be possible for them to provide this service to us. This is an outright lie. Our modem is a DOCSIS 2.0 modem which they have documented in their system and which can handle speeds of up to 42mbps (http://en.wikipedia.org/wiki/DOCSIS). More than capable of handling 28mbps service.
Then the rep also tells us it is not possible to give us 120GB of monthly allowance without this top end modem and that’s why we have only gotten ‘the slower service’ because we haven’t upgraded our modem. Both of these statements are pure lies from a technical point of view and it just doesn’t make sense to say you cant download over 95GB a month because of your modem… but THEN BILL YOU OVERAGE for going over 95GB of usage for a month. How can I not get over 95GB a month with this modem and then download over that and be charged for it then? I asked the rep this question and she was silent for about 20 seconds with nothing to say.
Regardless of the modem being insufficient they claim that there is only one modem which can be used with this service, yet have three listed on their website as compatible with this service. The standard modem being one for $4 a month. We do not want a wireless modem because we already have a wireless router here and adding a second wireless network is just going to cause more interference than we already have and there is no justification or written notice on Rogers website that says you _must_ use the upgraded modem. They clearly offer three options on their website as shown above and at http://www.rogers.com/web/link/hispeedBrowseFlowDefaultPlans under ‘hardware options’ or ‘hardware options which one is right for you?’ again clearly saying you have three options and explain how to choose which one you want.
At this point we ask to speak to the rep’s supervisor which is typical for Rogers customer service you usually have to go through 4-5 people before you get things fixed when they incorrectly bill you. (We have been over billed on cell service for over $400 in the last two years on two occasions and had to fight for 6 hours on the phone over 3 days to fix it last year.)
The supervisor tells us it is not possible to download over 95GB a month with our old modem and that’s why they wont upgrade our plan. This is again a lie and a misinformed, poorly trained service representative who knows nothing about technology.
We then ask to be sent to retentions. Retentions is the department in the Canadian telecoms that deals with the worst case customer service scenarios and who have the power to give you great discounts and bill adjustments to keep you as a customer. We have been customers with Rogers for over 10 years, paying an average monthly bill of between $200-$400 per month for various services over the years. At its peak we had HD cable, PVR, internet, home phone, and 3 cell phones with Rogers and were paying over $500 a month before discounts. We have been excellent customers to them, We now have only internet and 2 cell phones on two accounts and pay about $250 a month to Rogers.
At this point we are put on hold for 35 minutes and then are disconnected after 1hour and 53 minutes on the phone with the first four reps.
We call back and get a new rep. We explain the scenario to him and how Rogers owes us $80 and needs to upgrade our plan to give us the service we have been paying for for the last 5 months. We politely ask him to please not hang up on us like the last lady did
He puts us on hold for 20 minutes, and hangs up on us.
We call back again for the third time to speak to our now sixth representative of the night. Our call time is now at over 2 hours.
We explain to this lady our story again all the way through from the beginning. She tells us it says right on the website that we need the higher modem to get this plans speed. We ask her to show us where and she leads us to the fine print details hidden in a small link at the bottom of the page that appears in a popup when you click it.
No where in these details does it say you must get the $7 a month modem to get the plan it only says there is a $7 a month modem rental fee for the ‘N’ home networking modem which has a wireless router built in. The plan clearly shows three options for the service. Rogers is simply telling lies to avoid refunding the charges at this point. If we needed a new modem why did they not provide one to us.. OR TELL US THIS, after changing our plan, also without telling us.
We then ask to be sent to retentions again to speak to another rep.
This new rep is now our seventh rep we have spoken to. We explain our whole story to her and she says please hold. She comes back after about 10 minutes and says the best she can offer us is a $40 credit on our account.
So at this point Rogers has offered to return half the money they have stolen from us in overage fees so we will only be 50% scammed instead of 100% scammed.
The rep said absolutely nothing about any conditions for this credit or that we would have to remain as customers with them to receive it. She simply said I’m adding the credit to your account now and then said it had been processed.
Once the credit had been processed we politely asked to cancel our service and that we would be switching to Teksavvy. (Teksavvy has amazing plans at amazing prices and I don’t know why we haven’t switched sooner. Friends who have it all recommend it.)
At this point the rep said we didn’t inform her that we wanted to cancel our internet before offering us the credit and so she would have to remove it now. She didn’t say anything about having to remain a customer to receive the credit.
We said fine cancel our service we are done with being lied to by Rogers.
We are put on hold to be transferred to a cancellation department.
The 8th lady we have talked to for the night says “can I ask you the reason why you are cancelling sir?’ We politely say “Rogers has overcharged us $80 and is only offering to refund us half of it after changing our plan without notifying us and not giving us the service we have been paying for for the last 5 months”
The lady immediately and without hesitation says “What if I can offer you the full $80 refund, will you remain as customers?”
No talking to her boss or checking with a supervisor. She didn’t even check to verify the truth about what we said about the overage charges she just instantly offered us an $80 refund on the spot on the condition we stayed as customers for the next 30 days.
Her name was Monica, and she was amazing. She clearly informed us ahead of time what the conditions were, and didn’t hang up on us. That’s +2 right there against all the other reps we spoke to for the night.
We accepted the refund and will now call back in 30 days to immediately cancel our service with Rogers once our stolen money is returned to us and switch to Teksavvy for our Internet.
As soon as my contract expires with Rogers I will change my cell service to Wind Mobile or another provider as well.
The new company I work for is also collecting quotes on business internet service and large scale bandwidth and infrastructure hosting for a new software service I am building. Rogers will not be our service provider under any circumstances for our business internet line or our hosting provider. I plan to make the case to my CEO that we go with Teksavvy for all our services. They are cheaper, and have better reputation with regular Canadian internet customers. Their internet presence and their stance on Usage Based Billing in Canada makes them much more trustworthy than Rogers.
If you are an internet customer of rogers I highly encourage you to check your bills and see if you are being scammed into the new rates but given the old service speeds and call and complain about it furiously.
I cannot believe something like this is even legal in Canada. Maybe it’s not I am no lawyer.
Hope others find this cheat sheet useful.
If you have anything to add, feel free to leave a comment.
Returns a Boolean value indicating whether the user is connected to the Microsoft Dynamics CRM server while using Microsoft Dynamics CRM for Microsoft Office Outlook with Offline Access. When this function returns false, the user is working offline without a connection to the server. They are interacting with an instance of Microsoft Dynamics CRM running on their local computer.
One of my current projects I am working on is an educational game aimed at teaching the concepts of Mendelian Genetics to students.
What I’ve been working on for the last few days is optimizing the game for the web and iPad deployment.
My first shot at optimizations is making the game load up faster.
Comparing Processing.js to Native JAVA Processing on my PC I found the following results and they were surprising!
While the speed results for different pieces of code were different between browsers one thing was clear that the overall total time to complete running the setup() function was fastest in the browser in all cases except for IE9 and Safari on Windows 7. For individual test results only once was one piece of code faster in the JAVA environment compared to the browser.
Test System: Intel core i7, 12gb ram, Windows 7.
The green boxes show the fastest time for that section, when a time was within 1ms I have called it close enough to be a tie. I ran each test 5 times per browser and averaged the results to make sure there were no one offs.
I’m sure I will be able to further optimize it in the next few days to be even faster this is just an initial observation. Now that I know whats slow I can work on some async loading or deferred loading. Or just better code.
Sounds simple enough right? The thing is my only laptop is from 2007 and has no video driver for 64bit server so I cant attach it to a projector. Otherwise I could use my old dell laptop. So what I am working on is installing Windows Server 2008 on a core i7 Macbook Pro with 8gb of ram 🙂
I started off thinking I could just use boot camp assistant to install Windows 7 and then put Server 2008 inside a VM on Windows 7 with Virtual Box but the problem with that is I have to cover a lecture in one of the weeks on Hyper-V. Hyper-V is Windows Server’s virtualization hypervisor technology. You cannot install Hyper-V inside a VM environment and have a scenario where you have a VM inside a VM inside a host.
So my only option is to install Windows Server 2008 R2 as the main host and dual boot OSX Lion with it.
So to begin you’ll need to have a few things up front.
Windows Server 2008 R2 DVD
A USB with about 2GB of free space formatted as FAT32 not NTFS for storing boot camp support files
At least 60GB or more of free space on the HDD, I set aside 200GB (of 500GB total) because I may install Win 7 VM’s that can take 30GB+ each.
I started out by running the boot camp assistant in OSX. The boot camp assistant lets you download the Windows drivers for the Mac and stick them on a USB for later. It also helps you partition the HDD for Win7.
Once you have a partition ready you’ll reboot and do a normal install of server by booting from the DVD. you’ll have to format the BOOTCAMP partition as NTFS for server. Make sure you dont format the wrong partition or you’ll could wipe out your OSX partition.
Once the install finishes you’ll notice that there is a lot of devices that wont work. You can start by installing all the boot camp drivers on that USB from earlier that boot camp assistant created for you. WARNING: if you do not install boot camp drivers before rebooting you will not be able to press ctrl+alt+del to login to server because the option key is not remapped to alt until you install the bootcamp drivers. You can get around this problem by plugging in a USB keyboard to be able to press ctrl+alt+del.
This will leave you with about 3-4 things still not working. Wireless, Video, Bluetooth, and sound will all not be working.
Windows 7 and Windows Server 2008 R2 were developed in parallel and most windows 7 drivers will work ok in server 2008 R2 just fine. This is mostly the case for everything but video and bluetooth.
The Macbook Pro I have has an Intel HD Graphics 3000 video adapter, and an AMD Radeon HD 6490M graphics card, bootcamp tried to install Nvidia drivers for my video from the USB.
Windows Server 2008 R2 installs as a bare-bones OS with almost everything turned off. This includes wireless and sound. You will need to add the ‘Wireless LAN Service’ feature in Server Manager to enable wireless networking.
Sound can be enabled by trying to go into sound properties in control panel. You will get a popup saying the windows audio service is not enabled, do you want to enable it? click yes and your sound should start working and be adjustable by the mac volume keys.
If the video drivers are not installed you can probably safely installed the Hyper-V role now.
Do all the Windows Updates now there will be probably about 120 of them in waves because some require others to be installed first. SP1 will show up in Windows Update after about 4 sets of updates. If Hyper-V throws an error saying can’t initialize a VM when trying to start it and the event log shows error 3040 its related to the SP1 fix and Sandy Bridge chipset most likely.
For the fall semester 2011 I was lucky enough to pickup a contract at Seneca to teach the ULI101 (UNIX/LINUX, Internet) course in the Diploma programs at the college. One of the weeks included a lecture on using Fedora Live. I decided to show my students how to use virtual box in the labs to use Fedora within a Virtual Machine environment. The infrastructure of Seneca’s computer labs is setup favorably for this way of using Fedora easily. VM’s have also become a standard in large corporate environments to help reduce the total cost of ownership on server hardware and to better utilize CPU cycles, power, and floor space in server rooms.
Below is a step by step guide to setup VirtualBox with the Fedora Live ISO on Windows 7.
Step 4: Click New to create a new Virtual Machine using the Fedora ISO you downloaded.
Step 5: Click Next on the Create New Virtual Machine wizard window
Step 6: Give the VM a Name you can recognize easily like “Fedora Live”, Choose “Linux” from the Operating System list and “Fedora (64 bit)” from the Version list.
Step 7: Set the memory to the amount of RAM you want to allocate to the VM. The default of 768mb is fine for most needs. Make sure this amount is less than the host machines total ram minus 2GB to leave 2GB for windows 7 minimum.
Step 8: Use defaults for Virtual Hard Disk at 8GB space and “create a new hard disk” options, click next.
Step 9: Use defaults for File type of the “virtual disk with VDI”, click next.
Step 10: Use defaults for “Dynamically allocated disk size”, click next.
Step 11: For Virtual disk file location and size you might want to have students put their VDI file on a USB so they can save it and reuse it in other sessions by remounting it. If they are just using it for one session and throwing away the VM each class session and recreating it then the default settings are fine.
Step 12: Press create to create the VM.
Step 13: Click on the new VM and press start to start it up the first time.
Step 14: Press next to begin, then select the ISO file for Fedora that you downloaded earlier. Press next.
Step 15: Click start to start up the VM.
Notes about using the VM:
When you click inside the VM sometimes the VM hijacks the mouse cursor to the window and wont let it move outside the window. To release it the default key is RIGHT CTRL.
you can map a CD or USB drive from the host machine to the fedora VM so you can access files from the local hosts CD, USB, DVD, or HDD even.
The VM will use whatever amount of RAM you allocated it in the setup from the host. If you set it to use 3GB and the host only has 4GB only 1gb would remain for windows which may cause slow downs or virtual box may not let you start the VM at all if the memory amount is to high that it would starve the host machine.
To close the VM you exit it the same way you would if the OS was running normally with Shutdown from the top right menu. the VM will shutdown and close its window automatically.
You can run the VM in fullscreen mode and it will operate similar to how a remote desktop session would work in windows with a small popup tab at the bottom center of the screen to switch back to windowed mode or close the VM window.
I’m in the process of creating some custom JScript code to have some fields on an expense report form auto calculate and to enable one textbox if a certain expense type is selected.
I’ve been at this all day and I have been getting errors along the lines of “Error: Object expected” thrown at me from Dynamics when testing on the form.
It turns out the website I was using an example from used the quote characters “ ” instead of ” “.
It took me close to 4 hours to figure out why my ENTIRE SCRIPT LIBRARY was broken because of this when I was following some online examples exactly.
Yes that’s right my entire script library broke because one function had improper quotes and therefor a field object wasn’t being returned even though the function wasn’t being called it broke every other function in the library.
So word to the wise if you get an Error: Object expected in Dynamics CRM2011 check the following things:
Is your field name spelled EXACTLY right including case? my_fieldname is not the same as my_FieldName
Are there any spaces added by mistake in the name?
Are you using the entity field name or the display name? entity name is correct EX: new_mycustomfield not “My Custom Field Label”
Reduce down your JScript library and check for missing semi colons or other functions that may be broken to isolate the proper broken function it may not be where you think it is.
Finally did you copy paste an example from another website? if so check the quotes to make sure they are the proper double quote character it should be ” “ not “ ”
EX: Xrm.Page.getAttribute("new_mycustomfield"); not Xrm.Page.getAttribute(“new_mycustomfield”);
As a side note always remember to add code to the onSave event handler for the form as well as the onChange handler for a field if you are using read only fields you need to forceSubmit those values to save them.
Today I gave a presentation at FSOSS 2011 here at Seneca College on how we went about building a commercial game using Processing.js.
The presentation covered our development story. It covered what our industry partner does and why they wanted to change from Flash to Processing.js, our development story, and a demo of the game in its beta state.
With this library I was able to have a live demo of the game in a slide or embed other HTML 5 content.
This game is designed to help teach the basics of Mendelian Genetics to high school aged students and above. The concept is to collect and breed different dragons and learn how the genetics of it all works because the offspring are created based on the genetics of the parents.
One of the challenges I ran into when building this game was figuring out a way to handle all the different combinations of dragons. The dragons have 9 genetic traits that differentiate them from one another and each trait has two or three different phenotypes associated with it. The end result is there are 2592 different dragons that can be created and collected in the game.
These dragons were being dynamically built from a combination of 27 smaller images and then blended together, colorized, and then had patterns applied to them. In the native Processing JAVA environment this process took only about 100 milliseconds to build each dragon. But in the Processing.js environment this process took 700ms on Chrome, 1000ms on Firefox, 2500ms on IE9, and a whopping 4500ms on Safari.
This created a lot of problems, such as slow script warnings, when there were more than 4-5 dragons to build on game load.
To solve this problem I created a sketch in Processing to dynamically build every combination of dragon and call save() on it from a PGraphic to save out an image for every dragon in the game. Now with an automated build process I can quickly (roughly 5 minutes) generate all 2600 dragons into images and load them up with loadImage() or requestImage() in Processing.js significantly improving the load times when starting the game.
As a side challenge to this sketch to generate all the images I added some code to build a massive collage to stick in a copy of every dragon in the game in a giant PGraphics image.
Immediately I had problems with this with not enough memory being able to be allocated to the JRE. Because java runs in a 32 bit environment for the PDE I could only allocate about 1600mb of ram to the environment. This meant I would have to create eight separate images and then composite them later in Photoshop unfortunately. I was still able to do it though and through some crafty code I was able to make eight images that were 6144×13824 in size and then patch them together into a giant 680 megapixel composite image showing all 2592 dragons at 512×512 resolution.
Compositing the image in Photoshop took 11 GB of ram, 679477248 pixels, and created a 60MB PNG image file in the end.
If I had been able to allocate 4-5GB of RAM to the PDE I think I could have generated the entire image in one shot and I would have liked to have been able to add a sitting and flying image of each dragon bumping up the resolution to 1.35Gigapixels in total.