How to export import content from inside a table using mysql commands

I’m transferring a WordPress site to a new server, but I’m trying to do the process as clean as possible. However, since I have to transfer a lot of posts to the new database, and the export feature on WP doesn’t work well, I exported only the essentials tables, and then I’m configuring everything again from scratch.

The only problems is that I’m using the TablePress plugin which stores its data in the wp_posts and wp_postmeta tables, and the settings in the wp_options table.

Since I already the restored the posts using the wp_posts and wp_postmeta, the entries from TablePress plugins are already in the database, but the content doesn’t show up in the plugin, because the index and option are located in the wp_options, which I’m configuring again from scratch.

The plugin developers has suggested that I can export the tablepress_tables and tablepress_options entries from the wp_options, but neither him or I knows the syntax to export and import the entries from a tablet, in this case from the wp_options table in mysql without using phpmyadmin, since it’s not available in the server.

So I wanted to ask if anyone could help figuring out the how to export tablepress_tables and tablepress_options entries from inside the wp_options table inside a database called wordpress using command line on mysql 5.7?

Thanks,

IP Table Rules for SYN Flood

IP Table Rules for SYN Flood | Web Hosting Talk


‘);
var sidebar_align = ‘right’;
var content_container_margin = parseInt(‘350px’);
var sidebar_width = parseInt(‘330px’);
//–>









  1. IP Table Rules for SYN Flood


    Can anyone share some good IP Table rules for SYN flood? Randomly, I am getting one, out of blue. So would like to stop it.

    OS: Debian.

    Thanks













Similar Threads


  1. Replies: 18


    Last Post: 06-06-2007, 03:59 PM


  2. Replies: 8


    Last Post: 09-04-2005, 07:31 AM


  3. Replies: 15


    Last Post: 08-31-2005, 02:03 AM


  4. Replies: 9


    Last Post: 06-20-2004, 11:25 PM



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  








sql server – Foreign keys to primary tables or nested table

In this hypothetical example should the foreign key constraint setup for the ProductId and UserId columns in the ProductUserCommentAction table be referencing the Product/User tables as shown in the first diagram OR is it OK for those columns to reference the ProductUserComment table as shown in the second diagram?

I like how it’s setup in the second diagram as it reduces the spider web in visualizations.

Are there any downsides to this second approach?

enter image description here

Versus

enter image description here

Want to bind my custom grid with existing core database table of magento 2

I have created a custom module under system tab. Now I want to create a custom grid on that page and binds this grid with the core magento database table “directory_country_region”.

This is the custom module on which I want to create table

This is my folder structure used to achieve this task, registration.php file is there at bottom which is not visible in screenshort

postgresql – Pre Caching Index on a large table in PostgrSQL

I have a table with about 10mln rows in it with a primary key and an index defined on it:

    create table test.test_table(
        date_info date not null,
        string_data varchar(64) not null,
        data bigint
        primary key(date_info, string_data));
        create index test_table_idx 
        on test.test_table(string_data);

I have a query that makes the use of the test_table_idx:

select distinct date_info from test.test_table where string_data = 'some_val';

The issue is that first time around it could take up to 20 seconds to run the query and < 2 seconds on any subsequent runs.

Is there a way to pull load the entire index into memory rather then have DB load information on first access?

Select Into a temp table in DB2

Let me preface this question in that while I have a strong background in T-SQL but I am still just a newbie when it comes to DB2.

The root query looks roughly like this:

Select 
    Col1, Col2, Col3
From (
    Select A.Col1, B.Col2, B.Col3
    From SchemaA.TableA as A
        Inner Join SchemaA.TableB as B
            On A.Id = B.ParentId
    Where 
        A.Col2 = 'TypeValue'
    Fetch First 5 Rows Only -- This is not allowed in a union or sub select

    Union

    Select A.Col1, B.Col2, B.Col3
    From SchemaB.TableA as A
        Inner Join SchemaB.TableB as B
            On A.Id = B.ParentId
    Where 
        A.Col2 = 'TypeValue'
    Fetch First 5 Rows Only -- This is not allowed in a union or sub select
) as Hybrid

Because Fetch First X Rows is not allowed in subselects or with unions, this isn’t going to work. Since we’re limiting the output, it makes sense to limit the input.

I figure I can achieve a fake union by feeding my subselects into temp tables instead and returning that output instead.

In T-SQL, I can create a temp table on the fly with a query like this how would I do that in DB2?

Select *
Into #Temp
From TableA

How would I do that in DB2? Or would do I need to create the table before inserting data into it?

