text:
Q: Proving that the Cesaro means of Fourier sums for continuous $f$ converge uniformly to $f$ Let $f$ be a $1$-periodic and continuous function on $\mathbb{R}$. I would like someone to verify that the following proof is correct. I prove that $\|\sigma_n(f)-f\|_\infty\to0$, where $\sigma_n(f)$ denotes the $n$-th Cesaro mean of the partial sums of the Fourier series of $f$. That being said, $\sigma_n(f)=f*K_n$, where $K_n$ is Fejer's kernel: $K_n(x)=\displaystyle\frac{1}{n+1}\biggl(\frac{\sin((n+1)\pi x)}{\sin(\pi x)}\biggr)^2$ (for $x\not\in\mathbb{Z}$; for $x\in\mathbb{Z}$ it is $K_n(x)=n+1$).
Now a popular and sharp estimate of Fejer's kernel is the following: for all $x\in[-1/2, 1/2]$ it is $K_n(x)\leq\Phi_{\frac{1}{n+1}}(x)$, where $\Phi_{\frac{1}{n+1}}(x)$ is a piecewise function: For $|x|<\frac{1}{2(n+1)}$ it is $\Phi_{\frac{1}{n+1}}(x)=n+1$ and for $\frac{1}{2(n+1)}\leq|x|<\frac{1}{2}$ it is $\Phi_\frac{1}{n+1}(x)=\frac{1}{4(n+1)x^2}$.
I am not going to prove the estimate; as I said, it's popular.
Now for our goal: It is $\|\sigma_n(f)-f\|_\infty\leq\displaystyle\sup_{x\in[-\frac{1}{2},\frac{1}{2})}|\sigma_n(f)(x)-f(x)|$. As proved here, since $f$ is $1$-periodic and continuous it is uniformly continuous; Let $\varepsilon>0$ and $\delta>0$ be the corresponding quantity. Let $x\in[-\frac{1}{2},\frac{1}{2})$. We have $|\sigma_n(f)(x)-f(x)|=|(f*K_n)(x)-f(x)|=|\int_{(-1/2,1/2)}f(x-y)K_n(y)dy-\int_{(-1/2,1/2)}f(x)K_n(y)dy|\leq\displaystyle{\int_{(-1/2,1/2)}|f(x-y)-f(x)|K_n(y)dy}\;\;(1)$
Now we can break the integral on RHS in two parts: The first, $I_1$, being the integral over $(-\delta,\delta)$ and the second, $I_2$, the integral over the rest of $(-1/2,1/2)$.
But $I_1=\displaystyle{\int_{(-\delta,\delta)}|f(x-y)-f(x)|K_n(y)dy\leq\varepsilon\int_{(-\delta,\delta)}K_n(y)dy\leq\varepsilon}$ (we used the fact that $\int_0^1K_n(y)dy=1$)
As for $I_2$, for $n$'s large enough so that $\frac{1}{2(n+1)}<\delta$, we have that $I_2=2\displaystyle{\int_{(\delta,\frac{1}{2})}|f(x-y)-f(x)|K_n(y)dy\leq4M\int_{(\delta,\frac{1}{2})}K_n(y)dy\leq 4M\int_\delta^\frac{1}{2}\frac{1}{4(n+1)y^2}dy=\frac{C_\varepsilon}{(n+1)}},$ a quantity that also gets arbitarily small as we increase $n$.
Everything is independent of $x$; therefore the $\infty$-norm gets small as $n$ gets large.
Is there something wrong with my proof?


text:
Q: Program counts down by 2 instead of by 1 and I can't see any logic errors I have recently learned how to use the timer java class and have created a program which counts down using a timer and displays this countdown using a label.  My issue is that the program counts down by two instead of 1.
package test;

import java.awt.*;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.Timer;
import static javax.swing.UIManager.get;

public class Test extends JFrame implements ActionListener{

    //Declare Global Variable
    int timerValGlobal = 25;

    //Define components to add
    JButton startTimer = new JButton("Start Timer");
    JButton exitButton = new JButton("Exit");
    JLabel time = new JLabel();
    Timer timer = new Timer(1000, this);

    //Define panels
    JPanel pane = new JPanel();
    JPanel exitPane = new JPanel();

    public Test(){
        setExtendedState(JFrame.MAXIMIZED_BOTH);
        setUndecorated(true);
        setVisible(true);
        setDefaultCloseOperation(EXIT_ON_CLOSE);

        //Add buttons to panels
        pane.add(startTimer);
        pane.add(time);
        exitPane.add(exitButton);

        //Add panels to form;
        add(pane, BorderLayout.NORTH);
        add(exitPane, BorderLayout.SOUTH);

        //Add ActionListeners to Buttons
        startTimer.addActionListener(this);
        exitButton.addActionListener(this);
        timer.addActionListener(this);

    }

    public static void main(String[] args) {
        Test t = new Test();
    }

    public void actionPerformed(ActionEvent evt){
        Object source = evt.getSource();
        if(source == exitButton){
            System.exit(0);
        }

        else if(source == startTimer){
                timer.start();
        }

        else if (source == timer){
            time.setText(String.valueOf(timerValGlobal));
            timerValGlobal = timerValGlobal - 1;

            if(timerValGlobal == 0){
                timer.stop();
                timerValGlobal = 25;
            }
        }
    }
}

A: This is certainly hard bug to notice! (at least for me :D)
When you create the timer, you did this, right?
Timer timer = new Timer(1000, this);

Why do you write the word this in that piece of code? You're saying that this should be used as an action listener for the timer so that each second, one of the methods in the class will be called. Right?
Now, here's where it goes wrong. In the constructor, you set this as the action listener again!
public Test(){
    setExtendedState(JFrame.MAXIMIZED_BOTH);
    setUndecorated(true);
    setVisible(true);
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    //Add buttons to panels
    pane.add(startTimer);
    pane.add(time);
    exitPane.add(exitButton);

    //Add panels to form;
    add(pane, BorderLayout.NORTH);
    add(exitPane, BorderLayout.SOUTH);

    //Add ActionListeners to Buttons
    startTimer.addActionListener(this);
    exitButton.addActionListener(this);
    // LOOK! THIS LINE!
    // VVVVVVVVVVVVVVV
    timer.addActionListener(this);
}

You even wrote comments that says the following block of code is used to add action listeners to the buttons!
Because of the two identical action listeners, the actionPerformed method is called twice a second, hence the output!
Just remove the line that adds a second action listener!
Side note, you should create your frame on the Event Queue like this:
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            new Test();
        }
    });
}

