text:
Q: How to draw linestring from consecutive points of array in openlayers I am trying to draw LineString in openlayers with consecutive Points to give it a feel of animation like it is drawing from start to end.
I tried to achieve it by following  this example. All references of OL2 are converted to OpenLayers 5, but still drawing should happen one point followed by next for entire array and not at once.
Find my code with current output here - my code.
[For reference] This is I am trying to achieve Snake animation for leaflet.

A: Using only the vertices of a linestring doesn't give a smooth animation.  You can see that in the OpenLayers example https://openlayers.org/en/v4.6.5/examples/feature-move-animation.html where the marker moves much faster over the straight sections.  If you need smooth movement along straight lines as in the OpenLayers 2 example you need to use .getCoordinateAt() to calculate where on the line you should be at any time.  Here's a demo based on the marker animation example but also calculating positions between vertices showing the linestring from the snake example.  You can also draw you own straight lines and watch them animate smoothly.

var style = new ol.style.Style({
  stroke: new ol.style.Stroke({
width: 4,
color: 'red'
  })
});

var raster = new ol.layer.Tile({
  source:  new ol.source.OSM()
});

var vector = new ol.layer.Vector({
  source: new ol.source.Vector(),
  style: style
});

var map = new ol.Map({
  layers: [raster, vector],
  target: 'map',
  view: new ol.View()
});

var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://raw.githubusercontent.com/IvanSanchez/Leaflet.Polyline.SnakeAnim/master/route.js');
xhr.onload = function() {
  // read the route coordinates
  eval(xhr.responseText);
  // reverse the route
  var geom = new ol.geom.LineString(route.reverse());
  // change Lat/Lon to Lon/Lat
  geom.applyTransform(function(c){ return c.reverse(); });
  geom.transform('EPSG:4326', map.getView().getProjection());
  map.getView().fit(geom.getExtent(), { size: map.getSize() });
  var snake = new ol.Feature();
  vector.getSource().addFeature(snake);
  animate_line(snake, geom, 30000);
}
xhr.send();

function animate_line(feature, linestring, duration) {

  var length = linestring.getLength();
  var length_shown = 0;

  var coords = linestring.getCoordinates();
  var coords_shown = [coords[0], coords[0]];
  var geom_shown = new ol.geom.LineString(coords_shown);
  feature.setGeometry(geom_shown);

  var coordcount = 1;
  var start = new Date().getTime();
  var listenerKey = map.on('postcompose', animate);

  function animate() {

var elapsed = new Date().getTime() - start;
var toAdd = length*elapsed/duration - length_shown;
var point = linestring.getCoordinateAt(Math.min(elapsed/duration, 1));

// restart from last intermediate point and remove it
var newPart = new ol.geom.LineString(coords_shown.slice(-1));
coords_shown.pop();

// add vertices until required length exceeded
while (coordcount < coords.length && newPart.getLength() <= toAdd) {
  newPart.appendCoordinate(coords[coordcount]);
  coords_shown.push(coords[coordcount]);
  coordcount++;
}

// replace overrun vertex with intermediate point
coords_shown.pop();
coordcount--;
coords_shown.push(point);

geom_shown.setCoordinates(coords_shown);
length_shown += toAdd;

if (elapsed > duration) {
  ol.Observable.unByKey(listenerKey);
}
map.render();

  }

}

draw = new ol.interaction.Draw({
  source: vector.getSource(),
  type: 'LineString'
});

draw.on('drawend',function(evt){
  geom = evt.feature.getGeometry();
  evt.feature.setGeometry(undefined);
  animate_line(evt.feature, geom, 6000);
});
map.addInteraction(draw);
html, body, .map {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}
<link href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css" rel="stylesheet" />

A: Your for loop
for(i=0;i<path.length;) {
    drawAnimatedLine(/*snip*/);
}

starts the animation for all points basically at the same time without waiting. You'll need to wait until the animation of the first line is finished before starting the next segment. Your drawAnimation function has a 6th parameter fn to provide it with a function pointer of a function to call when drawing is finished.
Here's a quick an dirty version where I rewrote your for loop to demonstrate, what I mean. https://jsbin.com/lanoxojugi/edit?js,output


text:
Q: NotYetImplemented error ng2-charts Getting an error with message "NotYetImplemented" from utils.js .
I get the error while using nodejs server, what this exact error means?
When I'm using "ng serve" there is no such error.
I'm using line chart from ng2-charts module.
Full Stack Trace:
ERROR Error: NotYetImplemented
    at HTMLCanvasElement.exports.nyi (/home/project15/web/node_modules/domino/lib/utils.js:41:9)
    at BaseChartDirective.ngOnInit (/home/project15/web/node_modules/ng2-charts/charts/charts.js:24:47)
    at checkAndUpdateDirectiveInline (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:12439:19)
    at checkAndUpdateNodeInline (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:13966:20)
    at checkAndUpdateNode (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:13909:16)
    at prodCheckAndUpdateNode (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:14633:5)
    at Object.updateDirectives (/home/project15/web/dist-server/main.bundle.js:1:51133)
    at Object.updateDirectives (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:14355:29)
    at checkAndUpdateView (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:13875:14)
    at callViewAction (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:14226:21)

Using the following:
NodeJS: 9.3.0
Angular: 5.1.2
OS: linux x64
"chart.js": "^2.7.1"
"ng2-charts": "^1.6.0"
EDIT :
setup for node server:
https://medium.com/@cyrilletuzi/angular-server-side-rendering-in-node-with-express-universal-engine-dce21933ddce
Error is visible in the terminal after accessing the web url, while running the command
node server.js

A: I had the same issue and solve it as below:
1- Create a boolean in your component .ts file and set its value like this
import { Inject, PLATFORM_ID } from "@angular/core";
import { isPlatformBrowser } from "@angular/common";

isBrowser: boolean;

constructor(@Inject(PLATFORM_ID) private platformId: unknown) {}

ngOnInit(): void {
    this.isBrowser = isPlatformBrowser(this.platformId);
}

2- Then in your HTML file use the ng2-charts HTML tag as below
<canvas *ngIf="isBrowser"
        baseChart
        ...
        ...
        ... >
</canvas>

redpajama_set_name: RedPajamaStackExchange


text:
Q: Difference between a trigger and a transaction I'm implementing movie rating service, so I'm considering about using triggers or transactions.
What I'm considering is inserting movie information into a movie_list and to insert the genre of that movie into movie_genre_list.
In this case, my thinking is to write a trigger to insert the genre when the movie information is inserted.
But, I don't know whether a trigger or a transaction is right for this case. What should I do?

A: Comparing TRIGGERs and TRANSACTIONs is like comparing apples and oranges! No, wait, it's not, because apples and oranges are similar - they are both fruit and can both be eaten. It's more like chalk and cheese (English expression)!

*

*Transactions are for grouping actions into one unit of work which either succeeds or fails in its entirety!

*Triggers are (normally) for performing (procdural/business logic) code when an event (normally an INSERT, UPDATE or DELETE on a particular table) occurs in the database.
TRANSACTIONs.
These units of work are treated in a coherent and reliable way independent of other transactions.
From Wikipedia:

*

*To provide reliable units of work that allow correct recovery from failures and keep a database consistent even in cases of system
  failure, when  execution stops (completely or partially) and many
  operations upon a database  remain uncompleted, with unclear status.

*To provide isolation between programs accessing a database concurrently. If this isolation is not provided, the programs'
  outcomes are possibly  erroneous.

