read by other session问题

read by other session请问各位都有什么看法和解决的方法



  (1)环境:RedHat 5.1+Oracle10.2.0.4 RAC(两节点)




Top 5 Timed Events Avg %Total
~~~~~~~~~~~~~~~~~~ wait Call
~~~~~~~~~~~~~~~~~~ wait Call
Event Waits Time (s) (ms) Time Wait Class
Event Waits Time (s) (ms) Time Wait Class

gc buffer busy 2,346,848 24,567 10 33.2 Cluster
gc buffer busy 2,346,848 24,567 10 33.2 Cluster
read by other session 1,941,773 18,734 10 25.3 User I/O
read by other session 1,941,773 18,734 10 25.3 User I/O
db file scattered read 673,646 10,209 15 13.8 User I/O
db file scattered read 673,646 10,209 15 13.8 User I/O
CPU time 6,627 9.0
CPU time 6,627 9.0
log file sync 129,112 4,068 32 5.5 Commit
log file sync 129,112 4,068 32 5.5 Commit

  从top 5 event来看,主要是read类型的event比较多

  db file sequential read 顺序读导致

  gc buffer busy 产生的根本原因是Oracle 的cache fusion机制,简单来说cache fusion的主要目的



  如果存在大量的cache交换就会产生gc buffer busy

  3、read by other session

  When information is requested from the database, Oracle will first read the data from disk into the database buffer cache.

  If two or more sessions request the same information, the first session will read the data into the buffer cache while other sessions wait.

  In previous versions, this wait was classified under the "buffer busy waits" event.

  However, in Oracle 10.1 and higher, this wait time is now broken out into the "read by other session" wait event.

  Excessive waits for this event are typically due to several processes repeatedly reading the same blocks,

  e.g. many sessions scanning the same index or performing full table scans on the same table.

  Tuning this issue is a matter of finding and eliminating this contention.

  该event是10.1以后新引入的,之前归类于buffer busy waits,Oracle对event的划分越来越细,



  SELECT p1 "file#", p2 "block#", p3 "class#"
  FROM v$session_wait
  WHERE event = 'read by other session';


  SQL> SELECT relative_fno, owner, segment_name, segment_type
  FROM dba_extents
  WHERE file_id = &file
  AND &block BETWEEN block_id AND block_id + blocks - 1

  查看Top Sql 发现如下比较可疑,单次执行要花费20多分钟,

  查看表的索引无异常,查看执行计划是index range scan,貌似没有问题




  SQL ordered by Elapsed Time DB/Inst: BILLBJ/billbj1 Snaps: 15955-15956
  -> Resources reported for PL/SQL code includes the resources used by all SQL
  statements called by the code.
  -> % Total DB Time is the Elapsed Time of the SQL statement divided
  into the Total Database Time multiplied by 100
  Elapsed CPU Elap per % Total
  Time (s) Time (s) Executions Exec (s) DB Time SQL Id
  ---------- ---------- ------------ ---------- ------- -------------
  10,435 709 8 1304.3 66.8 5uc64k11j23wx
  Module: JDBC Thin Client
  select day,sum( data,sum(a.indata) indata from bandwidth_d
  ailytable a where between :v_start_date and :v_end_date and a.channelId
  in (select * from the (select cast(:v_channelId as channelIdArray) from dual))
  and a.nodeId in (select * from the (select cast(:v_nodeId as nodeIdArray) from d

  有时候产生同一个问题的几个原因可能是相悖的,比如read by other session,所以我们不能局限于某一个方面,此案例中db file sequential read wait也说明顺序读等待过多,最后的解决方法也说明查询未必适用索引就好。

  其实read by other session等待事件是要解决热点块问题,而解决热点块问题首先要减低IO次数,我们来看看IO情况:

~~~~~~~~~~~~ Per Second Per Transaction
~~~~~~~~~~~~ Per Second Per Transaction
--------------- ---------------
--------------- ---------------
Redo size: 28,546.06 881.39
Redo size: 28,546.06 881.39
Logical reads: 37,292.67 1,151.45
Logical reads: 37,292.67 1,151.45
Block changes: 151.32 4.67
Block changes: 151.32 4.67
Physical reads: 2,872.88 88.70
Physical reads: 2,872.88 88.70
Physical writes: 2.64 0.08
Physical writes: 2.64 0.08
User calls: 114.65 3.54
User calls: 114.65 3.54
Parses: 60.26 1.86
Parses: 60.26 1.86
Hard parses: 28.64 0.88
Hard parses: 28.64 0.88
Sorts: 15.86 0.49
Sorts: 15.86 0.49
Logons: 0.42 0.01
Logons: 0.42 0.01
Executes: 106.84 3.30
Executes: 106.84 3.30
Transactions: 32.39
Transactions: 32.39

  很明显逻辑读比较多,另外等待事件cr request retry也是造成性能差的一个原因。我们可以通过分割应用,对大表分区等方法进行系统优化。[/code]



Csdn user default icon
关于read by other session跟cr request retry的问题

今天有个同事说有张表通过索引可以查出指定的数据,如果走全表扫描等上非常久也跑不出数据,加rownum<3这样的也出不来,我去看了后台的$session_wait,event事件是read by other session,看到这种情况后,我去另外一台(两台RAC的)看了一下,另外一台关于这张表的等待事件是cr request retry,这个是什么问题,我无从入手,第一次碰到,请教有经验的大哥、大姐们一下。谢谢


<div class="post-text" itemprop="text"> <p>After scouring the internet for information about Transactional Isolation levels, I understood that Row Locking in MySQL can be achieved by using either <code>SELECT...FOR UPDATE</code> or <code>LOCK IN SHARE MODE</code> and also that, a row locking query must execute after starting the transaction. So I came across some example illustrating the implementation of READ COMMITTED isolation level for two sessions like this:</p> <pre><code>--session 1 SET TRANSACTION ISOLATION LEVEL READ COMMITTED; BEGIN TRANSACTION; SELECT FirstName FROM EmployeeInfo WHERE EmpID = 1; WAITFOR DELAY '00:00:05' SELECT FirstName FROM EmployeeInfo WHERE EmpID = 1; ROLLBACK TRANSACTION; </code></pre> <p>The code for session 2 is like so:</p> <pre><code> --session 2 UPDATE EmployeeInfo SET FirstName = 'Frank' WHERE EmpID = 1; </code></pre> <p>In the code sample for session1, the <strong>transaction Isolation level</strong> and the <strong>beginning</strong> of a transaction are explicit. In a certain blog I read that </p> <ul> <li>UPDATE statements implicitly create READ locks on affected rows in a transaction. So does this means that I can safely omit <code>SET TRANSACTION ISOLATION LEVEL READ COMMITTED;</code> from session 1 and still get the same results.In other words how true is the statement <strong>UPDATE statements implicitly create READ locks on affected rows in a transaction.</strong></li> </ul> </div>


<div class="post-text" itemprop="text"> <p>I want to use a captcha generator witch works like this:</p> <p>1)Save some security text in the $_SESSION variable 2)Display the captha image.</p> <pre><code>&lt;img src=""&gt; </code></pre> <p>the captcha image is a php file which reads the $_SESSION["security_text"] and generates an image, by setting it-s header to an image:</p> <pre><code>header(&amp;quot;Content-type:image/jpeg&amp;quot;); header(&amp;quot;Content-Disposition:inline ; filename=secure.jpg&amp;quot;); </code></pre> <p>3)compare the submited text to the one stored inside _SESSION</p> <p>The problem: -I set $_SESSION["outside"]="outside"; before the image tag, but inside captcha_source.php the $_SESSION variable is empty.</p> <p>-If I give it session_start() at the beginning of captcha_source.php, the session_id IS THE SAME as for the rest of the site, but _SESSION is still empty.</p> <p>-If I set $_SESSION["inside"]="inside"; inside captcha_source.php, when I read SESSION outside of captcha_source.php (after the img tag), SESSION only includes ["outside"]="outside". (And inside captcha_source, session prints as inside=&gt;inside)</p> <p>-If I remove the line with img src=captcha_source.php, and set SESSION to "test" and write "test" in the form, everything works after submitting (but I don't have the image, because it wasn't included). </p> <p>-If instead of including the file inside the image tag, I include it as include "/captcha/captcha_source.php" it sets the sessions ok, but I need the image, not garbage text.</p> <p>So session works from page to page, but somehow not inside captcha_soruce.php. Even thow the id-s are the same, the sessions seam to be totally independent.</p> <p>One hunch is that the problem is from htaccess (but the identical session id-s are strange), maybe from these lines: (the captcha folder is treated differently, but the base address should be unchanged)</p> <pre><code>RewriteCond $1 !^(index_ro|imagini|extra|fisiere|slider|tinymce|captcha) RewriteRule ^(.*)/ index_ro.php?$1/ </code></pre> <p>Maybe the identical sessions have to do with the way I read the files: remove the header from captcha_source.php and open the file whitch the same browser (firefox). And I see the garbage text and session id and session variables whitch I printed. Openning multiple tabs with the same site, keeps the same id.</p> <p>I hope it's not to long, but it's been 2 days since I strougled with this problem. If it won't work, I'll do this with sql, but I would like to know where the problem is so it won't show up again in other circumstances.</p> <p>Thank you :)</p> <p>and here is a stripped code to show what hapens:</p> <pre><code>//the form part &lt;?php session_start(); echo session_id(); //prints the same as on all pages //the form was not submittted if(!$_POST["mail_form_captcha"]) { unset($_SESSION); //just to be sure nothing remains from older sessions //generate form that has a field "mail_form_captcha" [...] //generate a random text for captcha and put it in security_text InitCaptcha(); $_SESSION["before"]="before"; ?&gt; &lt;img src="&lt;?php echo "./captcha/image.php"; ?&gt;" /&gt; &lt;?php //include "./captcha/image.php"; //if uncoment this line, everything works, but the image is included as garbage text $_SESSION["after"]="after"; print_r($_SESSION); //this prints [security_text] =&gt; 10 [before] =&gt; before [after] =&gt; after } else //interpret the submission { print_r($_SESSION); //this is empty if session_start() is at the beginning of captcha_source.php, otherwise only contains before after and security_text } ?&gt; //the captcha part &lt;?php session_start(); //if included, it erases the session from the other files, otherwise it leaves it intact :-/ $_SESSION["inside"]="inside"; print_r($_SESSION); //this prints [inside] =&gt; inside echo session_id(); //this prints the same session id as on the rest of the pages [...] imagettftext([...] $_SESSION["security_text"]); //this draws a blank image [...] header("Content-type:image/jpeg"); header("Content-Disposition:inline ; filename=secure.jpg"); imagejpeg($img); ?&gt; </code></pre> </div>

