Fibonacci Series: 0 1 1 2 3 5 8 13 21 …
Here are 2 PHP programs to print nth number of Fibonacci Series:
Iterative Program to find nth number of Fibonacci Series:
$first_num = 0;
$second_num = 1;
if(1 == $n)
elseif(2 == $n)
$next_num = 0;
for($i=1; $i<=$n-2; $i++)
$next_num = $first_num + $second_num;
$first_num = $second_num;
$second_num = $next_num;
Recursive Program to find nth number of Fibonacci Series:
if(1 == $n)
$result = 0;
elseif(2 == $n)
$result = 1;
$result = fibonacci($n-1) + fibonacci($n-2);
I’ve been using USB wireless mouse for quite a long time now. The only disadvantage I thought was high battery consumption.
However lately, I am being irritated by a new problem of this wireless USB device.
Occasionally, while using my wireless mouse, a pop-up suddenly and randomly appears in the Windows Taskbar saying that ‘USB device can perform faster. High-speed USB device has been plugged into a Non-high-speed USB port.’
It becomes very irritating and annoying to see that pop-up again and again. Moreover it does not come alone. It is always accompanied by that weird sound to add to the annoyance.
I have still not been able to figure out as to why this error keeps coming up at random times even though both the USB device and USB port are compatible.
However there is a solution in Windows to at least disable and suppress that USB error from popping out every now and then.
- Go to ‘Device Manager’ and click on the plus icon near the title ‘Universal Serial Bus controllers’ to expand the options.
- Right click on any one ‘Standard Enhanced PCI to USB Host Controller’ and click ‘Properties’.
- Go to ‘Advanced’ tab and check the checkbox ‘Don’t tell me about USB errors.’
These steps would at least not show that annoying message again and again.
How many times we have felt an itch to modify or tweak the appearance of a WordPress theme such as twentythirteen by just changing something in the core theme file.
However a big disadvantage of directly editing a core theme file is, in case a theme is updated in future (which will likely be the case), all our changes will be lost.
Hence changes should be done using the concept of ‘Child Theme’ of WordPress. With a child theme, we can update the parent theme (which might be important for security or functionality) and still keep our changes.
Following are the steps to keep the top menu bar fixed on top and stop the menu bar from scrolling up in twentythirteen theme using the concept of Child Theme:
- In wp-content/themes directory, create a new directory by the name ‘twentythirteen-child’. (In case twentythirteen theme needs to be changed).
- Inside directory twentythirteen-child, create a file by the name of ‘style.css’.
- Add the following code to the newly created style.css:
Theme Name: Twenty Thirteen Child
Theme URI: http://knowledge-share.in/twenty-thirteen-child/
Description: Twenty Thirteen Child Theme
Author: Shafi Memon
Author URI: http://knowledge-share.in
/* =Theme customization starts here
- Log in to site’s dashboard and go to Admin Panel -> Appearance -> Themes and activate ‘Twenty Thirteen Child’ theme.
- Go to Admin Panel -> Appearance -> Menus and check the checkbox ‘Navigation Menu’ to make sure that same menu bar is available which was set in the Parent twentythirteen theme. This is required because the menu bar of a parent theme (twentythirteen here) is not inherited in child theme (twentythirteen-child in this case) by default.
For further information on the concept of Child Themes of WordPress, refer http://codex.wordpress.org/Child_Themes
WordPress-3.6.1 comes with the most amazing theme called ‘twentythirteen’.
However considering user preferences, one enhancement that needs to be done is that the top menu bar should always remain visible regardless of the vertical scroll. This will make navigation much easier.
Hence position of menu bar should be fixed on top of page.
To achieve this, some changes are to be done in file ‘/wp-content/themes/twentythirteen/style.css’.
margin: 0 auto;
needs to be changed to:
margin: 0 auto;
Catch / Caveat:
- Tweaks / Modifications are for ‘twentythirteen’ theme. However similar tweaks could be applied to any other theme such as ‘Spine’.
- One of the theme file is directly edited (might be considered as bad advice), so need to take care about the future updates to the theme file.
[To achieve the same task without modifying the core theme file refer http://www.knowledge-share.in/wordpress-change-a-theme-appearance-without-touching-core-theme-files/
- Some difficulties might be faced when trying to view the top menu bar during admin tasks. (i.e. When admin is logged in.)
When WordPress files are FTP uploaded to the server via FileZilla Client, some files (such as ‘wp-admin/includes/ms.php’) are only partially uploaded and not entirely and hence not properly uploaded.
Due to this error in uploading, FileZilla FTP retries to upload the same file again and again resulting in another error mentioned on page Filezilla FTP Error: 421 Too many connections (8) from this IP.
The only solution known till now is to change the overall method of uploading WordPress files to the server.
cPanel (or corresponding utility) should be used to upload files instead of FileZilla FTP Client.
Following steps should be executed:
- Compress all the source code files into an archive. (.zip and not .rar)
- Login into cPanel.
- Click on link called ‘File Manager’.
- Upload the archive using functionality provided by ‘File Manager’.
- Extract the contents of archive at desired location.
Thus files will be uploaded on the server.
When there is some error in uploading any file, Filezilla client retries to upload that file by opening a new connection in addition to the existing connection.
As a result, those connections do not terminate properly and require manual disconnection. Moreover every server will have a limit on the maximum number of simultaneous connections for obvious security reasons.
This can be solved by following steps:
- Login to your cPanel.
- Scroll down the menu until you find FTP Session Control.
- You will see a list of your connections. Click on the button in the DISCONNECT column as long as the status of the connection states IDLE. You might have to click on the DISCONNECT button several times to remove all of the connections.
Disconnect all such IDLE connections and try logging again using FileZilla.
For more information, refer http://www.inmotionhosting.com/support/community-support/file-management/421-too-many-connections-8-from-this-ip
Hope this works.
After successfully downloading a version of uTorrent client, when we try to install it (by double clicking the exe file), there is no response and basically nothing happens.
Obvious questions that come to mind are:
- Is the file downloaded properly?
- Have I downloaded an incompatible version? etc.
No. There is nothing wrong with the download or compatibility.
uTorrent is blocked by default. It simply needs to be unblocked by right clicking the setup and clicking ‘Unblock’.
When you search for files that contain text by using the ‘A word or phrase in the file’ search criterion, the search results may not contain files that contain the text that you specified. For example, .log, .dll, .js, .asp, .xml, .xsl, .hta, .css, .wsh, .cpp, .c, or .h files, or files with no file name extension, may not appear in the search results even if the files contain the text that you specified. This problem may occur even if you specified the file name or type in the All or part of the file name box.
To configure Windows XP to search all files no matter what the file type, obtain the latest service pack for Windows XP and then turn on the Index file types with unknown extensions option.
If you use this method, Windows XP searches all file types for the text that you specify. This can affect the performance of the search functionality. To do this:
- Click Start, and then click Search (or point to Search, and then click For Files or Folders).
- Click Change preferences, and then click With Indexing Service (for faster local searches).
- Click Change Indexing Service Settings (Advanced). Note that you do not have to turn on the Index service.
- On the toolbar, click Show/Hide Console Tree.
- In the left pane, right-click Indexing Service on Local Machine, and then click Properties.
- On the Generation tab, click to select the Index files with unknown extensions check box, and then click OK.
- Close the Indexing Service console.
For more information, refer http://support.microsoft.com/kb/309173