text:
Q: DataTables Excel style based on cell class I'm using DataTables plugin to export a monthly calendar view; I need to set a cell style inside the excel file based on the class of the corrisponding cell in the DataTables calendar view.
I know how to style the exported excel file using the customize: function( xlsx, index ) {} however I'm not able to find, in the examples I saw on the forum, a way to set the style of the excel cell based on the class of the corrispondig cell in the DataTables view.
I have created my own xml style like this:
customize: function( xlsx, index ) {
  var new_style = '<?xml version="1.0" encoding="UTF-8"?>'+
  '';

This is a styles.xml as you can find iside an .xlsx file if you change the extension to .zip
and than unzip it.
To apply the styles to the excel cell I'm doing:
  xlsx.xl['styles.xml'] = $.parseXML(new_style);
  var sheet = xlsx.xl.worksheets['sheet1.xml'];

  $('row:first c', sheet).attr( 's', '1' );
  $('row:eq(1) c', sheet).attr( 's', '2' );
  $('row:eq(2) c', sheet).attr( 's', '3' );
}

What I need to do is something like:
     $('row:eq(3) c', sheet).hasClass('custom').attr( 's', '1' ); //not working

or:
    $('row c[r^="B"]', sheet).each( function () {
       if ( $(this).hasClass('custom') ) {
       $(this).attr( 's', '4' );
      }
    }); // not working

Basically I'm working on a row of cells (more than 30, so I have AA, AB, AC and so on) and i need a method to discriminate some of them to add a different style, as you can see the header has 31 cells with calendars day/name and i would like the colums with Saturday and Sunday to be with a gray background like they are in the datatable table.
This is the datatable:

And this is the excel file so far, i need the Sab and Dom columns to be gray

UPDATE * with @andrewjames solution and @georg solution for double letters posted here Convert numbers to letters beyond the 26 character alphabet
function colName(n) {
  var ordA = 'A'.charCodeAt(0);
  var ordZ = 'Z'.charCodeAt(0);
  var len = ordZ - ordA + 1;
  var s = "";
  while(n >= 0) {
    s = String.fromCharCode(n % len + ordA) + s;
    n = Math.floor(n / len) - 1;
  }
  return s;
}

var cellIndexes = tabellaOre.cells(".Sab, .Dom").indexes();

for (var i = 0; i < cellIndexes.length; i++) {
  var cellIndex = cellIndexes[i];
  var tblRow = cellIndex['row']+4; //changed to my needs
  var tblCol = cellIndex['column']; //removed +1
  // var xlCol = String.fromCharCode(64 + tblCol); changed with follow
  var xlCol = colName(tblCol);

  // .... previous stuff here, it was already in a for() loop, so still working

  $('row c[r='+xlCol+tblRow+']', sheet).attr('s','12');
}

and this is the result:

As @andrewjames correctly says in his anwer:

My naive implementation will fail for more than 26 columns:

The colName(n) function solved the problem.
One last step would be to style the cells with thick borders with their own style, but I can consider this as solved.

A: Assumptions:
It sounds like you already have your embedded styles.xml customized the way you want it, and you therefore know what style index values to refer to, from its <cellXfs> section.
It sounds as if the missing piece is knowing which DataTables cells have been given which CSS style classes, so you can select the relevant <cellXfs> indexes for the equivalent Excel cells.
Proposed Approach:
This takes advantage of the fact that the customize function can be passed 3 variables:

*

*the XML files for the Excel

*an object representing the button object(s)

*the DataTable instance

We use this last one to map classes in the HTML to cells in Excel:
  var table = $('#example').dataTable({
    dom: 'Bfrtip',
    buttons: [
      {
        extend: 'excelHtml5',
        title: '', // no title row
        text: 'Excel',
        customize: function ( xlsx, btnObj, tableInst ){

          var cellIndexes = tableInst.cells(".mycustom").indexes();
          for (var i = 0; i < cellIndexes.length; i++) {
            var cellIndex = cellIndexes[i];
            var tblRow = cellIndex['row']+1; // adjusted from 0 indexed
            var tblCol = cellIndex['column']+1; // adjusted from 0 indexed
            var xlCol = String.fromCharCode(64 + tblCol); // DANGER: fails after Z (26 columns)
            alert('table row ' + tblRow + ' col ' + tblCol
                + ' maps to excel cell ref ' + xlCol + tblRow);
          }
        }
      }
    ]

  });

This doesn't apply any styles, it just shows you how to determine which DataTable cells have been given a specific style, and translates those cell indexes into Excel-style cell references.
So, for the following sample data...

                Head 1
                Head 2
                Head 3

                Row 1 column 1
                Row 1 column 2
                Row 1 column three

                Row 2 column 1
                Row 2 column 2
                Row 2 column 3

                Row 3 column 1
                Row 3 column 2
                Row 3 column 3

                Row 4 column 1
                Row 4 column 2
                Row 4 column 3

                Row 5 column 1
                Row 5 column 2
                Row 5 column 3

...the above code generates 2 alerts as follows:
table row 3 col 2 maps to excel cell ref B3
table row 5 col 1 maps to excel cell ref A5

You can then use the B3 and A5 values in the selectors you need - for example:
$('c[r=B3] t', sheet).attr( 's', '25' );

Additional notes:
The DataTables cells().indexes() function is described here.
My naive implementation will fail for more than 26 columns:
var xlCol = String.fromCharCode(64 + tblCol);

But it shouldn't be too hard to extend that for Excel columns "AA", "AB", and so on, if needed.
If you want to work at the column (or row) level, instead of the cell level, I have not tried that - but it should be a slightly simpler version of the above.


