sql server – Basic alternative to fn_LocalTimeToUTC

My cloud provider has prevented me accessing fn_LocalTimeToUTC and fn_UTCToLocalTime.

How would I go about getting the same functionality that these two functions offer manually and directly in SQL without using these functions?

To try to simplify it further, All our users are in the UK.

databases – Basic Sqlite3 Python Question

I have a beginner sqlite3 python question. I have a large function f() that sequentially calls a series of intermediate functions f1(),…,f10(). f() takes about 10 minutes to complete. It is being called simultaneously by multiple (eight) different threads (different arguments for each call). f5() tries to write to an sqlite3 database—the same database for each thread. This write is not intensive and should be very short. Even with a connection timeout=80, there are times when I am getting a OperationalError: database is locked. I am trying to figure why this is happening.

In f5(), I have the following try-except block

    con = sqlite3.connect()
    do stuff and write
    return (and move on to f6())

    (never call con.close())
    return (again move on to f6())

As shown, I realized that I never call con.close() in the except portion of the try-except block. If the connection opens in the try block and moves to the except block before calling con.close(), is this connection remaining open when I move on from f5() to f6(). Or is it automatically deleted once f5() hits a return?


8 – How To Restrict GraphQL Access With Drupal Core’s Basic Auth?

According to this Gitbook (near the bottom), its possible to require GraphQL query authentication with Drupal Core’s Basic Auth module. This allows GraphQL to authenticate against a user stored in the Drupal DB.


I created an event subscriber that adds the Basic Auth option to the route like this:

use DrupalCoreRoutingRouteSubscriberBase;
use SymfonyComponentRoutingRouteCollection;

class RouteSubscriber extends RouteSubscriberBase {

