text:
Q: What is the domain "safebrowsing-cache.google.com" used for? A user on my network has a ton of hits to the address safebrowsing-cache.google.com. Is it a proxy to bypass the network filter or is it a Google cache?

A: Safe Browsing is a service from Google that helps fighting the spam and phishing sites by blocking them in the browser.
When you go to a site, it's checked by Google. If it's returned as problematic, you get a warning in the browser.

Safe Browsing is integrated in Google Chrome and in the Google Toolbar.


text:
Q: Is it possible to combine system link and split screen play on Halo 3's campaign? I know that online you can play 4 player campaign, but on split screen mode you are limited to two players. Is it pssible to play both System Link and split screen with two consoles, and two players each?
(Between free games with my 360's replacement, the free game when someone got it as a present, and the disc in ODST and the fact that Gamestop only give €3 for trade ins I do have several Halo 3 game discs)

A: Yes, Halo is one of the few games that allows you do both split screen and live/system link at the same time. It is possible to play four player campaign with two per xbox over system link.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Play2 form attributes with - in them "value - is not a member of Symbol" I've just got started with Play2 and I'm struggling with scala.
In a view I've got this simple form helper to create a news item.
@textarea(
  newsItemForm("content"),
  '_label -> "Content",
  'rows -> 3,
  'cols -> 50,
)

Now I'd like to add a data-wysiwyg to the attributes, but since it contains a - scala complains about - not being a member of Symbol.
since ' is just a nice way of writing Symbol("data-wysiwyg") I can get it working, but then my views will look ugly with some attributes beeing specified with Symbol and others with '
My question is: is there a way to use the scala ' notation for html5 data- attributes?

A: I don't think it's possible because the dash will be interpreted as a minus sign. If the matter is to shorten the declaration, why not add a method s to strings to produce the corresponding symbol (akin to the r method for producing regexp) ?
class SymbolString( str: String ) {
  def s = Symbol(str)
}

implicit def str2symstr( str: String ) = new SymbolString(str)

scala> "hello".s
res20: Symbol = 'hello

scala> "data-wysiwyg".s
res21: Symbol = 'data-wysiwyg

A: You can also use the apply method of the Symbol companion object. I think this is more readable, as it makes it very obvious that you're creating a symbol:
scala> Symbol("data-wysiwyg");
res0: Symbol = 'data-wysiwyg


text:
Q: Why is twitter bootstrap's typeahead not working here? I'm trying to get typeahead.js working in my project.  I have bootstrap loaded in my project (downloaded the source from the bootstrap site just now).  Looking in the source shows no mention of typeahead, so I included the standalone js file.
I'm not getting any errors when I try to use it, but it's just not working.  Simple code:
<input type="text" class="typeahead" />

var source = ["test1", "test2", "test3", "test4"];

$('.typeahead').typeahead({
    source: source })

jsfiddle:  link
What am I doing wrong?  (note my js is at the bottom of the jsfiddle)

A: You're using a different version of typeahead.js than how you're calling it.
The latest version of typeahead expects a variable number of dataset arguments. See my updated version of your fiddle: http://jsfiddle.net/DTcHh/458/
var source = ["test1", "test2", "test3", "test4"];

function mySource(query, callback){
  srcs = [];
  for(var idx in source){
      var src = source[idx];
      if(src.indexOf(query) !== -1){
        srcs.push({value: src});
      }
  }
  console.log(srcs);
  callback(srcs);
}

$(document).ready(function(){
    var t = $(".typeahead");
    t.typeahead({}, {'source': mySource});
});

For each dataset, there needs to be a source attribute that points to a function. That function takes the query string and a callback function. It is expected that you do what you need with the query string and then call the callback function with a list of objects where each object has an attribute of value that maps to the value to display.
I think you should be able to specify {'local': source} in the options, but I haven't gotten it to work.
Anyway, if you want the old API, you'll have to use Bootstrap 2's version of typeahead.


text:
Q: What is a good example of using event constructors in js? I am trying to figure out how to properly create and fire events in JavaScript, so in the process of learning ran into this page:
https://developer.mozilla.org/en-US/docs/DOM/document.createEvent
Which at the top informs me of the following:

The createEvent method is deprecated. Use event constructors instead.

Googling JS event constructors was not very fruitful - topics talking about constructors in general, but not what I am looking for. Could somebody please explain to me what are the event constructors and provide a good example of their usage?

A: From https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent:
It seems that events are now encapsulated in a class called CustomEvent.  You can think of the old document.createEvent as a factory method that returns an event object.  Now, instead of using document.createEvent to create the object, you now have access to create the object directly.
    //this is the new way
    var my_event = new CustomEvent('NewEventName');
    var my_element = document.getElementById('TargetElement');
    my_element.dispatchEvent(my_event);

is the replacement for
    //this is the old way
    var my_event = document.createEvent('NewEventName');
    var my_element = document.getElementById('TargetElement');
    my_element.dispatchEvent(my_event);

A: You want to use addEventListener()
https://developer.mozilla.org/en-US/docs/DOM/EventTarget.addEventListener
Here's my library code for attaching events, I found these on stackoverflow and put them inside of my app global namespace:
var app={}

app.listenEvent=function(eventTarget, eventType, eventHandler) {
   if (eventTarget.addEventListener) {
      eventTarget.addEventListener(eventType, eventHandler,false);
   }
  else if (eventTarget.attachEvent) {
      eventType = "on" + eventType;
      eventTarget.attachEvent(eventType, eventHandler);
  }
  else {
     eventTarget["on" + eventType] = eventHandler;
  }
}

app.cancelEvent=function(event) {
    if (event.preventDefault)
       event.preventDefault()
    else
       event.returnValue = false;
}

app.cancelPropagation=function(event) {
    if (event.stopPropagation) {
        event.stopPropagation();
    } else {
     event.cancelBubble = true; }
 }

So to add an listen for an event:
app.listenEvent(document.aform.afield, 'focus', function(){console.log(arguments)} )

These functions are great, they work in all browsers.


text:
Q: Is there any way to define an element in React that can be used throughout the component? For example I have the following component:
import React from 'react'

export default function App() {
  function handleOver() {
    const target = document.getElementById("target")
    target.style.background = "red"
  }

  function handleLeave() {
    const target = document.getElementById("target")
    target.style.background = "green"
  }

  return (

          Test

  )
}

Instead of defining target twice, can I define it once and call it from each event?

A: You can useRef, but also check recommended approach in second code snippet.
import React from 'react'

export default function App() {
  const target = useRef();

  function handleOver() {
    target.current.style.background = "red"
  }

  function handleLeave() {
    target.current.style.background = "green"
  }

  return (

          Test

  )
}

But probably it's better not to manipulate the DOM like that yourself, instead define some backgroundColor state variable with useState and use style binding like

 or assign a custom CSS class with these colors:
export default function App() {
  const [targetColor, setTargetColor] = useState(null);

  function handleOver() {
    setTargetColor("red");
  }

  function handleLeave() {
    setTargetColor("green");
  }

  return (

          Test

  )
}


text:
Q: Is returning an error code value from stored procedure good practice? In our company, we're using four types of simple stored procedures (insert, update, delete, select); database group persist on a rule that every single stored procedure should contain "error code" in return value for update/delete/insert stored procedure types.
To illustrate:
-------------------
--INSERT sp example
-------------------
 INSERT INTO dbo.SomeTable(..) VALUES(...)

 if @@error <> 0
   return -1
 return 0

-------------------
--UPDATE sp example
-------------------
declare
@errsql int
@updcount int

update dbo.SomeTable set foo = @bar

select @errsql = @@error, @updcount = @@rowcount
if @errSQL <> 0
  return -1
if @updcount < 1
  return -2
return 0

-------------------
--DELETE sp example
-------------------
delete from dbo.SomeTable where ...

if @@error <> 0
  return -1
return 0

This rule dates back to ages when we're using old ASP/VB6.0; however for a long age our platform is pure .NET and error on SQL side (such as primary key violation/unique index violation/etc.) is transferred to application as .NET exception, so following this pattern seems like a cargo cult programming (I can see checking updates rows count can be useful in some scenarios, still that should be driven by application developers, not by database group  - in the end you have to check return code in the app to have any effect :).
So my question is - can you see any benefit in this practice, or is this classical cargo cult programming example ?

A: If you are using exceptions in the rest of your project, I'd say exceptions should be the way to go. Notice you have the RAISEERROR (http://msdn.microsoft.com/en-us/library/ms178592.aspx) SQL clause so you can raise exceptions within those stored procedures.
I believe the severity must be over 16 on RAISEERROR for it to be raised as an exception (you may want to check http://msdn.microsoft.com/en-us/library/ms164086.aspx). Exceptions should rise for any error that would work on a TRY/CATCH SQL block.


text:
Q: Using a whitelist too large for an AWS VPC Security Group I have a large list of IPs I need to whitelist for a VPC instance. I've added as many ranges as possible to the security group until I ran out of available rules. I'm adding rules for HTTP and HTTPS for each range, and I'm still left with about 100 individual IPs that I need to whitelist.
AFAIU I can't increase the rule limit for the security group, is there any other way I can whitelist the remaining IPs?

A: Just put the additional rules in a second security group. Apply both groups to the instances - they're additive.


text:
Q: If statement function Hiding form inputs based on element value, How do I make it shorter? I have a large chunk of javascript that hides and shows inputs based on the element being selected, I want to reduce the number of else ifs I need to use in this case. Basically anyway I can shorten this code would be good.
    function routerChange(element) {
         if ((element.value == '****') || (element.value == '****')){
            $('.network_hide').show();
            $('.net_password_hide').show();
            $('.activation_hide').show();
            $('.telephone_hide').show();
            $('.ip_address_hide').show();
            $('.ppp_username_hide').hide();
            $('.ppp_password_hide').hide();
            $('.lan_ip_hide').hide();
            $('.subnet_mask_hide').hide();
        } else if (element.value == '2862N_DTG'){
            $('.network_hide').hide();
            $('.net_password_hide').hide();
            $('.activation_hide').hide();
            $('.telephone_hide').hide();
            $('.ip_address_hide').hide();
            $('.ppp_username_hide').show();
            $('.ppp_password_hide').show();
            $('.lan_ip_hide').show();
            $('.subnet_mask_hide').show();
             $('#PPP').show();
        } else if ((element.value == '****') || (element.value == '****') || (element.value == '****') || (element.value == '****')){
            $('.network_hide').show();
            $('.net_password_hide').show();
            $('.activation_hide').show();
            $('.telephone_hide').show();
            $('.ip_address_hide').hide();
             $('.ppp_username_hide').hide();
             $('.ppp_password_hide').hide();
             $('.lan_ip_hide').hide();
             $('.subnet_mask_hide').hide();
        } else if (element.value == '****'){
            $('.network_hide').hide();
            $('.net_password_hide').hide();
            $('.activation_hide').show();
            $('.telephone_hide').show();
            $('.ip_address_hide').hide();
             $('.ppp_username_hide').hide();
             $('.ppp_password_hide').hide();
             $('.lan_ip_hide').hide();
             $('.subnet_mask_hide').hide();
        } else if ((element.value == '****') || (element.value == '****') || (element.value == '****')){
            $('.network_hide').show();
            $('.net_password_hide').show();
            $('.activation_hide').hide();
            $('.telephone_hide').hide();
            $('.ip_address_hide').hide();
             $('.ppp_username_hide').hide();
             $('.ppp_password_hide').hide();
             $('.lan_ip_hide').hide();
             $('.subnet_mask_hide').hide();
        } else if (element.value == '****'){
            $('.network_hide').hide();
            $('.net_password_hide').hide();
            $('.activation_hide').hide();
            $('.telephone_hide').hide();
            $('.ip_address_hide').hide();
             $('.ppp_username_hide').hide();
             $('.ppp_password_hide').hide();
             $('.lan_ip_hide').hide();
             $('.subnet_mask_hide').hide();
        } else {
            $('.network_hide').show();
            $('.net_password_hide').show();
            $('.activation_hide').show();
            $('.telephone_hide').show();
            $('.ip_address_hide').show();
            $('.ppp_username_hide').hide();
            $('.ppp_password_hide').hide();
            $('.lan_ip_hide').hide();
            $('.subnet_mask_hide').hide();
        }
            }

Just to be clear this code works as intended, I just want to reduce its size.

A: I'd use an array of objects, with properties: (1) a function to invoke, which, if it returns true: (2) hides all selectors in a hide array (3) shows all selectors in a show array. For example:
const conditions = [
  {
    fn: value => value == '****' || value == '****',
    show: ['network_hide', 'net_password_hide', 'activation_hide', 'telephone_hide', 'ip_address_hide'],
    hide: ['ppp_username_hide', 'ppp_password_hide', 'lan_ip_hide', 'subnet_mask_hide']
  },
  {
    fn: value => value === '2862N_DTG',
    show: ...
  }
  ...
];
// For the final else:
const defaults = {
  show: ['network_hide', 'net_password_hide', 'activation_hide', 'telephone_hide', 'ip_address_hide'],
  hide: ['ppp_username_hide', 'ppp_password_hide', 'lan_ip_hide', 'subnet_mask_hide']
};

Then .find the first condition that passes, or use the defaults object if none pass:
function routerChange(element) {
  const { value } = element;
  const found = conditions.find(cond => cond.fn(value)) || defaults;
  found.show.forEach(classToShow => $('.' + classToShow).show());
  found.hide.forEach(classToHide => $('.' + classToHide).hide());
}

It would be possible to minify it further, but it would probably come at the expense of readability, I think.

A: Not very smart solution but u can try this way it will reduce pretty enough code
function routerChange(element) {
    if ((element.value == '****') || (element.value == '****')){
        check(true, true, true, true, true, false, false, false, false)
    } else if (element.value == '2862N_DTG'){
       // call check again
    } else if ((element.value == '****') || (element.value == '****') || (element.value == '****') || (element.value == '****')){
        // call check again
    } else if (element.value == '****'){

    } else if ((element.value == '****') || (element.value == '****') || (element.value == '****')){
       // call check again
    } else if (element.value == '****'){
       // call check again
    } else {
        // call check again
    }
}

function check(nh, np, ah, th, ia, pu, pp, li, sm) {
  nh === true ? $('.network_hide').show() :  $('.network_hide').hide();
  np === true ? $('.net_password_hide').show() : $('.net_password_hide').hide();
  ah === true ? $('.activation_hide').show():  $('.activation_hide').hide();
  th === true ? $('.telephone_hide').show():  $('.telephone_hide').hide();
  ia === true ? $('.ip_address_hide').show():  $('.ip_address_hide').hide();
  pu === true ? $('.ppp_username_hide').hide():  $('.ppp_username_hide').hide();
  pp === true ? $('.ppp_password_hide').hide():  $('.ppp_password_hide').hide();
  li === true ? $('.lan_ip_hide').hide():  $('.lan_ip_hide').hide();
  sm === true ? $('.subnet_mask_hide').hide():  $('.subnet_mask_hide').hide();
}


text:
Q: Delete the current node from list : AngularJs Fiddle
 link where we can add new child nodes, and their child node too, can delete the child node form the parent ONLY.
I am trying to delete all the child node and ALSO the current node from the same delete button. (All child node are deleted successfully but i am not able to delete the current node from the list.)
How can i do this via Angular Js.
    angular.module("myApp", []).
controller("TreeController", ['$scope', function($scope) {
    $scope.delete = function(data) {
        data.nodes = [];
    };
    $scope.add = function(data) {
        var post = data.nodes.length + 1;
        var newName = data.name + '-' + post;
        data.nodes.push({name: newName,nodes: []});
    };
    $scope.tree = [{name: "Node", nodes: []}];
}]);

Can anyone please help.

A: To remove the current node also, you need to remove it from the parent, therefore you will need to store reference to parent node in data
data.nodes.push({name: newName,nodes: [], parent: data});

Then in delete(), you can access parent node and remove itself:
$scope.delete = function(data) {
    var index = data.parent.nodes.indexOf(data);
    if(index > -1) {
        data.parent.nodes.splice(index, 1);
    }
};

Updated jsfiddle


text:
Q: getClass method Java with array types So I've run into something odd and I don't know what it's called so I'm having trouble finding out information about it, hence my question here.
I've run into an issue where if you create an array of any type and call getClass on this array in Java you will get an odd return.  I am wondering why you get this specific return and what it means.
Code example is as follows:
byte[] me = new byte[1];
int[] me2 = new int[1];
double[] me3 = new double[1];
float[] me4 = new float[1];
String[] me5 = new String[1];
Integer[] me6 = new Integer[1];

System.out.println(me.getClass());
System.out.println(me2.getClass());
System.out.println(me3.getClass());
System.out.println(me4.getClass());
System.out.println(me5.getClass());
System.out.println(me6.getClass());

and the output is:
 class [B
 class [I
 class [D
 class [F
 class [Ljava.lang.String;
 class [Ljava.lang.Integer;

A: The toString method of Class invokes the getName method of Class which

Returns the name of the entity (class, interface, array class,
  primitive type, or void) represented by this Class object, as a
  String. If this class object represents a reference type that is not
  an array type then the binary name of the class is returned, as
  specified by The Java™ Language Specification.
If this class object represents a primitive type or void, then the
  name returned is a String equal to the Java language keyword
  corresponding to the primitive type or void.
If this class object represents a class of arrays, then the internal
  form of the name consists of the name of the element type preceded by
  one or more '[' characters representing the depth of the array
  nesting. The encoding of element type names is as follows:

 Element Type           Encoding
 boolean                Z
 byte                   B
 char                   C
 class or interface     Lclassname;
 double                 D
 float                  F
 int                    I
 long                   J
 short                  S

The class or interface name classname is the binary name of the class
  specified above.
Examples:
 String.class.getName()
     returns "java.lang.String"
 byte.class.getName()
     returns "byte"
 (new Object[3]).getClass().getName()
     returns "[Ljava.lang.Object;"
 (new int[3][4][5][6][7][8][9]).getClass().getName()
     returns "[[[[[[[I"

A: It's just some stupid naming convention. Would been much better if they are more humanly readable: class byte[] , class java.lang.Integert[][]

A: Those are the names of the underlying type object.  The [ indicates it's an array, and the following letter indicates the array type.  B=byte, I=integer, D=double, etc.  "L" is for class type members as you can see.

A: The [ at the start of the class name should be read as "array of ...", with "..." being what follows the [; the conventions for what follows are spelled out in the documentation for Class.getName() that @emory cited and linked to.
Section 4.3.1 of the Java Language Specification starts: "An object is a class instance or an array." This suggests that arrays are not class instances. (Perhaps this is what @TigerTrussell was getting at in his answer.) However, Section 10.8 starts: "Every array has an associated Class object, shared with all other arrays with the same component type. The direct superclass of an array type is Object." This suggests that arrays are, if not true class instances, pretty darn close.
Unfortunately, the syntax rules for Java prohibit inheriting from an array type:
public class MyFancyArray extends int[] { // ILLEGAL
   // ...
}

Note that this is a syntax constraint; there are no conceptual or semantic barriers (and it's allowed in many other OO languages).

A: Arrays don't have classes, they are simply data structures. The only thing having a class would be something extended from Object which is included in the array.


text:
Q: NEED website to close when FB link is clicked i have a website where there is a radio ad being played - and a FB "like" box - if someone clicks on a video within the FB stream it goes to FB and the website with the radio ad keeps playing.  I NEED to figure out how to make the website close.
I am a graphic designer, not a web expert - but i try, please don't bash me for not knowing the correct lingo.  I use adobe dreamweaver and am aware of the "target" preference but that only applies to something that is linked.. OH I'm using IFrame when asking for the code in FB for the like box.  please please help me!


text:
Q: Spark Memory Leak with MatrixFactorizationModel.recommendProductsForUsers(num: Int) I am preparing user recommendations based on Collaborative filtering. For this I have used org.apache.spark.mllib.recommendation._ .
But I have experienced a job failure due to spark memory leak when I ran the job with around size of 7GB. But I am getting results with small size data set.
ALS model configurations :

*

*rank  50

*iterations  15

*lamdha  0.25

*alpha  300

Spark Cluster Details :

*

*nodes  9

*memory 64 GB per node

*cores 4 per node

Running configurations :
--num-executors 16 --executor-cores 2 --executor-memory 32G

Code :
def generateTopKProductRecommendations(topK : Int = 20: RDD[Row] = {
       model.recommendProductsForUsers(topK)
      .map{ r => Row(r._1, r._2.map(x => x.product).toSeq)}
}

Even I tried to debug with,
model.recommendProductsForUsers(topK)
      .map{ r => Row(r._1)}

YARN log :
16/11/08 06:33:48 ERROR executor.Executor: Managed memory leak detected; size = 67108864 bytes, TID = 8796
16/11/08 06:33:48 ERROR executor.Executor: Managed memory leak detected; size = 67108864 bytes, TID = 8791
16/11/08 06:33:48 ERROR storage.ShuffleBlockFetcherIterator: Failed to get block(s) from xxx.xxx.xxx.xxx:42340
java.io.IOException: Failed to connect to xxx.xxx.xxx.xxx:42340
    at org.apache.spark.network.client.TransportClientFactory.createClient(TransportClientFactory.java:193)
    at org.apache.spark.network.client.TransportClientFactory.createClient(TransportClientFactory.java:156)......

16/11/08 06:33:48 ERROR storage.ShuffleBlockFetcherIterator: Failed to get block(s) from xxx.xxx.xxx.xxx:42340
java.io.IOException: Failed to connect to xxx.xxx.xxx.xxx:42340
    at org.apache.spark.network.client.TransportClientFactory.createClient(TransportClientFactory.java:193)
    at org.apache.spark.network.client.TransportClientFactory.createClient(TransportClientFactory.java:156)
    at org.apache.spark.network.netty.NettyBlockTransferService$$anon$1.createAndStart(NettyBlockTransferService.scala:88)


text:
Q: What does the Batch Apex "Holding" status mean and where is it documented? I've seen the following values in the AsyncApexJob table during the 'cradle to grave' life cycle of a Batch Apex job:
BEFORE running:

*

*Queued

*Preparing

WHILE running:

*

*Processing

AFTER running:

*

*Failed

*Aborted

*Completed

But I've noticed an additional picklist value that I've never encountered in the wild: Holding. Does anyone have experience with this? Do I need to include this when determining if a batch is running?

A: Based on the Summer '14 Release Notes the holding status appears to be associated with the new Apex Flex Queue feature.

The Apex Flex Queue pilot enables you to submit batch jobs beyond the allowed limit of five queued or active jobs. Any jobs that are submitted for execution but aren't processed immediately by the system are in holding status and are placed in a separate queue (the Apex flex queue). Up to 100 batch jobs can be in the holding status. When system resources become available, the system picks up jobs from the Apex flex queue and moves them to the batch job queue. The status of these moved jobs changes from Holding to Queued. Queued jobs get executed when the system is ready to process new jobs.
Without administrator intervention, jobs are processed first-in first-out—in the order in which they're submitted. Administrators can modify the order of jobs that are held in the Apex flex queue to control when they get processed by the system. For example, you can move a batch job up to the first position in the holding queue so that it is the first job that gets processed when the system fetches the next held job from the flex queue.

A: The Holding status is mentioned in the Summer 14 release notes under the new pilot feature of "Submit More Batch Jobs with Apex Flex Queue". Summer 14 release site: salesforce.com/customer-resources/releases/summer14.


text:
Q: Sum of a variable number of Big O's terms Let $k=o(n)$, let $n\to \infty$. I am interested in the asymptotic behaviour of
$$
\sum_{i=0}^k \log\left(1-\frac{i}{n}\right).
$$
By using the Taylor series of $\log$ I obtain
$$
\sum_{i=0}^k \log\left(1-\frac{i}{n}\right) = \sum_{i=0}^k -\frac{i}{n} + O\left(\left(\frac{i}{n}\right)^2\right) = \frac{-k(k+1)}{2n} + O\left(\frac{k^3}{n^2}\right)
$$
Manipulation with Big O seems too hand-wavy, and I'm not sure if this is correct.
I have $k$ and $n$ that both go to $\infty$, the first big O is based around $n$, but there is still the summation up to $k$ outside.
Does this make sense? Is it correct?
What if $k=o(\sqrt{n})$ or $k=o(n^{\frac{2}{3}})$, does that change anything?

A: Your work is correct, but it seems that it's not justified fully. Let's rewrite your first step (expansion of the Taylor series):
$$\sum_{i=0}^k\log\Big(1-\frac{i}{n}\Big)=-\sum_{i=0}^k\sum_{t=1}^\infty\frac{1}{t}\Big(\frac{i}{n}\Big)^t=-\sum_{i=0}^k\bigg(\frac{i}{n}+\sum_{t=2}^\infty\frac{1}{t}\Big(\frac{i}{n}\Big)^t\bigg).$$
Now you are right with intruducing the big-O element, but the furthest you can go is this:
$$-\sum_{i=0}^k\bigg(\frac{i}{n}+\mathcal{O}\bigg(\Big(\frac{i}{n}\Big)^2\bigg)\bigg)=-\frac{k(k+1)}{2n}-\sum_{i=0}^k\mathcal{O}\bigg(\Big(\frac{i}{n}\Big)^2\bigg).$$
You can't just swap the sum and the big-O. For that you need a uniform bound. Every big-O has some linear bound and here you have arbitrarily many big-O's. You need to give them a common bound. You can get just that with the next inequality:
$$0<\sum_{t=2}^\infty\frac{1}{t}\Big(\frac{i}{n}\Big)^t<\Big(\frac{i}{n}\Big)^2\Rightarrow0<\sum_{i=0}^k\bigg(\sum_{t=2}^\infty\frac{1}{t}\Big(\frac{i}{n}\Big)^t\bigg)<\sum_{i=0}^k\Big(\frac{i}{n}\Big)^2<\frac{k^3}{n^2}.$$
Now you can directly apply this to the first step:
$$-\frac{k(k+1)}{2n}-\frac{k^3}{n^2}<\sum_{i=0}^k\log\Big(1-\frac{i}{n}\Big)<-\frac{k(k+1)}{2n}.$$
And just now you can conclude your result:
$$\sum_{i=0}^k\log\Big(1-\frac{i}{n}\Big)=-\frac{k(k+1)}{2n}+\mathcal{O}\bigg(\frac{k^3}{n^2}\bigg).$$
You could go even further with:
$$\frac{1}{2}\Big(\frac{i}{n}\Big)^2<\sum_{t=2}^\infty\frac{1}{t}\Big(\frac{i}{n}\Big)^t<\Big(\frac{i}{n}\Big)^2\Rightarrow\frac{1}{2}\sum_{i=0}^k\Big(\frac{i}{n}\Big)^2<\sum_{i=0}^k\bigg(\sum_{t=2}^\infty\frac{1}{t}\Big(\frac{i}{n}\Big)^t\bigg)<\sum_{i=0}^k\Big(\frac{i}{n}\Big)^2$$
$$\Rightarrow\frac{1}{3}\frac{k^3}{n^2}<\sum_{i=0}^k\bigg(\sum_{t=2}^\infty\frac{1}{t}\Big(\frac{i}{n}\Big)^t\bigg)<\frac{k^3}{n^2},$$
and derive a tighter bound:
$$\sum_{i=0}^k\log\Big(1-\frac{i}{n}\Big)=-\frac{k(k+1)}{2n}+\mathcal{\Theta}\bigg(\frac{k^3}{n^2}\bigg).$$


text:
Q: Implement an Iterable interface with a single item I have this snippet, where I want to return a single instance board to test the solution.  What's a good way to return a single item and exhaust the Iterator?
Placing it an  final List and then emptying it an only option?
 public Iterable<Board> solution() {
        return new Iterable<Board>() {
            @Override
            public Iterator<Board> iterator() {
                return new Iterator<Board>() {
                    @Override
                    public boolean hasNext() {
                        return false; // change this
                    }

                    @Override
                    public Board next() {
                        return board;    // This does not work
                    }

                    @Override
                    public void remove() {

                    }
                };
            }
    };
}

A: I think you might be overthinking this just a bit, any Collection is an Iterable, so you could do something as simple as:
public Iterable<Board> solution() {
    return Collections.singleton(board);
}

A: The answer given by @nickb lead me to see how Singleton implements the iterator and I could come up with the following approach (for my learning /testing).
For production code, I will prefer @nickb's answer.
public Iterable<Board> solution() {
    return new Iterable<Board>() {
        /**
         * Returns an iterator over a set of elements of type T.
         *
         * @return an Iterator.
         */
        @Override
        public Iterator<Board> iterator() {

            return new Iterator<Board>() {
                private boolean hasNext = true;
                @Override
                public boolean hasNext() {
                    return hasNext;
                }

                @Override
                public Board next() {
                    if (hasNext) {
                        hasNext = false;
                    }
                    return board;
                }
                @Override
                public void remove() {

                }
            };
        }
    };
}


text:
Q: Can Marketing Cloud generate JWT tokens in AMPScript? As the title suggests, I need to make a callout to an external service but must sign the request with a JWT token (using a private key).
Is this possible?

A: This is newly supported with the GetJWT function.
string GetJWT(string key, string algorithm, string jsonPayload)

Example:
SET @JWT = GetJWT("0123456789abcdef0123456789abcdef", "HS256", @JSON)
SET @HREF = CONCAT("https://someurl?sign=",@JWT)


text:
Q: I want to have a content box resize in the middle of the screen I'm trying to make it so that when the web browser is resized the content boxes on the page resize but begin resizing from the middle of the page instead of from the edge. I have got the content boxes to resize just need help getting them to resize from the middle.

#getting-started {
  width: 1400px;
  margin: 0 auto;
  background-color: #9599b8;
  border: solid 1.5px #1f2a7f;
  border-radius: 15px;
  margin-top: 16px;
  margin-bottom: 16px;
  align-items: center;
  max-width: 100%;
}

Li Europan lingues

Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores.

At solmen va esser necessi far uniform grammatica, pronunciation e plu sommun paroles. Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues. Li nov lingua franca va esser plu simplic e regulari quam li existent Europan lingues.

It va esser tam simplic quam Occidental in fact, it va esser Occidental. A un Angleso it va semblar un simplificat Angles, quam un skeptic Cambridge amico dit me que Occidental es. Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores. At solmen va esser necessi far uniform grammatica, pronunciation e plu sommun paroles.

I want it to start resizing about 25% in from the left side.

A: check this i used property The resize property defines if (and how) an element is resizable check this code..i mould it hope it would be helpful for you as it resizing on equall proportional

#getting-started {
width: auto;
margin: 0 auto;
background-color: #9599b8;
border: solid 1.5px #1f2a7f;
border-radius: 15px;
margin-top: 16px;
  resize: both;
  overflow: auto;
margin-bottom: 16px;
align-items: center;
max-width: 100%;}

Let the user resize both the height and the width of this div element.

To resize: Click and drag the bottom right corner of this div element.

check it out hope it would help you


text:
Q: Adding a titled color bar and generally getting a colored scatter plot to look good I'm creating a scatter plot that is colored according to a 2-d array, but having trouble getting the color bar set up correctly alongside it. What I have so far is:
self.fig1 = plt.figure('blahblahblah', (10.0,10.0)))
ax2=plt.subplot(111)
ax2.set_ylabel('blah')
ax2.set_xlabel('blah')
ax2.set_title....
...
...
cmap, norm = mpl.colors.from_levels_and_colors9[0.9, 0.975, 1.025, 1.1],['green', 'red', 'blue'])
ax2.scatter(firstarray,secondarray,c=colordefiningarray,marker="o",cmap=cmap,norm=norm, vmin=0.9,vmax=1.1)
cax=self.fig1.add_axes([0.95, 0.2, 0.02, 0.6]) #pulled these #s from another question, no idea what they mean
cb = mpl.colorbar.ColorbarBase(cax, cmap=cmap, norm=norm, spacing='poportional')
cb.set_label('moreblah')
#saving fig

The color bar is showing up, except it doesn't have a title. Also, i feel as if there is a much easier way to this, but I can't seem to figure it out from other questions.
EDIT: I now know it's an issue with the saved image scaling. I don't know how to scale the image without scaling the figure. Help?
Thank you in advance for the help!


text:
Q: How to use dynamic table_name in OPENJSON query? I have a query like :
DECLARE @jsonVariable NVARCHAR(MAX)
SET @jsonVariable =
N'{ "id" : "11","info": { "fname": "John", "surname": "Smith" }, "age": "25" }'

INSERT INTO Employees
SELECT *
FROM OPENJSON(@jsonVariable)
  WITH (id int,fname nvarchar(50) '$.info.fname')

How to use a dynamic TableName after INSERT INTO instade of Employees?
I have tried with sp_executesql:
DECLARE @jsonVariable NVARCHAR(MAX)
DECLARE @TABLENAME NVARCHAR(MAX) = 'Students'
DECLARE @SQL NVARCHAR(100)

SET @jsonVariable =  N'{ "id" : "11","info": { "fname": "John", "surname": "Smith" }, "age": 25 }'

SET @SQL = 'INSERT INTO '+ @TABLENAME +' SELECT *  FROM
OPENJSON(@jsonVariable); WITH (id int ,age nvarchar(50))'
EXEC sp_executesql @SQL

But getting the error : Must declare the scalar variable "@jsonVariable".
Is there any way to do it?

A: Please use like this.
CREATE TABLE Em
(
     Id INT
    ,fName VARCHAR(10)
)
GO

DECLARE @jsonVariable NVARCHAR(MAX)
DECLARE @TableName VARCHAR(10) = 'Em'
SET @jsonVariable =
    N'{ "id" : "11","info": { "fname": "John", "surname": "Smith" }, "age": 25 }'

DECLARE @SQL AS VARCHAR(MAX) = '

INSERT INTO ' + @TableName + '
SELECT *
FROM OPENJSON(' + '''' + @jsonVariable + '''' + ')
  WITH (id int,fname nvarchar(50) ''$.info.fname'') '

EXEC(@SQL)
SELECT * FROM Em

OUTPUT
Id          fName
----------- ----------
11          John

(1 rows affected)


text:
Q: Parallel.Invoke does not wait for async methods to complete I have an application that pulls a fair amount of data from different sources. A local database, a networked database, and a web query. Any of these can take a few seconds to complete. So, first I decided to run these in parallel:
Parallel.Invoke(
   () => dataX = loadX(),
   () => dataY = loadY(),
   () => dataZ = loadZ()
);

As expected, all three execute in parallel, but execution on the whole block doesn't come back until the last one is done.
Next, I decided to add a spinner or "busy indicator" to the application. I don't want to block the UI thread or the spinner won't spin. So these need to be ran in async mode. But if I run all three in an async mode, then they in affect happen "synchronously", just not in the same thread as the UI. I still want them to run in parallel.
spinner.IsBusy = true;

Parallel.Invoke(
     async () => dataX = await Task.Run(() => { return loadX(); }),
     async () => dataY = await Task.Run(() => { return loadY(); }),
     async () => dataZ = await Task.Run(() => { return loadZ(); })
);

spinner.isBusy = false;

Now, the Parallel.Invoke does not wait for the methods to finish and the spinner is instantly off. Worse, dataX/Y/Z are null and exceptions occur later.
What's the proper way here? Should I use a BackgroundWorker instead? I was hoping to make use of the .NET 4.5 features.

A: As you stated in your question, two of your methods query a database (one via sql, the other via azure) and the third triggers a POST request to a web service. All three of those methods are doing I/O bound work.
What happeneds when you invoke Parallel.Invoke is you basically trigger three ThreadPool threads to block and wait for I/O based operations to complete, which is pretty much a waste of resources, and will scale pretty badly if you ever need to.
Instead, you could use async apis which all three of them expose:

*

*SQL Server via Entity Framework 6 or ADO.NET

*Azure has async api's

*Web request via HttpClient.PostAsync
Lets assume the following methods:
LoadXAsync();
LoadYAsync();
LoadZAsync();

You can call them like this:
spinner.IsBusy = true;
try
{
    Task t1 = LoadXAsync();
    Task t2 = LoadYAsync();
    Task t3 = LoadZAsync();

    await Task.WhenAll(t1, t2, t3);
}
finally
{
    spinner.IsBusy = false;
}

This will have the same desired outcome. It wont freeze your UI, and it would let you save valuable resources.

A: It sounds like you really want something like:
spinner.IsBusy = true;
try
{
    Task t1 = Task.Run(() => dataX = loadX());
    Task t2 = Task.Run(() => dataY = loadY());
    Task t3 = Task.Run(() => dataZ = loadZ());

    await Task.WhenAll(t1, t2, t3);
}
finally
{
    spinner.IsBusy = false;
}

That way you're asynchronously waiting for all the tasks to complete (Task.WhenAll returns a task which completes when all the other tasks complete), without blocking the UI thread... whereas Parallel.Invoke (and Parallel.ForEach etc) are blocking calls, and shouldn't be used in the UI thread.
(The reason that Parallel.Invoke wasn't blocking with your async lambdas is that it was just waiting until each Action returned... which was basically when it hit the start of the await. Normally you'd want to assign an async lambda to Func<Task> or similar, in the same way that you don't want to write async void methods usually.)


text:
Q: How to make an anchor tag refer to nothing? I use jQuery, I need to make some anchor tags perform no action.
I usually write it like this:
link

However this refers to the top of the page!

A: To make it do nothing at all, use this:
 ...

A: I know this is an old question, but I thought I'd add my two cents anyway:
It depends on what the link is going to do, but usually, I would be pointing the link at a url that could possibly be displaying/doing the same thing, for example, if you're making a little about box pop up:
About

Then with jQuery
$('#about').click(function(e) {
    $('#aboutbox').show();
    e.preventDefault();
});

This way, very old browsers (or browsers with JavaScript disabled) can still navigate to a separate about page, but more importantly, Google will also pick this up and crawl the contents of the about page.

A: Make sure all your links that you want to stop have href="#!" (or anything you want, really), and then use this:
jq('body').on('click.stop_link', 'a[href="#!"]',
function(event) {
     event.preventDefault();
});

A: You can have an HTML anchor (a tag) without an href attribute. Leave off the href attribute & it won't link to anything:
link

A: The only thing that worked for me was a combination of the above:
First the li in the ul

All Assigned

Then in the LoadTab2_1 I manually switched the tab divs.
$("#tabs-2-1").hide();
    $("#tabs-2-2").show();

This is because the disconnection of the  also disconnects the action in the tabs.
You also need to manually do the tab styling when the primary tab changes things.
$("#secTab1").addClass("ui-tabs-active").addClass("ui-state-active").addClass("ui-state-hover").addClass("ui-state-focus");
    $("#secTab1 a").css("color", "#ffffff");

A: The correct way to handle this is to "break" the link with jQuery when you handle the link
HTML
My Link

JS
$('#theLink').click(function(ev){
    // do whatever you want here

    ev.preventDefault();
    ev.stopPropagation();
});

Those final two calls stop the browser interpreting the click.

A: There are so many ways to do it like
Dont add and href attribute
 Test

You can add onclick event instead of href like
 Test

Or you can add void function like this which would be the best way

A: There are a few less than perfect solutions:
1. Link to a fake anchor

Problem: clicking the link jumps back to the top of the page
2. Using a tag other than 'a'
Use a span tag and use the jquery to handle the click
Problem: breaks keyboard navigation, have to manually change the hover cursor
3. Link to a javascript void function

Problem: breaks when linking images in IE
Solution
Since these all have their problems, the solution I've settled on is to link to a fake anchor, and then return false from the onClick method:

Not the most concise of solutions, but it solves all the problems with the above methods.

A: What do you mean by nothing?
blank page

or
won't navigate

A: You can do it by
Link

A: This answer should be updated to reflect new web standards (HTML5).
This:
This represents a placeholder hyperlink

... is valid HTML5. The tabindex attribute makes it keyboard focusable like normal hyperlinks. You might as well use the span element for this as mentioned previously, but I find using the a element more elegant.
See: https://w3c.github.io/html-reference/a.html
and: https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-href

A: I think you can try
link

The only catch I see over here is high level browser security may prompt on executing javascript.
Though this is one of the easier way than
Link

this should be used sparingly
Read this article for some pointers https://web.archive.org/web/20090301044015/http://blog.reindel.com/2006/08/11/a-hrefjavascriptvoid0-avoid-the-void

A: Here are the three ways for  tag's href tag property refer to nothing:
 link

link

 Link

A: If you don't want to have it point to anything, you probably shouldn't be using the  (anchor) tag.
If you want something to look like a link but not act like a link, it's best to use the appropriate element (such as ) and then style it using CSS:
Am I a link?

.fake-link {
    color: blue;
    text-decoration: underline;
    cursor: pointer;
}

Also, given that you tagged this question "jQuery", I am assuming that you want to attach a click event hander. If so, just do the same thing as above and then use something like the following JavaScript:
$('#fake-link-1').click(function() {
    /* put your code here */
});

A: sth.

this was my anchor tag. so return false on onClick="" event is not usefull here.
I just removed href="#" property and it worked for me just like below
sth.

and i needed to add this css.
.SomeClass
{
    cursor: pointer;
}

A: I encountered this issue on a WordPress site. The headers on dropdown menus always had the attribute href="" and the header plugin being used only allowed standard urls. The easiest solution there was just to run this code in the footer:
jQuery('[href=""]').click(function(e){
    e.preventDefault();
});

This will prevent blank anchors from doing anything.

A: React no longer support using a function like this href="javascript:void(0)" in your anchor tag, but here is something that works pretty well.
 null} >link

A: In HTML5 just remove the href attribute
Your text

A: I know this is tagged as a jQuery question, but you can answer this with AngularJS, also.
in your element, add the ng-click directive and use the $event variable which is the click event... prevent its default behavior:

You can even pass the $event variable into a function:

in that function, you do whatever you want with the click event.


text:
Q: Readable way of knowing if there is at least one difference between two Map in Java? I have two maps of type Map<Long, Integer>, one named "oldValues" representing the old state of an object, and the other named "newValues" representing the new state of the same object.
Is there a simple & readable way of knowing if the old state and the new state are different (ie. if the state has changed)?
Ideally, I'd like some "java.utils" or "Apache Commons" library function like:
hasChanged = !MapUtils.diff(oldValues, newValues).isEmpty();

Note: I looked for, but didn't find one.
Thanks.

A:
Doese'nt the equals method work?

A: Equals seems like a bad idea because examining the entire map for equality sounds expensive. You also would need to lock both maps to do the check to make it threadsafe.
There's an idea used in ConcurrentHashMap where the map uses a counter to detect changes. If this were public you could just compare the counter in the 2 maps for equality. It's not, but you could accomplish the same thing with a dirty flag or possibly a class representing the object state that wraps the map and simplifies the equality checking.


text:
Q: How do I receive multiple paragraphs from a user in Ruby2.6.3? I'm trying to receive multiple paragraphs at once from a user.
I've tried using gets, but it doesn't seem to be working... it discards the second paragraph:
#The code:
   print("Paste your text here: ")
.. essay = gets
.. puts(essay)

# Getting user imput (the second sentance is a separate paragraph)
Paste your text here:  I like cake.
 It makes me happy.

# What the computer did for puts(essay):
I like cake.
=> nil

I expected the result to be something like this:
"I like cake.\nIt makes me happy.\n"

But it gave me "I like cake." instead.
How could I end up with my expected result?

A: Add paragraphs to a string until the input consists of a empty line:
str  = ""
para = "init"
str << (para = gets) until para.chomp.empty? #or para == "\n"
p str

A: Here's an alternative, with a slightly different logic
def getps
  save, $/ = $/, "\n\n"
  gets.chomp
ensure
  $/ = save
end

str = getps

The global variable $/ is what Ruby uses to find out what line end is. gets gets things till line end. If we tell Ruby that line end is two newlines, then gets waits till we have two newlines in a row till it exits. Since we don't need them, we'll just chomp them off. The rest of the code is just to ensure that $/ gets restored properly afterwards so normal gets is not messed up forever.


text:
Q: Iterate a FormArray of FormGroups I'm having trouble getting my form array of form groups to work.
I'd like to iterate over the form array and render the inputs in each form group. When I call addExercise() the template doesn't render the new form group that I push to the form array. Also when I call saveWorkout() the console.log(this.workoutFormArray.value) line shows that the values from my inputs are not reflected.
workout.component.ts
workoutFormArray: FormArray;

ngOnInit() {
  this.workoutFormArray = new FormArray([
    new FormGroup({
      exercise: new FormControl(''),
      reps: new FormControl('')
    })
  ]);
}

addExercise() {
  this.workoutFormArray.push(
    new FormGroup({
      exercise: new FormControl(''),
      reps: new FormControl(''),
    })
  );
}

saveWorkout() {
  console.log(this.workoutFormArray.value);
}

workout.component.html
<ion-icon (click)="addExercise()" name="add" slot="end"></ion-icon>

<div [formArrayName]="workoutFormArray">
  <div *ngFor="let group of workoutFormArray.controls; let i = index">
    <div [formGroupName]="i">
      <ion-select
        placeholder="Exercise"
        formControlName="group.controls.exercise"
        (ionChange)="saveWorkout()"
      >
        <ion-select-option [value]="pushups"> Pushups </ion-select-option>
        <ion-select-option [value]="squats"> Squats </ion-select-option>
      </ion-select>

      <ion-input
        type="text"
        formControlName="group.controls.reps"
      ></ion-input>
    </div>
    <button type="button" (click)="saveWorkout()">Save</button>
  </div>
</div>

A: Updated: You mentioned that the workoutFormArray FormArray is the root of the form, you may have a read on this reported issue in GitHub: Supporting [formArray] without a [formGroup] parent #30264.
<div [formGroup]="$any(workoutFormArray)">
  ...
</div>

The problem was that you provided the wrong formControlName to the nested FormGroup. It should be:
<ion-select
  placeholder="Exercise"
  formControlName="exercise"
  (ionChange)="saveWorkout()"
>
  <ion-select-option value="pushups"> Pushups </ion-select-option>
  <ion-select-option value="squats"> Squats </ion-select-option>
</ion-select>

<ion-input type="text" formControlName="reps"></ion-input>

Without the prefix group.controls..
Demo @ StackBlitz


text:
Q: Eager load in JPA @Transactional test I am trying to do a test where the data from one entity is loaded eager, so I have a code like the following:
Entity:
@Entity
@Table(name = "tableA")
@NamedEntityGraph(name = "tableA.tableB", attributeNodes = [NamedAttributeNode("tableB")])
class TableA (

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    var id: Int = 0,

    @JoinColumn(name = "table_b_id", referencedColumnName = "id")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    @Fetch(FetchMode.JOIN)
    var tableB: TableB? = null
)

Repository:
@Repository
interface tableARepository: JpaRepository<TableA, Int>, JpaSpecificationExecutor<TableA>{

    @EntityGraph(attributePaths = [ "tableB" ])
    fun findByModelId(modelId: Int) : List<DispersionDetail>
}

Test:
@Test
@Transactional
fun disperserTest(){
    //Here the code to create a tableA and the tableB
    val tableAList = tableARepository.findAll()
}

The problem is that when debug my code the result of the tableAList the attribute tableB is null but when delete the @Transactional annotation from the test then tableB is not null and is loaded eager just how I want.
My question is why this happened and how can load tableA with all his relations (tableB) with the @Transactional annotation in the test


text:
Q: Android service destroy after lock screen I am using MediaBrowserServiceCompat in my app to play music. I am also starting service with startService method within the service and also using startForeground with notification as well as using wakelock require. But still my service is being destroyed after lock.
startService(new Intent(getApplicationContext(),
                            PlaybackService.class));

mService.startForeground(NOTIFICATION_ID, notification);

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
mWakeLock.acquire();

A: Calling Context.startForeground() instead of Context.startForegroundService() on Oreo+ devices can cause trouble.
Try to check Build version and call the appropriate method:
For Oreo+: startForegrountService()
For lower than Oreo: startForeground()


text:
Q: SQL View + foreach not looping through results I have a view that is returning a resultset LEFT OUTER JOIN from a SQL Database.  I'm using MVC 3 to display a partial view based on the resultset.  But....
@foreach (var category in Model.FeeScheduleRates().Distinct())
{

@category.Category

     foreach (var item in Model.FeeScheduleRates()
                               .Where(i=>i.Cat_ID == category.Cat_ID))
     {

             @item.Fee_Title - @item.Description
             @item.Amount

     }
}

The view isn't looping through the second foreach loop.  Rather, it repeats the first entry as many times as there are matching records.  So it should create a table with a row spanning two columns for each category, and then display the items in that category (Title, Description and amount.
Why doesn't the second foreach loop work?
EDIT:  As requested The View
SELECT  TOP (100) PERCENT a.Cat_ID, a.Fee_Title, a.Description, a.Amount, b.Category
FROM     dbo.Fee_Schedule AS a LEFT OUTER JOIN
           dbo.Fee_Categories AS b ON a.Cat_ID = b.Cat_ID
ORDER BY a.Cat_ID


text:
Q: MS SQL -- Add another restriction from a third table The question I have is I have to add another restriction:
All the listed items have to be green. So i found the colour of the items are in the table xitem.
 Where should I add that comment to my current code?
My current code is:
SELECT DISTINCT *
FROM xsale, xdept
WHERE xsale.deptname IN
  (
    SELECT deptname
    FROM xsale
    WHERE xsale.deptname=xsale.deptname
    AND deptfloor <> 1
  )


text:
Q: $\operatorname{Ran} \lambda I - T$ is closed for compact operator $T$ and $\lambda \neq 0$ Let $T$ be a compact operator on a Hilbert space $\mathcal{H}$ and $\lambda \in \Bbb{C} - \{0\}$. I want to show that $\operatorname{ran}  \lambda I - T$ is closed. So suppose we have $g_j = (\lambda I - T)f_j \in \operatorname{ran} \lambda I - T$ converging to some $f$. We need to show $f \in \operatorname{ran} \lambda I - T$.
First because $\lambda I - T$ is a bounded operator its kernel $V_\lambda$ is closed, hence $\mathcal{H} = V_\lambda^\perp \oplus V_\lambda$. With this we may assume wlog that $f_j \in V_\lambda^\perp$. Now the next hint in the problem is to show that $\{f_j\}$ is bounded under the assumption that $\{f_j\} \subseteq V_\lambda^\perp$. I have tried for about 1 hour and I can't show this.

How can I go around showing this?  Here's a partial proof for this fact that I have. We may write $$\begin{eqnarray*}||\lambda f_j||& =& \|\lambda f_j - Tf_j + Tf_j\| \\
&\leq& \| (\lambda I - T)f_j\| + \|Tf_j\|\\
&\leq& \|g_j\| +  \|T\|\|f_j\|\\
&\leq& N + \|T\|\|f_j\|\end{eqnarray*}$$
    where we have used that $g_j \to g$ impies $\|g_j\| \leq N$. Now we may rearrange to get $\|f_j\| (|\lambda - \|T\|) \leq N$ and so I will be done if I know $\|\lambda \| - \|T\|) \neq 0$. However this may not be true in general. So how can I show $\{f_j\}$ is bounded using the hint in Stein and Shakarchi? Please do not give full answers.

Next, assuming that $\{f_j\}$ is bounded and that $T$ is compact we know $Tf_{n_j} \to f$ for some $f \in \mathcal{H}$. However I don't know how to show this implies $g$ that we started out with is in $\operatorname{ran} \lambda I - T$.
What's strange about all of this is they claim in Stein and Shakarchi that the result is not true if $\lambda = 0$. My guess is that we somehow have to use the result that if $\lambda \neq 0$ that $V_\lambda $ is finite dimensional. All this is very puzzling at the moment and I would appreciate some help.

A: The key is to show that $S = (\lambda I - T)\lvert_{V_\lambda^\perp}$ has the property
$$\bigl(\forall x \in V_\lambda^\perp\bigr)\bigl(\lVert Sx\rVert \geqslant \delta \lVert x\rVert\bigr)\tag{1}$$
for some $\delta > 0$. Everything follows quite easily from that.
To show the existence of such a $\delta > 0$, suppose the contrary. Then there is a sequence $(x_n)$ in $V_\lambda^\perp$ with $\lVert x_n\rVert = 1$ for all $n$ and $Sx_n \to 0$. Use the compactness of $T$ and then $\lambda \neq 0$ to obtain a contradiction.
I assume the OP has meanwhile filled in the details, so let me add them here too:
If we had a sequence $x_n \in V_\lambda^\perp$ with $\lVert x_n\rVert = 1$, and $z_n = Sx_n \to 0$, by the compactness of $T$ there is a subsequence such that $Tx_{n_k}$ converges. Suppose without loss of generality that the subsequence is the entire sequence, so $y_n = Tx_n \to y$. Then
$$\lambda x_n = Sx_n + Tx_n = z_n + y_n \to 0 + y = y.$$
Since $\lambda\neq 0$, we have $\lVert y\rVert = \lvert\lambda\rvert > 0$, it follows that $x_n \to \lambda^{-1}y \in V_\lambda^\perp\setminus\{0\}$ and
$$S(\lambda^{-1}y) = \lim_{n\to\infty} Sx_n = \lim_{n\to\infty} z_n = 0,$$
contradicting $V_\lambda^\perp \cap V_\lambda = \{0\}$.
So the existence of a $\delta > 0$ with $\lVert Sx\rVert \geqslant \delta \lVert x\rVert$ for all $x\in V_\lambda^\perp$ is established.
Since $\mathcal{H} = V_\lambda \oplus V_\lambda^\perp$, we have the (linear) bijection $S\colon V_\lambda^\perp \to \mathcal{R}(\lambda I - T)$. Now if $(y_n)$ is a Cauchy sequence in $\mathcal{R}(\lambda I-T)$, then $(S^{-1}y_n)$ is a Cauchy sequence in $V_\lambda^\perp$ by $(1)$, and we have
$$\lim_{n\to\infty} y_n = \lim_{n\to\infty} S(S^{-1}y_n) = S(\lim_{n\to\infty} S^{-1}y_n) \in \mathcal{R}(S) = \mathcal{R}(\lambda I - T).$$
If we had not assumed $\lambda\neq 0$, we couldn't have deduced the convergence of $x_n$ from the convergence of $Sx_n\to 0$ and $Tx_n \to y$, and in fact the range of a compact operator is in general not closed.
It should be noted that the result does not depend on $\mathcal{H}$ being a Hilbert space, that only makes the proof a little bit more easy. When working with an arbitrary Banach space, the proof is exactly the same if one can establish a closed complement of $V_\lambda$. Although generally closed subspaces need not be complemented in Banach spaces, the compactness of $T$ implies the finite-dimensionality of $V_\lambda$, and finite-dimensional subspaces (as well as subspaces of finite codimension) are always complemented in Banach spaces. A slight variation of the proof considers the quotient $\mathcal{H}/V_\lambda$ instead of a complementing subspace.


text:
Q: Unable to upgrade bash everyone knows about bash vulnerability "CVE-2014-6271", I'm trying to update bash using below command.
apt-get update && apt-get install --only-upgrade bash

but i'm getting bash is already newest version.
Reading state information... Done
bash is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 47 not upgraded.

and its still vulnerable for "CVE-2014-6271".


text:
Q: How to limit number of the many in a one-to-many relationships between two tables? I have a MySQL database with two MySql tables. First is with The first table (table A) has a column with unique values(from values (from 1 to n). In the second table 2 (table B), I have two columns: in the first I have a name and in the second i have values from 1 to n(if i ad an value in the . The second it's updated column in table B is a reference to the first and vice versa. That's done)column in table A.
My Question: Can I limit the number of aparation of times the values from the second in table A appear in table B, specifically to a maximum of 10 times?
An example is this: (with limitation for column val to 3) (the third table would send an error)
First table:      Second table:        Third table(imaginary)
+---+             +----+-----+          +----+-----+
|val|             |name| val |          |name| val |
+---+             +----+-----+          +----+-----+
| 1 |             |  a |  1  |          |  a |  1  |
| 2 |             |  b |  2  |          |  b |  2  |
+---+             |  c |  1  |          |  c |  1  |
                  |  d |  1  |          |  d |  1  |
                  +----+-----+          |  e |  1  |
                                        +----+-----+

PS: Sorry for my english.

A: You need to add a constraint to the table definition of the second table.  This way, the database will check the value for you upon insert and update.

A: I think you will need to use a trigger: http://forge.mysql.com/wiki/Triggers#Emulating_Check_Constraints


text:
Q: Wordpress custom post type archive page wp_query pagination not working I have created an archive page for my 'Event' custom post ape called archive-event.php.
I used the content from the standard archive.php template and it listed my 4 events in the order they were posted.
The next step was to change the order by the custom field event_date. I did this no problems. Then I wanted to not show any events that event_date had passed. The below code does this perfectly.
The issue I now have is my pagination is all messed up. I have the default reading settings set to 2 posts per page and I have a 'Load more' button to bring up the next two.
When I click 'Load more' it duplicates the two events already showing. Any ideas where I've gone wrong?
<?php
$today = date("Ymd");
$args = array (
    'post_type'      => 'event',
    'meta_key'       => 'event_date',
    'orderby'        => 'meta_value',
    'order'          => 'ASC',
    'meta_query'     => array(
                            array(
                                'key' => 'event_date',
                                'value' => $today,
                                'type' => 'numeric',
                                'compare' => '>=',
                                )
                            ),
                        );
$wp_query = new WP_Query( $args );

while( $wp_query->have_posts() )
{
$wp_query->the_post();
?>

Content goes here

<?php } wp_reset_postdata(); ?>

A: Depending on how the plugin builds the UI it may or may not be respecting the pagination functionality built into WordPress.
Try forcing the paged setting into your query like so:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array (
    'post_type'      => 'event',
    'paged'          => $paged, // this will be set to what WordPress thinks is the proper page to start
    'meta_key'       => 'event_date',
    'orderby'        => 'meta_value',
    'order'          => 'ASC',
    'meta_query'     => array(
                            array(
                                'key' => 'event_date',
                                'value' => $today,
                                'type' => 'numeric',
                                'compare' => '>=',
                                )
                            ),
                        );

Next, if this still doesn't work, you can test the assumption that the paged parameter isn't working for some reason by changing the default paged value like so (again, just to test):
$paged = 2; // just force it to start on the second page to see if that works

If the above test works, I would say that get_query_var() believes you're on the first page.


text:
Q: Exponential fit overflow compilation error I don't know what am doing wrong.
amount={20,30,40,50,60,70,80,90,120,130,140,150,160,170,180,190,200}
capa={12,32,50,65,87,110,145,185,320,380,445,510,580,650,710,790,860}
data=Transpose[{amount,capa}]
nlm=NonlinearModelFit[data,A*(1-Exp[-b*x]),{A,B},x]
Using this I get overflow compilation error and nothing happens.
When I use the exact same fit in Origin or Matplotlib I get correct fit with A=-135and B=-0.01017.

A: As you could read on the Documentation page for the "General::ovfl" message you got, the problem here possible in bad starting values chosen by NonlinearModelFit. Let us try to specify better starting values:
nlm = NonlinearModelFit[data, a*(1 - Exp[-b*x]), {{a, -1}, {b, 0}}, x];
nlm["BestFitParameters"]

(*=> {a -> -134.847, b -> -0.0101706} *)

Right answer and no error messages.


text:
Q: Lattice of Subgroups of Group
Describe all groups $\mathcal G $ whose lattices of subgroups look like the Hasse Diagram shown.
I do not understand how to begin and I am unable to visualize the lattice relation among the subgroups. Some help in that direction will be greatly appreciated.

A: According to the given lattice diagram of subgroups of some group $G$, $G$ has a unique nonidentity proper subgroup.  It can be shown that such a group $G$ is necessarily a cyclic group of order the square of a prime.  For suppose the order of $G$ is divisible by two distinct primes $p$ and $q$. Then, by Cauchy's theorem $G$ contains (cyclic) subgroups of order $p$ and $q$, which are necessarily distinct, but your lattice diagram shows only one nonidentity proper subgroup.  Thus, the order of $G$ is $p^m$ for some prime $p$ and some $m \ge 2$ (here, $m \ne 1$  because the cyclic group $C_p$ has no nontrivial subgroups by Lagrange's theorem).  Any group of order $p^m$ contains subgroups of orders $1,p,p^2,\ldots,p^{m-1}$ (this can be proved using the isomorphism theorems), whence $m=2$ by the given lattice diagram.  Thus, $|G|=p^2$.  A group of order $p^2$ is either the cyclic group $C_{p^2}$ or the direct product $C_p \times C_p$.  But the latter group has more than one nonidentity proper subgroup, contradicting the lattice diagram.   Thus, $G$ must be $C_{p^2}$.
A simpler proof is as follows. Suppose the group $G$ of the given lattice is not cyclic.  Then, $\exists x \in G-1$ such that $\langle x \rangle$ is a proper subgroup of $G$.  Let $y \in G - \langle x \rangle$.  Then $\langle y \rangle$ is also a proper subgroup of $G$ and is distinct from $\langle x \rangle$, contradicting your lattice diagram.  Thus, $G$ must be cyclic.  Since $G$ has only one nontrivial subgroup, by the basic results on all subgroups of cyclic groups, the order of $G$ must have only one divisor besides 1 and $|G|$.  Hence this order must be the square of a prime.

A: Every point on this lattice is a subgroup of $\mathcal{G}$, and every subgroup of $\mathcal{G}$ is one of the points.  An edge from a point down to another point indicates a subgroup relation.
At the top of the lattice is the group $\mathcal{G}$ itself.  At the bottom is the trivial subgroup $\{1_{\mathcal{G}}\}$.  In the middle is some proper subgroup of $\mathcal{G}$.  There must be no other subgroups of $\mathcal{G}$ (or they would have been indicated in the diagram).
So, your task is to classify which groups have this specific property.


text:
Q: AFNetworking AFHTTPSessionManager POST called twice I am using the new afnetworking 3.0 library to make network request to login using AFHTTPSessionmanager. So when I do a POST Call and in the response if I get 401, there is another network request being called silently.
How can I avoid it by not calling the service again on the failure callback ?
[manager POST:[[urlReq URL] absoluteString] parameters:nil progress:nil success:^(NSURLSessionTask *operation, id responseObject)

A: You'll see that second request if you're receiving an authentication challenge.
You can, if you want, simply reject the authorization challenge, which stops the second request:
[manager setTaskDidReceiveAuthenticationChallengeBlock:^NSURLSessionAuthChallengeDisposition(NSURLSession * _Nonnull session, NSURLSessionTask * _Nonnull task, NSURLAuthenticationChallenge * _Nonnull challenge, NSURLCredential *__autoreleasing  _Nullable * _Nullable credential) {
    return NSURLSessionAuthChallengeCancelAuthenticationChallenge;
}];

Or, if you want to go ahead and authenticate, you could do something like:
[manager setTaskDidReceiveAuthenticationChallengeBlock:^NSURLSessionAuthChallengeDisposition(NSURLSession * _Nonnull session, NSURLSessionTask * _Nonnull task, NSURLAuthenticationChallenge * _Nonnull challenge, NSURLCredential *__autoreleasing  _Nullable * _Nullable credential) {
    if (challenge.previousFailureCount == 0) {
        *credential = [NSURLCredential credentialWithUser:self.user password:self.password persistence:NSURLCredentialPersistenceForSession];
        return NSURLSessionAuthChallengeUseCredential;
    }

    return NSURLSessionAuthChallengeCancelAuthenticationChallenge;
}];

It all depends upon how you're authenticating users on your web service.


text:
Q: How to stop casting when another app starts casting? I run two applications, both of which use Cast SDK v2 and the Remote Display API. I start casting from App #1, then go to App #2, press the cast button and select a route.
Expected: App #2 starts casting, App #1 stops casting.
Actual: Immediately after I select a route, App #2's MediaRouter.Callback.onRouteUnselected() is called. Neither app's content shows up on the receiver, but App #1's notification controller remains.
I haven't seen this behavior in Cast SDK v3. Is there any way in Cast SDK v2 to ensure that a prior cast session stops  when another app starts casting?

A: I haven't done this yet but you can try implementing a addUpdateListener and perform session.stop when another one starts.
addUpdateListener(listener)

Adds a listener that is invoked when the Session has changed. Changes
  to the following properties will trigger the listener: statusText,
  namespaces, status, and the volume of the receiver.
Listeners should check the status property of the Session to determine
  its connection status. The boolean parameter isAlive is deprecated in
  favor of the status Session property. The isAlive parameter is still
  passed in for backwards compatibility, and is true unless

status = chrome.cast.SessionStatus.STOPPED

Stop the app method:
function stopApp() {
    session.stop(onSuccess, onError);
}


text:
Q: Can't login to Firebase on StackBlitz The Firebase integration is not working, I give StackBlitz access to my personal Google account, it loads, and it nothing happens, it still says that I have not yet connected my Google account to StackBlitz.

A: I had Firebase setup but didn't create a project yet, once I did that it worked perfectly.


text:
Q: How to change .carousel-control-next-icon hover color Which css property controls the hover color for the bootstrap 4 carousel control icons - ".carousel-control-next-icon" & ".carousel-control-prev-icon"?

A: The Carousel icon arrows use SVG images. You can change the fill attribute as needed with a HEX, RGBA, named color etc...
.carousel-control-prev-icon {
  background-image: url("data:image/svg+xml;charset=...' fill='#ffcc00' ...);
}

.carousel-control-next-icon {
  background-image: url("data:image/svg+xml;charset=...' fill='cyan' viewBox='...');
}

https://www.codeply.com/go/s9QQJY5uDU
Another option is to use a font icon such as Fontawesome, Feather Icons, etc...


text:
Q: JQuery loading inside html file but not in linked javascript file (JqueryUI tabs) I'm currently having a weird problem.
I'm using JqueryUI tabs, and am loading php pages with each tabs. This works well for me, but what I am trying to do, is loading another php page from within one of those tabs with the html "a" tag. For some reason, it doesn't work when I place the click function in a already linked javascript file, but works when I place the code in a script tag directly in the html file.
Here is the function:
$(function(){
    $('a.commandsRecep').on('click',function(e){
        e.preventDefault();
        window.open(this.href,'','width=700,height=700');
    });
})

I know that loading pages from within a tab is done by Ajax and am wondering if that's what causing me problems.
The link is inside a table :
Réception des commandes

A: What is the order of includes?
Make sure that jquery is included before javascript file.
The order should be like :

A: Found it!
After a while, I got to the same type of error.
What I had to do was separate my script in two parts, one that required jqueryUI and one that didn't.
That way, in the html files where I don't import jqueryUI, I only import the one that doesn't require it.
Looks like having jquery that required jqueryUI without having imported jqueryUI was stopping the script from executing.


text:
Q: Multiple parameters corrections algorithm to correct flow rate readings I have temporal readings of multiple flow meters of different zones.
A[a1, a2, a3...an],
F[f2, f2, f3......fn]
n is the zone number, A is air flow, F is fuel flow

THEORETICALLY, one can calculate a theory O2 from A/F. That is g(A/F)=O2T.
There is a measured O2, namely O2M.
Since the flow meter of air and fuel is not correct, there's a gap between O2T and O2M.
I tried introduce a correction factor k[k1, k2,....kn] to have the k multiply A to correct the flow. Using scipy.optimize.fmin to calculate k to minimize (O2T-O2M). But it failed.
I wonder if anyone can provide me some idea or code on calculating k to minimize O2T-O2M. With the k calculated, the zonal flow rate can be corrected by using data.
Thanks.


text:
Q: Doesn't the Stack Exchange community support mainframe related questions? I see that Super User doesn't have any questions tagged Mainframes, or COBOL, or JCL, nor have I seen mainframe related support on Stack Overflow.
Does that mean that the Stack Exchange community does not support mainFrames and related development, or does it simply mean that no one has ever asked such a question before?
Personally, I feel that JCL, COBOL, CICS, being vast fields, would certainly benefit from Stack Exchange's community support.

A: It can mean one of three things (and you had two of them right):

*

*There simply have not been any questions about them yet.

*There have been questions, but they were deleted and so were the tags after a while.

*There's been a discussion on Meta.SU deeming those subjects off-topic for SU.

I haven't looked into it yet, but if it's the first two, then you have the liberty to post questions about them. Make sure you phrase them well and generally follow the advice given in the faq for the site.
If you don't know which it is, then dig around on the site's Meta and find a post relating to it. If it's been discussed, then you're in luck, and it will definitely guide you in the right direction. If it's the third, and the meta post confirmed that, then that's where it ends.

A: There certainly are mainframe programming-related questions on SO - for example, we had a fun time pulling Delphi-related questions out of jcl and into their own tag, after a discussion about it here.
For hardware support, I would agree with ChrisF that SF probably makes more sense than SU.  SF does have some mainframe-related questions, though not many.


text:
Q: convert array to dictionary in php I have array (returns from database), looks like this:
response = {
    0 = {
        id = "12312132",
        title = "title1",
        ....
        createDT = "2015-03-03 22:53:17"
        }
    1 = {
        id = "456456456",
        title = "title2",
        ....
        createDT = "2015-03-03 22:53:17"
        }
    2 = {
        id = "789789789",
        title = "title3",
        ....
        createDT = "2015-03-03 22:53:17"
        }
    }

I need to convert this in dictionary use php like this:
response = {
    "12312132" = {
        title = "title1",
        ....
        createDT = "2015-03-03 22:53:17"
        }
    "456456456" = {
        title = "title2",
        ....
        createDT = "2015-03-03 22:53:17"
        }
    "789789789" = {
        title = "title3",
        ....
        createDT = "2015-03-03 22:53:17"
        }
    }

i.e. key is id. Perhaps there is some function in php, for do it easy?

A: There is nothing of dictionary term in PHP. What you actually mean is an associative array, also commonly known as a hash. The same thing though, but this can make it easier to google up in future.
You can do it in several ways, I will give you classic foreach() one. I think array_map() approach would be possible too.
$response = ...;        // your database response
$converted = array();   // declaring some clean array, just to be sure

foreach ($response as $row) {
    $converted[$row['id']] = $row;        // entire row (for example $response[1]) is copied
    unset($converted[$row['id']]['id']);  // deleting element with key 'id' as we don't need it anymore inside
}
print_r($converted);

A: No, but you can write a little program in PHP:
$result = array();
foreach ($response as $row)
{
  $id = $row['id'];
  unset($row['id']);
  $result[$id] = $row;
}

echo '<pre>';
print_r($result);
echo '</pre>';

And even make that into your own function:
function dictonary($response)
{
  $result = array();
  foreach ($response as $row)
  {
    $id = $row['id'];
    unset($row['id']);
    $result[$id] = $row;
  }
  return $result;
}

A: Loop through the results to populate the array again in new format
    $count = count($response) // count the items of your initial array
    $i=0;
    while($i<$count) { //start a loop to populate new array
    $key = $response[i]['id'];
    $new_response[$key] = array('title' =>  $response[i]['title'], ... ,'createDT' => $response[i]['createDT']);
    $i++;
    } // end loop

print_r($new_response);

A: You can achieve this using array_combine and array_column, like this :
$result = array_combine(array_column($response, 'id'), $response);

Basically, this :

*

*extracts an array of the values of ids

*use this list as key for a new array, using $response as values.


text:
Q: Oracle - trigger after update I have trigger:
CREATE OR REPLACE TRIGGER TR.TR_OUTPUT_EHT_UPDATE_OPE
  AFTER DELETE
  ON TR.TR_JN_OUTPUT_EHT
  FOR EACH ROW
DECLARE
   BEGIN
  UPDATE TR.TR_BP tbp
    SET tbp.DONE= 2, tbp.DATA_WYK = SYSDATE
    WHERE EXISTS (SELECT ARCH.NR
    FROM TR.TR_KB_OUTPUT_ARCH ARCH
        WHERE ARCH.NR = tbp.NRKK)
    AND NOT EXISTS (SELECT OUTPUT.NR_SERYJNY
        FROM TR.TR_JN_OUTPUT OUTPUT
        WHERE OUTPUT.NR = tbp.NRKK);
END;
/

After that I want to get the "NRKK" of just updated row and update another table which is connected by this "NRKK":
UPDATE P.TR_OPE OPE
SET OPE.DATA = SYSDATE,
OPE.STATUS = OPE.STATUS + 1
WHERE OPE.NRKK = "NRKK"

I tried to do:
SELECT tbp.NRKK INTO v_nrkk FROM TR.TR_BP tbp WHERE tbp.DATA = (SELECT
MAX(tbp.DATA) FROM TR.TR_BP tbp1);

but I have errors: ORA 04091, ORA 06512 and ORA 04088.
EDITED:
I created another trigger:
CREATE OR REPLACE TRIGGER TR.TR_OP_E
  AFTER UPDATE ON TR.TR_BP
FOR EACH ROW
DECLARE
    v_nrkk TR.TR_BP.NRKK % TYPE;
BEGIN
  SELECT tbp.NRKK INTO v_nrkk FROM TR.TR_BPtbp WHERE tbp.DATA = (SELECT
MAX(tbp.DATA) FROM TR.TR_BP tbp1);

  IF v_nrkk is NOT NULL THEN
  UPDATE P.TR_OPE OPE
    SET OPE.DATA = SYSDATE, OPE.STATUS = 1
    WHERE OPE.ID_BR = '00100300'
    AND OPE.NRKK = v_nrkk;
  END IF;
  END;
/

But I have still errors...

A: As mentioned by @Renato Afonso, you can avoid mutating table error via using a COMPOUND TRIGGER. See below demo;
--Tables
CREATE TABLE TABLE_1 (data NUMBER);
/
CREATE TABLE TABLE_2 (DATA1 NUMBER);
/

--Record in table_1
SQL> select * from TABLE_1;

      DATA
----------
         1

--Record in table_2
SQL> select * from TABLE_2;

     DATA1
----------
         5

Trigger:
CREATE OR REPLACE TRIGGER TR_OP_E FOR
   INSERT OR UPDATE OR DELETE
   ON TABLE_1
   COMPOUND TRIGGER
   v_nrkk   TABLE_1.DATA%TYPE;
   AFTER STATEMENT
   IS
   BEGIN
      --Selecting from the same table on which trigger is created
      SELECT tbp.data
        INTO v_nrkk
        FROM Table_1 tbp
       WHERE tbp.DATA = (SELECT MAX (tbp.DATA)
                           FROM Table_1 tbp1);

      IF v_nrkk IS NOT NULL
      THEN
         UPDATE TABLE_2 OPE
            SET OPE.DATA1 = v_nrkk;
      END IF;
   END
   AFTER STATEMENT;

END;
/

Execution:
SQL> UPDATE TABLE_1 SET DATA = 2;

1 row updated.

SQL> COMMIT;

Commit complete.

SQL> select * from TABLE_1;

      DATA
----------
         2

SQL>  select * from TABLE_2;

     DATA1
----------
         2


text:
Q: What is the smallest possible value of $n$? Is an easy way to solve the problem?

The product of the digits of positive integer $n$ is $20$, and the sum of the digits is $13$. What is the smallest possible value of $n$?

The way I did is to list equations $$n_1+n_2+n_3+...+n_i=13$$ $$n_1*n_2*n_3*...*n_i=20$$ Then I tried $n_s$. I don't think this is not a very good method.

A: First, let's list out all of the ways $20$ can be factored with digits:
$$20=2*2*5$$
$$20=4*5$$
If we take $225$, we can add four $1$s at the beginning to get a number with a sum of $13$, so we have $1111225$.
If we take $45$, we can add four $1$s at the beginning to get a number with a sum of $13$, so we have $111145$.
Clearly, $111145$ is the smaller number, so that is our answer.

A: Hint: If the product is $20=2 \cdot 2 \cdot 5 = 4 \cdot 5$, then the only possible digits are $1,2,4,5$.

A: We see that $20$ can be factored as $2\times2\times5$.So,we can use only these three numbers or add $1$'s to our number since multiplying by $1$ gives same result.
So,we see,13 can be written as $2+2+5+1+1+1+1$.We add $4$ ones without changing the product.
So,least number possible with this is $111145$.
Note that we multiply the two $2$'s to form $4$ to give the least possible number.

A: Since $n_1,\dots,n_i$ are positive integers and $20$ is primarily decomposed as $20=2^2\cdot 5$, we quickly find the largest $n$, that is $5221111$.
But before finding the smallest, lets note since $20$ is a multiple of $5$ and no digits other than $0$ and $5$ aren't divisible by $5$. and since product of the digits is non-zero, one and only one of the digits is $5$, but by similar but not not same reasoning we can say either, one and only one digit is $4$, or, two and exactly two digits are $2$. in either ways the some of non-units is $9$. So, we have 4 other digits, each of which are unit. so the numbers we can write with the properties asserted, have either, 6, or 7 digits. of course the smallest among them should have 6 digit. and is $111145$


text:
Q: What are you supposed to use to write in Latex? There doesn't seem to be any application akin to Word or Google Docs I am new to Latex (technically not "new" - I got my interest from the Maths Stack Exchange, where I absorbed some Latex typesetting skills for maths). Hopefully, this type of question is allowed on this SE: basically, where do I start? I initially thought Latex was primarily for scientific typesetting for maths and chemistry etc only. ie recursive fractions, square roots, chemical equations which are impossible to typeset without using the "\blahblah" command.
But I really like the aesthetic and simplicity of Latex documents which I have seen in thesis and papers. I am actually very confused as to how this whole thing works - but hopefully there is a guide somewhere? I thought that there would be an app to make Latex documents like you do in Word but it seems that there are so many different downloads and extensions you have to get. Additionally, it seems very complex and overkill to write stuff like \startdocument, put an "&" sign whenever you want a new sentence, and especially tables get very complex when Word does it instantly.
Is it designed for everyday use? I am a school student but it would be nice to do homework in Latex (it seems only formal documents are in Latex, however). I have a mac and am just using the online Overleaf, but why are there so many more online website to do the same thing? (sorry I am not sure what tag to use)


text:
Q: How can I detect if the caller passed any variables to my function in Python? I guess the subject sounds pretty stupid, so I'll show some code:
def foo(**kwargs):
    # How can you detect the difference between (**{}) and ()?
    pass
foo(**{})
foo()

Is there any way to detect inside of foo, how the method was called?
Update 1
Because there were some comments why you possible want to do something, I'll try to explain some background.
super(MyClass, self).foo(*args, **kwargs) sucks - a lot of wasteful duplication. I want to write 'self.super()'. In this case, just call the super class and hand over all parameters that the calling method got as well. Works like a charm.
Now the problematic magic part:
I want to say 'self.super(something)' and in this case, only 'something' is passed to the super method. Works for most cases.
This is where it breaks:
def foo(self, fnord=42, *args, **kwargs):
    self.super(*args, **kwargs)

So the super method should get the arguments that the calling method - however if *args, **kwargs are empty, currently the library can not detect this condition and passed all arguments including 'fnord'...
Of course I could use self.super.foo(*args, **kwargs) as an alternative syntax but that's lame :-)
PS: Yes, I know p3k's super, but still not nice and it does not work with Python 2.x...
Update 2
Actually even Python's ast module removes the **{} (ast.parse('foo(**{})')) so it looks like this happens so early in the parsing process that you can not get this information later on...
So in the end I have either to give up on that specific problem (raising an AmbiguousSyntaxError) or to use text parsing as proposed by ~unutbu. Re-thinking my approach, the latter might actually feasable because I only need to know if it is self.super(\s*), self.super(\S+).

A: This hack only works with CPython.
import traceback

def foo(**kwargs):
    # stack is a list of 4-tuples: (filename, line number, function name, text)
    # see http://docs.python.org/library/traceback.html#module-traceback

    (filename,line_number,function_name,text)=traceback.extract_stack()[-2]
    print('foo was called: %s'%text)

foo(**{})
# foo was called: foo(**{})
foo()
# foo was called: foo()

As an example of how this might be useful:
def pv(var):
    (filename,line_number,function_name,text)=traceback.extract_stack()[-2]
    print('%s: %s'%(text[text.find('(')+1:-1],var))

x=5
pv(x)
# x: 5

Notice that pv is called with just the value x, but
it prints both the "name" of the variable (as it was called), and the value of a variable. Sometimes I use this when debugging and am too lazy to write out the full print statement.

A: In your update to your original question you wrote you want to be able to do something like this:
def foo(self, fnord=42, *args, **kwargs):
    self.super(*args, **kwargs)

Does this do what you want?
def foo(self, fnord=42, *args, **kwargs):
    self.super(fnord=fnord, *args, **kwargs)

A: So basically it is not possible to do that with the provided Python modules. I had to fall-back to plain-text regexes which work for me pretty well given the simplicity of my requirements.


text:
Q: Send data from bpm workflow to openERP? After a lot of research, i couldn't find any useful information that could be of use onto my problem.
My problem is how i can send business data from BPMS (bonita, tibgo, bizagi ....) to openERP via web services?.

A: To send data from Bonita BPM workflow (sorry I'm only familiar with this solution) to any external system you can use "connectors".
Bonita BPM provide a SOAP 1.2 Web Service connector that should allow you to push your process data to openERP.
You can refer to the Web Service connector tutorial form more information about the actual configuration of the connector.


text:
Q: JTableheader with checkable and sortable column I have a JTable where headers are sortable, Below is the code that I have used:
TableRowSorter<FolderModel> sorter = new TableRowSorter<FolderModel>(folderModel);
setRowSorter(sorter);

One column header has a checkbox, rendered with a custom renderer, to check and uncheck all the column values.
I have to choose a different gesture to distinguish between check/uncheck and sorting. I think a single click to sort and a double click to check/uncheck, but the problem is that also a double click fires sorting. What solution is possible?

A: Thanks to trashgod I realized that it's a bad idea trying to overload an header column with a checkbox when the headers are sortable too. It's better to put the checkbox outside the table.


text:
Q: How can we modify the width of the columns in gridlayout in nativescript? I created a grid layout with 5 columns in a row. I am stuck with modifying the width of each of hte columns. For example, in some cases i want to display only the last 2. However in other time,I want to display only the first 2 columns.
let gridContainer = createGridLayout('grid_layout','*,*,*,*,*','*')
columns = gridContainer.getColumns();
console.log(columns[0].value);


text:
Q: Standard deviation of POSIXlt type variable How can I calculate the standard deviation from POSIXlt type variable?
I got the min and max from summary  but there is no standard deviation. I try sd(dd) and I get inexplicable number: 242.5095
My data:
str(dd)
POSIXlt[1:71]
  format: "2015-10-01 00:03:43" "2015-10-01 00:01:06" "2015-10-01 00:01:17" "2015-10-01 00:00:41" ...

summary(dd)
                 Min.               1st Qu.                Median                  Mean               3rd Qu.
"2015-10-01 00:00:26" "2015-10-01 00:01:00" "2015-10-01 00:01:19" "2015-10-01 00:03:02" "2015-10-01 00:03:15"
                 Max.
"2015-10-01 00:26:08"

A: I'd use dplyr for this:
dd = data.frame(t = Sys.time() + 1:100)
dd %>% summarise_each(funs(mean, min, max, as.numeric(sd(.))))
                 mean                 min                 max as.numeric
1 2015-10-01 11:40:25 2015-10-01 11:39:35 2015-10-01 11:41:14   29.01149

Note that I cast the sd first to numeric in order to get a numeric value. Also note that I use POSIXct and not POSIXlt.

A: The standard deviation you get is in seconds.
sd takes a numeric vector, or converts the input to numeric. as.numeric calls as.double internally which gives the seconds since the epoc for POSIXlt objects.


text:
Q: standalone Ruby script to Rails 4 web app: where to store configuration details At work we have a downloadable ZIP file and on the download page we list the contents of the file so that people know what the ZIP contains.  Before, this list of ZIP contents was manually maintained and it was often inaccurate/out of date.  To fix this problem, I wrote a standalone Ruby script that is called from the command line like $ ruby my_script.rb arg1 arg2 arg3. This script generates the HTML that we can paste into the web page to display the ZIP file contents.
arg1 is the path to the extracted contents of the ZIP file, and arg2 and arg3 are paths to CSV files that contain data like so:
#arg2 — version numbers
/path/to/some/file,4.0
/path/to/another/file,3.2.9
/path/to/third/file,1.0

#arg3 — descriptions
/path/to/fourth/file,Here is a description
/path/to/fifth/file,Here is a description
/path/to/sixth/file,Here is a description

I want to convert this standalone Ruby script to a Rails 4 web app so that multiple people within the company can generate the needed HTML.
My question is where should I be storing the data that arg2 and arg3 contain?  Both of these files need to be able to be updated by whomever is generating the HTML.  I thought maybe I could store this info in the DB, one DB record per line of the CSV, and then provide an interface for adding/deleting/updating the records.  Then to get the data I would use Version.all or Description.all to get all of the records.  I am a bit hesitant, though, to make a model to hold this data since it doesn't really model anything—it is just a saveable representation of a CSV file.

A: Data
The data is the relatively simple part - you should keep it in your models & database.
You'll likely want two models (User and Details), which you'll be able to populate with the following code:
#app/models/user.rb
class User < ActiveRecord::Base
   has_many :details
end

#app/models/detail.rb
class Detail < ActiveRecord::Base
   #fields id | user_id | version | description | created_at | updated_at
   belongs_to :user
end

You can use Devise for authentication, giving you the ability to accept registration & population of users in your app. You'll then be able to associate the details of your app with each of the users you have.
You'll be able to get this working relatively simply:
#config/routes.rb
resources :details do
    get :send #-> domain.com/details/:detail_id/send
end

#app/controllers/details_controller.rb
class DetailsController < ApplicationController
   before_action :authenticate_user!

   def new
      @detail = current_user.details.new
   end

   def create
     @detail = current_user.details.new details_params
     @detail.save
   end

   def send
       #invoke rake task here
   end

   private

   def details_params
      params.require(:detail).permit(:user_id, :version, :description)
   end
end

Finally, this will give you the ability to use Rake like this:
#lib/tasks/file.rake
namespace :file do
    task :send => :environment do
        #invoke script for file here
    end
end

--
Obviously this is supremely generalised, but hopefully it will give you the ability to see how you can integrate a standalone Ruby script into a Rails app.
IMO, Rails should really be used to give you the ability to manage users & data in a more structured way. Coming from Ruby / native dev, you'll understand that Rails is just a framework (indeed, "just" a gem), which will give you the ability to manage your data more coherently. It will not replicate or replace your native / back-end code


text:
Q: Not able to pass shared value object (Multiprocessing.Value('i',10)) in pool apply_async arguments Passing shared value object to apply_async argument dosent run the object(probably dosent recognize)
from Multiprocessing import Value,Pool,apply_async
val = Value('i',1)

pool = Pool(processes=2)

pool.apply_async(some_func1_accepts_argument,args=(val,))
pool.apply_async(some_func2_accepts_argumet,args=(val,))
pool.close()
pool.join()

output: Nothing
whereas:
from Multiprocessing import Value,Pool,apply_async
val = Value('i',1)

pool = Pool(processes=2)

pool.apply_async(some_func1_dosen't_accepts_argumet)
pool.apply_async(some_func1_dosen't_accepts_argumet)
pool.close()
pool.join()

Runs fine
tried passing string/int 'tuple' in argument: also runs fine
problem comes for share memory object
p1=Process(target=some_func1_accepts_argument,args=(val,))
p2=Process(target=some_func2_accepts_argument,args=(val,))
p1.start()
p2.start()
p1.join()
p2.join()

Multiprocessing Process runs fine here with val as shared memory object
EXPECTED: two parallel process should come up when using apply_async with a shared memory argument

A: In order to utilise all the cores, multiprocessing module provides a Pool class. The Pool class represents a pool of worker processes. It has methods which allows tasks to be offloaded to the worker processes in a few different ways.
If you are using the Pool of processes in multiprocessing then for sharing object you have first make it global so that it could be available in every core of machine.Please find the below code:
from multiprocessing import Value,Pool, Lock
import time

def some_func1_accepts_argument():
    return value

def some_func2_accepts_argument():
    return value

def init(val):
    global value
    value=val.value

if __name__=='__main__':
    val = Value('i',1)

    pool = Pool(processes=2,initializer=init, initargs=(val,))
    res=pool.apply_async(some_func1_accepts_argument)
    res1=pool.apply_async(some_func2_accepts_argument)
    print(res.get())
    print(res1.get())

Above initializer in Pool class would make val available for all processes forked by main process.

A: maybe try to figure out what it is that is making your function crash? The manner in which you call the function looks correct to me so maybe your function is not able to handle the type of the argument you are giving it?
there are probably better ways to do this but maybe change your some_func1_accepts_argument and some_func2_accepts_argument to look like:
import traceback

def some_func1_accepts_argument(arg):
    try:
        your original stuff
    except Exception as e:
        print(e)
        traceback.format_exc()

This is similar to: error_callback in multiprocessing.Pool apply_async in Python 2?