Note the use of the word "isolation" - this is one of the criteria for the "ACID" test. ACID in this context corresponds to both a play on words in English and a set of properties of database transactions that are considered highly desirable - these are: Atomicicty, Consistency, Isolation and Durablility.
The classic example of this is in banking. Say you want to pay your credit card bill of €100 by transferring money from your current account. So, it's important for both you and the bank that this "transaction" should occur as one single consistent unit of work. Otherwise, either you (money leaves your current account but doesn't get to the CC account), or the bank (your CC get credited but your current account isn't debited) is out of pocket.
So, in SQL, what you would do is:
BEGIN TRANSACTION;
UPDATE current_account ca SET ca.balance = ca.balance - 100 WHERE ca.cust_name = 'Haram';
UPDATE      CC_account cc SET cc.balance = cc.balance + 100 WHERE cc.cust_name = 'Haram';
COMMIT;  -- definitively perform the work.

If any of the steps fail (e.g. the balance in the current_account is insufficient), all of the work of the transaction will be rolled back - thus ensuring consistency.
Final point - if only it were all that simple! :-) There are (at least) four complicating factors:
1) Different isolation levels. This is beyond the scope of this answer - check out the Wiki and use your search engine of choice - there's loads of material out there, and
2) Different implementations by vendors - you'll have to look at your own system(s)' documentation for this, and
3) There are such things as nested TRANSACTIONs and SAVEPOINTs - again, this is getting beyond the scope of this answer - check your documentation, and
4) Some database engines support Transactional DDL (Data Definition Language) and some (notably MySQL) don't.
TRIGGERs.
A database TRIGGER on the other hand is a different animal altogether! A TRIGGERis an action (coded by the developer) which occurs in response to events on a table (again, there are complications which I won't go into here - check the Wiki and/or use your search engine). In the vast majority of cases, the event in question is an INSERT, an UPDATE or a DELETE on a table.
A rather nice analogy can be found here. An action on a database is compared to a row of dominoes - you knock over the first one and rest come tumbling down in a chain reaction. This is similar to a TRIGGER which will cause further events on other tables and so on!
It is best, however, not to take the analogy too far - you want to avoid doing complex multi-table chained updates in so far as is possible - KISS. You can see how circular references (TRIGGER on  A UPDATEs B which in turn UPDATEs A...) might be disastrous!
From here:
You can use triggers to perform the following actions, as well as others that are not found in this list:

*

*Create an audit trail of activity in the database. For example, you can track updates to the orders table by updating corroborating
  information to an audit table.

*Implement a business rule. For example, you can determine when an order exceeds a customer's credit limit and display a message to that
  effect.

*Derive additional data that is not available within a table or within the database. For example, when an update occurs to the
  quantity column of the items table, you can calculate the
  corresponding adjustment to the total_price column.

(The link also mentions using them to enforce DRI (Declarative Referential Integrity) - I disagree - see end of answer).
A typical (vendor syntax varies considerably here - check your system's documentation) TRIGGER skeleton (example taken from here) would be:
CREATE
  TRIGGER `event_name` BEFORE/AFTER INSERT/UPDATE/DELETE
  ON `database`.`table`
  FOR EACH ROW BEGIN
  -- trigger body
  -- this code is applied to every
  -- inserted/updated/deleted row
END;

and the body might look something like this:
IF NEW.deleted THEN
  SET @changetype = 'DELETE';
ELSE
  SET @changetype = 'NEW';
END IF;
INSERT INTO audit (blog_id, changetype) VALUES (NEW.id, @changetype);

This trigger is INSERTING a record into a table called audit with the id from the audited table (called blog in this case) and also recording whether the action was a DELETEor an INSERT. You could also have TIMESTAMP logic in there as well to keep track of when the action took place. Furthermore, you could add in user_name logic to audit who INSERTed/DELETEd what and when. The possibilities are endless.
Summary.
So, to sum up, a TRANSACTION groups a set of statements into a logical unit and a TRIGGER permits the inclusion of logic beyond the scope of SQL (complex business rules) in the database itself.
One thing I found tricky at the beginning was the idea that (if no TRANSACTION is specified), the server will set up an implicit transaction on your behalf and COMMIT after each statement.
For example, here is the default behaviour of the MySQL server:
mysql> show variables like '%COMMIT%';
+-----------------------------------------+-------+
| Variable_name                           | Value |
+-----------------------------------------+-------+
| autocommit                              | ON    |

Issue the command
mysql> SET autocommit = OFF;
Query OK, 0 rows affected (0.00 sec)

Now, you can experiment with what happens if you issue several commands in a row and issue a COMMIT and also when you exit without COMMITting.
Better yet, you can experiment with isolation levels
mysql> show variables like '%ISOL%';
+-----------------------+-----------------+
| Variable_name         | Value           |
+-----------------------+-----------------+
| transaction_isolation | REPEATABLE-READ |
| tx_isolation          | REPEATABLE-READ |
+-----------------------+-----------------+

and then open different terminal sessions and see what happens to record visibility under different conditions.
Very last word: It looks to me that you are on the beginning of your database journey. Even though I have used MySQL for examples here, I would strongly (strongly) urge you to use PostgreSQL whenever possible - it is a vastly superior database server to MySQL and much more standards compliant to boot! Try and use the command line client whenever possible - can be fiddly at the beginning, but much more powerful and worth it in the long run!
Very very last word ( :-) ) - keep reading and get some good texts and study them! p.s. Congratulations on your first questions on dba.stackexchange!
Oooops - almost forgot to answer the question asked!
You can either (if you have one and only one (main) genre per film do this:

*

*create a genre table and have a FOREIGN KEY on your movie table pointing to the genre_name field (fiddle1),

Or (if you wish to have more than one genre per film - a far more interesting and realistic scenario) do this:

*

*create a genre and movie table as above, but also have a movie_genre joining table (or Associative Entity) between the two (fiddle2).


text:
Q: To change the background color of only a particular button out of multiple buttons in angularjs I have made a game that has 50 buttons. You have three tries to click on a button. If you clicked the correct one, that is the 25th one you win the game!. I want the only the button no.25 background color to change on click . How to do that. My program changes the color of all the buttons when the 25th button is clicked.

   <title>BlueBox</title>

                <button ng-style="{'color':x.color}" ng-class="bgcolor" ng-
    click="pressed($index)" type="button">
                    Button {{x.Id}}
          </button>

A: Just add class bgcolor to only 25th button and set win flag like ng-class="{bgcolor: ($index==24 && win)}" so it will solved your issue.
if (index == 25) {
          $scope.win = true;

Currently you are adding bgcolor to all button which is wrong.

angular.module("Bluebox", [])
  .controller("BoxController", ["$scope", "$log", function($scope, $log) {

    var limit = 50;
    var arr = []; // populate in your controller
    for (var index = 0; index <= limit; index++) {

      arr.push({
        "color": "green",
        "Id": index
      })
    }

    $scope.boxes = arr;
    $scope.tries = 3;
    $scope.win = false;

    $scope.pressed = function(index, event) {

      if ($scope.tries <= 3 & $scope.tries != 0) {
        $log.log("Button " + (index) + " was pressed");
        $scope.tries = $scope.tries - 1;

        if (index == 25) {
          $scope.win = true;
          $scope.bgcolor = "red";
          $log.log("you won the game");
          $scope.tries = 0;
          angular.element(event.currentTarget).addClass('red')
        }

        if ($scope.tries == 0 && index != 25) {
          $log.log("you lost the game");
        }

      } else {
        $log.log("Please restart the game");
      }
    }

  }])
.red {
  background-color: brown;
}

  <title>BlueBox</title>

         <button ng-style="{'color':x.color}" ng-class="{bgcolor: ($index == 24 && win)}"

         ng-click="pressed($index, $event)"   type="button">
                        Button {{x.Id}}
              </button>

     <button ng-style="{'color':x.color}" ng-class="{bgcolor: $index==24}" ng-click="pressed($index)" type="button"> Button {{x.Id}}
     </button>

A: Well, this is how I would have done it. You can just catch the clicked event and add style/class to that particular clicked element.
I like JS so this can be achieved in the same fashion.
angular.element() lets you select the element on your DOM and you can pass any reference to angular.element(reference) to select the DOM element. For example event.currentTarget in this case gives you the reference of clicked element and you can use traditional JS/Jquery on it to do other things.
Hope this helps
Thanks

angular.module("Bluebox",[])
           .controller("BoxController",
    ["$scope","$log","$timeout",function($scope,$log,$timeout){

             var limit = 50;
  var arr = []; // populate in your controller
  for (var index = 0; index <= limit; index++) {

    arr.push({
     "color":"green",
      "Id": index
      })
   }

  $scope.boxes = arr;
  $scope.tries=3;

  $scope.won = false;
  $scope.pressed = function(index,event){

    if($scope.tries<=3 & $scope.tries!=0){
    $log.log("Button "+(index)+" was pressed");
   $scope.tries=$scope.tries-1;

    if(index==25){

        $scope.bgcolor="red";
        $log.log("you won the game");
        $scope.tries=0;
        $scope.won = true;
        angular.element(event.currentTarget).addClass('red')
    }

    if($scope.tries==0 && index!=25){
        $log.log("you lost the game");
     }

     }

     else{
         $log.log("Please restart the game");
     }
    }

    }])
.red{
         background-color:brown;
     }

   <title>BlueBox</title>

     <button ng-style="{'color':x.color}"

     ng-click="pressed($index, $event)"   type="button">
                    Button {{x.Id}}
          </button>

You won


text:
Q: Automorphisms of $\mathbb{C}(X)$ and their fixed field I'm stuck at the very beginning of an exercise I have to do for my algebra class.
We're looking at the field of $\mathbb{C}(X)$ and it's automorphisms.
Let $a \in \mathbb{C}^*$, $ b \in \mathbb{C} $ and $ \sigma : \mathbb{C}(X) \to \mathbb{C}(X) $ given by $ X \mapsto aX + b$.
a) Explain why $\sigma$ is a field-automorphism.
I wrote that $\sigma$ is a coordinate transform in $\mathbb{C}(X)$ and therefore must be a field-automorphism.
Is this explanation correct?
b) Let $ H = \langle \sigma \rangle \subseteq Aut(\mathbb{C}(X)) $. Find the field fixed by $H$, i.e. $\mathbb{C}(X)^H$.
I know that $ \mathbb{C}(X)^H = \{ f \in \mathbb{C}(X) \; | \; \tau(f) = f \;\; \forall \tau \in H \} $ but I did not really get around how to decode this automorphism into something I can use to find the field fixed.
Any hints how to find it would be greatly appreciated.
Edit:
Since I am still stuck I wanted to add some thoughts of me. I'm working on b).
I tried some cases for $a$, $a=1$ is obvious.
$a = -1$:
When we only take a look at monoms $f(X) = X^i$ we have to conclude that $\sigma^i(f) = f$ for $i \in \mathbb{N}$ holds only for even exponents of $X^i$ and $\mathbb{C}(X)^H = \mathbb{C}(X^2)$. (Where we write $\sigma^i$ for $\sigma(\sigma(...))$.)
$a = i$:
With the same argumentation we see that $\mathbb{C}(X)^H = \mathbb{C}(X^4)$.
I now assumed that: $|a| = 1$ (hence $a$ is a root of unity) or else the field fixed would only consist of $\mathbb{C}$. I came up with the explanation, that when $|a| \not = 1$ you may take a look at any monom $X^j$. When you evaluate $\sigma$ $i$-times on $X^j$ you get: $\sigma^i(X^j) = a^{i+j} X$.
If $|a| > 1 $ or $|a| < 1$ you are either making the coefficient very large or close to zero by evaluation $\sigma$ many times. It can't hold that $\sigma^i(f) = f$ therefore.
What I couldn't find out if there are other fixed fields (besides $a = -i$).
As  Jyrki Lahtonen pointed out, there are solutions where $ b \not = 0$. For example $ X \mapsto -X - 1$ and $ -X(X+1) $ is invariant under $\sigma$.
I generalized that a bit and came up with
$$ \sigma : X \mapsto -X - b \\
\sigma(-X(b+X)) =  -(-X-b)(b - X + b) = -X(b+X) \\
\text{And clearly: } ord \; \sigma = 2
$$
For $b=1$ The field fixed for this is $ \mathbb{C}(X^2+X) $.
What I'm now trying to do is proof that:
$$ \mathbb{C} \subsetneq \mathbb{C}(X)^H \implies ord \; \sigma \lt \infty $$
The argument for that lies within the answer of Michael Zieve though I couldn't figure it out until now: Intersection of two subfields of the Rational Function Field in characteristic $0$

A: About a), you should probably say better that $\sigma$ is an invertible coordinate transformation, but why not just checking the axiomatic definition of field automorphism?
About b), let $f\in\Bbb C(X)$ such that $f(aX+b)=f(X)$. Recall that $f$ is a quotient of polynomials. What can we say about the set of zeroes and poles of $f$?


text:
Q: Iterate and filter a list using Java streams instead of for-each loop In a kind of chat with a chatbot that I'm implementing, I have a List of Conversation and every Conversation has a List of Messages. I want to add those conversations that its last message is not a chatbot message and is not viewed by the user to a List of Conversations. To do that I'm coding it as bellow:
List<ConversationDto> conversationsToBeSent = new ArrayList<>();

for (ConversationDto conversation : super.allConversations) {
    if (conversation.getMessages() != null) {
        if (conversation.getMessages().get(0).getMessageType().getId() != MessageTypeEnum.CHATBOT.getValue()
                && conversation.getMessages().get(0).getToViewedAt() == null) {
            conversationsToBeSent.add(conversation);
        }
    }

}

This is working.
The question is how can I code that using Lambda and stream instead of for each.

A: Your problem is a classical "Filter a collection" task.
This is what the Stream.filter() method does.
A code block:
List<Item> newList = new ArrayList<>();
for (Item item : collection) {
    if (predicate(item)) {
        newList.add(item);
    }
}

can generally be converted to:
List<Item> newList =
    collection
        .stream()
        .filter(item -> predicate(item))
        .collect(Collectors.toList());

In your case, the code transforms as follows.
Note the comments in the following code block for explanations:
List<ConversationDto> conversationsToBeSent = super.allConversations // Start with the original list
    .stream() // Get a stream of list items
    .filter(conversation -> // Filter the list items
        conversation.getMessages() != null
        && !conversation.getMessages().isEmpty() // YOU PROBABLY WANT THIS CHECK AS WELL!
        && conversation.getMessages().get(0).getMessageType().getId() != MessageTypeEnum.CHATBOT.getValue()
        && conversation.getMessages().get(0).getToViewedAt() == null
    )
    .collect(Collectors.toList()); // Collect the stream items to a new list

