|
i create control and this control derived from gridview control.then i add 2 column in constructor like this :
InitializeComponent();
this.AutoGenerateColumns = false;
DataGridViewCheckBoxColumn cb = new DataGridViewCheckBoxColumn();
cb.HeaderText = "";
cb.Name = "dgvcSelect";
this.Columns.Add(cb);
DataGridViewTextBoxColumn tb = new DataGridViewTextBoxColumn();
tb.Name = "dgvcRowNumber";
tb.HeaderText = "ردیف";
but when i run my program 4 column generate for me.where is the problem?
please help me
|
|
|
|
|
Did you turn AutoGenerateColumns back on in your code consuming this new control?
Do your column names match the column names coming from your bound data?
|
|
|
|
|
some column come from database but these 2 column generate at runtime.i think thic part of code call twice.what can i do when i have custom control and want generate columns at runtime?
|
|
|
|
|
If you think that's the case, then call the Clear method of the Columns collection at the start of your code that setups up your columns.
|
|
|
|
|
|
Hy
I want to create a FPS convertor in c#.
input FPS =[24] to output FPS = [23] -it will show.
it will ONLY work with *.srt files, meaning it will have to hunt and modify this type of line:
[00:00:11,409 --> 00:00:14,548] ...(from inside that file).
I want a formula for converting ANY FPS into ANY FPS. (A general formula).
4^789*242/1131(rad45*cons321)/5453+122-vect453E-453/34.23=x__<(something like this, i suppose)
It will NOT work with movie files---only with txt files in *.srt format. That's it.
Thanks.
|
|
|
|
|
_q12_ wrote: I want to create a FPS convertor in c#.
_q12_ wrote: It will NOT work with movie files
Your question does not make sense. FPS conversion actually means you are going to work with the video itself. If you mean subtitle converter and not a FPS converter, it would be best if you first have a basic understanding of the different subtitle formats.
A SRT file is just a text file so you can open and be able to modify it the same way you would open a .txt file. See below for an example.
Subtitle Synchronization with C#[^]
Signature construction in progress. Sorry for the inconvenience.
|
|
|
|
|
subtitle converter, yes.
So, the conversion idea is to Add or Extract seconds and/or milliseconds from existing time. Hmmm.
DateTime.Parse(m.Groups["start"]).AddSeconds(offset);
But if I need to change from a predefined input FPS 23.978 to output FPS 23.976,
then the difference is -0.002 ?
or from 30 into 24, the difference is -06.000 ?
. I did not made something like this ever, its my first time, so I appreciate a straight answer, please. And I know it sound stupid, but I want to be sure before start anything, because can rapidly become a time consuming process. And also, it will be good for others too. Thanks walterhevedeich! Excellent example.
|
|
|
|
|
I still don't get your question. What exactly are you having problems with? Is it on retrieving the date time stamps from the file? Or on the subtracting part? By the way, once you've put the date time stamps on a collection class(a List , for example), I'm sure you won't have a problem on the subtraction/addition part because you already have some code for it.
Signature construction in progress. Sorry for the inconvenience.
|
|
|
|
|
Adding the same offset to all entries does not change the speed of the subtitles, it just shifts them in time.
To change the speed, add a different offset depending on the number of nanoseconds (or some other unit) from the start, or stated differently, multiply the time by something.
For example, to convert 23.978 FPS to 23.976, multiply each time by 23.978 / 23.976, or perhaps slightly more accurately (due to rounding), multiply the time by 23.978, then divide it by 23.976. You can factor out the fact that those are not integers by multiplying by 23978 (make sure there is no overflow) and then dividing by 23976, but if you use integer division, the division always rounds downwards and you get no chance to round To Nearest (so you'd get when using doubles and then rounding).
If you're now thinking "what does multiplying a time even mean", it means taking the number of nanoseconds (or some other unit) that the time represents (it's just an offset from the beginning of course), do the math on that number, and convert it back to a time-thing again (with rounded as necessary).
modified 24-Jul-13 6:23am.
|
|
|
|
|
Extraordinary explanation Harold ! Well done.
But if I have to set that time, not knowing the initial time (i will test some predefined values) but if i am not so lucky in finding that value, how I can proceed?
ex of testing pseudocode :
inputTime=? outputTime=23.976 (i check movie properties);
if inputTime = 30, outputting to 23.976 will have the desired effect?
no?
then, if inputTime = 25, outputting to 23.976 will have the desired effect?
no?
then, if inputTime = 23, ...etc
This i will do manually from a list of defaults (30,25,23,etc) -Or writing it myself in a textbox whatever value i feel is right - but orbiting the default values.
My question is:
if I will have 0 for inputTime, How I will do the math then?
Your solution is: t=t*outputTime/inputTime;
if inputTime >0, t will have some specific duration.
if inputTime = 0 (I don't know what encoding can have that subtitle), t =0 and all my sub time will be 0. Subtitle file ruined.
I must make my program to guess the subtitle encoding (Its FPS encoded time) ?
Or go on manually set the inputTime? (from list of defaults and/or textbox with custom values)
Thank you!
~q12~
modified 25-Jul-13 13:17pm.
|
|
|
|
|
I don't know, I can't think of anything except a manual test that probably doesn't even work well:
See what at time the last line from the subs appears (in the sub file), and compare that with the time in the movie that the last line in the subs should appear. Then, assuming the beginning isn't shifted, you could get an approximate ratio with videotime/subtime, or the approximate old FPS with newfps*videotime/subtime.
|
|
|
|
|
Ok, Harold, Thank you very much for your help.
Your answer is the correct one, that helped me.
[newfps*videotime/subtime] - got it now.
|
|
|
|
|
I am setting formauthentication.setauthcoddkie and on the action i have written [authorise] attribute
now if i type the page url directly it redirects me to login page which is correct
but when i login then it still show the login page
how to make sure that once i have logged in it shows the page. i am using my own custom database and tables
i tried
if (HttpContext.User.Identity.IsAuthenticated) also but it is not going to the controller at all
it just kicks out even if i login
any help is appreciated
|
|
|
|
|
If you could post the code for the custom stuff, that would be handy (edit your original question rather than replying to me will be better).
Without your code it's hard to provide an answer, it sounds like the provider isn't honouring your cookie. One thing I will add is that custom-securing apps is both hard and prone to error, so you really should check out your reasons for doing this. The first thing I'd do in your position is a sanity check: Do I really need custom code, and if so can I base (preferably sub-class) it on the existing providers. In the past subclassing has provided me with the functionality I need whilst saving a lot of hassle. This article[^] explains more fully than I can in a reply such as this.
|
|
|
|
|
I'm creating a socket server in which I'm getting a string like this.
IPEndPoint ipEnd = new IPEndPoint(IPAddress.Any, 5656);
Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
sock.Bind(ipEnd);
sock.Listen(100);
Socket clientSock = sock.Accept();
while (true)
{
clientData = new byte[1024];
receivedBytesLen = clientSock.Receive(clientData);
clientDataInString = Encoding.ASCII.GetString(clientData, 0, receivedBytesLen);
Console.WriteLine("Received Data{0}",clientDataInString);
if(clientDataInString.Contains("Start"))
{
.....any method call....
}
}
I want to use this clientDataInString or the received string in another method.
Like this:
void abc()
{
if(clientDatainString.containg("A"))
{
Console.Writeline("Print A");
}
else if(clientDatainString.containg("B"))
{
Console.Writeline("Print B");
}
}
How can I use this String like this?
Please Suggest..
|
|
|
|
|
CodingHell wrote: How can I use this String like this?
Please Suggest.. Suggest what? You use this string the same way that you would use any string. Your question is not very clear.
Use the best guess
|
|
|
|
|
I'm unable to use the received string in a method because server socket is working in main method but abc method is not a part of this main.
So my motive is to switch and use received string in other methods of my program except where these are being received.
|
|
|
|
|
Then you need to pass the string to the other method as a fuction parameter.
Use the best guess
|
|
|
|
|
Pass the string as a parameter
[...]
Console.WriteLine("Received Data{0}",clientDataInString);
abc(clientDataInString);
} Of course, abc() has to accept a parameter of type System.String then:
void abc(string input)
{
if(input.Contains("A"))
{
Console.WriteLine("Print A");
}
else if(input.Contains("B"))
{
Console.WriteLine("Print B");
}
}
Ciao,
luker
|
|
|
|
|
I'm new to this, or precisely just realize that visual studio had this in the properties folder below visual studio project.
I'm planning to put important things like connection strings inside.
I tried to save a simple text in the setting and save it.
When I run the application, in the debug folder appear "WindowsFormsApplication1.exe.config" file.
I know that it's the setting I created, but the value of the setting is not inside.
When I re-run the application, it was able to load the text i saved before.
Where did the setting save the value?
Btw sorry for bad english.
|
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
{
Properties.Settings.Default.Constr = this.textBox1.Text;
Properties.Settings.Default.Save();
}
private void Form1_Load(object sender, EventArgs e)
{
this.textBox1.Text = Properties.Settings.Default.Constr;
}
Constr is the setting I create.
Actually I'm going to put licensing there too, of course I will encrypt it before I save.
Now I still can't find it.
This is what I use > http://msdn.microsoft.com/en-us/library/aa730869%28v=vs.80%29.aspx[^]
|
|
|
|
|
That's only one of the config files. It's like a blueprint holding the values you enter in Visual Studio at coding time.
What your application saves at runtime is stored in a user-dependent copy of that file somewhere in the region of "Documents and Settings/$YourUserName$/Application Data/$Company$/$ApplicationNameWithSomeAlphaNumericFuzz$/$ProductVersion$/user.config"
The exact location may depend on your OS version.
Ciao,
luker
|
|
|
|
|
lukeer wrote: "Documents and Settings/$YourUserName$/Application Data/$Company$/$ApplicationNameWithSomeAlphaNumericFuzz$/$ProductVersion$/user.config"
I found this but nothing inside.
"C:\Documents and Settings\Administrator\Application Data\Microsoft Corporation\Microsoft (R) Visual Studio (R) 2010\1.0.30319.1"
There are no strange company name in Application Data.
Btw thank you for answering.
Edit :
I found it here[^]
It's just like what you answered, I missed Local Settings before Application Data.
Thank you very much. 
modified 23-Jul-13 6:00am.
|
|
|
|