|
thanx there man, the solution was to add and IsolationMode(Serializable)........
THANX once again, but u kinda ranked me too low with ur "if u thinking hiring a prof programmer wait till u hire an amatuer...".... i'm way better than an amatuer that this quiz may have reflected of me.... but i'll never stop learning
|
|
|
|
|
Hbr_Tha_real wrote: THANX once again, but u kinda ranked me too low with ur "if u thinking hiring a
prof programmer wait till u hire an amatuer...".... i'm way better than an
amatuer that this quiz may have reflected of me.... but i'll never stop learning
Er, that's just part of my sig. It was said by Red Adair[^] and is spot on but wasn't directed at you!
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
It's okay man and thanx for understanding and not lashing out at me
|
|
|
|
|
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Hello,
Existing set up is in classic ASP the HTTP request is made as
CreateObject( "WinHttp.WinHttpRequest.5.1" )
Now, I am using C#. would you say this is a good translation of above?
WebClient wc = new WebClient();
NetworkCredential myCred = new NetworkCredential("myuser", "mypwd");
wc.Credentials = myCred;
wc.DownloadFile("http://my.location.com", @"C:\mylocation.csv");
|
|
|
|
|
A bit more on this:
CreateObject( "WinHttp.WinHttpRequest.5.1" )
Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
sURL="http://my.location.com"
sUsername="myuser"
sPassword="mypassword"
objHTTP.Open "GET", sURL, False
objHTTP.SetCredentials sUsername, sPassword ,HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
objHTTP.Send
|
|
|
|
|
I saw the previous post on this same type of question however it wasn't much help
Here is what I need to do
Start at
A0001... A9999 to B0000...Z9999 to AA000...ZZZZZ
I found this code but it didn't explain what to put in the the variables your passing to it.
string base36Characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string toBase36(int x, int digits)
{
char[] result = new char[digits];
for (int i = digits - 1; i >= 0; --i)
{
result[i] = base36Characters[x % 36];
x /= 36;
}
return new string(result);
}
IEnumerable<string> base36Counter()
{
for (int n = 0; n < 36 * 36 * 36 * 36; ++n)
{
yield return toBase36(n, 4);
}
}
void Run()
{
foreach (string s in base36Counter())
Console.WriteLine(s);
}
|
|
|
|
|
Just split the counter as shown below
string base36Characters = "0123456789";
string base36Alaphs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string toBase36(int x, int digits)
{
char[] result = new char[digits];
for (int i = digits - 1; i >= 0; --i)
{
result[i] = base36Characters[x % 10];
x /= 10;
}
return new string(result);
}
IEnumerable<string> base36Counter()
{
for (int i = 0; i < base36Alaphs.Length; i++)
{
for (int n = 0; n <; 10 * 10 * 10 * 10; ++n)
{
yield return base36Alaphs[i] + toBase36(n, 4);
}
}
}
void Run()
{
foreach (string s in base36Counter())
Console.WriteLine(s);
}
|
|
|
|
|
This works only for the single alpha character case (A0000...Z9999), it doesn't handle the next numbers in the sequence OP described.
|
|
|
|
|
Oh... Yes... I didnt notice his second set of sequence..
hmmmm.. need to workout!! Thanks for the hint. will update my answer soon.
|
|
|
|
|
This code you're showing does base 36 which is not what you're showing as what you need.
I.e., the code will produce:
0001, 0002, ... 0009, 000A, 000B, ..., 000Z, 0010, 0011, 0012, ..., 0ZZZ, A000, A001, ... ZZZZ I'm not exactly sure how to get the sequence you are describing...
|
|
|
|
|
Do you just need code to generate the strings in that sequence or do you need conversion to/from int?
The implementations likely will be quite different depending on the answer.
(Code based on the code you've posted assumes all you need is the strings in sequence. And never needing to start mid-sequence!)
|
|
|
|
|
I'm not sure I completely understand...
I think it will always be in sequence... It will never jump around..
Im trying to edit some current code in a stored procedure to see if I can make it work.. But no luck yet
|
|
|
|
|
"...in a stored procedure..."
Do you need the answer as C# or as SQL?
|
|
|
|
|
I can do either really... Right before I left work yesterday I think I got something to resemeble working in the stored procedure.
|
|
|
|
|
This looks like a standard Excel column number followed by a four-digit decimal part. Assuming you need the code in C#, something like this should work:
static string ConvertNumber(int number)
{
if (number < 0) throw new ArgumentOutOfRangeException();
int decimalPart;
int columnNumber = Math.DivRem(number, 10000, out decimalPart) + 1;
int length = 5 + (int)Math.Floor(Math.Log(columnNumber, 26));
int resultIndex = length - 1;
char[] result = new char[length];
for (int i = 0; i < 4; i++)
{
int remainder;
decimalPart = Math.DivRem(decimalPart, 10, out remainder);
result[resultIndex] = (char)('0' + remainder);
resultIndex--;
}
while (columnNumber != 0)
{
int remainder = (columnNumber - 1) % 26;
columnNumber = (columnNumber - remainder - 1) / 26;
result[resultIndex] = (char)('A' + remainder);
resultIndex--;
}
resultIndex++;
return new string(result, resultIndex, length - resultIndex);
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
It could be that is what Angela (OP) wants, however what is shown is that after Z9999 is AA000. I.e., as the length of the alpha part of the string gets longer, the numeric part gets shorter. The total string length remains 5.
|
|
|
|
|
Hi guys. StreamWriter.WriteAsync exists in 4.5 but not 4.0. I'm getting a sporadic error- out of memory exception, when I use StreamWriter.Write(String Builder). I'm not sure if I can move up to 4.5 yet, what's a good work around for 4.0?
|
|
|
|
|
How big is that freaking StringBuilder?? If you don't specify a size, it starts with 16 characters and allocates a new array internally every time you exceed it's capacity. So, it starts with 16, then goes to 32, 64, 128, 512, 1024, ... when you get into VERY large objects, you can be allocating megabytes of memory and possibly hit a size where the CLR doesn't have a big enough contiguous block of memory to fit the new size.
This also applies when you finally call .ToString on the StringBuilder. A new String object has to be allocated and the data in the StringBuilder copied to it. Again, if sufficiently big, the new String may not fit in memory because of a fragmented large object heap.
The CLR will allocate any object requiring more than 85K (IIRC) out of the LOB. The LOB isn't compacted and defragmented like the Smaller Object Heap is. So if you're allocating and freeing a bunch of large objects, you could be fragmenting the LOB to the point where you can't allocate a new object of the size you need, even though there's enough TOTAL free memory.
But, the way around this little problem using StringBuilder is to allocate the StringBuilder with a size sufficient to hold the entire POSSIBLE string without having it constantly reallocate itself.
Oh! And as for the StreamWriter.WriteAsync, there is no equivilent in any other version of .NET. You'd have to implement an Async version yourself. But, I don't think that has anything to do with your problem right now.
|
|
|
|
|
Ah, it's all coming back. I've fought this fight before. Here is an example of my stringbuilder data:
Capacity 81341696 int
Length 81334894 int
MaxCapacity 2147483647 int
You are right in your second point. It is happening on the ToString()
at System.Text.StringBuilder.ToString()
at System.IO.TextWriter.Write(Object value)
I should've provided this earlier.
|
|
|
|
|
I don't think allocating to the size initially is a good idea, I don't know what the max size is going to be in the long run. I think I'm just going to use a list of strings, or stringbuilders.
|
|
|
|
|
I want to ask something about radio buttons in a web page. I'm using c#.net.
Let's assume that I have a table with 5 rows and 3 columns. I put a radiobutton in each cell of this table. So we have 15 radio buttons.
The user should select exactly one choice in each column, and at most one choice in each row.
I tried radiobuttonlist in each row. But in this case the user can select more than one choice in a column. Or the user can not give up a selection in a row.
I think that I need to write a client-side script. But I could not figure out this problem in a practical way. I wish I had a control that solves this problem.
|
|
|
|
|
This question really belongs in the ASP.NET forum.
|
|
|
|
|
The radiobutton list in each row seems like a good approach because it handles one of your constraints: at most one choice in each row.
To handle the other constraint (exactly one choice in each column) you need to make a handler that's called whenever the selection state of a radio button changes, then check this constraint in the handler. If it's violated (i.e. more than one choice in a column) you can give the user an error message or change their previous selection in that column.
When they're done (e.g. they press the OK button), then you can check to see if every column has a selection.
|
|
|
|
|
hey guys !
can you guide me ,how can i write code in good ways!?
well lemme explain whats my problem !
i thought writing codes is most simple part of developing ,but after some project which i did ,i found that need to change my coding style !
as you know for one porpuse is many way to achieve ! but i found always choose worst way !
well is any book or reference to teach me how i choose best way? at least better way!
very thanks
|
|
|
|