Latest Posts:

How to query in Codeigniter with limit and without limit for pagination?

November 13, 2019 2:58 am

$this->db->start_cache(); $this->db->select(“p.*”); $this->db->from(‘product p’); $this->db->where(“p.cat_id”, “12”); $this->db->group_by(“p.id”); $this->db->stop_cache(); # Get total number of products $total_product = $this->db->count_all_results(); # show only 5 products $this->db->limit(5, 0); $query = $this->db->get(); $this->db->flush_cache(); $result = $query->result_array(); $result_count = $query->num_rows();

You cannot call save() after accessing serializer.data in Django Seriliazer

October 27, 2019 6:13 pm

YOU CANNOT CALL `.SAVE()` AFTER ACCESSING `SERIALIZER.DATA`.IF YOU NEED TO ACCESS DATA BEFORE COMMITTING TO THE DATABASE As the above error says, “If you need to access data before committing to the database then inspect ‘serializer.validated_data’ instead.” Written code: serializerdata = serializers.CreateSerializer(data=request.data) if serializerdata.is_valid(): user_id = serializerdata.data.get(‘user_id’) if user_id==2: serializerdata.save(i_created_by=request.user) return JsonResponse({“message”: “success”}) else: return JsonResponse({“message”:

How to set the timezone in CodeIgniter

October 20, 2019 1:21 pm

date_default_timezone_set() function is used to sets the default timezone used by all date or time functions in core PHP, CodeIgniter etc. date_default_timezone_set(); date_default_timezone_set(‘Asia/Kolkata’); # Option-1: In case of CodeIgniter, we can set the default timezone in the application/config.php file In case of CodeIgniter, we can set the default timezone in the application/config.php file <?php defined(‘BASEPATH’) OR exit(‘No direct script access allowed’); date_default_timezone_set(‘Asia/Kolkata’); # Option-2:Place the code in the

Google Business Listing has been Suspended Due to Quality Issues!

September 6, 2019 6:26 pm

As, Google Says….. We may take action on listings and user accounts that violate our content and conduct policies. If we remove a listing: The public can’t access the listing anymore. The owner and managers can’t take actions on its behalf, though they can still make edits and appeal to be reinstated. If the listing is reinstated, we’ll also reinstate the owner and managers. If we remove the owner’s Google Account: We’ll also remove all of the listings owned by that user. If we reinstate the owner’s Google Account, we’ll also reinstate the listings. If we

How to write a program to accepts a string from console and print the characters that have even indexes?

July 28, 2019 12:05 pm

Example: If the following string is given as input to the program:H1e2l3l4o5Then, the output of the program should be:Hello print(“Please enter text to print::”) inputchars = input() if inputchars: string = “” for i in inputchars: if inputchars.index(i)%2 == 0: string += str(i) print(‘——————-‘) print(“You Entered:”, inputchars) print(“Result:”) print(string) # OUTPUT:: Please enter text to print:: H1e2l3l4o5 ——————- You Entered: H1e2l3l4o5 Result: Hello

How to find the odd and even numbers using Python?

July 28, 2019 10:37 am

Here, In below code, user can enter two numbers to find the odd and even numbers between them. The number must be in between 1000 and 3000. print(“Please Enter the Number between 1000 and 3000”) print(“Enter the First Number:”) first_number = input() print(“Enter the Second Number:”) second_number = input() print(“First Number: “, first_number) print(“Second Number: “, second_number) if int(first_number) >= 1000 and int(second_number) <= 3000: first_number = int(first_number) second_number = int(second_number) even_numbers= odd_numbers

How to read or write files in Python?

July 27, 2019 6:51 pm

Before any files to read we have to know how to Open & Close the files. # Open Function: we can open a file using python build in function open() file_object = open(file_name, file_access_mode ) file_name = It is the file name or the full file path.file_access_mode = File access mode is to determine, open file for read, write , append etc. ModesDescriptionrOpens a file for read only purpose.rbOpen a file for reading only in binary format.r+Open a file for both operation reading & writing.rb+Open a file for both reading & writing in binary format.wOpen a file for writing purpose only.