Categories
Android Device Hardware Nexus 5 Open Source Solutions

How To Disable Keyboard Touch Vibration in Android 6 Marsh Mallow (Nexus 5x & 6p)

Google Keyboard is the default keyboard in the Android 6(Marsh Mallow). By default, its configured to enable vibration on key press. If you are someone who dislikes this feature and wants to disable it, here is a simple way of disabling it:
{adinserter 3}

  • Go to Home -> Settings -> Language & input
  • Locate “Google Keyboard” and press it to open its options.
  • Select Preferences
  • Disable the “Vibrate on keypress” option and you are good
Categories
FaceBook Open Source Web

How to stop videos from playing automatically in the Facebook News Feed?

Facebook’s video auto-play settings can be turned on or off. This will help you save bandwidth and help remove the distraction of an autoplaying video. To stop videos from playing automatically do the following:
fb

  1. Go to your facebook timeline.
  2. From the top right of Facebook, click the  option and select Settings
  3. Click Videos in the left menu
  4. Click the dropdown menu next to Auto-play Videos and select Off
Categories
JavaScript jQuery Solutions Web

JavaScript Loop Through Select Options – Example

Update (2025): This guide has been updated with modern ES6+ methods and troubleshooting FAQs to ensure it works with the latest web standards and frameworks.

Iterating through dropdown (select) options is a fundamental task in web development. Whether you are validating a form, dynamically filtering data, or syncing UI states, knowing how to efficiently loop through a <select> element’s options is essential for a smooth user experience.

In this guide, we will cover the modern ES6+ way, the traditional approach, and the jQuery method.

1. Modern JavaScript (ES6+) — Recommended

The most efficient and readable way to handle this today is by converting the HTMLOptionsCollection into an array and using the forEach method. This is the standard in modern frameworks like React, Vue, or Vanilla JS projects.

JavaScript

// Get the dropdown by ID
const dropdown = document.getElementById("dropdownlist");

// Convert options to an Array and iterate
Array.from(dropdown.options).forEach((option) => {
    console.log("Text:", option.text, "Value:", option.value);
    
    // Add your custom logic or operations here
});

2. The Traditional JavaScript Loop

If you need to support legacy browsers (like very old versions of IE) or prefer the standard for loop, use the code below. It is highly performant as it avoids creating an array copy.

JavaScript

var x = document.getElementById("dropdownlist");

for (var i = 0; i < x.options.length; i++) {
    console.log("Value: " + x.options[i].value);
    
    // Perform operations based on each option
}

3. The jQuery Approach

If your project is already utilizing the jQuery library, the .each() method provides a very concise and readable syntax for targeting child options.

JavaScript

$("#dropdownlist > option").each(function() {
    console.log("Text: " + this.text + " | Value: " + this.value);
    
    // Add your operations here
});

Comparison Table: Which Method Should You Use?

MethodBest ForComplexity
ES6 Array.from()Modern Web Apps / Clean CodeLow
Standard for loopHigh Performance / Legacy SupportMedium
jQuery .each()Projects already using jQueryLow

Frequently Asked Questions (FAQs)

How do I select a specific value while iterating?
You can add a simple conditional check inside your loop. For example: if (option.value === "target") { option.selected = true; }

How do I get the total count of options in a dropdown?
You can simply access the length property: document.getElementById("dropdownlist").options.length;

Can I iterate through a dropdown without using an ID?
Yes, you can use document.querySelector('select') or document.getElementsByClassName('your-class') to target the element without an ID.

Categories
Android Apps Solutions

How to Enable Manual Exposure in Google Camera App

Google just updated its Camera app to bring in new features and performance. But any prolific camera user will find that the Exposure settings are missing in the options provide on screen. Don’t worry the Exposure settings have not been removed from the app, they have just been hidden by default.

Here is how to enable the setting:

  1. Open the camera app.
  2. Swipe from left to right on the screen to bring out the mode options
  3. Tap the ‘Cog Wheel'(settings button) on the bottom right.
  4. Select “Advanced”
  5. Turn On “Manual Exposure”
  6. Hit back twice to get to the main screen
  7. Tap on options button(Screen bottom right), Now Exposure option will show up with the rest of the options.
Enhanced by Zemanta
Categories
Open Source Web

Threaded Comments in WordPress

WordPress
Image via Wikipedia

WordPress has a builtin feature of allowing threaded comments for your posts. This feature is by default disabled and has to be “enabled”… Here is how to do that:

  • Login to your WordPress install as Admin(or a user with Admin permissions).
  • Navigate to the “Settings” menu and the “Discussions” option in that menu.
  • Under “Other Comment Settings” section, you will find the option: Enable threaded (nested) comments.
  • Check the option and provide the maximum depth of a thread.

Now nested comments should be enabled on your WordPress Blog.

Enhanced by Zemanta