text:
Q: Possible solution for data cleaning in R I have a dataset which contains two date and time columns. I would like to line up the date and time columns in the same row and delete everything to the right of the second date and time column if they don't match. A sample of my dataset problem looks like the following.

Note that Time.1!=Time. A cleaned final version of the dataset should look like this:
I would like to  remove everything to the right of the column Date.1 until both Date.1=Date and Time.1=Time.
I have wrote the following R code to do this:
rm(list = ls())
data<-read.csv(file="data.csv",header=T,stringsAsFactors=FALSE)
datacol<-ncol(data)
datarow<-nrow(data)

for (i in 1:datarow){
  for (j in 1:(datarow-1)){
    while(data$Date[i]!=data$Date.1[j] | data$Time[i]!=data$Time.1[j]){data[j,6:datacol]<-data[j+1,6:datacol];
    if (j<datarow) next; if (j == datarow) break; print(data[i,]);}
  }
}

However R just keeps running without stop even though I specified break when the length of the row is met. I would appreciate any advice on how to solve this issue.
Thank you.

A: Consider subsetting by columns and then merging your dataset without need of nested for loops. Below reproduces data with filled in values for demonstration:
df <- read.table(text="Date     Time    Price   MA        X     Date.1      Time.1    Open      High    Low     Close   BMA     Vol
                       5/2/2016 5:00    9810+   98073.07  NA    5/2/2016    5:00      130035    130040  130020  130035  130020  7014
                       5/2/2016 0:30    98080   98071     NA    5/2/2016    4:30      130030    130035  130020  130035  130017  6631
                       5/2/2016 0:00    9809+   98070.05  NA    5/2/2016    4:00      130030    130035  130020  130030  130016  2465
                       5/1/2016 23:30   9809+   98066     NA    5/2/2016    3:30      130025    130035  130020  130030  130015  2918
                       5/1/2016 23:00   9809+   98063.03  NA    5/2/2016    3:00      130030    130030  130020  130020  130012  2289
                       5/1/2016 22:30   98080   98061     NA    5/2/2016    2:30      130035    130035  130030  130030  130010  4699
                       5/3/2016 12:30   7777    7777      NA    5/2/2016    0:30      130030    130035  130010  130015  130005  4424
                       5/3/2016 12:45   8888    8888      NA    5/2/2016    0:00      130030    130035  130025  130030  130005  1906
                       5/4/2016 13:30   78787   78787     NA    5/1/2016    23:30     130020    130035  130015  130030  130002  5429
                       5/4/2016 13:45   87878   87878     NA    5/1/2016    23:00     130015    130020  130015  130020  130001  540
                       5/4/2016 13:50   77888   88777     NA    5/1/2016    22:30     130010    130020  130010  130015  130000  1417
                 ", header = TRUE)

# SUBSET INTO TWO SEPARATE DFs
df1 <- df[c('Date', 'Time', 'Price', 'MA', 'X')]
df2 <- df[c('Date.1', 'Time.1', 'Open', 'High', 'Low', 'Close', 'BMA', 'Vol')]

# MERGE BY DATE AND TIME COLUMNS
#  (NOTE: LOSE SECOND PAIR OF JOIN VARS --Date.1, Time.1-- WITH DF SORT)
finaldf <- merge(df1, df2, by.x = c('Date', 'Time'), by.y = c('Date.1', 'Time.1'))
finaldf

#       Date  Time Price MA       X  Open   High   Low    Close  BMA    Vol
# 1 5/1/2016 22:30 98080 98061.00 NA 130010 130020 130010 130015 130000 1417
# 2 5/1/2016 23:00 9809+ 98063.03 NA 130015 130020 130015 130020 130001  540
# 3 5/1/2016 23:30 9809+ 98066.00 NA 130020 130035 130015 130030 130002 5429
# 4 5/2/2016  0:00 9809+ 98070.05 NA 130030 130035 130025 130030 130005 1906
# 5 5/2/2016  0:30 98080 98071.00 NA 130030 130035 130010 130015 130005 4424
# 6 5/2/2016  5:00 9810+ 98073.07 NA 130035 130040 130020 130035 130020 7014


text:
Q: In perl match a dot when there're at least three words before it I'm using (?<=(?:(?:\w|,|'){1,20} ){2}(?:\w|,|'){1,20} ?)\.
But it's not working as expected:
use v5.35.2;
use warnings;
use strict;

my $str = shift // q{If you have to go. you go. That's no problem.};

my $regex = qr/(?<=(?:(?:\w|,|'){1,20} ){2}(?:\w|,|'){1,20} ?)\./;

my @all_parts = split $regex, $str;

say for@all_parts;

It should print out If you have to go and  you go. That's no problem
Is there an easier way to achieve this?

A: #!/usr/bin/env perl
use warnings;
use strict;
use feature qw/say/;

my $str = shift // q{If you have to go. you go. That's no problem.};
my $regex = qr/(?:\b[\w,']+\s*){3}\K\./;
my @all_parts = split $regex, $str;
say for @all_parts;

splits like you want. Using \K to discard everything before the period from the actual match is the key bit. (There's probably tweaks that could be made to the RE to better account for edge cases you didn't provide in your example string).

A: split / [\w'] (?: [\s,]+ [\w']+ ){2} \K \. /x

Notes:

*

*It's usually easier and more efficient to use \K instead of a lookbehind. It also has the advantage that can look further back than the 255 chars a real variable-length lookbehind can look back. But it has the disadvantage that it can't "look behind" further than the end of the previous match. This isn't a problem here.

*Feel free to remove the whitespace. If you do, you can also remove the x.

*Adding a + after each existing + should make it a tiny bit faster.

*You obviously consider a's to be one word, but the earlier answer can count it as two. For example, it considers the . to be preceded by three words in a's b. c.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to delete files permanently (not to recycle bin) with TortoiseProc I executed the command line:
TortoiseProc.exe /command:cleanup /revert /delunversioned /delignored /refreshshell /path:"%~1" /noui /closeonend:1

and all files were deleted to the recycle bin.
I found this message :
https://groups.google.com/forum/#!msg/tortoisesvn/Tb-LUnmosj0/2ez-ocdEbdgJ
but cannot find this option.

A: You can configure the behavior in the settings dialog:

Settings->Dialogs 1->Use recycle bin when reverting

If you remove the checkmark, then TortoiseSVN will not use the recycle bin anymore but simply delete the files.


text:
Q: resize function with window width jQuery   if ($(window).width() >= 320 && $(window).width() <= 480) {
    $(".projects").slice(1, 8).css("margin", "10px");
  } else {
    $(".projects").slice(3, 6).css("margin", "10px");
  };

Its working good with default without resize finction. I try set this with:
 $(window).resize(function() {
 })

But not working.
Any idea why?
JSFIDDLE

A: You are never resetting the div margins. Therefore, as soon as it get to the point where slice 1 through 8 have margins, they will never get changed back. You need to reset the divs:
$(window).resize(function () {
    $(".projects").css('margin', '0px'); // reset the divs
    if ($(window).width() >= 320 && $(window).width() <= 480) {
        $(".projects").slice(1, 8).css("margin", "10px");
    } else {
        $(".projects").slice(3, 6).css("margin", "10px");
    };
});

Here is Fiddle


text:
Q: To create a login page should i create a login activity or just an empty activity with textviews and button? i am trying to create a login page for my app. Should i just take an empty activity and add textviews and buttons or should i start by taking a login activity in android studio? what is the difference between the two and which one should i go for?

A: You can - of course - use your own layout. No problem with that.
The Login Activity is predesigned for you, use if if you want.
It also brings some logic with it which you can use.
Do you have your own authentication process?
You can creat this via the menu

This is how it looks like.

and this is the layout tree.

Do you need some more help?
If you want a real backend server implementation you can read this Article: Authenticate with Firebase using Password-Based Accounts on Android


text:
Q: Magento 2: How to change text in admin panel? how can I change the (German) labels in admin panel like in the screenhot for example?
I have tried to change this in "i18n" folders in custom theme and custom module but nothing worked.
For frontend it is working fine but I have no idea to change that for admin panel.
I have also cleaned all caches of corse.
Can anybody help please?

A: I think adding the translation with a language pack should do the trick + changing the language on the admin store to be the one you need.

A: Has nobody changed any text in the backend?


text:
Q: ChangeDetection not triggering in .subcribe() in RC.5? I have an app currently running in RC.4 that I'm upgrading to RC.5. I've stopped using the old Forms directives and I've updated to use NgModule to get the app started.
However I immediately run into a problem due to my app loading much of it's information through ajax calls. I subscribe to these Observables and put the data on the component like I always have in RC.4. The usual line looks something like this:
api.GoGetData().subscribe((data) => this.myData = data);

In RC.4 this worked without any issues. Now that I'm getting RC.5 up and running I'm finding that the View isn't updating to show this bound data. In Chrome's Dev Tools I'm seeing that the requests are being made and if I update the above line to:
api.GoGetData().subscribe((data) => {
  this.myData = data;
  debugger;
});

Then I'm hitting the breakpoint and I can see the data properly.
It seems I have to manually call for a tick:
constructor(api: Api, appref: ApplicationRef) {
  ...
  this.api.GoGetData().subscribe((data) => {
    this.myData = data;
    appref.tick();
  });
  ...
}

If I do that, Change Detection is forced and my UI updates appropriately. This might work, but it can't possibly be the Angular2 way to do it.
In Angular2 RC.5, what do I need to do for Change Detection to fire when I change component variables from an Http request's Observable's subscribe callback?
EDIT: I've removed a lot of my existing code so I can try and get this sorted out. Here's what I have now:
index.html

    <app>Loading</app>

boot.ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';

import { TestComponent } from './components/test';
import { TestApi } from './components/testapi';

@NgModule({
  imports: [ BrowserModule, HttpModule ],
  declarations: [ TestComponent ],
  providers: [ TestApi ],
  bootstrap: [ TestComponent ]
})
export class AppModule { }

platformBrowserDynamic().bootstrapModule(AppModule);

test.ts
import { Component } from '@angular/core';
import { TestApi } from './testapi';

@Component({
  selector: 'app',
  template: 'TEST

{{ myData }}'
})
export class TestComponent {
  myData: any;
  constructor(private api: TestApi) {
    this.api.GoGetData().subscribe(data => {
      this.myData = data;
      console.log(this.myData);
    });
  }
}

testapi.ts
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';

@Injectable()
export class TestApi {
  constructor(private http: Http) { }

  GoGetData() {
    return this.http.get('test.txt').map(res => res.text());
  }
}

systemjs.config.js
(function(global) {

  var ngVer = '@2.0.0-rc.5'; // lock in the angular package version; do not let it float to current!
  // var routerVer = '@3.0.0-rc.1'; // lock router version
  var formsVer = '@0.3.0'; // lock forms version

  //map tells the System loader where to look for things
  var  map = {
    'app':                        'app',

    '@angular':                   'https://npmcdn.com/@angular', // sufficient if we didn't pin the version
    'rxjs':                       'https://npmcdn.com/rxjs@5.0.0-beta.6'
 };

  //packages tells the System loader how to load when no filename and/or no extension
  var packages = {
    'app':                        { defaultExtension: 'js' },
    'rxjs':                       { defaultExtension: 'js' }
  };

  var ngPackageNames = [
    'common',
    'compiler',
    'core',
    'http',
    'forms',
    'platform-browser',
    'platform-browser-dynamic',
  ];

  // Add map entries for each angular package
  // only because we're pinning the version with `ngVer`.
  ngPackageNames.forEach(function(pkgName) {
    var url = pkgName;
    switch (pkgName) {
      case 'forms':
        url += formsVer;
        break;
      default:
        url += ngVer;
        break;
    }
    map['@angular/'+pkgName] = 'https://npmcdn.com/@angular/' + url;
  });

  // Add package entries for angular packages
  ngPackageNames.forEach(function(pkgName) {

    // Bundled (~40 requests):
    packages['@angular/'+pkgName] = { main: 'bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
  });

  var config = {
    map: map,
    packages: packages
  };

  System.config(config);

})(this);

This is driving me crazy now! I have a test.txt containing "Hello from server!" and it appears just fine in the console but I only see TEST on the page. No errors, warnings, anything. yurzui's plnkr in the comments works for me, but not my own code.

A: For my situation it turned out that something in systemjs-polyfills.js was the root cause. Simply not including it was enough to solve my issues.


text:
Q: Angular ui-router initial state without URL Using UIRouter in an Angular 1.5 app, I'm having trouble trying to set an initial state for my angular module.
I've created a few states without URLs (because I don't need actual routing) and I would like to activate an initial state once the module is instantiated.
Usually, I would do this using $urlRouterProvider.otherwise(<initialRoute>), but since I don't use URLs in my states, that can't work.
Does UIRouter (or Angular) provide a solution for this?

A: After your application has bootstrapped, you can set your initial state  inside the .run() method.
angular.module("myModuleName")
    .run([
        "$state",
         function($state){
            $state.go('stateName');
         }
     ]);


text:
Q: Lookup Field whose value depends on the value of another lookup field I'm trying to make a field in Access 2013 where the selection of a set of team members is dependent upon the team that was selected in the same record.  I've made the following SQL statement as my Row Source:
SELECT [Tech Name]
FROM tblTechs
WHERE tblWorkOrder.[Team Responsible:]=tblTechs.[Team];

Where tblTechs.[Tech Name] is the field of where the list of options is called from and tblWork Order.[Team Responsible:] is the field that I want to inform the list options for the given field in the same table.
The Tech table contains the field "Team" which contains the same reference that informs [Team Responsible:] in the Work Order table.
Once again, any help you guys could provide would be great.


text:
Q: Swiper using cdn link is not working in html I want to add Swiper Slider on my website. I have added Swiper CDN to my html. But it is not working. I don't know what is wrong with my code. I have copy pasted the same code which Swiper has on it's website. But still it does not slide. Can anyone help me what is that I am missing.
From here I copy pasted the code.
https://swiperjs.com/get-started#use-swiper-from-cdn
Below is the screenshot for your reference. When I click arrow buttons slide does not move.

HTML CODE -
<!doctype html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://unpkg.com/swiper@8/swiper-bundle.min.css" />
    <title> </title>

                Navbar
                <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
                    data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
                    aria-expanded="false" aria-label="Toggle navigation">

                </button>

                            Home

                            About Me

                            Gallery

                            Services

                            Press Media

                            Enquiry

Slide 1

Slide 2

Slide 3

Slide 4

Slide 5

Slide 6

                ...

A: Here is my try, changed the javascript code

var swiper = new Swiper(".swiper-js", {
  navigation: {
    nextEl: ".swiper-button-next",
    prevEl: ".swiper-button-prev",
  },
  scrollbar: {
    el: '.swiper-scrollbar',
  },
  pagination: {
    el: '.swiper-pagination',
  },
});
<!doctype html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://unpkg.com/swiper@8/swiper-bundle.min.css" />
    <title> </title>

                Navbar
                <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
                    data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
                    aria-expanded="false" aria-label="Toggle navigation">

                </button>

                            Home

                            About Me

                            Gallery

                            Services

                            Press Media

                            Enquiry

Slide 1

Slide 2

Slide 3

Slide 4

Slide 5

Slide 6

                ...

A: Hey I found the answer.
I shifted this script above like this and added css, check below code and css. This worked.

CSS -
.dvSlider .slider {
  width: 100%;
  height: 100vh;
}

A: You write shipper script code before the library load this cause it's a js error in console I fixed your code and paste you can directly use the code

<!doctype html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://unpkg.com/swiper@8/swiper-bundle.min.css" />
    <title> </title>

                Navbar
                <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
                    data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
                    aria-expanded="false" aria-label="Toggle navigation">

                </button>

                            Home

                            About Me

                            Gallery

                            Services

                            Press Media

                            Enquiry


text:
Q: "Just" or "Even" with Dare? There's well-known expression: Don't you dare...
Is there a way to somehow make it stronger, to show more of your emotions when you "asking" person not to dare etc.?
I've heard 2 cases, but don't really know the differences or even are they correct or not.

*

*Don't you just dare...

*Don't you even dare...

What do you think?

A:
Don't you dare...  Q: Is there a way to make it stronger?

There are several ways to express this more vehemently (U.S. English):

Don't even think about it!
Don't go there!  (This doesn't mean physically going someplace
  -- it means the same as the previous phrase.)

Note also that "Don't you dare!" is stronger than "Don't you dare show them that photograph!" (or whatever the contemplated action is).

A:
1.Don't you just dare...
  2.Don't you even dare...

In the variant of English I am familiar with as a native speaker, (1) is incorrect and is a confusion with a different idiom. To give all the rules would take up a lot of space so I'll give some examples and offer a way to research this more.
I am used to hearing:
Just don't [you] dare.
Don't [you] even dare.
Don't you just love that?
By examining the links at the bottom of this ngram and trying your own searches you can discover more examples.
Google ngram: don't dare,don't even dare,don't just dare,just don't dare
Note that you may have to click the 'Search lots of books' button to get the full results.


text:
Q: How can you send up to fifty requests per second to a microcontroller (ESP8266) in Safari? I'm using a microcontroller(ESP8266) as a webserver to serve a webpage. This microcontroller controls a remote car. The webpage sends up to 50 request to the microcontroller to regulate speed and turning angle.
XHR is too slow for this purpose, so I'm changing the source of a hidden image. This doesn't work on any browser availble on iPhone because Apple forces browser developers to use their webkitengine.
interv = setInterval(send, 20);
function send() {
  if (autodrive) {
    imgsend.src = "send.php?autodrive=on&sh=" + sh;
  } else {
    imgsend.src = "send.php?autodrive=off&x=" + x + "&y=" + y + "&sh=" + sh;
  }
}

There should be up to 50 Request per second to microcontroller. In reality there is only one after a few seconds. Is there any way to fix this? Please keep in mind, that the microcontroller has only limited power.


text:
Q: Update values in numpy array with other values in Python Given the following array:
a = np.array([[1,2,3],[4,5,6],[7,8,9]])

[[1 2 3]
 [4 5 6]
 [7 8 9]]

How can I replace certain values with other values?
bad_vals = [4, 2, 6]
update_vals = [11, 1, 8]

I currently use:
for idx, v in enumerate(bad_vals):
    a[a==v] = update_vals[idx]

Which gives:
[[ 1  1  3]
 [11  5  8]
 [ 7  8  9]]

But it is rather slow for large arrays with many values to be replaced. Is there any good alternative?
The input array can be changed to anything (list of list/tuples) if this might be necessary to access certain speedy black magic.
EDIT:
Based on the great answers from @Divakar and @charlysotelo did a quick comparison for my real use-case date using the benchit package. My input data array has more or less a of ratio 100:1 (rows:columns) where the length of array of replacement values are in order of 3 x rows size.
Functions:
# current approach
def enumerate_values(a, bad_vals, update_vals):
    for idx, v in enumerate(bad_vals):
        a[a==v] = update_vals[idx]
    return a

# provided solution @Divakar
def map_values(a, bad_vals, update_vals):
    N = max(a.max(), max(bad_vals))+1
    mapar = np.empty(N, dtype=int)
    mapar[a] = a
    mapar[bad_vals] = update_vals
    out = mapar[a]
    return out

# provided solution @charlysotelo
def vectorize_values(a, bad_vals, update_vals):
    bad_to_good_map = {}
    for idx, bad_val in enumerate(bad_vals):
        bad_to_good_map[bad_val] = update_vals[idx]
    f = np.vectorize(lambda x: (bad_to_good_map[x] if x in bad_to_good_map else x))
    a = f(a)

    return a

# define benchit input functions
import benchit
funcs = [enumerate_values, map_values, vectorize_values]

# define benchit input variables to bench against
in_ = {
    n: (
        np.random.randint(0,n*10,(n,int(n * 0.01))), # array
        np.random.choice(n*10, n*3,replace=False), # bad_vals
        np.random.choice(n*10, n*3) # update_vals
    )
    for n in [300, 1000, 3000, 10000, 30000]
}

# do the bench
# btw: timing of bad approaches (my own function here) take time
t = benchit.timings(funcs, in_, multivar=True, input_name='Len')
t.plot(logx=True, grid=False)

A: Here's one way based on the hinted mapping array method for positive numbers -
def map_values(a, bad_vals, update_vals):
    N = max(a.max(), max(bad_vals))+1
    mapar = np.empty(N, dtype=int)
    mapar[a] = a
    mapar[bad_vals] = update_vals
    out = mapar[a]
    return out

Sample run -
In [94]: a
Out[94]:
array([[1, 2, 1],
       [4, 5, 6],
       [7, 1, 1]])

In [95]: bad_vals
Out[95]: [4, 2, 6]

In [96]: update_vals
Out[96]: [11, 1, 8]

In [97]: map_values(a, bad_vals, update_vals)
Out[97]:
array([[ 1,  1,  1],
       [11,  5,  8],
       [ 7,  1,  1]])

Benchmarking
# Original soln
def replacevals(a, bad_vals, update_vals):
    out = a.copy()
    for idx, v in enumerate(bad_vals):
        out[out==v] = update_vals[idx]
    return out

The given sample had the 2D input of nxn with n samples to be replaced. Let's setup input datasets with the same structure.
Using benchit package (few benchmarking tools packaged together; disclaimer: I am its author) to benchmark proposed solutions.
import benchit
funcs = [replacevals, map_values]
in_ = {n:(np.random.randint(0,n*10,(n,n)),np.random.choice(n*10,n,replace=False),np.random.choice(n*10,n)) for n in [3,10,100,1000,2000]}
t = benchit.timings(funcs, in_, multivar=True, input_name='Len')
t.plot(logx=True, save='timings.png')

Plot :

A: This really depends on the size of your array, and the size of your mappings from bad to good integers.
For a larger number of bad to good integers - the method below is better:
import numpy as np
import time

ARRAY_ROWS = 10000
ARRAY_COLS = 1000

NUM_MAPPINGS = 10000

bad_vals = np.random.rand(NUM_MAPPINGS)
update_vals = np.random.rand(NUM_MAPPINGS)

bad_to_good_map = {}
for idx, bad_val in enumerate(bad_vals):
    bad_to_good_map[bad_val] = update_vals[idx]

# np.vectorize with mapping
# Takes about 4 seconds
a = np.random.rand(ARRAY_ROWS, ARRAY_COLS)
f = np.vectorize(lambda x: (bad_to_good_map[x] if x in bad_to_good_map else x))
print (time.time())
a = f(a)
print (time.time())

# Your way
# Takes about 60 seconds
a = np.random.rand(ARRAY_ROWS, ARRAY_COLS)
print (time.time())
for idx, v in enumerate(bad_vals):
    a[a==v] = update_vals[idx]
print (time.time())

Running the code above it took less than 4 seconds for the np.vectorize(lambda) way to finish - whereas your way took almost 60 seconds. However, setting the NUM_MAPPINGS to 100, your method takes less than a second for me - faster than the 2 seconds for the np.vectorize way.


text:
Q: How to do page caching when doing pagination/infinity scroll? I have large dataset to display in which the order is constantly changing (like SO, HN, Reddit). Since Rails does caching at the page and action level, what can I do if the action rendered like in the case needs to be different depending on pagination params?
A couple strategies I could think of:

*

*Do just object caching in redis/memcached - but most of my time is being spent in rendering ; if I did this I'd ideally have to move the rendering into javascript as well

*use eTags - but then the client still has to get the page once.

*cache the entire rendered dataset, and put some logic into the controller to grab the page it needs. Use a sweeper to expire it.

How can I best do this "out of the box?" I want to introduce the minimum amount of complexity.


text:
Q: Advice on executing sequential operations in a non-blocking manner, Task.Run vs task with ContinueWith We have a processor that will receive a queue of elements, and for every element, it will run some actions that need to be guaranteed to be executed in a sequential manner. Each action to execute on an element is a Promise Task (http://blog.stephencleary.com/2014/04/a-tour-of-task-part-0-overview.html). The processing of each element in the queue doesn't need to wait for completion of the previous one.
The signature of the actions can be assumed to be something like this:
Task MyAwaitableMethod(int delay)

The way I'm seeing, the problem can be reduced to executing a loop, and inside the loop, executing sequential operations, and each iteration shouldn't block. I'm looking at 2 approaches:
1.
for (var i = 0; i < Iterations; i++)
{
    Task.Run(async () => {
            await MyAwaitableMethod(DelayInMilliseconds);
            await MyAwaitableMethod(DelayInMilliseconds);
    });
}

2.
for (var i = 0; i < Iterations; i++)
{
    MyAwaitableMethod(DelayInMilliseconds).ContinueWith(
        antecedent => MyAwaitableMethod(DelayInMilliseconds));
}

I was assuming, given the actions are Promises, that with approach #2, there would be less threads created, as opposed to Task.Run, which I'd assume would create more threads. But in tests I've run, the number of threads created for both when executing a high number of iterations tends to be the same, and not dependent of the given number of iterations.
Are both methods entirely equivalent? Or you guys have better suggestions?
EDIT (rephrasing the question)
Are both methods equivalent in terms of the number of threads both require?
Thanks

A: Why not use Task.WhenAll()?
var tasks = new List<Task>();
for (var i = 0; i < Iterations; i++)
{
    Task t = MyAwaitableMethod(DelayInMilliseconds);
    tasks.Add(t);
}

await Task.WhenAll(tasks);

A: Part of the beauty of async-await is to write sequential asynchronous code.
If it was not to be asynchronous, you would write:
for (var i = 0; i < Iterations; i++)
{
    MyAwaitableMethod(DelayInMilliseconds);
    MyAwaitableMethod(DelayInMilliseconds);
}

If you want it to be asynchronous, just write:
for (var i = 0; i < Iterations; i++)
{
    await MyAwaitableMethod(DelayInMilliseconds);
    await MyAwaitableMethod(DelayInMilliseconds);
}

The code you posted does not satisfy your requirement to process each item only after the previous one because you are not awaiting for Task.Run.


text:
Q: Sql server errors in query I am trying to collaborate 3 queries to perform arithmetic operation. The queries are shown in
(SELECT ITEM_ID,ISNULL(SUM(REC_GOOD_QTY),0)
FROM INVENTORY_ITEM
WHERE COMPANY_ID = 1
AND INVENTORY_ITEM.COMPANY_BRANCH_ID = 1
AND INVENTORY_ITEM.INV_ITEM_STATUS = 'Inward'
AND GRN_DATE <  CAST('2017-01-10 00:00:00.0' AS DATETIME)
GROUP BY INVENTORY_ITEM.ITEM_ID) -
(SELECT ITEM_ID, SUM ( TOTAL_LITRE )
FROM STOCK_REQUISITION_ITEM B, STOCK_REQUISITION A
WHERE A.ID = B.REQUISITION_ID
AND A.COMPANY_ID = 1
AND A.REQ_FROM_BRANCH_ID = 1
AND A.REQUISITION_DATE < CAST('2017-01-10 00:00:00.0' AS DATETIME)
GROUP BY B.ITEM_ID) +
(SELECT ITEM_ID, SUM ( RETURN_QUANTITY )
FROM STOCK_RETURN_ITEM B, STOCK_RETURN A
WHERE A.ID = B.STOCK_RETURN_ID
AND A.COMPANY_ID = 1
AND A.COMPANY_BRANCH_ID = 1
AND A.RETURN_DATE <= CAST('2017-01-10 00:00:00.0' AS DATETIME)
GROUP BY B.ITEM_ID)

I am getting this error.

[Err] 42000 - [SQL Server]Incorrect syntax near '-'.
  42000 - [SQL Server]Incorrect syntax near '+'

A: In your queries you always returns two fields ITEM_ID and a numeric field.
To apply an arithmetical operation you must return one numeric field
The first query:
SELECT ITEM_ID,ISNULL(SUM(REC_GOOD_QTY),0)

becomes
SELECT ISNULL(SUM(REC_GOOD_QTY),0)

The second query:
SELECT ITEM_ID, SUM ( TOTAL_LITRE )

becomes
SELECT SUM ( TOTAL_LITRE )

The third query:
SELECT ITEM_ID, SUM ( RETURN_QUANTITY )

becomes
SELECT SUM ( RETURN_QUANTITY )

So the GROUP BY returns more than one row per query
UPDATE
i try to rewrite your query:
SELECT DISTINCT ii.item_id,
ISNULL(
    (SELECT SUM(ii2.rec_good_qty)
    FROM inventory_item ii2
    WHERE ii2.item_id = ii.item_id
    AND ii.company_id = 1
    AND ii.company_branch_id = 1
    AND ii.inv_item_status = 'Inward'
    AND ii.grn_date <  CAST('2017-01-10 00:00:00.0' AS DATETIME))
    ,0) -
ISNULL(
    (SELECT SUM(total_litre)
    FROM stock_requisition_item b
    JOIN stock_requisition a
        ON a.id = b.requisition_id
    WHERE a.company_id = 1
    AND a.req_from_branch_id = 1
    AND a.requisition_date < CAST('2017-01-10 00:00:00.0' AS DATETIME))
,0) +
ISNULL(
    (SELECT SUM(return_quantity)
    FROM stock_return_item b
    JOIN stock_return a
        ON a.id = b.stock_return_id
    WHERE a.company_id = 1
    AND a.company_branch_id = 1
    AND a.return_date <= CAST('2017-01-10 00:00:00.0' AS DATETIME))
,0) AS result
FROM inventory_item ii
WHERE ii.company_id = 1
AND ii.company_branch_id = 1
AND ii.inv_item_status = 'Inward'
AND ii.grn_date <  CAST('2017-01-10 00:00:00.0' AS DATETIME)

A: Not much to go on here for details. And we aren't actually sure if you are using mysql or sql server but pretty sure you are using sql server. I think you can accomplish what you are trying to do with something along these lines.
with Iventory as
(
    SELECT i.ITEM_ID
        , GoodQty = ISNULL(SUM(i.REC_GOOD_QTY), 0)
    FROM INVENTORY_ITEM i
    WHERE COMPANY_ID = 1
        AND i.COMPANY_BRANCH_ID = 1
        AND i.INV_ITEM_STATUS = 'Inward'
        AND i.GRN_DATE <  '2017-01-10'
    GROUP BY i.ITEM_ID
)
, StockRequisition as
(
    SELECT ITEM_ID
        , TotalLitre = SUM(TOTAL_LITRE)
    FROM STOCK_REQUISITION_ITEM B
    JOIN STOCK_REQUISITION A ON A.ID = B.REQUISITION_ID
    WHERE A.COMPANY_ID = 1
        AND A.REQ_FROM_BRANCH_ID = 1
        AND A.REQUISITION_DATE < '2017-01-10'
    GROUP BY B.ITEM_ID
)
StockReturn as
(
    SELECT ITEM_ID
        , ReturnQuantity = SUM(RETURN_QUANTITY)
    FROM STOCK_RETURN_ITEM B
    JOIN STOCK_RETURN A ON A.ID = B.STOCK_RETURN_ID
    WHERE A.COMPANY_ID = 1
        AND A.COMPANY_BRANCH_ID = 1
        AND A.RETURN_DATE <= '2017-01-10'
    GROUP BY B.ITEM_ID
)

select i.ITEM_ID
    , MyCalculation = i.GoodQty - isnull(Req.TotalLitre, 0) + isnull(sr.ReturnQuantity, 0)
from Inventory i
left join StockRequisition sr on sr.ITEM_ID = i.ITEM_ID
left join StockReturn Req on Req.ITEM_ID = i.ITEM_ID


text:
Q: Почему возвращается Can't call method "value" on an undefined value? #!usr/bin/perl
use strict;
use WWW::Mechanize;
use HTTP::Cookies;
my $outfile = "out.htm";
my $url = "https://id.rambler.ru/login-20/login/";
my $username = "test";
my $password = "pass";
my $cookiefile = 'cookies.txt';
my $mech = WWW::Mechanize->new();
$mech->cookie_jar(HTTP::Cookies->new());
$mech->get($url);
$mech->form_name('login_form');
$mech->field(login => $username);
$mech->field(password => $password);
$mech->click();
$mech->follow_link(text => "Войти", n => 1);
my $output_page = $mech->content();
open(OUTFILE, ">$outfile");
print OUTFILE "$output_page";
close(OUTFILE);

Can't call method "value" on an undefined value at /usr/share/perl5/vendor_perl/WWW/Mechanize.pm line 769.

A: Вы пытаетесь передать поле в несуществующую форму или в несуществующее поле, соответственно у вас ошибка.

*

*для начала выведите куда-то print $mech->content; и найдите глазами форму, которую вы заполняете.

*проверьте, что вы действительно получили форму (что получили от метода формы)


text:
Q: I am trying to install MongoDB for a node js express on a Windows 8 machine using 'npm install mongodb', getting following error I am trying to install MongoDB for a node js express on a Windows 8 machine using 'npm install mongodb'
    C:\Users\lisp\Desktop\CRUD>npm install mongodb
    /

kerberos@0.0.11 install C:\Users\lisp\Desktop\CRUD\node_modules\mongodb\node_modules\mongodb-core\node_modules\kerberos
  (node-gyp rebuild 2> builderror.log) || (exit 0)

C:\Users\lisp\Desktop\CRUD\node_modules\mongodb\node_modules\mongodbcor\node_modules\kerberos>if not defined npm_config_node_gyp (node "C:\ProgramFiles\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_module\node-gyp\bin\node-gyp.js" rebuild )  else (rebuild)
npm WARN installMany nopt was bundled with node-pre-gyp@0.6.4, but bundled packa ge wasn't found in unpacked tree
npm WARN installMany npmlog was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany request was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany semver was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany tar was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany tar-pack was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany mkdirp was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany rc was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany rimraf was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
/
> bson-ext@0.1.7 install C:\Users\lisp\Desktop\CRUD\node_modules\mongod\node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext> (node-pre-gyp install --fallback-to-build) || (node-gyp rebuild 2> builderror.log) || (exit 0)

C:\Users\lisp\Desktop\CRUD\node_modules\mongodb\node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" clean )  else (clean)

C:\Users\lisp\Desktop\CRUD\node_modules\mongodb\node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure --fallback-to-build --module=C:\Users\lisp\Desktop\CRUD\node_modules\mongodb node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext\build\Release\bson.node --module_name=bson --module_path=C:\Users\lisp\Desktop\CRUD\node_modules\mongodb\node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext\build\Release )  else (configure --fallback-to-build --module=C:\Users\lisp\Desktop\CRUD\node_modules\mongodb node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext\build\Release\bson.node --module_name=bson --module_path=C:\Users\lisp\Desktop\CRUD\node_modules\mongodb\node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext\build\Release )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT HON env variable.
gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:103:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules npm\node_modules\node-gyp\lib\configure.js:64:11
gyp ERR! stack     at FSReqWrap.oncomplete (evalmachine.anonymous>:95:15)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\lisp\\Desktop\\CRUD\\node_modules\\mongodb\\node_modules\\mongodb-core\\node_modules\\bson\\node_modules\\bson-ext\\build\\Release\\bson.node" "--module_name=bson" "--module_path=C:\\Users\\lisp\\Desktop\\CRUD\\node_modules\\mongodb\\node_modules\\mongodb-core\\node_modules\\bson\\node_modules\\bson-ext\\build\\Release"
gyp ERR! cwd C:\Users\lisp\Desktop\CRUD\node_modules\mongodb\node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd configure --fallb
ack-to-build --module=C:\Users\lisp\Desktop\CRUD\node_modules\mongodb\node_modul
es\mongodb-core\node_modules\bson\node_modules\bson-ext\build\Release\bson.node
--module_name=bson --module_path=C:\Users\lisp\Desktop\CRUD\node_modules\mongodb\node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext\build\Release
' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\lisp\Desktop\CRUD\node_modules\mongodb\node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
node-pre-gyp ERR! stack     at maybeClose (child_process.js:1015:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
node-pre-gyp ERR! System Windows_NT 6.2.9200
node-pre-gyp ERR! command "node" "C:\\Users\\lisp\\Desktop\\CRUD\\node_modules\\
 mongodb\\node_modules\\mongodb-core\\node_modules\\bson\\node_modules\\bson-ext\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp.js" "install" "--fallback-to-build"
 node-pre-gyp ERR! cwd C:\Users\lisp\Desktop\CRUD\node_modules\mongodb\node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext
node-pre-gyp ERR! node -v v0.12.2
node-pre-gyp ERR! node-pre-gyp -v v0.6.4
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd configure --fallback-to-build
--module=C:\Users\lisp\Desktop\CRUD\node_modules\mongodb\node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext\build\Release\bson.node --module_name=bson --module_path=C:\Users\lisp\Desktop\CRUD\node_modules\mongodb\node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext\build\Release' (1)

C:\Users\lisp\Desktop\CRUD\node_modules\mongodb\node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (rebuild)
npm ERR! Windows_NT 6.2.9200
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "mongodb"
npm ERR! node v0.12.2
npm ERR! npm  v2.7.4
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package mongodb does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer mongoskin@1.4.13 wants mongodb@~1.4

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\lisp\Desktop\CRUD\npm-debug.log

Thanks in advance.....:)

A: gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT HON env variable.

You need to install Python on your machine and set the Python executable as an environment variable. Python is required to build native modules on Windows.

A: Install python version 2.7, not the 3.x: http://www.python.org/
Config windows environment variables:

*

*Create environment PYTHON_PATH=C:\Python\2.7 (I use a custom path, use what you want, the default is C:\Python2.7 I believe)

*Create environment PYTHON=%PYTHON_PATH%\python.exe
Add PYTHON to your existing Path:
- Path=[...];%PYTHON%;
Note that you also may need other libraries like C++, so you'd need to install as well Visual Studio 2010/2013 (Express version is enough)


text: Q: Relation between a column vector and coordinate system. When we write a vector as a column matrix,what coordinate system does it correspond to.If it's the Cartesian system, does it mean that when we write vectors in other coordinate systems,we use the same form of column matrix,but replace each coordinate with those of corresponding system?


text:
Q: how to call a jquery function from javascript Let's say I created a function in jQuery table.js file.
function createCookie(name) {
    //...
}

how would I call this function from JavaScript in my main.php file? I tried calling it simply like
<script type="text/javascript">
createCookie("john");
</script>

I have included the table.js file but it's not working! I know that jQuery functions are called via .changeRows(5) and for that I have to change my function definition but in that case what object will be associated with this function as I am using this to create cookies!

A: <script type="text/javascript">
createCookie("john");
</script>

not
<script type"text/javascript>
createCookie("john");
</script>

A: Firstly, there is no such thing as a 'JQuery function'. A jQuery function IS as JavaScript function.
For the purposes of your question, however, it looks like you are probably including the JavaScript file in you PHP file AFTER the script block. so when the script block executes, the files hasn't yet been loaded.
You are also missing an = after the word type in your HTML and a closing " after javascript

A: First off all, jQuery is not a language. it's a library for javascript. Hence, you created a javascript function.
Since you're using jquery, just add
$(document).ready(function() {
    createCookie("john");
});

to the end of your js file
for standard js you could use
document.onload = function(){
    createCookie("john");
};


text:
Q: If all 2-faces of a polytope are $2n$-gons, is the edge-graph bipartite? I wonder if I can see easily whether the edge graph of a (convex) polytope $P\subset\Bbb R^d$ is bipartite or not.
A graph is bipartite if and only if all its cycles have even length.
I thought about the following: maybe, a polytope is bipartite if and only of all its 2-dimensional faces are $2n$-gons.
But then, the 2-faces are not all the cycles of the edge graph. So this might not be true.

Question: If all 2-faces of a polytope are $2n$-gons, is the edge graph of $P$ bipartite?

It is certainly true for $d=3$, as the cycle space of the edge graph of $P$ (a planar graph) is generated by the facial cycles.
The argument must make use of convexity or the spherical topology of $P$, as one can easily find polytopal complexs for which this statement is false (e.g. see the image below, which is taken from here).

A: H.S.M. Coxeter proves this in section 8.6 of his book Regular Polytopes.
In section 1.6, he shows "that alternate vertices of any even-faced simply-connected map can be picked out in a consistent manner (so that every edge joins two vertices of opposite types)."
He proves this by observing that any circuit of $N$ edges decomposes the map into two regions. Replacing one region by a single $N$-sided face, all faces but this one have evenly many sides, so $N$ must be even (since the number of odd faces must be even.)
Then in 8.6, he states "In fact, the argument used at the end of §1.6 may be extended to any number of dimensions, with the conclusion that alternate vertices of a simply-connected polytope or honeycomb can be selected whenever every face $\Pi_2$ has an even number of sides."
I will just quote the section:

...a circuit of edges can be shrunk to a point without leaving the manifold (i.e., without leaving the "surface" of the polytope). In other words, such a circuit is (generally in many different ways) the boundary of a two-dimensional region or "2-chain," consisting of a number of $\Pi_2$'s fitting together in such a way as to be topologically equivalent to a circle with its interior, or to the curved surface of an ordinary hemisphere.
If the circuit consists of $N$ edges, we can transform the 2-chain into a complete topological polyhedron (or two-dimensional map) by adding one $N$-sided face. Hence, by the remark at the end of §1.4, if every $\Pi_2$ has an even number of sides, the number $N$ must be even too. Finally, we select those vertices of the polytope or honeycomb which can be reached from a given vertex by proceeding along an even number of edges.

A: For $d=3$.
Start with a single vertex $V$, color it black.
Claim 1: Fix a vertex $v$. The parity of the distance between any vertex $v$ and $V$ is a constant.
Proof: Fix a path from $v$ to $V$. Take any other path from $v$ to $V$. Show that this can be written as the union of faces, minus the removal of edges taken twice.
Hence, the length of $v-V-v$ is even, so the paths have the same parity.
Corollary: Each vertex $v$ can be properly colored based on the parity of the distance to $V$.
Claim 2: This is a valid 2 coloring.
Proof: Take any 2 vertices $s, t$. The parity $s-V-t$ is the same as the parity of $s-t$, so they have the desired colors.

I'm less confident about this part.
Proof of claim 1 for higher dimensions $ d \geq 4$.
Claim 3: In a convex polytope (no holes), any edge-cycle splits the polytope into 2.
(In a sense, we want a "separating hyperplane" here, but ...)
Proof: Since we're in $\mathbb{R}^d$, orientation exists. We can walk around the cycle with a "left" and a "right" side.
For any vertex that is directly connected to the cycle on the left (resp right), color it red (resp blue).
For any vertex not on the cycle that is connected to another colored vertex, give it that color. Repeat until all of the vertices are colored (which is possible because the the vertex graph is connected).
If a vertex can inherit 2 colors, then there must be an edge that cuts within this cycle, which contradicts how convex polytopes are defined (?).
Corollary: For the cycle $v-V-v$, choose one of the halves, and then it can be written as the union of all of the faces on that half minus twice of all of the edges in that half (excluding the cycle).


text:
Q: Insert into table when row not exist else update table using Oracle SQL I am using Oracle database 12C. I have VK_ORDER table which has lot of redundant data with the combination of columns OID and EXID. The table has column FILENAME where the filename is given from which the data are getting inserted in this table and the table has SYSTEM_INSERTED_AT column where on which date time the data has inserted. The daily job is running on this table and redundant data of combination OID and EXID are getting inserted in this table.
I have created another table VK_MODIFY with below columns:
OID
EXID
FILENAME
FIRST_INSERT_DATE
LATEST_MODIFY_DATE

Now i want to write sql statment i am not sure if Merge sql statment works with the below conditions:
If the combination of columns values OID, EXID does not yet exist in the table then :
- Insert a new row
- Set FIRST_INSERT_DATE = LATEST_MODIFY_DATE = now()
- Write the name of the file to FILENAME

If the combination of columns value OID, EXID already exists in the table then:
- set LATEST_MODIFY_DATE = now()
- append the name of the file to FILENAME (prepend a comma – no space)

I can then simply run this query once in a day to update my VK_MODIFY table. I am not sure how to write this sql statment and whether its possible to using oracle sql statement.
DDL for VK_MODIFY table which has same data type as VK_ORDER table.
CREATE TABLE
    VK_MODIFY
    (
     FIRST_INSERT_DATE TIMESTAMP(6) NOT NULL,
     LATEST_MODIFY_DATE TIMESTAMP(6) NOT NULL,
     FILENAME VARCHAR2(60) NOT NULL,
     OID INTEGER,
     EXID VARCHAR2(100)
)

A: You can use the MERGE query as follows:
MERGE INTO VK_MODIFY T
USING (SELECT * FROM VK_ORDER) S
   ON (T.OID = S.OID AND (T.EXID = S.EXID OR (T.EXID IS NULL AND S.EXID IS NULL)))
WHEN MATCHED THEN
   UPDATE SET T.FILENAME = S.FILENAME || ',' || T.FILENAME,
              T.LATEST_MODIFY_DATE = SYSDATE
WHEN NOT MATCHED THEN
    INSERT(OID, EXID, FILENAME, FIRST_INSERT_DATE, LATEST_MODIFY_DATE)
     VALUES (S.OID, S.EXID, S.FILENAME, SYSDATE, SYSDATE);

A: Assuming oid and exid are both not null,
merge into vk_modify M

using (select * from vk_order) O
on ((M.OID,M.EXID) = (O.OID,O.EXID))
when matched then update
  set M.filename=M.filename||','||O.filename,
  latest_modify_date=sysdate
when not matched then insert (oid,exid,filename,first_insert_date,latest_modify_date)
values (O.oid,O.exid,O.filename,sysdate,sysdate);


text:
Q: Am I hitting artificial QSqlDatabase limits? I have a function which has been working well for ages, which begins
QSqlDatabase
DBUtil :: basic_open (const QString & path)
{
    static int connection_num = 0;
    static const QString CONNECTION_NAME = "Connection%1";

    QSqlDatabase db = QSqlDatabase :: addDatabase (
        "QSQLITE",
        CONNECTION_NAME .arg (connection_num++));

    db .setDatabaseName (path);

    if (false == db .open ())
    {
         // error

I am using this to open and read from many small SQLite databases, each ~200k, and when opening the 1013th one it fails with
 out of memory Error opening database

The total application's memory load is ~200M, with gigabytes free on the machine.
It seems like I'm hitting a limit other than sheer memory. Each QSqlDatabase object goes out of loop scope before the next is created, these databases aren't all existing concurrently, and I can't see any connection limits mentioned in the documentation. So I'm confused.
lsof reports about 200 open file handles before this loop starts and about 1,200 when it finishes, so it looks like Qt is keeping the handles open after ~QSqlDatabase, but still, if that's the limit it seems a bit low.
Any idea what's going on? This is on up-to-date Ubuntu.

A: First of all - QSqlDatabase is a singleton, so scope doesn't matter.
Try to close connection before opening new one.


text:
Q: Retrofit2: Expected BEGIN_ARRAY I am using for first time of Retrofit2 and I got this error:
Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $

I know my problem is my pojo class but I can't find the right solution to my problem.I create WCF web service an this service return to me a Arraylist of my user class as a json. this is my jsom response from wcf server by poster:
{
"GetUsersResult": [
    {
        "CreationDateTime": "/Date(1508174478395)/",
        "Id": "8e601956-04ab-4464-9f84-c129141b8198",
        "Topic": "Topics",
        "UserInfo": {
            "Age": "15",
            "Email": "",
            "LastName": "choopani",
            "Name": "niloofar",
            "SimId": "89984320001079005854"
        },
        "UserName": "niloo"
    },...

According my response I have created pojo class :
public class User {

@SerializedName("UserInfo")
private ExpChild mChildrenList;
private String UserName, CreationDateTime,Id,Topic;

public User(String mUserName,String mCreationDateTime,String mId,
                 String mTopic) {
    UserName = mUserName;
    CreationDateTime = mCreationDateTime;
    Id = mId;
    Topic = mTopic;
}

this is Interface for my client post method:
    @POST("json/GetUsers")
Call<List<User>> getAllUsers();

as you can see, I want to be returned a list of my User.
after that I create retrofit service creator and into my main Activity I've used it:
        allUsers.enqueue(new Callback<List<User>>() {
        @Override
        public void onResponse(Call<List<User>> call, Response<List<User>> response) {
            List<User> users = response.body();
        }

        @Override
        public void onFailure(Call<List<User>> call, Throwable t) {
            Toast.makeText(MainActivity.this, "faild to connect", Toast.LENGTH_SHORT).show();
            Log.i("====>", "onFailure: "+ t.getMessage());
        }
    });

but I got above error!!where is my mistake?

A: Your server returns a JSON object, but your interface says it expects a JSON array. (The List type).
You need to have a second object to represent the full response by the server:
public class ServerResponse {
    @SerializedName("GetUsersResult")
    private List<User> users;

    ... Constructor and getters here
}

Then the Retrofit interface should return Call<ServerResponse> which matches the returned JSON, fixing the error.


text:
Q: Last Logged on User on Offline Windows Installation Recently at work, I was wondering if there was a quick batch command I could use to look at some output and quickly determine which was the last user who logged on.  Users do not have roaming profiles, and the local profiles often need to be recovered manually (I know, I know I work with crazy people).  This means booting up WinPE on some failed computers and guessing who has not worked here for a long time, and making a judgement call on whether I can delete their refuse. So, I was thinking to look at the user profile directory (%SYSTEMDRIVE%\Users or %SYSTEMDRIVE%\Documents and Settings, what have you).  Obviously, that was pretty inaccurate.  Then, I thought NTUSER.DAT most be modified on every sequential login.  Can I just look at that like so?
for /d %subdir in (*) do dir /ah %subdir\ntuser.dat | findstr /i "ntuser.dat > lastlogon.log

I usually need to do this on a busted PE image with no whizbang tools.  Any thoughts?

A: You should have a look at LogParser utility. LogParser was written by a Microsoft employee in his spare time. It's an .exe that can run as a standalone utility without requiring "installation". It will even run when executed from a remote location such as \\server\share\logparser.exe or from within a remote RDP session as \\tsclient\c\path\to\logparser.exe
LogParser uses an SQL-like syntax to query Windows event logs -- even remotely! It can report results as nicely formatted .txt, .csv, .xml or even graphic charts output. (It can do much more than just query event logs, but this is what you need right now...). Try it:
logparser.exe -h examples

This will give you a few examples about what you can do with it. The next line will output the first 5 (oldest 5) events from the 'Application' eventlog of your own workstation:
logparser.exe "SELECT TOP 5 * FROM \\.\application"

The next query will output the top 20 events from 3 different eventlogs on 3 different servers:

*

*'Application' eventlog of remoteserver1 and

*'System' eventlog of remote2.

*'Security' eventlog of local system.

Try it (but write the following all in one line):
 LogParser.exe
   "SELECT TOP 20 *
    FROM \\remoteserver1\Application, \\remote2\System,\\.\Security
    ORDER by TimeGenerated DESC"

It will output the query results as a list in your cmd.exe window, in descending order. By default it will prompt you after 10 lines for more output. Oh, and the commandline params aren't even case sensitive, in case you like all lower casing better for faster typing. Here is something that may help your current needs. Again, type it in one line:
 logparser
    "select top 50
     timegenerated as logondate,
     extract_token(message, 0, ':') as logevent,
     extract_token(strings, 0, '|') as username,
     extract_token(strings, 1, '|') as domain
     from security
     where eventid not in (541;542;543)
     and eventtype = 8
     and eventcategory = 2 order by timegenerated desc"

Add -rtp:-1 if you want to override the defaualt value of 10 for rows to process, so you
are not prompted for more output every 10 lines.
It will be easy to put a fitting log parser query into a batch file LastLogins.bat and store that somewhere in your %PATH%...
Caveats:

*

*I have not really tested the above queries; you may need to tweak them for your own purpose.

*In the past I have used LogParser heavily on Windows XP and Windows 2003 Server, where it worked well. But I have no experience whatsoever on Vista or Windows 7 with it.

*PowerShell and the wmic.exe utility will be able to achieve similar things. It's just that logparser is my own preference for jobs like that.


text:
Q: Manual time loop control of FuncAnimation in matplotlib I'm looking for something similar to FuncAnimation with blit, but instead of having a the library call a function at a fixed timestep, I want to call the function myself whenever I'm ready. I don't understand what matplotlib does with the axes returned by the function to update them. I'm working with live data coming from outside sources and I want the refresh rate to be synced with that data.

A: I have done it something like this
import sys
import os
import random
from PySide import QtGui,QtCore
os.environ['QT_API'] = 'pyside'
from matplotlib import use
use('Qt4Agg')
import pylab as plt

class Example(QtGui.QMainWindow):

    def __init__(self):
        super(Example, self).__init__()
        self.setWindowTitle('Widgets')
        self.setGeometry(300, 300, 250, 150)

        self.wid = QtGui.QWidget()
        self.grid = QtGui.QGridLayout()
        self.wid.setLayout(self.grid)
        self.setCentralWidget(self.wid)

        self.dat = []
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.toc)
        self.timer.start(100)
        self.show()

        self.fig = plt.figure(13)
        plt.show()

    def toc(self):
        val = random.uniform(-1.7, 0.78)
        self.dat.append(val)
        plt.ion()
        fig = plt.figure(13)
        plt.clf()
        plt.plot(self.dat)
        plt.ioff()

def main():
    app = QtGui.QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())

if __name__ == '__main__':
    main()


text:
Q: How can I get the bytecodes that are executed at runtime for a Java program? The compiled .class file contains bytecodes corresponding to whole java class. However, during execution, some bytecodes are exectued multiple times while some are probably not executed at all, depending on the logic and the input. Is there a way that I could get a trace of only those bytecodes that are executed during the lifetime of the java program?
Edit: Use case
I think a use-case may help. After a sample run of the program, I would like to count the frequency of the bytecode instructions that were executed (e.g. areturn has been carried out 10 times). Is there a profiler or any other tool that I can use for this purpose?

A: this obscure paper talks about such a tool
http://ccsl.icmc.usp.br/files/vincenzi-et-al-2003.pdf
it's quite old (2003)
it states

This paper describes a coverage testing tool for Java programs and Java-based components, named JaBUTi
  (Java Bytecode Understanding and Testing). Differently from other testing tools that require
  the Java source code to carry out the program analysis, instrumentation and coverage assessment,
  our tool requires only the Java bytecode. Bytecode can be viewed as an assembly-like language that
  retains high-level information about a program [Lindholm and Yellin, 1999 ].
  Therefore, JaBUTi enables the user to test Java programs and Java-based components even when no
  source code is available. There are others testing tools that work at the bytecode level.
  The frame work JUnit [Beck and Gamma, 2002 ], for instance, can be used to test Java bytecode, but
  it only enables performing black-box testing; it does not report any coverage information.
  JTest [Corporation, 2002] and GlassJAR [Edge, 2002 ] provide coverage information with respect
  to control-flow testing criteria at the bytecode level, but none of them supports dataflow coverage
  testing criteria. By working at the bytecode level we want to provide a tool that can be used
  for testing not only Java applications that have the corresponding source code available, but also,
  the ones that have only the bytecode, like software components


text:
Q: About approximate eigenvalue I am in trouble when read the book "D.Henry, Geometric Theory of Semiliner Parabolic Equations". The question is relate to Page 104,proof Lemma 5.1.4.
Suppose $X$ is a real Banach Space, $M$ is a continuous linear operator on $X$ with specturm radius $r>0$. In the proof, it is says that: There exist $\lambda=re^{i\theta}$ in $\sigma(M)$. $\lambda$ is an approxiamte eigenvalue, for a fixed $\delta>0$ and any integer $N$, we may choose $u,v$ in $X$, $\|u\|=1\ge \|v\|$ such that,
$$\|Re\{M^n(u+iv)-\lambda^n(u+iv)\}\|<\frac{\delta}{2}r^n,0\le n\le N.$$
I want to ask how to know $\lambda$ is an approximate eigenvalue? Moreover, how to proof the existence of $u,v$ fulfil that inequality?


text:
Q: Moving an object left and right on particular top scroll position jquery I want to move an object having position absolute from left to right then right to left on particular scroll position. My object is at a particular position say from left it is left:300px. I want when top scroll reaches to 150px or greater, the object moves to 100px to right so that it left becomes left:400px and then it stops. Now matter how much we scroll down. And when user scroll top and again scroll top becomes 0, the object again moves to left by 100px and it left again becomes left:300px;
I have been trying jQuery animate and one jQuery Transit plugin. When I use jQuery animate it starts moving to right and then not stop on scroll down and continue to move right. When I use transit plugin it moves to right by 100px then stop there. But in either condition it doesn't move to left to its original position when scroll reaches to 0. My code looks like
$(window).on('scroll',
        function() {
            windowScrollTop = $(window).scrollTop();
            if (windowScrollTop == 0) {
                //using transit plugin. It should move to left by 100 px;
                $('.frameTwo .laptopClosed').transition({left: +100}, 1000, 'in');
                //$('.frameTwo .laptopClosed').animate({right: '+=100'}, 1000, 'linear');
            }
            if (windowScrollTop >= 150) {

                $('.frameTwo .laptopClosed').transition({x: 100}, 1000, 'in');
                //animate code commented
                $('.frameTwo .laptopClosed').stop().animate({left: '+=100'}, 1000, 'linear');
            }

        }
);

HTML

CSS
.laptopClosed {
    left: -325px;
    position: absolute;
    top: 314px;
}

A: Try to use -=100 when srollTop=0 like,
if (windowScrollTop == 0) {
    //using transit plugin. It should move to left by 100 px;
    $('.frameTwo .laptopClosed').transition({left: '-=100'}, 1000, 'in');
    // ------------------------ Use negative sign --^ here
}


text:
Q: Registering a Visual Studio 2008 Express product on an offline PC I have a large project that was built with VS 2008 and don't want to upgrade the project to a 2010 version just yet. I have VS 2008 Express but the trial period expired and it's installed in a computer with no access to the internet.
To get the registration key I only know of clicking the link in VS 2008 to get to the registration page. But is there a place I can go where Microsoft can provide the key from just logging in from an online computer with my Live account so I can copy that to my offline computer?

A: As of February 2015, the registration page returns a 404.
A workaround is to delete the following registry key: HKEY_CURRENT_USER/Software/Microsoft/VCExpress/9.0/Registration


text:
Q: yarn build. Error - Invalid options object I learn  React and try to build my own setup of webpack5 + babel and I have this error message in my console after run yarn build. Any ideas on how to fix that or what I did wrong?
Failed to load '/Users/admin/webpackFuel/webpack.config.js' config  Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.

options[0] misses the property 'patterns'. Should be:    [non-empty string | object { from, to?, context?, globOptions?, filter?, toType?, force?, info?, transform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)

A: I found the answer in this tread - npm run dev fails : ValidationError: Invalid options object
https://stackoverflow.com/a/62680933 - there it is. Totally forget about the word "patterns"


text:
Q: Chrome screen distorted in places Please refer to following 3 images. Screen is not rendered correctly on mouse hover.

The display gets corrected as long as I move the mouse again - so this problem is more of an annoyance, than any thing else. I have updated chrome and my updates are latest (15.04).
Only thing is that I am not using AMD fglrx drivers. Last time I used them, kernel complained as being tainted and my backlight controls stopped working. Any suggestions please

A: Seeing as you tried fglrx-updates, I recommend using just fglrx. The updates version tends to be buggy, since it's mainly beta releases.


text:
Q: http error 500 on require_once in Child Theme I'm getting an error 500 and i don't know why this is happening.
I'm building a wordpress child theme with the function file including two strings of "require_once" function to replace some php files of main theme.
 require_once( get_stylesheet_directory() . '/first path');
 require_once( get_stylesheet_directory() . '/second path');

Everything works as intended using only the first path.
Using both or only the second, results in an error 500.
Both paths are correct with the same permissions, there is no error in the htaccess and i don't know how to fix this issue.


text:
Q: PayPal IPN: (PHP) Send custom field without  I'm using CodeIgniter to create a page where users can register for a charity cycle my club is organising.
The registration page accepts info such as name/dob/phone number etc etc, and asks the user if they want to pay online or on the day. Clicking the submit button sends the info to the same page, runs form validation, inserts the info to the database (including timestamp) and checks if the user selected to pay online. If so, the user is redirected to the PayPal donate button URL to complete their payment.
My question is, how do I send the PayPal custom field through the URL? I have tried appending &custom=whatever to the button URL, (where 'whatever' is the new database row ID and the timestamp) but this doesn't work after completing a donation with a sandbox account.
IPN:
public function ipn()
{
    // STEP 1: Read POST data

    // reading posted data from directly from $_POST causes serialization
    // issues with array data in POST
    // reading raw POST data from input stream instead.
    $raw_post_data = file_get_contents('php://input');
    $raw_post_array = explode('&', $raw_post_data);
    $myPost = array();
    foreach($raw_post_array as $keyval)
    {
        $keyval = explode ('=', $keyval);
        if(count($keyval) == 2)
        {
            $myPost[$keyval[0]] = urldecode($keyval[1]);
        }
    }

    // read the post from PayPal system and add 'cmd'
    $req = 'cmd=_notify-validate';
    if(function_exists('get_magic_quotes_gpc'))
    {
        $get_magic_quotes_exists = true;
    }
    foreach($myPost as $key => $value)
    {
        if($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1)
        {
            $value = urlencode(stripslashes($value));
        }
        else
        {
            $value = urlencode($value);
        }
        $req .= "&$key=$value";
    }

    // STEP 2: Post IPN data back to paypal to validate

    $ch = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr');
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));

    // In wamp like environments that do not come bundled with root authority certificates,
    // please download 'cacert.pem' from "http://curl.haxx.se/docs/caextract.html" and set the directory path
    // of the certificate as shown below.
    // curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
    if(!($res = curl_exec($ch)))
    {
        // error_log("Got " . curl_error($ch) . " when processing IPN data");
        curl_close($ch);
        exit;
    }
    curl_close($ch);

    // STEP 3: Inspect IPN validation result and act accordingly

    if(strcmp($res, "VERIFIED") == 0)
    {
        // PAYMENT VALIDATED & VERIFIED!
        $custom = explode('_', $_POST['custom']);
        $reg_id = $custom[0];
        $date_registered = $custom[1];

        $query = $this->db->query('SELECT date_registered FROM registrations WHERE id=' . $reg_id);
        $array = $query->result_array();
        if($array['date_registered'] == $date_registered)
        {
            $data = array(
                'has_payed' => 1
            );
            $this->db->where('id', $reg_id);
            $this->db->update('registrations', $data);
        }
    }
    elseif(strcmp($res, "INVALID") == 0)
    {
        // do whatever
    }
}

Note that I need this to work to update the 'has_payed' field of the database, which requires the row ID to be sent when the registration page is submitted.
Registration controller:
// check payment online
if($this->input->post('pay_online') == 1)
{
    // redirect to paypal depending on route
    switch($route)
    {
        case '80':
        case '40':
            // €20 for over 16s
            if($age >= 16)
            {
                redirect('https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H3PFP5GGN2X5J&custom=' . urlencode($reg_id . '_' . $sql['date_registered']));
            }
            // €10 for anyone under 16
            else
            {
                redirect('a different button URL');
            }
            break;
        case '15':
            // €15 for family
            redirect('a different button URL');
            break;
    }
}

The above code is working, as in, I'm being redirected to the button URL when I submit the form with the appropriate values (i.e. doing the 80km or 40km route, and being over 16yo). When I complete the payment at the PayPal page, the 'has_payed' field in the database is not updated as it should be (see IPN page).
Also, note that I do obviously have IPN enabled in my sandbox seller account.
I have searched for hours for a solution to this, but cannot find anything. Maybe I'm overlooking something simple! I'd appreciate any help.
Thanks!

UPDATE
Instead of redirecting the user to the PayPal button URL, I'm now redirecting them to a HTML page with the <form> code on it, and a Javascript which auto-submits the form when they load the page. This is working fine, but the database field is still not updating when the user has donated.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" id="paypal_form" method="post" target="_top">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="hosted_button_id" value="H3PFP5GGN2X5J">
    <input type="hidden" name="notify_url" value="#IPN URL#" />
    <input type="hidden" name="custom" value="<?php echo urlencode($reg_id . '_' . $sql['date_registered']); ?>">
    <input type="image" src="https://www.sandbox.paypal.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
    <img alt="" border="0" src="https://www.sandbox.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>

A: You can pass over the variable "custom" in your button code that you send over to PayPal.  This would then be sent back to your system thru the IPN POST.  You should then be able to grab it from there and perform your actions that you need to.

A: The problem, of course, was simple.
CSRF protection was enabled in config.php, which caused the IPN to not work. Disabling it fixed the issue.


text:
Q: Want to keep showing old date for date field? I want to have my date field remember my old input after reloading or going to next page.
Is there any way I can do this?
I already tried this way !!
< input type= " date " id = " to_date " name = " to_date " value = " {{ old ( 'to_date' ) }} " >

A: You can store it in localStorage and while rendering fetch the value from localStorage.

A: I think that you have to call it from controller when you open/refresh your page like
Controller:
$to_date = $request->old('to_date');
return Redirect::to('/page')->withInput();

then, try run it again with your view
<input type= "date" id ="to_date" name="to_date" value="{{Carbon\Carbon::parse(old('to_date'))->format('Y-m-d')}}">

But, if you want to do the simpliest way is using localstorage, so you save the data first in your localstorage before reload page

A: Input with type date will accept in 2018-04-30 this format:
<input type= "date" id = "to_date" name = "to_date" value = "{{ Carbon\Carbon::parse(old ( 'to_date' ))->format('Y-m-d') }}">


text:
Q: Hosting a precompiled WCF REST service in IIS6 - how? Can anyone provide a repeatable process for hosting a precompiled website or a web application in IIS6 that can be built using aspnet_compiler? I cannot get code to build reliably (works sometimes) with aspnet_compiler without hitting the "cannot load type: global" error. Changing to a website does not help as I can't even get the precompiled site to come up in IIS6. Whether it's a site or an app makes no difference to me so long as it works.
If anyone has some good info or can point me in the right direction, much appreciated!

A: It should work if you develop it as a web application, which will compile the service code into a single DLL. Dropping that DLL into the bin directory and copying the SVC file should work fine.


text:
Q: SQL Server Management Studio 2016: How to disable auto-capitalization of keywords There was recently an update to SQL Server 2016 where keywords are automatically capitalized. While this is certainly convenient, I enjoy the freedom to capitalize words as I please (i.e. I don't always want keywords capitalized). Does anyone know how to disable this?

A: You can change the case you prefer to upper or lower under Tools / Options / Text Editor / Transact-SQL / IntelliSense

A: if the build is not working for you,try going back to an earlier one
(uninstall the last update)


text:
Q: why quotes " in Verbatime become tilde when adding \usepackage[T1]{fontenc} with tex4ht? There seems to be another strange interaction with packages here with tex4ht. I do not know if this is a feature of these packages that one is not supposed to mix them, or a bug. But it only shows up in the HTML not in the pdf.
This MWE
\documentclass[12pt]{report}%
\usepackage[T1]{fontenc}
\usepackage{fancybox,fancyvrb}
\usepackage{times}
\begin{document}
\begin{Verbatim}
htlatex foo.tex "htm,3"
\end{Verbatim}
\end{document}

Now htlatex foo.tex gives

The HTML is

  htlatex foo.tex ~htm,3~

When I comment either the package \usepackage[T1]{fontenc} or \usepackage{times}, then problem goes away and I get:

with HTML source

  htlatex foo.tex "htm,3"

I do not know what \usepackage[T1]{fontenc} does, but I remember reading it is good to have always? I use the times package to make the fonts more dark and more compact, which I like, even though I was told it is very old package. I had problems using \usepackage{newtxtext,newtxmath} with tex4ht (which I understand they replace the times package?), so I went back to using times. But I now I noticed this new problem on some of the pages I have.
I thought someone might be able to explain why this problem shows up.
texlive 2014.
 *File List*
  report.cls    2014/09/29 v1.4h Standard LaTeX document class
  size12.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
fancybox.sty    2010/05/15 1.4
fancyvrb.sty    2008/02/07
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
   times.sty    2005/04/12 PSNFSS-v9.2a (SPQR)
   t1ptm.fd    2001/06/04 font definitions for T1/ptm.
   t1pcr.fd    2001/06/04 font definitions for T1/pcr.
 ***********

A: It seems two errors were presented here, both of them in tex4ht hyper fonts. When we modify your sample slightly:
\documentclass[12pt]{report}%
\usepackage[T1]{fontenc}
\usepackage{fancybox,fancyvrb}
\usepackage{times}
\begin{document}
\begin{Verbatim}
htlatex foo.tex "htm,3"
\end{Verbatim}

\begin{verbatim}
htlatex foo.tex "htm,3"
\end{verbatim}
\font\x=pcrr8t
\x
htlatex foo.tex "htm,3"
\end{document}

we can see that this error does have nothing to do with fancyvrb package:

not only there are tildes instead of double quotes, text is also bold. text in plain is not in verbatim, because styling information in hyper fonts is not being used.
font used for code blocks in your example is pcrr8t and corresponding hyper font is pcrr8t.htf:
.bchr8t
htfcss: pcrr8t font-weight: bold;

two types of hyper fonts exists in tex4ht one provides values used for characters, other points to hyper font of the first type and add css style. pcrr8t.htf is this second type, pointing to bchr8t.htf. the error here is font-weight, which shouldn't be bold, but monospaced instead.
the other problem, as Ulrike pointed out, is wrong code for double quotes in bchr8t.htf. correct content of these files is following:
pcrr8t.htf:
.bchr8t
htfcss: pcrr8t font-weight: monospaced;

and bchr8t.htf:
bchr8t 0 255
'̀' ''  grave           0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'́' ''  acute           1 % bchr8t.htf                 2009-05-06 %
'̂' ''  circumflex      2 % Copyright (C) 2004--2009 Eitan M. Gurari %
'̃' ''  breve           3 %                                                                    %
'̈' ''  diaeresis       4 % This work may be distributed and/or modified under the conditions  %
'̋' ''  double acute    5 % of the LaTeX Project Public License, either version 1.3 of this    %
'̊' ''  ring above      6 % license or (at your option) any later version. The latest version  %
'̌' ''  tilde           7 % of this license is in http://www.latex-project.org/lppl.txt and    %
'̆' ''  dieresis        8 % version 1.3 or later is part of all distributions of LaTeX version %
'̄' ''  overbar         9 % 2003/12/01 or later.                                               %
'̇' ''                 10 %  This work has the LPPL maintenance status "maintained". This      %
'̧' ''                 11 % Current Maintainer of this work is Eitan M. Gurari.                %
'̨' ''                 12 %                                                                    %
'̦' ''                 13 % If you modify this file your your adding a note of                 %
'‹' '' < guillement    14 % your own after this copyright note will be appreciated.            %
'›' ''                 15 %                                                                    %
'“' ''                 16 %                                          gurari@cse.ohio-state.edu %
'”' ''                 17 %                              http://www.cse.ohio-state.edu/~gurari %
'„' ''                 18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'«' ''                 19
'»' ''                 20
'–' ''                 21
'—' ''                 22
'' ''                         23
'◾' ''                 24
'ı' '' dotlessi        25
'▮' ''                 26
'ﬀ' ''  ﬀ        27
'ﬁ' ''  ﬁ        28
'ﬂ' ''  ﬂ        29
'ﬃ' ''  ﬃ       30
'ﬄ' ''  ﬄ       31
'␣' ''  visible space  32
'!' ''                        33
'"' '' double quotes     34
'#' ''                        35
'$' ''                        36
'%' ''                        37
'&' ''  ampersand      38
'’' ''                 39
'(' ''                 40
')' ''                 41
'*' ''                 42
'+' ''                 43
',' ''                 44
'-' ''                 45
'.' ''                 46
'/' ''                 47
'0' ''                 48
'1' ''                 49
'2' ''                 50
'3' ''                 51
'4' ''                 52
'5' ''                 53
'6' ''                 54
'7' ''                 55
'8' ''                 56
'9' ''                 57
':' ''                 58
';' ''                 59
'<' ''          60
'=' ''                 61
'>' ''          62
'?' ''                 63
'@' ''                 64
'A' ''                 65
'B' ''                 66
'C' ''                 67
'D' ''                 68
'E' ''                 69
'F' ''                 70
'G' ''                 71
'H' ''                 72
'I' ''                 73
'J' ''                 74
'K' ''                 75
'L' ''                 76
'M' ''                 77
'N' ''                 78
'O' ''                 79
'P' ''                 80
'Q' ''                 81
'R' ''                 82
'S' ''                 83
'T' ''                 84
'U' ''                 85
'V' ''                 86
'W' ''                 87
'X' ''                 88
'Y' ''                 89
'Z' ''                 90
'[' ''                 91
'\' ''          92
']' ''                 93
'^' ''          94
'_' ''                 95
'‘' ''          96
'a' ''                 97
'b' ''                 98
'c' ''                 99
'd' ''                100
'e' ''                101
'f' ''                102
'g' ''                103
'h' ''                104
'i' ''                105
'j' ''                106
'k' ''                107
'l' ''                108
'm' ''                109
'n' ''                110
'o' ''                111
'p' ''                112
'q' ''                113
'r' ''                114
's' ''                115
't' ''                116
'u' ''                117
'v' ''                118
'w' ''                119
'x' ''                120
'y' ''                121
'z' ''                122
'{' ''                123
'|' ''                124
'}' ''                125
'~' ''                126
'̱' ''         127
'Ă' '' Abreve  128
'Ą' '' Aogonek 129
'Ć' '' Cacute  130
'Č' '' Ccaron  131
'Ď' '' Dcaron  132
'Ě' '' Ecaron  133
'Ę' '' Eogonek 134
'Ğ' '' Gbreve  135
'Ĺ' '' Lacute  136
'Ľ' '' Lcaron  137
'Ł' '' Lslash  138
'«' '' Nacute  139
'Ň' '' Ncaron  140
'◾' ''         141
'Ő' '' Ohungarumlaut  142
'Ŕ' '' Racute  143
'Ř' '' Rcaron  144
'Ś' '' Sacute  145
'Š' '' Scaron  146
'Ș' '' Scommaaccent  147
'Ť' '' Tcaron        148
'Ț' '' Tcommaaccent  149
'Ű' '' Uhungarumlaut 150
'Ů' '' Uring         151
'Ÿ' '' Ydieresis     152
'Ź' '' Zacute        153
'ž' '' Zcaron        154
'Ż' '' Zdotaccent    155
'Ĳ' '' IJ            156
'İ' '' Idotaccent    157
'đ' '' dcroat        158
'⩀' '' section       159
'ă' '' abreve   160
'ą' '' aogonek  161
'ć' '' cacute   162
'č' '' ccaron   163
'ď' '' dcaron   164
'ě' '' ecaron   165
'Ę' '' eogonek  166
'Į' '' gbreve   167
'ĺ' '' lacute   168
'ľ' '' lcaron   169
'ł' '' lslash   170
'ń' '' nacute   171
'ň' '' ncaron   172
'◾' ''          173
'ő' '' ohungarumlaut   174
'ŕ' '' racute          175
'ř' '' rcaron          176
'ś' '' sacute          177
'Š' '' scaron          178
'ș' '' scommaaccent    179
'ť' '' tcaron          180
'ț' '' tcommaaccent    181
'ű' '' uhungarumlaut   182
'ů' '' uring           183
'ÿ' '' ydieresis       184
'ź' '' zacute          185
'ž' '' zcaron          186
'ż' '' zdotaccent      187
'ĳ' '' ij              188
'¡' '' exclamdown      189
'¿' '' questiondown    190
'£' '' sterling        191
'À' '' Agrave       192
'Á' '' Aacute       193
'Â' '' Acircumflex  194
'Ã' '' Atilde       195
'Ä' '' Adieresis    196
'å' '' Aring        197
'Æ' '' AE           198
'Ç' '' Ccedilla     199
'È' '' Egrave       200
'é' '' Eacute       201
'Ê' '' Ecircumflex  202
'Ë' '' Edieresis    203
'Ì' '' Igrave       204
'Í' '' Iacute       205
'Î' '' Icircumflex  206
'¯' '' Idieresis    207
'Ð' '' Eth          208
'Ń' '' Ntilde       209
'Ò' '' Ograve       210
'Ó' '' Oacute       211
'Ô' '' Ocircumflex  212
'Õ' '' Otilde       213
'Ö' '' Odieresis    214
'×' '' multiply     215
'Ø' '' Oslash       216
'Ù' '' Ugrave       217
'Ú' '' Uacute       218
'Û' '' Ucircumflex  219
'Ü' '' Udieresis    220
'Ý' '' Yacute       221
'Þ' '' Thorn        222
'ß' '' germandbls   223
'à' '' agrave       224
'á' '' aacute       225
'â' '' acircumflex  226
'ã' '' atilde       227
'ä' '' adieresis    228
'å' '' aring        229
'æ' '' ae           230
'ç' '' ccedilla     231
'è' '' egrave       232
'é' '' eacute       233
'Ê' '' ecircumflex  234
'ë' '' edieresis    235
'ì' '' igrave       236
'í' '' iacute       237
'î' '' icircumflex  238
'ï' '' idieresis    239
'ð' '' eth          240
'ñ' '' ntilde       241
'ò' '' ograve       242
'ó' '' oacute       243
'ô' '' ocircumflex  244
'õ' '' otilde       255
'ö' '' odieresis    246
'÷' '' divide       247
'ø' '' oslash       248
'ù' '' ugrave       249
'ú' '' uacute       250
'û' '' ucircumflex  251
'ü' '' udieresis    252
'ý' '' yacute       253
'þ' '' thorn        254
'ß' '' beta         255
bchr8t 0 255

save these files in folder with your document. the result is now:

these issues should be reported to tex4ht bug list, it seems that there is a lot of problems with hyper fonts


text:
Q: Sequelize - left join MAX date from same table Current dataset:
id   userId   enrolledAt   active
1    22       2020-01-01   false
2    22       2020-05-05   true

How to retrieve all active records where enrolledAt should equal to the MIN(enrolledAt) from all active and inactive records for given user.
Starting point:
const include = [{
  model: User,
  as: 'user'
}];

Enrollment.findAll({ include, where: { active: true } });


text:
Q: Tab bar gets covered by the new view I have built an app based on a tab bar controller. While I am on one of the tab views I want to be able to swipe my finger and switch to another tab view of which the index on the tabBarController in unknown. I am therefore calling the desired viewcontroller from its nib. The view gets swapped correctly but the problem is that it appears ABOVE the tab bar itself, covering it completely and making it become unusable! How can I push the view back or the tab bar up? Thanks
- (IBAction)swipeLeftDetected:(UIGestureRecognizer *)sender
{
DesiredViewController *controllerInstance =[[DesiredViewController alloc]initWithNibName:@"DesiredViewController" bundle:nil];
controllerInstance.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controllerInstance animated:YES];
}

A: presentModalViewController:animated always uses whole screen: On iPhone and iPod touch devices, the view of modalViewController is always presented full screen. On iPad, the presentation depends on the value in the modalPresentationStyle property.
If you really use UITabBarController, it instantiates view controllers of its tabs. So trying to instantiate view controller of one of tabs manually is wrong. You will end in a mess of view controllers instances.
Set property selectedIndex of your UITabBarController to switch tab. I think you need this. But it will be switched without animation.
If you know only pointer of controller you want to switch to, ask viewControllers property about controller's index and than switch tab by its index:
self.selectedIndex = [[self viewControllers] indexOfObject:viewController];


text:
Q: Getting fatal error on push and clone the git I was able to push and pull from the git remote till yesterday. I don't know (or remember) what I did today suddenly I can't push to remote git repo. I am getting following error
$ git push
Counting objects: 83, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (16/16), done.
Writing objects: 100% (17/17), 1.32 KiB | 0 bytes/s, done.
Total 17 (delta 12), reused 0 (delta 0)
remote: fatal: unresolved deltas left after unpacking
error: unpack failed: unpack-objects abnormal exit
To //myserver/git/apps/myApp.git
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to '//myserver/git/apps/myApp.git'

And when I try to clone again I am getting error
$ Git clone //myserver/git/apps/myApp.git/
Cloning into 'MyApp'...
done.
fatal: unable to read tree 18295307f1270da3c09e3de91890652af4ff7ca8
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

Both
git status

and
git checkout -f HEAD

gives error
fatal: unable to read tree 18295307f1270da3c09e3de91890652af4ff7ca8

Can anyone help me understand what went  wrong and how can I fix it?
Thanks

A: So I solved this issue. Luckily my remote repo is up to date  with no error. With verify object command
git fsck --full

I saw the dangling tree. So I wen to the server and copy those missing object to my local copy. With continuous check and copy I am able to bring all missing object and finally able to push. Evey thing is up to date now.
Reason  to corrupt my local copy may be I delete the branch. Which I have done.


text:
Q: Fetch request not working on mobile devices I have a contact form with a fetch request to post (formspree contact form). While on desktop and in any browser it works just fine but as soon as I go mobile it doesn't..
The button of the form says 'Send', while submitting that value changes to 'Sending..' and after successful submission it says 'Message sent'. On mobile, after hitting the button it switches to 'Sending..' but then nothing else happens and also I don't receive the submission.
I tried debugging using ghostlab and all I get is:
formData.entries is not a function

I haven't found any solution by looking that up so was hoping someone here might have an idea..
Here is my code, note that if (typeof window !== undefined) and window.onload=function had to be added for anything to work at all since I am using gatsby js to build my site.
if (typeof window !== `undefined`) {

window.onload=function(){

  const sendButton = document.getElementById('send-button')

  const formDataToJson = formData => {
    const entries = formData.entries();
    const dataObj = Array.from(entries).reduce( (data, [key, value]) => {
      data[key] = value;
      if (key === 'email') {
        data._replyTo = value;
      }
      return data;
    }, {});
    return JSON.stringify(dataObj);
  };

  const postToFormspree = formData => fetch(`https://formspree.io/myemail@gmail.com`, {
    method: 'POST',
    body: formDataToJson(formData),
    headers: {
      'Content-Type': 'application/json'
    }
  }).then(r => r.json());

  document.getElementById('myform').addEventListener('submit', function (e) {

    e.preventDefault();

    sendButton.value = 'Sending..';

    const formData = new FormData(this);

    postToFormspree(formData).then(response => {
        sendButton.value = 'Message sent!';
        myform.reset();

    });
  });

}
}

A: After being pointed into the right direction by Barmar, I got it working by simply adding the formdata-polyfill npm package: https://www.npmjs.com/package/formdata-polyfill
and then inside my main.js I added
var WebFont = require('webfontloader');

like so:
if (typeof window !== `undefined`) {

window.onload=function(){

  require('formdata-polyfill')

.....

Deployed it and tested in chrome and FF on mobile and working fine so far

A: According to MDN FormData.entries is available in Chrome 50+, Firefox 44+, and Opera. It's not supported in Edge or Safari, and it's unknown what versions of Internet Explorer support it.


text:
Q: check if a variable is defined (null or not) I would like to test if a variable exists
This variable can be set to null.
Is there a function can test that?
isset() returns false if the variable exists but defined to null.
I can't use is_null() if my $var is not defined.
Edit:
my var is an object property so I did this:
property_exists($pData, $key)
and that works
Thx

A: I don't think you can - and you probably shouldn't. However, if you aren't using methods you can check the global scope:
$x = null;

var_dump(array_key_exists('x', $GLOBALS)); # true
var_dump(array_key_exists('y', $GLOBALS)); # false

See also https://3v4l.org/Sl8Wi


text:
Q: Why is this JS Form Verification script not triggering? I cannot figure out why my script is not triggering. I am trying to create form validation for this select element, requiring that is the Other option is chosen, then the following input field be set as required. As it is, the other_lab input field is not becoming required when Other is chosen in the select element. Here is the code:
<form id="form_1" method="post">
Lab
<select id="lab" required name="lab">
    <option disabled selected value="">Choose lab</option>
    <option value="Lab_1">ABC</option>
    <option value="Lab_2">DEF</option>
    <option value="Other">Other</option>
</select>

If other, please specify:
<input name="other_lab" id="other_lab" size="15">
</form>

A: I don't think it has any effect if onsubmit you add a required-attribute on any of the input elements. That is only going to affect the next submit.
Instead, if you want to make sure the form submit doesn't go through, use
e.preventDefault();

inside the condition that you need to prevent it on. This will cancel the submit, and the added required attributes can take effect on the next submit.

A: Use document.getElementById instead with the form id as a parameter, you used it with your other elements, why don't you use it with the form as well?
https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById

var form = document.getElementById('form_1');
form.onsubmit = function(e) {
  alert('submit');
}
<form id="form_1" method="post">
  Lab
  <select id="lab" required name="lab">
    <option disabled selected value="">Choose lab</option>
    <option value="Lab_1">ABC</option>
    <option value="Lab_2">DEF</option>
    <option value="Other">Other</option>
  </select>

  If other, please specify:
  <input name="other_lab" id="other_lab" size="15">
  <input type="submit" value="submit" />
</form>

document.getElementsByTagName returns a NodeList, not a single DOM node.
https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByTagName
notice the s in Elements which signals that it returns some form of collection.
I suggest you have a look at this page to learn about HTML forms:
https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Form_validation

A: You can solve this by binding that same function on selectbox's change event.