如何检查$ _SESSION是否被锁定?

<div class="post-text" itemprop="text"> <p>I've written a CMS with multiple AJAX POST calls to get data.</p> <p>One of which checks if the user is logged in every x seconds by checking if</p> <pre><code>isset($_SESSION['key']) </code></pre> <p>Which works great, but if the $_SESSION is locked, i.e it's in use with another file for an extended period like uploading an image, it will ask the user to log in even if the session is valid (as the AJAX can't access it while in use). </p> <p>I tried using:</p> <pre><code> session_write_close(); </code></pre> <p>on the file upload page to try and release it, but it doesn't seem to help.</p> <p>The "check login" AJAX doesn't even write to the session, but it can't even seem to read it or just check if a variable isset(). </p> <p>Is there a way for my php script to differentiate between a locked session and a non-existant one maybe? Or any other ideas would be ace, thanks! :)</p> </div>

从pthreads访问$ _SESSION变量

<div class="post-text" itemprop="text"> <p>I'm having an issue accessing the session variable from functions called from Thread objects using the pthreads library for PHP.</p> <p>When the function is called from the <strong>main thread</strong>, no errors occur and <strong>everything runs fine</strong>.</p> <p>When run from a Thread object however, I get the following errors:</p> <pre><code>&gt; PHP Notice: Undefined variable: _SESSION &gt; PHP Notice: Undefined index: Properties Manager &gt; PHP Fatal error: Call to a member function getGroupValue() on a non-object </code></pre> <p>The line numbers specified by the errors all point to this code block:</p> <pre><code>function connect_mysql_db($database, $write = false) { $properties = $_SESSION['Properties Manager']; if(!isset($database) || strlen($database)==0){ throw new Exception("No database specified"); } // Read appropriate host, port, dbname, user &amp; pass for this database $host = $properties-&gt;getGroupValue($database, DB_HOST); $port = $properties-&gt;getGroupValue($database, DB_PORT); $db_name = $properties-&gt;getGroupValue($database, DB_NAME); ...Removed unnecessary code... } </code></pre> <p>A little searching says that I should be able to remedy this issue by putting <em>session_start();</em> at the top of my file. After doing this, the other errors are still printed in addition to:</p> <pre><code>&gt; PHP Notice: A session had already been started - ignoring session_start() </code></pre> <p>So my main question: Is there something special that I need to do when using pthreads in order to access the super-global session? Or is there something completely different at play here that I am missing?</p> <p>Edit: Yes, I have tried <em>global $_SESSION;</em> as well.</p> </div>

PHP session.upload_progress在Linux / cPanel / Apache环境中不起作用(在Windows中工作)

<div class="post-text" itemprop="text"> <p>Sorry for yet another question about the session upload_progress freature in PHP, but it has me stumped. I developed a prototype file upload facility on a Windows server and the progress feature worked just fine. But when I moved the prototype to our Linux server, it didn't work. The progress array never appears in the $_SESSION superglobal, though the files transfer without issue.</p> <p>Here is the environment:</p> <ul> <li>Apache version: 2.2</li> <li>PHP version: 5.4.31</li> <li>Server API: Apache 2.0 Handler (not CGI!)</li> </ul> <p>Here are the session variables:</p> <ul> <li>session.upload_progress.cleanup: Off (turned off so I could check $_SESSION after the transfer) </li> <li>session.upload_progress.enabled: On</li> <li>session.upload_progress.freq: 1000</li> <li>session.upload_progress.min_freq: 1</li> <li> PHP_SESSION_UPLOAD_PROGRESS</li> <li>session.upload_progress.prefix: upload_progress_</li> </ul> <p>Here are my core file transfer settings:</p> <ul> <li>post_max_size: 0</li> <li>upload_max_filesize: 0</li> <li>max_input_time: -1</li> <li>max_execution_time: -1</li> <li>output_buffering: 4096</li> </ul> <p>(I set the output_buffering parameter to match the setting on the Windows server where the upload progress worked. Initially, it had "no value" on the Linux server).</p> <p>Here is the HTML that sets up the form:</p> <pre><code>&lt;form name="UploadForm" id="UploadForm" method="post" enctype="multipart/form-data"&gt; &lt;input type="hidden" name="&lt;?php echo ini_get('');?&gt;" id="&lt;?php echo ini_get('');?&gt;" value="1" /&gt; Enter a note to be sent along with your file:&lt;br /&gt; &lt;textarea name="UploadNote" id="UploadNote" rows="5" cols="50"&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt; &lt;div style="border: thin solid black; padding: 10px;"&gt; Choose the file you wish to transfer and then click the "Upload" button. &lt;input type="file" name="UploadFile" id="UploadFile" /&gt; &lt;br /&gt;&lt;br /&gt;&lt;input type="button" id="SubButton" value="Upload" onclick="submit_form('SU')" /&gt; </code></pre> <p>The PHP program to retrieve the uploaded file is launched in a hidden iframe. The status checking program is called every 1.5 seconds via jQuery/Ajax.</p> <p>Like I said, the upload_progress code worked on a Windows server and was moved unchanged to the Linux server. Some of the things I've since checked:</p> <ul> <li>The session integrity is fine. I added my own session variable in the main program (that sets up the form) and was able to retrieve it in the status program and the upload program (running in the iframe). The session IDs are all the same.</li> <li>Nothing outside of my $_SESSION item ever gets added to $_SESSION.</li> <li>Again, the file transfers themselves work fine.</li> <li>Some other SO posts pointed to possible issues involving the buffering of POST data by Apache so PHP only receives the file when it's completely uploaded. Would that cause the upload progress array to never be posted in $_SESSION? I read that mod-security could be interposed in the transfer of POST data. So I temporarily disabled mod-security in my Apache virtual host, but that unfortunately didn't help.</li> </ul> <p>I have to think there is some module that is part of the standard cPanel Apache build that is affecting the operation of the session.upload_progress feature. Does anyone have any suggestions of what to try? Thanks very much.</p> </div>


