w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Why does wget use Firefox cookies to login on an authenticated webpage?
To do this with wget only, you need to first send your credentials to the login page, then use the returned cookie for the next request. The page in your code uses a simple post request (no javascript etc.), so it wouldn't bee too difficult: wget -q -O - --load-cookies=$workingDirectory/cookies.txt --save-cookies=$workingDirectory/cookies.txt --keep-session-cookies --post-data="mid=USERNAME&pwd=PASSWORD" "http://www.tczonline.ir/?m=login&op=inc" After that, the file cookies.txt should contain the session cookie and you can continue like you've shown above.

Categories : Python

Dreamweaver Preview Browser different from Actual Webpage HTML CSS
I tried using http://bradfrost.github.io/this-is-responsive/patterns.html# as a basic template and it ended up working how I wanted it to. It did require starting again and copying and pasting only the relevant code. TRY THIS: http://bradfrost.github.io/this-is-responsive/patterns.html#

Categories : HTML

When do we know the actual width of an element in Angular?
First, I only have used this logic when I defined a controller for a directive rather than a link function. So defining it in a link function instead may cause different behavior, but I suggest you try it there first and if you can't get it to work then switch to using a controller. As far as I can tell, the only change you would need to make this work would be to change $scope to scope calls and $element to element since the dependency injected objects become standard link function parameters. $scope.getElementDimensions = function () { return { 'h': $element.height(), 'w': $element.width() }; }; $scope.$watch($scope.getElementDimensions, function (newValue, oldValue) { <<perform your logic here using newValue.w and set your variables on the scope>> }, true)

Categories : Angularjs

Try to get actual width & height of a element with jQuery
EDITED ANSWER DEMO $('#test').click(function () { var size = elementSize('#content'); $('#result').html(size.width + ' x ' + size.height + 'px'); }); function elementSize(elementId) { var html_org = $(elementId).html(); var $html_calc = $('<span>' + html_org + '</span>').css({ position: 'absolute', top: -9999, left: -9999 }).appendTo('body'); var ret = { width: $html_calc.width(), height: $html_calc.height(), }; $html_calc.remove(); return ret; }

Categories : Javascript

Jquery : function to catch actual element clicked
You can stick this in one call.. $("span, a, p, div, tr").on('click', function(event) { event.stopPropagation(); var $this = $(this); alert("The " + $this.prop("tagName") + " element was clicked. ID:" + $this.prop("id") + " ; Class=" + $this.prop("class")); });

Categories : Javascript

How to convert Text-based programming code (stored in DB) into actual programming code?
The hard way is to interpret the code within the database, the easier way is to store c# code and runtime compile it with CodeDOM http://msdn.microsoft.com/en-us/library/y2k85ax6.aspx Or take a look at Iron Python. http://ironpython.net/

Categories : C#

Add actual HTML elements to PRE/CODE contents
Use .html() instead of .text(). When you use .text(), the value is the literal text that you want users to see, so it replaces special HTML characters with entities so they'll show up literally.

Categories : Javascript

code doesn't work on Actual server
It is really difficult to debug in PHP. Only few tricks and tools can be used in debugging. To solve this type of problem, when you get blank window without any error indication, it is good to use a error reporting tool of PHP. To enable the error reporting add the following line of code in your webpage error_reporting(E_ALL); ini_set('display_errors',true);

Categories : PHP

