text:
Q: How to predict a layer's weights using another model in an end to end fashion? I am working on visual question answering task and i want to reproduce the work in this paper https://arxiv.org/pdf/1511.05756v1.pdf
where they predict a layer's weights in a network using the question embedding. i wonder can i do that in keras?
i tried that and i know that for each tensor there is an argument weight
ex: Dense(128 , weight= )
but it expect a real number, and i want to train the network in an end to end.


text:
Q: Invalid value of TX counter when delete vertexes with orientdb 2.1.x While deleting vertexes from a class with more than 1600000 instances using the console:
delete vertex program batch 5000

I encounter this error:
com.orientechnologies.orient.core.exception.OStorageException: Invalid value of TX counter
    at com.orientechnologies.orient.core.tx.OTransactionOptimistic.rollback(OTransactionOptimistic.java:175)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2595)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.close(ODatabaseDocumentTx.java:1137)
    at com.orientechnologies.orient.server.network.protocol.http.command.post.OServerCommandPostCommand.execute(OServerCommandPostCommand.java:107)
    at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.service(ONetworkProtocolHttpAbstract.java:180)
    at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.execute(ONetworkProtocolHttpAbstract.java:627)
    at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:77)

I don't run inside a transaction and I was able to reproduce the error with plocal and remote connection, with enterprise version v2.1.4.
The database was created with another server instance, but with the same major version (2.1.x).
Update
My database is really huge (~29G) but I managed to reproduce the issue with a smaller graph and starting the console with a small heap (-Xmx32M).
OrientGraphFactory factory = ...

OrientBaseGraph graph = factory.getTx();

graph.createVertexType("Program");
graph.createVertexType("Variable");

graph.getRawGraph().getLocalCache().setEnable(false);
graph.declareIntent(new OIntentMassiveInsert());

try {
    Vertex vr = graph.addVertex("class:Program");

    for (int i = 0; i < 20000; i++) {
        Vertex v;

        v = graph.addVertex("class:Variable");
        graph.addEdge(null, v, vr, "has");
    }
} finally {
   graph.shutdown();
}

Update 2
With orient enterprise 2.1.5, the error is a little bit different. I ran with remote connection (because I wasn't able to configure the logging in client console) and with the same memory restriction (-Xmx32M):
2015-11-02 11:50:49:936 FINE  {db=db1} Deleted record #13:468 v.2 [OLocalPaginatedStorage]{db=db1} Error on transaction commit
com.orientechnologies.orient.core.exception.OTransactionException: Transaction was committed more times than it is started.
    at com.orientechnologies.orient.core.tx.OTransactionOptimistic.commit(OTransactionOptimistic.java:160)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2653)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2622)
    at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.commit(OrientTransactionalGraph.java:161)
    at com.orientechnologies.orient.graph.sql.OCommandExecutorSQLDeleteVertex.end(OCommandExecutorSQLDeleteVertex.java:279)
    at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.execute(OCommandExecutorSQLSelect.java:437)
    at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:90)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.executeCommand(OAbstractPaginatedStorage.java:1538)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:1519)
    at com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:72)
    at com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:33)
    at com.orientechnologies.orient.graph.sql.OCommandExecutorSQLDeleteVertex$2.call(OCommandExecutorSQLDeleteVertex.java:212)
    at com.orientechnologies.orient.graph.sql.OCommandExecutorSQLDeleteVertex$2.call(OCommandExecutorSQLDeleteVertex.java:207)
    at com.orientechnologies.orient.graph.sql.OGraphCommandExecutorSQLFactory.runInTx(OGraphCommandExecutorSQLFactory.java:130)
    at com.orientechnologies.orient.graph.sql.OCommandExecutorSQLDeleteVertex.execute(OCommandExecutorSQLDeleteVertex.java:207)
    at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:90)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.executeCommand(OAbstractPaginatedStorage.java:1538)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:1519)
    at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:63)
    at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.command(ONetworkProtocolBinary.java:1319)
    at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.executeRequest(ONetworkProtocolBinary.java:396)
    at com.orientechnologies.orient.server.network.protocol.binary.OBinaryNetworkProtocolAbstract.execute(OBinaryNetworkProtocolAbstract.java:223)
    at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:77)

2015-11-02 11:50:54:101 FINE  {db=db1} Sent run-time exception to the client /127.0.0.1:37943: com.orientechnologies.orient.core.exception.OStorageException: Invalid value of TX counter [ONetworkProtocolBinary]

redpajama_set_name: RedPajamaStackExchange


text:
Q: New Rails project without rails cmd I like to keep my global gemset as small as possible (only bundler and no rails) and install project-specifc gems individually for each rails project. Consequently, I do not have the rails command line tool in my global gemset, which makes it hard for me to create a new rails project from scratch. Is there a way to setup a new rails project without the command line tool? This way I can keep my global gemset as lean as possible. Any Ideas?
Cheers,
Gerardo
FYI: Normally, I include this file .bundle/config to my rails projects to install the gems locally:
---
BUNDLE_PATH: vendor/bundle
BUNDLE_DISABLE_SHARED_GEMS: '1'

A: Create app folder - say test_app.
Now put Gemfile there with
source "https://rubygems.org"

gem "rails"

Install gem: cd test_app && bundle install --path vendor/bundle
Now you have rails within this folder.
bundle exec rails new ../test_app --force will init new app, rewrite Gemfile and puts everything you need. Btw all gem now will be installed in vendor/bundle.

A: Here is how I do it:
Make sure you have bundler gem installed.
Create a directory named rails and create a Gemfile with the following contents
source 'https://rubygems.org'

gem 'rails'

Now run bundle install --path .bundle
This will provide you rails executable and you can now create new rails projects using:
bundle exec rails new path/to/my_app


text:
Q: how to extract Id of one url in one to another url in 2nd html page using angular js

            {{product.price}}

On ng button click want to get id of sku to another page
Need your help

A: If you want to use your ID (in your case your sku) in another view you can do it using $routeProvider.
Here I show you an example on JSFiddle
HTML

JS
var myapp = angular.module('myapp', []).config(function ($routeProvider) {
    $routeProvider
    .when('/list', {
        templateUrl: '/list.html'
    })
    .when('/detail/:id/', {
        templateUrl: '/detail.html',
        controller: 'DetailCtrl'
    })
    .otherwise({
        redirectTo: '/list'
    });
});

myapp.controller('DetailCtrl', function ($scope, $routeParams) {
    $scope.id = ($routeParams.id) ? parseInt($routeParams.id) : 0;
});

Test here


text:
Q: Image resized error: CGBitmapContextCreate: unsupported parameter I am using the following code (from a blog post) to resize an image
if (inImage.size.width <= inImage.size.height) {
    // Portrait
    ratio = inImage.size.height / inImage.size.width;
    resizedRect = CGRectMake(0, 0, width, width * ratio);
}
else {
    // Landscape
    ratio = inImage.size.width / inImage.size.height;
    resizedRect = CGRectMake(0, 0, height * ratio, height);
}

CGImageRef          imageRef = [inImage CGImage];
CGImageAlphaInfo    alphaInfo = CGImageGetAlphaInfo(imageRef);

if (alphaInfo == kCGImageAlphaNone)
    alphaInfo = kCGImageAlphaNoneSkipLast;

CGContextRef bitmap = CGBitmapContextCreate(
                                            NULL,
                                            resizedRect.size.width,     // width
                                            resizedRect.size.height,        // height
                                            CGImageGetBitsPerComponent(imageRef),   // really needs to always be 8
                                            4 * resizedRect.size.width, // rowbytes
                                            CGImageGetColorSpace(imageRef),
                                            alphaInfo
                                            );

but for some reason depending on the size I am try to resize to I get the following error generated

CGBitmapContextCreate: unsupported
  parameter combination: 8 integer
  bits/component; 32 bits/pixel;
  3-component colorspace;
  kCGImageAlphaNoneSkipFirst; XXX
  bytes/row.

where XXX differs depending on which image.
The rect I am creating is propotional to the image, I take a ratio from the width/height (depending on aspect) and multiple that be target width/height.
Here are some examples (X errors, / doesnt), the resize size will be 50xX or Xx50 depending on aspect:
Source   50x50   69x69
430x320  /      X
240x320  /      /
272x320  /      /
480x419  /      X
426x320  X      X
480x256  X      X

A: Where you wrote thumbRect, did you mean resizedRect? thumbRect does not otherwise occur.
I suspect the problem is that resizedRect.size.width is non integral.  Note that it's floating point.
The width and bytesPerRow parameters of CGBitmapContextCreate are declared as integers.  When you pass a floating point value, such as here, it gets truncated.
Suppose your resizedRect.size.width is 1.25.  Then you will end up passing 1 for the width, and floor(1.25 * 4) == 5 as the bytes per row.  That's inconsistent.  You always want to pass four times whatever you passed for the width for the bytes per row.
You can also just leave bytesPerRow as 0, by the way.  Then the system picks the best bytesPerRow (which is often larger than 4 times the width - it pads out for alignment).


text:
Q: nginx ssl_dhparam key for each vhost, or once for entire configuration? vs SSL confg Should diffie hellman parameters (ssl_dhparam key) be generated for each vhost, or just placed within http{...}? (for completely different website served up by the same host.
Conversely, to confirm, ssl_certificate, ssl_certificate_key, ssl_trusted_certificate should be different for each website?
Is there a way to refer to these three parameters if used in multiple vhosts (e.g. forwarding none www to www) without copy pasting? (Trying to follow the DRY principle, one source of truth)

A: Don't set the parameter at all.
Doing so enables DHE ciphers, which have been deprecated, and which are recommended to be disabled in favor of ECDHE ciphers.


text:
Q: How to get a single variable attached to the URI? I don't seem to able to acquire a GET variable that is attached to the URI.
The codes are => at the controller
...
parse_str($_SERVER['QUERY_STRING'], $_GET);
....
$data['ti'] = $this->input->get('hamleno');
this->load->view('anasayfa', $data);

The codes are => at the view the link is
...

<?php for ($b=0; $b<=(count($hml)-1); $b++) { ?><a href="<?php echo site_url('welcome/index/hamleno/'.$b.''); ?>"><?php echo $hml[$b]."  "; ?> <?php } ?>

The link is working. I have added the
$config['uri_protocol'] = "PATH_INFO";

to the config.php file.
However I am not able to get the $ti variable
if ($ti){

    $t=$ti;
}else{
    $t = $this->input->post('t');
    if (!$t) $t = 0;
    if( $this->input->post('ileri') ) {
        $t=$t+1;
        if($t>($uz-1)){
            $t=$uz-1;
        }
    } // Forward  button was pressed;
    if( $this->input->post('geri') ) {
        $t=$t-1;
        if($t<0){
            $t=0;
        }
    } // Back button was pressed;
}

A: I'm not familiar with codeigniter, but I've always passed GET variables in this manner:
URL = www.site.com/folder/webpage.php?myvariable=myvalue
I would retrieve that value this way:
$x = $_GET['myvariable'];

or with codeigniter: (I think)
$x = $this->input->get('myvariable');

Tailored to your example, I would personally de-obfuscate your loop code just a little and instead of switching from PHP to HTML and back in one line, I would simply echo both from PHP like this:
(I also don't exactly understand the url you're using, so here is my approximate)
<?php
    for ($b=0; $b<=(count($hml)-1); $b++)
    {
        echo '',$hml[$b],'  ';
    }
?>

A: I found out how Codeigniter solves the problem =>
$get = $this->uri->uri_to_assoc();
        if(isset($get['hamleno'])){
        $data['ti'] = $get['hamleno'];
  }

This sends the $b assigned to $hamleno together with all the other stuff in $data.
Thank you all for your kind comments


text:
Q: Actor Model is it ideal for Controlling Concurrency so I am thinking of using the actor model to solve a problem I currently have. For brevity, I have made up a scenario so we don't get too technical.
Lets say I have 3 benches but each bench supports a different amount of people:

*

*Park Bench 1 supports 3 people simultaneously

*Park Bench 2 supports 5 people simultaneously

*Park Bench 3 supports 2 people simultaneously

Upfront I know which bench to route too however, what I don't have context of is how many people are sitting on the bench. What I want to do is block any further people from sitting on a bench if its full but when a seat becomes available allow them to sit on it.
For some reason, the Actor model popped into my head but I am not sure whether this is the correct approach and perhaps there is alternative approach to solving my problem in which case I am keen to hear.
I envision creating 3 actors ParkBench1Actor ParkBench2Actor ParkBench3Actor and somehow control the number of live actors. I believe concepts such as pooling can help in these scenarios http://getakka.net/articles/actors/routers.html#pools-vs-groups.
Would appreciate peoples thoughts on this and tell me whether I have lost the plot a little :)

