问:
Envify CLI not removing process.env.NODE_ENV
I am trying to reduce the size of my React bundle.js.

I am attempting to use Envify with Browserify to replace process.env.NODE_ENV with the string "production", in order to use uglifyjs and remove all the extra development code.

Here is my command: browserify -t [envify --NODE_ENV production] assets/js/app.js -o assets/js/bundle.js

So my bundle.js is successfully created, but it still has some of the instances of process.env.NODE_ENV.

All the instances that are in my "app.js" or my other components are correctly replaced with "production".

...But in all of my required modules from the node_modules folder (like react etc), the instances are not replaced.

Any help greatly appreciated! THX!

******************* Edit **********************

JMM's solution successfully answered the original question, but I still had an issue because I am using React-Router (I think).

I created a simple example that shows the situation.

Here is my app.js file:

```<code>var React = require('react');
var ReactDOM = require('react-dom');
var Router = require('react-router').Router;
var Route = require('react-router').Route;

var Example = React.createClass({
    render: function(){
        console.log(process.env.NODE_ENV);
        if (process.env.NODE_ENV === "development") {
          console.log('Development Version');
        } else {
            console.log('Production Version');
        }
        return <span>Hello World!</span>;
    }
});

var AppRoutes = ( <Route name="/" path="/" component={Example} /> );

ReactDOM.render(
    (<Router>
        {AppRoutes}
    </Router>),
    document.getElementById('ExampleApp')
    );
</code>```

If I run NODE_ENV=production browserify -t envify assets/js/app.js -o assets/js/bundle.js, I still have some instances of process.env.NODE_ENV in the bundle.js.

I found a work-around by simply creating the bundle.js with: browserify assets/js/app.js -o assets/js/bundle.js, and then running envify on the bundle with: NODE_ENV=production envify assets/js/bundle.js > assets/js/bundle2.js

This solves my problem, but I am still unsure why react-router doesn't allow browserify and envify to work together.

I hope this helps others with a similar problem!!

答:
Unfortunately JMM's answer doesn't work, because setting process.env.NODE_ENV has no effect in Browserify. The resulting bundle still has process.env.NODE_ENV references in it and hence

Browserify will not require() the React production version modules,

the minifier will not be able to remove dead code, and

the application will still be running in debug mode.

