I tried to get the site information  with the command file_get_contents. But my output is meaningless?  Output results are as follows     �\�-]���[sי�{?U�z������A9;Nƻ�W�/{�R)HB$b��e9I�XJ������ŶF��D�����%�yW�8w7A�����ի�z�{>\����N��a]��4��F�ݭ��F�Yߪ^�q���޽\�._����/����\&lt;�����K�q����t�X��3����������ꥰ��ݝN㰷�q��}�n���v������W�^o��������K�vv[V�׭�v�;��+�   Used command:  &lt;?php  $data = file_get_contents('http://www.tsetmc.com/Loader.aspx?ParTree=15');  echo $data;  ?&gt;
326
I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.  Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL, and PHP to do this — is there some standard checklist I can follow, or perhaps troubleshoot where the mismatches occur?  This is for a new Linux server, running MySQL 5, PHP, 5 and Apache 2.
91306
I hope someone is able to help me. The problem is the following one: 1)I have module in which a assign the variable in order to send to the template file php.tpl  &lt;?php ... $testvar="Hello from alex!"; $variables['testvar'] = $testvar;  ... ?&gt;   This variable can be shown in the php.tpl file like   &lt;?php print $testvar?&gt;   2)I have separated .js file How can i get access to this varuiable inside .js file?  I know how it'll be if .js file is inside .php.tpl:  &lt;?php $testvar="Hello from alex!"; ?&gt; &lt;script type="text/javascript"&gt; var myVar = '&lt;?php print $testvar?&gt;'; &lt;/script&gt;   The problem is how to do the same if these two files .js and .php.tpl are separated?
69958
I am reading through a directory with some pictures and such using a pretty simple implementation of readdir() like the following:  if ($handle = opendir($path)) {     while (false !== ($szFilename = readdir($handle))) {     if ($szFilename[0] !== '.') {         if (is_file($path.$szFilename)) {                 // do stuff             }         }      }  }   The problem that I am having is that the files are not being read in alphabetical order as the docs for readdir() state:     Returns the filename of the next file   from the directory. The filenames are   returned in the order in which they   are stored by the filesystem.   Another weird thing is that, on the local testing server, the same code works great.  This is running on a server using the LAMP stack in both cases.  I know that I can build an array and just sort it, but I was wondering if I was missing something in what I was doing.
10360
There is a file named RESULTS.txt and I want to open this file in my terminal. (I mean I want to see the file contents be displayed in the terminal and not in some text editor)   How do I do that ?
123297
I have the following code  &lt;?php if ($handle = opendir('C:/xampp/htdocs/movies')) {     while (false !== ($file = readdir($handle))) {         if ($file != "." &amp;&amp; $file != "..") {             echo $file."&lt;br /&gt;\n";         }     }     closedir($handle); } ?&gt;   When it does have mb language such as japanese, it doesn't display properly instead it display like kyuukyoku Choujin R ?????~? rather then kyuukyoku Choujin R 究極超人あ～る  Anyway to make it display the correct name or make it still download-able by others?  Thanks for helping me :)
86881
Where should I be extracting the  module, sites/all/modules or sites/all/libraries?
107999
In the /etc/passwd file on my system, the "comment" field, field 5, is inconsistent in its contents.  I thought that I could extract it to get the full name of the user.  fullname=`awk -F: '$1 == name {print $5}' name=$LOGNAME /etc/passwd`   However this returns with $fullname containing a name with 0, 3, or 4 commas following.  Exploring the man page (man 5 passwd) provides no details of this field other than describing it as "user name or comment field."  Perhaps there is additional information that is stored along with the user name?
51902
In Windows 7, when I start the Command prompt, is there any command to display the contents of an environment variable (such as the JAVA_HOME or PATH variables)?  I have tried with echo $PATH, echo PATH and $PATH but none of these work.
66718
I have a Git repository and I'd like to see how some files looked a few months ago. I found the revision at that date; it's 27cf8e84bb88e24ae4b4b3df2b77aab91a3735d8. I need to see what one file looks like, and also save it as a ("new") file.  I managed to see the file using gitk, but it doesn't have an option to save it. I tried with command-line tools, the closest I got was:  git-show 27cf8e84bb88e24ae4b4b3df2b77aab91a3735d8 my_file.txt   However, this command shows a diff, and not the file contents. I know I can later use something like PAGER=cat and redirect output to a file, but I don't know how to get to the actual file content.  Basically, I'm looking for something like svn cat.
85719
I want to output a file's contents while they change, for example if I have the file foobar and I do:  magic_command foobar  The current terminal should display the file's contents and wait until, I don't know, I press ^C.  Then if from another terminal I do:  echo asdf &gt;&gt; foobar  The first terminal should display the newly added line in addition to the original file contents (of course, given that I didn't press ^C).
100638
As a simple example, I have a bunch of source code files. I want to store the "head" command output to a variable for all these files.  I tried:  output=$(head $file)   but what happened is that this automatically trimmed all \n characters when storing the output to a variable.  How do I store the command output as is without removing \n characters?
113295
I am trying the contents of an array into a file with each element of the array in a new line in the file.  IFS=$'\n'    echo "${mtches[@]}" &gt; sample1.txt     The content of mtches is "qwe" and " asd". But the sample1.txt file contains qwe asd in a single line. Why is it not taking IFS value into the picture?
46255
I have a command that I run in a folder that outputs MD5 hashes and filenames on the terminal:  ls |sort -nr | xargs md5sum   I need this output in a text file that I can download and compare to another folder on another customer's machine. How can I modify the command such that its output is stored in a file in say /tmp? I'm using Redhat 5.
38739
I am new to Python and it seems to have a lot of nice functions that I don't know about. What function can I use to get the root site name? For example, how would I get faqs.org if I gave the function the URL ""?
79722
My goal is to output an html source into a file, I'm using w3m to browse the web from terminal.  When using the following command on terminal: w3m &lt;url&gt; -dump the program displays the web site in a non interactive way, but no its html source.  If you open a web site with w3m &lt;url&gt;, the terminal will display the site and if you press v, then the program will display the html source, I tried to script this but with no success. I thought the command line argument -dump_source would help me, but the only thing I got is a non-human reading content, I don't know what -dump_source was supposed to return  Here is what I tried so far:   Use -T text/html with -dump on terminal but the output didn't changed Use -T text/plain with -dump_source on terminal hoping that the non-human output would be converted to a plain text, but no success (I didn't understand what -T is used for, even after reading w3m manual by typing man w3m on terminal) Knowing that pressing v while w3m is displaying a web site switch from web page content to html source code, I tried to use gdb to attach it to the w3m process and redirect its stdin and stdout to my files (input.txt, output.txt) which input.txt contains a single v, but I had no success. Doing this on my test program worked as expected. I followed what was described . If I write ls -l /proc/&lt;w3m_pid&gt;/fd, where w3m_pid is my w3m process id which I got by using ps ax on terminal, I can see there is 3 file descriptors, if I try to redirect the third one, the program crashes and displays: Error occured: errorno=25 Redirecting the standard I/O with w3m &lt;url&gt; &lt; input.txt &gt; output.txt also did not worked W3M uses keybinding to navigate on the web, it means that if you press v there is no need to hit enter, the terminal is not buffering the input, using gdb attached to the w3m process I tried to remove it by using p system ("/bin/stty cooked"), but the w3m keybind did not changed.   My question is: why redirecting I/O with gdb is not working and what I can do to get html source code? w3m have an option to output html source code that I'm missing or I would have to use another program?  PS: I need html source code for a university homework, with html source code I can create a script to browse the web and output the page into a file, than I'm supposed to use those outputs with flex to extract statics information about things on the web, like: how many the word stack appears in questions about the c language? This is my idea.  Any suggestions would be appreciated.  W3M version: 0.5.3+debian-15  GDB version: 7.7.1   Ubuntu version: 14.04  Thanks in advance!
83659
I have a site which is running under SharePoint 2013. Via REST I am trying to retrieve the file and folder directory for that site. There are several similar questions on this site related to recursively retrieving all of the files and folders for a given a folder:       The answers provided therein led me to the following URI:     /_api/web/Lists/GetByTitle('Documents')/Items?$expand=Folder&amp;$select=Title,FileLeafRef,Folder/ServerRelativeUrl   Which from what I can tell does retrieve all of the files and folders from the given starting path.  However, I am missing something. When reading through the returned XML I cannot figure out where a given file goes. Meaning that I have info on how to retrieve file bros.pdf, but cannot determine that it is in the documents/super/mario/ folder.  For the file items I've tried to retrieve the ServerRelativeUrl property, but have not succeeded though the folders seem to. Is there some identifier in the XML that I am missing? When doing a recursive RESTful query how do I determine where a given file belongs?
96991
This is very odd. I'm working on a VF page and none of the $Site fields are returning anything -- not even whitespace or an error. I've tried it with about half of the $Site fields.  For example, this just renders a blank page (except for the standard header and sidebar):  &lt;apex:page&gt; {!$Site.BaseUrl} &lt;/apex:page&gt;   Other global variables, like $Organization and $User, seem to be working fine. Is there something I'm missing?