<div class="post-text" itemprop="text"> <p>I'm use sessions in 2 pages. In the first, page one, I save data to it:</p> <p>page one code :</p> <blockquote> <pre><code>&lt;?php session_start(); $_SESSION['dl']="goooo"; // run page two by use fsockopen ... </code></pre> </blockquote> <p>In page two:</p> <blockquote> <pre><code>&lt;?php session_start(); $_SESSION['dl']="asd"; ... </code></pre> </blockquote> <p>When I read the session in the other page result is "goooo"! Why is "asd" not saved to the session?</p> <p><strong>what is your idea for save 'dl' in multi page???</strong> (post and cookie is not helpfull)</p> </div>


<div class="post-text" itemprop="text"> <p>I have a PHP website that requires users to be registered and logged in. I use PHP sessions to manage the information from logged in users. It has been working great until few months back but I am now having issues with certain users and devices only.</p> <p>The user starts in index.php with the login form. When submitted, there is a control.php page that controls whether the user is registered and gives or denies control. If the user is registered, it goes to menu.php.</p> <p>Now, the problem is that some users, despite entering the right login info, are unable to reach menu.php in their Android devices using Chrome (even if they are able to do it in a PC, also using Chrome, or in other devices).</p> <p>I debugged the session variables and realized that they are fully killed when redirecting from control.php to menu.php. However, as this is only happening to some users in some devices, I understand there is no issue with redirects or others that I read in similar posts.</p> <p>I also saw other cases where the recommendation was to clear cookies and cache in Chrome. I tried with that too and it did not work. The session_id() changes after clearing all information but info is still killed.</p> <p>After reseraching for weeks and trying every possible solution, I am now completely lost. Any recommendations would be more than welcomed.</p> <p>By the way, I am running nginx and PHP 5.5.9</p> <p>Thank you in advance,</p> <p>JR</p> <p>control.php looks like</p> <pre><code>$nick=$_POST['nick']; $pass=md5($_POST['pass']); $q=mysql_fetch_array(mysql_query("select * from ft_managers where (nickmanager='$nick' or email='$nick') and (passmanager='$pass')")); if($q['activado']==1) // Means account is activated { session_start(); $_SESSION['permiso']=1; $_SESSION['nick']=$q['nickmanager']; $_SESSION['username']=$q['nickmanager']; $_SESSION['id']=$q['idmanager']; Header("Location: menu.php"); exit } else { Header("Location: index.php?error=1"); } ?&gt; </code></pre> <p>menu.php looks like</p> <pre><code>&lt;?php session_start(); print_r($_SESSION); echo session_id(); // Rest of the code here, but the print_r already shows no info for certain users and devices. For the same user in a different device, everything works ?&gt; </code></pre> </div>

PHP - session_id()给我HTTP / 1.1 500内部服务器错误

<div class="post-text" itemprop="text"> <p>Running Apache with PHP as FastCGI.</p> <p><strong>serverinfo.php</strong>:</p> <pre><code>if (isset($_GET['session'])) { session_id($_GET['session']); session_start(); die('You got here'); } </code></pre> <p>i won't even get to session_start() because session_id() will hang the "thread". This is the scenario:</p> <p>Page <strong>[serverinfo.php]</strong> shows server info, where you can update info as well. When updating the info, a AJAX call is made to <strong>[update.php]</strong>, when everything is updated <strong>[update.php]</strong> is supposed to return the same data shown in <strong>[serverinfo.php]</strong> just to "refresh" the "page" with the new data, this is done by:</p> <p><strong>update.php</strong>:</p> <pre><code>if($update) { $serverinfo = file_get_contents('' . session_id() . '&amp;name=' . $_GET['name']); print $serverinfo; } </code></pre> <p>The reason why i want to re-use the internal $_SESSION is because i need to access data about the client for a specific session, such as username and other important data. Otherwise serverinfo.php will just give me: "Login!" which it's supposed to do :)</p> <p>I could do: include_once('serverinfo.php'); and pass the $_GET data some how but i'm not quite sure if that would work or be all that efficient :)</p> <p><strong>Accesslog from Apache</strong>:</p> <pre><code> - - [15/Feb/2012:11:03:15 +0100] "GET update.php?source=serverinfo&amp;name=test HTTP/1.1" 500 544 - - [15/Feb/2012:11:03:15 +0100] "GET serverinfo.php?session=&lt;session_id&gt;&amp;name=test HTTP/1.0" 500 544 </code></pre> <p>This simply shows that update.php actually completes it's updates and tries to call serverinfo.php but it fails with Internal Server error.</p> <p><strong>apache error log</strong>:</p> <pre><code>[Wed Feb 15 11:03:55 2012] [warn] [client] mod_fcgid: read timeout from pipe [Wed Feb 15 11:03:55 2012] [error] [client] Premature end of script headers: serverinfo.php </code></pre> <p>And here's the <em>global</em> <strong>error log</strong>:</p> <pre><code>[Wed Feb 15 11:04:04 2012] [warn] mod_fcgid: process 5584 graceful kill fail, sending SIGKILL </code></pre> </div>


<div class="post-text" itemprop="text"> <p>We have an ASP intranet web application that have been developed over years which is running on IIS6. Nowadays, we would like to add some new functionalities using PHP language instead. PHP is running fine on the same server. Sessions variables need to be shared between both ASP and PHP.</p> <p>I am asking if there is other alternatives to share session between classic ASP and PHP instead of using database as gateway (too much resources consuming for us)? Both side need to read/edit session variables.</p> <p>By tweaking a bit, I've noticed that a PHPSESSID and ASPSESSIONID is generated on PHP side every time a user is logged in the ASP web application. These are also visible on the ASP side, which are stored inside the server Variable HTTP_COOKIE, so I think there may be a correlation between ASP session and PHP sessions variables at the heart of IIS.</p> <p>So,</p> <p>-- ASP -- </p> <pre><code>&lt;% Response.write ('HTTP_COOKIE') %&gt; </code></pre> <p>gives:</p> <pre><code>__utma=...; __utmz=...; computer%5Fid=AAA; lan=fre;ASPSESSIONIDXXXXXXXX=BBBBBBBBBBBBBBBBBBBBBBBB; user_login=cccc </code></pre> <p>-- PHP --</p> <pre><code> echo '&lt;pre&gt;'; var_dump($_COOKIE) ?&gt; echo '&lt;/pre&gt;'; </code></pre> <p>gives:</p> <pre><code>Array ( [__utma] =&gt; ... [__utmz] =&gt; ... [computer_id] =&gt; AAA [lan] =&gt; fre [ASPSESSIONIDXXXXXXXX] =&gt; BBBBBBBBBBBBBBBBBBBBBBBB [user_login] =&gt; cccc ) </code></pre> <p>on ASP side, if I write :</p> <pre><code>&lt;% Request.Cookies(strCookie)(strKey) %&gt; </code></pre> <p>in a loop, it gives me bunch list of key/values session cookies stored. </p> <p>But on PHP side, I can't find a way to get these key/value list. May be it is the way to go and find more? A real existing implementation would help more but any answers are welcome.</p> </div>


