output

get meta description , title and image from url like facebook link sharing

谁都会走 提交于 2019-12-19 02:05:16
问题 my code is function getTitle($Url){ $str = file_get_contents($Url); if(strlen($str)>0){ preg_match("/\<title\>(.*)\<\/title\>/",$str,$title); return $title[1]; } else { return false; } } function getMetas($Url){ $str = file_get_contents($Url); if(strlen($str)>0){ // preg_match("/\<title\>(.*)\<\/title\>/",$str,$title); preg_match("/<meta name=\"description\" content=\"(.*?)\"/",$str,$title); // preg_match( '<meta name="description".*content="([^"]+)">siU', $str, $title); return $title[1]; }

Python: How to read stdout of subprocess in a nonblocking way

微笑、不失礼 提交于 2019-12-18 16:51:34
问题 I am trying to make a simple python script that starts a subprocess and monitors its standard output. Here is a snippet from the code: process = subprocess.Popen([path_to_exe, os.path.join(temp_dir,temp_file)], stdout=subprocess.PIPE) while True: output=process.stdout.readline() print "test" The problem is that the script hangs on output=process.stdout.readline() and that the line print "test" only executes after the subprocess is terminated. Is there a way to read standard output and print

How to use R's sprintf to create fixed width strings with fill whitespace at the END?

吃可爱长大的小学妹 提交于 2019-12-18 12:49:33
问题 I have vector of strings and want to create a fixed with string out of that. Shorter strings should be filled up with white spaces. E.g.: c("fjdlksa01dada","rau","sjklf") sprintf("%8s") # returns [1] "fjdlksa01dada" " rau" " sjklf" But how can I get the additional whitespace at the END of the string? Note that I heard of write.fwf from the gdata package which is really nice but doesn't help much in this case, because I need to write a very specific non-standard format for an outdated old

How to know query generated by Fluent NHibernate

大兔子大兔子 提交于 2019-12-18 12:14:09
问题 I am using linq to Nhibernate to fire some select query to data base. My question is, how do I know, the query generated by Fluent NHibernate? 回答1: If you want the SQL to be in log4net, make sure you set the logger in your configuration section. I put the NHibernate package at "INFO" to reduce the noise and the NHibernate.SQL to all so I can log all SQL statements. <logger name="NHibernate"> <level value="INFO" /> </logger> <logger name="NHibernate.SQL"> <level value="ALL" /> </logger> 回答2:

How can I see normal print output created during pytest run?

China☆狼群 提交于 2019-12-18 09:58:26
问题 Sometimes I want to just insert some print statements in my code, and see what gets printed out when I exercise it. My usual way to "exercise" it is with existing pytest tests. But when I run these, I don't seem able to see any standard output (at least from within PyCharm, my IDE). Is there a simple way to see standard output during a pytest run? 回答1: The -s switch disables per-test capturing. 回答2: In an upvoted comment to the accepted answer, Joe asks: Is there any way to print to the

Mercurial Hg No changes found - can't Hg push out

眉间皱痕 提交于 2019-12-18 09:27:24
问题 Can someone pls advise why I'm getting NO CHANGES found at the end. Also, I'm getting an annoying message, " Username not specified in .hg/hgrc. Keyring will not be used. " Version tool: Hg latest version Server: Linux Workspace: ~/2012WS LinuxServer123:~/2012WS # hg clone http://LinuxServer123/hg/GigaTest/ Username not specified in .hg/hgrc. Keyring will not be used. http authorization required realm: Mercurial Repositories user: u123456 password: destination directory: GigaTest requesting

Formatting issues / missing data when multiple commands use Select-Object within a script

佐手、 提交于 2019-12-18 07:25:29
问题 I've run into a problem with my PowerShell scripts where I am "losing" output that was going to the console, or being redirected. After much legwork, I simplified it down to an easily documented example of the problem. Place the following single line in a script (test1.ps1), and invoke it from a basic PowerShell command window: Get-WmiObject win32_share | select name, path and you will likely get two columns of output similar to the following: PS C:\Users\me\temp> ./test1.ps1 name path ---- -

Formatting issues / missing data when multiple commands use Select-Object within a script

荒凉一梦 提交于 2019-12-18 07:25:12
问题 I've run into a problem with my PowerShell scripts where I am "losing" output that was going to the console, or being redirected. After much legwork, I simplified it down to an easily documented example of the problem. Place the following single line in a script (test1.ps1), and invoke it from a basic PowerShell command window: Get-WmiObject win32_share | select name, path and you will likely get two columns of output similar to the following: PS C:\Users\me\temp> ./test1.ps1 name path ---- -

Fortran 90 how to write very long output lines of different length

↘锁芯ラ 提交于 2019-12-18 06:57:27
问题 I've spent hours scouring the internet for a solution to this problem and can't find anything. I have been trying to write unformatted output to a CSV output file with multiple very long lines of varying length and multiple data types. I'm trying to first write a long header that indicates the variables that will be written below, separated by commas. Then on the lines below that, I am writing the values specified in the header. However, with sequential access, the long output lines are

Weka Predictions to CSV

风格不统一 提交于 2019-12-18 05:48:06
问题 I've trained a classifier in Weka, and I'm able to use it on test data. Additionally, I can opt to display the classifier's predictions in the log window for this test data. However, for my current project, it would be convenient for me to be able to get this data in CSV format. Is this possible in Weka ? Is it only possible when using the command line (something I'll eventually move towards) ? I could always save the entire buffer result to a text file, but in that case, I would have to