text:
Q: Whats the use of Nullable.GetUnderlyingType, if typeof(int?) is an Int32? why is typeof int? an Int32
int? x = 1;
Console.WriteLine(x.GetType().Name);

If it is okay then what's the use of Nullable.GetUnderlyingType?

A: Its for when you don't know its Int32.
Example:
    public Type GetNullableUnderlyingType<T>(Nullable<T> obj)
        where T : struct
    {
        return Nullable.GetUnderlyingType(typeof(Nullable<T>));
    }

Here, you can pass any Nullable object and get it to return it's underlying type.

A: Calling GetType() boxes your variable. The CLR has a special rule that Nullable<T> gets boxed to T. So x.GetType will return Int32 instead of Nullable<Int32>.
int? x = 1;
x.GetType() //Int32
typeof(int?) //Nullable<Int32>

Since a Nullable containing null will be boxed to null the following will throw an exception:
int? x = null;
x.GetType() //throws NullReferenceException

To quote MSDN on Boxing Nullable Types:

Objects based on nullable types are only boxed if the object is non-null. If HasValue is false, the object reference is assigned to null instead of boxing
If the object is non-null -- if HasValue is true -- then boxing occurs, but only the underlying type that the nullable object is based on is boxed. Boxing a non-null nullable value type boxes the value type itself, not the System.Nullable<T> that wraps the value type.

A: When you write int? it's as if you've written Nullable<int>. That's the type you're looking for, I think.

A: This example is a bit confused, because:
int? x = 1;

creates a Nullable<int> like you expect; however:
Type type = x.GetType();

is a call to a non-virtual method on object, which isn't (and can't be) overridden - therefore this is a boxing operation; and Nullable<T> has special boxing rules:

*

*if it is empty, it boxes to null

*if it has a value, the value is boxed and returned

i.e.
int? x = 1;
int y = 1;

box to exactly the same thing.
Therefore, you are passing typeof(int) to GetUnderlyingType.
A more illustrative example of when this helps is when using reflection:
class Foo {
    public int? Bar {get;set;}
}
...
Type type = typeof(Foo); // usually indirectly
foreach(var prop in type.GetProperties()) {
     Type propType = prop.PropertyType,
          nullType = Nullable.GetUnderlyingType(propType);

     if(nullType != null) {
         // special code for handling Nullable<T> properties;
         // note nullType now holds the T
     } else {
         // code for handling other properties
     }
}

A: Mainly its for dealing with a generic method::
e.g.
public static void SomeMethod<T>(T argument)
{
     if(Nullable.GetUnderlyingType(typeof(T) != null)
     {
             /* special case for nullable code go here */
     }
     else
     {
            /* Do something else T isn't nullable */
     }
}

It's important to know this, as certain things that are very cheap can be wildly expensive on nullable's. For instance, if(argument == null) is normally super cheap, but when done in a generic method on a Nullable<T> is forced to box the argument to get a null reference. Your best bet is to use EqualityComparer<T>.Default which will slow everything else down, but makes nullable's not suffer.


text:
Q: Which is more correct, $\| \vec{a} \|$ or $|\vec{a}|$? The question is pretty self explanatory, but I've encountered situations where, for the length of some vector $\vec{a}$, to denote the length (or magnitude, which ever you prefer) as either $\| \vec{a}\|= \sqrt{a_1^2+a_2^2+\ldots+a_n^2}$ or $|\vec{a}|= \sqrt{a_1^2+a_2^2+\ldots+a_n^2}$ and I was wondering which notation is more widely accepted, per say? I've tried researching this and different websites actually use different notation.
Any help is appreciated, thank you.

A: Definitions are not judged "correct" or "incorrect".  Both of your notations are used in various contexts in mathematics.  There is a problem only if the writer and the reader do not understand each other.

A: You see both sets of notation. For vectors you see ${\bf v}$, $\vec{v}$ and $\underline{v}$, perhaps others. For the norm you see $|\cdot|$ and $\| \cdot \|$. It depends if you're in high-school or university, do physics or pure maths.
As a mathematician, I prefer $\|{\bf v}\|$ for the norm of a vector. By hand, that would be written as $\| \underline{v}\|$, but that's just because it's hard to write bold font by hand.
(Same reason we use $\mathbb R$ for what was traditionally ${\bf R}$)
I like to use $|\cdot|$ for the modulus function, a.k.a. absolute value, which applies to scalars. It might seem silly when both $|\cdot|$ and $\| \cdot \|$ measure "size" in some way, but it makes it easier for the reader to see what is a vector and what is a scalar.
(To be technical: A vector space has a set of vectors, and an accompanying scalar field. There is often an idea of "size" in the vector space, and an idea of "size" in the scalar field. I like to use $\| \cdot \|$ for the norm in the vector space and $| \cdot |$ for the norm in the scalar field.)
For example, given two intersecting lines with respective direction vectors ${\bf u}$ and ${\bf v}$, the acute angle of intersection $\theta$ satisfies $|{\bf u} \cdot {\bf v}| = \|{\bf u}\| \|{\bf v}\| \cos\theta$. The scalar/inner/dot product ${\bf u} \cdot {\bf v}$ is a scalar, and so $|{\bf u} \cdot {\bf v}|$ is the absolute value/modulus of that scalar. On the other hand ${\bf u}$ and ${\bf v}$ are vectors and $\|{\bf u}\|$ and $\|{\bf v}\|$ are the norms of those vectors.
I hope this makes sense.

A: I would say, it really depends on the context. Both are widely accepted and understood. However, the nice thing is, that the two notations allow you to distinguish between two notions of "length". So in one extreme, in an introductory course on vectors I would write
$$\|a\| = \sqrt{|a_1|^2+ |a_2|^2+...+|a_n|^2}$$
to explicitely distinguish the notion of absolute value in the real numbers and length of a vector.
In the other extreme, if I am later interested in some basic functional analysis, I would instead use notation
$$\|f\| = \sqrt{\int_{\mathbb{R}^n} |f(x)|^2 dx}$$
for some function $f:\mathbb{R}^n \to \mathbb{R}^n$, where then
$$|f(x)| = \sqrt{f_1(x)^2+...+f_n(x)^2},$$
this time to explicitely distinguish between the $L^2$ norm of a function and the length of its value at $x$.
edit: I did not put vector arrows here, because I personally do not use them, however this answer of course also works with $\vec{a}$ and $\vec{f}$.

A: The first one is the more correct, in the sense that is preferable when you are dealing both with vectors and numbers and it is necessary to avoid misunderstanding.
The notation $|\cdot|$ indicates the absolute value for numbers, but it is also frequently and widely used for vectors when it is clear from the context.

redpajama_set_name: RedPajamaStackExchange


text:
Q: join two table folder and image        album
------------------
  aid  |  aname  |
------------------
  1   | album1   |
  2   | album2   |
  3   | album3   |
  4   | album4   |
------------------

       image
---------------------------------------
  iid  |  title  |  albumid |  imgurl
---------------------------------------
  1   | img1     |   3      |  image3.jpg
  2   | img2     |   1      |  image1.jpg
  3   | img3     |   2      |  image4.jpg
  4   | img4     |   0      |  image5.jpg
---------------------------------------

I have two tables album and image. In image table albumid= 0 means that image does not belong to any folder. I need that imageurl with all folder names and count of images inside folder like below table in mysql.
Example:
----------------------------------------------------------------
  id=aid+iid  |  name= aname +title | imgurl          | countimg
----------------------------------------------------------------
  1           | album1              |       null      |  1
  2           | album2              |       null      |  1
  3           | album3              |       null      |  1
  4           | album4              |       null      |  0
  4           | img4                |    image5.jpg   |  0
-----------------------------------------------------------------

Can I have any help please. Thanks in advance.

A: Try this:
SELECT a.aid AS `id`, a.aname AS `name`, NULL AS imgurl, COUNT(i.iid) countimg
FROM album a
LEFT OUTER JOIN image i ON a.aid = i.albumid
GROUP BY a.aid
UNION
SELECT a.iid AS `id`, i.title AS `name`, imgurl AS imgurl, 0 countimg
FROM image i
WHERE i.albumid = 0;


text:
Q: Fit a Weibull distribution to...right-censored data? Premise: I know next to nothing about survival analysis, I just started. I have a vector of failure times for some machines. Most of the machines (3362 vs 2694) are still running today, so I know they haven't failed, and the failure time is at some unknown time in the future. If I'm not mistaken, we call this right-censored data. Correct? Now, I would like to start simple and fit a Weibull distribution to these data. No regression, no covariates - just fit a distribution to these data, and see what it looks like. Is this possible? What are the methods used to fit a Weibull distribution to right-censored data, and are there some of these methods available in R?
EDIT adding a data sample to show what I would like to do
# sample data set
foo <- structure(list(time = c(416L, 307L, 552L, 740L, 1126L, 442L,
765L, 375L, 275L, 623L, 455L, 695L, 724L, 1653L, 529L, 615L,
15L, 477L, 758L, 353L, 851L, 25L, 524L, 283L, 954L, 183L, 558L,
851L, 377L, 208L), event = c(1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,
0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1)), .Names = c("time",
"event"), row.names = c(1170L, 5856L, 1237L, 1448L, 1161L, 4759L,
2766L, 3321L, 4253L, 5645L, 3875L, 3531L, 238L, 3204L, 714L,
2161L, 3275L, 5879L, 3758L, 2406L, 1548L, 4234L, 87L, 2548L,
3958L, 5872L, 3326L, 1549L, 4823L, 1002L), class = "data.frame")

# fit a Weibull distribution
weibull_fit <- survreg(Surv(time, event) ~ 1, data = foo)
summary(weibull_fit)

# Call:
# survreg(formula = Surv(time, event) ~ 1, data = foo)
#             Value Std. Error     z        p
# (Intercept)  6.881      0.132 52.14 0.000000
# Log(scale)  -0.758      0.197 -3.86 0.000115
#
# Scale= 0.469
#
# Weibull distribution
# Loglik(model)= -101.2   Loglik(intercept only)= -101.2
# Number of Newton-Raphson Iterations: 8
# n= 30

R fits the distribution, which is what I wanted. But I hoped there would be some function to plot the survival function, with confidence bounds...it looks like there's none.
EDIT2 for those interested in a simple intro to Survival Analysis, this page is short but sweet:
http://data.princeton.edu/wws509/notes/c7s1.html

A: Fitting is implemented in R's classic survival package (this function), or flexsurv, which has more flexibility, but a different parametrization for Weibull (flexsurvreg function here). Both also provide a few other distributions to try out.
Although I am not entirely sure about the method, it looks like both packages use likelihood maximization (from inspection of source functions, e.g. body(flexsurv::flexsurvreg)).

For more detailed R instructions and plotting examples, see this question on SO. The idea there is to take various survival fractions $S(t)$, use predict.survreg as $S^{-1}(t)$ to get the corresponding times, and plot those on your own. In the no-covariate case that you have the call can be just predict(weibull_fit, type="quantile", p=x)[1], with x - some quantile.
Note that these are just the predictions given estimated parameters - if you want to incorporate the uncertainty about the estimates as well, you will need to switch to log scale, add se.fit=T to the predict call and use that to calculate the confidence intervals for the predicted times. Something like:
pr = predict(weibull_fit, type="uquantile", p=0.5, se.fit=T)
lims = c(pr$fit[1] + 1.96*pr$se.fit[1], pr$fit[1] - 1.96*pr$se.fit[1])
lims = exp(lims)

should give 95 % CI for predicted median survival time.


text:
Q: How do I change the column widths on a PaginatedDataTable? Right now there is so much space between the columns, even when I have a 4 character header and a 1 to 3 digit value for ranking, it's as if I could fit 4x that in each column.
I tried using smaller fonts, but the separation stays the same.
Here's what I am using to setup the PaginatedDataTable. I can't find any parameters across the Table/Row/Cell/etc that seem like the will affect width. The space seems automatic, yet wholly unnecessary. Thanks.

Widget build(BuildContext context) {
    return new Scaffold(
        appBar: new AppBar(title: const Text('Tour Rankings')),
        body:
        new ListView(
            padding: const EdgeInsets.all(5.0),
            children: <Widget>[
              new PaginatedDataTable(
                  header: const Text('Current Rankings'),
                  rowsPerPage: _rowsPerPage,
                  onRowsPerPageChanged: (int value) { setState(() { _rowsPerPage = value; }); },
                  sortColumnIndex: _sortColumnIndex,
                  sortAscending: _sortAscending,
                  columns: <DataColumn>[
                    new DataColumn(
                        label: new Text('Rank', style: new TextStyle(fontSize: 8.0)),
                        numeric: true,
                        onSort: (int columnIndex, bool ascending) => _sort<num>((Player d) => d.rank, columnIndex, ascending)
                    ),
                    new DataColumn(
                        label: new Text('Prev', style: new TextStyle(fontSize: 8.0)),
                        numeric: true,
                        onSort: (int columnIndex, bool ascending) => _sort<num>((Player d) => d.prevRank, columnIndex, ascending)
                    ),...

A: There is a property of paginated data table in flutter as columnSpacing.
This value defaults to 56.0 as per Material Design specifications.
You can change the value as per your requirement to change the horizontal margin between the contents of columns.
              PaginatedDataTable(
                showCheckboxColumn: false,
                columnSpacing: 10.0,
                header: Center(
                  child: Text("Statement"),
                ),
                columns: [
                  DataColumn(label: Text("Date")),
                  DataColumn(label: Text("Particular")),
                  DataColumn(label: Text("Debit")),
                  DataColumn(label: Text("Credit")),
                  DataColumn(label: Text("Detail")),
                ],
                source: YourDataSource(),
              ),

It should look something like this:

A: After this diff you can set horizontalMargin and columnSpacing to achieve custom column widths.
  /// The horizontal margin between the edges of the table and the content
  /// in the first and last cells of each row.
  ///
  /// When a checkbox is displayed, it is also the margin between the checkbox
  /// the content in the first data column.
  ///
  /// This value defaults to 24.0 to adhere to the Material Design specifications.
  final double horizontalMargin;

  /// The horizontal margin between the contents of each data column.
  ///
  /// This value defaults to 56.0 to adhere to the Material Design specifications.
  final double columnSpacing;

A: I've also encountered the same problem with the flexibility of flutter PaginatedDataTable layout.
My solution was to extend the constructor of the DataTable with the layout variables:
FlexibleDataTable({
    Key key,
    @required this.columns,
    this.sortColumnIndex,
    this.sortAscending = true,
    this.onSelectAll,
    this.headingRowHeight = 56.0,
    this.dataRowHeight = 48.0,
    this.tablePadding = 24.0,
    this.columnSpacing = 56.0,
    this.sortArrowPadding = 2.0,
    this.headingFontSize = 12.0,
    @required this.rows,
  }

Of course I had to implement FlexiblePaginatedDatatable to use the FlexibleDataTable:
new SingleChildScrollView(
    scrollDirection: Axis.horizontal,
    child: new FlexibleDataTable(
        key: _tableKey,
        columns: widget.columns,
        sortColumnIndex: widget.sortColumnIndex,
        sortAscending: widget.sortAscending,
        onSelectAll: widget.onSelectAll,
        columnSpacing: 20.0,
        dataRowHeight: 40.0,
        rows: _getRows(_firstRowIndex, widget.rowsPerPage)
    )
),

The Flutter team should include this features in the official version of DataTable and PaginatedDataTable so others don't need to implement ad hoc versions for such trivial stuff. The issue exists and we'll see when it will be done.
https://github.com/flutter/flutter/issues/12775


text:
Q: PyQt: Initialize default values for reset I have a MainUI, that has a few buttons, line-edits and checkboxes. Most of the widgets I have set with a given state - e.g. all checkboxes are checked by default, and all line-edit fields have a default value of "1.0".
Currently I have a pushbutton called "reset everything". As its name implies, any changes made in these checkboxes or line-edit fields will be reverted to be checked and have a value of "1.0".
One way I can think of resetting the values, is by creating a function where I have to re-type the variable names of the affected widgets, along with their default state - which is similar to what I did when I created them. But I don't think this is a practical method.
My question here is: what is the best way for me to store the default values and then revert them?
So far I have created a class that contains the creation of the main ui:
class MainUI(QtGui.QDialog):
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.setWindowTitle('UI MANAGER')
        self.setModal(False)
        self.init_main_ui()
        self.resize(QtCore.QSize(600, 350))

    # UI-Configurations
    def init_main_ui(self):
        self.check1 = QtGui.QCheckBox("chk_box1")
        self.check2 = QtGui.QCheckBox("chk_box2")
        self.check3 = QtGui.QCheckBox("chk_box3")
        self.check1.setChecked(True)
        self.check2.setChecked(True)
        self.check3.setChecked(True)
        self.max_label = QtGui.QLabel("MIN Val")
        self.max_input = QtGui.QLineEdit("0.0")
        self.min_label = QtGui.QLabel("MAX Val")
        self.min_input = QtGui.QLineEdit("1.0")
        ...

A: The simplest approach would be to refactor your existing code so that the initial values are set by a separate method:
class MainUI(QtGui.QDialog):
    ...

    def init_main_ui(self):
        self.check1 = QtGui.QCheckBox("chk_box1")
        self.check2 = QtGui.QCheckBox("chk_box2")
        self.check3 = QtGui.QCheckBox("chk_box3")
        self.max_label = QtGui.QLabel("MIN Val")
        self.max_input = QtGui.QLineEdit()
        self.min_label = QtGui.QLabel("MAX Val")
        self.min_input = QtGui.QLineEdit()
        ...
        self.reset_main_ui()

    def reset_main_ui(self):
        self.check1.setChecked(True)
        self.check2.setChecked(True)
        self.check3.setChecked(True)
        self.max_input.setText("0.0")
        self.min_input.setText("1.0")
        ...


text:
Q: How to add signature to URL I'm making a UrlConnection and it requires a signature using SHA1.
I have already generate the signature but I don't know how to append it to the connection.
Here are my codes:
String url = domain + path
           +"?api_key="+DEVELOPER_API_KEY
           +"&timestamp="+time
           +"&username="+givenName;
urlToRequest = new URL(url);
urlconnection = (HttpURLConnection)urlToRequest.openConnection();
urlconnection.setRequestMethod("POST");

I don't know where to place my signature. I've tried to append it in the url like
+"signature="+signature;

but it doesn't work.
So how should I do it?
Thank you guys.

A: Yes, appending it to your url should work just fine, from your example however you seem to have forgot an ampersand.
url = url + "&signature=" + signature;


text:
Q: What determines the gender of a Gen-1 Pokemon? Pokémon in the Generation 1 games don't have a gender, but they can be traded to Generation 2 games, where most Pokémon have genders. What determines the gender of a Generation 1 Pokémon when it is traded to a Generation 2 game?

A: The Attack IVs.
From the Bulbapedia:

In Generation II, a Pokémon's gender was determined through its Attack IV. Due to this, a female Pokémon could never have a maximized Attack stat (unless they were a member of an all-female species, such as Smoochum), because female Pokémon were given the lower portion of the IV range. This also prevented female Pokémon of a species with a gender ratio of seven males to one female, such as starter Pokémon or Eevee, from being Shiny, due to that also being based partly on the Attack IV.

Basically, females were given the lower half Attack IV range and males the upper.  This Reddit post goes into a brief discussion about it as well. I also found another post that explains the ratios:

87.5% male ratio: Attack IV needs to be 0 or 1 to be female all others result in a male
75% female ratio: Attack IV needs to be below 12 to be female
75% male ratio: Attack IV must be below 4 to be female
50-50 ratio: Attack IV must be below 8 to be female


text:
Q: Silencing "Your disk is almost full" notification Since none of the solutions found here Silencing "Your disk is almost full" notification worked for me on Mojave, I simply disabled the daemon:
sudo mv /System/Library/PrivateFrameworks/StorageManagement.framework/Resources/diskspaced /System/Library/PrivateFrameworks/StorageManagement.framework/Resources/diskspaced.disabled

Brute force, I know, but unloading/removing/disabling using launchctl didn't work and I got annoyed.
Is there a more elegant way to turn off Apple's constant nannying alert messages?

A: Put mac on do not disturb - this worked for me w/ Mojave


text:
Q: WSO2 API Manager does not work https endpoint I create an API where I configure the endpoint: https://ssl.croinform.ru:450/api.test And there is a problem with https, I am not getting a response to the request. It seems the WSO2 API Manager API gateway is not proxying requests to the endpoint. When I make requests directly, I pre-configure the infrastructure: install the openssl counterpart, install the cacer.p7b and ssl.croinform.cer certificates. After that, I successfully receive responses from the ssl.croinform.ru:450/api.test service.
I was advised to add a certificate according to this manual: https://apim.docs.wso2.com/en/3.2.0/learn/design-api/endpoints/certificates/#adding-a-certificate-for-an-endpoint I did everything according to the manual, but requests to https are still not transmitted. The problem is I need to import two certificates: cacer.p7b, ssl.croinform.cer. I manage to add the .cer certificate, but the .p7b certificate is not added (I get an error), I suppose the .p7b file extension is simply not supported. But I need to transfer the whole certificate chain. Also, I do not understand how encryption is supported in wso2-am, but this is important, since traffic with a remote API is encrypted using tls. Am I getting it right that wso2-am works with openssl? If so, is it possible to use any other alternative software? In my case, openssl does not support some regional standards. I am still asking for hints or directions on my problem.
When I install a certificate with a .p7b extension in the portal I get the following error: The server encountered an internal error. Please contact administrator. The wso2carbon.log file contains the following events: ERROR {org.wso2.carbon.apimgt.impl.utils.CertificateMgtUtils} - Error loading certificate. java.security.cert.CertificateException: Unable to initialize, java.io.IOException: Short read of DER length at java.base / sun.security.x509.X509CertImpl.  (X509CertImpl.java:197) at java.base / sun.security.provider.X509Factory.engineGenerateCertificate (X509Factory.java:10
Continuing: ERROR {org.wso2.carbon.apimgt.impl.certificatemgt.CertificateManagerImpl} - Error adding the certificate to Publisher Trust Store. Rolling back... ERROR {org.wso2.carbon.apimgt.impl.APIProviderImpl} - Adding certificate to the Publisher node is failed. No certificate changes will be affected. ERROR {org.wso2.carbon.apimgt.rest.api.publisher.v1.impl.EndpointCertificatesApiServiceImpl} - Error while adding the certificate due to an internal server error
Can you tell me what I need to do to make this work in WSO2 API Manager?


text:
Q: Why can I play Minecraft online with my friends even though we both don't have Xbox gold? Everyone said we need Xbox gold, but my friend and I apparently do not. Why is that so? All I need is them to be my Xbox friend and invite them over to my Minecraft world, and we can play together and everything's perfectly fine.

A: Currently, there is an All Access Event going on right now for Minecraft on Xbox.  From May 19th-21st 2017, all players can play Minecraft online regardless of their subscription.

We're launching a Multiplayer All-Access event with a free unlock of Minecraft: Xbox One Edition. Xbox is inviting all Xbox Live members, with or without a Gold membership, to play online with friends for free in any game they own during our Multiplayer All-Access event from May 18-21 on Xbox One and Xbox 360.

However, after this event you will still need gold. See Does Minecraft for Xbox require a gold account to play with other players?


text:
Q: Formatting currency in .NET I am formatting the currency using Tostring() method i m using following syntax
ToString('##.##') it is working perfectly but in case of round number it remove last 2 zero
like for 100 it does not show 100.00 is shows 100.
how can i format in that way means
input    desired output
100      100.00
100.10   100.10

A: Try "##.00" instead.
That will force two digits after the decimal separator.
You can also use ToString("C") to use the culture specific format in Windows directly.

A: First google result.
String.Format("{0:C}", x.ToString());

http://www.howtogeek.com/howto/programming/format-a-string-as-currency-in-c/

A: This might help. Might be more than you need, but it takes globalization into account which might be necessary. "C" is also a short-cut currency format string that might get you further along.

A: You can use :
.ToString("C")

Hope it helps.

A: Also, if you don't want the currency sign ($ in the US) added that "C" gives, you can also use "F2", which is "fixed number with 2 decimal places". It also has the advantage of giving you a thousands separator when you results go over 1,000.00.


text:
Q: Batch File to rename multiple files and move to folder I need help with batch file that can rename and move files from my c:\SaveAttachments to multiple folders in C:\Users\Omer\Documents\
I have about 5000 files in c:\SaveAttachments (.pdf, .doc, .xls)
e.g (aacom_880072_4860914.pdf or .doc or .xls)
e.g (bbcom_880082_4860914.pdf or .doc or .xls)
rename aacom_880072_4860914 to 880072 and move it to C:\Users\Omer\Documents\aacom
rename bbcom_880082_4860914 to 880082 and move it to C:\Users\Omer\Documents\bbcom
Help on this is greatly appreciated.
I hope I have provided sufficient information to see if this is feasible.
FYI I am beginner in coding batch files so comments on the code are greatly appreciated.

A: @ECHO Off
SETLOCAL
SET "sourcedir=U:\sourcedir"
SET "destdir=U:\destdir"
set "logfile=U:\logfile.log"
PUSHD "%sourcedir%
>>"%logfile%" echo start at %date% %time%
FOR %%x IN (pdf doc xls) DO (
 FOR /f "delims=" %%a IN (
   'dir /b /a-d "*_*_*.%%x" '
   ) DO (
    FOR /f "tokens=1,2*delims=_" %%m IN ("%%a") DO IF "%%n" neq "" (
    ECHO(MD "%destdir%\%%m"
    >>"%logfile%" ECHO(MD "%destdir%\%%m"
    ECHO(Move "%%a" "%destdir%\%%m\%%n.%%x"
    >>"%logfile%" ECHO(Move "%%a" "%destdir%\%%m\%%n.%%x"
   )
 )
)
POPD
>>"%logfile%" echo end at %date% %time%

GOTO :EOF

You would need to change the settings of sourcedir and destdir to suit your circumstances.
The required MD commands are merely ECHOed for testing purposes. After you've verified that the commands are correct, change ECHO(MD to MD to actually create the directories. Append 2>nul to suppress error messages (eg. when the directory already exists)
The required MOVE commands are merely ECHOed for testing purposes. After you've verified that the commands are correct, change ECHO(MOVE to MOVE to actually move the files.  Append >nul to suppress report messages (eg. 1 file moved)
switch to the source directory
For the required extensions, do a directory scan for files with at least 2 underscores and the extension.
tokenise the name to %%m and %%n
(belt-and-braces - ensure %%n isn't empty)
create the directory and move the file.
[edited to include logging as requested]
[revised edit : omitted % and include quotes]

A: If all the files have the same naming convention as you posted this should be relatively easy using a Bash shell script executed within Cygwin.
src='/cygdrive/c/SaveAttachments'
dst="/cygdrive/c/Users/Omer/Documents"
for file in $(find $src -type f)
do
    prefix=${file%%_*}
    if [[ ! -e $dst/$prefix ]]
    then
        mkdir -p $prefix
    fi
    name=$(cut -d_ -f2 $file)
    mv $file $dest/$name
done

I have not tested this so there might be corner cases I missed, but overall you get the idea.


text:
Q: IOS Stack View Basics Learning stack view; what's preventing this horizontal line of 60x60 buttons from a) all showing up on both screens (constraints are set on the trailing side so I'm not sure why it's going past the right edge of the screen), and b) scaling the buttons larger.  I'm looking to see all the buttons and scale them proportionately to the screen size while maintaining their individual aspect ratios.
Thanks!

A: 1- Put an "aspect ratio " constraint in each one of them.
2- Put constraints on stack view "leading" and "trailing".
3- In the attributes inspector for stack view make all views "Equal " instead of "Fill".
These setting will make all of them appear with the same size and  according to the screen size they will vary but still all of them with the same aspect ratio.


text:
Q: not able to display acts_as_taggable_on tags on ruby on rails (and formtastic!) Given
As the User, I am at a nested new vendors/5/reviews/new. In addition to :params that will get written to the Review model, I need to be able to include tags that belong to the Vendor model.
I have used acts_as_taggable_on (http://github.com/mbleigh/acts-as-taggable-on):
class Vendor....
     acts_as_taggable_on :tags, :competitors

I use formtastic to submit the tags and field_for to make sure that I write to vendor even though the form is on a CREATE Review:
 semantic_form_for ....

 <% fields_for :vendor do |vendor| %>

        <%= vendor.label :tags %>

        <%= vendor.text_field :tag_list %>

 <% end %>

I try to display the tags for the Vendor with the following:
Tags:  <%=h @vendor.tag_list %>

My outcome: NOTHING.
1) Am I correctly writing the tags?  It looks like it is create the right SQL in the console
2) Am I doing the right approach to display the tag list using acts_as_taggable_on?

A: First, I'm a bit confused why you're using Formtastic (semantic_form_for) when all of the helpers in the form are standard rails helpers (fields_for, label, text_field), so this really doesn't have much to do with Formtastic.
Second, if the form is for a Vendor record (form_for(@vendor)), then fields_for(:vendor) doesn't make any sense.  Using fields_for inside a form_for creates a nested form with nested attributes (useful to create a parent record and an associated record at the same time).
I'd need to see a complete sample of the form code to really get a grip on what you're trying to do, but I think you've over complicated something quite simple.  Either way, my advice is to correctly understand form_for before using semantic_form_for.


text:
Q: Stored Procedures and SSRS 2008 I have a stored procedure in SQL Server 2008 that consists of multple select statements.  When building a report in SSRS, I have a dataset that uses that stored procedure.  However, the only fields that show up are the ones that are in the first select statement.  Is there a way to show the other fields or use multiple select statements within one stored procedure?
Thanks!

A: Do the selects output the same schema (i.e. fields)? If so, and if you need all the results, you could try UNIONing the separate queries together. Otherwise, why not move the query you need into a new stored proc and call that from the report?

A: Eric, it's been my experience that when SSRS is based on a stored procdure, the results of the last Select statement are used and not the first. So you should be able to do anything you want up until the last Select statement in the stored proc and then make sure the last Select contains the correct data/columns for the report.

A: From the MSDN documentation

If multiple result sets are retrieved
  through a single query, only the first
  result set is processed, and all other
  result sets are ignored. For example,
  when you run the following query in
  the text-based query designer, only
  the result set for Production.Product
  appears in the result pane:

SELECT ProductID FROM Production.Product
GO
SELECT ContactID FROM Person.Contact


text:
Q: convert website to mobile friendly version I'm displaying news feeds from google and I want to convert this pages to a mobile friendly version. I'm using UIWebView to display the news content and I used Read It Later to convert the page using their API
    http://text.readitlaterlist.com/v2/text?apikey=yourapikey&url=http://readitlaterlist.com/api/docs

This does the job but it's not quite good enough, Do you guys know any alternative for this?

A: Google Web Toolkit have a "mobilizer" feature that you can find at http://www.google.com/gwt/n. Knowing Google there might be even some API for this.


text:
Q: Hi, how can I keep a user active when switching from one angular application to another without asking me to log in again? I have my login and I start the session but if it is not a user with an administrator role I have to redirect it to another application but I do not know how to keep the session active so that it does not log in again

A: In case you're not already doing it, you can store on your database (or where you handle authentication) a unique identifier bound to the open session.
When you navigate from an angular application to the other, simply pass the token so that the second application can automatically authenticate without knowing user/password or asking it to the user.

A: It depends on the way you use in authentication,  say you are using (Bearer token) in two apps and the users DB is shared also
you can follow these steps:

*

*Send the generated token before redirection to the second App

*In login page check if this token is valid if yes proceed to the home page else ; stay in login page

*if the token is valid then send it to the whole authorized requests

A: Probably the best way in your situation is to use localStorage. Before redirecting to another url, you'd have to store a key:value pair in localStorage like this:
AppComponent {

 public redirectToSecondApp() {
   localStorage.setItem('jwt', 'fgsdlkfgjwerg...2345234');
   this.redirectTo(this.url);
 }
}

Then on the second application's startup you can access this key:value pair like this
 SecondAppComponent {
  constructor() {
    const jwt = localStorage.getItem('jwt');
  }
}

The other way around is to use query params in combination with activatedRoute on the second app (on the first app you set query params, on the second you can access these params by activatedRoute)
(If you use session-based authentication it may be a bit tricky, but I hope you got the general idea about localStorage. Good luck!)


text:
Q: Display list items as grid with pages I'm at my wits end here... I've been looking for hours and hours... What I'm trying to do, is display a list of items as a grid layout view with pages (like Android home screen) meaning, the list items should be displayed in a fixed X times Y grid and the list should be split into (list.length / x*y) pages. I've been googling to find something that would help me achieve this, but I've failed to find anything... I've found that I could use angular-slick for the page navigation part, but haven't found anything to use to split and display the data...
Any advice is greatly appreciated.

A: simply you try to use bootstrap then you can solve grid system problem.

bootstrap gridsystem


text:
Q: Mean and median line in seaborn histplot Seaborn v0.11.0 just came out with the very useful histplot function. One thing I am trying to figure out is how best to display the mean and/or median on the plot. There seems to be no option for this in the function itself, as far as I could see in the documentation.
Does anyone know how adding a line for mean and/or median could be easily achieved?


text:
Q: How to get current date and time in WordPress? As you may know it's highly recommended by WordPress to theme/plugin authors to don't change the WordPress timezone by PHP functions like date_default_timezone_set.
I addition to that you may receive wrong date and time values when you use php date function because of not setting default timezone by PHP.
I mean you may receive 10 for date('G') while the exact hour is 15 in the selected timezone in WordPress->Settings->General->Timezone option.
So what should you do if you need the correct date and time values in selected timezone for WordPress website?

A: WordPress 5.3+
You can use current_datetime function. It returns a DateTimeImmutable object with the timezone selected in WordPress general options. Then you can use format or other methods of the object to get your desired date and time.
$current_datetime = current_datetime()->format('Y-m-d H:i:s');

Prior to WordPress 5.3
You should use current_time function of WordPress instead of PHP date function for getting local date and time in WordPress. It will return correct value for you based on selected timezone in WordPress general options.
For me current_time('G') returns exactly 15 while PHP date('G') returns 10 which is not correct.
Hope it helps somebody since I didn't find related thread in the stackoverflow.

A: Since WordPress 5.3, you can use current_datetime to get it correctly:
$current_date_time = current_datetime()->format('Y-m-d H:i:s');

The result will respect the time zone defined in the Settings → General → Time Zone select field, in the WordPress dashboard.
See also the available formatting options.
Note: please don't use current_time, it's not recommended anymore.

A: You can also install a plugin like Shortcode for Current Date to display the current time in your respective time zone. It also provides a great overview of various date and time formats.

A: You should use current_time function of WordPress instead of PHP date function for getting local date and time in WordPress. It will return correct value for you based on selected timezone in WordPress general options.
 $Date_Time   = current_datetime()

Retrieves the current time based on specified type.
current_time( string $type, int|bool $gmt )

Retrieves the current time based on specified type.
Source :

File: wp-includes/functions.php

function current_time( $type, $gmt = 0 ) {
// Don't use non-GMT timestamp, unless you know the difference and really need to.
if ( 'timestamp' === $type || 'U' === $type ) {
    return $gmt ? time() : time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
}

if ( 'mysql' === $type ) {
    $type = 'Y-m-d H:i:s';
}


text:
Q: Storing JTextArea from Swing in an Access 2007 database I am currently writing an application in Java that preforms input/output from/to Swing GUI components and stores/retrieves this data from a local Microsoft Access 2007 database. Everything is going well except when I try to update a record with input coming in from a JTextArea that is to be stored in a Text or Memo field. I can take in input from a JTextField fine, but I get a "SQLException: Syntax error in UPDATE statement." with a JTextArea.
Here's the code that is having the problem:
/* <in_some_method> */
myJTextArea.setText(someString); // the components can have the exact
myJTextField.setText(someString); // same string and still have problems

saveEdit(myTable, myColumn, myJTextField.getText(), myID); // this works fine
saveEdit(myTable, myColumn, myJTextArea.getText(), myID); // this throws an exception
/* </in_some_method> */

/* the update method */
public void saveEdit(String table, String column, String value, long id) {
    String query = "UPDATE " + table + " ";
    query += "SET " + column + " = '" + value + "', "
    query +=  "UpdatedAt = Now() ";
    query += "WHERE ID = " + id;

    try {
        // conn is a working connection to the database
        Statement s = conn.createStatement();

        // execute the query
        s.executeUpdate(query);

        // close open database handle
        s.close();

    } catch (Exception ex) {
        System.err.println(ex);
    }
}

Couple of things:

*

*I don't think it exists with the data type of the field in the database; I've tried both Memo and Text for the type and both work with the JTextField and neither work with the JTextArea.

*The exception, as already stated, is "SQLException: Syntax error in UPDATE statement." so I know my problem has nothing to do with the layout of the database table; the table and columns requested exist and can be accessed.
Anybody have any ideas? Any help will be greatly appreciated.

A: I don't know what someString is, but I'm betting it contains newlines or such, so when setting into a JTextField it will be "flattened" while when setting to the JTextArea it will not. So, when getting, you'll have two different strings, one that will work fine and other that will cause a syntax error.
Whatever the case is, you should escape your strings before saving them in the database, or you run the risk of SQL injection. This will also ensure your method work fine for both components (though the exact string can be still different, for the reason stated above).

A: I agree with mgibsonbr, that it is vunerable to SQL Injection. This is another tutorial on how to go about using them
However for your immediate problem, given that the string retrieved using the getText() of the textfield already works, have you perhaps tried storing the string retrieved using getText() from your JTextArea and checking what it is? or perhaps even tried to call the trim function on the getText method of your JTextArea so there are no empty spaces etc.
Perhaps that someString is not being set properly for the JTextArea?


text:
Q: mutate data list column in purrr block and get a static min by grouping numeric variable Using diamonds as an example, I'd like to group by cut then add a row number for each grouping and then shuffle. Then I'd like to apply a transformation to price, in this case just price + 1 and then I'd like to find the price corresponding to row 1 and make that the value for the entire feature.
Tried:
mydiamonds <- diamonds %>%
  group_by(cut) %>%
  mutate(rownum = row_number()) %>%
  nest %>%
  mutate(data = map(data, ~ .x %>% sample_n(nrow(.x)))) %>%
  mutate(data = map(data, ~ .x %>% mutate(InitialPrice = price + rownum)))

This gets me close:
mydiamonds$data[[1]] %>% head
# A tibble: 6 x 11
  carat color clarity depth table price     x     y     z rownum InitialPrice
  <dbl> <ord> <ord>   <dbl> <dbl> <int> <dbl> <dbl> <dbl>  <int>        <int>
1  0.4  E     VS1      62.4  54     951  4.73  4.75  2.96  13792        14743
2  0.71 H     VS2      60.9  55    2450  5.76  5.74  3.5   20808        23258
3  1.01 F     VVS2     61    57    8688  6.52  6.46  3.96   6567        15255
4  0.62 G     VS2      61.6  55    2321  5.51  5.53  3.4   20438        22759
5  0.77 F     VS1      60.9  58    3655  5.91  5.95  3.61   1717         5372
6  1.37 G     VVS2     62.3  55.5 12207  7.05  7.14  4.43   8013        20220

What I'd like to do from here is to find the value of InitialPrice corresponding to rownum == 1 and then overwrite InitialPrice to be that single value all the way down for each data frame in mydiamonds$data.
I tried mutating and mutating again in my last line like so:
mutate(data = map(data, ~ .x %>% mutate(InitialPrice = price + rownum) %>% mutate(InitialPrice = . %>% filter(rownum ==1) %>% pull(InitialPrice))))

However got error:

Error: Problem with mutate() input data.
x Problem with mutate() input InitialPrice.
x Input InitialPrice must be a vector, not a fseq/function object.
ℹ Input InitialPrice is . %>% filter(rownum == 1) %>% pull(InitialPrice).
ℹ Input data is map(...).

How could I do that?

A: We could wrap the . within braces
library(dplyr)
library(ggplot2)
library(purrr)
mydiamonds %>%
   mutate(data = map(data, ~ .x %>%
       mutate(InitialPrice = price + rownum ) %>%
       mutate(InitialPrice = {.} %>%
                 filter(rownum ==1) %>%
                 pull(InitialPrice))))
# A tibble: 5 x 2
# Groups:   cut [5]
#  cut       data
#  <ord>     <list>
#1 Ideal     <tibble [21,551 × 11]>
#2 Premium   <tibble [13,791 × 11]>
#3 Good      <tibble [4,906 × 11]>
#4 Very Good <tibble [12,082 × 11]>
#5 Fair      <tibble [1,610 × 11]>

A: You can do :
library(tidyverse)

result <- mydiamonds %>%
              mutate(data = map(data, ~.x %>%
                            mutate(InitialPrice = InitialPrice[rownum == 1])))

result$data[[1]]

# A tibble: 21,551 x 11
#   carat color clarity depth table price     x     y     z rownum InitialPrice
#   <dbl> <ord> <ord>   <dbl> <dbl> <int> <dbl> <dbl> <dbl>  <int>        <int>
# 1  0.7  I     VVS1     61.8  56    2492  5.72  5.74  3.54  20897          327
# 2  0.51 G     VS1      61.8  60    1757  5.08  5.12  3.15  18405          327
# 3  0.32 G     VVS1     61.4  57     814  4.39  4.41  2.7   11820          327
# 4  0.33 H     VVS1     62.5  56     901  4.44  4.42  2.77  13130          327
# 5  0.72 G     SI2      62.1  54    2079  5.77  5.82  3.6   19769          327
# 6  1.31 G     VVS2     59.2  59   11459  7.12  7.18  4.23   7807          327
# 7  0.32 F     VVS2     61.6  55     945  4.41  4.42  2.72  13714          327
# 8  0.39 G     VVS1     62.1  54.7  1008  4.64  4.72  2.91  14462          327
# 9  0.7  E     VVS2     62.3  53.7  3990  5.67  5.72  3.55   2138          327
#10  0.71 D     SI2      62.7  55    2551  5.67  5.71  3.57  21042          327
# … with 21,541 more rows


text:
Q: Codeigniter Shopping Cart Helper Class - Change the "subtotal" value I am working with the CI Framework and using the Shopping Cart Class. Which has proved a success so far, Until my user has decided to mess about with it and add postage to the total.
So what I'd like to do is add the value of the variable $postage to the subtotal array.
i.e subtotal is first 111.24, Then it goes to my controller and it adds 4 to the subtotal making it 115.24.
My array of data is as follows :
[id] => 9
        [qty] => 1
        [price] => 111.24
        [price_artwork] =>
        [name] => Lincoln Catherdral
        [print_type] => Canvas
        [postage] => 4
        [file_name] => bbb5359bd6d0dc27ace3f2921460a021
        [file_ext] => .jpg
        [subtotal] => 111.24

and $data in the controller is set as follows:
$data = array(
           'id'             => $this->input->post('ARTWORK_id'),
           'qty'            => 1,
           'price'          => $this->input->post('print_cost'),
           'price_artwork'  => $this->input->post('ARTWORK_price'),
           'name'           => $this->input->post('ARTWORK_title'),
           'print_type'     => $this->input->post('print_type'),
           'postage'        => $postage,
           'file_name'      => $this->input->post('ARTWORK_file_name'),
           'file_ext'       => $this->input->post('ARTWORK_file_ext'),
           'subtotal'       => $subtotal
        );

But subtotal is only going through as the same as the [price] value in the array.
Any ideas how to change this?
Thanks

A: I would try this and see if it works:
Change:
       'subtotal'       => $subtotal

To:
       'subtotal'       => $this->input->post('print_cost') + $postage

Or, before the array is set, add this line:
$subtotal += $postage;

A: This doesn't seem to be a CodeIgniter question and more of a PHP question, assuming I've grasped what you're after correctly.
The issue is that $subtotal is wrong.  This isn't the class changing the value, it's just wrong in the first place.
By the sounds of it you're just trying to add the price with the postage?  This should be very simple:
$subtotal = $this->input->post('print_cost') + $this->input->post('ARTWORK_price') + $postage;
Failing that, do some simple debugging; print out the $subtotal field before declaring the array.


text:
Q: Match alternating digits and characters I have read the Google python regex tutorial about regular expression and tried to test one of the patterns I need.

*

*String must be 10 characters long.

*1,3,5,7,9 chars must be digits (1 - 5) and should not be repeated

*other symbols are letters (a, b or c) and the can be repeated

For example:
1a2b4a3c5b # is valid

1a5c4b4a3b # is not valid because of two 4s

So far I've tried:
pattern = r'([1-5])[abc]([1-5^\1])[abc]([1-5^\1\2])[abc]([1-5\1\2\3])[abc]([1-5\1\2\3\4])[abc]'

but it failed...

A: You're trying to include a previous match in a negated character class, which is not possible.
The only way to do this is to do something like this:
^([1-5])[abc](?!\1)([1-5])[abc](?!\1|\2)([1-5])[abc](?!\1|\2|\3)([1-5])[abc](?!\1|\2|\3|\4)[1-5][abc]$

Needless to say, this is not something regex should be doing.
A demo:
#!/usr/bin/env python

import re

tests = ['1a2b4a3c5b', '1a5c4b4a3b']

pattern = re.compile(
    r"""(?x)             # enable inline comments and ignore literal spaces
    ^                    # match the start of input
    ([1-5])              # match any of '1'..'5' and store it in group 1
    [abc]                # match 'a', 'b' or 'c'
    (?!\1)([1-5])        # if the digit from group 1 is not ahead, match any of '1'..'5' and store it in group 2
    [abc]                # match 'a', 'b' or 'c'
    (?!\1|\2)([1-5])     # if the digits from group 1 and 2 are not ahead, match any of '1'..'5' and store it in group 3
    [abc]                # match 'a', 'b' or 'c'
    (?!\1|\2|\3)([1-5])  # if the digits from group 1, 2 and 3 are not ahead, match any of '1'..'5' and store it in group 4
    [abc]                # match 'a', 'b' or 'c'
    (?!\1|\2|\3|\4)[1-5] # if the digits from group 1, 2, 3 and 4 are not ahead, match any of '1'..'5'
    [abc]                # match 'a', 'b' or 'c'
    $                    # match the end of input
    """, re.X)

for t in tests:
  if re.match(pattern, t):
    print t

would print:
1a2b4a3c5b

A: I would suggest something like this instead of regex:
def matches(s):
    return (len(s) == 10 and
            set(s[::2]) == set('12345') and
            set(s[1::2]) <= set('abc'))

>>> matches('1a2b4a3c5b')
True
>>> matches('1a5c4b4a3b')
False

A: You can use negative lookaheads to determine whether the next number is not one of the previous ones. The following regex should work:
pattern = r'^([1-5])[abc](?!\1)([1-5])[abc](?!\1|\2)([1-5])[abc](?!\1|\2|\3)([1-5])[abc](?!\1|\2|\3|\4)([1-5])[abc]$'

Edit: As Bart pointed out, the regex should start with ^ and end with $ to ensure it only matches exactly that string


text:
Q: ggplot2: How to add closed (and filled) arrowheads to a polar plot Following this link:
ggplot2 polar plot arrows
I have been wondering how to get closed arrows on a polar plot in ggplot2.
Here is my code:
# make some data
    polar <- structure(list(degree = c(120L, 30L, -120L, 60L, 150L, -90L,
    -60L, 0L), value = c(0.5, 0.2, 0.2, 0.5, 0.4, 0.14, 0.5, 0.6)), .Names = c("degree",
    "value"), class = "data.frame", row.names = c(NA, -8L))

    require(ggplot2)
    require(grid)

    base <- ggplot(polar, aes(x=degree, y=value, axis.x = NULL, axis.y = NULL))
    p <- base
    p <- p + geom_segment(aes(y=0, xend=degree, yend=value)) # add the lines

    awid <- 1
    p <- p + geom_segment(aes(y=0, xend=degree, yend=value)) + geom_segment(aes(y=value-0.05,yend=value,x=degree-awid/value,xend=degree)) +  geom_segment(aes(y=value-0.05,yend=value,x=degree+awid/value,xend=degree))
    p

However, the arrowheads I get are open arrows, not closed. I was wondering how to replace the arrowheads with (essentially) filled triangles and still be in polar coordinates. Any suggestions?
Thanks a bunch in advance!
PS; updated to add issues with arrow. Here is the code I ran:
 require(ggplot2)
 require(grid)

 # Data
 polar <- structure(list(degree = c(120L, 30L, -120L, 60L, 150L, -90L, -60L, 0L),
                         value = c(0.5, 0.2, 0.2, 0.5, 0.4, 0.14, 0.5, 0.6)),
                    .Names = c("degree", "value"),
                    class = "data.frame", row.names = c(NA, -8L))

 ggplot(polar, aes(x=degree, y=value)) +
   geom_segment(aes(y=0, xend=degree, yend=value), arrow=arrow(type="closed")) +
   coord_polar()

And here is the plot I get:

A: Using the arrow() function from grid, you only need one call to geom_segment.
 require(ggplot2)
 require(grid)

 # Data
 polar <- structure(list(degree = c(120L, 30L, -120L, 60L, 150L, -90L, -60L, 0L),
                         value = c(0.5, 0.2, 0.2, 0.5, 0.4, 0.14, 0.5, 0.6)),
                    .Names = c("degree", "value"),
                    class = "data.frame", row.names = c(NA, -8L))

 ggplot(polar, aes(x=degree, y=value)) +
   geom_segment(aes(y=0, xend=degree, yend=value), arrow=arrow(type="closed")) +
   coord_polar()


text:
Q: Windows 7 VM taskbar disappears if I go up to a resolution > 800x600 Oracle Virtual Box The host OS is Ubuntu Gnome and my hypervisor is Oracle Virtual Box. I've made sure that my drivers are up to date on the VM, and I set the scale factor to 100%. Guest additions ISO has been checked in the menu. 800x600 is too small, but any larger screen resolution will cause my VM screen to expand too far vertically.
Any ideas?
Thanks


text:
Q: C/C++ Control Structure Limitations? I have heard of a limitation in VC++ (not sure which version) on the number of nested if statements (somewhere in the ballpark of 300).  The code was of the form:
if (a) ...
else if (b) ...
else if (c) ...
...

I was surprised to find out there is a limit to this sort of thing, and that the limit is so small.  I'm not looking for comments about coding practice and why to avoid this sort of thing altogether.
Here's a list of things that I'd imagine could have some limitation:

*

*Number of functions in a scope (global, class, or namespace).

*Number of expressions in a single statement (e.g., compound conditionals).

*Number of cases in a switch.

*Number of parameters to a function.

*Number of classes in a single hierarchy (either inheritance or containment).

What other control structures/language features have limits such as this?  Do the language standards say anything about these limits (perhaps minimum requirements for an implementation)?  Has anyone run into a particular language limitation like this with a particular compiler/implementation?
EDIT: Please note that the above form of if statements is indeed "nested."  It is equivalent to:
if (a) { //...
}
else {
    if (b) { //...
    }
    else {
        if (c) { //...
        }
        else { //...
        }
    }
}

A:
Do the language standards say anything
  about these limits (perhaps minimum
  requirements for an implementation)?

No, the standard sets no minimum limits on this. But it is good practice for an implementation to set and document a hard limit on such things, rather than fail in some unknown way when the limit is exceeded.
Edit: The standard recommends some minimum limits In Annex B - there are really too many to post here and they are in any case advisory:

The limits may constrain quantities
  that include those described below or
  others. The bracketed number following
  each quantity is recommended as the
  minimum for that quantity. However,
  these quantities are only guidelines
  and do not determine compliance.

A: C specifies that implementations must be able to translate a program that contains an instance of each of a number of limits. The first limit is that of 127 nesting levels of blocks. (5.2.4.1 of ISO/IEC 9899:1999)
C doesn't say that any valid program that contains no more than 127 nesting levels must be translated; it could be unreasonably large in other ways. The rationale was to set some level of expectation that portable programs can have, while allowing latitude not to exclude small implementations and implementations targetting small systems.
In short, if you want more than 127 nesting levels it probably means that you should consult your implementation's documentation to see if it guarantees to support a larger number.

A: Just to put the whole scoping thing to bed, the following is legal C++ code:
int main() {
    if ( int x = 1 ) {
    }
    else if ( int x = 2 ) {
    }
}

which it would not be if both the if and the else if were at the same scope. I think there have been a lot of misunderstandings, perhaps engendered by my comment:
The compiler cares a great deal about scope.

which is of course true, but maybe not helpful in this situation.

A: Visual C++ Compiler Limits

The C++ standard recommends limits for
  various language constructs. The
  following is a list of constructs
  where the Visual C++ compiler does not
  implement the recommended limits. The
  first number is the recommended limit
  and the second number is the limit
  implemented by Visual C++:

*

*Nesting levels of compound statements,
  iteration control structures, and
  selection control structures [256]
  (256).

*Parameters in one macro definition
  [256] (127).

*Arguments in one macro invocation
  [256] (127).

*Characters in a character string
  literal or wide string literal (after
  concatenation) [65536] (65535).

*Levels of nested class, structure, or
  union definitions in a single
  struct-declaration-list [256] (16).

*Member initializers in a constructor
  definition [6144] (approximately 600,
  memory dependent, can increase with
  the /Zm compiler option).

*Scope qualifications of one identifier
  [256] (127).

*Nested external specifications [1024]
  (10).

*Template arguments in a template
  declaration [1024] (64).


text:
Q: Java cannot see jlabel in jframe nor imageIcon I'm writing a simple Java code that shows a text inside a frame and substitutes the standard ImageIcon with a custom one (.png file), stored in the same directory of this Java file.
However, whenever I run the code no text appears inside the frame and I also noticed that no Image is shown as Icon.
I'm running Java on VsCode and the code is as follows:
public class Example{
  public static void main(String[] args) {
     JFrame frame = new JFrame();
     frame.setSize(420,420);
     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

     ImageIcon image = new ImageIcon("icon.png");
     frame.setIconImage(image.getImage());

     Jlabel label = new Label();
     label.setText("Hello there!");
     frame.setVisible(true);
  }
}

Needless to say that I'm importing javax.swing.ImageIcon, javax.swing.JFrame and javax.swing.JLabel.
Whenever I run the above code this is the frame that appears:

May this be a problem due to Virtualization not being set on on my computer?


text:
Q: User name and password error during ArcGIS Server connection from ArcGIS Desktop I get this error message, when I try to connect to our ArcGIS Server. I can reach that from browser with the same address. I get this error, when I try to connect from ArcMap, without any loading or any sign of real connecting.

We were unable to connect to .... Error: Make sure you type in your user name and password correctly.

What can be the problem?
I'm not sure about my password or user name are wrong. According to my memories, an administrator user, who was picked up into the server's manager site with admin role should be able to log in. I tried with disabled firewalls too.

A: If ArcGIS Server is using Windows domain User / Role stores, you will need to prefix your login with your domain name.
For example, if my windows domain is XNET.gov, my log in username would be "XNET\btelliot".


text:
Q: Writing a complex function $f(x,y)=f(x+iy)$ as function of complex variable $z$. Is it true that to write a differentiable complex function $f(x,y)=f(x+iy)$ as a function of the complex variable $z$ one can replace real variable $x$ with $z$ and put $y=0$? If it is true (even under more conditions) then how can one prove it?

A: Yes, that is true. If you already know that $f(x+iy)$ is holomorphic, the conclusion follows from the identity principle.
For example, assume that $f(x+iy) = x^2-y^2 + x + 2ixy + iy$.
Define a new function $g$, where $g(z) = z^2 + z$. (I.e. what you get by putting $y=0$ and $x=z$. Then $g(z) = f(z)$ whenever $z$ is real (by construction). On the other hand $g$ is holomorphic (obviously) and so is $f$ by assumption.
Since $f$ and $g$ agree on the real axis, they agree everywhere by the identity principle for holomorphic functions. (It's enough to assume that $f$ and $g$ agree on a set with accumulation points.)
This is a common trick when solving Cauchy-Riemann's equations: e.g. given $u$, determine $v$ so that $u+iv$ is holomorphic. Normally, we want the answer in terms of $z$, not in terms of $x$ and $y$.

A: Assume that $f:\>z\mapsto f(z)$ is analytic in a region $\Omega\subset{\mathbb C}$ which intersects the real axis in an interval $I$. Then $f$ can be considered also as a complex-valued function of the real variables $x$ and $y$, which I write here as
$$\hat f(x,y):=f(x+iy)\ .\tag{1}$$
One has, e.g.,
$$\hat f_x(x_0,y_0)=\lim_{h\to 0}{f(z_0+h)-f(z_0)\over h}=f'(z_0)$$
and similarly $\hat f_y(x_0,y_0)=i f'(z_0)$. Putting $y:=0$ in $(1)$ we obtain the function
$$\phi(x):=\hat f(x,0)=f(x)\qquad(x\in I)\ ,$$
which is nothing else but the restriction of the original $f$ to $I$.
Conversely: If you just know $\phi:\>I\to{\mathbb C}$ then $f:\>\Omega\to{\mathbb C}$ is completely determined by this information. E.g., if you have a Taylor development
$$\phi(x)=\sum_{k=0}^\infty a_k(x-x_0)^k$$
with $a_k={\displaystyle{\phi^{(k)}(x_0)\over k!}}$ then $f$ is given in a full complex neighborhood of $x_0$ by
$$f(z)=\sum_{k=0}^\infty a_k(z-x_0)^k\ .$$
Another example: If you have found out that in fact $\phi(x)={1\over 1+ x^2}$ then you can say that $f(z)={1\over 1+z^2}$ in some domain $\Omega$ containing the full real axis.


text:
Q: nodeJS async function parse csv return data to other file I'm creating a small tool for internal user with puppeteer.
Basically I got a csv file with some data i "read" and fill form with.
As I try to cleanup my project to be reusable i'm struggle a little bit:
I create a file  name parsecsv.js
const config = require('../config.json');
const parse = require('csv-parse');
const fs = require('fs');

const processFile = async () => {
    records = []
    const parser = fs
        .createReadStream(config.sourceFile)
        .pipe(parse({
            // CSV options
            from_line: 1,
            delimiter: ";",
        }));
    let i =1;
    for await (const record of parser) {
        records.push(record)
        i++;
    }
    return records
}

const processFileData = async () => {
    const records = await processFile()
    console.info(records);
    return records
}

module.exports ={
    processFile, processFileData
}

in an other Js file i made
const parseCSV = require('./src/ParseCsv');
const records = parseCSV.processFileData();
const data = parseCSV.processFile();
console.log(typeof records);
console.table(records);
console.log(typeof data);
console.table(data);

But I never get my data only an empty oject.
How I can get my data to be able to "share" it with other function ?
thanks

A: as your functions are async ones and they return a promises, you can do something like
const parseCSV = require('./src/ParseCsv');
(async () => {
        const records = await parseCSV.processFileData();
        const data = await parseCSV.processFile();
        console.log(typeof records);
        console.table(records);
        console.log(typeof data);
        console.table(data);

          })()


text:
Q: add raduis in selected dates for react-dates (airBnB) I'm using react-dates in order to achieve the following date range picker :

here is what I have done :
https://codesandbox.io/s/ecstatic-almeida-3u72o?fontsize=14&hidenavigation=1&theme=dark
but I still have a problem to apply the selected style out of border radius of the selected dates (i tried before and ofter also I tried to create a custom content cell in order to apply a background style but it doesn't work)
Anyone can help me, please
Here is a screenshot of the problem that i'm facing :

A: What are you having trouble with exactly?
Making the css rules apply or making the rules to be exactly like the screenshot design?
If it is the second one, I would just do something like:
.CalendarDay__selected {
  border: none;
}

.CalendarDay__selected_start,
.CalendarDay__selected_end {
    border-radius: 50%;
    position: relative;
    z-index: 0;

  &:before {
    display: block;
    position: absolute;
    content: '';
    left: 50%;
    right: 0;
    bottom: 0;
    top: 0;
    background: #66e2da;
    z-index: -1;
  }

  &:after {
    display: block;
    position: absolute;
    content: '';
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    background: #00a699;
    z-index: -1;
    border-radius: 50%;
  }
}

.CalendarDay__selected_span {
  border: none;
}

.CalendarDay__selected_span:last-of-type {
  border-top-right-radius: 50%;
  border-bottom-right-radius: 50%;
}

.CalendarDay__selected_span:first-of-type {
  border-top-left-radius: 50%;
  border-bottom-left-radius: 50%;
}


text:
Q: How to display the content of MS Office 2007/2010 files on iPad? How can we display the content of MS Office 2007/2010 files (specially .docx) in iOS 3.2 (ipad)?

A: using this code snippet :
NSString *path = [[NSBundle mainBundle] pathForResource:resourcePath ofType:nil];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];

ironically I found that the UIWebView is capable of viewing these types but only on the iPad physically, it will not view the files in the simulator.


text:
Q: How should you properly report a beta Flutter issue with beta version 0.8.2? I just updated to Flutter verison 0.8.2 via Flutter upgrade and updated my dependencies and I get a compile time error in media_query.dart. Here's the version info:
Flutter 0.8.2 • channel beta • https://github.com/flutter/flutter.git
Framework • revision 5ab9e70727 (13 days ago) • 2018-09-07 12:33:05 -0700
Engine • revision 58a1894a1c
Tools • Dart 2.1.0-dev.3.1.flutter-760a9690c2

I'd like to report this to the Flutter team, what's the best way to do this?
Here is my actual error:
I/flutter (19370): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (19370): The following _CompileTimeError was thrown building WidgetsApp-[GlobalObjectKey
I/flutter (19370): _MaterialAppState#b6c28](dirty, state: _WidgetsAppState#48dc8):
I/flutter (19370): 'package:flutter/src/widgets/media_query.dart': error: line 67 pos 47:
I/flutter (19370): file:///Users/pbirdsall/flutter/flutter/packages/flutter/lib/src/widgets/media_query.dart:67:47:
I/flutter (19370): Error: The getter 'boldText' isn't defined for the class 'dart.ui::AccessibilityFeatures'.
I/flutter (19370): Try correcting the name to the name of an existing getter, or defining a getter or field named
I/flutter (19370): 'boldText'.
I/flutter (19370):       boldText = window.accessibilityFeatures.boldText,
I/flutter (19370):                                               ^
I/flutter (19370):       boldText = window.accessibilityFeatures.boldText,
I/flutter (19370):                                               ^
I/flutter (19370):

A: To submit issues go to the Flutter github repository and look under the tab 'issues'
https://github.com/flutter/flutter/issues
Check if your particular issue hasn't been brought to the developers' attention already by another user, if it hasn't you can follow the submission guidelines found here https://github.com/flutter/flutter/blob/master/CONTRIBUTING.md


text:
Q: Error while Happybase connection with hbase >>>import happybase
>>>cnx=happybase.Connection('localhost')

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/seyf/envname/local/lib/python2.7/site-packages/happybase/api.py", line 121, in __init__
self.open()
File "/home/seyf/envname/local/lib/python2.7/site-packages/happybase/api.py", line 138, in open
self.transport.open()
File "/home/seyf/envname/local/lib/python2.7/site-packages/thrift/transport/TTransport.py", line 149, in open
return self.__trans.open()
File "/home/seyf/envname/local/lib/python2.7/site-packages/thrift/transport/TSocket.py", line 99, in open
message=message)
thrift.transport.TTransport.TTransportException: Could not connect to localhost:9090

A: First, make sure the thrift server is running:
hbase thrift start

Then make sure you get the right port number (default 9090)\
cnx=happybase.Connection('localhost', port=xxxx)

A: This looks like a network problem. Did you actually start the Thrift server? (It's not the same process as the HBase daemon itself.)


text:
Q: Post a comment on image in instagram I have been following this tutorial "http://technet.weblineindia.com/mobile/instagram-api-integration-in-ios-application/2/" and able to login and even fetch user's data like his images, likes and comments. But when it comes to posting like "comments on images" and "posting an image" it's really confusing.
I have searched online and come up this http://instagram.com/developer/endpoints/comments/ but I'm unable to incorporate this in my code, and from where to get media_id it's confusing and I'm not even sure whether this is exactly what I want.
Please anyone guide me how to proceed after this or if someone has some useful tutorial. Thanks a lot in advance
EDIT:
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.instagram.com/oauth/authorize/?client_id=%@&redirect_uri=%@&response_type=token&scope=likes+comments+relationships",KCLIENTID,kREDIRECTURI]];
[instaLogin loadRequest:[NSURLRequest requestWithURL:url]];

A: Just spotted you aren't constructing the URL Properly:
Try this:
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.instagram.com/v1/media/761688240037794812_261410739/comments?access_token=319219722.a1a262a.7ca4123804ee4506a63256519b32147c&text=test"];

****EDIT****
Make sure you are using GET,POST & DELETE properly. see the top of the link you provided. I suspect you are calling this with GET.
http://instagram.com/developer/endpoints/comments/


text:
Q: There exists a bijection between $(0,1)$, $(0,1]$ and $[0,1]$? There exists a bijection between $(0,1)$, $(0,1]$ and $[0,1]$?
These 3 sets are not countable and since there are all in $\mathbb{R}$ they should have the same number of elements, so my question which are those bijective functions?
I've been thinking, but I cannot find of any.

A: A way to do this is to take a denumerable set in $D \subset (0,1)$,
to define a bijection as the identity outside $D$, to map the first element of $D$ to $1$ [and the second to $0$] and to "push" the remaining elements of $D$ down by $1$ [or $2$] to get a bijection with $(0,1]$, and $[0,1]$.


text:
Q: c1841 unable to recognize HWIC-1T (smart serial) card. any idea? I have this problem where c1841 router unable to verify HWIC-1T card (with smart serial connector), you have to know that i have other routers with IOS
c1841-ipbasek9-mz.151-4.M5 and c1841-ipbasek9-mz.124-24.T5 on its flash and with ROM ver "Version 12.4(13r)T5, RELEASE SOFTWARE (fc1)" and those routers can recgonize the card succesfully so i just take the flash off from one of those routers and replace it with the flash of the router with the problem. i did some efforts as follows:
1.I have upgraded  ROM to "Version 12.4(13r)T5, RELEASE SOFTWARE (fc1)"
Green#show rom
ReadOnly ROMMON version:

System Bootstrap, Version 12.4(13r)T, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 2006 by cisco Systems, Inc.

Upgrade ROMMON version:

System Bootstrap, Version 12.4(13r)T5, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 2007 by cisco Systems, Inc.

Currently running ROMMON from Upgrade region
ROMMON from Upgrade region is selected for next boot

2.I have upgraded IOS to c1841-ipbasek9-mz.151-4.M5.bin and c1841-ipbasek9-mz.124-24.T5.bin and still have the same problem.
3.I have entered the command show diag and i got the following:
Green#show diag

Slot 0:

    C1841 2FE 2SLOT Mainboard Port adapter, 2 ports
        Port adapter is analyzed
        Port adapter insertion time 02:49:58 ago
        EEPROM contents at hardware discovery:
        Chassis MAC Address      : 001b.d506.c8c8
        MAC Address block size   : 34
        PCB Serial Number        : FOC111909DY
        Hardware Revision        : 7.0
        Part Number              : 73-8191-08
        Board Revision           : A0
        Top Assy. Part Number    : 800-23434-06
        Deviation Number         : 0
        Fab Version              : 04
        CLEI Code                : IPM7W00CRA
        RMA Test History         : 00
        RMA Number               : 0-0-0-0
        RMA History              : 00
        Product (FRU) Number     : CISCO1841
        Version Identifier       : V05
        Processor type           : 86
        Chassis Serial Number    : FHK11191972
        EEPROM format version 4
        EEPROM contents (hex):
          0x00: 04 FF C3 06 00 1B D5 06 C8 C8 43 00 22 C1 8B 46
          0x10: 4F 43 31 31 31 39 30 39 44 59 40 04 1B 41 07 00
          0x20: 82 49 1F FF 08 42 41 30 C0 46 03 20 00 5B 8A 06
          0x30: 88 00 00 00 00 02 04 C6 8A 49 50 4D 37 57 30 30
          0x40: 43 52 41 03 00 81 00 00 00 00 04 00 CB 89 43 49
          0x50: 53 43 4F 31 38 34 31 89 56 30 35 20 D9 02 C1 40
          0x60: 09 86 C2 8B 46 48 4B 31 31 31 39 31 39 37 32 FF
          0x70: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x80: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x90: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0xA0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0xB0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0xC0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0xD0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0xE0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0xF0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x100: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x110: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x120: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x130: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x140: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x150: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x160: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x170: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x180: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x190: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x1A0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x1B0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x1C0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x1D0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x1E0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x1F0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

        WIC/HWIC Slot 0:
        Unknown WAN daughter card
        Unknown EEPROM ver 255
        EEPROM format version 255
        EEPROM contents (hex):
          0x20: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x30: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

3.these are show flash: outputs
Green#show flash:
-#- --length-- -----date/time------ path
1     27577580 Jan 02 2006 12:27:28 c1841-ipbasek9-mz.124-24.T5.bin
2         1038 Oct 11 2011 23:28:36 home.shtml
3         2746 Oct 11 2011 23:28:54 sdmconfig-18xx.cfg
4         5864 Feb 03 2013 22:16:54 PATCH9A45NVM.S37
5     34793740 Apr 03 2013 14:51:40 c1841-ipbasek9-mz.151-4.M5.bin

2736128 bytes available (62390272 bytes used)

4.these are show version outputs:
Green#show ver
Cisco IOS Software, 1841 Software (C1841-IPBASEK9-M), Version 12.4(24)T5, RELEAS
E SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2011 by Cisco Systems, Inc.
Compiled Fri 04-Mar-11 02:48 by prod_rel_team

ROM: System Bootstrap, Version 12.4(13r)T5, RELEASE SOFTWARE (fc1)

Green uptime is 2 hours, 58 minutes
System returned to ROM by reload at 16:50:09 UTC Fri Apr 7 1972
System image file is "flash:c1841-ipbasek9-mz.124-24.T5.bin"

This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

Cisco 1841 (revision 7.0) with 117760K/13312K bytes of memory.
Processor board ID FHK11191972
2 FastEthernet interfaces
DRAM configuration is 64 bits wide with parity disabled.
191K bytes of NVRAM.
63808K bytes of ATA CompactFlash (Read/Write)

Configuration register is 0x2102

5.startup-config file attached.
6.I have entered boot system flash:c1841-ipbasek9-mz.151-4.M5.bin command for testing IOS c1841-ipbasek9-mz.151-4.M5.bin but you will not find it on configration file attached.
Any suggestion? thanks in advance.

A: I would contact the place you bought the card from and request an RMA.
WIC/HWIC Slot 0:
    Unknown WAN daughter card
    Unknown EEPROM ver 255
    EEPROM format version 255
    EEPROM contents (hex):
      0x20: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
      0x30: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

All 1's in the EEPROM looks unrecoverably bad, and from Cisco's website you're using code that should recognize that card.

A: If this is the exact same model card in the exact same model router with the exact same IOS as you have working other places, you could have a hardware issue.
Steal a module from another router that is known working.  Does it work okay in the new router?  If it does, probably an HWIC issue.
If other HWICs don't work either, do you have any other models that you could try in the new router to see if the slot is possibly bad?

A: I don't have any HWIC cards working in any 1841's (I've got many!) on IOS Version 12. You need to upgrade to 15.
EDIT: Actually, I read your question wrong. I have this problem with HWIC-ADSL2 cards, not tried any 1T cards. Eitherway, I still stand by my post; upgrading to IOS 15 solves this for me every time.


text:
Q: using sys.exit() and heroku threw an error 2022-02-21T01:07:54.352381+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=_botname.herokuapp.com request_id=88df74f6-a5a1-4ee9-a0a5-c98a22a60949 fwd="115.66.143.26" dyno= connect= service= status=503 bytes= protocol=https
2022-02-21T01:07:54.988568+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=_botname.herokuapp.com request_id=5d73238d-8ee6-42d0-a010-997a073d06e9 fwd="115.66.143.26" dyno= connect= service= status=503 bytes= protocol=https

- Got this error when using sys.exit(26) (trying to restart bot)


text:
Q: Plotly not showing last value of the series when using 'hv' line shape I am working with a time series like this:
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots

csv = [
    ['2019-05-01 00:00', 6],
    ['2019-05-01 00:30', 8],
    ['2019-05-01 01:00', 7],
    ['2019-05-01 01:30', 3],
    ['2019-05-01 02:00', 8],
    ['2019-05-01 02:30', 4]]

df = pd.DataFrame(csv, columns=["Timestamp", "Value"])
df["Timestamp"] = pd.to_datetime(df["Timestamp"])
df = df.set_index("Timestamp")
print(df)

So nothing special here, output:
                     Value
Timestamp
2019-05-01 00:00:00      6
2019-05-01 00:30:00      8
2019-05-01 01:00:00      7
2019-05-01 01:30:00      3
2019-05-01 02:00:00      8
2019-05-01 02:30:00      4

This is averaged data, meaning for example that the first value (6) is between 00:00 and 00:30.
I want to plot this data and also a bigger average, for example hourly average:
df_hourly = df.resample('1H').mean()
print(df_hourly)

Output:
                     Value
Timestamp
2019-05-01 00:00:00      7
2019-05-01 01:00:00      5
2019-05-01 02:00:00      6

Ok, so let's do it using Plotly's line shape 'hv':
fig = make_subplots(rows=2, shared_xaxes=True)

fig.add_trace(go.Scattergl(
    name='Value',
    x=df.index,
    y=df['Value'],
    line=dict(shape='hv'),
), row=1, col=1)

fig.add_trace(go.Scattergl(
    name='Hourly Value',
    x=df_hourly.index,
    y=df_hourly['Value'],
    line=dict(shape='hv'),
),row=2, col=1)

fig.show()

And here is the problem, this is the final plot:

I am interested in the line plot and my expectation is it will cover from the beginning of the data (0:00) to the end (just before 3:00). However the first ploted line ends at 2:30 and the second at 2:00.
I know all the data is being considered because all the markers are there. But visually talking, for me is very misleading that the lines corresponding to the last point are not being shown. If you use lines without markers, last point is not visible at all.
I understand this is the expected Plotly's behavior. So the question is, how can I fix it? Is there any easy way to plot a line from 0:00 to 3:00 (or 2:59:59) in both graphs?
I mean, in the first plot, for example, each individual value is plotted as marker followed by a line of half an hour. This is true for each value except the last one, which is plotted as marker but not followed by any line. I want to plot this last line so the plot will end at 3:00 because that is what my data means in reality.
Thank you.

A: By changing your Data to this:
csv = [
['2019-05-01 00:00', 6],
['2019-05-01 00:30', 8],
['2019-05-01 01:00', 7],
['2019-05-01 01:30', 3],
['2019-05-01 02:00', 8],
['2019-05-01 02:30', 4],
['2019-05-01 03:00', 4]]

I was able to get a graph like


text:
Q: How to solve this this bad operand types for binary operator import java.io.*;
import java.util.*;

public class Solution {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        for(int i=1;i < sc.hasNext();i++){
            System.out.print(i+sc.nextLine());
        }
    }
}

Solution.java:10: error: bad operand types for binary operator '<'
        for(int i=1;i < sc.hasNext();i++){
                      ^
  first type:  int
  second type: boolean
1 error

A: The hasNext() method returns true if this scanner has another token in its input, else if it has no more tokens then it returns false. And we can't compare int with boolean. Hence it's sufficient to use hasNext() as a terminating condition.
import java.io.*;
import java.util.*;

class Solution
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);

        for (int i=1;sc.hasNext();i++)
        {
            System.out.print(i+sc.nextLine());
        }
        /** ALT:
        int i = 1;
        while (sc.hasNext())
        {
            System.out.print(i+sc.nextLine());
        }
        **/
    }
}


text:
Q: is there any difference in authorization between Magento.RestAPI 1.8 and 1.6 I'm using magento.restAPI and i'm very new to magento and i havent used any previous version of magento.
Currently i'm having a magento rest Api
i want to know whether its the same authentication process being used in magento 1.8 and 1.6

A: If you look at the Magento changelog
Release Notes - Magento 1.7.0.0 (Apr 24, 2012)
You'll notice the Major Highlights, the 8th bullet isted is:
Added REST API

If you browse through all of the available changelogs, there is no further mention of REST modification in versions later than 1.7.0.0.
So yes, there is a difference in the REST API between versions 1.6 & 1.8 which is the existence of the API itself ;-)


text:
Q: Comparación booleana de strings Tengo dos string, uno es "ac" y el otro "ca"
¿Por que cuando ejecuto "ac"<"ca" la operación da True?

A: Si nos vamos a la documentación de Python:

The comparison uses lexicographical ordering: first the first two items are compared, and if they differ this determines the outcome of the comparison; if they are equal, the next two items are compared, and so on, until either sequence is exhausted.

Traducción libre:

La comparación utiliza ordenamiento lexicográfico: primero se comparan los dos primeros elementos, si difieren, determinan el resultado de la comparación; si son iguales, se comparan los siguientes dos elementos, y así sucesivamente, hasta que se agote cualquiera de las secuencias.

*

*En Python 3 dónde str son cadenas UTF-8 el orden lexicográfico usa el identificador numérico del carácter Unicode, el llamado "code point"  para ordenar caracteres individuales.

*En Python 2 se usa el orden en la tabla ASCII para ordenar cadenas str.
Por lo tanto, cuando haces "ac" < "ca" obtienes True porque primero se compara si 'a' < 'c', lo cual es cierto ya que el identificador numérico para 'a' es 97 y para 'c' es 99 y 97 es menor que 99. La comparación termina aquí. Si el primer carácter de cada cadena fueran iguales se pasaría al segundo y así sucesivamente hasta encontrar una diferencia o iterar completamente sobre al menos una de las cadenas. Si una de las cadenas es agotada la otra es considerada mayor, si ambas se agotan al mismo tiempo sin haber por tanto encontrado ninguna diferencia las cadenas son consideradas iguales.

A: Se ordenan según su numero en la tabla ASCII

var to = arr => console.log(arr[0] > arr[1]);

to(["!", " "]);

to(["#", "!"]);

to(["$", "#"]);

to(["%", "$"]);

to(["a", "A"]);

to(["ca", "ac"]);

(function() {
 var first = "ca",
     second = "ac",
     firstNumber = first.charCodeAt(),
     secondNumber = second.charCodeAt();

     if(first > second) {
     console.log(`

     Primera cadena(ca) : ${firstNumber} vs

     Segunda cadena(ac) : ${secondNumber}`);
     }
}());

Se van comparando en orden, el primero con el primero, si son iguales, se sigue con el siguiente.
Ejemplo:

(function() {

  /*

   @Info:

   c => 99

   a => 97

   b => 98

  */

  var first = "caa",
      second = "cab";
      // 'ca' y 'ca' son iguales, pero 'cab' es mayor que 'caa'

    console.log(second > first); // True

})();


text:
Q: How to query a table with a composite primary key Hello (I am a noob in this area), I have a MySQL database and it has the next tables:
Tables
So there are 3 tables, the one called "INGREDIENTES" that has ingredients and the other one called "RECETAS" that has recipes in it. The way I am connecting the 2 tables is with a table called "INGREDIENTES_RECETAS", this table has a composite primary key "id_ingrediente + id_receta", because  a recipe can have an unknown number of ingredients.
The problem is that I can't figure out how to make a query that filters a recipe by a number of unknown ids of "id_ingrediente".
I was thinking about something like:
SELECT id_receta FROM INGREDIENTES_RECETAS WHERE id_ingrediente CONTAINS (89 AND 18);

I would like to solve this problem avoiding PL/SQL, using only SQL. Is it possible?
I am using this in an java app, so if there is a method of doing it programatically it will solve the problem too.
If I have to use PL/SQL, How can I call a "Procedure" in java, using the jdbc driver?
Thank you for helping.

A: If you're looking for recipes that contain both ingredients 89 and 18, then join INGREDIENTES_RECETAS with itself to form pairs of ingredients on which you can filter:
SELECT ir1.id_receta
FROM INGREDIENTES_RECETAS ir1
INNER JOIN INGREDIENTES_RECETAS ir2 ON ir1.id_receta = ir2.id_receta
WHERE ir1.id_ingrediente = 89 AND ir2.id_ingrediente = 18;

A: SELECT id_receta FROM INGREDIENTES_RECETAS WHERE id_ingrediente IN (89, 18);

or
SELECT id_receta FROM INGREDIENTES_RECETAS WHERE (id_ingrediente = 89) OR (id_ingrediente = 18);

A: It looks like you want a list of id_receta where the id_ingrediente matches a given list of IDs. This can be accomplished with.
SELECT
   `id_receta`
FROM
    `ingredients_recetas`
WHERE
    `id_ingrediente` IN (89, 18);

A: Assuming that you want to find all recipes which contain all listed ingredients (possibly more than 2), then you can do the following. Note that the HAVING clause should be compared to the number of ingredients being checked, and the IN clause should contain all the id's of the ingredients.
SELECT
    ir.id_receta
FROM
    INGREDIENTES_RECETAS ir
WHERE
    ir.id_ingrediente IN (89, 18)
GROUP BY
    ir.id_receta
HAVING
    COUNT(*) = 2;

EDIT
If you want to find all recipes which have at least one of the listed ingredients, change the last clause to:
HAVING
    COUNT(*) > 0;

And... while some of the other solutions here provide this in a different manner, to find all the recipes which have exactly one of the listed ingredients, change the last clause to:
HAVING
    COUNT(*) = 1;


text:
Q: Why am I getting a Run-Time Error 1004 (Application-defined or Object-defined error) in VBA When I try to run the Macros, I get a run-time error 1004 (Application-defined or Object-defined error), and this line is highlighted.
The line is supposed to populate information in a group of cells from text entered in previous cells. I have double checked the example I'm using and it matches exactly so I'm unsure of the problem.
'Places values in WO Row
.Cells(WORow, WOCol).Value = .Range(.Cells(15, WOCol).Value).Value


text:
Q: How to receive only one email report for multiple AWS SNS topics I have several services, and each service creates an SNS topic which sends an email to me. e.g., whenever code deploy fails, I receive an email from an SNS topic, whenever codepipeline fails I receive an email from another SNS topic, whenever a specific lambda fails, I receive another SNS topic. None of the above failures is urgent, so it does not need to be taken care immediately.
How can I receive only one email report once a day for all the above failures? Maybe I should let the corresponding service trigger SQS instead of SNS and then once every day I pull all messages from SQS?

A: The option you mentioned with an SQS queue subscribed to the SNS topic is probably the best way to go. You can then use a scheduled Lambda function that runs once a day to poll the messages in the queue and send you an email with the aggregated information.


text:
Q: Finding a minmuim swaps in an array I have found a problem on a net for generating some sequence.
 A = [A1, A2, ..., AN]
and
where  A1 < A2 < ... < Am > Am+1 > ... > AN for some index m, with m between 1 and N inclusive).

I want to find the minimum swaps to accomplish this
For Ex
1 8 10 3 7
Swap between 3 and 7 will give me the required seq.
Ans=1

I found this code in the editorial:
boolean[] done = new boolean[n];
 for(int i=0;i<n;i++) {
            int index = -1;
            for(int j=0;j<n;j++) {
                if(!done[j] && (index == -1 || values[j] < values[index]))
                    index = j;
            }

            int left = 0, right = 0;
            for(int j=0;j<index;j++)
                if(!done[j])
                    left++;
            for(int j=index+1;j<n;j++)
                if(!done[j])
                    right++;
            res += Math.min(left, right);
            done[index] = true;
        }
        return res;

I can't understand the code what its doing How can i found the minimum swap ? Is this a standard algorithm question.And time complexity is O(n^2) is this good.

A: (Note: swap seems to mean swap of two adjacent elements.)
The idea behind the code is as follows. The minimum element x must be moved either to the first or last position in the array. The number of swaps to move x does not depend on which swaps not involving x are performed. For every valid solution, the swaps not involving x are a solution for the array with x removed. Thus, there exists an optimal solution that moves x to the first or last position and then recursively deals with the remaining elements.
The structure of the code is to find the minimum unprocessed element (inner loop 1; done[j] is a flag indicating whether the element at position j has been processed), determine how many swaps are needed to move it to the first position (inner loop 2), and determine how many swaps are needed to move it to the last position (inner loop 3). We don't count swaps over processed elements because, when we're moving the current element, those elements already have been moved out of the way.
The running time could be improved to O(n log n) by substituting merge sort for the implicit selection sort and using a Fenwick tree to count the number of unprocessed elements in a range.


text:
Q: How to read a line from python currently in console? I want to use a line of code that can read what I was typing in console, for use with asyncio module in python. My code prints data when it receives it from the server, and after it does that, I want it to read what I was typing and save it to a variable. I am fine with having to use a non-standard module.
Information about program:

*

*Currently reads stdin non-blocking using asyncio loop.run_in_executor

*Program runs using loop.create_connection, then uses loop.run_forever with the stdin reader added as a task.

Code:
#!python3.5
#chatroom client

import socket, sys, os, traceback, asyncio
from threading import Lock

DBG = False #More Error printing using full_error function

#async stuf
loop = asyncio.get_event_loop()
lock = Lock()
prev_stdin = ""

#Server Location
target = 'localhost'
port = 17532
buffer_size = 1024
server = None
transports = [] #an array of async.iotransport`s

#Functions for Error handling
full_error = lambda: traceback.print_exception(*sys.exc_info())
pause = lambda: None #make it global for below

#Pause system compatability
if os.name[0:5]=='posix':
    def pause():
        os.system('read -n1 -r -p "Press any key to continue . . ." key')
elif os.name[0:2]=='nt':
    def pause():
        os.system("pause")
else:
    def pause():
        input("Press enter to continue . . .")

def empty_stdin():
    output = ""
    while True:
        temp = sys.stdin.buffer.read(1)
        if temp == "":
            break
        else:
            output += temp
    return output

if DBG:
    loop.set_debug(DBG)

async def write():
    loop = asyncio.get_event_loop()
    while True:
        line = await loop.run_in_executor(None, sys.stdin.readline)
        line = prev_stdin + line
        prev_stdin = ""
        for i in transports:
            loop.call_soon(i.write,line.encode('utf-8'))

class Server(asyncio.Protocol):
    def connection_made(self,transport):
        self.transport = transport
        transport.write(b"Connected")
    def data_received(self, data):
        print("\n%s"%data.decode('utf-8'))
        prev_stdin = empty_stdin()
        print(prev_stdin,)

try:
    coro = loop.create_connection(Server, host=target, port=port)
    task = loop.create_task(coro)
    print("hi")
    print(transports)
    server, serverp = loop.run_until_complete(task)
    transports += [server]
    user_input = loop.create_task(write())
    #loop.add_reader(sys.stdin, write)
    loop.run_forever()
    print('end')

except Exception as e:
    if DBG:
        full_error()
    else:
        print(type(e))
        print(e)
    pause()
    sys.exit()

A: I solved the problem (Windows only) by using msvcrt to catch a single character and some code changes.
New Functions/Changes

*

*draw_screen:

*

*clear screen using os.system("cls")

*print lines that I save when I print info (Could get laggy)

*print a cursor with what I am currently typing (">> Hello")

*write:

*

*replaced sys.stdin.readline with msvcrt.getch

*A lot more changes

*everywhere:

*

*Whenever I would print, instead add it to screen variable which is an array that holds everything. Then it calls draw_screen()

*removed prev_stdin stuff

*removed some other print statements

Final Code (For now):
#!python3.5
#chatroom client

import sys, os, traceback, asyncio, msvcrt
from threading import Lock

DBG = False #More Error printing using full_error function

screen = [] #holds lines of text that are printed to the screen
line = ""

#async stuf
loop = asyncio.get_event_loop()
lock = Lock()

#Server Location
target = 'localhost'
port = 17532
buffer_size = 1024
server = None
transports = [] #an array of async.iotransport`s

#Functions for Error handling
full_error = lambda: traceback.print_exception(*sys.exc_info())

#system compatable functions
if os.name[0:5]=='posix':
    def pause():
        os.system('read -n1 -r -p "Press any key to continue . . ." key')
    def cls():
        os.system("clear")
elif os.name[0:2]=='nt':
    def pause():
        os.system("pause")
    def cls():
        os.system("cls")
else:
    def pause():
        input("Press enter to continue . . .")
    def cls():
        os.system("clear")

def draw_screen():
    cls()
    for i in screen:
        print(i)
    print("> ", line, end="\r") #Draws current line of text being typed

if DBG:
    loop.set_debug(DBG)

async def write():
    global line
    while True:
        temp = await loop.run_in_executor(None, msvcrt.getch)
        temp = temp.decode('utf-8')
        if temp == "\b":
            line = line[0:len(line)-1]
        elif not (temp == "\r" or temp == "\n"):
            line += temp
        else:
            for i in transports:
                loop.call_soon(i.write,line.encode('utf-8'))
            line = ""
        draw_screen()

class Server(asyncio.Protocol):
    def connection_made(self,transport):
        self.transport = transport
        transport.write(b"Connected")
    def data_received(self, data):
        global screen
        screen += ["%s"%data.decode('utf-8')]
        draw_screen()

try:
    coro = loop.create_connection(Server, host=target, port=port)
    task = loop.create_task(coro)
    server, serverp = loop.run_until_complete(task)
    transports += [server]
    user_input = loop.create_task(write())
    loop.run_forever()
    print('end')

except Exception as e:
    if DBG:
        full_error()
    else:
        print(type(e))
        print(e)
    pause()
    sys.exit()