sql – How do I extract data from a main table based on this specific scenario?

I am using SQL Server 2014. I have a table (T1) which contains the list of IDs of cancelled bookings and their equivalent re-bookings.

Extract of table T1:

CancelledID       Re-bookingID
  301                754
  387                801
  400                900
  ...

Each CancelledID has a unique equivalent in the Re-bookingID column.

I have another table (T2) which contains the list of ALL BookingIDs with additional information related to each ID. An extract of this table is shown below:

BookingID     MonthOfStay      RoomNights
...
301             2019-03-01        10
387             2019-04-01         7
400             2019-03-01         5
754             2019-08-01        10
801             2019-09-01         3
900             2019-07-01         5
900             2019-08-01         4
...   

I need a t-sql query which will me the following output:

  BookingID       Cancelled_MonthOfStay     Re-booking_MonthOfStay     RoomNights
    301                2019-03-01                                           10
    387                2019-04-01                                            7
    400                2019-03-01                                            5
    754                                           2019-08-01                10
    801                                           2019-09-01                 3
    900                                           2019-07-01                 5
    900                                           2019-08-01                 4

As you can see, a re-booking can span over 2 months with additional room nights.

I am thinking about “Joins” between the 2 tables but I am stuck at the logic to be used for the “Joins” (if that is the right way of tackling the problem).

Any help would be appreciated.

functions – Keep PODS data (meta table) after wp-ultimo (multisite) template switching

I have a multisite install and using wp-ultimo to manage the subsite duplication, or “template sites” as they call it.

One downside to this approach is that you’d lose any edits you make when you switch the template, because in reality, it’s not a template, it’s an entire subsite that will override your current subsite.

I have extended the site’s pages with PODS, added a couple of simple text fields, they’re basically custom meta fields, you get the data using get_post_meta($id, 'field_name', true).

What I’m trying to achieve is:

  1. Write a function that will retrieve this data before duplication
  2. Pass the data to the search & replace filter that fires after duplication

Relevant Available Hooks:

  • do_action (../inc/duplicate/duplicate.php line 139) ( ‘mucd_before_copy_data’, $from_site_id, $to_site_id );

  • apply_filters (../inc/class-wu-site-hooks.php line 576) (‘wu_search_and_replace_on_duplication’, $search_and_replace_settings, $from_site_id, $to_site_id);

Using search & replace filter example

I don’t know enough PHP to wrap the function properly and pass the values, I’d appreciate any help or a nudge in the right direction.

Thank you <3

sql server – Why is it important for every table to have a primary key?

So I have some tables in Sql Server that are essentially a list of sales, things like:

ProductID 
SalesOrderID
ProductFamilyID 
ProductCost
ProductSource

and so on. In this case, none of the columns are necessarily unique, so I can’t create a primary key from any combination of them. In fact, the only constraint that I really have on the table is that I need every row in the table to be a unique combination of the columns. So I’m assuming something like a unique index would be the way to go there.

The only primary key I could add is something like an autoincrement primary key. But what would be the actual use of that, database wise? What are the possible problems with not creating a primary key for a table like this?

typescript – subscribe to the data content for a datasource angular material table , how to make the pagination server calls from angular

introducir la descripción de la imagen aquí

Hi, I’m block with 2 points and need some of help with my development first it’s how to get data from backend with the pagination server procedure, i see multiple examples but nothing with the backend results of the httpclient get call.

The api to use data works with this:

http://localhost:8080/users?size=10&page=100

1.- I get the values but i don’t know really how to implements the HttpParams to get the values with the angular material table paginator.

My other problem its the object its a container but i can’t access into the content of the data to retrieve the values of users.