<div class="post-text" itemprop="text"> <p>I'm having some problems understanding the connection to the database in CakePHP.</p> <p>I have a table called user (which was taken from the CakePHP tutorial website) I added another row to the table called "bio" I am able to insert text into the bio but i'm not able to retrieve it. I've managed to retrieve all the other rows by:</p> <pre><code> $name = CakeSession::read("Auth.User.username"); $mail = CakeSession::read(""); $created = CakeSession::read("Auth.User.created"); $id = CakeSession::read(""); </code></pre> <p>but for some reason it won't work with the bio.</p> <p>Do I need to add anything to controllers to be able to this? Or is it a variable that I need to set? </p> <p>Thank you! </p> </div>


<div class="post-text" itemprop="text"> <p>I'm having trouble using a custom user provider with my custom user class. As highlighted in the log below, I <em>believe</em> the problem exists somewhere in my handler (of course, custom). It doesn't appear to be grabbing the email address (used for authentication: system_user_email_address). </p> <p><strong>app/config/dev.log</strong></p> <pre><code>[2014-07-17 09:48:42] request.INFO: Matched route "login_check" (parameters: "_route": "login_check") [] [] [2014-07-17 09:48:42] security.DEBUG: Read SecurityContext from the session [] [] [2014-07-17 09:48:42] security.DEBUG: Reloading user from user provider. [] [] [2014-07-17 09:48:42] doctrine.DEBUG: SELECT t0.system_user_id AS system_user_id1, t0.first_name AS first_name2, t0.last_name AS last_name3, t0.enabled AS enabled4, t0.salt AS salt5, t0.password AS password6, t0.last_login AS last_login7, t0.locked AS locked8, t0.expired AS expired9, t0.expires_at AS expires_at10, t0.confirmation_token AS confirmation_token11, t0.password_requested_at AS password_requested_at12, t0.credentials_expired AS credentials_expired13, t0.credentials_expire_at AS credentials_expire_at14, t0.customer_id AS customer_id15, t0.system_user_phone_number_id AS system_user_phone_number_id16, t0.system_user_email_address_id AS system_user_email_address_id17 FROM system_user t0 WHERE t0.system_user_id = ? [16] [] [2014-07-17 09:48:42] security.DEBUG: Username "" was reloaded from user provider. [] [] [2014-07-17 09:48:42] doctrine.DEBUG: SELECT s0_.system_user_id AS system_user_id0, s0_.first_name AS first_name1, s0_.last_name AS last_name2, s0_.enabled AS enabled3, s0_.salt AS salt4, s0_.password AS password5, s0_.last_login AS last_login6, s0_.locked AS locked7, s0_.expired AS expired8, s0_.expires_at AS expires_at9, s0_.confirmation_token AS confirmation_token10, s0_.password_requested_at AS password_requested_at11, s0_.credentials_expired AS credentials_expired12, s0_.credentials_expire_at AS credentials_expire_at13, s0_.customer_id AS customer_id14, s0_.system_user_phone_number_id AS system_user_phone_number_id15, s0_.system_user_email_address_id AS system_user_email_address_id16 FROM system_user s0_ WHERE s0_.system_user_email_address_id = ? **["NONE_PROVIDED"]** [] [2014-07-17 09:48:42] security.INFO: Authentication request failed: Bad credentials [] [] </code></pre> <p>I'm getting a response correctly from the SystemUserRepository class:</p> <pre><code>{"success":false,"message":"Bad credentials"} </code></pre> <p>I <em>have</em> been through the other "Bad Credential" posts, and double checked the problems listed there. I'm using SHA512, the password fields are long enough, etc. </p> <p><strong>app/config/security.yml</strong></p> <pre><code>security: encoders: System\Bundle\DataBundle\Entity\SystemUser: algorithm: sha512 role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ] providers: administrators: entity: { class: SystemDataBundle:SystemUser } firewalls: dashboard: pattern: ^/ form_login: check_path: /Dashboard/Login/Check login_path: /Dashboard/Login use_forward: false success_handler: failure_handler: anonymous: true logout: path: /Dashboard/Logout target: / admin_area: pattern: ^/admin http_basic: ~ access_control: - { path: ^/admin, roles: ROLE_ADMIN } - { path: /_wdt/.*, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: /_profiler/.*, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/Dashboard/(Login|LoginCheck|Logout)$, roles: IS_AUTHENTICATED_ANONYMOUSLY } </code></pre> <p><strong>System/Bundle/Entity/SystemUserRepository.php</strong></p> <pre><code>namespace System\Bundle\DataBundle\Entity; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; use Symfony\Component\Security\Core\Exception\UnsupportedUserException; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\NoResultException; class SystemUserRepository extends EntityRepository implements UserProviderInterface { public function loadUserByUsername($emailAddress) { $q = $this -&gt;createQueryBuilder('u') -&gt;where('u.systemUserEmailAddress = :email') -&gt;setParameter('email', $emailAddress) -&gt;getQuery(); try { // The Query::getSingleResult() method throws an exception // if there is no record matching the criteria. $SystemUser = $q-&gt;getSingleResult(); } catch (NoResultException $e) { $message = sprintf( 'Unable to find an active admin AcmeUserBundle:User object identified by "%s".', $emailAddress ); throw new UsernameNotFoundException($message, 0, $e); } return $user; } public function refreshUser(UserInterface $systemUser) { $class = get_class($systemUser); if (!$this-&gt;supportsClass($class)) { throw new UnsupportedUserException( sprintf( 'Instances of "%s" are not supported.', $class ) ); } return $this-&gt;find($systemUser-&gt;getSystemUserId()); } public function supportsClass($class) { return $this-&gt;getEntityName() === $class || is_subclass_of($class, $this-&gt;getEntityName()); } } </code></pre> <p><strong>System/Bundle/UserBundle/Security/AuthenticationHandler.php</strong></p> <pre><code>namespace System\Bundle\UserBundle\Security; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Routing\RouterInterface; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\SecurityContextInterface; use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; class AuthenticationHandler implements AuthenticationSuccessHandlerInterface, AuthenticationFailureHandlerInterface { private $router; private $session; public function __construct( RouterInterface $router, Session $session ) { $this-&gt;router = $router; $this-&gt;session = $session; } public function onAuthenticationSuccess( Request $request, TokenInterface $token ) { // if AJAX login if ( $request-&gt;isXmlHttpRequest() ) { $array = array( 'success' =&gt; true ); // data to return via JSON $response = new Response( json_encode( $array ) ); $response-&gt;headers-&gt;set( 'Content-Type', 'application/json' ); return $response; // if form login } else { if ( $this-&gt;session-&gt;get('_security.main.target_path' ) ) { $url = $this-&gt;session-&gt;get( '_security.main.target_path' ); } else { $url = $this-&gt;router-&gt;generate( 'dashboard_home_homepage' ); } // end if return new RedirectResponse( $url ); } } public function onAuthenticationFailure( Request $request, AuthenticationException $exception ) { // if AJAX login if ( $request-&gt;isXmlHttpRequest() ) { $array = array( 'success' =&gt; false, 'message' =&gt; $exception-&gt;getMessage() ); // data to return via JSON $response = new Response( json_encode( $array ) ); $response-&gt;headers-&gt;set( 'Content-Type', 'application/json' ); return $response; // if form login } else { // set authentication exception to session $request-&gt;getSession()-&gt;set(SecurityContextInterface::AUTHENTICATION_ERROR, $exception); return new RedirectResponse( $this-&gt;router-&gt;generate( 'login_path' ) ); } } } </code></pre> <p><strong>System/Bundle/UserBundle/Controller/SystemUserController/registerAction</strong> (bits and pieces)</p> <pre><code> ... $tempSalt = uniqid(mt_rand()); ... $SystemUser ... -&gt;setSalt($tempSalt) -&gt;setPassword(hash('sha512', $tempSalt . $parameters['password'])) ... </code></pre> <p>I think these are all the relevant files. I'll happily add anything else that might be relevant. I think I'm confusing one of the references, but have torn my hair out enough. There are a few pieces of messy stuff (early development obviously) but nothing that interferes with the fundamental operation here (I hope!). Not all of my routes are finished, but I'd be more than happy to be redirected to the wrong place...</p> <p>I'm a little over-normalized for the typical web project:</p> <pre><code>SystemUser PK SystemUserID FK SystemUserEmailAddressID FK SystemUserPhoneNumberID ... </code></pre> <p>I have no problem hydrating or dealing with these objects however, and the relationships seem to be correct based on the security.DEBUG logs above.</p> <p>If there is a better method of salt/hash I will take that advice as well.</p> <p>Thanks!</p> </div>


<div class="post-text" itemprop="text"> <p>I am currently setting up a website using a pay-wall type backend that you log into with Microsoft accounts. Currently, I am using PHP sessions to capture and track valid requests.</p> <p>I have managed to completely destroy all session data saved on the server as well as rename and blank the session cookies (See code below). Unfortunately, this is not enough it seems. I can still access the page by passing the old session ID through GET variable and I can still load the page. I suspect it is a cached version. I have tried adding in php headders to prevent this but its still loading!</p> <h2>Log out code:</h2> <pre><code>&lt;?php if ($_POST) { session_start($_POST["SID"]); $_SESSION[] = array(); setcookie( session_name(), "", time()-3600, "/" ); session_destroy(); session_write_close(); echo("Session ".$_POST["SID"]." has been destroyed"); } ?&gt; </code></pre> <h2>Header code:</h2> <pre><code>&lt;?php header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); ?&gt; </code></pre> <p>I was expecting to be able to hit the log out button and if I tried to manually access the page by supplying the old session id by GET command, I should have been bounced by the page. Is there any way to get around this? Maybe force the page to re-query the server (if I can just get it to ping the server again I believe my php should bounce the request? <em>I say that with some hesitance hahaha</em>)</p> <p><strong>EDIT:</strong></p> <p>Ok, so after a whole lot of debugging, I have narrowed the problem down too my <code>$_SESSION["IS_AUTHORIZED"]</code> variable? This shouldn't be possible but somehow, the standalone PHP script I wrote to destroy a session when the user logs out, can run the same <code>session_id()</code>, but somehow cannot access any of the session variables?! if I <code>var_dump($_SESSION["IS_AUTHORIZED"])</code>, it spits out <code>NULL</code>, whereas on all the other pages, it spits out the Boolean <code>0</code> or <code>1</code>?!?!?! I am very confused... I guess this is why I cant properly remove the session?</p> <p><strong>Code:</strong></p> <pre><code>&lt;?php if ($_POST) { session_id($_POST["SID"]); echo(session_id()); //comes out as same as session origin page session_start(); echo("|||"); //to make payoad easier to read lol echo($_SESSION["IS_AUTHORIZED"]); //nothing... and var_dump() is NULL? ?&gt; </code></pre> <p><strong>EDIT 2:</strong></p> <p>Oh lord. So now after some tinkering the stand-alone PHP script works and links up to the correct <code>session_id()</code> and I can do the whole <code>session_destroy()</code>, <code>$_SESSION = array();</code> bit to clear the session info. Small problem though, if I refresh the HTML page with the <code>session_id()</code> as a GET variable, it still loads the page? Even says the `$_SESSION["IS_AUTHORIZED"] variable I supposedly just cleared in my stand-alone script is now back and reverted to before I cleared it? That literally defeats the entire point of using sessions? help please! ( I HATE php sessions so far oh my soul!)</p> </div>


<div class="post-text" itemprop="text"> <p>If I register a user using this table:</p> <pre><code>CREATE TABLE IF NOT EXISTS `users` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `md5_id` VARCHAR(200) NOT NULL, `full_name` TINYTEXT CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, `user_name` VARCHAR(10) NOT NULL, `user_email` VARCHAR(30) NOT NULL, `user_level` TINYINT(4) NOT NULL DEFAULT '1', `pwd` VARCHAR(220) NOT NULL, `nationality` VARCHAR(30) NOT NULL, `department` VARCHAR(20) NOT NULL, `birthday` DATE NOT NULL, `date` DATE NOT NULL DEFAULT '0000-00-00', `users_ip` VARCHAR(200) NOT NULL, `activation_code` INT(10) NOT NULL DEFAULT '0', `banned` INT(1) NOT NULL, `ckey` VARCHAR(200) NOT NULL, `ctime` VARCHAR(220) NOT NULL, `approved` INT(1) NOT NULL DEFAULT '1', PRIMARY KEY (`id`) ) ENGINE=INNODB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3; </code></pre> <p>and then once logged in to 'myaccount.php' use this code to enter values into another table, the language table:</p> <pre><code>if (empty($_SESSION['$user_id'])) { // user not logged in; redirect to somewhere else } if (!empty($_POST['doLanguage']) &amp;&amp; $_POST['doLanguage'] == 'Submit') { $result = mysql_query("SELECT `id` FROM users WHERE `banned` = '0' order by id desc"); list($id) = mysql_fetch_row($result); session_start(); $_SESSION['user_id'] = $id; foreach ($_POST as $key =&gt; $value) if (empty($err)) { for ($i = 0;$i &lt; count($_POST["other"]);$i++) { $native = mysql_real_escape_string($_POST['native'][$i]); $other = mysql_real_escape_string($_POST['other'][$i]); $other_list = mysql_real_escape_string($_POST['other_list'][$i]); $other_read = mysql_real_escape_string($_POST['other_read'][$i]); $other_spokint = mysql_real_escape_string($_POST['other_spokint'][$i]); $other_spokprod = mysql_real_escape_string($_POST['other_spokprod'][$i]); $other_writ = mysql_real_escape_string($_POST['other_writ'][$i]); $sql_insert = "INSERT into `language` (`user_id`,`native`,`other`,`other_list`,`other_read`, `other_spokint` ,`other_spokprod`,`other_writ` ) VALUES ('$id','$native','$other','$other_list','$other_read','$other_spokint', '$other_spokprod','$other_writ') "; mysql_query($sql_insert, $link) or die("Insertion Failed:" . mysql_error()); } header("Location: myaccount.php?id=' . $_SESSION[user_id] .'"); exit(); } } } </code></pre> <p>All is fine until , for example I register id=3 (in users table) and then log back into id=1 and change their details in the language table, then their user_id in the language table (which is foreign key to id in users table) is 3 when it should be 1. To make things simple, the id in users table should be same as the user_id in the language table. But when going back and changing data in the languages table the user_id stays the same as the last id that registered!</p> <p>Please help!</p> </div>


<div class="post-text" itemprop="text"> <p>I'm writing a login system for a web application. Currently I create a php session and generate a token stored in a PHP session variable before any HTML or other output. That token is read in JavaScript from the php session by a simple embedded PHP echo and stored briefly in a javascript variable. It is then sent in all ajax requests and if the token sent in the ajax request doesn't match the token stored in the PHP session, the ajax call is aborted. An alternative would be to make a ajax call DOMContentLoaded to a php script, generate the token, store a hash is mysql, and return the unhashed token via ajax response and store it in a JavaScript variable. On subsequent ajax calls within the same page, I could return a new token each time to be used in a subsequent ajax call. </p> <p>My question is whether the storing the token primarily in the PHP Session but still reading it via php echo into a JavaScript variable is more secure than returning the token via ajax and storing it in a JavaScript variable. The ajax method has the advantage of allowing a new token to be generated and returned on each ajax call.</p> <p>I have tried updating the token in the php session during an ajax call but client side code that uses PHP echo of the session variable into a JavaScript variable doesn't receive the new value created during the ajax call because the client page hasn't reloaded. This isn't a problem if the token is stored in mysql and returned to the client via ajax.</p> </div>


<div class="post-text" itemprop="text"> <p><strong>TL;DR</strong> - What is the proper way to close a <code></code> session freeing all resources? </p> <p>My investigation thus far:</p> <p>The <code></code> <code>*Session</code> has a <code>Close()</code> function which calls the <code>*Channel</code> <code>Close()</code> function which sends a message (I'm guessing to the remote server) to close, but I don't see anything about closing other resources like the pipe returned from the <code>*Session</code> <code>StdoutPipe()</code> function. </p> <p>Looking at the <code>*Session</code> <code>Wait()</code> code, I see that the <code>*Session stdinPipeWriter</code> is closed but nothing about the <code>stdoutPipe</code>.</p> <p>This package feels a lot like the <code>os/exec</code> package which guarantees that using the <code>os/exec Wait()</code> function will clean up all the resources. Doing some light digging there shows some similarities in the <code>Wait()</code> functions. Both use the following construct to report errors on <code>io.Copy</code> calls to their stdout, stderr, stdin readers/writers (well if I'm reading this correctly actually only one error) - crypto package shown:</p> <pre><code>var copyError error for _ = range s.copyFuncs { if err := &lt;-s.errors; err != nil &amp;&amp; copyError == nil { copyError = err } } </code></pre> <p>But the <code>os/exec</code> <code>Wait()</code> also calls this close descriptor method</p> <pre><code>c.closeDescriptors(c.closeAfterWait) </code></pre> <p>which is just calling the close method on a slice of <code>io.Closer</code> interfaces:</p> <pre><code>func (c *Cmd) closeDescriptors(closers []io.Closer) { for _, fd := range closers { fd.Close() } } </code></pre> <p>when <code>os/exec</code> creates the pipe, it tracks what needs closing:</p> <pre><code>func (c *Cmd) StdoutPipe() (io.ReadCloser, error) { if c.Stdout != nil { return nil, errors.New("exec: Stdout already set") } if c.Process != nil { return nil, errors.New("exec: StdoutPipe after process started") } pr, pw, err := os.Pipe() if err != nil { return nil, err } c.Stdout = pw c.closeAfterStart = append(c.closeAfterStart, pw) c.closeAfterWait = append(c.closeAfterWait, pr) return pr, nil } </code></pre> <p>During this I noticed that <code>x/cyrpto/ssh</code> <code>*Session StdoutPipe()</code> returns an <code>io.Reader</code> and <code>ox/exec</code> returns an <code>io.ReadCloser</code>. And <code>x/crypto/ssh</code> does not track what to close. I can't find a call to <code>os.Pipe()</code> in the library so maybe the implementation is different and I'm missing something and confused by the Pipe name. </p> </div>

使用mgo和mongodb的I / O超时

<div class="post-text" itemprop="text"> <p>I am running a map-reduce job from mgo. It runs on a collection with a little more than 3.5M records. For some reasons right now I can not port this to aggregation; may be later. So, map-reduce is the thing I am looking forward to. This job, when I run it from the original js files I have created to test the code and output, runs fine. I tried to put the map and reduce code inside two strings and then tried to call the mgo.MapReduce to do the map-reduce for me where I am writing the output in a different collection. And it gives me </p> <p>read tcp i/o timeout</p> <p>Though, as the job has been fired in back-ground it is still running. Now according to this thread here --- <a href="" rel="noreferrer"></a></p> <p>It is easy to solve by calling the session.SetSocketTimeout but I do not want to do this as the total number of documents on which this map-reduce will run will vary and thus, I believe, the time. So, I will never be able to solve the problem by that way I believe. </p> <p>What are the other ways that I might have?</p> <p>Please help me</p> </div>


书上的一个实例,不知道为什么报错。请各位大神帮忙解答一下。 程序如下: from tensorflow.examples.tutorials.mnist import input_data mnist=input_data.read_data_sets("MNIST_data/",one_hot=True) print(mnist.train.images.shape,mnist.train.labels.shape) print(mnist.test.images.shape,mnist.test.labels.shape) print(mnist.validation.images.shape,mnist.validation.labels.shape) import tensorflow as tf sess=tf.InteractiveSession() x=tf.placeholder(tf.float32,[None,784]) W=tf.Variable(tf.zeros([784,10])) b=tf.Variable(tf.zeros([10])) y=tf.nn.softmax(tf.matmul(x,W)+b) y_=tf.placeholder(tf.float32,[None,10]) cross_entropy=tf.reduce_mean(-tf.reduce_sum(y_* tf.log(y),reduction_indices=[1])) train_step=tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy) tf.global_variables_initializer().run() for i in range(1000): batch_xs,batch_ys=mnist.train.next_batch(100){x:batch_xs,y_:batch_ys}) correct_prediction=tf.equal(tf.argmax(y,1),tf.argmax(y_,1)) accuracy=tf.reduce_mean(tf.cast(correct_prediction,tf.float32)) print(accuracy.eval({x:mnist.test.images,y:mnist.test.labels})) 报错如下: runfile('D:/project/Spyder/', wdir='D:/project/Spyder') Extracting MNIST_data/train-images-idx3-ubyte.gz Extracting MNIST_data/train-labels-idx1-ubyte.gz Extracting MNIST_data/t10k-images-idx3-ubyte.gz Extracting MNIST_data/t10k-labels-idx1-ubyte.gz (55000, 784) (55000, 10) (10000, 784) (10000, 10) (5000, 784) (5000, 10) D:\soft\Anaconda3\lib\site-packages\tensorflow\python\client\ UserWarning: An interactive session is already active. This can cause out-of-memory errors in some cases. You must explicitly call `InteractiveSession.close()` to release resources held by the other session(s). warnings.warn('An interactive session is already active. This can ' Traceback (most recent call last): File "<ipython-input-2-3b25b2404fa0>", line 1, in <module> runfile('D:/project/Spyder/', wdir='D:/project/Spyder') File "D:\soft\Anaconda3\lib\site-packages\spyder\utils\site\", line 705, in runfile execfile(filename, namespace) File "D:\soft\Anaconda3\lib\site-packages\spyder\utils\site\", line 102, in execfile exec(compile(, filename, 'exec'), namespace) File "D:/project/Spyder/", line 29, in <module> print(accuracy.eval({x:mnist.test.images,y:mnist.test.labels})) File "D:\soft\Anaconda3\lib\site-packages\tensorflow\python\framework\", line 680, in eval return _eval_using_default_session(self, feed_dict, self.graph, session) File "D:\soft\Anaconda3\lib\site-packages\tensorflow\python\framework\", line 4951, in _eval_using_default_session return, feed_dict) File "D:\soft\Anaconda3\lib\site-packages\tensorflow\python\client\", line 877, in run run_metadata_ptr) File "D:\soft\Anaconda3\lib\site-packages\tensorflow\python\client\", line 1100, in _run feed_dict_tensor, options, run_metadata) File "D:\soft\Anaconda3\lib\site-packages\tensorflow\python\client\", line 1272, in _do_run run_metadata) File "D:\soft\Anaconda3\lib\site-packages\tensorflow\python\client\", line 1291, in _do_call raise type(e)(node_def, op, message) InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder_3' with dtype float and shape [?,10] [[Node: Placeholder_3 = Placeholder[dtype=DT_FLOAT, shape=[?,10], _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]] [[Node: Mean_3/_29 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_18_Mean_3", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]] Caused by op 'Placeholder_3', defined at: File "D:\soft\Anaconda3\lib\site-packages\spyder\utils\ipython\", line 268, in <module> main() File "D:\soft\Anaconda3\lib\site-packages\spyder\utils\ipython\", line 264, in main kernel.start() File "D:\soft\Anaconda3\lib\site-packages\ipykernel\", line 478, in start self.io_loop.start() File "D:\soft\Anaconda3\lib\site-packages\zmq\eventloop\", line 177, in start super(ZMQIOLoop, self).start() File "D:\soft\Anaconda3\lib\site-packages\tornado\", line 888, in start handler_func(fd_obj, events) File "D:\soft\Anaconda3\lib\site-packages\tornado\", line 277, in null_wrapper return fn(*args, **kwargs) File "D:\soft\Anaconda3\lib\site-packages\zmq\eventloop\", line 440, in _handle_events self._handle_recv() File "D:\soft\Anaconda3\lib\site-packages\zmq\eventloop\", line 472, in _handle_recv self._run_callback(callback, msg) File "D:\soft\Anaconda3\lib\site-packages\zmq\eventloop\", line 414, in _run_callback callback(*args, **kwargs) File "D:\soft\Anaconda3\lib\site-packages\tornado\", line 277, in null_wrapper return fn(*args, **kwargs) File "D:\soft\Anaconda3\lib\site-packages\ipykernel\", line 283, in dispatcher return self.dispatch_shell(stream, msg) File "D:\soft\Anaconda3\lib\site-packages\ipykernel\", line 233, in dispatch_shell handler(stream, idents, msg) File "D:\soft\Anaconda3\lib\site-packages\ipykernel\", line 399, in execute_request user_expressions, allow_stdin) File "D:\soft\Anaconda3\lib\site-packages\ipykernel\", line 208, in do_execute res = shell.run_cell(code, store_history=store_history, silent=silent) File "D:\soft\Anaconda3\lib\site-packages\ipykernel\", line 537, in run_cell return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs) File "D:\soft\Anaconda3\lib\site-packages\IPython\core\", line 2728, in run_cell interactivity=interactivity, compiler=compiler, result=result) File "D:\soft\Anaconda3\lib\site-packages\IPython\core\", line 2856, in run_ast_nodes if self.run_code(code, result): File "D:\soft\Anaconda3\lib\site-packages\IPython\core\", line 2910, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-2-3b25b2404fa0>", line 1, in <module> runfile('D:/project/Spyder/', wdir='D:/project/Spyder') File "D:\soft\Anaconda3\lib\site-packages\spyder\utils\site\", line 705, in runfile execfile(filename, namespace) File "D:\soft\Anaconda3\lib\site-packages\spyder\utils\site\", line 102, in execfile exec(compile(, filename, 'exec'), namespace) File "D:/project/Spyder/", line 20, in <module> y_=tf.placeholder(tf.float32,[None,10]) File "D:\soft\Anaconda3\lib\site-packages\tensorflow\python\ops\", line 1735, in placeholder return gen_array_ops.placeholder(dtype=dtype, shape=shape, name=name) File "D:\soft\Anaconda3\lib\site-packages\tensorflow\python\ops\", line 5928, in placeholder "Placeholder", dtype=dtype, shape=shape, name=name) File "D:\soft\Anaconda3\lib\site-packages\tensorflow\python\framework\", line 787, in _apply_op_helper op_def=op_def) File "D:\soft\Anaconda3\lib\site-packages\tensorflow\python\util\", line 454, in new_func return func(*args, **kwargs) File "D:\soft\Anaconda3\lib\site-packages\tensorflow\python\framework\", line 3155, in create_op op_def=op_def) File "D:\soft\Anaconda3\lib\site-packages\tensorflow\python\framework\", line 1717, in __init__ self._traceback = tf_stack.extract_stack() InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'Placeholder_3' with dtype float and shape [?,10] [[Node: Placeholder_3 = Placeholder[dtype=DT_FLOAT, shape=[?,10], _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]] [[Node: Mean_3/_29 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_18_Mean_3", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]


