Categories
Development Linux

Bash, command as function is not working, but manually is OK

Issue, I have bash script which run command as variable in function. Function command is here (message is function too, just for logging, not important, simply if command is true, then message OK, else message false.). command() { if $2 then message “t” “$1” else message “f” “$1″ result=”false” fi } I am using this […]

Categories
Development Linux Ubuntu

Bash, command as fucntion is not working, but manually is OK

Issue, I have bash script which run command as variable in function. Function command is here (message is function too, just for logging, not important, simply if command is true, then message OK, else message false.). command() { if $2 then message “t” “$1” else message “f” “$1″ result=”false” fi } I am using this […]

Categories
Development Linux

Transpose columns into rows with first column data repeating using awk

I’ve the input in test.txt as month,var1,var2 June,10,a Sep,20,b Dec,30,c I want the output as month,variable,value June,var1,10 June,var2,a Sep,var1,20 Sep,var2,b Dec,var1,30 Dec,var2,c Note that the number of columns starting from second column is dynamic. It can have 2 columns or 100 columns. How can we transpose the data using awk?

Categories
CMS Development Wordpress

Error Saving Table with WPDataTables Plugin [closed]

I installed wpdatatables in my WordPress Instance, and I get the following error trying to create a JSON Table: There was an error while trying to save the table! OK {“table”:{“id”:13,”title”:”New wpDataTable”,”show_title”:1,”table_type”:”json”,”connection”:””,”content”:”https://wpdatatables.com/sample_files/employees.json”,”filtering”:1,”filtering_form”:0,”sorting”:1,”tools”:1,”server_side”:0,”editable”:0,”inline_editing”:0,”popover_tools”:0,”editor_roles”:””,”mysql_table_name”:””,”edit_only_own_rows”:0,”userid_column_id”:0,”display_length”:10,”auto_refresh”:0,”fixed_columns”:”-1″,”fixed_layout”:0,”responsive”:1,”scrollable”:0,”word_wrap”:0,”hide_before_load”:1,”var1″:””,”var2″:””,”var3″:””,”tabletools_config”:{“print”:1,”copy”:1,”excel”:1,”csv”:1,”pdf”:0},”advanced_settings”:”{\”info_block\”:1,\”global_search\”:1,\”showRowsPerPage\”:1,\”showAllRows\”:0,\”clearFilters\”:0}”,”columns”:[{“calculateTotal”:0,”color”:””,”conditional_formatting”:0,”css_class”:””,”defaultSortingColumn”:0,”display_header”:”Name”,”editor_type”:”text”,”filter_type”:”text”,”filterDefaultValue”:””,”formula”:””,”groupColumn”:0,”hide_on_mobiles”:0,”hide_on_tablets”:0,”id”:169,”id_column”:0,”input_mandatory”:0,”orig_header”:”Name”,”pos”:0,”skip_thousands_separator”:0,”text_after”:””,”text_before”:””,”type”:”string”,”valuesList”:””,”visible”:1,”width”:””,”decimalPlaces”:-1,”possibleValuesAddEmpty”:0,”possibleValuesAjax”:10,”calculateAvg”:0,”calculateMax”:0,”calculateMin”:0,”sorting”:1,”exactFiltering”:0,”filterLabel”:””,”checkboxesInModal”:0,”possibleValuesType”:”read”,”editingDefaultValue”:””,”dateInputFormat”:””,”linkTargetAttribute”:””,”linkButtonAttribute”:0,”linkButtonLabel”:””,”linkButtonClass”:””,”rangeSlider”:0}, ….. I even use the example JSON URL from WPdataTables and receive the same error https://wpdatatables.com/sample_files/employees.json I don’t know what’s wrong with this, could […]

Categories
Development

Add a list fo values to each row in a PySpark dataframe

I have a PySpark dataframe which we’ll assume looks as below: df = spark.createDataFrame([(10,11,12,13), (20,21,22,23), (30,31,32,33)],[‘var1’, ‘var2’, ‘var3’, ‘var4’]) df.show() > |———————|——————|———————|——————| | var1 | var2 | var3 | var4 | |———————|——————|———————|——————| | 10 | 11 | 12 | 13 | |———————|——————|———————|——————| | 20 | 21 | 22 | 23 | |———————|——————|———————|——————| | 30 | […]

Categories
Development

First columns match; read pattern and replace with specific values in the second file column

I would like to update file1(tab-delimited) using file2(tab-delimited) conditionally. For each line of file1, perform the following substitutions for each column except the first, using the line from file2 which has the same value in the first column as the line in file1 has in the first column: a. If; the field in file1 contain […]

Categories
Development

Filter a piped df within ggplot

I am using a dplyr pipeline to clean my df then feed directly into a ggplot. However, I want to plot only one group at a time, so I need to filter to just that group. The problem is, I want the scales to remain constant as if all groups are present. Is it possible […]

Categories
Development

First columns match; read pattern and replace with specific values in the second file column

I would like to update file1(tab-delimited) using file2(tab-delimited) conditionally. columns1 of both files should match a. If; the field in file1 contain string “A”, replace it with string in file2 column2 b. else if; field in file1 contain string “B”, replace it with string in file2 column3 c. else; field in file1 with string “X”, […]

Categories
Development

How to conduct an ANOVA of several variables taken on individuals separated by multiple grouping variables?

I have a data frame similar to the one created by the code below. In this example, measurements of 5 variables are taken on are 30 individuals represented by ID. The individuals can be separated by any of three grouping variables: GroupVar1,GroupVar2,GroupVar3. For each of the grouping variables, I need to conduct an ANOVA for […]

Categories
Development

call_user_func_array not working on php 5.6

I recently tried using an old code I wrote for PHP 5.3 on a project that’s running on a server that runs PHP 5.6. Though my code runs on my local machine (windows – PHP 5.3), it shows the error below when i try to use on my online host: Warning: call_user_func_array() expects parameter 1 […]