A: To use stream on a list, just do super.allConversations.stream()
Then if you want to select only some elements, you can use the filter method like in the code below:
super.allConversations.stream().filter(
  conversation ->
    conversion != null &&
    conversation.getMessages().get(0).getMessageType().getId() != MessageTypeEnum.CHATBOT.getValue() &&
    conversation.getMessages().get(0).getToViewedAt() == null
);


text:
Q: How can I make a linux module load another module? I have the task to program one module to store some data and another module to control the first one, been able to load/unload it from the code.
I'm and kernel programming ignorant but i've tried hard to find the way to do this. Is there any function to do this?
Thank you very much in advance

A: Use request_module to load a module

A: You usually wouldn't make one module load another, instead using the kernel's dependency system to load your prerequisites on demand. otherwise use request_module as suggested by Matias Valdenegro.


text:
Q: can not get required gain with gilbert cell on ltspice I designed a very basic Gilbert cell using BJT's. The function is a DSB modulator where one input is a 2.5mvpp sine wave, and the other a 5vpp square wave. The current at the bottom is a simple current source with a biasing emitter resistor. I tried changing the current from 10 to 200 mA and also the two resistors at the top to no avail of making the modulated signal higher than 25uv. What is the problem? The gain should be merely 10.

A: You "blindly" connected square wave sources (V3, V4) to the inputs.
The problem is that you do not define a proper commonmode level. I would try to make the commonmode voltage of V3 something around +10 V and for V3 use +5 V.
ALWAYS first make the DC solution in order (check the biasing of each transistor) before applying signals to it. Applying proper biasing is essential and a step that you missed!
Here's how I make a differential signal with a properly defined commonmode level:

simulate this circuit – Schematic created using CircuitLab
Vcmm sets the commonmode voltage
Vin is the input voltage, note that if I want a 1 Vpeak-peak differential signal that I need to give Vin an amplitude of 0.5 V (not 1 V)


text:
Q: Program to update all 3rd party software packages? Is there a program that can check for updated versions of various application packages? I currently have 123 different packages and its a pain to keep them up to date manually. Mainly what I want from it:

*

*Ability to update all packages from one program and not use several programs in conjunction.

*Ability to choose where each package gets downloaded(i have 4 different folders for them).

*Ability to only check for updates but not download anything.

*Ability to download to a file(so when a filename is pre-set then the package is downloaded into it and i save the trouble of renaming via batch files etc.)

*Preferably open source,lightweight on resources and regularly maintained and updated(please don't offer dead projects)
Currently I have found these that could potentially fit my demands but I haven't tested them yet very much.
http://www.kcsoftwares.com/?sumo
http://ketarin.canneverbe.com/
My system is Windows 7 x64.

A: Does Appsnap work for you ?

A: Ok.Ketarin is the one.
I have managed to do everything i wanted and can imagine.Very happy with it.
I am almost finishing up the extremely long configuration and testing process.
It has been about week and several hours of continious work each day, but this is waht i've done:
*96 packages(reduced from the original 123 since i deleted the unnessesasy ones).
*17 packages are marked as Manual since updating them is technicly very complex.
*21 packages that are packed as .zip.I have written special extraction and rename commands for each of those to be run after one of them is updated and is downloaded.
*Rest are .msi/.exe packages and the install command for these after download is much simpler.
*Version numbers are extracted from official wesites(during update check) and placed in a custom column for easy overview.
*Files are saved with the latest version number and naming scheme.This fully accounts for any changes that might occur(if version number changes on the website and Ketarin detects that the remote package date and/or time has changed then the file is downloaded,given the latest version number and executed for install.
It has taken a long time to configure but since there wont be need for any major rewrite in the forseeable future then i'm pretty sure that within months i have saved all that time i spent on configuring and then some.
If you need any help with Ketarin then let me know and i see if i can help you.I'm still learning new this as i go along but so far it seems like a very flexible program that can be suited to any need.


text:
Q: MySQL Filter Query by Date Range I would like to create a query that filters records in a table using a date range.

*

*The table has a "date" column that follows MM/DD/YYYY format.

I have this existing function that filters the records by "type" automatically, but how can I attach arguments to this function that uses a date range to only show records that fall within the range?
Say, for example, find a record that falls between 04/01/2015 and 04/30/2015.
public function getByType() {

    $query = $this->pdo->prepare("SELECT * FROM `" . $this->table . "` WHERE type='hod'");
    $query->execute();

      if ($query->rowCount() == 0) return null;

}

Thank you!

A: You are storing dates with wrong data types. Storing dates as varchar string is like inviting evil to your application. You should always store dates with mysql native date data types date,datetime,timestamp etc. with the date as Y-m-d format
However in the current case you can use str_to_date function to get the job done, but in long run you should think about correcting these.
So here how it works
mysql> select str_to_date('04/01/2015','%m/%d/%Y') as d ;
+------------+
| d          |
+------------+
| 2015-04-01 |
+------------+

So the query you could use as
SELECT * FROM table_name
WHERE
type='hod'
and str_to_date(date,'%m/%d/%Y') between str_to_date('04/01/2015','%m/%d/%Y')
and str_to_date('04/30/2015','%m/%d/%Y')


text:
Q: Android when to upload to server I have an application that stores the user's interest kind of like StumbleUpon. I present the user's interest to them in an List Activity. If they decide to change an interest, when should I upload the changes?
Should I upload after the change, so when a checkbox changes, or should I upload in bulk after they exit out of the activity?
EDIT:
I have other data that takes the user's interest, so having the most accurate representation of the user's interest is very important. And because there is an accompanying website that the user is also able to change interests, I need to take into consideration which changes take precedence. So I need something speedy, but I also don't want to kill the user's battery.

A: Updating for each checkbox would be more accurate, but updating in bulk would be more battery-friendly. Either way, you should make sure you are doing the uploads asynchronously, as to not block the UI.
I assume that the ListActivity to change interests is a sort of preference screen? If so, then under normal conditions, a user wouldn't need their interests to update immediately after they check a box. They would only need them to update before the next time they use them. The transition from the preferences screen back to the main activity should give enough time for the updates to push to the server.


text:
Q: GSL-GNU in Visual studio I have visual studio 2008, I want to integrate GSL library in my project, kindly give me some guidelines so that I can make it possible.
I have added the GSL library but the following error come.
Error   1   error LNK2028: unresolved token (0A000010) "extern "C" void __cdecl gsl_matrix_set(struct gsl_matrix *,unsigned int,unsigned int,double)" (?gsl_matrix_set@@$$J0YAXPAUgsl_matrix@@IIN@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)

Error   2   error LNK2028: unresolved token (0A000011) "extern "C" struct gsl_matrix * __cdecl gsl_matrix_alloc(unsigned int,unsigned int)" (?gsl_matrix_alloc@@$$J0YAPAUgsl_matrix@@II@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)

Error   3   error LNK2028: unresolved token (0A000014) "extern "C" double __cdecl gsl_matrix_get(struct gsl_matrix const *,unsigned int,unsigned int)" (?gsl_matrix_get@@$$J0YANPBUgsl_matrix@@II@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)

Error   4   error LNK2019: unresolved external symbol "extern "C" double __cdecl gsl_matrix_get(struct gsl_matrix const *,unsigned int,unsigned int)" (?gsl_matrix_get@@$$J0YANPBUgsl_matrix@@II@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)

Error   5   error LNK2019: unresolved external symbol "extern "C" void __cdecl gsl_matrix_set(struct gsl_matrix *,unsigned int,unsigned int,double)" (?gsl_matrix_set@@$$J0YAXPAUgsl_matrix@@IIN@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)

A: The orignal GNU Scientific library wasn't meant to be built by anything else than gcc, as you can see in their Supported Platforms section. Take a look here for a version that should build with Visual Studio.

A:

    An alternative GSL with Intel C/C++ on MS Visual Studio 2010 can be found at:
    http://xtechnotes.blogspot.com.au/2012/07/gslwintel.html
    https://sites.google.com/site/gslwintel/home


text:
Q: pip not running with Python 3.5 I have installed Python 3.5 and Pip but When I am type pip or pip3 in console, i get this error

The folder you are executing pip from can no longer be found.

If I run pwd, I get

/home/zahid

Pip was installed using
sudo python /usr/local/lib/python3.5/site-packages/easy_install.py pip

and output that I got was
[sudo] password for zahid:
Searching for pip
Best match: pip 8.1.1
Adding pip 8.1.1 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip3.5 script to /usr/local/bin
Installing pip3 script to /usr/local/bin

Using /usr/local/lib/python3.5/site-packages
Processing dependencies for pip
Finished processing dependencies for pip

Can anyone tell me what is going on  here
which python3 returns

/usr/bin/python3

which pip returns

/usr/local/bin/pip

which pip3 returns
/usr/local/bin/pip3

echo $PYTHONPATH returns
nothing blank

Regards

A: Please close this terminal and open a new terminal. You may have deleted some files inadvertently. As a result the terminal is unable to locate some links or environment variables. I faced the same issue. In a new terminal everything went fine.

A: I had this error on my Mac and restarting fixed this problem for me.

A: Does sudo pip work?
If so, check to make sure your profile isn't messed up. Check your path variable using the echo command with something like  echo $PATH
You need to make sure /usr/local/bin is present in your user profile.
If not, did you install pip into 3.5 and are you accidentally running some other version of python like python 2?

A: Create a symbolic link using
ln -s /usr/local/bin/pip /usr/bin/pip

test it by running
pip -V


text:
Q: Migrate to new component on clicking submit button in react can anyone suggest how to migrate to new component on clicking submit button? I was making a simple login page using react.Included email field in  and a submit button, what m trying is if I enter email n click on submit the password component appears. i.e same as gmail login.

A: Create the main component as follows.
export default class Index extends React.Component{

  constructor(props) {
    super(props);
    this.state = {
        currentStep : 1,
    };
    this.changeStep = this.changeStep.bind(this);
}

loadSteps() {
    switch(this.state.currentStep) {
        case 1:
            return (<EmailView />);
        case 2:
            return  (<PasswordView />);
        default:
            return (<EmailView />);
    }
}

changeStep(step) {
    this.setState({ currentStep : step});
}

render() {

    return (

             {this.loadSteps()}

    );
}

}
And Create two Child components for Email field and Password steps,
Email.js
export default class Email extends React.Component{

  constructor(props) {
    super(props);
  }

  render() {

    return (

            <input type="text" className="email-field">
            <input type="button" value="Go to" onClick="this.props.changeStep.bind(this, 2)">

    );
  }
}

Password.js
export default class Password extends React.Component{

  constructor(props) {
    super(props);
  }

  render() {

    return (

            <input type="password" className="password-field">
            <input type="button" value="Login" >

    );
  }
}


text:
Q: sails.js angulajs file post 404 (Not Found) error node.js i am using sailsjs and want to upload files using

var xhr = new XMLHttpRequest()
xhr.open("POST", "/admin/images/upload")

routes:

 'post /admin/images/upload' :{
        controllers   :'ImagesController',
        action        :'upload'
  }

but when i post it returns 404 not found error ,and it never enters to that controller,
this code was prefectly working with simple node.js and i tried other jquery plugin for file upload but same 404 page not found error reciving from server

A: You need to change controllers to controller in your route declaration:
'post /admin/images/upload' :{
        controller   :'ImagesController',
        action       :'upload'
 }

Or you could use the shortcut:
'post /admin/images/upload' : 'ImagesController.upload'


text:
Q: ReflectionException in Container.php line 734: Class PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker does not exist Laravel 5.2 I am installing Laravel Stats Tracker in laravel 5.2, and add my providers and facades, set my middleware files, kernel.php and config / database.php file.
Migration run my console, but in my browser I have the following error:
ReflectionException in Container.php line 734:
Class PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker does not exist

These are my providers:
'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        Illuminate\Auth\AuthServiceProvider::class,
        Illuminate\Broadcasting\BroadcastServiceProvider::class,
        Illuminate\Bus\BusServiceProvider::class,
        Illuminate\Cache\CacheServiceProvider::class,
        Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
        Illuminate\Cookie\CookieServiceProvider::class,
        Illuminate\Database\DatabaseServiceProvider::class,
        Illuminate\Encryption\EncryptionServiceProvider::class,
        Illuminate\Filesystem\FilesystemServiceProvider::class,
        Illuminate\Foundation\Providers\FoundationServiceProvider::class,
        Illuminate\Hashing\HashServiceProvider::class,
        Illuminate\Mail\MailServiceProvider::class,
        Illuminate\Pagination\PaginationServiceProvider::class,
        Illuminate\Pipeline\PipelineServiceProvider::class,
        Illuminate\Queue\QueueServiceProvider::class,
        Illuminate\Redis\RedisServiceProvider::class,
        Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
        Illuminate\Session\SessionServiceProvider::class,
        Illuminate\Translation\TranslationServiceProvider::class,
        Illuminate\Validation\ValidationServiceProvider::class,
        Illuminate\View\ViewServiceProvider::class,

        /*
         * Application Service Providers...
         */
        App\Providers\AppServiceProvider::class,
        App\Providers\AuthServiceProvider::class,
        App\Providers\EventServiceProvider::class,
        App\Providers\RouteServiceProvider::class,

        /*
        *
        */

        PragmaRX\Tracker\Vendor\Laravel\ServiceProvider::class,

    ],

These are my aliases:
'aliases' => [

        'App' => Illuminate\Support\Facades\App::class,
        'Artisan' => Illuminate\Support\Facades\Artisan::class,
        'Auth' => Illuminate\Support\Facades\Auth::class,
        'Blade' => Illuminate\Support\Facades\Blade::class,
        'Cache' => Illuminate\Support\Facades\Cache::class,
        'Config' => Illuminate\Support\Facades\Config::class,
        'Cookie' => Illuminate\Support\Facades\Cookie::class,
        'Crypt' => Illuminate\Support\Facades\Crypt::class,
        'DB' => Illuminate\Support\Facades\DB::class,
        'Eloquent' => Illuminate\Database\Eloquent\Model::class,
        'Event' => Illuminate\Support\Facades\Event::class,
        'File' => Illuminate\Support\Facades\File::class,
        'Gate' => Illuminate\Support\Facades\Gate::class,
        'Hash' => Illuminate\Support\Facades\Hash::class,
        'Lang' => Illuminate\Support\Facades\Lang::class,
        'Log' => Illuminate\Support\Facades\Log::class,
        'Mail' => Illuminate\Support\Facades\Mail::class,
        'Password' => Illuminate\Support\Facades\Password::class,
        'Queue' => Illuminate\Support\Facades\Queue::class,
        'Redirect' => Illuminate\Support\Facades\Redirect::class,
        'Redis' => Illuminate\Support\Facades\Redis::class,
        'Request' => Illuminate\Support\Facades\Request::class,
        'Response' => Illuminate\Support\Facades\Response::class,
        'Route' => Illuminate\Support\Facades\Route::class,
        'Schema' => Illuminate\Support\Facades\Schema::class,
        'Session' => Illuminate\Support\Facades\Session::class,
        'Storage' => Illuminate\Support\Facades\Storage::class,
        'URL' => Illuminate\Support\Facades\URL::class,
        'Validator' => Illuminate\Support\Facades\Validator::class,
        'View' => Illuminate\Support\Facades\View::class,

        'Tracker' => PragmaRX\Tracker\Vendor\Laravel\Facade::class,

    ],

This my Kernel.php file:
<?php

namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    /**
     * The application's global HTTP middleware stack.
     *
     * These middleware are run during every request to your application.
     *
     * @var array
     */
    protected $middleware = [
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
    ];

    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker::class,
        ],

        'api' => [
            'throttle:60,1',
        ],
    ];

    /**
     * The application's route middleware.
     *
     * These middleware may be assigned to groups or used individually.
     *
     * @var array
     */
    protected $routeMiddleware = [
        'auth' => \App\Http\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class,
        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
    ];
}

