rest Are These the Most Interesting Front-end Developer Tools for 2021? By www.impressivewebs.com Published On :: Tue, 05 Jan 2021 09:47:31 +0000 When I come to the end of any given year, it’s always interesting to look back through the click-through stats for my weekly newsletter Web Tools Weekly to see which tools got the most attention. This year wasn’t all that different from previous years. I’ve learned that clicks happen for basically one of two reasons: The post Are These the Most Interesting Front-end Developer Tools for 2021? appeared first on Impressive Webs. Full Article Roundups and Resources
rest West versus the rest: On western conduct and India By www.thehindu.com Published On :: Wed, 23 Oct 2024 00:10:00 +0530 The West must not tolerate terror threats in the name of free speech Full Article Editorial
rest Duo arrested for possession of banned tobacco products worth ₹3 lakh in Tiruchi By www.thehindu.com Published On :: Wed, 06 Nov 2024 18:23:30 +0530 Full Article Tiruchirapalli
rest Three arrested for assaulting doctor in ESI hospital By www.thehindu.com Published On :: Wed, 06 Nov 2024 19:23:47 +0530 Full Article Tiruchirapalli
rest The secret sauce behind ITC’s enduring restaurant brands By www.thehindubusinessline.com Published On :: Sun, 20 Oct 2024 10:45:54 +0530 The promise of an unchanged, consistent menu and supreme culinary artistry has drawn food lovers to ITC’s tables for decades Full Article Marketing
rest Morning runs, protein-packed breakfast, and a rest day By www.thehindubusinessline.com Published On :: Sun, 20 Oct 2024 20:19:00 +0530 The daily quest to balance work, health, and personal life Full Article Pulse
rest Delhi L-G inspects Gole Market restoration project By www.thehindu.com Published On :: Wed, 06 Nov 2024 01:16:27 +0530 Full Article Delhi
rest 29-year-old woman arrested from Delhi’s Shakurpur for human trafficking minor By www.thehindu.com Published On :: Fri, 08 Nov 2024 00:18:36 +0530 Full Article Delhi
rest Three arrested for raping intellectually disabled research scholar from Odisha By www.thehindu.com Published On :: Fri, 08 Nov 2024 01:09:38 +0530 Full Article Delhi
rest Delhi cop Nidhin Valsan’s inspiring journey from arresting cancer to Ironman finish line By www.thehindu.com Published On :: Fri, 08 Nov 2024 02:05:22 +0530 Diagnosed with stage 4 non-Hodgkin’s lymphoma in 2021, IPS officer Nidhin Valsan resurrected himself by competing the Ironman triathlon and writing his memoir because he hopes to be a good influence on other cancer patients Full Article Delhi
rest Inter-State arms gang busted, Delhi police arrest 18 persons By www.thehindu.com Published On :: Tue, 12 Nov 2024 00:40:02 +0530 Full Article Delhi
rest Can India arrest income inequality? By www.thehindubusinessline.com Published On :: Sun, 26 Jul 2020 20:12:21 +0530 Thomas Piketty’s prescriptions are too radical. Dattopant Thengadi’s vision is more useful for us Full Article Books
rest Interesting, but only in parts By www.thehindubusinessline.com Published On :: Sun, 29 Aug 2021 20:33:39 +0530 The profiling of 25 BITSians follows a templated style Full Article Books
rest Karnataka agriculturists retailing forest honey, gluten-free flours, and more By www.thehindu.com Published On :: Thu, 12 Oct 2023 16:55:36 +0530 In part two of this series, we look at agriculturalists in the State retailing wild forest honey, gluten-free flours, ragi malt, and more Full Article Food
rest Mangrove restoration in T.N. makes a small but steady progress By www.thehindu.com Published On :: Tue, 06 Aug 2024 22:24:48 +0530 The Tamil Nadu Forest Department and non-governmental organisations are working to restore mangroves at various sites of the Ennore-Pulicat wetlands. In the meantime, the National Centre for Coastal Research has identified land available for restoration in Cuddalore, Tiruvarur, Thanjavur, Pudukkottai, Ramanathapuram, and Thoothukudi Full Article Tamil Nadu
rest Sensex, Nifty fall over 1 %, snap two-day rally ahead of U.S. Fed interest rate decision By www.thehindu.com Published On :: Thu, 07 Nov 2024 16:32:07 +0530 Stock markets tumble over 1% as investors await U.S. Fed decision, with Sensex and Nifty dropping significantly Full Article Markets
rest Forest Department free coaching helps tribal youth in Jawadhu Hills to get government jobs By www.thehindu.com Published On :: Sun, 10 Nov 2024 18:37:23 +0530 Full Article Tamil Nadu
rest ‘Restore stops for mofussil buses on Samayapuram service road’ By www.thehindu.com Published On :: Sun, 10 Nov 2024 19:26:57 +0530 Full Article Tiruchirapalli
rest Teenager arrested for damaging Ambedkar’s statue at Vengalam By www.thehindu.com Published On :: Mon, 11 Nov 2024 20:32:03 +0530 Full Article Tiruchirapalli
rest Sri Lankan Navy arrests 12 Nagapattinam fishermen By www.thehindu.com Published On :: Tue, 12 Nov 2024 11:18:30 +0530 The fishermen had set sail on board a mechanised vessel from the Akkaraipettai fishing harbour late on Sunday night Full Article Tamil Nadu
rest Five Interesting Ways to Use Array.reduce() (And One Boring Way) By 24ways.org Published On :: Wed, 18 Dec 2019 12:00:00 +0000 Chris Ferdinandi turns the heat down low and lets the sauce reduce while we take a look at how to add spice to our source with a sprinkling of Array.reduce(). Just a little ingenuity with the humblest of functions. Of all the modern array methods, the one I had the hardest time wrapping my head around was Array.reduce(). On the surface, it seems like a simple, boring method that doesn’t do much. But below its humble exterior, Array.reduce() is actually a powerful, flexible addition to your developer toolkit. Today, we’re going to look at some cool things you can do with Array.reduce(). How Array.reduce() works Most of the modern array methods return a new array. The Array.reduce() method is a bit more flexible. It can return anything. Its purpose is to take an array and condense its content into a single value. That value can be a number, a string, or even an object or new array. That’s the part that’s always tripped me up – I didn’t realize just how flexible it is! The syntax The Array.reduce() accepts two arguments: a callback method to run against each item in the array, and a starting value. The callback also accepts two arguments: the accumulator, which is the current combined value, and the current item in the loop. Whatever you return is used as the accumulator for the next item in the loop. On the very first loop, that starting value is used instead. var myNewArray = [].reduce(function (accumulator, current) { return accumulator; }, starting); Let’s look at some examples to make this all tangible. 1. Adding numbers together Let’s say you had an array of numbers that you wanted to add together. Using Array.forEach(), you might do something like this: var total = 0; [1, 2, 3].forEach(function (num) { total += num; }); This is the cliche example for using Array.reduce(). I find the word accumulator confusing, so in this example, I’m calling it sum, because that’s what it is. var total = [1, 2, 3].reduce(function (sum, current) { return sum + current; }, 0); Here, we pass in 0 as our starting value. In the callback, we add the current value to the sum, which has our starting value of 0 on the first loop, then 1 (the starting value of 0 plus the item value of 1), then 3 (the sum value of 1 plus the item value of 2), and so on. Here’s a demo. 2. Combining multiple array methods into Array.map() and Array.filter() into a single step Imagine you had an array of wizards at Hogwarts. var wizards = [ { name: 'Harry Potter', house: 'Gryfindor' }, { name: 'Cedric Diggory', house: 'Hufflepuff' }, { name: 'Tonks', house: 'Hufflepuff' }, { name: 'Ronald Weasley', house: 'Gryfindor' }, { name: 'Hermione Granger', house: 'Gryfindor' } ]; You want to create a new array that contains just the names of wizards who are in Hufflepuff. One way you could do that is by using the Array.filter() method to get back just wizards whose house property is Hufflepuff. Then, you’d use the Array.map() method to create a new array containing just the name property for the remaining wizards. // Get the names of the wizards in Hufflepuff var hufflepuff = wizards.filter(function (wizard) { return wizard.house === 'Hufflepuff'; }).map(function (wizard) { return wizard.name; }); With the Array.reduce() method, we can get the same array in a single pass, improving our performance. You pass in an empty array ([]) as the starting value. On each pass, you check to see if the wizard.house is Hufflepuff. If it is, you push it to the newArr (our accumulator in this example). If not, you do nothing. Either way, you return the newArr to become the accumulator on the next pass. // Get the names of the wizards in Hufflepuff var hufflepuff = wizards.reduce(function (newArr, wizard) { if (wizard.house === 'Hufflepuff') { newArr.push(wizard.name); } return newArr; }, []); Here’s another demo. 3. Creating markup from an array What if, instead of creating an array of names, we wanted to create an unordered list of wizards in Hufflepuff? Instead of passing an empty array into Array.reduce() as our starting value, we’ll pass in an empty string ('') and call it html. If the wizard.house equals Hufflepuff, we’ll concatenate our html string with the wizard.name wrapped in an opening and closing list item (li). Then, we’ll return the html to become the accumulator on the next loop. // Create a list of wizards in Hufflepuff var hufflepuffList = wizards.reduce(function (html, wizard) { if (wizard.house === 'Hufflepuff') { html += '<li>' + wizard.name + '</li>'; } return html; }, ''); Add an opening and closing unordered list element before and after Array.reduce(), and you’re ready to inject your markup string into the DOM. // Create a list of wizards in Hufflepuff var hufflepuffList = '<ul>' + wizards.reduce(function (html, wizard) { if (wizard.house === 'Hufflepuff') { html += '<li>' + wizard.name + '</li>'; } return html; }, '') + '</ul>'; See it in action here. 4. Grouping similar items in an array together The lodash library has a groupBy() method takes a collection of items as an array and groups them together into an object based on some criteria. Let’s say you want an array of numbers. If you wanted to group all of the items in numbers together based on their integer value, you would do this with lodash. var numbers = [6.1, 4.2, 6.3]; // returns {'4': [4.2], '6': [6.1, 6.3]} _.groupBy(numbers, Math.floor); If you had an array of words, and you wanted to group the items in words by their length, you would do this. var words = ['one', 'two', 'three']; // returns {'3': ['one', 'two'], '5': ['three']} _.groupBy(words, 'length'); Creating a groupBy() function with Array.reduce() You can recreate that same functionality using the Array.reduce() method. We’ll create a helper function, groupBy(), that accepts the array and criteria to sort by as arguments. Inside groupBy(), we’ll run Array.reduce() on our array, passing in an empty object ({}) as our starting point, and return the result. var groupBy = function (arr, criteria) { return arr.reduce(function (obj, item) { // Some code will go here... }, {}); }; Inside the Array.reduce() callback function, we’ll check to see if the criteria is a function, or a property of the item. Then we’ll get its value from the current item. If there’s no property in the obj with that value yet, we’ll create it and assign an empty array as its value. Finally, we’ll push the item to that key, and return the object as the accumulator for the next loop. var groupBy = function (arr, criteria) { return arr.reduce(function (obj, item) { // Check if the criteria is a function to run on the item or a property of it var key = typeof criteria === 'function' ? criteria(item) : item[criteria]; // If the key doesn't exist yet, create it if (!obj.hasOwnProperty(key)) { obj[key] = []; } // Push the value to the object obj[key].push(item); // Return the object to the next item in the loop return obj; }, {}); }; Here’s a demo of the completed helper function. Special thanks to Tom Bremer for helping me make some improvements to this one. You can find this helper function and more like it on the Vanilla JS Toolkit. 5. Combining data from two sources into an array Remember our array of wizards? var wizards = [ { name: 'Harry Potter', house: 'Gryfindor' }, { name: 'Cedric Diggory', house: 'Hufflepuff' }, { name: 'Tonks', house: 'Hufflepuff' }, { name: 'Ronald Weasley', house: 'Gryfindor' }, { name: 'Hermione Granger', house: 'Gryfindor' } ]; What if you had another data set, an object of house points each wizard has earned. var points = { HarryPotter: 500, CedricDiggory: 750, RonaldWeasley: 100, HermioneGranger: 1270 }; Imagine you wanted to combine both sets of data into a single array, with the number of points added to each wizard’s data in the wizards array. How would you do it? The Array.reduce() method is perfect for this! var wizardsWithPoints = wizards.reduce(function (arr, wizard) { // Get the key for the points object by removing spaces from the wizard's name var key = wizard.name.replace(' ', ''); // If the wizard has points, add them // Otherwise, set them to 0 if (points[key]) { wizard.points = points[key]; } else { wizard.points = 0; } // Push the wizard object to the new array arr.push(wizard); // Return the array return arr; }, []); Here’s a demo combining data from two sources into an array. 6. Combining data from two sources into an object What if you instead wanted to combine the two data sources into an object, where each wizard’s name was the key, and their house and points were properties? Again, the Array.reduce() method is perfect for this. var wizardsAsAnObject = wizards.reduce(function (obj, wizard) { // Get the key for the points object by removing spaces from the wizard's name var key = wizard.name.replace(' ', ''); // If the wizard has points, add them // Otherwise, set them to 0 if (points[key]) { wizard.points = points[key]; } else { wizard.points = 0; } // Remove the name property delete wizard.name; // Add wizard data to the new object obj[key] = wizard; // Return the array return obj; }, {}); Here’s a demo combining two data sets into an object. Should you use Array.reduce() more? The Array.reduce() method has gone from being something I thought was pointless to my favorite JavaScript method. So, should you use it? And when? The Array.reduce() method has fantastic browser support. It works in all modern browsers, and IE9 and above. It’s been supported in mobile browsers for a long time, too. If you need to go back even further than that, you can add a polyfill to push support back to IE6. The biggest complaint you can make about Array.reduce() is that it’s confusing for people who have never encountered it before. Combining Array.filter() with Array.map() is slower to run and involves extra steps, but it’s easier to read. It’s obvious from the names of the methods what they’re supposed to be doing. That said, there are times where Array.reduce() makes things that would be complicated more simple rather than more complicated. The groupBy() helper function is a good example. Ultimately, this is another tool to add to your toolkit. A tool that, if used right, can give you super powers. About the author Chris Ferdinandi helps people learn vanilla JavaScript. He believes there’s a simpler, more resilient way to make things for the web. Chris is the author of the Vanilla JS Pocket Guide series, creator of the Vanilla JS Academy training program, and host of the Vanilla JS Podcast. His developer tips newsletter is read by thousands of developers each weekday. He’s taught developers at organizations like Chobani and the Boston Globe, and his JavaScript plugins have been used used by Apple and Harvard Business School. Chris Coyier, the founder of CSS-Tricks and CodePen, has described his writing as “infinitely quote-worthy.” Chris loves pirates, puppies, and Pixar movies, and lives near horse farms in rural Massachusetts. He runs Go Make Things with Bailey Puppy, a lab-mix from Tennessee. More articles by Chris Full Article Code javascript
rest Editorial. SEBI right in trying to restrict retail F&O punts By www.thehindubusinessline.com Published On :: Thu, 01 Aug 2024 21:34:12 +0530 These punts result in flight of capital too, as the counter-parties are often global algo-trading and high frequency shops Full Article Editorial
rest Editorial. BJP’s remarkable show in Haryana; NC wrests J&K By www.thehindubusinessline.com Published On :: Tue, 08 Oct 2024 21:24:17 +0530 BJP wins in Haryana for third successive time Full Article Editorial
rest Five arrested in attack case; police deny political angle in attack on YSRC activist By www.thehindu.com Published On :: Sun, 10 Nov 2024 16:21:23 +0530 The attacker was a tenant of the victim and had a grudge as he had been asked to vacate the by the victim, the police said Full Article Andhra Pradesh
rest Man arrested and 20 stolen motorcycles worth ₹15 lakh recovered in Nandyal By www.thehindu.com Published On :: Mon, 11 Nov 2024 20:52:54 +0530 Full Article Andhra Pradesh
rest The case for a nature restoration law in India By www.thehindu.com Published On :: Tue, 22 Oct 2024 00:58:00 +0530 The law enacted by the European Union recently is a model worth following Full Article Comment
rest Mangaluru police arrest Puttur resident, seize 300 grams of hydro weed worth ₹30 lakh By www.thehindu.com Published On :: Sat, 02 Nov 2024 14:58:50 +0530 Mangaluru police arrest Mohammed Hafeez for trafficking hydro weed from Thailand and also the Central Crime Branch seizes 2.5 kg of cannabis worth ₹75,000 Full Article Mangaluru
rest Police arrest two, seize ₹50,000 worth of MDMA By www.thehindu.com Published On :: Sun, 03 Nov 2024 22:05:12 +0530 Full Article Mangaluru
rest Two Rajasthan youth who cheated Amazon delivery partner of ₹11.45 lakh in Mangaluru arrested By www.thehindu.com Published On :: Sun, 03 Nov 2024 22:22:23 +0530 Full Article Mangaluru
rest Traffic restrictions in place till 10 a.m. of November 10 for Mangalore Marathon By www.thehindu.com Published On :: Thu, 07 Nov 2024 07:00:00 +0530 The Mangalore Marathon comprises of 42K, 32K, 21K, 10K, 10K students run, 5K, 5K student run and 2K Gammat run between Mangala Stadium and Tannirbhavi second beach Full Article Mangaluru
rest Samithi to hold collective dharna on November 26 demanding complete restoration of Nanthoor-Surathkal stretch of NH 66 By www.thehindu.com Published On :: Thu, 07 Nov 2024 07:00:00 +0530 Preparatory meeting highlights battered carriageway stretch, absence of service roads and shoulder drains and delayed execution of new bridge at Kulur Full Article Mangaluru
rest KSRTC directed to return penal interest deducted from retirement benefit By www.thehindu.com Published On :: Sun, 10 Nov 2024 07:00:00 +0530 Full Article Mangaluru
rest Police arrest six on charges of group assault and attempt to murder a youth in Bantwal taluk By www.thehindu.com Published On :: Sun, 10 Nov 2024 22:45:22 +0530 Full Article Mangaluru
rest Prestige Estates raises ₹5,000 crore via QIP By www.thehindubusinessline.com Published On :: Thu, 05 Sep 2024 09:13:34 +0530 The company launched its QIP on August 29 to raise funds Full Article Markets
rest Interest subsidy to be provided only once for a property under PMAY-U 2.0 By www.thehindubusinessline.com Published On :: Sun, 13 Oct 2024 18:43:29 +0530 Affordable housing transactions could be impacted due to clause Full Article Real Estate
rest Housing loan growth slows as interest rates and property prices surge By www.thehindubusinessline.com Published On :: Wed, 23 Oct 2024 18:24:49 +0530 Recent data from the RBI on gross bank credit by major sectors shows that the year-on-year growth in housing loans was 13.1 per cent in August 2024, a steep drop from 40.5 per cent in August 2023. Full Article Data Focus
rest Telangana CID arrests two involved in pan-India job fraud racket By www.thehindu.com Published On :: Thu, 07 Nov 2024 11:29:31 +0530 Full Article Telangana
rest Woman arrested after kidnap attempt in Koti Government Maternity Hospital By www.thehindu.com Published On :: Thu, 07 Nov 2024 18:41:29 +0530 The accused was a habitual offender and had made a vain bid on Tuesday night, before being caught by the hospital staff and police on Wednesday Full Article Telangana
rest ₹4.8 crore loan fraud scheme unearthed at SBI Sanathnagar, eight more arrested By www.thehindu.com Published On :: Thu, 07 Nov 2024 21:26:49 +0530 Full Article Telangana
rest Cyberabad | Four arrested for vandalising Gandhi statue By www.thehindu.com Published On :: Fri, 08 Nov 2024 11:42:57 +0530 Full Article Hyderabad
rest Key agent in Cambodia job racket arrested in Delhi By www.thehindu.com Published On :: Fri, 08 Nov 2024 18:11:22 +0530 Full Article Telangana
rest Hyderabad man loses ₹1.73 lakh trying to get 0% interest loan on insurance policy worth ₹10 lakh By www.thehindu.com Published On :: Fri, 08 Nov 2024 18:29:42 +0530 Full Article Telangana
rest Eleven transgenders arrested for public nuisance in Cyberabad By www.thehindu.com Published On :: Fri, 08 Nov 2024 20:59:02 +0530 Full Article Telangana
rest Man arrested for sexually assaulting mother-in-law in Balapur By www.thehindu.com Published On :: Fri, 08 Nov 2024 21:13:40 +0530 Full Article Telangana
rest Cockroach infestation found at CCMB canteen; hygiene violations flagged at Nacharam restaurants By www.thehindu.com Published On :: Sat, 09 Nov 2024 18:01:58 +0530 Full Article Hyderabad
rest Man, accused of murdering ‘friend’ in Sept., arrested By www.thehindu.com Published On :: Sat, 09 Nov 2024 20:48:09 +0530 Full Article Telangana
rest Man arrested for kidnapping, marrying, sexually assaulting minor By www.thehindu.com Published On :: Sat, 09 Nov 2024 21:24:54 +0530 Full Article Telangana
rest Explosion at restaurant injures four in Hyderabad’s Jubilee Hills By www.thehindu.com Published On :: Sun, 10 Nov 2024 22:49:03 +0530 Full Article Telangana
rest Man arrested for shooting at father of woman he liked By www.thehindu.com Published On :: Mon, 11 Nov 2024 13:07:48 +0530 Full Article Hyderabad
rest Hyderabad commissioner restricts city-wide ban to vicinity of Telangana Secretariat By www.thehindu.com Published On :: Mon, 11 Nov 2024 18:05:04 +0530 The new order comes into effect from November 11 until further notice, said the commissioner Full Article Hyderabad