A: The actor model is distinguished from other techniques by virtue of its ability to run processes on any arbitrary machine within your computing domain.  So if this capability fits your use case, then yes, it is ideal for your purposes.
However, a process is a relatively coarse-grained computational unit, and because of that, it's not appropriate for all scenarios.  You wouldn't, for example, try to distribute the sorting of an ordinary array to actors unless the array was enormous.  Instead, you would employ a finer-grained mechanism like threads and futures.
Map/Reduce engines like Hadoop/Hive (which take a big-data problem, break it into smaller pieces, fan it out to multiple machines and then perform an aggregation on the individual results) do justify a process-based, Actor-like model due to the huge amount of data involved.


text:
Q: .withColVis() is not working in angularjs when i try to use .withColVis() in angularjs datatable then DTOptionsBuilder.fromSource(...).withPaginationType(...).withColVis is not a function error generate.
check this plunker. plunkr link
If i use .withDOM() then it is working.
check this plunker.
I also take reference from official website check this link :
help me to solve this problem , i want to use .withColVis() in my application.
.withColVis() is used for displaying a column list.
.withColVis() and .withDOM('<"H"Cr>t<"F"ip>') doing the same functionality , like displaying a Show/Hide column options. But .WithDOM() is working and .withColVis() is not working.
Not working code:
(function(angular) {
  'use strict';
  angular.module('datatablesSampleApp', ['datatables']).
  controller('simpleCtrl', function($scope, DTOptionsBuilder, DTColumnBuilder) {
    $scope.dtOptions = DTOptionsBuilder.fromSource('data.json')
      .withPaginationType('full_numbers')
      // Active ColVis plugin
      .withColVis()
      // Add a state change function
      .withColVisStateChange(function(iColumn, bVisible) {
        console.log('The column' + iColumn + ' has changed its status to ' + bVisible)
      })
      // Exclude the last column from the list
      .withColVisOption('aiExclude', [2]);
    $scope.dtColumns = [
      DTColumnBuilder.newColumn('id').withTitle('ID'),
      DTColumnBuilder.newColumn('firstName').withTitle('First name'),
      DTColumnBuilder.newColumn('lastName').withTitle('Last name')
    ];
  });
})(angular);

Working Code:
(function(angular) {
  'use strict';

  angular.module('datatablesSampleApp', ['datatables'])
    .controller('SimpleCtrl', SimpleCtrl);

  function SimpleCtrl(DTOptionsBuilder, DTColumnBuilder) {
    var vm = this;
    vm.dtOptions = DTOptionsBuilder.newOptions()
      .withOption('sAjaxSource', 'data.json')
      .withDataProp('data')
      .withDOM('<"H"Cr>t<"F"ip>')
      .withPaginationType('full_numbers')
      .withDisplayLength(10);
    vm.dtColumns = [
      DTColumnBuilder.newColumn('id', 'ID'),
      DTColumnBuilder.newColumn('firstName', 'First name'),
      DTColumnBuilder.newColumn('lastName', 'Last name')
    ];

  }
})(angular);

A: You must include angular-datatables.colvis.js in order to get the (now deprecated) ColVis plugin to work, here from the forked plnkr :
<script src="https://rawgithub.com/l-lin/angular-datatables/v0.6.2/dist/plugins/colvis/angular-datatables.colvis.js"></script>

and inject the datatables.colvis module :
angular.module('datatablesSampleApp', ['datatables', 'datatables.colvis']).

https://plnkr.co/edit/edZcE3DLjaDSuNhTu2MV?p=preview


text:
Q: Removing line feed from a postgres table Can any one help me to remove the line feeds in a postgres table which is created as
CREATE TABLE details
(
  doc_id serial NOT NULL,
  doc_name character varying(255),
  doc_description character varying(255),
  doc_location oid
)

Line feed has to be removed from the doc_location column.
Thanks,
Karthi


text:
Q: Importing a PostGIS and a Delimited Text layer in QGIS, not overlapping I'm a beginner in QGIS, and I have a PostGIS database and a CSV file I would like to visualize.
I followed the instructions in this question and the answers, but it doesn't work for me, my two layers are still not overlapping.
Here is what I'm doing:

*

*I create a new project, and in the project properties, in CRS, I "enable 'on the fly' CRS transofrmation" and select "Google Mercator".

*I add a PostGIS layer. In the "Properties" ("General") of this layer, the specified layer is "EPSG:900913 - Google Mercator". In "Metadata", I have:

+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs

*Finally, I add a Delimited Text layer. This one is in Swiss Coordinates, so when adding it, Google Mercator is proposed, but I change it to "CH1903+". In "Metadata", I have:

+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs

I'm choosing Google Mercator because when I first added the PostGIS layer, it was automatically selected.
What am I doing wrong here?
Here are examples of data from my sets:
CSV (Swiss coordinates):

533288    152585
533230    152625
533066    152647
533057    152660
533110    152607
533143    152627
533162    152571
533103    152560

PostGIS (Google Mercator coordinates) (supposedly overlapping more or less):

731632.384716794;5863923.31681192
731351.09395362;5864059.81606372
731351.452782778;5864091.19255148
731202.814656544;5864134.45924451
731322.906745951;5864210.56763595
731128.278515869;5864216.17023219
731337.333643971;5864149.17870271
730796.011530197;5864247.06311145
731613.06159501;5864003.29715222
730454.864224799;5863712.64413468

A: Looks like you picked the wrong Swiss CRS.
EPSG:21781 - CH1903 / LV03 looks good to me.


text:
Q: binutils cross-compile error I install cygwin-x86: source/binary binutils, flex, bison, source/binary gcc, etc..
In order to cross-compile binutils, I run the follwing commands:
export PREFIX=/usr/cross
export TARGET=x86_64-pc-linux
cd /usr/src/binutils-2.23.51-1
./configure --target=$TARGET --prefix=$PREFIX --enable-64-bit-bfd --disable-shared --disable-nls
make configure-host
make LDFLAGS="-all-static"
make install

