How to change UPDATES and INFO folers between each other (change their places between each other)? - socialengine

How to change UPDATES and INFO folers between each other in SocialEngine profiles? I need INFO folder of user profile data to be before his UPDATES.

For this needed in engine4_core_content table change between content_id columns 540 and 541 their values for order column like this: content_id|541 = order|1 and content_id|540 = order|2.

Related

Find first occurrence of record in list of modifications/deletions with connecting keys

I have an algorithm that converts the writeback of a frontend app into a cleaned dataset.
In the frontend the user can either add a new record or modify/delete an existing one. The modification and deletion are performed by tracking the key of the original row and creating a new one with the new status.
Here is an example of the writeback of the frontend app
key
date
status
source_key
10277_left_1605483676378
1605483676378
created
null
10277_left_1605559717253
1605559717253
modified
10277_left_1605483676378
10277_left_1627550679123
1627550679123
deleted
10277_left_1605559717253
10277_left_1605560105840
1605560105840
modified
10277_left_1605483676378
10277_left_1605560105900
1605560105900
modified
10277_left_1605560105840
and here is the result after applying the algorithm that creates the cleaned dataset
key
date
status
10277_left_1605560105900
1605560105900
modified
As you can see we branched from the first version of the data (1605483676378), created two modified versions and deleted one of those, before making a final modification on the remaining one, so the resulting data only contains one row.
┌──────►1605559717253 ──────► 1627550679123 ─────► no output row
created │ modified deleted
1605483676378│
│ ┌──────────────────┐
└──────►1605560105840─────┼──►1605560105900 ├─────► row visible in
modified │ modified │ cleaned
└──────────────────┘ dataset
This works as every update is treated singularly. However, I would like to be able to inspect the origin of a certain record. That is, I want to know the original date when the record was created, something like this
key
date
status
date_added
10277_left_1605560105900
1605560105900
modified
1605483676378
I'm thinking on how to do this. I would avoid having to loop through the entire history of a record as this would be not efficient.
As the algorithm is currently working in Pyspark I would like to find a solution that works there, but hints in Pandas are also accepted.
IIUC you want to find the root node of a child node. I assume all your keys are unique in the below:
# df is your original df, df2 the one after you apply your algo
d = df.set_index("key")["source_key"].to_dict()
def find_root(node):
cur = d.get(node, np.NaN)
return find_root(cur) if cur is not np.NaN else node
df2["root"] = df2["key"].map(find_root)
print (df2)
key date status root
0 10277_left_1605560105900 1605560105900 modified 10277_left_1605483676378

Woocommerce, update ACF field and short description with SQL

I've got a WooCommerce set up where I currently need to do two things. The first is to move data that is currently in the post.excerpt field to an ACF field that I've created specifically for the purpose while the second is to update the post.excerpt field with new data. All the product data is in SQL-Server Express because the product data came from another website that we're replacing with the WooCommerce one. I exported all the Woocommerce products with basic info like the product ID, SKU, Title and Post_Content and wrote a query in SQL-Server to match the two together. That's been exported as a flat file and imported into MySQL. Now I've writen a query to update the post.excerpt field but what I can't find is a way to update the ACF field in the same query (or another one).
set
'wp.posts'.'post.excerpt' = 'updatelist'.'excerpt'
From 'updatelist'
where
'wp_posts'.'ID' = 'updatelist'.'product_id'
Can anyone help? Please don't suggesting importing a CSV file. There's 180,000 products and using a csv, well it's about 10% of the way through and has taken, so far, 24 hours.
To update ACF fields, first i would usually prepare an aray of key-value pairs of ACF fields to loop over and update them:
# first prepare your array of ACF fields you need to update
acf_fields = [
'field_5f70*********' => 'product_name',
'field_5f80*********' => 'product_color',
'field_5f90*********' => 'product_price'
];
# to find the key values for your own ACF fields, just go to admin dashboard under custom fields, select your group of ACF fields and then on the "Edit Field Group" you see those keys. If you don't see them, choose "screen options" and select "fields keys".
# Now we're going to loop over them and update each field
foreach(acf_fields as $key => $name){
update_field(a, b, c);
# a = $key
# b = value to be updated which comes from your old list (from querying your list)
# c = which post it belongs to (custom query for your custom post type that contains ACF fields)
};
That's how i update my ACF fields, there are other methods using Wordpress REST API too.

Error: Not found: Dataset my-project-name:domain_public was not found in location US

