|
But in WebPage have using <marquee> tag to scroll page.
I want reload data in page at time, then position of all records in page not change <-- because page load then setting all position of records.
Example:
time A:
Position records.
Record 1
Record 2
Record 3
....
time B: <--- at time update data.
Record 2
Record 3
....
if using javaScript -- meta --> Position Record of B is.
time B:
Position records.
Record 1
Record 2
Record 3
....
|
|
|
|
|
From the docs the definition of Math.Round
The integer nearest a. If a is halfway between two integers, one of which is even and the other odd, then the even number is returned.
So 4.5 rounds to 4 and 3.5 rounds to 4. Why?
|
|
|
|
|
Because it uses the Banker's Rounding algorithm to do the rounding. It's overrideable so you can use your own round method(s).
|
|
|
|
|
|
I learned banker's rounding in High school, so it just seems natural to me. Check out this[^].
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hello:
I have here a problem where I am using web services.
From this example you can see that webservices is very tolerant of extra fields or missing fields. One issue though is that if you run one of the webservices and then update the other project's web reference it generates partial class code for your remote object in the namespace of the webservice. This is a problem.
For instance:
If you run the solution Version1 and then open the solution
Version2 and update the Web Reference in the project (you have to show hidden files) you get a file called Reference.cs.
In Reference.cs the system generates a wrapper for the class Foo
/// <remarks>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml","2.0.50727.1378")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class Foo {...}
The problem is that when it does this it will return this object as when you call HelloWorld.
static void Main(string[] args)
{
ConsoleApplication1.localhost.Service1 s1 = new Service1();
MyLibrary.Foo f1 = new MyLibrary.Foo();
f1.Prop1 = "New";
MyLibrary.Foo f2 = (MyLibrary.Foo)s1.HelloWorld( f1);
System.Console.WriteLine("F1.Prop1=" + f2.Prop1);
}
Which is not what you want. The intended object is MyLibrary.Foo not ConsoleApplication1.localhost.Foo. Please figure out how prevent VS from creating the wrapper or any other solution.
Below are the project codes:
"Version1" Solution:
Webservices:
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Xml;
using System.Xml.Serialization;
using MyLibrary.Lib;
namespace Version1
{
///
/// Summary description for Service1
///
[WebService(Namespace = "http://localhost/")]
[ToolboxItem(false)]
public class Service1 : System.Web.Services.WebService
{
[WebMethod(EnableSession = true)]
[XmlInclude(typeof(Foo))]
public MyLibrary.Lib.FooHelloWorld(MyLibrary.Lib.Foo foo1)
{
foo1 = "Updated";
return foo1;
}
}
}
"MyLibrary.cs"
using System;
using System.Data;
using System.Configuration;
using System.Xml;
using System.Xml.Serialization;
namespace MyLibrary
{
public class Foo
{
private string m_prop1 = null;
public string Prop1
{
get { return m_prop1; }
set { m_prop1 = value; }
}
private string m_prop2 = null;
public string Prop2
{
get { return m_prop2; }
set { m_prop2 = value; }
}
public Foo()
{
m_prop1 = "abc";
m_prop2 = "cde";
}
}
}
Console application: "Program.cs"
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using MyLibrary.Lib;
namespace ConsoleApplication1
{
static void Main(string[] args)
{
ConsoleApplication1.localhost.Service1 s1 = new Service1();
MyLibrary.Foo f1 = new MyLibrary.Foo();
f1.Prop1 = "New";
MyLibrary.Foo f2 = (MyLibrary.Foo)s1.HelloWorld( f1);
System.Console.WriteLine("F1.Prop1=" + f2.Prop1);
}
}
*** NOte *** localhost is the name of the web services when i add reference.
If you can provide solution in this Version1 solution it will work also on Version2 solution.
Hope anyone can save me from hell... Thanks
|
|
|
|
|
How to make a random number generate? And also, every time it is called, will it generate a new random number? (between 1 and 20, please). Thanks in advance.
|
|
|
|
|
|
It will do what you tell it to.
When I use a Random I prefer to make one static instance that I use throughout the program.
private static readonly System.Random randy = new System.Random() ;
To get a random number in the range 1 -- 20:
int x = randy.Next ( 20 ) + 1 ;
|
|
|
|
|
|
Every day, you post questions that show you have no resources on C#, and are scared to use google. We love to help, but you're never going to learn to code unless you learn how to do basic research, and invest in at least one good book.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Trust me, I do invest in books, but it's not the same as a person telling you directly and so on, not that the site is the same either... The books are things that can't explain it to you if you don't understand what it says, though they usually do help.
|
|
|
|
|
Then use that book, to whack yourself on the head if for nothing else.
If you want to learn from a live person take a class.
|
|
|
|
|
PIEBALDconsult wrote: If you want to learn from a live person take a class.
Yep. Like the people in my class I teach
"Find it your bloody self - immediately!" - Dave Kreskowiak
|
|
|
|
|
Well, I taught myself entirely from books, so my advice would be to grab a more basic book to start with. I sure did.
Contrary to what you may think, people here are not trying to take a shot at you, but it is frustrating to see so many people ask the most trivial questions, over and over, it really does make us wonder if anyone does any research at all. We want to help you, I'm giving you advice that I think is the best help I can offer.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Listen to what Christian has to say. He made it to MVP and started out by reading a couple of books. He's living proof that books do work.
|
|
|
|
|
The point they are trying to make is that if you goto Google and type "C# random", then you will quickly find what you need. In fact the first 5 (atleast) links explain how to generate a random number in C#.
The answers on those links may not be a quick and short C# snippet that you can directly cut and paste into your code. But I would expect any developer to research it, try some solutions, then if they can't get it to work then ask a question.
A large portion of doing software development is being able to do research, which includes searching the Internet and writing test code (that may never work and may get throw away).
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
I am not very proficient with VB6, but I am writing an ActiveX EXE for a legacy program to use.
I have code that receives data from the legacy software just fine (I can display it in a msgbox), but need an idea to push that data to a C# event to run some code based on the data.
I know how to hook into the ActiveX from C#, but am having trouble with the C# program recognizing that data is coming.
any help is appreciated and examples greatly appreciated.
-- modified at 19:48 Tuesday 2nd October, 2007
|
|
|
|
|
You can try with pass or return data the type of object not specific data type (int, string etc).
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
what is the difference between int? and int
seema
|
|
|
|
|
The question mark denotes it is a nullable value. For example,
int? i = null;
is the same as
Nullable<int> i = null;
The Nullable<T> type wraps a value type, like integers, but allows you to assign null to them. Without this, you couldn't assign null to an int or any other value type.
|
|
|
|
|
int? is shorthand for INullable<int>
A nullable type can be null as well as the normal values and has a HasValue property. Very useful, for example, if you have a numeric column in your database which can be null, or just in general to avoid having to have magic numbers to indicate that no value has been set.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi there, i want to know how to setup to nhibernate for use the SysCache2 in my AspNet 2.0 Application... this is what i have been doing, in the web.config:
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>
<hibernate-configuration>
<session-factory xmlns="urn:nhibernate-configuration-2.2">
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.connection_string">server=XXXX;database=XXXX;uid=XXXX;password=XXXX;Max Pool Size=100;Enlist=False</property>
<property name="cache.use_query_cache">true</property>
<property name="cache.use_second_level_cache">true</property>
<property name="cache.provider_class">NHibernate.Caches.SysCache2.SysCacheProvider,NHibernate.Caches.SysCache2</property>
<mapping assembly="Model" />
</session-factory>
</hibernate-configuration>
And in my class i do the following:
public static IList<Country> GetCountryList()
{
string sql = "from Model.Country c Order By c.Countryid";
IQuery query = Base.Session().CreateQuery(sql);
query.SetCacheable(true).SetCacheRegion("nhibernate.country.countrylist");
IDictionaryEnumerator e = HttpContext.Current.Cache.GetEnumerator();
while (e.MoveNext())
{
//The first time nothing happen here
//After that the System.Web.HttpContext.Current.Cache.Count is 2
//How can i get the cached collection??
object o = e.Current;
object k = e.Key;
object v = e.Value;
}
return query.List<Country>();
}
Any help would be appreciated.
Bye.
p.d:oops, its the c# forum, my code was in vb net, now is in the right language
-- modified at 18:32 Tuesday 2nd October, 2007
|
|
|
|
|
I'm having trouble deserilizing an xml node that has empty tags. See
XML:
<ContentCampaign>
<ad_id_source type="integer"></ad_id_source>
<billing_code type="integer"></billing_code>
<birth type="datetime">2007-08-24T16:15:16-07:00</birth>
<body>this campaign has alerady been sent</body>
<category_id type="integer">1</category_id>
<created_at type="datetime"></created_at>
<id type="integer">4</id>
<name>complete_campaign</name>
<notes></notes>
<subject>this campaign is read to send</subject>
<thumbnail></thumbnail>
<updated_at type="datetime"></updated_at>
<valid_after type="datetime"></valid_after>
</ContentCampaign>
This XML is generated from a rails web service and respresents a table
in the database.
When I try to deserilize this the deserlizer fails on the empty tags.
How can I make the deserializer simply ignore these tags as they have
no value anyways...?
/\ |_ E X E GG
|
|
|
|
|
Check out this[^] for elements and this[^] for attributes. Basically, you are going to read them in, but you can trash them later.
Or you could use this[^] to ignore those elements/attributes.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|