text:
Q: C++ - what data structures for Dijkstra's should I use? The task is:
Find the shortest path between two cities. Cities are connected with one-way roads.
Cities are present inside a .txt file in such manner:

// From // // To // // Distance //

e.g.:

London Glasgow 180
Manchester Liverpool 80
York Cambridge 415
York Manchester 260
Glasgow York 315
Glasgow Manchester 315

Given a source city S and target city T, find the shortest path. Calculate the distance and retrieve the taken path.
Problem is: I am not allowed to use any STL container at all. Cannot use containers such as std::list, std::vector, std::pair, std::set, etc. I am, however, able to use my own implemented dynamic data structures.
I'm clueless which data structures should I implement and how to implement them.
Also, should I use priority queue, or a heap, or something else?
Also wondering about adjacency list or adjacency matrix.
I don't really care if the solution is well-optimized or not.
I have been googling much, but all Dijkstras algorithms implementations I found use plenty of STL containers, that I'm not allowed to use.
Any tips, hints or links are appreciated. Thank you.

A: To code Dijkstra's shortest path algorithm you only need to implement a priority queue (min heap).
I recommend heap above all. The implementation of a set involves a (almost) balanced binary search tree like AVL or Red-Black Tree or Treap (Cartesian Tree), such codes are way harder by several orders of magnitude than implementing a heap. Also, all these solutions have the same running time O(log n) so easier to code solution come first.


text:
Q: PrepareForSegue Swift I have a NSUserDefault all set up in my viewController and this is part of it in the viewDidLoad
if  (txt1TotalDefault.valueForKey("TextField1Total") != nil){
            TextField1Total = txt1TotalDefault.valueForKey("TextField1Total") as! Double
            let T1Total = NSString(format: "TextField1Total: %i", TextField1Total)
    }

Then I have a segue at the bottom of all the code
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        var DestViewController : SecondViewController = segue.destinationViewController as! SecondViewController

        DestViewController.TotalMoneyLabel.text = T1Total}

but it will not work because it does not recognise T1Total, how would i get it to recognise it or get it out of the if statement so it can read the value correctly

A: T1Total should be class variable. In your case its method variable, because of this T1Total is not accessible in prepareForSegue method.
Pseudo Code
Class yourclass
{
    var T1Total = ""
    override func viewDidLoad()
    {
        if  (txt1TotalDefault.valueForKey("TextField1Total") != nil){
            TextField1Total = txt1TotalDefault.valueForKey("TextField1Total") as! Double
            T1Total = NSString(format: "TextField1Total: %i", TextField1Total)
        }
    }

    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        var DestViewController : SecondViewController = segue.destinationViewController as! SecondViewController

        DestViewController.TotalMoneyLabel.text = T1Total
    }
}

Using this code the T1Total will be accessible in prepareForSegue

redpajama_set_name: RedPajamaStackExchange


text:
Q: add property to interface I have an interface (from another Framework that I cannot directly modify) that looks like the following:
public interface IUserDemo
{
string UserName { get; }
}

I would like to 'extend' this interface so it looks like the following:
public interface IUserDemo
{
string UserName { get; }
string Password { get; }
}

The solution will hopefully allow me to do the following:
  UserDemo demouser = new UserDemo();
  return new UserDemo
   {
      UserName = userName,
      Password = password
   };

Where UserDemo simply looks like:
public class UserDemo : IUserDemo
{
    public string UserName { get; set; }
    public string Password { get; set; }
}

If anyone can nudge me in the right direction that would be great!

A: You can extend IUserDemo like the following
public interface IMyUserDemo : IUserDemo
{
    string Password { get; }
}

Implement your extended interface IMyUserDemo
public class UserDemo : IMyUserDemo
{
    public string UserName { get; set; }
    public string Password { get; set; }
}


text:
Q: Exporting global variables to a valid PHP file for reproducibility I have a web application running on PHP. It sometimes has bugs, and I'd like to
be able to reproduce specific requests locally through the CLI SAPI. The way I
imagined doing it was something like this:
<?php
// index.php
if (!empty($_GET["export_for_debug"]) && DEBUG_MODE) {
    file_put_contents("request.dat", serialize(get_defined_vars()));
}

// resume normal execution

This isn't for any public facing feature, it's just to allow reproducible
requests for debugging with phpdbg or similar.
However, I'm having trouble extracting the request variables into the current
global ones.
<?php
// test_request.php

// get the request variables
$vars = unserialize(file_get_contents("request.dat"));

// this doesn't work
extract($vars);

// neither does this
foreach ($vars as $key => $val) {
    $$key = $val;
}

tl;dr: How do I extract an array that looks like this:
array("_SERVER" => array("foo" => "bar"))

Into the current scope?

Edit:
I got it. You can overwrite the globals, but it seems like the code needs to be
eval'd. After a little bit of trial and error, here's what I got:
<?php

// get the request variables
$vars = unserialize(file_get_contents("request.dat"));

foreach ($vars as $key => $val) {
    eval("\${$key} = \$val;");
}

Is there a better way of doing this?

A: If you want to use phpdbg console:
1) Create file named .phpdbginit into the working directory from which you call phpdbg. File contents:
<:
extract(array("_SERVER" => array("foo" => "bar")));
:>

2) Start debugging console phpdbg -e PATH/TO/SCRIPT/NAME.php. For example phpdbg -e index.php
3) Test if it works using command ev $_SERVER
For me with php 5.6.12 and phpdbg v0.4.0, it prints:
root@host:/var/www/html# cat .phpdbginit
<:
extract(array("_SERVER" => array("foo" => "bar")));
:>
root@host:/var/www/html# phpdbg -e index.php
[Welcome to phpdbg, the interactive PHP debugger, v0.4.0]
To get help using phpdbg type "help" and press enter
[Please report bugs to <http://github.com/krakjoe/phpdbg/issues>]
[Attempting compilation of /var/www/html/index.php]
[Success]
phpdbg> ev $_SERVER
Array
(
    [foo] => bar
)


text:
Q: Why does ModelBuilder addGeometry function throw error I want to add a custom geometry to my model in the forge viewer. To do so, I use the model builder extension, but the modelBuilder.addGeometry function throws the following error:
thirdparty/three.js/three.js:33
Unhandled Promise rejection: Cannot read property 'position' of undefined
const sceneBuilder: any = await this.viewer.loadExtension('Autodesk.Viewing.SceneBuilder');
const modelBuilder: any = await sceneBuilder.addNewModel({
    modelNameOverride: 'My Custom Model',
    conserveMemory: false
});

const geometry: THREE.Geometry = new THREE.Geometry();

let vertexIndex = 0;
// room is a custom object coming from our database containing 2D geometrical information
    for (let i = 1; i < room.Outline.Vertices.length; i++) {
      const bimV1 = room.Outline.Vertices[i - 1];
      const bimV2 = room.Outline.Vertices[i];
      if (i === 1) {
        const v1 = new THREE.Vector3(bimV1.X, bimV1.Y, room.Zbase);
        const v2 = new THREE.Vector3(bimV1.X, bimV1.Y, room.Zbase + 5);
        geometry.vertices.push(v1);
        geometry.vertices.push(v2);
      }

      const v3 = new THREE.Vector3(bimV2.X, bimV2.Y, room.Zbase);
      const v4 = new THREE.Vector3(bimV2.X, bimV2.Y, room.Zbase + 5);

      geometry.vertices.push(v3);
      geometry.vertices.push(v4);

      const face1 = new THREE.Face3(vertexIndex, vertexIndex + 1, vertexIndex + 2);
      const face2 = new THREE.Face3(vertexIndex + 1, vertexIndex + 2, vertexIndex + 3);

      geometry.faces.push(face1);
      geometry.faces.push(face2);

      vertexIndex += 2;
    }

geometry.computeFaceNormals();

const bufferGeometry = new THREE.BufferGeometry().fromGeometry(geometry);
const material = new THREE.MeshPhongMaterial({ color: new THREE.Color(0, 0, 1), opacity: 0.5 });
const transform = new THREE.Matrix4().identity();
modelBuilder.addMaterial('MyCustomMaterial', material);
const geometryId = modelBuilder.addGeometry(geometry);
const cylinderFragId = modelBuilder.addFragment(geometryId, 'MyCustomMaterial', transform);

What causes this error? It works, when I am using a three cylinder like this:
const sceneBuilder: any = await this.viewer.loadExtension('Autodesk.Viewing.SceneBuilder');
const modelBuilder: any = await sceneBuilder.addNewModel({
    modelNameOverride: 'My Custom Model',
    conserveMemory: false
});
const cylinderGeometry = new THREE.BufferGeometry().fromGeometry(new THREE.CylinderGeometry(5, 5, 10));
const cylinderMaterial = new THREE.MeshPhongMaterial({ color: new THREE.Color(0, 0, 1) });
const cylinderTransform = new THREE.Matrix4().compose(
    new THREE.Vector3(+10, +10, 0),
    new THREE.Quaternion(0, 0, 0, 1),
    new THREE.Vector3(1, 1, 1)
);
modelBuilder.addMaterial('MyCustomMaterial', cylinderMaterial);
const cylinderGeomId = modelBuilder.addGeometry(cylinderGeometry);
const cylinderFragId = modelBuilder.addFragment(cylinderGeomId, 'MyCustomMaterial', cylinderTransform);

I already tried to use BufferGeometry as well, but that didn't help...
Edit:
I also tried to use the 'ConvexGeomtry' class:
let vertices :THREE.Vector3[] = [];
for (let i = 0; i < room.Outline.Vertices.length; i++) {
  const bimV1 = room.Outline.Vertices[i];
  vertices.push(new THREE.Vector3(bimV1.X, bimV1.Y, bimV1.Zbase));
  vertices.push(new THREE.Vector3(bimV1.X, bimV1.Y, bimV1.Zbase + 5));
}

const geometry = new ConvexGeometry(vertices);

const material = new THREE.MeshPhongMaterial({ color: new THREE.Color(0, 0, 1), opacity: 0.5 });
const transform = new THREE.Matrix4().identity();
modelBuilder.addMaterial('MyCustomMaterial', material);
const geometryId = modelBuilder.addGeometry(geometry);
modelBuilder.addFragment(geometryId, 'MyCustomMaterial', transform);

It throws the same error when calling 'modelBuilder.addGeometry(geometry)'

A: It looks like there's an error in your code snippet. While you are converting your THREE.Geometry object into THREE.BufferGeometry object (required by Forge Viewer), you are passing the wrong variable into the modelBuilder.addGeometry method.
Try replacing
const geometryId = modelBuilder.addGeometry(geometry);

with
const geometryId = modelBuilder.addGeometry(bufferGeometry);


text:
Q: How to handle an HTTP response time beyond two minutes? The maximum value for HttpRequest.setTimeout function is two minutes. How can we design an Apex class to receive the response if the response time is always guaranteed to be more than two minutes?
In the statement, HTTPResponse res = http.send(req), I want to execute the RHS to send the request immediately, but want to execute the LHS assignment ten minutes later.

A: @Anshul provided an Amazing answer on how to handle callouts in async way. But still the question here is"The maximum callout time is 120,000 milliseconds" i.e You can't go beyond 2mins via any async method . Here now you would have to change the architecture of your application.
The answer would be to split the transaction into two calls.

*

*The endpoint will provide just ack id without full processing.

*After processing data the server will call our webservice providing the result with ack id. You query the particular record and perform DML. Thats how you utilize the platform to its full capability without have to worry about long callouts.

Callout Timeout limits here.
The integration pattern I am talking about is "Fire and Forget". You can read more about it here.

A: Salesforce now allows Apex developers to invoke Asynchronous Callouts. This means that now, developers can initiate callouts from within Salesforce which can respond back in more than 2 minutes (governor limits) and assign a callback mechanism, to handle response for such callouts.
The mechanism is called continuation, wherein all such asynchronous requests are submitted to a Salesforce continuation server, along with a callback method. Continuation server takes care of web service invocation. Once continuation server receives a response from web service host, it calls the callback method specified during invocation.
With this, visualforce pages can be designed in a way that they submit an asynchronous request and continue with rest of the process. As soon as response is received an async method is called which can take care of the related business process (update records, refresh VF Page etc.)
For more details refer :-
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_continuation_overview.htm
https://developer.salesforce.com/blogs/engineering/2014/05/put-apex-sleep-salesforce-asynchronous-callouts.html


text:
Q: How to concatenate null columns in spark dataframe in java? I am working with spark in java and I want to create a column which is a concatenation of all other column values separated by comma. I have tried few ways to do this but couldn't find a solution.
For example-
col1 | col2 | col3 | result
 1   | john | 2.3  | 1,john,2.3

The problem that I'm facing is if a column value is null then simply nothing should be there but so far I have not achieved this.
For example-
col1 | col2 | col3 | result
 1   | null | 2.3  | 1,,2.3  -> this is what I'm trying to achieve

What I have tried-
1.) I tried concat function of spark sql but if a column value is null then entire value of concat function will be null, which is not something i want.
2.) concat_ws function simply ignore the null values hence can't be used. Hence in my 2nd example the result would be something like 1,2.3
3.) using coalesce require matching data types so if I do something like coalesce(col_name,'') under concat function and col_name is number data type then it throws data types mismatch error.
4.) using case when statement also require same data type in THEN & ELSE conditions. So if I say case when column_1 is null THEN '' ELSE column1 END will throw error if column1 is number because '' is empty string and column_1 is number.
one way it can be achieved is creating map_function. But is there a way to do it in spark sql way?

