casting

Cast Date in Informix

跟風遠走 提交于 2019-12-24 08:58:52
问题 I have never used Informix before and I'm trying to write a query that will return records over the last 365 days. Here is the query I have been trying to use: Select * from Visit where vis_mod_dt between today-365 and today; That returns no records even though I know that there is data for the last 365 days. I am guessing that the vis_mod_dt in not a true date column, although it displays as '12/31/1899' I have tried to cast this column using: select * from visit where date(vis_mod_dt)

Dynamically specify the type in C#

微笑、不失礼 提交于 2019-12-24 08:41:10
问题 I'm creating a custom DataSet and I'm under some constrains: I want the user to specify the type of the data which they want to store. I want to reduce type-casting because I think it will be VERY expensive. I will use the data VERY frequently in my application. I don't know what type of data will be stored in the DataSet, so my initial idea was to make it a List of object s, but I suspect that the frequent use of the data and the need to type-cast will be very expensive. The basic idea is

Casting array of pointers to objects

余生长醉 提交于 2019-12-24 08:38:05
问题 If B is subclass of A . And I have in main() : B** b = new B*[10]; ... // some algorithm that does b[i] = new B(..); So I have an array of pointers to objects B . Then I have a function: void f(A** foo); If in main, I do: f(b); I get a warning, but obviously if I do: f((A**)b); , I don't. The (A**) its a bit nasty. I was wondering if there's a more elegant way in C++ that at least do type checking as dynamic_cast . I want foo to sort (only using swaps) arrays of objects of type A or subclass.

How to determine the type of the camel exchange object

本小妞迷上赌 提交于 2019-12-24 07:56:30
问题 I have two different services running on a web server. Both the services have an operation named 'xyz', with the following arguments. Service 1: Public String xyx(Student object) {} Service 2: public String xyz(Employee object){} Now i have a client which will invoke the operation of one of these services based on the message that it receives. The message will be received as a camel exchange. So i need to identify the type of the message and then invoke the appropriate service. How do i

How to cast list to enumerable

那年仲夏 提交于 2019-12-24 07:48:15
问题 I've got a problem with the following code: public IEnumerable<ISession> GetSessions() { // ... using (ProvaDbEntities DBEntities = new ProvaDbEntities(Utilities.ToEntitiesConnectionString())) { ObjectQuery<session> sessions = DBEntities.session; IEnumerable<session> q1 = from session in sessions where session.site == this.Name select session; List<Session> sessionList = new List<Session>(); foreach (var s in q1) { sessionList.Add(new Session(s.id.ToString(),s.username, s.site, new DateTime()

portable signed/unsigned byte cast,C++

时光怂恿深爱的人放手 提交于 2019-12-24 07:43:23
问题 I am using signed to unsigned byte(int8_t) cast to pack byts. uint32_t(uint8_t(byte)) << n This works using GCC on Intel Linux. Is that portable for other platforms/compilers, for example PowerPC? is there a better way to do it? using bitset is not possible in my case. I am using stdint via boost 回答1: If you are using boost/cstdint.hpp from the Boost Integer library, then yes, the typedefs are portable (cross-platform.) The boost/cstdint.hpp header is meant to implement C99 stdint.h

Is there a good way to convert from unsigned char* to char*?

落花浮王杯 提交于 2019-12-24 06:59:11
问题 I've been reading a lot those days about reinterpret_cast<> and how on should use it (and avoid it on most cases). While I understand that using reinterpret_cast<> to cast from, say unsigned char* to char* is implementation defined (and thus non-portable ) it seems to be no other way for efficiently convert one to the other. Lets say I use a library that deals with unsigned char* to process some computations. Internaly, I already use char* to store my data (And I can't change it because it

instance of primative (wrapper) [duplicate]

﹥>﹥吖頭↗ 提交于 2019-12-24 06:59:09
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Determining if an Object is of primitive type This may sound moronic, but please forgive me, I'm working with moronic code. What is the best way, given a collection of objects, to identify which are primitives, or more accurately, wrappers around primitives. Suppose I want to print all primitives: HashMap<String,Object> context = GlobalStore.getContext(); // Some bizarre, strangely populated context for(Entry

Casting DataRow to Strongly-Typed DataRow: How do they do it?

拜拜、爱过 提交于 2019-12-24 06:40:13
问题 I'm trying to make a lightweight version of some strongly-typed DataRows in order to write a test for a method that takes IEnumerable<T> where T : DataRow . I would like to make a class that inherits from DataRow but has additional properties, as in the autogenerated strongly-typed DataSet.Designer.cs. I cannot get their code to work, and indeed I don't understand how it could work: // from AnimalDataSet.Designer.cs: [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System

How to extend WCF returned class properly?

跟風遠走 提交于 2019-12-24 05:04:14
问题 I am using a WCF service in my project. This service returns a class called "Store". I created a new local class which inherits from "Store". My class is called "ExtendedStore". My ExtendedStore looks like this: class ExtendedStore : StoreManagerService.Store { public int Id; .... } Now I am using the WCF service to cast to my class using the following code: StoreManagerService.StoreClient client = new StoreManagerService.StoreClient(); ExtendedStore store = (ExtendedStore) client.GetStore();