How would you store all 12 months and their correct amount of days in an array? Making a 12 by 31 array is two much for some of the months, like Feb has only 28 days. Suggestions?
To prohibit copy construction and copy assignment, I've seen the boost noncopyable class and in the Google style guide the DISALLOW_COPY_AND_ASSIGN macro. Is there any reason to prefer one of the techniques over the other, or any subtle differences one should be aware of?
I have two entities. Groups. Pools. A Group can create many pools.
So I setup my Pool table to have a GroupID foreign key.
My code:
using (entity _db = new entity()) {
Pool p = new Pool();
p.Name = "test";
p.Group.ID = "5";
_db.AddToPool(p);
}
This doesn't work. I get a null reference exception on p.Group.
How do I go about creating a new "Pool" and associating a GroupID?
It looks like Django does not update last_login field in auth_user model when a visitor is authenticated by saved session.
So in this case, how can I implement a similar feature like the "seen" field on very SO user's profile page.
I'm having problem with some data missing in the record. I've a ASP.net web app that take some information from the user then create a record on the database. It's your typical CRUD app but I've noticed lately that some record are missing couple fields. Where they are null value. I think it might have been an Session issue.
What's the best way to handle session time out in a typical CRUD app?
Thanks
I'm trying to figure out how do download a particular tag of a git repository - it's one version behind the current version.
I saw there was a tag for the previous version on the git web page, with object name of something long hex number.
But the version name is "Tagged release 1.1.5" according the site.
I tried a command like this (with names changed):
git clone http://git.abc.net/git/abc.git my_abc
And I did get something - a directory, a bunch of subdirectories, etc.
If it's the whole repository, how do I get at the version I'm seeking? If not, how do I download that particular version?
I am using PHP/Java bridge to run PHP scripts on the Tomcat server. Can someone point me to an example as to how to call my PHP scripts from a Java file.
<?php
class X{
//variables
//functions
}
?>
Now I want to call the member functions of class X using its object via a Java file. How do I do this?
Are there any tools available that allow you to 'look' at any given application and show you which WinForm controls are being used in that application? I happen to have an app which I like the GUI of, and I want to use a similar structure in my own app. Instead of developing these controls myself, it may be easier to buy them, if only I can spot which are being used... Any suggestions?
This is my function:
(defun MyFunction(input)
(let ((NEWNUM (find input num)))
(if (find input num) //if this
(setq num NEWNUM) (FUNCT2) //then execute both of these
(list 'not found)))) //else output this
So after the if statment I want to be able to execute (setq num NEWNUM) and (FUNCT2). One to set a new variable and then the other to call a function. Any ideas on how to do this?
I want to create a list containing the 3-D coords of a grid of regularly spaced points, each as a 3-element tuple. I'm looking for advice on the most efficient way to do this.
In C++ for instance, I simply loop over three nested loops, one for each coordinate. In Matlab, I would probably use the meshgrid function (which would do it in one command). I've read about meshgrid and mgrid in Python, and I've also read that using numpy's broadcasting rules is more efficient. It seems to me that using the zip function in combination with the numpy broadcast rules might be the most efficient way, but zip doesn't seem to be overloaded in numpy.
Restaurants Menus Products
RestaurantID MenuID ProductID
RestaurantName MenuName ProductName
RestaurantID MenuID
<asp:DropDownList ID="DropDownList8" runat="server" DataSourceID="ObjectDataSource3"
SelectedValue='<%# Bind("MenuID") %>' Field="RestaurantName" DataValueField="RestaurantID">
Gridview has GetAllProducts method
ObjectDataSource3 has method GetAllRestaurants.
I want to edit and update Menus of each Product. But I want to show RestaurantName indtead of MenuID..
Thanks
I have a strange problem,
I am trying to order the output of a set of records by a field called displayOrder. Now even though record A has a displayOrder of 2 and record B has a displayOrder of 1000, record B still shows up before record A. Here's my select statement:
SELECT * FROM items ORDER BY displayOrder ASC
It works fine until I have a record greater than 9, then 10, 11, 12, etc are seen as smaller than 2, 3, 4 because they start with the number 1. Any way to fox this?
Hi all,
ok what I want to do is to draw a quad in the scene that lays on a plane parallel to the view. So it should appear flat.
More in particular, I think I didn't get very well how the mechanism of gluLookAt works in comparison with the functions glTranslate and glRotate:
If I position the view "manually" using the functions glTranslate and glRotate whenever I draw an object its position is relative to the current view. And I understand that this is due to the transformation matrix in the stack.
However when I use the gluLookAt that should automatically set the view, the coordinates of the object I want to draw must be "absolute" to show it properly.
Thanks in advance.
Are they stored in the heap or there is separate area where they are stored?
Similarly where are static variables stored in memory. They can't be stored in frames as they will get destroyed when the function returns.
PS - Can someone suggest a good book that talks about memory mapping for C/C++.
I'm trying to make an application-level add-in for Excel and I would like to store certain information about the program's state. The information I want to store pertains to the state of each Excel file (rather than across all Excel files).
I decided to rewrite all our Bash scripts in Python (there are not so many of them) as my first Python project. The reason for it is that although being quite fluent in Bash I feel it's somewhat archaic language and since our system is in the first stages of its developments I think switching to Python now will be the right thing to do.
Are there scripts that should always be written in Bash? For example, we have an init.d daemon script - is it OK to use Python for it?
We run CentOS.
Thanks.
It's possible via C# code get an list of methods/delegates that was set to Control? let me explain better..
For example.
Assuming some definitions like this:
foo.Click += (a, b) => { ... }
//..
foo.Click += (A,B) => { ... }
And a megic method:
var baa = foo.GetEvents("Click");
Returns
baa[0] points to (a, b) => { ... }
baa[1] points to (A,B) => { ... }
My scenery: I make and add dynamically event to some controls inside a loop. I want depending to a boolean value a event of control of index one,will removed by using control.Click -= baa[1] or something like this. I hope this is clear for your. Thanks in advance.
I have some git repositories running on my server and I would like to give a friend read/write access to one. That's simple: I add him as a user, give him SSH access, and change the permissions to the repository folder.
Everything works fine; I'm able to clone the git repository using Xcode and change things (ssh://www.example.com/repo.git). However, I do not want him to have command line access. If I recall correctly, Github does not give command line access to those who SSH in.
I'm using Snow Leopard Server. Is this more of a server issue or a git issue? Do you have any idea where to begin? Setting the user's Login Shell to none (as opposed to /bin/bash) cuts off access to everything.
After an error occurs, I call perror(), naturally. But I'm getting a segmentation fault when I do this or printf("error: %s\n", strerror(errno)); I have no idea what is happing.
int fd;
if((fd = open(FILENAME, O_RDONLY)) == -1) {
perror("fbi");
exit(1);
}
for(;;) {
readed = read(fd, buffer, BUFSIZE);
if(readed == 0)
break;
if(readed == -1) {
perror("fbi"); // <- here's the error
exit(1);
}
How to fix this?
Hi, I'm using JQuery to select some elements on a page and then move them around in the DOM. The problem I'm having is I need to select all the elements in the reverse order that JQuery naturally wants to select them. For example:
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
I want to select all the li items and use the .each() command on them but I want to start with Item 5, then Item 4 etc. Is this possible?
Thanks
I want to have a function which searches for a key in a collection of maps and returns an iterator to the found key. But what should be returned in case the key cannot be found? I cannot return map::end since the collection of maps can be empty.
Thanks.