A: You can cast all your fields to String so that you can run NVL on them and set them to empty string '' if they're null.
To generate an expression for all the columns in your dataframe automatically, you can use map function:
df.show()
//+----+----+----+
//|col1|col2|col3|
//+----+----+----+
//|   1|John| 2.3|
//|   2|null| 2.3|
//+----+----+----+

List<String> columns = df.columns() ;
// List("col1", "col2", "col3")

String nvlExpr = columns.stream().map(i -> "nvl(cast ("+i+" as string),'')").collect(joining(", ", "concat_ws(','," , ")"));

//concat_ws(',',nvl(cast (col1 as string), ''), nvl(cast (col2 as string), ''),nvl(cast (col3 as string), ''))

df.withColumn("result", expr(nvlExpr)).show()

//+----+----+----+----------+
//|col1|col2|col3|    result|
//+----+----+----+----------+
//|   1|John| 2.3|1,John,2.3|
//|   2|null| 2.3|    2,,2.3|
//+----+----+----+----------+

A: This way you can concat

scala> spark.sql("select *, concat(cast(col1 as string),',' ,col2,',' ,cast(col3 as string)) as result from (select col1, col3, case when col2 is null then '' else col2 end as col2 from final)").show()
+----+----+----+--------+
|col1|col3|col2|  result|
+----+----+----+--------+
|   1| 2.3|  JK|1,JK,2.3|
|   1| 2.3|    |  1,,2.3|
+----+----+----+--------+


text:
Q: Agular2 + typescript + file upload I am creating an angular2 project, in which my requirement is to upload a file and send some parameters from client to server(Spring Rest Server).
I have tried Formdata Interface, but when i am appending a file(File Object created from event.srcElement.files) to it and then logging the object to console it prints an empty formdata object.
As for the server side i am using @requestparam("file") to fetch the file.
It would be great if anyone can provide some help on this.
this is the code in my html file
<input type="file" #uploadFile multiple="true" (change)="uploadFile($event)"/>

component file is like this
  uploadFile(event:any){
    let file = event.target.files[0];
    let fileName = file.name;
    console.log(file)
    console.log(fileName)
    let formData = new FormData();
    formData.append('file',file);
    this.examService.uploadAnswer(formData);
}

and in service file
uploadAnswer(formData:FormData){
            console.log(formData)
            this.http.post(this.url+'/uploadanswer', formData)
            .map((response: Response) => {
                let res = response.json();
            Object.keys(res).forEach(name =>
                this.questions=res[name]
            );
            });

A: Your HTML should be:
<input id="file-field" name="file-field" (change)="uploadFile($event)" type="file" accept=".png,.jpg,.jpeg">

So you will get file in component as:
uploadFile(event) {
  let files = event.target.files;
  if (files.length > 0) {
    console.log(file); // You will see the file
    this.service.uploadFile(file);
  }
}

And in service:
uploadFile(file) {
  let formData: FormData = new FormData();
  formData.append('file', file, file.name);

  this.http.post(url, formData, request_options)
}

Then you will get file in with file key in request data.


text:
Q: How to Solve this " TypeError: read() missing 1 required positional argument: 'self' " I am using Flask to create a REST api to get all books stored in MSSQL database. When i simply run this code and print data in console it's working great. But when i run as a Flask API and try to get all data in postman, it's showing this error:
Complete Trace Back:
Traceback (most recent call last):
     File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 2309, in __call__
        return self.wsgi_app(environ, start_response)
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 2295, in wsgi_app
        response = self.handle_exception(e)
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 1741, in handle_exception
        reraise(exc_type, exc_value, tb)
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\_compat.py", line 35, in reraise
        raise value
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 2292, in wsgi_app
        response = self.full_dispatch_request()
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
        rv = self.handle_user_exception(e)
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
        reraise(exc_type, exc_value, tb)
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\_compat.py", line 35, in reraise
        raise value
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
        rv = self.dispatch_request()
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 1799, in dispatch_request
        return self.view_functions[rule.endpoint](**req.view_args)
    TypeError: read() missing 1 required positional argument: 'self'
    127.0.0.1 - - [13/Feb/2019 17:38:21] "GET / HTTP/1.1" 500 -
    Traceback (most recent call last):
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 2309, in __call__
        return self.wsgi_app(environ, start_response)
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 2295, in wsgi_app
        response = self.handle_exception(e)
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 1741, in handle_exception
        reraise(exc_type, exc_value, tb)
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\_compat.py", line 35, in reraise
        raise value
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 2292, in wsgi_app
        response = self.full_dispatch_request()
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
        rv = self.handle_user_exception(e)
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
        reraise(exc_type, exc_value, tb)
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\_compat.py", line 35, in reraise
        raise value
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
        rv = self.dispatch_request()
      File "C:\Users\raj.pandey\Desktop\Flask_API\lib\site-packages\flask\app.py", line 1799, in dispatch_request
        return self.view_functions[rule.endpoint](**req.view_args)
    TypeError: home() missing 1 required positional argument: 'self'

Here's my code that is getting error:
class MssqlConnection:
    def __init__(self):
        credentials = Credentials()
        self.driver = credentials.driver
        self.host = credentials.host
        self.database = credentials.database
        self.table = credentials.table
        self.user = credentials.user
        self.password = credentials.password

    @app.route('/books')
    def read(self):
        query = "Select id, name, price, isbn from dbo." + self.table
        cursor.execute(query)
        for row in cursor:
            data = {
                'id': row.id,
                'name': row.name,
                'price': row.price,
                'isbn': row.isbn
            }
            # print(data)
            return jsonify(data)

I have checked it, but still can't understand what's the problem.

A: Your endpoint function is not (or even should not) in a class probably. Just remove the self argument from def read(self): line and you will be fine. You should use "self" as an argument when you code in a class scope. You are not in a class scope. So the solution is def read():.
In Flask, only if you put a parameter in your url like app.route('/books/<somevariable>') you should pass somevariable to the endpoint function as an argument and write def myfunction(somevariable):
You can read the docs about that:
http://flask.pocoo.org/docs/1.0/quickstart/#variable-rules


text:
Q: Is there any functions can access single value of smbios with protocol technique? I am newbie to uefi and trying to access smbios values with protocol technique. I have checked up the UEFI and SMBIOS spec, but found nothing with them.
I know that there is one function called pci.read() which can access one value in the pci area of memory each time when using protocols to deal with pci devices. It seems that there is no alike function to read one value each time to deal with smbios protocols?
What I found in the specs which is similar is GetNext(), but this function only outputs three values of header. I am wonder if there is any way to read single value each time so I can instantly Print() the value? Or put memory values of smbios into an array?

A: SMBIOS is nothing more to UEFI than a pointer to a configuration table (reachable through the UEFI System Table, and identified by the specified GUID).
There is an EFI_SMBIOS_PROTOCOL, but it is part of the PI (Platform Initialization) specification, not UEFI - so cannot be considered a portable interface. The latest version of the PI specification (currently 1.7) can be downloaded from https://uefi.org/specifications.
Otherwise, grab the pointer from the system table and parse the structure manually. The size of the structure table can be read from the SMBIOS entry point.


text:
Q: SQL Azure: Deadlock on concurrent delete operations I am encountering some deadlocks on my SQL azure database caused by concurrent delete operations and I am unsure as how to resolve it. I have simplified the situation to the most basic level. I have the following table:
CREATE TABLE [dbo].[Test2013](
    [ClientID] [int] NOT NULL,
    [ID] [uniqueidentifier] NOT NULL,
    [Value] [int] NOT NULL,
 CONSTRAINT [dbo-Test2013] PRIMARY KEY CLUSTERED
(
    [ClientID] ASC,
    [ID] ASC
)
 WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF,
       IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON,
       ALLOW_PAGE_LOCKS  = ON)
)

