Categories
Mastering Development

Can I build a serializer that validates username and email existence on is_valid call?

guys! I have this serializer class for the user model class UserSerializer(serializers.ModelSerializer): username = serializers.RegexField("^(?=.{6,20}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._]+(?<![_.])$") full_name = serializers.RegexField("^([a-zA-Z]{2,}\s[a-zA-Z]{1,}’?-?[a-zA-Z]{2,}\s?([a-zA-Z]{1,})?)") email = serializers.EmailField() phone = serializers.RegexField("^(\+\d{1,2}\s?)?1?\-?\.?\s?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$") class Meta: model = User fields = [‘username’, ‘full_name’, ’email’, ‘password’, ‘phone’] This is my serializer class for the moment. I want to validate that the username and email does not […]

Categories
Mastering Development

Why is my data not going to my SQL database when i click the button?

public partial class signupuser : System.Web.UI.Page { string strcon = ConfigurationManager.ConnectionStrings["con"].ConnectionString; protected void Page_Load(object sender, EventArgs e) { } // sign up button click event protected void Button1_Click(object sender, EventArgs e) { //Response.Write("<script>alert(‘Testing’);</script>"); try { SqlConnection con = new SqlConnection(strcon); if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("INSERT INTO member_master_tbl(email, password, […]

Categories
Mastering Development

Migrations are not applying to specific model

The problem is whenever I try to migrate changes, migrations does’nt applying to this specific app which is named as Userinfo. The messege in my terminal is Operations to perform: Apply all migrations: admin, auth, books_details, contenttypes, sessions Running migrations: No migrations to apply. And that app is not listed in my above list also […]

Categories
Mastering Development

Swift ui macos json convert in class Codable

I get the following json from an api call but am having trouble making the proper structure in swift and then getting the data as an array. Json: { "status":"ok", "users":[ { "position":0, "user":{ "pk":"", "full_name":"", "username":"", "profile_pic_url":"" } },… ] } Swift: class Response: Codable { var status: String var users: [User]? } class […]

Categories
Mastering Development

comparsion and match date format

I have facing an issue in javascript dates. i want to show dates which is greater than newprevious and less than newseconddate comparing with start_date json data react component i try but my condition is not working <div class=”row”> {this.state.data && this.state.data.length ? // this.state.data[index].start_date.toString() > this.state.newprevious // this.state.data[index].start_date.toString() < this.state.newseconddate this.state.data.map( ({ cust_full_name, full_name, […]

Categories
Mastering Development

checkbox inputs are checked by default?

I have some checkbox inputs in my vue app that I am trying to render as unchecked but for some reason they stay checked my data looks like so: data: { students: [ { “id”: 189, “first_name”: “el Mahdi”, “avatar”: null, “group_id”: 24, “full_name”: “, el Mahdi”, “exclude”: false, “isGrouped”: false, “include”: false, }, { […]

Categories
Database Development

Postgres query performance – hash aggregate costly operation

I’m running Postgres 9.6.6 and I have a relatively simple query, however, I’m finding that it is slow with the hash aggregation function which is the most costly operation: select program_schedule_source_count.full_name, program_schedule_source_count.country, sum(program_schedule_source_count.displays) as displays, program_schedule_source_count.source_id, program_schedule_source_count.source_region from program_schedule_source_count where program_schedule_source_count.original_title = ‘How I Met Your Mother’ and program_schedule_source_count.show_type in (‘SM’, ‘SE’) and program_schedule_source_count.start_date between […]

Categories
Development

login system not working using php and mysql

so im trying to get my login working which is using php and mysql. i dont no what to replace (mysqli_fetch_array) because before i was using md5 password and changed it to password hash. what i want the code to basically do is when the users correct email and password is inputted the page is […]

Categories
Development

Fuzzy matching a string in SQL

I have a User table, that has id, first_name, last_name, street_address, city, state, zip-code, firm, user_identifier, created_at, update_at. This table has a lot of duplication like the same users have been entered multiple times as a new user, so example id first_name last_name street_address user_identifier ——————————————————— 11 Mary Doe 123 Main Ave M2111111 ——————————————————— 21 […]

Categories
Development Laravel MySQL

laravel stored procedure migration syntax error when calling

I have stored procedure migration in laravel for mysql DB. This is the stored procedure: DROP PROCEDURE IF EXISTS `select_total_raised_jobs`; delimiter ;; CREATE PROCEDURE `select_total_raised_jobs` (IN cid int) BEGIN DROP TABLE IF EXISTS tmp_results; CREATE TEMPORARY TABLE tmp_results AS SELECT COUNT(jobs.id) AS TotalJobs, DATE(jobs.created_at) AS created_at, users.id AS userID, concat( users.first_name,’ ‘,users.last_name) as full_name, jobs.driver_id […]