|
This account is for testing .
|
|
|
|
|
SO FREAKIN' WHAT?? Now ANYONE can impersonate you with malicious intent. Who cares if it's a "test" account.
|
|
|
|
|
Well now we have your username and password, and your email address we can cause any sort of trouble for you.
|
|
|
|
|
I voted to remove the post for the author's own good for that reason.
|
|
|
|
|
You're bypassing a captcha; meaning the site's owner has put in measures to prevent automated bots abusing his/her site. Whatever you're going to do, I doubt it complies with the TOS.
|
|
|
|
|
Just actually went to the URL?? I wasn't going to risk it because of recently exposed exploits.
|
|
|
|
|
hi all
I want to pass generic collection, List<string> with wcf
how to do that ?
i tried [datamember] but it's don't work
|
|
|
|
|
Sure it works. I do it all the time. Post your code.
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
namespace BE
{
[DataContract]
public class BusinessAccount : Account
{
private string companyNumber;
private string companyName;
private List<string> authorizedSignatory = new List<string>();
public BusinessAccount() { }
public BusinessAccount(long number, int branchNumber, DateTime openingAccountDate, string password, int credit, int balance,
AccountStatus status, AccountType account_Type, string companyNumber, string companyName, List<string> authorizedSignatory)
: base(number,branchNumber,openingAccountDate,password,credit,balance,status,account_Type)
{
this.companyNumber = companyNumber;
this.companyName = companyName;
this.AuthorizedSignatory = authorizedSignatory;
}
[DataMember]
public string CompanyNumber
{
get { return companyNumber; }
set { companyNumber = value; }
}
[DataMember]
public string CompanyName
{
get { return companyName; }
set { companyName = value; }
}
[DataMember]
public List<string> AuthorizedSignatory
{
get { return authorizedSignatory; }
set
{
foreach (var item in value)
authorizedSignatory.Add(item);
}
}
}
}
|
|
|
|
|
hi guys , im using the zeromq dll , and most of you knows , that this dll is handling the socket programming job .
okay , after that im define a dealer , i used the dealer.recived event is like
dealer.OnReceived += delegate(byte[] bytes, bool multipart)
{
string recive = Encoding.UTF8.GetString(bytes);
message = recive.Split('|');
publisher.Send(bytes);
if (Application.OpenForms["form2"] != null)
Application.OpenForms["form2"].Close();
};
Cross-thread operation not valid: Control 'Form2' accessed from a thread other than the thread it was created on.
this error belong to the application.openform.
i know one thing , when im using the threading opreation , i should define a new delegate to just invoke the object and get access of it , but here i dont really know what should i do to just close the form2.
so , any idea , i'll appriciate that .
|
|
|
|
|
It applies the same here. OnReceived is gets called from a different thread and hence any operation on UI objects should route through InvokeRequired mechanism.
Jibesh V P
|
|
|
|
|
|
i've solved the problem , but ty
|
|
|
|
|
i m developing the desktop application in c# dotnet for p2p file transffering..I am using wcf for this ..I have seen many articles over this ,they run smoothly on local computer as usually,but my application is p2p over internet and should not limited to LAN.I have found a article "http://www.codeproject.com/Articles/37057/File-Transfer-using-WCF-and-Socket" .Its run smoothly sometime but not always..can anybody help me regarding this.I Have done this with webservies hosted on server where my data reaches first on server and then transfer to destination but this is not wat i need.I want to transfer p2p directly where data should not reaches on intermediate server..please help me regarding this..Thanks in advance
|
|
|
|
|
I have problem making tab alignment in a text file.
For example I have this simple code:
long l1 = 500;
long l2 = long.MaxValue;
long l3 = 568678;
Console.WriteLine("Value1\tValue2");
Console.WriteLine("--------------");
Console.WriteLine("{0}\t{1}", l1, l3);
Console.WriteLine("{0}\t{1}", l2, l3);
This gives this output:
Value1 Value2
--------------
500 568678
9223372036854775807 568678
With this code I get the result I want:
long l1 = 500;
long l2 = long.MaxValue;
long l3 = 568678;
Console.WriteLine("Value1\t\t\tValue2");
Console.WriteLine("------------------------------");
Console.WriteLine("{0}\t\t\t{1}", l1, l3);
Console.WriteLine("{0}\t{1}", l2, l3);
Output becomes:
Value1 Value2
------------------------------
500 568678
9223372036854775807 568678
In the second result I have hard-coded the tab escape sequence different for each row to make it looking good.
Is there any way to fix this automatically?
|
|
|
|
|
String.Format [^] has an alignment field.
You can set this alignment number to the length of long.Maxvalue in terms of characters and then you can use this directly (even without using \t ). E.g. Console.WriteLine("{0,10},11,13);
Here[^] is an example.
String.PadLeft [^] could provide you with alternate solutions that you could consider and use.
|
|
|
|
|
Thanks very much!
|
|
|
|
|
I have 1 Usercontrol. In it I load an image from code. But when I go to Form1 and put this control into form, I get an error that he can not find the image, but the image is there, and the root is correct from code. When I run the application, is working fine, loading the correct image. What setting I miss?
Thanks and here is the code:
public partial class Equipment : UserControl
{
public Equipment(){InitializeComponent();}
string path = Application.StartupPath;
PictureBox pictureBox3429= new PictureBox();
public void Equipment_Load(object sender, EventArgs e)
{
panel1.BackgroundImage = Image.FromFile(path + "\\unit.jpg");
try
{
}
catch (Exception) { throw; }
}
}
modified 18-Jan-13 10:34am.
|
|
|
|
|
Instead of rethrowing the exception (which is a bit redundant - why catch it if you only throw it again), put up a messagebox or write the output (Debug.WriteLine); sounds like the designer is running it in a different path, and that's what you want to check.
Also, if it throws an exception, paste it here; it holds hints on whats wrong and how to solve it.
|
|
|
|
|
It's because the StartupPath is not what you think it is. Testing this on my system causes the designer view of the form to show an error message in HTML, helpfully rendered as one very long line. Carefully scrolling through it reveals that it looking for the image
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\pic.jpg
In a simplified test I place the image directly onto an otherwise empty user control. I thought that the correct thing to do would be to stop the designer attempting to load the image like this:
public partial class ImageControl : UserControl {
String path;
public ImageControl() {
InitializeComponent();
path = Application.StartupPath;
}
private void ImageControl_Load(object sender, EventArgs e) {
if (!DesignMode) {
BackgroundImage = Bitmap.FromFile(Path.Combine(path, "pic.jpg"));
}
}
}
Job done you might think, but no, as this allows the form to render properly with the image displayed. So what is going on? Actually I don't know, but the only reasonable explanation is that the designer loads the form more than once, in DesignMode where the path is incorrect and at least once more, not in DesignMode, where the path is correct.
|
|
|
|
|
Hi,
I made a small program which sorts a Vector of 100000 ints.
I use a quicksort , not the recursive one.
With the single thread version I takes about 22s to complete.
-now the problem and the question:
I have written a second version which
1. first make a partitioning
2. start an independent thread on eatch subpartition = 2Threads
So the sorting continues on 2 separate threads with no locks or anythig to block;
I got almost the same time when running.
Why happens to run in same interval of time.
Will Windows7 be very smart to optimize the code to run on multiple cores even if it is a single thread?
I have a x6 Cpu.
here is the sample code (test code)
class VectorSafeConcurency
{
int[] V;
const int sizeV = 100000;
void push2(Stack<int> s, int a, int b)
{
s.Push(b);
s.Push(a);
}
public VectorSafeConcurency()
{
V= new int[sizeV];
int value= sizeV;
for (int i = 0; i < sizeV; ++i)
V[i] = value--;
}
void exchange(ref int x, ref int y)
{
int temp= x;
x= y;
y= temp;
}
int partition(int[] A, int l, int r)
{
int i = l - 1;
int j = r;
int v= A[r];
for(;;)
{
while(A[++i] <v);
while (v < A[--j]) if (j == l) break;
if (i >= j) break;
exchange(ref A[i], ref A[j]);
}
exchange(ref A[i], ref A[r]);
return i;
}
struct ThData
{
public int[] A;
public int l;
public int r;
public ThData(int []a, int i, int j)
{
A = a; l = i; r = j;
}
}
void thWorkerParititoner(object data)
{
int[] A = ((ThData)data).A;
int l = ((ThData)data).l;
int r = ((ThData)data).r;
quicksort(A, l, r);
}
void StartQuicksort(int[] A, int l, int r)
{
if (r <= l) return;
int i = partition(A, l, r);
Thread t1 = new Thread(thWorkerParititoner);
t1.Start(new ThData (A, l, i-1));
Thread t2 = new Thread(thWorkerParititoner);
t2.Start(new ThData(A, i+1, r));
}
void quicksort(int[] A, int l, int r)
{
Stack<int> Indexes = new Stack<int>();
push2(Indexes, l, r);
while (Indexes.Count > 0)
{
l = Indexes.Pop(); r = Indexes.Pop();
if (r <= l) continue;
int i = partition(V, l, r);
push2(Indexes, l, i - 1);
push2(Indexes, i + 1, r);
}
}
public void StartSort()
{
quicksort(V, 0, V.Length - 1);
int d = 1;
}
}
modified 18-Jan-13 6:59am.
|
|
|
|
|
22 seconds to sort 100,000 integers?? Are you running this on an Atari 800? That's horrible performance for a Quicksort.
I've got a Mergesort implementation in my toolbox that'll sort 10,000,000 integers in less than 12 seconds - single threaded.
Windows will not automatically rework your code to run in on multiple cores. No O/S will do that. YOU have to do that my rewriting your code. I'd concentrate on reworking your implementation to get better performance on a single thread first before you start to worry about how you're going to multithread this. Multithreading a poor implementation doesn't get you anything but more threads running poorly.
|
|
|
|
|
Hi,
This quick sort couldn't be so bad. Ok, it is not an optimized QuickSort.
I think it depends also on the input data you provide. I have used other sorting algorithms with these data set and I get comparative results.
But still I don't have any answer here.
modified 18-Jan-13 11:12am.
|
|
|
|
|
George Nistor wrote: This quick sort couldn't be so bad
Oh yeah?? Quick sort normally has about 95% of the performance of Merge sort, given a proper implementation. Try recoding to use arrays only and skill all the stack collection garbage.
|
|
|
|
|
I think the stack operations are slowing your algorithm. Quicksort only needs a simple array.
The generic operations that are "array-like" will reallocate a NEW array and copy all the elements to this array when the old array isn't long enough to hold a new element. This gives O(n^2) performance, which is slow. (Quicksort should be O(n log n)).
Using multiple threads to speed Quicksort is a good idea because the partitioning lets the threads work independently, without requiring synchronization. You just have to make sure your basic operations aren't wasting time.
|
|
|
|
|