text:
Q: Not able to remove focus from input field I have four textfields, a title field, a details field, a date field, and a time field. Both the date and time fields are wrapped within a gesture detector, and onTap calls a pickDateAndTime method. The problem is that when I click on the date field and try to manually change the time through the input rather than the dial way, the focus goes to the title field and when I am still on the time picker and type something in the time picker, the title field gets changed with the new input. The weird part is that this error just appeared out of nowhere, and there are no errors reported in the console.
class TodoScreen extends StatefulWidget {
  final int? todoIndex;
  final int? arrayIndex;

  const TodoScreen({Key? key, this.todoIndex, this.arrayIndex})
      : super(key: key);

  @override
  State<TodoScreen> createState() => _TodoScreenState();
}

class _TodoScreenState extends State<TodoScreen> {
  final ArrayController arrayController = Get.find();
  final AuthController authController = Get.find();
  final String uid = Get.find<AuthController>().user!.uid;
  late TextEditingController _dateController;
  late TextEditingController _timeController;
  late TextEditingController titleEditingController;
  late TextEditingController detailEditingController;

  late String _setTime, _setDate;
  late String _hour, _minute, _time;
  late String dateTime;
  late bool done;

  @override
  void initState() {
    super.initState();
    String title = '';
    String detail = '';
    String date = '';
    String? time = '';

    if (widget.todoIndex != null) {
      title = arrayController
              .arrays[widget.arrayIndex!].todos![widget.todoIndex!].title ??
          '';
      detail = arrayController
              .arrays[widget.arrayIndex!].todos![widget.todoIndex!].details ??
          '';
      date = arrayController
          .arrays[widget.arrayIndex!].todos![widget.todoIndex!].date!;
      time = arrayController
          .arrays[widget.arrayIndex!].todos![widget.todoIndex!].time;
    }

    _dateController = TextEditingController(text: date);
    _timeController = TextEditingController(text: time);
    titleEditingController = TextEditingController(text: title);
    detailEditingController = TextEditingController(text: detail);
    done = (widget.todoIndex == null)
        ? false
        : arrayController
            .arrays[widget.arrayIndex!].todos![widget.todoIndex!].done!;
  }

  DateTime selectedDate = DateTime.now();
  TimeOfDay selectedTime = TimeOfDay(
      hour: (TimeOfDay.now().minute > 55)
          ? TimeOfDay.now().hour + 1
          : TimeOfDay.now().hour,
      minute: (TimeOfDay.now().minute > 55) ? 0 : TimeOfDay.now().minute + 5);

  Future<DateTime?> _selectDate() => showDatePicker(
      builder: (context, child) {
        return datePickerTheme(child);
      },
      initialEntryMode: DatePickerEntryMode.calendarOnly,
      context: context,
      initialDate: selectedDate,
      initialDatePickerMode: DatePickerMode.day,
      firstDate: DateTime.now(),
      lastDate: DateTime(DateTime.now().year + 5));

  Future<TimeOfDay?> _selectTime() => showTimePicker(
      builder: (context, child) {
        return timePickerTheme(child);
      },
      context: context,
      initialTime: selectedTime,
      initialEntryMode: TimePickerEntryMode.input);

  Future _pickDateTime() async {
    DateTime? date = await _selectDate();
    if (date == null) return;
    if (date != null) {
      selectedDate = date;
      _dateController.text = DateFormat("MM/dd/yyyy").format(selectedDate);
    }
    TimeOfDay? time = await _selectTime();
    if (time == null) {
      _timeController.text = formatDate(
          DateTime(
              DateTime.now().year,
              DateTime.now().day,
              DateTime.now().month,
              DateTime.now().hour,
              DateTime.now().minute + 5),
          [hh, ':', nn, " ", am]).toString();
    }
    if (time != null) {
      selectedTime = time;
      _hour = selectedTime.hour.toString();
      _minute = selectedTime.minute.toString();
      _time = '$_hour : $_minute';
      _timeController.text = _time;
      _timeController.text = formatDate(
          DateTime(2019, 08, 1, selectedTime.hour, selectedTime.minute),
          [hh, ':', nn, " ", am]).toString();
    }
  }