This my tracker.php file in app/config/
<?php

return [

    /**
     * Enable it?
     */
    'enabled' => true,

    /**
     * Deffer booting for middleware use
     */
    'use_middleware' => true,

    /**
     * Robots should be tracked?
     */
    'do_not_track_robots' => false,

    /**
     * Which environments are not trackable?
     */
    'do_not_track_environments' => [
        // defaults to none
    ],

    /**
     * Which routes names are not trackable?
     */
    'do_not_track_routes' => [
        'tracker.stats.*',
    ],

    /**
     * The Do Not Track Ips is used to disable Tracker for some IP addresses:
     *
     *     '127.0.0.1', '192.168.1.1'
     *
     * You can set ranges of IPs
     *     '192.168.0.1-192.168.0.100'
     *
     * And use net masks
     *     '10.0.0.0/32'
     *     '172.17.0.0/255.255.0.0'
     */
    'do_not_track_ips' => [
        '127.0.0.0/24' /// range 127.0.0.1 - 127.0.0.255
    ],

    /**
     * Log every single access?
     *
     * The log table can become huge if your site is popular, but...
     *
     * Log table is also responsible for storing information on:
     *
     *    - Routes and controller actions accessed
     *    - HTTP method used (GET, POST...)
     *    - Error log
     *    - URL queries (including values)
     */
    'log_enabled' => false,

    /**
     * Log SQL queries?
     *
     * Log must be enabled for this option to work.
     */
    'log_sql_queries' => false,

    /**
     * If you prefer to store Tracker data on a different database or connection,
     * you can set it here.
     *
     * To avoid SQL queries log recursion, create a different connection for Tracker,
     * point it to the same database (or not) and forbid logging of this connection in
     * do_not_log_sql_queries_connections.
     */
    'connection' => 'tracker',

    /**
     * Forbid logging of SQL queries for some connections.
     *
     * To avoid recursion, you better ignore Tracker connection here.
     *
     * Please create a separate database connection for Tracker. It can hit
     * the same database of your application, but the connection itself
     * has to have a different name, so the package can ignore its own queries
     * and avoid recursion.
     *
     */
    'do_not_log_sql_queries_connections' => [
        'tracker'
    ],

    /**
     * Also log SQL query bindings?
     *
     * Log must be enabled for this option to work.
     */
    'log_sql_queries_bindings' => false,

    /**
     * Log events?
     */
    'log_events' => false,

    /**
     * Which events do you want to log exactly?
     */
    'log_only_events' => [
        // defaults to logging all events
    ],

    /**
     * What are the names of the id columns on your system?
     *
     * 'id' is the most common, but if you have one or more different,
     * please add them here in your preference order.
     */
    'id_columns_names' => [
        'id'
    ],
    /**
     * Do not log events for the following patterns.
     * Strings accepts wildcards:
     *
     *    eloquent.*
     *
     */
    'do_not_log_events' => [
        'illuminate.log',
        'eloquent.*',
        'router.*',
        'composing: *',
        'creating: *',
    ],

    /**
     * Do you wish to log Geo IP data?
     *
     * You will need to install the geoip package
     *
     *     composer require "geoip/geoip":"~1.14"
     *
     * And remove the PHP module
     *
     *     sudo apt-get purge php5-geoip
     *
     */
    'log_geoip' => false,

    /**
     * Do you wish to log the user agent?
     */
    'log_user_agents' => false,

    /**
     * Do you wish to log your users?
     */
    'log_users' => false,

    /**
     * Do you wish to log devices?
     */
    'log_devices' => false,

    /**
     * Do you wish to log HTTP referers?
     */
    'log_referers' => false,

    /**
     * Do you wish to log url paths?
     */
    'log_paths' => false,

    /**
     * Do you wish to log url queries and query arguments?
     */
    'log_queries' => false,

    /**
     * Do you wish to log routes and route parameters?
     */
    'log_routes' => false,

    /**
     * Log errors and exceptions?
     */
    'log_exceptions' => false,

    /**
     * A cookie may be created on your visitor device, so you can have information
     * on everything made using that device on your site.    *
     */
    'store_cookie_tracker' => false,

    /**
     * If you are storing cookies, you better change it to a name you of your own.
     */
    'tracker_cookie_name' => 'please_change_this_cookie_name',

    /**
     * Internal tracker session name.
     */
    'tracker_session_name' => 'tracker_session',

    /**
     * ** IMPORTANT **
     *   Change the user model to your own.
     */
    'user_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\User',

    /**
     * You can use your own model for every single table Tracker has.
     */

    'session_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Session',

    'log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Log',

    'path_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Path',

    'query_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Query',

    'query_argument_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\QueryArgument',

    'agent_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Agent',

    'device_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Device',

    'cookie_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Cookie',

    'domain_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Domain',

    'referer_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Referer',

    'referer_search_term_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\RefererSearchTerm',

    'route_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Route',

    'route_path_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\RoutePath',

    'route_path_parameter_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\RoutePathParameter',

    'error_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Error',

    'geoip_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\GeoIp',

    'sql_query_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQuery',

    'sql_query_binding_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryBinding',

    'sql_query_binding_parameter_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryBindingParameter',

    'sql_query_log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryLog',

    'connection_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Connection',

    'event_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Event',

    'event_log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\EventLog',

    'system_class_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SystemClass',

    /**
     * Laravel internal variables on user authentication and login.
     */
    'authentication_ioc_binding' => 'auth', // defaults to 'auth' in Illuminate\Support\Facades\Auth

    'authenticated_check_method' => 'check', // to Auth::check()

    'authenticated_user_method' => 'user', // to Auth::user()

    'authenticated_user_id_column' => 'id', // to Auth::user()->id

    'authenticated_user_username_column' => 'email', // to Auth::user()->email

    /**
     * Enable the Stats Panel?
     */
    'stats_panel_enabled' => false,

    /**
     * Stats Panel routes before filter
     *
     */
    'stats_routes_before_filter' => '',

    /**
     * Stats Panel routes after filter
     *
     */
    'stats_routes_after_filter' => '',

    /**
     * Stats Panel routes middleware
     *
     */
    'stats_routes_middleware' => '',

    /**
     * Stats Panel template path
     */
    'stats_template_path' => '/templates/sb-admin-2',

    /**
     * Stats Panel base uri.
     *
     * If your site url is http://wwww.mysite.com, then your stats page will be:
     *
     *    http://wwww.mysite.com/stats
     *
     */
    'stats_base_uri' => 'stats',

    /**
     * Stats Panel layout view
     */
    'stats_layout' => 'pragmarx/tracker::layout',

    /**
     * Stats Panel controllers namespace
     */
    'stats_controllers_namespace' => 'PragmaRX\Tracker\Vendor\Laravel\Controllers',
];

