text:
Q: Sqlite3 Python Parameterized Query Error binding parameter 0 - probably unsupported type I'm getting an error (Error binding parameter 0 - probably unsupported type.) for the query:
parameterized_query = cur.execute('SELECT courses.dept, courses.course_num, courses.title FROM courses JOIN catalog_index ON catalog_index.course_id = courses.course_id WHERE catalog_index.word IN (?)', arg)

where
arg = (('computer', 'science', 'economics'),)

I am confused because I am passing in a tuple, so I expect this should work, but it is not.

A: How about this:
arg = ('computer', 'science', 'economics')
sql = '''SELECT courses.dept
, courses.course_num
, courses.title
FROM courses
JOIN catalog_index
ON catalog_index.course_id = courses.course_id
WHERE catalog_index.word IN (?,?,?);'''
parameterized_query = cur.execute(sql, arg)

The changes in my suggestion are:

*

*Set arg to be a single tuple (it is a nested tuple in your post)

*Use 3 question marks in the prepared sql statement (it is one question mark in your post).


text:
Q: Risks of Network Partitioning When a Split Brain Creates a Security Flaw I'm looking to create a high-availability, scalable networking solution by using a distributed system of data. A node here, describes a network that has control over one copy of the data. These nodes might contain more than one machine but has one copy of the data.
The nodes will contain data records which can be in a spent state or an unspent state. A client can request a transition for a record to go from an unspent state to a spent state (a request to spend). There is a security risk if they can successfully do this more than once.
A single node, if it has a connection to all other nodes, can tell the nodes that a spend has been requested and can ensure no other nodes want to access the data and that the spend has not occurred already. The node can change the state of the data to spent and other nodes will not do this since they know one of the nodes is updating it and processing the spend. All nodes will change the data, so the record is in the spent state.
If a node cannot reach another node, it can assume the other node is down and will continue operating with the other nodes until the other node comes back up. In this case the node will send all updates to the node that came back up. If this failed node was in the middle of a spend operation that was incomplete at the time, it can complete it then. This would cause minor downtime for some operations. This would be in the case where a node tells the other nodes it will spend and then fails before it can complete the spend process. In this case the other nodes are blocked from updating it so the failed node needs to come back online before it can be completed.
The problem is, the processing for the spend can only happen once. If the network was partitioned, an attacker knowing this could request the spend on one partition and also on the other. Each partition of the network would assume the other to be down and so would operate independently. This could cause the spend to be processed more than once.
This would not be a problem if the request to the two sides of the network was not being made during the time they were partitioned. The network would become eventually consistent when the connections are re-established. If an attack was successful, the nodes would learn about the attack when they re-establish connections because two sides of the network would announce the same change.
So it is detectable attack but is it practically possible?
An attacker would need to be deliberately trying to do this. The software is not designed to make several spend requests at once. There is a time cost to the attack. If the attacker fails, it will take time before they can recreate an unspent record. Creating unspent records requires money. And more money will need to be used in a single attack to get a higher benefit. The reason there is a time cost, is that it would take time to receive the money back to try again. They could afford many smaller attacks and then the benefit to them would be less and the damaged caused, less too.
Surely partitions are so rare naturally, that an attacker would have to be ridiculously lucky to win, if attempting attacks at any time?
If a connection is naturally lost, a node can halt all operations and try a reconnection. Using a low timeout for the connection to the node means it doesn't have to cause any downtime (Perhaps only rare increased latency). If the reconnection fails then it will continue trying but then restart operations (assuming the node is down). Would something like that protect against occasional connection errors?
So would an attacker be able to detect/cause a partition in the network? How likely is it that partitions will occur and for how long? What ways can issues be resolved if possible?
Thank you.

A: Having dealt with similar issues in Clustering scenarios, I'm familiar with the situation you describe. Such systems frequently have the concept of a quorum, which is why such systems require an odd number of member nodes. The quorum is used to determine the majority and minority partitions.
The quorum is the number, greater than half, that defines what is the minimum number of available nodes that needs to be present to provide services. If a network partition happens only one partition will have quorum, the other stop services until the partition goes away. If a multiple partition event happens it can lead to no services being provided at all. However, it does guarantee only-one node is serving, and that's how consistency is provided.
As for the likelihood of a partition, that depends on your infrastructure and how your nodes are communicating availability state to each other.
As for their ability to detect a partition event, that depends on your code. The main thing that would make such an attack possible is if both partitions are independently addressable during a partition, which may not be the case. In my experience, network partitions frequently exclude end-users from one partition as well as the other nodes. If the partitions are not addressable, then this attack is a lot less likely to succeed.

A: Distributed storage works best with single origin of data being replicated every n seconds, using e.g. SQL index and using replication rules, were to push it. Also central memory "SQL" to control the states.
So simply, when you change object state, this is being communicated to the origin node, and the transaction is performed in SQL with the lock on the record.
If node cannot reach the origin at the time, the operation must fail, as the origin state is only on origin server.
This is like origin-edge workflow, were origin has "memory" - states, and edge "content" - objects.
Is it theoretically impossible to bypass the above model of the edge and central memory while preserving the security and do it in a simple manner. The above model is the most efficient and most correct, and fuzzing it just makes life difficult.

A: If you're looking for a practical solution to allow transactions to continue while there is a partition, I have an idea.
For each new data record that is created as unspent, assign it to a single node. While the network is partitioned, the data records assigned to the reachable nodes are the only ones allowed to be spent by the clients. When the partition is resolved, all of the nodes resynchronize which data records are spent. Since only modes that were reachable by clients spent records assigned to those nodes, there should be no over-spent records.
Thought will have to be put in to how records are assigned to nodes, and what to do when a node runs out of its own records during both unified and partitioned operation.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Disable bouncy scrolling in Cordova app for WP8 I've added
 this.CordovaView.DisableBouncyScrolling = true;

in my MainPage.xaml.cs (Cordova 3.5.0), to prevent the bouncing. But now all scrolling is disabled. (But I just wanted to disable the bouncing when scrolling outside the viewport area.)
When testing my HTML code inside the IE mobile browser everything works fine, but I would like to ship it as a "native" app.
Isn't this.CordovaView.DisableBouncyScrolling what I am looking for?

A: I've found the answer myself, by looking into CordoveView.xaml.cs:
this.bmHelper.ScrollDisabled = this.DisableBouncyScrolling;

Means DisableBouncyScrolling absolutely disables scrolling, which isn't what would expect from "disabling bouncy".

A: body{
 overflow: hidden;
}

This worked for me.


text:
Q: Attempted XPath query not showing any results I'm currently working on a fantasy sports site, and I want to be able to pull basic stats from another site. (I don't have much experience with XML or pulling data from other sites).
I inspected the element to gain it's XPath:

Which gave me: //*[@id="cp1_ctl01_pnlPlayerStats"]/table[1]/tbody/tr[4]/td[18]
I've looked into a couple methods of trying to pull the info and came up with this:

But I just end up with empty elements in my table within my site:

Here's My Code:
        $doc = new DOMDocument();
        @$doc->loadHTMLFile($P_RotoLink);

        $xpath = new DOMXpath($doc);

        $elements = $xpath->query('//*  [@id="cp1_ctl01_pnlPlayerStats"]/table[1]/tbody/tr[4]/td[18]');

        if (!is_null($elements)) {
            foreach ($elements as $element) {
                $nodes = $element->childNodes;
                foreach ($nodes as $node) {
                    echo $node->nodeValue. "\n";
                }
            }
        }

A few things I've tried have thrown me errors, and any time I finally get pass them or suppress them I get empty content. I've tried a bunch of different formats but none seem to give me the desired content.
Edit: Here's the source HTML, I want to grab the value within the td (13.0).

Edit 2: So this is what I'm trying now:
$html = file_get_contents($P_RotoLink);

$doc = new DOMDocument;
libxml_use_internal_errors(true);
$doc->loadHTML($html);
libxml_use_internal_errors(false);
$xpath = new DOMXpath( $doc);

foreach ($xpath->query('//*[@id="cp1_ctl01_pnlPlayerStats"]/table//tr[4]/td[18]') as $node) {
                                        $ppg = substr($node->textContent,0,3);
                                        echo $ppg;
                                    }

A: The problem is that the table in the screenshot doesn't have tbody node, but your XPath expression includes tbody which causes DOMXPath::query to return an empty list of nodes. I suggest ignoring tbody and fetching only rows with //tr.
Example
$html = <<<'HTML'

      0.91.03.0	2.0

HTML;

$doc = new DOMDocument();
$doc->loadHTML($html);
$xp = new DOMXPath($doc);
$expr = '//*[@id="cp1_ctl01_pnlPlayerStats"]/table//tr[2]/td[1]/text()';
$td = $xp->query($expr);
if ($td->length) {
  var_dump($td[0]->nodeValue);
}

Output
string(3) "1.0"

The text() function selects all text node children of the context node.


text:
Q: how to start console screen in windows service i use Tow methods to log my application (windows app) to file and console screen
public static void InitLogFile(string filename)
{

    FileStream fs = new FileStream(filename, FileMode.Create);
    Trace.Listeners.Add(new TextWriterTraceListener(fs));
    Trace.AutoFlush = true;

}
public static void InitConsole()
{
    Trace.Listeners.Add(new ConsoleTraceListener());
    Trace.AutoFlush = true;
}

and i use this code for start the console screen when my windows application is started
  [DllImport("kernel32.dll",EntryPoint = "GetStdHandle",SetLastError = true,CharSet = CharSet.Auto,
        CallingConvention = CallingConvention.StdCall)]
        private static extern IntPtr GetStdHandle(int nStdHandle);

        [DllImport("kernel32.dll",EntryPoint = "AllocConsole",SetLastError = true,CharSet = CharSet.Auto,
        CallingConvention = CallingConvention.StdCall)]
        private static extern int AllocConsole();

        private const int STD_OUTPUT_HANDLE = -11;
        private const int MY_CODE_PAGE = 437;

        void StartConsole()
        {
            AllocConsole();
            IntPtr stdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
            var safeFileHandle = new SafeFileHandle(stdHandle, true);
            var fileStream = new FileStream(safeFileHandle, FileAccess.Write);
            var encoding = Encoding.GetEncoding(MY_CODE_PAGE);
            var standardOutput = new StreamWriter(fileStream, encoding) {AutoFlush = true};
            Console.SetOut(standardOutput);
        }

My Question is :
I convert my windows Application to windows service  the console log screen is not working not appearing now how make it work?

A: A Windows Service does not run like a standard Windows application. It could be running when no users are logged on to the computer so how could a console screen appear?
When running as a service you should consider writing to the Windows Event Log or some other logging mechanism instead.

A: The reason you don't see anything is because of Session 0 Isolation.
However, there is a nice codeproject article which will run an app from a service, in the user session.
Just put your code into a exe file, and launch the exe file using the project in the link.


text:
Q: OpenCV::Mat how to efficiently add a column of ones? GIVEN:
A matrix (N, 3) build from a point cloud, i.e. a vector<Point3d>
std::vector<cv::Point3d> pcVector = ... // from somewhere
cv::Mat                  pcMat = cv::Mat(pcVector).reshape(1);

Thus having pcMat to be something like:
[  0.1, 1.3, 4.5 ]
[  3.1, 1.4, 7.6 ]
   ...
[  1.1, 3.4, 4.1 ]

GOAL:
An efficient method to get a column of ones added to the matrix. That is to receive a matrix like the following from the above.
[  0.1, 1.3, 4.5, 1.0 ]
[  3.1, 1.4, 7.6, 1.0 ]
   ...
[  1.1, 3.4, 4.1, 1.0 ]

CURRENTLY:
cv::Mat  result(N, 4);
cv::Mat  ones = cv::Mat_<double>::ones(N, 1);

cv::hconcat(pcMat, ones, result);

QUESTION:
This seems to be inefficient since a temporary matrix full of ones needs to be created. Are there any tricks to get this done faster?

A: Use cv::convertPointsToHomogeneous

The function converts points from Euclidean to homogeneous space by appending 1's to the tuple of point coordinates. That is, each point (x1, x2, ..., xn) is converted to (x1, x2, ..., xn, 1).

// given
std::vector<cv::Point3d> pcVector = ... // from somewhere
cv::Mat                  pcMat = cv::Mat(pcVector).reshape(1);

