|
Guffa, this is the way the most ?nixe show their directory entries. For older entries they show date without time, for younger date without year, but with time. But in all cases you can't rely on fixed width column structure.
Regards
|
|
|
|
|
mabo42 wrote: But in all cases you can't rely on fixed width column structure.
So what can one rely on ...
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
The columns you showed are always exist, but the width can differ in width (perhaps not in your case, username is always ftp, directory size is always 0...). To be on the safe side, use RegEx.
Regards
|
|
|
|
|
To make it more clear, this is a sample listing:
drwxr-x--- 2 ftp ftp 8192 Nov 19 12:14 .
drwxr-xr-x 11 ftp ftp 8192 Nov 19 12:35 ..
-rw-r----- 1 someone someone 8639750144 Nov 19 12:14 this_is_a_long_file_name.dat
-rw-r----- 1 ftp ftp 6260006912 Nov 19 13:13 shortname.dat
The filename (or directory name) is the 9. group (delimited by whitespace) until line end.
Regards
|
|
|
|
|
|
You could try this function, should work:
using System.Text.RegularExpressions;
public string EntryName(string line)
{
Regex regex = new Regex(@"[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+(?<ENTRY>.*)");
Match match = regex.Match(line);
return match.Groups["ENTRY"].Value.Trim();
}
Regards
|
|
|
|
|
Yeah, one of the worst things about Unix.
|
|
|
|
|
This has suddenly become a real ‘would like to have’ feature in the project I’m currently working on. I know this isn’t possible in standard C#, but I’m trying to find a hammer with the right weight and shape to beat this into some semblance of working. What I would like to achieve is something like this, in the commented line:
public class PersonForm
{
System.Windows.Forms.TextBox textRate = new TextBox();
public void BuildPerson(Person person)
{
Person pers = new Person();
pers.HourlyRate = textRate.Text.Length == 0 ? (double?) null : double.Parse(textRate.Text);
}
}
My SetPropertyFromText should take the pers.HourlyRate as a delegate parameter, not as a double?, determine the correct type conversion based on the type of the pers.HourlyRate, and set the property to the converted object value.
I can easily use a property name as my property parameter for SetPropertyFromText, but then I lose compile time checks. Our generated DAL, nettiers, provides, for each entity, an Enum with all the column properties for each entity, and I think this is about as close as I’ve seen to what I want, but not quite there.
Any ideas on the matter?
Calling all South African developers! Your participation in this local dev community will be mutually beneficial, to you and us.
|
|
|
|
|
i am uninstalling the application using batch file,while unistalling i don't want to get command prompt(need to hide this from showing).how to do this programatically in c#
naveen
|
|
|
|
|
try using
Process oProcess = new Process();
oProcess.StartInfo.CreateNoWindow = true;
Chaos, panic and disorder - my work here is done.
|
|
|
|
|
cde is not working,can u tell me any other solution
naveen
|
|
|
|
|
code is not working,can u say the alternate colution
naveen
|
|
|
|
|
hi please tell
How i can change custom level of security (for example ActiveX control and plugins) of trusted sites, programmatically?
Is it possible by using IInternetSecurityManager interface?
Thanks.
-- modified at 0:43 Monday 19th November, 2007
|
|
|
|
|
Hi,
cenories is like i fill dataset from client machin which is in india. now that dataset is updating in Neterland server. but problem is occured that the data on server which have datetime field is oncrement by one day. i.e. is local database have value in datetime field 22/10/2007 then Netherland server database update to 23/10/2007 . this due to time span difference between us. is there any mehtod that will help me to avoid this adding of time span
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
How you are passing DataSet from Indian server to Netherlands server ?
|
|
|
|
|
yes
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
|
Hi All,
I've got a GridView which I am using like Visual Studio's Local and Autos Windows. When I attempt to call the DeleteRow method (GridView.DeleteRow Method[^]), the program will not compile. Any ideas how to 'Clear' the GridView control? The GridView is unbound, and I am using Framework version 2.0.
Thanks,
Jeff
private void GridViewClear() {
for (int i = GridView.Rows.Count; i > 0; i--)
{
GridView.DeleteRow(i - 1);
}
}
|
|
|
|
|
Jeffrey Walton wrote: the program will not compile
R u getting any error ? can you explain in details.
You can try with ,
GridView.dataSource=NULL
|
|
|
|
|
Hi Abhijit,
It won't compile because it cannot find the method. Also, it is an unbound control.
Jeff
|
|
|
|
|
I am quickly becoming a master of what does not work (even though others recommend it). The following results in "Collection already belongs to a DataGridView control. This operation is no longer valid.":
for (int i = GridView.Rows.Count; i > 0; i--)
{
GridView.Rows[i - 1].Cells.Clear();
}
|
|
|
|
|
Thinking I'd be slick (and give up the look and feel of Visual Studio), I swirtched to a TreeView with two columns. The most recent reason the program will not compile is: "Cannot implicitly convert type 'string' to 'System.Windows.Forms.ColumnHeader'". Offending line of code is (from Designer.cs - at least it is not my code this time):
this.Name = "FrmMain"; The related warning before the error is "warning CS0108: 'ASN1View.FrmMain.Name' hides inherited member 'System.Windows.Forms.Control.Name'. Use the new keyword if hiding was intended."
Does it ever end with this language?
Jeff
|
|
|
|
|
Hi.
In C dll, there is a struct that contains an array of struct pointers. I do not know how to represent that in C#. That's my problem.
Here is the relevant C code:
struct vector
{
uint elem_count;
uint size;
int (*cmp)(const void *, const void *);
void *table;
};
typedef struct vector VECTOR;
#define CTABLE VECTOR
#define CSTATS VECTOR
struct cstream
{
int mode;
int byte_count;
uchar *buff;
int buff_len;
int buff_pos;
int bit_pos;
bool growable;
bool prepared;
CTABLE *table[2];
CSTATS *stats[3];
uchar last_mode;
int last_mode_offset;
};
And here is the C# code:
[UnmanagedFunctionPointer(CallingConvention.Winapi) ]
unsafe public delegate int cmp(IntPtr a, IntPtr b);
[StructLayout(LayoutKind.Sequential, Pack = 1)]
unsafe public struct VECTOR
{
public uint elem_count;
public uint size;
public uint elem_size;
[MarshalAs(UnmanagedType.FunctionPtr)]
public cmp cp;
public IntPtr table;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
unsafe public struct CSTREAM
{
public int mode;
public int byte_count;
public IntPtr buff;
public int buff_len;
public int buff_pos;
public int bit_pos;
public bool growable;
public bool prepared;
public VECTOR[2];
public VECTOR[3];
public byte last_mode;
public int last_mode_offset;
}
[DllImport("compr.dll")]
public static extern IntPtr screate();
[DllImport("compr.dll")]
public static extern IntPtr tcreate();
Now, I know how to get the IntPtr to a struct. For example:
MyClass.VECTOR stext = new MyClass.VECTOR();
IntPtr st = MyClass.screate();
stext = (MyClass.VECTOR)Marshal.PtrToStructure(st, typeof(MyClass.VECTOR));
However, I do not know how to represent, or work with, "CTABLE *table[2];" or "CSTATS *stats[3];" from the struct in C, in the C# struct (CSTREAM).
Does anyone know how to do this?
Thank you for any help.
|
|
|
|
|
how can i populate a combobx with to columns of a datatable?? [firstname] and [lastname]
|
|
|
|
|
You would do best to create a new column called FullName so you can set the DataTextField of the control and just make the table your data source.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|