|
So basically what you are saying is you want a database on the client machine, but not install a full database environment, well sql compact is your friend
http://www.microsoft.com/sql/editions/compact/default.mspx[^]
one thing you cant do is have stored procs tho, but on the plus side its free
|
|
|
|
|
Hello,
most SMTP servers limit sending messages to 600 per hour, my application enables user to send
mail message to more than the limited number so I want to know how to get the count of messages sent in the current hour to inform user that there may be some messages will be send after an amount of time.
Dad
|
|
|
|
|
The SMTP protocol does not support a commmand to retrive the number of messages you can send per timeperiod. So I think you must set the limit and track it in your own application.
Espen
|
|
|
|
|
Is the query below performance-wise? If not, please tell how to optimize it.
return elements.SkipWhile(el => !startCondition)
.TakeWhile(el => !stop2condition)
.Reverse().TakeWhile(el => !stop1condition).Reverse();
The goal is to get a range marked as a ===== line:
---->start========stop1==========stop1------stop2----------
I have to find [start -> stop2] enumerator, and then cut the end. I cannot find stop1 directly, because between start and stop1 there are other elements which satisfy a stop1 condition. Other words, I need to get the last element which statisfies a condition stop1 before stop2. Hope it's clear what I meant here.
Any help appreciated.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
You van combine the boolean test. !stop1condition && !stop2condition
|
|
|
|
|
leppie wrote: You van combine the boolean test. !stop1condition && !stop2condition
!(stop1condition || stop2condition)
You have misunderstood me. I do not want to search for the first occurance of stop1 or stop2. I want to find a stop1 which is nearest to stop2 in a backward search. As I sad: the last stop1 before stop2.
Consider the following example:
-------start========stop1a=====stop1b-----stop2---
Your query would find start -> stop1a and I want get start -> stop1b .
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
My win forms application (c#) runs fine when its on a local path.
But, its not working when its located on a network / UNC path.
To make it work from a network path, I need help on the following :
1. Best way to determine if the current path is network path or not.
2. From the network path, I want to get the current user's TEMP directory path.
Neither Environment.GetEnvironmentVariable(Temp) nor Path.GetTempPath() worked from network path.
3. From the code/pgm running on network path, I want to run a batch file present in the user's TEMP directory.
Any guidance on this is appreciated.
|
|
|
|
|
Your problems is due to the .NET Frameworks default Runtime Security Policy. So if you need to run an .NET application from a network drive or UNC path, the best way is to configure the runtime policy in the .NET Framework Configuration utility (found under Control panel/Administrative tools).
Espen
|
|
|
|
|
It failed because of CAS in .net, you need to configure the permission of intranet as follows.
@%windir%\Microsoft.NET\Framework\v2.0.50727\caspol.exe -q -m -ag 1.2 -url file://FILEPATH FullTrust -n GROUPNAME
1.Best way to determine if the current path is network path or not:
You can use the regular expression.
2.From the network path, I want to get the current user's TEMP directory path.
What do you mean? the directory path of local machine or remote machine?
|
|
|
|
|
Thanks for the reply.
1. can the regular expression work even if network share is a mapped drive ?
2. I want to get the directory path of local machine.
Let the network drive be \\share1 & my code be \\share1\pgm1.exe.
When the user runs "\\share1\pgm1.exe", I want to retrieve his local machine's temp path which is similar to "C:\Documents and Settings\alias\LocalSettings\Temp". The local machine is a Win 2003 server. Once I get the local temp path, I wish to copy the files to this location from the remote share drive.
|
|
|
|
|
Dear All,
I've got a problem!!
If I want to rotate a PictureBox control/ or any winform control in any angle (lets say, after a certain time using a timer), what I am needed to do? I want to follow a process as simple as possible
thanks in advance
Faysal
|
|
|
|
|
Hi Faysal,
For rotating the PictureBox at 90 degrees, please use following code:
Me.PictureBox1.Image.RotateFlip(RotateFlipType.Rotate90FlipX)
To rotate images at any angle, refer to the below mentioned links:
http://www.codeproject.com/KB/cpp/rimage.aspx
http://www.codeguru.com/cpp/g-m/gdi/article.php/c3693/
http://www.codeguru.com/cpp/g-m/bitmap/specialeffects/article.php/c1743/
http://www.fastgraph.com/help/example_rotate.html
This[^]
Hope this helps.
Vinay
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Vinay Srivastava wrote: Me.PictureBox1.Image.RotateFlip(RotateFlipType.Rotate90FlipX)
You are aware that this is the C# fourm?
"Listen, and listen well. I really like the band N-Sync. My favorite member is Harpo. I think there's a Harpo. If not there should be. I will write their next hit, maybe 'A boom-boom chiky chiky boom-boom a boom-boom chiky chaka chaka cho cho.' By the way, you must beware of Betty's iron claw. They are sharp, and they hurt. And beware his song about big butts, he beats people up while he plays it! " - Master Tang (from Kung Pow: Enter the Fist)
|
|
|
|
|
ive been working on a program that will tell you if a link is a Rick roll, and i am trying to load links in from an xml file to a listbox, but it skips the first lnik, i dont know why, here is the read xml code, and below it the xml file
public void ReadXmlLinks()
{
XmlReaderSettings xs = new XmlReaderSettings();
xs.IgnoreWhitespace = true;
XmlReader xin = XmlReader.Create(path, xs);
xin.ReadToDescendant("link");
while (xin.ReadToNextSibling("link"))
{
links_lb.Items.Add(xin["string"]);
xin.ReadStartElement("link");
}
xin.Close();
}
and here's the xml file im trying to read
<links>
<link string="http://www.youtube.com/watch?v=oHg5SJYRHA0">
</link>
<link string="http://www.youtube.com/watch?v=eBGIQ7ZuuiU">
</link>
<link string="http://www.youtube.com/watch?v=Yu_moia-oVI">
</link>
<link string="http://www.smouch.net/lol">
</link>
</links>
|
|
|
|
|
Try this method
public void ReadXmlLinks()
{
XmlReaderSettings xs = new XmlReaderSettings();
xs.IgnoreWhitespace = true;
XmlReader xin = XmlReader.Create(path, xs);
xin.MoveToContent();
while (xin.ReadToFollowing("link"))
{
links_lb.Items.Add(xin["string"]);
xin.ReadStartElement("link");
}
xin.Close();
}
|
|
|
|
|
Hi, to all
I am doing a task in which "main" thread spawns two new threads , 1 thread is worker thread whose task is to do all the processing and in another thread i am displaying window that displays progress with one "cancel button", So when a user clicks on the cancel button it asks for whether you want to terminate application thru a confirmation dialog box,up to this i have done but what i want when user clicks the cancel button the worker thread
should go in wait condition and if user doesn't want to close then it should continue from where it stopped .
any Idea, suggest me
|
|
|
|
|
One option would be to use Thread.Suspend(), but since it's deprecated it would better if you choose from Mutex, Monitor or Semaphore which are available in the System.Threading namespace.
|
|
|
|
|
I have been studying C# for about 4 or 5 months and then thought "Well I'll just write something from scratch. Well I felt like I've been reading a book on "How To Swim" and then when I jumped in the water I just gasped for air! Well anyway I hoping that someone could look at this and tell me how to use the return for the "public bool TrueOrFalse().
Thanks and sorry this is so elementary. I think I would like to write a book some day named a Beginner Beginner for the Basics of C#. Well any way here it is.
using System;
using System.Collections.Generic;
using System.Text;
namespace StartingOver
{
class RunIt
{
public bool TrueOrFalse()
{
int four = 4;
int five = 5;
bool answer;
Console.WriteLine("4 * 5 should equal: {0}", four * five);
four*five
return answer;
}
public void Getyear()
{
Console.WriteLine("What year will you be beginning?");
string year = Console.ReadLine();
Console.Clear();
Console.WriteLine("Starting all over again in {0}\n", year);
}
static void Main(string[] args)
{
RunIt ri = new RunIt();
ri.Getyear();
ri.TrueOrFalse();
}
}
}
|
|
|
|
|
Hi,
Since the function is returning some value, you would need to extract the value to use it. ri.TrueOrFalse() has a value of Type Boolean. Therefore you would need a variable of Type Boolean to save the value ri.TrueOrFalse() is returning.
If you would like to see if ri.TrueOrFalse() is returning True or False, you may simply check it using If Else conditions.
Hope this helps.
Vinay
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Right you are almost there!! lets just look at the function you are talking about
public bool TrueOrFalse()
{
int four = 4;
int five = 5;
bool answer;
Console.WriteLine("4 * 5 should equal: {0}", four * five);
four*five
return answer;
}
It will always return false as it stands, because you are declaring answer but not setting it, then returning it. By default it will be set to false.
All you need to do is set it, so something like this (this is done freehand so may not compile)
public bool TrueOrFalse()
{
int four = 4;
int five = 5;
bool answer = false;
Console.WriteLine("4 * 5 should equal: {0}", four * five);
if((four*five) == 20)
{
answer=true;
}
return answer;
}
Hope that helps and its what you wanted
|
|
|
|
|
Hello everyone
Ok I have a problem, I am working on a C# project that connects to my MySQL Database via odbc and I have it set up so I enter information password and username to connect to the database on the MainForm (the MainForm is set up for parent / MDI) once a connection has been established I will than select the table I want from the populated combobox, for example I would select contacts, once contacts has been selected it will open a new windows form within the parent form (MainForm).
Once that new MDIChild form is open I want to be able to access the open database connection from my main form, so I can enter information and save it to the database. I have pretty much everything done other than that.
sorry it if this does not make much sense i have been up sense 3AM going through MEPS for the Navy.
Thank you for your time.
|
|
|
|
|
usually I will use global application class that act as session in my application, the global class contains application global variables stored as list (usually i use sorted list). thus this variable can be accessed by other object in application
sample of global class like this
public static class GlobalApplication
{
private static SortedList<string,> globalVars = new SortedList<string,>();
public static void AddGlobalVar(string variableName, object variableValue)
{
if (!globalVars.Keys.Contains(variableName.ToLower())
{
globalVars.Add(variableName.ToLower(), variableValue);
}
public static object GetGlobalVar(string variableName)
{
if (!globalVars.Keys.Contains(variableName.ToLower())
{
return null;
}
return globalVars[variableName.ToLower()];
}
}
}
by use that class u have to add your database connection or other object to store to global variable and access it within your application. i.e
GlobalApplication.AddGlobalVar("database connection", your.database.object)
YourDatabaseObject db = (GlobalApplication.GetGlobalVar("database connection") == null) ? null : (YourDatabaseObject)GlobalApplication.GetGlobalVar("database connection");
hope it helps
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
Hi,
Part1)
I have a base class that implements the methods "DoSomething()" and make it virtual
a) Is there anyway I can force the derivated class to override it too
b) I can't make it abstract, because I need something to be done in the base and in the derivated class
c) I also would like to force the programmer to call base.DoSomething() inside it's own method to be sure the base method to be executed too.
Part2)
If I have a log method, that I'd like to be called from inside every method, is there anyway to get all parameters and values from the function where it's been called without having to specify one by one?
Thanks,
Dirso
|
|
|
|
|
Hi,
1)
This is what I would try:
create a non-virtual public or protected method "PseudoVirtual()" that calls two other
methods say "fixd()" and "virtuaal()";
stuff whatever needs to be done anyway in private fixd();
and provide a protected virtual "virtuaal()" which, when overriden, effectively provides
overrides for "PseudoVirtual" while enforcing a call to "fixd()".
2)
I don't think that is possible (unless you write some code that modifies your IL code).
If it can be done, I'm interested!
|
|
|
|
|
Part1)
a) Nope
b) Even with abstract or an interface you can't specify what the method must do
c) No can do
Part2)
Not so much, no
|
|
|
|