PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label sorting. Show all posts
Showing posts with label sorting. Show all posts

Sunday, December 11, 2022

[FIXED] How to find duplicates in list of lists?

 December 11, 2022     list, python, sorting, syntax     No comments   

Issue

I have a list of key binds in a class like so:

self.key_bind_list = [["A", "B"], ["C"], ["SHIFT", "NUM6", "NUM7"], ["A", "B"], ["A", "B", "C"]]

*in this case a duplicate should be detected by the sublists ["A", "B"], but not by ["A", "B"] and ["A", "B", "C"]

And I'd like to check if there are any duplicates on the main list (assuming that the keys within each sublist are uniques, order is not important, and I don't need to know which ones that aren't unique)

I've tried using the set method in the following:

if(len(self.key_bind_list) != len(set(self.key_bind_list))):

Which gave me a unhashable type: 'list' error.


Solution

Assuming you just want to check if there are duplicates, and print out which sublists contain duplicates, you could use an approach with a list that contains set elements, such as so:

key_bind_list = [["A", "B"], ["C"], ["SHIFT", "NUM6", "NUM7"], ["B", "A"], ["A", "B", "C"]]

seen = []

for i, sublist in enumerate(key_bind_list):
    s = set(sublist)
    if s in seen:
        print(f'index {i}: there are duplicates in {sublist}')
    seen.append(s)

Output:

index 3: there are duplicates in ['B', 'A']

To just return a bool value if any sublist in a list is a duplicate (regardless of order) of another sublist, you could do something like this:

def has_duplicates(L: list[list]) -> bool:
    seen = []

    for sublist in L:
        s = set(sublist)
        if s in seen:
            return True
        seen.append(s)

    return False


print(has_duplicates(key_bind_list))