What are some ideas for when "Inspect Element" in Chrome shows the expected behavior of CSS but actual result is different?
You could always check for !important on lower down lines. I think that happened to me once, and I don't think it put a line through my style that was being overidden. (It may have though it was a long time ago it happened.) The only way really around that if that's the case and if that !important is necessary is to add !important to your rule you want to overwrite with. (Try to avoid using importants wherever possible though, because in most cases an important isn't necessary.)

Categories : CSS

Want to scroll a DIV element, not entire webpage
You are animating the body element. You need to animate the target div. Also, I would consider either shortening the ID on that element to make it more manageable or target the element using one of the classes. Either way, try using the code in that last snippet but put the nested list inside of the first selector and the child element to which you want to scroll in the scrollTop attribute's selector.

Categories : Javascript

How do you embed a certain element from a webpage with JavaScript?
How about: $("#YourElementId").append($('#comm')); Using JQuery, can't you just append the element? Expanding on the comment by @Omar, you could also append a clone of that element if you want it duplicated instead of relocated: $("#YourElementId").append($('#comm').clone());

Categories : Javascript

Why is this generated ruby regex not working in the actual code?
try this: s = "4.4 out of 5 stars" p s[/([+-]?d*.d+)(?![-+0-9.])/] # >> "4.4" You can find this wayRegexp.new: Regexp.new('([+-]?\d*\.\d+)(?![-+0-9\.])') # => /([+-]?d*.d+)(?![-+0-9.])/

Categories : Ruby

With HtmlAgilityPack, verify that element on webpage exists
Method LoadHtml(html) loads string, which contain html content for parsing. This is not url of resource to load. So you are loading string "http://google.com" and trying to find logo in it. Which of course gives you not there result. You can use WebClient to download resource content: WebClient client = new WebClient(); string html = client.DownloadString("http://google.com"); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(html);

Categories : C#

My php code works on localhost, but doesn't work on the actual server
Your production server is Server:Microsoft-IIS/6.0 The instructions for installing PHP on IIS 6 are at http://php.net/manual/en/install.windows.iis6.php Here are the headers from the Server response: HTTP/1.0 304 Not Modified Content-Location: http://www.digitalcowboyrepair.com/index.html Last-Modified: Mon, 15 Jul 2013 17:15:42 GMT Accept-Ranges: bytes Server: Microsoft-IIS/6.0 MicrosoftOfficeWebServer: 5.0_Pub X-Powered-By: ASP.NET Date: Mon, 15 Jul 2013 17:57:35 GMT If you do not already have MySQL installed on the server, you can find the instructions at http://dev.mysql.com/doc/refman/5.7/en/windows-installation.html

Categories : PHP

Virtualbox has a different byte code for backspace than an actual bare metal OS
You have just encountered the classic DEL vs. BKSP dilemma. There is no perfect solution, you have to acknowledge that some terminals are configured to output a BKSP (0x08) ASCII character when the user presses backspace, while others output DEL (0x7f). Most terminal emulators have an option for this sort of thing, I have not seen a lot of application software that actually works around this issue. It is usually left up to the terminal program, and the user decides whether to press DEL or BKSP or re-configure their terminal in order to ensure proper program operation.

Categories : C

Java generics - naming actual types of actual type
You need a second generic parameter: public interface MyInterface2<U estends MyAbstractClass, T extends MyInterface1<U>> { U returnInstanceOfMyClass(); }

Categories : Java

Extracting a value from webpage element with selenium, fiebug, xpaths
Humm.. You can try the below : @driver.find_element(:css,"input#dateTxt").attribute("value") #=> "Thursday June 20" @driver.find_element(:xpath,"//input[@id = 'dateTxt']").attribute("value") #=> "Thursday June 20" Look at the below page Element examples: and Selenium::WebDriver::Element#attribute

Categories : HTML

force file download code work on localhost but not working on actual server in php
use this public function loadfile($fl) { $mime = 'application/force-download'; header('Pragma: public'); // required header('Expires: 0'); // no cache header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private',false); header('Content-Type: '.$mime); header('Content-Disposition: attachment; filename="'.basename($fl).'"'); header('Content-Transfer-Encoding: binary'); header('Connection: close'); readfile($fl); // push it out exit(); }

Categories : PHP

Using the full jQuery code in a webpage.
You'll normally load something like this if you're using a CDN: http://code.jquery.com/jquery-1.7.2.min.js just remove the .min or you can download the full source (unminified/uncompressed) here: http://jquery.com/download/ To be honest though, if you're getting an error that's leading you to jQuery, the error is with your code, not jQuery.

Categories : Javascript

Best way to scrape source code from a webpage?
I'd consider the HtmlAgilityPack. You can easily download a page like this: HtmlDocument document = new HtmlDocument(); document.LoadHtml(new WebClient().DownloadString("http://www.bing.com")); If you are looking for a good parser, as well, I've had good experience with ScrapySharp which adds extension methods to HtmlAgilityPack's HtmlDocument to easily select elements on the page using CssSelectors like you'd find in jQuery, like this: document.DocumentNode.CssSelect(".sessions .main-head-row td.download a.text-pdf")

Categories : C#

VBA Code Should not Proceed Further Until Webpage is launched
You could use Application.Wait in place of DoEvents. Do While IeNav.readyState <> READYSTATE_COMPLETE Application.Wait Now + TimeValue("0:00:01") Loop If you do go ahead and use Application.Wait you may wish check the remarks on MSDN regarding it as it may disable some usage for the time it is running.

Categories : Vba

I want to add certain effects into my webpage, for which I am unable to get my code correct
Tidying the monster line into .promise().then().then()... form, I get : $(document).ready(function() { $("a.transition").click(function(event){ event.preventDefault(); $("#titlesonly").fadeOut("slow").promise(function() { return $("#lineandbutton").animate({right:'289px'}, "slow").promise(); }).then(function() { return $("#iwabutton").animate({bottom: '-=100px'}, "slow").promise(); }).then(function() { return $("#iwanimate").animate({height:'55px', width:'55px'}).promise(); }); var linkLocation = this.href; $("body").fadeOut("slow", function() { window.location = linkLocation; }); }); }); You've now got got a managable chain, which avoids a pyramid of doom. However, I

Categories : Jquery

Can't correctly lanuch JS code on webpage - VBA script
The following code worked for me for programatically click 'Message 1'. When testing be carefull to enable script execution. Private Const URL As String = "C:/Temp/HTML/HTMLPage1.html" Sub test() Dim Browser As InternetExplorer Dim Document As HTMLDocument Set Browser = New InternetExplorer Browser.Visible = True Browser.navigate URL Do While Browser.Busy And Not Browser.readyState = READYSTATE_COMPLETE DoEvents Loop Set Document = Browser.Document Dim tds As IHTMLElementCollection Dim anchors As IHTMLElementCollection Dim tdElement As IHTMLElement Dim anchorElement As IHTMLElement Set tds = Document.getElementsByClassName("sc") For Each tdElement In tds

Categories : Javascript

how to style embedded code, displayed on a webpage
You should really provide some code rather than asking a random question. But as the answer is so simple try this plugin, don't reinvent a very complex wheel! https://github.com/AndiDittrich/EnlighterJS/

Categories : PHP

trying to write code to check source of webpage for certain metrics
There are web site parsing libraries out there. I used JSoup (at http://jsoup.org/) for Java to parse the IBM information center and was successful. There are examples for table parsing everywhere, like at how to parse a table from HTML using jsoup. Since the question is about parsing HTML in PHP: I personally never used such a PHP library. However How do you parse and process HTML/XML in PHP? may help.

Categories : HTML

Using strcmp() in my cgi code, for an html webpage, is causing a server error
I think you should be checking subtoken == NULL, not strcmp(subtoken, "") == 0. "" is a string containing a NUL byte, then another NUL (the terminator), so the standard library's string functions will just see an empty string. That's different to a NULL pointer (i.e. a pointer with value zero). From STRTOK(3): Each call to strtok() returns a pointer to a null-terminated string containing the next token. This string does not include the delimiting byte. If no more tokens are found, strtok() returns NULL.

Categories : HTML

Bring value from one webpage to another webpage in Ruby on Rails website without database
OK, after a night of research, I was able to pull together a few different sources that helped me get an answer to this one. The most helpful answers were here: pass parameter by link_to ruby on rails and Pass Variable between Views in Rails I learned how to use link_to to pass the parameters from one view to another view (one webpage to another, to a user). Here is how I did it: newmaps.html.erb <%= link_to 'Edit', maptry_path(:newsavedmap_id => newsavedmap.id) %> The above code uses the anchor text "Edit" and links the user to the maptry.html.erb view. It also brings over the newsavedmap_id. Then, I updated the maptry_controller maptry_controller.rb @newsavedmap = Newsavedmap.find(params[:newsavedmap_id]) With this in place, I can add any of the information from

Categories : Mysql

Directing to a webpage after comparing a input variable in perl webpage
You are looking for the redirect header CGI.pm: Generating a Redirection Header To elaborate, once you've computed the next URL, you add a redirect header to tell the browser to go there. There are two ways. The first way is to call redirect($new_url). The second is to call header('Location', $new_url). I've found that sometimes, the redirect() method doesn't work for me, and I have to resort to the header() method. But that may have been my old, old version of CGI.pm. The other thing to remember, is that neither of those methods end your request processing. They simply add a header to the response's header list. It's up to you to exit correctly from your script.

Categories : Forms

Unicode signs shown on development page, but not on actual page with same code
Try putting this in your <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> Also, try changing the de-DE in the <html> tag to <html lang="de" prefix="og: http://ogp.me/ns#"> let me know if that works

Categories : CSS

Writing junits in Test Driven Development before writing actual code?
That's partly right. Using an IDE (Eclipse, IntelliJ) you can create a test. In that test invoke a method (that does not exist) and using a refactoring tool create a method with the proper signature. That's a trick that makes working with TDD easier and more fun. According to Now i will write junit test case where i will check the size as 0. Is this Right? you should write a test that fails, and the provide proper implementation.

Categories : Java

How to ensure a webpage's content extends to the bottom of a webpage using only CSS
Notice you specify header height in pixels and everything else in %'s also note the excess is exactly 155px over the page. The header was pushing everything downwards because you told content to take room already taken by the header new css: html, body, div, header { box-sizing:border-box; } html, body { .... height:100%; .... } #wrapper { height:100%; .... } header { height: 20%; width: 100%; .... /*Top Gradient Defined*/ ..... } #content { ..... height:80%; .... } Here's a jsFiddle example

Categories : HTML

Element Tree : Can't build root tree when getting XML from webpage
You need to parse the response body, not the response object: root = ET.fromstring(XML.content) # no .getroot() call required or pass in a file object: XML = requests.get(url, stream=True) tree = ET.parse(XML.raw) root = tree.getroot() The latter could fail if the stream is compressed; the raw file object does not decompress this for you.

Categories : Python

Downloaded webpage looks different than the original webpage
This occurs because your scraped version doesn't include the Cascading Style Sheets (CSS) linked to by the page. It also won't include any images or javascript linked to either. If you want to obtain the linked files, you'll have to parse the source code you scrape for them.

Categories : Python

Trying to fetch data from webpage with a VBA code, but sometimes it works and sometimes it does not fetch
Here you go. Example Type of Job : Accountant zipcode :94551 Sub GetData() Dim eRow As Long Dim html As Object, ele As Object, xmlHttp As Object Dim URL As String, myjobtype As String, myzip As String Set sht = Sheets("Sheet1") RowCount = 1 sht.Range("A" & RowCount) = "Title" sht.Range("B" & RowCount) = "Company" sht.Range("C" & RowCount) = "Location" sht.Range("D" & RowCount) = "Description" eRow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row myjobtype = InputBox("Enter type of job eg. sales, administration") myzip = InputBox("Enter zipcode of area where you wish to work") Set xmlHttp = CreateObject("MSXML2.XMLHTTP") URL = "http://jobs.com/search?where=" & myzip & "&q=" & myjobtype

Categories : Excel

wget with GET parameters?
There is no GET parameters in there, just a path. X-Auth-Token is a custom header. Try: wget -d --header="X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb" http://ipadress/get/v1/AUTH_test/test/test.jpg

Categories : Linux

file_get_contents (and wget) very slow
It's due to how Google parses robots. You need to spoof the User-Agent headers to pretend to be a computer. Some info on how to go about this would be here: https://duckduckgo.com/?q=php%20curl%20spoof%20user%20agent

Categories : PHP

Post request with Wget?
man wget says: Only one of --post-data and --post-file should be specified. The full paragraph is: --post-data=string --post-file=file Use POST as the method for all HTTP requests and send the specified data in the request body. --post-data sends string as data, whereas --post-file sends the contents of file. Other than that, they work in exactly the same way. In particular, they both expect content of the form "key1=value1&key2=value2", with percent-encoding for special characters; the only difference is that one expects its content as a command-line parameter and the other accepts its content from a file. In particular, --post-file is not for transmitting files as for

Categories : Linux

wget on behalf of a web user
The short answer is no. The long answer is that it's probably possible, but enormously impractical for the following reasons: Server would need to spoof TCP packets, which it shouldn't be able to. All hops between server and third party would have to accept spoofed traffic, which they shouldn't. Client routers/firewalls would have to accept unsolicited TCP responses, which they won't. Establishing the TCP connection like that would require forwarding all sorts of hairy data from the client to the server, which is a highly platform and network dependent process. In order to authenticate to the third party, you'd have to send your credentials through the process, which is an awful idea. Accepting unsolicited requests in this manner would make you extremely vulnerable to denial of service

Categories : Javascript

MAC OSX LION: gcc on mac not compiling wget
Honestly, even though it appears that gcc exists; but does it point to a valid install? It still sounds like it is not installed properly and with an upgrade to Mountain Lion, all your open source tools have been scrubbed away and pushed to Xcode and must be manually installed if necessary.

Categories : C++

linux wget not certified?
Follow the instructions: To connect to dl.dropboxusercontent.com insecurely, use `--no-check-certificate'. Run: wget --no-check-certificate https://dl.dropboxusercontent.com/u/60455970/litecoin-0.6.3c-linux.tar.gz it worked for me just fine!

Categories : Linux



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.