On "make install", It occur errors
./c-arc.texi:223: command @bullet not accepting argument in brace should not be on @table line
./c-arm.texi:393: command @bullet not accepting argument in brace should not be on @table line
./c-arm.texi:394: warning: @item missing argument
./c-arm.texi:397: warning: @item missing argument
./c-arm.texi:402: warning: @item missing argument
./c-arm.texi:407: warning: @item missing argument
./c-arm.texi:412: warning: @item missing argument
./c-arm.texi:415: warning: @item missing argument
./c-cr16.texi:49: warning: @item missing argument
./c-cr16.texi:51: warning: @item missing argument
./c-cr16.texi:53: warning: @item missing argument
./c-cr16.texi:58: warning: @item missing argument
./c-cr16.texi:63: warning: @item missing argument
./c-cr16.texi:65: warning: @item missing argument
./c-tic54x.texi:113: @code expected braces
./c-tic54x.texi:130: @code expected braces
./c-tic54x.texi:137: @code expected braces
./c-tic54x.texi:313: @code expected braces
as.texinfo:4385: warning: node `Byte' is next for `Bundle directives' in menu but not in sectioning
as.texinfo:4441: warning: node `Bundle directives' is prev for `Byte' in menu but not in sectioning
as.texinfo:4449: warning: node `Comm' is next for `CFI directives' in menu but not in sectioning
as.texinfo:4571: warning: node `CFI directives' is prev for `Comm' in menu but not in sectioning
./c-arm.texi:447: warning: node next `ARM-Regs' in menu `ARM-Relocations' and in sectioning `ARM-Neon-Alignment' differ
./c-arm.texi:454: warning: node prev `ARM-Neon-Alignment' in menu `ARM-Relocations' and in sectioning `ARM-Regs' differ
./c-arm.texi:476: warning: node `ARM-Neon-Alignment' is next for `ARM-Relocations' in menu but not in sectioning
./c-arm.texi:476: warning: node `ARM-Regs' is prev for `ARM-Relocations' in menu but not in sectioning
./c-arm.texi:476: warning: node up `ARM-Relocations' in menu `ARM Syntax' and in sectioning `ARM Floating Point' differ
./c-arm.texi:469: node `ARM Floating Point' lacks menu item for `ARM-Relocations' despite being its Up target
./c-i386.texi:412: warning: node `i386-Regs' is next for `i386-Mnemonics' in menu but not in sectioning
./c-i386.texi:512: warning: node `i386-Mnemonics' is prev for `i386-Regs' in menu but not in sectioning
./c-i386.texi:927: warning: node next `i386-16bit' in menu `i386-Arch' and in sectioning `i386-Bugs' differ
./c-i386.texi:979: warning: node next `i386-Bugs' in menu `i386-Notes' and in sectioning `i386-Arch' differ
./c-i386.texi:979: warning: node prev `i386-Bugs' in menu `i386-Arch' and in sectioning `i386-16bit' differ
./c-i386.texi:1000: warning: node next `i386-Arch' in menu `i386-Bugs' and in sectioning `i386-Notes' differ
./c-i386.texi:1000: warning: node prev `i386-Arch' in menu `i386-16bit' and in sectioning `i386-Bugs' differ
./c-i386.texi:1067: warning: node prev `i386-Notes' in menu `i386-Bugs' and in sectioning `i386-Arch' differ
./c-mips.texi:449: warning: node next `MIPS Stabs' in menu `MIPS ISA' and in sectioning `MIPS symbol sizes' differ
./c-mips.texi:463: warning: node next `MIPS symbol sizes' in menu `MIPS autoextend' and in sectioning `MIPS ISA' differ
./c-mips.texi:463: warning: node prev `MIPS symbol sizes' in menu `MIPS ISA' and in sectioning `MIPS Stabs' differ
./c-mips.texi:518: warning: node next `MIPS ISA' in menu `MIPS symbol sizes' and in sectioning `MIPS autoextend' differ
./c-mips.texi:518: warning: node prev `MIPS ISA' in menu `MIPS Stabs' and in sectioning `MIPS symbol sizes' differ
./c-mips.texi:557: warning: node prev `MIPS autoextend' in menu `MIPS symbol sizes' and in sectioning `MIPS ISA' differ
./c-ns32k.texi:35: warning: node next `NS32K-Dependent' in menu `SH-Dependent' and in sectioning `PDP-11-Dependent' differ
./c-pdp11.texi:6: warning: node prev `PDP-11-Dependent' in menu `SH64-Dependent' and in sectioning `NS32K-Dependent' differ
./c-score.texi:7: warning: node next `SCORE-Dependent' in menu `Sparc-Dependent' and in sectioning `SH-Dependent' differ
./c-sh.texi:6: warning: node prev `SH-Dependent' in menu `NS32K-Dependent' and in sectioning `SCORE-Dependent' differ
./c-sh64.texi:5: warning: node next `SH64-Dependent' in menu `PDP-11-Dependent' and in sectioning `Sparc-Dependent' differ
./c-sparc.texi:8: warning: node prev `Sparc-Dependent' in menu `SCORE-Dependent' and in sectioning `SH64-Dependent' differ
./c-tilepro.texi:7: warning: node next `TILEPro-Dependent' in menu `V850-Dependent' and in sectioning `Z80-Dependent' differ
./c-z80.texi:7: warning: node prev `Z80-Dependent' in menu `Xtensa-Dependent' and in sectioning `TILEPro-Dependent' differ
./c-vax.texi:7: warning: node `V850-Dependent' is next for `Vax-Dependent' in sectioning but not in menu
./c-v850.texi:5: warning: node prev `V850-Dependent' in menu `TILEPro-Dependent' and in sectioning `Vax-Dependent' differ
./c-xtensa.texi:9: warning: node `Z80-Dependent' is next for `Xtensa-Dependent' in menu but not in sectioning
Makefile:397: recipe for target 'as.info' failed
make[4]: *** [as.info] Error 1
make[4]: Leaving directory '/usr/src/binutils-2.23.51-1/gas/doc'
Makefile:592: recipe for target 'install-am' failed
make[3]: *** [install-am] Error 2
make[3]: Leaving directory '/usr/src/binutils-2.23.51-1/gas/doc'
Makefile:2182: recipe for target 'install-recursive' failed
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory '/usr/src/binutils-2.23.51-1/gas'
Makefile:4762: recipe for target 'install-gas' failed
make[1]: *** [install-gas] Error 2
make[1]: Leaving directory '/usr/src/binutils-2.23.51-1'
Makefile:2142: recipe for target 'install' failed
make: *** [install] Error 2

It worked well when I did cross-compile before.. so I don't know what's wrong more
What should I do?


text:
Q: Which orbits of a separable representation of the infinite unitary group are closed? Consider a separable irreducible unitary representation of $U(\mathcal{H})$ in the Hilbert space $V$. Assume that $\mathcal{H}$ is separable. My question is the following:

Is it true that all orbits of
  $U(\mathcal{H})$ in
  $\mathbb{P}\mathcal{V}$ are closed? If
  not, are there any conditions for
  given state
  $[v]\in\mathbb{P}\mathcal{H}$ that
  guarantee that the orbit
  $[U(\mathcal{H}).v]$ is closed?

Motivation: I want to generalize a well known result from the theory of representations of compact semisimple Lie groups that states that the orbit through the highest weight vector in $\mathbb{P}V$  is characterized by a certain a quadric. Due to the structure of separable representations of $U(\mathcal{H})$ (see here) one can hope that the similar characterization is valid for orbits through "highest weight vectors" in these representations. In order to complete the proof I need to know that orbits through these highest weight vectors are closed. I was able to prove closedness for "highest weight orbits" in cases that are most interesting from the physical perspective: $V=\bigwedge^L\mathcal{H}$ and $V=Sym^L(\mathcal{H})$ but I am not able to cope with the general case.


text:
Q: Connection string changed unexpectedly in PostgreSQL code first 1- Installed Npgsql 3.1.9.0 and EntityFramework6.Npgsql.dll 31.0.0 dlls
2- Defined a DbContext as following
  public class MyDbContext : DbContext
{
    public MyDbContext()
        : base("myConnectionString")
    {

    }
    public virtual DbSet<Tag> Tags { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.HasDefaultSchema("public");
        modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
    }
}

3- And my app.config :
<configuration>
  <connectionStrings>
    <add name="myConnectionString" providerName="Npgsql" connectionString="Host=localhost;Port=5432;Database=mv_test;User Id=postgres;Password=devel;" />
  </connectionStrings>
  <configSections>

  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v13.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework" />
    </providers>
  </entityFramework>
</configuration>

4- My test snipped code
 MyDbContext myContext = new MyDbContext();
 int c = myContext.Tags.Count();

the exception :

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

but I can see the connection is default, is that connection string is not correct or something else?

UPDATE:
After many tries and Installing Npgsql again and again I knew that <configSections> must be the first child of the root <configuration>, corrected it and run again hope to run properly but at the end I have got this exception:

Could not load file or assembly 'Npgsql, Version=3.1.2.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I think some dependensies need to be referenced but I am newbie with Npgsl can anybody knows what went wrong.

A: YES, No pain No gain , There is no any barrier for a developer!
After many problems with Npgsql and code first I get succeeded to run my snipped code but here some notes that my useful for someone
As they said by installing Install-Package EntityFramework6.Npgsql by Nuget , Npgsql and all it's dependencies will be referenced without any problem but  I have got many fails so by installing Install-Package EntityFramework6.Npgsql the following libraries be referenced as desc given bellow (Tuesday, November 22, 2016):
1- Npgsql version 3.1.0.0
2-EntityFramework6.Npgsql version 3.1.1.0
3-EntityFramework and EntityFramework.SqlSrver version 6.0.0.0
after establishing DbContext and data model you may get exception that said

Could not load file or assembly 'Npgsql, Version=3.1.2.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

because Ngpsql is not compatible with Entityframework6.Npgsql or another reason should be located Ngpsql located in C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Npgsql\v4.0_3.1.9.0__5d8b90d52f46fda7 is 3.1.9
but to bypass this exception I have added Npgsql version 3.1.9.0 manually then code runs like a charm.
so the App.config should like:
    <?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>

  </configSections>
   <connectionStrings>
    <add name="myConnectionString" providerName="Npgsql" connectionString="Host=localhost;Port=5432;Database=mv_test;User Id=postgres;Password=devel;" />
  </connectionStrings>

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v13.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, EntityFramework6.Npgsql" />
    </providers>
  </entityFramework>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Npgsql" publicKeyToken="5d8b90d52f46fda7" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

hope this be useful for you.


text:
Q: as3 store an external variable and keep it I dont know if this is possible, but i have an  SWF file which i want it to get  info from an xml file only one time and then store it(keep it) there until a "newer" data will push into it
I know it sounds stupid but maybe there is a solution i don't know of...
1) i don't want to load the xml every time because of loads of traffic we have(a lot...will  cost a lot to refresh everytime from amazon s3)
but how do we get a newer data without checking the external xml file?
2) if there was a way to broadcast(to "ping") to the swf that an update of the xml is ready to load....
if anything i believe there should be an AS3 script for that.
thanks!

A:
but how do we get a newer data without checking the external xml file?

You could implement data file versioning. For example: urlToXmlData + "?version=" + myCurrentVesion As soon you ship new version of the application with extended data, it will work. It's global solution, so every new version of your product will work with latest data.
As for ping, you could create update strategy, for example: link is valid for 1 day. Idea is the same, concatenate stuff to the link, so browser will evaluate it as new: urlToXmlData + "?stamp=" + timestampForToday Tomorrow will be another timestamp, and browser will download updated version.

A: Use second xml which will contain the version first xml

A: I think you don't get the real subject.
You can't update a flash project without using any external update platform.
Because you cannot save all new XML data to a shared object because of "limitation of mb per data", so, flash going to delete all loaded data when application closed.
You cannot make a "permament update" in flash for "big files"...
BUT
You can update your main swf file with "EMBEDDED XML" files. Only that keeps your data updated when application is closed.
BUT that's not enough alone, also you need a "PRE-CHECK for Version of SWF" file, and that's what you can't do alone. You need a web platform featuring that way.
Mochi's "Live Updates" was offering that, but i couldn't make it work. But mochi is shutdown now... So forget about it...

A: I understand that your XML is BIG and you want to save trafic.
But how about small calls ?
You can have a call just to get the MD5 of your xml which is stored on the server.
Something like:  myserver.com/getMD5
Once the server will return you a different md5 than the one you have already stored, then you reload xml and save new MD5.


text:
Q: Scroll to Load More Method Freezes I have a UITableview that I'm trying to append data to when the user scrolls near the bottom. I've written this method to detect the scroll and it functions correctly but looks bad.
- (void)scrollViewDidScroll:(UIScrollView *)scroll {

NSInteger currentOffset = scroll.contentOffset.y;
NSInteger maximumOffset = scroll.contentSize.height - scroll.frame.size.height;

if (maximumOffset - currentOffset <= 5) {

        [self loaddata:[NSString stringWithFormat:@"%d", celltitle.count]];

}
}

loaddata has a number passed to it which is used to limit the returning cells from the database correctly. i.e. LIMIT x, (x+20)
Like I said the data loads but each time it goes to load it the scrolling pauses and then resumes. The NSURLConnection is synchronous. Could that be a problem?


text:
Q: ajax request failing to communicate with php Background: I have an HTML file containing some JavaScript. This file is hosted on a server. In the same directory, there is a PHP file. Keep this in mind.
The user selects some options and the site generates an XML string based on those options. I then want to pass this XML string to the PHP file to generate an XML file and execute a command concerning this file on this server.
Problem: I receive an error 400 (bad request) upon attempting the AJAX GET request. Why? Is it because the files are in the same directory?
JS AJAX:
        $.ajax({
        type: "GET",
        url: 'Submit_Job_to__Computer_Cluster.php',
        data: {XML_requested_job :  XML_string},
        dataType: "json",
        success: function (msg) {
           console.log(msg);
        },
        error: function (errormessage) {
            console.log("error: " + errormessage);
        }
    });