{
  "content": ({
        "id": 343,
        "name": "name1",
        "email": "a.dasgeasslo@asdf.com",
        "imageUrl": null,
        "emailVerified": true,
        "sapUserId": "adangesslo",
        "provider": "google",
        "providerId": null,
        "createdBy": "Admin",
        "updatedBy": "Admin",
        "createDate": "2020-05-05T12:15:42.744+0000",
        "updateDate": "2020-05-05T12:15:42.744+0000",
        "lastLoginDate": null,
        "roles": ({
          "id": 9,
          "name": "site_prod_shift",
          "type": "site_prod_shift",
          "description": "site_prod_shift",
          "createdBy": "Admin",
          "updatedBy": "Admin",
          "createDate": "2020-05-04T18:37:58.302+0000",
          "updateDate": "2020-05-04T18:37:58.302+0000"
        }),
        "plants": ({
          "plantId": 4,
          "name": "asdf (asdf e asdf)",
          "code": "MG",
          "smartsheetLink": "",
          "type": {
            "id": 1,
            "name": "asf Plant"
          },
          "createDate": "2020-05-04T18:02:15.333+0000",
          "updateDate": "2020-05-04T18:02:15.333+0000",
          "createdBy": "Admin",
          "updatedBy": "Admin",
          "opcoId": 1
        })
      },




  ),
  "pageable": {
    "sort": {
      "unsorted": true,
      "sorted": false,
      "empty": true
    },
    "offset": 0,
    "pageNumber": 0,
    "pageSize": 20,
    "unpaged": false,
    "paged": true
  },
  "totalPages": 104,
  "totalElements": 2065,
  "last": false,
  "size": 20,
  "number": 0,
  "sort": {
    "unsorted": true,
    "sorted": false,
    "empty": true
  },
  "numberOfElements": 20,
  "first": true,
  "empty": false
}


My user.service:

import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { User } from '../model/user';
import { HttpClient, HttpErrorResponse, HttpParams } from '@angular/common/http';
import { environment } from './../../environments/environment.prod';
import { ToasterService } from 'angular2-toaster';
import { AddDialogComponent } from '../main/users/dialogs/add/add.dialog.component';
import { map } from 'rxjs/operators';

@Injectable({
  providedIn: 'root'
})
export class UserService {

  dataChange: BehaviorSubject<User()> = new BehaviorSubject<User()>(());
  // Temporarily stores data from dialogs
  dialogData: any;
  apiurl = environment.apiUrl;
  items: any;
  AddDialogComponent: AddDialogComponent;
  AllDataObj: any;
  AllData_Arr: string;

  constructor(private httpClient: HttpClient) { }

  get data(): User() {
    return this.dataChange.value;
  }

  getDialogData() {
    return this.dialogData;
  }

  /** CRUD METHODS http://localhost:8080/users?size=1&page=1  */

  getAllUsers(): void {
    this.httpClient.get<User()>(this.apiurl + "/users?",
      {
        params: new HttpParams()
          .set('size', "5")
          .set('page', "5")
        //}).subscribe((data: User()) => {
        }).subscribe(data => {
        this.dataChange.next(data);
        console.log(this.data);
      },
        (error: HttpErrorResponse) => {
          console.log(error.name + ' ' + error.message);
        });
  }
  // getAllUsers(): void{
  //   this.httpClient.get<User()>(this.apiurl+"https://es.stackoverflow.com/users").subscribe((data: User())=> {
  //     console.log(data);
  //     this.dataChange.next(data);
  //     //this.AllDataObj = data;
  //     //this.AllData_Arr= JSON.stringify(this.AllDataObj);
  //     //console.log(this.AllData_Arr);
  //     },
  //     (error: HttpErrorResponse) => {
  //     console.log (error.name + ' ' + error.message);
  //     });
  // }

  // DEMO ONLY, you can find working methods below
  addUser(user: User): void {
    this.httpClient.post(this.apiurl + "/createuser", user).subscribe(data => {
      this.dialogData = user;
      // this.toasterService.pop('Successfully added');
    },
      (err: HttpErrorResponse) => {
        console.log(err.name + ' ' + err.message)
        //this.ToasterService.pop('Error occurred. Details: ' + err.name + ' ' + err.message);
      });
  }

  updateUser(user: User): void {
    this.dialogData = user;
  }

  deleteUser(id: number): void {
    console.log(id);
  }

  getConfig(): Observable<User()> {
    return this.httpClient.get<User()>(this.apiurl + "https://es.stackoverflow.com/users");
  }

}



/* REAL LIFE CRUD Methods I've used in my projects. ToasterService uses Material Toasts for displaying messages:

    // ADD, POST METHOD
    addItem(kanbanItem: KanbanItem): void {
    this.httpClient.post(this.apiurl, kanbanItem).subscribe(data => {
      this.dialogData = kanbanItem;
      this.toasterService.showToaster('Successfully added', 3000);
      },
      (err: HttpErrorResponse) => {
      this.toasterService.showToaster('Error occurred. Details: ' + err.name + ' ' + err.message, 8000);
    });
   }

    // UPDATE, PUT METHOD
     updateItem(kanbanItem: KanbanItem): void {
    this.httpClient.put(this.apiurl + kanbanItem.id, kanbanItem).subscribe(data => {
        this.dialogData = kanbanItem;
        this.toasterService.showToaster('Successfully edited', 3000);
      },
      (err: HttpErrorResponse) => {
        this.toasterService.showToaster('Error occurred. Details: ' + err.name + ' ' + err.message, 8000);
      }
    );
  }

  // DELETE METHOD
  deleteItem(id: number): void {
    this.httpClient.delete(this.apiurl + id).subscribe(data => {
      console.log(data(''));
        this.toasterService.showToaster('Successfully deleted', 3000);
      },
      (err: HttpErrorResponse) => {
        this.toasterService.showToaster('Error occurred. Details: ' + err.name + ' ' + err.message, 8000);
      }
    );
  }
*/

