text:
Q: endfloat and \Continuedfloat: incorrect numbering for place holders When I use endfloat and \ContinuedFloat, the table place holders that endfloat puts in don't have the correct numbering (while the tables themselves do).  For example if I have a float and another float immediately after with the \ContinuedFloat command, they will both be titled Table 1. On the other hand, the place holder in the text will say [Table 1 about here] and [Table 2 about here].  Does anyone know how to fix this?

A: Since the endfloat package does not support \ContinuedFloat you need to correct the corresponding counter by yourself, e.g. by
\addtocounter{posttable}{-1}
just before the table environment containing \ContinuedFloat.
Furthermore one can adapt the table replacement text additionally, e.g.:
\documentclass[a4paper,12pt]{article}
\usepackage{caption,endfloat}
\begin{document}

\begin{table}
\caption{Test}
\end{table}

% Variant #1: Just correct the table counter of the `endfloat' package
\addtocounter{posttable}{-1}
\begin{table}
\ContinuedFloat
\caption{Test (cont.)}
\end{table}

% Variant #2: Change the table replacement text additionally
\begingroup % keep changes locally
\addtocounter{posttable}{-1}
\renewcommand\theposttable{\arabic{posttable} (cont.)}
\begin{table}
\ContinuedFloat
\caption{Test (cont.)}
\end{table}
\endgroup

% Variant #3: Remove the table replacement text completely
\begingroup % keep changes locally
\addtocounter{posttable}{-1}
\renewcommand\tableplace{}
\begin{table}
\ContinuedFloat
\caption{Test (cont.)}
\end{table}
\endgroup

% [...]

\end{document}

(postfigure and posttable are the counters used for the markers replacing the original figures and tables. So the endfloat package is using own counters here.)


text:
Q: My app Crashes when I enter a letter to register/login activity I have a problem and I can't debug it.
When I try to login or register the app crashes.
When adding only one letter I get the message "My app" keeps stopping.
I don't have any problem in the login/register activity and I can't debug it because the app crashes on the first letter.
Thanks for the help.
This is Login activity for example:
import android.content.Intent;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
/**
 * Login
 * This class for login
 * Check if the input is admin and send to another activity
 */
public class Login extends AppCompatActivity {

    DatabaseHelper helper = new DatabaseHelper(this);
    private TextInputLayout textInputPassword;
    private TextInputLayout textInputUsername;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login_join);

        textInputUsername = findViewById(R.id.etUserName);
        textInputPassword = findViewById(R.id.etPassword);

        TextView tvjuinUs = (TextView) findViewById(R.id.tvJuinUs);

        //Check if user already exist pass move to login
        tvjuinUs.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Login.this, JoinUs.class);
                startActivity(intent);
                finish();
            }
        });
    }

    //Check if user name & password exist in database
    public void CheckDetails(View v) {
        String username = textInputUsername.getEditText().getText().toString().trim();
        String pass = textInputPassword.getEditText().getText().toString().trim();

        try {
            if ((username.equals("admin")) && (pass.equals("admin"))) {
                Intent intent = new Intent(Login.this, AdminConnection.class);
                startActivity(intent);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        //Check match beetwen user name and pass
        if (!(helper.checkMatcForUser(username, pass))) {
            Toast.makeText(getApplicationContext(), "Login Failed. The email or password you entered is incorrect", Toast.LENGTH_LONG).show();
            textInputUsername.setError("ERROR !!!");
            textInputPassword.setError("ERROR !!!");
            return;
        }
        if ((helper.searchUsername(username)) && (helper.searchPassword(pass))) {

        } else {
            textInputUsername.setError("User or Password don't match!");
            textInputPassword.setError("Password or user don't match!");

        }
    }

}

This is the error :
E/InputEventSender: Exception dispatching finished signal.
E/MessageQueue-JNI: Exception in MessageQueue callback:
 handleReceiveCallback
E/MessageQueue-JNI: java.lang.NoSuchMethodError: No static method
dispatchUnhandledKeyEventPre(Landroid/view/View;Landroid/view/KeyEvent;)Z in class Landroid/support/v4/view/ViewCompat; or its super classes (declaration of 'android.support.v4.view.ViewCompat' appears in /data/app/com.example.aviorka.bstrong-ZZzNIVOJeVtP54s_AGokUw==/base.apk)
                    at android.support.v7.app.AppCompatDelegateImpl.dispatchKeyEvent(AppCompatDelegateImpl.java:1162)
                    at android.support.v7.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent(AppCompatDelegateImpl.java:2529)
                    at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:342)
                    at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4991)
                    at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4856)
                    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4377)
                    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4430)
                    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4396)
                    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4536)
                    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4404)
                    at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4593)
                    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4377)
                    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4430)
                    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4396)
                    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4404)
                    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4377)
                    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4430)
                    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4396)
                    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4569)
                    at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4730)
                    at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2559)
                    at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2069)
                    at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2060)
                    at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2536)
                    at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
                    at android.os.MessageQueue.nativePollOnce(Native Method)
                    at android.os.MessageQueue.next(MessageQueue.java:326)
                    at android.os.Looper.loop(Looper.java:160)
                    at android.app.ActivityThread.main(ActivityThread.java:6642)
                    at java.lang.reflect.Method.invoke(Native Method)
                    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
              Process: com.example.aviorka.bstrong, PID: 8924
              java.lang.NoSuchMethodError: No static method
dispatchUnhandledKeyEventPre(Landroid/view/View;Landroid/view/KeyEvent;)Z in class Landroid/support/v4/view/ViewCompat; or its super classes (declaration of 'android.support.v4.view.ViewCompat' appears in /data/app/com.example.aviorka.bstrong-ZZzNIVOJeVtP54s_AGokUw==/base.apk)
                  at android.support.v7.app.AppCompatDelegateImpl.dispatchKeyEvent(AppCompatDelegateImpl.java:1162)
                  at android.support.v7.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent(AppCompatDelegateImpl.java:2529)
                  at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:342)
                  at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4991)
                  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4856)
                  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4377)
                  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4430)
                  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4396)
                  at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4536)
                  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4404)
                  at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4593)
                  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4377)
                  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4430)
                  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4396)
                  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4404)
                  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4377)
                  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4430)
                  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4396)
                  at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4569)
                  at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4730)
                  at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2559)
                  at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2069)
                  at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2060)
                  at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2536)
                  at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
                  at android.os.MessageQueue.nativePollOnce(Native Method)
                  at android.os.MessageQueue.next(MessageQueue.java:326)
                  at android.os.Looper.loop(Looper.java:160)
                  at android.app.ActivityThread.main(ActivityThread.java:6642)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
                  at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/Process: Sending signal. PID: 8924 SIG: 9
Disconnected from the target VM, address: 'localhost:8600', transport:
'socket'

// This suppot library : build.gradle(Module:app)
apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.aviorka.bstrong"
        minSdkVersion 28
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support:cardview-v7:28.0.0-alpha3'
    implementation 'com.android.support:design:28.0.0-alpha3'
    implementation 'com.thoughtbot:expandablerecyclerview:1.3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

A: Update support libraries and it will be fixed.

A: Stable version of 28.0.0 is availabe now. please use
28.0.0

version instead of
28.0.0-alpha3

And also set minSdkVersion 21 (Android L) for now. Because you set minSdkVersion 28 (Android P) thatt means it only work in Android 9 device.

A: I update from app gradle to 28.0.0 instead 28.0.0-alpha3.
And set the minSDKversion 21 .
problem solved !

redpajama_set_name: RedPajamaStackExchange


text:
Q: Java native array lengths I have a 2D array of doubles in Java which is basically a table of values and I want to find out how many rows it has...
It is declared elsewhere (and allocated) like this:
double[][] table;

then passed to a function...
private void doSomething(double[][] table)
{

}

In my function I want to know the length of each dimension without having to pass them around as arguments.  I can do this for the number of columns but don't know how to do it for the rows...
int cols = table[0].length;
int rows = ?;

How do I do that?
Can I just say...
int rows = table.length;

Why would that not give rows x cols?

A: Look at this example. They use .length there to get the row count, [].length to get the column count.
It's because the array consists of "row" pointers and these could lead anywhere, so you have to use .length for each column to get the sizes of these arrays, too.

A: In Java a 2D array is nothing more than an array of arrays.
This means that you can easily get the number of rows like this:
int rows = array.length;

This also means that each row in such an array can have a different amount of elements (i.e. each row can have a varying number of columns).
int columnsInFirstRow = array[0].length;

This will only give you the number of columns in the first row, but the second row could have more or less columns than that.
You could specify that your method only takes rectangular arrays and assume that each row has the same number of columns than the first one. But in that case I'd wrap the 2D-array in some Matrix class (that you might have to write).
This kind of array is called a Jagged Array.