This is unfortunately not the only place where this approach is offered as the correct answer :-(

The correct approach can be found in e.g.

https://github.com/hughsk/envify/issues/15#issuecomment-62229101

https://reactjs.org/docs/optimizing-performance.html#browserify

You need to switch the envify transform to be a global one, e.g.

```<code># note the "-g" instead of the usual "-t"
$ browserify ... -g [ envify --NODE_ENV production ] ....
</code>```

or in gulpfile.js

```<code>browserify(...)
    ...
    .transform('envify', {
        global:   true, // also apply to node_modules
        NODE_ENV: debug ? 'development' : 'production',
    })
    ...
    .bundle()
    ...
    .pipe(gulpif(!debug, babelMinify())) // my example uses gulp-babel-minify
    ...
</code>```

Body:
I am trying to reduce the size of my React bundle.js.

I am attempting to use Envify with Browserify to replace process.env.NODE_ENV with the string "production", in order to use uglifyjs and remove all the extra development code.

Here is my command: browserify -t [envify --NODE_ENV production] assets/js/app.js -o assets/js/bundle.js

So my bundle.js is successfully created, but it still has some of the instances of process.env.NODE_ENV.

All the instances that are in my "app.js" or my other components are correctly replaced with "production".

...But in all of my required modules from the node_modules folder (like react etc), the instances are not replaced.

Any help greatly appreciated! THX!

******************* Edit **********************

JMM's solution successfully answered the original question, but I still had an issue because I am using React-Router (I think).

I created a simple example that shows the situation.

Here is my app.js file:

var React = require('react');
var ReactDOM = require('react-dom');
var Router = require('react-router').Router;
var Route = require('react-router').Route;

var Example = React.createClass({
    render: function(){
        console.log(process.env.NODE_ENV);
        if (process.env.NODE_ENV === "development") {
          console.log('Development Version');
        } else {
            console.log('Production Version');
        }
        return Hello World!;
    }
});

var AppRoutes = ( <Route name="/" path="/" component={Example} /> );

ReactDOM.render(
    (<Router>
        {AppRoutes}
    </Router>),
    document.getElementById('ExampleApp')
    );

If I run NODE_ENV=production browserify -t envify assets/js/app.js -o assets/js/bundle.js, I still have some instances of process.env.NODE_ENV in the bundle.js.

I found a work-around by simply creating the bundle.js with: browserify assets/js/app.js -o assets/js/bundle.js, and then running envify on the bundle with: NODE_ENV=production envify assets/js/bundle.js > assets/js/bundle2.js

This solves my problem, but I am still unsure why react-router doesn't allow browserify and envify to work together.

I hope this helps others with a similar problem!!

Body:
Unfortunately JMM's answer doesn't work, because setting process.env.NODE_ENV has no effect in Browserify. The resulting bundle still has process.env.NODE_ENV references in it and hence

Browserify will not require() the React production version modules,

the minifier will not be able to remove dead code, and

the application will still be running in debug mode.

This is unfortunately not the only place where this approach is offered as the correct answer :-(

The correct approach can be found in e.g.

https://github.com/hughsk/envify/issues/15#issuecomment-62229101

https://reactjs.org/docs/optimizing-performance.html#browserify

You need to switch the envify transform to be a global one, e.g.

# note the "-g" instead of the usual "-t"
$ browserify ... -g [ envify --NODE_ENV production ] ....

or in gulpfile.js

browserify(...)
    ...
    .transform('envify', {
        global:   true, // also apply to node_modules
        NODE_ENV: debug ? 'development' : 'production',
    })
    ...
    .bundle()
    ...
    .pipe(gulpif(!debug, babelMinify())) // my example uses gulp-babel-minify
    ...


来源: stackexchange

问:
Set CSS Class in HTML.TextBoxFor in VB
I've seen the other posts referencing C# syntax do do this, but I can't find how to do it using VB.NET.  I swear I'm daft.  I keep trying different variations that I think would work but I'm missing it.

C# Syntax is:

```<code>Html.TextBox("title", Model.Title, new { @class = "txt" })
</code>```

How do I do that in VB?

Thanks!

答:
Try:</p>

```<code>New With {.class = "txt" }
</code>```

ContentLicense: CC BY-SA 2.5

Title: Set CSS Class in HTML.TextBoxFor in VB

Body:
I've seen the other posts referencing C# syntax do do this, but I can't find how to do it using VB.NET.  I swear I'm daft.  I keep trying different variations that I think would work but I'm missing it.

C# Syntax is:

Html.TextBox("title", Model.Title, new { @class = "txt" })

How do I do that in VB?

Thanks!

Body:
Try:

New With {.class = "txt" }


问:
Java http request GET causes timeout exception while it works fine in the browser
I have been playing with Http in Java and I faced a strange problem. Below is a piece code which executes GET method:

```<code>OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(100, TimeUnit.SECONDS);
client.setReadTimeout(100, TimeUnit.SECONDS);
Response response = null;
Request request = new Request.Builder()
        .url("https://www.celebritycruises.com/")
        .get()
        .build();
try {
    response = client.newCall(request).execute();
    System.out.println(response.code());
} catch (IOException e) {
    e.printStackTrace();
}
</code>```

So there are some sites (like the one provided in the Builder which cause:

```<code>java.net.SocketTimeoutException: timeout
at okio.Okio$3.newTimeoutException(Okio.java:207)
at okio.AsyncTimeout.exit(AsyncTimeout.java:261)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:215)
[...]
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.read(InputRecord.java:503)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:940)

at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
at okio.Okio$2.read(Okio.java:139)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:211)
... 38 more
</code>```

What I do NOT understand is: why this works fine in the browser? I already set timeouts for 100seconds. I also tried with other HttpClients but with the same results (I believe deep down they use same classes anyways). Could anyone tell me where the problem lies, please?

Edit

I tried wget - worked, saved some HTML content.
curl returned: (52) Empty reply from server

答:
You have to use an User-Agent in your request. This works:</p>

```<code>Request request = new Request.Builder().url("https://www.celebritycruises.com/").header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0").build();
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I have been playing with Http in Java and I faced a strange problem. Below is a piece code which executes GET method:

OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(100, TimeUnit.SECONDS);
client.setReadTimeout(100, TimeUnit.SECONDS);
Response response = null;
Request request = new Request.Builder()
        .url("https://www.celebritycruises.com/")
        .get()
        .build();
try {
    response = client.newCall(request).execute();
    System.out.println(response.code());
} catch (IOException e) {
    e.printStackTrace();
}

So there are some sites (like the one provided in the Builder which cause:

java.net.SocketTimeoutException: timeout
at okio.Okio$3.newTimeoutException(Okio.java:207)
at okio.AsyncTimeout.exit(AsyncTimeout.java:261)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:215)
[...]
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.read(InputRecord.java:503)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:940)

at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
at okio.Okio$2.read(Okio.java:139)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:211)
... 38 more

What I do NOT understand is: why this works fine in the browser? I already set timeouts for 100seconds. I also tried with other HttpClients but with the same results (I believe deep down they use same classes anyways). Could anyone tell me where the problem lies, please?

Edit

I tried wget - worked, saved some HTML content.
curl returned: (52) Empty reply from server

Body:
You have to use an User-Agent in your request. This works:

Request request = new Request.Builder().url("https://www.celebritycruises.com/").header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0").build();


问:
Target specific div Using Jquery
I Want to target a div using jQuery and change its color of innerHtml to red having INACTIVE Status (It is basically a select2 box)

This is the jQuery code  I have so far to target that div:

```<code>$("div#select2-drop ul > li > div:contains(INACTIVE)").css('color','red');
</code>```

答:
You have per your comments $("div#select2-drop ul > li > div:contains(INACTIVE)").css('color','red');

This targets an element with an ID however you have a class.

Use the class selector.

```<code>$("div.select2-drop")
 .find("ul > li")
 .find("div:contains('INACTIVE')").css('color','red');
</code>```

Title: Target specific div Using Jquery

Body:
I Want to target a div using jQuery and change its color of innerHtml to red having INACTIVE Status (It is basically a select2 box)

This is the jQuery code  I have so far to target that div:

$("div#select2-drop ul > li > div:contains(INACTIVE)").css('color','red');

Body:
You have per your comments $("div#select2-drop ul > li > div:contains(INACTIVE)").css('color','red');

This targets an element with an ID however you have a class.

Use the class selector.

$("div.select2-drop")
 .find("ul > li")
 .find("div:contains('INACTIVE')").css('color','red');


问:
Optimize sql Query which take too long to execute
The following sql query is taking to much to return a result

```<code>SELECT count(*)
FROM List_declarations
WHERE  Id_antenne IN (
   SELECT id
   FROM Service
   WHERE id_direction IN (
      SELECT id_dr
      FROM affectation_service_dr
      WHERE id_service = 15
   )
)
</code>```

How I can do better  ?

答:
I tried everyone proposition but nothing seems to be the solution , the time consumed by the request is still 37s

contemplating the request , I realized that the query within the in clause is executed for every row in table list_declarations which contains a huge amount of data . and the following sql code worked nickel (1s) :

```<code>declare  @table table( idantenne nvarchar(20))
insert into @table select ID from Service where id_direction in (select id_dr from affectation_service_dr where id_service = 15)
Declare @string AS Nvarchar(MAX) -- It must not be MAX if you have few numbers
SELECT  @string = COALESCE(@string + ',', '') + idantenne
FROM   @table where idantenne IS NOT NULL
declare @req nvarchar(max)
set @req = 'SELECT * FROM List_declarations Where 1=1  and Id_antenne in (' + @string +' )'
exec (@req)
</code>```

Body:
The following sql query is taking to much to return a result

SELECT count(*)
FROM List_declarations
WHERE  Id_antenne IN (
   SELECT id
   FROM Service
   WHERE id_direction IN (
      SELECT id_dr
      FROM affectation_service_dr
      WHERE id_service = 15
   )
)

How I can do better  ?

Body:
I tried everyone proposition but nothing seems to be the solution , the time consumed by the request is still 37s

contemplating the request , I realized that the query within the in clause is executed for every row in table list_declarations which contains a huge amount of data . and the following sql code worked nickel (1s) :

declare  @table table( idantenne nvarchar(20))
insert into @table select ID from Service where id_direction in (select id_dr from affectation_service_dr where id_service = 15)
Declare @string AS Nvarchar(MAX) -- It must not be MAX if you have few numbers
SELECT  @string = COALESCE(@string + ',', '') + idantenne
FROM   @table where idantenne IS NOT NULL
declare @req nvarchar(max)
set @req = 'SELECT * FROM List_declarations Where 1=1  and Id_antenne in (' + @string +' )'
exec (@req)


问:
How to solve this error IOError: [Errno 2] No such file or directory: 'logging.yaml' ?
I am trying to use a python library "google_news_crawler" that can be installed through "pip install google_news_crawler" when I run its example code.

```<code>google_news_crawler --datastore=ES --feed="http://news.google.com/news?cf=all&ned=en_bw&output=rss&topic=t&sort=newest"
</code>```

its gives me an error like this:

```<code>-HP-Notebook:~$ google_news_crawler --datastore=ES --feed="http://news.google.com/news?cf=all&ned=en_bw&output=rss&topic=t&sort=newest"
Traceback (most recent call last):
  File "/usr/local/bin/google_news_crawler", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/google_news_crawler/google_news_crawler.py", line 46, in main
    setup_logging(args['--log-config'])
  File "/usr/local/lib/python2.7/dist-packages/google_news_crawler/google_news_crawler.py", line 36, in setup_logging
    with open(fname) as f:
IOError: [Errno 2] No such file or directory: 'logging.yaml'
</code>```

I really don't have any clue what is 'logging.yaml' file and how can I solve this error.

thanks

答:
```<code>cd /usr/local/lib/python2.7/dist-packages/google_news_crawler/
sudo touch logging.yaml
sudo vi logging.yaml
</code>```

Copy paste below content into that file:

```<code>disable_existing_loggers: false
formatters:
  default:
    format: '%(asctime)s %(levelname)-8s %(name)-15s %(message)s'
    #datefmt: '%Y-%m-%d %H:%M:%S'
handlers:
  console:
    class: logging.StreamHandler
    formatter: default
loggers:
  google_news_crawler.gnc:
    level: DEBUG
  elasticsearch:
    level: ERROR
  elasticsearch.trace:
    handlers: null
root:
  handlers: [console]
  level: WARNING
version: 1
</code>```

Body:
I am trying to use a python library "google_news_crawler" that can be installed through "pip install google_news_crawler" when I run its example code.

google_news_crawler --datastore=ES --feed="http://news.google.com/news?cf=all&ned=en_bw&output=rss&topic=t&sort=newest"

its gives me an error like this:

-HP-Notebook:~$ google_news_crawler --datastore=ES --feed="http://news.google.com/news?cf=all&ned=en_bw&output=rss&topic=t&sort=newest"
Traceback (most recent call last):
  File "/usr/local/bin/google_news_crawler", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/google_news_crawler/google_news_crawler.py", line 46, in main
    setup_logging(args['--log-config'])
  File "/usr/local/lib/python2.7/dist-packages/google_news_crawler/google_news_crawler.py", line 36, in setup_logging
    with open(fname) as f:
IOError: [Errno 2] No such file or directory: 'logging.yaml'

I really don't have any clue what is 'logging.yaml' file and how can I solve this error.

thanks

Body:
cd /usr/local/lib/python2.7/dist-packages/google_news_crawler/
sudo touch logging.yaml
sudo vi logging.yaml

Copy paste below content into that file:

disable_existing_loggers: false
formatters:
  default:
    format: '%(asctime)s %(levelname)-8s %(name)-15s %(message)s'
    #datefmt: '%Y-%m-%d %H:%M:%S'
handlers:
  console:
    class: logging.StreamHandler
    formatter: default
loggers:
  google_news_crawler.gnc:
    level: DEBUG
  elasticsearch:
    level: ERROR
  elasticsearch.trace:
    handlers: null
root:
  handlers: [console]
  level: WARNING
version: 1


问:
What does "abstract over" mean?
Often in the Scala literature, I encounter the phrase "abstract over", but I don't understand the intent.  For example, Martin Odersky writes

You can pass methods (or "functions") as parameters, or you can abstract over them. You can specify types as parameters, or you can abstract over them.

As another example, in the "Deprecating the Observer Pattern" paper,

A consequence from our event streams being first-class values is that we can abstract over them.

I have read that first order generics "abstract over types", while monads "abstract over type constructors".  And we also see phrases like this in the Cake Pattern paper.  To quote one of many such examples:

Abstract type members provide flexible way to abstract over concrete types of components.

Even relevant stack overflow questions use this terminology.  "can't existentially abstract over parameterized type..."

So... what does "abstract over" actually mean?

答:
An abstraction is a sort of generalization.

http://en.wikipedia.org/wiki/Abstraction

Not only in Scala but many languages there is a need to have such mechanisms to reduce complexity(or at least create a hierarchy that partitions information into easier to understand pieces).

A class is an abstraction over a simple data type. It is sort of like a basic type but actually generalizes them. So a class is more than a simple data type but has many things in common with it.

When he says "abstracting over" he means the process by which you generalize. So if you are abstracting over methods as parameters you are generalizing the process of doing that. e.g., instead of passing methods to functions you might create some type of generalized way to handle it(such as not passing methods at all but building up a special system to deal with it).

In this case he specifically means the process of abstracting a problem and creating a oop like solution to the problem. C has very little ability to abstract(you can do it but it gets messy real quick and the language doesn't directly support it). If you wrote it in C++ you could use oop concepts to reduce the complexity of the problem(well, it's the same complexity but the conceptualization is generally easier(at least once you learn to think in terms of abstractions)).

e.g., If I needed a special data type that was like an int but, lets say restricted I could abstract over it by creating a new type that could be used like an int but had those properties I needed. The process I would use to do such a thing would be called an "abstracting".

Title: What does "abstract over" mean?


问:
How to automate app versioning in Android
I have a CI tool(Bamboo) which runs my Unit Tests and builds the app-release.apk. Whenever I make changes in my app and the build in successful I create a new Version number.I store the version number and build time in a file. Can I make Gradle to read from that file and change the app version accordingly?

Content of my file looks like this:

```<code>ProductVersion=0.0.0.0.0
ProductBuildDateTime=2017-01-01T00:00:00.000
</code>```

答:
Yes

If you meant how to do it, well simply do something like

```<code>def properties = new Properties()
def file = new File('version.properties')
file.withInputStream {
    properties.load it
}
properties.ProductVersion = ...
properties.ProductBuildDateTime = ...
file.withOuputStream {
    properties.store it, true
}</code>```

Body:
I have a CI tool(Bamboo) which runs my Unit Tests and builds the app-release.apk. Whenever I make changes in my app and the build in successful I create a new Version number.I store the version number and build time in a file. Can I make Gradle to read from that file and change the app version accordingly?

Content of my file looks like this:

ProductVersion=0.0.0.0.0
ProductBuildDateTime=2017-01-01T00:00:00.000

Body:
Yes

If you meant how to do it, well simply do something like

def properties = new Properties()
def file = new File('version.properties')
file.withInputStream {
    properties.load it
}
properties.ProductVersion = ...
properties.ProductBuildDateTime = ...
file.withOuputStream {
    properties.store it, true
}

ContentLicense: CC BY-SA 4.0


问:
How to differentiate the summary from the description in TortoiseGit commits?
On Github, for example, we can put a Summary message in the commits, but we can also put a Description message, so when a colaborator wants to see a description of the commit, he can know more details of it:

How can we do it when commiting a message in TortoiseGit, as he only gives you 1 input to write your message?

答: You can write the Summary and Description in the same input box in TortoiseGit, separated by a blank line.</p>


问:
How to create single page and render many pages in ASP.net
i want to create an ASP.NET website, what i want to do is to create a page lets name it the main page "main.aspx", not MVC or razor pages.

Then inside this page i control and render the other pages using paramter in the url named "method" for example as following :

main.aspx?method=register : so the register page or view rendered in the main page.

main.aspx?method=users : the users page or view rendered in the main page.

My question is, what it the right choice to do this in Visual studio 2017 ?

if web forms is the right one, what is the main page should be "Default.aspx" or another page ? where i should exactly get the "method" value ? where i should put the template or the view of the "register" for example? and what is the expected content to be inside it ?

答:
If you use Webforms, the template that can wrap other pages is called a MasterPage.

You don't need to pass the page name through a querystring, though. You can accomplish that with the URL Rewrite module or with Routing, but neither is necessary. The MasterPage will wrap any page that uses it automatically.

Here's an overview:

ASP.NET Master Pages

https://msdn.microsoft.com/en-us/library/wtxbf3hh.aspx


问:
number as a result in select in mysql database

I run query:

```<code>SELECT ifnull(TIME_TO_SEC( TIMEDIFF( a.ending, a.begining ))/60,0)
FROM visits` a
</code>```

and I wouls like  NUMBER as a result

but i recived like this

```<code>0.0000
50.0000
50.0000
0.0000
0.0000
50.0000
</code>```

I expect as below:

```<code>0
50
50
0
0
50
</code>```

or 50,00

it means I need return number

答:
```<code> SELECT CAST( ifnull( TIME_TO_SEC( TIMEDIFF( a.ending, a.begining ))/60,
                      0 )
             AS unsigned )
 FROM visits` a
</code>```

Body:
I run query:

SELECT ifnull(TIME_TO_SEC( TIMEDIFF( a.ending, a.begining ))/60,0)
FROM visits` a

and I wouls like  NUMBER as a result

but i recived like this

0.0000
50.0000
50.0000
0.0000
0.0000
50.0000

I expect as below:

0
50
50
0
0
50

or 50,00

it means I need return number


问:
UFT: ADODB state closed while executing SQL
Using UFT12.51. Need to retrieve data from SQL Server.
The query I need to run is the following:

```<code>DROP TABLE IF EXISTS dbo.TempTableOutgoing, TempTableOutgoingLeft, TempTableOutgoingRight;
SELECT * INTO TempTableOutgoingRight FROM(
SELECT vi.rownumber, vi.outgoing, vi.oamount FROM [eBalance].[dbo].[AMEX_OUTGOING] AS V1
      CROSS APPLY (Values ('1','Sales', Sales),
                    ('2','Cash Advances', CashAdvances),
                    ('3','Returns', Credits)
            ) as vi (rownumber, outgoing, oamount)
WHERE v1.FileDate = ''"&FileDate&"'')R;

SELECT RowNum, Present, Amount, Outgoing, OAmount INTO TempTableOutgoing FROM(
SELECT * FROM(SELECT * FROM TempTableOutgoingLeft
UNION ALL
SELECT '4','Total',  CONVERT(VARCHAR, SUM(CAST(ISNULL(Amount,'0') AS decimal(15,2)))) from TempTableOutgoingLeft) AS Table1
LEFT OUTER JOIN (SELECT * FROM TempTableOutgoingRight
UNION ALL
SELECT '4','Outgoing Settlement Total',  CONVERT(VARCHAR, SUM(CAST(ISNULL(oamount,'0') AS decimal(15,2)))) from TempTableOutgoingRight) AS Table2
ON Table1.RowNum = Table2.rownumber) Z;

DROP TABLE TempTableOutgoingLeft;
DROP TABLE TempTableOutgoingRight;

SELECT present, Amount, Outgoing, OAmount, Variance FROM(
SELECT * FROM dbo.TempTableOutgoing z1
INNER JOIN (Select RowN, Variance from (
SELECT DISTINCT RowN, Variance FROM TempTableOutgoing AS TTO
     CROSS APPLY (Values
        ('1',''),('2', (SELECT CONVERT(VARCHAR, SUM(CAST(ISNULL(Amount,'0') AS decimal(15,2)))-SUM(CAST(ISNULL(OAmount,'0') AS decimal(15,2))))
        FROM TempTableOutgoing where RowNum IN (1,2,3))), ('3',''))
        as z (RowN,Variance)    where TTO.RowNum IN (1,2,3)
UNION ALL
SELECT DISTINCT z.* FROM TempTableOutgoing AS TTO
     CROSS APPLY (Values
        ('4', (SELECT CONVERT(VARCHAR, SUM(CAST(ISNULL(Amount,'0') AS decimal(15,2)))-SUM(CAST(ISNULL(OAmount,'0') AS decimal(15,2))))
        FROM TempTableOutgoing where RowNum IN (4)))
        ) as z (RowN,Variance)  where TTO.RowNum IN (4)
) V Group by RowN, Variance) V1
on z1.RowNum = V1.RowN) T;
</code>```

When I run it on the Microsoft SQL Management Studio, it runs correctly and gives proper result. But when trying to run it from UFT, I get error.
The code is:

```<code>Dim objConnection : Set objConnection = CreateObject("ADODB.Connection")
Set objRS = objConnection.Execute(query)
</code>```

When running in SQL Management Studio, it works well and gives proper result:

```<code>present     |Amount     |Outgoing                 |OAmount    |Variance
============+===========+=========================+===========+========
1st Present |5028510.18 |Sales                    |5110968.89
------------+-----------+-------------------------+-----------+--------
1P 1-Sided  |0.00       |Cash Advances            |0.00       |0.00
------------+-----------+-------------------------+-----------+--------
            |NULL       |Returns                  |-82458.71  |
------------+-----------+-------------------------+-----------+--------
Total       |5028510.18 |Outgoing Settlement Total|5028510.18 |0.00
</code>```

Trying to get data from the query. While connection state in True, the Recordset remains closed:

```<code>print objRS.State
print objConnection.State
</code>```

Result:

0

0

Also tried next, but it gace same results:

```<code>Dim objRS : Set objRS = CreateObject("ADODB.Recordset")
objRS.open query, objConnection
</code>```

In both cases, print objRS.Fields(1) gives following error:

Item cannot be found in the collection corresponding to the requested
  name or ordinal

The connection settings are 100% good, and even a simple query like SELECT * from [database].[schema].[table] and print recordset.fields(0) or print recordset.state returns a valid/true result.

As far as I researched, problem might cause when the query has more than one column with same name, but I have all different column names.

What can be the problem and what might be a solution?

Similar questions are asked by many people, but researching several posts, could not find any answer.

答:
Some (especially older) drivers get confused with the ROWCOUNT messages that multi-statement batches will send by default.  You can suppress these by including SET NOCOUNT ON at the beginning of the batch.

Also SQL Server has temp tables.  Use them instead of creating and dropping regular tables.

EG

```<code>SET NOCOUNT ON;
DROP TABLE IF EXISTS dbo.#Outgoing, #OutgoingLeft, #OutgoingRight;

SELECT * INTO #OutgoingRight FROM(
SELECT vi.rownumber, vi.outgoing, vi.oamount FROM [eBalance].[dbo].[AMEX_OUTGOING] AS V1
      CROSS APPLY (Values ('1','Sales', Sales),
                    ('2','Cash Advances', CashAdvances),
                    ('3','Returns', Credits)
            ) as vi (rownumber, outgoing, oamount)
WHERE v1.FileDate = ''"&FileDate&"'')R;

SELECT RowNum, Present, Amount, Outgoing, OAmount INTO #Outgoing FROM(
SELECT * FROM(SELECT * FROM #OutgoingLeft
UNION ALL
SELECT '4','Total',  CONVERT(VARCHAR, SUM(CAST(ISNULL(Amount,'0') AS decimal(15,2)))) from #OutgoingLeft) AS Table1
LEFT OUTER JOIN (SELECT * FROM #OutgoingRight
UNION ALL
SELECT '4','Outgoing Settlement Total',  CONVERT(VARCHAR, SUM(CAST(ISNULL(oamount,'0') AS decimal(15,2)))) from #OutgoingRight) AS Table2
ON Table1.RowNum = Table2.rownumber) Z;

DROP TABLE #OutgoingLeft;
DROP TABLE #OutgoingRight;

SELECT present, Amount, Outgoing, OAmount, Variance FROM(
SELECT * FROM dbo.#Outgoing z1
INNER JOIN (Select RowN, Variance from (
SELECT DISTINCT RowN, Variance FROM #Outgoing AS TTO
     CROSS APPLY (Values
        ('1',''),('2', (SELECT CONVERT(VARCHAR, SUM(CAST(ISNULL(Amount,'0') AS decimal(15,2)))-SUM(CAST(ISNULL(OAmount,'0') AS decimal(15,2))))
        FROM #Outgoing where RowNum IN (1,2,3))), ('3',''))
        as z (RowN,Variance)    where TTO.RowNum IN (1,2,3)
UNION ALL
SELECT DISTINCT z.* FROM #Outgoing AS TTO
     CROSS APPLY (Values
        ('4', (SELECT CONVERT(VARCHAR, SUM(CAST(ISNULL(Amount,'0') AS decimal(15,2)))-SUM(CAST(ISNULL(OAmount,'0') AS decimal(15,2))))
        FROM #Outgoing where RowNum IN (4)))
        ) as z (RowN,Variance)  where TTO.RowNum IN (4)
) V Group by RowN, Variance) V1
on z1.RowNum = V1.RowN) T;
</code>```

Body:
Using UFT12.51. Need to retrieve data from SQL Server.
The query I need to run is the following:

DROP TABLE IF EXISTS dbo.TempTableOutgoing, TempTableOutgoingLeft, TempTableOutgoingRight;
SELECT * INTO TempTableOutgoingRight FROM(
SELECT vi.rownumber, vi.outgoing, vi.oamount FROM [eBalance].[dbo].[AMEX_OUTGOING] AS V1
      CROSS APPLY (Values ('1','Sales', Sales),
                    ('2','Cash Advances', CashAdvances),
                    ('3','Returns', Credits)
            ) as vi (rownumber, outgoing, oamount)
WHERE v1.FileDate = ''"&FileDate&"'')R;

SELECT RowNum, Present, Amount, Outgoing, OAmount INTO TempTableOutgoing FROM(
SELECT * FROM(SELECT * FROM TempTableOutgoingLeft
UNION ALL
SELECT '4','Total',  CONVERT(VARCHAR, SUM(CAST(ISNULL(Amount,'0') AS decimal(15,2)))) from TempTableOutgoingLeft) AS Table1
LEFT OUTER JOIN (SELECT * FROM TempTableOutgoingRight
UNION ALL
SELECT '4','Outgoing Settlement Total',  CONVERT(VARCHAR, SUM(CAST(ISNULL(oamount,'0') AS decimal(15,2)))) from TempTableOutgoingRight) AS Table2
ON Table1.RowNum = Table2.rownumber) Z;

DROP TABLE TempTableOutgoingLeft;
DROP TABLE TempTableOutgoingRight;

SELECT present, Amount, Outgoing, OAmount, Variance FROM(
SELECT * FROM dbo.TempTableOutgoing z1
INNER JOIN (Select RowN, Variance from (
SELECT DISTINCT RowN, Variance FROM TempTableOutgoing AS TTO
     CROSS APPLY (Values
        ('1',''),('2', (SELECT CONVERT(VARCHAR, SUM(CAST(ISNULL(Amount,'0') AS decimal(15,2)))-SUM(CAST(ISNULL(OAmount,'0') AS decimal(15,2))))
        FROM TempTableOutgoing where RowNum IN (1,2,3))), ('3',''))
        as z (RowN,Variance)    where TTO.RowNum IN (1,2,3)
UNION ALL
SELECT DISTINCT z.* FROM TempTableOutgoing AS TTO
     CROSS APPLY (Values
        ('4', (SELECT CONVERT(VARCHAR, SUM(CAST(ISNULL(Amount,'0') AS decimal(15,2)))-SUM(CAST(ISNULL(OAmount,'0') AS decimal(15,2))))
        FROM TempTableOutgoing where RowNum IN (4)))
        ) as z (RowN,Variance)  where TTO.RowNum IN (4)
) V Group by RowN, Variance) V1
on z1.RowNum = V1.RowN) T;

When I run it on the Microsoft SQL Management Studio, it runs correctly and gives proper result. But when trying to run it from UFT, I get error.
The code is:

Dim objConnection : Set objConnection = CreateObject("ADODB.Connection")
Set objRS = objConnection.Execute(query)

When running in SQL Management Studio, it works well and gives proper result:

present     |Amount     |Outgoing                 |OAmount    |Variance
============+===========+=========================+===========+========
1st Present |5028510.18 |Sales                    |5110968.89
------------+-----------+-------------------------+-----------+--------
1P 1-Sided  |0.00       |Cash Advances            |0.00       |0.00
------------+-----------+-------------------------+-----------+--------
            |NULL       |Returns                  |-82458.71  |
------------+-----------+-------------------------+-----------+--------
Total       |5028510.18 |Outgoing Settlement Total|5028510.18 |0.00

Trying to get data from the query. While connection state in True, the Recordset remains closed:

print objRS.State
print objConnection.State

Result:

0

0

Also tried next, but it gace same results:

Dim objRS : Set objRS = CreateObject("ADODB.Recordset")
objRS.open query, objConnection

In both cases, print objRS.Fields(1) gives following error:

Item cannot be found in the collection corresponding to the requested
  name or ordinal

The connection settings are 100% good, and even a simple query like SELECT * from [database].[schema].[table] and print recordset.fields(0) or print recordset.state returns a valid/true result.

As far as I researched, problem might cause when the query has more than one column with same name, but I have all different column names.

What can be the problem and what might be a solution?

Similar questions are asked by many people, but researching several posts, could not find any answer.

Body:
Some (especially older) drivers get confused with the ROWCOUNT messages that multi-statement batches will send by default.  You can suppress these by including SET NOCOUNT ON at the beginning of the batch.

Also SQL Server has temp tables.  Use them instead of creating and dropping regular tables.

EG

SET NOCOUNT ON;
DROP TABLE IF EXISTS dbo.#Outgoing, #OutgoingLeft, #OutgoingRight;

SELECT * INTO #OutgoingRight FROM(
SELECT vi.rownumber, vi.outgoing, vi.oamount FROM [eBalance].[dbo].[AMEX_OUTGOING] AS V1
      CROSS APPLY (Values ('1','Sales', Sales),
                    ('2','Cash Advances', CashAdvances),
                    ('3','Returns', Credits)
            ) as vi (rownumber, outgoing, oamount)
WHERE v1.FileDate = ''"&FileDate&"'')R;

SELECT RowNum, Present, Amount, Outgoing, OAmount INTO #Outgoing FROM(
SELECT * FROM(SELECT * FROM #OutgoingLeft
UNION ALL
SELECT '4','Total',  CONVERT(VARCHAR, SUM(CAST(ISNULL(Amount,'0') AS decimal(15,2)))) from #OutgoingLeft) AS Table1
LEFT OUTER JOIN (SELECT * FROM #OutgoingRight
UNION ALL
SELECT '4','Outgoing Settlement Total',  CONVERT(VARCHAR, SUM(CAST(ISNULL(oamount,'0') AS decimal(15,2)))) from #OutgoingRight) AS Table2
ON Table1.RowNum = Table2.rownumber) Z;

DROP TABLE #OutgoingLeft;
DROP TABLE #OutgoingRight;

SELECT present, Amount, Outgoing, OAmount, Variance FROM(
SELECT * FROM dbo.#Outgoing z1
INNER JOIN (Select RowN, Variance from (
SELECT DISTINCT RowN, Variance FROM #Outgoing AS TTO
     CROSS APPLY (Values
        ('1',''),('2', (SELECT CONVERT(VARCHAR, SUM(CAST(ISNULL(Amount,'0') AS decimal(15,2)))-SUM(CAST(ISNULL(OAmount,'0') AS decimal(15,2))))
        FROM #Outgoing where RowNum IN (1,2,3))), ('3',''))
        as z (RowN,Variance)    where TTO.RowNum IN (1,2,3)
UNION ALL
SELECT DISTINCT z.* FROM #Outgoing AS TTO
     CROSS APPLY (Values
        ('4', (SELECT CONVERT(VARCHAR, SUM(CAST(ISNULL(Amount,'0') AS decimal(15,2)))-SUM(CAST(ISNULL(OAmount,'0') AS decimal(15,2))))
        FROM #Outgoing where RowNum IN (4)))
        ) as z (RowN,Variance)  where TTO.RowNum IN (4)
) V Group by RowN, Variance) V1
on z1.RowNum = V1.RowN) T;


问:
Should a descendant class' method's variable that is identical to Self, have access to its ancestor's protected methods?
This question arose from an issue that surfaced when using method chaining (fluent interface), and I suppose that's one of the only reasons it might be an issue at all.

To illustrate, I'll use an example using method chaining:

In unit A:

```<code>TParent = class
protected
  function DoSomething: TParent;
end;
</code>```

In unit B:

```<code>TChild = class(TParent)
public
  procedure DoAnotherThing;
end;

implementation

procedure TChild.DoAnotherThing;
begin
  DoSomething.DoSomething
end;
</code>```

I want to keep the DoSomething procedure protected and visible only to class descendants.

This won't compile, throwing a

cannot access protected symbol TParent.DoSomething

because DoSomething returns a TParent and the subsequent DoSomething call is issued from a TParent object in another unit (so the protection kicks in and the function is inaccessible). (thanks, David Heffernan, for the explanation)

To reduce it to its bare essence, something like TParent(Self).DoSomething is not possible inside the TChild class.

My question:

since the compiler does know that a copy of the Self parameter is being accessed from within the child class, would there be instances in which the ability to access the ancestor's protected methods breaks encapsulation? I'm only talking about dereferencing the typecasted Self from inside a descendant's class method. I'm aware that outside of this class, that parameter should not have access to the ancestor's protected methods (in another unit), of course.

Again, in short: when a variable, that is identical to the Self parameter, is dereferenced INSIDE one of its own class methods, would it be unsafe for the compiler to allow it access to its parent's protected methods (just like the Self parameter itself)?

It's a pretty theoretical question, but I'd be interested if it would have any negative impact on compiled code or encapsulation, if the compiler would allow this.

Thanks.

答:
Well, the child might be identical, but it might not.

Consider a slight expansion to your example.

```<code>TParent = class
protected
  function DoSomething: TParent;
end;
</code>```

and unit 2

```<code>TChild = class(TParent)
public
  procedure DoAnotherThing;
end;

TChild2 = class(TParent)
public
  procedure DoAnotherThing;
  function DoSomething: Child2;
end;

implementation

procedure TChild.DoAnotherThing;
begin
  DoSomething.DoSomething
end;

procedure TChild2.DoAnotherThing;
var
  p : TParent;
begin
  p := DoSomething;
  p.DoSomething;
end;
</code>```

Now the value returned by DoSomething certainly is a TParent. It might be a TChild or indeed a TChild2 or even something that you have very little knowledge of (other than that it is descended from TParent).

If the returned value is really a TChild, then certainly access is no problem - it is knows how to handle its own data type, but if not then it has no right to access the protected functions of the other object. If the returned value is a TChild you can do what you want, like this

```<code>procedure TChild.DoAnotherThing;
var
  p : TParent;
begin
  p := DoSomething;
  if p is TChild then (p as TChild).DoSomething;
end;
</code>```

Body:
This question arose from an issue that surfaced when using method chaining (fluent interface), and I suppose that's one of the only reasons it might be an issue at all.

To illustrate, I'll use an example using method chaining:

In unit A:

TParent = class
protected
  function DoSomething: TParent;
end;

In unit B:

TChild = class(TParent)
public
  procedure DoAnotherThing;
end;

implementation

procedure TChild.DoAnotherThing;
begin
  DoSomething.DoSomething
end;

I want to keep the DoSomething procedure protected and visible only to class descendants.

This won't compile, throwing a

cannot access protected symbol TParent.DoSomething

because DoSomething returns a TParent and the subsequent DoSomething call is issued from a TParent object in another unit (so the protection kicks in and the function is inaccessible). (thanks, David Heffernan, for the explanation)

To reduce it to its bare essence, something like TParent(Self).DoSomething is not possible inside the TChild class.

My question:

since the compiler does know that a copy of the Self parameter is being accessed from within the child class, would there be instances in which the ability to access the ancestor's protected methods breaks encapsulation? I'm only talking about dereferencing the typecasted Self from inside a descendant's class method. I'm aware that outside of this class, that parameter should not have access to the ancestor's protected methods (in another unit), of course.

Again, in short: when a variable, that is identical to the Self parameter, is dereferenced INSIDE one of its own class methods, would it be unsafe for the compiler to allow it access to its parent's protected methods (just like the Self parameter itself)?

It's a pretty theoretical question, but I'd be interested if it would have any negative impact on compiled code or encapsulation, if the compiler would allow this.

Thanks.

Body:
Well, the child might be identical, but it might not.

Consider a slight expansion to your example.

TParent = class
protected
  function DoSomething: TParent;
end;

and unit 2

TChild = class(TParent)
public
  procedure DoAnotherThing;
end;

TChild2 = class(TParent)
public
  procedure DoAnotherThing;
  function DoSomething: Child2;
end;

implementation

procedure TChild.DoAnotherThing;
begin
  DoSomething.DoSomething
end;

procedure TChild2.DoAnotherThing;
var
  p : TParent;
begin
  p := DoSomething;
  p.DoSomething;
end;

Now the value returned by DoSomething certainly is a TParent. It might be a TChild or indeed a TChild2 or even something that you have very little knowledge of (other than that it is descended from TParent).

If the returned value is really a TChild, then certainly access is no problem - it is knows how to handle its own data type, but if not then it has no right to access the protected functions of the other object. If the returned value is a TChild you can do what you want, like this

procedure TChild.DoAnotherThing;
var
  p : TParent;
begin
  p := DoSomething;
  if p is TChild then (p as TChild).DoSomething;
end;


问:
how to make package for my python project
I have a python project, which uses qt(UI) for user input and then creates the pdf using latex.
I want to make full package of my whole projects in some form of exe.

I came to know about pyinstaller, pyexe and cx_frezer.
So which one should I pick up first.
My exe should run in windows 98, xp, vista and linux.
So how does MiKTeX ( windows) and qt get bundle to my exe.
Does I have to make different exe depending upon the operation system.

Any link for reading will be nice.

答:
This might be a viable alternative to freeze and py2exe. Python allows compilation into bytecode. You will have to do this on all of your target platforms for specific python versions. Run in root of your project folder

python -m compileall

See http://docs.python.org/library/compileall.html for details.

After that, delete all *.py files leaving only *.pyc. Note that such compilations must work up to a specific three digits' version of python's runtime, so this is not very convenient.


问:
Can Bluesnap IPN/Webhook support multiple IPN endpoints?
I want to feed transaction IPN data to 2 different back end systems for which I can configure 2 endpoint URLs. Can I configure 2 callback URL endpoints in BlueSnap Console so that the same transactional information reaches both systems?</p>

答:
Yes Bluesnap IPN/Webhook support multiple IPN endpoints.
You can configure it in your Control Panel page under IPN/Webhook configuration page. </p>


问:
What does the '&' sign do when using 'auto' for iteration
recently I've encountered very very peculiar question when using auto in C++, just ... just look at the following code snippet :

my main function:

```<code>#include <list>
#include <iostream>
#include <stdio.h>
int main(){
    int a = 10, b = 20, c = 30;
    list<int> what;
    what.push_back(a);
    what.push_back(b);
    what.push_back(c);

    read(what);

    return 0;
}
</code>```

And here's function read:

```<code>void read(const list<int>& con){

    for (auto it : con){
        printf("%p\n", &it);
        cout << it << endl;
    }
    return ;
}
</code>```

And here's is the output :

```<code>0x7fffefff66a4
10
0x7fffefff66a4
20
0x7fffefff66a4
30
</code>```

What the heck is that? Same address with different content !?

And more strange this is, if I modify the for-loop by adding an '&'

that is:

```<code>for (auto& it : con){
</code>```

All the output makes sense immediately, the addresses would change by iteration

So my question is,

Why does the '&' sign make a change under this circumstance?

答:
let's see the expanded version of the : loop syntax first.

```<code>for( auto it: container) {
    ...
}
</code>```

is conceptually the same as

```<code>for( auto _it = container.begin(); _it != container.end(); it++) {
    auto it = *_it;
    ...
}
</code>```

while the reference form:

```<code>for( auto& it: container)
</code>```

is the same as

```<code>for( auto _it = container.begin(); _it != container.end(); it++) {
    auto &it = *_it;
    ...
}
</code>```

So in the first case it is a copy of the items in the container, in the second case it is a (lvalue) reference of it, hence if you modify it in the second loop it affects the items in the container

The address issue too can be explained this way: in the copy example the local variable has always the same address in each loop iteration (because their lifetime do not overlap, the compiler has no reason not to use the same address in the stack), thought if you factorize the code inside a function you may observe it changing in different function invocation (because the stack size might be different), in the reference example the address is different every time, because taking the address of a reference will yield the address of the object being referenced (in this case, the item in the container)

Body:
recently I've encountered very very peculiar question when using auto in C++, just ... just look at the following code snippet :

my main function:

#include <list>
#include <iostream>
#include <stdio.h>
int main(){
    int a = 10, b = 20, c = 30;
    list<int> what;
    what.push_back(a);
    what.push_back(b);
    what.push_back(c);

    read(what);

    return 0;
}

And here's function read:

void read(const list<int>& con){

    for (auto it : con){
        printf("%p\n", &it);
        cout << it << endl;
    }
    return ;
}

And here's is the output :

0x7fffefff66a4
10
0x7fffefff66a4
20
0x7fffefff66a4
30

What the heck is that? Same address with different content !?

And more strange this is, if I modify the for-loop by adding an '&'

that is:

for (auto& it : con){

All the output makes sense immediately, the addresses would change by iteration

So my question is,

Why does the '&' sign make a change under this circumstance?

Body:
let's see the expanded version of the : loop syntax first.

for( auto it: container) {
    ...
}

is conceptually the same as

for( auto _it = container.begin(); _it != container.end(); it++) {
    auto it = *_it;
    ...
}

while the reference form:

for( auto& it: container)

is the same as

for( auto _it = container.begin(); _it != container.end(); it++) {
    auto &it = *_it;
    ...
}

So in the first case it is a copy of the items in the container, in the second case it is a (lvalue) reference of it, hence if you modify it in the second loop it affects the items in the container

The address issue too can be explained this way: in the copy example the local variable has always the same address in each loop iteration (because their lifetime do not overlap, the compiler has no reason not to use the same address in the stack), thought if you factorize the code inside a function you may observe it changing in different function invocation (because the stack size might be different), in the reference example the address is different every time, because taking the address of a reference will yield the address of the object being referenced (in this case, the item in the container)


问:
Java HTTP Server Library
I'm writing an application which needs to be able to handle HTTP requests from an external source (in this case, it's actually a script from Second Life). I started out by using HTTPComponents by Apache, which worked great as long as the Java server only had to respond to GET requests. Now it needs to be able to receive data from the body of POST requests, and I don't see any way to do so with HTTPComponents. Is there a superior library to use for this?

I did find through some Googling that there is a basic HTTP server included in the Sun packages. For the purposes of this application, it could be required that it only run on an actual Sun/Oracle JVM implementation -- but that's still a code smell to me, and I'd probably only do so if the only option was to write my own HTTP server library from scratch, working up from sockets and such. Any suggestions for an alternative?

答: You can access the entity if the request is a HttpEntityEnclosingRequest.  There is a simple example demonstrating the use of this class.

Title: Java HTTP Server Library


问:
getting server error 500 on drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); line
I got a zip file where drupal website was already installed . I am trying to run it in my local host So I copied all the files and put it under wwwroot\mysite folder.

I updated settings.php , db name etc. Now when I go to localhost\mywebsite , it gives error:

```<code>localhost is currently unable to handle this request.
HTTP ERROR 500
</code>```

So I tried to debug and I printed line numbers by using echo just to see which line is giving me error and found that below line is giving this server error:

```<code>drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
</code>```

I am not sure what wrong I did. Also It is not recording anything in php log file, in php.ini i have described my log location as:

```<code> error_log=C:\Windows\temp\PHP71ForIISExpress_errors.log
</code>```

here is my index.php file:

```<code>define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
menu_execute_active_handler();
</code>```

答: If it worked on other server then (most likely) problem is not in code but in your server settings. Try finding some log files (php, apache) and see what errors are recorded. May be that you don't have some required php library installed/enabled or something similar.</p>

Body:
I got a zip file where drupal website was already installed . I am trying to run it in my local host So I copied all the files and put it under wwwroot\mysite folder.

I updated settings.php , db name etc. Now when I go to localhost\mywebsite , it gives error:

localhost is currently unable to handle this request.
HTTP ERROR 500

So I tried to debug and I printed line numbers by using echo just to see which line is giving me error and found that below line is giving this server error:

drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

I am not sure what wrong I did. Also It is not recording anything in php log file, in php.ini i have described my log location as:

 error_log=C:\Windows\temp\PHP71ForIISExpress_errors.log

here is my index.php file:

define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
menu_execute_active_handler();


问:
Print table in Lua
I have a script in Lua and I need to print the variable res, but I do not know how to do this print. I get the result of the function in another function, where I wanted to do print

```<code>function parseCSVLine(line)
  local res = {}
  local pos = 1
  local sep = ','
  while true do
     local c = string.sub(line,pos,pos)
     if (c == "") then break end
     if (c == '"') then
        -- quoted value (ignore separator within)
        local txt = ""
        repeat
           local startp,endp = string.find(line,'^%b""',pos) -- Digitos
           txt = txt..string.sub(line,startp+1,endp-1)
           pos = endp + 1
           c = string.sub(line,pos,pos)
           if (c == '"') then txt = txt..'"' end
           -- check first char AFTER quoted string, if it is another
           -- quoted string without separator, then append it
           -- this is the way to "escape" the quote char in a quote. example:
           --   value1,"blub""blip""boing",value3  will result in blub"blip"boing  for the middle
        until (c ~= '"')
        table.insert(res,txt)
--        assert(c == sep or c == "")
        pos = pos + 1
     else
        -- no quotes used, just look for the first separator
        local startp,endp = string.find(line,sep,pos)
        if (startp) then
           table.insert(res,string.sub(line,pos,startp-1))
           pos = endp + 1
        else
           -- no separator found -> use rest of string and terminate
           table.insert(res,string.sub(line,pos))
           break
        end
     end
  end
  return res
end
</code>```

example

```<code>local result = parseCSVLine(line)
</code>```

Here I wanted to print the result

答:
res in parseCSVLine seems to be created as a list. So try this:

```<code>for i,v in ipairs(result) do print(i,v) end
</code>```

Title: Print table in Lua

Body:
I have a script in Lua and I need to print the variable res, but I do not know how to do this print. I get the result of the function in another function, where I wanted to do print

function parseCSVLine(line)
  local res = {}
  local pos = 1
  local sep = ','
  while true do
     local c = string.sub(line,pos,pos)
     if (c == "") then break end
     if (c == '"') then
        -- quoted value (ignore separator within)
        local txt = ""
        repeat
           local startp,endp = string.find(line,'^%b""',pos) -- Digitos
           txt = txt..string.sub(line,startp+1,endp-1)
           pos = endp + 1
           c = string.sub(line,pos,pos)
           if (c == '"') then txt = txt..'"' end
           -- check first char AFTER quoted string, if it is another
           -- quoted string without separator, then append it
           -- this is the way to "escape" the quote char in a quote. example:
           --   value1,"blub""blip""boing",value3  will result in blub"blip"boing  for the middle
        until (c ~= '"')
        table.insert(res,txt)
--        assert(c == sep or c == "")
        pos = pos + 1
     else
        -- no quotes used, just look for the first separator
        local startp,endp = string.find(line,sep,pos)
        if (startp) then
           table.insert(res,string.sub(line,pos,startp-1))
           pos = endp + 1
        else
           -- no separator found -> use rest of string and terminate
           table.insert(res,string.sub(line,pos))
           break
        end
     end
  end
  return res
end

example

local result = parseCSVLine(line)

Here I wanted to print the result

Body:
res in parseCSVLine seems to be created as a list. So try this:

for i,v in ipairs(result) do print(i,v) end


问:
Finding key from value in Python dictionary:
Fairly new to Python, still struggling with so much information.

All the documentation I've seen about dictionaries explain various ways of getting a value via a key - but I'm looking for a pythonic way to do the opposite - get a key via a value.

I know I can loop through the keys and inspect their values until I find the value I'm looking for and then grab the key, but I'm looking for a direct route.

答:
the first solution with the list comprehension is good.
but a small fix for python 3.x, instead of .iteritems() it should be just .items():

```<code>[k for k, v in d.items() if v == desired_value]
</code>```

Body:
the first solution with the list comprehension is good.
but a small fix for python 3.x, instead of .iteritems() it should be just .items():

[k for k, v in d.items() if v == desired_value]


问:
Put text and form next to photo using bootstrap
This is my HTML:

```<code><div class="row trolibelanja">
    <div class="col-md-3">
        <img src="http://2.bp.blogspot.com/-WGiyrP7xGOk/VQlHwjgporI/AAAAAAAABHI/zLGXTH0-H2w/s1600/Mie%2BAyam%2B(4).jpg" class="detailfoto">
    </div>
    <div class="col-md-4">
        <p class="detailnama">Mie Ayam Bakso</p>
        <p class="detailtoko">Toko Bu Lastri</p>
    </div>
    <div class="col-md-2">
        <p class="detailharga">Rp. 30.000</p>
    </div>
    <div class="col-md-2">
        <div class="input-group">
            <span class="input-group-btn">
            <button class="btnjumlah" type="button">-</button>
            </span>
            <input type="text" class="form-control jumlah" value="1">
            <span class="input-group-btn">
                <button class="btnjumlah" type="button">+</button>
            </span>
        </div>
    </div>
    <div class="col-md-1">
    </div>
</div>
</code>```

This is my css:

```<code>body{
    background-color: #661f61 !important;
    font-family: 'Saira Extra Condensed', sans-serif !important;
}

.container-fluid.keranjang {
    background-color: #e9e9e9;
    flex: 1;
}

.container.keranjang {

}

.row.trolibelanja {
        background-color: #e1e1e1;
    position: relative;
    padding-top: 10px;
    padding-bottom: 23px;
}

.row.trolibelanja:after{
    background-image: -webkit-linear-gradient(135deg, #6e1c64 25%, #e27f31 25%) !important;
    position: absolute;
    content: " ";
    width: 100%;
    height: 15px;
    bottom: 0;
}

.detailfoto {
    width: 100%;
    height: 110px;
    border: 6px solid white;
}

.detailnama{
    font-size: 20px;
    font-weight: bold;
}

.detailtoko{
    line-height: 20px;
    margin: -17px 0px;
}

.detailharga{
    font-size: 20px;
    font-weight: bold;
    text-align: center;
}

.input-group .jumlah {
    width: 50%;
    text-align: center;
}

.input-group .btnjumlah {
        background-color: #e27f31;
    color: white;
    border: 0;
    font-size: 20px;
    font-weight: bold;
    padding: 0px 10px;
    height: 100%;

}
</code>```

I am trying to put text and form next to photo using bootstrap, as in photo below:

enter image description here

My code result:

enter image description here

Please let me know what am I missing? I tried each combination of display that i know, but they wouldn't work. Thank you

答:
Arrange your columns properly. And you will be good. put image in one column (col-md-3 in this case) and rest of the content in another (col-md-9), then put all rest of the content in a new row. I would suggest that you have a better understanding of the rows and columns from bootstrap website.

https://www.w3schools.com/bootstrap/bootstrap_grid_system.asp

Mie Ayam Bakso

Toko Bu Lastri

Rp. 30.000

                                    <button class="btnjumlah" type="button">-</button>

                                    <input type="text" class="form-control jumlah" value="1">

                                        <button class="btnjumlah" type="button">+</button>

```

Body:
This is my HTML:

Mie Ayam Bakso

Toko Bu Lastri

Rp. 30.000

            <button class="btnjumlah" type="button">-</button>

            <input type="text" class="form-control jumlah" value="1">

                <button class="btnjumlah" type="button">+</button>

This is my css:

body{
    background-color: #661f61 !important;
    font-family: 'Saira Extra Condensed', sans-serif !important;
}

.container-fluid.keranjang {
    background-color: #e9e9e9;
    flex: 1;
}

.container.keranjang {

}

.row.trolibelanja {
        background-color: #e1e1e1;
    position: relative;
    padding-top: 10px;
    padding-bottom: 23px;
}

.row.trolibelanja:after{
    background-image: -webkit-linear-gradient(135deg, #6e1c64 25%, #e27f31 25%) !important;
    position: absolute;
    content: " ";
    width: 100%;
    height: 15px;
    bottom: 0;
}

.detailfoto {
    width: 100%;
    height: 110px;
    border: 6px solid white;
}

.detailnama{
    font-size: 20px;
    font-weight: bold;
}

.detailtoko{
    line-height: 20px;
    margin: -17px 0px;
}

.detailharga{
    font-size: 20px;
    font-weight: bold;
    text-align: center;
}

.input-group .jumlah {
    width: 50%;
    text-align: center;
}

.input-group .btnjumlah {
        background-color: #e27f31;
    color: white;
    border: 0;
    font-size: 20px;
    font-weight: bold;
    padding: 0px 10px;
    height: 100%;

}

I am trying to put text and form next to photo using bootstrap, as in photo below:

enter image description here

My code result:

enter image description here

Please let me know what am I missing? I tried each combination of display that i know, but they wouldn't work. Thank you

Body:
Arrange your columns properly. And you will be good. put image in one column (col-md-3 in this case) and rest of the content in another (col-md-9), then put all rest of the content in a new row. I would suggest that you have a better understanding of the rows and columns from bootstrap website.

https://www.w3schools.com/bootstrap/bootstrap_grid_system.asp

    <div class="row trolibelanja">
                        <div class="col-md-3">
                            <img src="http://2.bp.blogspot.com/-WGiyrP7xGOk/VQlHwjgporI/AAAAAAAABHI/zLGXTH0-H2w/s1600/Mie%2BAyam%2B(4).jpg" class="detailfoto">
                        </div>
                        <div class="col-md-9">
                          <div class="row">
                            <div class="col-md-4">
                                <p class="detailnama">Mie Ayam Bakso</p>
                                <p class="detailtoko">Toko Bu Lastri</p>
                            </div>
                            <div class="col-md-2">
                                <p class="detailharga">Rp. 30.000</p>
                            </div>
                            <div class="col-md-2">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                    <button class="btnjumlah" type="button">-</button>
                                    </span>
                                    <input type="text" class="form-control jumlah" value="1">
                                    <span class="input-group-btn">
                                        <button class="btnjumlah" type="button">+</button>
                                    </span>
                                </div>
                            </div>
                          </div>
                        </div>
                    </div>


问:
primefaces datatable rowexpansion with hidden column issue
I'm using PrimeFaces 6.0
I aim to create a data table with rowexpansion but I don't want to display rowtoggler. Expansion will occur on row selection. For this I have added to my code:

```<code>$(document).ready(function() {
      rowExpansion(PF('carDataTable'));
   });

function rowExpansion(dataTable) {
      //dataTable should be the widgetVar object
      var $this = dataTable;
      $this.tbody.off('click.datatable-expansion', '> tr')
         .on('click.datatable-expansion', '> tr', null, function() {
            //toggle the current row the old toggler
            $this.toggleExpansion($(this).find('div.ui-row-toggler'));
          });
}
</code>```

Rowtoggler column is hidden as:

```<code><p:column style="display:none">
    <p:rowToggler />
</p:column>
</code>```

The problem is that when row is expanded, the size of rows shrink. This also happens when any hidden column other than rowtoggler column exists. How it appears without expansion and with expansion is as follows:
before expansion
after expansion

any workaround or explanation is appreciated.

答:
Just an update but now you can set the column visibility to false.</p>

```<code><p:column visible="false">
  <p:rowToggler/>
</p:column>
</code>```

Body:
I'm using PrimeFaces 6.0
I aim to create a data table with rowexpansion but I don't want to display rowtoggler. Expansion will occur on row selection. For this I have added to my code:

$(document).ready(function() {
      rowExpansion(PF('carDataTable'));
   });

function rowExpansion(dataTable) {
      //dataTable should be the widgetVar object
      var $this = dataTable;
      $this.tbody.off('click.datatable-expansion', '> tr')
         .on('click.datatable-expansion', '> tr', null, function() {
            //toggle the current row the old toggler
            $this.toggleExpansion($(this).find('div.ui-row-toggler'));
          });
}

Rowtoggler column is hidden as:

The problem is that when row is expanded, the size of rows shrink. This also happens when any hidden column other than rowtoggler column exists. How it appears without expansion and with expansion is as follows:
before expansion
after expansion

any workaround or explanation is appreciated.

Body:
Just an update but now you can set the column visibility to false.

<p:column visible="false">
  <p:rowToggler/>
</p:column>


问:
Java8: Implement multiple conditional statements with stream API
I have a code block that redirects a Cassandra query to different Cassandra tables based on the available parameters such that I check multiple logical conditions inside multiple if conditions. I'm trying my hand at java 8 and looking to reduce these conditions to lambda expressions. Here's how the code currently looks,

```<code>String processTable(String cid, String postcode, String[] ratingvalue, String ratingType) {

    String table = "";
    if (postcode != null && ratingvalue == null) {
        table = cassconf.getTable1();
    }
    if (postcode != null && ratingvalue != null) {
        table = cassconf.getTable2();
    }
    if (cid != null && ratingvalue == null) {
        table = cassconf.getTable3();
    }
    if (cid != null && ratingvalue != null) {
        table = cassconf.getTable4();
    }
    if (cid != null && postcode != null && ratingvalue == null) {
        table = cassconf.getTable5();
    }
    if (cid != null && postcode != null & ratingvalue != null) {
        table = cassconf.getTable6();
    }
    return table;

}
</code>```

My problem is even if I store the arguments in a map and filter the unavailable values from the stream, I don't know how to return the final value of the table based on these 6 different conditions.

答:
I was thinking this as an exercise more, nothing to do with streams though, since it can't really help you here.

You could compute a HashMap that will have O(1) time for finding a value, like so:

```<code>    Map<Integer, String> map = new HashMap<>(16);
    map.put(0b1110, "table-6");
    map.put(0b1100, "table-5");
    map.put(0b1010, "table-4");
    map.put(0b1000, "table-3");
    map.put(0b0110, "table-2");
    map.put(0b0100, "table-1");
</code>```

This corresponds to whether your cid (the 4-th most significant bit), postcode (3-rd most significant bit) and ratingValue (second most significant bit) are null or not. So these are the total of 6 combinations that you are looking for.

Also this Map will have one entry per bucket, thus finding the value that you are interested in, will be really fast.

Computing the key that you need to get the value from is fairly trivial, you just need to set the bit (value that is not null).

```<code>String processTable(String cid, String postcode, String[] ratingvalue, String ratingType) {

    if (cid != null) {
        x = x | 1 << 3;
    }

    if (postCode != null) {
        x = x | 1 << 2;
    }

    if (ratingValue != null) {
        x = x | 1 << 1;
    }

    return map.get(x);
}
</code>```

Do note that this code was take just as an exercise (well, we do have something close to this in real life, but there are compelling reasons for this - speed mainly).

Body:
I have a code block that redirects a Cassandra query to different Cassandra tables based on the available parameters such that I check multiple logical conditions inside multiple if conditions. I'm trying my hand at java 8 and looking to reduce these conditions to lambda expressions. Here's how the code currently looks,

String processTable(String cid, String postcode, String[] ratingvalue, String ratingType) {

    String table = "";
    if (postcode != null && ratingvalue == null) {
        table = cassconf.getTable1();
    }
    if (postcode != null && ratingvalue != null) {
        table = cassconf.getTable2();
    }
    if (cid != null && ratingvalue == null) {
        table = cassconf.getTable3();
    }
    if (cid != null && ratingvalue != null) {
        table = cassconf.getTable4();
    }
    if (cid != null && postcode != null && ratingvalue == null) {
        table = cassconf.getTable5();
    }
    if (cid != null && postcode != null & ratingvalue != null) {
        table = cassconf.getTable6();
    }
    return table;

}

My problem is even if I store the arguments in a map and filter the unavailable values from the stream, I don't know how to return the final value of the table based on these 6 different conditions.

Body:
I was thinking this as an exercise more, nothing to do with streams though, since it can't really help you here.

You could compute a HashMap that will have O(1) time for finding a value, like so:

    Map<Integer, String> map = new HashMap<>(16);
    map.put(0b1110, "table-6");
    map.put(0b1100, "table-5");
    map.put(0b1010, "table-4");
    map.put(0b1000, "table-3");
    map.put(0b0110, "table-2");
    map.put(0b0100, "table-1");

This corresponds to whether your cid (the 4-th most significant bit), postcode (3-rd most significant bit) and ratingValue (second most significant bit) are null or not. So these are the total of 6 combinations that you are looking for.

Also this Map will have one entry per bucket, thus finding the value that you are interested in, will be really fast.

Computing the key that you need to get the value from is fairly trivial, you just need to set the bit (value that is not null).

String processTable(String cid, String postcode, String[] ratingvalue, String ratingType) {

    if (cid != null) {
        x = x | 1 << 3;
    }

    if (postCode != null) {
        x = x | 1 << 2;
    }

    if (ratingValue != null) {
        x = x | 1 << 1;
    }

    return map.get(x);
}

Do note that this code was take just as an exercise (well, we do have something close to this in real life, but there are compelling reasons for this - speed mainly).


答:
Add flex-wrap: nowrap; to your .row.trolibelanja like this:

```<code>.row.trolibelanja {
    background-color: #e1e1e1;
    position: relative;
    padding-top: 10px;
    padding-bottom: 23px;
    flex-wrap: nowrap;
}
</code>```

I made codepen example with your code: https://codepen.io/anon/pen/wPZoXX

Title: Put text and form next to photo using bootstrap

Body:
Add flex-wrap: nowrap; to your .row.trolibelanja like this:

.row.trolibelanja {
    background-color: #e1e1e1;
    position: relative;
    padding-top: 10px;
    padding-bottom: 23px;
    flex-wrap: nowrap;
}

I made codepen example with your code: https://codepen.io/anon/pen/wPZoXX


问:
HTML5 Canvas animation uses 88-98% of CPU
i'm trying to animate a faux pixelated map of the world so that it transitions between different colors smoothly. i originially did this with jquery and tables but the cpu usage was very high so i thought i'd try html5 canvas instead. However, i still get very high cpu usage for this. i'm wondering if its the large array in the code (which i use to indicate where a square should be filled). any help would be deeply appreciated.</p>

```<code><!DOCTYPE html>
<html>
<head>
    <title>canvas version</title>
    <script src="raphael.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
</head>
<body>
<div id="canvasesdiv" style="position:relative; width:864px; height:456px">
    <canvas id="world-map" width="864" height="456" style="position:absolute; left:0px; top:0px; z-index:1;">
    </canvas>
    <canvas id="backdrop" width="864" height="456" style="position:absolute; left:0px; top:0px; z-index:0;"></canvas>
    <script type="text/javascript">
        //declare vars
        var ctx1
        var ctx2
        var layer1
        var layer2
        var red = 255;
        var dr = 1;
        //initialization
        function init() {
            layer1 = document.getElementById("backdrop");
            ctx1 = layer1.getContext("2d");
            //layer2 = document.getElementById("world-map");
            //ctx2 = layer2.getContext("2d");
            drawMap(red);
            setInterval(function(){red = drawMap(red);},1);
            }

            //LOOP THROUGH THE ARRAY IT SHOULD BE 38 ROWS EACH WITH 72 COLUMN ENTRIES make each one 12x12 and then fill according to array non zero entries
        var array = [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 21.0, 22.0, 0.0, 0.0, 25.0, 26.0, 27.0, 28.0, 29.0, 0.0, 0.0, 0.0, 0.0, 0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23.0, 24.0, 25.0, 26.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 33.0, 34.0, 35.0, 36.0, 37.0, 0.0, 0.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 0.0, 0.0, 22.0, 23.0, 0.0, 0.0, 0.0, 27.0, 28.0, 0.0, 0.0, 0.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0, 61.0, 62.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 2.0, 0.0, 0.0, 0.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 30.0, 0.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 0.0, 0.0, 0.0, 60.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 0.0, 0.0, 60.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 29.0, 30.0, 0.0, 0.0, 0.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 29.0, 0.0, 0.0, 0.0, 33.0, 34.0, 35.0, 0.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 0.0, 0.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 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 64.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 16.0, 17.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 17.0, 18.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]]//

            //Draw the map and animate the background in red only for now
        function drawMap(){
            ctx1.clearRect(0,0, 864, 456);
            red -= dr
            if (red < 0 || red > 255){
                dr = -dr
            }
            ctx1.fillStyle = 'rgb('+red+',0,0)';
            ctx1.strokeStyle = '#000';
            for (var row = 0; row < 38; row+=1){
                for (var col = 0; col < 72; col+=1){
                    if (array[row][col] != 0.0){
                        ctx1.fillRect(col*12,row*12,12,12);
                        ctx1.strokeRect(col*12,row*12,12,12);
                    }
                }
            }
            return red;
        }
    init();
    </script>
    </div>
</body>
</html>
</code>```

答:
Well, you are scheduling the fill/stroking of 38 * 72 = 2736 rectangles every millisecond (setInterval takes args in milliseconds, not seconds). So you're forcing the browser to try and draw 2,736,000 rectangles a second.

That's not much for a GPU, but it is a fairly heavy load for a software renderer, which is what most browsers have for Canvas elements, until stuff like Direct2D and whatnot catches on.

Body:
i'm trying to animate a faux pixelated map of the world so that it transitions between different colors smoothly. i originially did this with jquery and tables but the cpu usage was very high so i thought i'd try html5 canvas instead. However, i still get very high cpu usage for this. i'm wondering if its the large array in the code (which i use to indicate where a square should be filled). any help would be deeply appreciated.

<!DOCTYPE html>

    <title>canvas version</title>

    <canvas id="world-map" width="864" height="456" style="position:absolute; left:0px; top:0px; z-index:1;">
    </canvas>
    <canvas id="backdrop" width="864" height="456" style="position:absolute; left:0px; top:0px; z-index:0;"></canvas>