GO

ALTER TABLE [dbo].[Test2013] ADD CONSTRAINT [Test2013-ID-Default-Value]
     DEFAULT (newid()) FOR [ID]
GO

The query that causes the issue is as follows:
INSERT INTO [Test2013]
    ([ClientID],[ID],[Value])
    SELECT
        CAST(-2147483648 AS INT) [ClientID],
        '82ecb924-d2f0-44ee-9a8e-5240d12de088' [ID],
        CAST(1 AS INT) [Value]

INSERT INTO [Test2013]
    ([ClientID],[ID],[Value])
    SELECT
        CAST(-2147483648 AS INT) [ClientID],
        '82ecb924-d2f0-44ee-9a8e-5240d12de077' [ID],
        CAST(2 AS INT) [Value]

 DECLARE @MyDateTime DATETIME
SET @MyDateTime = DATEADD(s,5,GETDATE())

DECLARE @MyDateTime2 DATETIME
SET @MyDateTime2 = DATEADD(ms,1,@MyDateTime)

BEGIN tran
    WAITFOR TIME @MyDateTime;
    DELETE FROM [Test2013]
    WHERE [ID] = '82ecb924-d2f0-44ee-9a8e-5240d12de088';
Commit tran

BEGIN tran
    WAITFOR TIME @MyDateTime2;
    DELETE FROM [Test2013]
    WHERE [ID] = '82ecb924-d2f0-44ee-9a8e-5240d12de077';
Commit tran

I thought this would be relatively trivial but I cannot find out what is actually locking on the query. I have checked the sys.events_log table and it doesn't contain any new deadlock events. I have seen other deadlocks before, but they all threw Exceptions that I could handle, this one just hangs indefinitely.
On a side note, if I delay the second operation by 50 ms, it works fine.

A: The hanging here isn't really caused by deadlocks, but because you are waiting for a time that has already passed. Below is a modified version of your query that spams the current time along with the messages from my run. As you can see, by the time you are waiting for @MyDateTime2, it has already passed. The reason why 50 ms works is because it doesn't take 50 ms to do all that work. I changed WAITFOR TIME to WAITFOR DELAY, and it works. It doesn't really wait for a millisecond, though.
INSERT INTO [Test2013]
    ([ClientID],[ID],[Value])
    SELECT
        CAST(-2147483648 AS INT) [ClientID],
        '82ecb924-d2f0-44ee-9a8e-5240d12de088' [ID],
        CAST(1 AS INT) [Value]

INSERT INTO [Test2013]
    ([ClientID],[ID],[Value])
    SELECT
        CAST(-2147483648 AS INT) [ClientID],
        '82ecb924-d2f0-44ee-9a8e-5240d12de077' [ID],
        CAST(2 AS INT) [Value]

 DECLARE @MyDateTime DATETIME
SET @MyDateTime = DATEADD(s,5,GETDATE())

PRINT(CONVERT(varchar, @MyDateTime, 121))
DECLARE @MyDateTime2 DATETIME
SET @MyDateTime2 = DATEADD(ms,1,@MyDateTime)

PRINT(CONVERT(varchar, @MyDateTime2, 121))
BEGIN tran
PRINT(CONVERT(varchar, getdate(), 121))
    WAITFOR TIME @MyDateTime;
PRINT(CONVERT(varchar, getdate(), 121))
    DELETE FROM [Test2013]
    WHERE [ID] = '82ecb924-d2f0-44ee-9a8e-5240d12de088';
PRINT(CONVERT(varchar, getdate(), 121))
Commit tran

BEGIN tran
PRINT(CONVERT(varchar, getdate(), 121))
    WAITFOR TIME @MyDateTime2;
PRINT(CONVERT(varchar, getdate(), 121))
    DELETE FROM [Test2013]
    WHERE [ID] = '82ecb924-d2f0-44ee-9a8e-5240d12de077';
PRINT(CONVERT(varchar, getdate(), 121))
Commit tran

Resulting messages when I cancel the query:
(1 row(s) affected)

(1 row(s) affected)
2013-06-21 15:13:09.980
2013-06-21 15:13:09.980
2013-06-21 15:13:04.980
2013-06-21 15:13:09.997

(1 row(s) affected)
2013-06-21 15:13:09.997
2013-06-21 15:13:10.017
Query was cancelled by user.

Using WAITFOR DELAY instead:    INSERT INTO [Test2013]
        ([ClientID],[ID],[Value])
        SELECT
            CAST(-2147483648 AS INT) [ClientID],
            '82ecb924-d2f0-44ee-9a8e-5240d12de088' [ID],
            CAST(1 AS INT) [Value]
INSERT INTO [Test2013]
    ([ClientID],[ID],[Value])
    SELECT
        CAST(-2147483648 AS INT) [ClientID],
        '82ecb924-d2f0-44ee-9a8e-5240d12de077' [ID],
        CAST(2 AS INT) [Value]

BEGIN tran
PRINT(CONVERT(varchar, getdate(), 121))
    WAITFOR delay '00:00:05'
PRINT(CONVERT(varchar, getdate(), 121))
    DELETE FROM [Test2013]
    WHERE [ID] = '82ecb924-d2f0-44ee-9a8e-5240d12de088';
PRINT(CONVERT(varchar, getdate(), 121))
Commit tran

BEGIN tran
PRINT(CONVERT(varchar, getdate(), 121))
    WAITFOR delay '00:00:00.001'
PRINT(CONVERT(varchar, getdate(), 121))
    DELETE FROM [Test2013]
    WHERE [ID] = '82ecb924-d2f0-44ee-9a8e-5240d12de077';
PRINT(CONVERT(varchar, getdate(), 121))
Commit tran


text:
Q: Como iterar com dicionários em Python 3? Eu tenho dois arquivos e preciso gerar um terceiro a partir deles.
Primeiro arquivo chamado "de_para".

*

*de_para.txt

Dentro desse arquivo tenho o seguinte conteúdo de exemplo:
Ordem   Campo_para  Campo_de
1   nome_emp    RAZA
2   ende_emp    ENDE
3   cepe_emp    NCEP
4   cida_emp    CIDA

*

*"Ordem" seria a ordem em que os dados serão impressos nas linhas no terceiro arquivo;

*"Campo_para" é o nome da coluna que será gravada no terceiro arquivo.

*"Campo_de" é o nome da coluna que será procurada nas chaves do segundo arquivo chamado "empresas.txt"

O segundo arquivo "empresas.txt" tem a seguinte composição:
RAZA    ENDE    NCEP    CIDA
empresa1    rua1    cep1    cidade1
empresa2    rua2    cep2    cidade2
empresa3    rua3    cep3    cidade3
empresa4    rua4    cep4    cidade4
empresa5    rua5    cep5    cidade5

Como posso fazer a iteração dessa situação?
Com esse código eu criaria a lista com as colunas do primeiro arquivo:
for dict_col_geempre in read_geempre:
    hash_geempre.append(dict_col_geempre.get("Campo_de"))

Não estou conseguindo fazer a verificação da seguinte maneira:
Preciso verificar se a coluna "RAZA" do segundo arquivo existe no hash_geempre, caso exista, pegue o valor dessa chave no segundo arquivo "empresas.txt" e assim por diante e depois grave tudo isso num terceiro arquivo de nome "empresas_validas.txt".
Daria para fazer de modo diferente. Setando uma variável para cada coluna do segundo arquivo "empresas.txt", mas pensei em fazer com um arquivo "de_para" para ficar melhor penso eu.
Como posso fazer isso?

A: Vamos por partes. Primeiro leia o arquivo de_para, e guarde cada linha (exceto a primeira) em uma lista (usando with para abrir o arquivo, pois ele garante que o arquivo é fechado ao final do bloco):
de_para = []
with open('de_para.txt', 'r') as de_para_arq:
    next(de_para_arq) # pula primeira linha
    for linha in de_para_arq:
        de_para.append(linha.split())
# ordena a lista de acordo com o campo ordem
de_para = sorted(de_para, key=lambda x: int(x[0]))

Eu uso split para separar a linha por espaços, e o resultado é uma lista, onde o primeiro elemento é a coluna ordem, o segundo é a coluna "para" e o terceiro é a coluna "de". Cada linha do arquivo será uma lista assim, e de_para será uma lista contendo todas essas listas (uma para cada linha do arquivo).
Em seguida ordenei a lista de_para com base na primeira coluna (usando int para converter a string para número), para garantir que os elementos estarão na ordem correta (se essa coluna existe, estou assumindo que as linhas não estarão necessariamente em ordem no arquivo, caso contrário não faria sentido essa coluna existir).

Agora vamos ler o arquivo de empresas:
empresas = []
with open('empresas.txt', 'r') as empresas_arq:
    headers = next(empresas_arq).split() # nomes dos headers
    for linha in empresas_arq:
        empresa = dict()
        for header, valor in zip(headers, linha.split()):
            empresa[header] = valor
        empresas.append(empresa)

Primeiro eu faço split na primeira linha para pegar os nomes das colunas.
Depois, para cada linha do arquivo, eu percorro tanto a lista de headers quanto os elementos da linha (o uso de zip permite percorrer as duas listas ao mesmo tempo, assim eu tenho o valor correspondente ao nome de cada coluna). Essa solução assume que o arquivo é bem formado e sempre tem todas as colunas.
No fim eu tenho uma lista de empresas, sendo que cada empresa é um dicionário, que mapeia os nomes das colunas com os respectivos valores. Por exemplo, o primeiro elemento da lista de empresas será:
{'RAZA': 'empresa1', 'CIDA': 'cidade1', 'ENDE': 'rua1', 'NCEP': 'cep1'}

Assim, eu tenho o nome da coluna atual e o respectivo valor. Cada linha do arquivo de empresas será um dicionário assim, e a lista empresas terá todos esses dicionários (um para cada linha do arquivo).

Agora é só escrever o terceiro arquivo:
with open('empresas_validas.txt', 'w') as out:
    # escreve os headers
    out.write(' '.join(para for _, para, _ in de_para))
    out.write("\n")
    for emp in empresas:
        out.write(' '.join(emp[de] for _, _, de in de_para))
        out.write("\n")