A: I don't quite understand your question. You have to realize that in Java, multidimensional arrays are in fact arrays of arrays.
table.length will in fact give you the number of one-dimensional arrays contained in your two-dimensional array (assuming there are no null entries).
table[0].length will give you the size of the first one-dimensional entry. This could be different from the size of the others, and it could throw a NullPointerException (though neither is possible when it's allocated as new double[rows][cols]).

A: Well, first of all, why don't you just test if
int rows = table.length;

gives the desired result?
It does indeed give you the number of elements in the first dimension. Multidimensional arrays are in fact nothing special, as they are just arrays of arrays of arrays of ... In your case - a 2D array - it is organized like this (in pseudo-code):
double[][] foo = { double[] = {...}, double[] = {...}, ... }

So when accessing foo, it refers to the "outer" array, which has of course the length property, which contains the number of arrays it contains on the second level.
You can read the double[][] as "An array ([]) of double-arrrays (double[])".

A: No it won't. You can just use table.length

A: Alternatively, you could wrap your 2d array into a Matrix or Grid class of some sort. Internally, you could represent it as a 1d array and compute offsets for the row/col coordinates.


text:
Q: xamarin.forms listview Items only update when scrolling even after iNotifyPropertychanged implementation I have a xamarin.forms app which have a listview showing item fetched from firebase. The issue I am facing is well asked question in SO ie; one of my item in listview (an item named location ) only updates when we scroll the listview. I tried to implement the iNotifyPropertychanged but still I am facing the same issue. What is the mistake I am doing here? Any help is appriciated.
My Listview Itemsource setting
var person = await firebaseHelper.GetPerson(EmployeeID);// getting data from firebase
                    LocationData = person.userdata.Where(x => DateTime.Parse(x.DateTime).ToString("yyyy-MM-dd") == StartDate.Date.ToString("yyyy-MM-dd") && x.Longitude != "initial").ToList();
                    ObservableCollection<UserLocationData> dynamicLocation = new ObservableCollection<UserLocationData>(LocationData);
                    TrackingListView.ItemsSource = dynamicLocation;
                    if (dynamicLocation.Count != 0)
                    {
                        foreach (UserLocationData Item in dynamicLocation)
                        {
                            Item.DateTime = DateTime.Parse(Item.DateTime).ToString("MMMM dd,yyyy hh:mm tt");

                            if (!string.IsNullOrEmpty(Item.Latitude) && !string.IsNullOrEmpty(Item.Longitude))
                            {

                                var Locations = await Geocoding.GetPlacemarksAsync(Convert.ToDouble(Item.Latitude), Convert.ToDouble(Item.Longitude));
                                var placemark = Locations?.FirstOrDefault();
                                if (placemark.Thoroughfare.ToString() != null)
                                {
                                    var geocodeAddress =
                                    placemark.Thoroughfare + '\n' +
                                    placemark.SubAdminArea + '\n';
                                    Item.Location = geocodeAddress.ToString();
                                }
                                else
                                {
                                    Item.Location = Item.Latitude + "," + Item.Longitude;

                                }
                            }

                        }

My Datamodel
 public class Person : INotifyPropertyChanged
    {

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
        public string Name { get; set; }
        public string PersonId { get; set; }
        public string Address { get; set; }
        public string PhoneNumber { get; set; }
        public string EmailID { get; set; }
        public string Password { get; set; }
        public bool Status { get; set; }
        public bool IsAdmin { get; set; }
        public List<UserLocationData> userdata { get; set; }
    }

 public partial class UserLocationData : INotifyPropertyChanged
    {

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
        public string Latitude { get; set; }
        public string Longitude { get; set; }
        public string DateTime { get; set; }

        private string _location;
        public string Location
        {
            get
            {
                return _location;
            }

            set
            {
                if (value != null)
                {
                    _location = value;
                    NotifyPropertyChanged("Selected");
                }
            }
        }

        public bool ButtonOn { get; set; }
        public bool ButtonOff { get; set; }
    }

The Firebase GetPerson portion
   public async Task<Person> GetPerson(string personId)
        {
                var allPersons = await GetAllPersons();
                await firebase
                .Child("Persons")
                .OnceAsync<Person>();
                return allPersons.Where(a => a.PersonId == personId).FirstOrDefault();

        }

My XAML
 <ListView  x:Name="TrackingListView"  ItemsSource="{Binding} "
                             HasUnevenRows="True"
                             IsVisible="False"
                             CachingStrategy="RecycleElement"
                             SeparatorVisibility="None"
                             SelectionMode="None"
                             BackgroundColor="Transparent"
                             Margin="10,10,10,10"
                             HorizontalOptions="FillAndExpand"
                             >
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <ViewCell>
                                    <ViewCell.View>

                                        <Frame
                            Padding="5"
                            Margin="0,5,0,5"
                            Opacity="0.9"
                            BackgroundColor="White"
                            BorderColor="LightBlue"
                            HasShadow="True"
                            CornerRadius="10"
                            ClassId="{Binding DateTime}"
                            HorizontalOptions="FillAndExpand">

                                            <Frame.GestureRecognizers>
                                                <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"></TapGestureRecognizer>
                                            </Frame.GestureRecognizers>
                                            <Grid Margin="0,10,0,0" >

                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="Auto"/>
                                                    <RowDefinition Height="Auto"/>
                                                    <RowDefinition Height="Auto"/>
                                                </Grid.RowDefinitions>

                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="*"/>
                                                    <ColumnDefinition Width="Auto"/>
                                                </Grid.ColumnDefinitions>

                                                <StackLayout HorizontalOptions="FillAndExpand"  Grid.Row="0" Grid.Column="0" Orientation="Horizontal">

                                                    <Image Source="clock.png" HorizontalOptions="Start" VerticalOptions="Start"
                                                       HeightRequest="20" Margin="10,0,5,0"
                                                       ></Image>

                                                    <StackLayout Orientation="Vertical" Margin="0" HorizontalOptions="FillAndExpand">

                                                    </StackLayout>

                                                </StackLayout>

                                                <StackLayout Grid.Column="1" Grid.Row="0" HorizontalOptions="EndAndExpand" VerticalOptions="FillAndExpand">
                                                    <Image Source="googlemap.png" HorizontalOptions="End" VerticalOptions="Center" HeightRequest="30" ></Image>

                                                </StackLayout>

                                                <StackLayout HorizontalOptions="FillAndExpand"  Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal">

                                                    <Image Source="currentlocation.png" HorizontalOptions="Start" VerticalOptions="Start"
                                                       HeightRequest="20" Margin="10,0,5,0"
                                                       ></Image>

                                                    <StackLayout Orientation="Vertical" Margin="0" HorizontalOptions="FillAndExpand">

                                                    </StackLayout>

                                                </StackLayout>

                                                <StackLayout Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"  Margin="0" >
                                                    <Grid>
                                                        <StackLayout Orientation="Horizontal" Margin="0"   IsVisible="{Binding ButtonOn}">

                                                            <Image Source="start.png" HorizontalOptions="Start"
                                                                    HeightRequest="20" Margin="10,0,5,0"
                                                                   VerticalOptions="Start">

                                                            </Image>

                                                        </StackLayout>

                                                        <StackLayout Orientation="Horizontal" Margin="0"  IsVisible="{Binding ButtonOff}">

                                                            <Image Source="stop.png" HorizontalOptions="Start"
                                                                    HeightRequest="20" Margin="10,0,5,0"
                                                                   VerticalOptions="Start">

                                                            </Image>

                                                        </StackLayout>

                                                    </Grid>

                                                </StackLayout>

                                            </Grid>
                                        </Frame>

                                    </ViewCell.View>
                                </ViewCell>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>

A: NotifyPropertyChanged("Selected"); it should be NotifyPropertyChanged("Location");


text:
Q: How to change keyboard shortcut in Budgie Files 3.26.3? I am using Ubuntu Budgie 18.04.
I would like to change default keyboard shortcut for action "go to next tab" from ctrl+page up to ctrl+tab

I went to global Settings > Devices > Keyboard but I can't find this shortcut to change.

I thought I could use dconf editor but I don't know where to look in the settings tree.

A: Budgie desktop is using the default gnome file manager, nautilus. Unfortunately, there is no easy way to change these key bindings. These key combinations appear to be hard coded in nautilus, and cannot be changes without editing the source code and recompiling the program.
Some time ago, gnome developers decided not to enable Ctrl+Tab for tab switching.
For the Gnome editor gedit, a third party plugin allows to enable tab switching with Ctrl+tab. I am not aware of any tool that would enable this for nautilus.

A: My Friend here is the right way to change or create new "bind" for your keys :

Example file for services that require global keybinding services drop
a .bde extension file into /etc/budgie-extras-daemon/bde/ or
/usr/share/budgie-extras-daemon or the install location appended with
bde either/both toggle / command need to be specified
[Daemon] shortcut=key shortcut to bind e.g. s
toggle=GSettings full-gsettings-path
key-is-bool-to-toggle-when-shortcut-activated command=command line to
execute when shortcut activated onlyactivate=GSettings
full-gsettings-path key-is-bool-bind-shortcut-only-when-true
overlay=GSettings full-gsettings-path key-is-string-set-to-empty used
with onlyactivate to set key to '' if true or reset to default key
value if onlyactivate is false name=short name to describe what this
shortcut is all about.

This documentation is in the directory :

/usr/share/budgie-extras-daemon

This works for all shortcuts that are internal to the system Ubuntu Budgie


text:
Q: Having difficulty with javascript(node.js) that needs to be synchronous I have an express.js app that needs to run a script on the server in order to derive some values using functions later. Here's the gist of it:
shell.exec(commandString);

readFolder();

renderPage();

Essentially, I need to run a script on the server, then run the second function, then run the third function. These need to happen subsequently, but it seems that javascript moves on ahead with the the second and third function no matter what I do. I've tried promises, async, callbacks. All of which I only partially understand and seem to get zero progress.
I will admit that I am a javascript novice. I am working on a project with others and this task fell to me. I doubt this is the best way to accomplish our ultimate goals, but I am left with little choice. please help.
I'll put the entire post here for reference:
//Run script when post is rec'd from root and send to results page
app.post("/", (req, res) => {
var commandString;

//take values and create complete command for Astrum script
commandString = 'bash /home/astrum/Main/Astrum.sh -s ' + req.body.speed + ' -h ' + req.body.host + ' -u ' + req.body.username + ' -p ' + req.body.password;

//execute command in shell
shell.exec(commandString);

readFolder();

renderPage();

//Iterate thru filenames to create arrays for links and link labels
function readFolder() {

    fs.readdir('./reports/html/', (err, files) => {

        //variable & method for links to html records pages
        ipAddressesLink = files; //this is initialized earlier, globally

        //variable and method to remove file extension for link labels in pug
        ipAddresses = files.map(removeExtension); //this is initialized earlier, globally

    });

}

//function to remove last five characters of each element
function removeExtension(value) {

    return value.substring(0, value.length - 5);

};

//function to render the page
function renderPage() {

    res.render("results", {ipAddressesLink, ipAddresses, title: 'Results'});

}

res.end();

});

A: Is shell here the child_process module? If it is then you can pass an optional callback argument and call your functions from there.

shell.exec(commandString, (error, stdout, stderr) => {
  const files = readFolder();
  renderPage(files);
});

function readFolder() {
  ...
  return fs.readdirSync(files);
}

function renderPage(files) {
  ...
}

A: You could write it this way:
shell.exec(commandString, (error, stdout, stderr) => {
  // Calling the 1st function after shell command is executed
  readFolder();
});

function readFolder() {
  fs.readdir('./reports/html/', (err, files) => {
    // Some stuff
    ...
    // Calls the 2nd function after fs is done reading files
    renderPage();
  });
}

function renderPage() {
  const options = { ... }; // IP addresses etc.
  res.render(
    "results",
    options,
    // Calls the final function after render is finished
    sendResponse
  );
}

function sendResponse(err, html) {
   // Sends the response. It's possible that res.send() is the better solution here
   res.end();
}

It's just the general structure of the callback chain, definitely not the cleanest one. If you want better code structure and readability try switching to async / await syntax.


text:
Q: After insert not working all id columns has auto_increment
In my trigger:
    ALTER trigger [dbo].[mytrig]
on [dbo].[requests]
after INSERT, UPDATE
as
begin
declare @MyId1 int
set @MyId1 = (select Id from inserted)
declare @MyId2 int
declare @MyId3 int
if (select column1 from inserted) = 1
begin
insert into [dbo].[contracts] select column1,column2,column3 .... from inserted
set @MyId2 = SCOPE_IDENTITY()
insert into [dbo].[History] select column1,column2,column3 ....  from inserted
set @MyId3 = SCOPE_IDENTITY()
insert into [dbo].[contracts_depts](Id_Contract ,column5)  select @MyId2,column6 from request_depts where Id_request=@MyId1
insert into [dbo].[History_depts]  (Id_InHistory,column5)  select @MyId3,column6 from request_depts where Id_request=@MyId1
end
end

@MyId1 returns value only after update but not after insert. Do I have to use scope_identity() or something ?

A: Your main issue is: you're assuming the triggers is called once per row - that is NOT the case!
The trigger is called once per statement, and if your statement affects multiple rows, the Inserted pseudo table will contain multiple rows - so your statement here
set @MyId1 = (select Id from inserted)

really isn't going to work - it will select one arbitrary row (out of however many there are).
You'll need to rewrite your trigger to take this fact into account! Assume that Inserted contains 100 rows - how do you want to deal with that? What are you trying to achieve? Triggers don't return values - they will record into an audit table, or update other rows, or something like that ....


text:
Q: MAKING GAME BOARD: How do you shorten this code of creating array, and how do you print them out? I'm working on a gameboard that prints out something like this:

Here's the code I wrote
    void showBoard() {

    String city1, city2, city3, city4, city5, city6, city7, city8, city9, city10;

// I wrote like this because I want each box to have the size to hold 11 characters.
    city1 = "Cario      ";
    city2 = "Phuket     ";
    city3 = "New delhi  ";
    city4 = "Hanoi      ";
    city5 = "Paris      ";
    city6 = "LA         ";
    city7 = "Sydney     ";
    city8 = "Tokyo      ";
    city9 = "Seoul      ";
    city10 = "START     ";

    char[][] cities = new char[10][];

    for (int i = 0; i < 10; i++) {
        cities[i] = new char[11];}

    cities[0] = city1.toCharArray();
    cities[1] = city2.toCharArray();
    cities[2] = city3.toCharArray();
    cities[3] = city4.toCharArray();
    cities[4] = city5.toCharArray();
    cities[5] = city6.toCharArray();
    cities[6] = city7.toCharArray();
    cities[7] = city8.toCharArray();
    cities[8] = city9.toCharArray();
    cities[9] = city10.toCharArray();

    for (int i = 0; i < 11; i++)
        System.out.print(cities[0][i]);

    for(int k = 0; k < 2; k++) {

        for (int q = 0; q < 5; q++) {
            for(int i = 0; i < 13; i++) {
                    System.out.print("-");}}

        System.out.println();

//There's the <Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 10 out of bounds for length 10 > error because of the code from here....
        for(int i = 0; i < 2 ; i++) {
            for(int j = 0; j < 5; j++) {
                for (int q = 0; q < cities.length; q++) {
                    if (q%11 == 0)
                        System.out.print("|");
                    else {
                        for (int p = 0; p < cities[q].length; p++ )
                            System.out.print(cities[p][q]);
                        }
                    }

                System.out.print(" ");
            }
            System.out.println();}
//to here

        for (int q = 0; q < 5; q++) {
            for(int i = 0; i < 13; i++) {
                    System.out.print("-");}}

        System.out.println();

        if (k == 0) {
        for(int i = 0; i < 65; i++) {
            if (i == 0)
                System.out.print("↑");
            else if (i == 64)
                System.out.println("↓");
            else
                System.out.print(" ");}}
    }

    System.out.println();

}

There are two problems that I really can't solve:
1.Shortening the code for cities[0~9] = city1~10.toCharArray();
2.Printing out the arrays like the image.
The couln't print nice seperate boxes, so I just made the boxes like they're inside fallen ladders

A: Here are the results from one of my test runs.
-----------------------------------------------------------------------
| Cario       | Phuket      | New Delhi   | Hanoi       | Paris       |
|             |             |             |             |             |
-----------------------------------------------------------------------

-----------------------------------------------------------------------
| Los Angeles | Sydney      | Tokyo       | Seoul       | START       |
|             |             |             |             |             |
-----------------------------------------------------------------------

I wrote a method to give me the length of the city with the longest name.  I tested this method.
Then, I wrote a method to create the dashed line.  I tested this method.
Then I wrote a method to give me the line with 5 of the 10 city names.  I tested this method several times.  I fixed problems that cropped up in the previous methods.
Then I put all the methods together to create the output you see.
Write a little, test a lot.  There's no way you can write an entire method like showBoard and expect it to work properly.  Write a little, test a lot.  And use methods to separate logical blocks of code.
I couldn't be bothered to look up the arrow symbols.  I leave that bit of code to you.
Here's the complete runnable code.
public class ConsoleGameBoard {

    public static void main(String[] args) {
        System.out.println(new ConsoleGameBoard().showBoard());
    }

    public String showBoard() {
        String[] cities = { "Cario", "Phuket", "New Delhi", "Hanoi", "Paris",
                "Los Angeles", "Sydney", "Tokyo", "Seoul", "START" };
        StringBuilder builder = new StringBuilder();
        int maxLength = getMaximumLength(cities);
        builder.append(createDashedLine(cities, maxLength));
        builder.append(createCityNameLine(cities, 0, maxLength));
        builder.append(createBlankNameLine(maxLength));
        builder.append(createDashedLine(cities, maxLength));
        builder.append(System.lineSeparator());
        builder.append(createDashedLine(cities, maxLength));
        builder.append(createCityNameLine(cities, 5, maxLength));
        builder.append(createBlankNameLine(maxLength));
        builder.append(createDashedLine(cities, maxLength));

        return builder.toString();
    }

    private StringBuilder createDashedLine(String[] cities, int maxLength) {
        StringBuilder builder = new StringBuilder();
        int dashLength = (maxLength + 1) * cities.length / 2 + 2 * cities.length / 2 + 1;
        for (int index = 0; index < dashLength; index++) {
            builder.append('-');
        }
        builder.append(System.lineSeparator());
        return builder;
    }

    private StringBuilder createCityNameLine(String[] cities, int startIndex, int maxLength) {
        String formatter = "%-" + maxLength + "s";
        StringBuilder builder = new StringBuilder();
        for (int index = startIndex; index < startIndex + 5; index++) {
            builder.append("| ");
            builder.append(String.format(formatter, cities[index]));
            builder.append(" ");
        }
        builder.append("|");
        builder.append(System.lineSeparator());
        return builder;
    }

    private StringBuilder createBlankNameLine(int maxLength) {
        String formatter = "%-" + maxLength + "s";
        StringBuilder builder = new StringBuilder();
        for (int index = 0; index < 5; index++) {
            builder.append("| ");
            builder.append(String.format(formatter, " "));
            builder.append(" ");
        }
        builder.append("|");
        builder.append(System.lineSeparator());
        return builder;
    }

    private int getMaximumLength(String[] cities) {
        int maxLength = 0;
        for (int index = 0; index < cities.length; index++) {
            maxLength = Math.max(maxLength, cities[index].length());
        }
        return maxLength;
    }

}


text:
Q: Is it possible to stub nokogiri xml search methods? Let's say that I have a method that looks like this:
def raise_if_client_status_error(xml_resp) # xml_resp is Nokogiri::XML object
  unless xml_resp.at('StatusCode').text == 'Success'
    raise ClientError, xml_resp.at('StatusMessage').text
  end
end

Is it possible to create an xml_resp_mock and stub the chained call -- .at('StatusCode').text -- to return 'Success'?  I'm unsure of the syntax to use, if it's at all possible.

A: It is not necessary to mock Nokogiri in your tests, because it doesn't exhibit any of the reasons to mock on c2 or reasons for use on wikipedia. It would be better to pass in a document with  <StatusCode>Success</StatusCode> instead. It would be best to mock the methods of the object that would normally read the xml response from the network.


text:
Q: issue with app selector in IE 8 salesforce I am facing UI issue on salesforce app navigation dropdown in IE8 standard:
we dont have any css added for home page components, Please suggest any solution.
Issue is not reproducing on any other browser

Thanks in advance
Another Issue with different application selection


text:
Q: boto3: elastic beanstalk --> 'create_environment' with RDS DB instance? I have a web server, load balancing, auto scaling, vpc, beanstalk environment with RDS DB instance attached.
I use EB CLI eb create with --database to create beanstalk environments.
I'd like to use boto3 create_environment instead.
Although I'm using OptionsSettings to define the RDS database configuration, it is creating the environment without RDS.
Does anyone know how to create an environment with and RDS instance using boto3?
Here is the boto3 command I'm using with only the RDS portion of my OptionsSettings ():
eb_client = boto3.client('elasticbeanstalk')

response = eb_client.create_environment(
    ApplicationName='APP',
    EnvironmentName='ENV',
    CNAMEPrefix='CNAME',
    Tier={
        'Name': 'WebServer',
        'Type': 'Standard'
    },
    SolutionStackName='64bit Amazon Linux ...',
    OptionSettings=[
        ...

        {
            'Namespace': 'aws:rds:dbinstance',
            'OptionName': 'DBEngineVersion',
            'Value': '5.6'
        },
        {
            'Namespace': 'aws:rds:dbinstance',
            'OptionName': 'DBPassword',
            'Value': 'PASSWORD_HASH'
        },
        {
            'Namespace': 'aws:rds:dbinstance',
            'OptionName': 'DBAllocatedStorage',
            'Value': '5'
        },
        {
            'Namespace': 'aws:rds:dbinstance',
            'OptionName': 'DBInstanceClass',
            'Value': 'db.t2.micro'
        },
        {
            'Namespace': 'aws:rds:dbinstance',
            'OptionName': 'DBEngine',
            'Value': 'mysql'
        },
        {
            'Namespace': 'aws:rds:dbinstance',
            'OptionName': 'DBUser',
            'Value': 'ebroot'
        },
        {
            'Namespace': 'aws:rds:dbinstance',
            'OptionName': 'DBDeletionPolicy',
            'Value': 'Snapshot'
        },

        ...
    ]
)


text:
Q: C# Use checkBox in dataGridView and get sum rows of a column that checked is true I locate a column checkBox as column0 in datagridview. I want to get sum rows of column1 that column0 checked is true. I used  this code :
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
    double sum = 0;

    for (int i = 0; i < dataGridView1.Rows.Count; ++i)
    {
        if (Convert.ToBoolean(dataGridView1.Rows[i].Cells[0].Value) == true)
        {
            sum += double.Parse(dataGridView1.Rows[i].Cells[1].Value.ToString());
        }
    }

    textBox1.Text = sum.ToString();
}

but it doesnt work correctly.

A: How about something like this
textBox1.Text = (dataGridView1.Rows.Cast<DataGridViewRow>()
      .Where( r => Convert.ToBoolean(r.Cells[0].Value).Equals(true))
      .Sum(t => Convert.ToInt32(t.Cells[1].Value))).ToString();

A: To select all the check boxes in the check box column in C# DataGridView:
        for (int i = 0; i < dataGridView1.Rows.Count; ++i)
        {
            dataGridView1.Rows[i].Cells[0].Value = true;
        }


text:
Q: How to display entities taken from XML with Javascript? There MUST be an easy way to do that! I didn't want to ask this question again if somebody already asked it but I couldn't find something similar in this site... anyway :
So I have a XML file :
<marker>This is a test & it's fun. é</marker>

So when I read this XML file with Javascript, I want to put it in a text input of a form, but it comes out with the & amp; etc instead of :
This is a test & it's fun. é

I really don't understand why I'm having so much problem finding a way to show the text right... Don't we all have the same problem with XML??? Help me!! In PHP, this would be sooo easy :(
Thanks a bunch in advance

A: Your XML isn't well-formed, so you probably isn't reading it as xml but plain text
Through DOM, you'll get & and ' correctly, but an error on é (undefined character entity)
EDIT
Since you don't have problems opening that file as XMLDOMDocument, you should be able to run following code into your browser. Make sute to create a SPAN tag to display that text:

var text = xmldoc.selectSingleNode("//marker").text;
document.getElementsByTagName("SPAN")[0].innerHTML = text;
alert(text);


text:
Q: How do I exit Python if run from command line, otherwise print stack trace I want to exit Python if I encounter an exception in my function if that function is being executed from the command line, but want to raise an exception and print a stack trace if the my function is not run from the command line.
Right now I have
    try:
        #...
    except Exception as e:
        print('ERROR: Some useful message')
        if __name__ == '__main__':
            raise SystemExit
        else:
            raise e

but I feel like I'm either doing too much here, or too little.
Is there an idiomatic way to get a stack trace with the original exception when my function is run from the command line; but simply exit if it is being run from the command line?

A: The better way would be to do this:
import sys

def func():
    do_actual_processing()
    if not successful:
        raise Exception("Yadayada")

if __name__ == '__main__'
    try:
        func()
    except Exception as e:
        sys.exit(1)

That is, the function itself does not need to be concerned with whether or not it is run from command line.


text:
Q: C++ How to make a non void function return nothing for if else statements? So my problem goes like this:
string something (string something){
    string letter;
    cout << "press a";
    cin >> letter;
    if (letter==a){
        return a;
    }
    else
    cout << "wrong letter";
    //what should I put here if I don't want it to return any value?
}

Any alternatives would also be welcome

A: One way to handle this would be a std::optional<std::string>
#include <optional>

std::optional<std::string> dingas(std::string something)
{
    string letter;
    cout << "press a";
    cin >> letter;
    if (letter==something){
        return "a";
    }
    else
    {
        std::cout << "wrong letter";
        return std::nullopt;
    }
}

[1] https://en.cppreference.com/w/cpp/utility/optional

A: If you want to read a single character you could use a char. However, if the function is declared to return a std::string but you do not want to return a std::string you have several options:

*

*return an empty std::string

*change signature to bool something(std::string& out) such that the return value signals sucess and when it is true the result is written to out.

*change the return type to std::optional<std::string>. A std::optional<std::string> either contains a std::string or not.

*throw an exception instead of return
Which one you pick is up to you. Exceptions should be used for exceptional cases, so you need to decide if not returning is "normal" or exceptional. It will require the caller to handle the exception. bool something(std::string&) is similarly inconvenient for the caller, because they need to check the return value and provide the string to be used. Usually a sentinal value (ie giving special meaning to the empty string) can cause problems, because one day you might confuse the sentinal with a proper return value. Though, as the function either returns a string with a single character or not, this isnt a big issue. I'd prefer the std::optional, but thats just my biased opinion.

A: Consider using the exception mechanism for this: this carries the advantage that you can keep a reasonable return type, and you can also delegate handling of the exception to the caller of the function.
First, write
struct WrongLetterException : public std::exception{};

Then change the function to
std::string something (std::string something/*ToDo - is this correct?*/){
    std::string letter;
    std::cout << "press a";
    std::cin >> letter;
    if (letter == "a"/*note the change here*/){
        return a;
    }
    throw WrongLetterException();
}

In the caller to the function, you then catch (const WrongLetterException& ex) and deal with it as you see fit.


text:
Q: Custom jQuery UI that doesn't have dialog and modal, needs a background overlay under the dialog box If I'm clicking on the second image with the pink background, a dialog appears. I need a background overlay under it which doesn't appear when I'm using modal: true because I have a customized library in my project. How can I add this background under the dialog box without using modal: true?

$(function() {
    $( "#dialog" ).dialog({
       //modal: true,
       autoOpen: false,
    });
    $(".images").find("a").eq(1).on('click', function(e) {
        e.preventDefault();
        setTimeout(() => {
            window.location.href = $(this).prop("href");
        }, 5000);
        $( "#dialog" ).dialog( "open");
    });
});
#dialog {
        display: none;
    }