<div class="post-text" itemprop="text"> <p>I want to mark not registered customers that already bought a product using either a cookie, a session variable, or some other way.</p> <p>I have attempted it with the code below, but this approach doesn't seem to be working. In the first approach, I try to save something. Then, I try to get the session cookie already in use by woocommerce to save it in the database as a unique identifier. After, I can read it out of the database to see if it's a new unique user or not. </p> <pre><code>add_action( 'woocommerce_payment_complete', 'so_payment_complete' ); add_action( 'woocommerce_order_status_completed', 'so_payment_complete' ); function so_payment_complete( $order_id){ setcookie('so_payment_complete', 1, time()+7200); WC()-&gt;session-&gt;set( 'so_payment_complete',true ); $session = new WC_Session_Handler(); $session_data = $session-&gt;get_session_data(); file_put_contents(__DIR__ . '/return_products.txt','cookies:'.(print_r($_COOKIE,true)) . " " ,FILE_APPEND ); file_put_contents(__DIR__ . '/return_products.txt','get_session_data:'.(print_r($session_data,true)) . " " ,FILE_APPEND ); } </code></pre> <p>It seems the cookie from <code>setcookie</code> never reaches the client. <code>WC()-&gt;session-&gt;set</code> never reaches the database. <code>WC()-&gt;session-&gt;get</code> cannot get it on other pages either.</p> <p><code>$_COOKIE</code> and <code>$session_data</code> arrays are empty.</p> </div>