text:
Q: FB.XFBML.parse reloads the whole page instead of reloading the content for fb-videos I loaded two videos statically and the third one dynamically using     `
FB.XFBML.parse(document.getElementById("container-id"));

But instead of reloading the contaier it reloads the whole page.

But this same code for fb-comments works fine and it didn't reloads the page only the container. Please note that I have read some questions but what I need is to load fb-video on a new div dynamically Not by modifying the data-href of an existing one.

A: My Bad, it should be
   facebook.XFBML.parse(document.getElementById("cutty-video-basket"));

not
facebook.XFBML.parse(document.getElementById("comment_basket"));

Notable thing is as per my expectation, it loads dynamically without reloading.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why was Yoda reluctant to train Anakin when he ended up training an older Luke later on? Yoda was reluctant to train Anakin in Episode II because he said Anakin was too old to start training (even though Anakin was still a boy). However, in Episode V, Yoda didn't seem very reluctant to train Luke despite the fact that Luke was a full grown man by that time. Why did Yoda put up resistance to training Anakin yet he was willing to train Luke?

Note: the idea for this question came from http://www.moviemistakes.com/film409/questions/page2

A: Luke is their last hope (I know there is another) objections about his age would have to take a back seat to the more pressing threat that by the time Luke turns up on Dagobah there are only 2 Jedi left Yoda and Luke (with luke being a very tenuous Jedi at that).
As Obi-Wan was on Tatooine watching Luke we can assume that part of the plan formulated by Yoda and Obi-Wan when Luke and Leia were split up would involve Obi-Wan monitoring Luke and sending him to Yoda when he was ready. Which Obi-Wan does on Hoth.

A: I think that yes, Yoda felt that Anakin was too old. Not only that, but also, he felt that Anakin might not be fully suited for the life of a Jedi, partly because of his emotional connection to his mother. I seem to remember that Yoda and Master Windu had some misgivings, which was partly why they were reluctant to allow Qui-Gon to take him as an apprentice. Yes, the reason they gave was that he already had Obi-Wan as an apprentice, and taking on Anakin as well would have broken the rule of two. But even when Qui-Gon said Obi-Wan was ready, they were still reluctant.
The reason Yoda especially was against Anakin being trained was, yes because of his age, but it goes deeper than that. Anakin was too old. Jedi younglings start training very early to be learn to control their emotions and power. However, Anakin had too many emotions and had never really learnt to control them. Plus, he had his mother, who was a point of contention, because as shown in the second movie, she was the reason he disobeyed his mandate to protect Padme and went haring off to Tatooine.
However, Luke was a slightly different case. Not only was he the last hope (whether or not they count Leia is another matter), but he was more level-headed. Yes, he had rough patches where he raced off to find his friends on Bespin a-la Anakin going to Tatooine. But in the end, he is proven to be the better of the two when he triumphs over the dark side and rejects Darth Sidious. Yes, he was a lot older, but he was probably the only one strong enough at that time (physically and psychologically) to beat Darth Vader.
Also, errr, in the movie, Yoda actually was very reluctant to start training Luke. He first tries to test Luke by acting like a kid and then sighs and says, apparently to himself, that he can't teach Luke because he has no patience. Then Luke realised that the irritating little green alien was actually the Jedi master he had been searching for. And he tries to convince Yoda into agreeing to teach him, but is losing the argument until the voice of Obi-Wan joins in and convinces Yoda to teach him. But main point: Yoda was reluctant to teach Luke. Very reluctant.


text:
Q: Multiple References in a single square bracket using IEEEtran style in Latex I am using the IEEEtran document class and bibliography style in latex and my references are displayed as individual numbers in square brackets e.g. [1], [2].
However, I am trying to find a way to get multiple references in the same square brackets e.g. [1, 2].
I have tried using a comma between references when citing and it didn't work. I think it has something to do with the fact that it is in IEEEtran style.
TIA.


text:
Q: Is an alternating sequence never divergent? My question:
lets say the sequence $\{a_n\}_{n \in \mathbb{N}}$ is alternating and not against $0$, to avoid the Leibniz criterion.
Is that said sequence always divergent then?

A: Do you mean:

Suppose $a_n \geq 0$, and $a_n \not \rightarrow 0$. Is is true that the series $\Sigma _{n=1}^\infty (-1)^n a_n$ diverges?

Then the answer is that the series can't possibly converge to a real number, because the terms of a convergent series always converge to zero. No conclusion can be made about if it diverges to $\pm \infty$ or just doesn't converge at all.


text:
Q: How to cache view for all users in Django I'm trying to use a Memcached instance of AWS ElastiCache with a Django project.  It seems to be caching a view for a user, but if you come in on a different PC, it isn't cached until called from that PC (or same PC with different browser).
I'm not sure what I've got wrong.
Within settings.py I have
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': os.environ.get('CACHE_LOCATION','127.0.0.1:11211'),
    }
}

MIDDLEWARE = [
    'core.middleware.DenyIndexMiddleware',
    'core.middleware.XForwardedForMiddleware',
    'core.middleware.PrimaryHostRedirectMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.cache.UpdateCacheMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
    'masquerade.middleware.MasqueradeMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.contrib.sites.middleware.CurrentSiteMiddleware',
    'cms.middleware.user.CurrentUserMiddleware',
    'cms.middleware.page.CurrentPageMiddleware',
    'cms.middleware.toolbar.ToolbarMiddleware',
    'cms.middleware.language.LanguageCookieMiddleware',
    'cms.middleware.utils.ApphookReloadMiddleware',
    'django.middleware.cache.FetchFromCacheMiddleware',
]

I've then  cached the views using cache_page
path('<str:service_type>/<str:location>/', cache_page(60*60)(views.canonical_search), name="canonical-search"),

How do I cache the site so that the page is cached irrespective of the user?
EDIT
I've noticed that it never caches when using the user is logged in.

A: Watch out for the Vary header, that cache_page() takes into account.
Usually, some middlewares may add a Vary header, for example :

*

*CsrfViewMiddleware adds Cookie,

*GZipMiddlewareadds Accept-Encoding

*LanguageCookieMiddleware may add Accept-Language
meaning that as soon as you have a different Cookie (session), encoding, or language, you have a different version of cache for your page.
As for you case, the CsrfViewMiddleware may be the problem, you can add the decorator @csrf_exempt to your view so that the Vary: Cookie header is not set in the response.
More info at https://docs.djangoproject.com/en/3.0/topics/cache/#using-vary-headers

A: Though Django documentation, you can read this:
Django's cache framework
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': '127.0.0.1:11211',
    }
}

If you need to store a page in the local
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
        'LOCATION': 'c:/foo/bar',
    }
}

But, my recommendation is store the results (database result, assets, etc), as @PVSK show in this thread:
from django.core.cache import cache
def sample(request):
        cached_data = cache.get_many(['query1', 'query2'])
        if cached_data:
            return render(request, 'sample.html', {'query1': cached_data['query1'], 'query2': cached_data['query2']})
        else:
            queryset1 = Model.objects.all()
            queryset2 = Model2.objects.all()
            cache.set_many({'query1': queryset1 , 'query2': queryset2 }, None)
            return render(request, 'sample.html', {'query1': queryset1 , 'query2': queryset2})

A: Hm, at first I wondered if you're running into some cache default limitations. You are not using OPTIONS in your CACHE backend definition, so the cache is limited to 300 entries per default.
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': os.environ.get('CACHE_LOCATION','127.0.0.1:11211'),
        'OPTIONS': {
            'MAX_ENTRIES': 1000
        }

    }
}

The next possible problem, that we also had, is that the cache_key generation takes the full QUERY_STRING into account, so  (the ?param=bla). But you already stated that the url is the same for all users.
Next up, as SebCorbin correctly identified, are the potential Vary issues.
UpdateCacheMiddleware will never cache a cookie-setting response to a cookie-less request.
    def process_response(self, request, response):
        #...

        # Don't cache responses that set a user-specific (and maybe security
        # sensitive) cookie in response to a cookie-less request.
        if not request.COOKIES and response.cookies and has_vary_header(response, 'Cookie'):
            return response

        # ...

The order of execution of middlewares is top-to-bottom for process_request and bottom-to-top for process_response.
I suspect that one of lower middlewares (or the view) is setting a cookie, so you might be able to work around this issue by moving the 'django.middleware.cache.UpdateCacheMiddleware' below the offending middleware, but you risk loosing features if you don't move feature-middlewares like LocaleMiddleware as well.
If your view code is setting cookies you'll need to switch to the low-level cache API to cache costly operations (or move the cookie logic into a middleware that lives above the UpdateCacheMiddleware middleware).


text:
Q: I have an image of resolution 1241*2207.In which folder do i put this image into? Note:This is not a dublicate question as i want to know in terms of actual pixels in width and height which images should be put in which folder.In no question is this asked
Sorry if this is a beginner question.But I couldn't understand from the official documentation.I have a background image of resolution 1241px width and 2207px height.When i put this image in the drawable(mdpi) folder,the bitmap cannot be loaded because of its size.But when i put this image in hdpi folder the image is loaded.My question is how do i know beforehand which resolution image should be put in which drawable folder?
Thank you for your time

A: This is helpful for you.
 xlarge screens are at least 960dp x 720dp
    large screens are at least 640dp x 480dp
    normal screens are at least 470dp x 320dp
    small screens are at least 426dp x 320dp
    Generalised Dpi values for screens:

    320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7" tablet (600x1024 mdpi).
720dp: a 10" tablet (720x1280 mdpi, 800x1280 mdpi, etc).

    ldpi
    Vertical = 426 * 120 / 160 = 319.5px
    Horizontal = 320 * 120 / 160 = 240px
    mdpi
    Vertical = 470 * 160 / 160 = 470px
    Horizontal = 320 * 160 / 160 = 320px
    hdpi
    Vertical = 640 * 240 / 160 = 960px
    Horizontal = 480 * 240 / 160 = 720px
    xhdpi
    Vertical = 960 * 320 / 160 = 1920px
    Horizontal = 720 * 320 / 160 = 1440px

    px = dp*dpi/160

or
    36x36 for low-density (LDPI)

48x48 for medium-density (MDPI)

72x72 for high-density (HDPI)

96x96 for extra high-density (XHDPI)

180x180 for extra extra high-density (XXHDPI)

192x192 for extra extra extra high-density (XXXHDPI)


text:
Q: How to extract data recursively on Linux? I'm attempting to work on a large dataset, however, the format structure of the data has been split up into hundreds of directories.

data/:
  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
data/0:
  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  symbols  t  u  v  w  x  y  z
data/1:
  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  symbols  t  u  v  w  x  y  z
data/2:
  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  symbols  t  u  v  w  x  y  z
data/3:
  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  symbols  t  u  v  w  x  y  z
data/4:
  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  symbols  t  u  v  w  x  y  z
data/5:
  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  symbols  t  u  v  w  x  y  z
data/6:
  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  symbols  t  u  v  w  x  y  z
data/7:
  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  symbols  t  u  v  w  x  y  z
data/8:
  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  symbols  t  u  v  w  x  y  z
data/9:
  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  symbols  t  u  v  w  x  y  z
data/a:
  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  symbols  t  u  v  w  x  y  z

Furthermore, the file types are also completely random.

0:       UTF-8 Unicode text
1:       UTF-8 Unicode text
2:       UTF-8 Unicode text
3:       UTF-8 Unicode text
4:       UTF-8 Unicode text
5:       Non-ISO extended-ASCII text, with LF, NEL line terminators
6:       UTF-8 Unicode text
7:       UTF-8 Unicode text
8:       UTF-8 Unicode text
9:       UTF-8 Unicode text
a:       UTF-8 Unicode text
...
z:       UTF-8 Unicode text

The files contain a email:password format.
How can I get all of the content into a JSON file, or CSV file?
I'm looking to import the data to MongoDB.
Thanks.

A: I'm sure someone will help you better than I can but if I can point you in right direction I will.
Have you tried making a perl script? Ie
    opendir(DIR, ".");
 @files = grep(/\.cnf$/,readdir(DIR));
 closedir(DIR);

 foreach $file (@files) {
    //shuv in a JSON file
}

Something like that?

A: The question was tagged with python, so I would recommend os.walk() (documentation) for recursively reading files. Something like:
# path is the path to the data
for subdir, dirs, files in os.walk(path):
    for file in files:
        file_path = os.path.join(subdir, file)
        try:
            read_file(file_path) # This is where you read the files and push to mongo etc
        except:
            continue

For the second part about reading Non-ISO extended-ASCII English text, there are some answers that might be helpful here: File encoding from English text to UTF-8


text:
Q: Slim does not display as expected. I want to show on browser that "Hello, It's Nextflow" The following code segment does not display Hello It's, Nextflow as I had intended.
<?php
require 'vendor/autoload.php';
use \Slim\App;
$app = new App;
$app->get('/hello/', function() {
   echo "Hello, It's Nextflow";
});
?>

A: You need to call run method on Slim application to make it work. Add the following code to the bottom of your code:
$app->run();

Full file will be:
<?php
require 'vendor/autoload.php';
use \Slim\App;
$app = new App;
$app->get('/hello/', function() {
   echo "Hello, It's Nextflow";
});
// Run application
$app->run();
?>


text:
Q: angular.js get controller in javascript I'm working on a multiple platform app and I'm using angular.js. I have a controller where I have defined several actions (e.g. when the user clicks on an item the controller action navigates to a different side). It works great when I'm using HTML and angular.js but because it's an app for smartphones as well I will use the GoBack-Button to navigate to the start page if the current page is an other than the start page.
But the I can only assign a function to the event that the GoBack-Button is pressed in Javascript. So here's my question:
How can I get access to an angular-controller within a javascript file?
Here is my summarized code
ang.js:
(function () {
    var app = angular.module("MyApp", [])
    app.controller("MyController", function ($scope) {
        $scope.myData = [{
            key: "Object 1",
            data: "Lorem Ipsum"
        },{
            key: "Object 2",
            data: "Lorem Ipsum"
        },{
            key: "Object 3",
            data: "Lorem Ipsum"
        }];

        this.actions = {
            goToStart: function () {
                // Navigates to the start page
            },
            goToPage1: function () {
                // Navigates to page 1
            },
            goToPage2: function () {
                // Navigates to page 2
            }
        };
    });
})();

site.js:
(function () {
    // ....

    function onDeviceReady() {
        device.addEventHandler("backbutton", onBackButtonPressed);
    }

    function onBackButtonPressed() {
        // Here I like to use the MyController.actions.goToStart() function
    }

    // ...
})();


text:
Q: Why columns are invalid in my query I have the following query which gets the total for each month taking data from three different tables:
--DROP TABLE [database].[dbo].[finaltable]
--TRUNCATE TABLE [database].[dbo].[finaltable]
;WITH
Ranges AS (
    SELECT 'January' AS M, '1/1/2014' AS [START], '1/31/2014' AS [END]
    UNION ALL
    SELECT 'February', '2/1/2014', '2/28/2014'
    UNION ALL
    SELECT 'March', '3/1/2014', '3/31/2014'
    UNION ALL
    SELECT 'April', '4/1/2014', '4/30/2014'
    UNION ALL
    SELECT 'May', '5/1/2014', '5/31/2014'
    UNION ALL
    SELECT 'June', '6/1/2014', '6/30/2014'
    UNION ALL
    SELECT 'July', '7/1/2014', '7/31/2014'
    UNION ALL
    SELECT 'August', '8/1/2014', '8/31/2014'
    UNION ALL
    SELECT 'September', '9/1/2014', '9/30/2014'
    UNION ALL
    SELECT 'October', '10/1/2014', '10/31/2014'
    UNION ALL
    SELECT 'November', '11/1/2014', '11/30/2014'
    UNION ALL
    SELECT 'December', '12/1/2014', '12/31/2014'
),
Data AS (
    SELECT [Date], [APSURGICALTOTAL], [APDERMTOTAL], [GYNNONGYNTOTAL], [CYTOHPV], [INHOUSE], [HEMOTOLOGY], [CHEMISTRY], [BLOODBANK], [REFLAB], [URINALYSIS], [SEROLOGY], [MICROBIOLOGY]
    FROM [database].[dbo].[weeklytable]
    UNION ALL
    SELECT CONVERT(VARCHAR(10), [Date], 101), [LastWeekEMROrders], [LastWeekAccLabOrders], [LastWeekLabResults], NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
    FROM [database].[dbo].[dailytable]
    UNION ALL
    SELECT CONVERT(VARCHAR(10), [Date], 101), [RAD EMR ORDERS], [EMR ORDERS], [ACCESSIONED LAB ORDERS], [RAD RESULTED], [LAB_RESULT], [RAD ACCESSIONED], [PENDING FOR PROCESSING], NULL, NULL, NULL, NULL, NULL
    FROM [database].[dbo].[othertable]
),
Joined AS (
    SELECT M AS [Month],
    [APSURGICALTOTAL],
    [APDERMTOTAL],
    [GYNNONGYNTOTAL],
    [CYTOHPV],
    [INHOUSE],
    [HEMOTOLOGY],
    [CHEMISTRY],
    [BLOODBANK],
    [REFLAB],
    [URINALYSIS],
    [SEROLOGY],
    [MICROBIOLOGY],
    [LastWeekEMROrders],
    [LastWeekAccLabOrders],
    [LastWeekLabResults],
    [RAD EMR ORDERS],
    [EMR ORDERS],
    [ACCESSIONED LAB ORDERS],
    [RAD RESULTED],
    [LAB_RESULT],
    [RAD ACCESSIONED],
    [PENDING FOR PROCESSING]
    FROM Ranges R
    JOIN Data D ON D.[DATE] >= R.[START] AND D.[Date] <= R.[END]
)

SELECT [Month],
    SUM([APSURGICALTOTAL]) AS [SURGTOTAL],
    SUM([APDERMTOTAL]) AS [DERMTOTAL],
    SUM(GYNNONGYNTOTAL) AS [GNGTOTAL],
    SUM(CYTOHPV) AS [HPVTOTAL],
    SUM(INHOUSE) AS [HOUSETOTAL],
    SUM([HEMOTOLOGY]) AS [HEMOTOTAL],
    SUM([CHEMISTRY]) AS [CHEMTOTAL],
    SUM([BLOODBANK]) AS [BBTOTAL],
    SUM([REFLAB]) AS [REFTOTAL],
    SUM([URINALYSIS]) AS [URINTOTAL],
    SUM([SEROLOGY]) AS [SEROTOTAL],
    SUM([MICROBIOLOGY]) AS [MICROTOTAL],
    SUM([LastWeekEMROrders]) AS [LWEMRORDERSTOTAL],
    SUM([LastWeekAccLabOrders]) AS [LWACCLABORDERSTOTAL],
    SUM([LastWeekLabResults]) AS [LWLABRESULTSTOTAL],
    SUM([RAD EMR ORDERS]) AS [RADEMRTOTAL],
    SUM([EMR ORDERS]) AS [EMRORDERTOTAL],
    SUM([ACCESSIONED LAB ORDERS]) AS [ACCLABORDERSTOTAL],
    SUM([RAD RESULTED]) AS [RADRESTOTAL],
    SUM([LAB_RESULT]) AS [LABREDTOTAL],
    SUM([RAD ACCESSIONED]) AS [RADACCTOTAL],
    SUM([PENDING FOR PROCESSING]) AS [PENFORPROCTOTAL],
    month([Month]+'1 2010') AS [MonthNum]
INTO [database].[dbo].[finaltable]
FROM Joined
GROUP BY [Month]

I get the following errors:
Msg 207, Level 16, State 1, Line 56
Invalid column name 'LastWeekEMROrders'.
Msg 207, Level 16, State 1, Line 57
Invalid column name 'LastWeekAccLabOrders'.
Msg 207, Level 16, State 1, Line 58
Invalid column name 'LastWeekLabResults'.
Msg 207, Level 16, State 1, Line 59
Invalid column name 'RAD EMR ORDERS'.
Msg 207, Level 16, State 1, Line 60
Invalid column name 'EMR ORDERS'.
Msg 207, Level 16, State 1, Line 61
Invalid column name 'ACCESSIONED LAB ORDERS'.
Msg 207, Level 16, State 1, Line 62
Invalid column name 'RAD RESULTED'.
Msg 207, Level 16, State 1, Line 63
Invalid column name 'LAB_RESULT'.
Msg 207, Level 16, State 1, Line 64
Invalid column name 'RAD ACCESSIONED'.
Msg 207, Level 16, State 1, Line 65
Invalid column name 'PENDING FOR PROCESSING'.

I asked my original question here with dummy table: Stackoverflow Question Link
A lot of people helped me with the dummy tables. Now I am trying to do the same with my real table but it's giving me all the errors listed above.
How can I resolve the error, so it works just like it was working with the dummy tables?

A: The problem is with this portion:
SELECT [Date], [APSURGICALTOTAL], [APDERMTOTAL], [GYNNONGYNTOTAL], [CYTOHPV], [INHOUSE], [HEMOTOLOGY], [CHEMISTRY], [BLOODBANK], [REFLAB], [URINALYSIS], [SEROLOGY], [MICROBIOLOGY]
    FROM [database].[dbo].[weeklytable]
    UNION ALL
    SELECT CONVERT(VARCHAR(10), [Date], 101), [LastWeekEMROrders], [LastWeekAccLabOrders], [LastWeekLabResults], NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
    FROM [database].[dbo].[dailytable]
    UNION ALL
    SELECT CONVERT(VARCHAR(10), [Date], 101), [RAD EMR ORDERS], [EMR ORDERS], [ACCESSIONED LAB ORDERS], [RAD RESULTED], [LAB_RESULT], [RAD ACCESSIONED], [PENDING FOR PROCESSING], NULL, NULL, NULL, NULL, NULL
    FROM [database].[dbo].[othertable]

The problem columns do not appear in the original select.  When you UNION ALL, the columns for the first select should match the following queries.

A: You need to make sure the columns "line up" in the UNION ALL statement.  It is easier to see if you put the column names in for all columns -- like this:
You need to make sure your date column is a date or datetime type.  If you store strings then convert them -- trying to do a date compare on a string is a bad plan -- use the dates and let the server compare apples to apples.
Data AS (
    SELECT
      CAST([Date] AS DateTime) AS [DATE],
      [APSURGICALTOTAL],
      [APDERMTOTAL],
      [GYNNONGYNTOTAL],
      [CYTOHPV],
      [INHOUSE],
      [HEMOTOLOGY],
      [CHEMISTRY],
      [BLOODBANK],
      [REFLAB],
      [URINALYSIS],
      [SEROLOGY],
      [MICROBIOLOGY],
      NULL AS [LastWeekEMROrders],
      NULL AS [LastWeekAccLabOrders],
      NULL AS [LastWeekLabResults],
      NULL AS [RAD EMR ORDERS],
      NULL AS [EMR ORDERS],
      NULL AS [ACCESSIONED LAB ORDERS],
      NULL AS [RAD RESULTED],
      NULL AS [LAB_RESULT],
      NULL AS [RAD ACCESSIONED],
      NULL AS [PENDING FOR PROCESSING]
    FROM [database].[dbo].[weeklytable]
    UNION ALL
    SELECT
      [Date],
      NULL AS [APSURGICALTOTAL],
      NULL AS [APDERMTOTAL],
      NULL AS [GYNNONGYNTOTAL],
      NULL AS [CYTOHPV],
      NULL AS [INHOUSE],
      NULL AS [HEMOTOLOGY],
      NULL AS [CHEMISTRY],
      NULL AS [BLOODBANK],
      NULL AS [REFLAB],
      NULL AS [URINALYSIS],
      NULL AS [SEROLOGY],
      NULL AS [MICROBIOLOGY],
      [LastWeekEMROrders],
      [LastWeekAccLabOrders],
      [LastWeekLabResults],
      NULL AS [RAD EMR ORDERS],
      NULL AS [EMR ORDERS],
      NULL AS [ACCESSIONED LAB ORDERS],
      NULL AS [RAD RESULTED],
      NULL AS [LAB_RESULT],
      NULL AS [RAD ACCESSIONED],
      NULL AS [PENDING FOR PROCESSING]
    FROM [database].[dbo].[dailytable]
    UNION ALL
    SELECT
      [Date],
      NULL AS [APSURGICALTOTAL],
      NULL AS [APDERMTOTAL],
      NULL AS [GYNNONGYNTOTAL],
      NULL AS [CYTOHPV],
      NULL AS [INHOUSE],
      NULL AS [HEMOTOLOGY],
      NULL AS [CHEMISTRY],
      NULL AS [BLOODBANK],
      NULL AS [REFLAB],
      NULL AS [URINALYSIS],
      NULL AS [SEROLOGY],
      NULL AS [MICROBIOLOGY],
      NULL AS [LastWeekEMROrders],
      NULL AS [LastWeekAccLabOrders],
      NULL AS [LastWeekLabResults],
      [RAD EMR ORDERS],
      [EMR ORDERS],
      [ACCESSIONED LAB ORDERS],
      [RAD RESULTED],
      [LAB_RESULT],
      [RAD ACCESSIONED],
      [PENDING FOR PROCESSING]
    FROM [database].[dbo].[othertable]
),


text:
Q: Showing a Time Series is Regular Note: this is not an assessed question, it is a practice question from a past exam.
If we are given the following time series:
$X_t=\alpha^2X_{t-1}+Z_t-\alpha Z_{t-1}+2\alpha^2$
I am asked to find the values for $\alpha$ for which this is regular (i.e. the MA part is invertible and the AR part is causal, moreover the lack of a common root means that the process may not be simplified). Is what I have done correct?
I write the time series in the form $\phi(B)X_t=\theta(B)Z_t$ with $\phi(B)=(1-\alpha^2)$ and $\theta(B)=(1-\alpha B- \alpha B^2)$, where $B$ is the backshift operator.
We can then see that this is an $ARMA(1,2)$ model, and for an ARMA  model we know that it is regular if the roots of both $\phi(B)=0$ and $\theta(B)=0$ lie outside the unit circle and they share no common roots.
Now the roots of $\phi(B)=0$ are $B=\frac{1}{\alpha^2}$ so this lies outside the unit circle if $|\alpha| < 1$
The roots of $\theta(B)$ are given by $\frac{-1}{\alpha},\frac{-1}{2\alpha}$ and these lie outside the unit circle is $|\alpha|< 1 $ and $|\alpha |<\frac{1}{2}|$
So in order for this process to be regular we require that $|\alpha| < \frac{1}{2}$, where we note that the roots will never be shared in this range.
Is the above correct/ the correct approach?


text:
Q: Could we construct an inverse transform for the equivalence $D^b(X)\to D^b(M)$ between a K3 surface and its moduli space of semistable sheaves? Let $X$ be a K3 surface and fix an ample line bundle on $X$. Let $v\in \widetilde{H}(X,\mathbb{Z})$ be a Mukai vector and $M(v)$ be the moduli space of semi-stable coherent sheaves on $X$ with Mukai vector $v$. Under certain conditions on $v$, we could show that $M(v)$ is a fine moduli space and parametrizes only stable sheaves and in addition dim$M(v)=2$. As a result there exists a universal sheaf $\mathcal{E}$ on $X\times M(v)$. Let $M\subset M(v)$ be a connected component. Then we have the following theorem of Mukai.

Under above assumptions, the integral transform
    $$
\Phi_{\mathcal{E}}:D^b(X)\to D^b(M)
$$
    gives an equivalence of trangulated categories, where $D^b(-)$ denotes the bounded derived category of coherent sheaves. See Huybrechts Section 10.3 for details.

The proof of above theorem in Huybrechts depends on the general criterion of equivalence of integral transforms rather than giving an inverse functor. Nevertheless, in the analogue theorem for abelian varieties, an inverse functor could be given.

My question is: for a K3 surface $X$, could we construct an inverse functor for $\Phi_{\mathcal{E}}$ and realize it as a integral transform?


text:
Q: How can I download the HTML code from a website in an Android app I am writing? I've searched everywhere, but I can not find a good .java file that downloads the HTML code of a website, and puts it into a String on Android.
I've tried using apps that import Apache jar software, but I can not get it to work.
The following are the Apache java files I have imported that don't work.
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.HttpResponse;

Please help me.
I would like to download the HTML code for "http://finance.yahoo.com/q?s=AAPL"

A: Just use URL objects and read data:
URL oracle = new URL("http://finance.yahoo.com/q?s=AAPL");
BufferedReader in = new BufferedReader(
new InputStreamReader(oracle.openStream()));
StringBuilder sb=new StringBuilder();
String inputLine;
while ((inputLine = in.readLine()) != null)
    sb.append(inputLine);
in.close();
String data=sb.toString();


text:
Q: Set object property (string) as Text Index I know from the mongodb docs that we only can set strings or arrays of strings as text indexes for future searches. I want to know if it's possible to have as index an string which is a string property of an object. For example:
Person: {
 name: String
}

Could be name a text index?

A: Yes, you definitely can:
db.collection.createIndex({'Person.name': 'text'});

In Mongoose:
schema.index({'Person.name': 'text'});


text:
Q: What is the benefit in getting the current time this way as opposed to using System.currentTimeInMillis()
Possible Duplicate:
System.currentTimeMillis() vs. new Date() vs. Calendar.getInstance().getTime()

I have just come across this in some legacy code:
GregorianCalendar.getInstance().getTime().getTime()

This just seems like a very circuitous way of calling System.currentTimeInMillis().
The server that this code runs on is probably running in a timezone other than UTC, but looking at the source of Date.getTime() everything will be GMT-based anyway (yes, I know that GMT doesn't precisely equal UTC).
Could there be a benefit I'm not aware of?


text:
Q: C# Multiuser Database Connection I am tasked with creating a central Database for a small office to allow multiple computers to connect to a database using a C# program. I have already written the program and it currently connects with a database that is in the bin folder.
I am completely lost as to how to move on to creating a multi user environment. I searched all around SO and tried downloading Microsoft SQL Server, but I have no idea how I would set this up in the office and allow it to be accessed from multiple computers. Also, from the information I've gathered, Microsoft SQL Server needs to be running at all times to allow a connection -- this isn't a deal breaker, but is there any other methods that wouldn't need this? There isn't exactly a "main computer" in the office that is always running.

A: To run a centralized sql server database in your office you would at a minimum setup sql server on a "server". The server can be pretty simple unless you expect a heavy user load.
The server has to be on in order to allow connections.
Sql Server exists in a free version called Sql Server express, but it has limitations when it comes to scalability, so it's not meant for large systems.
You can download it and install it on your server in the office and connect to it through a connection string in your application.
You can also consider open source platforms like mySQl, but it would still require a central server.
Alternatively you can consider a hosted solution where you have a company host the database for you in their data center.

A: If you do not have the server computer in your office that will host the DBMS and allow others to connect to your DB using the web interface, try to use Windows Azure. This will cost you some money. Here you need to estimate what is cheaper for you: purchase a server or pay for the azure.


text:
Q: indexOf alike function in HIVEQL I have the following query:
SELECT
    col1,
    case when array_contains(col1, "c") then "c exists" end as col2
FROM
    (
    SELECT
        *
    FROM
        (
        SELECT
            array("a","b","c") AS col1
        ) q1
    ) q2;

I want to check if the element "c" appears just before the element "b" in the array. In JavaScript I could use indexOf(), so if there were something similar in HiveQL I would do something like case when col1.indexOf("b") = col1.indexOf("c") - 1.
I have read the documentation, and it seems that the functions dealing with arrays are minimal.
I wouldn't like to split the array and check with LAG or LEAD.
I have tried with field("c", concat_ws(',',col1)) but this seems not to work neither.

A: You can concatenate array and use like or rlike. Example:
SELECT  concat_ws(',',col1) rlike 'c,b' as c_before_b_flag
FROM
        (
        SELECT
            array("a","b","c") AS col1
        ) q1

Result:
false

rlike 'b,c' gives true


text:
Q: How can I use leaflet-semicircle with vue2-leaflet in a VueJS project? I use Vue2Leaflet
and Leaflet-semicircle. I don't have a problem when using Vue2Leaflet, but I don't know how to use Leaflet-semicircle in my VueJS project.
<script>
    import { latLng } from "leaflet";
    import { LMap, LTileLayer, LMarker, LCircleMarker, LPopup, LTooltip } from "vue2-leaflet";
    import { mapGetters } from 'vuex';
    import moment from 'moment';
    import 'leaflet-semicircle';

    export default {
        name: 'Map',
        components: { LMap, LTileLayer, LMarker, LCircleMarker, LPopup, LTooltip, LSemicircle },
        data() {
            return {
            map: null,
            zoom: 12,
            center: latLng(53.88694, 27.554572),
            url: 'http://192.168.1.1/osm-tiles/{z}/{x}/{y}.png',
            withPopup: latLng(53.88694, 27.524572),
            withTooltip: latLng(53.88694, 27.565572),
            currentZoom: 12,
            currentCenter: latLng(53.88694, 27.554572),
            showParagraph: false,
            mapOptions: {
                zoomSnap: 0.5
            },
            showMap: true
            };
        },
        mounted() {
            this.map = this.$refs.map.mapObject;
            this.$nextTick(() => {
                this.map = this.$refs.map.mapObject;
            });
        },
        updated() {
            L.semiCircle(latLng(53.88694, 27.554572), { // not working
                radius: 5000,
                startAngle: 45,
                stopAngle: 360
            }).addTo(this.map);
        },
        computed: {
            ...mapGetters('targetControl', { events: 'getEvents'}),
        },
        ...
        ...
    }
</script>

A: I resolved this problem:
import L from "leaflet";
import 'leaflet-semicircle';

latLng changed by L.latLng

I just didn't have L function from leaflet

A: Sorry, it's probably not exact answer you need but still.
I see a few options:
1) Check sources https://github.com/vue-leaflet/Vue2Leaflet/blob/master/src/components/LCircle.vue and based on that component create your own (API from  Leaflet-semicircle says that is shouldn't be a headache )
2) Check page https://vue2-leaflet.netlify.com/plugins/ there are a list of plugins. The closest one is probably https://github.com/ais-one/vue2-leaflet-tracksymbol It added another leaflet plugin functionality to vue2leaflet
and by analogy create your own plugin for that
3) the hacky one. You can override the original circle component on leaflet class (I do not recommend to do that, but it's still an option)


text:
Q: Can't get body node from html document using xpath I know this is a stupid question but i just cant find an issue with it. Can't get inner text from body node in html document using xpath.
Code i am using:
HtmlWeb web = new HtmlWeb();

HtmlDocument doc = web.Load(String.Format(url, companyName));

HtmlNode node = doc.DocumentNode.SelectSingleNode("//body");
string code = null;
try
{
     code = node.FirstChild.InnerText;
}
catch (NullReferenceException e)
{
}

website structure:

     PYRIX | preston york

A: I just tried node.InnerText and it works. The problem must be in how you are loading the document.
This works:
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml("PYRIX | preston york");

var node = doc.DocumentNode.SelectSingleNode("//body");

Console.WriteLine(node.InnerText);


text:
Q: pandas checks if the no. of true in each group is equals to 1 I have the following df,
cluster_id    dummy
1             False
1             True
1             True
2             False
2             False
3             False
3             True

I want to create a boolean column 'dummy_display', which is set to False if there is at least one dummy == True in each cluster and the number of True values is less than the length of the cluster, so the results should look like,
cluster_id    dummy     dummy_display
1             False     False
1             True      False
1             True      False
2             False     True
2             False     True
3             False     False
3             True      False

A: Use transform with any
In [137]: ~df.groupby('cluster_id')['dummy'].transform('any')
Out[137]:
0    False
1    False
2    False
3     True
4     True
5    False
6    False
Name: dummy, dtype: bool

In [139]: df['dummy_display'] = ~df.groupby('cluster_id')['dummy'].transform('any')

In [140]: df
Out[140]:
   cluster_id  dummy  dummy_display
0           1  False          False
1           1   True          False
2           1   True          False
3           2  False           True
4           2  False           True
5           3  False          False
6           3   True          False

A: In My Opinion...
@Zero's answer is simpler and should be the goto approach.  But I couldn't help but provide a Numpy alternative.
i, u = pd.factorize(df.cluster_id)
a = np.zeros(len(u), np.bool8)
np.logical_or.at(a, i, df.dummy.values)

df.assign(dummpy_display=a[i])

   cluster_id  dummy  dummpy_display
0           1  False            True
1           1   True            True
2           1   True            True
3           2  False           False
4           2  False           False
5           3  False            True
6           3   True            True

Breakdown
pandas.factorize creates an array of integers representing the unique values in df.cluster_id
i, u = pd.factorize(df.cluster_id)
print(f"factorization (i): {[*i]}\nunique values (u): {[*u]}")

factorization (i): [0, 0, 0, 1, 1, 2, 2]
unique values (u): [1, 2, 3]

We then initialize False values for each unique cluster_id
a = np.zeros(len(u), np.bool8)
print(f"accumulated `or` init (a): {[*a]}")

accumulated `or` init (a): [False, False, False]

Then use the np.logical_or.at function to accumulate using or logic given specified indices and boolean values
np.logical_or.at(a, i, df.dummy.values)
print(f"accumulated `or` post (a): {[*a]}")
print(f"broadcast over factorization (a[i]):\n  {[*a[i]]}")

accumulated `or` post (a): [True, False, True]
broadcast over factorization (a[i]):
  [True, True, True, False, False, True, True]

Let's take a deeper look.  I'll iterate through and show the evolution of what happens to the grouped accumulation variable a
a = [False, False, False]
print(f"accumulate `or` init (a): {a}", end='\n\n')

d = df.assign(i=i, a=None)[['cluster_id', 'i', 'dummy', 'a']]

for j in d.index:
  a[d.at[j, 'i']] |= d.at[j, 'dummy']
  d.at[j, 'a'] = [*a]

d

   cluster_id  i  dummy                              a
            at ↓     ⇩  or a[0]          ⇩
0           1  0  False              [False, False, False]
                             ╭──────────⤴
            at ↓     ⇩  or a[0] ==       ⇩
1           1  0   True               [True, False, False]
                             ╭──────────⤴
            at ↓     ⇩  or a[0] ==       ⇩
2           1  0   True               [True, False, False]
                             ╭─────────────────⤴
            at ↓     ⇩  or a[1] ==              ⇩
3           2  1  False               [True, False, False]
                             ╭─────────────────⤴
            at ↓     ⇩  or a[1] ==              ⇩
4           2  1  False               [True, False, False]
                             ╭────────────────────────⤴
            at ↓     ⇩  or a[2] ==                     ⇩
5           3  2  False               [True, False, False]
                             ╭────────────────────────⤴
            at ↓     ⇩  or a[2] ==                     ⇩
6           3  2   True                [True, False, True]

And the same broadcasting we showed above
print(f"result (a): {a}\nbroadcasted (a[i]):\n  {[a[j] for j in i]}")

result (a): [True, False, True]
broadcasted (a[i]):
  [True, True, True, False, False, True, True]


text:
Q: in MS Access, after creating a dynamic query, how does one update the textboxes on the form with the corresponding values from the recordset? Following the example here: https://support.microsoft.com/en-us/help/304302/how-to-build-a-dynamic-query-with-values-from-a-search-form-in-access I have created a search button that searches a table and seem to pull in the correct SQL statement. However, on this form I have several textboxes (UserID, FirstName, LastName, Department) which are tied to their respective columns in the database. How to I update these textboxes inside the form frmSearchUsers to reflect the results of the filtered/queried table?
I would have thought a Me.Requery would be sufficient, however the textboxes remain blank (save for txtSQL)
Private Sub cmdSearch_Click()
On Error Resume Next

Dim ctl As Control
Dim sSQL As String
Dim sWhereClause As String

'Initialize the Where Clause variable.
sWhereClause = " Where "

'Start the first part of the select statement.
sSQL = "select * from customers "

'Loop through each control on the form to get its value.
For Each ctl In Me.Controls
    With ctl
        'The only Control you are using is the text box.
        'However, you can add as many types of controls as you want.
        Select Case .ControlType
            Case acTextBox
                .SetFocus
                'This is the function that actually builds
                'the clause.
                If sWhereClause = " Where " Then
                    sWhereClause = sWhereClause & BuildCriteria(.Name, dbtext, .Text)
                Else
                    sWhereClause = sWhereClause & " and " & BuildCriteria(.Name, dbtext, .Text)
                End If
        End Select
    End With
Next ctl

'Set the forms recordsource equal to the new
'select statement.
Me.txtSQL = sSQL & sWhereClause
Me.RecordSource = sSQL & sWhereClause
Me.Requery

End Sub
there are 4 textboxes, UserID, FirstName, LastName, Department.
Let's say I knew that in table Customers there was a Jane Doe, but did not know her ID or department.
Typing Jane into the FirstName textbox and Doe into the LastName textbox, and hitting search seems to yield the appropriate SQL query (and have confirmed that this correctly filters in SQL view on the table): SELECT * FROM Customers Where FirstName="Jane" and LastName="Doe"
However the additional fields will not update - what am I doing wrong here? Is it because of how I have the control source for the textboxes I have tied to the table columns?

A: Figured out the answer. I had to define the recordset and db, and then reference the recordset results to display to the textbox after button update. The Code was largely the same:
Private Sub btnSearch_Click()

On Error Resume Next

Dim strSQL As String
Dim ctl As Control
Dim strWhereClause As String
Dim db As Database
Dim rs As DAO.Recordset
Dim textBox As Control
Dim finalSQL As String
Set db = CurrentDb

'Init beginning of SQL select statement
sWhereClause = " Where "
sSQL = "SELECT * FROM Customers "

'Loop through filled in Controls on form to get value
For Each ctl In Me.Controls
    With ctl
        Select Case .ControlType
            Case acTextBox
            .SetFocus
            If sWhereClause = " Where " Then
                sWhereClause = sWhereClause & BuildCriteria(.Name, dbText, .Text)
            Else
                sWhereClause = sWhereClause & " and " & BuildCriteria(.Name, dbText, .Text)
            End If
        End Select
    End With
Next ctl

Me.txtSQL = sSQL & sWhereClause
finalSQL = sSQL & sWhereClause

Set rs = db.OpenRecordset(finalSQL)
If rs.RecordCount > 0 Then
'If Matching Record(s) are found, pull result into appropriate fields
    Me.UserID = rs!UserID
    Me.FirstName = rs!FirstName
    Me.LastName = rs!LastName
    Me.Department = rs!Department

MsgBox "No Users Found Matching Specified Search Criteria.", vbOKCancel, "No Results Found"
End If


text:
Q: output error: different outputs on two different compilers: Prime Cryptarithm USACO The following cryptarithm is a multiplication problem that can be solved by substituting digits from a specified set of N digits into the positions marked with *. If the set of prime digits {2,3,5,7} is selected, the cryptarithm is called a PRIME CRYPTARITHM. Example:
      * * *
     x  * *
    -------
      * * *         <-- partial product 1
    * * *           <-- partial product 2
    -------
    * * * *

These stars can be replaced only by a defined set of integers N which is given by the USACO grader.
The partial products must be three digits long.
Data given:
4       /* <-- This is the given size of set N from which the multiplicand and multiplier is taken */
2 3 5 7 /* <-- Set N */

The task is to calculate the number of possible outcomes and output the number.
My question:
In my compiler,The output is 0,which is correct,but in the USACO grader my program outputs 1. I am not able to identify what the problem is.
Could someone help me resolve this issue?
Thanks in advance.
MY PROGRAM CODE:
#include <iostream>
#include <fstream>

using namespace std;

int *sortInput(int arrSetN[], int numofDigs)
{
    for(int ictr=0;ictr<numofDigs;ictr++)
    {
        for(int jctr=ictr+1;jctr<numofDigs;jctr++)
        {
            if(arrSetN[ictr]>arrSetN[jctr])
            {
                swap(arrSetN[ictr],arrSetN[jctr]);
            }
        }
    }
    return arrSetN;
}
bool checkNum(int num,int arrSetN[],int numofDigs)
{
    int countDigits=0,tempNum=num,ictr=0,jctr=0;
    int *arrDigits,*digitTally;

    /*
    Counting the number of digits in num.
    */
    for(;tempNum>0;)
    {
        tempNum=tempNum/10;
        countDigits++;
    }
    arrDigits=new int[countDigits];
    digitTally=new int[countDigits];

    /*
        making digitTally = 0
    */
    for(ictr=0;ictr<countDigits;ictr++)
        digitTally[ictr]=0;

    /*
        retrieving the digits of num.
    */
    for(ictr=0;ictr<countDigits;ictr++)
    {
        arrDigits[ictr]=num%10;
        num=num/10;
    }

    /*
        checking if all digits of num are part of set N.
    */
    for(ictr=0;ictr<countDigits;ictr++)
    {
        for(jctr=0;jctr<=numofDigs;jctr++)
        {
            if(arrDigits[ictr]==arrSetN[jctr])
                digitTally[ictr]=1;
        }
    }

    for(int cfc=0;cfc<countDigits;cfc++)
    {
        if(digitTally[cfc]==0)
            return false;
    }
    return true;
}

int main()
{
    ofstream fout("crypt1.out");
    ifstream fin("crypt1.in");
    int numofDigs,ictr=0,a,b,c,d, e,p1,p2,sum,p2test;
    int actr=0,bctr=0,cctr=0,dctr=0,ectr=0,tally=0;
    bool sumCheck,p1Check,p2Check;
    fin>>numofDigs;
    int *arrSetN;
    arrSetN = new int[numofDigs];
    for(ictr=0;ictr<numofDigs;ictr++)
    {
        fin>>arrSetN[ictr];
    }
    arrSetN=sortInput(arrSetN,numofDigs);
    for(actr=0;actr<numofDigs;actr++)
    {
        a=arrSetN[actr];
        for(bctr=0;bctr<numofDigs;bctr++)
        {
            b=arrSetN[bctr];
            for(cctr=0;cctr<numofDigs;cctr++)
            {
                c=arrSetN[cctr];
                for(dctr=0;dctr<numofDigs;dctr++)
                {
                    d=arrSetN[dctr];
                    for(ectr=0;ectr<numofDigs;ectr++)
                    {
                        e=arrSetN[ectr];
                        p1=((a*100)+(b*10)+c)*e;
                        p2=((a*1000)+(b*100)+(c*10))*d;
                        p2test=((a*100)+(b*10)+c)*d;
                        p1Check=checkNum(p1,arrSetN,numofDigs);
                        p2Check=checkNum(p2test,arrSetN,numofDigs);
                        if(p1>999 || p2test>999 || p1<100 || p2test<100)
                        {
                            continue;
                        }
                        sum=p1+p2;
                        sumCheck=checkNum(sum,arrSetN,numofDigs);
                        if(sumCheck==true && p1Check==true && p2Check==true)
                        {
                            tally++;
                            //fout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;
                            //fout<<"\t"<<p1<<" "<<p2<<" "<<sum<<"\n";
                        }
                    }
                }
            }
        }
    }
    fout<<tally<<"\n";
}

A: Generally, when the results of a program are different with different compilers, that usually means somewhere in your program you are running into Undefined Behavior.
In your case, the comparison of j<=numofDigs in checkNum is incorrect.  You are accessing past the end of arrSetN when j==numofDigs.  Since this is undefined, you can get different results.
There may be other similar places, but this is the one I noticed.


text:
Q: boto3 get_resources paginator doesn't work with within console I'm attempting to use get_resources from the resourcesgrouptaggingAPI and paginate it. I'm doing this with a lambda function and boto3.
However, using base = client.can_paginate('get_resources') returns False although within the documentation it suggests that it works for get_resources.
Another person had this problem and created an issue of it here.  Now It seems to work for him, so I am trying to investigate what would cause the console lambda environment to not work.
Just for clarity is here is my declaration and initialization:
client = boto3.client('resourcegroupstaggingapi')
base = client.can_paginate('get_resources') #returns False
paginator = client.get_paginator('get_resources')

Thus, is there a problem with using the console for pagination?

A: The AWS lambda environment isn't always running the most up to date version of boto3/botocore. It currently offers botocore version 1.5.52 (source: https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html ). The paginator you're trying to access was released in 1.5.53 (source: https://github.com/boto/botocore/commit/144dda7b63f9eccaeae66c040a281208b43e2678 )
As such you're attempting to use a version of botocore where pagination of get_resources isn't yet supported. In this case you need to bundle a version of boto3/botocore which supports that functionality with your lambda by installing before bundling.
E.g. if your source code was in the directory src:
pip install boto3==1.4.4
cp -r /usr/local/lib/python2.7/site-packages/* src/
cd src
zip -rq lambda.zip .


text:
Q: Accessing char and int arguments char match (char*, int n);

int
main (int argc, char *argv[]) {
  char *query;
  int n = 3;
  query = argv[1];   /*argv[1] = "string" */
  match (query, n)
  return 0;
}

char
match (query, n) { ... }

I'm trying to access both arguments (query and n) but i'm getting the error: argument 'query' doesn't match prototype and error: prototype declaration

A: char
match(query, n) {

uses implicit int (a K&R and C89 feature outlawed with C99) for query and n. The compiler treats it as if you had written match(int query, int n). You must explicitly provide the types in the function definition as well:
char
match(char *query, int n) {

A: In the function definition,
char
match(query, n) {

should include the argument types:
char
match(char *query, int n) {


text:
Q: SQL query for courses, semester and students Hi I have a schema that looks like this

I was trying to make these 3 queries

*

*Find the names of the top 4 instructors who have taught the most number of distinct courses. Display also the total number of courses taught.
Output columns: InstructorName, NumberOfCoursesTaught
Sort by: NumberOfCoursesTaught in descending order

*Find the top 3 semesters in which the most number of courses were offered. (Treat Spring of 2009 and Spring of 2010 as two different semesters.
Output columns: Semester, Year, NumberOfCourses
Sort by: NumberOfCourses in descending order

*Find the top 2 students who have taken the most number of courses.
Output columns: S_ID, StudentName, NumberOfCourses
Sort by: NumberOfCourses in descending order
For query 1 I wrote
Select name AS InstructorName, count(course_id) AS NumberOfCourses
from Teaches where name IN
(SELECT name FROM Instructor where Instructor.i_id = Teaches.i_id)
group by i_id
order by count(course_id) DESC;

For query 2
SELECT semester, year, count(course_id) as
NumberOfCourses from Takes WHERE year='2009'
group by semester, year
order by count(course_id) DESC;

For query 3
SELECT s_id as S_ID, name as StudentName, count(course_id) as NumberOfCourses
FROM Takes where name IN
(SELECT name from Student where Takes.s_id = Student.s_id)
group by s_id
order by count(course_id) DESC;

Query 1 and 3 give the error
ORA-00904: "NAME": invalid identifier

Query 2 is giving an output, but it's wrong. I need help making the 3 queries correct
Test Data is
tables file is
create table classroom (building varchar(15), room_number varchar(7), capacity numeric(4,0), primary key (building, room_number));
create table department (dept_name varchar(20), building varchar(15), budget numeric(12,2) check (budget > 0), primary key (dept_name));
create table course (course_id varchar(8), title varchar(50), dept_name varchar(20), credits numeric(2,0) check (credits > 0),
primary key(course_id));
create table instructor (i_ID varchar(5), name varchar(20) not null, dept_name varchar(20), salary numeric(8,2) check (salary > 29000), primary key (i_ID));
create table section (course_id varchar(8), sec_id varchar(8), semester varchar(6) check (semester in ('Fall', 'Winter', 'Spring', 'Summer')), year numeric(4,0) check (year > 1701 and year < 2100), building  varchar(15), room_number varchar(7), time_slot_id varchar(4), primary key (course_id, sec_id, semester, year));
create table teaches (i_ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), primary key (i_ID, course_id, sec_id, semester, year));
create table student (s_ID varchar(5), name varchar(20) not null, dept_name varchar(20), tot_cred numeric(3,0) check (tot_cred >= 0), primary key (s_ID));
create table takes (s_ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), grade varchar(2), primary key (s_ID, course_id, sec_id, semester, year));
create table advisor (s_ID varchar(5), i_ID varchar(5), primary key (s_ID));
create table time_slot (time_slot_id varchar(4), day varchar(1),start_hr numeric(2) check (start_hr >= 0 and start_hr < 24), start_min    numeric(2) check (start_min >= 0 and start_min < 60), end_hr numeric(2) check (end_hr >= 0 and end_hr < 24), end_min numeric(2) check(end_min >= 0 and end_min < 60), primary key (time_slot_id, day, start_hr, start_min));
create table prereq (course_id varchar(8), prereq_id varchar(8), primary key (course_id, prereq_id));
create table grade_points(grade varchar(2), points Number(10,4), primary key (grade));

data file is
delete from prereq;
delete from time_slot;
delete from advisor;
delete from takes;
delete from student;
delete from teaches;
delete from section;
delete from instructor;
delete from course;
delete from department;
delete from classroom;

-- Classroom
insert into classroom values ('Packard', '101', '500');
insert into classroom values ('Painter', '514', '10');
insert into classroom values ('Taylor', '3128', '70');
insert into classroom values ('Watson', '100', '30');
insert into classroom values ('Watson', '120', '50');

-- Department
insert into department values ('Biology', 'Watson', '90000');
insert into department values ('Comp. Sci.', 'Taylor', '100000');
insert into department values ('Elec. Eng.', 'Taylor', '85000');
insert into department values ('Finance', 'Painter', '120000');
insert into department values ('History', 'Painter', '50000');
insert into department values ('Music', 'Packard', '80000');
insert into department values ('Physics', 'Watson', '70000');

-- Course
insert into course values ('BIO-101', 'Intro. to Biology', 'Biology', '4');
insert into course values ('BIO-301', 'Genetics', 'Biology', '4');
insert into course values ('BIO-399', 'Computational Biology', 'Biology', '3');
insert into course values ('CS-101', 'Intro. to Computer Science', 'Comp. Sci.', '4');
insert into course values ('CS-190', 'Game Design', 'Comp. Sci.', '4');
insert into course values ('CS-315', 'Robotics', 'Comp. Sci.', '3');
insert into course values ('CS-319', 'Image Processing', 'Comp. Sci.', '3');
insert into course values ('CS-347', 'Database System Concepts', 'Comp. Sci.', '3');
insert into course values ('EE-181', 'Intro. to Digital Systems', 'Elec. Eng.', '3');
insert into course values ('FIN-201', 'Investment Banking', 'Finance', '3');
insert into course values ('HIS-351', 'World History', 'History', '3');
insert into course values ('MU-199', 'Music Video Production', 'Music', '3');
insert into course values ('PHY-101', 'Physical Principles', 'Physics', '4');

-- Instructor
insert into instructor values ('10101', 'Srinivasan', 'Comp. Sci.', '65000');
insert into instructor values ('12121', 'Wu', 'Finance', '90000');
insert into instructor values ('15151', 'Mozart', 'Music', '40000');
insert into instructor values ('22222', 'Einstein', 'Physics', '95000');
insert into instructor values ('32343', 'El Said', 'History', '60000');
insert into instructor values ('33456', 'Gold', 'Physics', '87000');
insert into instructor values ('45565', 'Katz', 'Comp. Sci.', '75000');
insert into instructor values ('58583', 'Califieri', 'History', '62000');
insert into instructor values ('76543', 'Singh', 'Finance', '80000');
insert into instructor values ('76766', 'Crick', 'Biology', '72000');
insert into instructor values ('83821', 'Brandt', 'Comp. Sci.', '92000');
insert into instructor values ('98345', 'Kim', 'Elec. Eng.', '80000');

-- Section
insert into section values ('BIO-101', '1', 'Summer', '2009', 'Painter', '514', 'B');
insert into section values ('BIO-301', '1', 'Summer', '2010', 'Painter', '514', 'A');
insert into section values ('CS-101', '1', 'Fall', '2009', 'Packard', '101', 'H');
insert into section values ('CS-101', '1', 'Spring', '2010', 'Packard', '101', 'F');
insert into section values ('CS-190', '1', 'Spring', '2009', 'Taylor', '3128', 'E');
insert into section values ('CS-190', '2', 'Spring', '2009', 'Taylor', '3128', 'A');
insert into section values ('CS-315', '1', 'Spring', '2010', 'Watson', '120', 'D');
insert into section values ('CS-319', '1', 'Spring', '2010', 'Watson', '100', 'B');
insert into section values ('CS-319', '2', 'Spring', '2010', 'Taylor', '3128', 'C');
insert into section values ('CS-347', '1', 'Fall', '2009', 'Taylor', '3128', 'A');
insert into section values ('EE-181', '1', 'Spring', '2009', 'Taylor', '3128', 'C');
insert into section values ('FIN-201', '1', 'Spring', '2010', 'Packard', '101', 'B');
insert into section values ('HIS-351', '1', 'Spring', '2010', 'Painter', '514', 'C');
insert into section values ('MU-199', '1', 'Spring', '2010', 'Packard', '101', 'D');
insert into section values ('PHY-101', '1', 'Fall', '2009', 'Watson', '100', 'A');

-- Teaches
insert into teaches values ('10101', 'CS-101', '1', 'Fall', '2009');
insert into teaches values ('10101', 'CS-315', '1', 'Spring', '2010');
insert into teaches values ('10101', 'CS-347', '1', 'Fall', '2009');
insert into teaches values ('12121', 'FIN-201', '1', 'Spring', '2010');
insert into teaches values ('15151', 'MU-199', '1', 'Spring', '2010');
insert into teaches values ('22222', 'PHY-101', '1', 'Fall', '2009');
insert into teaches values ('32343', 'HIS-351', '1', 'Spring', '2010');
insert into teaches values ('45565', 'CS-101', '1', 'Spring', '2010');
insert into teaches values ('45565', 'CS-319', '1', 'Spring', '2010');
insert into teaches values ('76766', 'BIO-101', '1', 'Summer', '2009');
insert into teaches values ('76766', 'BIO-301', '1', 'Summer', '2010');
insert into teaches values ('83821', 'CS-190', '1', 'Spring', '2009');
insert into teaches values ('83821', 'CS-190', '2', 'Spring', '2009');
insert into teaches values ('83821', 'CS-319', '2', 'Spring', '2010');
insert into teaches values ('98345', 'EE-181', '1', 'Spring', '2009');

-- Student
insert into student values ('00128', 'Zhang', 'Comp. Sci.', '102');
insert into student values ('12345', 'Shankar', 'Comp. Sci.', '32');
insert into student values ('19991', 'Brandt', 'History', '80');
insert into student values ('23121', 'Chavez', 'Finance', '110');
insert into student values ('44553', 'Peltier', 'Physics', '56');
insert into student values ('45678', 'Levy', 'Physics', '46');
insert into student values ('54321', 'Williams', 'Comp. Sci.', '54');
insert into student values ('55739', 'Sanchez', 'Music', '38');
insert into student values ('70557', 'Snow', 'Physics', '0');
insert into student values ('76543', 'Brown', 'Comp. Sci.', '58');
insert into student values ('76653', 'Aoi', 'Elec. Eng.', '60');
insert into student values ('98765', 'Bourikas', 'Elec. Eng.', '98');
insert into student values ('98988', 'Tanaka', 'Biology', '120');

-- Takes
insert into takes values ('00128', 'CS-101', '1', 'Fall', '2009', 'A');
insert into takes values ('00128', 'CS-347', '1', 'Fall', '2009', 'A-');
insert into takes values ('12345', 'CS-101', '1', 'Fall', '2009', 'C');
insert into takes values ('12345', 'CS-190', '2', 'Spring', '2009', 'A');
insert into takes values ('12345', 'CS-315', '1', 'Spring', '2010', 'A');
insert into takes values ('12345', 'CS-347', '1', 'Fall', '2009', 'A');
insert into takes values ('19991', 'HIS-351', '1', 'Spring', '2010', 'B');
insert into takes values ('23121', 'FIN-201', '1', 'Spring', '2010', 'C+');
insert into takes values ('44553', 'PHY-101', '1', 'Fall', '2009', 'B-');
insert into takes values ('45678', 'CS-101', '1', 'Fall', '2009', 'F');
insert into takes values ('45678', 'CS-101', '1', 'Spring', '2010', 'B+');
insert into takes values ('45678', 'CS-319', '1', 'Spring', '2010', 'B');
insert into takes values ('54321', 'CS-101', '1', 'Fall', '2009', 'A-');
insert into takes values ('54321', 'CS-190', '2', 'Spring', '2009', 'B+');
insert into takes values ('55739', 'MU-199', '1', 'Spring', '2010', 'A-');
insert into takes values ('76543', 'CS-101', '1', 'Fall', '2009', 'A');
insert into takes values ('76543', 'CS-319', '2', 'Spring', '2010', 'A');
insert into takes values ('76653', 'EE-181', '1', 'Spring', '2009', 'C');
insert into takes values ('98765', 'CS-101', '1', 'Fall', '2009', 'C-');
insert into takes values ('98765', 'CS-315', '1', 'Spring', '2010', 'B');
insert into takes values ('98988', 'BIO-101', '1', 'Summer', '2009', 'A');
insert into takes values ('98988', 'BIO-301', '1', 'Summer', '2010', null);

-- Advisor
insert into advisor values ('00128', '45565');
insert into advisor values ('12345', '10101');
insert into advisor values ('23121', '76543');
insert into advisor values ('44553', '22222');
insert into advisor values ('45678', '22222');
insert into advisor values ('76543', '45565');
insert into advisor values ('76653', '98345');
insert into advisor values ('98765', '98345');
insert into advisor values ('98988', '76766');

-- Time_slot
insert into time_slot values ('A', 'M', '8', '0', '8', '50');
insert into time_slot values ('A', 'W', '8', '0', '8', '50');
insert into time_slot values ('A', 'F', '8', '0', '8', '50');
insert into time_slot values ('B', 'M', '9', '0', '9', '50');
insert into time_slot values ('B', 'W', '9', '0', '9', '50');
insert into time_slot values ('B', 'F', '9', '0', '9', '50');
insert into time_slot values ('C', 'M', '11', '0', '11', '50');
insert into time_slot values ('C', 'W', '11', '0', '11', '50');
insert into time_slot values ('C', 'F', '11', '0', '11', '50');
insert into time_slot values ('D', 'M', '13', '0', '13', '50');
insert into time_slot values ('D', 'W', '13', '0', '13', '50');
insert into time_slot values ('D', 'F', '13', '0', '13', '50');
insert into time_slot values ('E', 'T', '10', '30', '11', '45 ');
insert into time_slot values ('E', 'R', '10', '30', '11', '45 ');
insert into time_slot values ('F', 'T', '14', '30', '15', '45 ');
insert into time_slot values ('F', 'R', '14', '30', '15', '45 ');
insert into time_slot values ('G', 'M', '16', '0', '16', '50');
insert into time_slot values ('G', 'W', '16', '0', '16', '50');
insert into time_slot values ('G', 'F', '16', '0', '16', '50');
insert into time_slot values ('H', 'W', '10', '0', '12', '30');

-- Prereq
insert into prereq values ('BIO-301', 'BIO-101');
insert into prereq values ('BIO-399', 'BIO-101');
insert into prereq values ('CS-190', 'CS-101');
insert into prereq values ('CS-315', 'CS-101');
insert into prereq values ('CS-319', 'CS-101');
insert into prereq values ('CS-347', 'CS-101');
insert into prereq values ('EE-181', 'PHY-101');

-- Grade_points
insert into grade_points values ('A+', 4.0);
insert into grade_points values ('A', 4.0);
insert into grade_points values ('A-', 3.7);
insert into grade_points values ('B+', 3.3);
insert into grade_points values ('B', 3.0);
insert into grade_points values ('B-', 2.7);
insert into grade_points values ('C+', 2.3);
insert into grade_points values ('C', 2.0);
insert into grade_points values ('C-', 1.7);
insert into grade_points values ('D+', 1.3);
insert into grade_points values ('D', 1.0);
insert into grade_points values ('D-', 0.7);
insert into grade_points values ('F', 0.0);
insert into grade_points values ('NP', 0.0);
insert into grade_points values ('U', 0.0);

Expected Query 1:
Srinivasan          3
Brandt              2
Crick               2
Katz                2

My result of Query 2:
Fall         2009       9
Spring       2009       3
Summer       2009       1

Expected Query 2:
Spring       2010        7
Spring       2009        3
Fall         2009        3

Expected Query 3:
12345 Shankar                 4
45678 Levy                    3

A: I cant give you the full solution because you still learning. But here are some guide lines.
First one:
Select name AS InstructorName, count(course_id) AS NumberOfCourses
from Teaches where name IN ....

Teaches doesn't have name, instead of WHERE you need JOIN to Instructor table
Second one:
You dont need filter WHERE year='2009' what they ask is you GROUP BY year, semester if you do GROUP BY semester then all Spring semester will be on the same group
Third one: Same as first. You need JOIN to STUDENTS


text:
Q: Iterating (looping) through a TableAdapter We are looking to iterate through a TableAdapter and pull out the values of each row in the TableAdapter from a particular column called ClassName. We will add additional columns later.
We have created the following with the DataSet designer:
DataSet Name:      DataSetSchedules
DataTable Name:    DataTableSchedules
TableAdapter Name: DataTableDataAdapterSchedules

The TableAdapter is setup like this:
Dim theTableAdapter As New DataSetSchedulesTableAdapters.DataTableTableAdapterSchedules

And is initially populated like this:
Private Sub TeacherSchedules_Init(sender As Object, e As EventArgs) Handles Me.Init

    ' Load the data from the database into the GridView.
    '---------------------------------------------------
    GridViewSummary.DataSource = theTableAdapter.GetDataByAll(TextBoxSearch.Text)
    GridViewSummary.DataBind()

End Sub

We would like to make use of the already created TableAdapter which is why we want to just loop through the TableAdapter.
We will be using this to create a list that will be displayed as part of an email message.
Can you show me what coding is needed to populate and loop through the existing TableAdapter pulling out the value from the ClassName data column?
I think it should be something like:
    Dim strClassName As String = ""
    Dim objAadapter As New DataSetSchedulesTableAdapters.DataTableTableAdapterSchedules
    Dim objDataTable As <What to I put here?> = objAadapter.GetDataByAll(TextBoxSearch)

    For Each row As <What to I put here?> In objDataTable
        strClassName = row.ClassName
    Next

But I don't know what to put in place of the angle brakets (<>)

A: Friend Function ValidateUserCode(ByVal ScannedUserCode) As Boolean
    Try
        Dim taOperator As New dsBusinessTableAdapters.GetOperatorTableAdapter, isUpdated As Boolean = True
        If taOperator.GetData().Count <> My.Settings.Zero Then
            For Each dr As DataRow In taOperator.GetData()
                Dim dbUserCode As String = dr.Item(1).ToString 'pass usercode index to readable variable
                If ScannedUserCode = dbUserCode Then ' UserCode EXISTS in database?
                    If GetOperatorDetails(dr) = isUpdated Then Return True 'YES,Get their Details and lets go!
                End If
            Next
            Return False
        Else : Return False 'for now...'show ADD NEW OPERATOR FORM? 'or have a default Admin Operator...
        End If
    Catch ex As Exception
        Return False
    End Try
End Function


text:
Q: Same model for two tables I set the name of my table in my model in the constructor:
public function __construct($section, $attributes = array(), $exists = false){

    parent::__construct($attributes, $exists);

    $this->table = $section;
}

Later on in the class I use this method:
public function getEdit($id){

    return $this->find($id);
}

But it fails:
Missing argument 1 for MyModel::__construct()

Any ideas where I'm going wrong?

A: If you ever override a method that is provided by another class, you should add your own parameters to the end of the parameter list as optional parameters. The reason being that there will likely be code that relies on the old implementation. You can't expect it to know your new implementation, so you must add your own stuff to the end (and optional because the existing implementation won't be supplying it).
As such, change your constructor to:
public function __construct($attributes = array(), $exists = false, $section = null){
    parent::__construct($attributes, $exists);
    $this->table = $section;
}

And you should find it works. Obviously you'll have to update your code to pass $seciton as the last parameter now, too.


text:
Q: What has happened to Google Chrome Developer Console? Error detail is miminized What has happened to Google Chrome Developer Console?
My error messages are being minimized so that I can't see them.  All I get is a pink line.

I have tried resetting to the default settings.

Once I do this the console is back to normal.

But as soon as I refresh browser page, it's back to the single pink line.
I've tried fiddling around with the filters but this doesn't work either.  Also the little filter button is gone now.
Here is my before and after settings once I click the reset button.  No difference here that I can tell.

Here is my browser version.

Has anyone else had this happen? It's driving me crazy resetting between every refresh...

A: Looks like Google fixed this with a browser update.  It doesn't behave like before.


text:
Q: A structure in which every element is a lynchpin Is there a word or phrase for a structure in which every element is a lynchpin? To clarify: the removal of any part of this structure would cause it to collapse entirely.

The system is a/an X; removal of any part of it causes the rest to collapse.

A: You might consider the term irreducibly complex. Unfortunately, this is a term of art in the pseudoscience of so-called "intelligent design", which purports to challenge the Darwinian concept of evolution through natural selection. Here's a definition from one of the psuedoscientists, Michael Behe:

A single system which is composed of several interacting parts that contribute to the basic function, and where the removal of any one of the parts causes the system to effectively cease functioning.

(Emphasis mine. This is from Behe's book Darwin's Black Box as quoted on Wikipedia.)

A: I think that house of cards is a good metaphor for what you are looking for:

*

*a structure or plan that is insubstantial and subject to imminent collapse, as a structure made by balancing playing cards against each other.

(Dictionary.com)

*

*The system is a house of cards; removal of any part of it causes the rest to collapse.

A: Barebones would probably be best, here.
Minimum working example / minimal working example is also an option.
The wikipedia article says the term is limited to software, but that's inaccurate (source: I'm a native speaker. It is, at a bare minimum, used in other engineering disciplines).
However, calling something a MWE would imply that the thing is an example, and not necessarily a market-ready or production-ready product. It implies that the thing has only the core components needed to function, but may not be ideally suited to the ultimate task in mind. The phrase is often used interchangeably with the phrase "proof of concept", although the two are not precisely synonymous.


text:
Q: Where did I click with OpenGL? I am programming in Xcode / OpenGL and have some 3d objects displayed in my view.
Is there a way I can retrieve in OpenGL the 3D location / vertex / face I clicked on ?

A: The usual way to do this is by calling gluUnProject twice, with your x and y coordinates in both cases, and znear in one, and zfar in the other case.
That gives you two points through which a ray goes. Your mouse click is on that ray.
Now collide objects (first bounding volumes, then per triangle if you want, or parametrically if possible) with that ray. The closest hit is the one you want.
A different possibility would be to read back the z-buffer value (glReadPixels). This should be done with a pixel buffer object and spread over several frames (or it will be a very nasty stall on your pipeline). That will give you a 3D coordinate, for which you can find the closest object.
Or, you could use occlusion queries (redrawing a 1x1 viewport with color writes disabled) for the same effect.
Lastly, there is of course selection mode, but this is deprecated functionality, so you will probably not want to use it.

A: Another way to do it if you are okay with using something that's deprecated in newer opengl versions is using the picking buffer/selection mode: http://www.lighthouse3d.com/opengl/picking/


text:
Q: How do i fix "Error: Cannot find module '@endb/sqlite'" I am trying to install a database for my discord bot (using node.js) with sql/sqlite 3, using the database adapter 'endb', however after installing (using npm install) endb, sql, and sqlite3, I receive the error 'cannot find module '@endb/sqlite'.
In the setup for the database, I am using:
const Endb = require('endb');
const endb = new Endb('sqlite://my_database_name.sqlite');

I have tried many solutions, including deleting the modules and package-lock and reinstalling, as well as trying to install newer/older versions of both node, sqlite, and sqlite3.
Another solution I tried was to npm i @endb/sqlite, however that returned a series of errors, too many to list, though i think some of the main ones include:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@4.2.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@4.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Finally, i have looked in the package dependencies and @endb/sqlite is not there. I don't know how to get it to install, and it would be appreciated if someone knew how, i am pretty new to node and npm.

A: I looked at the endb's NPM page and it doesn't look like anyone maintains it. Neither the website nor the github repo for the package exist, and the last update to it happened a year back.
If you are trying to hookup your sqlite3 to node, why not use their official npm module. You can find all the information/tutorial here: https://www.sqlitetutorial.net/sqlite-nodejs/


text:
Q: Read Script content file from CDN as Text instead of execute script I'm trying to read script content file by GET request and I have cross origin issue but if I load it as script, it's working fine
ex: JQuery url for describe issue:

    const cache: RequestInit["cache"] = "no-cache";
const news = await request<string>(
    url,
    "GET",
    {
        "Access-Control-Allow-Origin": "*",
        "Content-Type": "text/html; charset=UTF-8",
    },
    undefined,
    undefined,
    cache,
);

Any help?


text:
Q: gremlin hasLabel query times out I have a test graph with less than a million nodes and probably a slightly higher number of edges. I'm using a remote gremlin client to connect to a janusgraph/gremlin-server instance backed by 3 scylla backends.
I have various different labeled nodes i.e url, domain, host and brand. The graph contains mainly url, domain, and host nodes. I have one brand node in this entire graph. The brand node looks like this:
{
    label: brand
    properties: {
        brand: string
    }
}

I am able to do the following query in 1.5 ms. The brand property has a composite index.
g.V().hasLabel('brand').has('brand','stackoverflow');

The query below hits the 30s timeout. I expect this query to only return only one result based on the data I imported into the graph. I verified by testing with a limit
g.V().hasLabel('brand')

My questions

*

*Why does this timeout?

*Is Janusgraph scanning through all nodes in the graph to try find a single node labeled 'brand'? Is there no default index on labels?

*Why does the first query execute fine when the first steps for both are the same?

Thank you

A: *

*Why does this timeout?

*Is Janusgraph scanning through all nodes in
the graph to try find a single node labeled 'brand'? Is there no
default index on labels?

As you have guessed this is likely timing out due to a full graph scan since vertex labels are not indexed in JanusGraph.  There is an open issue for this: https://github.com/JanusGraph/janusgraph/issues/283

*

*Why does the first query execute fine when the first steps for both are the same?

In this case I suspect that JanusGraph's optimizer is able to optimize the traversal plan to use the composite index.


text:
Q: How to check if a string is a discord name in python? I have a sheet where I'm sorting different columns and I have a column where there are supposed to be only discord names(example: name#0000).
Can I check that with discord.py, if not how should I check it?

A: You can use the If string in string syntax in Python.
For example:
If "#" in name:
        do something

A: You can get the name in the following way.
Let's say you want to check when a player joins your server:
async def on_member_join(member):
    if find_in_record(member.name):
        do something
    else:
        kick_member() //Depends on you

The member.name property will return you a str which will be the name (in name#XYZW).
For the find_in_record function you can use the xlrd module


text:
Q: Bind model to DLL function I have a win forms application that I'm rewriting to use WPF and MVVM pattern.
It uses a DLL written in C++ to expose a couple of functions that I will need to bind my model to in the WPF application.
For example I have this function from the DLL.
// The user supplied function will be called whenever a frame of data arrives.
SetDataHandlerFunc(void (*MyFunction)(sFrameOfData* pFrameOfData));

I've got a wrapper dll that looks like this:
public delegate void HandlerFunction(IntPtr frameData);

[DllImport("lib\\SDK.dll")]
public extern static int SetDataHandlerFunc(HandlerFunction function);

to let me later use it in my forms application like this:
private HandlerFunction myFunction;
myFunction = new HandlerFunction(threadFunction);

private void threadFunction(IntPtr FrameData)
{
    sFrameOfData frame = (sFrameOfData)Marshal.PtrToStructure(FrameData, typeof(sFrameOfData));
}

But I can't really figure out how to translate this to MVVM and the WPF data binding.
I think that I'm probably looking at using a ObjectDataProvider to bind to a method.
I will need to grab some parameters from the frame data (returned as a sFrameOfData object above) and show them in the GUI and have them update as the data changes.
Any ideas on how to implement something like this?

A: You wouldn't actually bind to the method.
In your view model have the properties that represent the paramters you are interested in and bind to those.
So in your threadFunction get back your sFrameOfData object, and then set the values of the properties on your viewmodel.
Make sure you implement INotifyPropertyChanged to raise the property changed event to the view, on which you have the controls that bind to the properties on your viewmodel.


text:
Q: Multiple Distinct Shattered Popup Below is html code for content within Shattered Popup:

1111111

2222222

When clicking on button with id c1 I expect modals with popup__text  = "1" to open and "2" when c2 is clicked.
Javascript code:
var numOfPieces = 6*6;
var frag = document.createDocumentFragment();
function insertInnerPieces($el, innerPieces) {
    for (var i = 0; i < innerPieces; i++) {
        var $inner = document.createElement('div');
        $inner.classList.add('popup__piece-inner');
        $el.appendChild($inner);
    }
};
for (var i = 1; i <= numOfPieces; i++) {
    var $piece = document.createElement('div');
    $piece.classList.add('popup__piece');

    insertInnerPieces($piece, 3);
    frag.appendChild($piece);
}
document.querySelector('.popup__pieces').appendChild(frag);
var $popupsCont = document.querySelector('.popups-cont');
var $popup = document.querySelector('.popup');
var popupAT = 900;

document.querySelector('#c1').addEventListener('click', function() {
    $popupsCont.classList.add('s--popup-active');
    $popup.classList.add('s--active');
});
document.querySelector('#c2').addEventListener('click', function() {
    $popupsCont.classList.add('s--popup-active');
    $popup.classList.add('s--active');
});
function closeHandler() {
    $popupsCont.classList.remove('s--popup-active');
    $popup.classList.remove('s--active');
    $popup.classList.add('s--closed');

    setTimeout(function() {
        $popup.classList.remove('s--closed');
    }, popupAT);
}
document.querySelector('.popup__close').addEventListener('click', closeHandler);
document.querySelector('.popups-cont__overlay').addEventListener('click', closeHandler);

How do I get distinct modals to pop up from respective icons/buttons?
You can find the fiddle example here:  Shattered Popup Example


text:
Q: 1 Click -> Go back / / Can't go back --> close Is there a nice way to fix this Problem?
In my Webview I can go back if click on the backbutton.
I need a way to go back if I click once, and if I can't go back (startdisplay/startside) it should say "Click once more to Exit the app" with a toast. Is this possible?
public class MainActivity extends AppCompatActivity {
private ImageButton Ilias_link;
private ImageButton Lsf_link;
private WebView mWebView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Ilias_link = (ImageButton) findViewById(R.id.ilias_link);
    mWebView = new WebView(this);
    Ilias_link.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            mWebView.getSettings().setJavaScriptEnabled(true);
            mWebView.loadUrl("https://elearns02.fh-biberach.de/ilias3/login.php?target=&soap_pw=&ext_uid=&cookies=nocookies&client_id=HSBC&lang=de");
            mWebView.setWebViewClient(new WebViewClient());
            setContentView(mWebView);

        }
    });

    Lsf_link = (ImageButton) findViewById(R.id.lsf_link);
    mWebView = new WebView(this);
    Lsf_link.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            mWebView.getSettings().setJavaScriptEnabled(true);
            mWebView.loadUrl("https://lsf.fh-biberach.de/qisserver/rds?state=user&type=0");
            mWebView.setWebViewClient(new WebViewClient());
            setContentView(mWebView);
        }
    });
}

@Override
    public void onBackPressed() {
        if (mWebView.canGoBack()) {
            mWebView.goBack();
        } else {
            super.onBackPressed();
        }
}

}

A: you can use a temp global variable.I haven't tested it but it should work
boolean goback = false;
@Override
public void onBackPressed() {
    if (mWebView.canGoBack()) {
        mWebView.goBack();
     }else {
        if(!goback) {
           goback = true;
           //show Toast here..
           return;
        }
        super.onBackPressed();
     }
}

A: Hello I suggest you a different method based on time. Because after user see toast message that warning about exit, she/he shouldn't want to exit app.
boolean doubleBack = false;
@Override
public void onBackPressed() {
    if (mWebView.canGoBack()) {
        mWebView.goBack();
        return ;
    }

    if (doubleBack) {
        super.onBackPressed();
        return;
    }

    doubleBack = true;
    Toast.makeText(this, "Click once more to Exit the app", Toast.LENGTH_SHORT).show();

    new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            doubleBack = false;
        }
    }, 2000);
}


text:
Q: Real values of $\frac{\zeta(2 s)}{\zeta(s)}$ If $\frac{\zeta(2 s)}{\zeta(s)}$ is a real number, then must $s$ be real ?

A: Of course not.  For example, let $2s$ be any non-real zero of the zeta function where $s$ is not a zero.
Through such a point, there will be a curve along which $\zeta(2z)/\zeta(z)$ is real.
EDIT: Here is a plot of the curve where $\zeta(2s)/\zeta(s)$ is real in one region of the plane.  A dot indicates the one non-real point in this region where $\zeta(2s) = 0$.


text:
Q: About managing Views when using Dependency Injection (MVP pattern)? Without using DI (Dependency Injection), I can create the View instance myself and I can determine its lifetime myself (create new one each time before showing or just re-show it because it is just hidden).
The problem here involves both DI and the pattern MVP. What I focus on here is the Presenter class. By using DI, we can consider IView as a dependency used by Presenter and DI helps inject that View at runtime (via the Presenter constructor), something like this:
public class MyPresenter {
    readonly IView _myView;
    public MyPresenter(IView view){
         _myView = view;
    }
}

So as you can see the IView is injected just once at the time initializing the MyPresenter. That means its instance should be maintained along with the lifetime of the MyPresenter, otherwise I have to recreate that IView instance myself (when needed) which defeats against the use of DI.
Keeping an instance of IView along is fine, but the problem might involve here is the memory management. The View may be quickly ready if there is some request showing it, but almost the time it's hidden and still keeps some memory (in some case may be quite large, such as a form showing a large list of objects ...).
Applied in Windows Forms UI tech, I think it is a good practice to Close the form to dispose it when not showing. In this case that means the created instance of IView won't be usable anymore. So I cannot close it, instead just hide it. What do you think about this?
What if the MyPresenter has a lot of dependencies of other IViews? I hope you could share some opinion about managing Views in this scenario, so it could involve the right use/design of MVP pattern. Thanks so much!


text:
Q: Regex Find/Replace in Notepad++ (for date convert) I need regexp for replace date format PostgreSQL to Mysql
From:
2011-02-10 18:33:57.29674+02

To:
2011-02-10 18:33:57

please help me

A: Press Ctrl + H.. select Regex Expression.
Find pattern : (\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2})\.\d{5}\+\d{2}
Replace : \1
Enter! :D


text:
Q: Remove all `null`s in an array without looping through in JS I have the following array:
const myArr = [null, null, null, null, 5, 6, null, null];

I know that the array at the end will contain:

*

*no nulls and

*only unique values.

I want to stripe off all nulls in the original array without using any loops (incl. filter(), reduce()). Is that possible? Maybe some kind of a Set that doesn't accept nulls?

A: Simply make it a Set, then delete(null)

const myArr = [null, null, null, null, 5, 6, null, null];
const s = new Set(myArr);
s.delete(null);
console.log(Array.from(s));


text:
Q: Scala -- mutually exclusive traits Is there a way to define a collection of alternatives of a common type:
trait Mutability
trait Mutable extends Mutability
trait Immutable extends Mutability

and have the compiler preclude something like:
object Hat extends Mutable with Immutable

I believe I can force some compiler error by having a common, conflicting member but the error message is a bit oblique:
trait Mutability
trait Mutable extends Mutability { protected val conflict = true }
trait Immutable extends Mutability { protected val conflict = true }

object Hat extends Mutable with Immutable

<console>:10: error: object Hat inherits conflicting members:
value conflict in class Immutable$class of type Boolean  and
value conflict in class Mutable$class of type Boolean
(Note: this can be resolved by declaring an override in object Hat.)
   object Hat extends Immutable with Mutable

Is there a more direct way to express this constraint and not permit someone to work around it by taking the hint offered by the compiler (override 'conflict' in Hat)?
Thanks for any insights

A: I think this might work
sealed trait Mutability
case object Immutable extends Mutability
case object Mutable extends Mutability

trait MutabilityLevel[A <: Mutability]

class Foo extends MutabilityLevel[Immutable.type]

This (ab?)uses the fact that you can't extend the same trait twice with different parameterization
scala> class Foo extends MutabilityLevel[Immutable.type] with MutabilityLevel[Mutable.type]
<console>:11: error: illegal inheritance;
 self-type Foo does not conform to MutabilityLevel[Immutable.type]'s selftype MutabilityLevel[Immutable.type]
       class Foo extends MutabilityLevel[Immutable.type] with MutabilityLevel[Mutable.type]
                         ^
<console>:11: error: illegal inheritance;
 self-type Foo does not conform to MutabilityLevel[Mutable.type]'s selftype MutabilityLevel[Mutable.type]
       class Foo extends MutabilityLevel[Immutable.type] with MutabilityLevel[Mutable.type]

However..
scala> class Foo extends MutabilityLevel[Mutability]
defined class Foo


text:
Q: jQuery not replacing text in ReportViewer I'm trying to replace text that I got back in the ReportViewer using jQuery. My div, wrapped in the table cell, display "empty" as text - which I plan on replacing with my own formatted text on the client side.
I can use jQuery just fine to set a class on the div (which is inside a td element). Example:
jQuery('div:contains("empty")').addClass('replacetext');

But for some reason I cannot do this:
jQuery('div:contains("empty")').replaceWith('
Hello World
');

I tried this out on some other elements on the page and jQuery does work... but it seems like this issue is ReportViewer (I'm using 2008) specific.

A: The key problem I encountered was a bit different from the question.
The way I was setting the class - the selector was general and the table was nested with a soup of divs and tables and rows. Many of which are uncessary but blame that on the ReportViewer.
So the solution is specificity which is what I used to select the level at a very granular level:
jQuery(document).ready(function() {
    jQuery('#container table table div:contains("empty")').addClass('persistent');
});

And I used a style, to mark the guilty since I have the horror of working with IE6 and the dev toolbar is not up to par with firebug.
.persistent {
    background-color: Yellow;
}

It was hard to pinpoint the error since I was had another jQuery at the top of the script which I didn't notice that was messing up the logic.