Tips Posts
Useful Shortcut Keys for Android StudioAndroid Development
![Useful Shortcut Keys for Android Studio](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/90/useful-shortcut-keys-for-android-studio.png)
Useful Shortcut Keys for Android StudioAndroid Development
Hello, friend, the shortcut way everyone likes. but remember a shortcut is to improve yourself and save time. It's a very good way. so in this blog learning the android studio shortcut key.use all short cut key and save time and performance improve
Search Keys:
- Shift+Shift — Search Everywhere
- Ctrl+F — Find Text within a Single File
- Ctrl+Shift+F-Find Text in All Files
- Ctrl+R — Replace Selected Text in a Single File
- Ctrl+Shift+R — Replace Selected Text in all Files (Be Careful while Using This)
- Ctrl+Shift+A —Search for IDE Commands
Navigation Keys:
- Ctrl+N — Navigate to Class
- Ctrl+Shift+N — Navigate to a File
- Ctrl+B — Jump to Declarations
- Alt+ ↑ — Jump to the Previous Method
- Alt+↓ — Jump to Next Method
- Ctrl+G — Jump to Line
- Ctrl+E — Recent Files
- Ctrl+Shift+Backspace — Jump to Last Edited Location
- Ctrl+B — Find Declarations
- Ctrl+Left Mouse(or)Ctrl+Alt+F7— Show Usage
- Alt + F7 / Ctrl + F7 — Find usages /Find usages in file
- Ctrl+Shift+B — Find Implementations
- F3 — Find Next
- Shift+F3 — Find Previous
BookMark Keys:
- F11 — Toggle bookmark
- Ctrl+F11 — Toggle bookmark with the mnemonic(0–9 or A-Z)
- Ctrl +(0–9) — Go to numbered bookmark
- Shift+F11 — Show all Bookmarks
- Ctrl + Shift + F7 — Highlight usages in file
Selection Keys:
- Ctrl + W — Extend selection (selects a word->line->method->Class )
- Ctrl +Shift+ W — Decrease Selection
- Alt + J — Select next occurrence
- Ctrl + Alt + Shift + J — Select all occurrences
- Alt + Shift + J — Unselect occurrence
- Ctrl+Shift+V — Paste from recent buffers (from a History of Copied Contents)
Editing Keys:
- Ctrl+F6 — Refactor Code
- Ctrl+D — Duplicate a Line/Selected part
- Ctrl+Y — Delete a Line/Selected part
- Ctrl+Q — Quick Documentation
- Ctrl + Space — Code completion
- Ctrl+Shift+Space — Smart code completion (by expected type removes unrelated suggestions)
- Alt+Insert — Generate Code
- Ctrl+J — Insert Live template
- Ctrl + O — Override methods
- Ctrl + I — Implement methods
- Ctrl + Alt + T — Surround with…
- Ctrl + / — Comment / uncomment with line comment
- Ctrl + Shift + / — Comment / uncomment with block comment
- Ctrl+Alt+L — Reformat code
Run:
- Ctrl + F9 — Compile and Run Make a project
- Ctrl + Shift + F9 — Compile selected file, package or module
- Shift + F10 — Run
- Shift + F9 — Debug
- Ctrl + Shift + F10 — Run context configuration from editor
Debugging:
- F8 / F7 — Step over / into
- Shift + F7 / Shift + F8 — Smart step into/Step out
- Alt + F9 — Run to cursor
- Alt + F8 — Evaluate expression
- F9 — Resume program
- Ctrl + F8 — Toggle breakpoint
- Ctrl + Shift + F8 — View breakpoints
How to explain the tricks to close your next dealSales
![How to explain the tricks to close your next deal](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/80/2020-12-19-5fddd20934e0e.png)
How to explain the tricks to close your next dealSales
Introduction
Let's review the persuasion strategy you can implement today to close your next deal.
1. Personalize your message
This doesn't mean you need to fully wing your sales calls, it does mean you need to be prepared to adjust your message based on what interests you in the potential.
2. Focus on problem-solving
3. Give social proof
While buyers may take your point as a sales representative with a grain of salt because they know you want to sell, they are more likely to trust a testimonial or story from a previous customer who was looking for a similar solution.
4. Assume goals
Then during a call, potentially throws out several turns, asking you questions and mentioning objections that you weren’t prepared to account for - the dream of every sales rip. But don't go too far. This is a valuable learning experience.
5. Empower empowerment decision making
6. Make personal connections
7. Don’t rush into the process
How To Grow Your Business - 2Sales
![How To Grow Your Business - 2](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/57/2020-12-10_5fd22bc193aac.png)
How To Grow Your Business - 2Sales
Here is part one of How To Grow Your Business - 1
Introduction
You can only develop products and services that are very effective if you pay attention to the needs of your customers and prospects. One way to understand exactly what your customers want is through research and surveys.
8. Create a sales funnel
The first way to grow your business faster is by creating a sales funnel. If you do not have a sales funnel, you are making a big mistake. Sales funnels can help automate your business.
It helps you grow and grow quickly and easily. Sure, there are some front-end functions involved. Is natural. But, once those processes are suspended, they will travel easily from there.
9. Use a customer management system
Manually tracking transactions is difficult. No one wants to do that. It becomes a burden as the business grows. If you want to scale quickly, use a customer management system.
10. Competition research
When going to the market, and you are really looking to get your offer out to the public, you need to research the competition. Frasier says he uses two platforms to do his own research. The first is the same web.
11. Create a customer loyalty program
Loyalty programs are the best way to increase sales. It costs three times more to acquire new customers than to sell something to an existing customer.
Other resources pin this number anywhere from four to 10 times more. However, whichever way you cut it, getting new customers is expensive.
12. Identify new opportunities
Analyze new opportunities in your business by better understanding your demographics. Understand everything from distribution channels to your direct competitors, and also analyze overseas markets and other potential industries.
With the right amount of potential analysis, you are likely to immediately pursue dozens of new opportunities.
13. Create an email list
One of the best and most effective ways to grow a business quickly is to create an email list. Clearly, that means you need to have a lead magnet.
14. Think of the franchise model.
If you have a successful business, and you are trying to grow really fast, consider franchising it. Although franchise costs are high and moving towards a franchise model is complex and it takes a lot in marketing, how can it all make a difference if you are looking for really fast growth.
How to build Pagination with Laravel LivewireLaravel
![How to build Pagination with Laravel Livewire](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/40/pagination-with-laravel-livewire.png)
How to build Pagination with Laravel LivewireLaravel
Livewire is a very awesome thing that I have ever seen, the old school developers are still using the jquery and ajax concept to not refresh the page. But forget the jquery and ajax stuff. If you are good at PHP then you can do the same with Laravel Livewire.
Wait what?
Load dynamic data on the page without using ajax? Yes, it is possible with Laravel Livewire. So that is all about laravel livewire, and in this tutorial, we will see how to build laravel pagination with laravel livewire.
Let's start and I hope you have already set up the livewire. Let's say you already have created a component named UsersListing
Now in the users listing, we want to paginate all users and we will list 10 records per page.
How to use pagination with Laravel Livewire
Livewire provides a trait called WithPagination
and you have to add it into your component UsersListing
. Check out the following code:
use Livewire\WithPagination;
use Livewire\Component;
class UsersListing extends Component
{
use WithPagination;
public function render()
{
return view('livewire.users.index', [ 'users' => User::paginate(10), ]);
}
}
And to load pagination you have to add the following code:
@foreach ($users as $user) ...
@endforeach {{ $users->links() }}
That's it, and your laravel pagination now works like charm without page refresh. There is much more about pagination like how to use it with a custom view, how to use it with a custom theme. We will see it in our next tutorial, until then enjoy the code
How to Keep Your Customers Happy & Increase Repeat ProjectSales
![How to Keep Your Customers Happy & Increase Repeat Project](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/39/customers-happy-and-increase-repeat-project.png)
How to Keep Your Customers Happy & Increase Repeat ProjectSales
Introduction
Increasing customer loyalty is a requirement of any organization. If a recurring project is found, the organization develops. Do not require to generate new leads. The cycle of the company runs from the existing customer and scales the company.
1. Keep in touch
Keep in touch with each client every few months to make sure everything goes smoothly. During a class or meeting, ask about your client's challenges. Issues you can resolve. They are more likely to turn to you when they need you.
2. Create high-quality software
One of the best ways to keep customers coming back is to always develop high-quality software. You can do this by meeting the expectations of your customers and also by making sure that they are satisfied with your work. Help your customers save money and get rid of waste, ultimately deliver huge profits for them, and possibly do more business for you.
3. Listen carefully when your customers are speaking to you
Try to give your customers your undivided attention. Multi-tasking is often. When customers are in front of you, make eye contact.
4. Collaborate with clients
To ensure quality in the software you develop and keep your customers happy, you should encourage collaboration with your clients. Meet with them and ask questions so you can fully understand use cases for the software you are developing. Bring new ideas to make suggestions on how to make improvements.
5. Demonstrate time management skills
Tracking time is also key to the success of a project, you should be able to provide detailed reports to your clients for the time spent on their particular projects. They’ll be more likely to hire you again if they see you’re organized and working efficiently.
6. Keep your promises to your customers
When you tell your customer you are going to do something, follow-up as quickly as possible. Given the time frames and honor them.
7. Don’t waste your customers’ time
Everyone is busy. Complicated voice mail systems, making customers repeat their service requests more than once and un-knowledgeable employees are some major time-wasters. A customer’s time is as important as your time!
8. Ask your customers what they want
Constantly ask your customers what you can do for them and how you can do it better. They want extended hours, academic classes, or the ability to talk to the manager. After you ask, try to give them what they want and keep them informed of the process along the way.
We will see more points in our next tutorial.
Retrieve count of nested relationship data in LaravelLaravel
![Retrieve count of nested relationship data in Laravel](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/34/retrive-count.png)
Retrieve count of nested relationship data in LaravelLaravel
Recently in one of our client's projects, we want to load the count of relation in laravel. But we do not want to retrieve original records.
For example,
We have the following Models,
- Category
- Products
- Orders
For that, we have categories
, products
, orders
, order_items
table. Where in the order_items
table, we got the following fields
- order_id
- product_id
- quantity
So the requirement was, In the Products table, we want to display the total number of orders placed with that item regardless of the quantity in each order. All we need is a number of orders where the product is purchased.
1st way: Query via Relationship
$products = Product::all();
$productsArr = $products->map(function (Product $product)
{
$productObj = $product->toArray();
$productObj['orders_count'] = $product->orders()->count();
return $productObj;
}
);
But the problem with this approach was, we are firing queries to the database for every single product. so if I'm retrieving 100 Products from the database then it will fire 100 additional queries to the database. Imagine if we have thousands of products.
2nd way: Eager Load Relationship and Calculate Count
$products = Product::with('orders')->get();
$productsArr = $products->map(function (Product $product)
{
$productObj = $product->toArray();
$productObj['orders_count'] = $product->orders->count();
return $productObj;
}
);
so this way, we are only firing two queries to the database. But the problem here is, we are loading all the Orders of each product which we don't need at all. so it will consume lots of memory since we are loading lots of orders. so imaging if we retrieve 100 products, and each product has 10 orders, then we are loading 1000 Orders into memory without any need.
3rd way: Use withCount function
The third powerful approach of using withCount
function in Laravel. so we refactored our code like,
$products = Product::withCount('orders')->get();
$productsArr = $products->map(function (Product $product)
{
$productObj = $product->toArray();
$productObj['orders_count'] = $product ->getAttribute('orders_count');
return $productObj;
}
);
In this approach, we are firing two queries but no Order models are loaded into memory.
4th Bonus: Using in a nested relationship while multiple eager loading
You can even use it with nested relationships. Imagine a case, where you want to retrieve categories along with its products with orders count.
$categories = Category::with(['products' => function ($query)
{
$query->withCount('orders');
},
'someOtherEagerLoading1',
'someOtherEagerLoading2'
])->get();
$categoriesArr = $categories->map(function (Category $category)
{
$categoryObj = $category->toArray();
$categoryObj['products'] = $category->products->map(function (Product $product)
{
$productObj = $product->toArray();
$productObj['orders_count'] = $product ->getAttribute('orders_count');
return $productObj;
});
return $categoryObj;
});
Hope this will help you to retrieve the count of relationship data without retrieving actual relation data.
Using Common StatusTrait in Laravel in multiple modelsLaravel
![Using Common StatusTrait in Laravel in multiple models](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/32/common-status-trait.png)
Using Common StatusTrait in Laravel in multiple modelsLaravel
Recently, we were working on a laravel app where we have a status column in multiple models. We have multiple processes going on for which we have different jobs.
Initially job status will be "Pending", then each job will take one record, change the status to "Running" and process that record, and update the status to either "Completed" or "Failed".
We have constants for each status. Something like below,
static $STATUS_PENDING = 0;
static $STATUS_RUNNING = 1;
static $STATUS_COMPLETED = 2;
static $STATUS_FAILED = 3;
And the problem is, we need to go and define the status in every model that we have (around 10+ models).
Then we have functions to update status and check the status in each model like,
public function markRunning($saveRecord = true)
{
$this->status = static::$STATUS_RUNNING;
if ($saveRecord) {
$this->save();
}
}
public function isRunning()
{
return $this->status === static::$STATUS_RUNNING;
}
And above functions existed for each 4 status. So what we did is, we created a common StatusTrait
which can be used across multiple models.
Here is the code of StatusTrait that you can find for that.
Then in each model, we use this trait. For e.g.,
class SavePdf extends Model
{
use StatusTrait;
.....
}
And then can use any method of trait in all the models,
...
$savePdf = new SavePdf();
$savePdf->markRunning();
...
Or we can check if the status of the model is running or not. For e.g.,
...
if ($savePdf->isRunning())
{
// logic here
}
...
This is how we have saved tons of writing code and optimized the code. Another advantage is, we can just update the value of any status from one single place.
You can also check this kind of pattern and do something like this.
Use Laravel Debugbar's measure function to optimize application performanceLaravel
![Use Laravel Debugbar's measure function to optimize application performance](https://d37y9b4kfek2hl.cloudfront.net/blog/images/posts/31/debugbar-timeline.png)
Use Laravel Debugbar's measure function to optimize application performanceLaravel
Laravel Debugbar is a great package to debug Laravel applications while developing. But it's not just limited to debugging. You can use it to optimize the performance of your app a lot as well. Like,
- number of models loaded in a memory
- number of queries fired with timing
- memory used and more.
In short, we can have a complete view of what's going on in each request.
But the less known and used feature it gives is the Timeline tab. Where you can see how much time is taken for each request. And more than that, how much time Laravel took to boot up and how much time our other code has taken. Check the below screenshot.
Recently we came to the case, where one of our consultation clients' CRM application was taking too much time on the first load. Their developers were not able to spot a problem. They checked queries and other stuff which looked completely good. so we were not sure where the time had been spent by the application.
That's where debugbar came to rescue us. We used its measure function facility by which we can measure the time spent in each of the functions wherever we want to use. It gives simply two functions startMeasure
and stopMeasure
to measure the time spent between these two statements.
so we can put startMeasure
in the starting of function and put stopMeasure
at the end of the function which will render something like this in the timeline tab.
public function searchClients($department)
{
\Debugbar::startMeasure("searchClients'');
// logic here
\Debugbar::stopMeasure("searchClients");
return $result;
}
Once we put this, we get a time that < code > searchClients is taking. Check the screenshot below,
Hope this can help you to figure out what piece of code is taking the time and you can optimize it.
Happy Optimizing :)