text:
Q: Back "Button" in a Android App I want to create a Back "Button" in my Android app.
I have the standard Layout in the Eclipse project, with the small image in the left top corner. Now i want to open a new activity and when i click on this image, i want to get back to my activity before (like parent and children)
For example: The way on the ESPN ScoreCenter app:
Home Screen

Back Screen (This is the Screen i want)

Is this possible with two different Activitys?

A: Use setHomeAsUpEnabled() to show the back arrow. Override onOptionsItemSelected to end the activity:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            finish();
            return(true);
    }

    return(super.onOptionsItemSelected(item));
}

A: You just have to set listener on the button/imageView you are using as back. And inside that listener just call this.finish(). It will destroy the current activity and will take you on the previous/parent activity which started the current activity.
Example :
void onBack(View v){
// Will destroy current activity and take you to the previous activity which started this one
// Thus will act like back button
this.finish();
}

A: I suggest you to read the full article describing the ActionBar available on the Android developer guide:
http://developer.android.com/guide/topics/ui/actionbar.html
Particularly this chapter explaining in details the functionality you are asking and how to set it up:
http://developer.android.com/guide/topics/ui/actionbar.html#Home


text:
Q: Why am I getting "parameter is never used [E0392]"? I'm trying to implement an Octree in Rust. The Octree is generic over a type with a constraint that it should implement a generic trait:
pub trait Generable<U> {
    fn generate_children(&self, data: &U) -> Vec<Option<Self>>;
}

pub enum Octree<T, U>
where
    T: Generable<U>,
{
    Node {
        data: T,
        children: Vec<Box<Octree<T, U>>>,
    },
    Empty,
    Uninitialized,
}

Here is a simplified example reproducing the issue on the Playground
This generates an error:
error[E0392]: parameter `U` is never used
 --> src/main.rs:5:20
  |
5 | pub enum Octree<T, U>
  |                    ^ unused type parameter
  |
  = help: consider removing `U` or using a marker such as `std::marker::PhantomData`

Removing the U from the signature results in "undeclared type name 'U'".
Am I doing something wrong or is it a bug? How to do this properly?

A: I don't believe you want another generic here, you want an associated type:
pub trait Generable {
    type From;
    fn generate_children(&self, data: &Self::From) -> Vec<Option<Self>>
    where
        Self: Sized;
}

pub enum Octree<T>
where
    T: Generable,
{
    Node {
        data: T,
        children: Vec<Box<Octree<T>>>,
    },
    Empty,
    Uninitialized,
}

fn main() {}

As an aside, Vec<Box<Octree<T>>> is probably one level extra of indirection — you can just use Vec<Octree<T>>.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is dark energy (like) normal energy? I know that the term 'dark' is used because a) dark matter does not interact with light b) we know so little about them. Dark matter I guess could be just an unexplained type of particle we don't know about. But what about dark energy?
When we say 'dark energy', are we saying that it's a different concept altogether than energy? Is it saying that there is a third energy type to potential and kinetic? Or is it just 'normal' energy that we cannot explain the origin of? Or do we just not know?

A: What we know is that the mass-energy density of the universe must be much higher than expected from baryonic matter/dark matter in order to fit the accelerated expansion observed. It could be a particle. It could some gravitational feature we don't understand... The thing is, what we currently think is that the density of dark energy is constant over time. That's pretty crazy by itself, but it's even crazier if you try to figure out how to do that with some kind of particle.
The most reasonable way to get a density that doesn't change over time, is to say that it's a property of space; if you get more space, you get more "space energy". Dark matter is likely to be a particle, since it "clumps" around galaxies. But dark energy seems to be basically everywhere.

A:
When we say 'dark energy', are we saying that it's a different concept altogether than energy?

Yes, it is. Thermodynamics fundamental equation states that when gas volume increases,- then gas internal energy should drop, assuming it has constant entropy:
$$ \mathrm {d} U=-p\,\mathrm {d} V $$
But contrary to expectations, universe does not slows-down in expansion, but even accelerates the expansion with increasing universe volume. This means that in given thermodynamics equation above pressure term is negative, that's why universe has overall increasing "internal energy".
How pressure can be negative ?
Pressure can be expressed as vacuum energy per unit volume :
$$ p=\frac {E}{V} $$
Substitute Einstein's mass-energy relation (noticing that multiplying both equation sides by $-1$ does not change anything in principle mathematically, however physical meaning will be different)  $$ -E=-mc^2$$ So we get for pressure :
$$ p=\frac {-mc^2}{V} $$
This equation can be a bit shortened, due to the fact that it involves vacuum density :
$$\boxed {p= \rho_{\text{vac}} c^2 }$$
Currently vacuum density is estimated to be :
$$ \rho _{\text{vac}}=-5.96\times 10^{-27}{\text{ kg/m}}^{3} $$
Negative vacuum density lets for universe to "accumulate" internal energy. It needs some sort of negative mass, which fills all vacuum space. Negative mass gives birth to "negative gravitation", i.e. negative mass is repulsion force, not attraction like gravity. So two units of negative mass will propel from each other apart. That's why "dark energy" is called dark, it can be thought as a synonym to a negative energy.


text:
Q: Sending a Mail on Jenkins Pipeline hi I have a simple pipeline job that should send a mail, I configured on Manage jenkins -> Configure System with port 465 and the appropriated SMTP server , when I test the configuration by sending a e-mail  , it sends and I can see the test mail on my inbox , but from the pipeline job , it fails:
node {

    stage("test") {
        def message = "hello there!"

        mail bcc: '', body: message, cc: '', from: 'jenkinsuser@mycom.com', replyTo: 'jenkinsuser@mycom.com', subject: "Develop: build generated ",     to:'grace@mycom.com'
    }

}

Error:
java.net.SocketException: Connection closed by remote host
    at sun.security.ssl.SSLSocketImpl.checkWrite(Unknown Source)
    at sun.security.ssl.AppOutputStream.write(Unknown Source)
    at com.sun.mail.util.TraceOutputStream.write(TraceOutputStream.java:114)
    at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
    at java.io.BufferedOutputStream.flush(Unknown Source)
    at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:2104)
Caused: javax.mail.MessagingException: Can't send command to SMTP host;
  nested exception is:
    java.net.SocketException: Connection closed by remote host
    at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:2106)
    at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:2093)
    at com.sun.mail.smtp.SMTPTransport.close(SMTPTransport.java:1184)

Any suggestion how to fix it?
thanks,