Primeiro eu escrevo os headers, usando os nomes que estão na lista de_para. Eu uso join para unir os nomes, separando-os por espaço. Para facilitar, use a sintaxe de list comprehension, bem mais sucinta e pythônica.
Depois, para cada empresa, eu pego o valor da coluna "de" que está na lista de_para (como a lista foi ordenada, eu garanto que os campos são escritos na ordem desejada). O resultado será o arquivo:
nome_emp ende_emp cepe_emp cida_emp
empresa1 rua1 cep1 cidade1
empresa2 rua2 cep2 cidade2
empresa3 rua3 cep3 cidade3
empresa4 rua4 cep4 cidade4
empresa5 rua5 cep5 cidade5

Se quiser, também pode trocar os loops que leem os arquivos por list e dict comprehensions:
with open('de_para.txt', 'r') as de_para_arq:
    next(de_para_arq) # pula primeira linha
    de_para = [ linha.split() for linha in de_para_arq ]
# ordena a lista de acordo com o campo ordem
de_para = sorted(de_para, key=lambda x: int(x[0]))

with open('empresas.txt', 'r') as empresas_arq:
    headers = next(empresas_arq).split() # nomes dos headers
    empresas = [ { header: valor for header, valor in zip(headers, linha.split()) } for linha in empresas_arq ]

with open('empresas_validas.txt', 'w') as out:
    # escreve os headers
    out.write(' '.join(para for _, para, _ in de_para))
    out.write("\n")
    out.write("\n".join( ' '.join(emp[de] for _, _, de in de_para) for emp in empresas))


text:
Q: Understanding Smartctl Output I'm trying to determine if an old hard drive is failing. It makes a constant, loud, buzzing noise, and has problems shutting down properly.
Smartctl indicates that my hard drive has passed, but also lists numerous errors at the bottom.
=== START OF INFORMATION SECTION ===
Model Family:     Seagate Mobile HDD
Device Model:     ST1000LM035-1RK172
Serial Number:    ZDE1F5CD
LU WWN Device Id: 5 000c50 0a3561544
Firmware Version: LVM2
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Form Factor:      2.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-3 T13/2161-D revision 3b
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Fri Dec  2 13:21:54 2022 EST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                    without error or no self-test has ever
                    been run.
Total time to complete Offline
data collection:        (    0) seconds.
Offline data collection
capabilities:            (0x71) SMART execute Offline immediate.
                    No Auto Offline data collection support.
                    Suspend Offline collection upon new
                    command.
                    No Offline surface scan supported.
                    Self-test supported.
                    Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                    General Purpose Logging supported.
Short self-test routine
recommended polling time:    (   1) minutes.
Extended self-test routine
recommended polling time:    ( 168) minutes.
Conveyance self-test routine
recommended polling time:    (   2) minutes.
SCT capabilities:          (0x3035) SCT Status supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   078   058   034    Pre-fail  Always       -       58414483
  3 Spin_Up_Time            0x0003   099   099   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   097   097   020    Old_age   Always       -       4039
  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   085   060   045    Pre-fail  Always       -       315028363
  9 Power_On_Hours          0x0032   082   082   000    Old_age   Always       -       15873 (119 200 0)
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   097   097   020    Old_age   Always       -       3766
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   001   001   000    Old_age   Always       -       153
188 Command_Timeout         0x0032   100   099   000    Old_age   Always       -       6
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   072   049   040    Old_age   Always       -       28 (Min/Max 20/28)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       35
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       58
193 Load_Cycle_Count        0x0032   032   032   000    Old_age   Always       -       137023
194 Temperature_Celsius     0x0022   028   051   000    Old_age   Always       -       28 (0 6 0 0 0)
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
240 Head_Flying_Hours       0x000f   083   083   030    Pre-fail  Always       -       15457 (99 157 0)
254 Free_Fall_Sensor        0x0032   100   100   000    Old_age   Always       -       0