img {
        width: 300px;
        height: 250px;
        object-fit: cover;
    }

    <link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" />

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quod amet, et minus commodi repellendus hic? Ut eos blanditiis quis provident.

A: You need to move the dialog event within the click function for dialog to be initialized at the same when you the click event occurs.
To change the background pink you can either use CSS with !important rule OR you can use addClass to the your dialogue when it opens.
Edit: Since you do not want the modal: true option for your library reasons. You can use addClass and removeClass of jQuery to add a custom modal to you body and remove the class on dialogue close.
Live Working Demo: (Both images showing dialogue with pink background modal)

$(function() {

  $(".images").find("a").on('click', function(e) {
    e.preventDefault();

    //dialog box
    $("#dialog").dialog({
      autoOpen: false,
      open: function(e) {
        $('body').addClass('modal');
      },
      close: function(e) {
        $('body').removeClass('modal');
      }
    }).dialog("open");

    //Href
    setTimeout(() => {
      // window.location.href = $(this).prop("href");
    }, 5000);
  });
});
img {
  width: 300px;
  height: 250px;
  object-fit: cover;
}

.modal {
  background-color: pink;
  opacity: 1;
  overflow: auto;
}

#dialog {
    display: none;
}

<link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" />

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quod amet, et minus commodi repellendus hic? Ut eos blanditiis quis provident.