  @override
  Widget build(BuildContext context) {
    bool visible =
        (_dateController.text.isEmpty && _timeController.text.isEmpty)
            ? false
            : true;

    final formKey = GlobalKey<FormState>();

    return Scaffold(
      resizeToAvoidBottomInset: false,
      appBar: AppBar(
        title: Text((widget.todoIndex == null) ? 'New Task' : 'Edit Task',
            style: menuTextStyle),
        leadingWidth: (MediaQuery.of(context).size.width < 768) ? 90.0 : 100.0,
        leading: Center(
          child: Padding(
            padding: (MediaQuery.of(context).size.width < 768)
                ? const EdgeInsets.only(left: 0)
                : const EdgeInsets.only(left: 21.0),
            child: TextButton(
              style: const ButtonStyle(
                splashFactory: NoSplash.splashFactory,
              ),
              onPressed: () {
                Get.back();
              },
              child: Text(
                "Cancel",
                style: paragraphPrimary,
              ),
            ),
          ),
        ),
        centerTitle: true,
        actions: [
          Center(
            child: Padding(
              padding: (MediaQuery.of(context).size.width < 768)
                  ? const EdgeInsets.only(left: 0)
                  : const EdgeInsets.only(right: 21.0),
              child: TextButton(
                style: const ButtonStyle(
                  splashFactory: NoSplash.splashFactory,
                ),
                onPressed: () async {
                },
                child: Text((widget.todoIndex == null) ? 'Add' : 'Update',
                    style: paragraphPrimary),
              ),
            ),
          )
        ],
      ),
      body: SafeArea(
        child: Container(
          width: double.infinity,
          padding: (MediaQuery.of(context).size.width < 768)
              ? const EdgeInsets.symmetric(horizontal: 15.0, vertical: 20.0)
              : const EdgeInsets.symmetric(horizontal: 35.0, vertical: 15.0),
          child: Column(
            children: [
              Form(
                key: formKey,
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    TextFormField(
                        validator: Validator.titleValidator,
                        controller: titleEditingController,
                        autofocus: true, // problem here
                        autocorrect: false,
                        cursorColor: Colors.grey,
                        maxLines: 1,
                        maxLength: 25,
                        textInputAction: TextInputAction.next,
                        decoration: InputDecoration(
                            counterStyle: counterTextStyle,
                            hintStyle: hintTextStyle,
                            hintText: "Title",
                            border: InputBorder.none),
                        style: todoScreenStyle),
                    primaryDivider,
                    TextField(
                        controller: detailEditingController,
                        maxLines: null,
                        autocorrect: false,
                        cursorColor: Colors.grey,
                        textInputAction: TextInputAction.done,
                        decoration: InputDecoration(
                            counterStyle: counterTextStyle,
                            hintStyle: hintTextStyle,
                            hintText: "Notes",
                            border: InputBorder.none),
                        style: todoScreenDetailsStyle),
                  ],
                ),
              ),
              Visibility(
                visible: (widget.todoIndex != null) ? true : false,
                child: GestureDetector(
                  onTap: () {},
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text(
                        "Completed",
                        style: todoScreenStyle,
                      ),
                      Transform.scale(
                        scale: 1.3,
                        child: Theme(
                            data: ThemeData(
                                unselectedWidgetColor: const Color.fromARGB(
                                    255, 187, 187, 187)),
                            child: Checkbox(
                                shape: const CircleBorder(),
                                checkColor: Colors.white,
                                activeColor: primaryColor,
                                value: done,
                                side: Theme.of(context).checkboxTheme.side,
                                onChanged: (value) {
                                  setState(() {
                                    done = value!;
                                  });
                                })),
                      )
                    ],
                  ),
                ),
              ),
              GestureDetector(
                onTap: () async {
                  await _pickDateTime();
                  setState(() {
                    visible = true;
                  });
                },
                child: Column(
                  children: [
                    Row(
                      children: [
                        Flexible(
                          child: TextField(
                            enabled: false,
                            controller: _dateController,
                            onChanged: (String val) {
                              _setDate = val;
                            },
                            decoration: InputDecoration(
                                hintText: "Date",
                                hintStyle: hintTextStyle,
                                border: InputBorder.none),
                            style: todoScreenStyle,
                          ),
                        ),
                        visible
                            ? IconButton(
                                onPressed: () {
                                  _dateController.clear();
                                  _timeController.clear();
                                  setState(() {});
                                },
                                icon: const Icon(
                                  Icons.close,
                                  color: Colors.white,
                                ))
                            : Container()
                      ],
                    ),
                    primaryDivider,
                    TextField(
                      onChanged: (String val) {
                        _setTime = val;
                      },
                      enabled: false,
                      controller: _timeController,
                      decoration: InputDecoration(
                          hintText: "Time",
                          hintStyle: hintTextStyle,
                          border: InputBorder.none),
                      style: todoScreenStyle,
                    )
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Should I open an issue on Github, as I had not made any changes to the code for it behave this way and also because there were no errors in the console
Here is the full code on Github
Update
Here is a reproducible example:
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const TodoScreen(),
    );
  }
}

class TodoScreen extends StatefulWidget {
  const TodoScreen({Key? key}) : super(key: key);

  @override
  State<TodoScreen> createState() => _TodoScreenState();
}

class _TodoScreenState extends State<TodoScreen> {
  late TextEditingController _dateController;
  late TextEditingController _timeController;
  late TextEditingController titleEditingController;
  late TextEditingController detailEditingController;

  late String _setTime, _setDate;
  late String _hour, _minute, _time;
  late String dateTime;

  @override
  void initState() {
    super.initState();
    String title = '';
    String detail = '';
    String date = '';
    String? time = '';

    _dateController = TextEditingController(text: date);
    _timeController = TextEditingController(text: time);
    titleEditingController = TextEditingController(text: title);
    detailEditingController = TextEditingController(text: detail);
  }

  @override
  void dispose() {
    super.dispose();
    titleEditingController.dispose();
    detailEditingController.dispose();
    _timeController.dispose();
    _dateController.dispose();
  }

  Theme timePickerTheme(child) => Theme(
        data: ThemeData.dark().copyWith(
          timePickerTheme: TimePickerThemeData(
            backgroundColor: const Color.fromARGB(255, 70, 70, 70),
            dayPeriodTextColor: Colors.green,
            hourMinuteTextColor: MaterialStateColor.resolveWith((states) =>
                states.contains(MaterialState.selected)
                    ? Colors.white
                    : Colors.white),
            dialHandColor: Colors.green,
            helpTextStyle: TextStyle(
                fontSize: 12, fontWeight: FontWeight.bold, color: Colors.green),
            dialTextColor: MaterialStateColor.resolveWith((states) =>
                states.contains(MaterialState.selected)
                    ? Colors.white
                    : Colors.white),
            entryModeIconColor: Colors.green,
          ),
          textButtonTheme: TextButtonThemeData(
            style: ButtonStyle(
                foregroundColor:
                    MaterialStateColor.resolveWith((states) => Colors.green)),
          ),
        ),
        child: child!,
      );

  Theme datePickerTheme(child) => Theme(
        data: ThemeData.dark().copyWith(
            colorScheme: ColorScheme.dark(
          surface: Colors.green,
          secondary: Colors.green,
          onPrimary: Colors.white,
          onSurface: Colors.white,
          primary: Colors.green,
        )),
        child: child!,
      );

  DateTime selectedDate = DateTime.now();
  TimeOfDay selectedTime = TimeOfDay(
      hour: (TimeOfDay.now().minute > 55)
          ? TimeOfDay.now().hour + 1
          : TimeOfDay.now().hour,
      minute: (TimeOfDay.now().minute > 55) ? 0 : TimeOfDay.now().minute + 5);

  Future<DateTime?> _selectDate() => showDatePicker(
      builder: (context, child) {
        return datePickerTheme(child);
      },
      initialEntryMode: DatePickerEntryMode.calendarOnly,
      context: context,
      initialDate: selectedDate,
      initialDatePickerMode: DatePickerMode.day,
      firstDate: DateTime.now(),
      lastDate: DateTime(DateTime.now().year + 5));

  Future<TimeOfDay?> _selectTime() => showTimePicker(
      builder: (context, child) {
        return timePickerTheme(child);
      },
      context: context,
      initialTime: selectedTime,
      initialEntryMode: TimePickerEntryMode.input);

  Future _pickDateTime() async {
    DateTime? date = await _selectDate();
    if (date == null) return;
    if (date != null) {
      selectedDate = date;
      _dateController.text = selectedDate.toString();
    }
    TimeOfDay? time = await _selectTime();
    if (time != null) {
      selectedTime = time;
      _hour = selectedTime.hour.toString();
      _minute = selectedTime.minute.toString();
      _time = '$_hour : $_minute';
      _timeController.text = _time;
      _timeController.text =
          DateTime(2019, 08, 1, selectedTime.hour, selectedTime.minute)
              .toString();
    }
  }

  @override
  Widget build(BuildContext context) {
    bool visible =
        (_dateController.text.isEmpty && _timeController.text.isEmpty)
            ? false
            : true;

    final formKey = GlobalKey<FormState>();

    return Scaffold(
      resizeToAvoidBottomInset: false,
      appBar: AppBar(
        centerTitle: true,
      ),
      body: SafeArea(
        child: Container(
          width: double.infinity,
          padding: (MediaQuery.of(context).size.width < 768)
              ? const EdgeInsets.symmetric(horizontal: 15.0, vertical: 20.0)
              : const EdgeInsets.symmetric(horizontal: 35.0, vertical: 15.0),
          child: Column(
            children: [
              Container(
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(14.0)),
                  padding: const EdgeInsets.symmetric(
                      horizontal: 24.0, vertical: 15.0),
                  child: Form(
                    key: formKey,
                    child: Column(
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        TextFormField(
                          controller: titleEditingController,
                          autofocus: true,
                          autocorrect: false,
                          cursorColor: Colors.grey,
                          maxLines: 1,
                          maxLength: 25,
                          textInputAction: TextInputAction.next,
                          decoration: InputDecoration(
                              hintText: "Title", border: InputBorder.none),
                        ),
                        Divider(color: Colors.black),
                        TextField(
                          controller: detailEditingController,
                          maxLines: null,
                          autocorrect: false,
                          cursorColor: Colors.grey,
                          textInputAction: TextInputAction.done,
                          decoration: InputDecoration(
                              hintText: "Notes", border: InputBorder.none),
                        ),
                      ],
                    ),
                  )),
              GestureDetector(
                onTap: () async {
                  await _pickDateTime();
                  setState(() {
                    visible = true;
                  });
                },
                child: Container(
                    margin: const EdgeInsets.only(top: 20.0),
                    width: double.infinity,
                    padding: const EdgeInsets.symmetric(
                        horizontal: 24.0, vertical: 15.0),
                    decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(14.0)),
                    child: Column(
                      children: [
                        Row(
                          children: [
                            Flexible(
                              child: TextField(
                                enabled: false,
                                controller: _dateController,
                                onChanged: (String val) {
                                  _setDate = val;
                                },
                                decoration: InputDecoration(
                                    hintText: "Date", border: InputBorder.none),
                              ),
                            ),
                            visible
                                ? IconButton(
                                    onPressed: () {
                                      _dateController.clear();
                                      _timeController.clear();
                                      setState(() {});
                                    },
                                    icon: const Icon(
                                      Icons.close,
                                      color: Colors.white,
                                    ))
                                : Container()
                          ],
                        ),
                        Divider(
                          color: Colors.blue,
                        ),
                        TextField(
                          onChanged: (String val) {
                            _setTime = val;
                          },
                          enabled: false,
                          controller: _timeController,
                          decoration: InputDecoration(
                              hintText: "Enter", border: InputBorder.none),
                        )
                      ],
                    )),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

A: In your main.dart file, you should return something like this:
void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        // This allows closing keyboard when tapping outside of a text field
        FocusScopeNode currentFocus = FocusScope.of(context);

        if (!currentFocus.hasPrimaryFocus &&
            currentFocus.focusedChild != null) {
          FocusManager.instance.primaryFocus!.unfocus();
        }
      },
      child: // your app's entry point,
    );
  }
}

A: Add a focusNode in your textField:
FocusNode focusNode = FocusNode();

TextField(
    focusNode: focusNode,
);

And then in the gesture detector, add that following code to unselect the textfield input:
FocusScope.of(context).requestFocus(FocusNode());

A: simply wrap your Scaffold widget GestureDetector and add FocusScope.of(context).requestFocus(FocusNode()); it will automatically unfocused text field when you click anywhere on your screen
GestureDetector(
        onTap: () {
          FocusScope.of(context).requestFocus(FocusNode());
        },
     child: Scaffold()
)

A: You can use below code to remove focus in gesture detector event
 FocusScopeNode currentFocus = FocusScope.of(context);
    if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) {
      currentFocus.unfocus();
    }


text:
Q: Doctrine - populate field custom insert I'm building a project using Doctrine 2 to interact with my database (I'm usign postgres).
For one of my entities I need to have a field that, on insert, is populated using a postgres function.
Is there a way to this with Doctrine? Is there an annotation to specify this? Otherwise, is there a way to override the query made when performing the database insert?

redpajama_set_name: RedPajamaStackExchange


text:
Q: how to access object in template in Backbone My backbone code is :
var UserList=Backbone.View.extend({
            el:'.page',
            render:function() {
                var that=this;
                var users=new Users();
                users.fetch({
                    success:function(users){
                        var template=_.template($('#user-list-template').html(),{users:users.models});

                        that.$el.html(template);
                    }
                })

            }
        });

Template code :

The code is throwing UncaughtReferenceError:users not defined . Please let me know how to correct the above code.


text:
Q: How can you remotely login to a remote computer using C#? I'm trying to write a small command line application with C# that will prompt for a username and a password that will be used to login to several remote computers that are sitting on the same network/domain and start a local session.
I've tried connecting to a remote computer and to query the remote PC's operating system info with the following code:
ConnectionOptions options = new ConnectionOptions();

ManagementScope scope = new ManagementScope(@"\\REMOTE_COMPUTER_NAME");
scope.Connect();

ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_OperatingSystem");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);

ManagementObjectCollection queryCollection = searcher.Get();

foreach (ManagementObject m in queryCollection)
{
    // Display the remote computer information
    Console.WriteLine("Computer Name : {0}", m["csname"]);
    Console.WriteLine("Windows Directory : {0}", m["WindowsDirectory"]);
    Console.WriteLine("Operating System: {0}", m["Caption"]);
    Console.WriteLine("Version: {0}", m["Version"]);
    Console.WriteLine("Manufacturer : {0}", m["Manufacturer"]);
}

However, this only returns information on the local PC that I'm working on and not on the remote PC.
Am I overlooking something with this code? And is there an appropriate approach to accomplish what I am trying to do?

A: I don't have remote machine right now to give you the working example, but you can try this. advapi32.logonuser
Example:
[DllImport("advapi32.dll")]
public static extern bool LogonUser(string name, string domain, string pass,
int logType, int logpv, out IntPtr pht);

IntPtr ptr;
// LogonUser("username", "remotemachine", "password", 2, 0, out ptr);
LogonUser("username", "remotemachine", "password", 9, 0, out ptr);
WindowsIdentity windowsIdentity = new WindowsIdentity(ptr);
var impersonationContext = windowsIdentity.Impersonate();

// your code goes here...

impersonationContext.Undo();

This logon type allows the caller to clone its current token and
  specify new credentials for outbound connections. The new logon
  session has the same local identifier but uses different credentials
  for other network connections.  NOTE: This logon type is supported
  only by the LOGON32_PROVIDER_WINNT50 logon provider. NOTE: Windows NT:
  This value is not supported.

http://www.pinvoke.net/default.aspx/advapi32.logonuser
Edit
Give it a try cassia
ITerminalServicesManager manager = new TerminalServicesManager();
using (ITerminalServer server = manager.GetRemoteServer("servername"))
{
    server.Open();
    foreach (ITerminalServicesSession session in server.GetSessions())
    {
        Console.WriteLine("Hi there, " + session.UserAccount + " on session " + session.SessionId);
        Console.WriteLine("It looks like you logged on at " + session.LoginTime +
                            " and are now " + session.ConnectionState);
    }
}

A: You have to use ConnectionOptions and pass it to the ManagementScope
    public void GetSystemInformation(string _yourDomain, string _hostName, string _userName, SecureString _password)
    {
        ManagementScope Scope = null;
        string computerName = _hostName;
        string userName = _userName;
        SecureString password = _password;
        ManagementObjectCollection collection = null;

        try
        {
            SelectQuery query = new SelectQuery("SELECT * FROM Win32_OperatingSystem");
            //string query = "SELECT * FROM Win32_NetworkAdapterConfiguration" + " WHERE IPEnabled = 'TRUE'";

            var options = new ConnectionOptions
            {
                  EnablePrivileges = false,
                  Impersonation = ImpersonationLevel.Impersonate,
                  Username = _userName,
                  SecurePassword = _password,
                  Authority = "ntlmdomain:" + _yourDomain
            };
            Scope.Options = options;
            Scope.Connect();

            ManagementObjectSearcher searcher = new ManagementObjectSearcher(Scope, query);
            collection = searcher.Get();

           //Do something with the collection
        }
        catch (ManagementException ex)
        {
            Console.WriteLine(ex.Message);
        }
        catch (UnauthorizedAccessException ex)
        {
            throw new ArgumentException(ex.Message);
        }
    }

    private static SecureString CreateSecuredString(string pw)
    {
        var secureString = new SecureString();

        foreach (var c in pw)
        {
            secureString.AppendChar(c);
        }

        return secureString;
    }

You might have to try some different stats with the variables EnablePrivileges and Impersonation
edit:
If you want to get your information from your pc (local) than you dont have to pass the options to the scope.


text:
Q: How do I get a Google Admin to Fix my Project Console? Short of paying $150/month so I can actually submit a ticket, what can I do to get Google's attention?  I've seen other people get help for what appears to be the exact same issue.
I uploaded a new (small) app to Google App Engine (GAE), and the Applications Settings page shows an error under Cloud Integration ("An error occurred when creating the project. Please retry").
I've retried over a period of days, but it tries for a while, then reports another failure.  I've asked questions of StackOverflow, and in the GAE issues forum, to no response.

A: Try to get hold of the people from Google Developer relations here, in the relevant Google+ communities or on Google groups.
If it can bring you any comfort: paying the $150 does not help you much - we have the subscription.

A: If you have a second Google Apps domain, replicate the issue by switching domains and recreating the project from scratch. Then if the error occurs again, post that it occurs in 2 or more cloud.google.com accounts with separate domains.  This should help show this is not a one off error and requires investigation.
If it does not occur in the second domain, save your data, delete your project and recreate with a different project name and number.
-ExGenius


text:
Q: how to reverse a dataframe to its original form in pandas i have data frame and used the command pd.pivot_table(df,columns="category",index=["year","period"])
did some data processing at this dataframe and i want to reverse the process to get the original formation of the df.
i tried with pd.melt and pd.wide_to_long without any luck. also on the pivot_table the the columns are a combination of two values, something like that:
("a","1"),("a","2"),("a","3"), .... ,("d","5")  where the 1st position are columns from the original dataframe and the 2nd values of the category column
original df cols:
year  period  category a  b  c  d
                 1
                 2
                 3
                 4
                 5

pivot_table:
                  |a             | b             | ... | d
        category  |1  2  3  4  5 | 1  2  3  4  5 | ... | 1  2  3  4  5
year |  period

>
 data={"col1":[1111,1111,1111,1111,2222,2222,2222,2222],
        "col2":["a1","a1","a1","a1","a2","a2","a2","a2"],
        "col3":[1,2,1,2,1,2,1,2],"
        "a":[555,555,555,555,555,555,555,555],
        "b":[666,666,666,666,666,666,666,666]}
df=pd.DataFrame.from_dict(data)

table=pd.pivot_table(df,columns="col3",index=["col1","col2"])

A: In general, for a given way to construct a pivot table from a data frame, two different data frames may yield the same pivot table. So this process is irreversible. For example, compare the following to your df and table:
data2 = {"col1": [1111, 1111, 2222, 2222],
         "col2": ["a1", "a1", "a2", "a2"],
         "col3": [1, 2, 1, 2],
         "a": [555, 555, 555, 555],
         "b": [666, 666, 666, 666]}
df2 = pd.DataFrame.from_dict(data2)

table2 = pd.pivot_table(df2, columns="col3", index=["col1", "col2"])

df2 is different from your df, but table2 is the same as your table.
Having said that, if you know more about the data frame you want to reconstruct from the pivot table than could be inferred from the table alone, you may be able to write a custom function implementing this knowledge.
The double index structures you see in the pivot tables are instances of a special index class in pandas called MultiIndex.


text:
Q: Hive managed table drop doesn't delete files on HDFS. Any solutions? While deleting managed tables from the hive, its associated files from hdfs are not being removed (on azure-databricks). I am getting the following error:

[Simba]SparkJDBCDriver ERROR processing query/statement. Error Code: 0, SQL state: org.apache.spark.sql.AnalysisException: Can not create the managed table('`schema`.`XXXXX`'). The associated location('dbfs:/user/hive/warehouse/schema.db/XXXXX) already exists

This issue is occurring intermittently. Looking for a solution to this.

A: I've started hitting this. It was fine for the last year then something is going on with the storage attachment I think. Perhaps enhancements going on in the back ground that are causing issues (PaaS!) As a safeguard I'm manually deleting the directly path as well dropping the table until I can get a decent explanation of what's going on or get a support call answered.
Use
dbutils.fs.rm("dbfs:/user/hive/warehouse/schema.db/XXXXX", true)

becarefull with that though! Get the path wrong and it could be tragic!

A: So sometimes the metadata(schema info of Hive table) itself gets corrupted. So whenever we try to delete/drop the table we get errors as, spark checks for the existance of the table before deleting.
We can avoid that if we use hive clint to drop the table, as it avoids checking the table's existence.
Please refer this wonder databricks documentation


text:
Q: How to remove comments from text file My text file contains one line comments that all being with "// ".  Two forward slashes and a space.  These may either take up the whole line or just the last part of a line.  Each comment does not extend beyond the line that it's on.  So no /* */ type comments crossing multiple lines.
In simple terms, all comments start with "//space" anywhere on the line.  Anything starting with "//space" should be removed and trailing spaces on that line should also be removed.  Leading spaces should stay.  Any blank lines should be removed.
Sample file:
// This is a comment
x = 1 // This is also a comment after the double slash
x = 2

x = 3  // The above is a blank line
          // Comment on this record but nothing precedes it, so should be deleted.
   y = 4 // A line with leading spaces that should be kept.
z = "//path"; // The first double slashes are not a comment since the space is missing after the "//"
// Last comment line.

Result file (no trailing spaces, but keep leading spaces.:
x = 1
x = 2
x = 3
   y = 4
z = "//path";

I can remove the blank lines using gc file.txt | Where-Object { $_ -ne ''} > result.txt.  However I'm having trouble with reading just the beginning part of a line up to the "//" comment part.
I also tried findstr but haven't found how to read each line up to the "//" and then trim spaces out.
I could write a script program to loop throught the file and do this, but it seems like there should be a way to accomplish it using a simple one or two line powershell or bat file command.
What is the easiest way (shortest amount of code) to remove these comments while keeping the uncommented contents of the file?

A: Since you seem to equate "easy" with "short", here's a fairly simple solution:
gc .\samplefile.txt|%{$_-replace"(.*)(// .*)",'$1'}|?{$_}

if it's really that important to you :-)
A bit more verbose version (still using regex):
Get-Content .\samplefile.txt | Where-Object {
    -not ([String]::IsNullOrEmpty($_.Trim()) -or $_-match"^\s*// ")
} |ForEach-Object { $_ -replace "(.*)(// .*)",'$1' }

That being said, I would (personally) go for a more verbose and easier-to-read/maintain solution:
To remove everything after //, the easiest way is to find the first occurrence of // with String.IndexOf() and then grab the first part with String.Substring():
PS C:\> $CommentedString = "Content // this is a comment"
PS C:\> $CommentIndex    = $CommentedString.IndexOf('// ')
PS C:\> $CommentedString.Substring(0,$CommentIndex)
Content

For the indented comments you can also use String.Trim() to remove whitespace from the beginning and end of the string:
PS C:\> "    // Indented comment" -match '^//'
True

You can use the ForEach-Object cmdlet to go through every line and apply the above:
function Remove-Comments {
    param(
        [string]$Path,
        [string]$OutFile
    )

    # Read file, remove comments and blank lines
    $CleanLines = Get-Content $Path |ForEach-Object {

        $Line = $_

        # Trim() removes whitespace from both ends of string
        $TrimmedLine = $Line.Trim()

        # Check if what's left is either nothing or a comment
        if([string]::IsNullOrEmpty($TrimmedLine) -or $TrimmedLine -match "^// ") {
            # if so, return nothing (inside foreach-object "return" acts like "coninue")
            return
        }

        # See if non-empty line contains comment
        $CommentIndex = $Line.IndexOf("// ")

        if($CommentIndex -ge 0) {
            # if so, remove the comment
            $Line = $Line.Substring(0,$CommentIndex)
        }

        # return $Line to $CleanLines
        return $Line
    }

    if($OutFile -and (Test-Path $OutFile)){
        [System.IO.File]::WriteAllLines($OutFile, $CleanLines)
    } else {
        # No OutFile was specified, write lines to pipeline
        Write-Output $CleanLines
    }
}

Applied to your sample:
PS C:\> Remove-Comments D:\samplefile.txt
x = 1
x = 2
x = 3

A: Like a great many text processing problems, there is a simple solution using JREPL.BAT - a powerful regex text processing utility for the Windows command line. It is pure script (hybrid JScript/batch) that runs natively on any Windows machine from XP onward. Full documentation is embedded within the script.
jrepl "^(.*?)\s*// " "$1!=''?$1:false" /jmatch /f test.txt /o out.txt

You can overwrite the original file by specifying - as the output file:
jrepl "^(.*?)\s*// " "$1!=''?$1:false" /jmatch /f test.txt /o -

I've tested, and it gives the exact output you are looking for.
If you put the command within a batch script, then you must use call jrepl

A: Tha Batch file below do what you want. Sorry, but there is not an "easy short code" way to do this...
@echo off
setlocal EnableDelayedExpansion

rem Set the maximum number of trailing spaces as a power_of_2-1 value. For example, for 15 spaces:
set spcPow2=4

set "spaces= "
for /L %%i in (1,1,%spcPow2%) do set "spaces=!spaces!!spaces!"
set /A spcPow2-=1

rem Process all lines, excepting empty ones and lines that start with "/"
setlocal DisableDelayedExpansion
for /F "eol=/ delims=" %%a in (test.txt) do (
   set "line=%%a"

   rem Split line at "// " and get the first part
   setlocal EnableDelayedExpansion
   for /F "delims=¡" %%b in ("!line:// =¡!") do (
      endlocal
      set "line=%%b"
   )

   rem Eliminate trailing spaces
   setlocal EnableDelayedExpansion
   set spc=0
   for /L %%b in (%spcPow2%,-1,0) do (
      set /A "newSpc=spc+(1<<%%b)"
      for %%n in (!newSpc!) do if "!line:~-%%n!" equ "!spaces:~-%%n!" set "spc=%%n"
   )
   if !spc! gtr 0 for %%n in (!spc!) do set "line=!line:~0,-%%n!"

   rem Show resulting line
   if defined line echo !line!

   endlocal
)

EDIT: New solution added
@set @x=1 // & CScript //nologo //E:JScript "%~F0" < samplefile.txt & goto :EOF
WScript.Stdout.Write(WScript.Stdin.ReadAll().replace(/(.*)\/\/ .*/g,"$1"))

Copy previous code into a file with .BAT extension, that is, it is a Batch file!


text:
Q: "Notice:undefined index.." when uploading a file into the system I tried to upload a file into a mySQL database using this code

    Upload a photograph
        <input type="file" class="form-control" id="file" tname="file"  required>

      <button type="submit" class="btn btn-default">Submit</button>

<?php
if ($_FILES["file"]["error"] > 0) {
  echo "Error: " . $_FILES["file"]["error"] . "
";
} else {
  echo "Upload: " . $_FILES["file"]["name"] . "
";
  echo "Type: " . $_FILES["file"]["type"] . "
";
  echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB
";
  echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
?>

But I get these notices
Notice: Undefined index: file in C:\xampp\htdocs\tachi\html\admin\addplace\insert_place.php on line 2

Notice: Undefined index: file in C:\xampp\htdocs\tachi\html\admin\addplace\insert_place.php on line 5
Upload:

Notice: Undefined index: file in C:\xampp\htdocs\tachi\html\admin\addplace\insert_place.php on line 6
Type:

Notice: Undefined index: file in C:\xampp\htdocs\tachi\html\admin\addplace\insert_place.php on line 7
Size: 0 kB

Notice: Undefined index: file in C:\xampp\htdocs\tachi\html\admin\addplace\insert_place.php on line 8
Stored in:

How to fix this problem. From where can I identify whether the photograph has been uploaded into the database and how?

A: You don't have a valid form. For starters, you've completely omitted the <form> tag. Without it, you can't add the enctype attribute required for uploads.
<form action="insert_place.php" method="POST" enctype="multipart/form-data">

Also, you used an invalid attribute name for your upload field. There is no tname attribute. It's just name:
<input type="file" class="form-control" id="file" name="file"  required>


text:
Q: Conversion of array to JSON doesn't handle nested array I have a weird problem occurring when I convert a PHP array to JSON. If the array contains a nested array then the resulting JSON prints out Array instead of the contents of the array (for eg { 'foo': 1, 'bar': 2 }.
  $result = [
      'type' => "success",
      'message' => "Shortcode successfully executed.",
      'content' => null
  ];
  $result['content'] = do_shortcode('[xyz]', false); // I have confirmed it returns an associative array of values

  // header('Content-type=> application/json');
  $result = json_encode($result); //, JSON_FORCE_OBJECT);
  echo $result;
  die();

The response is:

{"type":"success","message":"Shortcode successfully executed.","content":"Array"}

It should be:

{"type":"success","message":"Shortcode successfully executed.","content": { 'foo': 1, 'bar': 2 }}


text:
Q: Validar en PL-SQL Estoy en una base de datos PL/SQL y necesito armar un script anónimo para insertar en una tabla de configuración (campos config y value). Algo como esto:
Config: 'country'       Value: 'Argentina'
Config: 'moneysign'     Value: '$'
Config: 'dateformat'    Value: 'DD/MM/YYYY'

El problema es que necesito validar que las 3 inserciones sean correctas y además, en caso de falla, se debe identificar cuáles fallaron y dejar la base en el estado consistente anterior al inicio del script anónimo (según tengo entendido se hace con ROLLBACK o algo similar).
¿Cómo puedo hacer?

A: Puesto que PL/SQL es un lenguaje orientado a transacciones, entonces puede englobar esas tres inserciones dentro de una transacción. Es decir:
DECLARE
  …
BEGIN
  INSERT INTO mi_table (campo_1, campo_ 2)
      VALUES('country', 'Argentina');
  INSERT INTO mi_table (campo_1, campo_ 2)
      VALUES('moneysign', '$');
  INSERT INTO mi_table (campo_1, campo_ 2)
      VALUES('dateformat', 'DD/MM/YYYY');
  COMMIT;
EXCEPTION
  WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(SQLCODE || ' :''( ' || SQLERRM);
    ROLLBACK;
END;

Para saber más:

*

*Excepciones en PL/SQL

*Transacciones en PL/SQL

*Exception PL/SQL parte I - tratamiento de errores a fondo.

*Exception PL/SQL parte II - tratamiento de errores a fondo.

A: Puedes hacerlo todo en una misma transacción y en caso de excepción al insertar cualquiera de los valores de configuración se capture y haga un rollback. De este modo solamente se guardará la transacción si todos los registros se han insertado satisfactoriamente
BEGIN
  --
  SAVEPOINT SP_CONFIGURATION;
  --
  INSERT INTO CONFIGURATION(config, value) VALUES ('country', 'Argentina');
  INSERT INTO CONFIGURATION(config, value) VALUES ('moneysign', '$');
  INSERT INTO CONFIGURATION(config, value) VALUES ('dateformat', 'DD/MM/YYYY');
  --
  COMMIT;
  --
EXCEPTION
WHEN OTHERS THEN
  --
  ROLLBACK TO SP_CONFIGURATION;
  --
END;

A: El siguiente código hace uso de un cursor con los datos de interés y, mediante un FOR LOOP, controla la inserción de datos. Si un registro falla, la variable v_CodeResp cambia su valor y al final no realizará el COMMIT. En su lugar realiza un ROLLBACK, regresando el estado de la tabla a como estaba antes de ejecutar el bloque anónimo.
¡Saludos!
SET SERVEROUTPUT ON;
DECLARE
    v_CodeResp INTEGER := 0;
    v_MsgResp  VARCHAR2(300);
    v_Log      VARCHAR2(4000);
BEGIN
    FOR Datos IN (
            SELECT 'Country' AS CONFIG,  'Argentina' AS VALUE FROM DUAL
            UNION
            SELECT 'moneysign' AS CONFIG, '$' AS VALUE FROM DUAL
            UNION
            SELECT 'dateformat' AS CONFIG, 'DD/MM/YYYY' AS VALUE FROM DUAL)
    LOOP
        BEGIN
        INSERT INTO TABLA(A, B) VALUES(Datos.CONFIG, Datos.VALUE);

    EXCEPTION
        WHEN OTHERS THEN
            v_MsgResp := 'Fallo al insertar: '|| Datos.CONFIG || ' ' || Datos.VALUE ||' ';
            v_Log := v_Log || v_MsgResp;
            v_CodeResp := 1;
    END;
END LOOP;

IF v_CodeResp <> 0 THEN
    ROLLBACK;
ELSE
    COMMIT;
    v_MsgResp := 'Registros insertados correctamente';
    v_Log := v_Log || v_MsgResp;
END IF;

DBMS_OUTPUT.PUT_LINE(v_Log);
END;


text:
Q: Git tags with quote names on Windows We've got a repo on GitHub with several tags with quotes " in the name. Occasionally, some Windows hosts will fail to fetch with the error below. I don't know why some Windows hosts fail to fetch and others don't, if we solved that that would be great.

fatal: Unable to create 'C:/src/code/tags/some_tag_"with_quotes".lock': Invalid argument

As a workaround, we deleted the tags on GitHub, but inevitably someone who has this tag locally runs a git push and pushes the tag back into GitHub. Having everyone reclone will be painful.
These tags cannot be deleted locally (on Windows), the same error is generated.

A: Note: This answer has been torn apart and rewritten from its original version
I wonder if you're having issues with the filesystem's permitted characters in filenames. For example, according to Wikipedia, FAT does not permit double-quotes ("). According to Wikipedia, NTFS will accept double-quotes only if a filename is in the Posix namespacem, but I cannot seem to find that information anywhere else. Further, Microsoft seems to recommend avoiding double-quotes in filenames. Posix appears to only allow A-Za-z_.- in "portable" filenames¹. See Wikipedia on filesystem limitations and filesystem capabilities for more.
Perhaps you might try the Cygwin version of Git. It appears that Cygwin manages to support quotes in filenames on Windows.


text:
Q: Catch Multiple Ajax Responses I am submitting multiple forms which are generated dynamically, how can I catch the responses? I'll catch the response for single form submit using the form id:
// ajax response
$("#formID").ajaxForm({
  dataType: 'json',
  success: function(response) {
    alert("Success");
  }
});

My html code is:
<form action="someAction.htm" id="formID" method="post">
  <input type ="text"/>
</form>

It is working fine. Now I want to do the same for dynamically geneated forms. Something like this:
<% for(int i=0;I,5;i++) %>
<form action="someAction.htm" id="formID" method="post">

In the generated HTML I can see that all form tags are getting genearated and request are going but I don't know how to catch the responses. Any suggestions?

A: why don't do do this:
// ajax response
$("#formID_0").ajaxForm({
  dataType: 'json',
  success: function(response) {
    alert("Success 0");
  }
});

and
$("#formID_1").ajaxForm({
  dataType: 'json',
  success: function(response) {
    alert("Success 1");
  }
});

to capture these forms
<% for(int i=0 ; i<2 ; i++) { %>
<form action="someAction.htm" id="formID_<%=i%>" method="post">
</form>
<% } %>

If you want however to have only one function to capture all request you will have a different selector. To check the potential selectors take a look at this:

A: You need unique form IDs, that is for sure. This part is from @fGo.
<% for(int i=0 ; i<2 ; i++) { %>
<form action="someAction.htm" id="formID_<%=i%>" method="post" class="myform">
</form>
<% } %>

And on document.ready:
$(".myform").ajaxForm({
 dataType: 'json',
 success: function(response) {
 alert("Success");
}
});


text:
Q: Handling a sequence of clicks with javascript When using plain javascript to handle the clicking of a button, I have the following problem.
I have generic code like this:
let count = 0
myButton.onclick = function() {
    if (count > 2 {
        ... do something special ...
        // This does not work!!
    }
    ...
    count++
}

It is basically working, but I want to be able to make the difference between the first click and the second, third ..etc..
I would only need to have some kind of variable starting with the value 0 (for instance) and getting incremented on each click.
What is the correct way to implement such a variable?
What instinctively came to mind at this point (roughly 2 solutions) has failed.

A: You should increment the count before if condition then it will give you your desired result. Your code will also work but on 4th click, this will give you a better idea of how it is working:

var count = 0
myButton = document.getElementById("mybutton");
myButton.onclick = function() {
  console.log('Initial Count is', count);
    if (count > 2) { //This is checking if initial count is > 2
        console.log("Executed");
    }
    count++;
    console.log('Incremented Count is', count);
}
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="src/style.css">

    <button id="mybutton">Click</button>

A: <input type="button" id="myButton" value="Add" />


text:
Q: Connect lists to object within DispForm.aspx I am creating a page where users can see information for a chosen customer. On the same page I would also like to show To-Do's and Events filtered by that customer. As seen in the picture, I've added To Do-list and Eventslist as web parts within the DispForm.aspx as well as a bunch of sample data. However, I am unable to connect the lists to the customer.
Any idea how that connection could be made? Sadly I have neither InfoPath nor Visual Studio, I'm stuck with SharePoint Designer. That limits one's code possibilites a lot.

Edit: I cannot create the connections as between "normal webparts"; when trying, I receive "No Provider Schema". I tried also to make the connections in SP Designer, but as shown in the picture below (sorry it's in Swedish) the columns are empty and I cannot continue from there.

A: This can be done by connecting the web parts. For example edit the To DO List webpart and click on Connections -> Get Filter Values From. Here Select the Customer list. Then in Provider field name, select the column (in this case it will be Name) whose value will be used for filtration. Similarly select the Consumer filed (Customer) which will be used for filtration. Click on Finish.
Repeat same steps for Events list.

A: For this task You need to use Webpart Connections. Edit Page on DispForm.aspx, Then click on Your Customer Part, select web part connection-> Provide Values. In my example I created list with users, and List called Notes, which have user name in "Responsable". Next see screenshots:

Then set options of target webpart, where You want to catch this value:

and in the end select what field will be associated with what in target webpart(Name will be associated with 'Responsible'):

As a result You get connected web part, filtered by Your customer:

That's all. You don't need Designer or Visual Studio for that, Sharepoint can do it Out-of-Box.

A: This does NOT work any more, when the provider of the Row is a Data Form Webpart instead of a list view webpart.
It used to work in former times, but I also didn't find a workaround yet. Error msg after chosing "Get filter values from" is always "No provider schema"


text:
Q: Charging a single 12V battery from 2 solar panels I'm building a solar powered robot that uses a 12V lithium battery. It will have two (17.6V max) solar panels - one on the top and one on the bottom (so it will still work if it flips), meaning I won't be able to wire the two panels directly together (as the one on the bottom would limit the one on the top), and I read that wiring controllers together isn't a good idea either. How would I best supply 1A at 12V to my robot?

A: I assume you are mentioning something like a box with solar panel on either sides.
Consider below image.

The wall adapter and the 9V battery can be your two solar panels. We call them Panel A and Panel B.
When Panel A has more sunlight incident on it, Panel A voltage will be higher and hence Panel A will conduct and it will supply the load.. The diode in front of Panel B blocks the current entering it and hence, practically you can treat Panel B as like not connected only.
Same thing happens when Panel B has got more light energy.
The diodes should ideally be very low leakage ones(BAV720, for example) which helps in blocking leakage and battery discharge through the panels when there is no light.
Low leakage diodes normally come with little higher forward voltage drop and hence you have to decide based on applications and voltage margin you have.
Edit 1:
If battery power is not to be truly saved for long, I would suggest then to go for Schottky diodes or even PMOSFET based polarity protection. Here, almost all the voltage is available for the battery and loss during charging the batteries due to voltage drop of the diode.
One point here: you are completely losing the energy harvested (no matter how small it is) from the panel which is upside down.
Edit 2
The load in the picture shall be treated a charge controller module for batteries


text:
Q: Can't get to wrap text around and image & sliding overlay not working too <!DOCTYPE html>

    <meta charset="utf-8">

    <title>WebDev Profile</title>

Hilary Duff

Hilary Duff, Adult

Hilary Duff, Adult

INTJ (Introversion, Intuition, Thinking, Judgment) is an abbreviation used in the publications of the Myers–Briggs Type Indicator (MBTI) to refer to one of the 16 psychological types.[1]
According to Myers–Briggs the INTJ represents "The Mastermind". INTJs are one of the rarest of the 16 psychological types and account for approximately 2%[2] of the population.[3] Women of this personality type are especially rare, forming just 0.8% of the population.
The MBTI assessment was developed from the work of prominent psychiatrist Carl G. Jung in his book Psychological Types. Jung proposed a psychological typology based on the theories of cognitive functions that he developed through his clinical observations.
From Jung's work, others developed psychological typologies. Jungian personality assessments include the MBTI instrument, developed by Isabel Briggs Myers and Katharine Cook Briggs, and the Keirsey Temperament Sorter, developed by David Keirsey. Keirsey referred to INTJs as Masterminds,[4] one of the four types belonging to the temperament he called the Rationals.[5]

source file for image
There is an image around which I want to wrap text enclosed in the paragraph tags. Also sliding overlay not coming while I take my pointer over the image. Can't figure out where I did wrong. Please all of you help me solve this problem.
Here is another image of how my page appears.
Page screenshot

A: Not sure if this solves it but from what I get is your text is not overlapping the image. That is because your details class doesn't have "." in front of it. It should defined as .details not details in css.
 .details {
        position: relative;
        font-size: 1.50em;
        font: "Times New Roman";
        font-style: italic;
      }

Link for your reference:
https://codepen.io/Harsh89/pen/OombZL

A: *

*You just replace position absolut in the polaroid div with float left to wrap.

*That your hover is working you need to use max-height and transition: max-height. Also u need an invisible pseudo div with postion: absolute to hold on the place where u hover.

<!DOCTYPE html>

    <meta charset="utf-8">

    <title>WebDev Profile</title>

Hilary Duff

Hilary Duff, Adult

Hilary Duff, Adult

INTJ (Introversion, Intuition, Thinking, Judgment) is an abbreviation used in the publications of the Myers–Briggs Type Indicator (MBTI) to refer to one of the 16 psychological types.[1]
According to Myers–Briggs the INTJ represents "The Mastermind". INTJs are one of the rarest of the 16 psychological types and account for approximately 2%[2] of the population.[3] Women of this personality type are especially rare, forming just 0.8% of the population.
The MBTI assessment was developed from the work of prominent psychiatrist Carl G. Jung in his book Psychological Types. Jung proposed a psychological typology based on the theories of cognitive functions that he developed through his clinical observations.
From Jung's work, others developed psychological typologies. Jungian personality assessments include the MBTI instrument, developed by Isabel Briggs Myers and Katharine Cook Briggs, and the Keirsey Temperament Sorter, developed by David Keirsey. Keirsey referred to INTJs as Masterminds,[4] one of the four types belonging to the temperament he called the Rationals.[5]

Hope this is what you want.


text:
Q: RNFirebase core module was not found natively on iOS AppDelegate.m
#import "Firebase.h"
#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];
  NSURL *jsCodeLocation;

  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"kakashi"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return YES;
}

@end

Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'my_app' do
  pod 'Firebase/Core'

end

Verified that Build phase/Link Binary with Libraries has libRNFirebase.a
I've also verified the $(inherited) is there for framework search paths.
Still getting error RNFirebase core module was not found natively on iOS with expo start or npm start
Can you please recommend how to approach this problem? Or any help with what to verify/ensure for this to work is much appreciated.


text:
Q: Equal Column Heights I want the east and west divs to extend down to match the height of the center div... possible?
Thanks so much.
.con{
padding-left: 22px;
padding-right: 22px;
overflow: hidden;
}

.col{
position: relative;
float: left;
}

.west{
width: 7px;
right: 22px;
margin-left: -100%;
background: url(http://www.example.com/west.png) repeat-y;
padding: 0 0 0 15;
}

.east{
width: 7px;
margin-right: -22px;
background: url(http://www.example.com/east.png) repeat-y;
padding: 0 15 0 0;
}

.center{
width: 100%;
}

   Test Text

   Test Text

   Test Text

   Test Text

A: You can start with what's done here for CSS-only:
HTML/CSS: Making two floating divs the same height
Or use JavaScript layouts.

A: I used this jQuery solution and it works great...
var maxHeight = 0;
$(".col").each(function(){
  maxHeight = $(this).height() > maxHeight ? $(this).height() : maxHeight;
}).height(maxHeight);

Just FYI for others looking. Trying to css it tho.


text:
Q: Load ~ 400 (Bad Request). XmlHttpRequest works on local, but not on server-side I am working on async load (using XMLHttpRequest .readystate & .responseText) of product table contents on pagination or filter changing. Funtions I wrote work perfectly but on local only. On apache/ngnix  server-side it returns bad request. Please help.
function loadContent(link) {

    var http = createRequestObject();
    if( http ) {

        http.open('load', link);
        http.onreadystatechange = function () {

            if(http.readyState == 4) {

                var div = document.createElement('div');
                div.innerHTML = http.responseText;
                var all = div.getElementsByTagName('div');

                for (var i = 0, len = all.length; i < len; i++) {

                   if (all[i] && all[i].getAttribute('id') == 'to-ajax') {

                      var deep = all[i].getElementsByClassName('product-layout col-lg-4');
                      $('.load').before(deep);

                   }
                }
            }
        }

        http.send(null);

    } else {

        document.location = link;

    }
}

function createRequestObject() {
    try { return new XMLHttpRequest() }
    catch(e) {
        try { return new ActiveXObject('Msxml2.XMLHTTP') }
        catch(e) {

            try { return new ActiveXObject('Microsoft.XMLHTTP') }
            catch(e) { return null; }
        }
    }
}

Error warning refers to this line of code ~ } http.send(null);
It seems that problem is on .onreadystatechange function, but have no idea how to test it to define what an exact issue is.

A: The first argument to open needs to be a string containing an HTTP request method. "load" is not an HTTP request method. Examples include "GET" and "POST". The invalid HTTP is likely causing your server to respond with the Bad Request error.


text:
Q: What's wrong with this Makefile and LaTeX? I am trying to use the following Makefile in order to compile a LaTeX project.
# LaTeX Makefile
FILE=Tesis
all: $(FILE).pdf
.PHONY: clean
clean:
        rm *.aux *.blg *.out *.bbl *.log *.dvi *.idx *.lof *.toc *.pdf
$(FILE).pdf: $(FILE).tex
$(FILE).tex: Generalidades.tex Analisis.tex Diseno.tex Construccion.tex Conclusiones.tex Tesis.bib
        latex $(FILE).tex
        bibtex $(FILE)
        latex $(FILE)
        dvipdfm $(FILE).dvi

The file Tesis.pdf doesn't exist. However after running make I get:
make: Nothing to be done for `all'

What is wrong? Thanks.

A: Your dependency
$(FILE).pdf: $(FILE).tex

has no rule associated with it – it's missing a sequence of indented lines which tell make how to make the PDF from the .tex file. That means it'll always be up to date.
Your second dependency, on the other hand:
$(FILE).tex: Generalidades.tex Analisis.tex ...
    latex $(FILE).tex

says '$(FILE).tex depends on Generalidades.tex Analisis.tex ..., and to make it [ie, the .tex file] up to date, run latex'.  That's not what you mean.
Try
$(FILE).pdf: $(FILE).tex Generalidades.tex Analisis.tex ...
    latex $(FILE).tex
    ...

(By the way, if you use pdflatex then you can generate a PDF file directly from the .tex source.  You'll have to use .pdf figures rather than .eps ones, but it's easy to convert .eps figures to .pdf).


text:
Q: Rename file containing substring 'foo' with 'bar' I want to rename all files which contain the sub-string 'foo', replacing it with 'bar' within a given folder.How can I accomplish this?
Update:
for i in ./*foo*; do mv "$i" "${i//foo/bar}";done

works!!!

A: If you have the rename(1) that came with perl (Debian provides it), you can use:
cd /path/to/directory
rename 's/foo/bar/g' *

If you have the other rename(1) (I've seen it in Red Hat Enterprise Linux and some other distributions, it comes from util-linux), you can try:
cd /path/to/directory
rename foo bar *foo*

You can check which version of rename you have by trying rename -V. If it doesn't recognize the flag, it's the perl version. If it prints version information, it's the other version.


text:
Q: Nest Load a folder path Power Query I'm trying to use Excel Power Query (Stuck with Excel 2010 in this one) to check if a folder called "SWPPP", which is inside a list of directories, has files in it.
The folder structure is as follows.
|O:\Planning Projects
|---2012\
|--------00-000 A Custom Folder Name\
|------------------------------------\SWPPP
|---2013\
|--------00-000 A Custom Folder Name\
|------------------------------------\SWPPP
|---2014\
|--------00-000 A Custom Folder Name\
|------------------------------------\SWPPP
|---2015\
|--------PB-391-000 A Custom Folder Name\
|------------------------------------\SWPPP
|--------10-000 Another Custom Folder Name\
|------------------------------------\SWPPP
|---2016\
|--------00-000 A Custom Folder Name\
|------------------------------------\SWPPP
|--------10-300 Another Custom Folder Name\
|------------------------------------\SWPPP
|---2017\
|--------00-000 A Custom Folder Name\
|------------------------------------\SWPPP
|--------10-000 Another Custom Folder Name\
|------------------------------------\SWPPP
|---Fill Permits\
|--------These folders I don't care about\
|--------Another Folder I don't care about\
|---Pat's Inspections\
|--------These folders I don't care about\
|--------Another Folder I don't care about\

From root (O:\Planning Projects), I'm only interested in the folders that are inside the "year" folders (e.g.: 2012, 2013, 2014...). There are more than 600 sub-directories (close to 700) inside them, and they will keep growing as time goes. I'm trying to automate and future-proof this as much as possible.
What I need is to go in each of those "year" folders, go to the sub-folders, check if there is a "SWPPP" folder, and then check if there are any files in it.
I'm close to get it done, but there's a part which I'm stuck. I'm getting the infamous:

Formula.Firewall: Query 'Query1' (step 'loadedFiles') references other
  queries or steps, so it may not directly access a data source. Please
  rebuild this data combination.

Before going any further, I've done my research and accessed a couple of sites:
https://www.excelguru.ca/blog/2015/03/11/power-query-errors-please-rebuild-this-data-combination/
https://community.powerbi.com/t5/Desktop/Formula-Firewall-Query-references-other-queries-so-it-may-not/td-p/18619
Power Query - Please rebuild this data combination
This is the procedure I've followed:

*

*1.I load the root directory. (O:\Planning Projects)

*Do some logic to get the "years" folder into a list: {2012, 2013, 2014,etc}\

*From the list, I iterate and get the directories that are in each of those lists. (So far, so good)

*Now, I try to append "SWPPP" to the folder structure, and try to get the Contents from the folder. Then that's where I get struck
with the error.

I tried breaking the algorithm in different parts, as suggested by excelguru.ca, but that didn't do anything.
My second approach:

*

*Repeat steps 1 -3 from previous procedure.

*Load the directories into the Excel (See Step 3), and then, concatenated
 "SWPPP" in a custom table I created.

*Load the custom table into a new query using Power Query's import from
 Excel file (By importing the same file).

*I tried reading the files again, but it gave me the same error.

I'm using m programming language to put everything together (Need some help, only know it for a day), and I'm stuck.
Here's the second approach:
This first query loads all the sub-directories from the "year" folders.
Query Name: "LoadInspections"
let
    Url = "O:\Planning Projects",
    Source = Folder.Contents(Url),
    Cols = Table.SelectColumns(Source, "Name"),
    ColsList = Table.ToList(Cols),
    Cond = (val) => try not Number.IsNaN(Number.FromText(val)) otherwise false,
    Years = List.Select(ColsList, (val) => val = "pre 2012" or Cond(val)),
    load = List.Transform(Years, (val) => Folder.Contents(Url & "\" & val)),
    combinedTables = Table.Combine(load)

in
  combinedTables

This is the query that loads the custom table I created in Excel, which concatenates the directories with "SWPPP":
Query Name: ApplicationNumber_Files_Folders

let
    Source = Excel.Workbook(File.Contents("O:\MS4 Program\MCM4 Construction Site Stormwater Runoff Control\SWPPP Tracker\SWPPP Inspection Processor.xlsm"), null, true),
    ApplicationNumber_Files_Folders_Table = Source{[Item="ApplicationNumber_Files_Folders",Kind="Table"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(ApplicationNumber_Files_Folders_Table,{{"Application Number", type text}, {"Planning Project", type text}, {"Hidden Folder Path", type text}, {"Folder Path", type text}})
in
    #"Changed Type"

Then, as suggested by excelguru.ca, I tried breaking it up in a separate query:
Query Name: Query1

let
    Source = ApplicationNumber_Files_Folders,
    Cols = Table.SelectColumns(Source, "Hidden Folder Path"),
    ColsList = Table.ToList(Cols),
    SWPPP = List.Transform(ColsList, (url) => url&"\SWPPP"),
    // This line below is the problematic one
    loadedFiles = List.Transform(SWPPP , (url) => Folder.Contents(url))

in
    loadedFiles

I've visited these sites:

A: If you are looking for your SWPP directories that have files in them, I would probably just change the base level query to be "Folder.Files" instead of "Folder.Contents", as this will return every file in every subdirectory of the specified base directory.
= Folder.Files("C:\folders")

If these SWPP directories only exist in your year folders, all you really need to do is filter the Folder Path column to anything that ends in "SWPP\"
= Table.SelectRows(#"Filtered Rows", each Text.EndsWith([Folder Path], "SWPP\"))

If you wanted to filter only for the year directories, it depends how complex and varied the directories you are looking for are. If they are all just year folders in a single directory as you described, you can just do something simple like check the text in that location of the filepath to see if it is "20" (assuming your years are only going back to 2000 anyways...), which isn't the most modular check, but may be adequate for your needs.
= Table.SelectRows(Source, each (Text.Range([Folder Path], 11, 2) = "20"))

From there you can just filter down to whatever you need (removing all the columns except the folder path and remove duplicates on it will give you a list of every SWPP directory that has files in it)


text:
Q: flexible column comparison in data table r I am trying to filter by comparing groups of columns with each other in a dynamic fashion.  Suppose I have the data base.
###########
#Setup data
###########

set.seed(2)
fill = data.table(n=1:7)
Tp=3

  for(t in 1:Tp){
     set(x = fill, j = paste0('prod1vint',t), value = sample(0:10,7))
  }

fill[1,paste0('prod1vint',3):=0]
fill[5,paste0('prod1vint',2):=0]
fill[5,paste0('prod1vint',3):=0]

for(t in 1:Tp){
  fill[,paste0('prod1vint',t,'prm'):=get(paste0('prod1vint',t))]
}

fill[1,paste0('prod1vint',1,'prm'):=0]
fill[2,paste0('prod1vint',2,'prm'):=1]
fill[5,paste0('prod1vint',3,'prm'):=1]
fill[7,paste0('prod1vint',3,'prm'):=2]

The data table:
   n prod1vint1 prod1vint2 prod1vint3 prod1vint1prm prod1vint2prm prod1vint3prm
1: 1          2          9          0             0             9             0
2: 2          7          4          8             7             1             8
3: 3          5         10          9             5            10             9
4: 4          1          8          1             1             8             1
5: 5          6          0          0             6             0             1
6: 6          8          7          0             8             7             0
7: 7          0          0          6             0             0             2

By dynamic, I mean Tp can be an arbitrary integer.
I want to filter the following way:
For each t, e.g. prod1vint{t}, I want to compare to look at the "prm" version of it and check if it's not zero.  If it is not zero, then I only want to keep rows for which all t'>t vint are less than or equal to the pre-prime values and all lower elements (t'<t) are the SAME, e.g.
For each t.., if prod1vint{t}!=0, then
1. prod1vint{t'}prm <= prod1vint{t'} for t'>t
2. prod1vint{t'}prm == prod1vint{t'} for t'<t

For example, the following output should be displayed:
   n   prod1vint1 prod1vint2 prod1vint3 prod1vint1prm prod1vint2prm prod1vint3prm
1: 3          5         10          9             5            10             9
2: 4          1          8          1             1             8             1
3: 6          8          7          0             8             7             0
4: 7          0          0          6             0             0             2

(In case the X-Y problem...this might help... I am trying to make sure each vector (prod1vint1,prod1vint2,prod1vint3) is LIFO decreasing to it's prime. Ignore this bit if it doesn't help.  My attempted solution involves coding various conditions such as the one above, which I am stuck on.)

A: Using melt as the comments suggest I would do it like this:
# this part is as replied from the question
set.seed(2)
fill = data.table(n=1:7)
Tp=3

for(t in 1:Tp){
  set(x = fill, j = paste0('prod1vint',t), value = sample(0:10,7))
}

fill[1,paste0('prod1vint',3):=0]
fill[5,paste0('prod1vint',2):=0]
fill[5,paste0('prod1vint',3):=0]

for(t in 1:Tp){
  fill[,paste0('prod1vint',t,'prm'):=get(paste0('prod1vint',t))]
}

fill[1,paste0('prod1vint',1,'prm'):=0]
fill[2,paste0('prod1vint',2,'prm'):=1]
fill[5,paste0('prod1vint',3,'prm'):=1]
fill[7,paste0('prod1vint',3,'prm'):=2]

# NEW CODE
fill.melt <- reshape2::melt(fill, id.vars = c('n'))

fill.melt$intpart <-  sapply(fill.melt$variable,
                            function (x)
                              {stringr::str_extract(gsub('prod1','',x),
                                                    '\\d')})

fill.melt$prmpart <-  ifelse(grepl('prm', fill.melt$variable), 'prm','noprm')
fill.cast <- reshape2::dcast(fill.melt, n+intpart ~ prmpart , value.var = 'value')
fill.cast <- as.data.table(fill.cast)

t=3

tmp <- fill.cast[
                 ((intpart >= t & prm <= noprm) | (intpart < t & prm == noprm)),]

ns <- unique(tmp$n)[table(tmp$n) == t]

fill[n %in% ns,]


text: Q: Java PDF renderer with CSS3 I need to generate a pdf from an html using css3. I found some api's like flying saucer, but unfortunately it is only working with css 2.1. Is there any chance to do it with css3?


text:
Q: Reload/Refresh JFrame window on button click I have tried a lot of thinks in last two days and I just can't refresh the Frame :/
I connect on my database and make a select query... In my console window I see 4 ID-s On my form too... After I make another data in my database, in my console window i see 5 ID-s but on my form 4... If I put frame.setvisible on my button another form appears...
Here is my class:
JLabel timeLabel;

private JPanel contentPane;
 private ArrayList<JLabel> lbllist= new ArrayList<JLabel>();
 private ArrayList<JButton> btnlist= new ArrayList<JButton>();
static int brojac = 0;
private JLabel lblNewLabel;
private JButton btnRefresh;

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {

                Mainframe = new Main();
                frame.setVisible(true);

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}
           //constructor (I need every time to see data from the database)
               public Main() {

    getContentPane().setLayout(null);

    lblNewLabel = new JLabel("New label");
    lblNewLabel.setBounds(0, 185, 46, 14);
    getContentPane().add(lblNewLabel);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 800, 300);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    getContentPane().removeAll();
    btnRefresh = new JButton("Refresh");
    btnRefresh.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            do_btnRefresh_actionPerformed(arg0);
        }
    });
    btnRefresh.setBounds(335, 228, 89, 23);
    contentPane.add(btnRefresh);

    EntityManager em = Connection.getEmf().createEntityManager();
    TypedQuery<Entity> query = em.createQuery(
            "select n from Entityn where finished= 0",
            PokusajNarudzbe.class);
    List<Entity> resultList = query.getResultList();
    int a = 20;
    for (Entitypokusaj entity: resultList) {

        System.err.println(entity.getName());//here i see all data (but not
                                                   //in the form

        JLabel list= new JLabel(entity.getBrojName());
        lista.setBounds(10, a, 200, 20);
        lista.setText(entity.getNarudzbaID() + " "
                + entity.Name() + " ";
        lbllist.add(list);
        getContentPane().add(list);
        list.setVisible(true);
        list.repaint();
        list.revalidate();
        JButton btn= new JButton(entity.getName());
        btn.setBounds(500, a, 200, 20);
        btn.setText("Gotovo");
        btnlist.add(btn);
        getContentPane().add(btn);
        a += 20;
        gumb.setVisible(true);
        gumb.repaint();
        gumb.revalidate();
    }

    getContentPane().repaint();
    resultList.clear();
    em.clear();
    em.close();

}
`               protected void do_btnRefresh_actionPerformed(ActionEvent arg0) {
    Main frame1 = new Main();
    SwingUtilities.updateComponentTreeUI(frame1);
    frame1.invalidate();
    frame1.validate();
    frame1.repaint();
//      frame1.revalidate();
//      frame1.setVisible(true); (if I uncomment this another form apears...)

}

@Override
public int read(CharBuffer arg0) throws IOException {
    // TODO Auto-generated method stub
    return 0;
}
}

What can I do?

A: You shouldn't fetch your data from the DB inside a constructor.  This way you can't update the form - it only loads data when it's being created. Move the data fetching logic to a separate method and call it in your button click handler.
What you have right now will only create new forms, NOT update the original one. That's why if you uncomment the setVisible part another form opens.


text:
Q: Configuring jersey SpringServlet as a servlet throws "IllegalStateException: No Such servlet" I am attempting to configure the Jersey SpringServlet in the web.xml for my Jetty 8 server on Jersey 1.x and when I configure it as a <servlet> I get the exception thrown:
java.lang.IllegalStateException: No Such servlet: null
    at org.eclipse.jetty.servlet.ServletHandler.updateMappings(ServletHandler.java:1320)
    at org.eclipse.jetty.servlet.ServletHandler.setFilterMappings(ServletHandler.java:1414)
    at org.eclipse.jetty.servlet.ServletHandler.addServletMapping(ServletHandler.java:896)

Sorry for the short stack trace, I can't copy/paste.
Here is my web.xml
<!?xml version="1.0" encoding="UTF-8" ?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_3_0.xsd"
    version="3.0">
    <display-name>tpm</display-name>

    <context-param>
       <param-name>spring.profiles.default</param-name>
       <param-value>prod</param-value>
    </context-param>

    <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>classpath:spring/tpm-ui-context.xml</param-value>
    </context-param>

    <context-param>
       <param-name>resteasy.scan</param-name>
       <param-value>false</param-value>
    </context-param>

    <context-param>
       <param-name>resteasy.scan.providers</param-name>
       <param-value>false</param-value>
    </context-param>

    <context-param>
       <param-name>resteasy.scan.resources</param-name>
       <param-value>false</param-value>
    </context-param>

    <listener>
       <listener-class>org.springframework.web.context.ContextLoadListener</listener-class>
    </listener>

    <listener>
       <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>

    <filter>
       <filter-name>securityCheckFilter</filter-name>
       <filter-class>tpm.ui.filter.SecurityCheckFilter</filter-class>
       <async-supported>true</async-supported>
    </filter>

    <filter>
       <filter-name>cacheControlFilter</filter-name>
       <filter-class>tpm.core.rest.filter.ControlFilter</filter-class>
       <async-supported>true</async-supported>
    </filter>

    <!-- HERE'S THE PROBLEM, WHEN DECLARED AS A FILTER THE APPLICATION WORKS! -->
    <servlet>
       <servlet-name>jersey</servlet-name>
       <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
       <init-param>
          <param-name>com.sun.jersey.config.property.packages</param-name>
          <param-value>tpm.ui.resources</param-value>
       </init-param>

       <!-- WHEN DEFINED AS A FILTER THIS <init-param> IS UNCOMMENTED

       <init-param>
          <param-name>com.sun.jersey.config.property.WebPageContexRegex</param-name>
          <param-value>/|/.*(jsp|txt|html|woff|ttf)|/(images|js|swf|css|font|styles|api|(WEB-INF/jsp)|favicon.ico)/.*</param-value>
       -->

       <load-on-startup>1</load-on-startup>
       <async-supported>true</async-supported>
    </servlet>

   <filter-mapping>
      <filter-name>securityCheckFilter</filter-name>
      <url-pattern>/*</url-pattern>
   </filter-mapping>

   <filter-mapping>
      <filter-name>cacheControlFilter</filter-name>
      <url-pattern>/*</url-pattern>
   </filter-mapping>

   <servlet-mapping>
      <servlet-name>jersey</servlet-name>
      <url-pattern>/*</url-pattern>
   </servlet-mapping>

I need to get SpringServlet to work as a Servlet and not a Filter because I am adding another Servlet which is utilizing Comet to perform push services. If I keep SpringServlet as a Filter the request will never get to my new Servlet.

A:
Note:  Jetty 8 is EOL (End of Life), consider upgrading.

That stacktrace makes no sense.
java.lang.IllegalStateException: No Such servlet: null
    at org.eclipse.jetty.servlet.ServletHandler.updateMappings(ServletHandler.java:1320)
    at org.eclipse.jetty.servlet.ServletHandler.setFilterMappings(ServletHandler.java:1414)
    at org.eclipse.jetty.servlet.ServletHandler.addServletMapping(ServletHandler.java:896)

It goes from addServletMapping -> setFilterMappings -> updateMappings
I can find no version of Jetty 8 that had that call path.
Which version of Jetty 8 are you using?
Even accounting for the fact that com.sun.jersey.spi.spring.container.servlet.SpringServlet implements all of the following interfaces ...

*

*javax.servlet.Filter

*javax.servlet.Servlet

*javax.servlet.ServletConfig
If we make an assumption that jetty determines the type poorly, there is still no way that call stack would occur.
Went ahead and mocked up a quick test case with a class that implements all 3 of those interfaces and used it against Jetty 8.1.16.v20140903 distribution and it does not trigger that stacktrace.
Perhaps you need to enable full debug logging to see what was happening immediately before that IllegalStateException occurred. (its quite likely not the SpringServlet init that caused it)
If you have a larger (and more accurate) stacktrace, that might help too.


text:
Q: Is it possible to display the current state of modifier keys? I have a keyboard which is a little flaky, and occasionally one of the modifier keys becomes stuck. Realizing I've entered this state often takes a while. Is it possible to display — e.g., in the menu bar or in the style of Sticky Keys — which modifier keys are currently down?
I don't need the Sticky Keys functionality, so turning that on wouldn't seem to be a solution.

A: There is one native solution I can think of, and that's to show the Keyboard Layout window. This can be accessed through the input menu in the menu bar*, and will show you all keys and their current states. A bonus to this for normal circumstances is that you can see where option and shift-option special characters are mapped.
Another possible solution involves a third-party app such as Keyboard Maestro. If you create a macro triggered by the press of a modifier key, you can tell it to, say, display a Growl notification with a relevant message. I'm not exactly sure how you'd want to do this, or what exactly you'd want it to do in the first place, but many of these programs have tons of options.
*To enable this, go to System Preferences > Keyboard > "Show Keyboard and Character Viewers in menu bar"


text:
Q: Trouble with select query using implode variable in php? I dont know whether it's a duplicate one or not?
Here is what i'm trying:
 <?php
    session_start();
    include('db.php');
     $valid_data=$_POST['data'];
     if(isset($_POST['data']))
    {
     $list = isset($_SESSION['strtpnt1']) ? $_SESSION['strtpnt1'] : array();
     $_SESSION['strtpnt1'][] =$valid_data;
     $a=implode(',',$_SESSION['strtpnt1']);
    }
  ?>

when i use print_r for $_SESSION['strtpnt1'] i could see like this:
     array (size=5)
     0 => string 'trivandrum' (length=10)
     1 => string 'kochi' (length=5)
     2 => string 'nagercoil' (length=9)
     3 => string 'thrissur' (length=8)

I found nothing wrong with that
when i echoed the imploded variable i find the value like this:
      trivandrum,kochi,nagercoil,thrissur

When i tested the imploded data in wampserver phpmyadmin's sql like this i could get an error message:
  select start from tbl_place where start NOT IN(trivandrum,kochi,nagercoil,thrissur)

the error message is:
        Unknown column 'trivandrum' in 'where clause'

But the query works when string value is passed ie 'trivandrum','kochi' etc.
i dont know what is wrong with my query ...here is the query part
  $sql21 = "select start from tbl_place where start NOT IN('".$a."')";

A: There is error in your parameter $a value, all values inside IN() should be quoted and separated by commas.
Change your code like following:
$a=implode("','",$_SESSION['strtpnt1']); // ',' => "','"

$sql21 = "select start from tbl_place where start NOT IN('".$a."');";// no change

// NOW the SQL query will became:  select start from tbl_place where start NOT IN('trivandrum','kochi','nagercoil','thrissur');

Now it should work.

A: For now you can try this but prepared statement is best for it. You can use PDO or MYSQLi . it doesn't work for you because NOT IN needs the list to individually be quoted and separated by commas.
  $a=$_SESSION['strtpnt1'];
  $new_a= "'" . implode("','", $a) . "'";
  $sql21 = "select start from tbl_place where
 start NOT IN($new_a)";

Similar Ideas
:Can I bind an array to an IN() condition?
Proper format for PDO and MySQL IN/NOT IN queries

A: $sql21 = "select start from tbl_place where start NOT IN('".$a."')";
will querying like this :
$sql21 = "select start from tbl_place where start NOT IN('trivandrum,kochi,nagercoil,thrissur')";
which will treat as a whole string
you have to do in passing variable
$a=implode("','",$_SESSION['strtpnt1']);


text:
Q: Laravel application and PHPUnit using sqlite, after executing the test database tables are dropped I'm creating a Laravel7 application.
Laravel application and PHPUnit are using sqlite as database.
For the development in my local I have configured as follows
// .env
DB_CONNECTION=sqlite
DB_DATABASE=/path/to/db.sqlite

// phpunit.xml
<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>

Step 1: Register a new user and able to successfully login
Step 2: Execute the test and it executes successfully
Step 3: Again login to application but it shows SQLSTATE[HY000]: General error: 1 no such table: users (SQL: select * from "users" where "id" = 1 limit 1)
After executing the tests the existing tables are removed from the sqlite database even though the test's database is in memory
Note: In all my test classes I have use DatabaseMigrations; to include the trait.
How can I solve this issue?


text:
Q: Vercel Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'simple-concat' imported from /var/task/node_modules/mypackage/index.js I am new to node.js and vercel.
My project works in my local computer but when i deploy it to vercel, i get the following error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'simple-concat'
imported from /var/task/node_modules/mypackage/index.js
at new NodeError (node:internal/errors:400:5)
at packageResolve (node:internal/modules/esm/resolve:894:9)
at moduleResolve (node:internal/modules/esm/resolve:987:20)
at moduleResolveWithNodePath (node:internal/modules/esm/resolve:938:12)
at defaultResolve (node:internal/modules/esm/resolve:1202:79)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:842:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap. (node:internal/modules/esm/module_job:77:40)
at link (node:internal/modules/esm/module_job:76:36) {   code: 'ERR_MODULE_NOT_FOUND' } RequestId:
39a6c3ac-c643-4323-83b4-2ed45ad1920e Error: Runtime exited with error:
exit status 1 Runtime.ExitError

I tried changing the import there to import concat from 'simple-concat/index.js'
I tried to add environment variables VERCEL_CLI_VERSION with value vercel@28.10.2
I tried redeploying

A: Here's a few things to try:

*

*Make sure the package simple-concat is listed in your package.json file as a dependency.

*Run npm install or yarn install to install all dependencies locally before you deploy to Vercel. This makes sure that all of your required packages are in the node_modules directory.

*If simple-concat is a native node.js module, make sure it's in the engines section of your package.json file. this is important! - it will ensure that the correct version of Node.js is used when the code is being run on Vercel.


text:
Q: Using the contraction principle to prove that the sequence $a_n=f(a_{n-1})$ is convergent where $f(x)=1+1/x$ Define function $f(x)$ from $\mathbb R^1$ to $\mathbb R^1$ by $f(x) = 1+1/x$.
Define $a_n$ inductively by $a_1=1$ and $a_n=f(a_{n-1})$ for $n \geq 2$.

*

*Prove using the contraction principle that $(a_n)$ is convergent

*Prove that if $\lim_{n\to \infty}$  of $a_n= L$ then $L = F(L)$; hint Q2C

*Determine $\lim_{n\to \infty}$ of $a_n$
My thoughts
I honestly have no idea what  the contraction principle is,  I have googled it and have found no results.  And I also don't know what Q2C means.

A: The Banach contraction principle (which I state here only for the reals) says that if $f$ is a contraction mapping, that is if there is $q$ with $0\le q<0$ such that $|f(x)-f(y)|\le q |x-y|$ for all $x,y$ then $f$ has a unique fixed point $L$, that is $f(L)=L$, and moreover taking any $a_1$ the sequence $a_1,f(a_1),f(f(a_1)),...$ converges to $L$.
So, $a_1=1$ and $a_2=1+\frac11=2$. We will prove by induction that
$\frac32\le a_n \le 2$ whenever $n\ge 2$. Indeed this is true for $n=2$.
Assuming it is valid for some $n\ge2$, we have $\frac12\le \frac1{a_n} \le \frac23$,
so $1+\frac12=\frac32 \le 1+\frac1{a_n}=a_{n+1} \le 1+\frac23=\frac53<2$, which completes this proof by induction.
So consider the restriction of $f$ to the interval $[\frac32,2]$, we will show that it is a contraction mapping with $q=\frac49$. Indeed, take any $x,y\in[\frac32,2]$. Then $|f(x)-f(y)|=|1+\frac1x-(1+\frac1y)|= |\frac1x-\frac1y|=|\frac{y-x}{x y}|\le|y-x|\cdot(\frac23)^2=\frac49|x-y|$.
So, since $f$ is a contraction mapping on $[\frac32,2]$, the sequence
$a_2,f(a_2),f(f(a_2)),...$ converges to some limit $L\in[\frac32,2]$.
To find the value of $L$ use $Q2C$. If you don't know what $Q2C$ means
(I do not), then use common sense :) In the equality $a_n=f(a_{n-1})$ take limit as $n\to\infty$, we obtain $L=f(L)=1+\frac1L$ (note that this is exactly what your hint says), so we have the equation
$L^2=L+1$, or $L^2-L-1=0$, with roots $L_1=\frac{1-\sqrt{5}}2$ and $L_2=\frac{1+\sqrt{5}}2$. Note that $0>L_1\not\in[\frac32,2]$ hence we must have that
$L=L_2=\frac{1+\sqrt{5}}2$.


text:
Q: Unit Testing Go Functions having ORM interactions I have written a function:
func AllItems(w http.ResponseWriter, r *http.Request) {
    db, err := gorm.Open("sqlite3", "test.db")
    if err != nil {
        panic("failed to connect database")
    }
    defer db.Close()

    var items [] Item
    db.Find(&items)
    fmt.Println("{}", items)

    json.NewEncoder(w).Encode(items)
}

I want to do unit testing on this. Ideally, unit testing means that each line of the function needs to be tested. I'm not sure how I should test if a database connection is opened and then if it is displaying all the contents of the database. How should I test this code?
This function is the GET endpoint of a simple CRUD application. The code is here.

A: Refactor your code and break it down into smaller, testable functions which you pass dependencies to. Also create interfaces for the dependencies to make testing easier.
For example:
type myDatabaseInterface interface {
    Find(interface{}) // this signature should match the real db.Find()
}

func AllItems(w http.ResponseWriter, r *http.Request) {
    db, err := gorm.Open("sqlite3", "test.db")
    if err != nil {
        panic("failed to connect database")
    }
    defer db.Close()
    items := findItems(db)
    json.NewEncoder(w).Encode(items)
}

func find(db myDatabaseInterface) ([]Item) {
    var items []Item
    db.Find(&items)
    return items
}

Then you can create mocks for your dependencies and use them in your tests:
type mock struct {}

// mock should implement myDatabaseInterface to be able to pass it to the function
func (m *mock) Find(interface{}) {
    // implement the mock to satisfy your test
}

func Test_find(t *testing.T) {
    m := mock{}
    res := find(m)
    // do testing
}

Instead of calling Open every time you handle a request maybe you should open it outside and have it available to your function. That way the handler becomes so small there's no need to test it really:
func makeAllItemsHandler(db myDatabaseInterface) func(http.ResponseWriter, *http.Request) {
    return func(http.ResponseWriter, *http.Request) {
        items := findItems(db)
        json.NewEncoder(w).Encode(items)
    }
}

Then you can create a db once and for all when you set up your application and pass it to the functions that need it thus removing hard to test code from the functions.