After the configuration of these files, I run the migration of my tables, that process was executed without errors.
But in the browser it generates the initial error.
Error stack:
enter image description here
enter image description here

A: The file Tracker.php is not in the directory, i create a file with the same parameters as the TrackVisitsMiddleware.php file, the problem was corrected. I assume that this error may occur when installing in laravel version 5.2.


text:
Q: Create an object of a generic class (Using Java) I am implementing a generic class which is a B-Tree. When the user runs the program they can supply some arguments which will determine the type of the tree (Integer, Character, Double or String).
In my main method I have this code:
// Get user input and split it into tokens
// Tokens[1] = the type specified by the user

if( tokens[1].equals("DOUBLE"))
    BTree<Double> t = new BTree<Double>();

else if( tokens[1].equals("CHARACTER"))
    BTree<Character> t = new BTree<Character>();

else if( tokens[1].equals("INTEGER"))
    BTree<Integer> t = new BTree<Integer>();

else if( tokens[1].equals("STRING"))
    BTree<String> t = new BTree<String>();

But the compiler complains if I have the if statements. If I remove them then it compiles and runs fine :/ how can I fix this? So that the user can supply the type and the tree will be created depending on the type supplied? Thanks.
Here is some of the compiler output:
C:\Users\User\Desktop>javac *.java
Main.java:42: error: cannot find symbol
BTree<Double> t = new BTree<Double>();
symbol:   variable BTree
location: class Main

Main.java:42: error: cannot find symbol
BTree<Double> t = new BTree<Double>();
symbol:   variable Double
location: class Main

Main.java:42: error: cannot find symbol
BTree<Double> t = new BTree<Double>();
symbol:   variable t
location: class Main

.. There is more but it is similar and repeated for each of the types

A: The variable t in each of the if statements is only defined in the if's context, outside them the compiler won't recognize them.
Define your variable t before the if statements.
BTree<?> t = null;
if( tokens[1].equals("DOUBLE")) {
    t = new BTree<Double>();
}
else if( tokens[1].equals("CHARACTER")) {
    t = new BTree<Character>();
}
else if( tokens[1].equals("INTEGER")) {
    t = new BTree<Integer>();
}
else if( tokens[1].equals("STRING")) {
    t = new BTree<String>();
}
// now you can use your 't'

A: Your BTree<T> class should not be abstract, since you seem to want to instanciate the same functionality for all kinds of the type T.
If you need specific functionality for different types of T, you'd need to either implement
class CharacterBTree extends BTree<Character>

or do it on the fly like
 BTree<Character> t = new BTree<Character>() {
    ...
 };

Also; declare your BTree<T> t variable outside of the if's, so your code becomes
BTree<?> t = null;
if ("char".equals(whatever)) {
   t = new BTree<Character>();
} else if {
  ...
}

A: Insert curly brackets:
if( tokens[1].equals("DOUBLE")){
    BTree<Double> t = new BTree<Double>();
}
else if( tokens[1].equals("CHARACTER")){
    BTree<Character> t = new BTree<Character>();
}
else if( tokens[1].equals("INTEGER")){
    BTree<Integer> t = new BTree<Integer>();
}
else if( tokens[1].equals("STRING")){
    BTree<String> t = new BTree<String>();
}

Or declare your tree before the statetment:
BTree<? extends Object> t = null;
if( tokens[1].equals("DOUBLE"))
    t = new BTree<Double>();
else if( tokens[1].equals("CHARACTER"))
    t = new BTree<Character>();
else if( tokens[1].equals("INTEGER"))
    t = new BTree<Integer>();
else if( tokens[1].equals("STRING"))
    t = new BTree<String>();

A: i'd use a case-switch statement (maybe it's not the solution you need, as mishandoff said, seeing the log could help a little bit more) just from a logical point of view:
switch(tokens[1]) {
    case "DOUBLE" : BTree<Double> t = new BTree<Double>(); break;
    ....
    ....
}

A: If you're trying to something like
if (tokens[1].equals("DOUBLE"))
  BTree<Double> t = new BTree<Double>();
else if (tokens[1].equals("CHARACTER"))
  BTree<Character> t = new BTree<Character>();
// etc.

t.doStuff();

That won't work.  First, because the t variables are only in scope within their if statements, and second, because you can't make a variable have different static types along different code paths.
You could do something like
BTree<?> t;
if (tokens[1].equals("DOUBLE"))
  t = new BTree<Double>();
else if (tokens[1].equals("CHARACTER"))
  t = new BTree<Character>();
// etc.

But then you can't do anything useful with the items stored in t afterward because the code that follows doesn't know what it's a tree of.  This is more of a fundamental design problem, not a syntax problem.
You could create an interface — let's call it ValueHolder — and use it to define whatever operations you need to do on the values in the tree.  Then define classes like DoubleHolder, CharacterHolder, and so on, which implement the ValueHolder interface.  Then you can write:
BTree<? extends ValueHolder> t;
if (tokens[1].equals("DOUBLE"))
  t = new BTree<DoubleHolder>();
else if (tokens[1].equals("CHARACTER"))
  t = new BTree<CharacterHolder>();
// etc.

and afterward, you can retrieve items from the tree and they'll be of type ValueHolder so you can call any of the methods provided by that interface.


text:
Q: QGIS road style appears blocky, I want it to appear continuous. Is there a style merge function or something similar? If you look closely and see the main roads, they break down into blocks [][][][].
I was wondering in QGIS how can I have them appear continuous and not blocked up as shown below. This is one file and not multiple ones.


text:
Q: uib-modal in a component I'm trying to get a modal to open in a component, but all of the examples I've found don't cover components. Here's what I have so far. I'm not getting any error messages.
JS
// angular 1.5.8

(function () {
    var app = angular.module("foo-main");

    app.component("FooAssets", {
        templateUrl: "foo-content.html",
        controllerAs: "FooModel",
        controller: ["BarService", "FormService", "$uibModal", FooController]
    });

    function FooController(BarService, FormService, $uibModal) {
        var FooModel = this;
        FooModel.bar = 1;

        FooModel.openModal = function (size) {
            FooModel.modalInstance = $uibModal.open({
            animation: false,
            templateUrl: 'modal.html',
            controller: 'ModalController',
            size: size
        });

        FooModel.modalInstance.result.then(function () {

        }, function () {
            $log.info('Modal dismissed at: ' + new Date());
        });
    };
});
app.controller('ModalController', [ '$uibModal', 'FooModel', 'FormService', ModalController ]);

    function ModalController($uibModalInstance, FooModel, FormService) {
        var ModalController = this;
        FooModel.bar = 2;
    }
} ());

HTML

    Foo

Someone else wrote the component code, so it's all working besides the modal stuff. Also notice there's a modal controller that is separate from the component. I think I'm close, but there's something I'm just not grasping about how dependencies are passed to components/controllers.


text:
Q: Mysql Recursive Query - get all parent-child relationship I have table with below data.
id|child
1|2
1|3
1|4
2|6
2|7
3|9
6|10
6|11
9|12
9|13
10|14
10|15
17|18
19|20

I need to fetch the data like below. i.e all parent child relationship for a id.
Here I have select all childs recursively for parent id "1"
id|all_child_id
1|2,3,4
2|6,7
3|9
6|10,11
9|12,13
10|14,15

I am looking for "WITH RECURSIVE" which is not supported my Mysql. Can someone help me how to write such recursive query where depth must not be any constraint.

A: What your expected output shows, can be achieved by using group_concat
select parent, group_concat(child)
from table
group by parent

fiddle

A: try this ,
SELECT p.id, GROUP_CONCAT(c.child) AS all_child_id FROM parent p left JOIN
child c WHERE p.id=c.child GROUP BY p.id


text:
Q: error /bin/sh: 1: sourcekitten: not found on ubuntu I'm using SourceKitten to get code completions for swift. I'm trying to invoke the command through the following code:
var str = 'sourcekitten complete --text "' + code + '"';
const proc = exec(str, function(err, stdout, stderr) {
    if (err || stderr) {
        console.log('error', stderr);
        return resolve([]);
    }
    try {
        return resolve(JSON.parse(stdout));
    } catch (error) {
        console.log('error', error);
        return resolve([]);
    }
});

I am getting the following error: error /bin/sh: 1: sourcekitten: not found. I have downloaded sourcekitten from https://github.com/jpsim/SourceKitten and have done swift build too. Even using
    var str = 'SourceKitten/Source/sourcekitten complete --text "' + code + '"';  gives the same error.


text:
Q: JS How to import file from importer folder, not owner folder For example I have next file structure
src
| - lib
|   | - customImport.js
| - app
|   | - app.js
|   | - style.scss

customImport.js - contains one function which imports specified filepath
const customImport = (filepath) => {
   require(filename);
};

app.js - uses this function
import { customImport } from '../lib/customImport';
customImport('./style.scss')

The issue is that require(filename) executes from ./src/lib folder, not from expecting folder ./src/app.

Module not found: Can't resolve './style.scss' in '.../src/lib'

How to write correct code where require(filename) will be called from ./src/app/app.js file?


text:
Q: Issue integrating Selenium test suite using jenkins I am trying to integrate Jenkins with Selenium. I have prepared the following command:
java -jar "D:\CI\TWCP\Selenium plugins\selenium-server-standalone-2.32.0.jar" -htmlSuite *firefox "http://www.google.co.in"  "C:\Users\....\Desktop\Test suites\GoogleTestSuite.html" "C:\Users\.....\Desktop\results.html" -firefoxProfileTemplate "C:\....\Mozilla\Firefox\Profiles\s980v5zn.default"

When I execute the command in the command line, it works Perfectly fine. Then I called the same command through Jenkins and I got the following error:
    Started by user anonymous
Building in workspace D:\CI\Jenkins\jobs\Google Test\workspace
[workspace] $ cmd /c call C:\Windows\TEMP\hudson600399625489206831.bat

