|
Thank you very much. Your reply was very helpful. Talking about the other method mentioned by Richard, I need a little clarification on how to include it in my code. Am a bit of a newbie. Thanks.
|
|
|
|
|
I am developing a .net windows application to fetch HTML from a particular web page. I am using WebBrowser control to launch the web page and trying to fetch the HTML source. But, what i am getting is HTML from View Source. There is difference between HTML source in View Source and in Developer Tool. please help me in fetching the HTML source from Developer Tool.
|
|
|
|
|
It's not possible to answer your question. What do you mean by "Developer Tool"?? WHat do you mean by "getting the source from the developer tool" as opposed to the HTML source the brwoser gets? How do you know the difference?? Is this a website that you control and have the source for??
|
|
|
|
|
I mean in IE if I click on f12 I get a developer tool which will have a html code. When right click on a webpage and select view source I can see the html code.
There is difference between view source html and what I see in developer tool html code.
Below is the code for accessing view source html code:
HtmlElementCollection objHtmlElementCollection = null;
HtmlDocument objHtmlDocument = webBrowser1.Document;
similarly I want to access developer tool's html code.
Please help..
|
|
|
|
|
There is no "developer tools source". What you're seeing is a debugger analysis of the same source you see in "View Source". There is no different "source" you can possibly get from the browser.
|
|
|
|
|
The code is different in view source and developer tool source.
I have a scenario where a button is being displayed as in view source, whereas in developer tool, it is displayed as . Also, when i tried accessing a web page with frames, in View Source, i could not able to see the control tags appearing inside the frame, whereas i could see those in developer tools.
|
|
|
|
|
|
Yes. Can I access this interpreted html in my code?
|
|
|
|
|
No, as we have repeatedly told you, what you get from the website is the exact HTML. There are classes and methods in .NET that will help you manipulate the content but you still need to write the code to suit your requirements.
Veni, vidi, abiit domum
|
|
|
|
|
No. It's not exposed by Internet Explorer. You'd have to write you own debugger/interpreter to get the same data and all you have to work with is the exact same source you see in "View Source".
|
|
|
|
|
Thank you.
Do you have any idea why is shown as in view source? Some pages I see as in view source but in some other pages it is different.
Please help me.
|
|
|
|
|
That's because <button> is shorthand for an <input> with a type of "button".
|
|
|
|
|
I am trying to write a small code to find the possible combinations from a list of integer values which when added is equal to the input value or somewhat nearing.
List<int> comb = new List<comb>() { 618, 350, 308, 300, 250, 232, 200, 128 };
The above list contains the integer values from which the proper combination has to be generated
The combination should have least number of values i.e., greatest number has to used most
Example:
If Input from User [Value = 2386]
Combination 1 = 618 + 350 + 308 + 300 + 250 + 232 + 200 + 128
Combination 2 = 618 + 618 + 618 + 300 + 232
I have used the below code, but have missed some logic.
public static void Main(string[] args)
{
//subtotal list
List<int> totals = new List<int>(new int[] { 618, 350, 308, 300, 250, 232, 200, 128 });
// get matches
List<int[]> results = KnapSack.MatchTotal(2682, totals);
// print results
foreach (var result in results)
{
Console.WriteLine(string.Join(",", result));
}
Console.WriteLine("Done.");
}
internal static List<int[]> MatchTotal(int theTotal, List<int> subTotals)
{
List<int[]> results = new List<int[]>();
while (subTotals.Contains(theTotal))
{
results.Add(new int[1] { theTotal });
subTotals.Remove(theTotal);
}
if (subTotals.Count == 0)
return results;
subTotals.Sort();
double mostNegativeNumber = subTotals[0];
if (mostNegativeNumber > 0)
mostNegativeNumber = 0;
if (mostNegativeNumber == 0)
subTotals.RemoveAll(d => d > theTotal);
for (int choose = 0; choose <= subTotals.Count; choose++)
{
IEnumerable<IEnumerable<int>> combos = Combination.Combinations(subTotals.AsEnumerable(), choose);
results.AddRange(from combo in combos where combo.Sum() == theTotal select combo.ToArray());
}
return results;
}
public static class Combination
{
public static IEnumerable<IEnumerable<T>> Combinations<T>(this IEnumerable<T> elements, int choose)
{
return choose == 0 ?
new[] { new T[0] } :
elements.SelectMany((element, i) =>
elements.Skip(i + 1).Combinations(choose - 1).Select(combo => (new[] { element }).Concat(combo)));
}
}
Is there any other way other than the above to get combinations
|
|
|
|
|
Simplest one for me was
List<int> comb = new List<int>() { 618, 350, 300, 250, 200, 128 };
List<int> output = new List<int>();
output = CalcLowestCombination(comb, 2386);
List<int> Test2 = CalcLowestCombination(comb, 1096);
private static List<int> CalcLowestCombination(List<int> comb, int ToAchieve)
{
List<int> output = new List<int>();
foreach (int value in comb)
{
while (value <= ToAchieve)
{
output.Add(value);
ToAchieve -= value;
}
}
return output;
}
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
The logic returns a combination but when output list is added, it does not return the input value. The Logic fails here.
|
|
|
|
|
There are some good articles on CP (for both C# and C++) on generating combinations, permutations, etc. : [^]. An interesting debate and brawl on StackOverFlow on various permutation generating algorithms here: [^].
While the permutations of a set of eight would be around 40k, the fact that your solution is going to consider multiple uses of any one item suggests to me you will have a vast "combinatorial" space to examine for a set of eight.
good luck, Bill
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|
I don't have a solution, but looking at the exercise I imagine that you will probably need to use the %(mod) operator to determine what value you have left to calculate in your iterations.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
There are much better algorithms to solve Knapsack[^] and the related Subset Sum[^] (this problem). The pseudo-polynomial time DP algorithm is very fast on most practical inputs, and the approximation algorithm is tune-able to be as close to exact as you want it to be, trading off speed for accuracy.
|
|
|
|
|
Hello,
I would like to make infix to postfix calculator.
What I would like to make is like, If I entered the number on the calculator, 1+23*4=, then calculator form will show "1 23 4 * +".
And, I already made my own two program, these are calculator form, and converter infix to postfix program.
But, I don't know how combine two program.
Could somebody help me?
I uploaded two my program on the storage.
infix to postfix program
http://firestorage.jp/download/60346ca65783c9f87a086c362427c05bfdfea76d
calculator program
http://firestorage.jp/download/e636062b4f88508536aed645e85fdc9001e86f83
|
|
|
|
|
Sottyoru wrote: But, I don't know how combine two program. Just add the extra code as a new class or method to the one that needs it. I do not think anyone is going to download these files and do it for you.
Veni, vidi, abiit domum
|
|
|
|
|
|
I want to write a dll file in .net
when i write the dll file and add reference to the project.
I can simply see the whole contents of dll files.while debugging
My question is that i want to write dll file such that no one can see its contents or methods defination. just can use the methods of dll files.
|
|
|
|
|
You need to use obfuscation.
Here[^] is a list of obfuscators that you could consider using.
Note that even obfuscation is not a 100% secure way and users can still view your code.
|
|
|
|
|
Consider this. Suppose no one can see the contents, how does your computer know what to do with it? That could sort of be done, with asymmetric key cryptography, but let's hope that never happens. If people can't read your code, then how will viruses get caught? (on the other hand, how would you find an exploit?) How will backdoors be detected?
Because of the extreme value of the key (at least hundreds of millions, perhaps billions - remember, every virus writer and every government is going to want it), significant resources will be poured into cracking it, ranging from brute-forcing it with super-computers to inspecting the physical circuitry with electron microscopes to going after the source of the key with hacks / actual cloak-and-dagger spies.
It won't be safe for long.
This is not a scenario anyone should want. The only party that actually benefits from it is the one who finds the key. Everyone else loses.
|
|
|
|
|
What are you on about, the guy just wants to protect his code (naive I know but understandable).
Never underestimate the power of human stupidity
RAH
|
|
|
|