Hi,
So using the regular MongoDB library in Ruby I have the following query to find average filesize across a set of 5001 documents:
avg = 0
total = collection.count()
Rails.logger.info "#{total} asset creation stats in the system"
collection.find().each {|row| avg += (row["filesize"] * (1/total.to_f)) if row["filesize"]}
Its pretty…
I created an application core, in C++, that I've compiled into a static library in Visual Studio. I am now at the process of writing a GUI for it.
I am using MFC to do this. I figured out how to map button presses to execute certain methods of my application core's main class (i.e. buttons to have it start and stop).
The core class however,…
I have been developing for my company for approximately three years. We serve up a web portal using Microsoft .NET and MS SQL Server on DotNetNuke.
I am going to leave my job full time at the end of April. I am leaving on good terms, and I really care about this company and the state of the web project.
Because I haven't worked in a…
I need to take a url, "/ServiceSearch/r.php?n=blahblah", and have it go to "/search/blahblah/" so that it appears in the browser as "/search/blahblah", but I actually want it to REALLY be going to "r.php?n=ServiceSearch&n=blahblah"..
So I was thinking I'll need to rewrite the first URL to "/ServiceSearch/r.php?n=blahblah" and then…
I'm wanted to convert some of my python code to C++ for speed but it's not as easy as simply making a C++ function and making a few function calls. I have no idea how to get a C++ integer from a python integer object. I have an integer which is an attribute of an object that I want to use. I also have integers which are inside a list in…
So, I have a pretty basic need, but I can't figure out if it's even possible, much less how to do it.
I have a main page that anyone can see. Most of the rest of the application can be seen only if logged in (hence, a "set cookie"). So I was thinking, as long as they don't have a cookie set, they can just see a cached version of nginx.…
I am trying to write xsd type schema for an element that has a custom type to include addition attributes to extend a base type. I am running into trouble getting the syntax right.
<xs:element name="graphs">
<xs:complexType>
<xs:sequence>
<xs:element name="graph"
minOccurs="1"
…
Hi just wondering if you could help I've produced a function to get back a random set of submission depnding on the amount passed to it, but I worry that even though it works now with a small amount of data when the a large amount is passed through it would become efficent and cause problems.
Just wondering if you could suggest a more…
Hello I am getting the below message on a table i am trying to create
The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
Anyone know the answer to this please
-- Table warrington_central.job
-- -----------------------------------------------------
…
I have a nullable date in my database. I am connecting to it with a LinqDataSource, and binding with a FormView. It allows you to place dates fine, but if you remove the date I need it to insert the null value to the db. It is instead throwing an exception.
<asp:TextBox ID="TxtStartDate" runat="server"
…
http://stackoverflow.com/a/6065421 was helpful to see how to confirm jquery has been loaded.
my widget will need a class that was written using jquery. may i have some assistance on embedding this other class built using jquery?
thank you,
below is the snippet from the above link with my code added in the final portion as…
Is there any way to write a VS Add-In or something else that would allow me to be able to link files to an ASPX page in ASP.NET.
My goal is to be able to have this extra file created with every ASPX page, and then use a custom MS Build Task to analyze those files and do some stuff.
So for example, when I created…
I created a marker interface:
public interface ISupportAJAXPostsBacks{}
I added it to my Page..
public partial class MyWebForm : PageBase, ISupportAJAXPostsBacks
I have this check in my PageBase class...
if(this is ISupportAJAXPostsBacks)
{
... do some stuff ...
}
If I step through via the debugger,…
I want to be able to package my JavaScript code into a 'namespace' to prevent name clashes with other libraries. Since the declaration of a namespace should be a simple piece of code I don't want to depend on any external libraries to provide me with this functionality. I've found various pieces of advice on…
I have a C++/CLI application in Visual Studio 2008 whose namespace follows the .NET guideline of CompanyName.TechnologyName[.Feature][.Design]. The problem is that there seems to be no way to set a multi-level namespace in the project's Root Namespace property. I have tried both CompanyName.TechnologyName…
I started the source from this progressbar example, and it works fine. My only change was to set the width of the progressbar to "20%".
<!DOCTYPE html>
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet"…
I have created a very simple window service using visual studio 2010 and .Net 4.0.
This service has no functionality added from the default windows service project, other than an installer has been added.
If i run installutil.exe appName.exe on my dev box or other windows 2008 R2 machines in…
One of the pitfalls I run into on a daily basis is customers saying one thing while meaning another. Usually, this is just due to a miscommunication somewhere, but occasionally they are, in fact, saying the same thing I am just using a different term.
For example, one of my customers the…
I'm doing a simple shopping cart for a small site.
I plan to store cart items as well as logged in user_id in session variables.
to make things a little more secure, I thought I'd do this:
sha1() the user_id before storing it in the session.
Also sha1() and store the http_user_agent…
Hi
I’m trying to resolve a problem using VB and I need some assistance. I’m very new to the language (1 week). The problem is I have created a user form to show how many hours and minutes has elapsed between two different times similar to a time sheet.
The user form consists of two…
I'd like to be able to run a line of PHP code on the command line similar to how the following options work:
:~> perl -e "print 'hi';"
:~> python -c "print 'hi'"
:~> ruby -e "puts 'hi'"
I'd like to be able to do:
:~> php "echo 'hi';"
I've read that there is a -r…
I want to modify the "Java class" template, so that the class javadoc comment includes more than just the author. In Netbeans 6.8., I go to Tools Templates Java Java Class, and modify the template. However, nothing seems to change. I tried restarting Netbeans, just in case,…
I have been using this script to send emails to certain staff but because of changes to my system i have to now send attachements with the email and i have tried multipul peices of code to accomplish this but have been unsuccessful... I still recive the email but without the…