text:
Q: String values not matching C++ Hi generous people of StackExchange,
I'm working with C++ and I've seemed to run into the error of not being able to match two string values properly. I have the code in main:
/**
*   Author: Kevin Hill
*   Assignment: Project5
*   Description: VehicleDB
**/

#include <iostream>
#include <string>
#include <fstream>
#include <stdlib.h>
#include "Vehicle.h"
//#include "Truck.h"
//#include "Car.h"

using namespace std;

bool checkLine(string, string);

int main(int argc, char const *argv[])
{

    string fileName; //This is the file name
     //Vehicle array
    ifstream file; //Instantiate file
    string sLine;
    Vehicle **vehArr;

    //Tell user to enter data
    cout << "Enter the file name: ";
    cin >> fileName;
    file.open(fileName.c_str());
    if(!file.is_open()){
        cerr << "The file is not there" << endl;
        return 1;
    }

    //Get first line of file to determine size of vehArr
    for (int i = 0; !file.eof(); ++i)
    {
        if (i == 0){
            getline(file, sLine);
            break;
        }
    }

    int arrSize = atoi(sLine.c_str());
    vehArr =  new (nothrow) Vehicle*[arrSize];
    string truck = "truck";
    string car = "car";
    while(!file.eof()){
        getline(file, sLine);
        string stuff = sLine;
        checkLine(stuff, car);
    }

    // Test add Truck and Car objects
    // vehArr[0] = new Car(file);
    // vehArr[1] = new Truck();

    string theLine = "";

    // checkLine("one", "one");

    // cout << "Beginning loop" << endl;

    // for (int i = 0; !file.eof(); ++i){
    //  getline(file, theLine);

    //  // if(theLine == "car"){
    //  //  vehArr[i] = new Car(file);
    //  //  i++;
    //  // }
    //  // if (theLine == "truck"){
    //  //  vehArr[i] = new Truck(file);
    //  //  i++;
    //  // }
    //  // if (i == arrSize){
    //  //  break;
    //  // }
    // }

    return 0;
}