// I did not run this
cv::Mat dst;
cv::convertPointsToHomogeneous(pcMat, dst); // pcVector oughta work too

As always, these things will accept both Nx1 K-channel Mats as well as NxK 1-channel Mats. The result seems to always be Nx1 (K+1)-channel though.
And... you can imagine what convertPointsFromHomogeneous would do.


text:
Q: Does teardown_appcontext ignore HTTPExceptions? So, I'm trying to rollback the database session in case of an HTTP error like a bad_request, unauthorized, forbidden, or not_found happens.
it is a serverless application with wsgi and flask.
The scenario is: I create an entry to be saved in the database, but if something wrong happens, I want it to roll_back the session.
If, I raise an exception, the rollback happens, but if I use abort(make_response(jsonify(message=message, **kwargs), 400)) an HTTPException is raised, but the teardown_appcontext kind of ignores it.
I also tried application.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = True #and false too but it didn't solve my problem.
In my app:
def database(application, engine=None):
    sqlalchemy_url = os.environ.get('SQLALCHEMY_URL')
    set_session(sqlalchemy_url, engine=engine)

    @application.teardown_appcontext
    def finish_session(exception=None):
        commit_session(exception)

def commit_session(exception=None):
    if exception:
        _dbsession.rollback()
    else:
        _dbsession.commit()
    _dbsession.remove()
    if hasattr(_engine, 'dispose'):
        _engine.dispose()

And here, the function that is called if I want to return an bad_request response. The abort function raises an HTTPException that is ignored by the teardown function
def badrequest(message='bad request.', **kwargs):
    abort(make_response(jsonify(message=message, **kwargs), 400))

I want the teardown_appcontext to recognize the HTTPException too, not only an Exception. In this way, if the abort function is called, the rollback will be done.

A: I think this is because teardown_appcontext called when the request context is popped. An exception was init in context of request. You can rollback session using errorhandler() or register_error_handler(). Here is an example:
from flask import Flask, abort, jsonify
from flask_sqlalchemy import SQLAlchemy
from werkzeug.exceptions import BadRequest

app = Flask(__name__)
app.config.update(dict(SQLALCHEMY_DATABASE_URI='...'))

db = SQLAlchemy(app)

class Node(db.Model):
   id = db.Column(db.Integer, primary_key=True)
   name = db.Column(db.String(100), nullable=False)

@app.errorhandler(BadRequest)
def handle_bad_request(e):
    db.session.rollback()
    return 'session has been rolled back!', 400

@app.teardown_appcontext
def finish_session(exception=None):
    if not exception:
        db.session.commit()

@app.route('/bad-node')
def bad():
    # add into session without commit and abort(see: handle_bad_request)
    db.session.add(Node(name='bad node'))
    abort(400)

@app.route('/good-node')
def good():
    # without exceptions - see: finish_session
    db.session.add(Node(name='good node'))
    return '<good node> was saved'

@app.route('/nodes')
def all_nodes():
    # just list of items from db
    return jsonify([i.name for i in Node.query.all()])

if __name__ == '__main__':
    db.create_all()
    db.session.commit()
    app.run(debug=True)

Open /good-node and /bad-node a few times. After that open /nodes you will see that 'bad nodes' were not saved(was rollback).
Hope this helps.


