This post is under construction, Please check back soon.
Web development in |Php/Mysql | OS Commerce | Wordpress |Joomla | Magneto | Codeigniter | CakePHP | Jquery | Ajax
Friday, September 26, 2014
Wednesday, October 9, 2013
Selecting First Option of a Drop Down/Combo Box using JQuery
This one is pretty simple and straight forward. I am just placing it here for future reference and may be it will be helpful to people looking for a similar solution.
If you want to select the first option of an HTML drop down/select control/combo box, just use the following:
I found the solution on Stack Overflow.
Hope it helps, if it does just drop a comment, it will keep me motivated :)
If you want to select the first option of an HTML drop down/select control/combo box, just use the following:
$("#target").val($("#target option:first").val());
I found the solution on Stack Overflow.
Hope it helps, if it does just drop a comment, it will keep me motivated :)
Labels:
Combo Box,
Drop Down,
DropDown,
HTML,
Java Script,
JavaScript,
JQuery,
Option,
Select
Tuesday, June 18, 2013
Including/Excluding a Category From Wordpress Search Query
Recently I was working on a Wordpress site where I had to design two types of search. Basically the searches needed to identify a particular post category. I designed two search forms one for general search (searchform.php) and the other for category specific search (searchform-category.php). Further deatils are as follow:
- General Search:
- The General Search was meant to search the entire site except a particular category.
- This meant that I needed to exclude that particular category.
- For excluding the category, I simply added the the following hidden field:
- where 5 denotes the category ID to exclude.
- In case you want to exclude multiple categories the following should work:
- Category Specific Serach (Advanced Search):
- The advanced search was meant to search in on specific category and was available to only logged in users.
- This meant that I needed to specifically instruct WP which category to search in.
- In my advance/category search form I added the following:
- where 5 denotes the category ID to search in.
- In case you want to search in multiple categories, the following will work for you
The support forums on Wordpress.org helped me a lot, but there was no clear cut and tested solution available there so I wrote this post for myself and other like me out there :). The above have been tested with Wordpress 3.5.1.
I will be looking at Wordpress Theme Development and Customization in the coming articles, till then:
Happy search customization on Wordpress. :D
Wednesday, July 25, 2012
Enabling LDAP on XAMPP 1.8.0 for Active Directory on Windows XP
Recently I installed XAMPP 1.8.0 on Windows XP. The XAMPP Server was working fine after installation and the control panel has really been given a good, clean and detailed look.
One of my applications needed PHP's LDAP Module so I went into the php.ini file located at [Your Drive]:\xampp\php\php.ini. and simply un-commented the line:
extension=php_ldap.dll
After doing the above I saved the INI file and restarted Apache service from the XAMPP Control Panel only to find the warning:
Warning PHP Startup: Unable to load dynamic library '\xampp\php\ext\php_ldap.dll'
After a bit of Googling I found this solution on the XAMPP Support Forum:
- Added [Your Drive]:\xampp\php to the PATH environment variable.
- Move the file: libsasl.dll, from [Your Drive]:\xampp\php to [Your Drive]:\xampp\apache\bin.
- Restart Apache from XAMPP Control Panel
After this Apache successfully started without any warnings or errors and phpinfo() also reported the LDAP Module as running. Hope it will save your time and effort from searching, browsing and understanding what is written at the link below :)
Source: Use LDAP extension ? [XAMPP Support Forum]
CHEERS :D
Tuesday, May 1, 2012
Resetting an Auto Incremental Primary Key on SQL Server
Almost all of us create tables in SQL Server with auto incremental primary keys. After creating these tables we write programs which use these tables to place data in them. These programs under go a lot of testing and thus place a lot of test data in these tables and in turn increment the value of such auto increment fields.
Once all the testing is said and done and you are all set to launch your program/application/software you empty the database/tables so that there is no dummy/test data. but the simple delete statement:
only clears the data but does not reset the values of any auto increment fields, this gives a sense of uncleanliness when you are delivering the product/project.
So to reset any auto incremental primary key in MS SQL Server 2008 user defined database tables use the following command after the DELETE statement above.
After the command has executed the next value generated for the auto incremental primary key would be 1, hence the count has been reset, giving a sense of a fresh start or a new beginning. Now you can test a fresh or deliver it a fresh. As pizza companies say Oven Hot we developers can say Database Fresh :).
Happy resetting. :)
Once all the testing is said and done and you are all set to launch your program/application/software you empty the database/tables so that there is no dummy/test data. but the simple delete statement:
DELETE FROM [tableName];
only clears the data but does not reset the values of any auto increment fields, this gives a sense of uncleanliness when you are delivering the product/project.
So to reset any auto incremental primary key in MS SQL Server 2008 user defined database tables use the following command after the DELETE statement above.
DBCC CHECKIDENT ("dbo.[tableName]", RESEED, 0);
After the command has executed the next value generated for the auto incremental primary key would be 1, hence the count has been reset, giving a sense of a fresh start or a new beginning. Now you can test a fresh or deliver it a fresh. As pizza companies say Oven Hot we developers can say Database Fresh :).
Happy resetting. :)
Sunday, July 25, 2010
Problem: Slow Internet on Windows 7
I recently bought a Dell 1564 and installed Windows 7 Ultimate (64 bit) on it. Before this laptop I had a Dell Latitude 610 with Windows XP Professional (32 bit). Ever since I satrted using Windows 7 I always got a felling that I was experiencing very slow internet browsing speeds. I tried all the major browsers IE 8 (that came with Windows 7), Mozilla Firefox 3.6.3 (both with and without add ons) and of course my personal favorite Google Chrome.
Before Windows 7 (i.e. on Windows XP Professional) on the same Internet Connection (a Mobilink Infinity Wifi Broadband Connection) I was having a great Internet surfing and downloading experience. So finally after some 2 months of suffering, I finally decided to see if I was the only one suffering from the same issue and thus decided to do a Google Search and found out that I was not the only one with the help of Google Suggest, so instead of writing my own search query I decided to go with Google Suggest and searched for "slow internet windows 7".
So the first article that came up in search at that time was Microsoft's own explanation in the form of an article titled "Why is my Internet connection so slow?", after skimming through the article I found that this was of no use to a tech user as he would have already checked and made all the suggestions provided in the article. Then I found two really helpful articles on "Microsoft Social" which were "Painfully slow internet on Windows 7" and "Slow Internet and Page Timeouts". Although the second article was intended for Windows Vista, but works for Windows 7 as well. Here I will summarize only the key points from the two and will try to make them equally useful for both teach and general user. Please be advised not to make any changes to the Windows Registry without proper backup or supervision and better to try out all the other suggestions leaving registry as the absolute last resort.
Use Selective Startup (Clean Boot)
- Click Start, click Control Panel, click Administrative Tools, and then double-click System Configuration.
- Click Continue, or provide Administrator credentials if prompted.
- Click the General tab, and click Selective startup.
- Under Selective startup uncheck Load startup items.
- Click the Services tab, check the Hide all Microsoft services box, and then click Disable all (not necessary to disable all services but a few that take up internet or network resources. On Dell its found that "Advanced Networking Service" by Dell is found to cause the problem).
- Click the Apply, then OK, and then Restart.
Use Fix it For Me or Fix it Yourself
Try uninstalling IPv6 on all interfaces, removing any IPv6 virtual adapters, and resetting the TCP/IP stack. To remove IPv6, go into the properties for each network adapter and either uncheck the box next to the protocol "Internet Protocol version 6 (TCP/IPv6), that will disable it, or select it and click uninstall, which will remove it off the computer. Then go into device manager and remove any 4to6 adapters, WUN miniport adapters, or tunnel adapters.
NOTE: You should do this for each network connection.
Tuesday, June 29, 2010
Installing MongoDB Service on Windows7
The time when SQL was considered to be the Lingua Francia for data storage and retrieval will soon be coming to an end. No SQL databases have shown that they are way faster when it comes to data storage and retrieval. Among the many new Object or Document Databases (for simplicity we will refer to them as No SQL Databases) MongoDB is one which has shown and is still showing a lot of promise. In order to make it easier for people to you can find a comparison fo SQL Server 2008 vs. MongoDB here.
Now lets have a look at how to install MongoDB as a service on Windows7, (below are actual extracts from http://www.michaelckennedy.net/blog/2010/04/29/MongoDBVsSQLServer2008PerformanceShowdown.aspx)
Now lets have a look at how to install MongoDB as a service on Windows7, (below are actual extracts from http://www.michaelckennedy.net/blog/2010/04/29/MongoDBVsSQLServer2008PerformanceShowdown.aspx)
- Download and extract the MongoDB archive appropriate for your system. http://www.mongodb.org/display/DOCS/Downloads
- Copy the extracted folder to C:\ and rename it mongo.
- Create a directory called 'data' inside C:\mongo
- Click on the Start Menu and enter "cmd" in the search box. Right-click on cmd.exe and select "Run as administrator." This is VERY important because you won't be able to register MongoDB as a service if you run cmd.exe with normal privileges.
- Type "C:\mongo\bin\mongod --install" to register MongoDB as a Windows service. This will probably output what may look like an error message, but don't worry ... as long as you really did run cmd.exe with administrator privileges, everything is fine.
- Click on the start menu and enter "regedit" in the search box. Click on regedit.exe, and then browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services. There should be child folder there named MongoDB that has several keys inside it. If not, go back to step 4 and try again.
- The ImagePath key should read "c:\mongo\bin\mongod --service" right now; change it to "c:\mongo\bin\mongod --service --dbpath c:\mongo\data". This will allow MongoDB to find its data files.
- Click on the Start Menu and enter "services" in the search box. Click on the "Component Services" option.
- In the pane on the far left, double-click on "Services (Local)." Locate MongoDB in the list in the center pane, and double click on it to bring up the properties inspector window.
- Make sure "Startup type" is set to automatic. Then click on the "Start" button.
- Browse to http://localhost:28017/ to verify that MongoDB is really running.
Subscribe to:
Posts (Atom)