课程主要面向嵌入式Linux初学者、工程师、学生 主要从一下几方面进行讲解: 1.linux学习路线、基本命令、高级命令、vi及vim入门讲解 3.软件安装下载、NFS、Samba、FTP等服务器配置及使用




文章目录经典飞机大战一.游戏设定二.我方飞机三.敌方飞机四.发射子弹五.发放补给包六.主模块 经典飞机大战 源代码以及素材资料(图片,音频)可从下面的github中下载: 飞机大战源代码以及素材资料github项目地址链接 ————————————————————————————————————————————————————————— 不知道大家有没有打过飞机,喜不喜欢打飞机。当我第一次接触这个东西的时候,我的内心是被震撼到的。第一次接触打飞机的时候作者本人是身心愉悦的,因为周边的朋友都在打飞机, 每


92讲视频课+16大项目实战+源码+¥800元课程礼包+讲师社群1V1答疑+社群闭门分享会=99元 &nbsp; 为什么学习数据分析? &nbsp; &nbsp; &nbsp; 人工智能、大数据时代有什么技能是可以运用在各种行业的?数据分析就是。 &nbsp; &nbsp; &nbsp; 从海量数据中获得别人看不见的信息,创业者可以通过数据分析来优化产品,营销人员可以通过数据分析改进营销策略,产品经理可以通过数据分析洞察用户习惯,金融从业者可以通过数据分析规避投资风险,程序员可以通过数据分析进一步挖掘出数据价值,它和编程一样,本质上也是一个工具,通过数据来对现实事物进行分析和识别的能力。不管你从事什么行业,掌握了数据分析能力,往往在其岗位上更有竞争力。 &nbsp;&nbsp; 本课程共包含五大模块: 一、先导篇: 通过分析数据分析师的一天,让学员了解全面了解成为一个数据分析师的所有必修功法,对数据分析师不在迷惑。 &nbsp; 二、基础篇: 围绕Python基础语法介绍、数据预处理、数据可视化以及数据分析与挖掘......这些核心技能模块展开,帮助你快速而全面的掌握和了解成为一个数据分析师的所有必修功法。 &nbsp; 三、数据采集篇: 通过网络爬虫实战解决数据分析的必经之路:数据从何来的问题,讲解常见的爬虫套路并利用三大实战帮助学员扎实数据采集能力,避免没有数据可分析的尴尬。 &nbsp; 四、分析工具篇: 讲解数据分析避不开的科学计算库Numpy、数据分析工具Pandas及常见可视化工具Matplotlib。 &nbsp; 五、算法篇: 算法是数据分析的精华,课程精选10大算法,包括分类、聚类、预测3大类型,每个算法都从原理和案例两个角度学习,让你不仅能用起来,了解原理,还能知道为什么这么做。