A: I am using Email Extension plugin in scripted pipeline with no issues. Make sure you properly configured E-mail Notification section in Manage Jenkins > Configure System. Example for gmail:
Jenkins e-mail notifications settings
Plugin usage is described here: here. This is how I call it in Pipeline (I didn't remove variables):
emailext attachmentsPattern: "**/packages/rpm/splitted/${file}",
              to: "${to}",
            from: "Jenkins",
         subject: "[jenkins] ${packageFullName}: part ${part}/${files.size()}",
            body: "File received: \'${file}\'\n" +
                  "From package:  \'${packageFullName}\'\n" +
                  "Package MD5:   \'${mainMdFiveSum}\'\n" +
                  "Jenkins Build: \'${env.BUILD_URL}\'\n"


text:
Q: Knockout / Complex Object Issue Let me preface this question by stating that I have only started working with the Knockout library yesterday afternoon so this quite possibly could be a factor in this issue.
Before I get into the code, I am trying to create a model that a Competition object which has a Name property and a Criteria property which is a collection of Criterion objects.  A Criterion object has a PrimaryDescription and SecondaryDescription property.
Here is what I have so far:
function Competition(name, criteria)
{
  var self = null;

  self = this;

  self.Name = ko.observable(name);
  self.Criteria = criteria;

  return;
}

function Criterion(id, primaryDescription, secondaryDescription)
{
  var self = null;

  self = this;

  self.Id = id;
  self.PrimaryDescription = ko.observable(primaryDescription);
  self.SecondaryDescription = ko.observable(secondaryDescription);

  return;
}

In the view model, I have a Competition property that is set up like this:
self.Competition = ko.observable(new Competition('Competition 1', ko.observableArray([new Criterion(-1, 'Criterion 1', 'Criterion 1'), new Criterion(-1, 'Criterion 2', 'Criterion 2')])));

When the page loads, a binding to Competition().Criteria() works as expected.
In the view model, I have added the following:
self.addCriterion =
  function ()
  {
    self.Competition().Criteria().push(new Criterion(-1, '???', '???'));

    alert(self.Competition().Criteria().length);

    return;
  }

When I call this method, the new element gets added to the array and the array length is accurately reflected.  However, the binding is not updated.  I messed around a bit and changed the line in the Competition model part from "self.Criteria = criteria" to "self.Criteria = ko.observableArray(criteria)".  When I do this and call the addCriterion method, the new element is added to the array and the binding updates the UI but the length of the array is reported as zero.
Since I can only get this working halfway, this tells me I am doing something wrong.  What am I missing?
Many thanks in advance to whoever can steer me in the right direction.

A: You should call self.Competition().Criteria.push instead of self.Competition().Criteria().push, because self.Competition().Criteria() will get you the original ordinary array.

A: First off, not everything needs to be an observable. In fact, things should only be an observable if you truly need that functionality. There's a ton of overhead involved in constructing, initializing, and updating observables.
You haven't shown your view model (the thing you register with ko.applyBindings), but typically, your view model will just be the thing you're interacting with, not some abstraction over that. In other words, if your view is centered around the concept of a "Competition" then Competition, itself, would be your view model for the page.
Nevertheless, don't create an observable of an object. Knockout can't detect changes within an object, only changes to the whole object, i.e. you store a completely new instance of Competition in the self.Competition observable. As a result, just treat it as a simple JS var on your view model:
self.Competition = new Competition( ... );

Then if you want to reference an observable inside that, you just chain it like normal in JS: self.Competition.SomeObservable().
@jaux is right about the reason for your specific issue.


text:
Q: Python3, problem importing vim from pyVmomi I had a project in PyCharm with python2.7 perfectly working and in it the class VMWare that imported vim from pyVmomi.
I'm reworking it it python3.6, via pip I installed all the needed library but on PyCharm I can't import vim from pyVmomi.
Cannot find reference 'vim' in '__init__.py'

If I execute the project from command line/terminal it works without problem but I can't execute quickly from pyCharm.
Any idea how to fix it? I follow even other post to check virtual environment configuration and trying to select different version of pyVmomi but this didn't solve my problem.


text:
Q: Border included in the layout/ frame of an element, instead of being around it? (Like stroke: included on Figma) Hope you're all doing fine. I have a question regarding borders in CSS.
I have a button that is 48px height, but padding sets its size dynamically instead of hardcoding the 48px height value. When I give it a 2px border, the button ends up being 52px because of the extra 2px on top and bottom.
Is there a way to include border in the total height? Like border included in layout? There is a specific reason that I don't wanna lower padding with 4px in total. Maybe stack the border on top of the padding? Is this possible?
Further reading: https://forum.figma.com/t/borders-are-not-included-in-the-size-of-frames/2372


text:
Q: Additional element being mapped to hash I'm mapping two different arrays to a hash and for some reason it seems to be adding an additional element to the hash.  I have 5 elements in array @pids and array @time, I'm mapping them to hash %match and it's giving me a 6th element.  Any idea on how to fix this?
Thanks.
print Dumper \@pids;
print Dumper \@time;
my %match = map { $_ => @time } @pids;
print Dumper \%match;

@pids:
$VAR1 = [
          '4690',
          '4692',
          '4693',
          '4696',
          '5320'
        ];

@time:
$VAR1 = [
          '23:59',
          '23:59',
          '23:59',
          '23:59',
          '23:59'
        ];

%match:
$VAR1 = {
          '4696' => '23:59',
          '4693' => '23:59',
          '4690' => '23:59',
          '4692' => '23:59',
          '23:59' => '23:59',
          '5320' => '23:59'
        };

A: For each element of @pids you're assigning the whole array @time, the right syntax is:
my %match = map { $pids[$_] => $time[$_] } (0..@pids);

But, you'd better use this:
my %match;
@match{@pids} = @time;

A: '$_ => @time', here is the problem.
It works just like this:
   foreach my $key (@pids)
   {
        $map{$key} = $time[0];
        $map{$time[1]} = $time[2];
        $map{$time[3]} = $time[4];
   }


text:
Q: Displaying loaded XAML I have created some code that should save and load the canvas object, however when I press the load button the saved canvas isn't loaded. I don't know what I'm doing wrong any help would be greatly appreciated. code below. Thanks.
public partial class MainWindow : Window
{

    public MainWindow()
    {
        InitializeComponent();
    }

    public void Button_Click(object sender, RoutedEventArgs e) // button and code to save canvas
    {
        string savedCanvas = XamlWriter.Save(cnv);
        File.WriteAllText("canvas.xaml", savedCanvas);
    }

    void Button_Click_1(object sender, RoutedEventArgs e) //button and code for loading canvas
    {
        var savedCanvas = File.ReadAllText("canvas.xaml");
        StringReader stringReader = new StringReader(savedCanvas);
        XmlReader xmlReader = XmlReader.Create(stringReader);
        Canvas readerLoadCanvas = (Canvas)XamlReader.Load(xmlReader);
    }

    private void Button_Click_2(object sender, RoutedEventArgs e)
    {
        Block b = new Block();
        hor.Children.Add(b);
    }
}


text:
Q: I can still edit cookie even with httpOnly using cookie editor I've been told that putting httpOnly:true on the cookie prevents the browser from editing cookies, but I can still edit it on my local server.

Here is what I currently have every time I make a cookie
res.cookie("jwt", token, {
  expires: new Date(
    Date.now() + process.env.JWT_COOKIE_EXPIRES_IN * 24 * 60 * 60 * 1000
  ),
  httpOnly: true, // cannot be modified by the browser
});

A: According to the specification (rfc6265), the user agent (ie. the browser) must not allow scripts in a page to access cookies marked as httpOnly. This does not mean that the browser itsef may not have access - that in fact would be impossible, because the browser has to send the cookies with requests. If you control the browser (which you do in case of your own browser), then you as the user have full control over any data stored in that browser, including any cookie with any attributes.
This is the whole point in many security vulnerabilities. As a malicious user, you can try editing values stored in your browser to get around poor access control in web applications, like changing ids and similar to get access to data the developers did not mean accessible by you. As this is easily possible (data received from the client can be tampered with by the client itself), all authorization (access control) decisions must be made on the server.
So what is the point in httpOnly then? In a class of attacks, the goal of the attacker is to somehow inject javascript into an application page (see cross-site scripting, XSS). The reason is that even if an attacker somehow gets a user to visit their malicious website, the javascript running on the attacker's site will not have access to the information (eg. cookies) stored by another application (origin). So to gain access to such info, the attackers javascript would have to run on the application page, and that is actually possible if the application is vulnerable to XSS.
So in case of XSS, the attacker writes javascript, injects it into an application page, and when a legitimate user visits the page, the victim will run the attacker's javascript, in the application context. This allows an attacker to access any application information the user has access to, proibably most importantly the authentication cookie. If the attacker gets hold of the auth token (traditionally from a cookie), they can probably just impersonate the victim to the application.
And this is prevented by httpOnly. If a cookie is marked as httpOnly, javascript (including both the legit javascript of the website, and the attacker's malicious javascript) will not have access. This prevents an attacker being able to compromise data stored in httpOnly cookies, via XSS.
Note that XSS is still an issue, the attacker can still extract information, this does not prevent XSS at all. It just means that any data stored in such cookies will not be compromised, but there is likely a lot more data that would be.
Also note that as you correctly observed, this does not prevent you from editing your own cookies - again, the purpose is not message authentication. If the application wanted, it could authenticate and/or encrypt its own cookies for different reasons, some frameworks actually do that to statelessly but still securely store session information. But that is independent of what httpOnly does.

A: It is just a flag to make the cookie inaccessible to client-side scripts (e.g. JavaScript code). Using Developer Tools to access resources like cookies is not the same thing.


text:
Q: CloudFormation: extraneous key [DependsOn] is not permitted Building a simple Hello World API using SAM(API Gateway + Lambda). I was told DependsOn is supposed to work with all resources.
The APIs were configured as :
HelloWorldAPI:
    Type: AWS::Serverless::Api
    # Type: AWS::ApiGateway::RestApi
    Properties:
      Name: HelloWorldApi
      StageName: !Ref StageName

  HelloWorldAPIResource:
    Type: AWS::ApiGateway::Resource
    Properties:
      RestApiId: !Ref HelloWorldAPI
      ParentId: !GetAtt HelloWorldAPI.RootResourceId
      PathPart: hello

  HelloWorldAPIMethod:
    Type: AWS::ApiGateway::Method
    Properties:
      AuthorizationType: NONE
      HttpMethod: GET
      ResourceId: !Ref HelloWorldAPIResource
      RestApiId: !Ref HelloWorldAPI
      Integration:
        Type: AWS_PROXY
        IntegrationHttpMethod: GET
        Uri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${HelloWorldFunction.Arn}/invocations
          # - Arn: !GetAtt HelloWorldFunction.Arn

  HelloWorldAPIDeployment:
    Type: AWS::ApiGateway::Deployment
    Properties:
      RestApiId: !Ref HelloWorldAPI
      StageName: !Ref StageName
      DependsOn:
        - HelloWorldAPIMethod

But I get the following errors during deployment:
CREATE_FAILED                                   AWS::ApiGateway::Deployment                     HelloWorldAPIDeployment                         Properties validation failed for resource
                                                                                HelloWorldAPIDeployment with message: #:
                                                                                extraneous key [DependsOn] is not permitted
CREATE_FAILED                                   AWS::ApiGateway::Resource                       HelloWorldAPIResource                           Resource creation cancelled
CREATE_FAILED                                   AWS::ApiGateway::Deployment                     HelloWorldAPIDeployment5332c373d4               Resource handler returned message: "The REST
                                                                                API doesn't contain any methods (Service:
                                                                                ApiGateway, Status Code: 400, Request ID:
                                                                                634b4de5-ead7-48f5-8075-ab55d7176189,
                                                                                Extended Request ID: null)" (RequestToken:
                                                                                ef65a5fd-cdf4-fe14-2010-a513bca36aca,
                                                                                HandlerErrorCode: InvalidRequest)

The explicitly defined AWS::ApiGateway::Deployment is unable to use DependsOn, while there is another AWS::ApiGateway::Deployment being created implicitly but unnecessarily which is being deployed before the method, which was the reason I defined one explicitly in the first place.
Any help is appreciated.

A: DependsOn should have one last tab less:

  HelloWorldAPIDeployment:
    Type: AWS::ApiGateway::Deployment
    Properties:
      RestApiId: !Ref HelloWorldAPI
      StageName: !Ref StageName
    DependsOn:
      - HelloWorldAPIMethod


text:
Q: Custom Event ID When creating an event in outlook Calendar you get a generated event id and using that you can update any event you have created as described here by storing the eventId in some table and use it when updating an event, my question is: Is it possible to set that event Id on your own like in googles calendar here so that I don't need to keep track of the event id because it changes everytime you create/update and creates yet annother column in my database?

A: The id of an event is a calculated hash value based on its metadata. When an item is moved (date, folder, calendar, etc.) the id will change.
For tracking, you should use the iCalUId property from the event. This is a guaranteed unique value that will never change. While you cannot define your own value, this GUID is absolutely safe to store and can be used to recall the event from Microsoft Graph using the $filter=iCalUId eq '{GUID}' query parameter.
Also, unlike the id, the value is available (and static) for attendees aswell (i.t. if the attendee is using GMail, Google will maintain the same iCalUId value on their end).


text:
Q: argument "second_str" is missing with no default I have written a function which finds the intersection between two strings. I want to use this function in apply and find out all the intersections in the given data frame. I am using below code.
Function:-
common <- function(first_str,second_str)
  {
    a <- unlist(strsplit(first_str," "))
    b <- unlist(strsplit(second_str," "))
    com <- intersect(a,b)
    return((length(com)/length(union(a,b)))*100)
  }

Data frame:-
str1 <- c("One Two Three","X Y Z")
str2 <- c("One Two Four", "X Y A")

df <- data.frame(str1, str2)

When use apply I get argument "second_str" is missing with no default error
apply(df, 1, common)

Could you please help me out with the solution?

