|
You'll get a much better response if you post this in the WPF/ WCF / WF forum instead.
|
|
|
|
|
|
Please verify that the .config file is copied together with the exe. The config has the same name as the exe, e.g. MyApp.exe.config. Check if this file has the client-element within.
If the file is missing, right-click on App.config in the Project Explorer ro open the properties and select "Copy always".
Regards
Sebastian
|
|
|
|
|
The .config file is copied together with the .dll and has the same name, Application.dll and Application.dll.config.
The config has the client element from my original posting.
Best regards
Soren
|
|
|
|
|
Well, that is not really how it is working. If you are using the dll within an application, you have to put the client-definition in the config-file for the application.
|
|
|
|
|
I didn't know that but tried it out.
It worked like a charm.
Thx for the input.
|
|
|
|
|
The solution was to put the system.serviceModel part of my .config into application.exe.config.
My original .config was application.dll.config.
This was done, because my .dll was to be called from a foreign program, and I didn't know that the configuration had to be done in that program.
Thx for the input.
|
|
|
|
|
how can i convert an int number to hex?
|
|
|
|
|
someInteger.ToString("X8")
|
|
|
|
|
Cool - I've never spotted "X8".
I've always used the Convert class
Convert.ToString(intValue, base)
|
|
|
|
|
unfortunately there is no similar code for octal or binary, things people around here seem to want often.
|
|
|
|
|
Yeah, that's probably why I've stuck with Convert - only one thing to remember!
There's been few times binary literals would have been useful too...
|
|
|
|
|
|
you're welcome.
|
|
|
|
|
hi,
I developed windows application. In that I used web service. with use of web service I am fetching data from database and stored it into the cache.
cache contains datatable which contained data that comes from the database through web service. Now I want to update the datatable which is stored into the cache. I dont want to update the original database values.
Thanks
sjs4u
|
|
|
|
|
sjs4u wrote: I dont want to update the original database values.
What is the problem?
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi,
I just want to update the datatable..I dont want to update the database.
and these data I want to store it into the cache so that it will be available to other form.
Thanks
sjs4u
|
|
|
|
|
Hi,
I used the delegate, Microsoft.Office.Interop.Excel.DocEvents_ChangeEventHandler, to track the changes in excel workbook.
Excel.DocEvents_ChangeEventHandler EventDel_CellsChange;
EventDel_CellsChange = new Excel.DocEvents_ChangeEventHandler(CellsChange);
xlSheet1.Change += EventDel_CellsChange;
It executes whenever the cell content gets changed.
But its not handling the automatic changes like function changes. Its handling only manual changes.
For example,
A1=10
A2=20
A3=SUM(A1,A2)=30
If A1 value changes to 15, then A3 changes to 35. I'm able to handle the change in A1(15), but couldn't able to retrieve the A3 cell changes. Please guide me to handle the automatic function changes.
Thanks in advance..
|
|
|
|
|
Hi everybody,
I have an tool that reads an file. That file has for example the follow content:
²{öï#°ÿùpO¬[ÿùpO¬ÿùpO¬¿ÿùpO¬ñÿùpO#ÿùpONÿ
I would like to search for repeated character combinations like the bold characters. The character combination ùpO repeated 6 times.
I would like to return some top 5 with the most repeated character combinations. Something like this:
ùpO : 6 times
xyz : 5 times
ab4 : 3 times
ab : 2 times
66 : 2 times
This is the code that reads the file:
string path = @openFileDialog1.FileName;
try
{
using (FileStream fs = File.OpenRead(path))
{
byte[] b = new byte[1024];
UTF7Encoding temp = new UTF7Encoding(true);
while (fs.Read(b, 0, b.Length) > 0)
{
textBox1.Text += temp.GetString(b);
}
}
}
Thanks!
|
|
|
|
|
if you want to clculate how many each char repeat you can use this:
string[] s;
s=File.ReadAllLine(@"file name.txt");
int[] c=new int[255];
for(int y=0y
|
|
|
|
|
I dont whant to count each character. I would like to discover some repeated character combinations.
|
|
|
|
|
string s="xlstxtjpgxls";
string[] f = {"xls","txt","jpg" };
int[] x=new int[f.Length];
for (int y = 0; y < f.Length; y++)
{
for (int i = 0; i < s.Length; i++)
{
for (int j = 0; j < f[y].Length; j++)
{
if (f[y][j] != s[i + j])
{
break;
}
if (j == f[y].Length - 1)
{
x[y]++;
}
}
}
}
for (int g = 0; g < f.Length; g++)
{
Console.WriteLine(f[g]+":"+x[g]);
}
Console.ReadLine();
modified on Friday, September 11, 2009 4:57 PM
|
|
|
|
|
I have found this example but it is not 100 % good. Could you please have a look?
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
<br />
namespace ConsoleApplication1<br />
{<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
string _givenString = "wvtnfhxyz1hdxyz1fdxyz1ejxyz1dhxyz1dxyz1eeaa1oeys";<br />
Dictionary<string, int> _codes = new Dictionary<string, int>();<br />
int _startingPoint = 0;<br />
while (_startingPoint < _givenString.Length)<br />
{<br />
for (int j = 2; j < _givenString.Length; j++)<br />
{<br />
for (int i = _startingPoint; i < _givenString.Length && i + j < _givenString.Length; i++)<br />
{<br />
if (!_codes.ContainsKey(_givenString.Substring(i, j)))<br />
{<br />
_codes.Add(_givenString.Substring(i, j), 1);<br />
}<br />
else<br />
{<br />
_codes[_givenString.Substring(i, j)] += 1;<br />
}<br />
}<br />
}<br />
<br />
_startingPoint++;<br />
}<br />
<br />
List<KeyValuePair<string, int>> _sortedCodes = SortDictionary(_codes);<br />
for (int i = 0; i < 5; i++)<br />
{<br />
Console.WriteLine(_sortedCodes[i].Key + " : " + _sortedCodes[i].Value + " times");<br />
}<br />
Console.ReadKey();<br />
}<br />
<br />
public static List<KeyValuePair<string, int>> SortDictionary(Dictionary<string, int> data)<br />
{<br />
List<KeyValuePair<string, int>> result =<br />
new List<KeyValuePair<string, int>>(data);<br />
result.Sort(<br />
delegate(<br />
KeyValuePair<string, int> first,<br />
KeyValuePair<string, int> second)<br />
{<br />
return second.Value.CompareTo(first.Value);<br />
}<br />
);<br />
return result;<br />
}<br />
}<br />
}
modified on Thursday, September 17, 2009 8:13 AM
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CountString
{
class Program
{
static void Main(string[] args)
{
string _givenString = "wvtnfhxyz1hdxyz1fdxyz1ejxyz1dhxyz1dxyzeeaa1oeys";
Dictionary<string, int> _codes = new Dictionary<string, int>();
int _startingPoint = 0;
//while (_startingPoint < _givenString.Length)
//{
for (int j = 2; j < _givenString.Length; j++)
{
for (int i = _startingPoint; i < _givenString.Length && i + j < _givenString.Length+1; i++)
{
if (!_codes.ContainsKey(_givenString.Substring(i, j)))
{
_codes.Add(_givenString.Substring(i, j), 1);
}
else
{
_codes[_givenString.Substring(i, j)] += 1;
}
}
}
// _startingPoint++;
//}
List<KeyValuePair<string, int>> _sortedCodes = SortDictionary(_codes);
for (int i = 0; i < 5; i++)
{
Console.WriteLine(_sortedCodes[i].Key + " : " + _sortedCodes[i].Value + " times");
}
Console.ReadKey();
}
public static List<KeyValuePair<string, int>> SortDictionary(Dictionary<string, int> data)
{
List<KeyValuePair<string, int>> result =
new List<KeyValuePair<string, int>>(data);
result.Sort(
delegate(
KeyValuePair<string, int> first,
KeyValuePair<string, int> second)
{
return second.Value.CompareTo(first.Value);
}
);
return result;
}
}
}
does it work as you want??
|
|
|
|
|
Well, I'm sure there's a better algorithm for this, but here's one off the top of my head:
Note that this is NOT an efficient algorithm, and will NOT earn you any prizes if this is a school assignment (And if that's the case, keep in mind your teacher may be reading this).
1. Keep a string:int dictionary of substring:count
2. Loop through each character:
a. Looping from 2 to your maximum substring size (Say, 5)
i. Grab the substring of that length from the current position
ii. Add/increment it in the dictionary
3. Look through the dictionary keys:
a. See if the key is a substring of any other keys, with an equal count... If so, just delete this key.
Grab 'em, sort 'em, and display 'em...
If you want a better algorithm, you could try posting this in the Algorithms forum... I would guess there are at least a dozen formalized and documented algorithms to handle this, with all sorts of fancy names, that the folks there could point you to.
|
|
|
|