D:\CI\Jenkins\jobs\Google Test\workspace>java -jar "D:\CI\TWCP\Selenium plugins\selenium-server-standalone-2.32.0.jar" -htmlSuite *firefox "http://www.google.co.in"  "C:\Users\N_chandanKumar\Desktop\Test suites\GoogleTestSuite.html" "C:\Users\N_chandanKumar\Desktop\results.html" -firefoxProfileTemplate "C:\Users\N_chandanKumar\AppData\Roaming\Mozilla\Firefox\Profiles\s980v5zn.default"
Apr 24, 2013 10:54:07 AM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
10:54:08.647 INFO - Java: Sun Microsystems Inc. 1.6.0-b105
10:54:08.647 INFO - OS: Windows Vista 6.1 x86
10:54:08.662 INFO - v2.32.0, with Core v2.32.0. Built from revision 6c40c18
10:54:08.756 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
10:54:08.756 INFO - Version Jetty/5.1.x
10:54:08.756 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
10:54:08.756 INFO - Started HttpContext[/selenium-server,/selenium-server]
10:54:08.756 INFO - Started HttpContext[/,/]
10:54:08.787 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@13c1b02
10:54:08.787 INFO - Started HttpContext[/wd,/wd]
10:54:08.787 INFO - Started SocketListener on 0.0.0.0:4444
10:54:08.787 INFO - Started org.openqa.jetty.jetty.Server@7ced01
jar:file:/D:/CI/TWCP/Selenium%20plugins/selenium-server-standalone-2.32.0.jar!/customProfileDirCUSTFFCHROME
10:54:09.941 INFO - Preparing Firefox profile...
10:54:12.041 INFO - Launching Firefox...
10:54:14.242 INFO - Checking Resource aliases
10:54:37.079 INFO - Checking Resource aliases
10:54:37.079 INFO - Received posted results
GoogleTestCase.html
GoogleTestCase

10:54:37.297 INFO - Killing Firefox...
Tests failed, see result file for details: C:\Users\N_chandanKumar\Desktop\results.html
10:54:37.921 INFO - Shutting down...
10:54:37.921 INFO - Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444]

D:\CI\Jenkins\jobs\Google Test\workspace>exit 1
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE

result.html shows failure with below log
info: Starting test /selenium-server/tests/GoogleTestCase.html
info: Executing: |setTimeout | 1000000 |  |
info: Executing: |openAndWait | http://www.google.co.in/ |  |
info: Executing: |setTimeout | 1000000 |  |
info: Executing: |pause | 20000 |  |
info: Executing: |verifyTextPresent | India |  |
warn: currentTest.recordFailure: false
info: Executing: |assertTitle | Google |  |
error: Actual value 'Error Message' did not match 'Google'
warn: currentTest.recordFailure: Actual value 'Error Message' did not match 'Google'

If I run the same code adding debug tag i.e.
java -jar "D:\CI\TWCP\Selenium plugins\selenium-server-standalone-2.32.0.jar" -htmlSuite *firefox "http://www.google.co.in"  "C:\Users\....\Desktop\Test suites\GoogleTestSuite.html" "C:\Users\....\Desktop\results.html" -firefoxProfileTemplate "C:\Users\.....\AppData\Roaming\Mozilla\Firefox\Profiles\s980v5zn.default" -debug

I get the following logs at the end
GoogleTestCase.html
GoogleTestCase

10:58:56.737 DEBUG - Handled by org.openqa.selenium.server.htmlrunner.SeleniumHTMLRunnerResultsHandler@14b7453
10:58:56.737 DEBUG - RESPONSE:
HTTP/1.1 200 OK
Date: Wed, 24 Apr 2013 05:28:56 GMT
Server: Jetty/5.1.x (Windows Vista/6.1 x86 java/1.6.0
Cache-Control: no-cache
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/html
Transfer-Encoding: chunked

10:58:57.002 INFO - Killing Firefox...
10:58:57.018 DEBUG - java.net.SocketException: Connection reset
10:58:57.018 DEBUG - java.net.SocketException: Connection reset
10:58:57.018 DEBUG - java.net.SocketException: Connection reset
10:58:57.018 DEBUG - java.net.SocketException: Connection reset
10:58:57.033 DEBUG - java.net.SocketException: Connection reset
10:58:57.033 DEBUG - java.net.SocketException: Connection reset
Tests failed, see result file for details: C:\Users\N_chandanKumar\Desktop\results.html
D:\CI\Jenkins\jobs\Google Test\workspace>exit 1
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE

I have jenkins 1.509 and seleniumHQ2.32.0
Not able to make out how I am getting "java.net.SocketException: Connection reset" Any help in this regard will be appreciated.
Thanks & Regards,
cK

A: To check on the issue I ran the jenkins server in Interactive mode. The setting can be seen when you go to services.msc -> Jenkins process -> properties-> click on logon tab and you can select Local system account and tick "Allow service to interact with desktop".
This made jenkins to run the selenium test interactively instead of running in background.
There I could observe browser failing to open the website. This was tackled by following settings services.msc -> Jenkins process -> properties-> click on logon tab --> Select this account and give the account using which you have logged into this system.


text:
Q: Can not add account as role admin in Apple developer I try to add new account as role admin, I already use an account with role Account Holder but when dialog add admin I can't check to option Access to Certificates, Identifiers & Profiles in Developer Resources sector and when I hit Invite it show error like image below.

Does anybody know this error, please help me? I research from google but no luck.
Thanks.

A: It seems that you are using an Individual Account, aren't you?.
If that, please check on here.

Note: If you're enrolled as an individual and add users in App Store Connect, users receive access only to your content in App Store Connect and are not considered part of your team in the Apple Developer Program.

https://developer.apple.com/support/roles/


text:
Q: Find CRS (coordinate reference system) based on known location and coordinates? Is there any tool or any tutorial which would help me to figure out CRS (coordinate reference system) from related information?
In my particular case I know only the system is in meters, has origin (probably of zone) at E 91°30' and N 50°20' (not 100% sure about exactly 50°20') and it is presumably commonly used in Russia.
I would be glad for general solution if any.

A: Based on Identifying Coordinate System of Shapefile when Unknown? it directed me to a tool which is very helpful to find relevant CRS which is exactly I was hoping for:
http://www.epsg-registry.org/
The result in my case:

A: My preferred solution is to build a custom CRS in QGIS, and test if sample coordinate points are placed correctly compared to Openstreetmap or Google imagery from the openlayers plugin.
In Russia, Gauss-Krüger transverse mercator based on the Krassnowsky ellipsoid is common use. The projections named Pulkovo are usually 3 or 6 degrees wide, with a false Easting of 500000m to the central meridian. Some CRS put the zone number before the false Easting, like 16500000 for zone 16 arond the 48° meridian.
False Northing is not used, perhaps some leading numbers are simply stripped of for the local coordinates.

A: I recommend ProjFinder. The principle is "zoom on the place you are looking for and the tool will provide the supposed projections".
You can also use epsg.io and search Russia to sort out possible projections

A: I also used Projfinder and I found it is very useful.
But asking the producer is the best.
I worked on a project in South Africa, I found a suitable CRS but after few weeks the customer gave me the name of the right one, and it was different. Probably in Projectfinder is not available a full list of CRS like as in www.epsg-registry.org


text:
Q: Failed to rename a file This might be a duplicate but trust me i have done lots of research before posting this question
i am working on a text editor project " Sodalime ", and i want to append ".txt" to file name if user forgets to put this extension after their file, but the problem is i just can't rename the "userFile" to "userFile.txt".
the code below is just a demo and not a part of my project Sodalime
import java.awt.EventQueue;

import javax.swing.JFrame;
import java.awt.BorderLayout;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.JMenuItem;
import javax.swing.JMenu;
import java.awt.FlowLayout;
import java.awt.Color;
import java.awt.GridLayout;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.swing.JSplitPane;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.Window;
import javax.swing.JTextPane;
import java.awt.Point;
import javax.swing.JTextArea;
import java.awt.Component;
import java.io.File;
import java.time.temporal.JulianFields;

public class MenuTest {

    JFrame frame;
    /**
     * @wbp.nonvisual location=280,89
     */

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    MenuTest window = new MenuTest();
                    window.frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the application.
     */
    public MenuTest() {
        initialize();
    }

    /**
     * Initialize the contents of the frame.
     */
    private void initialize() {
        frame = new JFrame();
        frame.setBounds(new Rectangle(0, 0, 300, 400));

        JButton btnNewButton = new JButton("New button");
        btnNewButton.setIcon(new ImageIcon("E:\\Sodalime\\icons\\delete.png"));
        btnNewButton.setAlignmentX(Component.CENTER_ALIGNMENT);
        frame.getContentPane().add(btnNewButton, BorderLayout.NORTH);

        JPanel panel = new JPanel();
        frame.getContentPane().add(panel, BorderLayout.CENTER);

        final JTextArea textArea = new JTextArea();
        textArea.setPreferredSize(new Dimension(250,300));
        textArea.setBackground(Color.LIGHT_GRAY);

        btnNewButton.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent arg0) {
                JFileChooser fc = new JFileChooser();
                int filechoice = fc.showOpenDialog(fc);
                if(filechoice == JFileChooser.APPROVE_OPTION){
                File chosedfile = fc.getSelectedFile();
                FilenewFIle=newFile(chosedfile.getParent()+File.separator+".txt");

                if(chosedfile.renameTo(newFIle)) {
                    textArea.setText("done \n");
                    textArea.append(chosedfile.getAbsolutePath()+"\n");
                    textArea.append(newFIle.getAbsolutePath());
                }
                else textArea.setText("failed");
                }
            }
        });

        panel.add(textArea);

    }
}

Also any suggestions to make my editor working properly will be highly appreciated. This might be OFFTOPIC but i have couple of issues with my editor
like gridLayout leaves lots of Vgap and some more , so i would appreciate my suggestions given to improve my coding style and my project
my project is on github Sodalime-v1.0

A: Make your :
File newFIle=new File(chosedfile.getParent()+File.separator+".txt");

To:
File newFIle=new File(chosedfile.getParent()+File.separator+chosedfile.getName()+".txt");

Your code is wrong.
For example, if the path is C:/ABC/d, your code will make it C:/ABC/.txt. You need to add the name of the file after the file separator, to make it C:/ABC/d.txt


text:
Q: jQuery Steps and validation of multiple panels I have a simple wizard made of three simple steps.
In the first two steps I have some form controls with a couple of select control which are handled by the chosen plugin

    Da operazione

        <select name="ExpirationMode" id="ExpirationMode"
                class="chosen-select form-control" data-placeholder="Select an item" data-rule-required="true" data-msg-required="Required field">
            <option value=""></option>
            @foreach ( ExpirationModeViewModel e in expirationModeList ) {
                <option value="@e.ExpirationModeID">@e.Description</option>
            }
        </select>

with the following javascript
$('.chosen-select').chosen({
    disable_search_threshold: 10,
    no_results_text: 'Oops, no results found',
    allow_single_deselect: true,
    width: '100%'
});