PHP:
<?php
header("Access-Control-Allow-Origin: *");
$today = getdate();
$year = (string) $today['year'];
$month = (string) $today['month'];
$day = (string) $today['mday'];
$XML_string = $_GET["XML_requested_job"]; //here's where the query data comes into play
$db_path = " /tmp/";
$db_path .= $year;
$db_path .= $month;
$db_path .= $day;
$db_path .= ".db";
$rocoto_path = "/work/apps/gnu_4.8.5/rocoto/1.2.1/bin/rocotorun";
$XML_file= "workflowPROD.xml";
$file_handle = fopen($XML_file, 'w') or die("Can't open the file");
fwrite($file_handle, $XML_string);
fclose($file_handle);
//concatenate command
$exec_command = $rocoto_path;
$exec_command .= " -w ";
$exec_command .= $XML_file;
$exec_command .= " -d";
$exec_command .= $db_path;
echo json_encode($XML_string);
shell_exec($exec_command);?>

EDIT: Changing the type to POST throws a 501 not implemented error instead.

A: The most likely reason is that you said:

contentType: "text/html; charset=utf-8",

This content type triggers a preflight OPTIONS request because it isn't on the list of safe content types (i.e. those which you could trigger with a plain HTML form).
You can check if this is the case using the Network tab of your browser's Developer Tools.
If the server isn't properly configured, it could respond to an OPTIONS request with a 400 Bad Request error.
To fix this, remove that line. Since you aren't POSTing, PUTing or otherwise sending an HTML document in the body of the request, it is a lie anyway.

A: Found the issue and solved it.
It turns out I had to encode the data being passed, rookie mistake.

*

*Made a variable: var encodedXML = encodeURI(XML_String);

*Referred to that variable (encodedXML) instead: data: {XML_requested_job :  encodedXML}
Thanks for all the comments and help.


text:
Q: How do I check if a PATH is set? And if not, set it from an argument #!/bin/bash

if[$LD_PATH == ""]
 then
   export LD_PATH=$1
 else
   export LD_PATH=$LD_PATH
fi

#excute the program that needs the path
./someProgThatNeedsThePath

i keep getting "cannot open shared object file"

A: First, your bash syntax is broken due to lack of spaces. First, you would need spaces around the [ and ] closures. If you use the newer alternate double bracket syntax, you don't have to worry about quoting variables you are testing.
#!/bin/bash

if [[ $LD_PATH = "" ]]; then
   export LD_PATH="$1"
else
   export LD_PATH="$LD_PATH"
fi

But your real problem is not that at all. Since your code is running in a separate bash shell, the code will have no effect on anything you run in the parent shell.  In order to do that you would want to build a function:
function add_to_ld_path () {
    if [[ -z $LD_PATH ]]; then
       export LD_PATH="$1"
    fi
}

Add that code to your .profile, then run it with add_to_ld_path /my/path when you want to use it. Note that since your "else" statement wasn't actually doing anything, I removed it. I also replaced your test for a blank string by making your own with quotes with the builtin empty string test.
Next up is what you are actually trying to accomplish. If all you want to do is set the variable if it's empty, UncleAli's solution is very simple. But it might be useful to do something like this:
function add_to_ld_path () {
    case ":$LD_PATH:" in
      *"$1"*) :;;
      *) LD_PATH=$LD_PATH:$1
    esac
}

This would check the current path and add the path given if it wasn't already part of the LD_PATH variable, otherwise it would leave it alone.

A: if [ -z "$LD_PATH" ]
then
  export LD_PATH=$1
fi

Will that do the job?


text:
Q: FluentNHibernate mapping of composite foreign keys I have an existing database schema and wish to replace the custom data access code with Fluent.NHibernate. The database schema cannot be changed since it already exists in a shipping product. And it is preferable if the domain objects did not change or only changed minimally.
I am having trouble mapping one unusual schema construct illustrated with the following table structure:
CREATE TABLE [Container] (
  [ContainerId] [uniqueidentifier] NOT NULL,
  CONSTRAINT [PK_Container] PRIMARY KEY (
    [ContainerId] ASC
  )
)

CREATE TABLE [Item] (
  [ItemId]      [uniqueidentifier] NOT NULL,
  [ContainerId] [uniqueidentifier] NOT NULL,
  CONSTRAINT [PK_Item] PRIMARY KEY (
    [ContainerId] ASC,
    [ItemId] ASC
  )
)

CREATE TABLE [Property] (
  [ContainerId] [uniqueidentifier] NOT NULL,
  [PropertyId]  [uniqueidentifier] NOT NULL,
  CONSTRAINT [PK_Property] PRIMARY KEY (
    [ContainerId] ASC,
    [PropertyId]  ASC
  )
)

CREATE TABLE [Item_Property] (
  [ContainerId] [uniqueidentifier] NOT NULL,
  [ItemId]      [uniqueidentifier] NOT NULL,
  [PropertyId]  [uniqueidentifier] NOT NULL,
  CONSTRAINT [PK_Item_Property] PRIMARY KEY (
    [ContainerId] ASC,
    [ItemId]      ASC,
    [PropertyId]  ASC
  )
)

CREATE TABLE [Container_Property] (
  [ContainerId] [uniqueidentifier] NOT NULL,
  [PropertyId]  [uniqueidentifier] NOT NULL,
  CONSTRAINT [PK_Container_Property] PRIMARY KEY (
    [ContainerId] ASC,
    [PropertyId]  ASC
  )
)

The existing domain model has the following class structure:
alt text http://yuml.me/4e2bcb95
The Property class contains other members representing the property's name and value. The ContainerProperty and ItemProperty classes have no additional members. They exist only to identify the owner of the Property. The Container and Item classes have methods that return collections of ContainerProperty and ItemProperty respectively. Additionally, the Container class has a method that returns a collection of all of the Property objects in the object graph. My best guess is that this was either a convenience method or a legacy method that was never removed.
The business logic mainly works with Item (as the aggregate root) and only works with a Container when adding or removing Items.
I have tried several techniques for mapping this but none work so I won't include them here unless someone asks for them. How would you map this?

A: Mapping should look this way:
public sealed class CategoryMap : ClassMap<Category>
{
    public CategoryMap()
    {
        Table("Categories");
        CompositeId()
            .KeyProperty(c => c.ItemId, "ItemId")
            .KeyProperty(c => c.CategoryId, "CategoryId");
    }
}

Note:

*

*Category entity class should override Equals() and GetHashCode() methods

*All properties and methods should be virtual / overwritten!

-
public class Category
{
    public virtual int ItemId { get; set; }
    public virtual int CategoryId { get; set; }

    public override bool Equals(object obj)
    {
        if (ReferenceEquals(null, obj)) return false;
        if (ReferenceEquals(this, obj)) return true;
        if (obj.GetType() != typeof (Category)) return false;
        return Equals((Category) obj);
    }

    public virtual bool Equals(Category other)
    {
        if (ReferenceEquals(null, other)) return false;
        if (ReferenceEquals(this, other)) return true;
        return other.ItemId == ItemId && other.CategoryId == CategoryId;
    }

    public override int GetHashCode()
    {
        unchecked
        {
            return (ItemId*397) ^ CategoryId;
        }
    }
}


text:
Q: Cast integer to C-like enum in rust Is it possible to cast an int to a C-like enum in rust? It's possible to cast from the enum to the int but I'd like to do it the other way too.
enum Type {
    FIRST = 1,
    SECOND = 2,
    THIRD = 3,
}

fn main() {
    let x = 3u8 as Type;
    println!("{}", x as u8);
}

Results in an error trying to cast to Type:
main.rs:8:13: 8:24 error: non-scalar cast: `u8` as `Type`
main.rs:8     let x = 3u8 as Type;
                      ^~~~~~~~~~~
error: aborting due to previous error


text:
Q: new DC 2008 R2 with 2003 GPO I've been having some issues with firewall and the likes concerning GPO being applied on my new 2008 DC. Is there anything that would make 2008 act differently than a 2003 server when it comes to GPO policies?

A: Your best bet is to create a new group policy object and edit it from the Server 2008 machine (or a Windows 7 machine, if you have one of those). I don't like the idea of installing unrequired software on a production server, but you'll have to find a happy medium between provisioning a new Server 2008 or Windows 7 machine or utilising an existing Server 2008 resource. In any case, here's the basic steps you can utilise:

*

*Install the Group Policy Management Console. On Server 2008, it's part of Server Manager by default. For Windows 7, you will need to install the RSAT update before the Group Policy Management option shows up in the Windows Features section (under the RSAT node).

*Edit the new group policy - don't edit an existing policy.

*Add the firewall settings you require under the Computer Config > Windows Settings > Security Settings > Windows Firewall with Advanced Security.

*Close the group policy editor.

*Review the settings of the policy via the Settings tab.

*Link the policy object to the OU that contains the Server 2008 machine(s).

*Either wait, or run a gpupdate /force on the Server 2008 machine you want the settings to apply to.

The 2008 policies are just files, and they could happily live on a Windows 2000 domain controller. The important part is that they're created by a Server 2008 or Windows 7 machine. That's the key.


text:
Q: Ultra simple method of deleting last char from String failing I'm simply trying to delete the last char in a String, I know this is a simple task and has been done any times BUT for some reason it doesn't work.
Example method
public String removeLastChar(String stringToRemoveCharFrom)
{
    if(stringToRemoveCharFrom.length() > 0)
    {
        return stringToRemoveCharFrom.substring(0, stringToRemoveCharFrom.length());
    }
    else{
        return stringToRemoveCharFrom;
    }
}

Now, when I output the string sometimes I get an empty char at the end, when I call this function it runs the correct way BUT the string stays the same.
Debugger shows:
\b in some of the outputs, what is this? And how do I avoid it?
Any ideas?

I replaced the end with -1 like in the answers but it still fails to delete:
return stringToRemoveCharFrom.substring(0, stringToRemoveCharFrom.length() - 1);

It seems for some reason JAVA is entering weird characters that cannot be deleted. such as \b.
If I do the following at the start:
stringToRemoveCharFrom = stringToRemoveCharFrom.replaceAll("\b", "");

it works. But I'm wondering what this char is?

A: stringToRemoveCharFrom.substring(0, stringToRemoveCharFrom.length())
will return the entire String. What you should be doing is:
stringToRemoveCharFrom.substring(0, stringToRemoveCharFrom.length() - 1)
This is because substring(int start, int end) returns a substring starting at "start", and ending at the index 1 before "end". The starting index is inclusive, the end is exclusive.

A: You forgot to subtract one from the length:
public String removeLastChar(String stringToRemoveCharFrom)
{
    if(stringToRemoveCharFrom.length() > 0)
    {
        return stringToRemoveCharFrom.substring
               (0, stringToRemoveCharFrom.length() - 1);
    }
    else{
        return stringToRemoveCharFrom;
    }
}

A: stringToRemoveCharFrom.substring(0, stringToRemoveCharFrom.length());