bool checkLine(string one, string two){

    // if (one == two)
    // {
    //  /* code */
    // }

    if (one == two)
    {
        cout << "It's a " << two << endl;
    }
    // cout << one << endl;
    // cout << two << endl;

    return true;
}

As you can see, I commented the code out to get rid of all the stuff that's not important for my problem. When I read my file I try to make a match of all the lines that equal car. It should work because I tried having all lines equal themselves and that worked, but having the lines equal car alone just didn't work out. I'm now stuck on this one thing.
This is the text file it's reading from:
5
car
11111
Ford
Fusion FWD
Red
24999.00
3
AC
795.00
XM
295.00
Leather Seats
495.00
20
28
car
22222
Volvo
V70 FWD
White
42999.00
2
Child Seats
198.00
17" wheels
698.00
14
22
car
33333
Honda
Accord
Silver
19999.00
1
Tinted Windows
175.00
22
31
truck
44444
Freightliner
FLD SD
Red
119999.00
1
Detroit Diesel Series 60
4999.00
10 speed manual
455
truck
55555
Mack
TerraPro Cabover MRU612
White
125000.00
1
Dual Air Brake System
6000.00
8 speed manual
325

It's necessary for me to actually complete my assignment, but I can't figure out how fix this. Please help me.

A: I thank WhozCraig and for giving me the answer. There was probably come indexing issue that occured because I used !file.eof() instead of file >> data.
So here was the minor code difference:
string truck = "truck";
string car = "car";
//Old version
 while(!file.eof()){
    getline(file, sLine);
    string stuff = sLine;
    checkLine(stuff, car);
 }

string data;
while(file >> data){
// cout << data << endl;
checkLine(data, car);
}