To handle the validation with the chosen plugin I have added the following validator settings in the onStepChanging event
onStepChanging: function (event, currentIndex, newIndex) {
    // Disable validation on fields that are disabled or hidden.
    form.validate().settings.ignore = ":disabled,:hidden:not('select.form-control')";
    // Start validation; Prevent going forward if false
    return form.valid();
},

The problem happens when I add another chosen select in the second panel. The instruction form.validate().settings.ignore = ":disabled,:hidden:not('select.form-control')"; is trying to validate also the chosen elements that are in the second panel.
How can I solve this? Can I tell the validator to validate only the controls contained in the current panel?

A: If I got you right, I have similar problem. Here's the workaround I've found. In onStepChanging I added this piece of code:
if (newIndex === 1) {
   form.validate().settings.ignore = ":disabled,:hidden:not(#partner)";
} else if (newIndex === 2) {
   form.validate().settings.ignore = ":disabled,:hidden:not(#partner2)";
} else {
   form.validate().settings.ignore = ":disabled,:hidden";
}

Where #partner and #partner2 are IDs of two <select> elements.
Hope it helps; works fine for me.


text:
Q: Problem when compile gnumeric from source I'm trying to compile gnumeric 1.12.45 from source.
The building is done and it works but when the windows open, it shows a lot of warnings.
For example, there are multiple lines of warnings like this,
CRITICAL **: 19:10:06.028: go_conf_add_monitor: assertion 'node || key' failed
CRITICAL **: 19:10:06.028: go_conf_get_node: assertion 'parent || key' failed

and it show multiple lines of WARNING **: 19:11:16.979: unknown GOConfMonitor id. when I closed the windows.
What should I add or configure to make it disappear when I run the binary?


text:
Q: Issue with UNION in MySQL I have two tables.
rp_format
+-----+--+--------------+
| fid |  | recordformat |
+-----+--+--------------+
|   1 |  | CD           |
|   2 |  | Vinyl        |
|   3 |  | DVD          |
+-----+--+--------------+

rp_records
+----+--+--------+
| id |  | format |
+----+--+--------+
|  1 |  |      1 |
|  2 |  |      2 |
|  3 |  |      3 |
+----+--+--------+

What I would like to achieve is to display everything from "rp_format". But I would also like make a check to see if there is a "fid"-value found in "format".
Example that should be displayed on page like this:
fid         recordformat
1           CD              Remove this format
2           Vinyl           Remove this format
3           DVD             Remove this format

But let's say an "fid" value is found in "format" then I would like it to be displayed like this on page:
fid         recordformat
1           CD              Remove this format
2           Vinyl           Can't remove this format
3           DVD             Remove this format

"Remove this format / Can't remove this format" is text that will be displayed by checking if "fid" = "format" using PHP.
Here is my SQL query so far:
global $wpdb;
$rpdb = $wpdb->prefix . 'rp_format';
$rpdb2 = $wpdb->prefix . 'rp_records';

$sql = "
SELECT *
FROM $rpdb
LEFT OUTER JOIN $rpdb2 ON $rpdb.fid = $rpdb2.format

UNION

SELECT *
FROM $rpdb
RIGHT OUTER JOIN $rpdb2 ON $rpdb.fid = $rpdb2.format
WHERE $rpdb.fid IS NOT NULL
";

The issue I have with this query is that when "fid" is found in "format" (let's say it's found 10 times) every of these 10 values will be outputed also.
How can this be fixed?
Kind regards
Johan

A: Not sure that i correctly understand your logic with found and not found format, if i wrong - add to if condition r.format IS NOT NULL instead r.format IS NULL. And i think you no need to use union, you should use join:
SELECT
    r.fid,
    f.recordformat,
    IF(r.format IS NULL, "Can't remove this format", "Remove this format")
FROM rp_format f
LEFT JOIN rp_records r ON f.fid = r.format
GROUP BY f.fid
;

I'm sure that something like this will help you!

A: If I understand correctly you want to display some message depending on if the data exists on rp_records or not and avoid multiple display.
Consider the following
mysql> select * from rp_format;
+------+--------------+
| fid  | recordformat |
+------+--------------+
|    1 | CD           |
|    2 | Vinyl        |
|    3 | DVD          |
|    4 | Test         |
+------+--------------+
4 rows in set (0.00 sec)

mysql> select * from rp_records;
+------+--------+
| id   | format |
+------+--------+
|    1 |      1 |
|    2 |      2 |
|    3 |      3 |
|    4 |      2 |
|    5 |      1 |
+------+--------+

So the query is
select
f.*,
case
  when r.format is not null then 'Can\'t remove' else 'Remove this' end
as message
from rp_format f
left join rp_records r on r.format = f.fid
group by f.fid  ;

+------+--------------+--------------+
| fid  | recordformat | message      |
+------+--------------+--------------+
|    1 | CD           | Can't remove |
|    2 | Vinyl        | Can't remove |
|    3 | DVD          | Can't remove |
|    4 | Test         | Remove this  |
+------+--------------+--------------+


text:
Q: HWX 2.6 sandbox in virtual box - not able to start services HWX 2.6 sandbox in virtual box - not able to start services (HDFS or ANY services using Ambari).

*

*Vt-x enabled.

*Server didnt start and timed out so increased timeout in "/etc/ambari-server/conf/ambari.properties" - server.startup.web.timeout=180 - WORKS NOW.

*As hdfs user - safe mode is OFF as well using command - hdfs dfsadmin -safemode leave

*yum update and yum install -y hadooplzo hadooplzo-native done as well.

*Can see the below in /etc/hosts
172.17.0.2      sandbox-hdp.hortonworks.com sandbox-hdp
127.0.0.1 sandbox.hortonworks.com
Connection refused error :
[root@sandbox-hdp ~]# telnet sandbox.hortonworks.com 8020
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
[root@sandbox-hdp ~]# telnet sandbox.hortonworks.com 8080 (WORKS)
Trying 127.0.0.1...
Connected to sandbox.hortonworks.com.
Escape character is '^]'.
ambari-agent.log
INFO 2018-06-18 09:59:06,502 NetUtil.py:70 - Connecting to https://sandbox.hortonworks.com:8440/ca
ERROR 2018-06-18 09:59:06,569 NetUtil.py:96 - [Errno 8] _ssl.c:492: EOF occurred in violation of protocol
ERROR 2018-06-18 09:59:06,571 NetUtil.py:97 - SSLError: Failed to connect. Please check openssl library versions.
Refer to: https://bugzilla.redhat.com/show_bug.cgi?id=1022468 for more details.
WARNING 2018-06-18 09:59:06,576 NetUtil.py:124 - Server at https://sandbox.hortonworks.com:8440 is not reachable, sleeping for 10 seconds...

A: Just faced the same issue while building up a HDP sandbox from scratch with Ansible. The solution was to add this line in /etc/ambari-agent/conf/ambari-agent.ini
force_https_protocol=PROTOCOL_TLSv1_2

also you may need verify=disable in  /etc/python/cert-verification.cfg but not sure


text:
Q: Berry phase with density matrix approach Berry phase, coming from Schrodinger equation, has well known form in terms of closed integral
$$\gamma = \int_C A(\xi) d\xi $$
with Berry connection $$A(\xi) = i < \psi(\xi) | \partial_{\xi} | \psi(\xi) > $$ and $\psi(\xi)$ is eigenstate of Schrodinger equation $$H |\psi> = E |\psi>.$$
Suppose instead you have system described by mixed state.
Is there generalization of Berry phase for density matrix $\rho$?

A: I do not think the notion of a berry phase makes sense for a general mixed state. This is because in general geometric phases in general are got by varying parameters in the Hamiltonian. This makes them inherently a geometric feature of $\textit{coherent}$ evolution.
Another way of seeing, is to consider the following particular situation: suppose you have one qubit in state $\psi(t=0) $ with Hamiltonian $H$. Then you change parameters in the $H$ so that the evolution of qubit is supposed to return to the original state $ \lambda \psi(t=0)$ where $\lambda$ is some $U(1)$ phase factor.Throughout the evolution we are staying on the surface of the Bloch sphere. Now if you want to bring in the possibility of mixed states then one way is to introduce noise in the evolution but as you change the parameters in the Hamiltonian the Bloch sphere is being deformed and in general your state may end up inside the Bloch sphere. In other words the possibility of returning to your state modulo global phases is in not possible for arbitrary mixed states.


text:
Q: Use query syntax in GroupBy with complex range variable I have a LINQ query, where I want to group elements from a collection. I'm trying to use query syntax to achieve my result, but I can't figure out how to describe a more complex range variable using query syntax.
Using method syntax, this works:
Dim R = someCollection.GroupBy(Function(x)
                                       For Each cItem In x.Attributes
                                           If cItem.Name = "N1" Then Return cItem.Value
                                       Next
                                   End Function)

I tried doing this in query syntax, but failed. So this doesn't work and gives an error: Range variable name can be inferred only from a simple or qualified name with no arguments.
Dim R = From q In someCollection
            Group q By Function(x)
                           For Each cItem In q.Attributes
                               If cItem .Name = "N1" Then Return cItem .Value
                           Next
                       End Function
                Into Group

I tried various other versions, but to no avail. How can I group by a complex parameter using a query syntax? Or should just stick to method syntax?

A: A For Each loop that exits the first time a condition is satisfied can generally be collapsed into a single call to First, FirstOrDefault, Single or SingleOrDefault.  In this case, the best option depends on whether there will always be one match or there can be none or more than one.
Always one: Single
Never more than one: SingleOrDefault
Never less than one: First
None, one or many: FirstOrDefault
In this case, assuming the last case:
Group q By q.Attributes.FirstOrDefault(Function(a) a.Name = "N1")?.Value

Null propagation is used because the "OrDefault" means that Nothing may be returned.


text:
Q: Обновление записей в MySQL с ON DUPLICATE KEY UPDATE без учета пустых ячеек Здравия прочитавшим!
При обновлении данных в базе используется файл *.xls, в нем бывают пустые ячейки в записях - по задумке, надо что бы они не стирали имеющиеся записи  в базе данных, если совпали.
Делаю стандартное обновление записей путем провоцирования конфликта ключей по полю ID
INSERT INTO `orders` (`id`,`name`,`status`)
VALUES ('1','Иван','OK'),('2','Марья','OK')
ON DUPLICATE KEY UPDATE
`name` = VALUES(`name`),
`status` = VALUES(`status`);

Но к сожалению, пустые ячейки стирают соответствующие записи в базе. Все обновляет нормально.
Пробовал посредством PHP, но ничего дельного не приходило в голову.
Кто сталкивался с подобными случаями, может есть идеи?
Спасибо.

A:
в нем бывают пустые ячейки в записях

Что попадает в формируемый запрос в секцию VALUES, если некая ячейка "пустая"? небось пустая строка? т.е. получается нечто вроде
INSERT INTO `orders` (`id`,`name`,`status`)
VALUES ('1','Иван','OK'),('2','Марья','')

