What are all operations supported by function pointer differs from raw pointer?
Is , < , <= , =operators supported by raw pointers if so what is the use?
linq to sql visual studio Object-Relational designer generates C# entity class names same as the table names (except pluralizing it).
so if the table name is authors it generates entity class with name "author". If the table name is Customers it generates class with name "Customer". Is there any option that can be set to
make the designer generate entity class names as pascal cased.
I am using VS 2010 if that makes any difference. Thanks.
I need to monitor the direction a user is indicating using the four directional arrow keys on a keyboard in ActionScript 3.0 and I want to know the most efficient and effective way to do this.
I've got several ideas of how to do it, and I'm not sure which would be best. I've found that when tracking Keyboard.KEY_DOWN events, the event repeats as long as the key is down, so the event function is repeated as well. This broke the method I had originally chosen to use, and the methods I've been able to think of require a lot of comparison operators.
The best way I've been able to think of would be to use bitwise operators on a uint variable. Here's what I'm thinking
var _direction:uint = 0x0; // The Current Direction
That's the current direction variable. In the Keyboard.KEY_DOWN event handler I'll have it check what key is down, and use a bitwise AND operation to see if it's already toggled on, and if it's not, I'll add it in using basic addition. So, up would be 0x1 and down would be 0x2 and both up and down would be 0x3, for example. It would look something like this:
private function keyDownHandler(e:KeyboardEvent):void
{
switch(e.keyCode)
{
case Keyboard.UP:
if(!(_direction & 0x1)) _direction += 0x1;
break;
case Keyboard.DOWN:
if(!(_direction & 0x2)) _direction += 0x2;
break;
// And So On...
}
}
The keyUpHandler wouldn't need the if operation since it only triggers once when the key goes up, instead of repeating. I'll be able to test the current direction by using a switch statement labeled with numbers from 0 to 15 for the sixteen possible combinations. That should work, but it doesn't seem terribly elegant to me, given all of the if statements in the repeating keyDown event handler, and the huge switch.
private function checkDirection():void
{
switch(_direction)
{
case 0:
// Center
break;
case 1:
// Up
break;
case 2:
// Down
break;
case 3:
// Up and Down
break;
case 4:
// Left
break;
// And So On...
}
}
Is there a better way to do this?
I'm planning on using Apache torque as my object-relational mapper (ORM), and I was wondering if anybody has any suggestions around what framework to use for presentation layer with torque. maybe Spring?
I don't know if this helps, but my application is basically going to be bunch of forms to input data and based on that data, I'll generate reports in form of a graph or chart.
So, I want to resize images to a FIXED width, but proportional height.
I have been trying a wide range of operators:
380x242#
380x242
380!x242
380x242<
none of them have the desired effect. Any help? I want it to fill or resize to the 380 width, then resize / shrink the height by the same factor it used to shrink or resize the image to 380 wide.
Are these two equivalent? In other words, are the ++ and -- operators atomic?
int i = 0;
return ++i;
AtomicInteger ai = new AtomicInteger(0);
return ai.incrementAndGet();
Hello, All!
Is somebody have an experience using inheritance in PostgreSQL?
Is it worth to use it, or better to keep hands of :)?
In which situation you would use it?
To be true I'm a little bit in doubt about mixing relational and OO models...
I'm getting my first exposure to data warehousing, and I’m wondering is it necessary to have foreign key constraints between facts and dimensions. Are there any major downsides for not having them? I’m currently working with a relational star schema. In traditional applications I’m used to having them, but I started to wonder if they were needed in this case. I’m currently working in a SQL Server 2005 environment.
I'm looking for web app frameworks and/or database administration tools, either popular and unpopular, written in any language, for any relational database.
In short, I'm looking for web accessible CRUD front-ends with minimal programming effort.
For example:
phpMyAdmin (MySQL administration tool)
Ruby on Rails (web app framework with scaffolding)
Hello, I'm looking for any pointers on how to write a rails web app without ActiveRecord.
A doc or an example of a (not too complex) web app using storage backends other than a relational database would be greatly appreciated.
It's not clear on what should be implemented in the model classes in order to make the rails app work without the ActiveRecord layer.
Thanks,
I will build a system where I want to reduce single-point-of-failures, and I need a database. Is there any (free) relational database systems that can handle multi-master setups good (i.e where it is easy to add and remove nodes) or is it better to go with a NoSQL-database?
As what I have understood, a key-value store will handle this better. What database system do you recommend for a multi-master (cluster) setup?
Quoting http://www.mongodb.org/display/DOCS/MapReduce#MapReduce-Parallelism
As of right now, MapReduce jobs on a
single mongod process are single
threaded
Without parallelism, what are the benefits of MapReduce compared to simpler or more traditional methods for queries and data aggregation?
To avoid confusion: the question is NOT "what are the benefits of document-oriented DB over traditional relational DB"
i came across this line is stroustrup An operator function must either be a member or take at least one argument of a user-defined type (functions redefining the new and delete operators need not).
Dont operator new and operator delete take an user defined type as one of their arguments?
what does it mean, am i missing something here
Hi, I already have my operators for, by example, eat banana problem
[#op{
action = [climb, on, {object}],
preconds = [[at, {place}, {object}], [at, {place}, me],
[on, floor, me], [on, floor, {object}], [large, {object}]],
add_list = [[on, {object}, me]],
del_list = [[on, floor, me]]
},
But how can I use it in the function solve(Problem, depth_first, []). And depth_first (Problem, Start) - search_tree(Problem, container.stack, Start).
I realize this is a basic question but I have searched online, been to cplusplus.com, read through my book, and I can't seem to grasp the concept of overloaded operators. A specific example from cplusplus.com is:
// vectors: overloading operators example
#include <iostream>
using namespace std;
class CVector {
public:
int x,y;
CVector () {};
CVector (int,int);
CVector operator + (CVector);
};
CVector::CVector (int a, int b) {
x = a;
y = b;
}
CVector CVector::operator+ (CVector param) {
CVector temp;
temp.x = x + param.x;
temp.y = y + param.y;
return (temp);
}
int main () {
CVector a (3,1);
CVector b (1,2);
CVector c;
c = a + b;
cout << c.x << "," << c.y;
return 0;
}
from http://www.cplusplus.com/doc/tutorial/classes2/ but reading through it I'm still not understanding them at all. I just need a basic example of the point of the overloaded operator (which I assume is the "CVector CVector::operator+ (CVector param)").
There's also this example from wikipedia:
Time operator+(const Time& lhs, const Time& rhs)
{
Time temp = lhs;
temp.seconds += rhs.seconds;
if (temp.seconds >= 60)
{
temp.seconds -= 60;
temp.minutes++;
}
temp.minutes += rhs.minutes;
if (temp.minutes >= 60)
{
temp.minutes -= 60;
temp.hours++;
}
temp.hours += rhs.hours;
return temp;
}
from "http://en.wikipedia.org/wiki/Operator_overloading"
The current assignment I'm working on I need to overload a ++ and a -- operator.
Thanks in advance for the information and sorry about the somewhat vague question, unfortunately I'm just not sure on it at all.
I know that there are certain "special" methods of various objects that represent operations that would normally be performed with operators (i.e. int.__add__ for +, object.__eq__ for ==, etc.), and that one of them is list.__setitem, which can assign a value to a list element. However, I need a function that can assign a list into a slice of another list.
Basically, I'm looking for the expression equivalent of some_list[2:4] = [2, 3].
I've been looking into writing a web app that will run on Google App Engine, but before I commit myself to the platform I'd like to know what, if any, limitations there are. I'm aware of the basic CPU/bandwidth restrictions that Google places on the free service, but I'm wondering more about development restrictions like how BigTable compares to a standard relational database and what Python libraries aren't available on the GAE platform (and what alternatives Google provides).
Basically I'm looking for any hidden roadblocks before I commit to the platform. Thanks for your help!
I came across this code today whilst reading Accelerated GWT (Gupta) - page 151.
public static void getListOfBooks(String category, BookStore bookStore) {
serviceInstance.getBooks(category, bookStore.new BookListUpdaterCallback());
}
public static void storeOrder(List books, String userName, BookStore bookStore) {
serviceInstance.storeOrder(books, userName, bookStore.new StoreOrderCallback());
}
What are those new operators doing there? I've never seen such syntax, can anyone explain?
I am creating an mssql database table, "Orders", that will contain a varchar(50) field, "Value" containing a string that represents a slightly complex data type, "OrderValue".
I am using a linqtosql datacontext class, which automatically types the "Value" column as a string.
I gave the "OrderValue" class implicit conversion operators to and from a string, so I can easily use implicit conversion with the linqtosql classes like this:
// get an order from the orders table
MyDataContext db = new MyDataContext();
Order order = db.Orders(o => o.id == 1);
// use implicit converstion to turn the string representation of the order
// value into the complex data type.
OrderValue value = order.Value;
// adjust one of the fields in the complex data type
value.Shipping += 10;
// use implicit conversion to store the string representation of the complex
// data type back in the linqtosql order object
order.Value = value;
// save changes
db.SubmitChanges();
However, I would really like to be able to tell the linqtosql class to type this field as "OrderValue" rather than as "string". Then I would be able to avoid complex code and re-write the above as:
// get an order from the orders table
MyDataContext db = new MyDataContext();
Order order = db.Orders(o => o.id == 1);
// The Value field is already typed as the "OrderValue" type rather than as string.
// When a string value was read from the database table, it was implicity converted
// to "OrderValue" type.
order.Value.Shipping += 10;
// save changes
db.SubmitChanges();
In order to achieve this desired goal, I looked at the datacontext designer and selected the "Value" field of the "Order" table.
Then, in properties, I changed "Type" to "global::MyApplication.OrderValue".
The "Server Data Type" property was left as "VarChar(50) NOT NULL"
The project built without errors.
However, when reading from the database table, I was presented with the following error message:
Could not convert from type 'System.String' to type 'MyApplication.OrderValue'.
at System.Data.Linq.DBConvert.ChangeType(Object value, Type type)
at Read_Order(ObjectMaterializer1 )
at System.Data.Linq.SqlClient.ObjectReaderCompiler.ObjectReader2.MoveNext()
at System.Linq.Buffer1..ctor(IEnumerable1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Example.OrdersProvider.GetOrders()
at ... etc
From the stack trace, I believe this error is happening while reading the data from the table. When presented with converting a string to my custom data type, even though the implicit conversion operators are present, the DBConvert class gets confused and throws an error.
Is there anything I can do to help it not get confused and do the implicit conversion?
Thanks in advance, and apologies if I have posted in the wrong forum.
cheers / Ben
Hi
I have a code like
A = B|C|D|E;
Throwing the warning "suggest parentheses around arithmetic in operand of |"
Expecting that expression needs high priority paranthesis for operators, tried the following ways:
A=(B|C)|(D|E);
one more as : A=(((B|C)|D)|E);
Still the same warning persists.
Please help me in resolving this.
Thanks,
Sujatha
I'm researching a way to build an n-tierd sync solution. From the WebSharingAppDemo-CEProviderEndToEnd sample it seems almost feasable however for some reason, the app will only sync if the client has a live SQL db connection. Can some one explain what I'm missing and how to sync without exposing SQL to the internet?
The problem I'm experiencing is that when I provide a Relational sync provider that has an open SQL connection from the client, then it works fine but when I provide a Relational sync provider that has a closed but configured connection string, as in the example, I get an error from the WCF stating that the server did not receive the batch file. So what am I doing wrong?
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
builder.DataSource = hostName;
builder.IntegratedSecurity = true;
builder.InitialCatalog = "mydbname";
builder.ConnectTimeout = 1;
provider.Connection = new SqlConnection(builder.ToString());
// provider.Connection.Open(); **** un-commenting this causes the code to work**
//create anew scope description and add the appropriate tables to this scope
DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription(SyncUtils.ScopeName);
//class to be used to provision the scope defined above
SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning();
....
The error I get occurs in this part of the WCF code:
public SyncSessionStatistics ApplyChanges(ConflictResolutionPolicy resolutionPolicy, ChangeBatch sourceChanges, object changeData)
{
Log("ProcessChangeBatch: {0}", this.peerProvider.Connection.ConnectionString);
DbSyncContext dataRetriever = changeData as DbSyncContext;
if (dataRetriever != null && dataRetriever.IsDataBatched)
{
string remotePeerId = dataRetriever.MadeWithKnowledge.ReplicaId.ToString();
//Data is batched. The client should have uploaded this file to us prior to calling ApplyChanges.
//So look for it.
//The Id would be the DbSyncContext.BatchFileName which is just the batch file name without the complete path
string localBatchFileName = null;
if (!this.batchIdToFileMapper.TryGetValue(dataRetriever.BatchFileName, out localBatchFileName))
{
//Service has not received this file. Throw exception
throw new FaultException<WebSyncFaultException>(new WebSyncFaultException("No batch file uploaded for id " + dataRetriever.BatchFileName, null));
}
dataRetriever.BatchFileName = localBatchFileName;
}
Any ideas?
I´m interested in both web resources and books. It´s a jungle out there, please give me a hand.
My goal is to learn the SQL language so I can query Sql Server databases within a couple of weeks.
I´ve got a programming background, and I know some basic stuff about relational databases, but almost nothing on how to use the SQL language.
I'm hoping there are some Cell Phone Operator gurus here today.
Would anyone be able to explain how Operators achieve the Visual Voicemail feature on the iPhone (and I assume other newer smart phones)?
If a new cell phone operator that distributed SIM cards wanted to utilise the visual voicemail feature on unlocked iPhone's what services need to be in place to be able to support it?
Is there an open spec or is it completely proprietary?