Lets assume we have a class car.
How would You name parameters of function that takes two different cars?
void Race(Car first, Car second);
or maybe
void Race(Car car1, Car car2);
The same situation with function that takes car and list of cars as a parameters.
I'm used to name 'cars' for list of cars, so it is inconvenient to use names like:
void Race(Car car, List<Car> cars);
Any suggestions about names?
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#define IE 40
#define JE 40
#define KE 40
#define ia 7
#define ja 7
#define ka 7
#define NFREQS 3
using namespace std;
main()
float l,m,n,i,j,k,ic,jc,kc,nsteps,n_pml;
float ddx,dt,T,epsz,muz,pi,eaf,npml;
int ib,jb,kb;
.
.
.
.
ic=IE*0.5 ;
jc=JE*0.5 ;
....'ic'dose not name a type.
....'jc'dose not name a type.
Currently, we are defining ourselves an extended log mechanism to print out the class name and the source line number of the log.
#define NCLog(s, ...) NSLog(@"<%@:%d> %@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], \
__LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__])
For example, when I call NCLog(@"Hello world");
The output will be:
Hello world
Now I also want to log out the method name like:
Hello world
So, this would make our debugging become easier when we can know which method is getting called. I know that we also have XCode debugger but sometimes, I also want to do debugging by logging out.
i am creating web mobile application in mvc4.
My problem is when I click on particular link in my application,it works well,
but sometimes it automatically redirected to INDEX page that is set as default page in global.asax as
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
Now I don't know why its automatically redirected to INDEX page,even if I have already defined controller and action name where it show redirected as,
<a href='@(Url.Action( "ActivityWall", "Home"))' > </a>
logically it should redirect to "ActivityWall" page,which it does.but sometime only it goes to INDEX page.then when I clear my cookie problem will again solved but after some time it again start redirecting to INDEX page.
I also posted question related to cookies issue yesterday,but I think that is nit main issue.
can someone help please ?
Hello, I have a TextArea html helper method I'm calling in a foreach loop. Basically, when I initially load the View it works fine, but when i reload the View and load postback data, the same TextArea throws a NullReferencException and yet the variable I'm using in the TextArea as the name of the TextArea is not null. I've attached a picture below for demonstration:
Sorry if it's difficult to see, the blue arrow below is pointing to the variable used to name the TextArea. Again, it works on initial load, but it errors out on postback when the page is reloaded. I'm not sure what's going on.
This has been driving me crazy all day.
I need to get a font filename (eg. Arial.ttf) based off of it's name (Arial in this case). The problem is, I am only supplied with the font name (Arial) and weather it's bold, italic or both. Using those pieces of information, I need to find the font file so I can use it for rendering.
Some more examples:
Calibri, Bold would resolve to calibrib.ttf
Calibri, Italic would resolve to calibrii.ttf
Any ideas on how I could achieve this in C++ (Win32)
Hi everyone,
I have a table with details on personnel. I would like to create a Next/Previous link based on the individual's last name. Since personnel were not added in alphabetical order, selecting the next or previous row based on its ID does not work.
It is a hefty table - the pertinent fields are id, name_l, and name_f. I would like to order by name_l, the individuals' last name.
How would I go about accomplishing this task?
Thanks!
I have a Contacts controller in the main/top area, and I have an area named "Contacts".
I get POST 404s to the Contacts controller if I register my areas before I register my top-level routes:
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
ModelBinders.Binders.DefaultBinder = new NullStringBinder();
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
And, if I register my areas after my routes, my 404s to the Contacts controller goes away, but my routes to the Contacts area are now 404s.
...lots of duplicate controller name questions logged, but I haven't found a specific scenario where the area is the same name as the controller.
...probably an easy fix. Would appreciate help. :-D
Hello! I am updating some C code that copys files with a certain name. basically, I have a directory with a bunch of files named like so:
AAAAA.1.XYZ
AAAAA.2.ZYX
AAAAA.3.YZX
BBBBB.1.XYZ
BBBBB.2.ZYX
Now, In the old code, they just used a call to ShellExecute and used xcopy.exe. to get all the files starting with AAAAA, they just gave xcopy the name of the file as AAAAA.* and it knew to copy all of the files starting with AAAAA. now, im trying to get it to copy with out having to use the command line, and I am running into trouble. I was hoping CopyFile would be smart enough to handle AAAAA.* as the file to be copied, but it doesnt at all do what xcopy did. So, any Ideas on how to do this without the external call to xcopy.exe?
I'm working on a LaTeX package which might need to do some things differently depending on the class that's being used. I'm wondering if there's a way to auto-detect or test the document class.
One could certainly look up the class files and test for the existence of a specific macro defined by that class, but is there a smarter way? I looked at the definition of the \ProvidesClass macro and can't see if it saves the class name anywhere except \@currname. I believe \@currname is just the name of the current package or class being read.
Basically I want to execute
\author{\longauthorname}
in the article class but
\author[\shortauthorname]{\longauthorname}
in the beamer class.
Being fairly new to C++ I have a question bascially concerning the g++ compiler and especially the inclusion of libraries. Consider the following makefile:
CPPFLAGS= -I libraries/boost_1_43_0-bin/include/ -I libraries/jpeg-8b-bin/include/
LDLIBS= libraries/jpeg-8b-bin/lib/libjpeg.a
# LDLIBS= -L libraries/jpeg-8b-bin/lib -llibjpeg
all: main
main: main.o
c++ -o main main.o $(LDLIBS)
main.o: main.cpp
c++ $(CPPFLAGS) -c main.cpp
clean:
rm -rf *.o main
As you can see I declared the LDLIBS variable twice. My code is compiling and working if I use the makefile above. But if I deactivate the first LDLIBS entry and active the second one I get ld: library not found for -llibjpeg. I assume my libjpeg.a is just not called libjpeg but bears some different name.
Is there a way to find out the name of a given "libraryfile" libsomething.a or libsomething.dyn?
I have built a Ruby on Rails app that allows users to track workouts. I also allow them to add groups (like blog tags) to workouts to help keep organized. In most places where I display the tags I do so by grouping by name.
@group_counts = current_user.groups.count(:group => :name,
:order => 'count_all DESC')
Is there a way to disregard capitalization. For instance I have two different records returned for Push press and Push Press.
I have a hierarchical data structure which I'm displaying in a webpage as a treeview.
I want to data to be ordered to first show nodes ordered alphabetically which have no children, then under these nodes ordered alphabetically which have children. Currently I'm ordering all nodes in one group, which means nodes with children appear next to nodes with no children.
I'm using a recursive method to build up the treeview, which has this LINQ code at it's heart:
var filteredCategory = from c in category
orderby c.Name ascending
where c.ParentCategoryId == parentCategoryId && c.Active == true
select c;
So this is the orderby statement I want to enhance.
Shown below is the database table structure:
[dbo].[Category](
[CategoryId] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](100) NOT NULL,
[Level] [tinyint] NOT NULL,
[ParentCategoryId] [int] NOT NULL,
[Selectable] [bit] NOT NULL CONSTRAINT [DF_Category_Selectable] DEFAULT ((1)),
[Active] [bit] NOT NULL CONSTRAINT [DF_Category_Active] DEFAULT ((1))
I use this:
public IQueryable<MaterialsView> FindAllMaterials()
{
var materials = from m in db.Materials
join Mt in db.MeasurementTypes on m.MeasurementTypeId
equals Mt.Id
select new MaterialsView {
MatId = m.Mat_Name,
MesName = Mt.Name,
MesType = m.Mat_Type };
return materials;
}
It gives me the following errors:
The type or namespace name MaterialsView could not be found (are you missing a using directive or an assembly reference?)
Cannot implicitly convert type System.Collections.Generic.IEnumerable<MaterialsView> to System.Linq.IQueryable<MaterialsView>. An explicit conversion exists (are you missing a cast?)
The type arguments for method System.Linq.Enumerable.ToList<TSource>(System.Collections.Generic.IEnumerable<TSource>) cannot be inferred from the usage. Try specifying the type arguments explicitly.
I have googled it and found this SO question but it doesn't help.
What's wrong?
Is there a way to actually get the column name that was updated in order to use it in a trigger?
Basically I'm trying to have an audit trail whenever a user inserts or updates a table (in this case it has to do with a Contact table)
CREATE TRIGGER `after_update_contact`
AFTER UPDATE ON `contact` FOR EACH ROW
BEGIN
INSERT INTO user_audit (id_user, even_date, table_name, record_id, field_name, old_value, new_value)
VALUES (NEW.updatedby, NEW.lastUpdate, 'contact', NEW.id_contact, [...])
END
How can I get the name of the column that's been updated and from that get the OLD and NEW values of that column. If multiple columns have been updated in a row or even multiple rows would it be possible to have an audit for each update?
using Silverlight & Prism.
i create a new scoped region inside a TabControl like so:
IRegionManager regionManager = tabControl.Add(viewRegions, UNIQUEID, true);
then from the TabControl SelectionChanged event i want to get the name of that region.
so i go:
TabItem item = e.AddedItems[0] as TabItem;
FrameworkElement view = item.Content as FrameworkElement;
IRegionManager xxx = RegionManager.GetRegionManager(view);
so now i have the scoped region manager at hand = xxx!
but how do i get its name? (the "UNIQUEID" param i have assigned to it ).
HOW?
First, I am SO sorry if the answer is out there. I've looked and looked and feel this is such a simple thing that it should be obvious.
I'm wanting to make sure only the person who added an event can modify it. Simple!
I already have a datasource that has event_added_by as a data point. It is populating a FormView.
SelectCommand="SELECT * FROM [tbl_events] WHERE ([event_ID] = @event_ID)"
And I have Page.User.Identity.Name.
How do I compare the two? I can't pull the value from the label in the FormView so I need to find another way.
if (!IsPostBack)
{
string uname = Page.User.Identity.Name;
string owner = ""// this is where I need to grab the value from dsEvents;
if (uname != owner)
{
//Send them somewhere saying they're not allowed to be here
}
}
TIA for any help!