Is a copy of the string, if you want to strip the last character, use:
stringToRemoveCharFrom.substring(0, stringToRemoveCharFrom.length() - 1);


text:
Q: Como utilizar uma função Python no Django Atualmente estou com um problema em que não encontrei nenhuma solução que eu tenha conseguido compreender e executá-la. Estarei resumindo aqui o escopo do que eu necessito, pois senão ficaria muito extenso.
Em um trabalho, fiz algumas funções em Python que envolvem processamento de imagens em Python, em que eu utilizo bibliotecas como OpenCV e Pytesseract, para ter uma ideia melhor sobre o assunto, pode consultar uma dúvida minha aqui no Stack sobre o assunto, conforme:https://stackoverflow.com/questions/61599703/detecting-warm-colors-in-the-python-image
A função que eu criei basicamente recebe um diretório que contêm imagens ou uma imagem isolada (em .jpg), faz os processos necessários e retorna a imagem com as indicações de localização de ponto quente (conforme a imagem abaixo) e a temperatura neste ponto (um número float).

Obs: O círculo em azul, Coodinate e Value são resultados da função e não fazem parte da imagem original.
Com isto, eu gostaria de criar um aplicativo Web que aplique essas funções, utilizando Django, por já ter essa interação com o Python. Minha ideia é criar uma página que eu possa entrar com as imagens que eu desejo analisar, através de um forms (esta parte já está pronta, consigo entrar com as imagens através do  Uploading multiple files e salvá-las no banco de dados).
Em outra página, gostaria de colocar um botão que execute esta função nas imagens salvas anteriormente e salve os resultados (imagem .jpg e o valor float) no banco de dados, para que eu possa mostrá-los no template para visualização do usuário. É esta parte que não estou conseguindo evoluir, achei alguns tutoriais que falam em Ajax, mas nenhum deles consegui aplicar. Achei outros que indicavam executar essa função nas views.py, mas também não surgiu resultado.
Gostaria de saber se é possível fazer este tipo de aplicação e se sim, como eu poderia fazê-lo? Aceito indicação de tutoriais, exemplos, enfim, qualquer coisa que possa me ajudar.

A:
Solução dada pelo autor na própria pergunta.

Na verdade foi mais simples do que eu pensava. Apenas precisei chamar a função para realizar os processos que ela já faria e depois salvar estes dados no banco de dados. Segue abaixo os arquivos views.py e models.py
view.py
def WarmView(request):
if str(request.method) == 'GET':
    image_path = r"C:\Users\bruno\PycharmProjects\teste3\media\termografias"
    for name_file in sorted(os.listdir(image_path)):
        img = cv2.imread(os.path.join(image_path, name_file))
        temperatura = point.show_warm_point(img, name_file) # Função que executa o processo desejado

        teste_temp = fr"C:\Users\bruno\PycharmProjects\teste3\media\processadas\{name_file}"

        image = Processings()
        image.images = f"{teste_temp}"
        Processings.objects.create(images=image.images, temperature=temperatura)

models.py
class Processings(models.Model):
images = models.ImageField('Processada', upload_to='processadas')
temperature = models.DecimalField('Temperatura', max_digits=5, decimal_places=2)
created = models.DateTimeField(auto_now=True)


text:
Q: Store Flask blog content by using database or something else? I'm writing a Flask blog app.
I think that it some kind a heavy way to use database to store every post content. Is there a nicer way to implement this?
Is it a good way to use things like static site? If it's so, how to do this?

A: If you want blog posts to be stored over multiple user sessions, you must use some kind of database and ORM. The most common ORM used with flask is SQLAlchemy. There is lots of good documentation for using Flask and SQLAlchemy together.
However, if you are not married to Flask, Django might be a good alternative, because it has a built in ORM and very good documentation for it already.
Extra: You can get pretty far with Flask


text:
Q: Using Google Maps Client with cors I am using the the node.js client library by Google , found here - https://github.com/googlemaps/google-maps-services-js, in my React component. I am trying to use the Google Distance Matrix in this function:
googleMapsClient.distanceMatrix({
  origins: "1002 Deming Way, Madison, WI 53717",
  destinations: that.state.deliverycoords,
  units: "imperial"
}, function(err, response){
  if (err){
    console.log("Error: ", err);
  } else {
     that.setState(
      {
        delivery: Object.assign({}, that.state.delivery, {
          time: response.rows.elements[0].duration.text,
          miles: response.rows.elements[0].distance.text,
          deliveryFeeTotal:
            parseInt(response.rows.elements[0].distance.text.split(" ")[0]) *
            that.state.deliveryFeePerMile
        })
      },
      function() {
        console.log("Retrieved duration: ", that.state.delivery.time);
        console.log("Retrieved miles:", that.state.delivery.miles);
        console.log(
          "Retrieved total delivery fee: ",
          that.state.delivery.deliveryFeeTotal
        );
      }
    );
  }
});

The that.state.deliverycoords is dynamic. When I run this function, it makes the request, the browser console returns this:

Failed to load https://maps.googleapis.com/maps/api/distancematrix/json?destinations=-94.12788%2C45.547585&origins=1002%20Deming%20Way%2C%20Madison%2C%20WI%2053717&units=imperial&key=AIzaSyCe43xuJivO4RphF2c5PgPWdkbxlFz4mL0: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://1zjr04npqj.codesandbox.io' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I am running this code in codesandbox. Question: How do I solve this problem and is there some sample code I can reference?. Thanks


text:
Q: Generate dynamic text attribute by pattern I have a string like this
var str = "This is &my& apple, I bought it %yesterday%"

Everything inside & & mark will be italics, inside % % mark will turn into bold style and set this data to a UILabel. The final output will be:

This is my apple, I bought it yesterday

Edited: I am using %(.*?)% as a regex pattern to extract the substring
Is there any way to solve this issue? Please help
Thanks in advance.

A: You can use replacingOccurrences of regex to put the matches between bold and italic html tags and then use NSAttributedString to convert your html string to attributed string.
let str = "This is &my& apple, I bought it %yesterday%"

let html = str
    .replacingOccurrences(of: "(&.*?&)", with: ""+"$1"+"", options: .regularExpression)
    .replacingOccurrences(of: "&(.*?)&", with: "$1", options: .regularExpression)
    .replacingOccurrences(of: "(%.*?%)", with: ""+"$1"+"", options: .regularExpression)
    .replacingOccurrences(of: "%(.*?)%", with: "$1", options: .regularExpression)

Converting your html to attributed string
let label = UILabel(frame: CGRect(origin: .zero, size: CGSize(width: 300, height: 50)))
label.font = UIFont.systemFont(ofSize: 14)
do {
    label.attributedText = try NSAttributedString(data: Data(html.utf8), options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding: String.Encoding.utf8.rawValue], documentAttributes: nil)
} catch {
    print("error:", error)
}


text:
Q: How to connect Combo Box with Image in Universal Windows Platform? I was just trying to connect the combo box to the Image. This means when I select any option in Combo Box then Combo Box shows me an Image of that Option. Please help me to know how to do this?

A: The easiest way to achieve this behavior is to change the image source when the ComboBox.SelectedItem is changed by handling the ComboBox.SelectionChanged event.
Here is a simple demo of how it works. First of all, create a ComboBox control and give it some data about the locations. Then handling the  ComboBox.SelectionChanged event in the code behind and get the selected item. Now you could check the selected value and change the source of the image.
XAML:
 <Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <ComboBox x:Name="LocationComboBox" Header="Location" Height="60" Width="296" ItemsSource="{x:Bind source}" SelectionChanged="LocationComboBox_SelectionChanged">
        <ComboBox.ItemTemplate>
            <DataTemplate x:DataType="local:LocationData">
                <Grid>
                    <TextBlock Text="{x:Bind location}"/>
                </Grid>
            </DataTemplate>
        </ComboBox.ItemTemplate>
    </ComboBox>
    <Image x:Name="LocationImage" Grid.Row="1"/>
</Grid>

Code-behind:
 public sealed partial class MainPage : Page
{
    public List<LocationData> source { get; set; }
    public MainPage()
    {
        this.InitializeComponent();

        source = new List<LocationData>();
        source.Add(new LocationData { location = "london" });
        source.Add(new LocationData { location = "paris" });
        source.Add(new LocationData { location = "seattle" });
        source.Add(new LocationData { location = "vancouver" });

    }

    private void LocationComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        LocationData data = LocationComboBox.SelectedItem as LocationData;
        switch (data.location)
        {
            case "london":
                LocationImage.Source = new BitmapImage(new Uri("ms-appx:///Assets/london.png"));
                break;
            case "paris":
                LocationImage.Source = new BitmapImage(new Uri("ms-appx:///Assets/paris.png"));
                break;
            case "seattle":
                LocationImage.Source = new BitmapImage(new Uri("ms-appx:///Assets/seattle.png"));
                break;
            case "Rvancouvered":
                LocationImage.Source = new BitmapImage(new Uri("ms-appx:///Assets/vancouver.png"));
                break;
        }
    }
}

public class LocationData
{
    public string location { get; set; }
}

You could change it based on your own requirenments.

A: I am using the Combo box and wanted to connect the combo box attribute with Image, So  I followed these steps and found my solution.
XAML:
 <Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <StackPanel Grid.Row="0">
        <ComboBox x:Name="imageViewer" Width="200" Header="Picture" PlaceholderText="LifePicture" SelectionChanged="imageViewer_SelectionChanged" SelectedItem="{Binding Source, Mode=OneWay}" >
            <x:String>America</x:String>
            <x:String>Bombey</x:String>
            <x:String>China</x:String>
            <x:String>Delhi</x:String>
        </ComboBox>
        <Image x:Name="PictureView" Height="150" Width="150"
           Margin="0,8,0,0" HorizontalAlignment="Left" />

    </StackPanel>
</Grid>

Code-Behind:
 private void imageViewer_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        string imageName = imageViewer.SelectedItem.ToString();

       if(imageName == "America")
        {
            PictureView.Source = new BitmapImage(new Uri("ms-appx:///Assets/a.jpg"));
        }
       else if (imageName == "Bombey")
        {
            PictureView.Source = new BitmapImage(new Uri("ms-appx:///Assets/b.jpg"));
        }
        else if (imageName == "China")
        {
            PictureView.Source = new BitmapImage(new Uri("ms-appx:///Assets/c.jpg"));
        }
        else if (imageName == "Delhi")
        {
            PictureView.Source = new BitmapImage(new Uri("ms-appx:///Assets/d.jpg"));
        }

    }


