text:
Q: Bootstrap selectpicker onchange fires multiple times The problem I'm having is that the change event on the bootstrap select picker is firing too much.
I have a select option using smarty like this:
<select class="selectpicker" id="ves">
    {foreach $ves as $vt}
        <option value="{$vt['v_id']}">{$vt['v_name']}</option>
    {/foreach}
</select>

The output from smarty looks like this:
<select class="selectpicker" id="ves">
    <option value="1">Hello</option>
    <option value="2">World</option>
</select>

Then I call the following JavaScript:
$(document).ready(function(){
    $('#ves').on('change', function(){
       console.log('click');
       console.log($(this).val());
    });
});

Output on first select:

click
  2

Output on second select:

click
  1
  click
  1

Output on third select:

click
  2
  click
  2
  click
  2

As you can see, it kind of accumulates, and I have no clue why. Any ideas?


text:
Q: Pandas apply with swifter on axis 1 doesn't return I try to apply the following code (minimal example) to my 2 Million rows DataFrame, but for some reason .apply returns more than one row to the function and breaks my code. I'm not sure what changed, but the code did run before.
def function(row):

  return [row[clm1], row[clm2]]

res = pd.DataFrame()
res[["clm1", "clm2"]] = df.swifter.apply(function,axis=1)

Did anyone get an idea or a similar issue?
Important without swifter everything works fine, but too slow due to the amount of rows.

A: This should work ==>
  def function(row_different_name):

        return [row_different_name[clm1], row_different_name[clm2]]

  res = pd.DataFrame()
  res[["clm1", "clm2"]] = df.swifter.apply(function,axis=1)

Try changing the name of function parameter rwo to some other name.

A: based on this previous answer what you are trying to do should work if you change it like this:
def function(row):
  return [row.swifter[clm1], row.swifter[clm2]]

res = pd.DataFrame()
res[["clm1", "clm2"]] = df.apply(function, axis=1, result_type='expand')

this because apply on a column lacks result_type as arg, while apply on a dataframe has it

A: axis=1 means column, so it will insert it vertically. Is that what you want? Try removing axis=1

redpajama_set_name: RedPajamaStackExchange


text:
Q: Test driven development: Testing ssl We are using the Akka framework and have recently switched our communication to being encrypted with SSL within a cluster.
It seems to be working, but I fear that we may accidentally disable it in the future developments and not notice it.
How would you go about writing a unit test that guarantees that your communication is encrypted, so that if someone moves it to being in clear we can detect it at build time?
This can be either or not akka specific, I'll be happy with both.

A: I would suggest the negative test that tries not encrypted communication. The failure will be the expected result of the such test in the encrypted communication channel. However if the encryption will omitted the test will signal that to you.


text:
Q: JNA calling C++ object from DLL - java.lang.IllegalArgumentException: Structure class has unknown or zero size I'm trying to access with JNA to my simple DLL, written on C++ (Windows 32 bit, Java 8, JNA  5.2.0, Visual Studio 2017 C++). The DLL has function which creates object. And I want to get the pointer on object and access to object function's inside JAVA-code.
I receive JNA-Pointer to the native object and try to initialyze it's Java-Structure implementation.
And here I have Exception during JNA-Structure initialization:
    public IMyClass(Pointer p) {
            super(p);

Exception in thread "main" java.lang.IllegalArgumentException: Structure class edu.nyu.cpptest.cpplib.CppLibDemo$CppLib$IMyClass has unknown or zero size (ensure all fields are public)  at com.sun.jna.Structure.deriveLayout(Structure.java:1374)  at com.sun.jna.Structure.calculateSize(Structure.java:1158)  at com.sun.jna.Structure.calculateSize(Structure.java:1110)  at com.sun.jna.Structure.useMemory(Structure.java:350)  at com.sun.jna.Structure.(Structure.java:202)  at com.sun.jna.Structure.(Structure.java:193)  at com.sun.jna.Structure.(Structure.java:189)  at edu.nyu.cpptest.cpplib.CppLibDemo$CppLib$IMyClass.(CppLibDemo.java:30)  at edu.nyu.cpptest.cpplib.CppLibDemo.(CppLibDemo.java:52)

C++ Code:
MyClass.h:
class __declspec(dllexport) IMyClass {
public:
    //int value;
    virtual int getValue() = 0;
    virtual void increment() = 0;
};

class MyClass : public IMyClass {
public:
    int value;
    MyClass();
    MyClass(int v);
    int getValue();
    void increment();
};

extern "C"
{
    __declspec(dllexport) IMyClass* createMyClass();
};

MyClass.cpp:
MyClass::MyClass() {this->value = 0;}
MyClass::MyClass(int v) { this->value = v; }
int MyClass::getValue() { return value; }
void MyClass::increment() { value++; }

cpplib.cpp
extern "C" __declspec(dllexport) IMyClass* createMyClass() {
    MyClass *mcl = new MyClass(0);
    return mcl;
}

Java code:
public class CppLibDemo {
    public interface CppLib extends StdCallLibrary  {
        CppLib INSTANCE = Native.loadLibrary("cpplib.dll", CppLib.class);
        Pointer createMyClass();
        class IMyClass extends Structure {
            interface Increment extends Callback {
                public void invoke();
            }
            interface GetValue extends Callback {
                public int invoke();
            }
            public IMyClass() { }
            public IMyClass(Pointer p) {
                super(p);
                super.read();
            }
            Increment increment;
            GetValue getValue;
            //public int value;//I tried to add 'value' field in IMyClass-native and java code
            //public void read() {
            //    value = (int)readField("value");
            //    super.read();
            //}
        }
    }
    CppLib.IMyClass myClass;
    public CppLibDemo() {
        Pointer ptr = CppLib.INSTANCE.createMyClass();
        myClass = new CppLib.IMyClass(ptr);
    }
    public int getValue() {
        return myClass.getValue.invoke();
    }
    public void increment() {
        myClass.increment.invoke();
    }
}

I also tried to move 'value'-field from MyClass to the it's parent IMyClass in C++ code and declare value-field in IMyClass in Java code. In this case I also have exception:

Exception in thread "main" java.lang.Error: Structure.getFieldOrder() on class edu.nyu.cpptest.cpplib.CppLibDemo$CppLib$IMyClass returns names ([]) which do not match declared field names ([value])
  at com.sun.jna.Structure.getFields(Structure.java:1088)  at com.sun.jna.Structure.deriveLayout(Structure.java:1233)  at com.sun.jna.Structure.calculateSize(Structure.java:1158)  at com.sun.jna.Structure.useMemory(Structure.java:350)  at com.sun.jna.Structure.(Structure.java:202)  at com.sun.jna.Structure.(Structure.java:193)  at com.sun.jna.Structure.(Structure.java:189)  at edu.nyu.cpptest.cpplib.CppLibDemo$CppLib$IMyClass.(CppLibDemo.java:30)

I tested this with simple console application, which loads my DLL in Viusual Studio and it works fine.
And I also can call my DLL through JNI using SWIG java & DLL-wrapper generation. It's interesting, if this is possible with JNA.

A: The Java structure needs to have public fields that match those of the native structure and it needs to declare those fields in the proper order. Typically your Java code will have an annotation that does this:
@Structure.FieldOrder({"value"})
public class ExampleStruct extends Structure {
    public int value;

    // rest of the implementation...
}


text:
Q: Flask python setup: oauthlib version problems while installing I am extremely new to flask - just setting it up now for following a tutorial on how to build a web app including logins.
Some of the packages I need for the tutorial are requests-oauthlib,flask-oauthlib and oauthlib.
I came across this problem while pip installing the requirements:
ERROR: flask-oauthlib 0.9.5 has requirement oauthlib!=2.0.3,!=2.0.4,!=2.0.5,<3.0.0,>=1.1.2, but you'll have oauthlib 3.1.0 which is incompatible.

Ok I need to downgrade oauthlib to satisfy flask-oauthlib.
I downgraded it and re-run everything, and get this error:
ERROR: requests-oauthlib 1.3.0 has requirement oauthlib>=3.0.0, but you'll have oauthlib 2.1.0 which is incompatible.

So now I need to upgrade oauthlib again to satisfy requests-oauthlib.
All the packages are complaining about something, but since I'm so new to this, I am not sure which one to listen to!
My guess is to downgrade requests-oauthlib until the errors stop?
These packages are all associated with the user-login part of flask, so for those of you familiar with this area, is there a stable configuration of all three versions that I should be using?
Otherwise I'm just blindly guessing and downgrading until something works.

A: I used the following combination:
pip install -I oauthlib==2.1.0
pip install -I requests-oauthlib==1.1.0

The versions are outdated, but requirements satisfied.
Also, you can use Authlib instead.


text:
Q: How to set up unique x-server instance for each vnc login I'm trying to set up a server for analysing MEG data where it's possible for multiple users to simultaneously run unique instances of Matlab on unique X instances. We have 32 gb ram and an SSD, so I'm not too concerned about performance.
However I'm fuzzy on the details of how this might be practically achieved.
Because VNC viewer by default runs on whatever x instance is active, I'm not sure if it's possible except by running separate vnc servers on separate active X-servers simultaneously.
Would it be possible to dynamically create and remove x-servers on the basis of vnc login? Any and all help is appreciated.

A: Depending on your setup, XRDP might work well for you.
It creates a new session for each login, and it lets you use a more minimal desktop environment than the one you use on the server.


text:
Q: Calendar (GregorianCalendar) .complete() method not visible? So I read through a few different threads but none of them seem to directly address how I fix my issue. I'm trying to create a Calendar (Gregorian) and then use the .complete() method so that in my classes using this (Paycheck) class I can find relative dates and create new Calendar(s) from those dates to determine wages payed and wages owed. However, it's telling me that .complete() .computeTime() and .computeFields() are all not visible.
From what I've read, this seems to be because they are protected methods and even though I import the java.util for them, I can't access them because that class is not in my package. How do I get this so that I can call the .complete() method?
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;

public class Paycheck {
    //fields
    protected double grossAmount;
    protected Calendar paymentDate;
    protected Calendar payPeriodStart;

    public Paycheck(double grossAmount, int iYear, int iMonth, int iDay, int sYear, int sMonth, int sDay) {
        this.grossAmount = grossAmount;

        TimeZone tz1 = TimeZone.getTimeZone("America/Chicago");
        this.paymentDate = new GregorianCalendar(iYear, iMonth, iDay);
        this.paymentDate.setTimeZone(tz1);
        this.paymentDate.complete(); //says "method not visible"

        this.payPeriodStart = new GregorianCalendar(sYear, sMonth, sDay);
        this.payPeriodStart.setTimeZone(tz1);

    }

A: Let's compare the typing effort:
this.paymentDate = new GregorianCalendar(iYear, iMonth, iDay);
this.paymentDate.complete(); // Why do you need to call this one?

vs the code having the same effect
this.paymentDate = new GregorianCalendar(iYear, iMonth, iDay, 0, 0, 0);
// constructor taking extra hours, minutes, seconds ----------^

So why do you try the almost-impossible of calling a protected method?

In some cases, very limited in number, one really needs to call a protected/private method and this may be possible. Exemplifying:
Class<GregorianCalendar> clazz=GregorianCalendar.class;
Method completeMethod = clazz.getDeclaredMethod("complete");
 // this does the trick if it doesn't throw security exceptions
completeMethod.setAccessible(true);
completeMethod.invoke(this.paymentDate);

See the Javadoc for AccesibleObject.setAccessible, Method being derived from AccessibleObject

A: In a comment you wrote:

I don't care about the actual time, I just want it to give me the date so I can determine the dayofweek (important based on various state laws).

That is very easy to do, and don't need any call to internal methods.
Calendar cal = new GregorianCalendar(2016, Calendar.SEPTEMBER, 22);
cal.setTimeZone(TimeZone.getTimeZone("America/Chicago"));
System.out.println("Day of week (1=Sun, ..., 7=Sat): " + cal.get(Calendar.DAY_OF_WEEK));

Output
Day of week (1=Sun, ..., 7=Sat): 5

Output is 5 because today is Thu 9/22/2016, and that's the date that was given.


text:
Q: Behavior mismatch in Full text search between SQL Server 2005 and SQL Server 2012 Initially we had SQL Server 2005 and then migrated to SQL Server 2012. Then there was an issue in Full Text Search in SQL Server 2012
The output (result set) of SQL Server 2005 & SQL Server 2012 was different. They are as below:

*

*We have created a new table in sql server 2005 and 2012 with some of sample data which is identical on both environment (2005 and 2012)..

*And we created fulltext search index in both tables.

*Then we run the below mentioned query in both envoirnment tables and the result as below.

Table name: candidate_search_test
candidate_search_test table having 11 records in the both environment (2005 and 2012).
    searchText  userid
1   java-script 10001
2   javascript  10002
3   java script 10003
4   java    10004
5   script  10005
6   vb-script   10006
7   sql-script  10007
8   vb  10008
9   vbscript    10009
10  sql 10010
11  sqlscript   10011

SELECT searchText
FROM candidate_search_test
where CONTAINS(searchtext,'java-script')

Note:
In 2005 environment the query returns 3 records which includes the result of "java-script","javascript","java script".
In 2012 environment the query returns 2 records which includes only the result of "java-script","java script".

A: In SQL Server 2005 (from 2000 to 2008 R2) there was a feature that ignored dashes - when using Full-Text search. Now it is fixed.


text:
Q: How to use streamlinejs in expressjs? When I use expressjs, but I don't know how to use it with streamlinejs.
Look at the express code:
var app = express.createServer();

app.get('/', function(req,res) {
   User.find({name:'Jack'}, function(err, users) {
      res.send(users);
   });
});

How to use streamlinejs in the code?

A: That's a point I'm covering quickly in the FAQ (https://github.com/Sage/streamlinejs/blob/master/FAQ.md#the-underscore-trick-is-designed-for-callbacks-but-not-events-how-do-i-deal-with-events).
The easiest solution is to add the underscore as extra parameter to the get callback:
app.get('/', function(req,res, next, _) {
   var users = User.find({name:'Jack'}, _);
   res.send(users);
});

The only problem would be if connect adds a fourth parameter to its callback some day. The following is a bit safer (but probably overkill because I don't see why connect would change its callback API):
app.get('/', function(req,res) {
   (function(_) {
      var users = User.find({name:'Jack'}, _);
      res.send(users);
   })(trap); // trap is a generic callback that handles errors
});

A: We use Express and Streamline for The Thingdom, and to do that, we built a simple wrapper that allows the next callback (third parameter) to be a Streamline-friendly callback, for both route handlers and middleware handlers.
Here you go:
https://gist.github.com/1087991
=)
I've been meaning to make that into a generic module and publish to npm -- I'll do that soon. Edit: https://github.com/aseemk/express-streamline
Note that there is one trade-off as a result of this -- you can't have route handlers "continue" (fall through) to other route handlers. We've never used that feature, though, and don't foresee ourselves doing so -- it's much simpler to know that every route handler is the final destination -- so we were okay with that trade-off.
Edit: This is only tested with Express 2.x.


text:
Q: How to put line break between th and td? I have table and I would like to put my td's under th tags. Here is my HTML code:

       Your Email

          <input type="text" name="userEmail" value="" id="userEmail" required="">

       Job Category
       //I need break line here

          <input type="radio" name="rd1" value="Programmer" id="rd1">Programmer

          <input type="radio" name="rd2" value="Web Developer" id="rd2">Web Developer

My output gives me text in  tags and then text in  tags next to it. I would like to have td content below th. I tried to use
 tags but looks like that does not work outside of td tags. If anyone know the best and way to fix this please let me know.

A: You are creating a table and nothing can be put outside the table cells. If you want to have the forms element under the headers, just create one row with headers and one row with forms elements:

       Your Email
       Job Category

          <input type="text" name="userEmail" value="" id="userEmail" required="">

          <input type="radio" name="rd1" value="Programmer" id="rd1">Programmer

          <input type="radio" name="rd2" value="Web Developer" id="rd2">Web Developer

A: Put your table header in its own row:

    Your Email

      <input type="text" name="userEmail" value="" id="userEmail" required="">

    Job Category

    //I need break line here

      <input type="radio" name="rd1" value="Programmer" id="rd1">Programmer

      <input type="radio" name="rd2" value="Web Developer" id="rd2">Web Developer

A: Place them in different rows using

        Your Email

           <input type="text" name="userEmail" value="" id="userEmail" required="">

        Job Category

//End row
       //I need break line here

 //start new row

            <input type="radio" name="rd1" value="Programmer" id="rd1">Programmer

            <input type="radio" name="rd2" value="Web Developer" id="rd2">Web Developer


text:
Q: SQL Server connection error with login control in asp.net after moving the project on different machine My asp.net application was working fine on my machine. For testing purpose, I moved the whole project on different machine.
Now everything is working except login. I am able to load data in my web site from database so I believe no issue with connection string.
I am using FormAuthentication with my own SQL Server database (have a separate table in my application database) and EF 4.0.
Here is the error message...

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) +5295167
  System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +242
  System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +5307115
  System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +145
  System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +920
  System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +307
  System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions) +434
  System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +5309659
  System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +37
  System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions) +558
  System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions) +67
  System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1052
  System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78
  System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +167
  System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) +143
  System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +83
  System.Data.SqlClient.SqlConnection.Open() +96
  System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +88
  System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +239
  System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +821
  System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +88
  System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +106
  System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +59
  System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +113
  System.Web.UI.WebControls.Login.AttemptLogin() +119
  System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +75
  System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
  System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +114
  System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +159
  System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
  System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
  System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724


text:
Q: Listing the latest unstable gem version? When I do:
gem search -r rails

It shows me:
rails (2.3.8)

But how do I know the latest unstable version which is 3.0.0.rc so that I can use it:
gem install rails --version=3.0.0.rc

A: Use gem search -r rails --pre.


text:
Q: t test for each regressor hypothesis (Beta=0) in multiple linear regression in R I have a data table like this (table.b1):
    y   x1   x2   x3
1  10 2113 1985 38.9
2  11 2003 2855 38.8
3  11 2957 1737 40.1

i fit a multiple regression on this with :
fit <- lm( y ~ x1 + x2 + x3 , table.b1 )

now i want to calculate t statistics for testing hypothesis individuals Beta1=0, Beta2=0, Beta3=0 in R.

A: As @ekstroem mentioned: use summary(fit).
dat <- data.frame(
  "y"  = rnorm(100),
  "x1" = rnorm(100),
  "x2" = rnorm(100),
  "x3" = rnorm(100)
)

fit <- lm( y ~ x1 + x2 + x3 , dat)

summary(fit)

The output is

Call:
lm(formula = y ~ x1 + x2 + x3, data = dat)

Residuals:
    Min      1Q  Median      3Q     Max
-1.8146 -0.6099  0.0218  0.5469  3.1833

Coefficients:
             Estimate Std. Error t value Pr(>|t|)
(Intercept)  0.036911   0.099474   0.371    0.711
x1          -0.008111   0.092547  -0.088    0.930
x2           0.031866   0.089083   0.358    0.721
x3           0.081973   0.101729   0.806    0.422

Residual standard error: 0.9822 on 96 degrees of freedom
Multiple R-squared:  0.008441,    Adjusted R-squared:  -0.02255
F-statistic: 0.2724 on 3 and 96 DF,  p-value: 0.8452

The t-value you are looking for are there. Usually, we rather look at the p-value and reject the H0 if the p-value is smaller than a predefined value and call the variable (statistically) significant. In most cases this predefined (alpha-) value is 0.05 aka 5%. So in my example non of the explanatory variables are significant as their p-values are all above 5%.


text:
Q: alert dialog onclick application crash i want to open url onclick of alert dialog in my application but it giver error of start activity.please tell me solution
public void AlertUpgrade(Activity activity)
{
    Log.e("AlertUpgrade", "Communicator.");
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setMessage("  Click OK to Upgrade Now ? ")
    .setPositiveButton("OK" +
    "", new DialogInterface.OnClickListener()
        {
     public void onClick(DialogInterface dialog, int id)
     {

       Log.e("onClick", "AlertUpgrade");

       Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("  "));
       marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET|Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
        startActivity(marketIntent);
    }
     }
    ).setOnKeyListener(new OnKeyListener() {
        @Override
        public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            if(keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP)
            {
                return false;
            }

            return true;
        }
    });
    builder.create().show();
}

ERROR:
04-04 15:40:10.549: E/AndroidRuntime(5142): FATAL EXCEPTION: main
04-04 15:40:10.549: E/AndroidRuntime(5142): java.lang.NullPointerException
04-04 15:40:10.549: E/AndroidRuntime(5142):     at android.app.Activity.startActivityForResult(Activity.java:3464)
04-04 15:40:10.549: E/AndroidRuntime(5142):     at android.app.Activity.startActivityForResult(Activity.java:3425)
04-04 15:40:10.549: E/AndroidRuntime(5142):     at android.app.Activity.startActivity(Activity.java:3661)
04-04 15:40:10.549: E/AndroidRuntime(5142):     at android.app.Activity.startActivity(Activity.java:3629)
04-04 15:40:10.549: E/AndroidRuntime(5142):     at gsip.webgalaxy.ui.Communicator$2.onClick(Communicator.java:146)
04-04 15:40:10.549: E/AndroidRuntime(5142):     at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:185)
04-04 15:40:10.549: E/AndroidRuntime(5142):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-04 15:40:10.549: E/AndroidRuntime(5142):     at android.os.Looper.loop(Looper.java:176)
04-04 15:40:10.549: E/AndroidRuntime(5142):     at android.app.ActivityThread.main(ActivityThread.java:5419)
04-04 15:40:10.549: E/AndroidRuntime(5142):     at java.lang.reflect.Method.invokeNative(Native Method)
04-04 15:40:10.549: E/AndroidRuntime(5142):     at java.lang.reflect.Method.invoke(Method.java:525)
04-04 15:40:10.549: E/AndroidRuntime(5142):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
04-04 15:40:10.549: E/AndroidRuntime(5142):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
04-04 15:40:10.549: E/AndroidRuntime(5142):     at dalvik.system.NativeStart.main(Native Method)

A: Put Uri you want to start in "".
For example-
Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));

A: protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    AlertUpgrade(MainActivity.this);
}
    public void AlertUpgrade(Activity activity)
    {

        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
        builder.setMessage("  Click OK to Upgrade Now ? ")
        .setPositiveButton("OK" +
        "", new DialogInterface.OnClickListener()
            {
         public void onClick(DialogInterface dialog, int id)
         {

           Log.e("onClick", "AlertUpgrade");

           Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
           marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET|Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
            startActivity(marketIntent);
        }
         }
        ).setOnKeyListener(new OnKeyListener() {
            @Override
            public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
                if(keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP)
                {
                    return false;
                }

                return true;
            }
        });
        builder.create().show();

    }


text:
Q: How to stop webview reload located on tabview cell while scrolling I have webview in table view cell , whenever tableview cell is scrolling ,Web view reloads ....How to stop webview reload while tableview is scrolling.

A: Hi iOSDev please follow the following link
Don't reuse cell in UITableView
Max Pevsner solution fulfills your problem of not dequeuing the cell with just instantiating a table view cell.
But my suggestion is you use static webView, instead of not dequeuing the cell, as it will always stay in memory till the tableview is loaded, and moreover every time the cell will be created again when you will scroll the tableview. not dequeuing cell will be least efficient, for the tableview.


text:
Q: What is the best form element styling library/plug-in (jQuery)? In the project I am working on at the moment form elements (like <input>,<select>,<textarea> etc)
must have non-standard 'look-n-feel'.
Which library or plugin (jQuery) can you recommend for this?
I have searched through some the available libraries, but did not find a library that suits my needs. All of them have 'real' - 'fake' element idea behid them.
The project has a lot of form elements created on-the-fly and injected into the DOM.
The main requirements are:

*

*Creation of 'fake' element/s on the fly.

*Ability to apply styles for one node or CSS selector (not the whole page).

*Non-intrusive events propagation between fake and real elements.
(Fake element should respond to changes in real element and send events occuring on it to the corresponding real element
like blur, focus, change, click. Library should take care about events propagation, not the code)

*It should be compatible with IE7 and upwards.

*Should have good documentation and flexible public API

I am struggling with one library and almost "adapted" it to the requirements but it lacks documentation and the licencing is unclear
as to whether I can modify it.
Thank you very much for the help!
Kind regards.

A: you may want to look into those (february 2014):
uniformjs.com - form elements styling (IE7+, chrome, safari, firefox)
github.com/emblematiq/Niceforms - form elements styling - (maybe?) sounds risky as no community, one commiter only (IE7+, Firefox2+, Safari3+, Opera9+, Chrome0.3+)
github.com/harvesthq/chosen and harvesthq.github.io/chosen - form select/dropdown box
ivaynberg.github.io/select2 - dropdown boxes (IE8+), it seems to have originated from Chosen.js (to be double checked)
github.com/Robdel12/DropKick and robdel12.github.io/DropKick - form select/dropdown box
github.com/gfranko/jQuery.selectBoxIt.js - form select/dropdown box
brianreavis.github.io/selectize.js or github.com/brianreavis/selectize.js - hybrid of a textbox and  box - useful for tagging, contact lists, country selectors, and so on
arthurgouveia.com/prettyCheckable - form checkboxes & radio buttons styling (IE7+, Chrome, Firefox, Safari & mobile browsers)
http://xoxco.com/projects/code/tagsinput/ or https://github.com/xoxco/jQuery-Tags-Input - tags
Twitter Bootstrap might be a good option too - Use the Customizer to only load the part of the library that you need, read more about customizing Twitter bootstrap components

A: You can see this!
http://twitter.github.com/bootstrap/base-css.html#forms

Bootstrap has very and util things that can help you!!

A: You might have a look at Twitter Bootstrap.  I believe it uses CSS to perform most of its tricks so you shouldn't need the concept of a delegate component (the real/fake thing) to get a slightly more polished look and feel.

A: I really like jQtransform: you just need to include jQuery library and plugin jqtransform
//required
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.jqtransform.min.js"></script>

and then apply the transformations to all form
<script type="text/javascript">
$(function() {
    //find all form with class jqtransform and apply the plugin
    $("form").jqTransform();
});
</script>

or to a specific form
<script type="text/javascript">
$(function() {
    //find all form with class jqtransform and apply the plugin
    $("form.jqtransform").jqTransform();
});
</script>

A: If you just want to style you input, select and textarea's you don't really need javascript to do that. That is all easily possible with normal css (change the borders, colors, background, rounded corners, etc..). Only older (IE) browsers will not be able to use rounded corners on your (form) elements.
If you also want to be able to style the dropdown of you select-element, you may need javascript, because that will not work in CSS.
From all the existing libraries I looked at I found jqTransform the easiest to work with (as mentioned earlier) because it delivers the 'cleanest' HTML replacements for you form elements. Which are all easy to style with css.
But, I have a few issues with jqTransform. For starters, it contains a bug that causes the onchance event on a select element not to fire, also it has no destroy/refresh option. So you won't be able to style new elements injected in a already styled form. For both these issues I have created workarounds to make it work. I found a fix for the onchange event (somewhere here on stackoverflow) and I also wrote an extra function to refresh a jqTransform element.
But, because of these issues and the fact that jqTransform hasn't been updated since 2009 I decided about a month ago to write my own jQuery plugin to handle this functionality for me.
It's called 'jQuery Mighty Form Styler' and it should work fine with jQuery 1.7 and above. At this point it only styles the select element, because other form elements can be styled with css. So why add load time to you page with unnecessary javascript? I'm planning to add radio and checkboxes too because styling them with just css is not that easy (and nog working in a lot of browsers).
It already does feature a refresh and destroy function to remove the fake elements or refresh the content of the fake elements.
You can get it at http://www.binkje.nl/mfs where you can also find the documentation. It's free for everybody to use. Although I do believe that you shouldn't style anything with javascript. That is something you should only do with CSS.

A: If you are looking for styling for both desktop web and mobile - a responsive solution - take a look at Mobiscroll Forms.
It ships with 13 distinctive controls from text inputs to alerts, notification and customizable sliders. You should be covered for your basic form needs and beyond.
Another thing to note is that the elements can be styled with the built-in themes - for iOS, Material, Windows, Web - and of course with CSS above that.

*

*The toolset can be downloaded from the website.

*Demos can be
seen here.

*If you prefer: Github repo and NPM package.


text:
Q: Example of git API call that specifies pagination with access token included I have this:
curl https://api.github.com/orgs/company/repos?access_token=<token>

It only returns the first 30 results, which I've read is the default. How would I modify this to set the pagination to include the rest of the results?

A: My problem was that I was not using quotes when trying to add the page= to the call. So in case anyone else is as dense as I can be, the curl command would look like this:
curl -i 'https://api.github.com/orgs/company/repos?access_token=<token>&page=2'

and so on for the number of pages you have.


text:
Q: How can I conditionally send templates and javascript files to the client in meteor? This is related to a previous question I asked about conditionally sending document data to the client in meteor.
Lets say I have a parse-like data editor/browser available for user accounts marked as system admin, as well as some pages that show logging information about the app. I'm using meteor-router and a filter to accomplish this.
99% of users won't need to to see those interfaces, but the (massive amounts of) javascript for them is still sent to the client. The admin specific javascript and templates are separated into their own files, how can I make sure they are not sent to the client unnecessarily (when the logged in user is not an admin)?
Is the best option really to split the admin interface into a separate app and point it at the original's mongo?

A: If you don't want Meteor to load your client-side scripts automatically, you could place them in the /public directory and load them yourself when you need them.
However, in the case of an admin environment, it may actually be better from a software development perspective to separate all of that into its own app, pointing to the same database like you said.

A: At the moment (June 2015), incremental template loading is still on the Meteor Roadmap.
The best solution might actually be to split away the admin app, also for security reasons.
If you do want to keep everything in one app, the leading community package for lazy loading is numtel:lazy-bundles.


text:
Q: Load more AJAX on WP Query I am trying to get an AJAX WP Query loop to output 2 posts then use a 'Load more' button to load the next page of results. What is the best method to approach as not currently working?
JS
  var ajaxRequest=function(){
  var filter = $('#filter');
  var page = 1; // What page we are on.
  var ppp = 3; // Post per page
        $.ajax({
            url: filter.attr('action'),
            data: filter.serialize(),
            type: 'POST',
            dataType: 'json',
            offset: (page * ppp) + 1,
            ppp: ppp,
            success: function(response) {
              page++;
              $(".card-wrap").append(response); //Post class
              $("#more_posts").attr("disabled",false);
            }
        });
    };

PHP
<?php
    header("Content-type: application/json"); //Outputting as JSON for map data.
    $offset = $_POST["offset"];
    $ppp = $_POST["ppp"];
    $args = array(
        'order' => $_POST['date'],
        'post_type' => 'custom',
        'posts_per_page' => 2,
        'offset' => $offset,
    );
    [Rest of query]
?>

HTML
Load More

A: if you want to use ajax in wordpress you must have to follow these step:
1) first make your js file like main.js.
2) localize it in functions.php with wp_localize_script().
wp_enqueue_script( 'main.js', get_template_directory_uri().'/js/main.js', array( 'jquery'  ) );
    wp_localize_script( 'main.js', 'ajax_object', array('ajax_url' => admin_url('admin-ajax.php')) );

3) make your javascript or jquery code to run your query with ajax and in ajax data object add a action property like action: 'load_more_posts'.
This action property will make function with same name to excute our code.
jQuery(function($){
    $('#load_more_posts').on('click', function(e){
        console.log('hi');
        e.preventDefault();
         var $offset = $(this).data('offset');
         console.log('var'+$offset);
        $.ajax({
            method: 'POST',
            url: ajax_object.ajax_url,
            type: 'JSON',
            data: {
                offset: $offset,
                action: 'load_more_posts'
            },
            success:function(response){
                console.log(response);
                $('#load_more_posts').data('offset', parseInt(response.data.offset));

            }
        });
    })
});

4) In functions.php
 add_action( 'wp_ajax_load_more_posts', 'load_more_posts' );
    add_action( 'wp_ajax_nopriv_load_more_posts', 'load_more_posts' );
    function load_more_posts(){
        global $post;
        $args = array('post_type'=>'post', 'posts_per_page'=> 2, 'offset'=> $_POST['offset']);
        $rst=[];
        $query = new WP_Query($args);
        if($query->have_posts()):
            while($query->have_posts()):$query->the_post();
                $rst[] = $post;
            endwhile;
            wp_reset_postdata();
            $offset = $_POST['offset']+2;
        endif;
        wp_send_json_success(array('post'=>$rst, 'offset'=>$offset));
    }

wp_ajax_nopriv_(action) executes for users that are not logged in.
 wp_ajax_(action) executes for users that are  logged in.
you can use query response as you like.
Hope this will help!


text:
Q: How to stop gridview column from automatically encoding html entities I am fairly new to asp.net and come into a problem whilst using a gridview.
I have added some entries that contain the "&" symbol eg "PR Murphy & Associates".
I haven't done any encoding of my data prior to inserting it into the database.
When the gridview is changed to edit mode my text looks like this: "PR Murphy & Associates"
Is thee a ny way I can stop it from encoding the information, I mean just keep the text as "PR Murphy & Associates" when inserting and then after/during an edit.
Thanking you

A: In the GridView's menu, you can select the column and under the properties for that column you can set HTMLEncode to False (or True depending upon your needs).

A: I solved this problem with GridView1_RowDataBound Event
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
           for (int i = 0; i < e.Row.Cells.Count; i++)
           {
               string encoded = e.Row.Cells[i].Text;
               e.Row.Cells[i].Text = Context.Server.HtmlDecode(encoded);
           }
    }
}


text:
Q: Build XLSX File With JavaScript I'm trying to build out an XLSX file using JavaScript using some database query results. I have to use JavaScript as the server back end only provides a JavaScript interface to work with (and it doesn't like jQuery). Now, I seem to have uncovered something to actually create the base64 encoded data to write to the file (the server interface provides an API for creating files using base64 encoded strings and defining a file type). XLSX.js looks like it will work well for that purpose, since it looks like it can read in some form of JS object and convert it to a base64 string. However, I am rather unclear about how to generate the worksheet XML data in the first place, or how I would want to construct a representative JS object. The only useful information I can seem to find doesn't really give me a good idea how to build it out, if I can even locate information on structuring. Most I find is about reading the files, not creating them. Also, I thought I found some simple to implement methods, but then they devolve into a mess of libraries and I get lost trying to understand which files are actually necessary and how to correctly include them in the work.

A: You can export data from js to XLS, XLSX and CSV formats with Alasql library.
For example we want to write a data which we saved in test variable in an XLSX file through click a button. To do this just use following steps:
1- Include following files in your page:
 <script src="http://alasql.org/console/alasql.min.js"></script>
 <script src="http://alasql.org/console/xlsx.core.min.js"></script>

2- So Then make a function in controller to save the test array as a xlsx file:
function saveAsXlsx(){
   alasql('SELECT * INTO XLSX("output.xlsx",{headers:true}) FROM ?',[test]);
}

So We save the data which we had in variable test into a file which we named it output.xlsx here.
3- The last part is the easiest part. Run the function on click on a button:
 <button onclick="saveAsXlsx()" >Save as XLSX</button>

A: I've abandoned trying to create an XLSX document in the environment I'm working in. I've been provided with a way to instead create an XLS file using the XML formatting for Excel 2003 that seems to work except for a warning when trying to open files generated in this fashion stating that the file is in a different format than what is specified by the extension. Other than that warning, I have been able to create workable files that open in Excel and behave pretty well.
I guess maybe I'll have to leave generating XLSX files for any future .NET projects I may have. This kind of sucks as a resolution, but thank you everyone for your responses.

A: Excel supports two forms of XML documents as input. One is a ZIP archive which contains various XML documents and other data. This is the standard XLSX file format.
The second form is just the sheet data itself as an XML document. So all you need is to create the XML as string. Wikipedia has an example for the Excel XML format. You can find links to the reference documentation under "External links"
If you create a file in this format and save it as .xslx, then Excel should be able to open it. If not, then try the .xsl extension. If you have trouble formatting something properly, do it in Excel, save and look at the resulting file.
I'm not sure XLSX.js will be much help since it's a browser / client framework that depends on jQuery and jszip and other things. The "base64 and back" option refers to adding an Excel sheet to a HTML document as base64 string. The framework can then open this virtual file and examine it. I think it's not meant to generate Excel files for download.


text:
Q: Sorting an array based on its value I have an Array,
Sample:
$array {
 [0] {
   [something]=1;
   [something2]=2;
     }
 [1] {
   [something]=2;
   [something2]=4;
     }
 [2] {
   [something]=5;
   [something2]=2;
     }
}

I want to order the array based on the key something;
So it will look like:
$array {
 [0] {
   [something]=5;
   [something2]=2;
     }
 [1] {
   [something]=2;
   [something2]=4;
     }
 [2] {
   [something]=1;
   [something2]=2;
     }
}

A: function compare($x, $y) {
    return $x['something'] - $y['something'];
}

usort($input_array, 'compare');

you need to use a usort() similar to the above.

A: Would the following suffice?
foreach($array as $key => $value){
    ksort( $array[$key] );
}


text:
Q: .gitconfig system location confusion On windows 10 when I run:
git config --list --show-origin

I get:
    file:"C:\\ProgramData/Git/config"       core.autocrlf=input
    file:"C:\\ProgramData/Git/config"       core.fscache=true
    file:"C:\\ProgramData/Git/config"       color.diff=auto
    file:"C:\\ProgramData/Git/config"       color.status=auto
    ...
    file:"C:\\Users\\user\\AppData\\Local\\Programs\\Git\\mingw64/etc/gitconfig"   http.sslcainfo=C:/Users/user/AppData/Local/Programs/Git/mingw64/ssl/certs/ca-bundle.crt
    file:"C:\\Users\\user\\AppData\\Local\\Programs\\Git\\mingw64/etc/gitconfig"   http.sslbackend=openssl
    file:"C:\\Users\\user\\AppData\\Local\\Programs\\Git\\mingw64/etc/gitconfig"   diff.astextplain.textconv=astextplain
    ....
    file:C:/Users/user/.gitconfig  alias.st=status
    file:C:/Users/user/.gitconfig  alias.co=checkout

Why do I have both:
file:"C:\\Users\\user\\AppData\\Local\\Programs\\Git\\mingw64/etc/gitconfig"

and:
file:"C:\\ProgramData/Git/config"

Should I not only have ONE system location?
And in Eclipse it defaults to the one in %APPDATA%

So I assume it/eclipse will never consider the file in:
"C:\ProgramData/Git/config"
?

A: There are --system config values, which you can see if you run:

git config --list --system

and there are --global config values, which you can see if you run:

git config --list --global

so when you run:

git config --list --show-origin

You can see both lists mixed.
And if you'll run it from within a local repository, you'll see it mixed also with the local config values, those that you can get if you'll run:

git config --list --local

A: I believe the correct answer is given in the link provided by @PetSerAl in the comment to the question. The explanation is that there are multiple different git implementations available for Windows and by splitting the system configuration into two locations you can have one system config that can be shared between implementations and one that is specific to the current implementation.
My interpretation of the doc is that the one in C:\\ProgramData/Git/config is the shared one and the one in C:\\Users\\user\\AppData\\Local\\Programs\\Git\\mingw64/etc/gitconfig is specific to the git implementation you are using.
It looks like Eclipse is not aware of this Windows-specific thing with two system settings files. Git for Windows is however aware of the other shared file and should make use of it when invoked from Eclipse.


text:
Q: Mysql on Ubuntu crashing periodically I have a problem with Mysql on my ubuntu server. it is restarting periodically about 4-5 times a day .
Here is the logs that I found in /var/log/mysql/error.log:
2021-02-23T08:35:08.249856Z 18 [Note] Aborted connection 18 to db: 'dbname' user: 'root' host: 'localhost' (Got timeout reading communication packets)
2021-02-23T10:34:19.443803Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 5088ms. The settings might not be optimal. (flushed=201 and evicted=0, during the time.)
2021-02-23T10:34:47.634586Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 4824ms. The settings might not be optimal. (flushed=202 and evicted=0, during the time.)
2021-02-23T10:35:23.300149Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-02-23T10:35:23.300393Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2021-02-23T10:35:23.304521Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.33-0ubuntu0.18.04.1) starting as process 123774 ...
2021-02-23T10:35:23.422500Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-02-23T10:35:23.422575Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-02-23T10:35:23.422587Z 0 [Note] InnoDB: Uses event mutexes
2021-02-23T10:35:23.422597Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-02-23T10:35:23.422606Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-02-23T10:35:23.422616Z 0 [Note] InnoDB: Using Linux native AIO
2021-02-23T10:35:23.430306Z 0 [Note] InnoDB: Number of pools: 1
2021-02-23T10:35:23.482073Z 0 [Note] InnoDB: Using CPU crc32 instructions
2021-02-23T10:35:23.549284Z 0 [Note] InnoDB: Initializing buffer pool, total size = 11G, instances = 8, chunk size = 128M
2021-02-23T10:35:24.950573Z 0 [Note] InnoDB: Completed initialization of buffer pool
2021-02-23T10:35:25.432846Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-02-23T10:35:25.472539Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2021-02-23T10:35:25.725336Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 340770137569
2021-02-23T10:35:26.793582Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 340775379968
2021-02-23T10:35:27.011079Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 340780622848
2021-02-23T10:35:27.253004Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 340785865728
2021-02-23T10:35:27.486900Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 340791108608
2021-02-23T10:35:31.778895Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 340880237568
2021-02-23T10:35:32.176816Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 340885480448
2021-02-23T10:35:32.417818Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 340890723328
2021-02-23T10:35:32.657115Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 340895966208
2021-02-23T10:35:32.993739Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 340901209088
2021-02-23T10:35:33.231043Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 340906451968
2021-02-23T10:35:45.981286Z 0 [Note] InnoDB: Database was not shutdown normally!
2021-02-23T10:35:45.981297Z 0 [Note] InnoDB: Starting crash recovery.
2021-02-23T10:35:47.430460Z 0 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
2021-02-23T10:37:35.718502Z 0 [Note] InnoDB: Apply batch completed
2021-02-23T10:37:36.213080Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2021-02-23T10:37:36.213174Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-02-23T10:37:36.213376Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-02-23T10:37:36.322627Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-02-23T10:37:36.324281Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2021-02-23T10:37:36.324312Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2021-02-23T10:37:36.325223Z 0 [Note] InnoDB: Waiting for purge to start
2021-02-23T10:37:36.375439Z 0 [Note] InnoDB: 5.7.33 started; log sequence number 341150009542
2021-02-23T10:37:36.375495Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 130943ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
2021-02-23T10:37:36.376274Z 0 [Note] InnoDB: Loading buffer pool(s) from /media/ssd/mysql/ib_buffer_pool
2021-02-23T10:37:36.389529Z 0 [Note] Plugin 'FEDERATED' is disabled.
2021-02-23T10:37:36.737795Z 0 [Note] InnoDB: Buffer pool(s) load completed at 210223 14:07:36
2021-02-23T10:37:37.064320Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2021-02-23T10:37:37.064371Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2021-02-23T10:37:37.168308Z 0 [Warning] CA certificate ca.pem is self signed.
2021-02-23T10:37:37.246404Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2021-02-23T10:37:37.249146Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2021-02-23T10:37:37.249192Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2021-02-23T10:37:37.249280Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2021-02-23T10:37:37.430015Z 0 [Note] Event Scheduler: Loaded 0 events
2021-02-23T10:37:37.430686Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.33-0ubuntu0.18.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
2021-02-23T14:51:15.763758Z 8 [Note] Aborted connection 8 to db: 'dbname' user: 'root' host: 'localhost' (Got an error reading communication packets)
2021-02-23T14:51:15.763838Z 16 [Note] Aborted connection 16 to db: 'dbname' user: 'root' host: 'localhost' (Got an error reading communication packets)
2021-02-23T14:51:15.763995Z 10 [Note] Aborted connection 10 to db: 'dbname' user: 'root' host: 'localhost' (Got an error reading communication packets)
2021-02-23T14:51:15.764047Z 15 [Note] Aborted connection 15 to db: 'dbname' user: 'root' host: 'localhost' (Got an error reading communication packets)
2021-02-23T14:51:17.210238Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 29446ms. The settings might not be optimal. (flushed=204 and evicted=0, during the time.)
2021-02-23T14:54:15.294784Z 453 [Note] Aborted connection 453 to db: 'dbname' user: 'root' host: 'localhost' (Got an error reading communication packets)
2021-02-23T14:54:15.296473Z 451 [Note] Aborted connection 451 to db: 'dbname' user: 'root' host: 'localhost' (Got an error reading communication packets)
2021-02-23T14:54:15.298752Z 450 [Note] Aborted connection 450 to db: 'dbname' user: 'root' host: 'localhost' (Got an error reading communication packets)
2021-02-23T14:54:15.298926Z 14 [Note] Aborted connection 14 to db: 'dbname' user: 'root' host: 'localhost' (Got an error reading communication packets)
2021-02-23T17:11:22.648311Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-02-23T17:11:22.648589Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2021-02-23T17:11:22.652881Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.33-0ubuntu0.18.04.1) starting as process 1634 ...
2021-02-23T17:11:22.672652Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-02-23T17:11:22.672725Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-02-23T17:11:22.672736Z 0 [Note] InnoDB: Uses event mutexes
2021-02-23T17:11:22.672745Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-02-23T17:11:22.672754Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-02-23T17:11:22.672762Z 0 [Note] InnoDB: Using Linux native AIO
2021-02-23T17:11:22.675075Z 0 [Note] InnoDB: Number of pools: 1
2021-02-23T17:11:22.683213Z 0 [Note] InnoDB: Using CPU crc32 instructions
2021-02-23T17:11:22.689903Z 0 [Note] InnoDB: Initializing buffer pool, total size = 11G, instances = 8, chunk size = 128M
2021-02-23T17:11:24.068244Z 0 [Note] InnoDB: Completed initialization of buffer pool
2021-02-23T17:11:24.559873Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-02-23T17:11:24.605433Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2021-02-23T17:11:24.871485Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 342136489876
2021-02-23T17:11:25.341573Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 342141732352
2021-02-23T17:11:25.577950Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 342146975232
2021-02-23T17:11:25.795290Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 342152218112
2021-02-23T17:11:26.031098Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 342157460992
2021-02-23T17:11:26.355898Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 342162703872
2021-02-23T17:11:26.619473Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 342167946752
2021-02-23T17:11:27.019359Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 342173189632
2021-02-23T17:11:28.172480Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 342199404032
2021-02-23T17:11:28.383917Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 342204646912
2021-02-23T17:11:28.571524Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 342209889792
2021-02-23T17:11:40.944348Z 0 [Note] InnoDB: Database was not shutdown normally!
2021-02-23T17:11:40.944364Z 0 [Note] InnoDB: Starting crash recovery.
2021-02-23T17:11:41.913740Z 0 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
2021-02-23T17:13:53.415441Z 0 [Note] InnoDB: Apply batch completed
2021-02-23T17:13:53.700851Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2021-02-23T17:13:53.700935Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-02-23T17:13:53.701086Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-02-23T17:13:53.816298Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-02-23T17:13:53.817845Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2021-02-23T17:13:53.817877Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2021-02-23T17:13:53.818861Z 0 [Note] InnoDB: 5.7.33 started; log sequence number 342515600566
2021-02-23T17:13:53.818894Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 149259ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
2021-02-23T17:13:53.819711Z 0 [Note] InnoDB: Loading buffer pool(s) from /media/ssd/mysql/ib_buffer_pool
2021-02-23T17:13:53.826641Z 0 [Note] Plugin 'FEDERATED' is disabled.
2021-02-23T17:13:54.130893Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2021-02-23T17:13:54.130990Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2021-02-23T17:13:54.150644Z 0 [Warning] CA certificate ca.pem is self signed.
2021-02-23T17:13:54.168241Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2021-02-23T17:13:54.171009Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2021-02-23T17:13:54.171228Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2021-02-23T17:13:54.171337Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2021-02-23T17:13:54.194435Z 0 [Note] InnoDB: Buffer pool(s) load completed at 210223 20:43:54
2021-02-23T17:13:54.323573Z 0 [Note] Event Scheduler: Loaded 0 events
2021-02-23T17:13:54.324340Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.33-0ubuntu0.18.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)

And Here is my.cnf file :
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
sql_mode = "ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
innodb_buffer_pool_size = 11G
innodb_log_buffer_size = 8M
innodb_log_file_size = 2047M

I can not determine what causes these crashes :(

A: Note the pattern:
2021-02-23T08:35:08.249856Z 18 [Note] Aborted connection 18 to db: 'dbname' user: 'root' host: 'localhost' (Got timeout reading communication packets)

Large time gap
2021-02-23T10:34:19.443803Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 5088ms. The settings might not be optimal. (flushed=201 and evicted=0, during the time.)
2021-02-23T10:34:47.634586Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 4824ms. The settings might not be optimal. (flushed=202 and evicted=0, during the time.)
2021-02-23T10:35:23.300149Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-02-23T10:35:23.300393Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2021-02-23T10:35:23.304521Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.33-0ubuntu0.18.04.1) starting as process 123774 ...

This is mysql restarting.
That means there wasn't a clean shutdown. Which is backed up by your mysql.service: Main process exited, code=killed, status=9/KILL comment.
So either you have a person going around doing a kill -9 on your mysqld process, or more likely, you are running out of memory at a particular point, the OOM killer is removing mysqld, and systemd is restarting it at point later in time.
Running dmesg should confirm the out of memory.


text:
Q: Travis sees old signature of a GO function and won't build I have a strange behaviour on Travis CI on a GO project.
It fails [here], complaining about a function taking just 1 parameter and being called with 2.
src/finances-service/main.go:45:19: too many arguments in call to route.Register
    have (*gin.Engine, *controller.TokensController)
    want (*controller.TokensController)

It used to accept only the TokensController, but now, in this pull request, it accepts also a gin.Engine.
If we look at the source code for this file in this branch, we can see the function signature accepting the 2 parameters.
func Register(
    engine *gin.Engine,
    tokensController *controller.TokensController,
) {

It is then being called once in production code.
route.Register(engine, tokensController)

and once in test code.
route.Register(testRoute, tokensController)

I do not understand this behaviour. I am sure there is something obvious about it, I just do not see it. I humbly ask for your help. I have sent an email to Travis CI, but am still waiting for the answer. Looking on all fronts for help on this. Thanks in advance.

A: I have just cloned the repo in my local environment and make build passed for master and 22-banner branches.
I messed out a little and realized that you have vendored your own src dir. It's absolutely not a good idea.
If you track down to the route package, it will end up somewhere in vendor folder, not somewhere it should be.

So what's the resolution?
First of all, if you really want to use Dep, then you have to put that vendor directory in root. Gopkg.* files are nothing without it.
I see that you have three branches and you're using the same dependencies even though you're trying to use a different (or wrong) signature in master. As I stated above, you also have had your own package vendored. You should not do this for local packages inside your working directory. If you really want, you can create another repo with version tags.
Then, you have to make sure that you're on the $GOPATH/src/github.com/<xxx>/<yyy> on Travis build, your repo must live there.
After that, since your local package isn't cached in vendor folder, it will successfully build on Travis.
P.S.: For testing purposes, just purge everything created by Dep and use only go get. The problem arised here is only about vendoring.


text:
Q: Alfresco 5.1 have blog posts on site's homepage Is there a method to have a blog's posts placed directly on a site homepage section ?
ALex.

A: I found an interesting collection of add-ons for Alfresco Share from Will Abson (http://share-extras.github.io/) among witch there is a nice site-blog-dashlet to publish blog posts directly on homepage.


text:
Q: Proving radius of injectivity goes to zero if volume goes to zero
Let $n_0 \in \mathbb{N}$ be an odd number. Prove there exists a sequence of compact manifolds, $M_k, k \in \mathbb{N}$, all with the same dimension $n_0$ and the same constant sectional curvature $K_{M_k} \equiv 1$ whose volume satisfies $$\lim_{k \to \infty} \operatorname{Vol}(M_k) = 0$$ Conclude that the radius of injectivity also goes to zero, that is, $\displaystyle{\lim_{k \to \infty}} i(M_k) = 0$.

Since $n_0 = 2m - 1$ for some $m \in \mathbb{N}$, we can consider the unit sphere $\mathbb{S}^{2m-1} \subset \mathbb{R}^{2n} = \mathbb{C}^n$ and the quotient manifold $\displaystyle{\mathbb{S}^{2m-1} \over \mathbb{Z}_p}$ (a lens space). It's straightforward to show the volume of this quotient is the volume of the sphere over $p$, so letting $p \to \infty$ we get the desired sequence of manifolds.
But how can we conclude the injectivity radius also goes to zero? I think maybe we could show that $i(M_k) = \dfrac{\pi}{k}$, but I haven't been able to prove this. I'd appreciate any help.


text:
Q: Trying to understand the Law of Demeter as it applies to my code I have a simple Store class that contains an Inventory. The Inventory contains a list of Items. In order to modify one of the Items in the Inventory, I'd have to write:
Store store( /*parameters*/ );
store.accessInventory(/*password*/).accessItem(/*item name*/).setPrice(9.50);

As  I understand it, this breaks the Law of Demeter because Store has to reach through Inventory and into Item in order to call setPrice().
I'd like to reconcile this violation of the law with the violation of the law in the classic example with the paper boy and the customer. In the paper boy example, the paper boy "knows" too much about the customer by assuming he will make his payment with a wallet. If the customer's method of payment changes, the paper boy will have to change as well.
What assumptions in my code are being made that could result in a problem like the one encountered in the paper boy example?
I understand that the Law is really more of a guideline, and that abiding by it in this case may not be the best idea, but I'd like to at least understand the Law before I move on. Thanks.

A: Your code is assuming that the Inventory object is the only object that will ever need to be notified when a price changes.
Imagine that in addition to containing an Inventory of items, your Store also had some advertising posters hung up in its windows.
If you followed the law of Demeter, your Store object might have a nice method like this:
void Store :: SetItemPrice(string item_name, float item_price)
{
   inventory.SetItemPrice(item_name, item_price);

   for (int i=0; i<num_advertising_posters; i++)
   {
      // Update any posters with the new price!
      if (advertising_posters[i].advertised_item == item_name)
      {
         advertising_posters[i].SetAdvertisedPrice(item_price);
      }
   }
}

... but if you instead allow the calling code to access the inventory object directly, then there is no easy/foolproof way to make sure that the advertisements always get updated whenever a price gets updated, so chances are that at some point your store's advertising posters will show an old/wrong price for a product.  The Law of Demeter makes it easier to avoid that sort of bug.

A: Your example follows the paperboy example very closely. Your code is dependent upon the current Item interface which has the method setPrice(float). If you change that interface you need to update
store.accessInventory(password).accessItem(name).setPrice(price)

everywhere that it occurs.
A better solution would be to create function for Store and Inventory of the form
void Store::setItemPrice(string password, string name, float price)
{
  accessInventory(password).setItemPrice(name, price);
}

void Inventory::setItemPrice(string name, float price)
  {
  accessItem(name).setPrice(price);
  }

This way you can use those functions in the rest of your code and just change them accordingly if your Item or Inventory interfaces change.

A:
What assumptions in my code are being made that could result in a problem like the one encountered in the paper boy example?

Angry customers. Angry personnel. Angry managers. Angry accountants.
Customers don't mind being surprised when the price listed is higher than the price they are charged, but they sure do get POed when they are charged a higher price than the price they expected. The worker bees don't like it when angry customers come up to them because the stupid newbie store manager didn't follow protocol and changed the price directly in the inventory. Low and mid level managers don't like this either because they get grief from all sides. Bean counters also like to be informed when the value of their beans suddenly change.
It's not just the advertising posters that Jeremy mentioned in his answer. Some person needs to be told to change the little pricing tags next to the stack of items that specify the price. A crew of people need to be dispatched with portable printers to change the price stamped on each item of that type. These people need to be scheduled, and you had better not do that without talking to the department manager. And so on and so on. Reaching through the inventory to change the price is a bad, bad idea.
BTW, all of the above is coming from someone who thinks the Law Of Demeter is better called the Occasionally Useful Suggestion of Demeter.


text:
Q: YouTube video not loading into AS2 Flash I'm trying to make a Flash movie which will load a Flash video within itself. This is the code I was using and it had been working, but since changing the video URL it no longer loads.
this.createEmptyMovieClip("youTube_mc", this.getNextHighestDepth());
this.youTube_mc.loadMovie("https://www.youtube.com/v/22RBuZJ6J7k?version=3&autoplay=1");

Is anyone able to offer any help with this? It is vexing me somewhat. Thanks.

A: The youtube player is AS3 based, that's your issue. I would suggest moving to AS3 and checking out their API.

A: You can get it to work by using the HTML for embedding a Youtube video and loading that into a text box's HTMLText. I used to do this all the time when I couldn't get it to work 0:) It's also how I imported images from URLS haha!
myTextObject.htmlText ="/*YouTube embed code here (iFrame may not work.. try their old embed code if you can find it online)*/";

A: Use the player version 2 it works for me in AS2, default version is not working so "?version=2" part is necessary
    box.loadMovie("http://youtube.googleapis.com/v/VIDEO_ID?version=2");
    or
    box.loadMovie("http://www.youtube.com/v/VIDEO_ID?version=2");

just type the VIDEO_ID in the above commands
check this too
https://developers.google.com/youtube/flash_api_reference_as2


text:
Q: How to mapping enum in postgresql (db first) with ef core on .net core I'm writing a middleware that logs the exceptions I get.
I created enum values on postgresql

and mapped this to my log table

My Log model is:
   public class Log
{
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    [JsonIgnore]
    public int Id { get; set; }
    public EventType EventType { get; set; }
    public string Description { get; set; }
    public DateTime CreatedAt { get; set; }

}

My Error middleware is:
        var log = new Log();
        log.Description = ex.Message;
        log.EventType = EventType.Exception;
        log.CreatedAt = DateTime.Now;

        Context.Add(log);
        Context.SaveChanges();

(This is coming on interfaces, but I wanted to show shortly)
My Context:
 protected override void OnModelCreating(ModelBuilder model)
    {
        model
            .HasPostgresEnum(null, "event_type", new[] { "info", "unknown", "warning", "exception" });

  protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder
            .UseNpgsql(Configuration.GetConnectionString("MyConnection"))
            .UseCamelCaseNamingConvention();
        NpgsqlConnection.GlobalTypeMapper.MapEnum<EventType>("enum_logs_eventType");
    }

i think i did everything right. It is DB First, so I migrated the database, but I think you did the same steps there.
when i run the service and trigger any error i get this error:

When I try to cast to string or run .HasConversion or something i get this error:

A: Posthresql enum values are case sensitive. So when I deleted the enums and fixed them again (they're all lowercase), the error was resolved.


text:
Q: Misunderstanding about Julia threading race conditions This question is a follow up of one of my previous questions: Fastest way to compare lists with threshold in Julia
I am trying to parallelise the code using threads, here is an before/after
for i = 1:l
    B[i] || continue
    for j = i + 1:l
        B[j] || continue
        if all(abs(P[i, k] - P[j, k]) <= 0.001 for k=1:1540)
            B[j] = false
        end
    end
end

after:
for i = 1:l
    B[i] || continue
    Threads.@threads for j = i + 1:l
        B[j] || continue
        if all(abs(P[i, k] - P[j, k]) <= 0.001 for k=1:1540)
            B[j] = false
        end
    end
end

Where B is a BitVector of size m and P is matrix of size (m, 1540)
Just threading the loop actually improved performance and seemed to work fine with large array, (shape of P = (400000, 1540)) but doing some tests on smaller arrays with higher number of threads (m = 1056, nthreads > 8) I realised that I wasn't getting the same answer anymore. Some false in B weren't set correctly.
Now what I don't understand is that there shouldn't be a race condition here: no threads will access the same j value?
Changing to the code below actually fix the problem without hurting the performance but I don't really understand why?
for i = 1:l
    B[i] || continue
    o = ReentrantLock()
    Threads.@threads for j = i + 1:l
        B[j] || continue
        if all(abs(P[i, k] - P[j, k]) <= 0.001 for k=1:1540)
           Threads.lock(o) do
               B[j] = false
           end
        end
    end
end


text:
Q: Boundary Value Problem in the space of Distributions I will not be rigirous cause my question does not require this. It is well known how to treat the solution (for example) of the problem $\Delta u=f$ in $\Omega$ and $u=g$ on $\partial \Omega$ by the introduction of some Sobolev Space. My quite vague question is the following one: Is it possible to give a meaning to the previous problem and to prove the existence of at least a solution of the previous problem in the space of distributions without introducing Sobolev Spaces?

A: Here's a rough approach which I do not believe needs to use Sobolev space theory, though it's perhaps not what you are looking for: Assuming some boundary regularity (I believe that $\partial \Omega \in C^2$ is sufficient), one can merely recast the problem as solving for a Green's function. It is then possible to prove the existence of the Green's function for Laplace's equation using somewhat elementary means, if I recall.

A: I think what you are looking for might be explained in Section 18.3 and Appendix B.2 in Lars Hörmander, The Analysis of Linear Partial Differential Operators III, Springer-Verlag.
I do not understand enough, but Hörmander says "Section 18.3 is intended to give a solid framework for the study of boundary problems, in particular a discussion of spaces of distributions in a manifold with boundary and their wave front sets. However, little use will be made of the results in the later chapters where we use more conventional but non-invariant techniques.  The notions introduced in Section 18.3 seem so natural though that they are bound to play an increasingly important role."
Maybe somebody could comment, what has happened since (the book dates from 1985) with this theory.


text:
Q: How to configure Apache to reject proxy requests with error code? I have a server running Apache that often gets unwanted proxy requests, mostly for sites like www.yandex.ru or www.baidu.com. I don't have mod_proxy loaded, so these requests don't actually work. But what happens is that the content returned corresponds to the home page for my website, presumably because that's the default virtual host. The thing is, I'd rather not send back the full index page to someone who obviously isn't actually interested in my website; I consider it a waste of bandwidth and resources. I'd rather respond with an HTTP error code (400 I suppose) to signal that my server does not work as a proxy, and also to make myself feel better when I examine the access logs ;-)
What's the recommended way to configure Apache to return an error code for a proxy request? (By "proxy request" I mean one that provides an absolute URL in the HTTP request line.) And which HTTP error code is most appropriate for this?
By the way, I thought this would have been asked already but I looked and didn't find it.

A: You could simply configure a default vhost that denies all request:
<VirtualHost *:80>
  ServerName deny.all
  <Location />
    Order allow,deny
    Deny from all
  </Location>
</VirtualHost>

With that in place, all requests accessing a vhost that is not explicitly configure will be denied with HTTP error code 403 ("Forbidden").
Also be sure to have a look at the Apache wiki page on proxy abuse for more details. Beyond the solution above, they will also give you hints for a mod_rewrite-based solution.


text:
Q: Some times alamofireImage did't load images I tried this using normal
 winnerCell.challengeBannerURL.af_setImage(withURL:  URL(string: winnerchallengesData[indexPath.row].challengeDetails.challenge_banner_url)!)

It was working in normal call but not in AlamofireImage
let data = try? Data(contentsOf: URL(string: self.winnerchallengesData[indexPath.row].winnerDetails.profileURL)!)
//                winnerCell.userProfile.image = UIImage(data:data!)
//

A: The data coming from the server is a stream so I have to configure this in AlamofireImage.
ImageResponseSerializer.addAcceptableImageContentTypes(["image/jpg","image/png","binary/octet-stream"])

A: I had the case that images stopped downloading, after this setting was added to the info.plist file (on advise of a third party ad implementation);
NSAllowsArbitraryLoadsForMedia

Removing it fixed the issue.


text:
Q: Python input name in searchbox and find file in folder with same name Absolute newbie here, I'm just trying to make a simple code where I scan a barcode and then when I hit the button it looks in a specific folder for a file with the same name and opens that file.
I have looked everywhere for an answer but I don't seem to find out how to get the value from the entry box and compare it with the folder files.
Also, how do I search for the document folder without having to put the correct username, so that it will work on any account?
I'm a little stuck if you guys could point me in the right direction it would be greatly appreciated.
Here you can see my code so far, although I'm not sure it is correct.
import tkinter as tk
import os

# define print button function to open file
def sendprint():
os.startfile(r"C:\AutoPrint\test.txt")

# create window
window = tk.Tk()
window.geometry('300x200')
tk.Label(window,
        text="Scan Bracode:").grid(row=0)
window.title('AutoPrint')

# create entrybox
entrybox = tk.Entry(window)
entrybox.grid(row=0, column=1)

# create button
tk.Button(window,
         text='Print',
         command=sendprint).grid(row=3,
                                   column=0,
                                   sticky=tk.W,
                                   pady=4)

tk.mainloop()

A: To get text from Entry
    word = entrybox.get()

And later you can use different functions to check in folder
os.listdir(folder)
def sendprint():
    word = entrybox.get()

    folder = r'C:\AutoPrint'

    for filename in sorted(os.listdir(folder)):
        if word.lower() in filename.lower():
            fullpath = os.path.join(folder, filename)
            os.startfile(fullpath)

glob.glob() with *
def sendprint():
    word = entrybox.get()

    folder = r'C:\AutoPrint'

    pattern = os.path.join(folder, f'*{word}*')
    print('pattern:', pattern)

    filenames = glob.glob(pattern)
    print('filenames:', filenames)

    #if filenames:
    #   os.startfile(filenames[0])

    for fullpath in filenames:
       os.startfile(fullpath)

A: @furas Thanks for your help and hints, I've only recently started and am not really sure how to move!
I managed to put the code together after following your instructions and works really well only one little thing is bugging me, when no entry is present in the entry box it still opens what I believe it is the first file in the folder.
What could I modify to get it to work as it should?
import tkinter as tk
import tkinter.font as font
import os
import glob
import time
from pynput.keyboard import Key, Controller, Listener
import ctypes
import keyboard

ctypes.windll.shcore.SetProcessDpiAwareness(True)

keyboard = Controller()

# values for widgets coordinates
ref_x=0
ref_y=0

# set values for thickboxes
pro_only=1
pro_x2=2
w_only=3

# create window
##window=ThemedTk(themebg=True)
##window.set_theme('clam')
window = tk.Tk()
window.geometry('650x400')
window.configure(bg='#fdfdfd')
window.title('AutoPrint')
myFont = font.Font(family='Calibri', size=13)

# create entrybox with label
entrybox = tk.Entry(window, width=28)
entrybox.place(x=ref_x + 200, y=ref_y + 10)
entrybox['font'] = myFont
entrybox.focus()
boxlabel = tk.Label(window, text='Scan Barcode:', bg='#fdfdfd')
boxlabel.place(x=ref_x + 15, y=ref_y + 10)
boxlabel['font'] = myFont

# define search funtions
def sendprint():
    word = entrybox.get()
    folder = r'C:\AutoPrint'
    pattern = os.path.join(folder, f'*{word}*')
    print('pattern:', pattern)
    filenames = glob.glob(pattern)
    print('filenames:', filenames)

    if filenames:
       os.startfile(filenames[0])
       time.sleep(3)
       keyboard.press(Key.enter)
       time.sleep(0.5)
       keyboard.release(Key.enter)
       print (filenames)

    else:
       print ('Not found')

# create button
print_button = tk.Button(window, text='Print', command=sendprint, width=15, bg='#00a2ed', fg='white')
print_button.place(x=ref_x + 220, y=ref_y + 280)
print_button['font'] = myFont


text:
Q: calculating O(n) when computer speed is doubled
*

*Say  an algorithm of O(n) is solved on a computer with speed X.
Now this same algo when used on a computer of 2X speed can solve a problem of size 2N in the same time.

*Now if we have an algo of O(logn) on a computer with speed X
How do i calculate the  size of the problem that can be solved in the same time on a computer with 2X speed.

*Similarly for an o(n^2).
This is not any homework problem or such.
Just curiosity as the book I was reading says for question 2 above it is O(n^2) and I don't get it.

A: These kind of estimations are only possible if you know the big-theta of the run time, and then only if the problem size is large enough.
For 2) 2*log(n) = log(n^2)
For 3) 2*n^2 = (n*sqrt(2))^2

A: Let n be the current amount of work handled, and m be the amount of work handled if the speed is doubled. See discussion here:
https://math.stackexchange.com/questions/248306/time-complexity-why-does-doubling-the-speed-given-this-improvement
For O(log(n)):

log(m)/log(n) = 2
log(m)=2*log(n)
log(m)=log(n^2)  =>  m=n^2

For O(n^2):

m^2/n^2 = 2  =>  m = sqrt(2)*n

A: Big O notation doesn't rely on computer speed, it just describes the algorithmic time complexity. Something where you have to iterate through an array twice will always be 2N, if you put it on a computer that is twice as fast it will still be of 2N time complexity even if in reality it completes twice as quickly. That is the beauty of the notation, that it is independent of processor speed.


text:
Q: Which URL should I use when adding a Git submodule? Github: Which URL should I use? recommends cloning with HTTPS.
But, I see that Handlebars uses git:// in .gitsubmoudle.
Which is best for an open-source project that I want others to be able to easily clone recursively?

A: If you've other contributors, https would be my suggestion, since the proxy servers (and ISPs) do not block those requests, in general.
OTOH, if you can be sure (or make sure), that they would not be using any such ISP services, you can choose to provide them access via any of those methods. I personally prefer SSH over other protocols.


text:
Q: beautifulsoup - find all li within div say I have html code

 ...

 ...

 ...

 ...

 ...

 ...

how would I find all of the li attribute that is in the div tag, but not that is outside the div tag?
data = soup.find_all("div", {"class": "one"}).find_all("li")

but this does not work

A:
Beautiful Soup supports the most commonly-used CSS selectors. Just pass a string into the .select method

In [25]: soup = BS("""
 ...

 ...

 ...

 ...

 ...

 ...

""")

In [26]: soup.select("div  ul")
Out[26]:
[

 ...

 ...

 ...

 ...

]

A: You may construct an xpath selector using the lxml module (which you most likely have already installed, since you are using BS), like so:
from lxml import etree

root = etree.fromstring(html_string)
items = root.xpath('.//div[@class="one"]/descendant::li')

The downside (or maybe an upside really?) is that xml_string needs to be a valid html.


text:
Q: ext 4-1 TreePanel Locked column i have use property locked in treepanel column, and my console report problem :
    columns: [{
        xtype: 'treecolumn', //this is so we know which column will show the tree
        text: 'Task',
        locked:true,
        flex: 2,
        sortable: true,
        dataIndex: 'task',
    }

ERROR IS: ext-debug.js:10872
Uncaught TypeError: Cannot read property 'length' of undefined


text:
Q: Why in my case ST_DWithin is not using index I'm using Postgis extension for Postgres and trying to optimize my query for searching points in circle.
Consider I have this table with index:
create table position
(
 id bigserial not null primary key,
 date timestamp with time zone,
 point GEOMETRY(Point, 4326),
 alias varchar(50)
);
create index position_point_idx on position using gist (point);

Now when I use query with polygon everything work as expected. In explain plan I can see that query uses index.
SELECT distinct alias
FROM position
WHERE date > '2021-11-28T19:26:18.574Z'
  AND date < '2021-11-28T20:26:18.574Z'
  AND ST_contains(ST_GeomFromText(
                          'POLYGON ((13.970947489142418 49.59174558308953, 13.970947489142418 50.12515341892287, 15.208740681409838 50.12515341892287, 15.208740681409838 49.59174558308953, 13.970947489142418 49.59174558308953))',
                          4326), point);

  ->  Bitmap Index Scan on position_point_idx  (cost=0.00..183.82 rows=5254 width=0) (actual time=5.981..5.981 rows=94462 loops=1)

Okey now I want to search aliases in circle but for some reason it takes seconds and not using index at all.
SELECT distinct alias
FROM position
WHERE
date > '2021-11-28T19:26:18.574Z' AND date < '2021-11-28T20:26:18.574Z'
AND
ST_DWithin (point,ST_GeomFromText('POINT (14.32983409613371
            49.91815471231952)',4326),62815.14152820495);

ST_DWithin is in list here so it should use index but it's ignoring it.
What I'm doing wrong here? Thanks for any hint.
Here is my query plan
HashAggregate  (cost=687537.59..687538.59 rows=100 width=9) (actual time=2874.991..2875.003 rows=100 loops=1)
  Output: alias
"  Group Key: ""position"".alias"
  ->  Gather  (cost=1000.00..686702.70 rows=333955 width=9) (actual time=0.254..2041.354 rows=5008801 loops=1)
        Output: alias
        Workers Planned: 2
        Workers Launched: 2
"        ->  Parallel Seq Scan on public.""position""  (cost=0.00..652307.20 rows=139148 width=9) (actual time=0.021..2117.644 rows=1669600 loops=3)"
              Output: alias
"              Filter: ((""position"".date > '2021-11-28 19:26:18.574+00'::timestamp with time zone) AND (""position"".date < '2021-11-28 20:26:18.574+00'::timestamp with time zone) AND (""position"".point && '0103000020E6100000010000000500000077EC65F919AAEEC0B42AE025A7A5EEC077EC65F919AAEEC03A26ECE821B2EE4077646615AFADEE403A26ECE821B2EE4077646615AFADEE40B42AE025A7A5EEC077EC65F919AAEEC0B42AE025A7A5EEC0'::geometry) AND ('0101000020E61000000100C003E0A82C40520AF71786F54840'::geometry && st_expand(""position"".point, '62815.1415282049493'::double precision)) AND _st_dwithin(""position"".point, '0101000020E61000000100C003E0A82C40520AF71786F54840'::geometry, '62815.1415282049493'::double precision))"
              Rows Removed by Filter: 86028
              Worker 0: actual time=0.023..2492.854 rows=1922778 loops=1
              Worker 1: actual time=0.025..2493.448 rows=2024544 loops=1
Planning Time: 0.211 ms
Execution Time: 2876.783 ms

A: PostgreSQL chooses a sequential scan because it thinks that that is the most efficient access strategy, and I would say it is right. After all, the WHERE condition removed only 250000 out of approximately 5 million rows.

A: I think you wanted to use geography, not geometry.  In geometry 4326, the entire earth (and the rest of the universe, I suppose) is well within 62815.14152820495 degrees of every other point, so the index would be profoundly ineffective.
If you were using geography, that would be 39 miles, for which the index would be useful, and in my hands it would be used.
The stats on your table also seem to be way off.


text:
Q: Android: Can't style ActionBar menu text I'm trying to create a custom styling for the ActionBar. Specifically i'm trying to change the menu item color.
I applied these stylings:
<style name="MyActionBar" parent="@style/Widget.Sherlock.Light.ActionBar">
        <item name="android:actionMenuTextAppearance" tools:ignore="NewApi">@style/MyActionBarMenuText</item>
        <item name="android:background">@drawable/actionbar_bg</item>

        <!-- Support library compatibility -->
        <item name="actionMenuTextAppearance">@style/MyActionBarMenuText</item>
        <item name="background">@drawable/actionbar_bg</item>
</style>

<style name="MyActionBarMenuText" parent="@style/TextAppearance.Sherlock.Widget.ActionBar.Menu">
        <item name="android:actionMenuTextColor" tools:ignore="NewApi">@color/actionbar_text</item>
        <item name="actionMenuTextColor">@color/actionbar_text</item>
        <!-- The textColor property is backward compatible with the Support Library -->
</style>

The background is applying but the menu text colour is not. What am i missing?
I know this was asked many times, but none of the solutions helped me.

A: Finally got it, Since android:actionMenuTextColor is defined in Theme.Sherlock.Light I needed to add it to my main custom theme which inherits from it and not to the style that inherits from Widget.Sherlock.Light.ActionBar:
<style name="MyTheme" parent="@style/Theme.Sherlock.Light">
        <item name="android:actionBarStyle" tools:ignore="NewApi">@style/MyActionBar</item>
        <item name="actionBarStyle">@style/MyActionBar</item>
        <item name="android:actionMenuTextColor" tools:ignore="NewApi">@color/actionbar_text</item>
        <item name="actionMenuTextColor">@color/actionbar_text</item>
    </style>


text:
Q: How to count the length of the content of a list in erlang? For example: ["hello","world wide","1","2","3"] the length would be 18 including the space between world and wide.
I have tried:
string:len(lists:flatten([X|Y]))
but it removes spaces.
What I'm thinking of using this for:
I am creating a function that will return a list of as many words as possible but keeping it below the specified length.
Example:
-spec hello(list(string()), integer()) -> list(string()).

1> hello:limit_word(["Hello", "there my friend", "wassup!"],10).
["Hello"]
2> hello:limit_word(["Hello", "there my friend", "wassup!"],22).
["Hello", "there my friend"]

A: Flattening and taking the length of the total works fine:
1> L = ["hello","world wide","1","2","3"].
["hello","world wide","1","2","3"]
2> string:length(lists:flatten(L)).
18

You could alternatively sum the length of each part:
3> lists:sum([length(S) || S <- L ]).
18

Or you could implement your limit_word function like this:
-module(hello).
-export([limit_word/2]).

limit_word(L, Max) ->
    limit_word(L, Max, {0, []}).
limit_word([H|T], Max, {Size, Acc}) ->
    NewSize = Size + length(H),
    case NewSize > Max of
        false ->
            limit_word(T, Max, {NewSize, [H|Acc]});
        true->
            lists:reverse(Acc)
    end;
limit_word([], _, {_, Acc}) ->
    lists:reverse(Acc).

The limit_word/2 is what's exported to the caller (same as in your original example). It just calls the limit_word/3 function, which takes an extra argument: a tuple of current total length, Size, and accumulated words, Acc. We take the head of the list, add its length to Size, and if the total is less than Max, we call limit_word/3 recursively, passing NewSize and a new list of words with the new word as its head and the existing list of words as its tail. But if NewSize exceeds Max, we return the reversed Acc list — reversed because we formed the list by adding new words to the head. It works just as you'd expect:
4> hello:limit_word(["Hello", "there my friend", "wassup!"],10).
["Hello"]
5> hello:limit_word(["Hello", "there my friend", "wassup!"],22).
["Hello","there my friend"]

Update: If the total length of all list elements is less than Max, we never hit the true case, so the final limit_word/3 clause handles the empty input list by returning the reversed accumulator.

A: You can use iolist_size/1:
> iolist_size(["hello","world wide","1","2","3"]).
18