A: apply() will only pass a single vector to the function you provide. With margin=1 it will call your function once per each row with a single vector containing all the values for the "current" row. It will not split up those values into multiple parameters to your function.
You could instead re-write your function to
common2 <- function(x) {
    first_str <- x[1]
    second_str <- x[2]
    a <- unlist(strsplit(first_str," "))
    b <- unlist(strsplit(second_str," "))
    com <- intersect(a,b)
    return((length(com)/length(union(a,b)))*100)
}

Although that doesn't scale well for multiple parameters. YOu could also use Map or mapply to iterate over multiple vectors at a time
If your original function you can do
with(df, Map(common, str1, str2))


text:
Q: An example of a noncommutative PID It's well known that when a ring $R$ is a PID, every submodule of a free $R$-module is free. I'm interested in cases when the converse holds -- that is, in rings $R$ which have the property that every submodule of a free $R$-module is free. It's easy enough to see that such a ring cannot have any zero divisors and that every ideal of the ring must be principal. I would like to know if there are any "noncommutative PIDs", that is, if there are any rings which (1) have no zero divisors, (2) have only principal ideals, and (3) are noncommutative. Is there any sort of structure theorem for such rings? For instance, Hungerford proved in this paper that every principal ideal ring (a ring whose ideals are all principal) which is commutative is a direct sum of homomorphic images of PIDs.
EDIT: Robert Lewis reminded me that one class of examples of the ring I am looking for is division rings. Are there any examples that are not division rings? (After all, the ideal structure of a division ring is not very interesting.)

A: Fred Byrd's suggestion of the quaternions does the trick, but if you want there to be some irreducible elements, you can use $\Bbb H[x]$, which is a left-and-right PID by the same argument you use for polynomial rings over fields. It is definitely not a division ring.

As for a structure theorem, I believe the one you're looking for is for hereditary Noetherian prime rings, of which a left-and-right principal ideal domain is an example. Unfortunately I do not know this one by heart and don't have the resources handy.
If I were you I'd check out the work by Robson, Eisenbud, Griffith, Connell and Jategaonkar on the topic of hereditary Noetherian rings. I would guess the conclusion is probably available in Rowen's ring theory books and maybe Goodearl and Warfield's book on noncommutative noetherian rings.
I remember the theorem going something like this:

Hereditary Noetherian rings decompose into an Artinian ring and a finite product of hereditary Noetherian prime rings.

I also managed to find in Faith's Rings and things p 115 that proper homomorphic images of HNP rings are all Artinian serial rings. I highly suspect that these are exactly the Artinian rings that appear in the above decomposition in the Artinian part.
Let's compare this to Hungerford's result. (Principal ideal ring=PIR, principal ideal domain-PID, and special principal ideal ring=SPIR.)

Theorem 1: Every PIR is a finite direct sum of homomorphic images of PIDs.
Lemma 10: Every PIR is a (finite) direct sum of PIDs and SPIRs.
Corollary 11: Every SPIR is a homomorphic image of a PID.

Now a SPIR with a unique maximal ideal is an Artinian ring whose ideals are linearly ordered. A finite product of SPIRs is an example of an Artinian serial ring. So, that is why So, I sincerely believe that the hereditary Noetherian ring theorem is the proper extension of Hungerford's theorem.

A: The quaternions, I believe, will do the trick.
As for a general structure theorem, I'm afraid that's a bit out of my depth.

A: The universal enveloping algebra of $\mathfrak{sl}_2(\mathbb{C})$ is a noncommutative PID which is not a division ring.  See for example Catoiu's Ideals of the enveloping algebra $U(sl_2)$ p.145 and the references cited there. Siciliano and Usefi give more examples in Enveloping algebras that are principal ideal rings.


text:
Q: Stability of Ubuntu 18.04 LTS with Kernel Linux-5.4.0-26-generic I installed a barebone version of Ubuntu 18.04 LTS with only kernel (no DE,Window Manger and the usual things that comes with Ubuntu).i wanted to know,if possible,will this kernel work alright with 18.04 LTS.No reason to believe otherwise to be honest.Just i have arch installed on the same machine and i dont want to tinker around with it too much.Thanks.
If i may ask in this same question,just this one time since they are related , i could not find the header for this kernel with the source list that was generated during installation. What repository ami missing and how to get it? This actually got me a little worried hence the first question.Sorry if i sound silly and this is a non issue.
Thanks again.

A: You might like to look at the following link. https://wiki.ubuntu.com/Kernel/LTSEnablementStack#Kernel.2FSupport.A18.04.x_Ubuntu_Kernel_Support
Ubuntu provide a hardware enablement stack which gives you more up to date kernels on older LTS releases. It's a simple install that should solve both questions.

A: It does not work . If you are using 18.0.4 LTS then expect major system problems as simple things like networking,distorted display (GPU acceleration) to be very unstable as i found out. You are better of not upgrading directly to 5.4 without a clear migration path that Ubuntu recommends. This is speaking from a personal experience


text:
Q: A question about linear transformations mapping straight lines to straight lines Obviously, a linear transformation over a space maps all straight lines to other straight lines.
My question is: is the converse true? That is, if we're looking at a space after some transformation and we're observing that all straight lines were mapped to straight lines, does that imply a linear transformation? (Lines are understood as finite and infinite collections of points that are aligned, well, in a line)
EDIT: The comments mention affine transformations which fullfil the above condition but are not linear since they also involve translation. I think I'll reask then: Is every transformation that maps ALL lines to lines necessarily affine?

A: not always but converse will  be true iff T(x) that is a function of x .You can suppose y=T(x) represents the line that Passes through origin


text:
Q: Optimizing code for searching a text in richtextbox windows form I have a windows form application that use a RichTextBox to display a text from a file. There is also a TextBox and a Button to perform a search in the text. Whenever the button is clicked, the content of the TextBox is searched and enlightened in the RichTextBox. Here is the code in the button_Click event handler:
String search = richtextboxContent.Text;
richtextboxContent.Text = "";
richtextboxContent.Text = search;

#region code Search
string keyword = textboxsearch.Text.Trim();
int startPosition = 0;
int endPosition = 0;
int endArticle = richtextboxContent.Text.Length;
for (int i = 0; i < endArticle; i = startPosition)
{
    if (i == -1)
    {
        break;
    }
    startPosition = richtextboxContent.Find(keyword, startPosition, endArticle, RichTextBoxFinds.None);
    if (startPosition >= 0)
    {
        count++;
        richtextboxContent.SelectionBackColor = Color.Yellow;
        endPosition = textboxsearch.Text.Length;
        startPosition = startPosition + endPosition;
    }
}

I have one text file of 20mb with 90.000++ lines, whenever I search one word (that resulted with 1300 matchs) the code below take more than 10 minutes to finish.
How can it be improved ?


text:
Q: Nuxt link with dynamic `to` prop I am trying to automatically add UTM tracking parameters to all nuxt links, so I made a component for this (let me know if there's a better way!).
<template>
  <nuxt-link :to="url" :target="$attrs.target"><slot></slot></nuxt-link>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
  name: 'ArticleLink',
  props: {
    to: {
      type: String,
      required: true,
    },
    date: {
      type: Number,
      required: true,
    },
  },
  computed: {
    url(): string {
      const url = this.to.startsWith('/')
        ? `${process.env.VUE_APP_ORIGIN}${this.to}`
        : this.to;
      const urlObject = new URL(url);
      urlObject.searchParams.append('utm_source', 'article');
      urlObject.searchParams.append('date', this.date);
      console.log(this.to, urlObject.href);
      return urlObject.href;
    },
  },
});
</script>

The problem is when I use it on relative links, the to property for some reason combines the initial href, with the calculated one:
<article-link date="20221109" to="/">link</article-link>

this is rendered as:
http://localhost:3000/current/path/http://localhost:3000/?utm_source=article&date-20221109`

What's strange is the console.log shows the correct conversion from / to http://localhost:3000/?utm_source=article&date=20221109
Also strange is if I use Vue devtools to inspect the <NuxtLink> it shows a correct to prop.

A: Seems I'm using vue router links incorrectly (see: https://github.com/vuejs/vue-router/issues/1131)
When I pass an absolute URL to the :to prop, it adds it to the end of the current URL. So I have to return urlObject.pathname + urlObject.search instead of returning urlObject.href
:shrug:


text:
Q: Allow embedding of gifly/gfycat The only option to embed this kind of media is to link to the bandwidth-hogging 256-color low-framerate gif version, which is a waste when video tags are now things that have been existing for a while.
Please bring audioless video playback to chat. Pretty please?


text:
Q: Script to "hide" cookie tag for "x" minutes for retargeting purposes Me and my friend have developed a script that hide the cookie tag for "X" minutes because the whole concept is when a visitor visit my website I don't want to cookied immediately for retargeting proposes but to hide the cookie tag for x seconds so only I can cookied only the visitor that stays more than x seconds.
Check the code below:
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
    <script>
        function Inject() {
$('body').append(HERE WE PUT THE RETARGETING PIXEL CODE);
      }
        // run script after 45 sec.
        window.setTimeout(Inject, 45000);
    </script>

As you can see the retargeting pixel code goes between ( ) but the problem I am facing this moment is that when I place the retargeting pixel from Facebook inside the ( ) it seems that it doesn't work correctly. Check the image below to see how it looks like in my website: http://i.imgur.com/JQtUxn4.png
As you can see something in the code is missing but I don't know what. Any help will be appreciated. Thanks.

A: Put a document.cookie assignment inside your timeout, no need for other functions:
 setTimeout(function(){
     document.cookie = "key=value;path=/;expires="+someDateFunc();
 }, 45000);

A: The screenshot tells me that you are closing the string in your append()-statement too soon. This is due a mismatch in your ' and " signs.
Try this while being careful of my '-sign:
function Inject() {
    var img = new Image(1,1); // width, height values are optional params
    img.src = 'http://www.your_facebook_img_link.com';
    document.body.appendChild(img);
}

window.setTimeout(Inject, 45000);

This is pure JS and does not require jQuery.


text:
Q: Upgrade SQL server without disturbing Sharepoint 2013 I have a very basic question for which i am not able to find the answer.
I have a dev box with Sharepoint 2013 foundation  and SQL server 2008 R2 installed on it. I need to use SSRS web parts on the sharepoint. As per this link they are not compatible. So i need to upgrade the SQL server to 2014 version. I do not want the existing sharepoint to be affected.
Please suggest how can i achieve this. Any tutorial or guidance will do.