text:
Q: How to reliably start a process in C#? I'm trying to start .lnk shortcuts from my application. However, I'm struggling with the infamous automatic filesystem redirection for 32/64-bit processes.
I'm searching for a way to simply start an application from the shortcut and I don't care, what happens to that process later. Effectively I'd like to start the shortcut the same way as if user doubleclicked it in the Explorer.
Currently I'm using the following method, but it still doesn't work (ie. I'm unable to start Word this way):

[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);

[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);

private static void Start(string shortcut)
{
    IntPtr temp = IntPtr.Zero;

    try
    {
        Wow64DisableWow64FsRedirection(ref temp);
        var error = Marshal.GetLastWin32Error();

        ProcessStartInfo info = new ProcessStartInfo(shortcut);
        info.UseShellExecute = true;

        Process.Start(info);
    }
    finally
    {
        Wow64RevertWow64FsRedirection(temp);
    }
}

How can I reliably start an application, knowing its direct location on the drive in C#?

Edit:
I used SysInternals' ProcMon to check, what is done behind scenes. It looks like the proper path is searched, but then system for some reason still falls back to the forced 32-bit one.


text:
Q: Is it possible to do wifi printing or device communication without an ISP? I've tried to both do networking with just a router and printing. However, it didn't work, even though people have said that it "should" work, and I fallowed all the instructions for networking to a T, then made sure i fallowed the instructions appropriately.
So either I was missing something when I was working on it, or it's necessary to have an internet connection to do wifi communication?

A: Yes it is possible.  An ISP gives you internet connectivity, however that is not necessary for a private network.  If your router has DHCP (most do), that will relieve you of a lot of manual configuration.  As others have said, it should work.  If it doesnt, it is most likely a DNS issue.  Use IPs just to make sure everything works, then iron out the kinks as necessary.


text:
Q: Need help using the official IANA timezone database in SQL I am using T-SQL queries to retrieve data from an Azure SQL database for customer data visualization.
I need a way to use an IANA timezone eg. Europe/Copenhagen to convert a UTC time eg. 10-08-2020 12:32:00 to local time eg. 10-08-2020 14:32:00 in SQL.
(Note that two hours have been added to the UTC time, because the UTC to Copenhagen offset at that time is two hours due to daylight saving.)
The official IANA website has a downloadable timezone database, but I fail to understand how to implement it, specifically in a SQL context.
I have spent a great deal of time trying to crack this challenge, and I welcome any useful input. There seems to be no support for the IANA timezone standard in the Microsoft ecosystem whatsoever.

A: little late but for me I resolved by mapping between windows and timezone database.
following SQL result is a mapping. There is a column name SQL_Names apply a join with [sys].[Time_Zone_Info] table to get SQL Time Zone detail below is the sample.
Note: the JSON is not covering all the timezone due to character limits here but you may import a full list from the below links.
try out:
DECLARE @TZ_Json VARCHAR(MAX)
SET @TZ_Json = '[{"SQLName":"Greenwich Standard Time","TZName":"Africa\/Abidjan","TZTerritory":"CI"},{"SQLName":"Greenwich Standard Time","TZName":"Africa\/Accra","TZTerritory":"GH"},{"SQLName":"E. Africa Standard Time","TZName":"Africa\/Addis_Ababa","TZTerritory":"ET"},{"SQLName":"W. Central Africa Standard Time","TZName":"Africa\/Algiers","TZTerritory":"DZ"},{"SQLName":"E. Africa Standard Time","TZName":"Africa\/Asmera","TZTerritory":"ER"},{"SQLName":"Greenwich Standard Time","TZName":"Africa\/Bamako","TZTerritory":"ML"},{"SQLName":"W. Central Africa Standard Time","TZName":"Africa\/Bangui","TZTerritory":"CF"},{"SQLName":"Greenwich Standard Time","TZName":"Africa\/Banjul","TZTerritory":"GM"},{"SQLName":"Greenwich Standard Time","TZName":"Africa\/Bissau","TZTerritory":"GW"},{"SQLName":"South Africa Standard Time","TZName":"Africa\/Blantyre","TZTerritory":"MW"},{"SQLName":"W. Central Africa Standard Time","TZName":"Africa\/Brazzaville","TZTerritory":"CG"},{"SQLName":"South Africa Standard Time","TZName":"Africa\/Bujumbura","TZTerritory":"BI"},{"SQLName":"Egypt Standard Time","TZName":"Africa\/Cairo","TZTerritory":"001"},{"SQLName":"Egypt Standard Time","TZName":"Africa\/Cairo","TZTerritory":"EG"},{"SQLName":"Morocco Standard Time","TZName":"Africa\/Casablanca","TZTerritory":"001"},{"SQLName":"Morocco Standard Time","TZName":"Africa\/Casablanca","TZTerritory":"MA"},{"SQLName":"Greenwich Standard Time","TZName":"Africa\/Conakry","TZTerritory":"GN"},{"SQLName":"Greenwich Standard Time","TZName":"Africa\/Dakar","TZTerritory":"SN"},{"SQLName":"E. Africa Standard Time","TZName":"Africa\/Dar_es_Salaam","TZTerritory":"TZ"},{"SQLName":"E. Africa Standard Time","TZName":"Africa\/Djibouti","TZTerritory":"DJ"},{"SQLName":"W. Central Africa Standard Time","TZName":"Africa\/Douala","TZTerritory":"CM"},{"SQLName":"Morocco Standard Time","TZName":"Africa\/El_Aaiun","TZTerritory":"EH"},{"SQLName":"Greenwich Standard Time","TZName":"Africa\/Freetown","TZTerritory":"SL"},{"SQLName":"South Africa Standard Time","TZName":"Africa\/Gaborone","TZTerritory":"BW"},{"SQLName":"South Africa Standard Time","TZName":"Africa\/Harare","TZTerritory":"ZW"},{"SQLName":"South Africa Standard Time","TZName":"Africa\/Johannesburg","TZTerritory":"ZA"},{"SQLName":"South Africa Standard Time","TZName":"Africa\/Johannesburg","TZTerritory":"001"},{"SQLName":"South Africa Standard Time","TZName":"Africa\/Juba","TZTerritory":"SS"},{"SQLName":"E. Africa Standard Time","TZName":"Africa\/Kampala","TZTerritory":"UG"},{"SQLName":"Sudan Standard Time","TZName":"Africa\/Khartoum","TZTerritory":"001"},{"SQLName":"Sudan Standard Time","TZName":"Africa\/Khartoum","TZTerritory":"SD"},{"SQLName":"South Africa Standard Time","TZName":"Africa\/Kigali","TZTerritory":"RW"},{"SQLName":"W. Central Africa Standard Time","TZName":"Africa\/Kinshasa","TZTerritory":"CD"},{"SQLName":"W. Central Africa Standard Time","TZName":"Africa\/Lagos","TZTerritory":"001"},{"SQLName":"W. Central Africa Standard Time","TZName":"Africa\/Lagos","TZTerritory":"NG"},{"SQLName":"W. Central Africa Standard Time","TZName":"Africa\/Libreville","TZTerritory":"GA"},'
SET @TZ_Json = @TZ_Json + '{"SQLName":"Greenwich Standard Time","TZName":"Africa\/Lome","TZTerritory":"TG"},{"SQLName":"W. Central Africa Standard Time","TZName":"Africa\/Luanda","TZTerritory":"AO"},{"SQLName":"South Africa Standard Time","TZName":"Africa\/Lubumbashi","TZTerritory":"CD"},{"SQLName":"South Africa Standard Time","TZName":"Africa\/Lusaka","TZTerritory":"ZM"},{"SQLName":"W. Central Africa Standard Time","TZName":"Africa\/Malabo","TZTerritory":"GQ"},{"SQLName":"South Africa Standard Time","TZName":"Africa\/Maputo","TZTerritory":"MZ"},{"SQLName":"South Africa Standard Time","TZName":"Africa\/Maseru","TZTerritory":"LS"},{"SQLName":"South Africa Standard Time","TZName":"Africa\/Mbabane","TZTerritory":"SZ"},{"SQLName":"E. Africa Standard Time","TZName":"Africa\/Mogadishu","TZTerritory":"SO"},{"SQLName":"Greenwich Standard Time","TZName":"Africa\/Monrovia","TZTerritory":"LR"},{"SQLName":"E. Africa Standard Time","TZName":"Africa\/Nairobi","TZTerritory":"001"},{"SQLName":"E. Africa Standard Time","TZName":"Africa\/Nairobi","TZTerritory":"KE"},{"SQLName":"W. Central Africa Standard Time","TZName":"Africa\/Ndjamena","TZTerritory":"TD"},{"SQLName":"W. Central Africa Standard Time","TZName":"Africa\/Niamey","TZTerritory":"NE"},{"SQLName":"Greenwich Standard Time","TZName":"Africa\/Nouakchott","TZTerritory":"MR"},{"SQLName":"Greenwich Standard Time","TZName":"Africa\/Ouagadougou","TZTerritory":"BF"},{"SQLName":"W. Central Africa Standard Time","TZName":"Africa\/Porto-Novo","TZTerritory":"BJ"},{"SQLName":"Sao Tome Standard Time","TZName":"Africa\/Sao_Tome","TZTerritory":"001"},{"SQLName":"Sao Tome Standard Time","TZName":"Africa\/Sao_Tome","TZTerritory":"ST"},{"SQLName":"Libya Standard Time","TZName":"Africa\/Tripoli","TZTerritory":"001"},{"SQLName":"Libya Standard Time","TZName":"Africa\/Tripoli","TZTerritory":"LY"},{"SQLName":"W. Central Africa Standard Time","TZName":"Africa\/Tunis","TZTerritory":"TN"},{"SQLName":"Namibia Standard Time","TZName":"Africa\/Windhoek","TZTerritory":"001"},{"SQLName":"Namibia Standard Time","TZName":"Africa\/Windhoek","TZTerritory":"NA"},{"SQLName":"Aleutian Standard Time","TZName":"America\/Adak","TZTerritory":"001"},{"SQLName":"Aleutian Standard Time","TZName":"America\/Adak","TZTerritory":"US"},{"SQLName":"Alaskan Standard Time","TZName":"America\/Anchorage","TZTerritory":"001"},{"SQLName":"Alaskan Standard Time","TZName":"America\/Anchorage America\/Juneau America\/Metlakatla America\/Nome America\/Sitka America\/Yakutat","TZTerritory":"US"},{"SQLName":"SA Western Standard Time","TZName":"America\/Anguilla","TZTerritory":"AI"},{"SQLName":"SA Western Standard Time","TZName":"America\/Antigua","TZTerritory":"AG"},{"SQLName":"Tocantins Standard Time","TZName":"America\/Araguaina","TZTerritory":"001"},{"SQLName":"Tocantins Standard Time","TZName":"America\/Araguaina","TZTerritory":"BR"},{"SQLName":"SA Western Standard Time","TZName":"America\/Aruba","TZTerritory":"AW"},{"SQLName":"Paraguay Standard Time","TZName":"America\/Asuncion","TZTerritory":"001"},{"SQLName":"Paraguay Standard Time","TZName":"America\/Asuncion","TZTerritory":"PY"},'
SET @TZ_Json = @TZ_Json + '{"SQLName":"Bahia Standard Time","TZName":"America\/Bahia","TZTerritory":"001"},{"SQLName":"Bahia Standard Time","TZName":"America\/Bahia","TZTerritory":"BR"},{"SQLName":"SA Western Standard Time","TZName":"America\/Barbados","TZTerritory":"BB"},{"SQLName":"Central America Standard Time","TZName":"America\/Belize","TZTerritory":"BZ"},{"SQLName":"SA Western Standard Time","TZName":"America\/Blanc-Sablon","TZTerritory":"CA"},{"SQLName":"SA Pacific Standard Time","TZName":"America\/Bogota","TZTerritory":"CO"},{"SQLName":"SA Pacific Standard Time","TZName":"America\/Bogota","TZTerritory":"001"},{"SQLName":"Argentina Standard Time","TZName":"America\/Buenos_Aires","TZTerritory":"001"},{"SQLName":"Argentina Standard Time","TZName":"America\/Buenos_Aires America\/Argentina\/La_Rioja America\/Argentina\/Rio_Gallegos America\/Argentina\/Salta America\/Argentina\/San_Juan America\/Argentina\/San_Luis America\/Argentina\/Tucuman America\/Argentina\/Ushuaia America\/Catamarca America\/Cordoba America\/Juju","TZTerritory":"AR"},{"SQLName":"Eastern Standard Time (Mexico)","TZName":"America\/Cancun","TZTerritory":"001"},{"SQLName":"Eastern Standard Time (Mexico)","TZName":"America\/Cancun","TZTerritory":"MX"},{"SQLName":"Venezuela Standard Time","TZName":"America\/Caracas","TZTerritory":"001"},{"SQLName":"Venezuela Standard Time","TZName":"America\/Caracas","TZTerritory":"VE"},{"SQLName":"SA Eastern Standard Time","TZName":"America\/Cayenne","TZTerritory":"001"},{"SQLName":"SA Eastern Standard Time","TZName":"America\/Cayenne","TZTerritory":"GF"},{"SQLName":"SA Pacific Standard Time","TZName":"America\/Cayman","TZTerritory":"KY"},{"SQLName":"Central Standard Time","TZName":"America\/Chicago","TZTerritory":"001"},{"SQLName":"Central Standard Time","TZName":"America\/Chicago America\/Indiana\/Knox America\/Indiana\/Tell_City America\/Menominee America\/North_Dakota\/Beulah America\/North_Dakota\/Center America\/North_Dakota\/New_Salem","TZTerritory":"US"},{"SQLName":"Mountain Standard Time (Mexico)","TZName":"America\/Chihuahua","TZTerritory":"001"},{"SQLName":"Mountain Standard Time (Mexico)","TZName":"America\/Chihuahua America\/Mazatlan","TZTerritory":"MX"},{"SQLName":"SA Pacific Standard Time","TZName":"America\/Coral_Harbour","TZTerritory":"CA"},{"SQLName":"Central America Standard Time","TZName":"America\/Costa_Rica","TZTerritory":"CR"},{"SQLName":"US Mountain Standard Time","TZName":"America\/Creston America\/Dawson_Creek America\/Fort_Nelson","TZTerritory":"CA"},{"SQLName":"Central Brazilian Standard Time","TZName":"America\/Cuiaba","TZTerritory":"001"},{"SQLName":"Central Brazilian Standard Time","TZName":"America\/Cuiaba America\/Campo_Grande","TZTerritory":"BR"},{"SQLName":"SA Western Standard Time","TZName":"America\/Curacao","TZTerritory":"CW"},{"SQLName":"UTC","TZName":"America\/Danmarkshavn","TZTerritory":"GL"},{"SQLName":"Mountain Standard Time","TZName":"America\/Denver","TZTerritory":"001"},{"SQLName":"Mountain Standard Time","TZName":"America\/Denver America\/Boise","TZTerritory":"US"},'
SET @TZ_Json = @TZ_Json + '{"SQLName":"SA Western Standard Time","TZName":"America\/Dominica","TZTerritory":"DM"},{"SQLName":"Mountain Standard Time","TZName":"America\/Edmonton America\/Cambridge_Bay America\/Inuvik America\/Yellowknife","TZTerritory":"CA"},{"SQLName":"Central America Standard Time","TZName":"America\/El_Salvador","TZTerritory":"SV"},{"SQLName":"SA Eastern Standard Time","TZName":"America\/Fortaleza America\/Belem America\/Maceio America\/Recife America\/Santarem","TZTerritory":"BR"},{"SQLName":"Greenland Standard Time","TZName":"America\/Godthab","TZTerritory":"001"},{"SQLName":"Greenland Standard Time","TZName":"America\/Godthab","TZTerritory":"GL"},{"SQLName":"Turks And Caicos Standard Time","TZName":"America\/Grand_Turk","TZTerritory":"001"},{"SQLName":"Turks And Caicos Standard Time","TZName":"America\/Grand_Turk","TZTerritory":"TC"},{"SQLName":"SA Western Standard Time","TZName":"America\/Grenada","TZTerritory":"GD"},{"SQLName":"SA Western Standard Time","TZName":"America\/Guadeloupe","TZTerritory":"GP"},{"SQLName":"Central America Standard Time","TZName":"America\/Guatemala","TZTerritory":"GT"},{"SQLName":"Central America Standard Time","TZName":"America\/Guatemala","TZTerritory":"001"},{"SQLName":"SA Pacific Standard Time","TZName":"America\/Guayaquil","TZTerritory":"EC"},{"SQLName":"SA Western Standard Time","TZName":"America\/Guyana","TZTerritory":"GY"},{"SQLName":"Atlantic Standard Time","TZName":"America\/Halifax","TZTerritory":"001"},{"SQLName":"Atlantic Standard Time","TZName":"America\/Halifax America\/Glace_Bay America\/Goose_Bay America\/Moncton","TZTerritory":"CA"},{"SQLName":"Cuba Standard Time","TZName":"America\/Havana","TZTerritory":"001"},{"SQLName":"Cuba Standard Time","TZName":"America\/Havana","TZTerritory":"CU"},{"SQLName":"US Mountain Standard Time","TZName":"America\/Hermosillo","TZTerritory":"MX"},{"SQLName":"US Eastern Standard Time","TZName":"America\/Indianapolis","TZTerritory":"001"},{"SQLName":"US Eastern Standard Time","TZName":"America\/Indianapolis America\/Indiana\/Marengo America\/Indiana\/Vevay","TZTerritory":"US"},{"SQLName":"SA Pacific Standard Time","TZName":"America\/Jamaica","TZTerritory":"JM"},{"SQLName":"SA Western Standard Time","TZName":"America\/Kralendijk","TZTerritory":"BQ"},{"SQLName":"SA Western Standard Time","TZName":"America\/La_Paz","TZTerritory":"BO"},{"SQLName":"SA Western Standard Time","TZName":"America\/La_Paz","TZTerritory":"001"},{"SQLName":"SA Pacific Standard Time","TZName":"America\/Lima","TZTerritory":"PE"},{"SQLName":"Pacific Standard Time","TZName":"America\/Los_Angeles","TZTerritory":"001"},{"SQLName":"Pacific Standard Time","TZName":"America\/Los_Angeles","TZTerritory":"US"},{"SQLName":"SA Western Standard Time","TZName":"America\/Lower_Princes","TZTerritory":"SX"},{"SQLName":"Central America Standard Time","TZName":"America\/Managua","TZTerritory":"NI"},{"SQLName":"SA Western Standard Time","TZName":"America\/Manaus America\/Boa_Vista America\/Porto_Velho","TZTerritory":"BR"},{"SQLName":"SA Western Standard Time","TZName":"America\/Marigot","TZTerritory":"MF"},'
SET @TZ_Json = @TZ_Json + '{"SQLName":"SA Western Standard Time","TZName":"America\/Martinique","TZTerritory":"MQ"},{"SQLName":"Central Standard Time","TZName":"America\/Matamoros","TZTerritory":"MX"},{"SQLName":"Central Standard Time (Mexico)","TZName":"America\/Mexico_City","TZTerritory":"001"},{"SQLName":"Central Standard Time (Mexico)","TZName":"America\/Mexico_City America\/Bahia_Banderas America\/Merida America\/Monterrey","TZTerritory":"MX"},{"SQLName":"Saint Pierre Standard Time","TZName":"America\/Miquelon","TZTerritory":"001"},{"SQLName":"Saint Pierre Standard Time","TZName":"America\/Miquelon","TZTerritory":"PM"},{"SQLName":"Montevideo Standard Time","TZName":"America\/Montevideo","TZTerritory":"001"},{"SQLName":"Montevideo Standard Time","TZName":"America\/Montevideo","TZTerritory":"UY"},{"SQLName":"SA Western Standard Time","TZName":"America\/Montserrat","TZTerritory":"MS"},{"SQLName":"Eastern Standard Time","TZName":"America\/Nassau","TZTerritory":"BS"},{"SQLName":"Eastern Standard Time","TZName":"America\/New_York","TZTerritory":"001"},{"SQLName":"Eastern Standard Time","TZName":"America\/New_York America\/Detroit America\/Indiana\/Petersburg America\/Indiana\/Vincennes America\/Indiana\/Winamac America\/Kentucky\/Monticello America\/Louisville","TZTerritory":"US"},{"SQLName":"UTC-02","TZName":"America\/Noronha","TZTerritory":"BR"},{"SQLName":"Mountain Standard Time","TZName":"America\/Ojinaga","TZTerritory":"MX"},{"SQLName":"SA Pacific Standard Time","TZName":"America\/Panama","TZTerritory":"PA"},{"SQLName":"SA Eastern Standard Time","TZName":"America\/Paramaribo","TZTerritory":"SR"},{"SQLName":"US Mountain Standard Time","TZName":"America\/Phoenix","TZTerritory":"001"},{"SQLName":"US Mountain Standard Time","TZName":"America\/Phoenix","TZTerritory":"US"},{"SQLName":"SA Western Standard Time","TZName":"America\/Port_of_Spain","TZTerritory":"TT"},{"SQLName":"Haiti Standard Time","TZName":"America\/Port-au-Prince","TZTerritory":"001"},{"SQLName":"Haiti Standard Time","TZName":"America\/Port-au-Prince","TZTerritory":"HT"},{"SQLName":"SA Western Standard Time","TZName":"America\/Puerto_Rico","TZTerritory":"PR"},{"SQLName":"Magallanes Standard Time","TZName":"America\/Punta_Arenas","TZTerritory":"001"},{"SQLName":"Magallanes Standard Time","TZName":"America\/Punta_Arenas","TZTerritory":"CL"},{"SQLName":"Canada Central Standard Time","TZName":"America\/Regina","TZTerritory":"001"},{"SQLName":"Canada Central Standard Time","TZName":"America\/Regina America\/Swift_Current","TZTerritory":"CA"},{"SQLName":"SA Pacific Standard Time","TZName":"America\/Rio_Branco America\/Eirunepe","TZTerritory":"BR"},{"SQLName":"Pacific SA Standard Time","TZName":"America\/Santiago","TZTerritory":"001"},{"SQLName":"Pacific SA Standard Time","TZName":"America\/Santiago","TZTerritory":"CL"},{"SQLName":"SA Western Standard Time","TZName":"America\/Santo_Domingo","TZTerritory":"DO"},{"SQLName":"E. South America Standard Time","TZName":"America\/Sao_Paulo","TZTerritory":"001"},{"SQLName":"E. South America Standard Time","TZName":"America\/Sao_Paulo","TZTerritory":"BR"},'
SET @TZ_Json = @TZ_Json + '{"SQLName":"Azores Standard Time","TZName":"America\/Scoresbysund","TZTerritory":"GL"},{"SQLName":"SA Western Standard Time","TZName":"America\/St_Barthelemy","TZTerritory":"BL"},{"SQLName":"Newfoundland Standard Time","TZName":"America\/St_Johns","TZTerritory":"001"},{"SQLName":"Newfoundland Standard Time","TZName":"America\/St_Johns","TZTerritory":"CA"},{"SQLName":"SA Western Standard Time","TZName":"America\/St_Kitts","TZTerritory":"KN"},{"SQLName":"SA Western Standard Time","TZName":"America\/St_Lucia","TZTerritory":"LC"},{"SQLName":"SA Western Standard Time","TZName":"America\/St_Thomas","TZTerritory":"VI"},{"SQLName":"SA Western Standard Time","TZName":"America\/St_Vincent","TZTerritory":"VC"},{"SQLName":"Central America Standard Time","TZName":"America\/Tegucigalpa","TZTerritory":"HN"},{"SQLName":"Atlantic Standard Time","TZName":"America\/Thule","TZTerritory":"GL"},{"SQLName":"Pacific Standard Time (Mexico)","TZName":"America\/Tijuana","TZTerritory":"001"},{"SQLName":"Pacific Standard Time (Mexico)","TZName":"America\/Tijuana America\/Santa_Isabel","TZTerritory":"MX"},{"SQLName":"Eastern Standard Time","TZName":"America\/Toronto America\/Iqaluit America\/Montreal America\/Nipigon America\/Pangnirtung America\/Thunder_Bay","TZTerritory":"CA"},{"SQLName":"SA Western Standard Time","TZName":"America\/Tortola","TZTerritory":"VG"},{"SQLName":"Pacific Standard Time","TZName":"America\/Vancouver","TZTerritory":"CA"},{"SQLName":"Yukon Standard Time","TZName":"America\/Whitehorse","TZTerritory":"001"},{"SQLName":"Yukon Standard Time","TZName":"America\/Whitehorse America\/Dawson","TZTerritory":"CA"},{"SQLName":"Central Standard Time","TZName":"America\/Winnipeg America\/Rainy_River America\/Rankin_Inlet America\/Resolute","TZTerritory":"CA"},{"SQLName":"Central Pacific Standard Time","TZName":"Antarctica\/Casey","TZTerritory":"AQ"},{"SQLName":"SE Asia Standard Time","TZName":"Antarctica\/Davis","TZTerritory":"AQ"},{"SQLName":"West Pacific Standard Time","TZName":"Antarctica\/DumontDUrville","TZTerritory":"AQ"},{"SQLName":"West Asia Standard Time","TZName":"Antarctica\/Mawson","TZTerritory":"AQ"},{"SQLName":"New Zealand Standard Time","TZName":"Antarctica\/McMurdo","TZTerritory":"AQ"},{"SQLName":"SA Eastern Standard Time","TZName":"Antarctica\/Rothera Antarctica\/Palmer","TZTerritory":"AQ"},{"SQLName":"E. Africa Standard Time","TZName":"Antarctica\/Syowa","TZTerritory":"AQ"},{"SQLName":"Central Asia Standard Time","TZName":"Antarctica\/Vostok","TZTerritory":"AQ"},{"SQLName":"W. Europe Standard Time","TZName":"Arctic\/Longyearbyen","TZTerritory":"SJ"},{"SQLName":"Arab Standard Time","TZName":"Asia\/Aden","TZTerritory":"YE"},{"SQLName":"Central Asia Standard Time","TZName":"Asia\/Almaty","TZTerritory":"001"},{"SQLName":"Central Asia Standard Time","TZName":"Asia\/Almaty Asia\/Qostanay","TZTerritory":"KZ"},{"SQLName":"Jordan Standard Time","TZName":"Asia\/Amman","TZTerritory":"001"},{"SQLName":"Jordan Standard Time","TZName":"Asia\/Amman","TZTerritory":"JO"},{"SQLName":"West Asia Standard Time","TZName":"Asia\/Ashgabat","TZTerritory":"TM"},'
SET @TZ_Json = @TZ_Json + '{"SQLName":"Arabic Standard Time","TZName":"Asia\/Baghdad","TZTerritory":"001"},{"SQLName":"Arabic Standard Time","TZName":"Asia\/Baghdad","TZTerritory":"IQ"},{"SQLName":"Arab Standard Time","TZName":"Asia\/Bahrain","TZTerritory":"BH"},{"SQLName":"Azerbaijan Standard Time","TZName":"Asia\/Baku","TZTerritory":"001"},{"SQLName":"Azerbaijan Standard Time","TZName":"Asia\/Baku","TZTerritory":"AZ"},{"SQLName":"SE Asia Standard Time","TZName":"Asia\/Bangkok","TZTerritory":"TH"},{"SQLName":"SE Asia Standard Time","TZName":"Asia\/Bangkok","TZTerritory":"001"},{"SQLName":"Altai Standard Time","TZName":"Asia\/Barnaul","TZTerritory":"001"},{"SQLName":"Altai Standard Time","TZName":"Asia\/Barnaul","TZTerritory":"RU"},{"SQLName":"Middle East Standard Time","TZName":"Asia\/Beirut","TZTerritory":"001"},{"SQLName":"Middle East Standard Time","TZName":"Asia\/Beirut","TZTerritory":"LB"},{"SQLName":"Central Asia Standard Time","TZName":"Asia\/Bishkek","TZTerritory":"KG"},{"SQLName":"Singapore Standard Time","TZName":"Asia\/Brunei","TZTerritory":"BN"},{"SQLName":"India Standard Time","TZName":"Asia\/Calcutta","TZTerritory":"001"},{"SQLName":"India Standard Time","TZName":"Asia\/Calcutta","TZTerritory":"IN"},{"SQLName":"Transbaikal Standard Time","TZName":"Asia\/Chita","TZTerritory":"001"},{"SQLName":"Transbaikal Standard Time","TZName":"Asia\/Chita","TZTerritory":"RU"},{"SQLName":"Sri Lanka Standard Time","TZName":"Asia\/Colombo","TZTerritory":"001"},{"SQLName":"Sri Lanka Standard Time","TZName":"Asia\/Colombo","TZTerritory":"LK"},{"SQLName":"Syria Standard Time","TZName":"Asia\/Damascus","TZTerritory":"001"},{"SQLName":"Syria Standard Time","TZName":"Asia\/Damascus","TZTerritory":"SY"},{"SQLName":"Bangladesh Standard Time","TZName":"Asia\/Dhaka","TZTerritory":"001"},{"SQLName":"Bangladesh Standard Time","TZName":"Asia\/Dhaka","TZTerritory":"BD"},{"SQLName":"Tokyo Standard Time","TZName":"Asia\/Dili","TZTerritory":"TL"},{"SQLName":"Arabian Standard Time","TZName":"Asia\/Dubai","TZTerritory":"001"},{"SQLName":"Arabian Standard Time","TZName":"Asia\/Dubai","TZTerritory":"AE"},{"SQLName":"West Asia Standard Time","TZName":"Asia\/Dushanbe","TZTerritory":"TJ"},{"SQLName":"West Bank Standard Time","TZName":"Asia\/Hebron","TZTerritory":"001"},{"SQLName":"West Bank Standard Time","TZName":"Asia\/Hebron Asia\/Gaza","TZTerritory":"PS"},{"SQLName":"China Standard Time","TZName":"Asia\/Hong_Kong","TZTerritory":"HK"},{"SQLName":"W. Mongolia Standard Time","TZName":"Asia\/Hovd","TZTerritory":"001"},{"SQLName":"W. Mongolia Standard Time","TZName":"Asia\/Hovd","TZTerritory":"MN"},{"SQLName":"North Asia East Standard Time","TZName":"Asia\/Irkutsk","TZTerritory":"001"},{"SQLName":"North Asia East Standard Time","TZName":"Asia\/Irkutsk","TZTerritory":"RU"},{"SQLName":"SE Asia Standard Time","TZName":"Asia\/Jakarta Asia\/Pontianak","TZTerritory":"ID"},{"SQLName":"Tokyo Standard Time","TZName":"Asia\/Jayapura","TZTerritory":"ID"},{"SQLName":"Israel Standard Time","TZName":"Asia\/Jerusalem","TZTerritory":"001"},{"SQLName":"Israel Standard Time","TZName":"Asia\/Jerusalem","TZTerritory":"IL"},'
SET @TZ_Json = @TZ_Json + '{"SQLName":"Afghanistan Standard Time","TZName":"Asia\/Kabul","TZTerritory":"001"},{"SQLName":"Afghanistan Standard Time","TZName":"Asia\/Kabul","TZTerritory":"AF"},{"SQLName":"Russia Time Zone 11","TZName":"Asia\/Kamchatka","TZTerritory":"001"},{"SQLName":"Russia Time Zone 11","TZName":"Asia\/Kamchatka Asia\/Anadyr","TZTerritory":"RU"},{"SQLName":"Pakistan Standard Time","TZName":"Asia\/Karachi","TZTerritory":"001"},{"SQLName":"Pakistan Standard Time","TZName":"Asia\/Karachi","TZTerritory":"PK"},{"SQLName":"Nepal Standard Time","TZName":"Asia\/Katmandu","TZTerritory":"001"},{"SQLName":"Nepal Standard Time","TZName":"Asia\/Katmandu","TZTerritory":"NP"},{"SQLName":"North Asia Standard Time","TZName":"Asia\/Krasnoyarsk","TZTerritory":"001"},{"SQLName":"North Asia Standard Time","TZName":"Asia\/Krasnoyarsk Asia\/Novokuznetsk","TZTerritory":"RU"},{"SQLName":"Singapore Standard Time","TZName":"Asia\/Kuala_Lumpur Asia\/Kuching","TZTerritory":"MY"},{"SQLName":"Arab Standard Time","TZName":"Asia\/Kuwait","TZTerritory":"KW"},{"SQLName":"China Standard Time","TZName":"Asia\/Macau","TZTerritory":"MO"},{"SQLName":"Magadan Standard Time","TZName":"Asia\/Magadan","TZTerritory":"001"},{"SQLName":"Magadan Standard Time","TZName":"Asia\/Magadan","TZTerritory":"RU"},{"SQLName":"Singapore Standard Time","TZName":"Asia\/Makassar","TZTerritory":"ID"},{"SQLName":"Singapore Standard Time","TZName":"Asia\/Manila","TZTerritory":"PH"},{"SQLName":"Arabian Standard Time","TZName":"Asia\/Muscat","TZTerritory":"OM"},{"SQLName":"GTB Standard Time","TZName":"Asia\/Nicosia Asia\/Famagusta","TZTerritory":"CY"},{"SQLName":"N. Central Asia Standard Time","TZName":"Asia\/Novosibirsk","TZTerritory":"001"},{"SQLName":"N. Central Asia Standard Time","TZName":"Asia\/Novosibirsk","TZTerritory":"RU"},{"SQLName":"Omsk Standard Time","TZName":"Asia\/Omsk","TZTerritory":"001"},{"SQLName":"Omsk Standard Time","TZName":"Asia\/Omsk","TZTerritory":"RU"},{"SQLName":"West Asia Standard Time","TZName":"Asia\/Oral Asia\/Aqtau Asia\/Aqtobe Asia\/Atyrau","TZTerritory":"KZ"},{"SQLName":"SE Asia Standard Time","TZName":"Asia\/Phnom_Penh","TZTerritory":"KH"},{"SQLName":"North Korea Standard Time","TZName":"Asia\/Pyongyang","TZTerritory":"001"},{"SQLName":"North Korea Standard Time","TZName":"Asia\/Pyongyang","TZTerritory":"KP"},{"SQLName":"Arab Standard Time","TZName":"Asia\/Qatar","TZTerritory":"QA"},{"SQLName":"Qyzylorda Standard Time","TZName":"Asia\/Qyzylorda","TZTerritory":"001"},{"SQLName":"Qyzylorda Standard Time","TZName":"Asia\/Qyzylorda","TZTerritory":"KZ"},{"SQLName":"Myanmar Standard Time","TZName":"Asia\/Rangoon","TZTerritory":"001"},{"SQLName":"Myanmar Standard Time","TZName":"Asia\/Rangoon","TZTerritory":"MM"},{"SQLName":"Arab Standard Time","TZName":"Asia\/Riyadh","TZTerritory":"SA"},{"SQLName":"Arab Standard Time","TZName":"Asia\/Riyadh","TZTerritory":"001"},{"SQLName":"SE Asia Standard Time","TZName":"Asia\/Saigon","TZTerritory":"VN"},{"SQLName":"Sakhalin Standard Time","TZName":"Asia\/Sakhalin","TZTerritory":"001"},{"SQLName":"Sakhalin Standard Time","TZName":"Asia\/Sakhalin","TZTerritory":"RU"},'
SET @TZ_Json = @TZ_Json + '{"SQLName":"Korea Standard Time","TZName":"Asia\/Seoul","TZTerritory":"001"},{"SQLName":"Korea Standard Time","TZName":"Asia\/Seoul","TZTerritory":"KR"},{"SQLName":"China Standard Time","TZName":"Asia\/Shanghai","TZTerritory":"001"},{"SQLName":"China Standard Time","TZName":"Asia\/Shanghai","TZTerritory":"CN"},{"SQLName":"Singapore Standard Time","TZName":"Asia\/Singapore","TZTerritory":"SG"},{"SQLName":"Singapore Standard Time","TZName":"Asia\/Singapore","TZTerritory":"001"},{"SQLName":"Russia Time Zone 10","TZName":"Asia\/Srednekolymsk","TZTerritory":"001"},{"SQLName":"Russia Time Zone 10","TZName":"Asia\/Srednekolymsk","TZTerritory":"RU"},{"SQLName":"Taipei Standard Time","TZName":"Asia\/Taipei","TZTerritory":"001"},{"SQLName":"Taipei Standard Time","TZName":"Asia\/Taipei","TZTerritory":"TW"},{"SQLName":"West Asia Standard Time","TZName":"Asia\/Tashkent","TZTerritory":"001"},{"SQLName":"West Asia Standard Time","TZName":"Asia\/Tashkent Asia\/Samarkand","TZTerritory":"UZ"},{"SQLName":"Georgian Standard Time","TZName":"Asia\/Tbilisi","TZTerritory":"001"},{"SQLName":"Georgian Standard Time","TZName":"Asia\/Tbilisi","TZTerritory":"GE"},{"SQLName":"Iran Standard Time","TZName":"Asia\/Tehran","TZTerritory":"001"},{"SQLName":"Iran Standard Time","TZName":"Asia\/Tehran","TZTerritory":"IR"},{"SQLName":"Bangladesh Standard Time","TZName":"Asia\/Thimphu","TZTerritory":"BT"},{"SQLName":"Tokyo Standard Time","TZName":"Asia\/Tokyo","TZTerritory":"001"},{"SQLName":"Tokyo Standard Time","TZName":"Asia\/Tokyo","TZTerritory":"JP"},{"SQLName":"Tomsk Standard Time","TZName":"Asia\/Tomsk","TZTerritory":"001"},{"SQLName":"Tomsk Standard Time","TZName":"Asia\/Tomsk","TZTerritory":"RU"},{"SQLName":"Ulaanbaatar Standard Time","TZName":"Asia\/Ulaanbaatar","TZTerritory":"001"},{"SQLName":"Ulaanbaatar Standard Time","TZName":"Asia\/Ulaanbaatar Asia\/Choibalsan","TZTerritory":"MN"},{"SQLName":"Central Asia Standard Time","TZName":"Asia\/Urumqi","TZTerritory":"CN"},{"SQLName":"SE Asia Standard Time","TZName":"Asia\/Vientiane","TZTerritory":"LA"},{"SQLName":"Vladivostok Standard Time","TZName":"Asia\/Vladivostok","TZTerritory":"001"},{"SQLName":"Vladivostok Standard Time","TZName":"Asia\/Vladivostok Asia\/Ust-Nera","TZTerritory":"RU"},{"SQLName":"Yakutsk Standard Time","TZName":"Asia\/Yakutsk","TZTerritory":"001"},{"SQLName":"Yakutsk Standard Time","TZName":"Asia\/Yakutsk Asia\/Khandyga","TZTerritory":"RU"},{"SQLName":"Ekaterinburg Standard Time","TZName":"Asia\/Yekaterinburg","TZTerritory":"001"},{"SQLName":"Ekaterinburg Standard Time","TZName":"Asia\/Yekaterinburg","TZTerritory":"RU"},{"SQLName":"Caucasus Standard Time","TZName":"Asia\/Yerevan","TZTerritory":"001"},{"SQLName":"Caucasus Standard Time","TZName":"Asia\/Yerevan","TZTerritory":"AM"},{"SQLName":"Azores Standard Time","TZName":"Atlantic\/Azores","TZTerritory":"PT"},{"SQLName":"Azores Standard Time","TZName":"Atlantic\/Azores","TZTerritory":"001"},{"SQLName":"Atlantic Standard Time","TZName":"Atlantic\/Bermuda","TZTerritory":"BM"},{"SQLName":"GMT Standard Time","TZName":"Atlantic\/Canary","TZTerritory":"ES"}]'

/* To Get the full list refer windows-time-zone http link below */

SELECT j.TZName,j.TZTerritory, j.SQLName, tz.[current_utc_offset],tz.[is_currently_dst]
FROM (
    SELECT SQLName,TZName,TZTerritory FROM  OPENJSON(@TZ_Json)
    WITH (
        SQLName VARCHAR(200) '$.SQLName',
        TZName VARCHAR(200) '$.TZName',
        TZTerritory VARCHAR(200) '$.TZTerritory')
    )j  INNER JOIN sys.[time_zone_info]tz ON j.[SQLName]=tz.[name]

furthermore, refer to the below links:
List of tz database time zones
Windows Timezone

A: Microsoft SQL Server
There is time zone support in Microsoft SQL Server, but perhaps not for the IANA standard. Time zone information is stored in sys.time_zone_info.
select tzi.*
from sys.time_zone_info tzi
where tzi.name like '%copenhagen%'
   or tzi.name like '%denmark%'
   or tzi.name like '%europe%'

-- result (dst = daylight saving time)
name                             current_utc_offset is_currently_dst
-------------------------------- ------------------ ----------------
W. Europe Standard Time          +02:00             1
Central Europe Standard Time     +02:00             1
Central European Standard Time   +02:00             1
E. Europe Standard Time          +03:00             1

These offsets can be combined with datetime values like shown here.
You could (manually) create a mapping table that maps the IANA time zones from your data set to the time zones available in sys.time_zone_info. An alternative would be a query with a large CASE statement to select the most accurate time zone available.
IANA downloads
Importing the data from the files that can be downloaded on the IANA website directly in SQL would be a big challenge. I had a quick look at the 'README' file contained in the tzdata2020a.tar.gz download (use your favourite zip application to unpack the files). It contains some UNIX style commands to install time zones on an OS (extract below).
make TOPDIR=$HOME/tzdir install
$HOME/tzdir/usr/bin/zdump -v America/Los_Angeles

The actual time zone information looks like the data below (extract from the file 'europe' for Denmark). I am afraid this would require an extensive script to parse and import the required data in Microsoft SQL Server.
# Denmark, Faroe Islands, and Greenland

# From Jesper Nørgaard Welen (2005-04-26):
# http://www.hum.aau.dk/~poe/tid/tine/DanskTid.htm says that the law
# [introducing standard time] was in effect from 1894-01-01....
# The page http://www.retsinfo.dk/_GETDOCI_/ACCN/A18930008330-REGL
# confirms this, and states that the law was put forth 1893-03-29.
#
# The EU [actually, EEC and Euratom] treaty with effect from 1973:
# http://www.retsinfo.dk/_GETDOCI_/ACCN/A19722110030-REGL
#
# This provoked a new law from 1974 to make possible summer time changes
# in subsequent decrees with the law
# http://www.retsinfo.dk/_GETDOCI_/ACCN/A19740022330-REGL
#
# It seems however that no decree was set forward until 1980.  I have
# not found any decree, but in another related law, the effecting DST
# changes are stated explicitly to be from 1980-04-06 at 02:00 to
# 1980-09-28 at 02:00.  If this is true, this differs slightly from
# the EU rule in that DST runs to 02:00, not 03:00.  We don't know
# when Denmark began using the EU rule correctly, but we have only
# confirmation of the 1980-time, so I presume it was correct in 1981:
# The law is about the management of the extra hour, concerning
# working hours reported and effect on obligatory-rest rules (which
# was suspended on that night):
# http://www.retsinfo.dk/_GETDOCI_/ACCN/C19801120554-REGL

# From Jesper Nørgaard Welen (2005-06-11):
# The Herning Folkeblad (1980-09-26) reported that the night between
# Saturday and Sunday the clock is set back from three to two.

# From Paul Eggert (2005-06-11):
# Hence the "02:00" of the 1980 law refers to standard time, not
# wall-clock time, and so the EU rules were in effect in 1980.

# Rule  NAME    FROM    TO  TYPE    IN  ON  AT  SAVE    LETTER/S
Rule    Denmark 1916    only    -   May 14  23:00   1:00    S
Rule    Denmark 1916    only    -   Sep 30  23:00   0   -
Rule    Denmark 1940    only    -   May 15   0:00   1:00    S
Rule    Denmark 1945    only    -   Apr  2   2:00s  1:00    S
Rule    Denmark 1945    only    -   Aug 15   2:00s  0   -
Rule    Denmark 1946    only    -   May  1   2:00s  1:00    S
Rule    Denmark 1946    only    -   Sep  1   2:00s  0   -
Rule    Denmark 1947    only    -   May  4   2:00s  1:00    S
Rule    Denmark 1947    only    -   Aug 10   2:00s  0   -
Rule    Denmark 1948    only    -   May  9   2:00s  1:00    S
Rule    Denmark 1948    only    -   Aug  8   2:00s  0   -
#
# Zone  NAME        STDOFF  RULES   FORMAT  [UNTIL]
Zone Europe/Copenhagen   0:50:20 -  LMT 1890
             0:50:20 -  CMT 1894 Jan  1 # Copenhagen MT
             1:00   Denmark CE%sT   1942 Nov  2  2:00s
             1:00   C-Eur   CE%sT   1945 Apr  2  2:00
             1:00   Denmark CE%sT   1980
             1:00   EU  CE%sT
Zone Atlantic/Faroe -0:27:04 -  LMT 1908 Jan 11 # Tórshavn
             0:00   -   WET 1981
             0:00   EU  WE%sT


text:
Q: Firewall rule for local, interactive users? I want to add a firewall rule that applies to a local interactive user. The intention is to clamp down the box, and only allow web and mail related connections, and update service connections. On occasion, I'll need to open a browser to look up a setting so I may need to allow the outbound connection when I'm sitting at the keyboard.
The Linux iptables Pocket Reference does not address the topic.
Question: Is it possible to add a firewall rule that filters based on "local user" and an "interactive user" objects?

A: You can filter outgoing packets based on the uid of the originating process. For example:
iptables -A OUTPUT -m owner --uid-owner some_user -j DROP

iptables is not able to distinguish between interactive and non-interactive processes. But you might want to look into the Linux CGROUP for this. Specifically, the net_cls subsystem. You can tag packets with the net_cls subsystem, and then filter them with iptables. So the process would be to first put the interactive user's shell in a net_cls cgroup which tags outgoing packets, and then filter those packet's with iptables.


text:
Q: How to extract date from the filename in ADF? I need to populate a column in a db table based on the date from the filename (or sysdate).
Example 1 -> test_1_20200101.csv -> the column should have 20200101
Example 1 -> test_2.csv -> the column should be populated with today's date.
This is my expression when creating the derived column, but the column is always blank.
coalesce(regexExtract(replace(sourceFileName, '/'), `((\d{4}(?:\d{1})?)(?:0?[1-9]|1[0-2])(:0?[1-9]|[12][0-9]|3[0-1]))`, 1), toString(currentDate(), 'ddMMyyyy'))

Also I am bit confused if the regex is wrong or there's something wrong with the expression.
Thanks
CP.

A: You can use CASE statement in derived column to extract date from file.
Below example depicts data flow with 2 files,

*

*one having date in the file name

*second without date in the file name.
Sample Input files:

*

*test_1_20200101.csv

*test_2.csv
In source:

*

*Add a column (SourceFileName) to store file name in source.

*Source data preview:
a. Columns "id" and "description" are from the source files.
b. Column SourceFileName is added to store source file name.

*Add new column using derived column FileExtractDate to extract and store date from the source file name. If file name does not contain date, populating the current date using case statement.
case(isDate(reverse(substring(reverse(SourceFileName), instr(reverse(SourceFileName), '.')+1,8)), 'yyyyMMdd'),reverse(substring(reverse(SourceFileName), instr(reverse(SourceFileName), '.')+1,8)), toString(currentDate(), 'yyyyMMdd'))

*FileExtractDate is the results populated from the derived column.

Sink:
Date preview of sink shows all the columns from the source and additional columns SourceFileName and FileExtractDate which is the date extracted from file name or the current date.


text:
Q: How to generate flattened tables? Table[f[i,j], {i, 1, 10}, {j, 1, 10} generates a list of lists. Sometimes I just want to obtain a single list that contains f[i,j] evaluated at all pairs of values i,j.

A: To get a flat table you could use Tuples. E.g:
f @@@ Tuples[Range[10], 2]
f @@@ Tuples[{Range[10], Range[5], Range[2]}]

A: FlatTable[expr_, ranges__] := Flatten[Table[expr, ranges], Length[{ranges}] - 1]
SetAttributes[FlatTable, HoldAll]

Use it like this:
FlatTable[f[i, j, k], {i, 2}, {j, 2}, {k, 2}]

This generates a flattened list:
{f[1, 1, 1], f[1, 1, 2], f[1, 2, 1], f[1, 2, 2],
 f[2, 1, 1], f[2, 1, 2], f[2, 2, 1], f[2, 2, 2]}

A: Also
Tuples[f[## & @@ (Range /@ {2, 3, 2})]];
Distribute[f[## & @@ (Range /@ {2, 3, 2})], List];
List @ Array[f, {2, 3, 2}, 1, Sequence]

{f[1, 1, 1], f[1, 1, 2], f[1, 2, 1], f[1, 2, 2], f[1, 3, 1],
   f[1, 3, 2], f[2, 1, 1], f[2, 1, 2], f[2, 2, 1], f[2, 2, 2],
   f[2, 3, 1], f[2, 3, 2]}

Equal[%, %%, %%%, FlatTable[f[i, j, k], {i, 2}, {j, 3}, {k, 2}]]

True

Timings:
n1 = 100; n2 = 200; n3 = 200;
First[AbsoluteTiming[res1 = FlatTable[f[i, j, k], {i, n1}, {j, n2}, {k, n3}];]]

1.642606

First[AbsoluteTiming[res2 = f @@@ Tuples[{Range[n1], Range[n2], Range[n3]}];]]

1.288345

First[AbsoluteTiming[res3 = Tuples[f[## & @@ (Range /@ {n1, n2, n3})]];]]

0.647329

First[AbsoluteTiming[res4 = Distribute[f[## & @@ (Range /@ {n1, n2, n3})], List];]]

0.706465

First[AbsoluteTiming[res5 = List@Array[f, {n1, n2, n3}, 1 , Sequence];]]

1.243508

Equal[res1, res2, res3, res4, res5]

True


text:
Q: What is the difference between :id, id: and id in ruby? I am trying to build a ruby on rails and graphQL app, and am working on a user update mutation. I have spent a long time trying to figure it out, and when I accidentally made a typo, it suddenly worked.
The below is the working migration:
module Mutations
  class UpdateUser < BaseMutation
    argument :id, Int
    argument :first_name, String
    argument :last_name, String
    argument :username, String
    argument :email, String
    argument :password, String

    field :user, Types::User
    field :errors, [String], null: false

    def resolve(id:, first_name:, last_name:, username:, email:, password:)
      user = User.find(id)
      user.update(first_name:, last_name:, username:, email:, password:)
      { user:, errors: [] }
    rescue StandardError => e
      { user: nil, errors: [e.message] }
    end
  end
end

The thing I am confused about is when I define the arguments, they are colon first: eg :id or :first_name
When I pass them to the resolve method they only work if they have the colon after: eg id: or first_name:
When I pass the variables to the update method, they use the  same syntax of colon after, for all variables other than ID. For some reason, when I used id: it was resolving to a string "id", and using colon first :id was returning an undefined error.
It is only when I accidentally deleted the colon, and tried id that it actually resolved to the passed through value.
My question for this, is why and how this is behaving this way? I have tried finding the answer in the docs, and reading other posts, but have been unable to find an answer.
Please someone help my brain get around this, coming from a PHP background, ruby is melting my brain.

A: It's going to take some time to get used to Ruby, coming from PHP, but it won't be too bad.
Essentially id is a variable, or object/model attribute when used like model_instance.id. In PHP this would be like $id or $object_instance->id.
When you see id: it is the key in a key-value pair, so it expects something (a value) after it (or assumes nil if nothing follows, often in method definitions using keyword arguments like your example). A typical use might be model_instance.update(id: 25) where you are essentially passing in a hash to the update method with id as the key and 25 as the value. The older way to write this in Ruby is with a "hash rocket" like so: model_instance.update(:id => 25).
More reading on Ruby hashes: https://www.rubyguides.com/2020/05/ruby-hash-methods
More reading on keyword arguments: https://www.rubyguides.com/2018/06/rubys-method-arguments
Now if you're paying attention that hash rocket now uses the 3rd type you're asking about. When you see a colon preceding a string like that it is called a "symbol" and it will take some time to get used to them but they are essentially strings in Ruby that are one character fewer to define (and immutable). Instead of using 'id' or "id" as a string, Ruby folks often like to use :id as a symbol and it will typically auto-convert to a string when needed. A good example might be an enumerator of sorts.
state = :ready
if state == :ready
  state = :finished
else
  state = :undefined
end

More reading on Ruby symbols: https://www.rubyguides.com/2018/02/ruby-symbols


text:
Q: ServiceStack ResponseStatus Serialization Is it possible to make the ResponseStatus class in ServiceStack serializable, or to solve this exception in another way: "Type ServiceStack.ResponseStatus is not marked as Serializable"
Im using ServiceStack in an mono embedded system. Works perfect! Now: part of that implementation is that i Serialize the request, and send it over a Socket Connection. I let the receiver DeSerialize it, and build the response, and send it back. However, after expanding ServiceStack Dto's with a ResponseStatus property to receive possible Exceptions in clientSide, i mentioned that the ResponseStatus class in ServiceStack, is not serializable, also mentioned in the exceptions: Type ServiceStack.ResponseStatus is not marked as Serializable.
Many thanks,
Robert


text:
Q: Possible Magento Hack ? Server load very high, with MySQL server has gone away end Short story, this is what happens :

*

*This guy gets on my site like 5-6 times a day, with a different IP
each time.

*He starts browsing alot of pages,adding products to cart,
adding to compare and so on, that he creates alot of processes on
the server.

Here's a part of the log:
supergeneratoare.ro:80 GET /putere?dir=desc&limit=all&order=price HTTP/1.1
supergeneratoare.ro:80 GET /catalog/product_compare/remove/product/401/uenc/aHR0cDovL3
supergeneratoare.ro:80 GET /catalog/product_compare/remove/product/362/uenc/aHR0cDovL3
supergeneratoare.ro:80 GET /checkout/cart/add/uenc/aHR0cDovL3d3dy5zdXBlcmdlbmVyYXRvYXJ
supergeneratoare.ro:80 GET /catalog/product_compare/remove/product/406/uenc/aHR0cDovL3
supergeneratoare.ro:80 GET /checkout/cart/ajaxDelete/id/3833/uenc/aHR0cDovL3d3dy5zdXBl
supergeneratoare.ro:80 GET /catalog/product_compare/remove/product/375/uenc/aHR0cDovL3

86.121.192.249 supergeneratoare.ro:80 GET /checkout/cart/add/uenc/aHR0cDovL3d3dy5zdXBlcmdlbmVyYXRvYXJ
86.121.192.249 supergeneratoare.ro:80 GET /checkout/cart/add/uenc/aHR0cDovL3d3dy5zdXBlcmdlbmVyYXRvYXJ
86.121.192.249 supergeneratoare.ro:80 GET /review/product/list/id/330/category/7/ HTTP/1.1
86.121.192.249 supergeneratoare.ro:80 GET /checkout/cart/add/uenc/aHR0cDovL3d3dy5zdXBlcmdlbmVyYXRvYXJ
86.121.192.249 supergeneratoare.ro:80 GET /catalogsearch/result/index/?mode=list&q=ect+7000 HTTP/1.1
86.121.192.249 supergeneratoare.ro:80 GET /sendfriend/product/send/id/319/cat_id/55/ HTTP/1.1
86.121.192.249 supergeneratoare.ro:80 GET /carcasa-insonorizata-24?dir=asc&limit=all&order=price HTTP
86.121.192.249 supergeneratoare.ro:80 GET /checkout/cart/add/uenc/aHR0cDovL3d3dy5zdXBlcmdlbmVyYXRvYXJ
86.121.192.249 supergeneratoare.ro:80 GET /catalogsearch/result/index/?limit=36&q=7+kva HTTP/1.1
86.121.192.249 supergeneratoare.ro:80 GET /catalogsearch/result/index/?dir=asc&limit=all&order=name&q
86.121.192.249 supergeneratoare.ro:80 GET /catalogsearch/result/index/?dir=asc&limit=36&order=name&q=
86.121.192.249 supergeneratoare.ro:80 GET /catalogsearch/result/index/?dir=desc&order=name&q=kde+100+
86.121.192.249 supergeneratoare.ro:80 GET /generatoare-curent-trifazate?limit=24&mode=grid&p=2 HTTP/1

92.114.94.101 supergeneratoare.ro:80 GET /endress?dir=asc&order=position&p=4 HTTP/1.1
92.114.94.101 supergeneratoare.ro:80 GET /checkout/cart/add/uenc/aHR0cDovL3d3dy5zdXBlcmdlbmVyYXRvYXJ
92.114.94.101 supergeneratoare.ro:80 GET /generatoare-electrice-cu-automatizare?dir=desc&limit=12&or
92.114.94.101 supergeneratoare.ro:80 GET /generatoare-sudura?dir=asc&order=price HTTP/1.1
92.114.94.101 supergeneratoare.ro:80 GET /pramac?limit=36&mode=grid HTTP/1.1
92.114.94.101 supergeneratoare.ro:80 GET /generatoare-sudura?dir=asc&limit=24&order=price HTTP/1.1
92.114.94.101 supergeneratoare.ro:80 GET /701-3000-kva?dir=asc&limit=36&order=position HTTP/1.1
92.114.94.101 supergeneratoare.ro:80 GET /tunuri-lumina?dir=desc&limit=24&order=price HTTP/1.1

What happens is the server load increases and then i get the MySQL has gone away error.
Before you tell me to read similar situations i'm telling you I HAVE, i've been reading each and every single post with this error. I have put max_allowed_packet and wait_timeout correctly, every answer is for a situation when only one error occurs, but nobody has a lunatic on their website starting 20 processes at the same time and feeding them queries until the site goes dead.
I even upgraded my VPS to quad core and 6gb of ram, it should be enough to run a 230 products Magento Website.
Please help me with this, i am willing to hire somebody for the job as long as one can fix this ..
later edit : Please advise me where to start, or what logs to check to see the malicious activity. Probably it's a bot doing all the bad stuff.
I get the feeling that there are 2 guys monitoring the website, both of them using Iphone :
- One guy has Platform iOS 8.1.2 with user agent "Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B440 Safari/600.1.4"
- Second guy has Platform iOS 8.3 with user agent "Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12F70 Safari/600.1.4"
Whenever one or the other shows up on the site, another ip comes along and site goes down. Each user has more than 30 pages viewed, i have this from opentracker installed.
At the IPs mentioned above in the log , when i find them in opentracker, i see alot of pages visited, products added to compare, and so on.
Running 1.9.0

A: Lets see, there are multiple places you need to improve to endure such a "attack".
MySql gone away probably means, your webserver is able to handle a lot more requests then your MySql, or if you have both on the same Server, the number of requests affects to much the MySql, like stealing all the CPU or IO time.
Reducing the number of accepted php connections can help a bit, even if this means, users get earlier rejected.
You need to improve your generel performance on the website.
There are more complete lists what to do for this, but a few points:
disable visitor logging
Thats one of the most costly parts of a normal website request, as it writes into the databse even on a simple product view. You can disable this by disabling specific observers. I collected once some, so look what each observer I disable here ( https://github.com/Cotya/magento_performance_fixes/blob/master/src/app/code/community/Cotya/PerformanceFixes/etc/config.xml ) does and disable them in your project, if you think you dont need this feature.
An own observer I added there, is for the following
remove category/product ID specific Layout Handles
This Increases the cache sharing a lot, which helps if you get requests on a lot of different URLs. And most people dont write ID specific rules into their layout.xml files. If you did, products and categories allow specifi own layout xml via fields in the admin area.
Increase Product List caching
One of my favorite optimizations, you cache every element(/product) on the list as own entry.
Thats a lot of additional cache entries, but means, if the same product gets shown on another category, or people change sort/filter, the single product is still cached and you need less additional querys per product.
An example for this is here: https://gist.github.com/Flyingmana/510cee6c7c2668e279ae/revisions
deactivate some functionality
You may have to think if you really need the compare functionality, it can be very performance heavy, and if not much people make use of it at your site, maybe just deactivate it.
You absolutely should deactivate the sendfriend functionality, as it allows to send emails to others.
Its not easy to block them, if you cant define a clear pattern how they do requests on your site. But when you can, there is the fail2ban tool, which can automatically block their IPs (even for limited time) if a defined behaviour is detected.

A: After almost 6 days with problems and site down, it turned out there were 2 things :

*

*During a normal MySQL update, something went wrong but this took the hosting company almost 5 days to figure it out. It was too complicated to explain to me (the CEO said), but nevertheless, hosting issue.

*I had some malicious visits that haven't been understood completly not even to this time, but anyway the hosting changed Apache to Litespeed which is about more secure than Apache, and it seems like bad traffic is gone.

A: You could be getting hit by a hack attempt or it could simply be a crawler by a bot. Bots will crawl for various reasons and having a bot + heavy traffic can be a problem with Magento servers.
How much does the traffic go up when your SQL server goes away? Having your SQL server go away is a symptom of a poorly or under performing environment. Having this happen before you get really busy and fixing it now will help your site perform better in the future.


text:
Q: How do I get my graphic card to work properly? I been having some problems with my graphic card for a time now. But I had enough when I didn't get Oil Rush to work on my HP Pavilion g6. The system has suggested hardware drivers for me, but the first time I installed them they pretty much ruined the graphics. After some time I managed to get the computers to work properly (I thought) again. When the game didn't work I tried to the hardware drivers for the graphic card anyway. First of all there was to possible choices instead of one, as the last time I installed the drivers (when it didn't work out so good). The choices are:

*

*ATI/AMDs proprietary video drivers FGLRX (update for edition)

*Proprietary FGLRX-video drivers for ATI/AMD
I realized the drivers probably are pretty much the same, so I tried the first one. But this didn't work. Instead I was asked to "Look in to /usr/var/log/jockey.log". This didn't helped me much. Instead I chose the other one, which was installed and after reboot there where some changes. First of all there was a lot more details for Unity that wasn't there before and some shortcut keys are now working that didn't before (like Ctrl + T and the Prt Sc-button). But overall everything doesn't work as it used to. Like when you browse between the work-spaces it doesn't look the same. To get to the point:
  it doesn't work well right now even if I got some things better and now will not Oil Rush (as I mentioned in the beginning) even start.
Can someone give me any advice with this? I'm stuck. Can't manage to see whats wrong right now.
My graphic card is AMD Radeon HD 6470M.

A: I've also faced this kind of problem, I've uninstalled amd drivers removing all fglrx related in synaptic package manager and installed the brand new amd driver released on january 25th 2012 and everything works perfectly now, you should try:
http://support.amd.com/fr/gpudownload/linux/Pages/radeon_linux.aspx
regards

A: Also this thread is very helpful: http://ubuntuforums.org/showthread.php?t=1930450


text:
Q: Explain introductory timing of Action versus Func Delegates Why was Func<T, TResult>(..) introduced with .NET 3.0 whereas Action<T>(..) with .NET 2.0?
Edit: I'm coding a project in .NET 2.0 right now and am missing Func. Although it's easy to roll your own as mentioned in the comments and answers i.e. simple delegate TResult Func<T,TResult>(T); I am curious why the timing would be different with two items so similar in nature.

A: Action<T> and Predicate<T> were probably added because of the methods on List<T>. It wasn't until C# 3.5 that lambdas were introduced and general delegates like these were particularly convenient.
But as John mentioned, just create your own. There's nothing special about those delegates.


text:
Q: Return response from Axios even if there is an exception when using multiple files for API call I am a beginner currently learning Vue.js. I am using Vue with my Laravel backend. For calling APIs I wanted to separate my API calls for different models. Therefore, I created api.js where I have a simple API class.
File api.js
export default class API {
    static async invoke(url, method, data=null, headers=null, acceptJson=true){
        headers = headers || {}
        if(acceptJson){
            headers['Accept'] = 'application/json';
        }
        try{
            return axios({
                method: method,
                url: url,
                data: data,
                headers: headers
            });
        }
        catch(e){
            console.log("Something went wrong while connecting to the server.");
        }
    }
}

To call this function, I created a models folder where I have separate JS file for each Model such as User.js, Activity.js etc.
File User.js
import API from '../api';

export default class User {
    /**
     * Login user to the system
     *
     * @param username string
     * @param password string
     */
    static async login(username, password){
        return await API.invoke('/api/login', 'POST', {
            'email': username,
            'password': password
        });
    }
  }

I am calling this method from my Login.vue component.
SingIn method in File Login.vue
async signIn(){
    try{
        const response = await User.login(this. Username, this.password);
        if(response.status === 200){
            this.$router.push('/dashboard');
        }
    }
    catch(err){
        this.loginError = err.response.data.message;
    }
}

On a side note, this is my directory structure:
js
│   api.js
│   app.js
│   bootstrap.js
│   router.js
│
├───components
│   │   App.vue
│   │
│   └───pages
│           Activities.vue
│           Login.vue
│           Main.vue
│           Settings.vue
│
└───models
        User.js

With this code, everything works fine when my credentials are right. But when my credentials are wrong or there is any kind of error where server responds with response codes other than 2XX, Axios throws exception.
I want to display the error from backend in my Login.vue component but when there is an exception, the exception occurs in User.js and code doesn't execute further due which error message is not accessible in Login.vue. How do I structure my code in such a way that I can display my error messages in my components having my API call codes separated in different files?
Also, I came up this code structure from little bit of research about structing files in Vue.js and rest is according to my knowledge and experience. I would appreciate a better approach to organize these codes if there is something wrong in this approach.

A: Entire structure seems good.
In Login.vue component instead of having separate try and catch you can try following
 signIn(){
     User.login(this. Username, this.password)
      .then((response) => {
       if(response.status === 200)
         this.$router.push('/dashboard');
      })
      .catch((err)=>{
        this.loginError = err.response.data.message
      })
}


text:
Q: how to create batch file in system folder using a batch file I was wondering how I would be able to create a batch file in the startup folder using a batch file. I can get the file to create in common places on my disk(desktop, documents) but I can not get it to create in the startup folder. Can I give the child batch file admin permissions in order to be copied or created to the startup folder?

A: Give a try for this code :
@echo off
Set "Startup_Folder=%AppData%\Microsoft\Windows\Start Menu\Programs\Startup"
(
    echo @echo off
    echo echo Hello this is a test
    echo pause
) >"%Startup_Folder%\test.bat"
pause


text:
Q: Can I restrict user's access on a certain IP? Like in a certain way in MySQL.
CREATE 'dbuser'@'10.1.0.1' identitifed by 'password';
GRANT USAGE on *.* to 'dbuser'@'10.1.0.1';
We are not using any mongodb tools except for Robo

A: When you create a user then you can specify Authentication Restrictions
Would be like this:
use admin
db.createUser(
   {
     user: "dbuser",
     pwd: "password"
     roles: [ { role: "readWrite", db: "reporting" } ],
     authenticationRestrictions: [ {
        clientSource: ["192.0.2.0"],
        serverAddress: ["198.51.100.0"]
     } ]
   }
)

But for me it is not clear, if you are looking for this.

A: In mongodb config file, you should specify bind_address value to your desired ip.


text:
Q: DbContext ChangeTracker issue with relationships Assume we have Customers and CustomerCategories with n-n relationship DbContext/ObjectContext. I want to maintain the relationship status in AuditLog table too. I can reach this by the following code in regular cases :
fetching relations' status in ChangeTracker by the following code :
foreach (ObjectStateEntry dbEntry in){
   objectContext
   .ObjectStateManager
   .GetObjectStateEntries(~EntityState.Detached)
   .Where(o=>o.IsRelationship)

and then finding both related entities' keys by the following codes :
(dbEntry.CurrentValues.GetValue(0) as EntityKey).EntityKeyValues[0].Value //for the key of related entity in customers table
(dbEntry.CurrentValues.GetValue(1) as EntityKey).EntityKeyValues[0].Value //for the key of related entity in CustomerCategories table

Everything is ok unless the related Customer or related CustomerCategories added newly which causes the above code returns null. So I cannot find the related entity.
Is there anyway to find the related entity properly?

A: Finally and after couple of hours I found a simple solution : GetObjectByKey a method which ObjectContext has and DbContext doesn't have! and it search the whole context by entity refrence. So I did it instead of above codes :
 objectContext.GetObjectByKey((dbEntry.CurrentValues.GetValue(0) as EntityKey));
 objectContext.GetObjectByKey((dbEntry.CurrentValues.GetValue(1) as EntityKey));


text:
Q: Seating students so that their numbers are different from both of the numbers on their chairs I read this question in a book without answer as an exercise. I read Mathematics by myself. This is the question:

In a class, there are $10$ chairs for sitting. There are two numbers on each chair:
$(1,2) (2,3) (3,4) (4,5) (5,6) (6,7) (7,8) (8,9) (9,10) (10,1)$
    There are $10$ students with numbers from $1$ to $10$. In how many ways we can sit the students so that their numbers are different from the numbers on the chair in which they sit? (the answer of question at most $6$ digits)

Is it possible to help me?

A: You are basically asking for the 10th Ménage number (the number of permutations $s$ of $[0, ..., n-1]$ such that $s(i) \ne i$ and $s(i) \ne i+1 (\text{mod}\space n)$ for all $i$).
The n-th Menage number is given with the following formula:
$$A_n=\sum_{k=0}^n (-1)^k \frac{2n}{2n-k} {2n-k\choose k} (n-k)!$$
The sequence is defined and described here and there is an article on Wikipedia too. You can find a lot of references on the same problem all over the web. You can start form there.
And the answer is 439792 :)


text:
Q: CGO did not generate header file at Mac OS I run the below code at Win 10 and got both lib and lib.h generated, tried the same at Mac but only lib got generated, and the lib.h not appeared!!
// file: lib/go.mod

module hasan/lib

go 1.14

And
// file: lib/main.go
package main

import "fmt"

//export HelloWorld
func HelloWorld() {
    fmt.Printf("hello world")
}

func main() {}

And made the build as:
$ go build -buildmode=c-shared

No error show up

A: Th error was due to missing:
import "C"

In the lib/main.go this is the one responsible about generating the proper header file lib.h
Example
Create go file lib.go
package main

import "C"
import "fmt"

//export HelloWorld
func HelloWorld() {
    fmt.Printf("hello world from GO\n")
}

func main() {}

Compile the above as:
go build -o lib.so -buildmode=c-shared lib.go

Then app.c as:
#include<stdio.h>
#include "lib.h"

int main(){
    HelloWorld();
    printf("Hello from c\n");
    return 0;
}

And compile it (and build executable) as:
cc -o output app.c lib.so

And call the output as:
Hasans-Air:Documents hajsf$ ./output
hello world from GO
Hello from c


text:
Q: R: creating a route map with multiple filters ~~EDIT~~~
The answer below worked, please see my code to be complete and question answered for anyone who needs the help in the future.
~~~~~~~~
I am trying to create a dashboard in R (first one!) that will create a map that shows thousands of routes taken between the package initial location and the package end location (travelling all over the world). I would then like to have filters in order to show different routes based on criteria (and if possible, give a box to tell how many routes are there based on the selection).
I was able to make the dashboard and the map with all the lines and it looks great. The issue now is I cannot seem to figure out how to create the filters to be interactive. My problem is I am currently creating the lines and plotting them in the For Loop so they are not being saved anywhere.
I have three filters: Department (which I call SBU), Manufacturing plant (which I call Plant and is a sub set of SBU), and Customer.
I.e You can have SBU A with all Plants associated with SBU A and look at Customer Y. You will then see those specific routes associated with this.
I.e. You can have SBU B with Plant K and look at all Customers
Unfortunately, I cannot give out the raw data.
Any help would be greatly appreciated as I am very new to R!
    library(shiny)
    library(shinydashboard)
    library(maps)
    library(geosphere)
    library(maps)
    library(mapproj)
    library(geosphere)
    library(ggrepel)
    library(scales)

    ###########################/ui.R/##################################
    #Setting drive where files are located
    setwd("C:/R Files")

    #Pulling in outside Data Files
    Network <- read.csv("Network Codes.csv")
    Data <- read.csv("Raw Data2.csv")

    #Header
    header <- dashboardHeader(
      title = "Intake Routes")

    #SideBar
    sidebar <- dashboardSidebar(

      #SBU Selection List
      selectInput(inputId = "SBU", "SBU:", selected="ALL",
                  choices = unique(as.character(Network$SBU))),

      #Plant Selection List
      uiOutput("Plant"),

      #Customer Selection List
      selectInput(inputId = "Customer", "Customer:", multiple = TRUE, selected="ALL",
          choices = unique(as.character(Data$Customer.Name.Standard))))

    #Body
    body <- dashboardBody(
      plotOutput(outputId = "map")
    )

    #Builds Dashboard Page
    ui <- dashboardPage(header, sidebar, body)

    ###########################/server.R/###############################
    server <- function(input, output) {

    ##INPUT##
      #Dependant Plant SideBar List Dependant on SBU
      output$Plant <- renderUI({
        selectInput(inputId = "Plant", "Plant:", multiple = TRUE,
            choices = as.character(Network[Network$SBU == input$SBU, "Plant.Name"]))
      })

      #Reactive data set based on inputs
      Reactive_Data1 <- reactive({
        if (input$SBU == "ALL") {Data}
        else {Data[Data$SBU == input$SBU,]}
      })

      Reactive_Data2 <- reactive({
        if (input$Plant == "ALL") {Reactive_Data1()}
        else {Reactive_Data1()[Reactive_Data1()$Plant == (input$Plant),]}
      })

     Reactive_Data3 <- reactive({
       if (input$Customer == "ALL") {Reactive_Data2()}
       else {Reactive_Data2()[Reactive_Data2()$Customer.Name.Standard == input$Customer,]}
      })

    output$map <- renderPlot({

      #Map coordinates
      xlim <- c(-170,170)
      ylim <- c(-55,75)

      map("world", col="#f2f2f2", fill=TRUE, bg="white", lwd=0.05, xlim=xlim, ylim=ylim)

      npoints <- 20
      nroutes <- nrow(Data)

      for(i in 1:nroutes){

        inter <- gcIntermediate(c(Data$Ship.From.Longitude[i],
                          Data$Ship.From.Latitude[i]),
                        c(Data$Ship.To.Longitude[i],
                          Data$Ship.To.Latitude[i]),
                        n=npoints, addStartEnd = T, breakAtDateLine = T)

        if (is.list(inter)) {
          inter1 <- inter[[1]]
          inter2 <- inter[[2]]
          lines(inter1, col = "green", lwd=0.50)
          lines(inter2, col = "blue", lwd=0.50)}
        else {
          lines(inter, col = "grey", lwd=0.50)}
      }
      })
    }

    #Combines Dashboard and Data together
    shinyApp(ui, server)

A: You need to make the dataset "reactive" to your inputs and then keep using and referring to that reactive dataset so it updates each time your inputs change.
Here is an example of making a new reactive variable called reactive_dat based on a filtered version of your Data variable.
reactive_dat <- reactive({
  Data[Data$SBU == input$SBU, ]
})


text:
Q: Disable touchpad hardware buttons I'd like to disable hardware buttons on the synaptic touchpad, but still be able to use the touchpad and "tap"-click on its surface. I don't find the related options in the output of synclient -l.
Note that I don't want to disable the touchpad completely. Only to make it ignore the hardware buttons, but still respond to taps.

A: Filed a bug against gpointing-device-settings #793440. It seems impossible to do what I want with the current version of the software. Question closed.

A: Disabling Touchpad:
Press Alt+F2 and type gconf-editor and click Run.

Navigate to desktop>gnome>peripherals>touchpad,in the right panel uncheck the entry touchpad_enabled.

Now your touchpad will be disabled.
To turn off touchpad completely install gpointing-device-settings . After installation you can access it under System > Preferences > Touchpad
UPDATE:

*

*If you want to use synclient then you have to edit your xorg.conf file.
sudo -H gedit /etc/X11/xorg.conf`

*See these instructions to edit xorg.conf

*Also See this tutorial on disabling touchpad.

*How to disable/enable touchpad in Ubuntu

A: This will disable the hardware buttons and the "tap" feature, but you will be able to move the pointer:
1) Create this file:
gedit ~/.Xmodmap

2) Paste this into it:
pointer = 0 0 0

3) Logout and log back in, or reboot, or run this:
xmodmap ~/.Xmodmap

To get it back to normal:
1) Edit the file:
gedit ~/.Xmodmap

2) And change to:
pointer = default

3) Logout and log back in, or reboot, or run this:
xmodmap ~/.Xmodmap

4) If this file doesn't have anything else, then you can delete it after step "3":
rm ~/.Xmodmap


text:
Q: Computation of the covariance of a stochastic integral. Set $X_t= \int_{0}^{t}\sqrt{s}\sin(B_s)dB_s, t\geq 0$.
How can I compute de covariance between $X_t$ and $X_u$, $0\leq u \leq t$?
I started using Itô isometry but I can´t go any further.
Thanks.

A: Hints:

*

*Fix $u \leq t$. Use Itô's isometry to show that $$\mathbb{E}(X_u X_t) = \mathbb{E} \left( \int_0^u s \sin^2(B_s) \, ds \right) = \int_0^u s \mathbb{E}(\sin^2(B_s)) \, ds. \tag{1}$$ In order to calculate the integral we need to compute $\mathbb{E}(\sin^2(B_s))$.

*Apply Itô's formula to show that $$\mathbb{E}(\sin^2(B_s)) = \int_0^s (1-2 \mathbb{E}\sin^2(B_u)) \, du.$$ This means that the function $f(s) := \mathbb{E}\sin^2(B_s)$ satisfies the ordinary differential equation $$\frac{d}{ds} f(s) = 1- 2 f(s) \qquad f(0)=0. \tag{2}$$

*Solve $(2)$ and plug the result into $(1)$ to compute $\mathbb{E}(X_u X_t)$.


text:
Q: My web app will not send confirmation emails My app used to send email confirmations when you created an account login. But I reset my database with rake db:reset and now when i Create a new account i never receive and email confirmation. Therefore I cant login into my app.
Here is my github
https://github.com/goldmullet/bloccit

A: You could add the following lines in /config/production.rb to send through SMTP:
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = false
  config.action_mailer.default :charset => "utf-8"

  config.action_mailer.smtp_settings = {
      address: "smtp.sendgrid.net",
      port: 587,
      authentication: "plain",
      enable_starttls_auto: true,
      user_name: ENV['SENDGRID_USERNAME'],
      password: ENV['SENDGRID_PASSWORD']
  }


text:
Q: CSS Issue on React project I'm starting to play with CSS and I'm struggling to center my "tasks". To debug I used a colored border and it's centered, but the elements aren't.
.App {
  display: block;
  text-align: center;
  align-items: center;
}

.done {
  color: red;
}

.task {
  text-align: center;
  align-items: center;
  display: flex;
  margin: auto;
  width: 50%;
  border: 3px solid green;
  padding: 10px;
}

Here is where the CSS is targetting:
import React, { Component } from "react";

class Task extends Component {

    render() {
        return (
            <div className={`task ${this.getClass()}`}>

{this.props.task.text}

                <button className="task-element" onClick={() => this.props.onDone(this.props.task.id)}>
                    check_box
                </button>

                <button className="task-element" onClick={() => this.props.onDelete(this.props.task.id)}>

                        delete

                </button>

        );
    }

    getClass() {
        return this.props.task.isDone ? 'done' : 'notDone';
    }
}

export default Task;

Here is the Output
Tryed to center elements and can't.

A: You need to use the justify-content property to center the elements inside the flexbox
Try this
.task {
  align-items: center;
  justify-content: center;
  display: flex;
  margin: auto;
  width: 50%;
  border: 3px solid green;
  padding: 10px;
}

A: You would need to justifyContent to centen, as your flex main axis is horizontal, and you want to center the element horizontally. Justify content manage content along main Axis, Here you can give a CSS a try, and let me know whether it works
    .task {
  text-align: center;
  align-items: center;
  justify-content: center; /*This will align the content to center in horizontal direction which is main axis if flex direction is row*/
  display: flex;
  margin: auto;
  width: 50%;
  border: 3px solid green;
  padding: 10px;
}

If you can provide whole code in a codesandbox, I can help more on that
Following are good articles on Flex box
An Interguide to Flex box by Josh W Comeau
Css Trick article on Flex box


text:
Q: Custom Double Handle Slider I was wondering if anyone had some code, or knew of a place that has code for creating a double handled slider.  (EX. Kayak application filter results time, has a slider with thumbs on both ends to create a range.) I am looking to do something similar using a double slider to search for a range of ages on a person array.
Any help would be great!

A: I created a double slider and posted it on GitHub.
Blog post: http://dev.doukasd.com/2010/08/double-slider/
GitHub page: https://github.com/doukasd/iOS-Components/tree/master/Controls/DoubleSlider
Let me know how it works for you.

A: Hey, I wrote one and posted it to git hub, too. Wish I'd seen Dimitris' earlier!
http://github.com/cmezak/CMRangeSlider

A: I just found a really nice one. There is an article on how it was built and on the second page a link to the github repository. It looks like something Apple would have done!
Wicked Double Slider
Posting this as I have a need for a really nice slider, found this page first, with so-so reviews of the projects, then later tripped on what appears to be a commercial quality project


text:
Q: Can we decide what should be our sitelinks in google? I have a maths related site and google created the sitelinks for my site ,
:) :) google is giving my site some priority
and i'm using the google web master tools
And there is an option to block any unwanted links from that list...
But the sitelinks are not exactly the subcategories of my site.
Can we decide what should be our sitelinks in google?
Note: I tried to create a new tag as 'google-sitelinks' but without reputation i could not create such one.

A: From webmaster tools:

Google generates these links
  automatically, but you can remove
  sitelinks you don't want.

You cannot add your own, but you can remove them.
View this page on webmaster tools for more info.