text:
Q: Nullspace of linear transformation I've gotten a little help on the following problem, but I'm still having trouble with it:
Let $T : \mathbb{R}^{n} \rightarrow \mathbb{R}^{m}$ be a linear transformation. We define the nullspace of $T$ to be
$$Null(T)=\{\mathbf{x} ∈ \mathbb{R}^{n} ∶ T(\mathbf{x})=\mathbf{0}\}.$$
Find a linear transformation $T: \mathbb{R}^{5}→\mathbb{R}^{2}$ such that
$$Null(T)=\{(x_1,…,x_5) ∈ \mathbb{R}^{5} ∶x_4=x_5=0\}$$
This is the help I got from a friend:
" Define $T(x1,x2,x3,x4,x5)=(x4,x5)$
$T$ is a linear transformation from $\mathbb{R}^{5}→\mathbb{R}^{2}$
$Null(T)=\{x ∈ \mathbb{R}^{5} ∶x_4=x_5=0\}$ "
It seems like this doesn't quite answer the question.
Please help me out!

A: I think this should work: define your transformation on the standard bases {$e_i$} , with $e_i$ a "5-vector" with i-th component 1 , and 0 otherwise. Then, define $T(e_i)=0$ for $ i= 1,2,3$ . Then define $T(e_4)=(1,0)$ and $T(e_5)=(0,1)$. Then {$T(e_4),T(e_5)$} is a basis for $\mathbb R^2$, so it must have trivial kernel.
We can verify this works using rank-nullity. We have that $Dim (Im(T))=Dim(\mathbb R^2)=2$, since the image (span) of T{$e_4,e_5$} is the whole of $\mathbb R^2$, and we know that the dimension of the nullspace is $3$, since the three vectors $e_i; i=1,2,3$ are linearly-independent, so they span a nullset of dimension 3. Since the map is from $\mathbb R^5$, we have Rank(T)+Nullity(T)=5


text:
Q: Optaplanner inventory allocation I am trying to work with Optaplanner in order to solve the following simple exmample :
https://www.gams.com/products/gams/gams-language/#the-gams-language-at-a-glance/
simple inventory allocation exemple
I find it very difficult to do so since I couldn't find a similar cas on optaplanner
Can anyone help ? some directions, ressources
thanks in advance

A: It looks like the Facility Location Problem in OptaPlanner Quickstarts, but a consumer can pull from 2 or more suppliers at the same time.
Because the number of units to ship from supplier A to consumer X is an integer (*), you would need to use continuous value ranges and custom moves like in the investment example. Not simple (unlike other use cases in OptaPlanner), but doable.
(*) These business requirements are maybe unrealistic: in the real world, a half-full truck is almost as expensive as a full truck.


text:
Q: Cross product determinant's matrix The cross product $a \times b$ can be represented by the determinant
$$\mathbf{a}\times\mathbf{b}= \begin{vmatrix}
\mathbf{i} & \mathbf{j} & \mathbf{k} \\
a_1 & a_2 & a_3 \\
b_1 & b_2 & b_3 \\
\end{vmatrix}.$$
Does the matrix whose determinant is this have any significance?

A: You can let the matrix act by ordinary matrix multiplication on ordinary vectors in three-dimensional space.
This will transform a vector in a triple containing the original vector and the lengths of the two projections on $a$ and $b$.
While I feel that this counts as "any significance", it isn't very satisfactory, because the matrix, as you presented it, does not allow for matrix multiplication.
I think it is a much more useful point of view, to first view $i$,$j$,$k$ as three scalar variables (better denoted by $x$, $y$, $z$), then take the determinant of your matrix and then regard the cross product as the gradient vector this determinant.

A: You could think of the entries as all being Quaternions, i.e. the matrix is an element of $M_3(\mathbb{H})$. This gives you a genuine way to act on vectors and do matrix multiplication. But you need to be careful about converting between the two different interpretations $i=(1,0,0)\in\mathbb{R}^3$ versus $i\in\mathbb{H}$
https://en.m.wikipedia.org/wiki/Quaternion


text:
Q: Calculate mean for selected rows for selected columns in pandas data frame,but end up with some weird number I am trying to find the mean for certain column of the data frame in python, but then I ended up with some really weird number. Can someone explain this to me?
I want the mean for column a,b,c
k = pd.DataFrame(np.array([[1, 0, 3,'kk'], [4, 5, 6,'kk'], [7, 20, 9,'k'],[3, 2, 9,'k']]),
                   columns=['a', 'b', 'c','type'])
k

which returns
    a   b   c   type
0   1   0   3   kk
1   4   5   6   kk
2   7   20  9   k
3   3   2   9   k

I want the mean for each column except the column 'type'
 k[['a','b','c']].mean()

and this give me
a     368.25
b    1300.50
c     924.75
dtype: float64

I am so confused! Can someone explain this to me ?

A: This is the problem with creating the numpy array with mixed datatypes. Each sub-lists are now have a data type of Object and the same is being converted into data frame.
So, now DataFrame also will hold the same data type as in array.
See the below snippet:
k = pd.DataFrame(np.array([[1, 0, 3,'kk'], [4, 5, 6,'kk'], [7, 20, 9,'k'],[3, 2, 9,'k']]),
                   columns=['a', 'b', 'c','type'])

print(k.dtypes)

a       object
b       object
c       object
type    object
dtype: object

But you can think, how the mean is getting calculated over the string objects. This is again the power of numpy.
For example, take column a:
when you apply mean, it is trying the below operation,
np.sum(array) / len(array)
print(np.sum(k["a"]))

'1473'

print(np.len(k["a"]))

4

print(np.mean(k["a"]))

368.25

Now, 368.25 is nothing but 1473 / 4.
For Column b, it will be 05202 / 4 = 1300.5.
So, when you create a Dataframe, create with list of lists or in a dictionary form which will assign the data types according to the elements.
k = pd.DataFrame(([[1, 0, 3,'kk'], [4, 5, 6,'kk'], [7, 20, 9,'k'],[3, 2, 9,'k']]),
                   columns=['a', 'b', 'c','type'])

print(k.dtypes)

a        int64
b        int64
c        int64
type    object
dtype: object

print(k.mean())

a    3.75
b    6.75
c    6.75
dtype: float64

A: If we look at the type of variables stored in the dataframe, we find that they're stored as objects.
print(k.dtypes)

a    object
b    object
c    object
d    object
dtype: object