text:
Q: Translate Yii messages service Messages (strings) that are used in my web application are automatically exported by Yii to .php files having content such as the following:
return array (
  'Company' => '',
  'Name' => '',
  'Description' => '',
);
Do you know of any service that automatically imports such messages generated by the Yii framework in order to have them translated? I am primarily interested in not having to convert to other file formats such as .po or .xml. For instance, launchpad would have been a solution to my problem if I didn't have to convert to .po.
Thank you in advance for your assistance.
`

A: You can use this extension to utilize the popular gettext extension, then in your code, whenever you want to mark your string for translation, you can just wrap it with a special function call (after configuring it in Yii config of course):
return array ( 'company' => _('Company'),
    'name' => _('Name'),
    'description' => _('Description'),
);

then you can use the xgettext script to extract the template file (.POT file) that will contain the actual translation of the strings:

xgettext -j -o index.pot index.php

Then extract PO file using msginit
All you have to do after that is to translate the content in the index.po file and so on...


text:
Q: C - Different array behavior linux/windows? I have a litle probem with C programming. I have to write a programm for the university and I wrote the whole programm on my windows pc.
I tried it afterwards on a linux system and I got different output.
Here is the code:
char *compress(char *input,int lineSize)
{
    int n = 0;
    char *compr = (char*)malloc(lineSize * sizeof(char));
    //compr++;

    char c = *input;

    while(*input != '\0')
    {
        printf("compr: %s\n",compr);
        if(*input != c)
        {
             snprintf(compr,lineSize,"%s%c%d",compr,c,n);

             n = 0;
             c = *input;
             n++;
        }
        else
        {

            n++;
        }

        input++;

    }

    snprintf(compr,lineSize,"%s%c%d%c",compr,c,n,'\0');
    printf("compr: %s\n",compr);

    return compr;
}

this works as it should on my windows pc, but when I run it on linux I get a file writing error + the "compr" array is empty :/
I hope anyone could help me, couldnt find any solution.
thanks

A: Compile with warnings:
warning: function returns address of local variable [enabled by default]

Another possible problem:
snprintf(compr,lineSize,"%s%c%d%c",compr,c,n,'\0');

From the sprintf man page:

Some programs imprudently rely on code such as the following
sprintf(buf, "%s some further text", buf);
to append text to buf. However, the standards explicitly note that the
  results are undefined if source and destination buffers overlap when
  calling sprintf(), snprintf(), vsprintf(), and vsnprintf(). Depending
  on the version of gcc(1) used, and the compiler options employed,
  calls such as the above will not produce the expected results.


text:
Q: Can I specify which VCS module or adaptor is used by a Luntbuild buiulder or schedule? I have luntbuild set up and working great for my project, with several different builder schedules running on trunk.  Now, I just created a branch, and I want to add at least one schedule (and corresponding builder, if necessary) to build that branch (I want the branch built separately from trunk).
Is this possible?  Some others in my company have just created separate projects in Luntbuild for their branches, but I feel like that might not be the ideal solution.
So, to reiterate, I want to build this branch continuously.  If I just add a second module to the current setup, it tries to build both trunk and the branch together.  I want them build separately.
Thanks for any insight!
EDIT: The bounty is about to end, and still no answers.  I have worked around the original problem by creating a new project in LB, but I feel like there must be a better way.

A: Although I've never used Luntbuild before, continuous integration does interest me. I found the following link and hope it is of use to you: http://osdir.com/ml/java.luntbuild.user/2007-10/msg00088.html
Please drop a comment on this if it does work, I am rather curious to see what the final solution is. Good luck!


text:
Q: call java script function from flash as3 android app to retrieve device id and serial no? i want to call a java script function using flash as3 to get android device id and build serial no. I'm creating a android app. Is it possible to do that? or is there any way to get device id and build serial no using flash as3 ?

A: Use a Native Extension to get a unique ID for the device.
For example this one: http://distriqt.com/native-extensions#application
I don't understand where JS fits in all this though... to use a native extension you will have to compile in Adobe Air for Android, not flash Player.
Usually ANEs come compiled in an .ane file. You have to include that file in the Actionscript settings of your popject, and then use it from your code like any other AS3 package. Most likely the ANE developer has some example on how to use it in AS3.
Here's a a beginner tutorial on how ot use ANEs
http://www.adobe.com/devnet/air/articles/using-ane-in-flash.html
Here's more info about ANEs
http://www.adobe.com/devnet/air/native-extensions-for-air.html


text:
Q: What causes Hibernate infinite loop at EntityType.java:677? Running Hibernate 4.3.5, I get an infinite loop here, leading to a StackOverflowError:
org.hibernate.type.EntityType.getIdentifierOrUniqueKeyType(EntityType.java:677)

The method in question is:
public final Type getIdentifierOrUniqueKeyType(Mapping factory) throws MappingException {
    if ( isReferenceToPrimaryKey() || uniqueKeyPropertyName == null ) {
        return getIdentifierType(factory);
    }
    else {
        Type type = factory.getReferencedPropertyType( getAssociatedEntityName(), uniqueKeyPropertyName );
        if ( type.isEntityType() ) {
            type = ( ( EntityType ) type).getIdentifierOrUniqueKeyType( factory );
        }
        return type;
    }
}

Has anyone run into this issue before or know what causes it?

A: Figured it out, I had created two one-to-one relationships on either end:
<one-to-one name="payment" property-ref="invoice" lazy="proxy" />
<one-to-one name="invoice" property-ref="payment" lazy="proxy" />

Sends Hibernate into an infinite loop. I'll see if there is a bug report on this on Hibernate, because it would not seem impossible to add a check for this and a better error message.
Replacing one end of the relationship with:
<many-to-one name="payment" column="payment_id" unique="true" lazy="proxy" />

Fixed the problem.


text:
Q: MAPI in XBAP Application I'm building an XBAP application to sit within an iFrame, which plays media files.  I have a button that I want to be able to click once and compose an email with the media files attached.  All the code I have written for handling the MAPI has been testing in standard C# application and works, but in most cases won't in the XBAP.
For i have tried to the following:

*

*Written a C# class for handling the MAPI dll

*Written a C++ DLL for calling MAPI, and embedded it into the XBAP (extracted when used)so that it can be used when opened.

as i said, none of these method work.
Any suggestions would be greatly appreciated.

A: XBAPS have a limited set of permissions and I don't think that includes sending email.
You'd need to create a webservice that sends emails and connect to that.

A: Are you aware that XBAP application run in a partial trust environment.
You say "in most cases won't in the XBAP" but don't give any indication of exactly what the problems you are experiences are - are you getting compilation errors, security errors, or some other runtime error.
See the following link for details on Partial Security and WPF:
http://msdn.microsoft.com/en-us/library/aa970910.aspx


text:
Q: File name not showing in file input in bootstrap I have this html code

  <link rel="stylesheet" href="./Depd/bootstrap.min.css">

      <input type="file" class="custom-file-input" id="inputGroupFile04" aria-describedby="inputGroupFileAddon04">
      Choose file

      <button class="btn btn-outline-secondary" type="button" id="inputGroupFileAddon04">Button</button>

When I run and try to upload a file by clicking browse and select a file i want to change the label text to the name of the file I uploaded how can I achieve that?
I'm using bootstrap. If you don't use bootstrap and use normal html it works in default way and shows the file name. But I have to use bootstrap here. So, please suggest a solution that goes with bootstrap.

A: You're going to need to use some JavaScript for this. I'll walk you through the steps: First detect when a file gets uploaded, then get the file name and update the label contents with the filename. Below is a brief example.

let input = document.getElementById("inputGroupFile04");
let label = document.querySelector("label[for='inputGroupFile04']");
input.addEventListener("change", e => {
  label.innerText = input.value.split(`C:\\fakepath\\`)[1];
});

  <link rel="stylesheet" href="./Depd/bootstrap.min.css">

      <input type="file" class="custom-file-input" id="inputGroupFile04" aria-describedby="inputGroupFileAddon04">
      Choose file

      <button class="btn btn-outline-secondary" type="button" id="inputGroupFileAddon04">Button</button>

If you require any more clarification please don't hesitate to ask.


text:
Q: Java JFrame Removing Components Weirdly by Accident My Java JFrame project has been buggy with the components, removing everything JComboBox has used in space.
The video example of the bug in my program can be viewed visually here.
Main code is as below. You can replicate it by replacing the 3 Panels with random JCombobox(es) and using the main class to call it.
Any help would be appreciated.
package com.company;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class DisplayPage extends JFrame implements ActionListener {

    EnterDetailsPage newRecord;
    ViewMore viewMoreRecord;
    ViewPage viewRecord;
    JPanel contentPanel = new JPanel(new FlowLayout());

    public DisplayPage(){
        setLayout(new BorderLayout());
        setSize(900, 600);
        setTitle("Add Flight Details");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        setPage(1);
        MenuSection menuSection = new MenuSection();

        //Add action listener to buttons
        menuSection.addNewButton.addActionListener(this::addActionPerformed);
        menuSection.updateButton.addActionListener(this::updateActionPerformed);
        menuSection.viewButton.addActionListener(this::viewActionPerformed);

        add("West", menuSection.getMainMenu());
        add("Center", contentPanel);
        setVisible(true);
    }

    public void setPage(int selection){
        contentPanel.removeAll();
        contentPanel.revalidate();
        //contentPanel.repaint();
        switch (selection) {
            case 1:
                newRecord = new EnterDetailsPage();
                contentPanel = newRecord.getTotalPanel();
                break;
            case 2:
                viewMoreRecord = new ViewMore();
                contentPanel = viewMoreRecord.getViewMorePanel();
                break;
            case 3:
                viewRecord = new ViewPage();
                contentPanel = viewRecord.getUpdatePagePanel();
                break;
        }
        add("Center", contentPanel);
    }

    public void actionPerformed(ActionEvent e){

    }

    public void addActionPerformed(ActionEvent e){
        setPage(1);
    }

    public void updateActionPerformed(ActionEvent e){
        setPage(2);
    }

    public void viewActionPerformed(ActionEvent e){
        setPage(3);
    }
}

A: Instead of bothering making your own GUI, always look through the java documentation in order to check if there is anything similar to what you want to use.
Instead of making your own "MenuSection", there already are JTabbedPanes, which you can use much more easily (without having flickering and other graphical issues).
https://docs.oracle.com/javase/tutorial/uiswing/components/tabbedpane.html
Alternatively, you could use CardLayout.
https://docs.oracle.com/javase/tutorial/uiswing/layout/card.html
Example for CardLayout:
public class DisplayPage extends JFrame implements ActionListener {
 ...

    CardLayout cl;
 ...

    public DisplayPage(){
     ...

        cl = new CardLayout();
        contentPanel.setLayout(cl);
     ...

        contentPanel.add(newRecord,"newRecord");
        contentPanel.add(viewMoreRecord,"viewMoreRecord");
        contentPanel.add(viewRecord,"viewRecord");
     ...
        cl.show(contentPanel,"newRecord");
     }

    public void addActionPerformed(ActionEvent e){
        cl.show(contentPanel,"newRecord");
    }

    public void updateActionPerformed(ActionEvent e){
        cl.show(contentPanel,"viewMoreRecord");
    }

    public void viewActionPerformed(ActionEvent e){
        cl.show(contentPanel,"viewRecord");
    }


text:
Q: industry standards for using google-authenticator with linux users? Would like to ask, particularly those who run large environments with lots of users, if there are any standardized- or industry-recommended ways to securely distribute the verification codes to remote users and/or force the user to rerun google-authenticator the very first time they log in via ssh to a Linux host that is configured with the libpam module requiring a user to enter the unix password plus the verification code every time they log in over ssh? Assuming the system administrator sets up the account, is there a way to either;
(a) not require google-authenticator the first time they log in, and force them to run it so that they can securely retrieve their verification code
-or-
(b) the system administrator runs it for them as part of creating the account, and securely (and easily, given there may be a lot of users) distributes the code plus the unix password to the user?
Note that a system admin can use the "chage" command to force a user to change their unix password the first time they log in.
Am interested in all practical solutions to this, particularly those that are implemented successfully in large environments. How do you get the two-factor codes to new users? Send it via txt message to their cell phones? Write it on pieces of paper and hand it to them? ....?

A: As far as I know, there is no industry standard in regard to google 2fa.
If you have a configuration management solution, you can use it to deploy google 2fa to all your users.
I had the same need as yours, in my case I wrote an Ansible module which installs, configures and displays the emergency keys to the user, expecting the user to be responsible enough to write them down for themselves.
The module also creates a user called "rescue" which can always access the machine.
With a little addition to the module you can make the module export each users emergency keys to some shared network drive which you will manage/backup.
I'm not sure that this is the full answer for you but take a look at my module.

A: I'm not aware of any publicly available solutions (opensource or otherwise) to distribute keys to local systems.  I've done it these two ways.
1) FreeIPA (Redhat IDm)
If you have the option to use FreeIPA for your user management system, you can add TOTP/Google Authentication to all accounts, manage what systems require 2FA with HBAC.
2) Internal application written by developers
In one case, we centrally stored the BASE32 secrets in a SQL Database (with 2016 encryption) and distributed these keys to gateway authentication servers (radius).  These servers each have an agent that pulls keys from an API endpoint and writes them to a specific folder.  Our internal application is also used for other employee information so that is where we expose their QR codes.  We do not use google-auth for the code generation, just the pam module itself.
We also did not write the one-time use keys as these keys would not actually be one time use, and the redistribution of these files would prevent those keys from rotating.
Also take into account local file permissions, service users and selinux, do not run pam as root.


text:
Q: having an error with adding a new record in database I found a really good code how to add and modify a record from this website:
http://www.killersites.com/community/index.php?/topic/3064-basic-php-system-view-edit-add-delete-records-with-mysqli/
When i wanted to add a new record i get this error on my screen:

ERROR: Could not prepare SQL statement.

The error is somewhere around line 43 below
1           NEW RECORD
2
3        */
4   // if the 'id' variable is not set in the URL, we must be creating a new record
5   else
6   {
7       // if the form's submit button is clicked, we need to process the form
8       if (isset($_POST['submit']))
9       {
10          // get the form data
11              $titel = htmlentities($_POST['titel'], ENT_QUOTES);
12              $datum = htmlentities($_POST['datum'], ENT_QUOTES);
13              $omschrijving = htmlentities($_POST['omschrijving'], ENT_QUOTES);
14              $begin = htmlentities($_POST['begin'], ENT_QUOTES);
15              $eind = htmlentities($_POST['eind'], ENT_QUOTES);
16
17          // check that firstname and lastname are both not empty
18          if ($titel == '' || $datum == '' || $omschrijving == '' || $begin == '' ||
19  $eind == '')
20          {
21              // if they are empty, show an error message and display the form
22              $error = 'ERROR: Please fill in all required fields!';
23              renderForm($titel == '' || $datum == '' || $omschrijving == '' || $begin == 24 '' || $eind == '');
25          }
26          else
27          {
28              // insert the new record into the database
29              if ($stmt = $mysqli->prepare("INSERT famevents (titel, datum, omschrijving, 30 begin, eind) VALUES (?, ?)"))
31              {
32                  $stmt->bind_param("ss", $titel, $datum, $omschrijving, $begin, $eind);
33                  $stmt->execute();
34                  $stmt->close();
35              }
36              // show an error if the query has an error
37              else
38              {
39                  echo "ERROR: Could not prepare SQL statement.";
40              }
41
42              // redirec the user
43              header("Location: beheerevents.php");
44          }
45
46      }
47      // if the form hasn't been submitted yet, show the form
48      else
49      {
50          renderForm();
51      }
52  }
53
54  // close the mysqli connection
55  $mysqli->close();

Personally, i do not see what i do wrong here or what goes wrong.....
On this code there is also a $_session going to check that someone is logged in yes or no.
What i was doing:
1. Modified the code to the data i need to get from my database or send to
2. I was trying first to get the <textarea> to work in the <form> but i couldn't do it so i changed it back to just text input. Still a thing what i like to see to work with the code i have so far.
3. Then i saw i was forgotten to modify the code in the section where i add a new record my database tables, like above in the edit section of the code.

After that, the error showed up on my screen..... and i am kinda stuck on how i solve that issue...
Hopefully, you can help me with this..

A: Mistake in statement "INTO" keyword is missing:
prepare("INSERT INTO famevents (titel, datum, omschrijving, 30 begin, eind) VALUES (?, ?)"))


text:
Q: Quaternion algebra of characteristic 2? I've been reading up on quaternion algebras recently and noticed the vast majority of theorems are contingent on setting the characteristic $p \neq 2$. In particular, this is true for the central theorem that all quaternions over the reals are either isomorphic to the 2x2 real matrix algebra or form division rings.
I'm wondering why this is so: what's so special about the characteristic two that it causes quaternions to "break down" algebraically, so to speak?
Dually, are there any concrete examples that can help illustrate why characteristic two is such an anomaly in so far as quaternion algebras are concerned?
Thanks!

A: GROVE attributes these to Huppert in lecture notes 1968/69. This is on page 120. With a field $F$ of characteristic 2, choose any two elements $a,b \in F,$ create a four dimensional vector space with basis $1,i,j,k,$ and create an associative algebra with this multiplication table:
$$
\begin{array}{c|ccc|}
 & i & j & k \\ \hline
i & a & k & aj \\
j & 1+k & b & bi + j \\
k & i + aj & bi & ab + k \\ \hline
\end{array}
$$
Grove has three chapters about characteristic 2; this chapter is about Clifford algebras.

A: The quaternion algebras are in the family of Weyl algebras, who, like their counterparts called Clifford algebras, are intertwined with geometry through bilinear forms.
Basically, geometry of planes for characteristic 2 fields is pathological compared to other fields. For one thing, symmetric and antisymmetric forms are the same thing over characteristic 2 fields. And the connection between bilinear forms and quadratic forms isn't as strong anymore.
So that is my case: it is related to geometry of planes, and planes over characteristic 2 fields misbehave.


text:
Q: WinForms: How to show output of Usb3 Vision webcam I got a task to show frames from camera as fast as possible. The camera is Basler Dart and it can produce more than 70 frames per second. Unfortunately it does not support stream output, but it produce bitmaps.
Now our solution is similar to the one from example from Basler, but it uses PictureBox to show frames. I've read somewhere that it is slow and better solution should be used. I agree that it is slow because it takes 25% of CPU (only camera, rest of app takes only 5%) when displaying all 70 fps. Unfortunately I haven't found the better solution.
private void OnImageGrabbed(Object sender, ImageGrabbedEventArgs e)
{
  if (InvokeRequired)
  {
    // If called from a different thread, we must use the Invoke method to marshal the call to the proper GUI thread.
    // The grab result will be disposed after the event call. Clone the event arguments for marshaling to the GUI thread.
    BeginInvoke( new EventHandler<ImageGrabbedEventArgs>( OnImageGrabbed ), sender, e.Clone() );
    return;
  }

  try
  {
    // Acquire the image from the camera. Only show the latest image. The camera may acquire images faster than the images can be displayed.

    // Get the grab result.
    IGrabResult grabResult = e.GrabResult;

    // Check if the image can be displayed.
    if (grabResult.IsValid)
    {
      // Reduce the number of displayed images to a reasonable amount if the camera is acquiring images very fast.
      if (!stopWatch.IsRunning || stopWatch.ElapsedMilliseconds > 100)
      {
        stopWatch.Restart();

        bool reqBitmapOldDispose=true;

        if(grConvBitmap==null || grConvBitmap.Width!=grabResult.Width || grConvBitmap.Height!=grabResult.Height)
        {
          grConvBitmap = new Bitmap(grabResult.Width, grabResult.Height, PixelFormat.Format32bppRgb);
          grConvRect=new Rectangle(0, 0, grConvBitmap.Width, grConvBitmap.Height);
        }
        else
          reqBitmapOldDispose=false;

        // Lock the bits of the bitmap.
        BitmapData bmpData = grConvBitmap.LockBits(grConvRect, ImageLockMode.ReadWrite, grConvBitmap.PixelFormat);
        // Place the pointer to the buffer of the bitmap.
        converter.OutputPixelFormat = PixelType.BGRA8packed;
        IntPtr ptrBmp = bmpData.Scan0;
        converter.Convert( ptrBmp, bmpData.Stride * grConvBitmap.Height, grabResult );
        grConvBitmap.UnlockBits( bmpData );

        // Assign a temporary variable to dispose the bitmap after assigning the new bitmap to the display control.
        Bitmap bitmapOld = pictureBox.Image as Bitmap;
        // Provide the display control with the new bitmap. This action automatically updates the display.
        pictureBox.Image = grConvBitmap;
        if (bitmapOld != null && reqBitmapOldDispose)
        {
          // Dispose the bitmap.
          bitmapOld.Dispose();
        }
      }
    }
  }
  catch (Exception exception)
  {
    ShowException(exception, "OnImageGrabbed" );
  }
  finally
  {
    e.DisposeGrabResultIfClone();
  }
}

My idea was to move the load to GPU. I've tryed SharpGL (OpenGL for C#) but it seemed that it cannot consume 70 textures per second but I guess it's because I made the solution in 60 minutes with learning basis of OpenGL.
My question is: What should I use instead of PictureBox to improve power and decrease CPU load? Should I use OpenGL or just limit displayed frames (as it's in example)? The PC has only integrated graphics (Intel i3 6th gen).

A: Overall when it comes to performance I would recommend doing some profiling to see where the actual bottleneck is. It is much easier to find performance problems if you have some data to go on rather than just guessing at the problem. A good profiler should also tell you a bit about garbage-collection penalty & allocation rates.
Overall I would say the example code looks quite decent:

*

*There is some rate control, even if the limit of 100ms/10fps looks rather low to me.

*The there does not seem to be much unnecessary copying going on as far as I can see.

*It looks like you are reusing and updating the bitmap rather than recreating it every frame.

Some possible things you could try:

*

*If the camera is a monochrome you could probably skip the conversion stage, and just do a memory copy from the grab-buffer to the bitmap.

*If the camera is a high resolution model you could consider binning pixels to reduce the resolution of the images.

*We are using WritableBitmap in wpf with fairly good performance. But I'm not sure how it compares to a winforms picturebox.

*You could try doing the drawing yourself, i.e. attach an eventHandler to OnPaint of a panel and use one of the Graphics.DrawImage* methods to draw the latest bitmap. I have no idea if this will make any significant performance difference.

*If the conversion takes any significant time you could try doing this on a background thread. If you do this you might need some way to handle bitmaps in such a way that no bitmap may be accessed from both the worker thread and UI thread at the same time.

*The rate control could probably be improved to "process images as fast the UI thread can handle" instead of a fixed rate.

Another thing to consider is hardware rendering is used. This is normally the case, but there are situations where windows will fallback to software rendering, with a very high CPU usage as a result:

*

*Servers may lack a GPU at all

*Virtualization might not virtualize the GPU

*Remote desktop might use software rendering


text:
Q: Adding exception for a file to default programs in windows Windows 10 has a default programs section in settings where we can associate a default program to open the file with its file extension. I have a situation where I want to open all the .py files with VSCode(IDE) except few which I want to associate with python.exe. But when I change the file association it changes for all .py files. Any nice way to handle this without changing extensions back and forth?

A: Disclaimer: This is a workaround. The following method requires administrator permission to change registry values.
Basis: After installing Python (any version), .py file is automatically associated with python.exe. In the following method, that python.exe association with .py extension is preserved. Because anytime we/users execute .py file with python.exe and this default file association helps to do it without typing python.exe in commands. Also Python files can be visually distinguished with blue-yellow pythons :) So what to do? Just add a context menu (i.e. right click dialog box) for .py file only which shows "Edit with VSCode" option.
Procedure: First check if .py is actually associated with python.exe (optional). Run these command:
assoc .py
ftype Python.File

From the first command output, grab the Python.File file type and write a text file as following:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Python.File\shell\Edit with VSCode\command]
@="E:\\VSCode\\Code.exe \"%1\""

Here E:\VSCode\Code.exe is the full path of VSCode executable. The path can be changed with Registry Editor.

Open HKEY_CLASSES_ROOT\Python.File\shell\Edit with VScode\command registry in Registry Editor. Edit the (Default) value with your own VSCode full path. So what does this registry value do? It adds a context menu for Python.File file type (e.g. for .py files) which execute Code.exe C:\path\to\abc.py command.


text:
Q: how to dowload libgl.so.1? So I am running 64-bit hardware with Ubuntu and I am trying to play Quake 3 but I can't install Libgl1.
 sudo apt-get install --reinstall libgl1-mesa-glx:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reinstallation of libgl1-mesa-glx:i386 is not possible, it cannot be downloaded.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

A: As you know, i386 means the package you are trying to install is for 32bit system.
As explained here: https://askubuntu.com/questions/522372/installing-32-bit-libraries-on-ubuntu-14-04-lts-64-bit
you can install 32bit libraries in 64bit system.
At this link we read https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/949606 :

64 bit dev packages contain a 64 bit version of the library file(s) that they provide for linking but not a 32 bit version of the library file(s). In previous versions of Ubuntu, however, it was possible to compile 32 bit applications using the 64 bit dev packages in by installing ia32-libs, which contained the required 32 bit library files.
In the move to multiarch, 32 bit library files are being removed from ia32-libs. Multiarch (I assume) aims to keep the architectures separate, so the generally intended solution is to install the i386 version of the dev package when compiling 32 bit applications, ie side-by-side with the 64 bit dev package.
However, some 64 bit development packages conflict with their 32 bit equivalent. This creates a regressive situation where it is impossible to install them side-by-side - you are forced to either install the 32 bit package, which breaks 64 bit compilations, or the 64 bit package, which breaks 32 bit compilations.
An example is libglu1-mesa-dev, which conflicts with libglu1-mesa-dev:i386. The libglu1-mesa-dev file contains all the necessary development files for 32 bit except for the 32 bit library file. It does contain the 64 bit library file. Since the library file is part of the development files, libglu1-mesa-dev does not contain all the necessary development files for 32 bit, ie it does not contain all the necessary development files for multiarch. I think that it should contain all the necessary files for building multarch applications.
The two workarounds are:

*

*Manually re-install the required i386 dev packages before compiling 32 bit apps, and then manually re-install the required amd64 dev packages before compiling 64 bit apps. This is a real pain.

*Install the i386 binary package (eg libglu1-mesa:i386) and the amd64 dev package (eg libglu1-mesa-dev), and manually create symlinks for the i386 libXYZ.so package (eg sudo ln -s /usr/lib/i386-linux-gnu/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so). This is a more permanent solution but is a real pain to set up, as you have to find each missing library manually, and some library files, like mesa/libGL.so.1, are in subfolders.

A: I was generating a /usr/bin/ld: cannot find -lGL error when attempting to install kivy on ubuntu mate in virtualbox. Using the workaround below, I was able to complete the installation successfully using the following instructions.
sudo apt install libglu1-mesa-dev

A: As an extention to what @GabrieleMartini said (and I'm glossing over a lot of detail, don't crucify me):
Your error message says:
Reinstallation of libgl1-mesa-glx:i386 is not possible, it cannot be downloaded.

First we need to resolve the "cannot be downloaded issue".
Try sudo dpkg --add-architecture i386 (to consider 32-bit packages, per the debian guide),
then sudo apt install libgl1-mesa-glx:i386 again.
While the linked information is a bit dated now, Ubuntu's packages site shows that the intel 32-bit (i386) library for libGL.so.1 is in the libgl1-mesa-glx package.
On a 64-bit (x86_64) system, you're generally going to receive the x86_64-linux-gnu version of the libGL.so.1 binary. When your package manager is setup to also look for 32-bit (i386) packages,
libgl1-mesa-glx:i386 will specify that you want the i386 (32-bit) versions of that package's binaries, and should fix the "missing libGL.so.1" issue.
Hope this helped you :)
The rest is supplementary information if you're curious ...

Basically all

*

*static libraries (bundled with application binaries)

and

*

*dynamic libaries (joined with the application at launch time)

go into some directory (or folder, if that's familiar) called lib
On Linux, a lot of these are in /usr/lib, that is to say, usEr installed libRARIES.
There is a good chance you already had the 64-bit (x86_64) version of the libGL.so.1 binary, located at
/usr/lib/x86_64-linux-gnu/libGL.so.1
and what was missing was the 32-bit analogue at
/usr/lib/i386-linux-gnu/libGL.so.1
which should appear after running sudo apt install libgl1-mesa-glx:i386 which contains the 32-bit version binary of libGL.so.1 (again, according to the somewhat dated Ubuntu's packages site)


text:
Q: How to know if someone else handled OnContextMenu I have a CWnd derived class that has a WM_CONTEXTMENU handler (OnContextMenu), which  has my default context menu.  This class is being used at several places in my application.
Some of the places where it's being used also handle the WM_CONTEXTMENU at the parent level (the window parent).  They basically override the default context menu.
When I am inside the CWnd derived class, I basically want to know if someone else (a window parent) handled the context menu.
for example:
void MyDerivedWnd::OnContextMenu( CWnd* in_pWnd, CPoint in_point )
{
    LRESULT res = __super::Default();

    // Now, how to I know of something happened inside __super::Default();??

    // Show my default menu
    // ...
}

It is possible via the Win32/MFC framework?

A: I found a way to discover if something happened during the default handler implementation.  It may not be the most elegant solution, but here it is:
bool g_bWindowCreated = false;
HHOOK g_hHook = NULL;
LRESULT CALLBACK HookProc(int code, WPARAM wParam, LPARAM lParam)
{
    if( code == HCBT_CREATEWND )
        g_bWindowCreated = true;

    return CallNextHookEx( g_hHook, code, wParam, lParam );
}

void MyDerivedWnd::OnContextMenu( CWnd* in_pWnd, CPoint in_point )
{
    // Setup a hook to know if a window was created during the
    // Default WM_CONTEXT_MENU handler
    g_bWindowCreated = false;
    g_hHook = SetWindowsHookEx( WH_CBT, HookProc, NULL,  GetCurrentThreadId() );

    // Call the default handler
    LRESULT res = __super::Default();

    UnhookWindowsHookEx( g_hHook );

    if( !g_bWindowCreated )
    {
        // Show my default menu
        // ...
    }
}


text:
Q: Where can i download Qt Bridge for photoshop? I downloaded qt design studio, I have photoshop installed but I can't find the plugin, looking at the tutorial https://doc.qt.io/qtdesignstudio/qtbridge-ps-setup.html only the installer program is provided and not the plugin

A: Solved, qt bridge is not available in community version


text:
Q: How to query childs in mongodb using php So here is my collection

And I need to get the records with age 23, I tried this:

$results = $table->find(array('author_details.age' => 23));

But it doesn't work, I'm new to mongoDB, and the documentation is bad!

A: Looking at the document with ID ObjectId("5226e8bcd874593c1400002a") in your collection, author_details.age does not correspond to a property. author_details is not a top-level field; rather, it's nested under a top-level 0 field in the document. I have a feeling that the following query would work:

$results = $table->find(array('0.author_details.age' => 23));

I doubt that you intended to create a field named 0 in your document, so I'd suggest debugging the code used to insert this document, so you can properly create author_details as a top-level field.

But it doesn't work, I'm new to mongoDB, and the documentation is bad!

If you're referring to the documentation on docs.mongodb.org, please consider sharing constructive feedback in the DOCS bug tracker or submitting a pull request with some proposed changes in the GitHub project. Issues with the PHP driver documentation can be reported in the PHP project.


text:
Q: How do I convert a bunch of md files and put them into my page as a prop? My ultimate goal here is to get some .md files' contents and return it to my client
I have some file index.json.ts that may or may not work, but anyway i cant get the file to run. I'd like to say that this code
export const hydrate = true
export const router = true
export const prerender = true
/**
 * @type {import('@sveltejs/kit').PageLoad}
 */
export async function load({ fetch }) {
    const postsData = await fetch("./index.json.ts")
    const posts = await postsData.json()
    return new Response(JSON.stringify(posts))
}

calls the file in the same directory named index.json.ts that, in the abridged version, does this

/** @type {import('@sveltejs/kit').RequestHandler} */
export async function GET({ url }) {
    console.log("6rm") // this doesn't run and i want it to
    const modules: Record<string, () => any> = import.meta.glob("./posts/*.{md,svx,svelte.md}")

    const postPromises = []
   // snip ...
    const pageOfPosts = publishedPosts.slice(0, limit)

    return new Response(JSON.stringify({ body: pageOfPosts }))
}

but instead of working I get
Unexpected token < in JSON at position 0
SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Proxy.<anonymous> (file:///home/rlm/Code/ab/node_modules/@sveltejs/kit/src/runtime/server/page/fetch.js:251:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async load (/src/routes/jobs/+page.js:14:19)

if you go here  you'll see that it's a "fake" fetch, meaning it kind of behaves like the real fetch api, but isn't the real fetch. my expectation is that it acts like a relative path based on the source file using the fetch.
edit: likely relevant that the action all happens in a directory under /routes/jobs, and there's a /routes/jobs/posts dir with 3 .md files I want to load.

A: fetch("./index.json.ts") is incorrect, does not match any route and will thus return a 404, which is why you're getting your error message (a 404 will by default return a blank HTML template and the JSON parser will error out on the opening < bracket of the initial <html> tag in that template).
You have several issues with your fetch call:

*

*an API endpoint in SvelteKit 1.0+ must be declared in a +server.js or +server.ts file whose location matches the intended URL path

*extensions (.js or .ts) must be left off ; this is doubly true of a Typescript file since it would be transpiled into JS first anyway

*while fetch URLs can be relative, you'd be better off making them absolute to the root of your domain

So from the above points, if your goal is to have an API endpoint that responds to requests made to /jobs/index.json, you need to place the GET handler inside /src/routes/jobs/index.json/+server.ts, and call this API (from your +page.ts file) with const postsData = await fetch('/jobs/index.json').
Note that this doesn't intend solve the loading of MD files as I am not completely sure what your intent is regarding that, but it will at least get your API route to run.