Or this, in Java 8:
public static void main(String[] args) {
    EventQueue.invokeLater(Test::new);
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: 8 chars unique String in Java Is there any way to generate 8 characters long random and unique String in Java?
String id = getRandomString();

and then id will be for example wf41Av5g

A: You can create this string on base of the current time.
For example:
2014 06 04 16 21 20 79    ---> 14 06 04 16 21 20 79
Then you can translate every two digits (except last two) for an alphanumeric character using table ( http://en.wikipedia.org/wiki/Base64  - note that all of them are smaller than 59)
then you will receive
14 - O
06 - G
04 - E
16 - Q
21 - V
20 - U
OGEQVU79 <- exactly 8 characters. A little bit complicated, but it works if you would not call your function often than 0.01 s

A: You can use RandomStringUtils
import org.apache.commons.lang.RandomStringUtils;
public class RandomStringUtilsTrial {
  public static void main(String[] args) {
    System.out.print("8 char string  >>>");
    System.out.println(RandomStringUtils.random(8, true, true));

  }
}

A: The uniqueness property depends on the scope in which you use it. Java can certainly generate random strings, although if you want a universally unique identifier you can use UUID class.
String unique = UUID.randomUUID().toString();

A: If the uniqueness is important, you can't simply randomly generate strings. There is no way to avoid a collision. Even UUIDs can collide, although it is quite unlikely.
You could keep a record of the strings you've used, and when you generate a new random string, check the record to see if it's a duplicate, and if so, discard it and try again.
However, what i would suggest is that you don't generate random numbers. Instead, keep a counter, and encrypt its output to produce random-looking numbers. These are guaranteed never to collide if you do this properly. See an earlier answer of mine, or one by Rossum

A: public String getRandomString(int length, char[] characterSet) {
    StringBuilder sb = new StringBuilder();

    for (int loop = 0; loop < length; loop++) {
        int index = new Random().nextInt(characterSet.length);
        sb.append(characterSet[index]);
    }

    String nonce = sb.toString();
    return nonce;
}

A: As none of the answers above ensures uniqueness, I decided to add another answer.
First we define all valid options in an array:
char[] chars = new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
        'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
        '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };

Now we can mutate the algorithm to Random shuffling of an array, to get the first 8 elements:
Random rnd = new Random();
int charsLength = chars.length;
int passLength = 8;
StringBuilder password = new StringBuilder();
for (int i = 0; i < passLength; i++)
{
    int index = rnd.nextInt(charsLength - i - 1);
    // Simple swap
    char a = chars[i + index];
    chars[i + index] = chars[i];
    chars[i] = a;
    password.append(a);
}

System.out.print(password);

It ensures uniqueness by that once a char is in the 8 first places of the array, it is not a valid choice for the next round.
Few outputs that I got:
ifJjuYrR
NpY3TfIU
LGFm8Ng9
sV4Gctb7
4fyhlSuQ

A: Quick and dirty solution using java.util.UUID:
public String getRandomString(int length) {
    return UUID.randomUUID().toString().subSequence(0, length);
}

A: Please try following code:
private String uniqid() {
    Random random = new Random();
    String tag = Long.toString(Math.abs(random.nextLong()), 36);
    return tag.substring(0, 8);
}

A: By now you must've gotten your answer, but for those who reach this page, try this code:
public class RandomValueXML {

    public static void main(String[] args) {

        System.out.println(org.apache.commons.lang3.RandomStringUtils.random(6, true, true));

    }

    static Set<String> getRandomUniqueStrings(int count, int length, boolean letters, boolean numbers){
        Set<String> rus = new HashSet<>();

        while (rus.size() < count){
            rus.add(RandomStringUtils.random(length, letters, numbers));
        }

        return rus;
    }
}

Here the use of set ensures the uniqueness while use of HashSet ensures better performance while reading and writing.

A: I know this is an old post but this may help someone.
This one worked for me:
System.out.println(UniqueIdGenerator.fromBase10(System.currentTimeMillis()));

should be unique in every millisecond on the same JVM.
with:
public class UniqueIdGenerator {

 private static final String MIX_STRING = "abcdefghijklmnopqrstuvwxyz1234567890";

 private static final int MIX_STRING_LENGTH = MIX_STRING.length();

 public static String fromBase10(final long base10) {
    if (base10 == 0)
        return "0";

    long temp = base10;
    final StringBuilder sb = new StringBuilder();

    while (temp > 0) {
        temp = fromBase10(temp, sb);
    }
    return sb.reverse().toString();
 }

 private static Long fromBase10(final long base10, final StringBuilder sb) {
    final int rem = (int) (base10 % MIX_STRING_LENGTH);
    sb.append(MIX_STRING.charAt(rem));
    return base10 / MIX_STRING_LENGTH;
 }
}

you can also change the char order in MIX_STRING, even add upperCase letters or symbols.

A: I have got no idea whether there is a method that can produce 8 digit unique random string but I would create an offline key-generator-service that constantly generates random keys and insert them to key table if the key does not exist in the table and whenever your online app needs a key then it can fetch from one of the pre-produced keys.

A: long unixTime = System.currentTimeMillis() / 1000L;
String unique_no=Long.toHexString(unixTime).toUpperCase();

gives you unique 8 chars String in HEX format.


text:
Q: RAM vs MongoDB for temporary game data? I'm writing a game where the current position of each player and game element needs to be handled and remembered by the server.
But once the game is over all I need the server to remember is who won... basically.
So I was wondering if I should store that data inside of an object or inside of the database. I think it would make my code a bit more readable to if I sued the db method and it would also allow me to resume games after a server restart.
But here is the thing: The data is updated hundreds if not thousands of times per second.
Would that significantly increase CPU usage, latency or so?


text:
Q: Adding Keyboard input to Directories I want to create a directory but I also want to add Keyboard input. Specifically, I want the user to chose the directory name, and location, and then it displays the name and location that the user entered.
Directory:
#!/usr/bin/python
import os

# Create a directory that the user choses when and where
os.mkdir()

Keyboard Input:
filename = raw_input('Filename:')
print('You Entered the Filename:'), filename

Figured it out!!!!!
Thanks everyone but I figured it out!
    import os

    filename = raw_input('Enter Filename:')
    os.mkdir(filename)
    print('Filename Entered'), filename

A: >>> import os
>>> os.curdir
'.'
>>> filename = raw_input('Filename:')
Filename:mydir
>>> os.mkdir(filename)
>>> os.listdir(os.curdir)
['mydir']


text:
Q: How can we call fallback method of Hystrix in zeebe handler? I have a service called payment-service which is down, and this is called inside a zeebe handler.Since the service is down it should call fallbackmethod of hystrix. But it is returning me success.
main class

controller class

delegate class

when I am executing localhost:8081/order-process it shows me success.
and in the console I get the error as
 I/O error on GET request for "http://localhost:8080/payment-service": Connection refused:
Please let me know why this fallback method is not getting called.

A: The reason your REST service returns "success" is that you successfully started your job worker (https://docs.zeebe.io/basics/job-workers.html). The job worker then executing the jobs/service tasks from your BPMN processes.
Hystrix will be used WITHIN the handler to do the call, so a potential exception or default value needs to be taken into account WITHIN the handle method.


text:
Q: how to change auth username after user profile edit in cakephp i have a situation where i need to allow current logged in user to change his username in cakephp.
when i update the username in database it doesn't reflect in
 $this->Auth->user('username')

Even after changing record in database $this->Auth->user('username') is giving same old username because it is saved in current session.
can anyone help me in how to update current $this->Auth session data
Thanks in advance

A: The AuthComponent stores the User's properties inside the session on login. Updating the User-data inside the database won't automatically update those changes inside the session, so you'll have to do that yourself after successfully saving the changes to the database;
Manually log in after update
Although the user already is logged in, manually logging the User in, will also update the data inside the Session (see the source here: https://github.com/cakephp/cakephp/blob/master/lib/Cake/Controller/Component/AuthComponent.php#L543)
Something like this;
if ($this->User->save($this->request->data)) {
    // Succesfully update the user
    // update the users data inside the session
    $this->Auth->login($this->request->data);

    // and redirect somewhere else
    return $this->redirect(array('controller' => 'pages', 'action' => 'display', 'home'));
}

Although you'll be able to achieve the same by updating the session-data via the Session-component, doing this via the AuthComponent is easier, as it will automatically store the data in the right location inside the session :)
Also see: Identifying users and logging them in
note Because you didn't mention what version of CakePHP you're using, I'm assuming CakePHP 2.x

A: After updating the new name in database, you can just update the name in session as below:
$this->Session->write('Auth.User.name', $new_username);

This line of code will update the username within the same session.

A: you have just to change the session data for the username
$this->Session->write('Auth.User.username') = $newusername;

for example
 $this->Session->write('Auth.User.username') = $this->request->data['User']['username'];


text:
Q: Ant task replace text escape dollar I want to replace unfiled$public with unfiled\$public and I'm using the following ant task -
 <replaceregexp match="unfiled$public" replace="unfiled\$public" flags="gs" byline="false" >
        <fileset dir="my_dir" />
    </replaceregexp>

but this is not doing the trick. I got to know that $ has to be escaped. I've tried this also without results -
 <replaceregexp match="unfiled\\$public" replace="unfiled\\\\\$public" flags="gs" byline="false" >
        <fileset dir="my_dir" />
    </replaceregexp>

A: Try this code:
<replaceregexp match="unfiled$$public" replace="unfiled\$$public" flags="gs" byline="false" >
    <fileset dir="my_dir" />
</replaceregexp>

As some compilers say to escape $ with double $$. If this will not work you may try to leave replace untouched like: replace="unfiled\$public" and only escape the match:
<replaceregexp match="unfiled\$public" replace="unfiled\$public" flags="gs" byline="false" >
        <fileset dir="my_dir" />
    </replaceregexp>

A: You (most likely) don't need to double escape the backslashes, as they are used in a XML string (which have other escape rules, like &, etc).
So try:
<replaceregexp match="unfiled\$public" replace="unfiled\$public" flags="gs" byline="false" >
    <fileset dir="my_dir" />
</replaceregexp>

A: Try :
<replaceregexp match="unfiled$public" replace="unfiled\\$public" flags="gs" byline="false" >
            <fileset dir="my_dir" />
        </replaceregexp>

A: In the replace attribute the dollar sign has to be written as \\\$ since the dollar sign has to be escaped in the regular expression replace part resulting to \$ and for Ant the two characters must be escaped again: \\ + \$.


text:
Q: Python script giving back error when attempting to load from file using JSON I'm attempting to load two dictionaries using JSON. I save them with the following function:
 def save_file(self):
        print(save_dict['filename'])
        with open(save_dict['filename'], 'w') as f:
            save_list = [save_dict, cad_dict]
            json.dump(save_list, f)

I then attempt to load them using this function:
def open_file(self):
        global save_dict
        global cad_dict

        filename = fd.askopenfilename(
            initialdir=r'C:\Users\Tim\Desktop\Code\Python\Surveying_Program',
            title='Browse',
            filetype = (('job files', '*.saj'), ("all files","*.*"))
        )
        with open(filename, 'r', encoding='utf-8') as f:
            save_list = json.load(f)

        save_dict = save_list[0]
        cad_dict = save_list[1]

I end up with the following error:
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\tkinter\__init__.py", line 1921, in __call__
    return self.func(*args)
  File "c:\Users\Tim\Desktop\Code\Python\Surveying_Program\survey_amateur_main.py", line 187, in open_file
    save_list = json.load(f)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 64467 (char 64466)
PS C:\Users\Tim\Desktop\Code\Python\Surveying_Program>

For reference, here is an example of the file I'm attempting to load:

[{"filename": "C:/Users/Tim/Desktop/Code/Python/Surveying_Program/dxf_practice/job_file.saj", "point_dict": {"filename": "", "1": {"northing": 780443.4568, "easting": 2039690.279, "elevation": 286.5, "description": "Walls", "time": "10:25:11", "date": "11/25/2022"}}}, {"cad_filename": "C:/Users/Tim/Desktop/Code/Python/Surveying_Program/dxf_practice/one_object_dxf.dxf", "dxf_extents": [[1125.591828718476, 5050.379053781544], [1131.50998529643, 5054.804957938229]], "dxf_lines": [["0", [1125.591828718476, 5050.379053781544, 0.0], [1131.50998529643, 5054.804957938229, 0.0]]], "dxf_plines": [], "dxf_mtext": [], "dxf_circles": [], "dxf_arcs": []}]

A: I didn't look closely at my data and my ezdxf module was putting the coordinates as a an object that evidently doesn't work well with json. Converted those objects to strings and it now works.


text:
Q: Update\Insert Cassandra Counter Value in Spark SQL How can we update Cassandra Counter value using Spark SQL?
I tried a Cassandra CQL query that updates a counter value using DBeaver and it worked. However, when I tried it using SQL, an error Update statement is not expected.
Another thing, INSERT OVERWRITE doesn't work here (I think) as I need to increment the Counter Value: counter_column=counter_column+1

A: I just found a way to do that:
When inserting value into a table with Counter value in Spark, Cassandra will add that value to the current value..so executing the following SQL:
INSERT INTO some_table VALUES ('key0', 1)
INSERT INTO some_table VALUES ('key0', 2)

Will yield the following table state:
key0, 3


text:
Q: How to solve- Onesignal push notification not coming to Android device if the app is not opened for a while? In my Android application, I am using One Signal push notification service to send push notifications. I have done all the settings according to document as mentioned.
After setting up all these things, I have created one service class of one signal like below-
NotificationExtenderBareBonesExample.java
public class NotificationExtenderBareBonesExample extends NotificationExtenderService {

    public static String first_screen;

    @Override
    protected boolean onNotificationProcessing(OSNotificationReceivedResult receivedResult) {

        SharedPreferences.Editor editor = getApplicationContext().getSharedPreferences("NOTIFY_PREF", MODE_PRIVATE).edit();
        editor.putString("notify_msg", receivedResult.payload.groupMessage);
        editor.putString("notify_key", receivedResult.payload.groupKey);
        editor.apply();

        first_screen = receivedResult.payload.groupMessage;

        return false;
    }
}

I have also created another class to handle the received push notification like below-
ExampleNotificationReceivedHandler.java
public class ExampleNotificationReceivedHandler implements OneSignal.NotificationReceivedHandler {
    @Override
    public void notificationReceived(OSNotification notification) {
        JSONObject data = notification.payload.additionalData;
        String customKey;

        if (data != null) {
            customKey = data.optString("customkey", null);
            if (customKey != null)
                Log.i("OneSignalExample", "customkey set with value: " + customKey);
        }
    }
}

Then, in my Activity class, I have initialized One Signal like below-
OneSignal.startInit(this)
                .inFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
                .unsubscribeWhenNotificationsAreDisabled(true)
                .setNotificationReceivedHandler(new ExampleNotificationReceivedHandler())
                .setNotificationOpenedHandler(new MyNotificationOpenedHandler(this))
                .init();

At last in my AndroidManifest file, I have declared the service like below-
<service
            android:name="com.rokomari.new_package.notification_check.NotificationExtenderBareBonesExample"
            android:exported="false"
            android:permission="android.permission.BIND_JOB_SERVICE">
            <intent-filter>
                <action android:name="com.onesignal.NotificationExtender" />
            </intent-filter>
        </service>

The push notification was coming, if the app is being used recently, but the problem was still there as it is mentioned in my question. So, I have checked few more solutions and applied in my project like below-
I made my application a system app and added one authentication service with that.
I also added one Broadcast-Receiver class like below-
BootReceiver.java
public class BootReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {

            Intent startServiceIntent = new Intent(context, NotificationExtenderBareBonesExample.class);
            context.startService(startServiceIntent);

            Intent notificationServiceIntent = new Intent(context, NotificationExtenderBareBonesExample.class);
            context.startService(notificationServiceIntent);
        }
    }
}

And declared this in my AndroidManifest file-
<receiver
            android:name="com.rokomari.new_package.notification_check.BootReceiver"
            android:enabled="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

After doing all these I am still having the same problem.
---- The Problem is -----
When I am using app(opening the app) regaularly the push notification from one signal is coming whether the app is in background or not. But when I am not using the app for a while it's not coming. In addition, for some devices mainly Xiomi the push notification is not coming at all.
After making some changes in Xiomi device like below-

*** Xiaomi  - Make sure "Auto-start" property enabled for your app in the settings.**

After changing settings, the push notification came once. But I need a solution programmatically to send push notification to cover all the devices. If it is not possible yet with One Signal, then I like to know how apps like facebook, whatsapp send push notification?


text:
Q: BUILD FAILED (OS X 10.14.6 using ruby-build 20190828) Installing Ruby via rbenv I'm trying to install ruby 2.6.4 via rbenv on macOS Mojave
rbenv install 2.6.4
But every time I try it gives me:
ruby-build: using openssl from homebrew
Downloading ruby-2.6.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.4.tar.bz2
Installing ruby-2.6.4...
ruby-build: using readline from homebrew

BUILD FAILED (OS X 10.14.6 using ruby-build 20190828)

Inspect or clean up the working tree at /var/folders/tc/ctlyg05n4czbm9wb3vvm11xr0000gn/T/ruby-build.20190920102949.80278
Results logged to /var/folders/tc/ctlyg05n4czbm9wb3vvm11xr0000gn/T/ruby-build.20190920102949.80278.log

Last 10 log lines:
tool/config.guess already exists
tool/config.sub already exists
checking build system type... x86_64-apple-darwin18.7.0
checking host system type... x86_64-apple-darwin18.7.0
checking target system type... x86_64-apple-darwin18.7.0
checking whether the C compiler works... no
configure: error: in '/var/folders/tc/ctlyg05n4czbm9wb3vvm11xr0000gn/T/ruby-build.20190920102949.80278/ruby-2.6.4':
configure: error: C compiler cannot create executables
See 'config.log' for more details
make: *** No targets specified and no makefile found.  Stop.

Tried solutions so far:
1) xcode-select --install
2) Add missing packages in xcode
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
3) Reinstall rbenv and ruby-build via homebrew and direct
4) RUBY_CONFIGURE_OPTS=--with-readline-dir="$(brew --prefix readline)" rbenv install 2.6.4
sudo rbenv install 2.6.4 works but I want it to install without sudo because it leads to other complications when installing rails.
Does anyone know a solution to this issue?

