w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to implement a type-bound write statement output in a Fortran derived-type or class
You need to have a generic WRITE(FORMATTED) binding, bound to a specific procedure that has suitable characteristics. See section 9.6.4.8 in the F2008 standard for more information. type :: A real :: value integer :: descriptor contains procedure :: writetype generic :: write(formatted) => writetype end type A ... subroutine writetype(dtv, unit, iotype, v_list, iostat, iomsg) ! Argument names here from the std, but you can name them differently. class(A), intent(in) :: dtv ! Object to write. integer, intent(in) :: unit ! Internal unit to write to. character(*), intent(in) :: iotype ! LISTDIRECTED or DTxxx integer, intent(in) :: v_list(:) ! parameters from fmt spec. integer, intent(out) :: iostat ! non zero on error, etc. character(*), int

Categories : Python

How to convert field of the list item via custom struts type converter?
TypeConversion Annotation: This annotation is used for class and application wide conversion rules. The TypeConversion annotation can be applied at property and method level. @TypeConversion(converter = “com.test.struts2.MyConverter”) public void setAmount(String amount) { this.amount = amount; } This annotation specifies the location of one of my converters. literally, by using this annotation, I register my class com.test.struts2.MyConverter as a converter, and gets executed every time when setAmount(String amount) method is invoked.

Categories : Java

List custom class members and type
You can use reflection foreach (var prop in typeof(WineCellar).GetProperties()) { if (prop.PropertyType == typeof(double) || prop.PropertyType == typeof(double?)) { } } to get the value, you can do: prop.GetValue(obj);

Categories : C#

foreach statement cannot operate on variables of type public definition for 'getenumerator'
Considering message your type Task03Entities.Entites is not a collection and/or not enumerable type. So in order to be able to use foreach on it, you have to make it such. For example can have a look on: How to make a Visual C# class usable in a foreach statement

Categories : C#

Convert Arraylist to Array, data of Arraylist is of custom class type
ArrayList<String> stock_list = new ArrayList<String>(); stock_list.add("stock1"); stock_list.add("stock2"); String[] stockArr = new String[stock_list.size()]; stockArr = stock_list.toArray(stockArr); for(String s : stockArr) System.out.println(s); this is helpful for arraylist to array conversion also you can use arraylist directly with the arrayadapter no need to convert it to array

Categories : Android

A message body reader for Java class java.util.List, and Java type java.util.List<>, and MIME media type text/html was not found
I deleted all generated classes and all restful classes and the GroupUClient then the program works without problems. change from public ChatuserClient() { com.sun.jersey.api.client.config.ClientConfig config = new com.sun.jersey.api.client.config.DefaultClientConfig(); client = Client.create(config); webResource = client.resource(BASE_URI).path("entities.chatuser"); } to public ChatuserClient() { com.sun.jersey.api.client.config.ClientConfig config = new com.sun.jersey.api.client.config.DefaultClientConfig(); client = Client.create(config); webResource = client.resource(BASE_URI).path("entities.service.chatuser"); }

Categories : Java