   * {@inheritdoc}
  protected function alterRoutes(RouteCollection $collection) {
    if ($route = $collection->get('graphql.query.default:default')) {
      $route->setOptions(('_auth' => ('basic_auth')));

However, when I make a curl request without an Authorization header it still goes through:

curl -X POST -H "Content-Type: application/json"   --data '{"query":"{fileById(id: "33") {changed}}","variables":null,"operationName":null}' http://MYLOCALHOST/graphql



I did enable my custom module with the RouteSubscriber information above and also the Basic Auth module. When I visit the /graphql Drupal path in a browser, access is denied but when I make the CURL request it goes through. I was hoping to restrict CURL access as well.

Here is the Drupal 8 documentation on Basic Auth:


I am using v3 of the Drupal 8 GraphQL module.

What is basic concept of ppc marketing?

Hello friends,

What is basic concept of ppc marketing?



Get Vashikaran Love Solution | How to Stop Extramarital Affairs| How to get your lost love back | Vashikaran Mantra Get Love Back Vashikaran Mantra Love Success

What are the basic tools required for SEO?

What are the basic tools required for SEO?… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1825115&goto=newpost

posix – *nix, *bsd, etc basic `tput` color setup

My goal with the below piece of POSIX shell code was to address the more platforms the better with shell tput colors. With this code, I now start all of my scripts, and so it’s time to review it for some things I overlooked, did not think of too well, and such. Note: I start my scripts with set -u, which is why I set all empty in unspecified cases. Thanks.


set -u

if tput setaf > /dev/null 2>&1; then
    # Linux-like
    tput_number_of_colors=$(tput colors 2> /dev/null)
    tput_bold=$(tput bold 2> /dev/null)
    tput_reset=$(tput sgr0 2> /dev/null)
    tput_cmd_set_fg_color='tput setaf'
elif tput AF > /dev/null 2>&1; then
    # BSD-like
    tput_number_of_colors=$(tput Co 2> /dev/null)
    tput_bold=$(tput md 2> /dev/null)
    tput_reset=$(tput me 2> /dev/null)
    tput_cmd_set_fg_color='tput AF'
    # Console-like

tput_test ()
    ( -n "$tput_number_of_colors" ) && ( -n "$tput_bold" ) && ( -n "$tput_reset" ) &&
    { ( "$tput_number_of_colors" -ge 8 ) && printf '%s' "$tput_bold" && $tput_cmd_set_fg_color 1; } > /dev/null 2>&1

if tput_test; then
    color_red=$tput_bold$($tput_cmd_set_fg_color 1)
    color_green=$tput_bold$($tput_cmd_set_fg_color 2)
    color_yellow=$tput_bold$($tput_cmd_set_fg_color 3)
    color_blue=$tput_bold$($tput_cmd_set_fg_color 4)
    color_magenta=$tput_bold$($tput_cmd_set_fg_color 5)
    color_cyan=$tput_bold$($tput_cmd_set_fg_color 6)
    color_white=$tput_bold$($tput_cmd_set_fg_color 7)
    color_red=; color_green=; color_yellow=; color_blue=; color_magenta=; color_cyan=; color_white=

Basic Evaluation Metrics You Use in Your Business


I have a small business – a startup business to be specific. And at the moment I am using Income, Sales and Customer Service/Review as my metrics. Any further suggestion on a more specific metric to use in my small business for evaluation and progress? I would really appreciate all your thoughts. Hope to hear from anyone, hehe. Thank you.

Basic idea on UI and UX

I wanted to know is ui and ux design is all about designing a website and app on how it looks? Like how should a particular box should appear whether it should be small or big? Should it have shadow or how will it aling? Is this how ui and ux design is all about?

Is it possible to build any regular expression in a computer language with just 3 basic operators?

Many computer languages have complex regular expressions tools. For example, in Javascript you have global flags, escape characters, whitespace character, assertions, character classes, groups and ranges etc. I’m wondering if using just the 3 basic regular expressions operators as defined in formal languages, that is concatenation, alternation and Kleene star can achieve the same result as any pattern described with more tools as for example in Javascript. Is there a theorem about this?

python – basic two-player tic tac toe game

Here is my code:

def printBoard(board):  # this prints the board
    print("         |         |         ")
    print(f"    {board(0)(0)}    |    {board(0)(1)}    |    {board(0)(2)}    ")
    print("         |         |         ")
    print("         |         |         ")
    print(f"    {board(1)(0)}    |    {board(1)(1)}    |    {board(1)(2)}    ")
    print("         |         |         ")
    print("         |         |         ")
    print(f"    {board(2)(0)}    |    {board(2)(1)}    |    {board(2)(2)}    ")
    print("         |         |         ")

def isGameOver(board, playerOneSprite, playerTwoSprite): #checks if eiither player won
    for i in range(3):
        if board(i)(0) == board(i)(1) and board(i)(1) == board(i)(2):
            if board(i)(0) == playerOneSprite:
                print("Player one wins!")
                return True
            elif board(i)(0) == playerTwoSprite:
                return True
        if board(0)(i) == board(1)(i) and board(1)(i) == board(1)(i):
            if board(0)(i) == playerOneSprite:
                print("Player one wins!")
                return True
            elif board(0)(i) == playerTwoSprite:
                return True
    if board(0)(0) == board(1)(1) and board(1)(1) == board(2)(2):
        if board(0)(0) == playerOneSprite:
            print("Player one wins!")
            return True
        elif board(0)(0) == playerTwoSprite:
            return True
    if board(0)(2) == board(1)(1) and board(1)(1) == board(2)(0):
        if board(0)(2) == playerOneSprite:
            print("Player one wins!")
            return True
        elif board(0)(2) == playerTwoSprite:
            return True
    return False

def switchTurns(playerOneSprite, playerTwoSprite, isPlayerOneTurn, board): #controls the flow of the game
    if isPlayerOneTurn:
        row = int(input("Player one, enter row: "))-1
        column = int(input("Player one, enter column: "))-1
        if (row > 3 or row < 1) or (column > 3 or column < 1):
            print("Out of range!")
            switchTurns(playerOneSprite, playerTwoSprite, isPlayerOneTurn, board)
        if board(row)(column) == '-':
            board(row)(column) = playerOneSprite
        row = int(input("Player two, enter row: "))-1
        column = int(input("Player two, enter column: "))-1
        if (row > 3 or row < 1) or (column > 3 or column < 1):
            print("Out of range!")
            switchTurns(playerOneSprite, playerTwoSprite, isPlayerOneTurn, board)
        if board(row)(column) == '-':
            board(row)(column) = playerTwoSprite
    if isGameOver(board, playerOneSprite, playerTwoSprite):
        switchTurns(playerOneSprite, playerTwoSprite, not isPlayerOneTurn, board)

switchTurns('X', 'O', True, board = (('-', '-', '-'), ('-', '-', '-'), ('-', '-', '-'))) #driver code

Is there a way to make this code smaller, more compact and readable?
Right no it is 72 lines long. I am hoping to get it below 60 lines, maybe even 50…
For instance, I have noticed that in the switchTurns() function some of the code is duplicated, but I am not sure how to implement that without sacrificing some clarity in the game…
Also, are there any improvements I can potentially make?