|
You might want to look into NxBRE.
|
|
|
|
|
Thank you very much, it seems really interesting. Nevertheless, if anyone has any other suggestion, I'm all ears.
Thank you again.
|
|
|
|
|
Hello,
I m woking on a web application that logins on another website and then downloads some files from that site just on a click of a button.
I have already implemented the logic to login on that website and am also able to see the protected page of that site.
Now that website is returning an HTML code that has the filename i want to download under <script> tag
<script>PrintFileURL("13572_BranchInformationReport_2012-05-22.zip","13572_BranchInformationReport_2012-05-22.zip",0,"184601","May 22 1:30","/icons/default.gif")</script>
the method called is
<i>function PrintFileURL(uri, name, dirFlag, filesize, time, icon)
{
var color
var bgcolor
if(!(name.length>2 && name.charAt(name.length-1)=="e" && name.charAt(name.length-2)==".")) {
if (lineColor)
{
bgcolor="EEEEEE"
lineColor=false
}
else
{
bgcolor="FFFFFF"
lineColor=true
}
document.write("<TR bgcolor=" + bgcolor + ">");
if (dirFlag)
{
document.write("<td nowrap><img src='../" + icon + "'><a href='" + uri +
"/?T'> " + name + "</a></td>");
document.write("<td> </td>");
document.write("<td> </td>");
document.write("<td> </td>");
}
else
{
document.write("<td nowrap><img src='" + icon + "'><a href='" + uri +
"'> " + name + "</a></td>");
document.write("<td><font face=Arial size=2>" + filesize +
"</font></td>");
document.write("<td><font face=Arial size=2>" + time +
"</font></td>");
document.write("<td> </td>");
}
document.write("</TR>");
}
}</i>
I am totally stuck here. Can someone help.
Thanks in advance
Regards,
Akhil
-- modified 22-Jun-12 6:05am.
|
|
|
|
|
|
Hi
I am new to C# and am still learning I am trying to merge data from iether 1 or multiple coloumns of a data file to x & y coordinates in a pdf file ive downloaded itextsharp but am not sure where best to begin any suggestion appreciated also want to call in font downloaded off internet.
Thanks & regards
|
|
|
|
|
Member 9155359 wrote: but am not sure where best to begin
Somewhere like this[^], where you should find some useful samples and tutorials.
|
|
|
|
|
I am trying to annotate an existing pdf document, however, i can only open the document readonly mode, it doesn't edit or annotate it, on the other hand, i can only create a pdf and overwrite my version. What is the problem?
|
|
|
|
|
candogu wrote: What is the problem?
Impossible to say without a lot more information.
|
|
|
|
|
If it's only one PDF that is like this, then it means it's been saved as a read only PDF. If it's a problem with all external PDFs, then it's your code that's at fault.
|
|
|
|
|
i want to display large content i.e data may be 50 to 60 mb for example bible in desktop application.how i can do that?
|
|
|
|
|
Like it says in "how to ask a question", choose THE correct forum. THE means one, not two or more.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
In a C# 2010 application, I have a string value that looks like the following:
"http://localhost:99/test/TestHome.aspx". I only want to obtain the part of the string that is "TestHome.aspx".
I have tried lots of string functions to obtain the "TestHome.aspx" part of the string with no success yet.
Thus can you tell me how to obtain the part of the string I am trying to access?
|
|
|
|
|
There are many ways you could accomplish this. You could use a regular expression (a sledgehammer to crack a nut). You could use string.LastIndexOf to find the last / and then do a Substring based off this, or you could do a string.Split and take the last item out of the array.
|
|
|
|
|
Use System.IO.Path.GetFileName("http://localhost:99/test/TestHome.aspx")
|
|
|
|
|
Good one! My first impression was "that's a URL, not a path. It'll never work." Then I tried it.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
GetFileName is a good choice, but it does have the limitation of that it is actually doing more than is necessary to solve this particular problem. Why is that you ask? Well, when we deconstruct the method, it actually does the following:
public static string GetFileName(string path)
{
if (path != null)
{
CheckInvalidPathChars(path);
int length = path.Length;
int num2 = length;
while (--num2 >= 0)
{
char ch = path[num2];
if (((ch == DirectorySeparatorChar) || (ch == AltDirectorySeparatorChar)) || (ch == VolumeSeparatorChar))
{
return path.Substring(num2 + 1, (length - num2) - 1);
}
}
}
return path;
} As you can see, right at the top of the method, it's calling CheckInvalidPathChars to determine whether or not the path is valid. However, this is just a minor point - yours is a perfectly good solution, hence my 5.
|
|
|
|
|
Don't worry about anything, single one line code will solve problem,
i have complete program for you:
String s = "http://localhost:99/test/TestHome.aspx";
s = Path.GetFileName(s.Replace("/", "\\"));
Console.WriteLine(s);
Console.ReadKey();
|
|
|
|
|
|
GetFileName is a crap choice, doesn't sound very portable at all and there is a class dedicated to Uri handling already :P
Votes of 1 all around on this
Surely you'd do
var result = new Uri("http://foo.com/foo.aspx").Segments.Last();
|
|
|
|
|
So, an even less efficient method to retrieve this then. As the OP hasn't stated they are doing anything else Uri, it's kind of a waste when you end up with this method
public string[] Segments
{
get
{
int index;
if (this.IsNotAbsoluteUri)
{
throw new InvalidOperationException(SR.GetString("net_uri_NotAbsolute"));
}
string[] strArray = null;
if (strArray != null)
{
return strArray;
}
string privateAbsolutePath = this.PrivateAbsolutePath;
if (privateAbsolutePath.Length == 0)
{
return new string[0];
}
ArrayList list = new ArrayList();
for (int i = 0; i < privateAbsolutePath.Length; i = index + 1)
{
index = privateAbsolutePath.IndexOf('/', i);
if (index == -1)
{
index = privateAbsolutePath.Length - 1;
}
list.Add(privateAbsolutePath.Substring(i, (index - i) + 1));
}
return (string[]) list.ToArray(typeof(string));
}
} I'll be nice though. I won't award you a 1.
|
|
|
|
|
Path.GetFileName() is prefectly reasonable given the problem as described.
It describes the (apparent) intent, and so adds to the clarity of the code, which increases maintainability.
It is not necssarily the most efficient solution, but if done in response to user interaction, is probably plenty fast to not cause a performance issue.
|
|
|
|
|
A combination of the substring and IndexOf functions should be enough.
String.Split is the other neat option.
|
|
|
|
|
You could always use the System.Uri [^] class, which can provide much more information for you.
|
|
|
|
|
I'd use LastIndexOf and Substring, unless you actually want the extra validation of a path or URL parsing function.
|
|
|
|
|
Hello,
Try this:
Uri myUrl = new Uri("http://localhost:99/test/TestHome.aspx");
string pagina = myUrl.Segments.Last();
att.
Ernesto Fazolo
modified 22-Jun-12 13:09pm.
|
|
|
|