在系统内核开发中,经常会用到串口调试,利用VMware的Virtual Machine更是为调试系统内核如虎添翼。那么怎么搭建串口调试环境呢?因为最近工作涉及到这方面,利用强大的google搜索和自己


获取讲师答疑方式: 在付费视频第一节(触摸命令_ALL)片头有二维码及加群流程介绍 限时福利 原价99元,今日仅需39元!购课添加小助手(微信号:csdn590)按提示还可领取价值800元的编程大礼包! 讲师介绍: 苏奕嘉&nbsp;前阿里UC项目工程师 脚本开发平台官方认证满级(六级)开发者。 我将如何教会你通过【定制脚本】赚到你人生的第一桶金? 零基础程序定制脚本开发课程,是完全针对零脚本开发经验的小白而设计,课程内容共分为3大阶段: ①前期将带你掌握Q开发语言和界面交互开发能力; ②中期通过实战来制作有具体需求的定制脚本; ③后期将解锁脚本的更高阶玩法,打通任督二脉; ④应用定制脚本合法赚取额外收入的完整经验分享,带你通过程序定制脚本开发这项副业,赚取到你的第一桶金!




C++语言基础视频培训课程:本课与主讲者在大学开出的程序设计课程直接对接,准确把握知识点,注重教学视频与实践体系的结合,帮助初学者有效学习。本教程详细介绍C++语言中的封装、数据隐藏、继承、多态的实现等入门知识;主要包括类的声明、对象定义、构造函数和析构函数、运算符重载、继承和派生、多态性实现等。 课程需要有C语言程序设计的基础(可以利用本人开出的《C语言与程序设计》系列课学习)。学习者能够通过实践的方式,学会利用C++语言解决问题,具备进一步学习利用C++开发应用程序的基础。