SMART Error Log Version: 1
ATA Error Count: 153 (device log contains only the most recent five errors)
    CR = Command Register [HEX]
    FR = Features Register [HEX]
    SC = Sector Count Register [HEX]
    SN = Sector Number Register [HEX]
    CL = Cylinder Low Register [HEX]
    CH = Cylinder High Register [HEX]
    DH = Device/Head Register [HEX]
    DC = Device Command Register [HEX]
    ER = Error register [HEX]
    ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 153 occurred at disk power-on lifetime: 976 hours (40 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 88 4e dd 06  Error: UNC at LBA = 0x06dd4e88 = 115166856

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 08 88 4e dd 46 00      00:25:19.106  READ FPDMA QUEUED
  2f 00 01 10 00 00 20 00      00:25:19.090  READ LOG EXT
  60 00 08 88 4e dd 46 00      00:25:09.399  READ FPDMA QUEUED
  2f 00 01 10 00 00 20 00      00:25:09.388  READ LOG EXT
  60 00 08 88 4e dd 46 00      00:24:59.574  READ FPDMA QUEUED

Error 152 occurred at disk power-on lifetime: 976 hours (40 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 88 4e dd 06  Error: UNC at LBA = 0x06dd4e88 = 115166856

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 08 88 4e dd 46 00      00:25:09.399  READ FPDMA QUEUED
  2f 00 01 10 00 00 20 00      00:25:09.388  READ LOG EXT
  60 00 08 88 4e dd 46 00      00:24:59.574  READ FPDMA QUEUED
  2f 00 01 10 00 00 20 00      00:24:59.562  READ LOG EXT
  60 00 08 88 4e dd 46 00      00:24:49.901  READ FPDMA QUEUED

Error 151 occurred at disk power-on lifetime: 976 hours (40 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 88 4e dd 06  Error: UNC at LBA = 0x06dd4e88 = 115166856

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 08 88 4e dd 46 00      00:24:59.574  READ FPDMA QUEUED
  2f 00 01 10 00 00 20 00      00:24:59.562  READ LOG EXT
  60 00 08 88 4e dd 46 00      00:24:49.901  READ FPDMA QUEUED
  2f 00 01 10 00 00 20 00      00:24:49.891  READ LOG EXT
  60 00 18 88 4e dd 46 00      00:24:39.968  READ FPDMA QUEUED

Error 150 occurred at disk power-on lifetime: 976 hours (40 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 88 4e dd 06  Error: UNC at LBA = 0x06dd4e88 = 115166856

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 08 88 4e dd 46 00      00:24:49.901  READ FPDMA QUEUED
  2f 00 01 10 00 00 20 00      00:24:49.891  READ LOG EXT
  60 00 18 88 4e dd 46 00      00:24:39.968  READ FPDMA QUEUED
  2f 00 01 10 00 00 20 00      00:24:39.956  READ LOG EXT
  60 00 08 88 4e dd 46 00      00:24:30.253  READ FPDMA QUEUED

Error 149 occurred at disk power-on lifetime: 976 hours (40 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 88 4e dd 06  Error: UNC at LBA = 0x06dd4e88 = 115166856

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 18 88 4e dd 46 00      00:24:39.968  READ FPDMA QUEUED
  2f 00 01 10 00 00 20 00      00:24:39.956  READ LOG EXT
  60 00 08 88 4e dd 46 00      00:24:30.253  READ FPDMA QUEUED
  2f 00 01 10 00 00 20 00      00:24:30.242  READ LOG EXT
  60 00 08 88 4e dd 46 00      00:24:20.410  READ FPDMA QUEUED

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

A: "smartctl -a /dev/sda" will give the information about the particular drive
You can run "smartctl -t short /dev/sda" to perform the SMART short test.


text:
Q: CASE OR IF IN SQL STATEMENT Tables with course_article, gr_article and user_score.

The course can have many articles within a course: 7 can have articles 1,2,5,6,7.
Only few articles are graded among: 1,6 and 2,5,7 are not graded.
User attempts all the articles: can get only graded articles 1,6 from gr_article and 2,5,7 from course_article.

I want all the courses, with articles and user score in one table as shown in the output.
SELECT u.userid ,
       c.cid ,
       a.id ,
       u.score ,
       ( CASE WHEN c.cid = a.cid THEN u.score
              ELSE 0
         END ) AS "score"
FROM   course_article c
       JOIN gr_article a ON c.cid = a.cid
       JOIN user_score u ON u.a_id = a.id
WHERE  u.userid = 8
       AND c.cid = 7;

When I execute the query, it shows only the graded articles that user attempted, but I need all the course articles to be shown.
Tables
course_article
+--------------+
|   id  cid    |
+--------------+
|     1    7   |
|     2    7   |
|     3    5   |
|     4    5   |
|     5    7   |
|     6    7   |
|     7    7   |
+--------------+

gr_article
+------------------------+
| id  cid  article_name  |
+------------------------+
| 1    7       A1        |
| 2    7       A4        |
| 3    7       A5        |
| 4    7       A3        |
| 5    7       A2        |
| 6    7       A44       |
| 7    7       A6        |
+------------------------+

user_score
+------------------------------+
|   id  a_id  userid   score   |
+------------------------------+
|     1    2      8       3.4  |
|     2    3      3       2.0  |
|     3    4      8       6.7  |
|     4    5      3       4.5  |
|     5    1      8       5.6  |
+------------------------------+

Output
+-----------------------------+
|  userid cid  a_id   score   |
+-----------------------------+
|       8     7    2      3.4 |
|       8     7    4      6.7 |
|       8     7    1      5.6 |
|       8     7    5       0  |
|       8     7    6       0  |
|       8     7    7       0  |
+-----------------------------+

A: You need to first identify which courses a user should be graded, and then perform an OUTER JOIN so you can show the 0.0 for articles not yet graded.
Assuming there is no table relating user to course, perhaps you can infer this relationship by assuming that a user is related to course if the user has received at least 1 grade for an article in the course.
Then, you get a query similar to this below:
SELECT
    uc.userid,
    a.cid,
    a.id AS a_id,
    COALESCE(us.score, 0) AS score -- If no user score, assume 0
FROM (
    SELECT DISTINCT
        us.userid,
        a.cid
    FROM user_score us
        INNER JOIN gr_article a
            ON us.a_id = a.id
    ) uc -- Get user/course relationship
    INNER JOIN gr_article a
        ON uc.cid = a.cid -- Get all possible articles for user courses
    INNER JOIN course_article ca
        ON uc.cid = ca.cid -- Join back to course article as requested (not sure exactly of conditions you may need)
    LEFT OUTER JOIN user_score us -- Get available scores by article for user
        ON us.userid = uc.userid
            AND us.a_id = a.id
 WHERE uc.userid = 8 -- Here is sample filter by user id

Updated to show how to filter by user id
If you are going to filter by user id, then it needs to be uc.userid and not us.userid - otherwise it makes the OUTER JOIN into an INNER JOIN. I updated the query to show user id filter example.
Here is a SQL Fiddle for the query with the userid filter:
http://sqlfiddle.com/#!18/a1b8d/12/0


text: Q: How to schedule reading messages from azure service bus queue at a specific time of the day I have a requirement where i want my listener to dequeue a message from the service bus queue at a specific time of the day. Right now i am using Spring boot's @JmsListener to read messages and currently it is reading message as soon as there is an entry in a queue.


text:
Q: Plot 3D boolean array in Mathematica I have been attempting several methods to plot a 3D diagram of n by n boolean array in Mathematica but none of them produced satisfactory result. I want the 3D plot to have a cube when M[i,j,k]=1 and when M[i,j,k]=0 just leaves as blank. Below is the best result I got.
L=10
M = RandomReal[{0, 1}, {L, L, L}];
For[k = 1, k <= L, k++,
  For[j = 1, j <= L, j++,
   For[i = 1, i <= L, i++,
    If[M[[i, j, k]] < 0.5,
     M[[i, j, k]] = 1,
     M[[i, j, k]] = 0
     ]]]];
Image3D[M, ImageSize -> 500, Boxed -> True]

The Image3D function gives a very fluffy and opaque look on the cubes which I couldn't change!!
Is there someway I can change the opacity and color of the Image3D function in this case? Or is there a better way to plot this matrix?
Thanks a lot for your time!!

A: This is an alternative to Image3D
 L=10;
 M=RandomInteger[{0,1},{L,L,L}];
 Graphics3D[
    First@Last@Reap[MapIndexed[ If[# == 1, Sow[Cuboid[#2]]] &, M, -1]]]

colorize using Sow[{ColorData["SouthwestColors"][RandomReal[{0, 1}]], Cuboid[#2]}]

the image3d version for comparison.

The cuboid version performs much better too. Image3D is so slow I don't even want to mess with it to see if there is a fix to the fuzziness.


text:
Q: Django urldecode in template file is there any way do the urldecode in Django template file?
Just opposite to urlencode or escape
I want to convert app%20llc to app llc

A: you have to write something like this instead of the previous answer otherwise you will get a maximum recursion depth
from urllib import unquote
from django.template.defaultfilters import register
from urllib.parse import unquote #python3

@register.filter
def unquote_new(value):
    return unquote(value)

{{ raw|unquote_new }}

A: You could create a simple custom filter around urllib.unquote
For instance:
from django.template.defaultfilters import stringfilter
from urllib import unquote

@stringfilter
def unquote_raw(value):
    return unquote(value)

and now you can have this in your django template file:
{{ raw|unquote_raw }}


text:
Q: SSIS Stuck on Created Execution Status Hi I just want to know what is the cause of this image.
Every time I execute the job in Ctrl M, it is running and the indicator beside it is of color yellow but when I tried to check it in Integration Services it is not running.
This is manually triggered and not schedule in Ctrl M because this is just on the test server.
Hope someone could help me figure this out.
Thanks


text:
Q: Unable to bind maven profile to spring boot profile I've seen all the questions and post regarding this issue so please don't mark this as duplicate or route me to those issues, I have tried implementing those solutions but nothing worked as of now.
I have profile specific application.properties files i.e application-prod.properties, application-dev.properties, application-int.properties etc
pom.xml
<profiles>
    <profile>
        <id>prod</id>
        <properties>
            <activeProfile>prod</activeProfile>
        </properties>
    </profile>
    <profile>
        <id>int</id>
        <properties>
            <activeProfile>int</activeProfile>
        </properties>
    </profile>
    <profile>
        <id>dev</id>
        <properties>
            <activeProfile>dev</activeProfile>
        </properties>
    </profile>
</profiles>

<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
    …
</build>
<plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <index>true</index>
                    <manifest>
                        <mainClass>com.demo.Application</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-help-plugin</artifactId>
        <executions>
            <execution>
                <id>show-profiles</id>
                <phase>compile</phase>
                <goals>
                    <goal>active-profiles</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

    </plugins>

application.properties
spring.profiles.active=@activeProfile@

I'm doing mvn clean install -Pprod and then running the application.
I'm sure the maven profile is executing during the build as I get this during the build
The following profiles are active:

 - prod (source: my-project-snapshot)

This is what I'm getting when running the application:
: The following profiles are active: @activeProfile@

Can anyone please help me here.
UPDATE
when I close my IDE(STS) and do the maven build, it is working. Any info regarding this info would be really appreciated.

A: Have you enabled resource filtering in your pom.xml? Since you are using spring-boot this can be easily enabled, in your pom.xml
<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
    …
</build>

UPDATE
I have put all your plugins in a sample project's pom.xml also matching your spring-boot version:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>in.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>11</java.version>
    </properties>

    <profiles>
        <profile>
            <id>prod</id>
            <properties>
                <activeProfile>prod</activeProfile>
            </properties>
        </profile>
        <profile>
            <id>dev</id>
            <properties>
                <activeProfile>dev</activeProfile>
            </properties>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-help-plugin</artifactId>
                <executions>
                    <execution>
                        <id>show-profiles</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>active-profiles</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <index>true</index>
                        <manifest>
                            <mainClass>com.example.demo.DemoApplication</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

When I run
mvn clean package spring-boot:run -Pdev -DskipTests

I see in the log files
com.example.demo.DemoApplication         : The following profiles are active: dev

And when I check the generated jar in target dir...target\demo-0.0.1-SNAPSHOT.jar\BOOT-INF\classes\ filtering has succeeded since in application.properties I get the line:
spring.profiles.active=dev

which in the source application.properties is
spring.profiles.active=@activeProfile@

So if you have a pom file similar to the above filtering should work.

A: Thanks a lot @pleft, I tried everything and because of that I realized this may not be a maven issue but an IDE issue. I'm using STS 3 and I found out that disabling "Refresh using native hooks" under Window > preferences > General > Workspace > Refresh using native hooks would solve the issue of STS IDE ignoring -P<profile> during maven build when STS is open.
There seems to be already a bug ticket for this.


text:
Q: trying to get the x and y from svg so i am trying to get the points from the code in the picture
i already made these teeth manually but it`s rly time consuming because i ll go to the roots after the crows :(
i already seen some posts but it doesn`t work with me
i hope u can find and correct the error in the code
The error and the picture
the code

var pt = svg.createSVGPoint(); // Created once for document

function alert_coords(evt) {
  pt.x = evt.clientX;
  pt.y = evt.clientY;

  var cursorpt = pt.matrixTransform(svg.getScreenCTM().inverse());
  console.log("(" + cursorpt.x + ", " + cursorpt.y + ")");
}
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
     "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="600.000000pt" height="300.000000pt" viewBox="0 0 3056.000000 1504.000000" preserveAspectRatio="xMidYMid meet" , onclick="alert_coords(evt)">

A: The variable svg does not seem to be defined anywhere. Hence pt is not defined.
I do not know whether this is the full problem, but start by inserting this before the pt=
var svg = document.querySelector('svg');

A: As Haworth said, you must declare svg, otherwise he doesn't know on whom to apply createSVGPoint so, add an id to your svg element id="SVG-ElementID" and get it with
const svg = document.getElementById("SVG-ElementID");

const svg = document.getElementById("SVG-ElementID");
const pt = svg.createSVGPoint(); // Created once for document

function alert_coords(evt) {
  pt.x = evt.clientX;
  pt.y = evt.clientY;

  var cursorpt = pt.matrixTransform(svg.getScreenCTM().inverse());
  console.log("(" + cursorpt.x + ", " + cursorpt.y + ")");
}
<svg id="SVG-ElementID" version="1.0" xmlns="http://www.w3.org/2000/svg" width="600.000000pt" height="300.000000pt" viewBox="0 0 3056.000000 1504.000000" preserveAspectRatio="xMidYMid meet" , onclick="alert_coords(evt)">


text:
Q: Uploading files to dropbox using python with the access tokens How can I upload files to Dropbox in python using access tokens?
I have tried with the following code for uploading the file
import requests
import json
print("uploading")
token ='#######'
para = {"path": "folder/file.txt", "mode": "add", "autorename": "true", "mute": "false", "strict_conflict": "false"}
headers = {'Authorization': 'Bearer ' + token}
files = {'data': ('metadata', json.dumps(para), 'application/json; charset=UTF-8'), 'file': open("file.txt", "rb")}
response = requests.post("https://content.dropboxapi.com/2/files/upload", headers=headers, files=files)

I got an error in response like this:
Error in call to API function "files/upload": Must provide HTTP header "Dropbox-API-Arg" or URL parameter "arg".
How can I modify the code for that?

A: Add the following header and read the docs to update your request with the necessary headers:
import json
headers["Dropbox-API-Arg"] = json.dumps({"path": "folder/file.txt", "mode": "add", "autorename": true, "mute": false, "strict_conflict": false})
headers["Content-Type"] = "application/octet-stream"


text:
Q: UIView frame slightly different when setting corner radius I am drawing a sequence of UIViews that touch each other's edges.
But when I set view.layer.cornerRadius they get slightly out of alignment creating artifacts. Is there some way around this?

Minimal working example (Swift Playround):
It seems to depend on the floating point coordinates.
I'd prefer if there was a version that didn't require me to round the coordinates to whole integers, though.
import UIKit
import PlaygroundSupport

class ViewController: UIViewController {

    override func viewDidLoad(){
        super.viewDidLoad()
        self.view.backgroundColor = .white

        let rect11 = UIView(frame: CGRect(x: 100, y: 100.15, width: 100, height: 100))
        let rect12 = UIView(frame: CGRect(x: 100, y: 200.15, width: 100, height: 100))

        let rect21 = UIView(frame: CGRect(x: 300, y: 100.15, width: 100, height: 100))
        let rect22 = UIView(frame: CGRect(x: 300, y: 200.15, width: 100, height: 100))

        rect21.layer.cornerRadius = 10
        rect22.layer.cornerRadius = 10

        rect11.backgroundColor = .black
        rect12.backgroundColor = .black
        rect21.backgroundColor = .black
        rect22.backgroundColor = .black

        self.view.addSubview(rect11)
        self.view.addSubview(rect12)
        self.view.addSubview(rect21)
        self.view.addSubview(rect22)
    }
}

let controller = ViewController()

PlaygroundPage.current.liveView = UINavigationController(rootViewController: controller)


text:
Q: Relation between momentum and number of collisions I was wondering there exists any mathematical relation between momentum of a photon (hence frequency) and the number of collisions it makes. Lets consider the case of the ionosphere where we have a large sample of free electron naturally existing. Let waves of 2 different frequencies be incident on the ionosphere.
Is it correct to say that photons of higher frequency wave (lower wavelength) makes more collisions in the ionosphere than the lower frequency counterpart since the former possess higher momentum (using $p=h/ \lambda$ )than the latter. It is assumed that both the frequencies traverse through the same path of the ionosphere so that it encounters the same density of electrons.


text:
Q: Python2.7: No module named zlib I'm trying to use matplotlib in Python 2.7, but am encountering the following error
    >>> import matplotlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 156, in <module>
  File "/usr/lib/pymodules/python2.7/matplotlib/cbook.py", line 15, in <module>
  File "/usr/local/lib/python2.7/gzip.py", line 9, in <module>
    import zlib
ImportError: No module named zlib

I installed python with sudo apt-get install python2.7, and other required packages similarly. I installed zlib from source, with no issues.


text:
Q: Заполнение массива путем ввода через Prompt Как правильно при заполнении массива через prompt, если пользователь не ввел значение, выводить prompt до тех пор, пока пользователь не введет какое-то значение?
function addName() {
    var arrContainer = document.getElementById('array');

    var arr = []; // создаем массив
    for(var i=0; i < 5; i++) {

        arr[i] = prompt('Введите любое имя', +i); // Заполняем массив
        if(arr[i] === null) { // если  нажимаем "Отмена"
            alert('Отмена');
            return;
        }

        if(arr[i] === '') { // если  имя не введено
            alert('Вы не указали имя');
            arr[i] = prompt('Введите любое имя');
        }
    }

    arrContainer.innerHTML = '';
    arrContainer.innerHTML = arr;

    console.log(arr); // Выводим массив целиком
}

A: Надо бы ещё считать неудачные попытки, чтобы не замучить алёртами бедного юзера, который передумал вводить имена.

function addName() {
  var arrContainer = document.getElementById('array')
    ,n     = 5  // число элементов массива
    ,max   = 3  // макс. число перезапросов
    ,att        // счётчик попыток
    ,i          // индекс элемента массива
    ,greet = '' // сообщение при запросе
    ,arr   = [] // создаем массив
  ;
  for(i=0; i<n; i++) {
    for( att=0; att<max;) {
      greet = 'Введите любое имя №'+(i+1);
      if(att++ > 0) greet += ' (попытка '+att+' из '+max+')';
      arr[i] = prompt( greet); // Заполняем массив
      if (null !== arr[i]  &&  arr[i].length) break;
      if(att === max) {
        alert("Ой, всё");
        return false;
      }
    }
  }

  arrContainer.innerHTML = JSON.stringify(arr);
  return arr;
}

addName();

A: Не притендую на красивый код, вот решение в лоб:
function addName() {
    var arrContainer = document.getElementById('array');
    var arr = []; // создаем массив
    for(var i=0; i < 5; i++) {
        while(
          typeof (arr[i] = prompt('Введите любое имя №'+i)) != 'string' || arr[i].length == 0
        );
    }
    arrContainer.innerHTML = arr;
    console.log(arr); // Выводим массив целиком
}

Демо:
http://codepen.io/anon/pen/WxdvOy
Кто разгадает фокус с typeof? :)


text:
Q: Find a root of trigonmetric funtion Let $\ell \in [0, 1).$  Assume that $g(s)=\sin(s+x(s))-\ell \sin(x(s))=0$ and $\cos(x(0)) \neq 0.$
Is it true that if $s=0$, then  $x(0)=\pi$?( Im interested in answers in $[0, \pi]$).
Attempt: $g'(s)=\cos(s+x(s))(1+x'(s))-\ell\cos(x(s))x'(s)=0$. Since $s=0$, $\cos(x(0))(1+x'(0))-\ell\cos(x(0))x'(0)=0$. Then, $x'(0)(-\ell +1)+1=0$. Then$ x'(0)=\frac{-1}{1-\ell}.$
By Taylor expansion, $x(s) \approx \pi- \frac{1}{\ell -1}s$, where $\ell=\ell(s).$

A:
Let $\ell \in [0, 1).$  Assume that $g(s)=\sin(s+x(s))-\ell \sin(x(s))=0$ and $\cos(x(0)) \neq 0.$

Is it true that if $s=0$, then  $x(0)=0\text{ or } \pi$?

If $s=0$ then $g(0)=\sin(x(0))-\ell\sin(x(0))=(1-\ell)\sin(x(0))=0$
and we know that $1-\ell \neq0$ so it must be that $\sin(x(0))=0$ so $x(0)=n\pi$ where $n\in\mathbb{Z}$.


text:
Q: How to get _id from listView (database) [android] I have a problem with receiving _ID value when an item is clicked on listView.
I have this code:
List<SavedSearch> values =  mydb.getAllSavedSearches();

      ArrayAdapter<SavedSearch> adapter = new ArrayAdapter<SavedSearch>(this,
                android.R.layout.simple_list_item_1, values);
      //adding it to the list view.
      obj = (ListView)findViewById(R.id.listView1);
      obj.setAdapter(adapter);

      obj.setOnItemClickListener(new OnItemClickListener(){

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

And my problem is that i want in onItemClick to somehow get the _ID value from database of clicked item in listView. int position and long id both are returning just position on the list.
Thanks for help, and I can say that any of previous topics helped me.

A: If you're using a database I would suggest you do not use an ArrayAdapter and instead use a CursorAdapter. Then simply call the method getItemId() from your CursorAdapter to retrieve the id of an item at a given position. So, do this:
CursorAdapter adapter = new CursorAdapter(Context yourAppContext, Cursor yourDBCursor, false);
obj = (ListView)findViewById(R.id.listView1);
obj.setAdapter(adapter);
obj.setOnItemClickListener(new OnItemClickListener(){

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

    adapter.getItemId(position); // This is the _ID value
}

A: This is just the suggestion. I am not sure this will solve the issue.
Method 1:
Whenever you load the listView just set the id for the row and you can get the id from onItemClikListener method
Method 2:
Add an texView (set visibility gone) and set text as your id and get id using getText() method
Note
Don't use position this is always changing when the listview is reCycling.


text:
Q: move_uploaded_file returns error code 0 but file not uploaded in my directory? I'm working on a project using codeigniter 3.0.6 and I need to upload image in some modules. the problem is that move_uploaded_file returns error code 0 but the file is nowhere to be found. I'm currently running this code on my localhost. if only it returns an error code then I can do something.. can anyone help me with this?
I've read Move_uploaded_file() function is not working too and my code below is based on one of the supposedly "working example" answer.. but still not working (error code 0 but file not found in directory). the mkdir($uploaddir, 0777, true); part doesn't seem to help.
this is my view file (display.php) :

        <meta charset="utf-8">

        <form enctype="multipart/form-data" action="submit" method="POST">
            <input type="hidden" name="MAX_FILE_SIZE" value="51200000" />
            Send this file: <input name="userfile" type="file" />
            <input type="submit" value="Send File" />
        </form>

and this is my controller file (test.php) :
function display()
{
    $this->load->view('display');
}

function submit() {
    $uploaddir = '/assets/img/guide/';
    $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

    if (!file_exists($uploaddir)) {
        mkdir($uploaddir, 0777, true);
    }

    echo "
";
    if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
        echo "File is valid, and was successfully uploaded.\n";
    } else {
        echo "Upload failed";
    }
    echo "
";

    echo '
';
    echo 'Error code:';
    print_r($_FILES['userfile']['error']);
    print "
";

    echo '
';
    echo 'Here is some more debugging info:';
    print_r($_FILES);
    print "
";

    echo $this->load->view('display', $this->data);
}

and this is the result after I submit the form:

File is valid, and was successfully uploaded.
Error code:0
Here is some more debugging info:Array (
      [userfile] => Array
          (
              [name] => Hydrangeas.jpg
              [type] => image/jpeg
              [tmp_name] => C:\xampp\tmp\php46FD.tmp
              [error] => 0
              [size] => 595284
          )
)

A: it turns out the files WERE uploaded but instead of going to my project's base folder (D:/myproject/dev/), the files were uploaded to the harddrive folder (D:/) so i guess the mistery's solved. I just need to figure out how to direct the target folder for upload.. maybe I'll put it in another question post.
thank you all


text:
Q: Why I can not place my figure where I want? I have some text and after that I want to insert a figure. The text almost finishes on the second page, so I want to place the figure on the top of the third page (right after the text), but I cant. I've read the placement commands frome here: http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions and I tried all the different options (i.e. \begin{figure}[t!], \begin{figure}[t], \begin{figure}[b], \begin{figure}[h], ...) but the figure stays on the same place in the middle of the third page. I want it to go at the top. What I am missing?
Here is the code:
    \documentclass[11pt]{article}

\usepackage{amssymb,amsmath}
\usepackage{pgf}
\usepackage{tikz}
\usepackage{amsthm}
\usepackage{graphicx}
\graphicspath{ {img/} }
\usepackage{fullpage}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\newtheorem{thm}{Theorem}
\newtheorem{thm1}{Theorem}
\theoremstyle{definition}
\usepackage{float}
\newtheorem{defn}{Definition}[section]
\floatname{algorithm}{Algorithm}
\newcommand{\euler}{e}
\newenvironment{claim}[1]{\par\noindent\underline{Claim:}\space#1}{}
\newenvironment{claimproof}[1]{\par\noindent\underline{Proof:}\space#1}{\hfill $\blacksquare$}

\begin{document}

\title{some titlw}
\author{me}
\date{\today}
\maketitle
\section{Some section}
sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
\\

sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx

asdszdszd
\begin{figure}[t]
\includegraphics[width=0.25\textwidth]{graphic1}
\end{figure}
asasdasdadsads
\end{document}

A: As it stands, your document does not contain enough text for LaTeX to put the figure at the top of a page. On the first page, floats at the top are banned. There is no second page (of text). So, having the figure left at the end of the document, LaTeX does whatever it must to place it: it puts it on a page of floats and, by default, that means the floats are vertically centred on the page.
If you have more text after the figure, this won't happen:
\documentclass[11pt]{article}
\usepackage{kantlipsum}% for the demo
\usepackage{amssymb,mathtools}% fixes/enhancements for amsmath (loads amsmath)
\usepackage[demo]{graphicx}
\usepackage{tikz}
\usepackage{amsthm}
\usepackage{fullpage}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\newtheorem{thm}{Theorem}
\newtheorem{thm1}{Theorem}
\theoremstyle{definition}
\usepackage{float}
\newtheorem{defn}{Definition}[section]
\floatname{algorithm}{Algorithm}
\newcommand{\euler}{e}
\newenvironment{claim}[1]{\par\noindent\underline{Claim:}\space#1}{}
\newenvironment{claimproof}[1]{\par\noindent\underline{Proof:}\space#1}{\hfill $\blacksquare$}

\begin{document}

  \title{some titlw}
  \author{me}
  \date{\today}
  \maketitle
  \section{Some section}
  sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
  sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
  sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
  sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
  \\

  sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
  sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
  sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
  sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx

  asdszdszd
  \begin{figure}[t]
    \includegraphics[width=0.25\textwidth]{graphic1}
  \end{figure}
  asasdasdadsads

  \kant[1-2]
\end{document}

If you want the figure to be centred, add \centering at the start of the figure environment`.

If that's the end of your document, you can add \newpage\vfill\mbox{ } at the end to force a new, otherwise empty page for the figure to float to the top of.

A: \usepackage{float}

\begin{figure}[H]

This will force LaTex to put your figure where you want it to be.


text:
Q: During the "Dark Ages" of the Universe's evolution, how lumpy (anisotropic) and dynamic was the mass distribution? In the dark ages between recombination (~0.4 Myr post-BB) and reionization (~300 Myr post-BB) of atoms, there was not any condensed-phase matter (except maybe some form of dark matter), nor radiation exchange other than Lyman-alpha. The only light was a warm cosmic background, and virtually all ordinary matter was in the form of neutral atoms of primordial elemental distribution (H, He, and traces of Li, B, C, N). Collapse of gas to form stars on any useful timescale was inhibited by the gas's transparency (in the sense of emission, not absorption of photons). Transparency prevented heat loss by radiation, which prevented the compression of the gas under gravity.
A dark, eventless place with few landmarks.
Eventually, somewhere around 100-500 Myr, the expansion of the Universe as a whole cooled it down to where H2 molecules could form, allowing better radiation away of heat when collapsing a parcel of gas. A certain amount of lumpiness is needed however and this structure, perhaps on several scales, along with proper motion, would determine several things: collisions between parcels, scale & timescale of individual star formation, and the amount of chain reaction in star formation (supernovae -> triggering more star formation -> more supernovae).
My intuition is that with 100's of M's of years to even out and settle down, it would be surpassingly smooth and quiescent.

A: I've located a paper that goes into great (excruciating?) detail on the 21cm power spectrum (of baryons) in the dark ages. I won't pretend to have the expertise to understand the whole thing, but I'll try to bring out a couple of relevant points here. Note that this is all theoretical work in the framework of the standard cosmological model since actual observations of the 21cm power spectrum are apparently fiendishly difficult, most likely involving a radio observatory on the Moon.
Fig. 11 of that paper shows the linear (solid) and approximate higher order correction (dashed) 21-cm (baryon) power spectrum at z=30 (~100 Myr) and z=50 (50 Myr):

There is actually more power on smaller scales ($l$ goes to $>10^6$ here!).
They note that the perturbations in the baryon distribution are less than the perturbations in the dark matter distribution because the baryons feel pressure. I think this is more or less what you're alluding to when you talk about 'evening out and settling down'. I think the point you may be missing, though, is that the baryons are also trying to settle into the potential wells of the dark matter distribution, which is not smooth since the dark matter feels no pressure and so can begin collapse as soon as the horizon is big enough.
These slides may also be of interest, and if you want to get your hands dirty there's this source code.

A: You conclude:

"My intuition is that with 100's of M's of years to even out and settle down, it would be surpassingly smooth and quiescent."

According to the history of the universe here , the dark ages happen after the decoupling of photons and the Cosmic Microwave Background radiation

which happened around 380.000 years after the Big Bang. CMB is very uniform and fits a black body spectrum with great accuracy, and this uniformity could not be explained using thermodynamic arguments, since large parts of the universe were in a different light cone by that time.
The hypothesis of inflation was put forward to explain the uniformity by quantum mechanical arguments where a scalar particle called inflaton homogenized the energies in the very early universe. The CMB though has non uniformities

9 year WMAP image.The radiation is isotropic to roughly one part in 100,000.The detailed, all-sky picture of the infant universe created from nine years of WMAP data. The image reveals 13.77 billion year old temperature fluctuations (shown as color differences) that correspond to the seeds that grew to become the galaxies. The signal from our galaxy was subtracted using the multi-frequency data. This image shows a temperature range of ± 200 microKelvin.

It is this promordial anisotropy that explains in the Big Bang model the lumpiness of the observable universe:

The Universe that we see today is very lumpy. There are planets, stars, galaxies, and clusters of galaxies. Yet when we look at the afterglow from the Big Bang, we see an incredibly smooth glow across the sky. So how did the matter in the Universe get to be so lumpy after starting out so smooth?
Astronomers generally agree that gravity shaped the evolution of the lumps we see in the Universe today. The force of gravity between different chunks of matter caused the chunks to pull together into one body, and then that body pulled in more material, similar to a snowball rolling downhill, picking up more snow as it goes.
But each snowball must have a beginning – a small "seed" around which the other material will gather. Observations of the cosmic microwave background (CMB) – which is as close as we can get to seeing the Universe near its beginning – show that it has a temperature that is very close to uniform. The temperature of the CMB is a tracer of where matter was in the very early Universe. If the temperature was completely uniform, there would be no seeds for gravitational collapse – no way to form the lumps we see today.

By the time of the dark ages the kernels for the lumpiness were there since the inflation period before 10^-32seconds.


text:
Q: Spring REST - Can a RestTemplate consume multipart/mixed? I want to write a REST service which does responed with a zipFile and some json data, everything in one multipart/mixed request.
The server part works fine and i am testing it with the REST Client from firefox. My Server sends a multipart like this
--k-dXaXvCFusLVXUsg-ryiHMmkdttadgcBqi4XH

Content-Disposition: form-data; name="form"
Content-type: application/json

{"projectName":"test","signal":"true"}

--k-dXaXvCFusLVXUsg-ryiHMmkdttadgcBqi4XH
Content-Disposition: form-data; name="file2"; filename="file2.txt"
Content-type: application/octet-stream
Content-Length: 10

hallo=Welt

I know that RestTemplate can send multiparts with the help of a MultiValueMap out of the box.
Now I tried to consume multipart/mixed responses and return a MultiValueMap
@Component
public class RestCommand
extends AbstractLoginRestCommand<Form, MultiValueMap<String, Object>>
{
    @Override
    protected MultiValueMap<String, Object> executeInternal ( Form form )
    {
        RestTemplate restTemplate = getRestTemplate();
        MyMultiValueMap map = restTemplate.postForObject(getUrl(), form, MyMultiValueMap.class);
        return new LinkedMultiValueMap<String, Object>(map);
    }
}

class MyMultiValueMap extends LinkedMultiValueMap<String, Object>
{}

MyMultiValueMap exist to prevent type erasure (generics).
This gives

org.springframework.web.client.RestClientException: Could not extract
  response: no suitable HttpMessageConverter found for response type
  [class org.jlot.client.remote.MyMultiValueMap] and content type
  [multipart/form-data;boundary=Rjh-fkdsI9OIyPpYwdFY7lsUIewhRSX8kE19I;charset=UTF-8]
    at
  org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:107)
    at
  org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:492)

Javadoc of FormHttpMessageConverter says it can write but not read multipart/form-data.
Why is it like this?
Is there a way to read multipart/form-data with RestTemplate out-of-the-box or do I need to write a HttpMessageConverter?

A: I had the same issue and I think I achieved what you wanted.
You just have to override the canRead method of the form converter. With your example something like below should work.
FormHttpMessageConverter formConverter = new FormHttpMessageConverter() {
    @Override
    public boolean canRead(Class<?> clazz, MediaType mediaType) {
        if (clazz == MyMultiValueMap.class) {
            return true;
        }
        return super.canRead(clazz, mediaType);
    }
};

And add this converter to your rest template.

A: I use this solution at the moment:
@ResponseBody
@PostMapping(value = JlotApiUrls.PUSH, produces = "application/json")
public List<PushResultDTO> push (
        @PathVariable String projectName,
        @PathVariable String versionName,
        @RequestPart("file") MultipartFile multipartFile,
        @RequestPart("data") @Valid PushForm pushForm
   ) throws IOException, BindException
{
 ...
}

https://github.com/kicktipp/jlot/blob/master/jlot-web/src/main/java/org/jlot/web/api/controller/PushController.java


text:
Q: How to add additional value to an array? I am currently creating a program where the user can use a printer as long as that particular user has enough funds.
The current issue I am having is that if the user chooses to have colour printing instead of black and white then the price for each piece of paper goes up.
How do I add value to an already existing array?
Here is my code...
printers[0] = new Printer("printer1", 0.10M);
            printers[1] = new Printer("printer2", 0.08M);
            printers[2] = new Printer("printer3", 0.05M);
            printers[3] = new Printer("printer4", 0.15);
            printers[4] = new Printer("printer5", 0.09M);

            foreach (Printer r in mPrinters)
            {
                if (printer != null)
                    printerCombo.Items.Add(r.getName());
            }

A: Technically, you can Resize the array:
 Array.Resize(ref printers, printers.Length + 1);

 printers[printers.Length - 1] = new Printer("printer6", 0.25M);

However, a much better approach is to change the collection type: array into List<T>:
 List<Printer> printers = new List<Printer>() {
   new Printer("printer1", 0.10M),
   new Printer("printer2", 0.08M),
   new Printer("printer3", 0.05M),
   new Printer("printer4", 0.15),
   new Printer("printer5", 0.09M), };

 ...

 printers.Add(new Printer("printer6", 0.25M));

A: Arrays have fixed size - after you created array with size 10 you can't add  one more element (to make size 11).
Use List<Printer>:
List<Printer> printers = new List<Printer>();
printers.Add(new Printer("printer2", 0.08M));
//add all items

Also you can access elements by index:
var element = printers[0];

Using List you can change its size, add and remove elements.

A: Arrays are fixed length.  You need to copy the values into a new array or use an List, List<>, or ArraryList.


text:
Q: Even Power Series properties Let $$\sum_{k=0}^{\infty}h_kx^k$$ be a series with convergence radius $R>0$ and sum function $s:(-R,R)\rightarrow \mathbb{R}$.

*

*Show that if $h_{2k+1}=0$ for alle $k\geq 0$ then $s$ is even and that
$$\sum_{k=0}^{\infty}h_k(1-(-1)^k)x^k$$ has a sum $s(x)-s(-x)$.

Use the uniqueness of a power series to conclude that if $s$ is even, then $h_{2k+1}=0$ for all $n\geq0$.

I know that a function is even if $g(x)=g(-x)$. Furthermore, I knwo that for 2 $\sum_{n=0}^{\infty}a_nx^n,\sum_{n=0}^{\infty}b_nx^n$ that both have convergence radius (atleast) $r>0$ and that $$\sum_{n=0}^{\infty}a_nx^n=\sum_{n=0}^{\infty}b_nx^n$$
holds for all $x\in (-r,r)$ then $a_n=b_n$ for all $n\in \mathbb{N_0}$.
Even though I understand these results I am struggeling solving this problem as it seems vague; i.e not specific.

A: Assume that $H:(-R,R)\to\mathbb{R}$ is even: for all $x\in(-R,R)$, $H(-x)=H(x)$ \emph{i.e.}
\begin{align*}
H(-x)&=\sum_{n=0}^{+\infty}h_n(-x)^n=\sum_{k=0}^{+\infty}h_{2k}(-x)^{2k}+\sum_{k=0}^{+\infty}h_{2k+1}(-x)^{2k+1}=\sum_{k=0}^{+\infty}h_{2k}x^{2k}-\sum_{k=0}^{+\infty}h_{2k+1}x^{2k+1},\\
H(x)&=\sum_{n=0}^{+\infty}h_nx^n=\sum_{k=0}^{+\infty}h_{2k}x^{2k}+\sum_{k=0}^{+\infty}h_{2k+1}x^{2k+1}.
\end{align*}
This yields after subtracting the second line from the first one:
\begin{align*}
0&=H(-x)-H(x)=-\sum_{k=0}^{+\infty}h_{2k+1}x^{2k+1}-\sum_{k=0}^{+\infty}h_{2k+1}x^{2k+1}=-2\sum_{k=0}^{+\infty}h_{2k+1}x^{2k+1}.
\end{align*}
The sum $\widetilde{H}$ of the series $\sum h_{2k+1}x^{2k+1}$ is thus identically zero over $(-R,R)$. As
\begin{align*}
h_{2k+1}&=\frac{1}{(2k+1)!}\widetilde{H}^{(2k+1)}(0)
\end{align*}
and $\widetilde{H}\equiv0$, we deduce that $h_{2k+1}=0$ for all $k\in\mathbb{N}$.
Assume conversely that $h_{2k+1}=0$ for all $k\in\mathbb{N}$. Then for all $x\in(-R,R)$,
\begin{align*}
H(x)&=\sum_{n=0}^{+\infty}h_nx^n=\sum_{k=0}^{+\infty}h_{2k}x^{2k}+\sum_{k=0}^{+\infty}\underbrace{h_{2k+1}}_{=0}x^{2k+1}=\sum_{k=0}^{+\infty}h_{2k}x^{2k},\\
H(-x)&=\sum_{n=0}^{+\infty}h_n(-x)^n=\sum_{k=0}^{+\infty}h_{2k}(-x)^{2k}+\sum_{k=0}^{+\infty}\underbrace{h_{2k+1}}_{=0}(-x)^{2k+1}=\sum_{k=0}^{+\infty}h_{2k}(-x)^{2k}=\sum_{k=0}^{+\infty}h_{2k}x^{2k}
\end{align*}
i.e. $H(-x)=H(x)$ and $H$ is even.


text:
Q: Why my command is not working with nohup and SSH? I'm restarting the server from my local mashine using the following command:
ssh -l root -p 22 $SERVER_HOST "cd $SERVER_DIR && nohup bin/restart &"

And it's not working, and prints nothing so I don't know what's the problem. But if I remove nohup and & - it's working. Why, and how to make it work (and continue in background after terminating ssh)?
Version without nohup works, but blocks the shell (it also prints output from the bin/restart script unlike the version with nohup). But I can't use it as I need the server to continue to work in background.
ssh -l root -p $SERVER_PORT $SERVER_HOST "cd $SERVER_DIR && bin/restart"

If that matter, the content of the bin/restart script (restarting Ruby on Rails app)
. /root/.asdf/asdf.sh
killall -r ruby
RAILS_ENV=production bundle exec rails server

A: What worked for me is:
ssh -tt -l root -p 22 $SERVER_HOST 'cd $SERVER_DIR && nohup bin/restart & sleep 1'

Tested with OpenSSH 7.2p2 (client & server), bash 4.3, Linux 4.15.
-tt forces ssh to allocate a terminal, which is apparently important for nohup to work.
sleep 1 is not special, you just need something that will force the shell to context-switch, it could also be /bin/true, but that isn't as sure-fire.


text:
Q: Missing symbol in linux shell script     #!/bin/bash
    FILE=$/var/tmp/filename

    if [ -f $FILE ];
    then
       echo "File $FILE exists"
    else
       echo "File $FILE does not exists"
    fi

What am i missing here? am getting the following error on running the above script
./installog.sh: 7: [: missing ]

A: I'm not seeing a problem with this file, you are probably running something wider in context.
One thing does seem strange:
FILE=$/var/tmp/filename
Why the $ sign? Doesn't seem like a proper path. Remove it?

A: This error message in bash means that you have an open square bracket without a closing one. At least in the script you posted here, this is obviously not the case.
Run the script again with trace switched on (set -x inside your script, or invoking it via bash -x ...) and post the output.


text: Q: How to change the ObjectContext class name of edmx The modes and classes are generated by Entity Framework 5 when I updated the mode from exist database . But I want to correct the name of the ObjectContext class. I know we can use the refactor tools of visual studio 2010, But I am not sure all the code files can be updated in this way. please help me .thanks.


text:
Q: How to block scroll event passing through to iframe until iframe is active? I have a long scrolling page. On this scrolling page is an iframe that has a media app that has media that zooms in and out when it receives a scroll event.
If a user is using the mousewheel to scroll the pareent page, eventually they will hit the iframe, at which case the page will stop scrolling and the iframe will zoom into the media app very far.
If I disable mouse events for the iframe, then the user can never zoom in or click around the media app.
Is there a way to prevent default scroll action on iframe and have it only occur when the iframe is active?

A: You can use the following steps:

*

*Wrap your iframe inside div element. You can't use onclick method of iframe.

*Change pointer-events property of iframe element when events (click, mouselive) are fired on parent div element.

Here is the JQuery example:
    $('#iframeContainer').on('click', function(event) {
        $('#iframe').css('pointer-events', 'auto');
    });

    $('#iframeContainer').mouseleave(function(event) {
        $('#iframe').css('pointer-events', 'none');
    });

A: Without testing I see two ways to solve this
1) Give the iframe the css value pointer-events: none; and set the value back to auto when its active
iframe {
    pointer-events: none;
}
iframe:active {
    pointer-events: auto;
}

2) Remove the eventlistener of the iframe via JavaScript and bind them again as soon the iframe is active.


text:
Q: Electron save as giving long server URL as title Electron save as dialog is giving me a long URL as title.
mainWindow.webContents.session.on('will-download', function (event, item, webContents) {
    item.on('updated', () => {});
    item.on('done', (e, state) => {});
});

I seen this: How can I display a Save As dialog in an Electron App?.
But it's giving me "item object destroyed".
If it's a post call how to pass data to the request.

A: Something like this will solve your problem.
dialog.showSaveDialog({"title":"RssReader.pdf"},function(filename){
                    console.log(filename);
                    webview.printToPDF({},function(error,data){
                        if(error) alert(error);
                        else{
                            fs.writeFile(filename, data,function(error){
                                if (error) alert(error);
                                else
                                    alert('PDF saved successfully')
                            });
                        }
                    });
                })


text:
Q: how to refresh listbox content onclick or blur event I Need to ask you how I Refresh the listbox content on listboxfocus event OR Onblur event.
I need if user click on listbox, the content of listbox get refreshed without page refreshed.
Is There is any javascript or jquery which do this.
<select>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>

A: Not sure what do you mean by refresh, you can attach these events on element and do whatever you want.
better provide id to your dropdown
<select id="ride">
  <option value="volvo">Volvo</option>
  <option value="audi">Audi</option>
</select>

$("#ride").on("click blur", function () {
 $("#ride").html('');
 $("#ride").append('<option value="audi">Audi</option>');
});


text:
Q: How do I record SQL transactions with SQL Server Express With a test migration from 2000 to 2008R2 Express, one function from the client application fails silently. I'd like to find out what SQL is running and why it fails.
I think I would have attacked this with the profiler in 2000 (not sure)? However this tool is absent from the Express Edition.
Is it possible to do what I want without any tool, eg just with T-SQL, and how would I go about it?

A: You'll need a profiler of some variety if the call is wrapped up.
One of:

*

*Download a trial version, install client tools only

*3rd party http://sites.google.com/site/sqlprofiler/

A: I believe that in SQL Server Express, just because you don't have the SQL Server Profiler application you are still able to use the Trace objects.
Please reference this to show an explanation of all the stored procs and functions that you can and need to use: http://msdn.microsoft.com/en-us/library/ms191006.aspx


text:
Q: Content-Security-Policy: allow custom URI I'm currently trying to implement CSP for our web application. There's also a mobile application that uses various web endpoints. The mobile application loads custom resources that look like this:
ma-file:///var/mobile/Containers/Data/Application/{GUID}

I've set the 'default-src' directive and want to override it with 'img-src' so that allows all images, including those custom ones. This is my 'img-src' directive
img-src * data: blob: filesystem:;

According to this reference it should cover all cases, but I still get a policy violation for the specified custom URI. The CSP report states
"violated-directive":"img-src * data: blob: filesystem:"

Please advise how I can allow these images.

A: You can add "ma-file:" to your source list for img-src. This works in Chrome, where it seems like you can specify any custom scheme. I don't know if it works in other browsers.