Верно?
Если так - то вместо пустой строки формируйте там Null, а в секции ODKU сделайте соотв. обёртку:
INSERT INTO `orders` (`id`,`name`,`status`)
VALUES ('1','Иван','OK'),('2','Марья',Null)
ON DUPLICATE KEY UPDATE
`name` = COALESCE(VALUES(`name`),`name`),
`status` = COALESCE(VALUES(`status`),`status`);


text:
Q: Trying to use shorten the text output using truncate smarty tag in PHP 5.4.19 trying to use {$articleTitle|truncate:30:""} to shorten the text output
its working in localhost correctly
but not working in server with PHP 5.4.19
am unable to find solution.
I think there is no problem with code problem in server.
any suggestions plz.
error info.

Fatal error! Your request can not be executed!

Fatal error:  Call to undefined function mb_substr() in Smarty/plugins/modifier.truncate.php on line 36


text:
Q: Studying spherical coordinates $(1)$ Please suggest some books regarding the fundamental studies on surface and volume integrals in spherical coordinates.
$(2)$ Are there any books dedicated to only elementary calculus of spherical coordinates? All of the calculus books I know have lengthy discussions regarding Cartesian coordinate system but only some couple of pages regarding spherical coordinates.

A: I don't know of any books which solely focus on spherical coordinates, and I would be surprised if there even existed one.
My surprise would stem from the fact that doing anything in spherical coordinates is (almost) exactly the same as integrating in the cartesisan coordinate system, as
$$\int_0^{2\pi} \int_0^{\pi} \int_0^1 \rho^2\sin\phi\  d\rho\ d\phi\ d\theta = \int_0^{2\pi} \int_0^{\pi} \int_0^1 x^2\sin y\ dx\ dy\ d\theta$$
by a simple change of variable names. The first can be thought of as integrating $1$ over the unit sphere in spherical coordinates, but as we can see, this is really just equivalent to doing a cartesian integral of $x^2\sin y$ over a subset of $\mathbb{R}^3$.
No doubt bijections like that of spherical coordinates are useful, and this is why coordinate transforms and Jacobians are taught in multivariable calculus, but the theory of integration after we do the coordinate transform and multiply by the Jacobian is exactly the same as for cartesian coordinates.


text:
Q: How to harden windows 2003 service account I remember there was a tech-net or WindowsITpro article about how to harden windows 2003 service accounts a couple of years ago.
For backup software purposes (such as BackupExec / AppAsure / Etc.. , please don't bash these) I have to create a domain admin account (usually called something such as "backup") and have the services run from that account.
In this article I remember you can create the domain admin user "Backup" however have it not able to login interactively.
Do any of you remember such an article or have the knowledge on how to do it?

A: I advise to create a group called something like 'DenyLogonLocally'. Then make sure this group is denied from logging on locally by using a GPO.
Computer Configuration -> Policies -> Windows Settings -> Security Settings -> Local Policies -> User Rights -> Deny Logon Loccaly
Add the Backup user and other service accounts to this group. You might want to consider the same technique with the user rights 'Deny log on through Remote Desktop Services' and 'Deny Access to this computer from the network'.
John's tips are good aswell.

A: There is a user rights setting that restricts interactive login.  Look for Local security policy and User rights assignment.  Test before you go too far.
You might also use an insanely long password/passphrase since you won't need to enter it very often.  This is a great way to harden the account.

A: I do remember seeing such articles but all they really said, in far too many words, was:

*

*Limit the access the account has. In particular, don't make them Domain Admin if there is any way to avoid it.

*Make the account credentials as secure as practical. i.e. Try not to use obvious names for the account and ensure the passwords are long and strong.

*Don't allow anyone to access the account unless they really need to, so set the permissions on the account itself accordingly.

*Ensure the relevant details are securely logged and protected. After all, if you can remember them you either have an exceptional memory or you have failed in choosing a secure enough password.

*As with any other important account, ensure the password is changed periodically.

It's unfortunate that some backup systems, such as BackupExec, require the account to be Domain Admin, even though Backup is all it really needs. That's just poor design but of course we users don't have any control over it.


text:
Q: Best list merging and manipulation technique So, I got a (mutable) list of <TOKENS, Strings> pairs that look something like this
...
Pair(IDENTIFIER, "A"),
Pair(TICKTICK, "``"),
Pair(IDENTIFIER, "_B")
...

I'd need to loop through the list and end merge to this:
...
Pair(IDENTIFER, "A_B")
...

So, basically find all TICKTICK token occurrences and merge the previous two tokens (i.e., create a new pair with the Strings added together).
My current idea was to do a for look looking for TICKTICK tokens and then remove previous, current and next and then insert a newly merged token.
It seems like there should be a more natural way…. Any ideas?
It also seems that I don't have access to iterator().previous even though indicated by this link

A: With Kotlin 1.2, you can also use the new windowed stdlib function that represents the elements as snapshots of a sliding window, e.g.
println(listOf(1, 2, 3, 4, 5, 6).windowed(3))
// [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6]]

Then check the pattern IDENTIFIER, TICKTICK, IDENTIFIER against the window and if it matches (and if the three items are not yet replaced) then store the information that you replace the items at these indices with a single one.
val pattern = listOf(IDENTIFIER, TICKTICK, IDENTIFIER)

// Stores indices of items that are not replaced:
val indicesOfNormalItems = items.indices.toMutableSet()

The loop over windows that also collects the resulting items into a map with the key of the first index of the triple:
val replaced = items.withIndex().windowed(pattern.size) { window ->
    val kinds = window.map { (_, item) -> item.first }
    if (kinds == pattern) {
        val windowFirstIndex = window.first().index
        if (windowFirstIndex in indicesOfNormalItems) {
            indicesOfNormalItems.removeAll(window.map { it.index })
            val (first, _, third) = window.map { it.value.second }
            return@windowed windowFirstIndex to (IDENTIFIER to first + third)
        }
    }
    null
}.filterNotNull().toMap()

Then collect the result, combining it from the items that were not replaced and the values from the map:
val result = items.indices.mapNotNull { index ->
    if (index in indicesOfNormalItems)
        items[index] else
        replaced[index]
}

Here's a complete runnable demo: (link)
In Kotlin 1.1.x there's no windowed function, so you will have to implement it on your own or do the same with your code.


text:
Q: C# Discord.net Add File as Image to Embed How can I add a local file to my Embed as image.
I don't want to upload it to imgur or anything and get the URL. That doesn't work for the project due to changing images.
My code right now:

                var emb = new EmbedBuilder()
                    .WithColor(Color.Blue)
                    .WithTimestamp(DateTime.Now)
                    .WithTitle(rarity)
                    .WithDescription($"{Context.User.Username} dropped a card!")
                    .WithImageUrl($"attachment://{path}")
                    .Build();

                await Context.Channel.SendFileAsync(path, null, false, emb);

A:                 var filename = Path.GetFileName(path);

                var emb = new EmbedBuilder()
                    .WithImageUrl($"attachment://{filename}")
                    .Build();

                await Context.Channel.SendFileAsync(path, null, false, emb);

The Path.GetFileName made it possible for me in combination with attachment://{filename}


text:
Q: Keyboard navigation in Jetpack Compose Android usually supports navigation with the tab and enter key as described here.
However, when using Jetpack compose this option seems unavailable. Is this true and if yes I wonder what would be the simplest method to navigate a Jetpack Compose Kotlin App using my keyboard?
maybe use the custom navigation as described here ?
or better implement a whole new navigation method as described here?
Thank you for any help


text:
Q: Specify UID/GID for NFS mount (CentOS 7) I have two servers svrA and svrB (both CentOS 7), where svrA is a turn-key system so I cannot change anything on it, and svrB is the one I am working on. svrA contains log files I need to transfer to svrB. svrA provides these via a read-only NFS mount, with the following /etc/exports:
/opt/logfiles *(ro,no_root_squash,insecure)

These logfiles have all kinds of permissions, some can only be read by root -  and this is the problem.
On my svrB, I have a log transfer script that mounts the NFS share and copies the files from svrA to svrB. For security reasons, I don't want that script to run as root on svrB, it has a dedicated user instead. But this means I cannot access some files on the NFS share of svrA!
Is there any way I can mount the svrA NFS share from svrB "with root permissions", so I can read "mode 600, owner root" files from svrA, without having to

*

*become root on svrB, or

*change anything on svrA?

I know that on OpenVMS, the NFS client can specify a UID/GID via a proxy. But is it possible with CentOS 7?


text:
Q: Use Recursion to Create a Countdown | FreeCodeCamp Recursion problem

var a=[];
// Only change code below this line
function countdown(n){

  if(n>=1){

    countdown(n-1);
    console.log(n);
    a.push(n);
    return a;
  }
  else{
    return [];
  }
}
console.log(countdown(5));

Here I want to know after the recalling of the countdown function why the n is printed like 1,2,3,4,5? It should be 5,4,3,2,1?

A: In the initial call to countdown (where n=5) you recursively call countdown and then print n.

A: Switch the order of console.log(n); and countdown(n-1); and you will have expected behavior.

var a=[];
// Only change code below this line
function countdown(n){

  if(n>=1){

    console.log(n);
    countdown(n-1);
    a.unshift(n);
    return a;
  }
  else{
    return [];
  }
}
console.log(countdown(5));


text:
Q: How to use pre-trained features from VGG-16 as input to GlobalAveragePooling2D() layer in Keras Is it possible to use pre-trained model features from VGG-16 and pass to GlobalAveragePooling2D() layer of other model in Keras?
Sample code for storing offline features of VGG-16 network:
model = applications.VGG16(include_top=False, weights='imagenet')
bottleneck_features_train = model.predict(input)

Sample code for top model:
model = Sequential()
model.add(GlobalAveragePooling2D()) # Here I want to use pre-trained feature from VGG-16 net as input.

I can not use Flatten() layer as I want to predict multi-labels with multi-classes.

A: Sure, you definitely can. You've got a couple of options:
pooling kwarg
Use the pooling kwarg in the VGG16 constructor, which replaces the last pooling layer with the specified type. i.e.
model_base = keras.applications.vgg16.VGG16(include_top=False, input_shape=(*IMG_SIZE, 3), weights='imagenet', pooling="avg")

Adding layers to the output
You can also add more layers to the pretrained model:
from keras.models import Model

model_base = keras.applications.vgg16.VGG16(include_top=False, input_shape=(*IMG_SIZE, 3), weights='imagenet')
output = model_base.output
output = GlobalAveragePooling2D()(output)
# Add any other layers you want to `output` here...
model = Model(model_base.input, output)
for layer in model_base.layers:
    layer.trainable = False

That last line freezes the pretrained layers so that you preserve the features of the pretrained model and just train the new layers.
I wrote a blog post that goes through the basics of working with pretrained models and extending them to work on various image classification problems; it's also got a link to some working code examples that might provide more context: http://innolitics.com/10x/pretrained-models-with-keras/