A: There is an issue about this problem. A solution from this comment:

I've resolved this issue by selecting Command Line Tools in Xcode >
  Preferences > Locations

Did you try this way?


text:
Q: ExecJS::RuntimeError SyntaxError: unexpected MATH (rails 4) i recently started trying Rails so I don't know much yet.
I developed so far a simple website and now I'm trying to add more features. First of all I tried pure javascript and it failed, then I translated it to coffeescript and right now I keep getting this error. The code is in /sessions.js.coffee
  helper = []

  helper.confirmation = ->
    answer = confirm("Wanna visit google?")
    window.location = "http://www.google.com/"  if answer

I'm just testing but I got stuck here. Any help would be really appreciated.


text:
Q: How to access resources from another proyect I have two resource files called String.arg.resx and String.en.rex in a proyect called Common
Then I Have a class called LocalizationService in my Service proyect, the code is as follows:
public class LocalizationService
{
    private ResourceManager resourceManager;
    private CultureInfo cultureInfo;

    public LocalizationService()
    {
        SetDefaultCultureAndResource();
    }

    private void SetDefaultCultureAndResource()
    {
        cultureInfo = CultureInfo.CreateSpecificCulture("en");
        resourceManager = new ResourceManager("Common.Resources.String", Assembly.GetAssembly(typeof(Common.Resources));
    }

    public void ChangeLanguage(Languages languages)
    {
        switch (languages)
        {
            case Languages.Español:
                cultureInfo = CultureInfo.CreateSpecificCulture("es");
                resourceManager = new ResourceManager("Common.Resources.String", typeof(LocalizationService).Assembly);
                break;
            case Languages.English:
                cultureInfo = CultureInfo.CreateSpecificCulture("en");
                break;
            default:
                cultureInfo = CultureInfo.CreateSpecificCulture("en");
                break;
        }
    }

    public string GetString(string value)
    {
        return resourceManager.GetString(value, cultureInfo);
    }

}

But the line resourceManager = new ResourceManager("Common.Resources.String", Assembly.GetAssembly(typeof(Common.Resources)); is not working, because I dont see Common.Resources.
Which Method of the Assembly class I should be using?

A: Ok... It seems I found the answer, I just put a Class that is inside the assembly where the Resource files are.


text:
Q: Get sum of a field per page in crystal report I Have a Crystal Report and get the sum of a field like this:
Sum({TheField})

and I put it in PageFooter section to have it in all pages but if the report has multiple pages it shows the sum of all fields and I need to get the sum per page.
Any ideas how to do that?

A: You can get page level totals as follows. Create three formula fields in report design, namely ff_Reset_Total, ff_Current_Total, ff_Add_Record and set their values in formula editor as under:

*

*ff_Reset_Total
whileprintingrecords;
numbervar PageTotl;
PageTotl:=0;

*ff_Current_Total
whileprintingrecords;
numbervar PageTotl;
PageTotl;

*ff_Add_Record
whileprintingrecords;
numbervar PageTotl;
PageTotl:=PageTotl + {TheField};

Now place these formula fields in your report as under:

*

*ff_Reset_Total in Page Header Section

*ff_Current_Total in Page Footer Section

*ff_Add_Record in your Details Section

Now hide ff_Reset_Total and ff_Add_Record by Right Click on each of them in Page Header and Details Sections, point to Format Field and then in the Common tab select Suppress

A: Create a variable in the report header.
numbervar runningtot;
runningtot:=0;

Add {TheField} to the variable on line level.
numbervar runningtot;
runningtot:=runningtot+{TheField};

Display the variable in the page footer A
numbervar runningtot;
runningtot;

Reset the variable to zero in page footer B
numbervar runningtot;
runningtot:=0;

You could display and reset the variable in one formula in page footer A, but the above is easier to digest..


text:
Q: Exporting JAR from Eclipse I've created a SWT application using eclipse. In the application I make use of Images with in the project. Now I build the jar file and run it in the command line I get the following error:
Caused by: java.io.FileNotFoundException: Images\Back.png (The system cannot fin
d the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at org.eclipse.swt.internal.Compatibility.newFileInputStream(Unknown Sou
rce)

Now I can see that the program cant read my Image but I would like to ask how to I include the Images in the jar file for everything to run smoothly.

A: Right click on your project, choose export.
Export -> Java -> Jar file

Choose the resources you would like to export, then click Finish.
If you need a runnable jar, just make sure the files are part of your project.  For example make a folder called "Images".  Then exporting a Runnable Jar should work.
That will get you the Images into your Jar file.  Once it's there you will need to retrieve it using the method "getResourceAsStream".  If you need help with that there are numerous good answers, here is one, Getting images from a .jar file.


text:
Q: Would you choose Selenium instead of Testbench (Vaadin)? Planning the automation tool before starting the new project I am about to start a new web project and one of my team members suggests to use Vaadin solution instead of Selenium.
If you have to pick up a web app automation tool, what will you choose between Selenium and Testbench? If possible, please argument your choice by comparing.
Except the fact that some components are license ba$ed [Freemium], I found that the internet resources (considering Github  w/ loads of Selenium libs and Stalkoverflow) are reduced for Testbench compared to Selenium. I've also noticed that Testbench is Selenium based.
Except the Vaadin's official site, there is no other comparison to be found, so I encourage you to share your thoughts on this. Your experience will help the automation engineers (instead of a long term try) to take a better decision that fits their specific needs.
What other automation tools are you using / recommending?
Thanks!

A: First of all, selenium is an open source tool as compared to vaadin testbench.
Second, Vaadin testbench is solely created to test the Vaadin application but with the help of selenium you can deal with general web applications.
You can check the below link where in the first line itself they have written about that.
https://vaadin.com/docs/v14/testbench/testbench-overview.html
Third, There are many frameworks out there for selenium as compared to testbench. So long time maintenance would be difficult in vaadin testbench.
So bottom line is if you have to test the vaadin application then go with the vaadin testbench. otherwise without a second thought, go with the selenium :)
If you want then I can tell you more about this.


text:
Q: C - Using character arrays in struct I use fscanf to read an array of chars from a text file. I would like to add that string to a linked struct, however it gives me an error (expression must be a modifiable value). I'm using structs for the first time, please help!
My struct:
typedef struct animals{
    char name_of_animal[51];
    struct animals *next;
} ANIMALS;

Later, the way I want to add a new element to this linked struct:
{
    char name_of_animal[51];
    /*
     * use fscanf to read into name_of_animal
     */

    ANIMALS* new_animal = (ANIMALS*) malloc(sizeof(ANIMALS));
    new_animal->name_of_animal = name_of_animal;
    new_animal->next = (*pointer_to_pointer_to_beginning);
    (*pointer_to_pointer_to_beginning) = new_animal;
}

A: Your problem has nothing to do with structs: you read a string into a char[51] (name_of_animal) and are trying to copy it into another char[51] (new_animal->name_of_animal) by using the assignment operator (=). You can't do that and should instead use strcpy from <string.h>.

A: "I would like to add that string to a linked struct, however it gives me an error ("expression must be a modifiable value")"
Regarding adding string to a linked struct, use a function to create a link and update the string member using a string function, rather than the = operator. Eg:
void createNode(struct zvierata** head_ref, char *new_data)
{
    //allocate memory for new node
    struct zvierata *new_node = malloc(sizeof(*new_node));

    // copy data to member
    //new_node->meno_zvierata = new_data; // '=' does not work with strings
    strcpy(new_node->meno_zvierata,  new_data);

    new_node->next = (*head_ref);

    //finally move the head to point to the new node
    (*head_ref)    = new_node;
}

" I'm using structs for the first [time], please help!"
Here are several pages of tutorial on Linked Lists (which is what you are using.)


text:
Q: PIL jpeg, how to preserve the pixel color I have some experiments with JPEG, the doc said "100 completely disables the JPEG quantization stage."
However, I still got some pixel modification during saving. Here is my code:
import Image
red = [20,30,40,50,60,70];
img = Image.new("RGB", [1, len(red)], (255,255,255))
pix = img.load()

for x in range(0,len(red)):
    pix[0,x] = (red[x],255,255)

img.save('test.jpg',quality=100)

img = Image.open('test.jpg')
pix = img.load()

for x in range(0,len(red)):
    print pix[0,x][0],

I got unexpected output: 22 25 42 45 62 65
What should I do to preserve the pixel value ? Please note that I also tried with PHP using imagejpeg and It gives me the correct value when quality=100.
I can use png to preserve, but I want to know the reason behind this and if there is any option to avoid

A: JPEG will always carry risk of lossyness, see Is Jpeg lossless when quality is set to 100?.
Your best bet is to use another format, especially if your experiments are for science :)  Even if you're forced to start with JPEG (which seems unlikely) you should immediately convert to a lossless format for any kind of analysis and modification.
If you really want to try lossless JPEG work with python you can try jpegtran, "the lossless jpeg image transformation software from the Independent Jpeg Group", but as @Mark notes, this won't get you very far.
By the way, quantization is used in lossy or lossless compression alike, so my guess is that

...100 completely disables the JPEG quantization stage.[1]

simply means that it's not compressed at all.

A: JPEG consists of many different steps, many of which introduce some loss. By using a sample image containing only red, you've probably run across the worst offender - downsampling or chroma subsampling. Half of the color information is thrown away because the eye is more sensitive to brightness changes than color changes.
Some JPEG encoders can be configured to turn off subsampling, including PIL and Pillow by setting subsampling=0. In any case it won't give you a completely lossless file since there are still other steps that introduce a loss.

A: Believe I've figured out how to keep the current color subsampling and other quality details:
from PIL import Image, JpegImagePlugin as JIP

img = Image.open(filename)
img.save(
    filename + '2.jpg',                 # copy
    format='JPEG',
    exif=img.info['exif'],              # keep EXIF info
    optimize=True,
    qtables=img.quantization,           # keep quality
    subsampling=JIP.get_sampling(img),  # keep color res
)

Per https://www.exiv2.org/tags.html I've found that the YCbCrSubSampling tag is not kept in EXIF in JPEG files:

In JPEG compressed data a JPEG marker is used
instead of this tag.

This must be why there is another function in a seemingly out of the way place to to grab it.
(Believe I found it here: https://newbedev.com/determining-jpg-quality-in-python-pil)


text:
Q: WordPress 2.8.5 & 'Responsive Twenty Ten' - error So, According to the WordPress theme download page; the theme 'Twenty Ten' and it's child theme/plugin 'Responsive Twenty Ten' are compatible with 2.8+
I'm stuck with using 2.8.5 at work, I don't have an answer to why - but am.
I've uploaded both the plugin and the base theme manually - and was stoked to begin implementation of the graphical mock-up when;
Fatal error: Call to undefined function home_url() in /data/24/1/0/139/1815302/user/1967139/htdocs/wp-content/themes/twentyten 3/header.php on line 63

Anyone have any suggestions as to what causes this error and how to fix it?

Thanks for your response Chip; but I'm a little confused with your advice -
Your advising me to edit the header.php, but then your saying it will create more errors, so that's not really an option then?
But your last suggestion seems like a good idea; how do I revert the theme to the old version? Is this something your suggesting I do in the code or is there a place I can download the old version?
Edit: On the download WP page for the 'Responsive Child theme/plug in' it says it's WordPress 2.8+ compatible - the base version I downloaded didn't specify it's compatibility so it may very well be an updated version not compatible with 2.8 - though I feel like I've seen that theme for years, so hopefully I can find an older version and get it going with the child theme.
-cheers!

A: home_url() function is implemented in Wordpress since version 3.0.0, and you are using version 2.8.5.
To fix this error edit wp-content/themes/twentyten 3/header.php file -
replace:
home_url();

with:
'http://'.$_SERVER["SERVER_NAME"]

This is hotfix, and i'm afraid you will receive more errors like this.
"Responsive Twenty Ten' are compatible with 2.8+" - as you see it's not true :)
Best solution is revert theme to old one, or install newest wordpress version.
EDIT
It would be better to use get_bloginfo( 'url' ) than $_SERVER data.

A: Ultimately, the problem is that the Theme you're using isn't compatible with the version of WordPress you're using.
Solutions:

*

*(easiest, best) Upgrade WordPress from 2.8.5 to latest

*(still easy) Change to a different Theme, that is compatible with WordPress 2.8.5

*(harder, not recommended) Fix the WordPress-2.8.5 incompatibilities in the Theme

The migrated answer involves the latter solution. The specific error you're getting is that the core template tag home_url() isn't defined in WordPress 2.8.5, as it was introduced in WordPress 3.0. So, you will have to replace that template tag call, somehow. But, you very well may find other such incompatibilities, and would have to address each one similarly.
To be honest, if you are unable to understand the original Fatal error message, I wouldn't recommend going with the approach of trying to fix the Theme. Just update WordPress, or change to a WordPress 2.8.5-compatible Theme.


text:
Q: Broadcasting on some User Action? I was wondering if I can find something on this, like if user changes the volume on his android device or presses home button twice or thrice or any number of times, then Is there any way that I can broadcast that user has performed this action, and invoke my application? It may sound strange, and ambiguous but its a thought. Any ideas, chances of possibility? Please suggest? Thanks!

A: The answer is NO.
Reason:
here you can see all available keycode that you can handle in android.
Now one option would be to try to catch the keyevents from a background service. But sorry to say this is not possible. see here.

KeyEvents can only be handled by Activities as they are the interface
  to the user pressing the keys and only when they are in the
  foreground. Even Services that run in the background are not intended
  to react on user input.

i dont know whether this is changed in new api as I didn't do this by myself so you can seach a bit but i dont't think there will be any solution. I think you can only get some media button event receiver to Register a component to be the sole receiver of MEDIA_BUTTON intents by using AudioManager.registerMediaButtonEventReceive


text:
Q: hierarchical table Can someone please help me create this table? I know it requires \multicolumns and I've looked at other threads, but I'm still unable to set up the columns as they are here. I'm sorry my knowledge of latex is only basic. Thanks.
Here's what I've tried:
\documentclass[a4paper,12pt]{book}
\usepackage{amsmath}
\usepackage{apacite}
\usepackage{graphicx}
\usepackage[usenames, dvipsnames]{color}
\usepackage{bm}
\pagestyle{plain}

\usepackage{setspace}
\onehalfspacing
\raggedbottom

\usepackage{mathtools}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{multirow}

\begin{document}

\begin{table*}
    \begin{tabular}{p{1.2cm}p{1.2cm}p{1.3cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}}
        \hline
        &\multicolumn{1}{l}{Variables}&&\multicolumn{6}{l}{Type of employment}\\
        \cline{2-8}
        &\multicolumn{2}{c}{Informal}&&\multicolumn{2}{c}{Formal}&&\multicolumn{2}{c}{Total}\\
        \cline{2-4}\cline{6-8}
        &\textit{n}=6036&\%&&\textit{n}=876&\%&&\textit{n}=6912&\%&100\%\\
        \hline
        Age 15-24&&663&20.944&&19&5.791&&682&20.019\\

        \hline
    \end{tabular}
\end{table*}

\end{document}

A: Maybe this code may help you to start:
\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{array, booktabs, ragged2e}

\begin{document}

\begin{tabular}{p{1ex}>{\RaggedRight}p{4cm}*{3}{p{1.8cm}p{1cm}}}\toprule
\multicolumn{2}{l}{Variables} & \multicolumn{2}{l}{Type of job contract} & \multicolumn{4}{c}{} \\\cmidrule{3-8}
 &           & \multicolumn{2}{l}{Informal} & \multicolumn{2}{l}{Formal}  & \multicolumn{2}{l}{Total}\\
  \cmidrule{3-4} \cmidrule(lr){5-6} \cmidrule{7-8}

 &            & n = 1234 & \% & n = 1234 & \% & n = 1234 & \% \\\midrule
\multicolumn{2}{l}{Female} & \\

 & Age under 22 years old & 101 & 13.1 & 52 & 8.7 & 153 & 11.2\\

\end{tabular}
\end{document}

You need 8 columns to get the indentation right. Ah, and I improved the code, instead of \hrulefill better use \cmidrule (as suggested in the other answer, which was deleted, but good).
Looks like:

EDIT:
I changed one line in the code:
\begin{tabular}{p{1ex}>{\RaggedRight}p{4cm}*{6}{p{1.5cm}}}\toprule

to:
\begin{tabular}{p{1ex}>{\RaggedRight}p{4cm}*{3}{p{1.8cm}p{1cm}}}\toprule

I'm very surprised that this works (@David: array is great!)! However, now your n = ... will fit into the line.

A: more "advanced" alternative code for your table:

*

*threeparttable for `table notes (as shown on your table image)

*siunitx for S column type, which enable better number formating

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{array, booktabs, threeparttable}
\usepackage{siunitx}

\begin{document}
    \begin{threeparttable}
\caption{Characteristic \dots}
\label{tab:characteristic}
\begin{tabular}{@{}
        p{1em}l*{3}{S[table-format=3]S[table-format=2.1]}
                @{}}
    \toprule
\multicolumn{2}{@{} l}{Variables}
    & \multicolumn{6}{l}{Type of job contract}          \\
    \cmidrule{3-8}
    &   & \multicolumn{2}{l}{Informal}
            & \multicolumn{2}{l}{Formal}
                & \multicolumn{2}{l}{Total}\\
    \cmidrule{3-4}
    \cmidrule(l){5-6}
    \cmidrule(l){7-8}
    &   & {$n = 1517$}    & {\%}    & {$n = 1390$}    & {\%}    & {$n = 2907$}  & {\%}  \\
    \midrule
\multicolumn{8}{@{} l}{Female}                                                  \\
    & Age under 22 years old\tnote{a}
        & 101           & 13.1  & 52            & 8.7       & 153 & 11.2    \\
    \bottomrule
\end{tabular}
\begin{tablenotes}[flushleft]\footnotesize
\item[a]    bla bla bla
\item[b]
\end{tablenotes}
\end{threeparttable}
\end{document}


text:
Q: Search key pair Array to return the Value NOT the Key PHP I'm not sure if I've titled this correctly...
I have this array :
array (
        'fu' => 'bar',
        'baz' =>
             array (
                 0 => 'bat',
             ),
)

And I can search it using :
echo array_search('bar', $myarray);

Which will return the key of bar, which is :
fu

But how do I search for the value of fu?
If I try :
echo array_search('fu', $myarray);

I get no results.
!!EDIT to show more code as requested!!
$data = '{fu:"bar",baz:["bat"]}';
$parsed = array();
parse_jsobj($data, $parsed);

Now if I use :
var_export($parsed);

I get :
array (
        'fu' => 'bar',
        'baz' =>
             array (
                 0 => 'bat',
             ),
)

If I use this instead :
print_r($parsed);

I get :
Array ( [fu] => bar [baz] => Array ( [0] => bat ) )

And I'm trying to return the Value of fu like this :
echo array_search('fu', $parsed);

But I get no results.
Like wise if I try :
echo $parsed['fu'];
echo $parsed[0]->fu;
echo $parsed[0];

This function only seems to return the Key and won't return the Value. Maybe I'm looking for a different function?
The class I'm using is HERE

A: echo $myarray[array_search('bar', $myarray)];

I'm not sure why you'd want to do this though, as you already know the result of fu. I think it far more likely you actually want to do this:
echo $myarray['fu'];

edit:
Leaving the above for posterity. After the edit with more info, hopefully this will work:
$parsed2 = $parsed;
$parsed = array();
foreach($parsed2 as $key=>$value){
    if(is_string($key) || is_numeric($key)) {
        $parsed[$key] = $value;
    } else {
        $parsed["'".$key."'"] = $value;
    }
}
unset($parsed2);
echo $parsed['fu'];

if that doesn't work, then I've no more ideas.


text:
Q: how to sign in child on parent/child create? I am following the RoR Tutorial for my application.  My set up is slightly different and I am so new to rails I can't figure out how to tweek the code.  In the tutorial you create Users and sign them in.  In my app I am creating a Company that has many Users.  All that works.  However, I want to sign the User in (not the company) when I create a new Company/User pair.  The initial create is through the Companies_Controller, while the sign_in code in the tutorial runs through the Users_Controller.
When I log in as an existing User it works, but the initial create never hits the Users_Controller so it doesn't sign in.
I tried adding:

sign_in @company.users

to the create method of the Companies_Controller
In the SesionsHelper the sign_in method looks like this:

def sign_in(user)
      cookies.permanent.signed[:remember_token] = [user.id, user.salt]
      self.current_user = user
    end

I get the error:
Failure/Error: post :create, :company => @attr

NoMethodError:
   undefined method `id' for []:ActiveRecord::Relation
 # ./app/helpers/sessions_helper.rb:4:in `sign_in'
 # ./app/controllers/companies_controller.rb:15:in `create'

I'm not clear how to pass the user info that I just collected in the Company create form to the method in the SessionsHelper.  Or do I need to write a second set of sign_in methods for the initial creation?  Any insight is appreciated.


text:
Q: Pass data to Call Directory Extension I cannot pass data call directory extension from main app

*

*I've created one App group and turned it on in App capabilities for both targets (main app and extension)

*I pass data with NSUser

-Create Data in main app
var userDefaults = UserDefaults(suiteName: "group.test.callapp")
    userDefaults?.set("mynumber", forKey: "mykey")

-Retrieve Data in extension
var baseDescription =  "test"

let newUserDefaults = UserDefaults(suiteName: "group.test.callapp")

if let testUserId = newUserDefaults?.object(forKey: "mykey") as? String
{
baseDescription = testUserId
}

When i do it in only main app - everything is ok, but when i do it in extension (i do it in 'addIdentificationPhoneNumbers' function) - it doesn't work, baseDescripton doesn't change

A: Your solutions shoud work, the only problem I can see is that you don't have App Groups enabled (with your "group.test.callapp" group) both for your application and the extension. Check Target->Capabilities if this is enabled for both. Another caveat is to pass the phone number in the international format (with country code).


text:
Q: Another enum vs. int I need namespace-wide contants.
So I have the option to use enums, like:
public enum Token
{
    INFORMATIONAL,
    WARNING,
    ABORT,
    FATAL
};

But the disadvantage is, in WPF for example, that I need to convert them to int, now and then.
So I thought, why not
public static class Token
{
    public const int
    INFORMATIONAL = 0,
    WARNING =1,
    ABORT = 2,
    FATAL = 3;
};

in the source, they look the same AND I have no conversion issues.
So what would be the reason for enums at all?
I'm clearly missing something.
What is the reason for enums?

A: Enums to my knowledge have only one advantage: Type Safety.
Edit: They also have that [Flag] option, wich helps with encoding a lot of settings in one variable. Thanks to John for reminding me.
There is this interesting article about Primitive Obession (and I am really surprised how often I got to link this since learned about it yesterday).
It applies to your case like this: If you just use Primtives everywhere, the compiler can not warn you as much. You might try to assign 42 to a variable that was only supposed to one of those constant values.
But trying to assign anything but valid values to a Enum? Pretty hard/impossible to do by accident.

A: Consideration
With enum you define a type having some constants themselves "typed" (not the good word by I don't know how to say that).
The advantage between using enum values and constants is to be able to parse the values and to use the enum scope as a type.
So it is a better abstraction.
Also you don't need to care to define the values even if you can.
For example:
Parsing enum values
foreach ( var value in Enum.GetValues(typeof(Token) ) ...

Passing enum parameter
void Method(Token token) ...

Declare a collection keyed by an enum
var map = new Dictionary<Token, string>();

Condition test
if ( value == Token.INFORMATIONAL ) ...

Easy of bit flags usage
https://learn.microsoft.com/en-us/dotnet/api/system.flagsattribute
Default item name ToString result
Console.WriteLine(Token.INFORMATIONAL)

Will display the name of the value, not its value as for a constant.
So to display the value:
Console.WriteLine((int)Token.INFORMATIONAL)

Conclusion
With constants, you need to use reflexion to parse a list but it is ugly and not usefull at all and you can't pass them as a typed parameter.
Usage possibilities of constants is limited.
So enums and constants are not the same thing at all even the basic as int usage.
Thus using enum or constants depends on the usage you will do.
If you only need int values and don't care about segregation, choose constants.
If you care about type safety and need to do advanced things, choose enum.
One last word to say is that enum is to not care about the underlying value, so if you need to work with values, use constants, else enum.
Use what is the most natural thing.


text:
Q: Reports Builder 10g: Memory issue with image links? throwing a hail mary here because I couldn't find any answers for this.
I have a Reports Builder 10g project where I have multiple image file links. I was able to successfully link the first 8 images, but get the following errors on the next image link:
REP-0069: Internal error
REP-62203: Internal error reading the image - Unable to render RenderedOp for this operation.

and this error after I close that dialog box
REP-1800: Formatter error.

I believe this might be a memory issue, because I added up the linked image sizes, which totalled to ~9MB. I noticed that I could still link small images. I have a feeling the limit might be 10MB.
I was wondering if anyone else has had this issue and how you resolved it.
Thank you.

A: I believe you're right when saying that it is the size limit problem.
I've had a report which - at the bottom of every page - printed someone's signature (it was  .JPG file). If there weren't many pages, the report was created successfully. However, when there were many pages, there was an error.
My "solution" was to load that .JPG file into an image editor and made it smaller (say, from 100 kB to 5 kB). You know how it goes ... someone signs on a paper, scans it and that's it. Who cares about the size? In my case, it was an easy task (just for information, if you're interested, I used paint.net to do that as it shows the target file size when saving a new .JPG, depending on image quality).
I don't know whether you can affect those images or not. If there are many of them, huh, you (or someone else) would have a lot to do. Besides, not all images can be resized and keep the quality. Basically, it depends.
Good luck!


text:
Q: Deleting columns in protected worksheet I have a row in a worksheet that I want to stay protected, but also have columns that I want to allow the user to delete.  Is this possible?
I saw that there were checkboxes for what you could allow a protected sheet to do, but even after I check "Delete columns", it doesn't allow it to happen when I select a column.


text:
Q: On the consistency of first-order theories with an infinite sequence of proper axioms
Let $T$ be a first-order theory whose proper axioms are an infinite sequence $\alpha_1,\alpha_2,...$ of closed wffs such that $\vdash \alpha_n\to\alpha_m$ iff $n\geq m$. Prove that $T$ is consistent.

So I'm an absolute beginner when it comes to first-order theories, and I've only been introduced briefly to the same. I understand that if $T$ is consistent, then $T$ is negation consistent and absolutely consistent. I'm trying to cook up a proof by contradiction, taking the help of one of these two definitions of consistency.
Let's suppose that $T$ is not consistent, in particular, it is not negation consistent. So there exists a wff $\beta$ such that $T\vdash\beta$ and $T\vdash\lnot\beta$. Here, $T$ refers to the set of proper axioms of the first-order theory $T$, combined with the first-order axioms (seven in number as in Angelo Margaris including Ax-Gen).
What do I do next? I am trying to show that such a $\beta$ cannot exist, while miserably failing at it. How do I find the contradiction? How do I go ahead from here? Thank you!

A: If $T$ is inconsistent, then there is a finite subset that is inconsistent, which are amongst $\{\alpha_1,\alpha_2,\ldots,\alpha_n\}$ for some $n$. But these are all logically implied by $\alpha_n$, so just the single statement $\alpha_n$ is inconsistent. Since it is inconsistent, we can prove anything from it, including $\alpha_{n+1},$ thus we have $\alpha_{n}\vdash \alpha_{n+1}$ and hence $\vdash\alpha_n\to \alpha_{n+1},$ contrary to assumption.


text:
Q: What is wrong with this Makefile? (header files not found) I am modifying an old makefile in order to build a C extension for postgreSQL. The Makefile currently looks like this:
PGLIB = /usr/lib/postgresql/8.4/lib
PQINC = /usr/include/postgresql/8.4/server
CC=gcc

override CFLAGS+= $(CFLAGS_SL) -DPG_AGGREGATE

SHLIB = pg_myextlib

SRC =  foo.c \
       foobar.c

OBJS = foo.o \
       foobar.o

all: $(OBJS)
    $(CC) -shared -o $(SHLIB)$(DLSUFFIX) $(OBJS) -I$(PQINC)
    cp *.so $(PGLIB)

clean:
    rm -f $(SHLIB) $(OBJS)

The error I get when I run make is:

common.h:58:22: error: postgres.h: No such file or directory

Which suggests that the include path is not being added (the file exists in $PQINC).
Its a long time since I wrote the Makefile - and I haven't written many since. As an aside, I am pretty sure that 'shared' is not the gcc flag to build shared libs on Ubuntu (my current dev box) - I think the flag should be 'fPIC' - can someone confirm this?
I am runing gcc v4.4.3 on Ubuntu 10.0.4 and compiling for use with PG 8.4

A: Try moving the -I$(PQINC) from target all to the end of line that starts with override CFLAGS.

A: Placing -Isomething on the compiler line which turns object files, like those in $(OBJS), into executable will have no effect whatsoever.
You need to do it when you compile the source files.
Since your makefile doesn't explicitly show the rule for processing source files, it may well be using a default one, which is incredibly unlikely to know about PQINC.

A: You seem to be using the default rules to build foo.o from foo.c, which doesn't have your -I. Try adding the following rule to your Makefile:
.c.o:
        $(CC) $(CFLAGS) -c $< -o $@ -I$(PQINC)


text:
Q: Unable to merger the value of 1 column that is in multiple tables I am having trouble updating a column that is found in multiple tables with this script. I would like to use this to prevent duplicate UnitId's throughout the DB. I keep getting this error messages:

The UPDATE statement conflicted with the FOREIGN KEY constraint
  "Ppt${FA40D62B-B45A-46B2-A5C5-24BA8E5B6318}". The conflict occurred in
  database "MQS-demo", table "dbo.Unit", column 'UnitID'.

and

The DELETE statement conflicted with the REFERENCE constraint
  "Ppt${FA40D62B-B45A-46B2-A5C5-24BA8E5B6318}". The conflict occurred in
  database "MQS-demo", table "dbo.Ppt", column 'UnitID'.

Here is the query
declare @oldUnitID as int=0;
declare @newUnitID as int=0;
declare @temp as TABLE
(
     bincode nvarchar(200),
     cnt     int
)

insert into @temp
select bincode, Count(*)
from   unit
group  by bincode -- HAVING count(*)=2

--select * from @temp

WHILE (SELECT Count(*) from   @temp) > 0 BEGIN

      DECLARE @bincodetodedup as nvarchar(200);

      select top(1) @bincodetodedup = bcode
      from   @temp;

      DECLARE @unitstodedup as TABLE
      (
           unitid int,
           num    int
      )

      insert into @unitstodedup
      select distinct UnitID, ROW_NUMBER() OVER(ORDER BY unitid) as num
      from   unit
      where  bincode = @bincodetodedup
      order  by unitid

      WHILE (SELECT Count(*) from @unitstodedup) > 0 BEGIN
            SELECT TOP(1) @oldUnitID = Unitid
            from   @unitstodedup
            where  num = 1

            SELECT TOP(1) @newUnitID = Unitid
            from   @unitstodedup
            where  num > 1

            update Compatibility
            set    UnitID = @newUnitID
            where  UnitID = @oldUnitID

            update PriceList
            set    UnitID = @newUnitID
            where  UnitID = @oldUnitID

            update Project
            set    UnitID = @newUnitID
            where  UnitID = @oldUnitID

            update ProjectNum
            set    UnitID = @newUnitID
            where  UnitID = @oldUnitID

            update Rate
            set    UnitID = @newUnitID
            where  UnitID = @oldUnitID

            update Resolve
            set    UnitID = @newUnitID
            where  UnitID = @oldUnitID

            update Services
            set    UnitID = @newUnitID
            where  UnitID = @oldUnitID

            update TrainingDate
            set    UnitID = @newUnitID
            where  UnitID = @oldUnitID

            update Form
            set    UnitID = @newUnitID
            where  UnitID = @oldUnitID

            update Ppt
            set    UnitID = @newUnitID
            where  UnitID = @oldUnitID

            --update Unit set UnitID=@newUnitID where UnitID=@oldUnitID
            update Manager
            set    UnitID = @newUnitID
            where  UnitID = @oldUnitID
      END

      DELETE FROM unit
      where  unitid = @oldUnitID

      DELETE TOP(1) from @unitstodedup

      DELETE TOP(1) from @temp
END

A: Why do not you do the delete at the end with the variables you are assigning?
    DELETE from @temp where bcode = @bincodetodedup
    DELETE from @unitstodedup where num=1
    DELETE from @unitstodedup where num>1


text:
Q: Help for changing image Magento onClick How to change products color image in same box? my product view page not change the image... it goes on an other page... http://crazyprices.pk/electronics/samsung/samsung-glaxy-s6-edge.html
this is url if anyone have solution so please help me.. where i do changes for that.

A: This is what's logged in the console: jQuery(...).CloudZoom is not a function.  You are missing a js library for cloud zoom. Find out what is missing and add the js to the page.


text:
Q: Change the step value of figure colorbar in Matlab I have a colorbar in a figure in Matlab. It ranges from 0 to 4. The colorbar appears like this: 0,0.5,1,1.5,2,1.5,2,2.5,3 so as shown the step value is 0.5. I want it to step 1 at a time so that it appears like this: 0,1,2,3,4

A: The following lines should do it:
hcb=colorbar;
set(hcb,'YTick',0:4);


text:
Q: How to find minimum and maximum values in Column B based on a specific string in column A? I have a list of items in Column A and have corresponding year and month values in Column B and C respectively. I am looking to find the minimum and maximum year in Column B (based on specific value in Column A), then find the corresponding month in Column C (only for max and min value) and then generate and fill in a Start and End date in Column E and F respectively.
E.g. IF @Item = Laptop THEN FIND MIN,MAX of @YEAR and THEN FIND adjacent value in @Month. Finally formulate and display a date accordingly.
Could i achieve this using a formula or is it out of scope and is better achieved using a macro?

A: For the Start date, in E2:
=IF(A2<>A1,DATE(AGGREGATE(15,6,$B$1:$B$1000/($A$1:$A$1000=A2),1),AGGREGATE(15,6,$C$1:$C$1000/(($A$1:$A$1000=A2)*($B$1:$B$1000 = AGGREGATE(15,6,$B$1:$B$1000/($A$1:$A$1000=A2),1))),1),1),"")

And for the end date in F2:
=IF(A2<>A1,EOMONTH(DATE(AGGREGATE(14,6,$B$1:$B$1000/($A$1:$A$1000=A2),1),AGGREGATE(14,6,$C$1:$C$1000/(($A$1:$A$1000=A2)*($B$1:$B$1000 = AGGREGATE(14,6,$B$1:$B$1000/($A$1:$A$1000=A2),1))),1),1),0),"")

Then copy down the desired rows.
The aggregate function was introduced in 2010 so it will not work in excel 2007 or earlier.

I over thought they can be simplified to:
=IF(A2<>A1,AGGREGATE(15,6,DATE($B$1:$B$1000,$C$1:$C$1000,1)/($A$1:$A$1000=A2),1),"")

And:
=IF(A2<>A1,AGGREGATE(14,6,EOMONTH(DATE($B$1:$B$1000,$C$1:$C$1000,1),0)/($A$1:$A$1000=A2),1),"")

Thanks to @Jerry for showing a more succinct method.

A: Here is something that I think should work for any version of Excel, and thanks to the comment from @ScottCarver you can now copy it down and it will put the dates on the first row of each Item:
Enter this in E2 as an array formula and then copy down:
=IF(A2<>A1,MIN(IF(A:A=A2,DATE(B:B,C:C,1))),"")

Enter this in F2 as an array formula and then copy down:
=IF(A2<>A1,MAX(IF(A:A=A2,DATE(B:B,C:C+1,0))),"")

Because these are array formulas you need to press control-shift-enter instead of just enter.  After they are entered they will be surrounded by { } to indicate that they are array formulas.

Original Answer:
Here is something that I think should work for any version of Excel, but you can't copy it down - you have to enter one separately for every Item.  If you really want them spread out so that the dates are on the row of the first occurance of the Item (like in your screenshot) then this won't really work for you.
For the start date of the Laptop Item:
=MIN(IF(A:A="Laptop",DATE(B:B,C:C,1)))

For the end date of the Laptop Item:
=MAX(IF(A:A="Laptop",DATE(B:B,C:C+1,0)))

These are array formulas so you need to press control-shift-enter instead of just enter.  After they are entered they will be surrounded by { } to indicate that they are array formulas.


text:
Q: GetType in .NET Reflection does not work I'm trying to call
Type.GetType("System.Diagnostics.TraceFilter")

not typeof(System.Diagnostics.TraceFilter)
but the result is always null. Could anyone help me out? How to get class type for this abstract class?

A: From the documentation for Type.GetType(string typeName)

The assembly-qualified name of the type to get. See AssemblyQualifiedName. If the type is in the currently executing assembly or in Mscorlib.dll, it is sufficient to supply the type name qualified by its namespace.

The type you are fishing around for (i.e. "System.Diagnostics.TraceFilter") is not in the currently executing assembly or in "Mscorlib.dll", it is in fact in "System.dll". Therefore you have to use the fully qualified assembly name, e.g.:
 Type type = Type.GetType("System.Diagnostics.TraceFilter, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");

Alternatively you can use:
 Type type = typeof(System.Diagnostics.TraceFilter);

A: It's probably because you must provide an assembly-qualified name.
Better, though, would be to use this instead:
typeof(System.Diagnostics.TraceFilter)

A: According to MSDN, Type.GetType(string) requires an assembly-qualified name unless the target type is either in the currently executing assembly or mscorlib.dll. System.Diagnostics.TraceFilter is in System.dll, which means that you must use an assembly-qualified name.

A: Sometimes even if the right assembly is loaded you can't use reflection as you might expect.
It often happens when using injection frameworks like MEF or Unity.
If typeof() operator is not an option and Type.GetType() fails then this function usually does the trick:
public static Type GetTypeEx(string fullTypeName)
{
 Type type = Type.GetType(fullTypeName);
 if (type != null)
     return type;

 foreach (System.Reflection.Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
 {
     Type t2 = assembly.GetType(fullTypeName);
     if (t2 != null)
         return t2;
 }
 return null;
}


text:
Q: How can i connect these nodes as a directed graph? How can i connect these nodes as a directed graph using vectors? Also how can i make it go through each edges only once (Eulerian circuit).
#include <string>
#include <iostream>
#include <vector>
using namespace std;
class node
{
     public:
     string a;
     vector<node> connect;
     node(string b)
     {
          a = b;
     }
};

int main()
{
    vector<node> AllNodes;
    AllNodes.push_back(A);
    AllNodes.push_back(B);
    AllNodes.push_back(C);
}

A: For making edges, you need edgelist for each node. You already have that in conncection member of class node.
You just need to add into the list. So, you can just do the following:
A.connection.push_back(required_node);

It will be better if you hold a reference than a copy of an object. It will save memory.
So, you can define a member function around this logic.

A: Try something like that, add the connection to the node by using address reference
class node
{
public:
    string a;
    vector<node> connect;
    node(string b)
    {
        a = b;
    }

    void add_connect(node &n)
    {
        connect.push_back(n);
    }

    void print()
    {
        cout << "value: " << a << endl;
    }

    void print_connection()
    {
        for each (node var in connect)
        {
            cout << "conection of " << a << ": ";
            var.print();
        }
    }
};

    int main(int argc, char*argv[])
{
    node A("A"),B("B"), C("C");
    vector<node> AllNodes;
    AllNodes.push_back(A);
    AllNodes.push_back(B);
    AllNodes.push_back(C);

    A.add_connect(B);
    B.add_connect(C);

    A.print();
    A.print_connection();

    B.print();
    B.print_connection();
}


text:
Q: Integrate SCORM in LMS I have developed a Learning Management System using Java.I have to import and access the SCORM courses in my LMS.I have studied about SCORM  in scorm.com but i have no clear idea of integrating it to my LMS.So can anyone give me the steps to integrate it to my LMS or link that has good explanation.Any help is appreciated.

A: My name is Brian Caudill, I am the founder of JCA Solutions "The SCORM Authority"
SCORM has 2 versions, SCORM 1.2 and SCORM 2004. There are a few open source projects that can assist in integrating SCORM 1.2 and there are some paid for applications.
Basically what you are looking for is called a "SCORM Adapter".
I have compiled a list of 8 offerings below, hopefully it helps.
Paid Applications
Name: Simple SCORM LMS Adapter
Company: JCA Solutions (we sell this product)
Implements: SCORM 1.2 / SCORM 2004
App stack: JavaScript
URL: jcasolutions.com/simple-scorm-lms-adapter

Name: SCORM Engine
Company: Rustici Software
App Stack: .Net, JavaScript, web service
Implements: SCORM 1.2 / 2004
URL: scorm.com/scorm-solved/scorm-engine/

Name: Icodeon SCORM Player
Company: Icodeon Software
App Stack: .Net or Java
Implements: SCORM 1.2 / 2004
URL: icodeon.com/product.html

Name: Xyleme SCORM Player
Company: Xyleme
App Stack: unknown
Implements: upgrades SCORM 1.2 to SCORM 2004
URL: xyleme.com/product/scorm-player

Open source
Name: VSSCORM
Implements: SCORM 1.2
App Stack: PHP / MYSQL
URL: vsscorm.net/run-time-environment-rte/run-time-environment-downloads/

NAME: SCORMPool
Implements: SCORM 2004 4th Ed
App stack: JavaScript
URL: scormpool.com/search/download.aspx

Name: ADL SCORM Resource Libraries by  jjmarks
Implements: SCORM 1.2 and possibly 2004
App Stack: C#.NET
URL: sourceforge.net/projects/adllib

Name: Dotnetscorm
Implements: SCORM 1.2
App stack: .NET
URL: dotnetscorm.codeplex.com


text:
Q: Could not Retrieve the wsdl file in eclipse Apache Axis2 I am trying to consume a soap web service using wsdl file. In eclipse when I try  New>Other>Web Service Client> Service definition : http://abc.com/demo?wsdl&username=test&password=test
I get an error:
Could not Retrieve the wsdl file http://abc.com/demo?wsdlusername=testpassword=test

When it shows the error -  it doesn't show '&' in uri. Do I need to put some encoding ?  I tried putting wsdl somewhere else so I don't have to use username & password - that worked.  Also, The URL working in browser.  Can you please help? Thanks.

A: Have you tried using wsimport tool that is included in the JDK 6 or higher? e.g.:
wsimport http://abc.com/demo?wsdl&username=test&password=test -Xnocompile


text:
Q: Migration Assistant Reports failed files, Prompts repair errors: No Documents transferred, High Sierra I have a 2017 Macbook Pro and a 2018 Macbook Pro. The target machine has a bigger SSD than the source, so I know it's not a space issue.
I ran Migration Assistant on both machines and the process completely relatively quickly. After it completed I received about 2 dozen files that could not be transferred. The machine than boots into macOS and I start receiving repeated authorizations requests to repair files.
I also receive notice that the keychain needs to be replaced with default.
Should I attempt to boot the source into target disk mode and transfer via thunderbolt?

A: It sounds like your Migration didn't work, even though you didn't get error messages saying so at the time.
I always use either Target Mode or an external disk when I use Migration Assistant. I also don't do the Migration until I've gotten the new computer completely up-to-date, etc. I create an extra "Admin" or other dummy account which I delete later.
I would reset the 2018 MBP, create a dummy account, do all the updates, and then when the system was running perfectly, then I'd start the Migration Assistant using the 2017 MBP in Target mode.
The other thing I do, because it didn't work correctly once when I did it a different way..... After selecting the source disk, MA will scan the source and identify the files, accounts, apps, etc. that need to be transferred. Since I was transferring everything, I didn't wait for it to calculate the sizes of all these different things, and just said "Go" or "Next" or whatever to get it started. That didn't work. So, now, I always wait for the scan of the source disk to complete. I wait to see the size of the Users folder, the size of the Apps folder, etc. before I start the Migration.
Good luck!

A: Finally...got it working.
TLDR; I put the destination machine in target-disk mode, connected it with USB-C 3.1 Male-to-Male cable and used Carbon Copy Cloner to create a new sparsebundle on the root of the drive, than ran migration assistant after mounting it while running a dummy account.
It is worth noting I wanted to do a few things:

*

*Copy my machine as completely as possible (IE all my bash-profiles (I am a developer), and installed frameworks)

*Have access to the source machine during the day for work! I don't think this is too much to ask in 2018 for a transfer of 500Gb to run over a LAN or USB-C 3.1 with all modern equipment)

There are A LOT of worthless "Migration Assistant" explanations out there. So I figured I'd post a few details of what I learned this week. This is my experience it may/probably won't work for everyone else. Plus I had the advantage of migrating 500Gb to 1TB which in the end was my saving grace.
Paths I tried:

*

*Open Migration Assistant on both machines both connected to the same router (late model Linksys AC9000) network over CAT5 cables
Result: Migration assistant runs, and transfers to new machine in 2-3 hours. However (same as initial question lots of "Unable to transfer file" errors, when logging in, no Docs, Applications in directories, etc., keychain warning). FAIL

*Run Time Machine backup from source machine to external NAS (both connected over CAT5 to same Linksys AC9000 router). NAS is 12TB Symbology
Result: Time Machine taking forever after 3-4 days I attempt to use lowpri_throttle_enabled hack, backups run faster, but keeps looping on "Backing Up" (Both Migration Assistant and Time Machine have USELESS "progress indication" FAIL - Gave up after backing up for 2-days

*Go to Apple Store, and as employee: "What does Apple use to migrate machines when customers ask it to be done for them?" Answer: "USB-C, it costs $99, and there is no timeframe, you leave us both computers and we call you when it's done."
Buy generic Microcenter Inland brand "Super Speed USB 3.1 10 Gbps" USB-C Male to USB-C Male (Apple Store DOES NOT STOCK a USB-C 3.1 Male-to-Male cable as of this posting)
Connect machines with cable, and put source in 'Target Disk Mode' (Hold "T" key while booting), open 'Migration Assistant' on destination machine.
Result: Migration Assistant relatively quickly manages to collect source-information calculations (User Account, Application, Network Settings, etc. and sizes for each - though this does not seem to have much practical effect it takes A LONG TIME) Start migration, Migration assistant shows "Starting Up" for 3-hours, no change, or estimation or copy-speed indication. FAIL

*Download Carbon Copy Cloner, I was suspicious of 3rd party back-up tools being capable of working appropriately with Apple's convoluted back-up scheme and sparse-bundle file format, but CCC 5 is definitely an excellent tool, so shameless plug to them! There is also a free-trial so you don't have to pay to use it full-featured for 30-days, but you should buy a license and save yourself the brain-damage of dealing with Time Machine.
Result: Create new backup on NAS (Same Symbology 12TB NAS as before), since my Time Machine backup indefinitely never finished after 4-days. Wait (not as long as Time Machine) but overnight 4-5 hours over LAN CAT6 now. Open Migration Assistant on target machine, attach network drive, see my backup, and wait.
Migration assistant says: "Loading Backup" for 12-14 hours, I cannot click "Continue" as it is deactivated. I can see network traffic moving from the NAS to the computer and so on, but after 15 hours I give up. FAIL

*Put destination machine into target disk mode, and connect with USB-C 3.1 Male-to-Male cable to source. Format target drive, remember it has 1TB of space, and backup is only ~500Gb. Open Carbon Copy Cloner, and create new back-up on root of attached target-disk drive. This takes about 2-hours (relatively fast compared to other attempts). Attempt to boot into recovery (Discover machine just hangs at the Apple Spinning Globe screen, until I place backup sparsebundle inside of a directory on the root of the drive, I just call it backup/macbook-pro-2017.sparsebundle
Result: I than reinstall MacOS, and create a dummy account (as suggested by @Zonker.in.Geneva) and than boot, run updates, verify that I still have my .sparsebundle archive, than I "mount it" (Double click it in Finder), and than open Migration Assistant.
Now I see Macbook-Pro-2017 as a source, I select it, and it very quickly manages to do the size calculations. I start the migration once they complete, it's worth noting that as a developer I have A LOT of tiny files (it calculated 3.5 million in the sparsebundle),
Migration takes ~12 hours. Again the time/progress indicators are WORTHLESS. Sometimes it says reading 130mb/s, sometimes nothing. Sometimes 3 days to finish, sometimes 3 hours. It's completely worthless.
Finally, I reboot the machine and it says "Migration Complete" and magically, I am able to login to my account as if I was on the original machine, and it appears so far that everything is as expected.
The big caveat here is that I had a 1TB machine as a destination for ~500Gb worth of files, and after migration I only have about 50Gb of space left before I delete the sparsebundle. SUCCESS, now if I could only get the last week of time I spent messing around with this back. Thanks for the productivity bump Apple.


text:
Q: Why the result of "SELECT 'ä' = 'ae' COLLATE latin1_german2_ci;" is 1? I am a Chinese. I can not understand why the result of "SELECT 'ä' = 'ae' COLLATE latin1_german2_ci", which is the example on MySQL document, is 1?
Besides, I have read another article. It set the charset as latin1 first, and then the result of "SELECT 'ä' = 'ae' COLLATE latin1_german2_ci" becomes 0. Why is the two results of the same sql is different? Is it because the charset difference?
On MySQL document.
mysql> SELECT 'ä' LIKE 'ae' COLLATE latin1_german2_ci;
+-----------------------------------------+
| 'ä' LIKE 'ae' COLLATE latin1_german2_ci |
+-----------------------------------------+
|                                       0 |
+-----------------------------------------+
mysql> SELECT 'ä' = 'ae' COLLATE latin1_german2_ci;
+--------------------------------------+
| 'ä' = 'ae' COLLATE latin1_german2_ci |
+--------------------------------------+
|                                    1 |
+--------------------------------------+

On the another article.
mysql> set charset latin1;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT 'ä' = 'ae' COLLATE latin1_german2_ci;
+---------------------------------------+
| 'ä' = 'ae' COLLATE latin1_german2_ci  |
+---------------------------------------+
|                                     0 |
+---------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT 'ä' LIKE 'ae' COLLATE latin1_german2_ci;
+------------------------------------------+
| 'ä' LIKE 'ae' COLLATE latin1_german2_ci  |
+------------------------------------------+
|                                        0 |
+------------------------------------------+
1 row in set (0.00 sec)


text:
Q: Custom fonts in CSS using font-face So I have looked, looked, looked, changed and trialled but I can not for the life of me get this to work. Has anyone got any insight into where the problem lies?
@font-face {
  font-family: 'customFont';
  src: url('www.100%CorrectURL.com/font.eot');
  src: url('www.100%CorrectURL.com/font.eot?#iefix') format('embedded-opentype'),
       url('www.100%CorrectURL.com/font.woff') format('woff'),
       url('www.100%CorrectURL.com/font.ttf') format('truetype'),
       url('www.100%CorrectURL.com/font.svg#paulmaulregular') format('svg');
  font-weight: normal;
  font-style: normal;
}

The URL is definately correct (I have changed the one in the above source) but for some reason, it just doesn't load the font to the page.

A: Your code is correct, but you might remove this two tags:
  font-weight: normal;
  font-style: normal;

IT should work, otherwise, you need to use another webfont (google font are always working)
Note: the url "www.100%CorrectURL.com/font.eot" isn't existing, you need to add a correct url.


text:
Q: Morse code in Arduino Mega 2560, using buttons and a buzzer I'm trying to make a simple morse code in Arduino, using a breadboard, one buzzer and two buttons. When button1 is pushed, the output of the buzzer should be a sound signal for 200ms. If the other button (button2) is pushed, the output of the buzzer should be a sound signal for 400ms.
Also when button1 is pushed the program should print "." to the screen. Similarly, print "-" for the longer output.
This is my code:
const int buttonPin1 = 10;
const int buttonPin2 = 8;
const int buzzPin = 13;

void setup() {
  // put your setup code here, to run once:
  pinMode(buttonPin1, INPUT);
  pinMode(buttonPin2, INPUT);
  pinMode(buzzPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  noTone(buzzPin);

  if (buttonPin1 == true) {
    Serial.println('.');
    tone(buzzPin, 1000);
    delay(200);
  }
  else if (buttonPin2 == true) {
    Serial.println('-');
    tone(buzzPin, 1000);
    delay(400);
  }
}

Currently, it does not work, and I am not sure what's incorrect if it is my code or the circuit. I am not receiving any output, either from the buzzer or in Arduino.
I would appreciate if anyone could guide me onto the right tracks.
Thanks.

A: buttonPin1 == true and buttonPin2 == true are compareing true with the pin number, not the status of pins.
You should use digitalRead() function to check status of pins.
void loop() {
  // put your main code here, to run repeatedly:
  noTone(buzzPin);

  if (digitalRead(buttonPin1) == HIGH) { // check pin status instead of doing constant comparision
    Serial.println('.');
    tone(buzzPin, 1000);
    delay(200);
  }
  else if (digitalRead(buttonPin2) == HIGH) { // check pin status instead of doing constant comparision
    Serial.println('-');
    tone(buzzPin, 1000);
    delay(400);
  }
}


text:
Q: Passing object as parameter for constructor I have 3 classes. These classes are Class1, Parent and Child. I'm having some trouble to figure out how to write a constructor I need for my Child class.
public Class1
{
    private String firstName;
    private String lastName;

    public Class1()
    {
    firstName="";
    lastName="";
    }

    public Class1(String firstName, String lastName)
    {
    this.firstName=firstName;
    this.lastName=lastName;
    }

    //Methods and stuff
}

public Parent
{
    private Class1 class1;
    private double number;

    public Parent();
    {
    class1=new Class1();
    number=0;
    }

    public Parent(Class1 c, double n)
    {
    Class1=c;
    number=n;
    }

//Methods and stuff
}

public Child extends Parent
{
    private String string;
    private Boolean boolean;

    public Child(Class1 class1, double n, String s, Boolean b)
    {
    //Don't know how to get the Class1 part to work
    //Don't know how to get the double to work
    string=s;
    boolean=b;

//Methods and stuff
}

I don't know how to write the code so that I can get my constructor to take the arguments like this:
new Child(new Class1("String", "String"), 10, "String", true);

I hope this helps clarify what my problem is.

A: Create Child constructor as
public Child(Class1 objClass1, double number, string str, boolean bool){
    super(objClass1,number);
    this.str=str;
    this.bool=bool;
}

Create Parent constructor as
public Parent(Class1 objClass1, double number){
    this.objClass1=objClass1;
    this.number=number;
}

and you can called the child constructor as
Child objChild=new Child(new Class1(str1,str2),number,str,bool);

A: I'm not going to give you the code, because you've not given us enough information, but let's assume you've got a class structure like..
 public class Parent
 {
     private String field;

     public Parent(String field) {
         this.field = field;
     }
 }

 public class Child extends Parent {
     private String field;

     public Child(String field)
     {
         this.field = field;
     }
 }

What you can do is specify a constructor in your Child class that passes the variables up the inheritance chain, to your Parent class:
public Child(String field, String parentField)
{
     super(parentField); // Calls the parent class.
     this(field);
}

So what you've done there, is passed the parentField up to the Parent class, and you've called your existing constructor that accepts a single String parameter.
Apply this principle to your code and you'll get it in minutes.


text:
Q: Patching \usepackage / \RequirePackage I want to implement automatic benchmarking for the packages I load (some of which are my own). Right now my preamble takes 15 seconds to load, much longer than the rest of my document seems to take to compile.
For this I wanted to implement a remark from this answer, which recommended using etoolbox's patchcmmd to patch usepackage. As most of my package loading happens inside of my own packages, I wanted to use this approach on RequirePackage. I opted however to use xpatch's utilities, as I had read that the normal patchcmd can't deal with commands with optional arguments.
My best try so far is this (please don't mind the ugly automatic output via AfterEndPreamble):
\RequirePackage{fp}
\RequirePackage{xpatch}
\newcount\timer

\xpretocmd{\RequirePackage}{\pdfresettimer}{}{}
\xapptocmd{\RequirePackage}{
    \timer=\pdfelapsedtime
    \FPdiv\temp{\the\timer}{65.536}
    \FPtrunc\temp\temp{3}
    \AfterEndPreamble{\par{#1:} \temp}
}{}{}

% Testing
\RequirePackage{tikz}
\RequirePackage{mathtools}

\documentclass{article}
\begin{document}

\end{document}

But sadly this produces an Error:
! LaTeX Error: File `\timer.sty' not found.

My best guess is that this is because ProvideCommand has a second optional argument after the normal one and xpatchcmd can't handle that, causing ProvideCommand to consume the appended text as it's main argument. But I'm way out of my comfort zone here, and I have not managed to understand ProvideCommand via \show so far (and I assume there must be a better way of just patching a command with surrounding code anyway, without knowing its internal structure). Any help is greatly appreciated.

A: You could use (with a new latex) the package hooks to define a list of packages that should be measured (the calculation is stolen from egregs answer):
\ExplSyntaxOn
\newcommand{\BenchmarkPackages}[1]
 {%
  \clist_map_inline:nn{#1}
   {
    \AddToHook{package/before/##1}{\pdfresettimer}
    \AddToHook{package/after/##1}{\typeout{##1: \fp_eval:n{round(\pdfelapsedtime/65.536,3)}}}
   }
 }
\ExplSyntaxOff
\BenchmarkPackages{tikz,mathtools,scrbase}

\documentclass{scrartcl}
\usepackage{tikz}
\begin{document}
alblb
\end{document}

This will then write something like tikz:1085.999 in the log (one could naturally also store the value and print it later).

A: Asking latexdef RequirePackage yields
% latex.ltx, line 10034:
\def\RequirePackage{%
  \@fileswithoptions\@pkgextension}

Oh, well, now we need to do latexdef @fileswithoptions
% latex.ltx, line 10097:
\def\@fileswithoptions#1{%
  \@ifnextchar[%]
    {\@fileswith@ptions#1}%
    {\@fileswith@ptions#1[]}}

which means that the macro absorbs one token or one braced argument and tests if a [ comes along. If you add those tokens at the end of \RequirePackage, the argument passed to \@fileswithoptions will be \@pkgextension and the test for [ will return false, so we'd end up with
\@fileswith@ptions\@pkgextension\timer=\pdfelapsedtime

and this will fail as you see, because
\def\@fileswith@ptions#1[#2]#3{%
  \@ifnextchar[%]
  {\@fileswith@pti@ns#1[{#2}]#3}%
  {\@fileswith@pti@ns#1[{#2}]#3[]}}

so argument #3 will be \timer instead of a list of file names (without extensions).
Sorry, but this is not going to work in any sensible way, because of nested \RequirePackage done by the packages you load.
\RequirePackage{fp}
\newcount\timer

\newcommand{\TimeRequirePackage}[1]{%
  \pdfresettimer
  \RequirePackage{#1}%
  \timer=\pdfelapsedtime
  \FPdiv\temp{\the\timer}{65.536}%
  \FPtrunc\temp\temp{3}%
  \printresult{#1}%
}
\newcommand{\printresult}[1]{\expandafter\printresultaux\expandafter{\temp}{#1}}
\newcommand{\printresultaux}[2]{\AtBeginDocument{\par#2: #1}}

% Testing
\TimeRequirePackage{tikz}
\TimeRequirePackage{mathtools}

\documentclass{article}
\begin{document}
\end{document}

Note that you need to expand \temp before passing it to \AtBeginDocument (not \AtEndPreamble).
With xfp
\RequirePackage{xfp}

\newcommand{\TimeRequirePackage}[1]{%
  \pdfresettimer
  \RequirePackage{#1}%
  \expanded{\noexpand\AtBeginDocument{\par#1: \fpeval{round(\pdfelapsedtime/65.536,3)}}}
}

% Testing
\TimeRequirePackage{tikz}
\TimeRequirePackage{mathtools}

\documentclass{article}
\begin{document}
\end{document}


text:
Q: Why can I not use re.sub to replace a group? My goal is to find a group in a string using regex and replace it with a space.
The group I am looking to find is a group of symbols only when they fall between strings. When I use re.findall() it works exactly as expected
word = 'This##Is # A # Test#'
print(word)
re.findall(r"[a-zA-Z\s]*([\$\#\%\!\s]*)[a-zA-Z]",word)
>>> ['##', '# ', '# ', '']

But when I use re.sub(), instead of replacing the group, it replaces the entire regex.
x = re.sub(r"[a-zA-Z\s]*([\$\#\%\!\s]*)[a-zA-Z]",r' ',word)
print(x)
>>> '    #'

How can I use regular expressions to replace ONLY the group? The outcome I expect is:
'This Is A Test#'

A: *

*First, there's no need to escape every "magic" character within a character class, [$#%!\s]* is equally fine and much more readable.

*Second, matching (i.e. retrieving) is different from replacing and you could use backreferences to achieve your goal.

*Third, if you only want to have # at the end, you could help yourself with a much easier expression:
(?:[\s#](?!\Z))+

Which would then need to be replaced by a space, see a demo on regex101.com.

In Python this could be:

import re

string = "This##Is # A # Test#"
rx = re.compile(r'(?:[\s#](?!\Z))+')

new_string = rx.sub(' ', string)
print(new_string)
# This Is A Test#

A: You can group the portions of the pattern you want to retain and use backreferences in your replacement string instead:
x = re.sub(r"([a-zA-Z\s]*)[\$\#\%\!\s]*([a-zA-Z])", r'\1 \2', word)

A: The problem is that your regex matches the wrong thing entirely.
x = re.sub(r'\b[$#%!\s]+\b', ' ', word)


text:
Q: how to delete document from firebase I need to delete one doc from firebase by clicking on it's icon. The problem is I dont't know how to tag the specific id of each doc in vuetify
this is my card (1 card for 1 project)
  <v-card flat v-for="project in projects" :key="project.title">
    <v-layout row wrap :class="`pa-3 project ${project.status}`">
      <v-flex xs12 md6>

Project title

{{ project.title }}

      </v-flex>
      <v-flex xs6 sm4 md2>

Person

{{ project.person }}

      </v-flex>
      <v-flex xs6 sm4 md2>

Due by

{{ project.due }}

      </v-flex>
      <v-flex xs2 sm4 md2>
      <v-btn flat color='red' slot='activator' class='right mx-0 my-0' @click='deleteProject()'>
      <v-icon>delete</v-icon>
     </v-btn>

          <v-chip small :class="`${project.status} white--text caption mx-0`">{{ project.status}}</v-chip>

      </v-flex>
    </v-layout>
    <v-divider></v-divider>
  </v-card>

And this method I try to write
deleteProject() {
  console.log('deleted');
  let idP = element.id; // obviously that i have problem with this line
  db.collection('projects').doc(idP).delete()
}

A: I think you are fetching projects from firebase and you will always get an Id for firebase document you are fetching. You should store that id with rest of the values. After that when you are calling your deleteProject function you can pass your Id in that function like this.
<v-btn flat color='red' slot='activator' class='right mx-0 my-0' @click='deleteProject(project.Id)'>

And than receive the Id in your function like this
deleteProject(Id) {
  console.log('deleted');
  db.collection('projects').doc(Id).delete()
}

Hopefully, this will solve your problem.


text:
Q: How to bind validation errors to a request using MultiActionController? I've tried a lot to implement a validation inside a MultiActionController and it seems it's not plain sailing.
I need to validate a form and, in case of failure, I want to redirect to the same form, displaying the errors and also being able to load some info from a database.
So basically I have this:
@RequestMapping("/addResponse.htm")
public ModelAndView addResponse(@ModelAttribute("responseDTO") ResponseDTO
             respDTO, BindingResult result, HttpServletRequest request) {

 ResponseFormValidator respValidator = new ResponseFormValidator();
 respValidator.validate(respDTO, result);

 if (result.hasErrors()) {
  return new ModelAndView("redirect:responseForm.htm?id=" + respDTO.getProjID());
 }
}

What I want is for the responseForm handler method to remember the errors resulted from the validation process (the Result Object)
Of course, I can copy and paste the logic from that method inside my if statement but I'm thinking it must be a better way than just copy and paste.
Any help will be highly appreciated!

A: In Spring version prior to 3.1.x, if you want to pass object through a redirect, you have to make your controller "session" aware.
http://static.springsource.org/spring/docs/2.5.x/reference/portlet.html#portlet-controller
(part 16.9, look for @SessionAttribute)
But after it is your responsibility to clean the object(s) stored in session that you do not want to use anymore.
With Spring 3.1.x, the flashAttribute is a very useful mecanism and Spring does the job for that.
http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-flash-attributes
Hereunder a little code to show the principle:
@RequestMapping(value = "form", method = RequestMethod.GET)
public String showForm(@ModelAttribute("form") FormBean formBean) {

    // Set some properties if needed

    return "tiles-litools-mml";
}

@RequestMapping(value = "form", method = RequestMethod.POST)
public String formAction( @Validated({MyValidator.class})
    @ModelAttribute("form") FormBean formBean,
    BindingResult validatorresult, Model model, Errors errors,
    RedirectAttributes redirectAttributes) {

    //redirect if any error
    if (validatorresult.hasErrors()){

        redirectAttributes.addFlashAttribute("message", "MML session failed");
        redirectAttributes.addFlashAttribute("form", formBean);
        redirectAttributes.addFlashAttribute("validation", validatorresult);
        return "redirect:/app/tools/form"; // redirect to the form GET method

    }

    // TODO continue code for process the form (valid!)

}

I assume you do not extends MultiActionController.