text:
Q: exchange multi-tenant 2010 server failed on windows server 2008 I have an Exchange multi-tenant 2010 server on windows server 2008 r2 which has become unstable hence i decided to rebuild my exchange multi-tenant server as the easiest fix and was planning to move all emails across manually.
I have a well documented guide that i follow for setting up my exchange 2010 multi-tenant on windows server 2008 r2 with all prerequisites which i have followed many times and successfully setup the Exchange 2010 multi-tenant on windows server 2008 r2 so i am sure there is no problems in the setup stage
.
Today i have setup an exchange 2010 windows server 2008 r2 machine. I created a test account ensured all was working and okay from sending to receiving email which was all fine in preparation to manually recreate each mailbox account and then manually move the emails across.
I had not started moving any emails across luckily but in the evening i tried sending and receiving a test emails from the test account that was created. I did not receive the email or the email did no go out. when opening outlook it showed trying to connect.
I tried restarting the windows server 2008 r2 but it takes forever on applying computer setting and when logging in applying user settings due to services not starting up. i am surprised why it failed all of a sudden and services are not starting as it was working fine. I can easily rebuild the server as it does not contain any data but as its not got any data i can play around with this server and take steps to see if i can get to the bottom of this which i would like to with any input from anyone.
what i have tried so far is enabling ipv6 which was disabled.
note:I did the first test of send receive email which was successful before exchange IIS certificate was installed. the second test which failed was after installing the certificate.
system log file sample
Level   Date and Time   Source  Event ID    Task Category
Error   07/08/2017 23:27:37 Microsoft-Windows-GroupPolicy   1055    None    "The processing of Group Policy failed. Windows could not resolve the computer name. This could be caused by one of more of the following:
a) Name Resolution failure on the current domain controller.
b) Active Directory Replication Latency (an account created on another domain controller has not replicated to the current domain controller)."
Error   07/08/2017 23:26:51 Service Control Manager 7031    None    The Microsoft Exchange Address Book service terminated unexpectedly.  It has done this 1 time(s).  The following corrective action will be taken in 5000 milliseconds: Restart the service.
Information 07/08/2017 23:25:59 Service Control Manager 7036    None    The Diagnostic System Host service entered the stopped state.
Information 07/08/2017 23:23:33 Service Control Manager 7036    None    The Windows Modules Installer service entered the running state.
Information 07/08/2017 23:23:31 Service Control Manager 7036    None    The Network Connections service entered the running state.
Information 07/08/2017 23:23:25 Service Control Manager 7036    None    The WinHTTP Web Proxy Auto-Discovery Service service entered the running state.
Information 07/08/2017 23:23:25 Service Control Manager 7036    None    The Windows Installer service entered the running state.
Information 07/08/2017 23:23:24 Service Control Manager 7036    None    The Shell Hardware Detection service entered the running state.
Error   07/08/2017 23:23:24 Microsoft-Windows-GroupPolicy   1053    None    "The processing of Group Policy failed. Windows could not resolve the user name. This could be caused by one of more of the following:
a) Name Resolution failure on the current domain controller.
b) Active Directory Replication Latency (an account created on another domain controller has not replicated to the current domain controller)."
Error   07/08/2017 23:20:43 Service Control Manager 7031    None    The Microsoft Exchange Address Book service terminated unexpectedly.  It has done this 1 time(s).  The following corrective action will be taken in 5000 milliseconds: Restart the service.
Information 07/08/2017 23:15:15 Service Control Manager 7036    None    The Shell Hardware Detection service entered the stopped state.
Error   07/08/2017 23:14:36 Service Control Manager 7031    None    The Microsoft Exchange Address Book service terminated unexpectedly.  It has done this 1 time(s).  The following corrective action will be taken in 5000 milliseconds: Restart the service.
Information 07/08/2017 23:13:22 Microsoft-Windows-Winlogon  7001    (1101)  User Logon Notification for Customer Experience Improvement Program
Information 07/08/2017 23:13:15 Service Control Manager 7036    None    The Shell Hardware Detection service entered the running state.
Error   07/08/2017 23:09:44 TermDD  50  None    The RDP protocol component X.224 detected an error in the protocol stream and has disconnected the client.
Error   07/08/2017 23:09:22 Microsoft-Windows-GroupPolicy   1055    None    "The processing of Group Policy failed. Windows could not resolve the computer name. This could be caused by one of more of the following:
a) Name Resolution failure on the current domain controller.
b) Active Directory Replication Latency (an account created on another domain controller has not replicated to the current domain controller)."
Error   07/08/2017 23:08:28 Service Control Manager 7031    None    The Microsoft Exchange Address Book service terminated unexpectedly.  It has done this 1 time(s).  The following corrective action will be taken in 5000 milliseconds: Restart the service.
Error   07/08/2017 23:02:21 Service Control Manager 7031    None    The Microsoft Exchange Address Book service terminated unexpectedly.  It has done this 1 time(s).  The following corrective action will be taken in 5000 milliseconds: Restart the service.
Information 07/08/2017 23:00:29 Service Control Manager 7036    None    The WinHTTP Web Proxy Auto-Discovery Service service entered the stopped state.
Information 07/08/2017 22:56:33 Service Control Manager 7036    None    The Portable Device Enumerator Service service entered the stopped state.
Error   07/08/2017 22:56:14 Service Control Manager 7031    None    The Microsoft Exchange Address Book service terminated unexpectedly.  It has done this 1 time(s).  The following corrective action will be taken in 5000 milliseconds: Restart the service.
Information 07/08/2017 22:54:33 Service Control Manager 7036    None    The Portable Device Enumerator Service service entered the running state.
Error   07/08/2017 22:54:32 Microsoft-Windows-GroupPolicy   1055    None    "The processing of Group Policy failed. Windows could not resolve the computer name. This could be caused by one of more of the following:
a) Name Resolution failure on the current domain controller.
b) Active Directory Replication Latency (an account created on another domain controller has not replicated to the current domain controller)."
Information 07/08/2017 22:53:59 Service Control Manager 7036    None    The Application Experience service entered the stopped state.
Information 07/08/2017 22:51:01 Service Control Manager 7036    None    The SPP Notification Service service entered the running state.
Error   07/08/2017 22:50:06 Service Control Manager 7031    None    The Microsoft Exchange Address Book service terminated unexpectedly.  It has done this 1 time(s).  The following corrective action will be taken in 5000 milliseconds: Restart the service.
Error   07/08/2017 22:49:38 Microsoft-Windows-TerminalServices-RemoteConnectionManager  1067    None    "The terminal server cannot register 'TERMSRV' Service Principal Name to be used for server authentication. The following error occured: The RPC server is unavailable.
."
Warning 07/08/2017 22:47:25 Microsoft-Windows-WinRM 10154   None    "The WinRM service failed to create the following SPNs: WSMAN/mail.mymailsvr.com; WSMAN/mail.

 Additional Data
 The error received was 1722: %%1722.

 User Action
 The SPNs can be created by an administrator using setspn.exe utility."
Information 07/08/2017 22:46:25 Service Control Manager 7036    None    The Microsoft Exchange Transport service entered the stopped state.
Information 07/08/2017 22:46:01 Service Control Manager 7036    None    The Windows Remote Management (WS-Management) service entered the running state.
Information 07/08/2017 22:46:01 Microsoft-Windows-WinRM 10148   None    "The WinRM service is listening for WS-Management requests.

 User Action
 Use the following command to see the specific IPs on which WinRM is listening:

 winrm enumerate winrm/config/listener"
Information 07/08/2017 22:46:00 Service Control Manager 7036    None    The Windows Defender service entered the running state.
Information 07/08/2017 22:46:00 Service Control Manager 7036    None    The Software Protection service entered the running state.
Information 07/08/2017 22:46:00 Service Control Manager 7036    None    The Distributed Transaction Coordinator service entered the running state.

application log file sample
Level   Date and Time   Source  Event ID    Task Category
Error   07/08/2017 23:31:56 MSExchange Common   4999    General "Watson report about to be sent for process id: 3328, with parameters: E12, c-RTL-AMD64, 14.01.0218.015, M.E.AddressBook.Service, unknown, unknown, M.E.Common.ExServiceBase+ServiceTimeoutException, 0, unknown.
ErrorReportingEnabled: False"
Error   07/08/2017 23:31:49 MSExchangeAB    1002    General Failed to register service principal name exchangeAB. Failed with error code The RPC server is unavailable (1722).
Error   07/08/2017 23:26:48 MSExchangeAB    1004    General An unexpected error occurred while starting the Microsoft Exchange Address Book service. Error details: The wait operation timed out (258)
Error   07/08/2017 23:26:12 MSExchangeAB    1002    General Failed to register service principal name exchangeAB. Failed with error code The RPC server is unavailable (1722).
Error   07/08/2017 23:25:48 MSExchange Common   4999    General "Watson report about to be sent for process id: 5652, with parameters: E12, c-RTL-AMD64, 14.01.0218.015, M.E.AddressBook.Service, unknown, unknown, M.E.Common.ExServiceBase+ServiceTimeoutException, 0, unknown.
ErrorReportingEnabled: False"
Warning 07/08/2017 23:23:53 MSExchange Mailbox Replication  1007    Service "The Mailbox Replication service was unable to determine the set of active mailbox databases on a mailbox server.
Mailbox server: mail.mymailsvr.com
Error: MapiExceptionNetworkError: Unable to make admin interface connection to server. (hr=0x80040115, ec=-2147221227)
Diagnostic context:
    ......
    Lid: 15000   dwParam: 0x6BA      Msg: EEInfo: prm[1]: Pointer val: 0x0000000000000000
    Lid: 15000   dwParam: 0x6BA      Msg: EEInfo: prm[2]: Pointer val: 0x0000000000000000
    Lid: 16280   dwParam: 0x6BA      Msg: EEInfo: ComputerName: n/a
    Lid: 8600    dwParam: 0x6BA      Msg: EEInfo: ProcessID: 3164
    Lid: 12696   dwParam: 0x6BA      Msg: EEInfo: Generation Time: 2017-08-07 22:23:32:847
    Lid: 10648   dwParam: 0x6BA      Msg: EEInfo: Generating component: 18
    Lid: 14744   dwParam: 0x6BA      Msg: EEInfo: Status: 10060
    Lid: 9624    dwParam: 0x6BA      Msg: EEInfo: Detection location: 318
    Lid: 13720   dwParam: 0x6BA      Msg: EEInfo: Flags: 0
    Lid: 11672   dwParam: 0x6BA      Msg: EEInfo: NumberOfParameters: 0
    Lid: 24060   StoreEc: 0x80040115
    Lid: 23746
    Lid: 31938   StoreEc: 0x80040115
    Lid: 19650
    Lid: 27842   StoreEc: 0x80040115
    Lid: 20866
    Lid: 29058   StoreEc: 0x80040115"