Answered By - rv.kvetch
Answer Checked By - Mary Flores (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Monday, November 28, 2022

[FIXED] How to sort elements in 2d array like pie chart or sunburst chart in python?

 November 28, 2022     pie-chart, python-3.x, sorting, sunburst-diagram     No comments   

Issue

I have 2d array

I wanted to divide 5 values in this array such that it should be kind of structure like sunburst or pie chart.

I will be very thankful if you could provide python code or idea to do so, any related suggestions are also welcome. Thank you!


Solution

This may be the way that you can divide your square grid according to percentages into five types. While I am not sure how to do it in a circular way.


    mat = np.reshape(list(np.random.choice(a=[i for i in range(1,6)], size=30*30, p=[0.326 ,0.02 ,0.11,0.053,0.491])), (30,30))
    mat2= [[0 for col in range(30)] for row in range(30)]
    
    lst=[0,0,0,0,0]
    for i in range(30):
        for j in range(30):
            lst[mat[i][j]-1] += 1
    print(lst) 
    
    lst2=[0,0,0,0,0]
    for i in range(len(lst)):
        lst2[i] = [lst[i], i+1]
    print(lst2)    
    print(sorted(lst2))
    lst3=sorted(lst2)
    
    
    def action(n,v):
        count = n
        for j in range(len(mat2)//2,-1,-1):
            for i in range(0,len(mat2)//2):
                if mat2[i][j]==0 and count!=0:
                    mat2[i][j] = v
                    count -= 1
                    
        for j in range(len(mat2)//2):
            for i in range(len(mat2)//2,len(mat2)):
                 if mat2[i][j]==0 and count!=0:
                    mat2[i][j] = v
                    count -= 1
            
        for j in range(len(mat2)//2,len(mat2)):
            for i in range(len(mat2)//2,len(mat2)):
                if mat2[i][j]==0 and count!=0:
                    mat2[i][j] = v
                    count -= 1
            
        for i in range(len(mat2)//2,-1,-1):
            for j in range(len(mat2)//2,len(mat2),-1):
                if mat2[i][j]==0 and count!=0:
                    mat2[i][j] = v
                    count -= 1
               
        for i in range(len(mat2)):
            for j in range(len(mat2)):
                if mat2[i][j]==0 and count != 0:
                    mat2[i][j]=v
                    count-=1
       
    for val in lst3:                    
        action(val[0],val[1])
    for i in mat2:
        print(i)



Answered By - Dvarkesh
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Thursday, November 10, 2022

[FIXED] how to Sort negative and positive data in SAS

 November 10, 2022     proc, sas, sorting, sql     No comments   

Issue

I have bellow data in variable NUM

-3 1 0 1 3 2 -2 5 -5 -6 4 6 -4

i want data NUM in bellow sorting order

0 -1 1 -2 2 -3 3 -4 4 -5 5 -6 6

How can we sort negative and positive values together? please help

data have;
input NUM @@;
cards;
-3 1 0 1 3 2 -2 5 -5 -6 4 6 -4
;
run;

Solution

Make a new variable with the absolute value and include it in the sort.

data want;
  set have;
  absolute=abs(num);
run;
proc sort data=want;
  by absolute num;
run;


Answered By - Tom
Answer Checked By - Terry (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Monday, November 7, 2022

[FIXED] How do I have the nearest element to a certain element in a set?

 November 07, 2022     algorithm, java, set, sorting     No comments   

Issue

Let say that I have a set as so:

Set<DueDate> dueDates;

class DueDate{
     Date date;
}

I need to find the nearest date element that comes right after a specified date.

The set contains around a 1000 entries. Is it ok if I just iterate over the set to find the nearest date entry or I have to use some type of sort or data structure to do it in a more efficient way.


Solution

TreeSet is a NavigableSet implementation. Your requirements are not precise, so I'm not sure if you are looking for the higher() (strictly greater) or ceiling() (greater or equal) method, but one of those should meet your needs.



Answered By - erickson
Answer Checked By - Marilyn (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Saturday, November 5, 2022

[FIXED] How to Sort a Model Based on a Property in IList<T> within that Model

 November 05, 2022     .net-core, lambda, linq, list, sorting     No comments   

Issue

This is a bit more complex than other questions. I have a Model that encapsulates an IList. Within each IList item there are multiple Lists. This makes it VERY difficult to flatten the entire dataset. I need to both filter and/or sort the highest IList items based on a value in that Ilist. So as an example, lets say my structure is as follows:

public class ScorecardModel
{
  //Measure Data
  public IList<ProgramScorecardModel> ProgramScorecardModel { get; set; }
                
}

public class ProgramScorecardModel
{
    public string programId { get; set; }
    public DateTime? reportingDate { get; set; }
    public string programName { get; set; }

    //Measure Data
    public IList<Sales_ViewModel> Sales_ViewModel { get; set; }
    public IList<Employees_ViewModel> Employees_ViewModel { get; set; }
    public IList<Locations_ViewModel> Locations_ViewModel { get; set; }

}

My scorecard returns all of the programs and their respective data. What I want to do is sort/filter the ProgramScorecard models based on the programId.

Here is how I call the queries that populate the scorecard.

ScorecardModel scorecard = new ScorecardModel();
scorecard = _adoSqlService.GetScorecard();

I want to call the following Sort function:

private ScorecardModel sortScorecard(ScorecardModel scorecardList, string sortField, string sortDirection)
{
    IQueryable<ScorecardModel> sortedScorecard = scorecardList.AsQueryable();
    sortedScorecard = sortedScorecard.OrderBy(sortField + " " + sortDirection);
    return sortedScorecard;
}

The problem is that the scorecardlist is not enumerable. If I change the functions to use this then the scorecard loading (GetScorecard) throws errors.

IEnumerable<ScorecardModel> scorecard = null;
scorecard = _adoSqlService.GetScorecard();

private IEnumerable<ScorecardModel> sortScorecard(IEnumerable<ScorecardModel> scorecardList, string sortField, string sortDirection)
{
  IQueryable<ScorecardModel> sortedScorecard = scorecardList.AsQueryable();
  sortedScorecard = sortedScorecard.OrderBy(sortField + " " + sortDirection);
  return sortedScorecard;
} 

I've tried changing the GetScorecard routine, but I can't get the following to work:

public IList<ScorecardModel> GetScorecard()
{
   string programid;
   string reportingdate = "2/1/2022";
   IList<ProgramViewModel> proglist = new List<ProgramViewModel>();
   proglist = GetPrograms();
   IList <ScorecardModel> scorecardData = new List<ScorecardModel>();
   scorecardData.ProgramScorecardModel = new List<ProgramScorecardModel>(); <---This Line Here, ProgramScorecardModel is not able to be a list
   int i = 0;
   foreach (var p in proglist)
   {
       ProgramScorecardModel programData = new ProgramScorecardModel();
       programData.programId = p.programId;
       programData.programName = p.programName;
       programid = p.programId;
       programData.Sales_ViewModel = new List<Sales_ViewModel>(GetSalesData(programid, reportingdate));
       programData.Employees_ViewModel = new List<Employees_ViewModel>(GetEmployeesData(programid, reportingdate));
       programData.Locations_ViewModel = new List<Locations_ViewModel>(GetLocationsData(programid, reportingdate));
       scorecardData.ProgramScorecardModel.Add(programData);
       i++;
    }
    return scorecardData;
}

How can I make the entire scorecardData and scorecardData.ProgramScorecardModel an enemrable object?

Assuming I get this working as an enumerable object, will I be able to sort AND Filter on scorecardData.ProgramScorecardModel[x].programName values?

Additional Info This is how I currently populate the scorecard model

public ScorecardModel GetScorecard()
{
    string programid;
    string reportingdate = "2/1/2022";
    IList<ProgramViewModel> proglist = new List<ProgramViewModel>();
    proglist = GetPrograms();
    ScorecardModel scorecardData = new ScorecardModel();
    scorecardData.ProgramScorecardModel = new List<ProgramScorecardModel>();
    int i = 0;
    foreach (var p in proglist)
    {
        ProgramScorecardModel programData = new ProgramScorecardModel();
        programData.programId = p.programId;
        programData.programName = p.programName;
        programid = p.programId;
        programData.Locations_ViewModel = new List<Locations_ViewModel>(GetLocationData(programid, reportingdate));
        programData.Employees_ViewModel = new List<Employees_ViewModel>(GetEmployeeData(programid, reportingdate));
        programData.Sales_ViewModel = new List<Sales_ViewModel>(GetSalesData(programid, reportingdate));

        scorecardData.ProgramScorecardModel.Add(programData);   
        i++; //This is used in some other code I have removed for simplification
    }
    return scorecardData;
}

The end result is this:
ScorecardModel
   ProgramScorecardModel[i]
       Programid
       Locations_ViewModel
       Employees_ViewModel
       Locations_ViewModel
   ProgramScorecardModel[i]
       Programid
       Locations_ViewModel
       Employees_ViewModel
       Locations_ViewModel
   ProgramScorecardModel[i]
       Programid
       Locations_ViewModel
       Employees_ViewModel
       Locations_ViewModel

Here is an oversimplification of how I'm using the scorecard model:

for (int i = 0; i < @Model.ProgramScorecardModel.Count; i++)
{
    <tr>
        <td rowspan="2" style="text-align: left; border: 1px solid black; padding-left: 5px">@Model.ProgramScorecardModel[i].programName</td>


        @{string results = Model.ProgramScorecardModel[i].Sales_ViewModel[0].rating;

            <td colspan="3" class="tdtooltip @(results == "R" ? "measure_red" : results == "Y" ? "measure_yellow" : results == "G" ? "measure_green" : results == "NR" ? "measure_nr" : results == "NS" ? "measure_ns" : "measure_na")">
                @Model.ProgramScorecardModel[i].Sales_ViewModel[0].rating
                @if (@Model.ProgramScorecardModel[i].Sales_ViewModel[0].comments.Length > 0)
                {
                    <span class="tooltiptext">@Html.Raw(Model.ProgramScorecardModel[i].Sales_ViewModel[0].comments)</span>
                }
            </td>
        }

        @{results = Model.ProgramScorecardModel[i].Employees_ViewModel[0].rating;

            <td colspan="3" class="tdtooltip @(results == "R" ? "measure_red" : results == "Y" ? "measure_yellow" : results == "G" ? "measure_green" : results == "NR" ? "measure_nr" : results == "NS" ? "measure_ns" : "measure_na")">
                @Model.ProgramScorecardModel[i].Employees_ViewModel[0].rating
                @if (@Model.ProgramScorecardModel[i].Employees_ViewModel[0].comments.Length > 0)
                {
                    <span class="tooltiptext">@Html.Raw(Model.ProgramScorecardModel[i].Employees_ViewModel[0].comments)</span>
                }
            </td>
        }

        @{ results = Model.ProgramScorecardModel[i].Locations_ViewModel[0].rating;

            <td colspan="3" class="tdtooltip @(results == "R" ? "measure_red" : results == "Y" ? "measure_yellow" : results == "G" ? "measure_green" : results == "NR" ? "measure_nr" : results == "NS" ? "measure_ns" : "measure_na")">
                @Model.ProgramScorecardModel[i].Locations_ViewModel[0].rating
                @if (@Model.ProgramScorecardModel[i].Locations_ViewModel[0].comments.Length > 0)
                {
                    <span class="tooltiptext">@Html.Raw(Model.ProgramScorecardModel[i].Locations_ViewModel[0].comments)</span>
                }
            </td>
        }
       
    </tr>
}

Solution

While writing the answer there are a couple things I did not understand. Maybe we can figure it out together. For now I will post what is a starting point to get things working.

using System.Linq;
using System.Collections.Generic;
                    
public class Program
{
    public static void Main()
    {
        var scorecard = GetScorecard();
        var sortedScorecard = scorecard.WithSortedPrograms("programId", "ascending");
    }
    
    public static ScorecardModel GetScorecard()
    {
        var proglist = new List<ProgramViewModel>();
        // proglist = GetPrograms();
        
        var scorecardData = new List<ProgramScorecardModel>();
        foreach (var p in proglist)
        {
          var programData = new ProgramScorecardModel();
          programData.ProgramId = p.ProgramId;
          scorecardData.Add(programData);
        }
        
        var scorecard = new ScorecardModel();
        scorecard.ProgramScorecardModel = scorecardData;
        return scorecard;
    }
}

public class ScorecardModel
{
  public List<ProgramScorecardModel> ProgramScorecardModel { get; set; }
    
  public ScorecardModel WithSortedPrograms(string sortField, string sortDirection)
  {
      var sortedModel = new ScorecardModel();
      // sortedModel.ProgramScorecardModel = ProgramScorecardModel.AsQueryable().OrderBy(sortField + " " + sortDirection);
      sortedModel.ProgramScorecardModel = ProgramScorecardModel.OrderBy(x => x.ProgramId).ToList();
      return sortedModel;
  }
}

public class ProgramScorecardModel
{
    public string ProgramId { get; set; }
}

public class ProgramViewModel
{
    public string ProgramId { get; set; }
}

I was not able to find a OrderBy method for IQueryable<T> that accepts a string. That is why for now I wrote the x => x.ProgramId expression.

There are many improvements I would personally make to your code though as I find it a bit messy. Once we find the correct solution to your problem, if you want, we can look at a different ways to approach this.



Answered By - Francesco D.M.
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Why doesn't lambda function accept parameter in bond with sorted()

 November 05, 2022     lambda, python, sorting     No comments   

Issue

Students = (("Squidward", "F", 60),
            ("Sandy", "A", 33),
            ("Patrick","D", 36),
            ("Spongebob","B", 20),
            ("Mr.Krabs","C", 78))

sort_grades = lambda grades: grades[1]

Sorted_Students = sorted(Students,key=sort_grades)

lambda function kinda has a parameter grades. Why don't we pass any parameters in Sorted_Students as a key= so there is no parenthesis after sort_grades. And this code somehow works even without passing any parameters as "grades" so we don't even run the lambda function (how without parameters - imposible). Please detail how this code works the most explicitly, so my dumb brain could get something from your comment


Solution

The key parameter of sorted is a function which will be applied to the elements in order to compare them to each other. Therefore, we only pass the function itself without calling it.

I suggest you read the documentation first next time :) https://docs.python.org/3/library/functions.html#sorted



Answered By - Tomer Ariel
Answer Checked By - Mildred Charles (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Friday, November 4, 2022

[FIXED] How to create a new list in Python based on two factors?

 November 04, 2022     key, lambda, list, python, sorting     No comments   

Issue

I have a list of list in Python like this:

vehicle_list = [['car', '123464', '4322445'],   ['car', '64346', '643267'], ['bicycle', '1357', '78543'], 
        ['bicycle', '75325', '75425'], ['car', '8652', '652466'], ['taxi', '653367', '63226'], 
        ['taxi', '96544', '22267'], ['taxi', '86542222', '54433'],     
        ['motorcycle', '675422', '56312'], ['motorcycle', '53225', '88885'], ['motorcycle', '773345', '9977'], 
        ['motorcycle', '3466', '987444'], ['truck', '2455554', '5225544'], ['truck', '2455554', '344543'], 
        ['train', '6543355', '6336']]

I want to return the top 3 vehicles which has the highest number at the end. Like this:

top_vehicle = [['truck', '2455554', '5225544'], ['car', '123464', '4322445'], ['motorcycle', '3466', '987444']]

I have tried sorting this way, but with my result, the vehicles are repeating which I do not want. I want the unique vehicles in my sorted list. I have tried the code this way:

top_vehicle = (sorted(vehicle_list, key=lambda x: int(x[-1]), reverse = True))[:3]
print(top_vehicle)


[['truck', '2455554', '5225544'], ['car', '123464', '4322445'], ['car', '8652', '652466']]

Solution

Method by

  • Get the item with largest number at end of item for vehicle
  • Reverse sort the values of dictionary by the number at end of item
  • Get the first three items
vehicle_list = [['car', '123464', '4322445'],   ['car', '64346', '643267'], ['bicycle', '1357', '78543'],
        ['bicycle', '75325', '75425'], ['car', '8652', '652466'], ['taxi', '653367', '63226'],
        ['taxi', '96544', '22267'], ['taxi', '86542222', '54433'],
        ['motorcycle', '675422', '56312'], ['motorcycle', '53225', '88885'], ['motorcycle', '773345', '9977'],
        ['motorcycle', '3466', '987444'], ['truck', '2455554', '5225544'], ['truck', '2455554', '344543'],
        ['train', '6543355', '6336']]

# Get largest one for each vehicle by dictionary
largest = {}
for item, no1, no2 in vehicle_list:
    if (item in largest and int(largest[item][2]) < int(no2)) or (item not in largest):
        largest[item] = [item, no1, no2]

# Reverse sort list by 3rd value and get first three
top_vehicle = sorted(list(largest.values()), key=lambda x:int(x[2]), reverse=True)[:3]

print(top_vehicle)
# [['truck', '2455554', '5225544'], ['car', '123464', '4322445'], ['motorcycle', '3466', '987444']]


Answered By - Jason Yang
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Why don't we add parenthesis when writing comparator in c++?

 November 04, 2022     algorithm, c++, comparator, lambda, sorting     No comments   

Issue

Here is a code explaining what I mean.


static bool comparator(int a, int b) {
    if(a > b) return false;
    return true;
}

sort(arr.begin(), arr.end(), comparator); // why don't we write comparator()


Solution

If you will write

sort(arr.begin(), arr.end(), comparator());

then it means that the argument expression of the function std::sort comparator() must be evaluated. But neither arguments are supplied to the function call comparator(). So the compiler will issue an error message.

On the other hand, if you will write

sort(arr.begin(), arr.end(), comparator);

then the function designator comparator is implicitly converted to a pointer to the function and the function std::sort within itself will call the function using the pointer and supplying two arguments to it.



Answered By - Vlad from Moscow
Answer Checked By - Clifford M. (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Thursday, November 3, 2022

[FIXED] How to sort the list based on student's last name using lambda in python?

 November 03, 2022     lambda, list, python, python-2.7, sorting     No comments   

Issue

I have a list with student names

students = ["Merol B Joseph", "Ferzil Babu", "Basil Abraham", "Kiran Baby", "Ziya sofia"]

I am trying to sort the list using lambda expression.

I want to sort the list based on student's last name

I just tried like this

student_last_name_alpha_order = students.sort(key=lambda name: name.split(" ")[-1].lower())

then I print student_last_name_alpha_order , but it returns None


Solution

That's because sort() is a method which sorts the list in-place and returns None.

students = ["Merol B Joseph", "Ferzil Babu", "Basil Abraham", "Kiran Baby", "Ziya sofia"]
students.sort(key=lambda name: name.split(" ")[-1].lower())
print students

Will print:

['Basil Abraham', 'Ferzil Babu', 'Kiran Baby', 'Merol B Joseph', 'Ziya sofia']

You can use sorted() which is a function returning a sorted version of its input without changing the original:

students = ["Merol B Joseph", "Ferzil Babu", "Basil Abraham", "Kiran Baby", "Ziya sofia"]
x = sorted(students, key=lambda name: name.split(" ")[-1].lower())
print x
print students

prints:

['Basil Abraham', 'Ferzil Babu', 'Kiran Baby', 'Merol B Joseph', 'Ziya sofia']
['Merol B Joseph', 'Ferzil Babu', 'Basil Abraham', 'Kiran Baby', 'Ziya sofia']

But this creates a new list, needs twice the amount of memory and also takes longer because everything needs to be copied. So it's up to you to decide if you really need this. The in-place sorting is more efficient and maybe more error-prone.



Answered By - Alfe
Answer Checked By - Mildred Charles (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] how to merge and sort a list with datetime and lambda in Python3?

 November 03, 2022     date, lambda, list, python, sorting     No comments   

Issue

I need to get info from two separate txt files, merge and sort them based on the first index of the list (date). I am having trouble using Lambda and DateTime together. I am currently stuck on this issue and have run out of ideas on how to implement this. I would also appreciate an explanation in order for me to comprehend where I am making a mistake.

  • I think that I am possibly creating various lists of lists, however, when I print the Len of my last List it says it contains the same amount of items as intended. Hence I believe that I am not mistakenly creating lists with extra values.

Note: I am 2 months into my programming journey and have searched for different methods to resolve my problem, but I am still coming up short. And I implemented the same concept yesterday on a much simpler problem where the first index was a single-digit INT, which was a lot easier. With the Date being the first index I am having trouble understanding the syntax of DateTime and lambda together in my code. I appreciate all help and opinions!

from datetime import datetime
from typing import Any, List


def get_list1(file_name: str) -> Any:
    list1 = []

    with open(file_name, newline='') as inputFile:
        lines = inputFile.readlines()
        for line in lines:
            line = line.replace("\r\n", '')
            seperate = line.split(";")
            list1.append(seperate)
    return list1

def get_list2(file_name: str) -> Any:
    list2 = []

    with open(file_name, newline='') as inputFile:
        lines = inputFile.readlines()
        for line in lines:
            line = line.replace("\r\n", '')
            seperate = line.split(";")
            list2.append(seperate)
    return list2


def mergeLists(list1:List, list2:List):
    newList = []

    for item in list1:
        newList.append(list1)
    for item in list2:
        newList.append(list2)
    print(len(newList))
    return(newList)


def sortedList(newList:List):
    orderedList = sorted(newList, key=lambda x: datetime.datetime.strptime(x[0]))
    print(orderedList)


list1 = get_list1("bitcoin.txt")
list2 = get_list2("exchange.txt")
newList =mergeLists(list1, list2)
sortedList(newList)
bitcoin.txt = 
2022-08-01;buy;100
2022-08-04;buy;50
2022-08-06;buy;10

exchange.txt = 
2022-08-02;buy;200
2022-08-03;sell;300
2022-08-05;sell;25

Desired output sorted by date = [2022-08-01;buy;100, 2022-08-02;buy;200, 2022-08-03;sell;300, 2022-08-04;buy;50, 2022-08-05;sell;25, 2022-08-06;buy;10]


Solution

Since your dates are in the format yyyy-mm-dd (sortable as string) and the first text of every line, you can sort them without converting them to datetime. This should do it:

def file_to_list(file: str) -> list:
    out = []
    with open(file) as f:
        for line in f:
            out.append(line.strip())
    return out

bitcoin  = file_to_list("bitcoin.txt")
exchange = file_to_list("exchange.txt")
combined = bitcoin + exchange

sorted(combined)

Out:

['2022-08-01;buy;100',
 '2022-08-02;buy;200',
 '2022-08-03;sell;300',
 '2022-08-04;buy;50',
 '2022-08-05;sell;25',
 '2022-08-06;buy;10']


Answered By - Timo
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] What does arr.sort(key=lambda x: (x[0],-x[1])) mean?

 November 03, 2022     arrays, lambda, list, python-3.x, sorting     No comments   

Issue

>>> arr=[[4,5],[4,6],[6,7],[2,3],[1,1]]
>>> arr.sort(key=lambda x:x[0]) #statement 1
>>> arr
[[1, 1], [2, 3], [4, 5], [4, 6], [6, 7]]
>>> arr.sort(key=lambda x:(x[0],-x[1])) #statement 2
>>> arr
[[1, 1], [2, 3], [4, 6], [4, 5], [6, 7]]

So, I can observe the difference between the execution of statement 1 and statement 2. I am aware that statement 1 sorts the list in ascending order of x[0]. But if we use, statement 2 then how the list is sorted?


Solution

lambda x:(x[0],-x[1])

this generates tuples of (the first element, negative of the second element)

When you sort 2-tuples, they are sorted based on

  1. The first element
  2. If the first elements are equal, then the second element

So

arr.sort(key=lambda x:(x[0],-x[1]))

Sorts the list arr based on:

  1. the first element
  2. if the first elements are equal, then based on the negative of the second element.

(that is why [4,6] is ahead of [4,5] since -6 < -5)



Answered By - rdas
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Wednesday, November 2, 2022

[FIXED] How to find sorted 'means of indexes' of two lists?

 November 02, 2022     indexing, list, python, ranking, sorting     No comments   

Issue

The task I have is as shown. Given two lists of ints, such as:

lst1 = [4,1,3,5,2]
lst2 = [1,3,5,2,4]

I want to get the mean of the ints indexes. For example, the int 4 will have indexes of 0 and 3, thus will have an index mean of 1.5. Similarly, int 1 will have an index mean of 1. I want to then have all ints in a list, sorted by their 'index mean'. The result should be:

result = [1, 3, 4, 5, 2]

as their means are 0.5, 1.5, 2, 2.5, and 3.5, respectively.

What is a fast pythonic way of doing this without going through some complicated iterations? All help is appreciated!


Solution

>>> lst1 = [4,1,3,5,2]
>>> lst2 = [1,3,5,2,4]
>>> sorted(lst1, key=lambda n: lst1.index(n) + lst2.index(n))
[1, 3, 4, 5, 2]

Note that finding the actual average (i.e. dividing the sum by 2) isn't necessary since you're using the values as sort keys; as long as they have the same comparison results as the averages (which they will since each sum is the average times a constant factor of 2) you get the correct result.

For a more efficient solution, you'd build a dictionary so you only need to iterate through each list once to sum up all the indices:

>>> avg_indices = {n: 0 for n in lst1}
>>> for a in (lst1, lst2):
...     for i, n in enumerate(a):
...         avg_indices[n] += i
...
>>> sorted(lst1, key=avg_indices.get)
[1, 3, 4, 5, 2]

Building lists of indices (and taking the actual average) would become necessary if you didn't have the same number of occurrences of each item across the lists.



Answered By - Samwise
Answer Checked By - Senaida (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Monday, October 31, 2022

[FIXED] How do I partially sort a Vec or slice?

 October 31, 2022     partial-sort, performance, rust, sorting, vector     No comments   

Issue

I need to get the top N items from a Vec which is quite large in production. Currently I do it like this inefficient way:

let mut v = vec![6, 4, 3, 7, 2, 1, 5];
v.sort_unstable();
v = v[0..3].to_vec();

In C++, I'd use std::partial_sort, but I can't find an equivalent in the Rust docs.

Am I just overlooking it, or does it not exist (yet)?


Solution

The standard library doesn't contain this functionality, but it looks like the lazysort crate is exactly what you need:

So what's the point of lazy sorting? As per the linked blog post, they're useful when you do not need or intend to need every value; for example you may only need the first 1,000 ordered values from a larger set.

#![feature(test)]

extern crate lazysort;
extern crate rand;
extern crate test;

use std::cmp::Ordering;

trait SortLazy<T> {
    fn sort_lazy<F>(&mut self, cmp: F, n: usize)
    where
        F: Fn(&T, &T) -> Ordering;
    unsafe fn sort_lazy_fast<F>(&mut self, cmp: F, n: usize)
    where
        F: Fn(&T, &T) -> Ordering;
}

impl<T> SortLazy<T> for [T] {
    fn sort_lazy<F>(&mut self, cmp: F, n: usize)
    where
        F: Fn(&T, &T) -> Ordering,
    {
        fn sort_lazy<F, T>(data: &mut [T], accu: &mut usize, cmp: &F, n: usize)
        where
            F: Fn(&T, &T) -> Ordering,
        {
            if !data.is_empty() && *accu < n {
                let mut pivot = 1;
                let mut lower = 0;
                let mut upper = data.len();
                while pivot < upper {
                    match cmp(&data[pivot], &data[lower]) {
                        Ordering::Less => {
                            data.swap(pivot, lower);
                            lower += 1;
                            pivot += 1;
                        }
                        Ordering::Greater => {
                            upper -= 1;
                            data.swap(pivot, upper);
                        }
                        Ordering::Equal => pivot += 1,
                    }
                }
                sort_lazy(&mut data[..lower], accu, cmp, n);
                sort_lazy(&mut data[upper..], accu, cmp, n);
            } else {
                *accu += 1;
            }
        }
        sort_lazy(self, &mut 0, &cmp, n);
    }

    unsafe fn sort_lazy_fast<F>(&mut self, cmp: F, n: usize)
    where
        F: Fn(&T, &T) -> Ordering,
    {
        fn sort_lazy<F, T>(data: &mut [T], accu: &mut usize, cmp: &F, n: usize)
        where
            F: Fn(&T, &T) -> Ordering,
        {
            if !data.is_empty() && *accu < n {
                unsafe {
                    use std::mem::swap;
                    let mut pivot = 1;
                    let mut lower = 0;
                    let mut upper = data.len();
                    while pivot < upper {
                        match cmp(data.get_unchecked(pivot), data.get_unchecked(lower)) {
                            Ordering::Less => {
                                swap(
                                    &mut *(data.get_unchecked_mut(pivot) as *mut T),
                                    &mut *(data.get_unchecked_mut(lower) as *mut T),
                                );
                                lower += 1;
                                pivot += 1;
                            }
                            Ordering::Greater => {
                                upper -= 1;
                                swap(
                                    &mut *(data.get_unchecked_mut(pivot) as *mut T),
                                    &mut *(data.get_unchecked_mut(upper) as *mut T),
                                );
                            }
                            Ordering::Equal => pivot += 1,
                        }
                    }
                    sort_lazy(&mut data[..lower], accu, cmp, n);
                    sort_lazy(&mut data[upper..], accu, cmp, n);
                }
            } else {
                *accu += 1;
            }
        }
        sort_lazy(self, &mut 0, &cmp, n);
    }
}

#[cfg(test)]
mod tests {
    use test::Bencher;

    use lazysort::Sorted;
    use std::collections::BinaryHeap;
    use SortLazy;

    use rand::{thread_rng, Rng};

    const SIZE_VEC: usize = 100_000;
    const N: usize = 42;

    #[bench]
    fn sort(b: &mut Bencher) {
        b.iter(|| {
            let mut rng = thread_rng();
            let mut v: Vec<i32> = std::iter::repeat_with(|| rng.gen())
                .take(SIZE_VEC)
                .collect();
            v.sort_unstable();
        })
    }

    #[bench]
    fn lazysort(b: &mut Bencher) {
        b.iter(|| {
            let mut rng = thread_rng();
            let v: Vec<i32> = std::iter::repeat_with(|| rng.gen())
                .take(SIZE_VEC)
                .collect();
            let _: Vec<_> = v.iter().sorted().take(N).collect();
        })
    }

    #[bench]
    fn lazysort_in_place(b: &mut Bencher) {
        b.iter(|| {
            let mut rng = thread_rng();
            let mut v: Vec<i32> = std::iter::repeat_with(|| rng.gen())
                .take(SIZE_VEC)
                .collect();
            v.sort_lazy(i32::cmp, N);
        })
    }

    #[bench]
    fn lazysort_in_place_fast(b: &mut Bencher) {
        b.iter(|| {
            let mut rng = thread_rng();
            let mut v: Vec<i32> = std::iter::repeat_with(|| rng.gen())
                .take(SIZE_VEC)
                .collect();
            unsafe { v.sort_lazy_fast(i32::cmp, N) };
        })
    }

    #[bench]
    fn binaryheap(b: &mut Bencher) {
        b.iter(|| {
            let mut rng = thread_rng();
            let v: Vec<i32> = std::iter::repeat_with(|| rng.gen())
                .take(SIZE_VEC)
                .collect();

            let mut iter = v.iter();
            let mut heap: BinaryHeap<_> = iter.by_ref().take(N).collect();
            for i in iter {
                heap.push(i);
                heap.pop();
            }
            let _ = heap.into_sorted_vec();
        })
    }
}
running 5 tests
test tests::binaryheap             ... bench:   3,283,938 ns/iter (+/- 413,805)
test tests::lazysort               ... bench:   1,669,229 ns/iter (+/- 505,528)
test tests::lazysort_in_place      ... bench:   1,781,007 ns/iter (+/- 443,472)
test tests::lazysort_in_place_fast ... bench:   1,652,103 ns/iter (+/- 691,847)
test tests::sort                   ... bench:   5,600,513 ns/iter (+/- 711,927)

test result: ok. 0 passed; 0 failed; 0 ignored; 5 measured; 0 filtered out

This code allows us to see that lazysort is faster than the solution with BinaryHeap. We can also see that BinaryHeap solution gets worse when N increases.

The problem with lazysort is that it creates a second Vec<_>. A "better" solution would be to implement the partial sort in-place. I provided an example of such an implementation.

Keep in mind that all these solutions come with overhead. When N is about SIZE_VEC / 3, the classic sort wins.

You could submit an RFC/issue to ask about adding this feature to the standard library.



Answered By - Stargateur
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Friday, October 28, 2022

[FIXED] How make np.argsort place empty strings at the END of an array instead of at the beginning

 October 28, 2022     is-empty, numpy, python, sorting     No comments   

Issue

I'm honestly surprised that this question hasn't come up on the forums (at least from what I have seen) earlier. Anyway, I am currently attempting to sort a list of strings, many of which are empty, in alphabetic fashion using np.argsort like so:

list = [ "Carrot", "Star", "Beta", "Zoro" , ""]

Right now, any call of np.argsort(list) will return the following array of indices:

[4,2,0,1,3] # => ["", "Beta", "Carrot", "Star", "Zoro"]

Is there a way to specify the order of the argsort function so that the empty strings are placed at the end of the array like so:

[2,0,1,3,4] # => ["Beta", "Carrot", "Star", "Zoro", ""]

Any input will be greatly appreciated!


Solution

One simple way of getting the order you want would be using np.roll:

lst = [ "Carrot", "Star", "Beta", "Zoro" , ""]
arr = np.array(lst)
idx = np.roll(arr.argsort(),np.count_nonzero(arr))
arr[idx]
# array(['Beta', 'Carrot', 'Star', 'Zoro', ''], dtype='<U6')


Answered By - Paul Panzer
Answer Checked By - Senaida (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Tuesday, October 18, 2022

[FIXED] How to generate an array in Python which shows the positions of the highest to the lowest integers or floats in another array?

 October 18, 2022     arrays, integer, python, sorting     No comments   

Issue

I'd like to generate an array which contains the positions of the highest integers/floating point numbers to the lowest in another array. For example:

integers = [1,6,8,5] I want the newly generated array to be: newArray = [2,1,3,0]

or

floatingPoints = [1.6,0.5,1.1] would become newArray = [0,2,1]


Solution

You can use the numpy function argsort and then simply reverse the ordering as it gives you ascending rather than descending, by default:

np.argsort(integers)[::-1]

Example:

import numpy as np
integers = np.array([1, 6, 8, 5])
np.argsort(integers)[::-1]

This results in the desired [2, 1, 3, 0].



Answered By - statnet22
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Tuesday, September 20, 2022

[FIXED] How can i sort HashMap<String,Int> order by their values in Kotlin?

 September 20, 2022     hashmap, kotlin, list, sorting, treemap     No comments   

Issue

Here is my example, how can i do that in Kotlin?

var hashMapForTry = HashMap<String,Int>()

hashMapForTry.put("Hi",5)
hashMapForTry.put("What",7)
hashMapForTry.put("How",2)
hashMapForTry.put("Go",1)
hashMapForTry.put("Ford",9)

Solution

You cannot sort a HashMap because it doesn't guarantee that its entries will be iterated in any particular order. You can, however, arrange the items into a LinkedHashMap which keeps the insertion order:

    val resultMap = hashMapForTry.entries.sortedBy { it.value }.associate { it.toPair() }

    println(resultMap)

Here the entries of hashMapForTry are sorted by entry value, then associate function converts the list of entries into a map that preserves the order of entries from that list.

The result type of this function is Map<String, Int>. If you need to mutate the result further, you can use associateTo function and specify an empty destination LinkedHashMap as a parameter:

....associateTo(LinkedHashMap()) { ... }


Answered By - Ilya
Answer Checked By - Mildred Charles (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, September 18, 2022

[FIXED] Why does PriorityQueue.toString return the wrong element order?

 September 18, 2022     comparator, java, printing, priority-queue, sorting     No comments   

Issue

I am trying to make a priority queue in java with the nodes with the lowest frequency in priority. However, my comparator is not working and the output is very weird. I believe I need to change my comparator but I am not sure how to change it. Here is my code:

public class HuffmanComparator implements Comparator<TreeNodeHuffman> {
    public int compare(TreeNodeHuffman p1, TreeNodeHuffman p2) {
        if (p1.frequency < p2.frequency) return -1;
        if (p1.frequency > p2.frequency) return 1;
        return 0;
    }    
}

public class TreeNodeHuffman {
public static void main(String[] args) {    
    HuffmanComparator compare = new HuffmanComparator();
    TreeNodeHuffman e = new TreeNodeHuffman('e', 12702);
    TreeNodeHuffman t = new TreeNodeHuffman('t', 9056);
    TreeNodeHuffman a = new TreeNodeHuffman('a', 8167);
    TreeNodeHuffman o = new TreeNodeHuffman('o', 7507);
    TreeNodeHuffman i = new TreeNodeHuffman('i', 6966);
    TreeNodeHuffman n = new TreeNodeHuffman('a', 6749);
    TreeNodeHuffman s = new TreeNodeHuffman('s', 6327);
    TreeNodeHuffman h = new TreeNodeHuffman('h', 6094);
    TreeNodeHuffman r = new TreeNodeHuffman('r', 5987);
    TreeNodeHuffman d = new TreeNodeHuffman('d', 4253);
    TreeNodeHuffman l = new TreeNodeHuffman('l', 4025);
    TreeNodeHuffman c = new TreeNodeHuffman('c', 2782);
    TreeNodeHuffman u = new TreeNodeHuffman('u', 2758);
    TreeNodeHuffman m = new TreeNodeHuffman('m', 2406);
    TreeNodeHuffman w = new TreeNodeHuffman('w', 2360);
    TreeNodeHuffman f = new TreeNodeHuffman('f', 2228);
    TreeNodeHuffman g = new TreeNodeHuffman('g', 2015);
    TreeNodeHuffman y = new TreeNodeHuffman('y', 1974);
    TreeNodeHuffman p = new TreeNodeHuffman('p', 1929);
    TreeNodeHuffman b = new TreeNodeHuffman('b', 1492);
    TreeNodeHuffman v = new TreeNodeHuffman('v', 978);
    TreeNodeHuffman k = new TreeNodeHuffman('k', 772);
    TreeNodeHuffman j = new TreeNodeHuffman('j', 153);
    TreeNodeHuffman x = new TreeNodeHuffman('x', 150);
    TreeNodeHuffman q = new TreeNodeHuffman('q', 95);
    TreeNodeHuffman z = new TreeNodeHuffman('z', 74);
    PriorityQueue<TreeNodeHuffman> queue = new PriorityQueue<TreeNodeHuffman>(26, compare);
    queue.add(e);
    queue.add(t);
    queue.add(a);
    queue.add(o);
    queue.add(i);
    queue.add(n);
    queue.add(s);
    queue.add(h);
    queue.add(r);
    queue.add(d);
    queue.add(l);
    queue.add(c);
    queue.add(u);
    queue.add(m);
    queue.add(w);
    queue.add(f);
    queue.add(g);
    queue.add(y);
    queue.add(p);
    queue.add(b);
    queue.add(v);
    queue.add(k);
    queue.add(j);
    queue.add(x);
    queue.add(q);
    queue.add(z);
    System.out.println(queue);
}
}

The output is as follows: [z, k, q, g, v, x, u, d, f, y, b, m, j, i, c, e, s, o, w, a, r, h, p, t, l, a].

However, the output should be [z, q, x, j, k, v, b........].


Solution

You need to poll the items from the PriorityQueue one by one. toString doesn't do that.

So instead of your System.out.println(queue); do this:

while(!queue.isEmpty()) {
   System.out.println(queue.poll());
}

The reason is that the PriorityQueue is never completely sorted internally, lookup how a heap works for more detail. Polling items from it fixes the heap during the calls, thus it should output the elements in sorted order.



Answered By - Thomas Jungblut
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Tuesday, August 30, 2022

[FIXED] How to sort comma separated values in bash?

 August 30, 2022     bash, csv, linux, sorting     No comments   

Issue

I have some numbers like

7, 15, 6, 2, -9

I want to sort it like this in bash(from command line or either a script file)

-9, 2, 6, 7, 15

How can I do this? I am unable to get this using sort command.


Solution

echo "7, 15, 6, 2, -9" | sed -e $'s/,/\\\n/g' | sort -n | tr '\n' ',' | sed 's/.$//'
  1. sed -e $'s/,/\\\n/g': For splitting string into lines by comma.
  2. sort -n: Then you can use sort by number
  3. tr '\n' ',': Covert newline separator back to comma.
  4. sed 's/.$//': Removing tailing comma.

Not elegant enough, but it should work :p



Answered By - Yu-Lin Chen
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Thursday, August 18, 2022

[FIXED] How to output excel sorting result into separate columns by content

 August 18, 2022     excel, excel-formula, output, sorting     No comments   

Issue

I have an excel column which I want to sort and output the result into a separate sheet. I want the output to be sorted into separate columns, so that each column in the output sheet should have its own type of content, only as many times as it showed up in the original.

e.g. if the original column looks like this:

Right
Left
Left
Right
Right

I want the next sheet to show:

Right    Left
Right    Left
Right 

Note, that I Don't want to specify what I am sorting according to, i.e. my formula will not contain "enter in this column any content that is equal to 'right'", but rather will be dynamic and will simply group whatever strings are identical into one column, etc.

How do I sort into multiple columns by content and output in a separate sheet?


Solution

For Excel 365

Say the first sheet is like:

enter image description here

In A1 of the second sheet enter:

=TRANSPOSE(UNIQUE(Sheet1!A1:A11))

(it will spill across)

In A2 enter:

=FILTER(Sheet1!$A1:$A11,Sheet1!$A1:$A11=A1)

and copy across.

Your required output starts in the second row of this second sheet.

enter image description here

EDIT#1:

If you want the column of "left"s to appear first, then use:

=TRANSPOSE(SORT(UNIQUE(Sheet1!A1:A11),,1))

in A1 of the second sheet.



Answered By - Gary's Student
Answer Checked By - Marilyn (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Wednesday, August 17, 2022

[FIXED] How to determine if a graph has a non-unique topological sort

 August 17, 2022     algorithm, c++, output, sorting, topological-sort     No comments   

Issue

I have created a program that organizes a graph by topological sort given an diagram. I identified 3 results:

  • ok
  • existing cycles
  • missing information

The output of the first two points is correct, but for the third it's not. For example for the graph with 4 vertices and edges: 1->2; 3->1; 3->4; 4->2, the result I obtained is: 3 1 4 2... wrong! What is known is insufficient to conclude this. Any hints or help is appreciated, thanks in advance.

#include<bits/stdc++.h>
using namespace std;

class Graph{
    int V;
    list<int> *adj;
    public:
        Graph(int V);
        void addEdge(int u, int v);
        void topologicalSort();
};

Graph::Graph(int V){
    this->V = V;
    adj = new list<int>[V];
}

void Graph::addEdge(int u, int v){
    adj[u].push_back(v);
}

void Graph::topologicalSort(){
    vector<int> in_degree(V, 0);
    for (int u=0; u<V; u++){
        list<int>::iterator itr;
        for (itr = adj[u].begin(); itr != adj[u].end(); itr++)
             in_degree[*itr]++;}
    queue<int> q;
    for (int i = 0; i < V; i++)
        if (in_degree[i] == 0)
            q.push(i);
    int cnt = 0;
    vector <int> top_order;
    while (!q.empty()){
        int u = q.front();
        q.pop();
        top_order.push_back(u);
        list<int>::iterator itr;
        for (itr = adj[u].begin(); itr != adj[u].end(); itr++)
            if (--in_degree[*itr] == 0)
                q.push(*itr);
        cnt++;}
    if (cnt != V){
        cout << "Existing cycle\n";
        return;}
    for (int i=1; i<(int)top_order.size(); i++)
        cout << top_order[i] << " ";
    cout << endl;
}

int main(){
    setbuf(stdout, NULL);
    int N, L, u, v;
    scanf("%d %d", &N, &L);
    Graph g(N+1);
    for (int i=1; i<=L; i++){
        scanf("%d %d", &u, &v);
        g.addEdge(u, v);
    }
    g.topologicalSort();
    return 0;
}

Solution

To check that a particular graph has a unique topological sorting, it is apparently enough to check for a Hamiltonian path in the DAG. Quoting wikipedia:

If a topological sort has the property that all pairs of consecutive vertices in the sorted order are connected by edges, then these edges form a directed Hamiltonian path in the DAG. If a Hamiltonian path exists, the topological sort order is unique; no other order respects the edges of the path. Conversely, if a topological sort does not form a Hamiltonian path, the DAG will have two or more valid topological orderings, for in this case it is always possible to form a second valid ordering by swapping two consecutive vertices that are not connected by an edge to each other. Therefore, it is possible to test in linear time whether a unique ordering exists.

So you just need to get the DAG for the first sorting you find and check that it forms a path that visits all the vertices.



Answered By - gilleain
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home
View mobile version

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing