text:
Q: How to create a border for whole table I have to draw solid lines as border.
I am using this loc
<fo:table border="solid 0.1mm black">

but it draws only surrounded lines. It is not applied to all cells and rows. Is it possible to draw solid lines as borders with minimum coding, like not setting borders for cell and rows separately as:
<fo:table-row  border="solid 0.1mm black">

A: Add the border attribute to all table-cell elements.  You can see here that borders are not inherited:  http://www.w3.org/TR/xsl11/#border
While it doesn't save any typing, you could help future support of your stylesheet by using attribute sets:
<xsl:attribute-set name="myBorder">
  <xsl:attribute name="border">solid 0.1mm black</xsl:attribute>
</xsl:attribute-set>
...
  <fo:table-cell xsl:use-attribute-sets="myBorder">
    ...

Then, when you need to change all, you just change it in one place.


text:
Q: Oracle 11g to 12c migration gotchas? I am embarking on an 11g to 12c Oracle DB migration. I will need to do it at least twice, once for testing, a 2nd time fro production. My initial thought is to use expdp/impdp. I export "full" the DB nightly using expdp.
My problem in the past when importing a full DB is it can get squirrely regarding the system schema/users. A full import tries to muck with system schemas (sys, system, sysman...). My new 12c DB is a portable DB, and obviously I want none of the settings or data from the system schemas, that may hose my new DB.
I do however want all of the non system schemas and users, of which there are 5 or so real schemas, and 30 or so "users."
I have been looking for some blogs or documents that address this issue, and can't find any. A pointer to documentation on how to avoid the problems described above would be great.
Also if there are any other gotchas when doing the migration, a heads up on that would be useful as well.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Java proxy applet: is such thing possible? I am wondering whether it is technically possible to create a proxy within a java applet.
And would it then be possible to route all further browser requests through this java applet proxy?
Eg., if the user would browse to google.com, could the default behaviour be replaced by this proxy applet?
Any feedback is appreciated.

A: Technically is possible, but I think it might be very expensive and time consuming to build. You might need to do something similar as what the Juniper VPN client does. It runs an applet which run an OS specific app that changes the proxy settings, and, in you case, the same applet can run as a proxy server. The OS application also has to revert the proxy settings if it detects that the applet died or was closed. In the case of Juniper, it changes the system hosts file instead of the proxy settings.
As for Mat concern: the user will get a few pop ups telling her to be SUPER sure of running the app and installing the OS app... again, in the same way that happens with Juniper :)
EDIT
It depends how many OSs / browsers you want to support. In worst case scenario you'll need an app to set and rollback the system proxy settings for Windows, Mac, Linux (I don't even know if there's system wide configuration for the proxy configuration). Then (as far as I remember) the way to sign an applet for IE is different than for all the other browsers.
What I'm trying to say is that it's not a weekend job, it could easily take a couple of months to code and have plenty of issues with certain combination of OS / browsers.


text:
Q: How to connect to a database from outside of a web app? I am developing a java web app with Wicket (with jpa). Inside the Wicket Application i can access the database Persistence Unit with Persistence.createEntityManagerFactory() configured in persistence.xml.
Now i want to have a helper script to perform maintenance tasks. I created a java file with a static void main method but if i run this file, I get an Exception:
Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method
that is not native or abstract in class file javax/persistence/Persistence

In the test files, it works fine.

A: You don't have JPA on your classpath.
Depending on your JPA provider, this will be at least javax.persistence-*-.jar plus the provider-specific JARs, e.g. eclipselink-x.y.z.jar or a bunch of JARs for Hibernate. Check out what lives in your WEB-INF/lib folder if you're not sure.


text:
Q: Mask Navbar-fixed-top links on ajax loader I am displaying loader image on ajaxstart event at the same time changed the opacity of body. But the opacity of navbar-fixed-top is not changed and as well as the links present on it are clickable.
Need to disable that links on ajaxstart when loader image is displayed

A: if z-index of your navbar for example is : 10, you must specified z-index: 11 for your loader image
Demo


text:
Q: Is there any way to share a pts/x? What I mean is, user A connect via ssh to the box (ubuntu 12.04). Then ssh to another box (Linux/Solaris/etc) and work.
User B connects to ubuntu box and can see what user A is doing.
I know for solaris are utilities called ntd (to open a shared session) and ntio (to join to the previous opened session, you can have read or write access to the opened session).

A: GNU screen can do session sharing with the the multiuser command and the -x flag (personally I've only tried this in single user mode, so some of the below is guesswork). From the manual page, I gather UserA would have to:

*

*Run screen

*ctrl-A

*:multiuser on

*ctrl-A

*:acladd UserB
Then UserB would have to:
 screen -x UserA/

And from then on they would share the screen. Note that the manual page also says:

This requires setuid-root.

So this may or may not work on any given server.

A: I think byobu is a good tool for your requirement.


text:
Q: How to use class extends List Preference I'm trying to make a change of features in ListPreference.
So I made a legacy of Kelas from this list, but I don't know how I can use it to change the title of the list, change some color and do some other things.
public class ThemedListPreference extends ListPreference implements AdapterView.OnItemClickListener {

    public static final String TAG = "ThemedListPreference";

    private int mClickedDialogEntryIndex;

    private CharSequence mDialogTitle;

    public ThemedListPreference(Context context , AttributeSet attrs){

        super(context , attrs);
    }

    public ThemedListPreference(Context context) {
        super(context);
    }

    @Override
    public void setLayoutResource(int layoutResId) {
        super.setLayoutResource(layoutResId);
    }

    @Override
    public void onItemClick(AdapterView<?> parent , View view , int position , long id) {

    }
}

A: document

This class was deprecated in API level 29.

If you want to make changes. You have to return true from your onPreferenceChangeListener.
PreferenceChangeListener document

This interface was deprecated in API level 29.

mPreferenceChange.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        .....
        .....
        return true;
    }
});


text:
Q: Switching xeditable off and on using editable("destroy"); I am trying to turn xeditable on and off using editable("destroy"). Xeditable turns off but does not turn back on. The function looks like this:
$("#changeType").on("change", function () {
    switch ($(this).prop("checked")) {
        case true:
            $("#status").editable("destroy");
            $("#status").editable({
                showbuttons: false,
                onblur: 'ignore',
                mode: 'inline',
                send: 'never',
                success: function (params) {
                    return false;
                }
            }).editable('show');
            break;
        case false:
            ("#status").editable("destroy");
            ("#status").editable();
            break;
    };
});

Please see my jsfiddle http://jsfiddle.net/ykay/vdoz07qz/3/

A: There is a typo (missing $ sign) in your case false:
$("#status").editable("destroy");
$("#status").editable();


text:
Q: how to specify duration in live m3u8 stream using ffmpeg? I want to specify a duration for example 4 min when using ffmpeg but i keep getting error:
ffmpeg -i "./test.m3u8" -t 04:00 "output.mp4"

and error i get is this:
Invalid duration specification for t: 04:00

also these warnings in yellow color:
max_analyze_duration 5000000 reached at 5014800
 Could not find codec parameters (Video: h264 (
 Could not find codec parameters (Audio: aac (
 Could not find codec parameters (Video: h264 (
Could not find codec parameters (Audio: aac (

hope you guys help me what i am doing wrong. Thanks in advance.

A: From the documentation:

duration may be a number in seconds, or in hh:mm:ss[.xxx] form.

Your form is mm:ss, so it's simply not valid. Which is also what the error message says.
Use -t 00:04:00 or -t 240 instead.


text:
Q: I have cURL installed on Ubuntu 14 with PHP 7 but getting still Call to undefined function curl_init() when i run below command :
 locate curl.so

Than below is the out put.
/usr/lib/php/20151012/curl.so
/usr/lib/php/20170718/curl.so
/usr/lib/python2.7/dist-packages/pycurl.so
/usr/lib/x86_64-linux-gnu/libcurl.so.3
/usr/lib/x86_64-linux-gnu/libcurl.so.4
/usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0

and after that i execute the below cmd. locate curl.ini
output as below.
/etc/php/7.0/apache2/conf.d/20-curl.ini
/etc/php/7.0/cli/conf.d/20-curl.ini
/etc/php/7.0/fpm/conf.d/20-curl.ini
/etc/php/7.0/mods-available/curl.ini
/etc/php/7.2/mods-available/curl.ini
/usr/share/php7.0-curl/curl/curl.ini
/usr/share/php7.2-curl/curl/curl.ini
/var/lib/ucf/cache/:etc:php:7.0:mods-available:curl.ini
/var/lib/ucf/cache/:etc:php:7.2:mods-available:curl.ini

every thing seems good(curl already installed) but still getting error.
Fatal error: Call to undefined function curl_init().
Updated output for


text:
Q: Graylog: Saving search when there are no results I just recently setup GrayLog2 and adding searches and streams as we go along.
Since it's a relatively new setup, Graylog doesn't have all the logs yet.
But we want to save searches for certain kinds of logs. When we search in GrayLog for those now, we obviously don't get any results.
In such a case, how do we save the searches i.e. when there are no results.
When there are results, it shows a "Save Search" button.


text:
Q: How to pass a javascript blob to java using getState in JavascriptComponent to Java byte[]? I am trying to create a custom javascript component in vaadin using to capture audio from the web browser and pass the saved javascript blob to java to save it in database.
My question is, how to pass that blob and convert it to a java readable type?


text:
Q: Sending iOS push notification notification over HTTP2 using .p12 developer certificate So I am trying to convert apple developer certificate for push notification to .pem file. Later I want to use that file to send apple push notifications over HTTP2 like this:
1. openssl pkcs12 -clcerts -in aps_dev.p12 -out aps_dev.pem
2. curl -v -d '{"aps":{"alert":"hello"}}' --http2 --cert aps_dev.pem https://api.development.push.apple.com/3/device/31abcb1367eaa30abc4e293f19a12aeabcdd25b04dca1234caa594b10946a21

While I can send the notification to the device. What I'm trying to understand is whether:

*

*If it is a HTTP2 request is certificate is sent to APNS.

*OR a secure socket is created using the certificate between and then a HTTP2 request is written over it?

I can see system opens some sockets after the call but I'm not sure if the socket is between my system and APNs server.


text:
Q: Combine specific rows of a dataframe and delete unused rows I have a dataframe called df1 which looks like this:
details            endFrame id  indexID object  startFrame
'series of numbers'  1111   78  0   Motorbike   1
'series of numbers'  3647   78  1   Motorbike   1112
'series of numbers'  3678   78  2   Motorbike   3649
'series of numbers'  704    120 3   Pedestrian  66
'series of numbers'  817    120 4   Pedestrian  705
'series of numbers'  922    120 5   Pedestrian  818
'series of numbers'  121    110 6   Pedestrian  69
'series of numbers'  140    109 7   Pedestrian  69
'series of numbers'  4161   109 8   Pedestrian  140
'series of numbers'  4344   109 9   Pedestrian  4163
'series of numbers'  3603   79  10  Motorbike   70

And I have another df2 that looks like this:
indexID matchID
0   1
1   2
3   4
4   5
7   8
8   9

The match ID shows which IDs that need to be joined. For example, from the first 2 rows indexs 0,1 and 2 should be joined together. In df1, all the details should be just added together. The final final df should look like this:
details                                                       id    indexID
'series of numbers''series of numbers''series of numbers'     78    0
'series of numbers''series of numbers''series of numbers'     120   3
'series of numbers'                                           110   6
'series of numbers''series of numbers''series of numbers'     109   7
'series of numbers'                                            79   10

How do I do this?
EDIT
The series of numbers is actually a list so instead of having an output like this:
details                                                  id    indexID
[series of numbers][series of numbers][series of numbers]     78    0
[series of numbers][series of numbers][series of numbers]     120   3
[series of numbers]                                           110   6
[series of numbers][series of numbers][series of numbers]     109   7
[series of numbers]                                            79   10

I would like it to have an output like this:
details                                                  id    indexID
[series of numbersseries of numbersseries of numbers]     78    0
[series of numbersseries of numbersseries of numbers]     120   3
[series of numbers]                                           110   6
[series of numbersseries of numbersseries of numbers]     109   7
[series of numbers]                                            79   10

A: Replace matched values to missing values by mask with isin and forward fill by previous values:
g = df1['indexID'] .mask(df1['indexID'].isin(df2['matchID'])).ffill().astype(int)
print (g)
0      0
1      0
2      0
3      3
4      3
5      3
6      6
7      7
8      7
9      7
10    10
Name: indexID, dtype: int32

Then use groupby with join:
#if want grouping only be new Series g
df = df1.groupby(g).agg({'details':' '.join, 'id':'first'}).reset_index()
print (df)
   indexID                                            details   id
0        0  'series of numbers' 'series of numbers' 'serie...   78
1        3  'series of numbers' 'series of numbers' 'serie...  120
2        6                                'series of numbers'  110
3        7  'series of numbers' 'series of numbers' 'serie...  109
4       10                                'series of numbers'   79

#or also by id column
df = df1.groupby(['id',g], sort=False)['details'].agg(' '.join).reset_index()
print (df)
    id  indexID                                            details
0   78        0  'series of numbers' 'series of numbers' 'serie...
1  120        3  'series of numbers' 'series of numbers' 'serie...
2  110        6                                'series of numbers'
3  109        7  'series of numbers' 'series of numbers' 'serie...
4   79       10                                'series of numbers'

A: This will work:
df = df.sort_values(['id'])
       .groupby('id', sort=False).details
       .apply(''.join)


text:
Q: Converting uint8_t data to AVFrame with FFmpeg I am currently working in C++ with the Autodesk 3DStudio Max 2014 SDK (toolset 100) and the Ffmpeg library in Visual Studio 2015 and trying to convert a DIB (Device Independent Bitmap) to uint8_t pointer array and then convert these data to an AVFrame.
I don't have any errors, but my video is still black and without meta data.
(no time display, etc)
I made approximatively the same with a Visual Studio Console application to convert jpeg image sequence from disk and this is working fine.
(The only difference is that instead of converting jpeg to AVFrame with the Ffmpeg library, I try to convert raw data to an AVFrame.)
So I think the problem could be either on the DIB conversion to the uint8_t data or the uint8_t data to the AVFrame.
(The second is more plausible, because I used the SFML library to display a window with my rgb uint8_t* data for debuging and it is working fine.)
I first initialize the ffmpeg library :

This function is called once at the beginning.

int Converter::Initialize(AVCodecID codec_id, int width, int height, int fps, const char *filename)
{
    avcodec_register_all();
    av_register_all();

    AVCodec *codec;
    inputFrame = NULL;
    codecContext = NULL;
    pkt = NULL;
    file = NULL;
    outputFilename = new char[strlen(filename)]();
    *outputFilename = '\0';
    strcpy(outputFilename, filename);

    int ret;

    //Initializing AVCodecContext and getting PixelFormat supported by encoder
    codec = avcodec_find_encoder(codec_id);
    if (!codec)
        return 1;

    AVPixelFormat pixFormat = codec->pix_fmts[0];
    codecContext = avcodec_alloc_context3(codec);
    if (!codecContext)
        return 1;

    codecContext->bit_rate = 400000;
    codecContext->width = width;
    codecContext->height = height;
    codecContext->time_base.num = 1;
    codecContext->time_base.den = fps;
    codecContext->gop_size = 10;
    codecContext->max_b_frames = 1;
    codecContext->pix_fmt = pixFormat;

    if (codec_id == AV_CODEC_ID_H264)
        av_opt_set(codecContext->priv_data, "preset", "slow", 0);

    //Actually opening the encoder
    if (avcodec_open2(codecContext, codec, NULL) < 0)
        return 1;

    file = fopen(outputFilename, "wb");
    if (!file)
        return 1;

    inputFrame = av_frame_alloc();
    inputFrame->format = codecContext->pix_fmt;
    inputFrame->width = codecContext->width;
    inputFrame->height = codecContext->height;

    ret = av_image_alloc(inputFrame->data, inputFrame->linesize, codecContext->width, codecContext->height, codecContext->pix_fmt, 32);

    if (ret < 0)
        return 1;

    return 0;
}

Then for each frame, I get the DIB and convert to a uint8_t* it with this function :
uint8_t* Util::ToUint8_t(RGBQUAD *data, int width, int height)
{
    uint8_t* buf = (uint8_t*)data;

    int imageSize = width * height;
    size_t rgbquad_size = sizeof(RGBQUAD);
    size_t total_bytes = imageSize * rgbquad_size;
    uint8_t * pCopyBuffer = new uint8_t[total_bytes];

    for (int x = 0; x < width; x++)
    {
        for (int y = 0; y < height; y++)
        {
            int index = (x + width * y) * rgbquad_size;
            int invertIndex = (x + width* (height - y - 1)) * rgbquad_size;

            //BGRA to RGBA
            pCopyBuffer[index] = buf[invertIndex + 2];
            pCopyBuffer[index + 1] = buf[invertIndex + 1];
            pCopyBuffer[index + 2] = buf[invertIndex];
            pCopyBuffer[index + 3] = 0xFF;
        }
    }

    return pCopyBuffer;
}

void GetDIBBuffer(Interface* ip, BITMAPINFO *bmi, uint8_t** outBuffer)
{
    int size;

    ViewExp& view = ip->GetActiveViewExp();

    view.getGW()->getDIB(NULL, &size);

    bmi = (BITMAPINFO *)malloc(size);
    BITMAPINFOHEADER *bmih = (BITMAPINFOHEADER *)bmi;
    view.getGW()->getDIB(bmi, &size);

    uint8_t * pCopyBuffer = Util::ToUint8_t(bmi->bmiColors, bmih->biWidth, bmih->biHeight);

    *outBuffer = pCopyBuffer;
}

This function is used to get the DIB :
void GetViewportDIB(Interface* ip, BITMAPINFO *bmi, BITMAPINFOHEADER *bmih, BitmapInfo biFile, Bitmap *map)
{
    int size;

    if (!biFile.Name()[0])
        return;

    ViewExp& view = ip->GetActiveViewExp();

    view.getGW()->getDIB(NULL, &size);

    bmi = (BITMAPINFO *)malloc(size);
    bmih = (BITMAPINFOHEADER *)bmi;

    view.getGW()->getDIB(bmi, &size);

    biFile.SetWidth((WORD)bmih->biWidth);
    biFile.SetHeight((WORD)bmih->biHeight);
    biFile.SetType(BMM_TRUE_32);

    map = TheManager->Create(&biFile);
    map->OpenOutput(&biFile);
    map->FromDib(bmi);
    map->Write(&biFile);
    map->Close(&biFile);
}

And after the conversion to AVFrame and video encoding :

The EncodeFromMem function is call each frame.

int Converter::EncodeFromMem(const char *outputDir, int frameNumber, uint8_t* data)
{
    int ret;

    inputFrame->pts = frameNumber;
    EncodeFrame(data, codecContext, inputFrame, &pkt, file);

    return 0;
}

static void RgbToYuv(uint8_t *rgb, AVCodecContext *c, AVFrame *frame)
{
    struct SwsContext *swsCtx = NULL;
    const int in_linesize[1] = { 3 * c->width };// RGB stride
    swsCtx = sws_getCachedContext(swsCtx, c->width, c->height, AV_PIX_FMT_RGB24, c->width, c->height, AV_PIX_FMT_YUV420P, 0, 0, 0, 0);
    sws_scale(swsCtx, (const uint8_t * const *)&rgb, in_linesize, 0, c->height, frame->data, frame->linesize);
}

static void EncodeFrame(uint8_t *rgb, AVCodecContext *c, AVFrame *frame, AVPacket **pkt, FILE *file)
{
    int ret, got_output;

    RgbToYuv(rgb, c, frame);

    *pkt = av_packet_alloc();
    av_init_packet(*pkt);
    (*pkt)->data = NULL;
    (*pkt)->size = 0;

    ret = avcodec_encode_video2(c, *pkt, frame, &got_output);
    if (ret < 0)
    {
        fprintf(stderr, "Error encoding frame/n");
        exit(1);
    }
    if (got_output)
    {
        fwrite((*pkt)->data, 1, (*pkt)->size, file);
        av_packet_unref(*pkt);
    }
}

To finish I have a function that write the packets and free the memory :
This function is called once at the end of the time range.
int Converter::Finalize()
{
    int ret, got_output;
    uint8_t endcode[] = { 0, 0, 1, 0xb7 };

    /* get the delayed frames */
    do
    {
        fflush(stdout);
        ret = avcodec_encode_video2(codecContext, pkt, NULL, &got_output);
        if (ret < 0)
        {
            fprintf(stderr, "Error encoding frame/n");
            return 1;
        }
        if (got_output)
        {
            fwrite(pkt->data, 1, pkt->size, file);
            av_packet_unref(pkt);
        }
    } while (got_output);

    fwrite(endcode, 1, sizeof(endcode), file);
    fclose(file);

    avcodec_close(codecContext);
    av_free(codecContext);

    av_frame_unref(inputFrame);
    av_frame_free(&inputFrame);
    //av_freep(&inputFrame->data[0]); //Crash

    delete outputFilename;
    outputFilename = 0;

    return 0;
}

EDIT :
I modify my RgbToYuv function and create another one to convert back the yuv frame to an rgb one.
This not really solve the problem, but maybe focus the problem on the conversion from YuvToRgb.
This is the result of the conversion from YUV to RGB :
![YuvToRgb result]: https://img42.com/kHqpt+
static void YuvToRgb(AVCodecContext *c, AVFrame *frame)
{
    struct SwsContext *img_convert_ctx = sws_getContext(c->width, c->height, AV_PIX_FMT_YUV420P, c->width, c->height, AV_PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL);
    AVFrame * rgbPictInfo = av_frame_alloc();
    avpicture_fill((AVPicture*)rgbPictInfo, *(frame)->data, AV_PIX_FMT_RGB24, c->width, c->height);
    sws_scale(img_convert_ctx, frame->data, frame->linesize, 0, c->height, rgbPictInfo->data, rgbPictInfo->linesize);

    Util::DebugWindow(c->width, c->height, rgbPictInfo->data[0]);
}
static void RgbToYuv(uint8_t *rgb, AVCodecContext *c, AVFrame *frame)
{
    AVFrame * rgbPictInfo = av_frame_alloc();
    avpicture_fill((AVPicture*)rgbPictInfo, rgb, AV_PIX_FMT_RGBA, c->width, c->height);

    struct SwsContext *swsCtx = sws_getContext(c->width, c->height, AV_PIX_FMT_RGBA, c->width, c->height, AV_PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL);
    avpicture_fill((AVPicture*)frame, rgb, AV_PIX_FMT_YUV420P, c->width, c->height);
    sws_scale(swsCtx, rgbPictInfo->data, rgbPictInfo->linesize, 0, c->height, frame->data, frame->linesize);

    YuvToRgb(c, frame);
}


text:
Q: Progress Bar Increment/Decrement I need some help with the progress bar from semantic UI. I'm trying to replicate the first example with the increment/decrement button, but for the life of me, can't get it to work, any help on this matter or sample with Javascript code would be greatly appreciated.

A: The code for that page is located here, and you are looking at this section in particular:
$buttons
  .on('click', function() {
    var
      $progress = $(this).closest('.example').find('.ui.progress')
    ;
    if( $(this).hasClass('increment') ) {
      $progress.progress('increment');
    }
    else {
      $progress.progress('decrement');
    }
  })
;

As you can see, each button is added a click event. Then, $progress get assigned to the closest found progress bar. Finally, we check for the class of the button (to know if it is in/decrement) and the .progress value gets used accordingly.
While we are at it, here's the HTML they use for the buttons:


text:
Q: Error SQL NO result rows in set. when i input from postman with json it has error result in a rows var (
    newServices                                                                                *models.UpsertIntoServices
    companyCode, serviceCode, approvalEmail, approvalName, coApprovalEmail, coApprovalName, technicianEmail, technicianName string
    departmentApproval, companyApproval, xapiensApproval, isActual, isMinus                                                 bool
    id                                                                                uint
)

tx, txErr := s.db.Begin()
if txErr != nil {
    return newServices, txErr
}

qapi := `
insert into company_services
    (company_code, service_code, department_approval, company_approval, xapiens_approval, approval_email, approval_name, co_approval_email,technician_email, co_approval_name, technician_name, is_actual, is_minus)
    values
        ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
    on conflict (company_code, service_code)
do update set company_code =excluded.company_code, service_code =excluded.service_code;
`

//insert data into new_services
sqlErr := tx.QueryRowContext(ctx, qapi, data.CompanyCode, data.ServiceCode, data.DepartmentApproval, data.CompanyApproval, data.XapiensApproval, data.ApprovalEmail, data.ApprovalName, data.CoApprovalEmail, data.TechnicianEmail, data.CoApprovalName, data.TechnicianName, data.IsActual, data.IsMinus).Scan(
    &id,
    &companyCode,
    &serviceCode,
    &departmentApproval,
    &companyApproval,
    &xapiensApproval,
    &approvalEmail,
    &approvalName,
    &coApprovalEmail,
    &technicianEmail,
    &coApprovalName,
    &technicianName,
    &isActual,
    &isMinus,
)

// checking if its rows has any errors but no result here
if sqlErr != nil {
    tx.Rollback()
    log.Println("sql Error on Repository Upsert Flagging", sqlErr)
    return newServices, sqlErr
}

// commit transaction query
txErr = tx.Commit()
if txErr != nil {
    return newServices, txErr
}

A: Use ExecContext to execute insert/update query. Try the below code
 var (
    newServices                                                                                *models.UpsertIntoServices
    companyCode, serviceCode, approvalEmail, approvalName, coApprovalEmail, coApprovalName, technicianEmail, technicianName string
    departmentApproval, companyApproval, xapiensApproval, isActual, isMinus                                                 bool
    id                                                                                uint
)

tx, txErr := s.db.Begin()
if txErr != nil {
    return newServices, txErr
}

qapi := `
insert into company_services
    (company_code, service_code, department_approval, company_approval, xapiens_approval, approval_email, approval_name, co_approval_email,technician_email, co_approval_name, technician_name, is_actual, is_minus)
    values
        ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
    on conflict (company_code, service_code)
do update set company_code =excluded.company_code, service_code =excluded.service_code;
`

//insert data into new_services
result, sqlErr := tx.ExecContext(ctx, qapi, data.CompanyCode, data.ServiceCode, data.DepartmentApproval, data.CompanyApproval, data.XapiensApproval, data.ApprovalEmail, data.ApprovalName, data.CoApprovalEmail, data.TechnicianEmail, data.CoApprovalName, data.TechnicianName, data.IsActual, data.IsMinus)

// checking if its rows has any errors but no result here
if sqlErr != nil {
    tx.Rollback()
    log.Println("sql Error on Repository Upsert Flagging", sqlErr)
    return newServices, sqlErr
}
//You can know lastInsertId and affectedRows
lastInsertId, _ := result.LastInsertId()
affectedRowsCnt,_ :=  result.RowsAffected()
fmt.Println(lastInsertId,affectedRowsCnt)

// commit transaction query
txErr = tx.Commit()
if txErr != nil {
    return newServices, txErr
}


text:
Q: Is there a way to keep the application switcher active on the screen all time? I like the way it works. I like the way it looks. It could be more better If i can keep the application switcher on screen all time, not only when pressing Alt+Tab, and switch apps using mouse click on it.
Is there a way to do it in a safe way? I don't want to use Compiz Settings Wizard. Is there a way doing it using Dconf Editor? I feel it more safer.
Heres the Image what I was indicating:

A: AFAIK this is not possible. You can switch your applications easily by pressing the icon on the launcher to the left. Isn't an application switcher annoying which appears permanently in front of all windows?

A: Okay ! here what I have done. There's a alternative to what I have asked, that is "GLX Dock". You can use that.
By setting its appearance to transparent and using right theme you can achieve a second launcher at any where on your desktop.
Look at the buttom of my desktop. That is what I'm talking. You can install "GlX dock" from Ubuntu Software Center. Go there and install it.
Under settings menu you can find the option to place it any where on the desktop. You can do it by setting the "Position" and the "margin" value.

A: Ubuntu 12.04

*

*Startup System Settings

*Click Appearance

*Click the tab Behavior

*Slide the bar for "Auto-hide Launcher" to OFF


text:
Q: SkImageDecoder::Factory returned null where downloading image in list adapter I have a custom ListAdapter. I want to download image for every list item. I try to download them in AsyncTask (I found this solution in other discuss on so), but for some reason I always receive communicate "SkImageDecoder::Factory returned null"
public class MainMenuListAdapter extends BaseAdapter {

private List<Event> _events;
private Context _activityContext;

public MainMenuListAdapter(List<Event> events, Context context) {
    this._events = events;
    this._activityContext = context;
}

@Override
public int getCount() {
    return this._events.size();
}

@Override
public Object getItem(int position) {
    return this._events.get(position);
}

@Override
public long getItemId(int position) {
    return this._events.get(position).getId();
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if(convertView==null)
    {
        LayoutInflater inflater = (LayoutInflater) this._activityContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.mainmenu_list_item, parent,false);
    }

    Event e = (Event)getItem(position);

    new DownloadImageTask((ImageView)convertView.findViewById(R.id.imageView1))
            .execute("http://java.sogeti.nl/JavaBlog/wp-content/uploads/2009/04/android_icon_256.png");

    TextView tvName = (TextView)convertView.findViewById(R.id.name);
    tvName.setText(e.getName());
    TextView tvDescription = (TextView)convertView.findViewById(R.id.description);
    tvDescription.setText(e.getDescription());
    TextView tvDate = (TextView)convertView.findViewById(R.id.date);
    tvDate.setText(e.getDate());
    TextView tvAddress = (TextView)convertView.findViewById(R.id.address);
    tvName.setText(e.getAddress());

    return convertView;
}

private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
    ImageView bmImage;

    public DownloadImageTask(ImageView bmImage) {
        this.bmImage = bmImage;
    }

    protected Bitmap doInBackground(String... urls) {
        String urldisplay = urls[0];
        String uri = Uri.parse(urldisplay)
                .buildUpon()
                .appendQueryParameter("key", "val")
                .build().toString();

        Bitmap mIcon11 = null;
        try {
            URL url = new URL(uri);
            InputStream in  = url.openStream();
            mIcon11 = BitmapFactory.decodeStream(in);

            return mIcon11;
        } catch (Exception e) {
            Log.e("Error", e.getMessage());
            e.printStackTrace();
        }
        return mIcon11;
    }

    protected void onPostExecute(Bitmap result) {
        bmImage.setImageBitmap(result);
    }
}
}


text:
Q: Avoiding row-wise processing of data.frame in R I was wondering what the best way is to avoid row-wise processing in R, most of row-wise stuff is done in internal C routines. For example: I have a data frame a:
  chromosome_name start_position end_position strand
1              15       35574797     35575181      1
2              15       35590448     35591641     -1
3              15       35688422     35688645      1
4              13       75402690     75404217      1
5              15       35692892     35693969      1

What I want is: based on whether strand is positive or negative, startOFgene as start_position or end_position. One way to avoid for loop will be to separate data.frame with +1 strand and -1 strand and perform selection. What can be other way for speed up? The method does not scale-up if one has certain other complicated processing per row.

A: Maybe this is fast enough...
transform(a, startOFgene = ifelse(strand == 1, start_position, end_position))

  chromosome_name start_position end_position strand startOFgene
1              15       35574797     35575181      1    35574797
2              15       35590448     35591641     -1    35591641
3              15       35688422     35688645      1    35688422
4              13       75402690     75404217      1    75402690
5              15       35692892     35693969      1    35692892

A: First, since all your columns are integer/numeric, you could use a matrix instead of a data.frame.  Many operations on a matrix are a lot faster than the same operation on a data.frame, even though they're not very different in this case.  Then you can use logical subsetting to create the startOFgene column.
# Create some large-ish data
M <- do.call(rbind,replicate(1e3,as.matrix(a),simplify=FALSE))
M <- do.call(rbind,replicate(1e3,M,simplify=FALSE))
A <- as.data.frame(M)
# Create startOFgene column in a matrix
m <- function() {
  M <- cbind(M, startOFgene=M[,"start_position"])
  negStrand <- sign(M[,"strand"]) < 0
  M[negStrand,"startOFgene"] <- M[negStrand,"end_position"]
}
# Create startOFgene column in a data.frame
d <- function() {
  A$startOFgene <- A$start_position
  negStrand <- sign(A$strand) < 0
  A$startOFgene[negStrand] <- A$end_position[negStrand]
}
library(rbenchmark)
benchmark(m(), d(), replications=10)[,1:6]
#   test replications elapsed relative user.self sys.self
# 2  d()           10  18.804    1.000    16.501    2.224
# 1  m()           10  19.713    1.048    16.457    3.152


text:
Q: select multiple options without holding CTRL Is it possible to make LeftMoust & SmartDevices clicks automatically multi-select the options without the need of holding Ctrl, Using HTML and CSS only?
<select multiple>
    <option>Value1</option>
    <option>Value2</option>
    <option>Value3</option>
    <option>Value4</option>
</select>


text:
Q: problems to deploy a java application I just finished a Java application to link to Sicstus prolog. Now I need to deploy it but I'm having the following problem, the Sicstus library to link with Java requires that the application be called with the following sintax:
java -classpath=path/to/sicstus/installation/dir -jar /path/to/jarfile.jar

I'm deploying a .sh or .bat file but the user has to edit it manually and state where the sicstus installation directory is. How can I avoid that?
I'm really stuck here. I've tried a couple of installers builders like JSmooth and GlassWorks but those doesn't fix my problem. Any idea?
Joshua.

A: Use IzPack in order to create installers. With this you gain the ability to install an application in the desired directory.
http://izpack.org
Furthermore you can also parse the bat file to point the installation directory by doing the following:
Create a bat file like this run.bat:
java -classpath=$INSTALL_PATH/lib/alib.jar  -jar $INSTALL_PATH/bin/myapp.jar

And specify the following in the install.xml:
<pack name="Base" required="yes">
        <file src="run.bat" targetdir="$INSTALL_PATH" override="true" />
                <parsable targetfile="$INSTALL_PATH/run.bat"/>
</pack>

This will parse the bat and replace it with the installation directory.


text:
Q: Django: Use different serializers for different (inherited) models in one endpoint I have this models (for ilustration only):
class Customer(models.Model):
    created = models.DateTimeField(auto_now_add=True)

class Person(Customer):
    first_name = models.CharField(max_lenght=40)
    last_name = models.CharField(max_length=40)
    # More data related to a person

class Company(Customer):
    company_name = models.CharField(max_length=100)
    # More data related to a company

As you can see, I can have two "types" of customers, but they are both "customers" (I think this is a textbook example of inheritance). Everything works fine at the database level, but now I need to create an endpoint that will "dinamically" show the customer data based on which "type" of customer it is. Something like this:
[
    {
        "id": 1,
        "first_name": "John",
        "last_name": "Doe"
    },
    {
        "id": 2,
        "company_name": "Big buck"
    },
    {
        "id": 3,
        "first_name": "Jane",
        "last_name": "Doe"
    }
]

When working within my project, I use things like:
customer = Customer.objects.get(pk=100)
if hasattr(customer, 'person'):
   pass # Do some stuff
elif hasattr(customer, 'company'):
   pass # Do some other stuff
# Do common stuff related to both customer 'types'

So far, I've managed to work around by using different endpoints for "Person" and "Company" customers, but now I need to get both "types" of customers in a single endpoint. And I can't figure out how to write a serializer to get this!
Looking around I found this example for using polymorphic models, however, since the project is quite big now, I'd like to keep things as "vanila" as possible. So my specific questions are:

*

*Is there a way to create a "polymorphic" serializer using the above model definition?

*If django-polymorphic (and django-rest-polymorphic) are the way to go, will using them break the functionallity?


text:
Q: Zimbra Alternative Open source application I'm looking for an open source alternative for zimbra which supports outlook and thunderbird as pop and smtp clients. I don't need collaboration suite.
If anyone can suggest or share their experience on MTA?
Thanks.

A: Check out this ServerFault thread titled "Exchange server replacement that runs on Linux"
Assuming you want one that runs on Linux, you have

*

*Kerio

*Scalix

*OpenXchange

*Kolab

*Linagora

*Zarafa

*Communigate Pro (Not open, but hey...)

And more that remain to be explored. If the server support open standards like SMTP and POP3, then there will be no problem with using Outlook, Thunderbird or any other standard client.

A: MTA is Mail Transfer Agent (SMTP portion). MTA is maybe 5% of what Zimbra does.
I've been using Cyrus IMAP & POP for years, works great with both Outlook and Thunderbird.

A: Without a collab suite, all you need is a simple MTA and POP/IMAP server, plus maybe a management GUI for it all. A typical solution is postfix and Cyrus, with the addition of ISPconfig and the likes.


text:
Q: signup GUI with steps I am working on a signup GUI and the process of signup include two steps (hence, two "screens").
Would you create two activities for that cause? or would you manipulate the UI in order to give that impression?
What is the best practice?

A: There's a number of ways you can approach this. You can make two activities and use putExtra() to send data between them. You can also use fragments to have different parts of the form appear when you need them.

A: I dont prefer manipulating the UI. It will unnecessarily clutter the code. So better you can go with multiple activities or fragments with a smooth transition.
Also check about ViewPager.


text:
Q: App communication to iOS safari via cookies or whatever? Am new to iphone dev.
I want authenticate a user before he goes to real portal through safari. I heard that we can not access safari;s cookies space to add a cookie...
this is not working as well, may be can not run javascript... url in safari
Setting a cookie in an iPhone App
any workaround..
thanks
us

A: Why don't you use a PHP script, create a session that will timeout in idk 2 minutes? and use that to authenticate

A: If you control the website's protocol, you could pass information from an app to Safari by embedding it in the URL that the app uses to launch Safari, and have the site pass it back to Safari.


text:
Q: Discord Bot leave the VC after X Seconds with Discord.js Heyy,
Im building a Discord Bot for do some practice with Node.js and Discord.js. With this bot you can do the command ?audio audio and it will reproduce a audio.
I want to set that the bot after 20 seconds of not playing anything leave the Voice Channel. I did it with the function setTimeout() but when I want to listen another audio the bot leave the channel before the audio finish.
The problem is obv the setTimeout() but idk how to fix it.
Here's my code.
    execute(message, args, CanaleVocale, AudioFiles) {
        let inactive
        let name = args[1] + ".mp3";
        console.log("[Command] ?audio " + message.author.id)
        if (!CanaleVocale) {
            message.channel.send("Il Koala e' confuso, non ti vede in nessun canale vocale :( ")
            console.log(`[Voice] The user ${message.author.id} isn't in a voice channel` )
        } else {
            if (AudioFiles.includes(name)) {
                CanaleVocale.join()
                .then(connection => {
                    clearTimeout(inactive)
                    inactive = undefined
                    connection.voice.setSelfDeaf(true);
                    connection.play(`./audio/${name}`)
                    console.log(`[Voice] Played the sound ${name} for the user ${message.author} `)
                    inactive = setTimeout(function(){
                        CanaleVocale.leave()
                        console.log(`[Voice] Left from the channel of ${message.author.id}`)
                        message.channel.send("Il Koala e' annoiato e quindi esce dalla chat vocale")
                    }, 20*1000)
                })
            } else {
                message.channel.send(`L'audio ${name} non esiste!`)
                console.log(`[Voice] The user ${message.author} tried to play ${name} but it doesn't exist!`)
            }

        }
    }
}

If you need the entire project, it is uploaded on GitHub, "KoalaBot" by EnderF5027
(Probably the code is ugly, im learning and if you want to, you can give me some suggestions :D )
Can someone help me ?
Thank you

A: I attach my code for example.
I handle not file base, only youtube with ytdl.
So, It could be differect with questions.
I handle joined channels with Map() Object.
// message.guild.id = '1234567812345678'
const queue = new Map();

// 1. set new queue
const queueContruct = {
  textChannel: message.channel,
  voiceChannel: voiceChannel,
  connection: null,
  songs: [],
  search: [],
  volume: 5,
  playing: true,
  leaveTimer: null /* 20 seconds in question */
};
queue.set('1234567812345678', queueContruct);

// 2. get queueContruct from queue
const serverQueue = queue.get('1234567812345678');
if(!serverQueue) { /* not exist */ }

// 3. delete from queue
queue.delete('1234567812345678');

I set timer with setTimeout when play-list is empty
and unset with clearTimeout when new play-list is come in.
Under is a piece of my code.
I wish this will be helpful.
const Discord = require('discord.js');
const bot = new Discord.Client();
const queue = new Map();
const prefix = "?"; // this prefix is in Question.

bot.on("message", async message => {
  // if direct-message received, message.guild could be null
  // Not handle that case.
  const serverQueue = queue.get(message.guild.id);

  if(message.content.startsWith(`${prefix}audio`)) {
    execute(message, serverQueue);
  }
});

// I assume user message is "?audio audioName"
function execute(message, serverQueue) {
  const audioName = message.content.split(' ')[1]; // "audioName"

  // check user who send message is in voiceChannel
  const voiceChannel = message.member.voice.channel;
  if(!voiceChannel) {
    return message.channel.send("YOU ARE NOT IN VOICE CHANNEL");
  }

  // check permission
  const permissions = voiceChannel.permissionsFor(message.client.user);
  if (!permissions.has("CONNECT") || !permissions.has("SPEAK")) {
    return message.channel.send("PERMISSION ERROR");
  }

  /*
    I handle only songs with google youtube api
    So, I skip how to get & push song information
  */

  if(!serverQueue) {
    // create new serverQueue

    const queueContruct = {
      textChannel: message.channel,
      voiceChannel: voiceChannel,
      connection: null,
      songs: [],
      search: [],
      volume: 5,
      playing: true
    };

    queue.set(message.guild.id, queueContruct);

    // "song" value is one of play list in my case
    // var song = {title: 'audioName', url: 'youtube-url'};
    queueContruct.songs.push(song);

    try {
      var connection = await voiceChannel.join();
      queueContruct.connection = connection;
      playStart(message.guild, queueContruct.songs[0]);
    } catch (err) {
      queue.delete(message.guild.id);
      return message.channel.send(err);
    }
  }
  else { // exist serverQueue
    // "song" value is one of play list in my case
    // var song = {title: 'audioName', url: 'youtube-url'};
    serverQueue.songs.push(song);

    if(serverQueue.songs.length == 1) {
      playStart(message.guild, serverQueue.songs[0]);
    }
  }
}

function play(guild, song) {
  const serverQueue = queue.get(guild.id);
  if(!song) {
    if(serverQueue.songs.length == 0) {
      serverQueue.leaveTimer = setTimeout(function() {
        leave_with_timeout(guild.id);
      }, 20 * 1000); // 20 seconds is for follow question
    }
    return;
  }

  // clear timer before set
  try {
    clearTimeout(serverQueue.leaveTimer);
  } catch(e) {
    // there's no leaveTimer
  }

  const dispatcher = serverQueue.connection
    .play(ytdl(song.url))
    .on('finish', () => {
      serverQueue.songs.shift(); // pop front
      play(guild, serverQueue.songs[0]); // play next
    })
    .on('error' error => console.log(error));
  dispatcher.setVolumeLogarithmic( 1 );
  serverQueue.textChannel.send(`Play Start ${song.title}`);
}

function leave_with_timeout(guild_id) {
  const serverQueue = queue.get(guild_id);
  if(serverQueue) {
    serverQueue.textChannel.send(`20 seconds left. Bye!`);
    serverQueue.voiceChannel.leave();
    queue.delete(guild_id);
  }
}


text:
Q: Parentheses in Block Brackets in RegEx I need a RegEx that matches the following:
(whatever)   3.4  Temp
(whatever)   7.8  Name
(whatever)  10.0  Other Name

Basically, it has to match whatever in the beginning, and then either two spaces, two digits, a dot and a digit or three spaces, one digit, a dot, and a digit, followed by two spaces and whatever.
This is easily matched with this RegEx:
.*?  [\s|\d]\d\.\d  .*?

However, I want to extract the decimal number and whatever's after it using a backreference.  I was trying
.*?  [\s(\d\.\d)|(\d\d\.\d)]  (.*?)

However, referring to it with \1,\2 doesn't work, I think because the parentheses I'm referring to are in the optional square brackets with the '|' symbol. Is there a solution?

A: Sure, just pull the space out of the character class.
.*?\s+([\d.]+)

However since \d is literally [0123456789.], just drop the character class. And since .*? will match those leading spaces too, drop the \s too!
.*?(\d+)


text:
Q: A scalable function for get boundary vertices in a graph Given a community division I need a list of vertices that have edges in more than one community, i.e., boundary vertices.
I've tried this:
import igraph
import time

if __name__ == "__main__":
    g = igraph.Nexus.get("condmatcollab2005")

    tic = time.clock()
    cl = g.community_fastgreedy()
    membership = cl.as_clustering().membership
    print "community time: "+str(time.clock() - tic)

    # --> Do I need to leave this part more faster =======
    tic = time.clock()
    boundary = []
    visited = set()
    for vertex in g.vs():
        if vertex.index in visited: continue
        for neighbor in g.neighbors(vertex.index):
            if membership[vertex.index] != membership[neighbor]:
                boundary.append(vertex.index)
                visited.add(vertex.index)
                if neighbor not in visited:
                    boundary.append(neighbor)
                    visited.add(neighbor)
                break
    print "boundary time: "+str(time.clock() - tic)

This implementation is very slow. I don't if there is a faster way or more cleaner to do this.
E.g., maybe there is a faster way by using the cl.as_clustering() object or other data structure more efficient.
I need some help with how to optimize my code! Do I need to leave my code more faster.

A: The VertexClustering object returned by cl.as_clustering() has a crossing() method - this gives you a Boolean vector which contains True for edges that are between clusters and False for edges that are within a cluster. You can easily extract the indices of the crossing edges like this:
cl = g.community_fastgreedy().as_clustering()
crossing_edges = [index for index, is_crossing in enumerate(cl.crossing()) if is_crossing]

Then you can simply take each edge and put its endpoints in a set:
boundary = set()
for edge in g.es[crossing_edges]:
    boundary.update(edge.tuple)


text:
Q: Angular2 - Http create json from empty response Hello I have this code:
save<T>(url: string, data:any, headers = null): Observable<T>{
return this.http
            .post(url, data, headers)
            .map(x =>{
                return x.json() as T
            } )
            .catch(error => {
                this.app.handleError(error, errorMessage);
                return Observable.throw(error);
            }).share();
}

And when i send request to action which return empty response (_body: "")
I have error SyntaxError: Unexpected end of JSON input in x.json()
How to check when body isnt empty? Thank you

A: Try this
.map(x =>{
  return (x._body ? x.json() : null) as T
})

A: Test this,
.map(x =>(x._body ? x.json() : null) as T)


text:
Q: Is it a good practice use Django integrated web server behind a proxy? I implement a Django website behind a NGINX configured as reverse proxy which serve also the static for Django when it is out of debug mode, all this is in a docker-compose app.
I know by read the Django docs they do not recommend to use integrated web server in a production environment (and it is not at the moment), put it behind a reverse proxy is acceptable to avoid security issue or it is the same as expose it directly?
If it is not an acceptable solution, could you suggest any implementation to not use the Django integrated web server?
Consider that the container structure like the following:

*

*Proxy is the NGINX Official image

*www1 & www2 are Python3 Official image with Django installed as described here.

*database is the Postgres Official image.

Only the Proxy container is exposed to the external world.
Thanks.

A: I get my answer, I gonna use gunicorn instead the integrated Django web browser.
I had use documentation present here That describe how to configure gunicorn and nginx on the same host, but using http instead linux socket, instead the command to run the Django integrate web server I have just to run gunicorn like this:
gunicorn --workers=4 --bind=0.0.0.0:9000 --access-logfile - --error-logfile - --log-level debug myapp.wsgi:application

with the previous command I also get logs managed by container.
Off course I also add gunicorn in the requirement file.
I hope this question will help also some one else.


text:
Q: ARC Weak References when building message error When i build my Ionic App with Capacitor in iOS, i get this error :
ARC Weak References
- Cannot create weak reference in file using manual reference counting
Xcode message erro ARC Weak References
The error seems to be from Cordova Plugins but i use Capacitor.
I try to reinstall the environnement and project several times, but still blocked since one week.
Thank you very much

A: I had exactly the same error and I fixed it like this :

*

*In your Project Navigator (Xcode), one click on Pods

*In the second tab, one click on Targets -> CordovaPlugins

*Do the same thing that you did for your main project (App), change "Weak Reference in Manual Retain Release" to Yes.

*Build

It depends on your build results but after that, I had to replace in a CordavaPlugins file the type of a value. It was "__weak ...." and I replace with "__strong ....".

A: The first time, I go with the way from here: https://stackoverflow.com/a/62679942/1979190
But this way will lead to many issues as EXC_BAD_ACCESS because some Cordova Plugins do not support that way.
My teammate found a way to resolve this issue.
The root cause is from Capacitor, I don't know why they set Compiler flags to -fno-objc-arc for all files from CordovaPlugins.
We just need to revert the Compiler flags to empty like this image below to avoid all error messages related to ARC Weak References.

But every time you run npx cap update or npx cap sync everything will be reset to -fno-objc-arc ^^.
So we need to write a script to set Compiler flags to empty for all files from CordovaPlugins after we run these commands.
We will add this script below Podfile (ios/App/Podfile) to do the job.
post_install do |installer|
  installer.pods_project.targets.each do |target|
    if ['CordovaPlugins'].include? target.name
      target.build_phases.each do |build_phase|
        if (build_phase.display_name.eql? "Sources")
          build_phase.files.each do |file|
              if (file.settings)
                settings = file.settings
                settings["COMPILER_FLAGS"] = ""
                file.settings = settings
              end
          end
        end
      end
    end
  end
end

Hope it help!


text:
Q: How to remove all rows and columns entirely with zeros in panda Dataframe i want all rows and columns filled with zeros entirely need to be removed.
but it is returning only this.
      Box_deatils    1    5
0           1  0.0  0.0
1           2  1.0  0.0
2           3  1.0  0.0
3           4  0.0  0.0
4           5  0.0  0.0
5           6  0.0  1.0
  Box_deatils    1    5
0           1  0.0  0.0
1           2  1.0  0.0
2           3  1.0  0.0
3           4  0.0  0.0
4           5  0.0  0.0
5           6  0.0  1.0

row removal is not happening only column is happening
Please help to find whats wrong below.
Soln=[[0. 0. 0. 0. 0. 0.]
     [1. 0. 0. 0. 0. 0.]
     [1. 0. 0. 0. 0. 0.]
     [0. 0. 0. 0. 0. 0.]
     [0. 0. 0. 0. 0. 0.]
     [0. 0. 0. 0. 1. 0.]]

    result=pd.DataFrame(Soln)

Final_result=result.loc[:,(result !=0).any(axis=0)]

print(Final_result)

Final_result=Final_result.loc[(Final_result !=0).any(axis=1)]

print(Final_result)

A: be careful with .loc an.iloc , they are not the same thing, more info here: loc and iloc in Pandas
I would use either "loc/iloc" approach or the .where approach, which I personally find easier:
df= df.where((df['column1'] != 0) & (df['column2'] != 0))

this worked for me in many cases.

A: As I understand, row filled with zeros is actually a row where
all "numeric-named" columns (in your case 1 and 5) have only zeros
(the value in Box_deatils (or Box_details) column doesn't matter).
To do it, you can run:
df.drop(df.index[df.iloc[:, 1:].eq(0).all(axis=1)], inplace=True)

and df now contains:
   Box_deatils    1    5
1            2  1.0  0.0
2            3  1.0  0.0
5            6  0.0  1.0


text:
Q: JavaFX AnchorPane Constraints invisible As mentioned in title, I tried to mess today with JavaFX, but encountered a problem: anchorpane constraints are in tab, which content is invisible for me. Any clues how to fix it?
Manjaro with Intellij.

A: There is no way to make anchorpane constraints visible in scenebuilder for JavaFX.


text:
Q: How to allocate more processor power to my (Ubuntu-based) Virtualbox system in Windows 7? I have installed an 32-bit Ubuntu based Linux OS,  Elementary, on a VirtualBox installed in Windows 7 (32 bit) , on a 64-bit laptop which has a 2-core Intel i3-2330 CPU @2.20Ghz, and 4GB RAM (2.45 usable).
I have allocated 1.2 GB RAM to the virtual system and left the CPU allocation default. The VM processor setting looks like so:

The Linux VM system is too slow.
Looking at the Task Manager in Win7 and at System Monitor in Linux, I can see that this is probably not because of the amount of RAM used, but because the virtual Linux has too little processor power. In Windows, VirtualBox takes 25% of CPU power and only about 160 MB of RAM (summing up the 4 instances that I see). In Linux, not even half of the 1.2 GB of RAM are normally used, while the CPU resources seem used 100% all the time.
Can I allocate more CPU resources to the VM? How to do that? Can I do that for the system that is already installed in VM or should I re-install the virtual OS?
CPU-Z displays this about the CPU in Windows:

My purpose is to use the Linux from time to time while not using Windows 7, so, I would prefer VirtualBox to take more of the CPU resourses from Windows, because I will not be needing those when using the VM. (I am aware that my purpose would be suited better with a dual-boot installation of the Linux system, but the GPU on this laptop doesn't have the proper drivers in Linux: it heats up so hard that the computer is shut down before the Linux is even installed, or before installing the proper drivers etc.)

A: Getting a host computer that's running something better than an i3 would be the real answer (IMO). :)
Regardless of that...
The reason it's using 25% at most is because your i3 has 2 cores, but 4 threads, so the host sees it as 4 processors.
The VM is set to use only one of them, up to 100%, so when it's maxed out it's using only 25% of the total CPU power of the host.
For setting up VB to allow more than 1 virtual CPU, additional settings need to be configured:

*

*enable I/O APIC in the Motherboard settings tab

*enable hardware virtualization (VT-x/AMD-V) in the Acceleration tab

To avoid problems, don't set it any higher than your number of PHYSICAL cores; so in your case, don't try to use more than 2 virtual CPUs.

You should not configure virtual machines to use more CPU cores than you have available physically (real cores, no hyperthreads).

*

*Quote source

*Additional settings source
If the Acceleration options are not available, ensure you have enabled virtualization technology in your BIOS.


text:
Q: OnClick() event in dropdown I have a dropdown menu. When I click on "Italian" in the dropdown, I want the content for Italian to show. Basically, what I want is to set the action to IT when I select Italian from the dropdown. How might I apprach this?
 <% action = Request.QueryString("action") %>

    <form name="contentchanger" action="/" method="post">
         <select name="flag" name="flag">
              <option value="Choose" selected="selected">Choose</option>
              <option value="italian" onclick="what code i should use here?">Italian</option>
         </select>
    </form>
    FR
    IT

    <%
    if action = "IT" Then
      Response.Write("
This is italian
")
    else if  action = "FR" Then
      Response.Write("
This is French
")
    end if
    end if
    %>

A: It is better to use onchange event on the select box. Onclick doesn't work well in all browsers. Bind a javascript function to the onchange event that changes the url of the a element (or redirect to the correct url if you want to change it instantly).
Something like this should work. I recomment using a javascript libary like jquery if you want to do more interactive client side functionality
changeLanguage()
<select onchange="changeLanguage(this.value)">
    <option value="Choose" selected="selected">Choose</option>
    <option value="IT" >Italian</option>
    <option value="FR" >France</option>
</select>

IT

Javascript:
function changeLanguage(language) {
    var element = document.getElementById("url");
    element.value = language;
    element.innerHTML = language;
}

Update:
Code I used for my test. This works in the most recent versions of chrome, firefox and ie.

<select onchange="changeLanguage(this.value)">
    <option value="Choose" selected="selected">Choose</option>
    <option value="IT" >Italian</option>
    <option value="FR" >France</option>
</select>

IT


text:
Q: Creating container usercontrol with design time support in WPF? I want to create a container usercontrol with design time support in WPF ? How can I do ?

A: If you want to have a container user control with design time support, you can create a  ContentControl http://msdn.microsoft.com/en-us/library/system.windows.controls.contentcontrol.aspx to host other user controls inside your container control.
You can expose the content control as a public property and then assign any other user controls you create to this property to display within the ContentControl. You would have the design time support of the parent control or any child user controls by default since they would all just be user controls.

A: Declare the following in your UserControl at the top:
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(IDesigner))]
public partial class ExpanderControl : UserControl

Required NameSpaces:
using System.ComponentModel;
using System.ComponentModel.Design;


text:
Q: youtube-dl gives errors: "command not found" I installed youtube-dl successfully via homebrew but cannot seem to invoke the program at all.
Here are the commands I tried:
> man youtube-dl
No manual entry for youtube-dl
> type -a youtube-dl
-bash: type: youtube-dl: not found
> man -aw youtube-dl
No manual entry for youtube-dl

My PATH looks as follows:
> echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin

When I try to list installed brew packages, I get:
brew list
-bash: brew: command not found

A: Your homebrew setup is broken. Can you reinstall it and then run brew doctor?
Then you will test the YouTube-dl and possibly reinstall that.
Most of the time you don't need to uninstall brew but the output of /opt/homebrew/bin/brew doctor will tell us what's up. Yours is in "opt" since you're on M1 (I hope).

*

*https://stackoverflow.com/a/36660313/475228

*https://docs.brew.sh/FAQ#how-do-i-uninstall-homebrew


text:
Q: Does Calling Result on an Async function cause block indefinitely? I am kinda new to C# from a heavy java background, and still trying to figure out how exactly await and async works, here's whats confusing me a lot:
Suppose I have a function likes this (Hackish code below is used for experiments only):
public static bool CheckInternetConnection()
{
    Task<bool> result = CheckInternetConnectionAsync();
    return result.Result;
}

public async static Task<bool> CheckInternetConnectionAsync()
{
    if (NetworkInterface.GetIsNetworkAvailable())
    {
        SomeClass details = await ReturnARunningTask();
        return details.IsSuccessful;
    }
    return false;
}

public Task<SomeClass> ReturnARunningTask()
{
    return Task.Run(() => checkInternet());
}

in the main execution thread, if I call this:
CheckInternetConnection();

It will block indefinitely, my assumption is that control leaves CheckInternetConnectionAsync() at the "await" keyword and blocks on ".Result". When await resumes, the main thread is already blocked and stays blocked
The reason for my assumption is that I can see the task finish and return, but the code after await is never executed
however, if I do this:
bool result = Task.Run(() => CheckInternetConnection()).Result;

then the code after the await statement is executed and main thread does continue
My expectation was that it will also block, because the main thread would be blocked on the intermediate task,. the intermediate task would be blocked on the .Result
so..what made the difference? What in this case the code after await gets executed?

A: In a UI environment you have a special single threaded SynchronizationContext that runs everything on the UI thread. That context is captured when you await a task and when the task completes the method resumes on that captured context (this can be configured using ConfigureAwait:
SomeClass details = await ReturnARunningTask().ConfigureAwait(false);

In your case when you use the Task.Result property on a not-completed task you are synchronously blocking the UI thread and so when the CheckInternetConnectionAsync tries to resume on the SynchronizationContext after ReturnARunningTask completed it can't. The UI thread is blocked waiting on the CheckInternetConnectionAsync task which in turn waits for the UI thread, hence deadlock (blocked indefinitely).
The difference when you use Task.Run(() => CheckInternetConnection()).Result; is that using Task.Run offloads work to be done on a ThreadPool thread. These threads don't have a SynchronizationContext and so while the UI thread is blocked on .Result the task can complete since it doesn't need the UI thread to do so.
Blocking on an asynchronous operation (sync over async) is discouraged since it blocks threads and makes the app less responsive and scalable and it can leads to deadlocks. You should instead use async-await all the way.

Note: Instead of doing "sync over async" you should have the synchronous version be synchronous and if you need an async version that offloads that CPU-intensive work to a different thread use Task.Run:
public static bool CheckInternetConnection()
{
    return checkInternet().IsSuccessful;
}

public async static Task<bool> CheckInternetConnectionAsync()
{
    if (NetworkInterface.GetIsNetworkAvailable())
    {
        return await Task.Run(() => CheckInternetConnection());
    }
    return false;
}


text:
Q: How to get substring after next ':' after a slice? I have a string that looks like this:
var string = 'foo:bar:1234:something:4321';

I want to return the section after bar: up until the next :. In this case I want "1234". The size can vary.
Here's what I have started, but am unsure how to specify the ending.
var newString = string.slice('bar:'.indexOf(), <HOW TO SPECIFY THE END?>);

EDIT
The string could also contain more values and colons so these are possible too:
var string = 'fu:bu:foo:bar:1234:something:4321';
var string = 'bar:1234:something:4321';

A: I'd use a regex:
// catch `bar:` at the beginning of the string, or
// :bar: elsewhere
var matches = string.match(/(?:^|:)bar:([^:]+):/);

var newString = matches[1];

var string = 'foo:bar:1234:something:4321';

var matches = string.match(/(?:^|:)bar:([^:]+):/);

var newString = matches[1];

console.log(newString);

string = 'bar:1234:something:4321';

console.log(newString);

A: function getBarValue(str) {
    var splitString = str.split('bar:'); // make this `:bar:` if foobar: is an issue

    if (splitString.length < 2) {
        return null; // "bar:" does not exist in string
    }

    return splitString[1].substring(0, splitString[1].indexOf(':'));
}

var barVal = getBarValue('foo:bar:1234:something:4321');
console.log(barVal);


text:
Q: Vue.js and Jest - Element-UI how to programmatically confirm MessageBox? I'm currently creating tests with Jest and I would like to know how to programatically confirm ElementUI's MessageBox because I can't seem to get it's HTML DOM. So that it would execute my graphql queries inside then(). I really don't know if this is a good practice or not since I'm new at Jest.
confirmBox(
        this,
        'warning',
        'Delete Record',
        'Do you really want to delete this record?',
        true
      ).then(() => {
        this.loading = true

        deleteGame(id, (response, success) => {
          if (success) {
            this.$message({
              message: 'Record successfully deleted',
              type: 'success'
            })
            this.get()
          } else {
            this.$message({
              message: response,
              dangerouslyUseHTMLString: true,
              type: 'error'
            })
            this.loading = false
          }
        })
      })

A: Element-ui has unit test for all there components, however they are written in karma.
They seem to trigger the Ok button as follows:
it('confirm', done => {
    MessageBox.confirm('This is a piece of content', {
      title: 'Title name',
      type: 'warning'
    });
    setTimeout(() => {
      document.querySelector('.el-message-box__wrapper')
        .querySelector('.el-button--primary').click();
      expect(document.querySelector('.el-message-box__wrapper')
        .__vue__.$parent.visible).to.false;
      done();
    }, 200);
  });

Full source: https://github.com/ElemeFE/element/blob/dev/test/unit/specs/message-box.spec.js


text:
Q: get the child key for specific value when append table using Jquery i created a table and used Jquery to put all the user database from firebase info in it. The problem is: i have a button in the table that be should when you click the button console print the element key from database.
var userDataRef = firebase.database().ref("User/3N2f2rJSSAZmFOdZEeJdlsuEZam2").orderByKey();

userDataRef.on('child_added', function(childSnapshot) {
  var key = childSnapshot.key;
  var childData = childSnapshot.val();
  var title_val = childData.Title;
  var url_val = childData.Url;
    // Append data
    $("#data").append("
" + title_val + "	 <button class='box'>GO</button>	<button id='del' class='box'>Delete</button>	<
");

    $('#data').on('click', '#del', function(){
        console.log(key)
      });

                            Title
                            Link
                            Delete

when this function perform i gut all the keys not just the one from the exact raw
$('#data').on('click', '#del', function(){
        console.log(key)
      });

output :
-LkT_afLi9nfn65OS2QJ database.js:17:17
-LkTciKQVEa2bsbtSwkW database.js:17:17
-LkTclDO8dYSBfgiBjAZ

A: ID's should never be repeated, use the class of the buttons instead as a common attribute.

A: You are binding to all the elements and you are duplicating ids. Ids are singular.
You would be better off with either binding to the one button alone or event delegation with a data attribute.
userDataRef.on('child_added', function(childSnapshot) {
  /* cut out the vars */
  var myRow = $("
" + title_val + "	 <button class='box'>GO</button>	<button class='box'>Delete</button>
");
  myRow.find("button").on("click", function(){
    console.log(key)
  });
  $("#data").append(myRow);
});

or event delegation with a data attribute
$("#data").on("click", "button[data-key]", function(evt){
  var btn = $(this);
  console.log(btn.data("key"))
});

userDataRef.on('child_added', function(childSnapshot) {
  /* cut out the vars */
  var myRow = $("
" + title_val + "	 <button class='box'>GO</button>	<button class='box' data-key='" + key + "'>Delete</button>
");
  $("#data").append(myRow);
});


text:
Q: How to save ICloudStorageAccessToken? I am trying to connect to Dropbox using the Sharpbox library. All the process went fine and I am able to connect, although I don't know how to save the access token for later use from within C#. It cannot be saved into the settings file unfortunately because it is an abstract type. I tried to convert it to string and save it, but I don't know how to convert it back to AppLimit.CloudComputing.SharpBox.ICloudStorageAccessToken for future use. So how can I store his token?
Thanks

A: Reading between the lines at http://www.jayway.com/2012/02/06/unboxing-dropbox-and-sharpbox-2/, I wonder if there's a CloudStorage.SerializeSecurityToken (to pair with the DeserializeSecurityToken shown in the post).


text:
Q: Remove selected dynamic checked items from listview Here, in a listview I have added a custom row in which Checkbox and EditText are there and with a add button I just add multiple views to my listview. Adding is working perfectly but when it comes to removing part the checked items are not removing and apart from that suppose I selected two items, then two items from last deleted. I don't know whats going on with my code please help me.
Here is my code:
MainActivity.java
public class MainActivity extends AppCompatActivity {

AdapterCustom customAdapter;
ArrayList<String> stringArrayList;
ListView listView;
ArrayList<Integer> listOfItemsToDelete;
AdapterCustom.ViewHolder item;
int POS;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    listOfItemsToDelete = new ArrayList<Integer>();
    stringArrayList = new ArrayList<String>();
    LinearLayoutManager layoutManager
            = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
    listView = (ListView) findViewById(R.id.list_item);
    customAdapter = new AdapterCustom(MainActivity.this, R.layout.main, stringArrayList);
}

public void addItems(View v) {
    stringArrayList.add("");
    listView.setAdapter(customAdapter);
    customAdapter.notifyDataSetChanged();
}

public void removeItems(View v) {

    if (listOfItemsToDelete.isEmpty()) {

        Toast.makeText(getBaseContext(), "No items selected.",
                Toast.LENGTH_SHORT).show();
    } else {

        Log.i("Delete Pos", POS + "");

        if (!listOfItemsToDelete.equals("")) {
            for (int j = 0; j < listOfItemsToDelete.size(); j++) {
                stringArrayList.remove(listOfItemsToDelete.get(j) - j);
                customAdapter.notifyDataSetChanged();
            }
        }
    }

}

AdapterCustom.java
public class AdapterCustom extends ArrayAdapter<String> {

    Context context;
    ArrayList<String> stringArrayList;

    ArrayList<Boolean> positionArray;
    MainActivity activity;

    public AdapterCustom(Context context, int resourceId, ArrayList<String> arrayList) {
        super(context, resourceId, arrayList);
        this.context = context;
        this.stringArrayList = arrayList;
        positionArray = new ArrayList<Boolean>(stringArrayList.size());
        for (int i = 0; i < stringArrayList.size(); i++) {
            positionArray.add(false);
        }
        activity = new MainActivity();

    }

    @Override
    public int getCount() {
        return stringArrayList.size();
    }

    @Override
    public String getItem(int position) {
        return stringArrayList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    public class ViewHolder {
        EditText ediText;
        CheckBox checkBox;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {

        if (convertView == null) {
            item = new ViewHolder();

            convertView = LayoutInflater.from(context).inflate(R.layout.main, null);

            item.ediText = (EditText) convertView.findViewById(R.id.ediText);
            item.checkBox = (CheckBox) convertView.findViewById(R.id.checkBox);
            item.checkBox.setTag(new Integer(position));
            convertView.setTag(item);
            final View finalConvertView1 = convertView;
            item.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton compoundButton, boolean b) {

                    if (b) {
                        int getPosition = (Integer) compoundButton.getTag();
                        POS = getPosition;
                        listOfItemsToDelete.add(POS);
                        Log.i("position after check", POS + "");
                        Log.i("position check array", listOfItemsToDelete + "");
                    }
                }
            });
        } else {
            item = (ViewHolder) convertView.getTag();
        }

        item.checkBox.setTag(position);
        return convertView;
    }

}

activity_main.xml
 <LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="10">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:orientation="horizontal"
    android:weightSum="10">
    <Button
        android:id="@+id/addBtn"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="5"
        android:onClick="addItems"
        android:text="Add New Item" />
    <Button
        android:id="@+id/goBtn"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="5"
        android:onClick="goItems"
        android:text="Go to Item" />
</LinearLayout>
<ListView
    android:id="@+id/list_item"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="8"
    android:drawSelectorOnTop="false"
    android:visibility="visible" />
<Button
    android:id="@+id/removeBtn"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:onClick="removeItems"
    android:text="Remove Item" />
</LinearLayout>

main.xml
<LinearLayout
android:id="@+id/custom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="10">

<CheckBox
    android:id="@+id/checkBox"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1" />

<EditText
    android:id="@+id/ediText"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="9"
    android:background="@android:color/white"
    android:hint="Type Anything You Want" />
</LinearLayout>

A: You only remove the item from the array. Try removing the item also from the list view adapter with  adapter.remove(itemPosition);

A: What does mean
 - j

in this code:
 for (int j = 0; j < listOfItemsToDelete.size(); j++) {
            stringArrayList.remove(listOfItemsToDelete.get(j) - j);
            customAdapter.notifyDataSetChanged();
        }

?
I think that:
    for (String itemToRemove:listOfItemsToDelete) {
        stringArrayList.remove(itemToRemove);
    }

    customAdapter.notifyDataSetChanged();
    listOfItemsToDelete.clear();

would be appropriate.


text:
Q: Automate The Boring Stuff with Python Ch 4 myPets I am currently working through Automate the Boring Stuff with Python and was given this example in Chapter 4 (You can read the page here if you're curious). The code was typed from the example given in the book as suggested and is pasted below. In the book, I am told the response I get is supposed to prompt me to enter a pet name, and if it doesn't match what's in the list I should get a response saying that I don't have a pet by that name.
The problem I run into is that the response I ACTUALLY get is :
Enter a pet name:
Gennie
Traceback (most recent call last):
  File "/Users/gillian/Documents/Python/AutomateTheBoringStuffwithPython/Ch4Example1.py", line 3, in <module>
    name = str(input())
  File "<string>", line 1, in <module>
NameError: name 'Gennie' is not defined

I'm not sure why that would be. I don't see anything different about my code from the example, but something about that error seems not right. Can anyone tell me where I've gone off course?
myPets = ['Zophie', 'Pooka', 'Fat-tail']
print('Enter a pet name: ')
name = input()
if name not in myPets:
    print('I do not have a pet named ' + name)
else:
    print(name + ' is my pet.')

A: Change input() into raw_input() as you seem to be using python 2.x and this code is written in 3.x.
Find out more about differences here.


text:
Q: add date to IEEEtran Let us assume a document is using the IEEEclass class as follows:
\documentclass[10pt,conference,compsoc,letterpaper]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{lipsum}
\begin{document}
\title{Dating IEEEtran}
\author{\IEEEauthorblockN{Leon Meier} \IEEEauthorblockA{Nancago, USA} \and \IEEEauthorblockN{Meier Leon} \IEEEauthorblockA{Chicy, France} \thanks{This work would have been impossible without initial contributions of Abra K.\ Dabra, University of Alpha Centauri.}}
\date{2017-09-20}
\maketitle
\begin{abstract}How to add a date?\end{abstract}
\section{Introduction}
\lipsum[1-4]
\end{document}

I wish to visibly add a date to the paper to put a timestamp on updates and corrections. Is there a canonical way to put the date between the title and the authors or between the authors and the main text without hacking into IEEEtran.cls?

A: Add \usepackage{datetime} in your preamble and change your title to :
\title{Dating IEEEtran \\\vspace*{20pt} \normalsize  \today{} (\currenttime)}

I don't really know if this will affect other features of IEEEtran... So just check it in your real project. (In your MWE works without problems)
Edit:
I also found that using: \IEEEpubid{\today{}\space(\currenttime)} it adds lower in the footer margin of first page a date and time that will not printed. (I know it is not what you want but may be someone will find it usefull)


text:
Q: (Laravel 8.x) Get Data From DB and Use It Directly From Master Layout without Passing It From Parameters My Problem
Framework : Laravel 8.x
I want to call my menu from DB and use it at layout.blade.php, but I'm using this layout.blade.php as my Master Layout of my view, so it's just and extends from other view.
So, I called is this way.
layout.blade.php
<!DOCTYPE html>
... some codes ...

Menu 1

Menu 2

Menu 3

Menu 4

Menu 5

@foreach ($menus as $menu)

{{ $menu->name }}

@endforeach

@yield('body_content')

IndexController.php
public function index()
{
   return view('index_page', ['menus' => $getMenusFromDB]); //just for example
}

index.blade.php
@extends('layout', ['menus' => $menus])

@section('body_content')

Hello World !

@endsection

I have so many views linked  to this layout, so I can't pass a menus parameter like this.
My Question
How can I use this $menus called from DB directly to use it at layout.blade.php without passing it from my extended view ?

A: :) You're in luck! Laravel has a pre-built feature to share data with all views. Do check out their Docs!
For example:
App\Providers\AppServiceProvider.php
use Illuminate\Support\Facades\View;

class AppServiceProvider extends ServiceProvider
{

    public function boot()
    {

        // Just do it like how you would normally pass data with view helpers
        View::share('$menus', '$menuFromDB');
    }
}

layout.blade.php

@foreach ($menus as $menu)

{{ $menu->name }}

@endforeach

A: App\Providers\AppServiceProvider.php
Pass data in all views then use simple Asterisk * character
use App\Model\Menu;
class AppServiceProvider extends ServiceProvider
 {
    public function boot() {
       view()->composer('*', function ($view) {
          $menu = Menu::get()->toArray();
          $view->with('menu', $menu);
     });
 }
}

Pass data in specific View then use this one,
view()->composer('profile', function ($view) {
  $view->with('menu', $menu);
});

pass all common data here and used it in the blade directly.
More Info - https://laravel.com/docs/8.x/views#sharing-data-with-all-views


text:
Q: Differential Equation involving Lambert W function I was wondering whether there is an explicit solution to the following differential equation
$$f'(x) = g'(t)\left(f(t)\left(\frac{a}{g(t)} -1 \right)-\frac{a}{g(t) \lambda}\left( 1+ W_{-1}(-e^{-1-\lambda f(t)}  \right)    \right) $$
All the functions are well-behaved, $W_{-1}$ is the -1 branch of the Lambert W function. I am not sure how to solve this one.
Thanks a lot for any help!

A: $$f'(t) = g'(t)\left(f(t)\left(\frac{a}{g(t)} -1 \right)-\frac{a}{g(t) \lambda}\left( 1+ W_{-1}(-e^{-1-\lambda f(t)}  \right)    \right) $$
Let :  $W_{-1}( -e^{-1-\lambda f(t) })=-y(t) \quad\to\quad -ye^{-y}=-e^{-1-\lambda f(t)}\quad\to\quad f(t)=\frac{1}{\lambda}\left( y-\ln(y)-1\right)$
$f'(t)=\frac{1}{\lambda}\left( 1-\frac{1}{y}\right) y'(t)$
$$y'(t)=\lambda \frac{y}{y-1} g'(t)\left(\frac{1}{\lambda}\left( y-\ln(y)-1\right)\left(\frac{a}{g(t)} -1 \right)-\frac{a}{g(t) \lambda}\left( 1-y  \right)    \right)$$
$$y'(t)=\frac{y}{y-1} g'(t)\left(\left( y-\ln(y)-1\right)\left(\frac{a}{g(t)} -1 \right)-\frac{a}{g(t)}\left( 1-y  \right) \right)$$
$$y'(t)=y\: g'(t)\left(\left( 1-\frac{\ln(y)}{y-1}\right)\left(\frac{a}{g(t)} -1 \right)+\frac{a}{g(t)} \right)$$
So, we got rid of the Lambert function.
Supposing that we could solve this non-linear ODE, the result $y(t)$ gives :
$$f(t)=\frac{1}{\lambda}\left( y-\ln(y)-1\right)$$
Without knowing what exactly is the function $g(t)$ it seems not possible to go further.


text:
Q: How to put a Partial View into a div in JavaScript (with jQuery) I have ,MyPartialView.cshtml':

some content

an 'index.cshtml':

and an 'index.js'.
The 'index.js' should do sth like:
$('mainDiv').html($('#partialDiv'))

to put the partial view into the main div.
(writing @<text>
  @Html.Partial("MyPartialView")
</text>) in my .cshtml works, but I need to change the content dynamically. Therefore, I thought maybe there is an equivalent in JavaScript for 'Html.Partial'
(Or is there another way to get a Partial View without an AJAX Call)

A: @Html.Partial("MyPartialView") used only to render single partial view file (also with @Html.RenderPartial()). You can use AJAX to call controller action which returns partial view:
AJAX Request
$.ajax({
    type: 'GET',
    url: '@Url.Action("ActionName", "ControllerName")',
    // other settings
    success: function (result) {
        $('mainDiv').html(result);
    }
});

Controller Action
[HttpGet]
public ActionResult ActionName()
{
    // do something
    return PartialView("MyPartialView");
}

Note that there's no equivalent of calling partial view in JS, because you need to make request to server which can't be simply handled by standard JS functions.

A: cshtml files are rendred in server side. you can't load it using just JavaScript. the perfect way is using Ajax by calling an Action that return your partial view


text:
Q: Wordpress remove ?id= from url I have a page url like www.example.com/catagory/postname. I set up the custom permalink format as following: /%category%/%postname%/.
However I am still getting urls formatted like www.example.com/category/postname/?id=123 (some number).
I tried access directly without those and I can still access to the same page.
What should I do to get rid of the ?id= tags following my posts URLs?
See this example link : camilleromano.com


text:
Q: python pyplot : how to organize the layout? Looking at matplotlib documentation, I found this example:
http://matplotlib.org/users/tight_layout_guide.html
import matplotlib.pyplot as plt

def example_plot(ax,pid, fontsize=12):
    ax.plot([1, 2])
    ax.locator_params(nbins=3)
    ax.set_xlabel('x-label', fontsize=fontsize)
    ax.set_ylabel('y-label', fontsize=fontsize)
    ax.set_title('Title'+str(pid), fontsize=fontsize)

plt.close('all')
fig = plt.figure()

ax1 = plt.subplot(221)
ax2 = plt.subplot(223)
ax4 = plt.subplot(122)

example_plot(ax1,1)
example_plot(ax2,2)
example_plot(ax4,4)

plt.tight_layout()

plt.show()

which produce a 2 columns layout, on the left a column with two rows, and on the right a column with 1 row.
This seems to match what the API of subplot is saying:
http://matplotlib.org/api/pyplot_api.html

subplot(211) produces a subaxes in a figure which represents the top
  plot (i.e. the first) in a 2 row by 1 column notional grid (no grid
  actually exists, but conceptually this is how the returned subplot has
  been positioned).

I am now trying to add a row to the column of the left (for a total of 3 rows).
From my understanding, that should do it:
import matplotlib.pyplot as plt

def example_plot(ax,pid, fontsize=12):
    ax.plot([1, 2])
    ax.locator_params(nbins=3)
    ax.set_xlabel('x-label', fontsize=fontsize)
    ax.set_ylabel('y-label', fontsize=fontsize)
    ax.set_title('Title'+str(pid), fontsize=fontsize)

plt.close('all')
fig = plt.figure()

ax1 = plt.subplot(321) # changed "2" by "3"
ax2 = plt.subplot(323) # changed "2" by "3"
ax3 = plt.subplot(324) # line added
ax4 = plt.subplot(122)

example_plot(ax1,1)
example_plot(ax2,2)
example_plot(ax3,3) # line added
example_plot(ax4,4)

plt.tight_layout()

plt.show()

There is something I must be doing wrong, because this display the right layout, but the third plot of the first column does not show up ....

A: When you do a 3 by 2 subplot grid, the plots in the left column are numbered 1, 3 and 5. Change the line to ax3 = plt.subplot(325) and it should work.


text:
Q: chmod +x gradlew ./gradlew clean build --refresh-dependencies --stacktrace fail I'm trying build android apk using:
jenkins@test-jenkins-vm:/home/lesha$ java --version

openjdk 10.0.2 2018-07-17 OpenJDK Runtime Environment (build
10.0.2+13-Ubuntu-1ubuntu0.18.04.2) OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.2, mixed mode)

and
jenkins@test-jenkins-vm:/home/lesha$ gradle -v

------------------------------------------------------------
Gradle 4.10.2
------------------------------------------------------------

Build time:   2018-09-19 18:10:15 UTC
Revision:     b4d8d5d170bb4ba516e88d7fe5647e2323d791dd

Kotlin DSL:   1.0-rc-6
Kotlin:       1.2.61
Groovy:       2.4.15
Ant:          Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM:          1.8.0_181 (Oracle Corporation 25.181-b13)
OS:           Linux 4.15.0-1023-azure amd64

My android sdk located at
jenkins@test-jenkins-vm:/home/lesha$ cd $ANDROID_HOME
jenkins@test-jenkins-vm:/opt/android-sdk-linux$ ls
NOTICE.txt  bin      emulator    lib       mksdcard  platforms  source.properties  tools
android     build-tools  emulator-check  licenses  monitor   proguard   support

When I execute
chmod +x gradlew && ./gradlew clean build --refresh-dependencies --stacktrace

I get an error

[Gradle] - Launching build.
      [Android] $ gradle clean build clean build --refresh-dependencies --stacktrace -b build.gradle
> Configure project :app
Checking the license for package Android SDK Build-Tools 27.0.3 in /opt/android-sdk-linux/licenses
License for package Android SDK Build-Tools 27.0.3 accepted.
Preparing "Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)".
"Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)" ready.
Installing Android SDK Build-Tools 27.0.3 in /opt/android-sdk-linux/build-tools/27.0.3
"Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)" complete.
"Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)" finished.
Checking the license for package Android SDK Platform 27 in /opt/android-sdk-linux/licenses
License for package Android SDK Platform 27 accepted.
Preparing "Install Android SDK Platform 27 (revision: 3)".
"Install Android SDK Platform 27 (revision: 3)" ready.
Installing Android SDK Platform 27 in /opt/android-sdk-linux/platforms/android-27
"Install Android SDK Platform 27 (revision: 3)" complete.
"Install Android SDK Platform 27 (revision: 3)" finished.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to find target with hash string 'android-27' in: /opt/android-sdk-linux

Can anybody help?


text:
Q: python requests and percent encoding of path when using python requests am I supposed to urlencode the URI manually?
>>> requests.get('http://example.com/increased by 10% (@tom)').url
u'http://example.com/increased%20by%2010%%20(@tom)'

here the %, (, ) and @ characters are not encoded while spaces are. what is the official way of making such request? should I wrap the path part using urllib.quote()?

A: requests will quote only unreserved characters (code). % and () are reserved characters so you'd have to quote them yourself. Spaces are unreserved characters and requests does quote them for you. See Percent-encoding for the list of reserved URI characters.


text:
Q: dpkg returning errors during apt-get upgrade s I run  sudo apt-get upgrade and at the end these errors are encountered
(Reading database ... 1234017 files and directories currently installed.)
Preparing to unpack .../gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb ...
install-info: No dir file specified; try --help for more information.
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
dpkg: error processing archive /var/cache/apt/archives/gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb (--unpack):
 there is no script in the new version of the package - giving up
install-info: No dir file specified; try --help for more information.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)