I need to make a query for a dataset provided by a public project. I created my own project and added their dataset to my project. There is a table named: domain_public. When I make query to this table I get this error:
Query Failed
Error: Not found: Dataset my-project-name:domain_public was not found in location US
Job ID: my-project-name:US.bquijob_xxxx
I am from non-US country. What is the issue and how to fix it please?
EDIT 1:
I change the processing location to asia-northeast1 (I am based in Singapore) but the same error:
Error: Not found: Dataset censys-my-projectname:domain_public was not found in location asia-northeast1
Here is a view of my project and the public project censys-io:
Please advise.
EDIT 2:
The query I used to type is based on censys tutorial is:
#standardsql
SELECT domain, alexa_rank
FROM domain_public.current
WHERE p443.https.tls.cipher_suite = 'some_cipher_suite_goes_here';
When I changed the FROM clause to:
FROM `censys-io.domain_public.current`
And the last line to:
WHERE p443.https.tls.cipher_suite.name = 'some_cipher_suite_goes_here';
It worked. Shall I understand that I should always include the projectname.dataset.table (if I'm using the correct terms) and point the typo the Censys? Or is this special case to this project for some reason?
BigQuery can't find your data
How to fix it
Make sure your FROM location contains 3 parts
A project (e.g. bigquery-public-data)
A database (e.g. hacker_news)
A table (e.g. stories)
Like so
`bigquery-public-data.hacker_news.stories`
*note the backticks
Examples
Wrong
SELECT *
FROM `stories`
Wrong
SELECT *
FROM `hacker_news.stories`
Correct
SELECT *
FROM `bigquery-public-data.hacker_news.stories`
In Web UI - click Show Options button and than select your location for "Processing Location"!
Specify the location in which the query will execute. Queries that run in a specific location may only reference data in that location. For data in US/EU, you may choose Unspecified to run the query in the location where the data resides. For data in other locations, you must specify the query location explicitly.
Update
As it stated above - Queries that run in a specific location may only reference data in that location
Assuming that censys-io.domain_public dataset has its data in US - you need to specify US for Processing Location
The problem turned out to be due to wrong table name in the FROM clause.
The right FROM clause should be:
FROM `censys-io.domain_public.current`
While I was typing:
FROM domain_public.current
So the project name is required in the FROM and `` are required because of - in the project name.
Make sure your FROM location contains 3 parts as #stevec mentioned
A project (e.g. bigquery-public-data)
A database (e.g. hacker_news)
A table (e.g. stories)
But in my case, I was using the LegacySql within the Google script editor, so in that case you need to state that to false, for example:
var projectId = 'xxxxxxx';
var request = {
query: 'select * from project.database.table',
useLegacySql: false
};
var queryResults = BigQuery.Jobs.query(request, projectId);
check exact case [upper or lower] and spelling of table or view name.
copy it from table definition and your problem will be solved.
i was using FPL009_Year_Categorization instead of FPL009_Year_categorization
using c as C and getting the error "not found in location asia-south1"
I copied with exact case and problem is resolved.
On your Big Query console, go to the Data Explorer on the left pane, click the small three dots, then select query option from the list. This step confirms you choose the correct project and dataset. Then you can edit the query on the query pane on the right.
may be dataset name changed in create dataset option. it should be US or default location
enter image description here

Peoplesoft CreateRowset with related display record

According to the Peoplebook here, CreateRowset function has the parameters {FIELD.fieldname, RECORD.recname} which is used to specify the related display record.
I had tried to use it like the following (just for example):
&rs1 = CreateRowset(Record.User, Field.UserId, Record.UserName);
&rs1.Fill();
For &k = 1 To &rs1.ActiveRowCount
MessageBox(0, "", 999999, 99999, &rs1(&k).UserName.Name.Value);
End-for;
(Record.User contains only UserId(key), Password.
Record.UserName contains UserId(key), Name.)
I cannot get the Value of UserName.Name, do I misunderstand the usage of this parameter?
Fill is the problem. From the doco:
Note: Fill reads only the primary database record. It does not read
any related records, nor any subordinate rowset records.
Having said that, it is the only way I know to bulk-populate a standalone rowset from the database, so I can't easily see a use for the field in the rowset.
Simplest solution is just to create a view, but that gets old very soon if you have to do it a lot. Alternative is to just loop through the rowset yourself loading the related fields. Something like:
For &k = 1 To &rs1.ActiveRowCount
&rs1(&k).UserName.UserId.value = &rs1(&k).User.UserId.value;
&rs1(&k).UserName.SelectByKey();
End-for;

SQL Query Needed for Joomla 1.5

I'm not sure if this is even possible but I have a Joomla 1.5 installation and I'm updating to 3.1.5 but the problem is the current site used a plugin which uses the Key Reference of each article to generate the Meta Page Title and I need to take this info from each article (220+) and put it under params in the menu item so I currently have the following;
Article
TABLE joscontent COLUMN id VALUE 39
TABLE joscontent COLUMN attribs VALUE:
show_title=
link_titles=
show_intro=
show_section=
link_section=
show_category=
link_category=
show_vote=
show_author=
show_create_date=
show_modify_date=
show_pdf_icon=
show_print_icon=
show_email_icon=
language=
keyref=Page Title Value is Currently Here
readmore=
MENU ITEM
table column value
jos_menu link index.php?option=com_content&view=article&id=39
jos_menu params
show_noauth=
show_title=
link_titles=
show_intro=
show_section=
link_section=
show_category=
link_category=
show_author=
show_create_date=
show_modify_date=
show_item_navigation=
show_readmore=
show_vote=
show_icons=
show_pdf_icon=
show_print_icon=
show_email_icon=
show_hits=
feed_summary=
page_title=
show_page_title=1
pageclass_sfx=
menu_image=-1
secure=0
So is there a way i can submit an SQL query that will take the keyref value from the attribs column and insert the page_title value of the params colum where the Article ID matches the id used in the menu link and this will do every article on the site.
Hope this makes sense!
EDIT THIS SOLUTION WORKED
update jos_menu jm
set params = (select concat('show_noauth=
show_title=
link_titles=
show_intro=
show_section=
link_section=
show_category=
link_category=
show_author=
show_create_date=
show_modify_date=
show_item_navigation=
show_readmore=
show_vote=
show_icons=
show_pdf_icon=
show_print_icon=
show_email_icon=
show_hits=
feed_summary=
page_title=',
replace(substr(attribs, locate('keyref=', attribs)+7), 'readmore=', ''),
'
show_page_title=1
pageclass_sfx=
menu_image=-1
secure=0 ')
from jos_content jc
where jm.link = concat('index.php?option=com_content&view=article&id=', jc.id))
where Instr(jm.link, 'index.php?option=com_content&view=article&id=')
You might find a single SQL statement that can do this by using some tricky regular expressions. But I would really suggest that you write a script in PHP which loops through all records and does this job. this will give you more control and the ability to make some error checks.