Search Results

Search found 6 results on 1 pages for 'hakre'.

Page 1/1 | 1 

  • How to tell the Browser the character encoding of a HTML website regardless of Server Content.-Type Headers?

    - by hakre
    I have a HTML page that correctly (the encoding of the physical on disk matches it) announces it's Content-Type: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content= "text/html; charset=utf-8"> <title> ... Opening the file from disk in browser (Google Chrome, Firefox) works fine. Requesting it via HTTP, the webserver sends a different Content-Type header: $ curl -I http:/example.com/file.html HTTP/1.1 200 OK Date: Fri, 19 Oct 2012 10:57:13 GMT ... Content-Type: text/html; charset=ISO-8859-1 (see last line). The browser then uses ISO-8859-1 to display which is an unwanted result. Is there a common way to override the server headers send to the browser from within the HTML document?

    Read the article

  • Command to execute another command while replaying the command on STDOUT

    - by hakre
    It's not easy to formulate the question properly, maybe it helps when I describe what I'd like to do. I want to execute a command and pipe it's output into a tool called pastebinit which uploads the STDOUT output to pastebin. That works very well, however I would like to send the command itself on top of it but w/o typing it a second time. Is there some command I can launch "my command" with that will Print "my command" on STDOUT Executes "my command" I have the feeling that something like that exists but as hard as it is to formulate such a question properly, I was not able to dig it up with google so far.

    Read the article

  • How to set Laptop Brightness in Gnome and /proc on Thinkpad W510?

    - by hakre
    I can set the brightness of my laptop screen already via /proc. I can read and change the value. Now I've set the value to 33 and then I went into gnome power management and enabled the option that it should reduce the backlight brightness being on battery. That works, the screen gets darker. If I now read out the current setting from /proc it still says it's 33. So I assume that there is another node in /proc to be used to control the brightness. The node I use so far is: /proc/acpi/video/VID/LCD0/brightness I'm using the nouveau driver. With the nvida driver the brightness can not be controlled.

    Read the article

  • Laptop Brightness in Gnome and /proc - Thinkpad W510

    - by hakre
    I can set the brightness of my laptop screen already via /proc. I can read and change the value. Now I've set the value to 33 and then I went into gnome power management and enabled the option that it should reduce the backlight brightness being on battery. That works, the screen gets darker. If I now read out the current setting from /proc it still says it's 33. So I assume that there is another node in /proc to be used to control the brightness. The node I use so far is: /proc/acpi/video/VID/LCD0/brightness

    Read the article

  • Reference - What does this error mean in PHP?

    - by hakre
    On Stackoverflow you can see a lot of questions popping up about errors. Some users do not even know that error messages exists, others are asking about code that gives an error message but they do not understand the error message. If the error message is common, many questions about the same kind of error appears, but it is hard to find existing Q&A about the topic. Please add "your favorite" error message, one per answer, a short description what it means (even if it is only highlighting terms to their manual page) and a listing of existing Q&A that are of value. This will create a list. The question is a community wiki, so you are not answering for reputation but for creating a reference list for new users. It's based on error messages. Compare with the existing Reference - What does this symbol mean in PHP? question, which works pretty well. What are common errors in PHP and what are their Solutions. Index of Errors Just starting, but there are already some: Warning: Cannot modify header information - headers already sent Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in ... on line Parse error: syntax error, unexpected T_XXX in YYY on line ZZZ Fatal Error: Call to a member function ... on a non-object

    Read the article

  • How to get all captures of subgroup matches with preg_match_all()?

    - by hakre
    Update/Note: I think what I'm probably looking for is to get the captures of a group in PHP. Referenced: PCRE regular expressions using named pattern subroutines. (Read carefully:) I have a string that contains a variable number of segments (simplified): $subject = 'AA BB DD '; // could be 'AA BB DD CC EE ' as well I would like now to match the segments and return them via the matches array: $pattern = '/^(([a-z]+) )+$/i'; $result = preg_match_all($pattern, $subject, $matches); This will only return the last match for the capture group 2: DD. Is there a way that I can retrieve all subpattern captures (AA, BB, DD) with one regex execution? Isn't preg_match_all suitable for this? This question is a generalization. Both the $subject and $pattern are simplified. Naturally with such the general list of AA, BB, .. is much more easy to extract with other functions (e.g. explode) or with a variation of the $pattern. But I'm specifically asking how to return all of the subgroup matches with the preg_...-family of functions. For a real life case imagine you have multiple (nested) level of a variant amount of subpattern matches. Example This is an example in pseudo code to describe a bit of the background. Imagine the following: Regular definitions of tokens: CHARS := [a-z]+ PUNCT := [.,!?] WS := [ ] $subject get's tokenized based on these. The tokenization is stored inside an array of tokens (type, offset, ...). That array is then transformed into a string, containing one character per token: CHARS -> "c" PUNCT -> "p" WS -> "s" So that it's now possible to run regular expressions based on tokens (and not character classes etc.) on the token stream string index. E.g. regex: (cs)?cp to express one or more group of chars followed by a punctuation. As I now can express self-defined tokens as regex, the next step was to build the grammar. This is only an example, this is sort of ABNF style: words = word | (word space)+ word word = CHARS+ space = WS punctuation = PUNCT If I now compile the grammar for words into a (token) regex I would like to have naturally all subgroup matches of each word. words = (CHARS+) | ( (CHARS+) WS )+ (CHARS+) # words resolved to tokens words = (c+)|((c+)s)+c+ # words resolved to regex I could code until this point. Then I ran into the problem that the sub-group matches did only contain their last match. So I have the option to either create an automata for the grammar on my own (which I would like to prevent to keep the grammar expressions generic) or to somewhat make preg_match working for me somehow so I can spare that. That's basically all. Probably now it's understandable why I simplified the question. Related: pcrepattern man page Get repeated matches with preg_match_all()

    Read the article

1