asp.net json web service sending array error Cannot convert object of type 'System.String' to type 'System.Collections.Generic.List`1[System.String]'
You need to make your data parameter of the $.ajax call like this: JSON.stringify({'a': variables}) The JSON variable is not available in < IE8 so you'll want to include a JSON implementation like the one mentioned in the answer here Also, you had an extra } in the success function. So, in the future, if you want to add extra parameters to your data object passed to the web service, you'd construct it like so: var someArr = ['el1', 'el2']; JSON.stringify({ 'param1': 1, 'param2': 'two' 'param3': someArr // etc }); JavaScript: var variables = Array(); var i = 0; $('#Div_AdSubmition').find('.selectBox').each(function () { variables[i] = $(this).find('.selected').find(".text").html(); i++; }); $.ajax({ type: 'post', data: JSON.stringify({'a': variables}),

Categories : C#

Cannot implicitly convert type '.List' to '.List'
You are selecting to an anonymous type, which is not a Customer. If you want to do (sort of) this, you can write it like this: return db.Customers.Select(x => new Customer { Name = x.CustName, Email = x.CustEmail, Address = x.CustAddress, ContactNo = x.ContactNo }).ToList(); This assumes the properties on your Customer object are what I called them. ** EDIT ** Per your comment, If you want to return a subset of the table, you can do one of two things: Return the translated form of Customer as I specified above, or: Create a new class for your business layer that only has only those four fields, and change your method to return a List<ShrunkenCustomer> (assuming ShunkenCustomer is the name that you choose for your new class.)

Categories : C#

AutoMapper custom type convert using ConstructServicesUsing
I tested this code and got this working using the following code: public void TestMethod1() { Mapper.CreateMap<string, DateTime>().ConvertUsing(new DateTimeTypeConverter()); Mapper.CreateMap<string, Type>().ConvertUsing(new StringTypeConverter()); Mapper.CreateMap<string, int>().ConvertUsing(new StringIntConverter()); Mapper.CreateMap<Source, Destination>(); var destination = Mapper.Map<Source, Destination>( new Source { Value1 = "15", Value2 = "01/01/2000", Value3 = "System.String" }, options => options.ConstructServicesUsing(type => new SourceDestinationTypeConverter()) ); Assert.AreEqual(destination.Value2.Year, 2000); } And the extra Converters: public

Categories : C#

CRTP with base class trying to get the return type of a derived class member: invalid use of incomplete type
This is pretty messy, since Derived isn't complete when template argument deduction happens for Base. I assume the obvious answer - pass Vector and Scalar explicitly - is unsatisfactory. How about: template <template <class, class> class Derived, class Vector, class Scalar> struct Base {}; template <class Vector, class Scalar> struct Derived : Base<Derived, Vector, Scalar> {}; Why the strange restriction to not use typedef? I find: template <class Vector> using ScalarTypeOf = typename std::decay<decltype(std::declval<Vector>()[0])>::type; template <class Crtp> using VectorTypeOf = typename std::decay<decltype(std::declval<Crtp>().data())>::type; template <class Crtp> struct Base { using Vector = Vector

Categories : C++

What does Failed to convert property value of type '$Proxy0 to required type means in this case?
Ok, first thing i see here: WriterSqlParameterSetter is a ItemPreparedStatementSetter! fine! But even if you declare: <beans:property name="amount" value="#{jobParameters[amount]}"/> <beans:property name="id" value="#{jobParameters[id]}"/> I don't see theses properties in : public class WriterSqlParameterSetter implements ItemPreparedStatementSetter<transactionas>{ public void setValues(transactionas ts, PreparedStatement ps) throws SQLException { ps.setDouble(1, ts.GetAmount()); ps.setInt(2, ts.GetID()); } } And even if the properties were declared, the ItemPreparedStatementSetter wont use them since, it takes value from the object received in the writer (eg. transactionas). I am trying to see why you need to pass an amount and

Categories : Spring

Webgrid: Cannot convert lambda expression to type 'object' because it is not a delegate type
You can't use embedded razor strings within the lambda expression, as @Alessandro D'Andra suggests you have to use x => "<img src='" + someString + "'></img>"; instead. You might also have to wrap it all in an MvcHtmlString to prevent Razor from escaping the string once it is used by the formatter, but I don't know exactly how the formatter works - you have to try it. I made a small test file to find out exactly what the Razor compiler would do with your code. This is the razor file: @{ string someString = "somestring"; Func<object, object> a = x => "<text><img src='" + someString + "'></img></text>"; Func<object, object> b = x => @<text><img src="@someString"></img></text>); } The ASP.NET

Categories : C#

What does Failed to convert property value of type '$Proxy0 to required type means?
You don't use the right interface. Your ReaderSqlParameterSetter should implements PreparedStatementSetter not ItemPreparedStatementSetter If you look at the impl of JdbcCursorItemReader: public class JdbcCursorItemReader<T> extends AbstractCursorItemReader<T> { PreparedStatement preparedStatement; PreparedStatementSetter preparedStatementSetter; String sql; RowMapper rowMapper; The property is a PreparedStatementSetter . If you look at the interface you try to use : public interface ItemPreparedStatementSetter<T> { /** * Set parameter values on the given PreparedStatement as determined from * the provided item. * @param ps the PreparedStatement to invoke setter methods on * @throws SQLException if a SQLException is encountered (i.e. there is no * need to

Categories : Spring

What is the meaning of statement below that the declared type shall not be incomplete type
That means you are not allowed to have: static int arr[]; // This is illegal as per the quoted standard. int main(void) {} The array arris tentatively defined and has an incomplete type (lacks information about the size of the object) and also has internal linkage (static says arr has internal linkage). Whereas the following (at file scope), int i; // i is tentatively defined. Valid. int arr[]; // tentative definition & incomplete type. A further definition // of arr can appear elsewhere. If not, it's treated like // int arr[] = {0}; i.e. an array with 1 element. // Valid. are valid.

Categories : C

WPF: Cannot convert lambda expression to type 'string' because it is not a delegate type
Your NotifyPropertyChanged expects a string, and you're passing it a delegate. Try: public string SelectedTransactionName { set { if (_selectedTransactionWsName == value) return; this._selectedTransactionWsName = value; // InitializaMessageElement(value.WsMethodName, transactionTypes); InitializaMessageElement(); this.NotifyPropertyChanged("SelectedTransactionName"); this.NotifyPropertyChanged("IsTransactionNameSelected"); } get { return this._selectedTransactionWsName; } }

Categories : Wpf

Cannot convert object of type 'System.String' to type 'PropertySearch'
It looks like you are trying to deserialize with invalid json. A good place to check your json format is JsonLint.com. You will want your json object to look more like this: { "UserId": 1, "SessionId": 1, "PriceMin": 1, "PriceMax": 1, "BedsMin": 1 } The issue you are having is you are passing a comma delimited string. The deserializer does not know which values to map to which fields.

Categories : Dotnet

Do Entity Framework Provide Utility that convert DB Type To C# Type?
I dont know such a public method (I think there is none... it that may be accepted as answer) However, try to uncompile sqlmetal.exe, you can have a good idea of how default associations are implemented internally: In class LinqToSqlShared.Utility.DbTypeSystem (internal class) you can find the method: internal static Type GetClosestRuntimeType(SqlDbType sqlDbType) { switch (sqlDbType) { case SqlDbType.BigInt: return typeof(long); case SqlDbType.Binary: case SqlDbType.Image: case SqlDbType.Timestamp: case SqlDbType.VarBinary: return typeof(Binary); case SqlDbType.Bit: return typeof(bool); case SqlDbType.Char: case SqlDbType.NChar: case SqlDbType.NText: case SqlDbType.NVarChar: case SqlDbType.Text: case SqlDbType.

Categories : C#

typeof() when Cannot implicitly convert type 'System.Type' to 'string'
According to the documentation, the DataType property is used to specify an XSD data type, not a .NET type: An XML Schema data type, as defined by the World Wide Web Consortium (www.w3.org) document named "XML Schema Part 2: Datatypes". Try this instead: public class EPubBody { [XmlElement(ElementName = "Image")] public EPubImage[] BodyItems; }

Categories : C#

Different type returned by getter than type of field in Jackson. How to convert map to set?
There is no direct way to convert a Set to a Map. Set is an extension of Collection, Map is an entirely different object. If ContactInfoInterface contains the information you need to manually build a Map you could do that. But trying to pass back a Set in the form of a Map will never work.

Categories : Java

convert id to unknown Class type and get its frame
You can cast them as a UIView by doing: [(UIView *)obj2 frame] Which you already seem to be doing, I don't see what your issue is? Or if the 'id', is guaranteed to be a subclass of UIView, which by your example it seems it is, use UIView instead of id in the first place.

Categories : IOS

convert selected item back to custom data type, winforms
Try listview1.Columns.Add("Col1"); listview1.Columns.Add("Col2"); foreach(ArticleDetails ad in myCollection) { var row = new ListViewItem(ad.Article.Name); row.Tag = ad; // You can use this to store your object row.SubItems.Add(ad.Article.Price); } listview1.View = View.Details; private void btnDelete_Click(object sender, EventArgs e) { var selected = (CustomDataType)listview1.SelectedItems[0].Tag; }

Categories : C#

c++ std::map asignation error : cannot convert ' type **' to 'type *' in assignment
void findMessageId(R * aPointerType,const int & aPKValue, int & aResult) { if (aPKValue < 0) { aResult=-1; return; } //buscar valor dentro de la lista mMessageListIterador=mListMessage->find(aPKValue); if (mMessageListIterador!=mListMessage->end()) { aResult=0; aPointerType=&mMessageListIterador->second; } else aResult=-1; return; } In this method i changed this line: aPointerType=&mMessageListIterador->second; for this: aPointerType=mMessageListIterador->second;

Categories : C++

Convert "C# friendly type" name to actual type: "int" => typeof(int)
Alias names like 'int','bool' etc. are not part of .NET Framework. Internally they are converted into System.Int32, System.Boolean etc. Type.GetType("int") should return you null. Best way to appoach this is by having a dictionary to map alias with their type e.g. Dictionary<string, Type> PrimitiveTypes = new Dictionary<string, Type>(); PrimitiveTypes.Add("int", typeof(int)); PrimitiveTypes.Add("long", typeof(long)); etc.etc..

Categories : C#

Can we Convert Anonymous Type to List using Linq to entity in C#?
Just use the actual concrete type instead of an anonymous one: select new Material { ID = c2.ID, MaterialParentID = c2.MaterialParentID, Name = c2.Name, ParentName = c1.Name }

Categories : C#

Convert variables of type List into String in Android
Take a new class in different activity, declare all the variables u want to attach to list view and write get and set method for those variables. if you want to add to string value use settext() / to get gettext()

Categories : Android

Java - Understanding the Class type and what happen when invoking 'Type.class'
According to this question, Class objects per type are unique, given that you have only one ClassLoader. Different ClassLoaders can yield different Class objects for the same class definition. The Class objects are created when the class is loaded by a ClassLoader, usually when the class is first referenced. According to the Java Language Specification, Section 15.8.2, Type.class is a class literal, so nothing is being invoked; the class literal refers to the Class object. Quoting the JLS from the section linked above: A class literal is an expression consisting of the name of a class, interface, array, or primitive type, or the pseudo-type void, followed by a '.' and the token class. and A class literal evaluates to the Class object for the named type (or for void) as

Categories : Java

How to display the type of a custom class?
GenericClasses.MyGenList<char> is the way you see it in code, GenericClasses.MyGenList1[System.Char] however is the internal representation. You could overload the ToString() method on your class to display it the way you want.

Categories : C#

C++ unordered_map using a custom class type as the key
To be able to use std::unordered_map (or one of the other unordered associative containers) with a user-defined key-type, you need to define two things: A hash function; this must be a class that overrides operator() and calculates the hash value given an object of the key-type. One particularly straight-forward way of doing this is to specialize the std::hash template for your key-type. A comparison function for equality; this is required because the hash cannot rely on the fact that the hash function will always provide a unique hash value for every distinct key (i.e., it needs to be able to deal with collisions), so it needs a way to compare two given keys for an exact match. You can implement this either as a class that overrides operator(), or as a specialization of std::equal, or &

Categories : C++

Actionscript check custom object defined type (not actual type)
I think you're misunderstanding the way all of those examples in your question work. They don't check the type that is associated with a variable - they check the type of the instance assigned to that variable. Here is a good example of why your examples don't make sense: var prop:DisplayObject = new MovieClip(); trace(prop is MovieClip); // true If this worked the way you thought it does, you would actually get false here. All you're doing when you create a variable and give it a type is telling the compiler what type of instances it expects to see assigned to that property, and to throw an error if something that is not an instance of the expected type is assigned to it. I don't think there is a way to determine what type a variable expects. Moreover, I think if you see a need to

Categories : Actionscript

How to call a method of a child class of a father class type list? C++
You need to use pointers to the item for it to behave polymorphically. You are at the moment in danger of object slicing as an object could be placed in the list via a copy constructor. In addition for a method to behave as you describe (polymorphism) you are required to declare the method as virtual. (I assume the lack of return type is a typo?). Change to a std::list<ClassA*> (or better yet an appropriate smart pointer).

Categories : C++

cds library: michael_deque causes crash when pushing back derived type of custom type (only in release mode)
It was indeed a compiler bug. More specifically, it was a bug associated with Visual Studio 2012's atomic implementation. Some template specializations of the std::atomic class modify the stack frame pointer (ebp) without backing it up on and popping it form the stack before/after the modification. The libcds library uses one of these specializations, and the resulting incorrect frame pointer sometimes causes illegal memory access (the undefined behavior seems to prevent catastrophic failure in debug mode) when running outside the scope of a function. The fix in this special case was to make libcds use a different atomics library then the standard one provided by Visual Studio. The library decides which implementation to use in cxx11_atomic.h: #if defined(CDS_USE_BOOST_ATOMIC) # err

Categories : C++

convert method on type to function of type
Yes: bar(_.foo(_)) in your case. If Scala doesn't have enough information to infer types of arguments (e.g. if you had bar[T1, T2](somef: (T1, T2) => Unit)), you can use something like (_: T).foo(_: U) instead.

Categories : Scala

Convert String to Type, where Type is a variable
change Type propertyType = property.GetType(); to Type propertyType = property.PropertyType; Using GetType(), you get the type of property. And property is an instance of PropertyInfo.

Categories : C#

convert String to XML type (Element type)
Your error message gives you a big clue: lineNumber: 1; columnNumber: 911 This means that at position 911 in the input string the parser found <?XML... It appears that your input string contains more than one XML document

Categories : Java

How to convert nullable type to its underlying type?
But it supports nullable types, AllowDbNull is true by default: var table = new DataTable(); table.Columns.Add("NullableInt", typeof(int)); table.Rows.Add(1); table.Rows.Add(2); table.Rows.Add(3); table.Rows.Add((int?)null); Use the DataRow extension methods which support nullable types, for example: foreach(DataRow row in table.Rows) { int? value = row.Field<Int32?>("NullableInt"); // modify the value with SetField: row.SetField<Int32?>("NullableInt", null); // or: row.SetField("NullableInt", (int?)null); }

Categories : Dotnet

Cannot convert type table-type to 'string'
You query returns x.role_name, which seems to be a string: var y = from x in dbcon.N_Roles_Users where x.user_name == currentUser select x.role_name; That's why you can't assign it to List<Role>. Change your query to select Role entity instead of just role name and it should work. Or change your method declaration to return List<string>: public List<string> GetUserRoles( string currentUser) And change roleslist to be List<string> too: List<string> roleslist = new List<string>();

Categories : C#

How to convert type "int" to type "LPCSTR" in Win32 C++
Convert the int to a string by using the right sprintf variant TCHAR buf[100]; _stprintf(buf, _T("%d"), cxClient); MessageBox(hwnd, buf, "Testing", MB_OK); you need <tchar.h>. I think _stprintf is the quick answer here - but if you want to go pure C++ like David suggests, then #ifdef _UNICODE wostringstream oss; #else ostringstream oss; #endif oss<<cxClient; MessageBox(0, oss.str().c_str(), "Testing", MB_OK); You need #include <sstream> using namespace std;

Categories : C++

How would you convert Binary field of type 4 to type 0?
You can not force the type. I don't quite understand why you want to do this, but you can rewrite the document to force a new type: db.places.insert( { id: new BinData( 0x04, "SEVMTE8=" ) } ); db.places.find(); { "_id" : ObjectId("5204c4f252d346a74dd17755"), "id" : BinData(4,"SEVMTE8=") } So for your script, you can do this: db.places.find({}).forEach(function(data) { bindata = data.id.base64(); db.places.update( { _id: data._id }, { $set: { id : new BinData(0, bindata) } } ); });

Categories : Javascript

how to bind to Custom Type with List of objects in ASP.NET MVC?
I've just tried your code on my mvc3 application and it worked fine. I did a get request like this: Scene? EntityName=Package&Columns[0].Id="Ordering"&Columns[0].Hidden=false&Columns[0].Width="250px"&Columns[1].Id="SubItemId"&Columns[1].Hidden=true&Columns[1].Width="250px" Are you using the default model binder? You should always start from the zero index, cause otherwise the default model binder wont populate your array.

Categories : Asp Net Mvc

List custom post type with certain tag (wordpress)
display all list of post which in add webonly tag notice-tag = your tag taxeonomy name tems in define your tag slug name 'post_type'=>'notice', in define your post type <?php $args = array( 'tax_query' => array( array( 'taxonomy' => 'notice-tag', 'field' => 'slug', 'terms' => array( 'webonly' ) ) ), 'post_type'=>'notice', 'order'=>'ASC', 'posts_per_page'=>-1 ); query_posts($args); ?> <?php while (have_posts() ) : the_post(); ?> <?php echo the_title(); ?> <?php endwhile; ?>

Categories : Wordpress



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.