Search Results

Search found 79 results on 4 pages for 'kendall'.

Page 4/4 | < Previous Page | 1 2 3 4 

  • Lambda recursive PHP functions.

    - by Kendall Hopkins
    Is it possible to have a PHP function that is both recursive and anonymous (lambda). This is my attempt to get it to work, but it doesn't pass in the function name. $factorial = function( $n ) use ( $factorial ) { if( $n == 1 ) return 1; return $factorial( $n - 1 ) * $n; }; print $factorial( 5 ); I'm also aware that this is a bad way to implement factorial, it's just an example.

    Read the article

  • file_get_contents returns an empty string that is 354 bytes long.

    - by Kendall Crouch
    I'm trying to read the contents of a file and simply getting an empty string. The file exists on the server. I've tried some test with the following code and get the true to display: $filename = "includes/blah.php"; $filecontents = file_get_contents($filename, FILE_USE_INCLUDE_PATH); if ($filecontents === false) { echo(":FALSE:"); } else { echo(":TRUE:"); } var_dump($filecontents); The dump displays "string(354)" which is the correct size of the file. What am I doing wrong?

    Read the article

  • Recovering data from /

    - by Abhijit Gavas
    I accidentally installed Ubuntu to one of my data drives from Windows. The drive was a NTFS drive and contained about 80 GB of important data. The size of the drive is 110 GB. Its new file system is ext4. In an attempt to recover the data, I downloaded foremost and tried the following commands: foremost -i / -o /media/281C8DB01C8D7998/Recovery/ -T -v foremost -i /dev/sda7 -o /media/281C8DB01C8D7998/Recovery/ -T -v (sda7 is the drive in question.) It appears that with either command, foremost gets stuck reading some file. Here is the console output: abhi@abi-PC:/dev$ foremost -i /dev/sda7 -o /media/281C8DB01C8D7998/Recovery/ -T -v Foremost version 1.5.7 by Jesse Kornblum, Kris Kendall, and Nick Mikus Audit File Foremost started at Fri Sep 28 20:58:00 2012 Invocation: foremost -i /dev/sda7 -o /media/281C8DB01C8D7998/Recovery/ -T -v Output directory: /media/281C8DB01C8D7998/Recovery_Fri_Sep_28_20_58_00_2012 Configuration file: /etc/foremost.conf Processing: stdin |------------------------------------------------------------------ File: stdin Start: Fri Sep 28 20:58:00 2012 Length: Unknown Num Name (bs=512) Size File Offset Comment Killed As you can see I have to kill it from system monitor. This approach does not seem to be working. What else could I try to recover the files? Please help. The files are very important and I will be devastated if I cannot recover them.

    Read the article

  • SQL SERVER – Quiz and Video – Introduction to Hierarchical Query using a Recursive CTE

    - by pinaldave
    This blog post is inspired from SQL Queries Joes 2 Pros: SQL Query Techniques For Microsoft SQL Server 2008 – SQL Exam Prep Series 70-433 – Volume 2.[Amazon] | [Flipkart] | [Kindle] | [IndiaPlaza] This is follow up blog post of my earlier blog post on the same subject - SQL SERVER – Introduction to Hierarchical Query using a Recursive CTE – A Primer. In the article we discussed various basics terminology of the CTE. The article further covers following important concepts of common table expression. What is a Common Table Expression (CTE) Building a Recursive CTE Identify the Anchor and Recursive Query Add the Anchor and Recursive query to a CTE Add an expression to track hierarchical level Add a self-referencing INNER JOIN statement Above six are the most important concepts related to CTE and SQL Server.  There are many more things one has to learn but without beginners fundamentals one can’t learn the advanced  concepts. Let us have small quiz and check how many of you get the fundamentals right. Quiz 1) You have an employee table with the following data. EmpID FirstName LastName MgrID 1 David Kennson 11 2 Eric Bender 11 3 Lisa Kendall 4 4 David Lonning 11 5 John Marshbank 4 6 James Newton 3 7 Sally Smith NULL You need to write a recursive CTE that shows the EmpID, FirstName, LastName, MgrID, and employee level. The CEO should be listed at Level 1. All people who work for the CEO will be listed at Level 2. All of the people who work for those people will be listed at Level 3. Which CTE code will achieve this result? WITH EmpList AS (SELECT Boss.EmpID, Boss.FName, Boss.LName, Boss.MgrID, 1 AS Lvl FROM Employee AS Boss WHERE Boss.MgrID IS NULL UNION ALL SELECT E.EmpID, E.FirstName, E.LastName, E.MgrID, EmpList.Lvl + 1 FROM Employee AS E INNER JOIN EmpList ON E.MgrID = EmpList.EmpID) SELECT * FROM EmpList WITH EmpListAS (SELECT EmpID, FirstName, LastName, MgrID, 1 as Lvl FROM Employee WHERE MgrID IS NULL UNION ALL SELECT EmpID, FirstName, LastName, MgrID, 2 as Lvl ) SELECT * FROM BossList WITH EmpList AS (SELECT EmpID, FirstName, LastName, MgrID, 1 as Lvl FROM Employee WHERE MgrID is NOT NULL UNION SELECT EmpID, FirstName, LastName, MgrID, BossList.Lvl + 1 FROM Employee INNER JOIN EmpList BossList ON Employee.MgrID = BossList.EmpID) SELECT * FROM EmpList 2) You have a table named Employee. The EmployeeID of each employee’s manager is in the ManagerID column. You need to write a recursive query that produces a list of employees and their manager. The query must also include the employee’s level in the hierarchy. You write the following code segment: WITH EmployeeList (EmployeeID, FullName, ManagerName, Level) AS ( –PICK ANSWER CODE HERE ) SELECT EmployeeID, FullName, ” AS [ManagerID], 1 AS [Level] FROM Employee WHERE ManagerID IS NULL UNION ALL SELECT emp.EmployeeID, emp.FullName mgr.FullName, 1 + 1 AS [Level] FROM Employee emp JOIN Employee mgr ON emp.ManagerID = mgr.EmployeeId SELECT EmployeeID, FullName, ” AS [ManagerID], 1 AS [Level] FROM Employee WHERE ManagerID IS NULL UNION ALL SELECT emp.EmployeeID, emp.FullName, mgr.FullName, mgr.Level + 1 FROM EmployeeList mgr JOIN Employee emp ON emp.ManagerID = mgr.EmployeeId Now make sure that you write down all the answers on the piece of paper. Watch following video and read earlier article over here. If you want to change the answer you still have chance. Solution 1) 1 2) 2 Now compare let us check the answers and compare your answers to following answers. I am very confident you will get them correct. Available at USA: Amazon India: Flipkart | IndiaPlaza Volume: 1, 2, 3, 4, 5 Please leave your feedback in the comment area for the quiz and video. Did you know all the answers of the quiz? Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: Joes 2 Pros, PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

< Previous Page | 1 2 3 4