|
Hi,
I have a problem I need to solve it quite fast: I need to write a function that have as input an URL, and return an number, the Google Page Rank for that page (like page rank that Google toolbar give)
Is someone here that know how to do this? I need to write this function in c# (to integrate in an existing application). Or an site to read how to do it!
|
|
|
|
|
|
All this "Page Rank Calculators" uses an algorithm to get the number representing the Rank. I need that algorithm. 2 years ago I wrote an php script that do this, but I lost the code, and I cannot find it (for now).
I posted here this question with the hope that someone have that algorithm (can be c# or php code).
|
|
|
|
|
Hi,
I'm developing one windows appln with C#. I'm getting the error msg as " An unhandled exception of Type 'System.StackOverflowException' occurred in mscorlib.dll" . Control stops at the place where I declared the hashtable as:
public class Logger : IDisposable
{
Hashtable htMsgCount;
}
public Logger()
{
htMsgCount = new Hashtable();
}
Control comes and stay at htMsgCount. What could be the problem. The funny thing is it was working fine just I made a few changes in my code. After compiling and tried to run, it is giving me this error. Anybody who knows please help me.
Thanks in advance.
Meeram395
|
|
|
|
|
The problem is elsewhere in the call stack
|
|
|
|
|
Hi,
I don't understand what you mean. Can you please clarify a little bit.
Meeram395
|
|
|
|
|
Standard question #5:
No, that is not the code you are using. It can't produce that result. What does the code you are using look like?
The constructor of the class has to be inside the class, so the code that you have shown doesn't even compile. It's hard to tell what's wrong with a piece of code, when you are not even looking at the code that is actually used.
Post the actual code that you are using, or a complete example that reproduces the error.
---
single minded; short sighted; long gone;
|
|
|
|
|
HI,
Thanks for the reply. The constructor is within the class only. I have put the closing braces wrongly before the constructor. Sorry for that.
-- modified at 1:44 Tuesday 26th June, 2007
Meeram395
|
|
|
|
|
I'm guessing here: if Hashtable is a class of your own, and its constructor needs
a new Logger, then thatwill need a new Hashtable which needs a new logger etc. until
the stack fills.
|
|
|
|
|
Dears,
Post your articles here too
www.exposecode.com
Mussarat Aziz
|
|
|
|
|
Your post has been reported as spam, and will be treated as such.
|
|
|
|
|
|
Yeah, I tagged that one too, but as I look back at that article, his post has disappeared.
Either way, advertising "Post your articles on MY site!" just doesn't deserve a warm and fuzzy reception around here.
|
|
|
|
|
My code connects to an Access database (SC226_db.mdb), which is installed in the application folder, using the code:
OleDbConnection Connection1 = new OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=SC226_db.mdb");
Connection1.Open();
This works fine until a FileOpen dialog is used to access a file in another folder, then my app looks for the database file in this other folder. Can anyone please tel me how to ensure that my app always looks for the database in the application folder?
|
|
|
|
|
There is a setting on the FileDialog to keep or move the current directory. I don't recall exactly what the property is off the top of my head, but it will be in MSDN or you might be able to guess from the intellisense.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
You could use the Application.StartupPath .
OleDbConnection Connection1 = new OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ Application.StartupPath +"\\SC226_db.mdb");
|
|
|
|
|
Try string strCurrentDirectory=Directory.GetCurrentDirectory();
This will return current directory of ur application ie. bin directory.Put ur database(.MDB) file in this directory.
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
Not necessarily, that current directory can be changed.
|
|
|
|
|
Hello,
It's System.Enviroment.CurrentDirectory
All the best,
Martin
|
|
|
|
|
Good practice is to ALWAYS use fully qualified path names when accessing files, even in connection strings. You cannot guarantee that the "current directory" will stay that way, so...
string databasePath = Path.Combine(Application.StartupPath, @"SC226_db.mdb");
string connString = String.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}", databasePath);
|
|
|
|
|
Dave Kreskowiak wrote: Good practice is to ...
|
|
|
|
|
Well, it's true!
|
|
|
|
|
Whats the best most efficient way of checking whether a resource (image, page, document etc.) exists at a particular URL web address location. Eg. I have a url http://www.example.com/myImage.jpg and I want to check whether myImage.jpg actually exists.
At the moment I'm using the WebClient class like so...
WebClient client = new WebClient();<br />
<br />
try<br />
{<br />
if(client.Download("http://www.example.com/myImage.jpg").Length > 0)<br />
{<br />
}<br />
else<br />
{<br />
}<br />
}<br />
catch<br />
{<br />
}
...problem with this method though is that it downloads the entire file to check it's existence. I'm not interested in the file, just whether the server will return a 404 or not.
Cheers!
|
|
|
|
|
Include System.IO and System.Text namespace to your project
Then you would be able to access File class which has a method defined for checking the existence of files as shown below
if (File.Exists(@"//localhost/command.gif") == false)
{
Response.Redirect("FileNotFound.htm");
}
else
{
Response.Write("File Exists");
}
I tested this code on my localhost, it works fine. I think this code would access the client machines path for the file and not the server's, just verify and let me know.
-- modified at 9:37 Monday 25th June, 2007
|
|
|
|
|
gladiatron wrote: I tested this code on my localhost, it works fine. I think this code would access the client machines path for the file and not the server's, just verify and let me know.
Just tested it with IronPython:
>>> ex = File.Exists("http://www.codeproject.com/script/images/news_answer.gif")
>>> ex
False
regards
modified 12-Sep-18 21:01pm.
|
|
|
|