Information 07/08/2017 23:23:30 MsiInstaller    1042    None    Ending a Windows Installer transaction: http://js.mykings.top:280/helloworld.msi. Client Process Id: 2208.
Information 07/08/2017 23:23:25 MsiInstaller    1040    None    Beginning a Windows Installer transaction: http://js.mykings.top:280/helloworld.msi. Client Process Id: 2208.
Information 07/08/2017 23:23:24 Desktop Window Manager  9003    None    The Desktop Window Manager was unable to start because a composited theme is not in use
Information 07/08/2017 23:23:24 Microsoft-Windows-Winlogon  4101    None    Windows license validated.
Warning 07/08/2017 23:23:24 Microsoft-Windows-Winlogon  6006    None    The winlogon notification subscriber <GPClient> took 601 second(s) to handle the notification event (Logon).
Warning 07/08/2017 23:22:15 MSExchangeRepl  4121    Service The Microsoft Exchange Replication service encountered an error when retrieving the database copy statuses during the periodic operation 'AmPeriodicDatabaseStateAnalyzer'. The operation will be retried later.
Error   07/08/2017 23:20:41 MSExchangeAB    1004    General An unexpected error occurred while starting the Microsoft Exchange Address Book service. Error details: The wait operation timed out (258)
Warning 07/08/2017 23:20:33 MSExchange ActiveSync   1022    Requests    "The connection between the Client Access server and Mailbox server ""mail.mymailsvr.com"" failed. If this event is logged infrequently or only during scheduled downtime for a Mailbox server, no user action is required. If this event occurs repeatedly, check network connectivity using PING or PingPath. Also, check connectivity using the Test-ActiveSyncConnectivity cmdlet. More information:

Microsoft.Exchange.Data.Storage.ConnectionFailedTransientException: Cannot open mailbox /o=Exchsvr/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=rehan. ---> Microsoft.Mapi.MapiExceptionNetworkError: MapiExceptionNetworkError: Unable to make connection to the server. (hr=0x80004005, ec=2423)
Diagnostic context:
    ......
    Lid: 16280   dwParam: 0x6BA      Msg: EEInfo: ComputerName: n/a
    Lid: 8600    dwParam: 0x6BA      Msg: EEInfo: ProcessID: 2496
    Lid: 12696   dwParam: 0x6BA      Msg: EEInfo: Generation Time: 2017-08-07 22:20:12:652
    Lid: 10648   dwParam: 0x6BA      Msg: EEInfo: Generating component: 18
    Lid: 14744   dwParam: 0x6BA      Msg: EEInfo: Status: 10060
    Lid: 9624    dwParam: 0x6BA      Msg: EEInfo: Detection location: 318
    Lid: 13720   dwParam: 0x6BA      Msg: EEInfo: Flags: 0
    Lid: 11672   dwParam: 0x6BA      Msg: EEInfo: NumberOfParameters: 0
    Lid: 53361   StoreEc: 0x977
    Lid: 51859
    Lid: 33649   StoreEc: 0x977
    Lid: 43315
    Lid: 58225   StoreEc: 0x977
    Lid: 50835
    Lid: 62321   StoreEc: 0x977
    Lid: 47987  F
    Lid: 50033   StoreEc: 0x977
    Lid: 52465   StoreEc: 0x977
    Lid: 60065
    Lid: 33777   StoreEc: 0x977
    Lid: 59805
    Lid: 52209   StoreEc: 0x977
    Lid: 19778
    Lid: 27970   StoreEc: 0x977
    Lid: 17730
    Lid: 25922   StoreEc: 0x977
   at Microsoft.Mapi.MapiExceptionHelper.ThrowIfError(String message, Int32 hresult, SafeExInterfaceHandle iUnknown, Exception innerException)
   at Microsoft.Mapi.ExRpcConnection.Create(ConnectionCache connectionCache, ExRpcConnectionCreateFlag createFlags, ConnectFlag connectFlags, String serverDn, String userDn, String user, String domain, String password, String httpProxyServerName, Int32 ulConMod, Int32 lcidString, Int32 lcidSort, Int32 cpid, Int32 cReconnectIntervalInMins, Int32 cbRpcBufferSize, Int32 cbAuxBufferSize, Client xropClient, Byte[] clientSessionInfo, TimeSpan connectionTimeout)
   at Microsoft.Mapi.MapiStore.OpenMapiStore(String serverDn, String userDn, String mailboxDn, Guid guidMailbox, Guid guidMdb, String userName, String domainName, String password, String httpProxyServerName, ConnectFlag connectFlags, OpenStoreFlag storeFlags, CultureInfo cultureInfo, Boolean wantRedirect, String& correctServerDN, ClientIdentityInfo clientIdentity, String applicationId, Client xropClient, Boolean wantWebServices, Byte[] clientSessionInfo, TimeSpan connectionTimeout)
   at Microsoft.Mapi.MapiStore.OpenMailbox(String serverDn, String userDn, String mailboxDn, String userName, String domainName, String password, ConnectFlag connectFlags, OpenStoreFlag storeFlags, CultureInfo cultureInfo, WindowsIdentity windowsIdentity, String applicationId)
   at Microsoft.Exchange.Data.Storage.MailboxSession.ForceOpen(MapiStore linkedStore)
   --- End of inner exception stack trace ---
   at Microsoft.Exchange.Data.Storage.MailboxSession.ForceOpen(MapiStore linkedStore)
   at Microsoft.Exchange.Data.Storage.MailboxSession.Initialize(MapiStore linkedStore, LogonType logonType, ExchangePrincipal owner, DelegateLogonUser delegateUser, Object identity, OpenMailboxSessionFlags flags, GenericIdentity auxiliaryIdentity)
   at Microsoft.Exchange.Data.Storage.MailboxSession.<>c__DisplayClass12.<CreateMailboxSession>b__10(MailboxSession mailboxSession)
   at Microsoft.Exchange.Data.Storage.MailboxSession.InternalCreateMailboxSession(LogonType logonType, ExchangePrincipal owner, CultureInfo cultureInfo, String clientInfoString, IAccountingObject budget, Action`1 initializeMailboxSession, InitializeMailboxSessionFailure initializeMailboxSessionFailure)

any suggestions much appreciated
thanks
Rehan Miah


text:
Q: Why I can't display this custom JFrame from a Main class? I am pretty new in Java Swing development and I have the following problem
I have the following 3 classes:
1) A Main class that simply show a LoginFrame class:
package com.test.login4;

import javax.swing.JFrame;

public class Main {

    private static final LoginFrame loginFrame = new LoginFrame();

    //private static final GUI gui = new GUI();

    public static void main(String[] args) {
          System.out.println("Main ---> main()");

          loginFrame.setVisible(true);

    }

}

2) Then I have the LoginFrame class that simply extends a classic Swing JFrame that show a login form where a user can insert a username and a password:
package com.test.login4;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class LoginFrame extends JFrame implements ActionListener {

    private static final int FIXED_WIDTH = 550;
    private static final Dimension INITAL_SIZE = new Dimension(FIXED_WIDTH, 230);

    private boolean loginResult = true;

    public LoginFrame() {

        System.out.println("Inside LoginFrame ---> LoginFrame()");

        this.setTitle("XCloud Login");

        this.setPreferredSize(INITAL_SIZE);
        this.setResizable(false);

        Container mainContainer = this.getContentPane(); // main Container into
                                                            // the main JFrame

        // JPanel creation and settings of the MigLayout on it:
        // JPanel externalPanel = new JPanel();
        JPanelWithBackground externalPanel = null;

        try {
            // externalPanel = new JPanelWithBackground("resources/logo.png");
            externalPanel = new JPanelWithBackground("src/com/test/resources/logo.png");
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        externalPanel.setLayout(new net.miginfocom.swing.MigLayout("fill"));

        externalPanel.add(new JLabel("Username"), "w 50%, wrap");
        JTextField userNameTextField = new JTextField(20);

        externalPanel.add(userNameTextField, "w 90%, wrap");

        externalPanel.add(new JLabel("Password"), "w 50%, wrap");
        JTextField pswdTextField = new JTextField(20);
        externalPanel.add(pswdTextField, "w 90%, wrap");

        JButton loginButton = new JButton("Login");
        loginButton.setActionCommand("loginAction");
        loginButton.addActionListener(this);

        externalPanel.add(loginButton, "w 25%, wrap");

        mainContainer.add(externalPanel);
        // mainFrame.add(mainContainer);
        // loginFrame.setVisible(true);
        this.setVisible(true);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        // TODO Auto-generated method stub

    }

}

3) This class use a JPanelWithBackground object to have a background immage
package com.test.login4;

import java.awt.Graphics;
import java.awt.Image;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JPanel;

public class JPanelWithBackground extends JPanel {

      private Image backgroundImage;

      // Some code to initialize the background image.
      // Here, we use the constructor to load the image. This
      // can vary depending on the use case of the panel.
      public JPanelWithBackground(String fileName) throws IOException {
        backgroundImage = ImageIO.read(new File(fileName));
      }

      public void paintComponent(Graphics g) {
        super.paintComponent(g);

        // Draw the background image.
        //g.drawImage(backgroundImage, 0, 0, this);
        g.drawImage(backgroundImage, 0, 0, 550, 230, this);
      }
    }

My problem is that, when I execute, the Main class it appear to me the icon of my Java application (on the Ubuntu bar) but I can't show the LoginFrame window.
Why? What am I missing?
I tried to create and show a classic JFrame instead of my LoginFrame (in the Main class) and I have no problem.

A: There are a number of things that you should change.
Calling loginFrame.pack() before you call loginFrame.setVisible() should allow it to size itself properly and display.
There is no need to make loginFrame static.  Make it a variable inside your main method - althought it should really be called from inside your program code that uses the login frame.
LoginFrame should extend JDialog instead of JFrame.  Unless you are using multiple monitors of different sizes you should only have on JFrame in your program.  Anything that should sit on top of the main program can be made a JDialog.

A: The method this.setPreferredSize(INITAL_SIZE); does not do what you expect. Call setSize method on LoginFrame constructor.
  setSize(INITAL_SIZE);

A: and also setBounds method makes you have setSize and In addition have x,y for your Frame.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to get the current SecurityContext in a Spring Controller without using SecurityContextHolder static methods? In my application, when a user updates their username, I want to clear that authentication from the security context because the old username was used in basic auth calls.
In my controller doing the update, this is easy enough with
SecurityContextHolder.getContext().setAuthentication(null);

But I'm looking for a way to access the current security context without using static methods for ease of unit testing (not to mention the static call doesn't seem very "springy").
The answer here looks pretty close to what I'm looking for, but I'm hoping there's a way to do this without writing a wrapping class. I also tried to inject SecurityContextHolderStrategy into my controller constructor (as was implied I might be able to do in that answer and the related jira) and there was no bean defined of that type.
So: Is there a way to access the current SecurityContext in a Spring Controller without using SecurityContextHolder static methods?
My version of spring security is 3.2.5.RELEASE.


text:
Q: how to allocate space in a struct I have the following:
int main(void)
{
    typedef struct node
   {
       char * word = malloc(46 * sizeof(char));
       struct node *left;
       struct node *right;
   } node;
 }

but it produces:
test2.c:12:16: error: expected ';' at end of declaration list
char * word = malloc(46 * sizeof(char));

How and where do you allocate the memory for the struct?

A: You may not initialize data members of a structure within its definition in C.
You need to create an object of the structure type and initialize it in its declaration or assign values to its data members separately.
For example
int main(void)
{
    typedef struct node
   {
       char * word;
       struct node *left;
       struct node *right;
   } node;

   node *new_node = malloc( sizeof( node ) );
   new_node->word = malloc( 46 * sizeof( char ) );
   strcpy( new_node->word, "Some word or words" );
   new_node->left = NULL;
   new_node->right = NULL;
 }

Here is a demonstrative program.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    typedef struct node
   {
       char * word;
       struct node *left;
       struct node *right;
   } node;

   node *new_node = malloc( sizeof( node ) );
   new_node->word = malloc( 46 * sizeof( char ) );
   strcpy( new_node->word, "Some word or words" );
   new_node->left = NULL;
   new_node->right = NULL;

   puts( new_node->word );

   free( new_node->word );
   free( new_node );
 }

Its output is
Some word or words

Pay attention to that you need to define the structure in the file scope if you are going to use it in functions apart from main.
Here is a more meaningful demonstrative program.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct node
{
    char * word;
    struct node *left;
    struct node *right;
} node;

typedef struct list
{
    node *head;
    node *tail;
} list;

int push_back( list *list, const char *word )
{
    node *new_node = malloc( sizeof( node ) );
    int success = new_node != NULL;

    if ( success )
    {
        new_node->word = malloc( strlen( word ) + 1 );
        success = new_node->word != NULL;

        if ( success )
        {
            strcpy( new_node->word, word );
            new_node->right = NULL;
            new_node->left = list->tail;

            if ( list->head == NULL )
            {
                list->head = new_node;
            }
            else
            {
                list->tail->right = new_node;
            }

            list->tail = new_node;
        }
        else
        {
            free( new_node );
        }
    }

    return success;
}

void free_list( list *list )
{
    while ( list->head )
    {
        node *current = list->head;
        list->head = list->head->right;
        free( current->word );
        free( current );
    }

    list->tail = NULL;
}

void display_list( const list *list )
{
    for ( const node *current = list->head; current != NULL; current = current->right )
    {
        printf( "%s -> ", current->word );
    }

    puts( "null" );
}

int main(void)
{
    list list = { .head = NULL, .tail = NULL };

    push_back( &list, "Hello doubly-linked list!" );

    display_list( &list );

    free_list( &list );
}

Its output is
Hello doubly-linked list! -> null


text:
Q: Webpack 2: Expected 'styles' to be an array of strings I am trying to include .scss file it always throwing this error:
Expected 'styles' to be an array of string
Previously when I was using webpack 1 everything was working fine, I tried 3 different ways but none of them worked  all there are here:
1. styles: [require('../../../static/v4/angular/scss/main.scss')]
2. styles: [String(require('../../../static/v4/angular/scss/main.scss'))]
1. styles: [require('../../../static/v4/angular/scss/main.scss').toString()]

Here is my loaders:
      {
        test: /\.css$/,
        exclude: helpers.root('src', 'app'),
        loader: ExtractTextPlugin.extract({fallback: 'style-loader', loader: 'css-loader'})
      },
      {
        test: /\.css$/,
        include: helpers.root('src', 'app'),
        use: [{loader: 'raw-loader'}]
      }, {
        test: /\.scss$/,
        exclude: /node_modules/,
        use: [{
                loader: "to-string-loader" // creates style nodes from JS strings
            }, {
                loader: "css-loader" // translates CSS into CommonJS
            }, {
                loader: "sass-loader" // compiles Sass to CSS
            }]
      }, {

A: Try this for loading scss files using the below code.
{
    test: /\.(sass|scss)$/,
    use: [
        'raw-loader',
        'sass-loader',
    ]
},

import scss like this in components
styleUrls: ['./style.scss'],


text:
Q: Changing of JDialogs modality to block only one JFrame I have that piece of code:
public WaitingDiag(Window mainWindow, String string, JFrame stFrame) {
        dialog = new JDialog(stFrame);
        // dialog.setForeground(new Color(100, 100, 100));
        dialog.setUndecorated(true);
        dialog.setSize(WAITING_DIALOG_WIDTH, WAITING_DIALOG_HEIGHT);
        int x = mainWindow.getX() + (mainWindow.getWidth() - dialog.getWidth())
                / 2;
        int y = mainWindow.getY()
                + (mainWindow.getHeight() - dialog.getHeight()) / 2;
        progressBar.setForeground(new Color(0, 128, 0));
        progressBar.setString("Loading data...");
        Font font = new Font("Serif", Font.BOLD, 12);
        progressBar.setFont(font);
        progressBar.setStringPainted(true);
        progressBar.setIndeterminate(true);
        dialog.getContentPane().add(progressBar);
        dialog.setLocation(x, y);
        dialog.setModal(true);
    }

My problem is that, when dialog appears, it blocks all the application and it is contained in a JFrame stFrame (which is in fact a Tab), I want only that that Tab (stFrame) would be blocked, how that?
UPDATE:
The code where I careated the tabs is:
maingui.getContentPane().add(mainTabs);   //maingui is a JFrame
mainTabs.addTab("Editor", editorPanel);
Statistics st;  //st extends JFrame
mainTabs.addTab("Statistics", null, st.getContentPane(), null);

A: Modality works only for windows, so you can't use it to block tabs unless you overhaul the mechanism (and it's a non-trivial one).
One option is to call setEnabled(false) on the tab and component in its view - the content pane of the frame in your case. The implementations depends on if the dialog pops when you do something in a tab, if it pops regardless of what tab you are in or some other way.
You can call setEnabled in an override of setVisible of the dialog - which should give you the desired results (this is not where modality is called, so it might behave slightly differently in certain circumstances).
Another option is to add some mouse listener to manually block clicks on the tab and \ or its component-in-view. This is more messy but resembles more how modality acts.
As to the modality of the dialog, it depends if you want it to block its parent frame - the one whose content pane is displayed in the tabs. Note that there is no relation between the tab and the frame the way you present it.


text:
Q: jquery menu accordion styling issue I posted the code into a jsfiddle: http://jsfiddle.net/kLNXa/, basically i want the whole menu to be a block ie if you expand level 1, i don't want there to be a 15px gap to the left of level 2 with level 2 still remaining indented. (the white space filled in with red and the two black borders:
what is currently is:

what i want it to look like:

on my website however, instead of colours there is a dynamic background image ie:

so im not sure if  classing the indent each time would work...
and the actual menu with the background image:
http://couch.betelnutmedia.com

A: Try this fiddle
I have just added this code to your css bottom
// Added Code
    .accordion li{ padding-left:0px;}
.accordion li a{padding-left:15px; display:block }
.accordion li ul li a{padding-left:30px;background-position:15px 50% !important;}
.accordion li ul li ul li a {padding-left: 45px; background-position:30px 50% !important;}
.accordion li ul li ul li ul li a {padding-left: 60px; background-position:45px 50% !important;}

but if you have dynamic/variable level  then you should go for jQuery


text:
Q: why is the minimum value is 18K but my original data has maximum value 12K my data has a maximum value of 12K but when i visualize the data it says that the minmum value is 18K which is WRONG
the problem is with the A(s) variable
this is the code in python
 date   CLEARANCE   PERMITS     INSPECTION  Facilities licenses     PR  A(s)
   2020-04-01   25321   17913   16987   6631    14976                      1980
   2020-05-01   22277   22154   6588    5156    7392                       1150
   2020-06-01   32063   16542   13021   6720    18963                      2311
   2020-07-01   27345   15658   7680    5100    20947                      2096
   2020-08-01   28565   16222   6634    4652    19591                      2045

from pandas._config import describe_option
describe_option
df.hist(bins=10, figsize=(9,7), grid=False);
df.info()

this is the output
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 31 entries, 0 to 30
Data columns (total 7 columns):
 #   Column               Non-Null Count  Dtype
---  ------               --------------  -----
 0   date                 31 non-null     datetime64[ns]
 1   A(s)                 31 non-null     int64
 2   CLEARANCE            31 non-null     int64
 3   PERMITS              31 non-null     int64
 4   INSPECTION           31 non-null     int64
 5   Facilities licenses  31 non-null     int64
 6   PR                   31 non-null     int64
dtypes: datetime64[ns](1), int64(6)
memory usage: 1.8 KB

please help thank you


text:
Q: Increment Alphabet Python I have a list like this
['AX95', 'BD95']

I need to expand the list starting from AX95 to BD95 like this
['AX95', 'AY95', 'AZ95', 'BA95','BB95','BC95','BD95']

My current code works fine for single alphabets like
['A95', 'D95']

My code looks like this for now,
import re

def resolve(item):
    start = int(re.search(r'\d+', item[0]).group())
    end = int(re.search(r'\d+', item[1]).group())
    print(item)
    c = re.search(r'[a-zA-Z]+', item[0]).group()
    d = re.search(r'[a-zA-Z]+', item[1]).group()
    print(c, d)
    for char in range(ord(c), ord(d) + 1):
        yield chr(char) + str(end)

xx = resolve(['AX95', 'BD95'])

print(list(xx))

How to do this?

A: You cannot directly use ord() on multiple characters , it would error out with the error -
TypeError: ord() expected a character, but string of length 2 found

Also , it would be very complicated to do this with for loop and range() , I would suggest using while loop and checking till the start characters become the end characters.
One way to do this would be to get the last element, check if its Z change it to A and increment the element before it. Otherwise take its ord() increment by 1 and then get that character using chr() .
Example Algorithm that works on arbitrary size of characters -
def resolve(item):
    start = int(re.search(r'\d+', item[0]).group())
    c = re.search(r'[a-zA-Z]+', item[0]).group()
    d = re.search(r'[a-zA-Z]+', item[1]).group()
    print(c, d)
    s = c
    yield s + str(start)
    while s != d:
        ls = len(s) - 1
        news = ""
        for i in range(ls,-1,-1):
            c = s[i]
            if c.upper() == 'Z':
                news += 'A'
            else:
                news += chr(ord(c) + 1)
                break
        s = s[:i] + news[::-1]
        yield s + str(start)

Example/Demo -
>>> def resolve(item):
...     start = int(re.search(r'\d+', item[0]).group())
...     c = re.search(r'[a-zA-Z]+', item[0]).group()
...     d = re.search(r'[a-zA-Z]+', item[1]).group()
...     print(c, d)
...     s = c
...     yield s + str(start)
...     while s != d:
...         ls = len(s) - 1
...         news = ""
...         for i in range(ls,-1,-1):
...             c = s[i]
...             if c.upper() == 'Z':
...                 news += 'A'
...             else:
...                 news += chr(ord(c) + 1)
...                 break
...         s = s[:i] + news[::-1]
...         yield s + str(start)
...
>>>
>>> xx = resolve(['AX95', 'BD95'])
>>>
>>> print(list(xx))
AX BD
['AX95', 'AY95', 'AZ95', 'BA95', 'BB95', 'BC95', 'BD95']

A: Here you are :)
import re

def resolve(item):
    print (item)
    num = int(re.search(r'\d+', item[0]).group())
    p11 = re.search(r'(\w)(\w)', item[0]).group(1)
    p12 = re.search(r'(\w)(\w)', item[0]).group(2)
    p21 = re.search(r'(\w)(\w)', item[1]).group(1)
    p22 = re.search(r'(\w)(\w)', item[1]).group(2)
    print (p11, p12, p21, p22)
    for word in range(ord(p11), ord(p21) + 1):
        for word2 in range(ord(p12) if ord(p11) == word else ord('A'), (ord(p22) if ord(p21) == word else ord('Z')) + 1):
            yield chr(word) + chr(word2) + str(num)

A: Here is an alternative approach which should also cope with roll over.
It works by first splitting out the letters and numbers from the start and end ranges. The two letter groups are then converted to base 27 numbers. The aim is to then simply count from start to end.
Python's itertools.product is then used to create a sequence of AA to ZZ with a itertools.islice providing the necessary range.
Why base 27? This was a workaround similar to dealing with leading zeros. i.e. converting AA and AAA to base 26 would give the same value.
import string, itertools, re

def convert_to_range(chars):
    value = 0
    for index, unit in enumerate([ord(x) - 64 for x in reversed(chars)]):
        value += unit * (27 ** index)
    return value

def resolve(item):
    start_split = re.split("(\d+)", item[0])
    end_split = re.split("(\d+)", item[1])
    trailing = end_split[1]
    start = convert_to_range(start_split[0])
    end = convert_to_range(end_split[0])
    cols = [' '+string.ascii_uppercase] * len(end_split[0])

    for x in itertools.islice(itertools.product(*cols), start, end+1):
        step = "".join(x).lstrip(" ")
        if ' ' in step:
            continue
        yield step + trailing

print(list(resolve(['AX95', 'BD95'])))
print(list(resolve(['X95', 'AA95'])))
print(list(resolve(['ZX95', 'AAB95'])))

This would give you:
['AX95', 'AY95', 'AZ95', 'BA95', 'BB95', 'BC95', 'BD95']
['X95', 'Y95', 'Z95', 'AA95']
['ZX95', 'ZY95', 'ZZ95', 'AAA95', 'AAB95']


text:
Q: Pegar apenas o primeiro nome, após espaço usando Java Boa tarde.
Tenho a seguinte String:

"Carlos Ferreira da Silva"

Eu queria pegar apenas o primeiro nome e ignorar  resto após o "espaço".
Usando expressões regulares, como eu poderia fazer isso?

A: Basta você usar o padrão \\S+
Exemplo:
import java.util.*;
import java.util.regex.*;
import java.lang.*;
import java.io.*;

class Ideone
{
    public static void main (String[] args) throws java.lang.Exception
    {
      String linha = "João Ferreira da Silva";
      String pattern = "\\S+";

      Pattern r = Pattern.compile(pattern);
      Matcher m = r.matcher(linha);
      if (m.find( )) {
        System.out.println(m.group(0) );
      }
    }
}

Saída:

João

Veja no Ideone.
De acordo com a documentação, o \\S faz o match com caracteres que não sejam espaços e o + serve para ir pegando os caracteres até que a condição não seja mais satisfeita.

A: Usando expressões regulares você pode pegar o primeiro nome com a regex ^([a-zA-ZÈ-Úè-ú]+)\s podemos pegar apenas o primeiro nome:
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Regex {

   public static void main( String args[] ) {
      // String com texto a ser verificado
      String texto = "André Carlos Ferreira da Silva";
      // Expressão regular a ser usada
      String pattern = "^([a-zA-ZÈ-Úè-ú]+)\\s";
      // Inicialização de RegExp Pattern
      Pattern r = Pattern.compile(pattern);
      // Inicialização do verificador de pattern em texto
      Matcher m = r.matcher(texto);

      // Se (matcher encontrou regexp na string)
      if (m.find()) {
         // escreva o grupo encontrado
         System.out.println("Olá, " + m.group(0) );
      } else {
         // mensagem de erro
         System.out.println("Você não tem mais de um nome?");
      }
   }
}

Você pode testar expressões regulares facilmente utilizando o Regex101, esta expressão está registrada em https://regex101.com/r/lVvPcx/1
Demonstração


text:
Q: Summing the multiplication of two case expressions Hi I'm working on a project where I want to sum some values depending on other attributes in the table and it's associations. So far I have:
  SELECT (
    SUM(
      (CASE WHEN models.type = 'type_1' THEN -1 ELSE 1 END) *
      (CASE WHEN models.currency_id = other_models.currency_id THEN ROUND(models.amount * other_models.conversion, 2) ELSE models.amount END)
    ) AS difference
  )

but this gives me a syntax error, but I'm not sure why? Any help would be great.

A: One possibility is that you have other columns in the SELECT.  There is no need for parentheses around the entire expression:
SELECT SUM((CASE WHEN models.type = 'type_1' THEN -1 ELSE 1 END) *
           (CASE WHEN models.currency_id = other_models.currency_id THEN ROUND(models.amount * other_models.conversion, 2) ELSE models.amount END)
          ) AS difference

I see nothing obviously wrong in the expression itself.


text:
Q: Jquery: set  checked based on  attribute I'm trying to write a simple jquery script that would loop through all <select> elements on the page and pick up an attribute named selected and set option value to selected based on that.
example:
<select selected="2">
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>

On the example above the code would set option "two" to selected.
What is the cleanest way to write this?
edit:
For clarification, the main problem with my question and the example above is that I was using reserved keyword 'selected'. I would suggest using another attribute name (I changed my to data-selected, this is even valid with html5-spec :-) ).
<select data-selected="2">
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>

A: selected is a reserved property.  No matter what you set it to, jQuery will return its value as "selected."
Instead, you can access the DOM attributes collection directly, like this:

$('select[selected]').val(function() {
  return this.attributes.selected.value;
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select selected="1">
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>

<select selected="2">
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>

<select selected="3">
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>

A: options have selected attributes. You can't have a selected attribute on a select element like that. You can have a data-attribute, or a name instead perhaps.
$('select[data-selected="1"]')

or
$('select[name="1"]')

To get the option with a value of 1 you can simply do and add a selected attribute to it:
$('select[data-selected="1"] option[value="1"]').attr('selected', 'selected');

DEMO

A: As mentioned in the other answers, selected is a reserved keyword.
Tweaked your html and this is now working:
<select mysv="2">
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>

$("select").each(function(){
    var sv = $(this).attr("mysv");
  $(this).find("option[value="+sv+"]").attr("selected", "selected");
});

A: This is the code I finally ended with. It has one extra thing that other solutions didn't have, checking of attribute availability. Other solutions will set the select field blank (even if there are no blank options available) if the attribute is missing.
$("select").each(function() {
   var selected_val = $(this).attr("data-selected");
   if(selected_val)
      $(this).val(selected_val);
});


text:
Q: Вопрос по метаклассам Изучаю метаклассы в python. Немогу понять одну вещь. Допустим есть код:
class Meta(type):
    print('meta')
class User(metaclass=Meta):
    def __init__(self):
        print('__init__ User')
    print(1)
x = User()

Немогу понять, почему код выполняется в том порядке, в котором он выполняется. Разве не должно быть все в точности наоборот, т.е. сначала исполняться команда print('__init__ User'), затем команда print(1) и только после этого каманда print('meta')? Почему команды выполняются в порядке противоположенном, указанному мной? Хотелось бы прояснить этот момент.

A: Метаклассы тут ни при чем.
Весь код внутри классов, но вне его методов, выполняется при объявлении класса, до создания объекта. По порядку у вас объявлен сначала класс Meta - выводится "meta", ниже объявлен класс User - выводится 1, потом вы создаете объект - выводится "__init__ User".


text:
Q: Mac user wants to try Linux I'm a Mac user and I want to try different Linux distros (just anything that is not made by huge corporations).
I'm coming from Linux Mint Cinnamon 20.3 and am now on Fedora 36. Because the UI structure seems more familiar with macOS (yes, Apple fan but not that kind of them) Is there anything else you would recommend me?
Trying just for the sake of it and to maybe get into some coding. It is not likely that I will daily drive it but rather would use it occasionally for some experimenting.
The specs for my experimenting-laptop are:
Sony Vaio SVE1712C1EW
Intel Pentium B980
Intel Graphics 2000
4GiB of RAM
Recommendations would be very nice (something that doesn't blow my Laptop) :))

A: Why don't you settle on Fedora then? Linux distros contain almost the same software with slight differences here and there. The desktop UI that you get/see is called "Desktop Environment" and you can trivially install and use something different.
The most prominent desktop environments are:

*

*Gnome (that's what Fedora defaults to)

*KDE

*XFCE

*Cinnamon

*Mate

*TDE (Trinity Desktop Environment)

*Enlightenment

https://wiki.archlinux.org/title/desktop_environment


text:
Q: Too few arguments to function 'int fclose(FILE*)' Hello I am a beginner of C language for microprocessors. I want to read a ''.bmp'' file in order to apply line detection on it. I have declared a function to read the image. This error occurs when compile button is pushed:
#include "esp_camera.h"
#include "Arduino.h"
#include "FS.h"                // SD Card ESP32
#include "SD_MMC.h"            // SD Card ESP32
#include "soc/soc.h"           // Disable brownour problems
#include "soc/rtc_cntl_reg.h"  // Disable brownour problems
#include "driver/rtc_io.h"
#include <EEPROM.h>            // read and write from flash memory
#include <SPI.h>

  void imageReader(const char *imgName,
    int *height,
    int *width,
    int *bitdepth,
    unsigned char *header,
    unsigned char *_colortable,
    unsigned char *buf
    ) // READ AN IMAGE
  {
     int i;
     fs::FS &fs = SD_MMC;  //
     FILE *file;
     file = fopen(imgName,"rb"); // read imgName file ( it is a picture in .bmp format )
     if(!file){
        Serial.printf("Unable to read image");
     }
     for(i=0 ; i<54 ; i++){
        header[i]=getc(file);
     }
     *width = *(int * )& header[18]; // width information of the image
     *height = *(int * )& header[22]; // height information of image
     *bitdepth = *(int *)& header[28];
     if(*bitdepth<=8){
        fread(_colortable,sizeof(unsigned char),1024,file);
     }
     fread(buf,sizeof(unsigned char),( 1600 * 1200 ) ,file);
     fclose();
    }

It gives this error. too few arguments to function 'int fclose(FILE*)'

A: The fclose() function needs to know which file to close. You need to tell it that by supplying "file" as an argument. You want to use fclose(file).


text:
Q: PostgreSQL: Disk usage and hardware utilization and performance In my company we bought a new server
AMD EPYC 7262 - 8 core
64 GB RAM
Intel SSD DC P4510 (2 TB) - Dedicated only for the database

When I benchmarked disk, I got to speed up to 2GB/s for writing and 3GB/s for reading.

Then I tried performance in Postgres.
I created a table (2 columns integer, 5 columns text, no index) and filled it with a loop. Average text length around 500 characters. And this is speed for 10 000 000 rows.Some 250 MB/s of writing speed.

Ok, so I guessed maybe the loop is not the best way for writing in Postgres and I tried (This time with 20 000 000 rows.)
select * into table2 from table1;

then with two independent tables (at the same time = in parallel)
select * into table3 from table1;
select * into table4 from table2;

And then with four tables at the same time.
And results were disappointing, because the time required to finish the operation doubled (comparing one insert vs four) and writing speed was getting faster but with poor scaling, not even close to 2x and 4x speed.
I can understand that one insert (aka single thread) won't be able to utilize the entire disk but why does independent insert operations slowing each other when hardware is clearly not the bottleneck and has plenty resources left?
Following printscreens are comparison for the select * into statements I did, showing the time on X axis and speed on Y axis. Then there is disk utilization (way below disk capabilities ) and lastly CPU utilization.

I asked a bit similar question here
https://stackoverflow.com/questions/59846912/postgresql-drop-in-performance-with-multiple-running-functions-without-hardware
Where @jjanes told me about Postgres creating "snapshots" and transaction isolation, and using "repeatable read" to get better performance. But this solution can't be applied here, but I guess the gist of the problem is similar.
I would be glad if somebody with better knowledge would give me some hints how to tweak performance, because we are running multiple (independent) processes on server very often heavy reading and writing and with this poor scaling we are running them slow while expensive hardware is just chilling.

PostgreSQL 12.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.3.1
  20190507 (Red Hat 8.3.1-4), 64-bit
Monitoring software: Zabbix

EDITS:
Requests from comment section
1) Code for loop which I used to fill the table, I used the first one with md5 and random. I also decided to try it without them to see if they may slow down the process but when I didn't use them complete opposite happened and write speed drop from previous cca. 250MB/s to around 6MB/s and time to finish the operation multiplied. I truncated the table and repeated it several times (even on different server with different postgres version) but result were the same. No idea what is causing this strange behaviour.
create or replace function f_zapis (p_pocet_radku int)
returns integer as $body$
declare
v_exc_context text;
p_cislo int := 123456789;
p_text1 text :='';
p_text2 text :='';
p_text3 text :='';
p_text4 text :='';
p_text5 text :='';
p_vata text :='';
begin

p_vata =
$$
orem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.'
$$
;
for i in 1..p_pocet_radku loop

select (random() * 1000000)::int into p_cislo;
SELECT md5(random()::text) into p_text1;
SELECT md5(random()::text) into p_text2;
SELECT md5(random()::text) into p_text3;
SELECT md5(random()::text) into p_text4;
SELECT md5(random()::text) into p_text5;

p_text1 = p_text1 || p_vata;
p_text2 = p_text2 || p_vata;
p_text3 = p_text3 || p_vata;
p_text4 = p_text4 || p_vata;
p_text5 = p_text5 || p_vata;
insert into test_2_zapis (id,cislo,pismena1,pismena2,pismena3,pismena4,pismena5) values(i,p_cislo,p_text1,p_text2,p_text3,p_text4,p_text5);
end loop;

return 1;

exception
  when others then
    get stacked diagnostics v_exc_context = pg_exception_context;
    perform main.ut_log('ERR', sqlerrm || ' [SQL State: ' || sqlstate || '] Context: ' || v_exc_context );
    raise;
end;
$body$ language plpgsql

truncate table test_2_zapis;
select * from f_zapis(1000); --finished in 0.084sec (0.077s, 0.078s)

create or replace function f_zapis (p_pocet_radku int)
returns integer as $body$
declare
v_exc_context text;
p_cislo int := 123456789;
p_text1 text :='';
p_text2 text :='';
p_text3 text :='';
p_text4 text :='';
p_text5 text :='';
p_vata text :='';
begin

p_vata =
$$
orem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.'
$$
;
for i in 1..p_pocet_radku loop
/*
select (random() * 1000000)::int into p_cislo;
SELECT md5(random()::text) into p_text1;
SELECT md5(random()::text) into p_text2;
SELECT md5(random()::text) into p_text3;
SELECT md5(random()::text) into p_text4;
SELECT md5(random()::text) into p_text5;
*/

p_text1 = p_text1 || p_vata;
p_text2 = p_text2 || p_vata;
p_text3 = p_text3 || p_vata;
p_text4 = p_text4 || p_vata;
p_text5 = p_text5 || p_vata;
insert into test_2_zapis (id,cislo,pismena1,pismena2,pismena3,pismena4,pismena5) values(i,p_cislo,p_text1,p_text2,p_text3,p_text4,p_text5);
end loop;

return 1;

exception
  when others then
    get stacked diagnostics v_exc_context = pg_exception_context;
    perform main.ut_log('ERR', sqlerrm || ' [SQL State: ' || sqlstate || '] Context: ' || v_exc_context );
    raise;
end;
$body$ language plpgsql

truncate table test_2_zapis;
select * from f_zapis(1000); -- finished in 7.282 sec (7.158s, 7.187s)
------------------------------------------------------
create table test_2_zapis (
id  bigint,
cislo  int,
pismena1  text,
pismena2  text,
pismena3  text,
pismena4  text,
pismena5  text
)

2) Table with time results for select into statements, all conditions are same as described above.

*

*Table size 20,000,000 rows

*If multiple selects run at the same time each has it own source and output table

*All tables has the same data

*I was the only user using the database at that time

Notes:

*

*time is measured in seconds

*I run the tests multiple times, column Number of tests

*result were quite consistent, you can see it from MIN,MAX,AVG times

*results are counted on avg values

*if run parallel instances I measured time of each thread (as shown in the table), and then sum them together

*Ideal scaling is based on number of threads

*For real scaling the base is single thread, which is 891 sec, for multithreads it is how much is done by one thread and then multiplied by number of threads
example 4 threads has speed of 1381 seconds per thread, so one thread does 64,5% of the base single thread, then multiple by 4 (number of threads) and we have 258% done, meaning the scaling 2,58

3) Wait events (for select into statements)
Wait events time line (single thread)
https://ibb.co/K9jWLRx
Wait event time line multi-thread (time line for one out of four threads)
https://ibb.co/j8wxHYB

A: What tool did you use for benchmarking the IO, and with what settings?
If it is multi-threaded, that might be the "problem".  Writing WAL records is an inherently single-threaded process (different processes can do it, but they use locks so only one process can do it at a time), so a multi-threaded benchmark may not be the relevant benchmark to use.
Does your benchmark insert fsync into the writes?  Large transactions like bulk copies don't fsync often (unlike short transactions) but they still fsync once per WAL file, 16 MB by default.  And 16 MB doesn't take very long when doing bulk inserts.  You can set the size of WAL files during initdb, or on newer versions change the size with pg_resetwal --wal-segsize (warning: pg_resetwal is very dangerous.  I'd only use in test systems in which case you usually might as just initdb instead)
It looks like the wait_events in your single threaded case are about half IO.  That is odd to me.  I would have expected them to be 90% NULL (meaning essentially 'CPU').  This fact make me wonder how much scaling you can expect to get.
Also, your rows alternative almost perfectly between NULL and not NULL.  I would expect a statistical process here, not a metronome. I don't need to pull out my stats book to declare that your runs of length 1 way too common to come from a statistical process.  But I don't know what to do with this conclusion, so I will ignore it.
On your 4 process data, on the other hand, I would have expected way more IO events and almost no NULL/CPU events.  There are a lot of IO event, but not as many as I would have thought by eyeballing it.
By the way, why stop at 4?  7262 apparently has 8 real CPUs (not that hyperthreading crap which never seems to do anything useful, for databases anyway).  Cranking it up to 8 might make patterns clearer.  Cranking it up to 80, on the other hand, will just find bottlenecks that are irrelevant at reasonable settings, so don't do that.
Here would be my research program:

*

*Upgrade to 12.3 if you are not already on it.
No point in discovering problems that have already been improved.

*set wal_writer_flush_after = 0
if it doesn't improve things at all, I might set it back.  I can't decide

*Increase wal-segsize

*Turn off fsync (not on production!)

*Make your tables unlogged/temp

*If still not scaling, move your tables to different databases (kind of a long shot)

*And if still not scaling, create several instances and put one table in each instance.

Many of these can't be used as a solution, but can at least provide some insight into the problem, which can then lead to solutions.


text:
Q: Relational algebra - List the names of employees who do not work in the project 1 I've the following tables:
Employee
|name|employee_cod|

Project
|name|project_cod|

Work
|employee_cod|project_cod|

So, how can I list the names of employees who not work,
for example, in the project with project_cod = 1, with relational algebra?
The following not work:
π(employee.name(σ work.project_cod != 1 (Employee ∞ Work ∞ Project)

Because if I have the following data in work table:
| employee_cod | project_cod |
-------1--------------1-------
-------1--------------2-------
-------1--------------3-------
-------2--------------2-------

This σ work.project_cod != 1 will result in:
| employee_cod | project_cod |
-------1--------------2-------
-------1--------------3-------
-------2--------------2-------

But the employee with code = 1 should not be returned, because it participates in project 1

A: You first find all the employees who do work on the project. Those who don't are produced by relational difference (minus) operator.

A: Thank you for the tip Tegiri.
The solution is:
π name (Employee) - ( π name (σ project_cod = 1 (Employee ∞ Work)))


text:
Q: Could not open ServletContext resource in Spring boot application I have created spring boot application which will connect to Google cloud pub/sub and get data from topic. For authentication I have added this property spring.cloud.gcp.credentials.location=C:\\Users\\Admin\\dev\\Projects\\cloud\\credentials-file.json in application.properties file.
When I run application, I get this exception
> Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/C:/Users/Admin/dev/Projects/cloud/credentials-file.json]
    at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:158) ~[spring-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    at org.springframework.cloud.gcp.core.DefaultCredentialsProvider.<init>(DefaultCredentialsProvider.java:94) ~[spring-cloud-gcp-core-1.1.0.RELEASE.jar:1.1.0.RELEASE]
    at org.springframework.cloud.gcp.autoconfigure.core.GcpContextAutoConfiguration.googleCredentials(GcpContextAutoConfiguration.java:58) ~[spring-cloud-gcp-autoconfigure-1.1.0.RELEASE.jar:1.1.0.RELEASE]
    at org.springframework.cloud.gcp.autoconfigure.core.GcpContextAutoConfiguration$$EnhancerBySpringCGLIB$$375b81d4.CGLIB$googleCredentials$1(<generated>) ~[spring-cloud-gcp-autoconfigure-1.1.0.RELEASE.jar:1.1.0.RELEASE]
    at org.springframework.cloud.gcp.autoconfigure.core.GcpContextAutoConfiguration$$EnhancerBySpringCGLIB$$375b81d4$$FastClassBySpringCGLIB$$81fbe7e5.invoke(<generated>) ~[spring-cloud-gcp-autoconfigure-1.1.0.RELEASE.jar:1.1.0.RELEASE]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    at org.springframework.cloud.gcp.autoconfigure.core.GcpContextAutoConfiguration$$EnhancerBySpringCGLIB$$375b81d4.googleCredentials(<generated>) ~[spring-cloud-gcp-autoconfigure-1.1.0.RELEASE.jar:1.1.0.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_191]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_191]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_191]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]

I tried to evaluate excretion in debug mode, everything is working. For this I evaluated this line in Intellij Idea.
is = new FileInputStream("C:\\Users\\Admin\\dev\\Projects\\cloud\\credentials-file.json");
in this method
    @Override
    public InputStream getInputStream() throws IOException {
        InputStream is = this.servletContext.getResourceAsStream(this.path);
        if (is == null) {
            throw new FileNotFoundException("Could not open " + getDescription());
        }
        return is;
    }

Solution
I moved my credentials file to folder resources/static/my-credentials-file.json

And changed file path in application.properties file (located on src/resources folder).
spring.cloud.gcp.credentials.location=file:src/main/resources/static/my-credentials-file.json
spring.cloud.gcp.project-id=my-project-id


text:
Q: ArcObjects: ExportOperationClass causing error and not exporting I'm trying to export each row in a shapefile, but I get an error I haven't seen before (see below). I feel like it might be the labyrinth of interfaces that I have to cast between that may be causing the error. I must be getting close though because I get an export feature class progress bar (see below) which then gets overridden by the error.
Code:
try
        {
            IMxDocument mxdoc = ArcMap.Application.Document as IMxDocument;
            IMap map = mxdoc.FocusMap;

            for (int i = 0; i < map.LayerCount; i++)
            {
                ILayer layer = map.Layer[i];
                if (layer.Name == "lga_polygon")
                {
                    if (layer is IFeatureLayer)
                    {
                        IFeatureLayer flayer = layer as IFeatureLayer;
                        IFeatureClass fc = flayer.FeatureClass;

                        IDataset pDataset = flayer as IDataset;
                        IDatasetName pDatasetName = pDataset.FullName as IDatasetName;

                        string lgaName = "LGA_NAME";

                        IFields fields = fc.Fields;
                        int lgaNameFieldIndex = fields.FindField(lgaName);

                        IField lgaNameField = fields.Field[lgaNameFieldIndex];

                        IFeatureCursor lgaCursor = fc.Search(null, true);

                        IFeature lga = lgaCursor.NextFeature();

                        while (lga != null)
                        {
                            string nameOfLGA = lga.Value[lgaNameFieldIndex].ToString();

                            IDatasetName dsName = new FeatureDatasetNameClass();
                            dsName.Name = nameOfLGA;
                            IFeatureClassName fcName = dsName as IFeatureClassName;

                            IWorkspaceName pWorkspaceName = new WorkspaceNameClass();
                            pWorkspaceName.PathName = "C:\\Users\\username\\Documents\\ArcGIS\\Default.gdb";
                            pWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesFile.FileGDBWorkspaceFactory";

                            IQueryFilter qFilt = new QueryFilterClass();
                            qFilt.WhereClause = "LGA_NAME = '" + nameOfLGA + "'";

                            IGeographicCoordinateSystem pGCS = new GeographicCoordinateSystemClass();
                            SpatialReferenceEnvironment spatRefEnv = new SpatialReferenceEnvironmentClass();
                            ISpatialReference spatRef;
                            pGCS =  spatRefEnv.CreateGeographicCoordinateSystem(Convert.ToInt16(esriSRGeoCSType.esriSRGeoCS_GDA1994));

                            spatRef = pGCS as ISpatialReference;

                            IGeometryDef geoDef = new GeometryDefClass();
                            IGeometryDefEdit geoDefEdit = geoDef as IGeometryDefEdit;
                            geoDefEdit.SpatialReference_2 = spatRef;
                            geoDefEdit.GeometryType_2 = fc.ShapeType;
                            IGeometryDef geoDef2 = geoDefEdit as IGeometryDef;

                            IExportOperation exportOp = new ExportOperationClass();
                            exportOp.ExportFeatureClass(pDatasetName, qFilt, null, geoDef2, fcName, ArcMap.Application.hWnd);

                            lga = lgaCursor.NextFeature();
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message + "\n\n" + ex.Source + "\n\n" + ex.StackTrace);
        }

Error:

A: In your code you have:
pWorkspaceName.PathName = "C:\\Users\\username\\Documents\\ArcGIS\\Default.gdb";
pWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory";

As you have defined the path name to be a file geodatabase then the workspacefactory should be:
pWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesGDB.FileGDBWorkspaceFactory";

A: First note that IExportOperation interface doesn't export featureclasses or tables that containt a BloB field. So if a blob field exists in your featurelayer you should use   "FeatureClassToFeatureClass" instead.
In your question you mentioned you want to export each row to a shapefile but in your export path you set a path to a File Geodatabase!
Here are some bugs with your code:
You must use
IDatasetName dsName = new FeatureClassNameClass();

instead of this
IDatasetName dsName = new FeatureDatasetNameClass();

and it is best to instantiate your objects outside of your loop.
Another problem with your code (main problem) is that you are missing to set the workspaceName of your output feature class:
dsName.Name = nameOfLGA;
dsName.WorkspaceName = pWorkspaceName;

I modified your code and now it works fine:
try
            {
                IMxDocument mxdoc = ArcMap.Application.Document as IMxDocument;
                IMap map = mxdoc.FocusMap;

                for (int i = 0; i < map.LayerCount; i++)
                {
                    ILayer layer = map.Layer[i];
                    if (layer.Name == "lga_polygon")
                    {
                        if (layer is IFeatureLayer)
                        {
                            IFeatureLayer flayer = layer as IFeatureLayer;
                            IFeatureClass fc = flayer.FeatureClass;

                            IDataset pDataset = flayer as IDataset;
                            IDatasetName pDatasetName = pDataset.FullName as IDatasetName;

                            string lgaName = "LGA_NAME";

                            IFields fields = fc.Fields;
                            int lgaNameFieldIndex = fields.FindField(lgaName);

                            IField lgaNameField = fields.Field[lgaNameFieldIndex];

                            IFeatureCursor lgaCursor = fc.Search(null, true);

                            IWorkspaceName pWorkspaceName = new WorkspaceNameClass();
                            pWorkspaceName.PathName = "C:\\Users\\user\\Documents\\ArcGIS\\Default.gdb";
                            pWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesFile.FileGDBWorkspaceFactory";

                            IGeographicCoordinateSystem pGCS = new GeographicCoordinateSystemClass();
                            SpatialReferenceEnvironment spatRefEnv = new SpatialReferenceEnvironmentClass();
                            ISpatialReference spatRef;
                            pGCS = spatRefEnv.CreateGeographicCoordinateSystem(Convert.ToInt16(esriSRGeoCSType.esriSRGeoCS_GDA1994));

                            spatRef = pGCS as ISpatialReference;

                            IGeometryDef geoDef = new GeometryDefClass();
                            IGeometryDefEdit geoDefEdit = geoDef as IGeometryDefEdit;
                            geoDefEdit.SpatialReference_2 = spatRef;
                            geoDefEdit.GeometryType_2 = fc.ShapeType;

                            IFeature lga = lgaCursor.NextFeature();
                            while (lga != null)
                            {
                                string nameOfLGA = lga.Value[lgaNameFieldIndex].ToString();

                                IDatasetName dsName = new FeatureClassNameClass();

                                dsName.Name = nameOfLGA;
                                dsName.WorkspaceName = pWorkspaceName;
                                IFeatureClassName outfcName = dsName as IFeatureClassName;

                                IQueryFilter qFilt = new QueryFilterClass();
                                qFilt.WhereClause = "name = '" + nameOfLGA + "'";

                                IExportOperation exportOp = new ExportOperationClass();
                                exportOp.ExportFeatureClass(pDatasetName, qFilt, null, geoDef, outfcName, 0);

                                lga = lgaCursor.NextFeature();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n\n" + ex.Source + "\n\n" + ex.StackTrace);
            }

Just make sure that the data in your lga_name field is unique because then you will have an already exported feature class replaced with a new one with the same  name


text:
Q: Using Custom Javascript Date Variable with IMG SRC Element I am trying to use a custom javascript date variable in some img src elements on my website but I am having some trouble with it, as the code is not recognizing the utcdate variable.. I have decided to use moment.js to help me achieve generating the current date (in UTC format). The purpose of this is to drive (and display) images in a gallery that live in a directory that is named with today's date in YYYYMMDD format.
HTML Code:

Title Goes Here

A: fiddle answer
 var utcdate = moment().format('YYYYMMDD');
 $("#my_image").attr("src","http://some.website/somedirectory/" + utcdate + "/someotherdirectory/image.png");


text:
Q: C++20 range-v3 and the zip_with view adapter With a lazy range combinator such as ranges::view::reverse I can either provide it with a single argument (e.g. reverse(iota(0,3))); or I can use it to adapt a range using operator| (e.g. iota(0,3) | reverse). This parity appears fairly regular; below are examples of nullary, unary, and binary views:
#include <range/v3/all.hpp>
#include <iostream>

int main(int argc, char *argv[])
{
  using namespace ranges::view;
  std::cout <<        (iota(0,9) | reverse)      << ' ';
  std::cout << reverse(iota(0,9))                << '\n';

  std::cout <<        (iota(0,9) | chunk(4))     << ' ';
  std::cout <<   chunk(iota(0,9),4)              << '\n';

  std::cout <<        (iota(0,9) | replace(5,0)) << ' ';
  std::cout << replace(iota(0,9),5,0)            << '\n';
  return 0;
}

I notice though that the ranges::view::zip_with combinator can only be used in the second (non-adapter) form; such as zip_with(std::plus{},iota(0,9),iota(0,9)). Is there a technical reason why zip_with cannot be defined to work with operator|? Is there a canonical ordering to the arguments of the lazy range combinators in the ranges-v3 library?
I'm working with the latest release (v0.4.0) of the ranges-v3 library.

A: It's a pretty common convention in range-v3 that r | adapter(x) means the same thing as adapter(r, x). (Indeed there's even a programming language, Elixir, for which r |> adapter(x) actually evaluates as adapter(r, x) directly).
The problem with zip_with is that the usage, as you point out, is:
zip_with(std::plus{},iota(0,9),iota(0,9))

Which means the logical separation with operator| would be:
std::plus{} | zip_with(iota(0,9),iota(0,9))

But then, that's not a range on the left-hand side. That's some binary operator. range-v3 is all about chaining ranges. In every other case, it's the range that appears on the left-hand-side of |. So while it's not technically difficult to do, it seems like a substantively different kind of thing.


text:
Q: Replace if exists or insert in mySQL database from Python I would like to replace a value if the date/time for a row in table is the same for the one he try to insert. If the time/date doesn't exist in the table then insert it.
If you se the picture. The value nr 2 to the end has the same time as the first value. Then it should replace the first one because they have the same time. Not get added last to the list. If the time doesn't exist, then it can be added.
I have tried with REPLACE and ON DUPLICATE KEY UPDATE, but I cant get it to work...
"INSERT INTO flowAvarageValuesDays (time, value) VALUES (%s, %s) ON DUPLICATE KEY UPDATE avarageFlowValueDays=%s", (time,value,value)

and
"REPLACE INTO flowAvarageValuesDays (time, value) VALUES (%s, %s)",
            (time, value)

Table

A: IF(SELECT time FROM table WHERE %s IN(time), INSERT INTO flowAvarageValuesDays (time, value) VALUES (%s, %s) ON DUPLICATE KEY UPDATE avarageFlowValueDays=%s, (time,value),REPLACE INTO flowAvarageValuesDays (time, value) VALUES (%s, %s),

(time, value))


text:
Q: How to Redirecting 301 which is already re-written My previous re-written rules are working fine as below:
RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^product-detail/([\w-.]+)/?$ product-detail.php?e=$1 [NC,L]

It is mysite.com/product-detail/laptop
In searches, 5000 product results are already there.
I want to redirect 301 to new folder as
mysite.com/electronics/product-detail/laptop
I don't want google to destroy my results. Please help me.

A: I believe it should be something like that:
RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^product-detail/([\w-.]+)/?$ /electronics/product-detail/$1 [NC,R=301,L]
RewriteRule ^electronics/product-detail/([\w-.]+)/?$ product-detail.php?e=$1 [NC,L]

Your 1st, 2nd rules are unchanged. Then, you forward all old URLs to new ones, with redirect code 301. And then, process new URLs to your script, as it was with old URLs.
I assume here that your path prefix electronics is a constant one, i.e. it does not depend on product category. If so, you would have to make the redirect in the script, as Apache will not be able to guess the category of the product (for example, if redirecting from /product-detail/hugo-boss to => /parfume/product-detail/hugo-boss).


text:
Q: Problems after upgrading to Ubuntu 19.10 from 18.04 I just upgraded to Ubuntu 19.10 from 18.04 (after going through 19.04) and I have a few problems.
1) The dock with icons is not showing up. I tried the solution here, but it didn't work for me.
2) When I press the Activities button, I am not sure what is supposed to happen (I never used it in 18.04), but both my screens go darker (I have a second monitor) and a search bar appears on the main, from which I can search for software I have installed and I can launch it. However I can't seem to 'exit' this Activities thing. Whatever and whereever I click it stays on and in particular I can't click on anything that I have launched through it (the Activities things is transparent, so I can see the programs I am launching). The only way I have found of 'closing' it is by doing Alt+F2 and 'r', but I assume this is not its intended usage.
3) In Settings, if I go to the 'Devices' section, then whenever I switch between more than 2 of the subsections (Keyboard, Mouse, etc.) the window starts flickering and I can't click on it anymore. I can close it with Alt+F4. This applies to the gnome-tweaks as well. The error I get in terminal is
(gnome-tweaks:10198): Gtk-WARNING **: 11:08:37.757: gtk_widget_size_allocate(): attempt to allocate widget with width -23 and height 19

It is apparently a bug affecting multiple users that hasn't been resolved yet.
4) There is some kind of a diagonal line on my second (physical) screen, but primary as defined in the settings, that is not visible unless scrolling through a page with text, because it distorts the text as the text passes by it - similar to light going through the interface of two media with different refractive index. My second screen worked great until before the update, so I doubt it is a hardware problem with it
5) Vivaldi doesn't launch. Here is the error I get in terminal
(vivaldi:7580): Gtk-WARNING **: 10:35:37.764: Theme parsing error: gtk.css:2:0: Expected a valid selector
[7580:7580:1202/103537.825606:ERROR:chrome_content_client.cc(343)] Failed to locate and load the component updated flash plugin.
[7610:7610:1202/103537.895850:ERROR:sandbox_linux.cc(369)] InitializeSandbox() called with multiple threads in process gpu-process.
[7580:7719:1202/103537.967988:ERROR:database.cc(1581)] Calendar sqlite error 1, errno 0: no such column: etag, sql: update events set etag = ''
[7580:7719:1202/103537.968014:ERROR:calendar_database.cc(47)] Calendar DB failed to migrate from version 1. Calendar API will be disabled.
[7580:7719:1202/103537.972650:ERROR:calendar_backend.cc(152)] INIT_TOO_NEW
Segmentation fault (core dumped)

I tried the proposed solution here, but it didn't help.
UPDATE: 2) was apparently caused by an extension called Workspace grid, which doesn't work with 19.10, so I removed it (and replaced it with Workspace matrix). That problem, 2), is now fixed
UPDATE 2: 4) was resolved (at least I can't see the line where I previously could) by reininstalling the NVIDIA drivers.
UPDATE 3: I tried disabling all my gnome extensions and then restarting - nothing changed - all the remaining (1,3,5) problems were still there.
UPDATE 4: 1) was resolved after what it seems to me a random sequence of events that might not all be linked to the resolution. Namely:
1-Uninstall "Dash to Dock" gnome extension after upgrading to 19.10 (it worked well in 18.04).
1.5-A large number of other operations connected with resolving other problems or just doing work on the machine. None of them seem relevant to gnome for me.
2-Reinstalled NVIDIA-440 drivers and restarted machine.
3-Installed "Dash to Dock" again. Not working.
4-Reverted back to NVIDIA-435 drivers and restarted machine.
5-Reinstalled "Dash to Dock". Working.
6-Upgraded to NVIDIA-440 drivers and restarted machine. "Dash to Dock" works and I can use the dock icons outside of "Activities".
UPDATE 5: A workaround for 2) is to first resize the settings window a bit with the mouse and then make it full screen through the button for doing so. This enables one to use the settings menu.


text:
Q: strtok() skips first token Can't seem to work out why this code is not working.
It should be really straight forward.
From what I have troubleshooted, in the while(token) block the id array is assigned but then when I go to print all the char array's outside the while(token) block the id array displays nothing but all the other array's display their contents.
int loadCatData(char* menuFile) {
   char line[MAX_READ];
   char id[ID_LEN];
   char hotCold[MIN_DESC_LEN];
   char name[MAX_NAME_LEN];
   char description[MAX_DESC_LEN];
   char delim[2] = "|";
   char lineTemp[MAX_READ];
   int count;
   FILE *mfMenu = fopen(menuFile, "r");

   while (fgets(line, sizeof(line), mfMenu)!=NULL) {
      count = 0;
      printf(line);

      strcpy(lineTemp,line);

      char* token = strtok(lineTemp, delim);

      while (token) {
         printf(token);
         if (count == 0) {
            strcpy(id, token);
         }
         if (count == 1) {
            strcpy(hotCold, token);
         }
         if (count == 2) {
            strcpy(name, token);
         }
         if (count == 3) {
            strcpy(description, token);
         }
         printf("\n");
         token = strtok(NULL, delim);
         count = count + 1;
      }
      printf(id);
      printf(hotCold);
      printf(name);
      printf(description);

   }
   fclose(mfMenu);
   return true;
}

A: You are the victim of a buffer overflow error caused by strcpy.
What is happening is that the hotCold array is too small to hold the data you're filling it with, but strcpy doesn't care, nor does it know that there isn't enough room.  So it keeps on writing data into hotCold and then runs out of room, then fills up the padding bytes, then fills up id.  You just have the unfortunate luck of having the terminating null byte of hotCold sitting at the start of id.
Switch from using strcpy to strncpy or strncat (which I think is better than strncpy).  If you're skeptical of what I'm saying, add a line of code at the end that goes like this:
assert (strlen (hotCold) < MIN_DESC_LEN);

The other alternative is that the id field is being interpreted as a special printf-format specifier.  Just in case, replace printf(id) with printf("%s", id).

A: int loadCatData(const char* menuFile) {
    char id[ID_LEN];
    char hotCold[MIN_DESC_LEN];
    char name[MAX_NAME_LEN];
    char description[MAX_DESC_LEN];
    FILE *mfMenu = fopen(menuFile, "r");

    while (fscanf(mfMenu, "%*s|%*s|%*s|%*s",
            sizeof(id), id, sizeof(hotCold), hotCold,
            sizeof(name), name, sizeof(description), description) == 4) {
        printf("%s %s %s %s\n", id, hotCold, name, description);
    }

    fclose(mfMenu);
    return true;
}

You should never pass input from outside the program to printf as the first argument.  Imagine if one of the tokens is "%s" and you say printf(token)--that's undefined behavior because you didn't pass a second string to print, and your program will crash if you're lucky.


text:
Q: How to add toAlternatingCase custom method to String class in JavaScript? I'm trying to add a custom method to the String class in JavaScript called toAlternatingCase, it will turn lowercase characters into uppercase and vice versa in the string that is called on, I'm trying to make it like the built-in toUpperCase/toLowerCase methods which don't take any arguments.
this is a kata(challenge) on codewars.

A: This can be done by utilizing the prototype method to extend the String class. This probably isn't the most efficient way of doing this, but it can be achieved with something like this:

String.prototype.toAlternatingCase = function() {
  var ns = "";
  for(var i = 0; i < this.length; i++) ns += (this.slice(i, i+1) == this.slice(i, i+1).toUpperCase()) ? this.slice(i, i+1).toLowerCase() : this.slice(i, i+1).toUpperCase();
  return ns;
}

"String.prototype.toAlternatingCase".toAlternatingCase();
// Should return 'sTRING.PROTOTYPE.TOaLTERNATINGcASE'

This just loops through the string and reverses the case of each character, then returns that new result (without modifying the original string).

A: String.prototype.toAlternatingCase = function () {
  return this.split("").map(l => l === l.toUpperCase() ? l.toLowerCase() : l.toUpperCase()).join("");
}


text:
Q: Unexpected voltage drop I am switching 5V relay with an Arduino Nano. When using USB cable as power source, everything works as it i supposed to. When using external source in form of batteries,(First I tried 9V battery, then 4xAA 1.5V batteries) when I switch relay, the voltage drops to 4.7 V from 5V pin to GND.Battery voltage at input stays at 6V. What might be causing this?

A: The Arduino regulator does not Supply enough current to drive a relay coil, and as a result the voltage drops. To drive your relay properly, you need a driver circuit, which Wired explains better than I would:
How To Move Big Electrons With an Arduino
The reason why it works with a USB cable is because it supplies the 5V directly to the +5V net, without going through the series regulator.

A: The way you're supplying the relay's coil, considering its current requirement and the Arduino output capability, the driving pin won't survive that long :D
Use an external 300mA+ rated transistor which you could drive from the Arduino's pin (Low Vgs-th MOSFET for example)


text:
Q: Mac OS X 10.6/python/pyperclip I'm trying to pick up python via Al Sweigart's book Automate the Boring Stuff and have ran into an issue getting pyperclip to properly install, or even pip for that matter on my machine running OS X 10.6.
How do I know pip is installed?
I ran the sudo pip install in the terminal last night.
I'm trying to run http://pastebin.com/2aEPV45Y.
What steps can I take to

*

*make sure pip has installed and is running and

*get pyperclip to run properly when I begin a program with "import pyperclip"?

A: If you installed python3 from python.org, use pip3 to install version 3 modules.


text:
Q: What can we say for this situation? There is a piece of work but no-one wants to do it  and it seems that you are the only one that will do it. So the burden will be on your shoulders. What idiom can I use?
For example: This work will be pushed to me or This job will be explode in my hands?

A: There's an idiom that goes ...

be left holding the baby
(North American be left holding the bag)
  Be left with an unwelcome responsibility, typically without warning.
  - ODO

A:
I'll be stuck with this job.

Stuck = past tense of Stick (MW verb definition 9)

to saddle with something disadvantageous or disagreeable  - "is still stuck with that lousy car"

A: fall on/upon somebody/something

phrasal verb
1 if a duty or job falls on someone, they are responsible for doing it
The responsibility usually falls on the mother.

More Examples:
The task of telling Mother about the broken vase fell upon Jane.
The job of cleaning up the spill fell upon Tom.
"It will fall upon me to do this task."
i.e., I, and only I will have to do this task (as no one else will do it).

A:
This job will be explode in my hands?

Focusing on the unpleasantness of the job itself, you could say, "This job is a recipe for disaster."

[Collins]
If you say that something is a recipe for disaster, you mean that it is very likely to have unpleasant consequences.