深度学习系列课程从深度学习基础知识点开始讲解一步步进入神经网络的世界再到卷积和递归神经网络,详解各大经典网络架构。实战部分选择当下最火爆深度学习框架PyTorch与Tensorflow/Keras,全程实战演示框架核心使用与建模方法。项目实战部分选择计算机视觉与自然语言处理领域经典项目,从零开始详解算法原理,debug模式逐行代码解读。适合准备就业和转行的同学们加入学习! 建议按照下列课程顺序来进行学习 (1)掌握深度学习必备经典网络架构 (2)深度框架实战方法 (3)计算机视觉与自然语言处理项目实战。(按照课程排列顺序即可)


本课程适合CCNA或HCNA网络小白同志,高手请绕道,可以直接学习进价课程。通过本预科课程的学习,为学习网络工程师、思科CCNA、华为HCNA这些认证打下坚实的基础! 重要!思科认证2020年2月24日起,已启用新版认证和考试,包括题库都会更新,由于疫情原因,请关注官网和本地考点信息。题库网络上很容易下载到。




本课程内容系统、全面、简洁、通俗易懂,通过2个多小时的介绍,让大家对软件测试有个系统的理解和认识,具备基本的软件测试理论基础。 主要内容分为5个部分: 1 软件测试概述,了解测试是什么、测试的对象、原则、流程、方法、模型;&nbsp; 2.常用的黑盒测试用例设计方法及示例演示;&nbsp; 3 常用白盒测试用例设计方法及示例演示;&nbsp; 4.自动化测试优缺点、使用范围及示例‘;&nbsp; 5.测试经验谈。


未经我的允许,请不要转载我的文章,在此郑重声明!!! 请先配置安装好Java的环境,若没有安装,请参照我博客上的步骤进行安装! 安装Java环境教程 Tomcat部署Web项目(一)·内嵌

2019数学建模A题高压油管的压力控制 省一论文即代码


图书管理系统(Java + Mysql)我的第一个完全自己做的实训项目

图书管理系统 Java + MySQL 完整实训代码,MVC三层架构组织,包含所有用到的图片资源以及数据库文件,大三上学期实训,注释很详细,按照阿里巴巴Java编程规范编写




微信小程序番茄时钟视频教程,本课程将带着各位学员开发一个小程序初级实战类项目,针对只看过官方文档而又无从下手的开发者来说,可以作为一个较好的练手项目,对于有小程序开发经验的开发者而言,可以更好加深对小程序各类组件和API 的理解,为更深层次高难度的项目做铺垫。

[已解决]踩过的坑之mysql连接报“Communications link failure”错误

目录 前言 第一种方法: 第二种方法 第三种方法(适用于项目和数据库在同一台服务器) 第四种方法 第五种方法(项目和数据库不在同一台服务器) 总结 前言 先给大家简述一下我的坑吧,(我用的是mysql,至于oracle有没有这样的问题,有心的小伙伴们可以测试一下哈), 在自己做个javaweb测试项目的时候,因为买的是云服务器,所以数据库连接的是用ip地址,用IDE开发好...


系列课程主要分为3大阶段:(1)首先掌握计算机视觉必备算法原理,结合Opencv进行学习与练手,通过实际视项目进行案例应用展示。(2)进军当下最火的深度学习进行视觉任务实战,掌握深度学习中必备算法原理与网络模型架构。(3)结合经典深度学习框架与实战项目进行实战,基于真实数据集展开业务分析与建模实战。整体风格通俗易懂,项目驱动学习与就业面试。 建议同学们按照下列顺序来进行学习:1.Python入门视频课程 2.Opencv计算机视觉实战(Python版) 3.深度学习框架-PyTorch实战/人工智能框架实战精讲:Keras项目 4.Python-深度学习-物体检测实战 5.后续实战课程按照自己喜好选择就可以

2019 AI开发者大会

2019 AI开发者大会(AI ProCon 2019)是由中国IT社区CSDN主办的AI技术与产业年度盛会。多年经验淬炼,如今蓄势待发:2019年9月6-7日,大会将有近百位中美顶尖AI专家、知名企业代表以及千余名AI开发者齐聚北京,进行技术解读和产业论证。我们不空谈口号,只谈技术,诚挚邀请AI业内人士一起共铸人工智能新篇章!






《YOLOv3目标检测实战系列课程》旨在帮助大家掌握YOLOv3目标检测的训练、原理、源码与网络模型改进方法。 本课程的YOLOv3使用原作darknet(c语言编写),在Ubuntu系统上做项目演示。 本系列课程包括三门课: (1)《YOLOv3目标检测实战:训练自己的数据集》 包括:安装darknet、给自己的数据集打标签、整理自己的数据集、修改配置文件、训练自己的数据集、测试训练出的网络模型、性能统计(mAP计算和画出PR曲线)和先验框聚类。 (2)《YOLOv3目标检测:原理与源码解析》讲解YOLOv1、YOLOv2、YOLOv3的原理、程序流程并解析各层的源码。 (3)《YOLOv3目标检测:网络模型改进方法》讲解YOLOv3的改进方法,包括改进1:不显示指定类别目标的方法 (增加功能) ;改进2:合并BN层到卷积层 (加快推理速度) ; 改进3:使用GIoU指标和损失函数 (提高检测精度) ;改进4:tiny YOLOv3 (简化网络模型)并介绍 AlexeyAB/darknet项目。






DirectX修复工具(DirectX Repair)是一款系统级工具软件,简便易用。本程序为绿色版,无需安装,可直接运行。 本程序的主要功能是检测当前系统的DirectX状态,如果发现异常则进行修复



Vue.js 2.0之全家桶系列视频课程

基于新的Vue.js 2.3版本, 目前新全的Vue.js教学视频,让你少走弯路,直达技术前沿! 1. 包含Vue.js全家桶(vue.js、vue-router、axios、vuex、vue-cli、webpack、ElementUI等) 2. 采用笔记+代码案例的形式讲解,通俗易懂


十个c语言案例 (1)贪吃蛇 (2)五子棋游戏 (3)电话薄管理系统 (4)计算器 (5)万年历 (6)电子表 (7)客户端和服务器通信 (8)潜艇大战游戏 (9)鼠标器程序 (10)手机通讯录系统

相关热词 c#中如何设置提交按钮 c#帮助怎么用 c# 读取合并单元格的值 c#带阻程序 c# 替换span内容 c# rpc c#控制台点阵字输出 c#do while循环 c#调用dll多线程 c#找出两个集合不同的