my user.component.ts

import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import { UserService } from '../../services/user.service';
import { HttpClient } from '@angular/common/http';
import { MatDialog } from '@angular/material/dialog';
import { MatPaginator, PageEvent } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { User } from '../../model/User';
import { DataSource } from '@angular/cdk/collections';
import {AddDialogComponent} from './dialogs/add/add.dialog.component';
import {EditDialogComponent} from './dialogs/edit/edit.dialog.component';
import {DeleteDialogComponent} from './dialogs/delete/delete.dialog.component';
import {BehaviorSubject, fromEvent, merge, Observable} from 'rxjs';
import {map} from 'rxjs/operators';

@Component({
  selector: 'app-users',
  templateUrl: './users.component.html',
  styleUrls: ('./users.component.scss')
})
export class UsersComponent implements OnInit {
  displayedColumns = ('id', 'Name', 'email', /*'imageUrl',*/ 'createdate', 'sapUserId', 'roles', 'actions');
  exampleDatabase: UserService | null;
  dataSource: ExampleDataSource | null;
  index: number;
  id: number;
  newid: number;

  constructor(
    public httpClient: HttpClient,
    public dialog: MatDialog, 
    public userService: UserService) {}

  @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
  @ViewChild(MatSort, {static: true}) sort: MatSort;
  @ViewChild('filter',  {static: true}) filter: ElementRef;

  ngOnInit() {
    this.loadData();

    //this.getAllUsers();
    }
  //getAllUsers(){
  //  this.dataApi.getAllUsers()
  //  .subscribe(users => console.log(users)); }

  refresh() {
    this.loadData();
  }

  addNew(user?: User) {
    const dialogRef = this.dialog.open(AddDialogComponent, {
      data: {user: user} 
    });

    dialogRef.afterClosed().subscribe(result => {
      if (result === 1) {
        // After dialog is closed we're doing frontend updates
        // For add we're just pushing a new row inside userService
        this.exampleDatabase.dataChange.value.push(this.userService.getDialogData());
        this.refreshTable();
      }
    });
  }

  startEdit(i: number, id: number, name: string, email: string, imageUrl: string, createdate: Date,  sapUserId: string, roles: ()) {
    this.id = id;
    // index row is used just for debugging proposes and can be removed
    this.index = i;
    console.log(this.index);
    const dialogRef = this.dialog.open(EditDialogComponent, {
      data: {id: id, name: name, email: email, imageUrl: imageUrl, createdate: createdate, sapUserId: sapUserId, roles: roles}
    });

    dialogRef.afterClosed().subscribe(result => {
      if (result === 1) {
        // When using an edit things are little different, firstly we find record inside userService by id
        const foundIndex = this.exampleDatabase.dataChange.value.findIndex(x => x.id === this.id);
        // Then you update that record using data from dialogData (values you enetered)
        this.exampleDatabase.dataChange.value(foundIndex) = this.userService.getDialogData();
        // And lastly refresh table
        this.refreshTable();
      }
    });
  }

deleteItem(i: number, id: number, name: string, email: string, imageUrl: string, createdate: string, sapUserId: string, roles: ()) {
  this.index = i;
  this.id = id;
  const dialogRef = this.dialog.open(DeleteDialogComponent, {
    data: {id: id, name: name, email: email, imageUrl: imageUrl, createDate: createdate, sapUserId: sapUserId, roles: roles}
  });

  dialogRef.afterClosed().subscribe(result => {
    if (result === 1) {
      const foundIndex = this.exampleDatabase.dataChange.value.findIndex(x => x.id === this.id);
      // for delete we use splice in order to remove single object from DataService
      this.exampleDatabase.dataChange.value.splice(foundIndex, 1);
      this.refreshTable();
    }
  });
}

private refreshTable() {
  // Refreshing table using paginator
  // Thanks yeager-j for tips
  // https://github.com/marinantonio/angular-mat-table-crud/issues/12
  this.paginator._changePageSize(this.paginator.pageSize);
}

