How to reverse the ids in a mysql table column without breaking primary key constraint?

Let me explain the problem scenario: Let us assume we have a table with 4 columns in it out of which 1 is PRIMARY column and rest 3 contain some data. What we want to do is to reverse the primary key IDs for that data keeping the rest of data intact. It is like shifting the first row to end and moving last row to starting. Initial Data id name email anything 1 jacob whatever how to reverse 3 nathan whosoeverisnathan ids in mysql table column 4 jagmohan idontknowjagmohan without breaking 8 monica iamsexy primary key constraint 9 batman idontexistinrealworld i am batman Data after update id name email anything 9 jacob whatever how to reverse 8 nathan whosoeverisnathan ids in mysql table column 4 jagmohan idontknowjagmohan without breaking 3 monica iamsexy primary key constraint 1 batman idontexistinrealworld i am batman Dude, you are just reversing the column, what is so tough in this? So, this seems simple to reverse an array if isolated by key “id“. But you have to understand that this column is the primary key. So if you run a command to change id for “jacob” to “9“. It will give you error: “Duplicate entry for id 9“ ...

June 1, 2019 · 2 min · Harshvardhan Malpani

How to remove sign in popup from Magento 2 checkout page?

Magento2 has this authentication pop-up on the checkout page, which many store owners won’t like to see on their checkout page. It’s the Sign In button that guests see at the top of the checkout, which opens a login box. If you want guests to go straight to the shipping form, it’s a distraction. Customers who have an account can still sign in without it: when someone types a registered email address in the email field of the shipping step, Magento shows a password field there. ...

May 27, 2019 · 3 min · Harshvardhan Malpani

How to show correct item count in Magento 2 Checkout Order summary?

On the Magento 2 checkout page, the order summary in the sidebar has a heading telling the customer how many items are in the cart. That number counts line items, meaning different products, not the quantity. A customer with five of one product and one of another sees 2 rather than 6, which looks wrong to them. The number comes from a small Knockout template, so the fix is to override that template in your theme and make it show the total quantity instead. ...

May 27, 2019 · 3 min · Harshvardhan Malpani

How to dump all options for any attribute in Magento 2 programmatically?

Sometimes you just need a list of every option of a dropdown attribute, such as all manufacturers or all colours, with their option IDs: to check for duplicates, to map values for an import, or to hand to someone else. The admin shows the options on the attribute’s edit page, but not in a form you can copy easily. This script prints them as a simple two-column table, sorted by label. ...

May 21, 2019 · 3 min · Harshvardhan Malpani

How to remove files with “No Content Changes Found” in Git Desktop

Git desktop clients such as GitHub Desktop sometimes list dozens or hundreds of files as changed, but when you click one, there’s no diff, only “No Content Changes Found”. It typically happens after copying a project between Windows and Linux or macOS, unzipping a backup, or running a chmod over the whole folder. Git has noticed something about the files that changed, just not the text you see in them. ...

May 8, 2019 · 4 min · Harshvardhan Malpani

Mouse and Keyboard sharing across Computers

We use multiple computers in workspace or in home. Often need to share same mouse and keyboard for all because you probably have a wireless/wired keyboard mouse set. here arises the issue that how to share same set of input controllers for both machines. Below are a few free and paid options for you to choose from. They all work as expected when computers are connected via LAN or WiFi ...

May 5, 2019 · 2 min · Harshvardhan Malpani

Magento 2 Multi Select click all code – Tax Rates

When you create or edit a tax rule in Magento 2 (Stores > Tax Rules), you pick its tax rates from a scrolling list of checkboxes. If you’ve imported hundreds of rates, ticking every one of them by hand takes ages. This snippet ticks them all for you. Open the tax rule page, then open the browser console (Ctrl + Shift + J in Chrome, Cmd + Option + J on a Mac). Put the following code in the console. ...

April 26, 2019 · 2 min · Harshvardhan Malpani

How to fix Undefined class constant ‘ARRAY_AS_PROPS’ Fatal Error?

This one cost me some time because the error points at PHP, but the fix was in the Apache configuration. It shows up on PHP applications that use zend-http, the HTTP component of Zend Framework that many projects (Magento 2, for example) install through Composer. The page fails with a fatal error, and the log points to a file inside the vendor folder. I received this error: “Fatal Error: Uncaught error in Undefined class constant ‘ARRAY_AS_PROPS’”. This issue is not related to PHP if you have 7.0 and above. It is Zend Framework’s zend-http module that is affected if an Apache module is not present. ...

April 17, 2019 · 3 min · Harshvardhan Malpani

3 ways to put a webpage on 100% device width

When a page is wider than a phone’s screen, you get a sideways scrollbar, or the whole page is shrunk down with tiny text. These are the three things I check to get a page to fit the device width exactly. <meta name="viewport" content="width=device-width, initial-scale=1"> overflow-x: auto; body,html{max-width:100%} 1. The viewport meta tag. This goes inside the <head> of every page. Without it, mobile browsers lay the page out as if the screen were desktop-sized (around 980px wide in Safari on the iPhone) and then shrink the result to fit. width=device-width makes the layout width match the device’s screen, and initial-scale=1 opens the page at 100% zoom. It’s also what makes CSS media queries for small screens work, because without it the browser reports the desktop-sized width. ...

April 1, 2019 · 2 min · Harshvardhan Malpani

Quick tips on American SALES TAX for developers who are setting up an ecommerce store for USA based organization

So, all of the info you read below is the summary of 6 hours I spent yesterday in gathering information about taxes in USA. – to be particular – Sales Tax. Not Income tax To start with, USA has 50 states, meaning constituent political entity. All states have their own rules for sales tax and there is no nation-wide sales tax as such. So if you are an store owner in any particular, you will have to charge your customers taxes, which you are supposed to pay to the state. ...

March 15, 2019 · 4 min · Harshvardhan Malpani