A: *

*Make sure that you have May 2014 Cumulative Update on SharePoint farm.
Where

SQL Server 2014 requires the May 2014 Cumulative Update to be installed.

*

*ake a full farm backup and database backup to allow rollback.

*An in-place upgrade and side by side upgrade provide this. in place is much faster. ( My recommendation would be to install SQL Server 2014 instance and then backup and migrate the database from SQL Server 2008 R2 to SQL Server 2014)

*You need to make sure you first upgrade SQl Server 2008 R2 to SP2/Sp3.
For more details check this or this vedio
If your aim only to host SSRS try to use native mode rather than integrated mode and hold it inside performance point web part as mentioned here

A: i dont think you can do it without disturbing the SharePoint. It is recommended that when you upgrade your SQL server either In-Place of move to new server then Shut Down the SharePoint Servers or At min Shut down all SharePoint services.
Also you have to meet the minimum requirement for the SQL 2014 support to SharePoint 2013.


text:
Q: Twitter trending topics RSS feed for specific country Is there any way to generate Twitter rss feed URL for trending tweets in a specific country? For example, I would like to generate rss feed with the most discussed topics on Twitter in Germany. Can this be done and how?
Thank you!

A: Yes. Use this Twitter API https://dev.twitter.com/docs/api/1.1/get/trends/place to get the trends and then generate the RSS feed yourself.
It will require a WOEID (http://developer.yahoo.com/geo/geoplanet/) which is for Germany is 23424829 (https://dev.twitter.com/discussions/6942)


text:
Q: If the House of Elrond is the Last Homely House east of the Sea, what are the others? As the books call it, Elrond's house is the Last Homely House east of the Sea. But if Rivendell is the last homely house, what are the other homely houses east of the sea? Or does Rivendell count as the last and the first because it is the only one? This question has bugged me for a while, and I would be very happy if there is a reliably-based answer to it (i.e. not something that the movies say).

A: Homely here just means civilized and decent, and is more of a description than an official category
In the original manuscript of The Hobbit, this was named the "Last Decent House".

They asked him where he was making for. 'You are now at the very Edge of the Wild' he answered. 'Somewhere ahead is the Last Decent House – I have been there already and they are expecting us.'
Marquette Tolkien Mss 1/1/3, published in The History of The Hobbit

Likewise, in The Annotated Hobbit, Douglas Anderson points out that "homely" means a place where you're treated kindly.

In describing Elrond's house as homely, Tolkien refers to what the Oxford English Dictionary describes as "characteristic of home as the place where one receives kind treatment; kind, kindly."
The Annotated Hobbit - Chapter 3 - "A Short Rest"

The implication that Tolkien is saying is that up to this point you're still part of the more civilized home turf, past here you enter "The Wild" and start your real adventure. Corey Olson explains this in Exploring J.R.R. Tolkien's The Hobbit.

Rivendell is called "The Last Homely House," and it stands on an important boundary. It is at the border, with all of the "respectable country," where one might possibly find good inns, to the west (30). When you get to Rivendell, as Gandalf explains to Bilbo, you have "come to the very edge of the Wild" (44). As I mentioned in Chapter Three, Rivendell doesn't just sit on this boundary; it embodies it. The house of Elrond is the place where the world of quiet comforts and the world of legends come together and coexist. The path beyond it, into the Wild, is "a hard path and a dangerous path, a crooked way and a lonely and a long" (52).
Exploring J.R.R. Tolkien's The Hobbit - Chapter 4 - "Over the Edge of the Wild"

As John Rateliff points out in The History of the Hobbit, this was probably inspired by the Cottage of Lost Play from Tolkien's earlier writings.

This brief chapter contains the most explicit references yet linking The Hobbit to the mythology out of which it grew. Elrond and Gondolin come directly from the Silmarillion tradition, while the 'Last Decent House' (renamed the Last Homely House before the end of the chapter) is clearly inspired by the Cottage of Lost Play that had appeared in the frame story of The Book of Lost Tales, where 'old tales, old songs, and elfin  music are treasured and rehearsed' (BLT I.20) – a description strikingly like that of Elrond's house, which 'was perfect, whether you liked food or sleep or work or storytelling or singing or just sitting and thinking best' (p. 115), and of which the narrator says 'I wish I had time [to] tell you even a few of the tales or one or two of the songs that they heard in his house' (ibid.). It is in the House of Lost Play (as it is also called; cf. BLT I.189) that Eriol the wanderer hears all the stories that together make up the 'Lost Tales', just as much later it is in Elrond's House (not yet named 'Rivendell')1 that Bilbo in his retirement collected the stories that made up The Silmarillion (cf. LotR.26–7 & 1023).
The History of The Hobbit - "The Last Decent House"

To more specifically answer your question, some other examples of "Homely Houses" would be various inns like The Prancing Pony, or perhaps even private residences like Bag End.


text:
Q: Getting error about json and i am new in Android World I m getting this error when i click a button in Activity
i m developing a Application in Android studio and getting error about json and  i m  not sure how to handle this error
Error Detail

Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a
  null object reference at com.example.tourista.DataParser.getAllnearbyPlaces(DataParser.java:62)
     at com.example.tourista.DataParser.parse(DataParser.java:100)

private List<HashMap<String,String>> getAllnearbyPlaces (JSONArray jsonArray)
{

//Line There i m getting Error

    int counter = jsonArray.length();

    List<HashMap<String,String>> NearbyPlacesList = new ArrayList<>();
    HashMap<String,String> NearbyplaceMap = null;

    if (jsonArray != null) {

        for (int i = 0; i < counter; i++) {
            try {
                NearbyplaceMap = getSingleNearbyPlace((JSONObject) jsonArray.get(i));
                NearbyPlacesList.add(NearbyplaceMap);
            } catch (JSONException e) {
                e.printStackTrace();
            }

        }
    }
    return NearbyPlacesList;
}

public List<HashMap<String,String>>  parse(String JSONdata)
{
    JSONArray jsonArray= null;
    JSONObject jsonObject;

    try
    {
        jsonObject =new JSONObject(JSONdata);
        jsonArray = jsonObject.getJSONArray("results");
    }
    catch (JSONException e)
    {
        e.printStackTrace();
    }
    return getAllnearbyPlaces(jsonArray);

}

A: Your error is for this line : int counter = jsonArray.length();
if you have a null object you can't call any method of that
your jsonArray is null so you can't call jsonArray.length()
you should put int counter = jsonArray.length(); bellow if (jsonArray != null) {

A: For this specific case
jsonArray = jsonObject.getJSONArray("results") probably throws a JSONException so your array is never initialized and remains null. Look in your logs and you will probably see some red lines of text with the error.
To learn more about Nullpointerexceptions read:
What is a NullPointerException, and how do I fix it?

A: You need to provide more code. Who is calling the getAllnearbyPlaces (JSONArray jsonArray)?
When this class is called you are passing a null JSONArray


text:
Q: Boot linux off hard drive and then switch to run from usb flash disk I have an older laptop that I want to use as a simple media server on my home network. I would like to avoid using the internal hard drive except for booting (BIOS does NOT support booting from USB).
My thought was to mirror the hard drive (currently has current install of Arch Linux) onto the flash drive and then after booting switch over to run everything from the flash drive.
I read the following article about using a RAM disk (HOW-TO: Boot OS into RAM for speed and silence) but ran into problem because the USB subsystem does not seem to be initialized soon enough (I create root and home paritions on the flash disk and modified fstab to pick those - didn't work).
Any thoughts?

A: My suggestion would be to install the boot partition containing a bootloader (I like extlinux), your kernel image and your initramfs to you hard disk.
Then you configure either the initramfs to mount your root partition (which is on your usb drive) or you add the partition as an argument for the kernel in the bootloader configuration. The latter is simpler to achieve, just add something like "root=/dev/sdb1" to the kernel arguments, for a root fs of the first partition on the second hd. Also, you won't need the initramfs if you don't use one already.
Both approaches results in something virturally identical to a boot from usb, but the initramfs approach lets you go (further) to town with lvm, crypto or exotic filesystems om the usb drive.

A: You can also use a CD with the bootloader that boots up the computer from the USB disk. This way the CD is only used when you startup the computer and after loading the kernel it will use the USB disk only.

A: One idea may be to use a virtual machine copied to the USB drive.
That way, usage of the main hard disk should be minimal after the VM started.
It might also be a good idea to use a minimalist Linux distribution, for both physical and virtual computers.


text:
Q: How to insert XML column of a table in to another table incuding the same fields I have a table including XML column which it's Name is Bookmarks and result of select query would be Like this:
SELECT [Bookmarks] FROM [prs_Decrees]

<Bookmarks>
  <Bookmark BookmarkGuid="f892e0ef-a498-4ece-9933-ab0154cd6c90" Title="AcceptableWorkinDaysMinusAbsenceDays" Value="-2" />
  <Bookmark BookmarkGuid="fe149c4d-1ae9-43c5-9403-11c06b8be567" Title="AcceptableWorkinDaysMinusAbsenceMonths" Value="-3" />
  <Bookmark BookmarkGuid="53669ea1-bc5b-4177-af4f-9642d1419549" Title="AcceptableWorkinDaysMinusAbsenceYears" Value="-4" />
  <Bookmark BookmarkGuid="e85da9b9-31a4-4ee4-a0b1-598678a631a4" Title="PersonnelExtra" Value="Teacher"/>
</Bookmarks>

beside, I've created a table including Title and Value columns.
I want to know how to read XML type and insert it's content to another table?

A: You can try to use XQuery to get XML values.
Query 1:
SELECT x.v.value('(@Title)[1]', 'varchar(200)') Title,
        x.v.value('(@Value)[1]', 'varchar(200)') Value
FROM [prs_Decrees] t
CROSS APPLY t.Bookmarks.nodes('/Bookmarks/Bookmark') as x(v)

Results:
|                                  Title |   Value |
|----------------------------------------|---------|
|   AcceptableWorkinDaysMinusAbsenceDays |      -2 |
| AcceptableWorkinDaysMinusAbsenceMonths |      -3 |
|  AcceptableWorkinDaysMinusAbsenceYears |      -4 |
|                         PersonnelExtra | Teacher |

if you want to insert to another table from XML values, you can try below.
INSERT INTO anotherTable (Title,Value)
SELECT x.v.value('(@Title)[1]', 'varchar(200)') Title,
        x.v.value('(@Value)[1]', 'varchar(200)') Value
FROM [prs_Decrees] t
CROSS APPLY t.Bookmarks.nodes('/Bookmarks/Bookmark') as x(v)

sqlfiddle


text:
Q: cant figure out whats wrong with my enum dropdown list in mvc I have the data seeded into a list on the index page into a table and this is the model for the album to create it using entity frame work, this is all the Model.cs
public enum genre { Rock=1, Pop=2 }

public class Album
{
    public int AlbumID { get; set; }
    public string AlbumName { get; set; }
    public string AlbumArtist { get; set; }
    public genre AlbumGenre { get; set; }
    public Album()
    {
        GenreList = new List<SelectListItem>();
    }
    public IEnumerable<SelectListItem> GenreList { get; set; }
    public List<Artist> Artists { get; set; }
}

The controller has the following code for the dropdown list. I get a redline under model in the code at the end, here return View(model); however when I run it, it doesn't specify this as the answer.
public ActionResult Index()
{
    Album model = new Album();
    IEnumerable<genre> genres = Enum.GetValues(typeof (genre)).Cast<genre>();
    model.GenreList = from action in genres
                      select new SelectListItem
                      {
                          Text = action.ToString(),
                          Value = (action.ToString())
                      };
    return View(model);
}

and my index page is where it shows the error.
@Html.DropDownListFor(model => model.AlbumID, model.GenreList) is the line in which I get the error on AlbumId and GenreList
@model IEnumerable<revision.Models.Album>
@{
    ViewBag.Title = "Index";
}

Index

    @Html.ActionLink("Create WOW", "Create"

@Html.DropDownListFor(model => model.AlbumID, Model.GenreList)

A: Enums are supported in Razor views from MVC 5.1. Check if you are using any prior version of mvc. Additionally, MVC 5.1 Razor DisplayFor not working with Enum DisplayName this will also help you.


text:
Q: Creating new table with multiple values in a column I have created a table with only one column
Create Table RLID_MARK
(
RLID Int )

I want to Add multiple values in Column RLID using
insert into RLID_MARK (RLID)
values( '43230335' ,    '20936450' ,    '39685560' ,    '50833640' ,    '78406124' ,)

but its showing
Error report - SQL Error: ORA-00913: too many values
00913. 00000 -  "too many values"
*Cause:
*Action:

Kindly help me to get exact method.
thnk you in advance

A: from 9i onward oracle knows insert all ..
use the following syntax:
INSERT ALL
   INTO RLID_MARK (RLID) VALUES (43230335)
   INTO RLID_MARK (RLID) VALUES (20936450)
   INTO RLID_MARK (RLID) VALUES (39685560)
   INTO RLID_MARK (RLID) VALUES (50833640)
   INTO RLID_MARK (RLID) VALUES (78406124)
SELECT 1 FROM DUAL;

this only carries the overhead of repeating the column names per insert line ..if that is still too much writing - you can use PLSQL
declare
   procedure ins
      (v_RLID INTEGER)
   is
   begin
      insert into RLID_MARK
      (RLID)
      values
      (v_RLID);
   end;
begin
   ins (43230335);
   ins (20936450);
   ins (39685560);
   ins (50833640);
   ins (78406124);
end;
/


text:
Q: django template convert object to int I'm trying to run this code in my django template:
{% if lawChoice.releveAnnee==law.releveAnnee %}

I get the following error:
Could not parse the remainder: '==law.releveAnnee' from 'lawChoice.releveAnnee==law.releveAnnee'

I think law.releveAnnee is considered as an object, not as an integer, that's why the comparison fails!
Thanks in advance for your help,
Romain
EDIT
Thanks to the answer above: a SPACE is needed BEFORE and AFTER the ==:
{% if lawChoice.releveAnnee == law.releveAnnee %}

This works! Solved :)

A: Probably that's because you need to add a space before and after the == operator.
You'd better go for ifequal
{% ifequal lawChoice.releveAnnee law.releveAnnee %}
    ...
{% endifequal %}


text:
Q: Submit button not working? I have this small test page trying to mess around and figure out PHP code, from what I understand, after filling the forms and hitting submit, something should happen. Depending on what you entered.
<!DOCTYPE html>

    <title>PHP Testing Page</title>

    <?php
        echo "Testing Page, working great!\n";
        $theDate = date("M-d-Y ");
        echo "Today is " . $theDate;
        $email1 = $_POST['email1'];
        $email2 = $_POST['email2'];
        function checkEmail()
        {
            $email1 = $_POST['email1'];
            $email2 = $_POST['email2'];
            echo $email1;
            echo $email2;
                if($email1==$email2)
                {
                    echo "\nE-Mail Addresses match.";
                }
                else
                {
                    echo "\nCheck to make sure your E-Mails match";
                }
            }
        ?>
        <form name="checkingEmail" action="." method="post">
            E-Mail: <input type="text" name="email1" value="E-Mail Here" />

            Retype E-Mail: <input type="text" name="email2" value="Confirm E-Mail" />

            <input type="button" value="Submit" onClick="checkEmail()">
        </form>

After the forms are filled (via visiting page) and the Submit button is clicked, nothing happens. Can someone explain please?
********EDIT******FIXED**
Found a work around! No functions, works like a charm.
<!DOCTYPE html>

    <title>PHP Testing Page</title>

    <?php
        echo "Testing Page, working great!\n";
        $theDate = date("M-d-Y ");
        echo "Today is " . $theDate;
    ?>
    <form name="checkingEmail" action="test.php" method="post">
        E-Mail: <input type="text" name="email1" value="E-Mail Here" />

        Retype E-Mail: <input type="text" name="email2" value="Confirm E-Mail" />

        <input type="submit" value="Submit">
    </form>
    <?php
    $email1 = $_POST["email1"];
    $email2 = $_POST["email2"];
    if($email2==null)
    {
/*I believe this just stops it from checking the rest of the conditions, that
        way it won't echo anything until someones enters valid (non-null) input*/
        $email2 = "notnull";
    }
    else if($email1==$email2)
    {
        echo "Good Job.";
    }
    else
    {
        echo "Failure to comply.";
    }
    ?>

I have the check outside of a function, so I don't have to call it or anything like that. Also, with the first if statement, if $email2 is null (When they first load it) it will
simply change $email2 to "notnull" and stop checking statements because it found a valid
one. (Not 100%)

A: Where is your submit button ?
<input type="button" value="Submit" onClick="checkEmail()">
               ^

The type should be submit
As mentioned on this answer comments, you can't call a php function from javascript.
When you do it you'll call checkEmail from a javascript, which isn't defined.
So, you'll get the following error:
Uncaught ReferenceError: checkEmail is not defined

A: type should be submit;

If you change it to the submit and then run it, it should be fine. You should use submit type with Form elements.


text:
Q: How to iterate over an Excel file and ID colored cell values I have an excel workbook that has cells of a column colored with specific colors to keep or exclude certain users that will then be used to filter another excel workbook.
I want to loop through this column and identify cells with red background and add a functional column stating 0 and identify cells with yellow background and add 1 to this same functional column so as to work as the filter for the other workbook.
I'm hoping to use OpenPyXL to complete this task.
column_pi = ws["A"]

for cell in column_pi:
    f cell.fill.fgColor == "00FF0000": # Red Hex
        # add column stating 0 as value

Have also tried this but no luck, returning nothing
red_fill = PatternFill(fill_type=None, start_color='00FF0000', end_color='00FF0000')
yellow_fill = PatternFill(fill_type=None, start_color='00FFFF00', end_color='00FFFF00')

for cell in column_pi:
    if cell.fill == yellow_fill:
        print(cell)

Works with no hex codes provided for no_fill
no_fill = PatternFill(fill_type=None)

for cell in column_pi:
    if cell.fill == no_fill:
        print(cell)

Any thoughts on the best way to iterate over the values and check the fill/background color are of a specific color and then add a functional column like this?

A: fill is a set of more complicated variables, so looking for it to be exactly equal only to red_fill or yellow_fill here isn't going to work. The complication is mostly due to being able to set a colour either as a static rgba value, or as one that will automatically update when the theme is changed. Styles in openpyxl, with parameters like PatternFill, are easy ways to set multiple of these values at once.
If you look up cell.fill for a particular cell, it returns something like:
<openpyxl.styles.fills.PatternFill object>
Parameters:
patternType='solid', fgColor=<openpyxl.styles.colors.Color object>
Parameters:
rgb='FFD9D9D9', indexed=None, auto=None, theme=None, tint=0.0, type='rgb', bgColor=<openpyxl.styles.colors.Color object>
Parameters:
rgb='00000000', indexed=None, auto=None, theme=None, tint=0.0, type='rgb'

You can specify these values directly as part of cell.fill.fill_type (synonym for cell.fill.patternType), cell.fill.fgColor, and cell.fill.bgColor. Plus sub-attributes like cell.fill.fgColor.rgb.
You could also make it quicker by picking knowncell.fill.fgColor of a cell you know to have red_fill, if one exists. That way, you could check any of fill_type, fgColor and/or bgColor match. Try:
red_fill = knowncell.fill
for cell in column_pi:
    if cell.fill.fgColor == red_fill.fgColor and cell.fill.fill_type == red_fill.fill_type:
        print(cell)

However, you can't match knowncell.fill directly with cell.fill, I think because a new openpyxl style object is created each time you define a new one.


text:
Q: L'Hopital with an inverse function Use L'Hopital's Rule to evaluate the limit $$\lim_{x{\rightarrow0}}\frac{x\cos(x)}{x+\arcsin(x)}$$
Here $\arcsin:(-1,1)\rightarrow(-\frac\pi2,\frac\pi2)$ is the inverse function of the sine function.
If we let $f(x)=x\cos(x)$ and $g(x)=x+\arcsin(x)$, we obviously know that $f$ is differentiable but how do we know that $g$ is differentiable?
We know that $\sin(x)$ is a differentiable function but we can't use the inverse function theorem and the inverse function theorem for differentiability to say that $\arcsin(x)$ is differentiable because our intervals for this function are strict.
$\sin:(-\frac\pi2,\frac\pi2)\rightarrow(-1,1)$ does not satisfy the inverse function theorem because the intervals are strict. I don't see how you can do this question rigorously.


text:
Q: Relations function in AR Model, many to one relationship So here's the scenario:
I have two table, Issue & Project.
A Project can have many Issue and an Issue can exactly one project.
Since Issue is many to one, do you have to define it?
Cause I know in Project Model I have:
public function relations()
{
    return array(
    'issues' => array(self::HAS_MANY, 'Issue', 'project_id'),
    'users' => array(self::MANY_MANY, 'User', 'tbl_project_user_assignment(project_id, user_id)'),
    );
}

For Issue Model I have nothing but foreign keys:
public function relations()
{
    // NOTE: you may need to adjust the relation name and the related
    // class name for the relations automatically generated below.
    return array(
        'requester' => array(self::BELONGS_TO, 'User', 'requester_id'),
        'owner' => array(self::BELONGS_TO, 'User', 'owner_id'),
        'project' => array(self::BELONGS_TO, 'Project', 'project_id'),
    );
}

I'm guessing anything to one relationship does not need to be define?
Thank you in advance.
BTW, I'm doing agile Yii book and I ended up asking myself this question.
There's a has-one option in AR class (http://www.yiiframework.com/doc/guide/database.arr).
But is this case optional for some reason?

A: It helps me to think of the difference between BELONGS_TO and HAS_ONE as "where is the foreign key stored"? If the Project model stored "Issue_Id" then potentially Issue could have many Projects. You use the HAS_ONE relationship to state that even if Issue COULD have many projects, it only has ONE.
However, the more common case is if you are storing the Project_Id in the Issue model (and I assume you are). Then you have to use the BELONGS_TO relationship. It appears you have defined the relationships correctly above.
Someone posted a similar question relating to Yii relations here that I helped answer:
yii - using relation HAS_ONE to get data from the related table to display in list page
As to your concern about "needing" to define relationships, you don't "need" to define any. You could write your own SQL queries to do the same thing. The ActiveRecord relations are just a convenience thing to make querying for related records simpler. If you are never going to look up an Issue's Project, then you don't "need" to define the "project" BELONGS_TO relationship.
Without actually seeing your database structure it looks to me like you have everything set up correctly. You can now easily make both $issue->project and $project->issues "lazy" relational queries, taking full advantage of the power of the Relational Active Record. Cheers and good luck with project!

A: In your Issue model you already have the relation specified as BELONGS_TO the project model.
I also just got the new yii-book. It helped me alot!
Happy coding :)


text:
Q: PHPunit test not following through after ZF form validation I'm brand new to phpunit testing. Can anyone help me on how to test the lines below in the image.

So far my test is:
public function testCanSendEmail()
{
    $formData = array(
        'subject'   => 'test subject',
        'email'     => 'test@mail.com',
        'message'   => 'test message',
        'name'      => 'test name');

    $this->request
        ->setMethod('POST')
        ->setPost($formData);
    $this->dispatch('/contact');
    $this->assertAction('win');

I was under the impression that if the validation succeeded it would follow through the whole action? Can anyone please explain what is happening here, and also what a correct test would be for such an action.

A: The obvious explanation is that $form->isValid returns FALSE.
The coverage report shows that the if block for a valid form never got executed. Instead, the else block was executed. The thing you need to find out is why and eliminate the cause. Use a Debugger and step through the execution flow to see what happens at runtime.
As an alternative, you can stub the contact form to return TRUE. Because the form is hardcoded into the controller action, have a look at http://sebastian-bergmann.de/archives/885-Stubbing-Hard-Coded-Dependencies.html on how to do that.
Yet another alternative: make the code to send the contact form into a Service Layer to allow testing this without having to make an actual request.


text:
Q: Get data JsonArray and JsonObject via $.each Jquery I have this, data json create from laravel API
[
    [{
        "id": 4,
        "name": "Customer-izlgy",
        "email": "ycgjl@xxyin.com"
    }, {
        "id": 5,
        "name": "Customer-bkxjn",
        "email": "wlrew@iloiv.com"
    }],
    [{
        "id": 1,
        "name": "Customer-izlgyt",
        "email": "ycgjl@xxysdin.com"
    }, {
        "id": 2,
        "name": "Customer-bkxjnyf",
        "email": "wlrew@iloifsv.com"
    }]
]

I trying to get data id 4 and and id 1 via ajax, but always error Uncaught TypeError: Cannot read property 'name' of undefined
This is my code to get name from above data json.
// get customer data that has been handled
function callHandledCustomer() {
  $.ajax({
    type: "GET",
    url: rootUrl + "/api/chat/getHandledCustomer",
    dataType: "json",
    success: function(response){
      $.each(response, function(i, customer) {
        console.log(customer[0][0].name); // get name
      });
    }

  });
}

Thanks a lot

A: You just have to remove your second [0] that doesn't match your object layout.

var response = [
    [{
        "id": 4,
        "name": "Customer-izlgy",
        "email": "ycgjl@xxyin.com"
    }, {
        "id": 5,
        "name": "Customer-bkxjn",
        "email": "wlrew@iloiv.com"
    }],
    [{
        "id": 1,
        "name": "Customer-izlgyt",
        "email": "ycgjl@xxysdin.com"
    }, {
        "id": 2,
        "name": "Customer-bkxjnyf",
        "email": "wlrew@iloifsv.com"
    }]
];

$.each(response, function(index, customer){
  console.log(customer[0].name);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>


text:
Q: How can i make sure this while loop can rerun my random number code without going forever? I created a guess the number program and used a while loop to allow the user to continue guessing until he/she could get it right, as seen here:
import random

number = random.randrange(1, 6)

print "Guess the number, between 1 and 6"

guess = "yes"

while guess != number:
    guess = int(raw_input('>'))
    if guess == number:
        break
        print "Good job! You got it right!"
        print number

    elif guess > number:
        print "Too High"
        print number
        number = random.randrange(1, 6)

    elif guess < number:
        print "Too Low"
        print number
        number = random.randrange(1, 6)

The problem is, when I am trying to guess the number, it will randomly end, whether me guessing the first time, 4 times, or 30 times. Also, I originally had,
guess = int(raw_input('>'))

in place of,
guess = "yes"

and replaced it to get rid of the extra and useless raw_input i'd initially need to add into terminal. Why am i able to make it equal "yes" and why doesn't it matter what I put there?
Example of Bug:
Guess the number, between 1 and 6
>3
Too High
2
>4
Too Low
5
>6
Too High
5
>3
Too High
1
>2
Too High
1
>5
Good job! You got it right!
5

------------------
(program exited with code: 0)
Press return to continue

It worked that time, and now:
Guess the number, between 1 and 6
>3
Too Low
4

------------------
(program exited with code: 0)
Press return to continue

A: The issue you have is that your while loop is testing if number matched guess after picking a new number value but before getting a new guess. This means that you'll say the player guessed wrong, but they they become right afterwards and the loop will end.
Try this instead:
import random

print "Guess the number, between 1 and 6"

guess = 'y' # the values set here don't actually matter, they just need to be different
number = 'x'

while guess != number:
    number = random.randint(1, 6)
    guess = int(raw_input('>'))

    if guess == number:
        print "Good job! You got it right!"

    elif guess > number:
        print "Too High"
        print number

    elif guess < number:
        print "Too Low"
        print number

I've also changed your use of random.randrange to random.randint, which will make it actually return 6s some of the time (randrange excludes the upper bound).

A: import random

number = random.randrange(1, 6)

print "Guess the number, between 1 and 6"

guess = "yes"

while guess != number:
    guess = int(raw_input('>'))
    if guess == number:
        break
        print "Good job! You got it right!"
        print number
        break

    elif guess > number:
        print "Too High"
        print number
        number = random.randrange(1, 6)
        break

    elif guess < number:
        print "Too Low"
        print number
        number = random.randrange(1, 6)
        break

A: guess = "yes" works because guess != number will always be True on the first check in the while loop, at which point the user is asked for input. Also, in the if block, put the break statement after all the print's.


text:
Q: Error codes and messages best practice I am planning out an EDI system that sends, amongst other things, an XML acknowledgement message containing several elements, but specifically these three; ErrorCode, ErrorSeverity and ErrorDescription.
I will basically be parsing an inbound XML message and depending upon success or failure of parsing to include message formatting, syntax, structure, validity and some business rules I will return either a success or failure acknowledgement.
I have free reign to pick ErrorCodes, ErrorSeverity and ErrorDescription but instead of naively starting at ErrorCode [1], ErrorSeverity [Error], ErrorDescription [Cannot Find Inbound XML File] and adding errors as I think of them during the coding of the inbound message parser I was wondering if there's a best practise for picking error codes and severities?
I know HTTP error codes are like 2xx for OK messages, 4xx for certain errors, 5xx for server errors, etc and wondered if anyone has any good suggestions that might help me down the road before I code myself into a corner and say "if only all my "warning" errors had started with a 3 or something similar!
I think ErrorSeverity isn't going to be much more than [Error], [Warning], [Info] and [OK] maybe?
Thanks.

A: You can find existing error-codes for EDI here:
http://msdn.microsoft.com/en-us/library/bb245948.aspx
The systems/developers you will be communicating with will probably be happy if you use one of the standard described in one of those documents.

A: I like to distinguish "Error" (the input data were faulty) from "Fatal" (the system is broken). The first calls for fixing the data and retrying; the other does not.
It should go without saying that any "error" messages should be actionable; they should make it clear to the recipient exactly what is wrong and what action needs to be taken to correct the fault in the data.
If you are separately communicating severity, then not only do I not see any need to stick to pre-defined numeric ranges, I suggest that such a move is a straight-jacket. If you do decide there's mnemonic value in using ranges, make the ranges at least ten times larger than you think you need now (digits are cheap, why not use five? ;-)
You might also consider parameterizing your messages; e.g. explicit fields to indicate position in the text. That makes it easier for code to receive the message and do something useful with it (without having to parse the human-readable text looking for clues).


text:
Q: How to get the Azure subscription and resouce group from within a VM using REST API? A lot of Azure API endpoints require you pass in the subscriptionID and resource group name of the resouce you want to work with.
From a bash script running on an Azure Linux VM, how can I get these info? I can't have the Azure CLI installed hence looking for some REST API.
There is this old answer which I found convoluted and requires the CLI anyway.
One answer even mentions this API to get all info of one given VM:
/subscriptions/[subscription-id]/resourceGroups/[resource-group-name]/providers/Microsoft.Compute/virtualMachines/[virtual-machine-name]

It seems to be a chicken and egg problem.

A: You could use this REST API - Subscriptions - List to list all the subscriptions the user can access for an Azure AD tenant.
GET https://management.azure.com/subscriptions?api-version=2019-06-01

For which tenant, it depends on the bearer token you got from, when you get the token, decode in https://jwt.io/, you will find that like below. If you use this token to call this API, it will get all the subscriptions the user can access in the tenant I hid in the screenshot.

If you want to get the resource group the VM is in, you can use this REST API - Virtual Machines - List All, no need to pass the resource-group-name, it can list all the VMs with the subscriptionId, you can get the subscriptionId from the Subscriptions - List.
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines?api-version=2019-03-01

So in conclusion, if you already know the subscriptionId which the VM is in, you can list all the VMs in the subscription and find the VM in the result, then you will find the resource group name. If you don't know the subscriptionId, you can just list all the subscriptions the user can access in one tenant, and list all the VMs in every subscription. Besides, if you even don't know the tenant-id, you can use Tenants - List to gets all the tenants for your account.

A: I've found it. The Azure Instance Metadata Service returns a lot of metadata about the Azure VM where the request has made from. I used the following REST endpoint to retrieve the VM's subscriptionId and resourceGroupName:
curl -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2017-08-01"
{
  "compute": {
    "location": "",
    "name": "",
    "offer": "",
    "osType": "",
    "placementGroupId": "",
    "platformFaultDomain": "",
    "platformUpdateDomain": "",
    "publisher": "",
    "resourceGroupName": "",
    "sku": "",
    "subscriptionId": "",
    "tags": "",
    "version": "",
    "vmId": "",
    "vmScaleSetName": "",
    "vmSize": "",
    "zone": ""
  },
  "network": {
    "interface": [
      {
        "ipv4": {
          "ipAddress": [
            {
              "privateIpAddress": "",
              "publicIpAddress": ""
            }
          ],
          "subnet": [
            {
              "address": "",
              "prefix": ""
            }
          ]
        },
        "ipv6": {
          "ipAddress": []
        },
        "macAddress": ""
      }
    ]
  }
}


text:
Q: Trouble installing Omnipay library with Composer I'm trying to use the Omnipay API with the Pin gateway but having issues.
I've run composer.phar locally with this in the composer.json file:
   {
    "require": {
        "omnipay/omnipay": "~2.0"
    }
    }

The composer "vendor" folder now resides at "classes/libs/vendor" on my site.
I have this payment class:
class Payment extends BasicClass {
    public function charge() {
        require "libs/vendor/autoload.php";

        use Omnipay\Omnipay;

        $gateway = GatewayFactory::create('Pin');
        $gateway->setSecretKey($this->config->secretKey);
    }
}

When calling:
$topup = new Payment();
$topup->charge();

I get a parse error, PHP takes issue with my use Omnipay\Omnipay line.
Very confused as all Omnipay documentation seems to use this syntax.
I've tried the require and use lines outside the class, but that did not help.
Thanks for everyone's help.

A: You have to use the use operator outside the class definition.
From PHP documentation :

Scoping rules for importing
The use keyword must be declared in the outermost scope of a file (the global scope) or inside namespace declarations. This is because
  the importing is done at compile time and not runtime, so it cannot be
  block scoped.

http://php.net/manual/en/language.namespaces.importing.php#language.namespaces.importing.scope

A: You are misusing the Composer autoloader. You are supposed to include the autoloader as one of the very first files in every request, possibly before loading any configuration files, or starting a session.
As it is currently coded, you would add another instance of the Composer autoloader whenever you make a call to that charge method. Calling charge three times in one request (for example when billing three customers in a loop) will add three autoloaders on top of each other. This sounds like a bad idea.
Please refer to the documentation at http://getcomposer.org/doc/01-basic-usage.md#autoloading to see how the composer autoloader should be included.
Especially pay attention to the paragraph stating that Composer could also autoload your own classes if you define it in your composer.json file. This is really a nice feature, you'd never again need to require the classes you are about to use.


text:
Q: Unable to display newly added media inside Gallery folder in Android I am able to successfully record the audio and play it back. The file is being stored in the SD and has a filePath like so: /storage/emulated/0/20160516_104008. The problem is that I want the user to be able to access it via the gallery widget.
I researched this problem and this post recommended using MediaScannerConnection API, which I have implemented as follows:
     MediaScannerConnection.scanFile(_reactContext,
                  new String[] { audioFileName }, null,
                  new MediaScannerConnection.OnScanCompletedListener() {
              public void onScanCompleted(String path, Uri uri) {
              }
        });

Here is the relevant code:
private boolean prepareAudioRecorder() {
        audioRecorder = new MediaRecorder();
        audioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        audioRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        audioFileName = Environment.getExternalStorageDirectory().getAbsolutePath();
        String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
        audioFileName += "/" + timeStamp;
        audioRecorder.setOutputFile(audioFileName);
        audioRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

        try {
            audioRecorder.prepare();
            return true;
        } catch (IOException e) {
            Log.e(TAG, "prepare() failed");
            return false;
        }
    }

public void stopAudioRecording(final Promise promise) {

        if (audioRecorderPromise != null) {
            audioFile = new File(audioFileName);
            releaseAudioRecorder();
            storeFile();
            promise.resolve("finished recording");
        } else {
            promise.resolve("not recording");
        }

private void releaseAudioRecorder() {
        if (audioRecorder != null) {
            audioRecorder.stop();
            audioRecorder.release();
             audioRecorder = null;
            if (audioRecorderPromise != null) {
                // audioRecorderPromise.resolve(Uri.fromFile(audioFile).toString());
                audioRecorderPromise.resolve(audioFileName);
                audioRecorderPromise = null;
            }
        }
    }

private void storeFile() {

        values = new ContentValues();
        values.put(MediaStore.Audio.Media.TITLE, audioFileName);
        values.put(MediaStore.Audio.Media.DATE_ADDED, System.currentTimeMillis());
        values.put(MediaStore.Audio.Media.MIME_TYPE, "audio/3gpp");
        values.put(MediaStore.Audio.Media.DATA, audioFileName);
        ContentResolver cr =  _reactContext.getContentResolver();
        cr.insert(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, values);
        Uri base = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
        Uri newUri = cr.insert(base, values);
        Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
        intent.setData(Uri.fromFile(audioFile));
        _reactContext.sendBroadcast(intent);
    }

A: You should not provide the file name but the absolute path
Refer Android Developers
Update Better use MediaScannerConnectionClient:
private MediaScannerConnectionClient mediaScannerConnectionClient = new MediaScannerConnectionClient() {

    @Override
    public void onMediaScannerConnected() {
        mediaScannerConnection.scanFile("pathToFile/someName.extension", null);
    }

    @Override
    public void onScanCompleted(String path, Uri uri) {
        if(path.equals("pathToFile/someName.extension"))
            mediaScannerConnection.disconnect();
    }
};
MediaScannerConnection mediaScannerConnection = new MediaScannerConnection(context, mediaScannerConnectionClient).connect();


text:
Q: Pipes & exec & C Hi i have the following problem , I have to create a program that performs these Linux commands  ls –la | sort | wc –l but in my code i just can read two of this command , can sameone help me with this??
int main(){
  pid_t pids[3];
   int dados[2],dados2[2],i;

    if(pipe(dados) == -1 && pipe(dados2) == -1){
       perror("pipe failed");
       exit(1);
     }

  for(i=0;i<3;i++){
      pids[i] = fork();
      if(pids[i] == 0){
          if(i==0){
            close(dados[0]);
            dup2(dados[1],1);
            close(dados[1]);

            execlp("ls","ls","-la",NULL);
            perror("exec failed");
            exit(-1);
        }
        if(i==1){
            close(dados[1]);
            dup2(dados[0],0);
            close(dados[0]);

            close(dados2[0]);
            dup2(dados2[1],1);
            close(dados2[1]);

            execlp("sort","sort",NULL);
            perror("exec failed");
            exit(-1);
         }else{
            close(dados2[1]);
            dup2(dados2[0],0);
            close(dados2[0]);
            printf("aaaaaaaaaaaaaaaaaa");
            execlp("wc","wc","-l",NULL);
            perror("exec failed");
            exit(-1);
         }
     }
 }

 /* Pai tem de fechar a sua copia da extremidade de escrita
  para a leitura do sort desbloquear */
 close(dados[1]);
 close(dados2[0]);
 for(i=0;i<3;i++){
     wait(NULL);
 }

return 0;

}
i dont understand what miss in this

A: What catches my eye immediatly is
-if(pipe(dados) == -1 && pipe(dados2) == -1){
+if(pipe(dados) == -1 || pipe(dados2) == -1){

   perror("pipe failed");
   exit(1);
}

The parent pid just needs to read the output of the last command, so the parent neeeds to close all other pipe ends. The child processes needs to close stdin/stdout and dup2() the pipe descriptors to bind them to stdin/stdout and then exec(). With pipes it is really important that you close the not needed pipe end in your process. See http://linux.die.net/man/2/pipe
Currently i dont have an linux box beneith me, so i cant write and test linux code.
My summary for you is:
- parent reads from the last pipe (stdout of the last process in the chain)
- all other childs need to close() their stdin/stdout, dup2() the right pipeend, close all unneeded pipes (remember to close the dup2() source too, because it is a fd) and then exec.
Here is an example how i did create a pipe and rebind the fds.
// unset FD_CLOEXEC
set_close_on_exec(to_child,false);
set_close_on_exec(from_child, false);

// close and rebind the stdin/stdout/stderr
// dup the fd and recreate stdin/stdout with fd as the target
if (dup2(to_child, STDIN_FILENO) != 0 || dup2(from_child, STDOUT_FILENO) != 1) {
    shared::perror("error duplicating socket for stdin/stdout");
    exit(EXIT_FAILURE);
}

// close these FDs
close(to_child);
close(from_child);

// now we can exec the new sub process and talk to it through
// stdin/stdout/stderr
execlp(exe.c_str(), exe.c_str(), argv.c_str(), (char*)0);

// this should never be reached
shared::perror("error: executing the binary: " + exe);
exit(EXIT_FAILURE);

Remember that at pipe(int fds[2]) the index 1 is the write end of the pipe and index 0 is the read end of the pipe. So you need
Regards
Georg
Edit: I recommend you the book "The Linux Programming Interface: A Linux and UNIX System Programming Handbook" ISBN-13: 978-1593272203


text:
Q: Data truncated at the 256th character - PHP with HFSQL database, using PDO ODBC pilot I am creating a WebSite with PHP and HyperFileSQL, based on PDO & ODBC for the connection.
I am using the 7.1.9 release of PHP and working under WampServer.
But I have an issue when retrieving text data with more than 255 characters : the data is truncated and some random characters appear at the end.
I found some posts about this problem, like the following :

*

*https://bugs.php.net/bug.php?id=38805 ==> The issue is about MSSQL Server ; I tried the different proposals, but nothing worked for me (PHP.ini with odbc.defaultlrl = 2147483648, mssql.textsize, ...) because I'm not using MSSQL Server.

*https://forum.pcsoft.fr/fr-FR/pcsoft.fr.webdev/3590-memo-texte-tronque-dans-requete-sql/read.awp ==> It's in french, but the problem is talking about the "DISTINCT" use on texts, but I don't use the DISTINCT or GROUP BY functions so I'm not concerned by this.

*ODBC query on MS SQL Server returning first 255 characters only in PHP PDO (FreeTDS) ==> The issue is about FreeTDS ; I tried to cast my text (CAST xxx AS TEXT) but I still have the same issue.

So, here is my code :
1) PHP :
// Configuration de la connexion à la BDD --- Configuration of the connection to the database
$connexion['DSN']       = '{HFSQL}';
$connexion['IPServeur']     = 'XXX';
$connexion['Port']      = 'XXX';
$connexion['NomBDD']        = 'XXX';
$connexion['LoginServeur']  = 'XXX';
$connexion['MDPServeur']    = 'XXX';
$dsn = sprintf('odbc:DRIVER=%s;Server Name=%s;Server Port=%s;Database=%s;UID=%s;PWD=%s;', $connexion['DSN'], $connexion['IPServeur'], $connexion['Port'], $connexion['NomBDD'], $connexion['LoginServeur'], $connexion['MDPServeur']);

try{
    // Connexion à la BDD --- Connection to the database
    $bdd = new PDO($dsn, '', '', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));

    // Initialisation de la requête --- SQL initialisation
    $sql        = 'SELECT CorpsHTML FROM T_ModeleEmail WHERE T_ModeleEmail.IDModeleEmail = :IDModeleEmail';
    $requete    = $this->getBDD()->prepare($sql);

    // Affectation des paramètres --- Bindings
    $tmpIDModeleEmail = 2;
    $requete->bindValue(':IDModeleEmail', $tmpIDModeleEmail, PDO::PARAM_INT);

    // Exécution de la requête --- SQL execution
    $requete->execute();

    // Récupération du 1er résultat --- Results parsing
    $donnees = $requete->fetch(PDO::FETCH_ASSOC);

    var_dump($donnees);

    // On libère la requête --- Unallocate the request
    $requete->closeCursor();

    // On vérifie qu'on a bien trouvé un modèle email --- email model found
    if(!empty($donnees)){
        // Renvoi de l'objet trouvé après hydratation --- Returns the object found
        return new ModeleEmail($donnees);
    }else{
        return null;
    }
}catch(PDOException $e){
    // Gestion des exceptions : arrête le script s'il y a une erreur --- Issue with PDO
    die('Impossible de se connecter aux données du site. [Code de l\'erreur : '. $e->getCode() . '] Détails : ' . utf8_encode($e -> getMessage()));
}

2) Here is the record that I try to display (8 byte), truncated at the 256th character when displayed :
<title>Activation de votre compte</title>Ceci est un texte supérieur à 255 caractères, et qui n'est par conséquent par récupéré entièrement, bien que ce soit stocké dans un mémo texte ! Cela semble provenir d'un ancien bug de PDO, mais tous les forums ne parlent que de MSSQL Server, et aucun ne parle d'une solution pour PDO ODBC.

3) And the result displayed :
array(1) {
    ["CorpsHTML"]=> string(370)
    "<title>Activation de votre compte</title>Ceci est un texte sup�rieur � 255 caract�res, et qui n'est par cons�quent par r�cup�r� enti�rement, bien que ce soit stock� dans un m�mo texte ! Cela semble provenir d'un ancien bug de PDO,Zk���-o�����������xj������X7o��(0o������@o���"
}

For information, I found something during my debugs : when I add "bindColumn", the full text seems to be found... :
PHP ("bindColumn" alternative) :
// Affectation des paramètres
$tmpIDModeleEmail = 2;
$requete->bindValue(':IDModeleEmail', $tmpIDModeleEmail, PDO::PARAM_INT);
$requete->bindColumn('CorpsHTML', $tmp);

// Exécution de la requête
$requete->execute();

// Récupération du 1er résultat
$donnees = $requete->fetch(PDO::FETCH_ASSOC);

var_dump($donnees);
echo 'TMP = '. $tmp;

And the result is... magic... :
array(1) {
["CorpsHTML"]=>
string(115) " mais tous les forums ne parlent que de MSSQL Server, et aucun ne parle d'une solution pour PDO ODBC."
}

TMP = <title>Activation de votre compte</title>Ceci est un texte sup�rieur � 255 caract�res, et qui n'est par cons�quent par r�cup�r� enti�rement, bien que ce soit stock� dans un m�mo texte ! Cela semble provenir d'un ancien bug de PDO,Zk���,o�����������xj������X7o��(0o������@o���

Am I missing something ? Should I consider another option than PDO ? Or should I migrate my database to MSSQL Server ?
Much thanks in advance for your help !
If something is not clear, I will edit my message to clarify it.
Have a good day,
Mickaël
EDIT - SOLUTION
Oh well, I found an alternative solution, dirty... but working :
--> Convert the datatype from "TEXT" to "VARCHAR(10000)"
--> Use ODBC instead of PDO & ODBC
--> Configure your DAOs to use ODBC or PDO & ODBC, depending if your table have TEXT fields (where you have to cast them into VARCHAR(XXXX) or not.
I hope that will help those in the same case.
Nevertheless, I'm still regarding to a cleaner solution :)

A: I found an alternative solution, dirty... but working :
--> Convert the datatype from "TEXT" to "VARCHAR(10000)"
--> Use ODBC instead of PDO & ODBC
--> Configure your DAOs to use ODBC or PDO & ODBC, depending if your table have TEXT fields (where you have to cast them into VARCHAR(XXXX) or not.
I hope that will help those in the same case.


text:
Q: ubuntu 9.10 and Windows proxy servers Is there anything special to setting up ubuntu 9.10 to use a proxy server besides going to Preferences->Network Proxy?  I setup the proxy name in a similar way (proxy 8080), but also provide the authentication credentials in the pop-up box.
This is a proxy at work, which I believe to be a Windows machine (most likely some version of Windows Server).  The computer I'm running is a laptop (with ubuntu 9.10).
I can't get ssh or Dropbox to work, but if I launch Chromium or Firefox and browse to a page, I'm prompted to enter credentials (my work computer login/pass, which are the same used on the proxy), and this works fine to browse any webpage.  However, I still can't use ssh and Dropbox doesn't connect.
Further, Chromium has this option to infer the proxy settings from the operating system, but this appears to have no effect and I'm still prompted for credentials to get any page to come up.
I also tried setting up ProxyCommand in my ssh/.config, but apparently the man page is out of date as the options in the nc -X command -x proxy:8080 %h %p command aren't recognized.  I tried this instead:
ProxyCommand nc proxy 8080 %h %p

But that doesn't work either.  Any other things I should try or check out to try and debug the problem?  Like I said, the credentials input through the browser are valid and get me access to webpages - I just don't know where else to try them out.
Update: Added sample screenshots of the Firefox/Chromium dialogs and prompts, which are both similar.  As mentioned in the comment below, the credentials are added to the Details... dialog/pop-up in ubuntu's Preferences->Network Proxy dialog.
Update 2: So, proxytunnel 1.9.0 didn't build on the machine (an openssl directory missing from the proxytunnel source code, gcc barks).  I did however get corkscrew built and installed, and added
ProxyCommand corkscrew proxy 8080 %h %p ~/.ssh/proxyauth

to .ssh/config, as shown here.  Still no dice - I get an error:
Proxy Error (The specified Secure Sockets Layer (SSL) port is not allowed.
ISA Server is not configured to allow SSL requests from this port.
Most Web browsers use port 443 for SSL requests.)

and it's starting to look more like this other question off SO.
Update 3: I got the bright idea to try and use my work computer (Vista+Cygwin) and not the work server as my proxy, because I am able to freely ssh from the work computer (I'm guessing because of the MS Firewall Client).  I found this ssl/ssh multiplexer utility which seems promising, but then I had the pleasure of trying to compile it under cygwin (it's not working).
So, is it possible to that?  Could I set up something (a service, open a port, etc.) on my work computer to forward ssh/Dropbox traffic from the laptop correctly?

A: It sounds like you're seeing realm-based authentication that's backed by an AD tie-in, but who knows?  You need to provide a bit more information, including a snapshot of the dialog, what information is prompted (just username and password, or username/domain/password), is the prompt per-session or consistent until you log out, etc.
Also, if you've just set up the proxy info but not the username/password, why would you expect it to work?  If you look at the second picture in that link you posted, you'll notice a "details" button to the far-right.  Click that button, and you'll be prompted to activate authentication with a checkbox; after clicking the checkbox, put in a username and password.  See if that gets you farther.

Ah, so it seems you're really interested in tunneling TCP traffic over HTTP.  There are several ways to accomplish this, although would it probably be easier to just ask the firewall admin for the access you need (hey, I need to get access to XYZ site via SSH, any chance you could open that up...)

A: Since you need proxy authentication you may need to look at something like proxytunnel instead of just netcat to get SSH through the proxy.