  /*   // If you don't need a filter or a pagination this can be simplified, you just use code from else block
    // OLD METHOD:
    // if there's a paginator active we're using it for refresh
    if (this.dataSource._paginator.hasNextPage()) {
      this.dataSource._paginator.nextPage();
      this.dataSource._paginator.previousPage();
      // in case we're on last page this if will tick
    } else if (this.dataSource._paginator.hasPreviousPage()) {
      this.dataSource._paginator.previousPage();
      this.dataSource._paginator.nextPage();
      // in all other cases including active filter we do it like this
    } else {
      this.dataSource.filter = '';
      this.dataSource.filter = this.filter.nativeElement.value;
    }*/

    public loadData() {
      this.exampleDatabase = new UserService(this.httpClient);
      this.dataSource = new ExampleDataSource(this.exampleDatabase, this.paginator, this.sort);
      fromEvent(this.filter.nativeElement, 'keyup')
        // .debounceTime(150)
        // .distinctUntilChanged()
        .subscribe(() => {
          if (!this.dataSource) {
            return;
          }
          this.dataSource.filter = this.filter.nativeElement.value;
        });
    }
  }

export class ExampleDataSource extends DataSource<User> {
  _filterChange = new BehaviorSubject('');

  get filter(): string {
    return this._filterChange.value;
  }

  set filter(filter: string) {
    this._filterChange.next(filter);
  }

  filteredData: User() = ();
  renderedData: User() = ();

  constructor(public _exampleDatabase: UserService,
              public _paginator: MatPaginator,
              public _sort: MatSort) {
    super();
    // Reset to the first page when the user changes the filter.
    this._filterChange.subscribe(() => this._paginator.pageIndex = 0);
  }

  /** Connect function called by the table to retrieve one stream containing the data to render. */
  connect(): Observable<User()> {
    // Listen for any changes in the base data, sorting, filtering, or pagination
    const displayDataChanges = (
      this._exampleDatabase.dataChange,
      this._sort.sortChange,
      this._filterChange,
      this._paginator.page
    );

    this._exampleDatabase.getAllUsers();

    return merge(...displayDataChanges).pipe(map( () => {
        // Filter data
        this.filteredData = this._exampleDatabase.data.slice().filter((user: User) => {
          const searchStr = (user.id + user.name + user.email + user.imageUrl + user.createdate + user.sapUserId + user.roles).toLowerCase();
          return searchStr.indexOf(this.filter.toLowerCase()) !== -1;
        });

        // Sort filtered data
        const sortedData = this.sortData(this.filteredData.slice());

        // Grab the page's slice of the filtered sorted data.
        const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
        this.renderedData = sortedData.splice(startIndex, this._paginator.pageSize);
        return this.renderedData;
      }
    ));
  }

  disconnect() {}

  /** Returns a sorted copy of the database data. */
  sortData(data: User()): User() {
    if (!this._sort.active || this._sort.direction === '') {
      return data;
    }

    return data.sort((a, b) => {
      let propertyA: number | string = '';
      let propertyB: number | string = '';
      let propertyC: Date | string = '';

      switch (this._sort.active) {
        case 'id': (propertyA, propertyB) = (a.id, b.id); break;
        case 'lastname': (propertyA, propertyB) = (a.name, b.name); break;
        case 'email': (propertyA, propertyB) = (a.email, b.email); break;
        case 'photoURL': (propertyA, propertyB) = (a.imageUrl, b.imageUrl); break;
        case 'createdate': (propertyC, propertyC) = (a.createdate, b.createdate); break;
        case 'sapid': (propertyA, propertyB) = (a.sapUserId, b.sapUserId); break;
      }

      const valueA = isNaN(+propertyA) ? propertyA : +propertyA;
      const valueB = isNaN(+propertyB) ? propertyB : +propertyB;
      const valueC = isNaN(+propertyC) ? propertyC : +propertyC;

      return (valueA < valueB ? -1 : 1) * (this._sort.direction === 'asc' ? 1 : -1);
    });
  }

}


my user.ts model



export class User {
    id: number;
    name: string;
    email: string;
    imageUrl?: string;
    emailVerified?: boolean;
    sapUserId: string;
    provider?: string;
    providerId?: string;
    createdBy?: string;
    createdate?: string;
    updatedBy?: string;
    createDate?: string;
    updateDate?: string;
    lastLoginDate?: string;
    roles: string;
    plants?:any();
    totalPages?: number;
    totalElements?: number;
}

2.- The other point its how to slice or filter the content () into the json response to load the datatable.

Thanks.

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123