This means that since you've stored a string in one of the columns, the entire dataframe is being stored as objects. There is a number associated to each character, and I believe you're getting a mean of some of those numbers (although I haven't been able to figure out how you got those numbers).
For example, if we look at the numerical value assigned to the string '0' :
ord('0')

48

We see it has the numerical value of 48.
In order to get the mean you're looking for, you'll need to change the type.
Try :
b = k[['a', 'b', 'c']].astype(int)
print(b.mean())

a    3.75
b    6.75
c    6.75
dtype: float64

edit : changed "strings" to "objects"

A: The problem in your data is that you are mixing numbers with non numbers which is the 'k' for type.
Therefore your dataframe has type OBJECT and not integers.
Now I can't really explain on the low level how the numbers are generating such answer, however, the solution is:
TLDR;
k[['a','b','c']].astype(int).mean()
Output:

a    3.75
b    6.75
c    6.75
dtype: float64

And Welcome!


text:
Q: Scale a div length-wise; preserve aspect ratio SO: I've spent a number of hours tackling this design problem but can't seem to find a precise answer. I'm attempting to scale a div to fit a designated height but constrain its aspect ratio. See example: http://jsfiddle.net/ks2jH/121/
Based on my research, the discussion has sort of been had all over the place, including here. Trouble is, the div only resizes & constrains based on the browser's width, and not its height.
The two closest solutions I found work for width:
(1) use the :after pseudo-class http://jsfiddle.net/ks2jH/89/, or
(2) use a blank/transparent png [http://jsfiddle.net/ks2jH/94/].
The idea, of course, is to achieve the same thing without specifying a width because it auto adjusts based on the height.
Thoughts?

A: Did it, using jQuery.
http://jsfiddle.net/5TETn/210/
I was able to modify an aspect ratio script [see:http://jsfiddle.net/Mottie/5TETn/8] by Mottie over at GitHub to achieve what CSS alone couldn't. Much gratitude, kind sir.


text:
Q: Enumerate printing extra line when iterating This is a method that I am writing for a class, for some reason this returns an ONE extra line than intended. The code below is just a testing, the values are not representative.
n = ""

dixoncider = ["a","f","f","g","f"]

for count,ele in enumerate(dixoncider,0):
    if count is len(dixoncider):
        break
    else:
        n = n + str(count) + ": " + str(ele) + "\n"
print(n)

Output which is wrong:
0: a
1: f
2: f
3: g
4: f

A: If you mean the empty line at the end, that's because you are appending a linebreak (\n) after each value, so the last character of your output is going to be that linebreak.
If you could see that character, you have this:
0: a\n
1: f\n
2: f\n
3: g\n
4: f\n

And want this:
0: a\n
1: f\n
2: f\n
3: g\n
4: f   <- No linebreak here.

If you want to get rid of that, you can replace the print(n) with print(n[:-1]) to skip that last character.
Alternatively, just add the \n conditionally within the loop in all but the last iteration.


text:
Q: bs4 BeautifulSoup - can't find what looks like custom tag to save my life I'm admittedly beginner to intermediate with Python and novice to BeautifulSoup/web-scraping.  However, I have successfully built a couple of scrapers.  Normal tags = no problem (e.g., div, a, li, etc)
However, can't find how to reference this tag with .select or .find or attrs="" or anything:
..........
<react type="sad" msgid="25314120" num="2"
..........
I ultimately want what looks like the "num" attribute from whatever this ghastly thing is ... a "react" tag (though I don't think that's a thing?)?

A: .find() works the same way as you'd find other tags such as div, p and a tags. Therefore, we search for the 'react' tag.
react_tag = soup.find('react')

Then, access the num attribute like so.
num_value = react_tag['num']

Should print out:
2

A: As per bs4 Documentation .find('tag') returns the single tag and .find_all('tag') returns list of tags in html.
In your case if there are multiple react tags use this
for reactTag in soup.find_all('react'):
    print(reactTag.get('num'))

To get only first tag use this
print(soup.find('react').get('num'))

A: The user "s n" was spot on!  These are dynamically created javascript which I didn't know anything about, but was pretty easy to figure out.  Using the SeleniumLibrary in Python and a "headless" WebChromeDriver together, you can use Selenium selectors like Xpath and many others to find these tags.


text:
Q: Excel VBA - how to rename sheets based on missing sheets I've just written some code to go through all files within a folder, search the workbooks for sheets of specific names, and then remove all said sheets (see below - I'm sure there are cleaner ways of writing it, but I'm not a dev). What I'm left with are sheets that aren't in order (i.e. sheet1, sheet2, sheet4, sheet5 - missing sheet3). What I want to do is shift the names of all the sheets down based on the sheets missing, so sheet4 in the example above, would become sheet3 etc. But there are also other sheets missing later on in the workbook (i.e sheet40, sheet41, sheet43 - missing sheet 42), which would mean that the later sheets would have to move X number of spaces depending on the number of sheets that are missing.
The only way that I can think of it working, would be to create a list of all the sheets that should be there, i.e. sheet1 through to sheetX, and then reference this list when renaming the existing sheets. Am I even close?
Sub AllFiles()
Dim folderPath As String
Dim filename As String
Dim wb As Workbook

folderPath = "C:\Users\user1\OneDrive\Desktop\something\macro_test\"

If Right(folderPath, 1) <> "\" Then folderPath = folderPath + "\"

filename = Dir(folderPath & "*.xls")
Do While filename <> ""
  Application.ScreenUpdating = False
    Set wb = Workbooks.Open(folderPath & filename)

    'Call a subroutine here to operate on the just-opened workbook
    Call Mymacro

    filename = Dir
Loop

Application.ScreenUpdating = True
End Sub
    Sub Mymacro()
Application.DisplayAlerts = False
For Each Sheet In ActiveWorkbook.Worksheets
     If Sheet.Name = "code_D_1" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_2" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_3" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_4" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_5" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_6" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_7" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_8" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_9" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_10" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_11" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_12" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_13" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_14" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_15" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_16" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_17" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_18" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_19" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_20" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_21" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_22" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_23" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_24" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_25" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_26" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_27" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_28" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_29" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_30" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_31" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_32" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_33" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_34" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_35" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_36" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_37" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_38" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_39" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_40" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_41" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_42" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_43" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_44" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_45" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_46" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_47" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_48" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_49" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_50" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_51" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_52" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_53" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_54" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_55" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_56" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_57" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_58" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_59" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_60" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_61" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_62" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_63" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_64" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_65" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_66" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_67" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_68" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_69" Then
            Sheet.Delete
     ElseIf Sheet.Name = "code_D_70" Then
            Sheet.Delete

     End If
Next Sheet
End Sub

A: Your question has three significant parts. Each one is a worthy question by itself. All three together are a project and not a question to be answered here. The parts are (1) loop through all files in a folder and open all workbooks. (2) delete specified sheets and (3) rename the remaining sheets.
Part 1 you seem to have good control of. Part 3 isn't specified sufficiently to enable an answer and for part 2 a solution is offered below.
Private Sub DeleteSheets(Wb As Workbook)
    ' 270

    Const FileName  As String = "Code_D_"
    Const FirstFile As Integer = 2
    Const LastFile  As Integer = 70

    Dim Fn          As String               ' loop variable: file name
    Dim i           As Integer              ' loop counter: file names

    Application.DisplayAlerts = False
    On Error Resume Next
    For i = FirstFile To LastFile
        Fn = FileName & i
        Wb.Worksheets(Fn).Delete
        If Wb.Worksheets.Count = 1 Then Exit For
    Next i
    Application.DisplayAlerts = False
End Sub

Your question isn't sufficiently specific but the core of this task is to create the sheet names. Your code specifies the core name to be "Code_D_" with a serial number following. If this number isn't consecutive from lowest to highest you might add  exclusions using IF statements just before the Delete instruction. If the pattern I chose isn't the one that's needed than another must be designed once the requirements are known.
You can call the above sub with a procedure like the one below.
Private Sub Test_DeleteSheets()
    ' 270

    Dim Wb      As Workbook

    Set Wb = ThisWorkbook
    DeleteSheets B
End Sub

In fact, your procedure that loops through all the workbooks produces a workbook object by the name of Wb. So, you would only need to integrate the last line of this procedure into your existing one.
Witness that the scope of the first procedure above is Private because it will only be called from another procedure in the same module. I made the calling procedure also Private because it isn't intended to be called from any other location but the module it's in. Your looping procedure probably needs to be Public (by default) but it must be in the same module as the Private procedure it calls.

A: Consider the following code, where I'm trying to keep it as simple as possible:
Sub delRename()
Dim i As Long, Sheet As Variant
Application.DisplayAlerts = False
i = 1
For Each Sheet In ActiveWorkbook.Worksheets
    If Left(Sheet.Name, 7) = "code_D_" Then
        Sheet.Delete
    ElseIf Left(Sheet.Name, 7) = "code_n_" then
        Sheet.Name = "code_n_" & i
        i = i + 1
    End If
Next Sheet
End Sub

It goes through the sheets in the active book, and deletes all the sheets starting with the name "code_D_" by using the Left() function.
For the sheets named "code_n_", it changes the name to be in order.
Note that if the sheets named "code_n_X" are out of order, this might fail, as the name is already taken.
IF that is a concern, you'd have to add a check for this.

A: Delete and Rename Worksheets

*

*You only run your modified AllFiles procedure. The other two are being called by it.

Option Explicit

Sub AllFiles()

    Dim FolderPath As String
    FolderPath = "C:\Users\user1\OneDrive\Desktop\something\macro_test\"
    If Right(FolderPath, 1) <> "\" Then FolderPath = FolderPath & "\"

    Dim fName As String
    Dim wb As Workbook

    fName = Dir(FolderPath & "*.xls")
    Do While fName <> ""
        Set wb = Workbooks.Open(FolderPath & fName)
        DeleteSheetsStartingWith wb, "code_D_"
        RenameSheetsWithIncrement wb, "code_D_"
        'wb.Close SaveChanges:=True
        fName = Dir
    Loop

End Sub

Sub RenameSheetsWithIncrement( _
        ByVal wb As Workbook, _
        ByVal BaseName As String, _
        Optional ByVal FirstIndex As Long = 1)

    If wb Is Nothing Then Exit Sub

    Dim n As Long: n = FirstIndex

    Dim sh As Object

    For Each sh In wb.Sheets
        sh.Name = BaseName & n
        n = n + 1
    Next sh

End Sub

Sub DeleteSheetsStartingWith( _
        ByVal wb As Workbook, _
        ByVal BaseString As String)

    If wb Is Nothing Then Exit Sub

    Dim sh As Object
    Dim shNames() As String
    Dim n As Long
    Dim FoundVisible As Boolean

    For Each sh In wb.Sheets
        If InStr(1, sh.Name, BaseString, vbTextCompare) = 1 Then
            If sh.Visible = xlSheetVeryHidden Then
                sh.Visible = xlSheetVisible
            End If
            n = n + 1
            ReDim Preserve shNames(1 To n)
            shNames(n) = sh.Name
        Else
            If Not FoundVisible Then
                If sh.Visible = xlSheetVisible Then
                    FoundVisible = True
                End If
            End If
        End If
    Next sh

    If FoundVisible Then
        If n > 0 Then
            Application.DisplayAlerts = False
            wb.Worksheets(shNames).Delete
            Application.DisplayAlerts = True
        'Else ' No sheets to delete.
        End If
    'Else ' No visible sheets would be left.
    End If

End Sub

EDIT

*

*The RenameSheetsWithIncrement procedure is not used in the following procedure.

Sub AllFiles()

    Dim FolderPath As String
    FolderPath = "C:\Users\user1\OneDrive\Desktop\something\macro_test\"
    If Right(FolderPath, 1) <> "\" Then FolderPath = FolderPath & "\"

    Dim fName As String
    Dim wb As Workbook
    Dim sh As Object
    Dim n As Long

    fName = Dir(FolderPath & "*.xls")
    Do While fName <> ""
        Set wb = Workbooks.Open(FolderPath & fName)
        DeleteSheetsStartingWith wb, "code_D_"
        n = 0
        For Each sh In wb.Sheets
            If InStr(1, sh.Name, "code_n_", vbTextCompare) = 1 Then
                n = n + 1
                sh.Name = "code_n_" & n
            End If
        Next sh
        'wb.Close SaveChanges:=True
        fName = Dir
    Loop

End Sub


text:
Q: iOS - Facebook Post I'm looking to add functionality that when an event happens on my app, it will post to my facebook timeline. That said, I'm trying to get it to look very similar to how when you post a youtube video to the timeline where there is a thumbnail image to the left and a title and subtitle next to it.
Anyone have any ideas how I can accomplish this?

A: You can't make a post automatically from code, but you can open a system window with predefined message and image attachment.
Sample code:
- (BOOL)postToFacebook:(NSString*)title andDescription:(NSString*)description {
    UIWindow *frontWindow = [[UIApplication sharedApplication] keyWindow];
    UIViewController *vc = [frontWindow rootViewController];

    BOOL success = NO;
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {

        SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
        SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result) {

            if (result == SLComposeViewControllerResultCancelled) {

            } else {

            }

            [controller dismissViewControllerAnimated:YES completion:Nil];
        };
        controller.completionHandler = myBlock;

        [controller setTitle:title];
        [controller setInitialText:description];
        [controller addURL:[NSURL URLWithString:@"http://example.com"]];
        [controller addImage:[UIImage imageNamed:@"sampleImage.png"]];

        [vc presentViewController:controller animated:YES completion:^{

        }];

        success = YES;
    }
    return success;
}

Remember to add two frameworks:

Social.framework
Accounts.framework


text:
Q: Google Cloud Java (No Class Def)
I am having issues when trying to use:
Storage storage = StorageOptions.newBuilder()
                    .setCredentials(ServiceAccountCredentials.fromStream(is))
                    .build()
                    .getService();

in Google Cloud Storage. It says that:
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/threeten/bp/Duration;

On my gradle, I have the following code:
compile (
            [group: 'org.threeten', name: 'threetenbp', version: '1.3.3'],
            [group: 'com.google.cloud', name: 'google-cloud-storage', version: '1.2.1']
    )
    compile('com.google.cloud:google-cloud-storage:1.2.1') {
        exclude group: 'com.google.api-client', module: 'google-api-client-appengine'
    }

I am not sure how to incorporate it into the build. I am currently running Android Lollipop.


text:
Q: new to java - trying to understand: checker |= (1 << val) the following code will check to see if you have any duplicate characters in the string, but i don't understand the if clause:
public static boolean isUniqueChars(String str) {
        int checker = 0;
        for (int i = 0; i < str.length(); ++i) {
            int val = str.charAt(i) - 'a';
            if ((checker & (1 << val)) > 0)
                return false;
            checker |= (1 << val);
        }
        return true;
    }

I tried to look up some references, I am new to bit shifting, all i understand is that  << shifts the binary number left or right. Can you explain to me how checker |= (1 << val) works ?  and that 'if' statement as well.

A: I was also going through this book Cracking the Code Interview and ended up googling for a clear explanations. Finally I understood the concept.
Here is the approach.
Note :

*

*We will assume, in the below code, that the string is only lower case 'a' through 'z'. This will allow us to use just a single int.

*Java integer is of size 32

*Number of lower case alphabets is 26

So we can clearly set 0/1 (true or false) value inside one integer in
  decimal notation.

*It is similar to bool visited[32] .
bool uses 1 byte. Hence you need 32 bytes for storing bool visited[32].

*Bit masking is a space optimization to this.
Lets start :

*

*You are looping through all the characters in the string.

*Suppose on i'th iteration you found character 'b' .
You calculate its 0 based index.

int val = str.charAt(i) - 'a';
For 'b' it is 1. ie 98-97 .

*Now using left shift operator, we find the value of 2^1  => 2.

(1 << val)  //     1<<1   =>  10(binary)
Now let us see how bitwise & works
0 & 0 -> 0
0 & 1 -> 0
1 & 0 -> 0
1 & 1 -> 1

So by the below code :
(checker & (1 << val))

We check if the checker[val] == 0 .
Suppose we had already encountered 'b'.
check = 0000 0000 0000 0000 0000 1000 1000 0010   &
'b'   = 0000 0000 0000 0000 0000 0000 0000 0010
 ----------------------------------------------
result= 0000 0000 0000 0000 0000 0000 0000 0010

ie decimal value = 2  which is >0
So you finally we understood this part.
 if ((checker & (1 << val)) > 0)
                return false;

*Now if 'b' was not encountered, then we set the second bit of checker using bitwise OR.

( This part is called as bit masking. )
OR's Truth table
0 | 0 -> 0
0 | 1 -> 1
1 | 0 -> 1
1 | 1 -> 1

So
check = 0000 0000 0000 0000 0000 1000 1000 0000   |
'b'   = 0000 0000 0000 0000 0000 0000 0000 0010
 ----------------------------------------------
result= 0000 0000 0000 0000 0000 1000 1000 0010

So that simplifies this part:
checker |= (1 << val);  // checker = checker |  (1 << val);

I hope this helped someone !

A: 1 << val is the same as 2 to the degree of val. So it's a number which has
just one one in its binary representation (the one is at position val+1, if you count from
the right side of the number to the left one).
a |= b means basically this: set in a all binary flags/ones from the
binary representation of b (and keep those in a which were already set).

A: The other answers explain the coding operator usages but i don't think they touch the logic behind this code.
Basically the code 1 << val is shifting 1 in a binary number to a unique place for each character for example
a-0001
b-0010
c-0100
d-1000
As you can notice for different characters the place of 1 is different
checker = checker | (1 << val)

checker here is Oring (basically storing 1 at the same place as it was in 1<<val)
So checker knows what characters have already ocurred
Let's say after the occurence of a,b,c,d checker would look like this
0000 1111
finally
if ((checker & (1 << val)) > 0)

checks if that character has already been occured before if yes return false.To explain you should know a little about AND(&) operation.

*

*1&1->1

*0&0->0

*1&0->0

So checker currently have 1 in places whose corresponding characters have already occured the only way the expression inside if statement is true
if a character occurs twice which leads 1&1->1 > 0

A: Seems like I am late to the party, but let me take a stab at the explanation.
First of all the AND i.e & operation:
0 & 0 = 0
1 & 0 = 0
0 & 1 = 0
1 & 1 = 1

So basically, if you are given a bit, and you want to find out if its 1 or 0, you just & it with a 1. If the result is 1 then you had a 1, else you had 0. We will use this property of the & below.
The OR i.e | operation
0 | 0 = 0
1 | 0 = 1
0 | 1 = 1
1 | 1 = 1

So basically, if you are given a bit, and you want to do something to it so that the output is always 1, then you do an | 1 with it.
Now, In Java the type int is 4 bytes i.e. 32 bits. Thus we can use an int itself as a data-structure to store 32 states or booleans in simpler terms, since a bit can either be 0 or 1 i.e false or true. Since we assume that our string is composed of only lower case characters, we have enough space inside our int to store a boolean for each of the 26 chars!
So first we initialize our data-structure that we call checker to 0 which is nothing but 32 zeros: 0000000000000000000000.
So far so good?
Now we go through our string, for each character, first we get an integer representation of the character.
int val = str.charAt(i) - 'a';

We subtract a from it because we want our integer to be 0 based. So if vals:
a = 0 i.e. `0000000000000000000000`
b = 1 i.e. `0000000000000000000001`
c = 2 i.e. `0000000000000000000010`
d = 4 i.e. `0000000000000000000100`

Now as seen above, a is 32 zeros, but rest of the characters have a single 1 and 31 zeros. So when we use these characters, we left shift each of them by 1, i.e. (1 << val), so each of them have a single 1 bit, and 31 zero bits:
a = 1 i.e. `0000000000000000000001`
b = 2 i.e. `0000000000000000000010`
c = 4 i.e. `0000000000000000000100`
d = 8 i.e. `0000000000000000001000`

We are done with the setup. Now we do 2 things:

*

*First assume all characters are different. For every char we encounter, we want our datastructure i.e. checker to have 1 for that char. So we use our OR property descrived above to generate a 1 in our datastructure, and hence we do:
checker = checker | (1 << val);

Thus checker stores 1 for every character we encounter.

*Now we come to the part where characters can repeate. So before we do step 1, we want to make sure that the checker already does not have a 1 at the position corresponding to the current character. So we check the value of
checker & (1 << val)

So with help of the AND property described above, if we get a 1 from this operation, then checker already had a 1 at that position, which means we must have encountered this character before. So we immediately return false.
That's it. If all our & checks return 0, we finally return true, meaning there were no character repititions.

A: This sets the 'val'th bit from the right to 1.
1 << val is a 1 shifted left val times. The rest of the value is 0.
The line is equivalent to checker = checker | (1 << val). Or-ing with a 0 bit does nothing, since x | 0 == x. But or-ing with 1 always results in 1. So this turns (only) that bit on.
The if statement is similar, in that it is checking to see if the bit is already on. The mask value 1 << val is all 0s except for a single 1. And-ing with 0 always produces 0, so most bits in the result are 0. x & 1 == x, so this will be non-zero only if that bit at val is not 0.

A: checker |= (1 << val) is the same as checker = checker | (1 << val).
<< is left bit shift as you said. 1 << val means it's a 1 shifted val digits left.
Example: 1 << 4 is 1000. A left bit shift is the same as multiply by 2. 4 left bit shifts are 4 times 1 multiplied by 2.
1 * 2 = 2 (1)
2 * 2 = 4 (2)
4 * 2 = 8 (3)
8 * 2 = 16 = (4)

| operator is bitwise or. It's like normal or for one bit. If we have more than one bit you do the or operation for every bit.
Example:
110 | 011 = 111

You can use that for setting flags (make a bit 1).
The if condition is similar to that, but has the & operator, which is bitwise and. It is mainly used to mask a binary number.
Example:
110 | 100 = 100

So your code just checks if the bit at place val is 1, then return false, otherwise set the bit at place val to 1.

A: It means do a binary OR on the values checker and (1 << val) (which is 1, left shifted val times) and save the newly created value in checker.
Left Shift (<<)
Shift all the binary digits left one space.  Effectively raise the number to 2 to the power of val or multiply the number by 2 val times.
Bitwise OR (|)
In each binary character of both left and right values, if there is a 1 in the place of either of the two numbers then keep it.
Augmented Assignment (|=)
Do the operation (in this case bitwise OR) and assign the value to the left hand variable.  This works with many operators such as:-

*

*a += b, add a to b and save the new value in a.

*a *= b, multiply a by b and save the new value in a.

A: Bitwise shift works as follows:
Example: a=15 (bit representation : 0000 1111)
For operation: a<<2
It will rotate bit representation by 2 positions in left direction.
So a<<2 is 0011 1100 = 0*2^7+0*2^6+1*2^5+1*2^4+1*2^3+1*2^2+0*2^1+0*2^0 = 1*2^5+1*2^4+1*2^3+1*2^2 = 32+18+8+4=60
hence a<<2 = 60
Now:
checker & (1<<val),
will always be greater then 0, if 1 is already present at 1<<val position.
Hence we can return false.
Else we will assign checker value of 1 at 1

A: I've been working on the algorithm and here's what I noticed that would also work. It makes the algorithm easier to understand when you exercise it by hand:
public static boolean isUniqueChars(String str) {
    if (str.length() > 26) { // Only 26 characters
        return false;
    }
    int checker = 0;
    for (int i = 0; i < str.length(); i++) {
        int val = str.charAt(i) - 'a';
        int newValue = Math.pow(2, val) // int newValue = 1 << val
        if ((checker & newValue) > 0) return false;
        checker += newValue // checker |= newValue
    }
    return true;

When we get the value of val (0-25), we could either shift 1 to the right by the value of val, or we could use the power of 2s.
Also, for as long as the ((checker & newValue) > 0) is false, the new checker value is generated when we sum up the old checker value and the newValue.

A: public static boolean isUniqueChars(String str) {
    int checker = 0;
    for (int i = 0; i < str.length(); ++i) {
        int val = str.charAt(i) - 'a';
        if ((checker & (1 << val)) > 0)
            return false;
        checker |= (1 << val);
    }
    return true;
}

1 << val uses right shift operator. Let us say we have character z. ASCII code of z is 122. a-z is 97- 122 = 25. If we multiply 1*(2)^25 = 33554432. Binary of that is 10000000000000000000000000
if checker has 1 on its 26th bit then this statement  if ((checker & (1 << val)) > 0) would be true  and isUniqueChar would return false.
otherwise checker would turn it's 26th bit on. |= operator(bitwise or and assignment operator) does checker bitwise OR 10000000000000000000000000. Assigns the result to checker.


text:
Q: using pytorch for Gradient Descent
my code:

import torch
import torch.nn as nn
import torch.nn.functional as F

class MultivariateLinearRegressionModel(nn.Module):
  def __init__(self):
    super().__init__()
    self.linear = nn.Linear(3,1)

  def forward(self,x):
# print(1)
    return self.linear(x)

x_train = torch.FloatTensor([[73,80,75],
                             [93,88,93],
                             [89,91,90],
                             [96,98,100],
                             [73,66,70]])
y_train = torch.FloatTensor([[152],[185],[180],[196], [142]])

model = MultivariateLinearRegressionModel()

optimizer = torch.optim.SGD(model.parameters(), lr = 1e-5)
# print(222)
ep = 2000
for epoch in range(ep+1):
   hypothesis = model(x_train)

   cost = F.mse_loss(hypothesis, y_train)
   if epoch % 100 == 0:
     print('Epoch {:4d}/{} Cost: {:.6f}'.format(
        epoch, 2000, cost.item()
    ))
   optimizer.zero_grad()
   cost.backward()
   optimizer.step()

my problem:

this code is my own MultivariateLinearRegressionModel.
But in the for loop
hypothesis = model(x_train)  why this code is same with
hypothesis = model.forward(x_train) ??
i don't know why this 2 code statement is same.
is this a python grammar??

A: Because your model MultivariateLinearRegressionModel is inherited from nn.Module so when ever you call model(x_train), it will automatically execute the forward function which is defined in MultivariateLinearRegressionModel class.
That's why model(x_train) and model.forward(x_train) give the same result.


text:
Q: Handle webview when offline I just started creating an android app with a WebView.
I have loaded urls successfully, but I would like to display cached pages & a popup dialog that says, "No Internet Connection" when the user does not have an internet connection.
Please help me with this code.

A: Breaking this down, you need to different things:

*

*Detecting if the user has an internet connection

*Displaying a pop up dialog

Here are two helpful posts that describe the above tasks:

*

*Detect whether there is an Internet connection available on Android

*How do I display an alert dialog on Android?
Hope this helps, good luck :-)