text:
Q: c++ creating cyclically dependent objects with raw pointers I'm trying to create a connected graph and to perform certain computations on it. To do that, from each node in this graph, I need to access its neighbors and to access its neighbor's neighbors from its neighbor and so forth. This inevitably creates many (useful) cyclic dependencies.
Below is a simplified example with 3 mutually connected nodes (like the 3 vertices of a triangle), and I'm not sure if this method is a good way to do it, particularly if the clean-up leaves any memory leaks :
#include <iostream>
#include <vector>

class A {
public:
    int id;
    std::vector<A*> partners;

    A(const int &i) : id(i) {
        std::cout << id << " created\n";
    }
    ~A() {
        std::cout << id << " destroyed\n";
    }
};

bool partnerUp(A *a1, A *a2) {
    if (!a1 || !a2)
        return false;

    a1->partners.push_back(a2);
    a2->partners.push_back(a1);

    std::cout << a1->id << " is now partnered with " << a2->id << "\n";

    return true;
}

int main() {
    std::vector<A*> vecA;
    vecA.push_back(new A(10));
    vecA.push_back(new A(20));
    vecA.push_back(new A(30));

    partnerUp(vecA[0], vecA[1]);
    partnerUp(vecA[0], vecA[2]);
    partnerUp(vecA[1], vecA[2]);

    for (auto& a : vecA) {
        delete a;
        a = nullptr;
    }
    vecA.clear();

    return 0;
}

I'm also aware that I can use shared_ptr + weak_ptr to complete the task, but smart pointers come with an overhead and I'd love to avoid that whenever possible (I also hate to use .lock() all the time to access the data, but that doesn't really matter). I rewrote the code using smart pointers as follows, and I'd like to know what are the differences between the 2 pieces of code (outputs of the two codes are identical).
#include <iostream>
#include <vector>
#include <memory>

using namespace std;

class A {
public:
    int id;
    vector<weak_ptr<A>> partners;

    A(const int &i) : id(i) {
        cout << id << " created\n";
    }
    ~A() {
        cout << id << " destroyed\n";
    }
};

bool partnerUp(shared_ptr<A> a1, shared_ptr<A> a2) {
    if (!a1 || !a2)
        return false;

    a1->partners.push_back(a2);
    a2->partners.push_back(a1);

    cout << a1->id << " is now partnered with " << a2->id << "\n";

    return true;
}

int main() {
    vector<shared_ptr<A>> vecA;
    vecA.push_back(make_shared<A>(10));
    vecA.push_back(make_shared<A>(20));
    vecA.push_back(make_shared<A>(30));

    partnerUp(vecA[0], vecA[1]);
    partnerUp(vecA[0], vecA[2]);
    partnerUp(vecA[1], vecA[2]);

    return 0;
}

A: You can prevent memory leaks by using a principle of ownership: At every point, there needs to be an owner who is responsible for freeing the memory.
In the first example, the owner is the main function: It undoes all the allocations.
In the second example, each graph node has shared ownership. Both vecA and the linked nodes share ownership. They are all responsible in the sense that they all call free if necessary.
So in this sense, both versions have a relatively clear ownership. The first version is even using a simpler model. However: The first version has some issues with exception safety. Those are not relevant in this small program, but they will become relevant once this code is embedded into a larger application.
The issues come from transfer of ownership: You perform an allocation via new A. This does not clearly state who the owner is. We then store this into the vector. But the vector itself won't call delete on its elements; it merely call destructors (no-op for a pointer) and deletes its own allocation (the dynamic array/buffer). The main function is the owner, and it frees the allocations only at some point, in the loop at the end. If the main function exits early, for example due to exception, it won't perform its duties as the owner of the allocations - it won't free the memory.
This is where the smart pointers come into play: They clearly state who the owner is, and use RAII to prevent issues with exceptions:
class A {
public:
    int id;
    vector<A*> partners;

    // ...
};

bool partnerUp(A* a1, A* a2) {
    // ...
}

int main() {
    vector<unique_ptr<A>> vecA;
    vecA.push_back(make_unique<A>(10));
    vecA.push_back(make_unique<A>(20));
    vecA.push_back(make_unique<A>(30));

    partnerUp(vecA[0].get(), vecA[1].get());
    partnerUp(vecA[0].get(), vecA[2].get());
    partnerUp(vecA[1].get(), vecA[2].get());

    return 0;
}

The graph can still use raw pointers, since the ownership is now solely the responsibility of the unique_ptr, and those are owned by vecA, and that is owned by main. Main exits, destroys vecA, and this destroys each of its elements, and those destroy the graph nodes.
This is still not ideal, though, because we use one indirection more than necessary. We need to keep the address of the graph nodes stable, since they're being pointed to from the other graph nodes. Hence we should not use vector<A> in main: if we resize that via push_back, this changes the addresses of its elements - the graph nodes - but we might have stored those addresses as graph relations. That is, we can use vector but only as long as we haven't created any links.
We can use deque even after creating links. A deque keeps the addresses of the elements stable during a push_back.
class A {
public:
    int id;
    vector<A*> partners;

    // ...

    A(A const&) = delete; // never change the address, since it's important!

    // ...
};

bool partnerUp(A* a1, A* a2) {
    // ...
}

int main() {
    std::deque<A> vecA;
    vecA.emplace_back(10);
    vecA.emplace_back(20);
    vecA.emplace_back(30);

    partnerUp(&vecA[0], &vecA[1]);
    partnerUp(&vecA[0], &vecA[2]);
    partnerUp(&vecA[1], &vecA[2]);

    return 0;
}

The actual problem of deletion in a graph is when you don't have a data structure like your vector in main: It is possible to just keep pointers to one or several nodes from which you can reach all other nodes in main. In that case, you need graph traversal algorithms to delete all nodes. This is where it gets more complicated and hence more error prone.
In terms of ownership, here the graph itself would have ownership of its nodes, and main has ownership of just the graph.
int main() {
    A* root = new A(10);

    partnerUp(root, new A(20));
    partnerUp(root, new A(30));
    partnerUp(root.partners[0], root.partners[1]);

    // now, how to delete all nodes?

    return 0;
}

Why would the second approach be recommended?
Because it follows a widespread, simple pattern that reduces the likelyhood of a memory leak. If you always use smart pointers, there'll always be an owner. There's just no opportunity for a bug that drops ownership.
However, with shared pointers, you can form cycles where multiple elements are kept alive because they own each other in a cycle. E.g. A owns B and B owns A.
Therefore, the typical rule-of-thumb recommendations are:

*

*Use a stack object, or if not possible, use a unique_ptr or if not possible, use a shared_ptr.

*For multiple elements, use a container<T>, or container<unique_ptr<T>> or container<shared_ptr<T>> in that order.

These are rules of thumb. If you have time to think about it, or some requirements like performance or memory consumption, it can make sense to define a custom ownership model. But then you also need to invest the time to make that safe and test it. So it should really give you a great benefit to be worth all the effort needed to make it safe. I would recommend against assuming that shared_ptr is too slow. This needs to be seen in the context of the application and usually measured. It's just too tricky to get custom ownership concepts right. In one of my examples above, you need to be very careful with resizing the vector, for example.


text:
Q: RubyMine can't find Ruby SDK on Ubuntu I'm trying to add Ruby SDK to RubyMine which is installed at /snap/bin/ruby however I get the following message.
Error configuring SDK: Could not get RubyGems environment for ruby-2.6.3-p62: ver.2.6.3p0 (/snap/bin/ruby).

Please make sure that /snap/bin/ruby is a valid home path for this SDK type.

A: Currently, RubyMine cannot add Ruby installed using snap: RUBY-23121. As an alternative, you can install Ruby with apt or by using the version manager.

A: If you are using ruby installed via rbenv, then just select 2nd option 'New local version manager...', instead of 'New local...' since you are using rbenv. Your path should be like this: /home/$USRNAME/.rbenv/bin/rbenv.

A: You should point it to the where you keep your Ruby Binary File, for example:

*

*Windows - d:\dev\Ruby19\bin\ruby.exe

*Mac Brew -/usr/local/Cellar/ruby/2.0.0-p247/bin/ruby

*Ruby Version Manager - /Users//.rvm/rubies/ruby-1.9.3-p327/bin/ruby

*Linux/Mac Default- /usr/bin/ruby

redpajama_set_name: RedPajamaStackExchange


text:
Q: Properly using c-code libs in Xcode to allow multi-platforms I have a c library of astronomical code that I'd like to make use of in several formats - a command line that reads and writes files, an iOS app with graphical output, etc.
Ideally I'd like to be able to leave the code in a format that would allow the most basic version (the CLI's) to be cross-compiled on other platforms, while remaining editable within Xcode for the iOS versions - if such a thing is possible.
Does anyone have a good guide on how to arrange projects in Xcode in order to make them easier to move between different targets like this, while avoiding platform lock-in as much as possible?


text:
Q: Ios chrome getting error getUserMedia is not implemented in this browser? window.navigator.mediaDevices.getUserMedia({ audio: true }).then(function (stream) {
  console.log(stream)
}).catch(function (err) {
    console.error(err);
});

It's working fine in the latest ios 15 OS but it's not working old ios 12,13,14 os. Also working safari in every ios os.


text:
Q: Why must you extend an object in order to delete a member of it? I was having a problem where JSON.stringify was not retaining a property I added to an object that was created using $("#myForm").serializeArray();.
I found this SO thread: JSON.stringify is ignoring object properties
And the solution worked for me -- I created a new object which extended my mySerializedFormArray object, then I was able to call delete newObj.toJSON.
If I simply called delete mySerializedFormArray.toJSON;, the new property I added is still removed during stringification.
Why does it work when I extend the object?
Edit:
var DynExport = $('#frmDynExport').serializeArray();

DynExport.IsFooEnabled = $("#hdnFooFlag").val();

var newObj = $.extend({}, DynExport);

delete newObj.toJSON;

var someOtherVar = JSON.stringify(newObj);
DynExport = JSON.stringify(DynExport);

someOtherVar will include IsFooEnabled, DynExport does not.

A: The .serializeArray() method returns an array (which is probably not surprising). When an array is serialized as JSON, it ends up looking like this:
[ value, value, value, ... ]

The property names are the numeric indexes of the values in the array, and they're implicit: the first value corresponds to element 0, the second to element 1, and so on.
In that scheme of representation, then, there's no place to put properties that don't have numeric names; that is, properties that aren't part of the "real" array. Such properties work fine in JavaScript of course, but there's simply no way to represent them in JSON.
By copying the array properties (along with your "IsFooEnabled" property) to a new plain object with $.exend(), you get around that problem because the JSON serialization scheme for a plain object explicitly includes all the property names.


text:
Q: GARCH specification - why are $\sigma_t^2$ and $\epsilon_t^2$ not the same? Often times people specify the GARCH model as follows:
$$ \sigma _{t}^{2}=\omega +\alpha _{1}\epsilon _{t-1}^{2}+\cdots +\alpha _{q}\epsilon _{t-q}^{2}+\beta _{1}\sigma _{t-1}^{2}+\cdots +\beta _{p}\sigma _{t-p}^{2}=\omega +\sum _{i=1}^{q}\alpha _{i}\epsilon _{t-i}^{2}+\sum _{i=1}^{p}\beta _{i}\sigma _{t-i}^{2}.$$
I must admit that I am a little confused as to what the difference is between $\sigma_t^2$ and $\epsilon_t^2$. As far as I (though I did) know the squared error terms equal the variance, because of the fact that its mean equal zero.
In other words; what I am wondering is what is the actual "numbers" that is put into $\sigma_t^2$'s place in the equation when estimating?

A: In a GARCH model for a time series $x_t$ we have
\begin{aligned}
x_t&\sim i.i.D(\mu_t,\sigma_t^2), \\
\mu_t&=... \text{ (conditional mean of } x_t \text{ given past information)} \\
\sigma_t^2&=\omega +\sum _{i=1}^{q}\alpha _{i}\epsilon _{t-i}^{2}+\sum _{i=1}^{p}\beta _{i}\sigma _{t-i}^{2} \text{ (conditional variance of } x_t \text{ given past information)}
\end{aligned}
where $D$ is some distribution parameterized by the conditional mean $\mu_t$ and conditional variance $\sigma_t^2$, and $\epsilon_t:=x_t-\mu_t$ is an additive error term, a random variable itself. Meanwhile, $\sigma_t^2$ is the conditional variance of $x_t$ and simultaneously of $\epsilon_t$, hence, a parameter (an unknown constant). You are right that $\mathbb{E}(\epsilon_t^2)=\sigma_t^2$, but that does not make for $\epsilon_t^2=\sigma_t^2$.
When we are estimating the model, we treat $\sigma_t^2$ as an unknown parameter and estimate it along with the other parameters such as $\omega$, $\alpha$s and $\beta$s. We are not putting in any numbers in for $\sigma_t^2$ in estimation because conditional variances are unobservable and are never a variable in our dataset (just like the other model parameters).


text:
Q: OSError: cannot identify image file 'dataSet/.DS_Store' I am trying to run a facial recognition trainer that looks at a folder of jpg images of faces
import os                                               # importing the OS for path
import cv2                                              # importing the OpenCV library
import numpy as np                                      # importing Numpy library
from PIL import Image                                   # importing Image library

EigenFace = cv2.face.EigenFaceRecognizer_create(15)      # creating EIGEN FACE RECOGNISER
FisherFace = cv2.face.FisherFaceRecognizer_create(2)     # Create FISHER FACE RECOGNISER
LBPHFace = cv2.face.LBPHFaceRecognizer_create(1, 1, 7,7) # Create LBPH FACE RECOGNISER

path = 'dataSet'                                        # path to the photos
def getImageWithID (path):
    imagePaths = [os.path.join(path, f) for f in os.listdir(path)]
    FaceList = []
    IDs = []
    for imagePath in imagePaths:
        faceImage = Image.open(imagePath).convert('L')  # Open image and convert to gray
        faceImage = faceImage.resize((110,110))         # resize the image so the EIGEN recogniser can be trained
        faceNP = np.array(faceImage, 'uint8')           # convert the image to Numpy array
        ID = int(os.path.split(imagePath)[-1].split('.')[1])    # Retrieve the ID of the array
        FaceList.append(faceNP)                         # Append the Numpy Array to the list
        IDs.append(ID)                                  # Append the ID to the IDs list
        cv2.imshow('Training Set', faceNP)              # Show the images in the list
        cv2.waitKey(1)
    return np.array(IDs), FaceList                      # The IDs are converted in to a Numpy array
IDs, FaceList = getImageWithID(path)

which in turn returns the error
Traceback (most recent call last):
  File "/Users/jef/PycharmProjects/testProject/Python/Trainer_All.py", line 28, in <module>
    IDs, FaceList = getImageWithID(path)
  File "/Users/jef/PycharmProjects/testProject/Python/Trainer_All.py", line 19, in getImageWithID
    faceImage = Image.open(imagePath).convert('L')  # Open image and convert to gray
  File "/Users/jef/venv1/lib/python3.6/site-packages/PIL/Image.py", line 2452, in open
    % (filename if filename else fp))
OSError: cannot identify image file 'dataSet/.DS_Store'

The folder dataSet exists and i'm running the code on my mac, and the most recent versions of Pillow, numpy and cv2, I've googled the OSError but not much came up to help this particular problem. Any ideas?

A: os.listdir() will give you every single file in the directory, including hidden files like .DS_Store. In macOS, .DS_Store is a hidden file (any file starting with a . is hidden from Finder) inserted in directories whenever you view them with Finder to speed up loading the file icons and saving your preferences for thumbnail sizes and such in that folder. You can read more about the file on Wikipedia.
You can see the file if you navigate to the directory and list the files in terminal with ls -a.
In any case, you just need to not try and read that as an image file. There are a bazillion ways to avoid this, here's a few:
for imagePath in imagePaths:
    if imagePath == directory + '.DS_Store':
        continue
    # rest of your program

or
imagePaths = [os.path.join(path, f) for f in os.listdir(path)]
if directory + '.DS_Store' in imagePaths:
    imagePaths.remove(directory + '.DS_Store')

or just use glob to grab files only with the extensions you want:
import glob
imagePaths = [f for f in glob.glob(directory+'*.jpg')]  # or .png, .tif, etc

Here the * is a wildcard meaning "any sequence of characters" so this will grab directory/1.jpg and directory/asdf.jpg and all other possibilities starting with directory/ and ending with .jpg.
Or just remove it from your directory in terminal with
rm .DS_Store

but this is only a temporary solution as macOS will insert the file again next time you view the folder in Finder.

A: On terminal, cd directory and run rm .DS_Store


text:
Q: Relativity time dilatation confusion please help POkay, so moving clocks run slower but there is something I don't understand when talking about relative time and proper time. Consider this example for PBS crash course relativity, it says that the train relative time is 6.66x10^-7 seconds with a velocity of 0.5c but if we calculate the proper time (the time the other person that is not moving calculates ) it results 5.77x10^-7 seconds which is less than the relative time so the time in the moving frame is higher but it should be slower (time runs slower in moving frames). In addition, the gamma factor is 1.15 so 1 second in the moving frame is 1.15 second in the proper frame so the proper time should be 1.15x6.66x10^-7 =7.6x10.7 but it actually says that the proper time is 5.77x10^-7 which brings me a lot of confusion because it is later used to calculate the length contraction from the proper time view but I can't understand why the proper time is less time. For example if the gamma factor is 4 then 1 year in a space should be 4 years in earth (proper time) and the length contraction should be done with that number. Plz explain:(

A: FYI, larger value of time means that the moving clock runs slower. Try to imagine that for the clock-tick, the clock use more time (larger value of time) to make a tick in moving frame and that's why you'd say the clock is running slower in moving frame. So you get the fact that proper time is smaller than the relative time.


text:
Q: Publish-AzureServiceProject is not updating files on the cloud I have a PHP Azure project which I have to manage with Powershell cmdlets. One of these, Publish-AzureServiceProject doesn't seem to be detecting file changes so these are not updated on the cloud (even though no errors are displayed).
I have remote desktop'd into the machines and the code is definitely not updated from weeks ago.
If I deploy to the local emulator, it is fine but this is much more obvious because it displays "removing old package" and "creating local package". The cloud package definitely contains the latest files, so the packaging is working fine.
Can anyone tell me how to force the publish to update the files on the cloud and more importantly, why this is not happening? Also, if I force the update, will it deploy to a new box and get a new IP Address?
Thanks.

A: It seems to work now.
I have removed and reinstalled azure libraries from my machine and created a new project from scratch and copied the original files over into it. I have not included diagnostics (not sure if that's an issue) and I have modified the Publish-AzureServiceProject script to select the subscription each time before it publishes.
It is possible that the subscription confusion was not helping (I have two Azure subscriptions and it might have used the wrong one at some point and done something weird) and also it was possible there was some conflict with various versions of the Azure SDK since I have been using it for over 6 months but at the moment, all is good.
A related article on my blog here: Problems with PHP Azure
Thanks for the interest


text:
Q: ASM diskgroup drop from another ASM instance I have created long time back one ASM RAC setup and I created one diskgroup with some name say xyz. I think that instance is gone but the diskgroup was not dropped exclusively using command:
drop diskgroup xyz including contents;

Now that I have created a new setup and want to re utilize these disks, I am getting below error:
CREATE DISKGROUP XYZ EXTERNAL REDUNDANCY DISK ...

ORA-15003: diskgroup "xyz" already mounted in another lock name space

How can this diskgroup be removed? Any help is appreciated.

A: Check the diskgroup status in both instances.  If it is showing mounted in both instances then:

*

*dismount the diskgroup in all the instance except one.  For instance, if you have a 3 node RAC setup, then dismount the diskgroup in nodes 2 and 3.

*Drop the diskgroup from the  1st node.


text:
Q: Is there a Bevy equivalent for Amethyst's fixed_update? In Amethyst, or numerous other game engines, there is a distinction between update for the logic and fixed_update for the rendering.
Bevy 0.4 introduced states, but there are only enter, update and exit lifecycle hooks.
A custom stage can be made with constants from the stage module, but it only adds POST_UPDATE and PRE_UPDATE.
My question is in the title, but furthermore, if there is no equivalent, is there a best practice to run a system that handles the rendering?
A working solution is to make a second update system (called render for instance), my aim is however to improve performance if there is a better way to do it.

A: I don't know if for your use case this is helpful but in the bevy 0.4 announcement a example that show that is possible to create a stage with FixedTimestep.
So using the example from the 0.4 announcement as a base:
use bevy::prelude::*;
use bevy::core::FixedTimestep;

fn main() {
    let target_rate = 60.0;
    App::build()
        // Add the default plugins to open a window
        .add_plugins(DefaultPlugins)
        .add_stage_after(
            stage::UPDATE,
            "fixed_update",
            SystemStage::parallel()
                // Set the stage criteria to run the system at the target
                //  rate per seconds
                .with_run_criteria(FixedTimestep::steps_per_second(target_rate))
                .with_system(my_system.system()),
        )
        .run();

}

Maybe this approach is not optimized (I don't exactly know how the FixedTimestep criteria works internally), but it should be sufficient in most of cases.
Edit

I found out that the it's possible to use the render App stages as the stage name, which should be more aligned with your needs:
use bevy::prelude::*;

fn main() {
    App::build()
        // Add the default plugins to open a window
        .add_plugins(DefaultPlugins)
        .add_system_to_stage(bevy::render::stage::RENDER, my_system.system())
        .run();

}


text:
Q: JavaScript - How to get 1900/01/01 in UTC+0? I have seen that Date.UTC() returns the number of milliseconds in a Date object since January 1, 1970, 00:00:00, universal time.
If I do new Date(Date.UTC(1900, 0, 1)).toString() I get

Sun Dec 31 1899 23:45:16 GMT-0014 (hora estándar de Europa central)

Why?
Test here:

const date = new Date(1900, 0, 1);
console.log(date.toString())

console.log("==========================");

const date2 = new Date(Date.UTC(1900, 0, 1));
console.log(date2.toString())

A: toString() will return tour local time based on OS configuration.
If you want UTC then use toUTCString()

console.log(new Date(Date.UTC(1900, 0, 1)).toString())
console.log(new Date(Date.UTC(1900, 0, 1)).toUTCString())


text:
Q: Passing Bitmap to another Activity in Kotlin I have a HashMap of Bitmap images, declared like this:
var cachedImages : HashMap<String, Bitmap?> = HashMap()

And I fetch one of them like so:
val imageNeeded = cachedImages.get("imgKey")

How can I pass this Bitmap? to the next activity so I can use it there?


text:
Q: How to change wifi passwords using the terminal I have like most people a router in my home. Wifi is accessed using a password. Is it possible to change the Wifi password from the OSX terminal? If not, is it possible from Ubuntu's?
And if so, how?

A: This totally depends on a router: different systems have different interfaces and store information like passwords differently.
For instance, dd-wrt stores password in nvram, so you can ssh to your router and do something like
# nvram set wl0_wpa_psk="password123"
So, just google router model and/or firmware + change password remotely.


text:
Q: Redirect if javascript condition is true not working I have a form and I validate the fields in javascript functions. After the validation, I want to redirect to another page. I am trying this for the form:
<form action="" method="post" name="form" onsubmit="return validate()">
User Name : <input type="text" name="realname" size="19">

E-Mail    : <input type="text" name="email" size="25">

PhoneNo   : <input type="phoneno" name="phoneno" maxlength="10" size="25">

<input type="submit" value="Submit">
</form>

And this is the code for validation:

The point is that all the javascript functions are working correctly, I get error messages if there are any, but it just doesn't make my redirect. The weird thing is that if I put the redirect into another script, and don't make the validation, it works. I don't know what am I doing wrong. I have tried to put my redirect into another function and just call it like this:
if (rtn) {  Redirect(); }

but it still doesn't work. Instead of window.location I also tried window.location.href and document.location.href. I really think there something that I'm missing inside the script... If you notice something, please let me figure it out. Thank you!
I HAVE TRIED TO PUT AN ALERT INSIDE MY IF STATEMENT AND IT APPEARS FOR 2 SECONDS AND THEN IT MAKES THE REDIRECT. IF I DON'T PUT THAT ALERT, MY REDIRECT DOESN'T WORK. HERE IS THE CODE:
if (rtn) {
    window.location="http://test.dev";
    alert(rtn);
   }

A: if (rtn)
{
  alert('hello there');
  window.location="http://new/new.php";
  return true;
}else{
  return false;
}

when true condition first then page redirect to given url and for condition second not           redirect.

A:  if (rtn)
   {
      window.location="http://test.dev";
      return rtn;
   }
  else return rtn;

Replace the above with
return rtn;

The form does not submit if we return false and submits otherwise.
Also, the form will submit to "action", so make sure your "action" property of form is set to "http://test.dev"

A: alert something inside this code
if (rtn)
{
  alert('you here');
  window.location="http://test.dev";
  return rtn;
}

if alert come out, you got here. If not, your first condition is wrong. That we split out where to have problem.

A: Set form tag's action to be http://test.dev.That's all.
Edit: You never think about the form data may not be posted to http://test.dev if you used window.location.href?

A: How doing this?
<form action="http://test.dev" method="post" name="form" onsubmit="return validate()">

A: Try jquery ajax to redirect true statement
$.ajax({url: 'search.php',data: "check_qc=" + qc,async:false,
success: function(response) {if(response==1){window.location="http://google.com";
return false;}}});


text:
Q: Cakephp 3 Image Upload to Cloudinary via API I was about to upload images to cloudinary - a Image CDN look cloudinary.com, It supports all languages and frameworks including Cakephp  3, but for cakephp 3 the steps we're not included in their site. Can anyone possibly say me steps for uploading images in ease?

A: As per their site, I'm providing procedures for uploading.
Base Documentation:
http://cloudinary.com/documentation/php_integration#getting_started_guide
Step 1:
Installation
{
  "require": {
    "cloudinary/cloudinary_php": "dev-master"
  }
}

Add the above to your composer.json located in your project folder.
You can use composer to update it and fetch dependencies. Run the following in composer after navigating to your project folder.
php composer.phar update

Step 2:
Installation in Cake PHP.
Open your AppController and add the following in the initialize function
It apparently looks like the following:
public function initialize() {
        parent::initialize();
        $this->loadComponent('Flash');

        \Cloudinary::config(array(
        "cloud_name" => "sample",
        "api_key" => "874837483274837",
        "api_secret" => "a676b67565c6767a6767d6767f676fe1"
       ));

}

In the above you can find the cloudinary configuration, replace with your own credentials.
To fetch credentials, follow the link below and sign in,
https://cloudinary.com/users/login
Step 3:
Image Upload Procedure
<?php

echo $this->Form->create('upload_form', ['enctype' => 'multipart/form-data']);
echo $this->Form->input('upload', ['type' => 'file']);
echo $this->Form->button('Change Image', ['class' => 'btn btn-primary']);
echo $this->Form->end();

?>

Use the above code in your view file. (you can modify as you need)
In your controller, you can use in the following way,
if (!empty($this->request->data['upload']['name'])) {
            $file = $this->request->data['upload']; //put the data into a var for easy use
            $cloudOptions = array("width" => 1200, "height" => 630, "crop" => "crop");
            $cloudinaryAPIReq = \Cloudinary\Uploader::upload($file["tmp_name"], $cloudOptions);
            $imageFileName = $cloudinaryAPIReq['url'];
        }

You can save the $imagefilename in your database, in here the complete url  is saved and repopulated.


text:
Q: How to unbind laravel class? I bind a class like so:
App::bind('Some_Class', 'Other_Class')

So that calls to App::make('Some_Class') will return an instance of 'Other_Class'. However, later on in the script I want to revert this, so that calls to make will now return the original class.
So far, I've tried these:
App::bind('Some_Class', 'Some_Class')
App::bind('Some_Class', NULL)

Neither has worked - they seem to be causing app to store an instance of the class, which is no good, as I need to able to accept arguments. If the constructor is called with no arguments, it triggers a fatal error. So, how do I undo the binding?
I've even tried using reflection:
App::bind('Some_Class', function() {
    $args = func_get_args();
    $app = array_shift($args);
    $reflection = new ReflectionClass( 'Some_Class' );
    return $reflection->newInstanceArgs($args);
});

And it still doesn't work!

A: App::offsetUnset('Some_Class') should do it.
If you have an instance of the Application ($app) you can even do unset($app['Some_Class'])

A: I believe that
App::instance('Some_Class', new Some_Class);

will do the reversion


text:
Q: PL/SQL efficient method to compare large set of columns? I have trigger on the table having 100+ columns. Is there any efficient method on oracle to compare set of columns and determine that NEW values are NOT equal to OLD values instead of checking every single column?
I am looking some kind of unique number generation like MAC on set of columns. And then compare OLD mac with NEW mac??

A: I typically still test each column individually to be safer.  This is a little bit of a pain, but I just use the database to generate the code for me:
select ':old.'||column_name||' <> :new.'||column_name||' or'
from user_tab_columns
where table_name = 'MY_TABLE';

I then copy the results and paste it into my trigger (deleting the extra "or" at the end).  Obviously it would be much better if you could just do :new <> :old, so lets hope that is possible in the next Oracle version.

A: I think following solution works for me in AFTER Trigger code logic...
SELECT ora_hash( old.ename || old.empno || old.sal ) INTO v_old_hash FROM dual
SELECT ora_hash( new.ename || new.empno || new.sal ) INTO v_new_hash FROM dual

And then compare
IF v_old_hash <> v_new_hash THEN
dbms_output.put_line('Record Change flag');
END IF;

A: Unfortunately, you can not compare records. Look at the documentation:

Record Comparisons
Records cannot be tested natively for nullity, equality, or
  inequality. These BOOLEAN expressions are illegal:
- My_Record IS NULL
- My_Record_1 = My_Record_2
- My_Record_1 > My_Record_2

You must write your own functions to implement such tests.

The easiest way would be to write a procedure that accepts two records (old and new) and returns true/false if the records are equal/not equal. Than use the procedure in the trigger.
How does the procedure check for equality is up to you - either compare every single field or concatenate all the fields and compare the two strings. A hash of the concatenated string could also be used, but you probably know that hashes can collide.


text:
Q: rvm: how do I really know it works I installed rvm successfully and then installed ruby 1.8.7, ruby 1.9.2, and jruby 1.6.0.  I currently use 1.8.7 for all of my rails projects, but I would like to experiment with 1.9.2, and I would also like to deploy jruby on those environments which are Java-specific.
So, I used rvm to select jruby and then I ran my current rails app on mongrel @ localhost:3000.  It worked great.  Then, I ran a Linux process command and looked at the names of the processes running and I found ruby1.8.  Does that mean that the Mongrel instance loaded ruby 1.8, but rails is using jruby-1.6.0?  I don't know.  Who can tell me how to determine that I really am running jruby?

A: type rvm | head -1

The above line should say that RVM is a function and confirms it was installed correctly.
Did you have trouble with instructions on entering the line
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.

into your bash profile? That was a little unclear in my opinion. If it's that, you need to go to your home directory and make a .bash_profile (source: http://donovan.covblogs.com/archives/027838.html)
The above needs to be done before you can rly ensure ruby 1.9.2 is installed, else it'll be forgotten/lost once you close your shell.
Regarding the version of ruby you're using, make sure you're setting the default version. Below was taken from the Ruby on Rails 3 tutorial so feel free to change some naming conventions:
$ rvm --create 1.8.7-p174@rails2tutorial
$ rvm --create use 1.9.2@rails3tutorial

then
$ rvm --default use 1.9.2@rails3tutorial

Finall, type $ ruby -v and you should get ruby 1.9.2
Source: http://ruby.railstutorial.org/chapters/beginning#sec:install_ruby

A: I found this very helpful after starting to use rvm:  i added this to the end of my .bashrc file:  it puts the currently selected rvm and gemset at the start of the command prompt, in red:  most of the following script is taken up with defining colors - you could delete the ones you don't need once you choose the colors you want.
##################################################
### RVM-specific command line (PS1): show current rvm and gemset

function __my_rvm_ruby_version {
  local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
  [ "$gemset" != "" ] && gemset="@$gemset"
  local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
  local full="$version$gemset"
  [ "$full" != "" ] && echo "$full "
}

bash_prompt() {
  local NONE="\[\033[0m\]"    # unsets color to term's fg color

  # regular colors
  local K="\[\033[0;30m\]"    # black
  local R="\[\033[0;31m\]"    # red
  local G="\[\033[0;32m\]"    # green
  local Y="\[\033[0;33m\]"    # yellow
  local B="\[\033[0;34m\]"    # blue
  local M="\[\033[0;35m\]"    # magenta
  local C="\[\033[0;36m\]"    # cyan
  local W="\[\033[0;37m\]"    # white

  # emphasized (bolded) colors
  local EMK="\[\033[1;30m\]"
  local EMR="\[\033[1;31m\]"
  local EMG="\[\033[1;32m\]"
  local EMY="\[\033[1;33m\]"
  local EMB="\[\033[1;34m\]"
  local EMM="\[\033[1;35m\]"
  local EMC="\[\033[1;36m\]"
  local EMW="\[\033[1;37m\]"

  # background colors
  local BGK="\[\033[40m\]"
  local BGR="\[\033[41m\]"
  local BGG="\[\033[42m\]"
  local BGY="\[\033[43m\]"
  local BGB="\[\033[44m\]"
  local BGM="\[\033[45m\]"
  local BGC="\[\033[46m\]"
  local BGW="\[\033[47m\]"
  local UC=$W                 # user's color
  [ $UID -eq "0" ] && UC=$R   # root's color

  PS1="$R\$(__my_rvm_ruby_version)$Y\h$W:$EMY\W${NONE}$ "
}

bash_prompt
unset bash_prompt
############## PS1 editing section ends


text:
Q: Error using dropdown on thymeleaf and spring I have a form to create a new product. This form has one dropdown with the possibles sizes (setting in the controller) and another dropdown with the possibles brands. I get the brands from the database (I have another independent form to create brands). My problem is that I can't create the product because my dropdowns have some error that I can't find.
Controller:
    @RequestMapping(value = "/form", method = RequestMethod.GET)
        public ModelAndView form(ModelMap map1, ModelMap map2) {
            String[] sizes = new String[] {"S", "M", "L", "XL"};
            List<String> size = Arrays.asList(sizes);
            map1.addAttribute("size", size);

            List<Brand> list = myService.listBrands();
            map2.addAttribute("brands", list);

            return new ModelAndView("formcreate", "product", new Product());
        }

    @RequestMapping(value = "/submit", method = RequestMethod.POST)
    public String saveProduct(@Valid @ModelAttribute("product") Product prod,
            BindingResult result) throws InstantiationException {

        if(result.hasErrors()) {
            System.out.println("Validation error");
            return "formcreate";
        }else {
            System.out.println("OK");
System.out.println("id brand = " + prod.getBrand().getId());
            System.out.println("name brand = " + prod.getBrand().getName());
            productService.insertProduct(prod);

            return "prodsubmit";
        }
    }

formcreate.html:
<form th:action="@{/submit}" th:object="${product}" method="post">
          <form:errors path="*" cssClass="errorblock" element="div" />

                Name
                <input type="text" th:field="*{name}"/>

                Brand
                    <select class="form-control" id="brand" name="brand">
                        <option th:each="brand : ${brands}"
                                th:value="${brand.id}"
                                th:text="${brand.nombre}"></option>
                    </select>

                Preice
                <input type="text" th:field="*{price}" />

                Size
                    <select class="form-control" id="size" name="size">
                        <option th:each="size : ${size}"
                                th:value="${size}"
                                th:text="${size}"></option>
                    </select>

                    <input type="submit" value="Aceptar">

</form>

In prodsubmit.html I have the code to show the product data.
When I try to create a new product I get the next:
id brand = null
name brand = 100

Id brand should be 100, and name brand should be Example


text:
Q: Spring boot Request Mapping URI Patterns There is a request mapping like this:
@DeleteMapping(value = "/{version:.+}")

I not sure what is the .+ does, but from what i know, this delete mapping can accept a value and match to path variable version, something like:
DELETE
/abc

Value abc will map to path variable version
Why the .+ is needed?

Edited Question:
What is the difference with just /{version}, is there any special case that requires .+?

A: You can find details or URL matching on this link
URL matching
REGEX: .+ means one or more.
'*' Matches 0 or More Characters
'+' Matches 1 or More.

A: @DeleteMapping(value = "/{version:.+}")
.+ means "one or more of any characters" - thats standard regex/
version: means - put that match in path variable named version.


text:
Q: Angular 1.4.1 breaks ngBindHtml When migrating to Angular 1.4.1 the following code didn't work anymore :

The error is the following :
Error: [$parse:syntax] Syntax Error: Token '{' is not a valid identifier at column 5 of the expression [row.{{col.field}} | {{col.filter}}] starting at [{{col.field}} | {{col.filter}}].

Any help would be greatly appreciated.
Update :
What i'm trying to do is the following :

*

*display a generic table in which row are extracted from displayedElts
variable, columns description comes from tableSpec.columns in scope.

*Each row has columns that is accessible by name contained in
tableSpec.columns,

*It apply a filter on each column by finding the name of the filter in
the tableSpec.columns['name'].filter attribute.
Update 2 :
Filters which names are given by col.filter are declared regularly in Angular with such syntax :
angular.module('cld-apps.filters', []).
filter('cldFloatPercent', ['$translate', '$log',
    function ($translate, $log) {
            return function (floatCentValue, forceDeci) {
                if (debug) $log.debug('Into cld-apps.filters.cldPercent');
                return formatFloatCent($translate, floatCentValue, forceDeci) + ' %';
            };
}]);

Sorry for not giving this informations sooner. I believe it was just a matter of syntax.
Jean-Marc

A: You can see on this link that ng-bing-html doesn't work this way.
you have to use expression in ng-bind-html like this:
Html code :

Script Code:
$scope.muHTML = "
Hello World
"


text:
Q: Type checking with dynamic class creation in Python I want to create a class dynamically:
from pydantic import BaseConfig

CompanyConfig: Type[BaseConfig] = type("CompanyConfig", (BaseConfig,), {})

Now, PyCharm 2022 complains Expected type 'Type[BaseConfig]', got 'type' instead. I can fix it by augmenting the type hint with "| type" or "| typing.Any":
CompanyConfig: Type[BaseConfig] | type = type("CompanyConfig", (BaseConfig,), {})

This feels like a hack. Are there cleaner / more Pythonic solutions?

A: I didn't receive a warning in Pycharm 2022.2.3 CE on macOS for below codes
CompanyConfig: Type[int] = type("CompanyConfig", (int,), {})

but if you indeed met the mentioned problem, typing.cast might help
from typing import (Type, cast)

CompanyConfig = cast(Type[int], type("CompanyConfig", (int,), {}))


text:
Q: Retrieve whole document from couchbase lite in phonegap I am newbie to couchbase lite and I need your help.
   I want to store the data and access in offline and displayed in the phonegap app. So I am choosing the couchbase lite.
Use sample code to do some step.There are

*

*Add the couchbase lite framework.

*Run it in the phonegap app.

*Get the Local couchbase lite URL.

*Create database.

*Database connection to insert, update and delete the document.
But my problem retrieves the whole document from the database.
At the same time I read the map method to retrive the document. but i am not able to understand.
Sample Phonegap app:Here the link
Below I have attached the working code, test it in the ios platform
 var coax = require("coax");
 console.log(coax);
 var appDbName = "couchdb";
 document.addEventListener('deviceready', onDeviceReady, false);

// deviceready Event Handler
//
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicitly call 'app.receivedEvent(...);'

function onDeviceReady() {
receivedEvent('deviceready');
setupConfig(function(err){
            if (err) {
            alert(err)
            return console.log("err "+JSON.stringify(err))
            }
            });

}

function logMessage(message) {
var p = document.createElement("p");
p.innerHTML = message;
document.body.getElementsByClassName('app')[0].appendChild(p);
console.log(message);
}

 // Update DOM on a Received Event

function receivedEvent(id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');

listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');

console.log('Received Event: ' + id);
}

function setupConfig(done) {
// get CBL url
if (!window.cblite) {
    return done('Couchbase Lite not installed')
}
cblite.getURL(function(err, url) {
              console.log("getURL: " + JSON.stringify([err, url]));

              window.server = coax(url);

              var db = coax([url, appDbName]);

              setupDb(db, function(err, info){
                      console.log("getDB"+db);

                      if (err) {
                      return alert( JSON.stringify("GetDB:"+ err ) );
                      }

                      db.get("_local/user", function(err, doc) {
                        if (err) {

                            if( err.status == 404 ) {

                            var docV = { "key" : "value" };
                            db.put( "_local/user", docV, function( err, ok ) {
                            //HERE I AM INSERT THE DATA
                            return alert( JSON.stringify("Success:" + ok ) );
                            } );

                            }
                            else {
                            return alert( JSON.stringify( err ) );
                            }

                        }
                        else {
                            console.log("Document : "+doc._id);
                            // HERE I AM UPDATE AND DELETE THE DATA
                            doc._deleted =true;
                            db.put("_local/user", doc, function(error, ok) {

                            });

                            }

                      });

                      });

              });

}

  function setupDb(db, cb) {
        db.get(function(err, res, body){
         console.log(JSON.stringify(["before create db put", err, res, body]))
         db.put(function(err, res, body){
              db.get(cb);
              })
         })
 }

A: You get the doc passed in as a JS var.  Here's a small snippet that shows this (from the sample app you linked):
function toggleChecked(id) {
    log("toggle", id)
    config.db.get(id, function(err, doc){
        doc.checked = !doc.checked
        doc.updated_at = new Date()
        config.db.put(id, doc, function(){})
    })
}

Properties in doc are available and updated directly.


text:
Q: Shade states of a country according to dictionary values with Basemap I want to plot the map of Mexico and shade the states accordingly to a the values of a dictionary. I used the following code suggested in previous question (Easiest way to plot data on country map with python), so far it plots the country and states, but when I try to define the shading I get an error. Below the code:
import numpy as np
    import matplotlib.pyplot as plt
    from matplotlib.collections import PatchCollection
    from mpl_toolkits.basemap import Basemap
    %matplotlib inline
    from shapely.geometry import Polygon

mexican_states_people = {'AGS': 20,'BC': 57, 'BCS': 562, 'CAMP': 594,'CHIH': 442,'CHIS': 69,'COAH': 100,'COL': 237,'DF': 7323,'DGO': 689,'GRO': 40,'GTO': 295,'HGO': 1134,'JAL': 875,'MEX': 1,'MICH': 393, 'MOR': 301,'NAY': 404,'NL': 327,'OAX': 391,'PUE': 670,'QRO': 270,'QROO': 156,'SIN': 63,'SLP': 689,'SON': 291,'TAB': 306,'TAMPS': 59,'TLAX': 108,'VER': 17,'YUC': 35,'ZAC': 890}

m = Basemap(llcrnrlon=-115,llcrnrlat=5,urcrnrlon=-80,urcrnrlat=35,
            resolution='i',projection='tmerc',lon_0=-99,lat_0=19)
m.readshapefile("MEX_adm1", "mexican_states")

max_people = np.max(mexican_states_people.values())

for coordinates, state in zip(m.mexican_states, m.mexican_states_info):
    print state
    if state["State_name"] in mexican_states_people.keys():
        shade = mexican_states_people[state["State_name"]]/max_people

m.drawcoastlines()
m.fillcontinents(color='coral',lake_color='aqua')
m.drawparallels(np.arange(-40,61.,2.))
m.drawmeridians(np.arange(-20.,21.,2.))
m.drawmapboundary(fill_color='aqua')
plt.title("Mexico")
plt.show()

I get error: KeyError: 'State_name'.
The print state command gave the following information:
{'NAME_0': 'Mexico', 'NAME_1': 'Aguascalientes', 'TYPE_1': 'Estado', 'CCA_1': '                                                                                ', 'VARNAME_1': '                                                                                ', 'ENGTYPE_1': 'State', 'HASC_1': 'MX.AG', 'RINGNUM': 1, 'ID_0': 145, 'ID_1': 1, 'ISO': 'MEX', 'NL_NAME_1': '                                                  ', 'CCN_1': 0, 'SHAPENUM': 1}

The shapefile "MEX_adm1" was downloaded from  http://www.gadm.org/

A: You copied too directly from my previous answer :)
This should work if you replace if state["State_name"] with if state["NAME_1"], as the key for names in the shapefile is NAME_1 - however there will be a different problem, as apparently your mexican_states_people dict uses a different naming convention than the shapefile, in your dict the state is abbreviated as "AGS", while in the shapefile it is called "Aguascalientes".
If there are not too many states, you could change your dict by hand, otherwise you will have to find some other mapping between abbreviations and names.


text:
Q: Javascript Prototype: Replacement vs Addition I'm working with a fairly simple Point2D data structure I built to be inheritable for say a Point3D in the future and I've followed all the guides and similar questions I can find, but none seem help with my issue.
I've defined Point2D as follows:
function Point2D (px, py)
{
  this.x = px;
  this.y = py;

  Point2D.prototype =
  {
    constructor: Point2D,

    move:function (mx, my)
    {
      this.x = mx;
      this.y = my;
    },
    translate:function (dx, dy)
    {
      this.x += dx;
      this.y += dy;
    }
  };
};

I instantiate the object as follows:
var p2d1 = new Point2D(2,3);

Then I call one of the methods as follows:
p2d1.move(1,2);

And the result is:
TypeError: Object #<Point2D> has no method 'move'

I have not idea why my methods don't resolve.
I've messed around with it for a good while and found that I can declare Point2D methods this way and they will work.
Point2D.prototype.move = function () {};

Can anyone explain why they first style of replacing the entire prototype does not work, but adding functions to the existing prototype does work?

A: When you call new Point() the first time, Point.prototype is still an "empty" prototype. I.e. the instance that is created doesn't inherit any methods.
You change (replace) the prototype after the instance was already created. JavaScript has assign by value, not assign by reference. Quick example:
var a = 5;
var b = {c: a};
a = 10;

b.c is still 5, since assigning to a doesn't change what b.c refers to.
Point2D.prototype.move = function () {};

works because you are not replacing Point2D.prototype, you are simply mutating the existing object.
Overall, assignments to *.prototype should take place outside the constructor:
function Point2D (px, py) {
  this.x = px;
  this.y = py;
};

Point2D.prototype = { };

A: I am not sure, but defining the prototype inside the declaration of the "class" is unusual and to me, hard to define exactly how things would be resolved. When doing manual inheritence, I tend to follow more these patterns:
function Foo() {
   this.bar = ...
}

Foo.prototype.baz = function() { ... }

OR
function Foo() { ... }
function Bar() { ... }

Foo.prototype = new Bar();

OR
Foo.prototype = {
    blah: ...
}

Also I wouldn't usually create a "constructor" property manually, as this is a side effect of setting the prototype, but I know some popular libraries do this. In the middle example above, Foo.prototype.constructor == Bar.

A: If you really want to warp your brain create a second instance of Point2D and watch it have the move method available and working!
So here is what is happening.
define Point2D class
create instance of Point2D class
  create initialization object
  create execution context object per new keyword usage
  attach prototype to execution context (at this point just Object)
  run constructor method
    assign value of x
    assign value of y
    assign new prototype value to Point2D class

what you want to do is to move the prototype setting out to the same scope as the class definition.


text:
Q: how to add messages files recursively in build.scala of Play2.0 framework I have messages file for each language in path: release/linux/mhome/user/config/languages/sv/messages.sv
I also have to mention path of each messages file in Build.scala as below:
unmanagedResourceDirectories in Compile <+= baseDirectory(_ /  ".." / ".." / ".." / "release" / "linux" / "mhome" / "user" / "config" / "languages" / "zh" ),
unmanagedResourceDirectories in Compile <+= baseDirectory(_ /  ".." / ".." / ".." / "release" / "linux" / "mhome" / "user" / "config" / "languages" / "en" ),
unmanagedResourceDirectories in Compile <+= baseDirectory(_ /  ".." / ".." / ".." / "release" / "linux" / "mhome" / "user" / "config" / "languages" / "fr" ),

But I need to add path till languages folder in Build.scala and all the messages files get added recursively in classpath. How to achieve this?

A: The first part of the puzzle is to use <++= to add multiple entries to a setting key that is a list in one go
unmanagedResourceDirectories in Compile <++= baseDirectory { dir =>
  ... something that returns a Seq[File] ...
}

The second part is the sbt PathFinder (http://www.scala-sbt.org/0.13.1/docs/Detailed-Topics/Paths.html), which allows you to specify wildcard patterns to find files:
val pathFinder = (".." / "shortened" / "for"/ "brevity" / "languages") ** "*"
val matching: Seq[File] = pathFinder.get

The PathFinder API also allows you to do more advanced filtering if you would need it.


text:
Q: Word order of participial and nonparticipial adjectives I am interested in whether there is any correlation between the word order of NP modifiers and their morphology, which could be purely adjectival or participial. First off, nonparticipial adjectives like shaven or open can occur both to the left and to the right of the nominal head (1).

(1a) A man carefully shaven
(1b) A carefully shaven man
(1a´) The doors recently open
(1b´) The recently open doors

The related participial forms shaved and opened can also occur both to the left and to the right of the nominal head (2).

(2a) A man carefully shaved
(2b) A carefully shaved man
(2a´) The doors recently opened
(2b´) The recently opened doors

The nonparticipial adjectives also appear in the complement of picture-nouns: (3a) refers to a picture that shows a man who is carefully shaven. And in this context they can also occur to the left of the nominal head (3b) (note that (3b) entails that it is the man in the picture that is carefully shaven, not the picture itself). Similar observations apply to the other two examples.

(3a) A picture of him carefully shaven
(3b) A carefully shaven picture of him
(3a´) A picture of the doors recently open
(3b´) A recently open picture of the doors

Now the interesting part. My impression is that the order with the participle on the right is OK (4a) but the one with the participle on the left is not (4b), at least in the reading in which the participles modify the things in the picture. I feel (4b) and (4b´) entail absurdly that the picture is shaved and opened (respectively), that is, we are forced to take the participles here as modifiers of picture, not him/the doors.

(4a) A picture of him carefully shaved
(4b) A carefully shaved picture of him
(4a´) A picture of the doors recently opened
(4b´) A recently opened picture of the doors

Would you guys say this is a fair assessment of the data? I'm not a native speaker so I keep second-guessing myself.

A: *

*"The doors recently open" can only be conceived elliptically as " The doors that were recently open", but this ellipsis does not seem to be recognized, perhaps because of the proximity with " The doors recently opened", which is readily given an unambiguous sense. It seems that the unique choice is the unellipted form.

*"The recently open doors" — The conveying of a stative situation by means of an adjective so managed in the phrase does not seem to belong to current English. Here again, only the past participle can be used, and this is so as to convey the idea of an action instead of that of a state.

*

*The recently opened doors

*The second construction (3b - a carefully shaven picture of him) is not possible: the only interpretation is that of a picture that is shaven, which is nonsense in normal contexts.The third and the fourth fare no better.

*Only the first and the third of this fourth lot of constructions are meaningful; the other two are nonsense.


text:
Q: Countdown available spaces in a textarea with jquery or other? I have a few areas on my site where I need to limit text input to X amount of characters and it's nice to show a number of spaces left while a user types in, like twitter does.
I found this jquery plugin;
jquery max-length plugin
It does just what I need but it seems kind of like overkill, I am not sure the filesize but it looks like a lot of lines of code for such a simple task, do you think I would be better off using a non-jquery method?  The reason I was thinking jquery was the way to go is because jquery is already included into all my pages
UPDATE;
I just found this non-jquery method that does the exact same thing is is way smaller footprint, so would this be the better method?

You have
<input readonly type="text" name="countdown" size="3" value="1000">
characters left.

A: Sometimes you need to have more than one text area and want them addressed individually without having to code for each. This code dynamically adds the chars remaining  to any  having a maxLength attribute...

<textarea id="myTextarea" maxLength="200">Initial text lorem ipsum blah blah blah</textarea>

<textarea id="mySecondTextarea" maxLength="500"></textarea>

<textarea id="textareaWithoutCounter"></textarea>

A: Very simple in jQuery:
<textarea id="myTextarea"></textarea>

Substitute the 200 by whatever your limit is.
Note this does not limit the actual text input, it just counts down. You need to check server-side for the input length, this is just a visual helper.
As an aside, I don't think you even should try to limit the input length by denying any input when the limit is reached. It's a pain in the rear usability-wise and can't be relied upon anyway. A simple countdown and server-side checking is the best option IMHO.

A: I've used Aaron Russell's simply countable jQuery plugin with success
Simple usage:
$('#my_textarea').simplyCountable();

Advanced usage:
$('#my_textarea').simplyCountable({
    counter: '#counter',
    countable: 'characters',
    maxCount: 140,
    strictMax: false,
    countDirection: 'down',
    safeClass: 'safe',
    overClass: 'over',
    thousandSeparator: ','
});

A:

    <title></title>

    <textarea id="TestId" cols="20" rows="8"></textarea>

    (Maximum characters: 100)

A:  var max = 140;
        $("#spn").html(max+"  Remaining");
        $("#textarea").keyup(function () {
            var lenght1 = $("#textarea").val().length;
            var remaining = max - lenght1;
            $("#spn").html(remaining + "  Remaining");
            if (remaining < 0) { $("#spn").css('opacity', '0.4').css('color', 'red'); $("#comment").attr('disabled', 'disabled'); } else { $("#spn").css('opacity', '1').css('color', 'black'); $("#comment").removeAttr('disabled'); }
            if (remaining < 10) { $("#spn").css('color', 'red'); } else { $("#spn").css('color', 'black'); }

        });

A: I used jQuery and the answer by deceze and then tweaked it to give me a twitter-style countdown so that users could see by how much they had gone over and adjust their text accordingly. I also put it into its own function so I could call it from another function that sometimes populated the textarea automatically:
    function reCalcToText() {
        var left = 200 - $('.toText').val().length;
        if (left < 0) {
            $('#counter').text(left);
            $('#counter').addClass("excess");
        } else {
            $('#counter').text(left);
            $('#counter').removeClass();
        }
    }
    function onReady() {
                  $('#<%= toText.ClientID %>').keyup(function() {
            reCalcToText();
        });
    };

A: So I took @deceze version and added a bit of trick to make it:

*

*show always and not only when the user starts typing,

*show minus when the limit is over, and

*add class - to color the text - when it is over the limit (extra css is needed for this of course)
$(document).ready(function(){
    var left = 200
    $('#field_counter').text('Characters left: ' + left);

        $('#id_description').keyup(function () {

        left = 200 - $(this).val().length;

        if(left < 0){
            $('#field_counter').addClass("overlimit");
        }
        if(left >= 0){
            $('#field_counter span').removeClass("overlimit");
        }

        $('#field_counter').text('Characters left: ' + left);
    });
});

For anyone needing the same as me :)

A: Using jQuery, assuming that you have a textarea with id field that you wish to limit to 100 characters, and another element with id chars-remaining to display the number of available characters:
var max = 100;
$('#field').keyup(function() {
    if($(this).val().length > max) {
        $(this).val($(this).val().substr(0, max));
    }
    $('#chars-remaining').html((max - $(this).val().length) + ' characters remaining');
});

A: Keep in mind that you have to account for NewLines being 2 characters.
I built upon the solutions provided here to the below code which accounts for new lines.
function DisplayCharactersLeft(idOfInputControl) {
    var maxNumberOfCharacters = $("#" + idOfInputControl).attr("maxLength");

    $("#" + idOfInputControl).on("input", function () {
        var currentText = $(this).val();
        var numberOfNewLines = GetNumberOfNewLines(currentText);

        var left = maxNumberOfCharacters - (currentText.length + numberOfNewLines);
        if (left < 0) { left = 0; }
        $("#" + idOfInputControl + "CharactersLeftCounter").text("Characters left: " + left);
    });

}

function GetNumberOfNewLines(text) {

    var newLines = text.match(/(\r\n|\n|\r)/g);
    var numberOfNewLines = 0;
    if (newLines != null) {
        numberOfNewLines = newLines.length;
    }
    return numberOfNewLines;
}


text:
Q: Go logging with multiple backend I'm using go-logging and I'm trying to build a logger with a variable number of Backends (i.e. stderr + file + syslog + ...). So my program reads a configuration file, and create the logger according to what's defined.
As SetBackend is a variadic function, I thought I could use a slice as argument, but I was wrong.
Here is an example of my code:
func configureLogger(debug, file bool) {
    var backendList = []logging.Backend{}
    var format = logging.MustStringFormatter(
        `%{color}%{time:15:04:05.000} [%{level:.4s}] %{shortfunc}%{color:reset}: %{message}`,
    )

    if debug {
        consoleBackend := logging.NewLogBackend(os.Stderr, "", 0)
        consoleBackendFormatter := logging.NewBackendFormatter(consoleBackend, format)
        consoleBackendLeveled := logging.AddModuleLevel(consoleBackendFormatter)
        consoleBackendLeveled.SetLevel(logging.DEBUG, "")
        backendList = append(backendList, consoleBackendLeveled)
    }

    if file {
        f, err := os.OpenFile("file.log", os.O_APPEND|os.O_CREATE|os.O_RDWR, 0644)
        filebackend := logging.NewLogBackend(f, "", 0)
        filebackendFormatter := logging.NewBackendFormatter(filebackend, format)
        filebackendLeveled := logging.AddModuleLevel(filebackendFormatter)
        filebackendLeveled.SetLevel(logging.DEBUG, "")
        backendList = append(backendList, filebackendLeveled)
    }

    logging.SetBackend(backendList)
}

This end up with the following error:
cannot use backendList (type []logging.Backend) as type logging.Backend in argument to logging.SetBackend:
    []logging.Backend does not implement logging.Backend (missing Log method)

What am I missing?

A: I was missing the good syntax. When passing a slice to a variadic function, you need to add ... after your slice name, as shown in the specs: https://golang.org/ref/spec#Passing_arguments_to_..._parameters
The right syntax is:
logging.SetBackend(backendList...)


text:
Q: Laravel 5 new routes don't work I'm starting with laravel 5 framework and I have a problem with the routes.
In the last few days, the routes worked correctly, but today I added a new route and it doesn't work anymore.
I have these routes
Route::get('url/create', 'UrlController@create');
Route::get('url/bulk', 'UrlController@bulk_view');
Route::post('url/bulk', ['as' =>'url/bulk', 'uses' => 'UrlController@bulk']);
Route::get('url/bulk_metrics', 'UrlController@bulk_metrics_view');
Route::post('url/bulk_metrics', ['as' =>'url/bulk_metrics', 'uses' => 'UrlController@bulk_metrics']);
Route::post('url/create', ['as' =>'url/create', 'uses' => 'Urlcontroller@store']);
Route::post('url/update/{id}', ['as' =>'url/update', 'uses' => 'Urlcontroller@update']);
Route::get('urls', ['as' =>'url/list', 'uses' => 'Urlcontroller@index']);
Route::get('url/{id}', ['as' =>'url/show', 'uses' => 'Urlcontroller@show']);
Route::post('url/delete/{id}', ['as' =>'url/delete', 'uses' => 'Urlcontroller@destroy']);

All work correctly, but I added this new route
Route::post('urls/filter', ['as' =>'url/filter', 'uses' => 'Urlcontroller@filter']);

and I call it like this
{!! Form::open(array('route' => 'urls/filter', 'method' => 'POST')) !!}

I tried php artisan route:clear, php artisan route:cache and php artisan route:list, and the new route appear in the list:
 POST     | urls/filter          | url/filter       | App\Http\Controllers\Urlcontroller@filter              | web,auth   |

The other routes work correctly and I think that it is a cache problem, because if I change the url/create to url/create2, and I change it in the template to url/create2 it doesn't work.
Thanks in advance to all

A: You should use it as url/filter
{!! Form::open(array('route' => 'url/filter', 'method' => 'POST')) !!}

because you're naming it like this:
'as' =>'url/filter'

Or remove 'as' =>'url/filter' part from route. In this case name of your route will be urls/filter and not url/filter.


text:
Q: Opening webbrowser in Private mode to avoid Caching I have created a flask application which run continuously and because of this, it can potentially overload the browser cache. Since the flask app is just filling out forms and it stays on 24/7, the responses could keep piling up and storing in the cache. I figured that if I run it in private mode then there would be no caching issues at all. I am using webbrowser to open the flask app.
webbrowser.open("http://127.0.0.1:5000/")
app.run(host='0.0.0.0', port=5000)

I also tried the following but it then says 'chrome' is not recognized as an internal or external command, operable program or batch file. Same for 'google-chrome' or 'chrome-stable':
import os
os.system("chrome -incognito http://example.com")

I know you could probably do the following to open in private mode:
import webbrowser
url = 'www.google.com'
chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s --incognito'
webbrowser.get(chrome_path).open_new(url)

However, I have bundled my entire flask application into an exe using pyinstaller and it can be used on any windows computer. But I will not know the chrome_path on that computer so how can I open webbrowser in private mode without knowing the path?
Thanks

A: Private browsing is not your fundamental problem.
You explained what you really care about is browser caching.
Use a Cache-Control: max-age=600 header to limit lifetime to ten minutes.
Or use a HTML META tag to accomplish the same thing.
EDIT
When you said you were concerned about
"potentially overload the browser cache"
it sounded like the amount of material
was slowing down the browser.
You revealed little about your browsing pattern,
including whether it was GET or POST.
If you don't want the browser to remember
filled in form data, use the autocomplete attribute:
<form method="post" action="/myform" autocomplete="off">

To avoid XY syndrome, you may want to ask a new question
that specifies a new set of parameters.


text:
Q: Escaping meta chars in slides apps script not working I want to match 212*235 as plain text in Slides service Text Range. Hence I used
var trs = text.find('212*234');
var trs = text.find(/212*234/);
also tried with
var re = new RegExp("212*234", "gi");
var trs = text.find(re);
but none of them worked.
https://developers.google.com/apps-script/reference/slides/text-range#findpattern
Is this might be a bug or intentional?

A: You want two backslashes before the *, as in:
var s = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];
Logger.log(s.getText().find('212\\*235')[0].asString());


text:
Q: How to get the date from "2019-06-27T12:30:00.000+0000"? I want to get date and time from 2019-06-27T12:30:00.000+0000 in android. I tried a code but it is not working.
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
    Date date = null;//You will get date object relative to server/client
timezone wherever it is parsed
    try {
        date = dateFormat.parse("2019-06-27T12:30:00.000+0000");
    } catch (ParseException e) {
        e.printStackTrace();
    }
    DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); //If you need time just put specific format for time like 'HH:mm:ss'
    String dateStr = formatter.format(date);

A: You're missing the millisecond portion of your SimpleDateFormat, below is what you need for that specific pattern:
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");

A: You're missing out on parts of the Date
The pattern you need is,
DateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'+'ssss");


text:
Q: VBA get a value in brackets from a cell and check if it is available in other sheet I am trying to get a specific cell value in brackets and check if this value is in other sheet. This is the column with the possible values:
StrS Format
HEADER
NOBREAK
IGNORE
REPEATABLE …-n can be up to 100
I want to split the string in the cell, check if its value is one of the above, if it  is equal with "REPEATABLE" extract the following block specifications: .  If  is not defined in "BY Variables" show error. This is a similar issue with this one:
VBA-Count and collect every found match in regular expression -again have to get values with brackets
Here is my code:
Public Function IsItGood(aWord As Variant) As Boolean
    Dim s As String

    s = "|"                                      '-means or
    'tmp = s & aWord & s
    tmp = Replace(s & aWord & s, ",", "")
    patern = ""
    patern = patern & "HEADER|NOBREAK|REPEATABLE" & s

    If InStr(1, patern, tmp) > 0 Then
        IsItGood = True
    Else
        IsItGood = False
    End If
End Function

Function check_cell_values()

    On Error Resume Next

    Application.EnableEvents = False
    Dim msg As String
    msg = ""

    Dim arr As Variant
    Dim a As Variant

    arr = Split(Target, " ")

    For Each a In arr
        If Target.Column = 10 And (Target.Row > 2 And Target.Row <= 308) Then

            If IsItGood(a) Then
                msg = msg & vbCrLf & (" In cell" + Target.Address(0, 0)) & vbCrLf & a & vbCrLf + "is ok"
            Else
                msg = msg & vbCrLf & (" In cell" + Target.Address(0, 0)) & vbCrLf & a & vbCrLf + "is invalid value"
                Application.Undo
            End If
        End If
    Next a

    If msg <> "" Then MsgBox msg
    check_cell_values = msg

End Function

Sub by_blocks_check()

    Application.EnableEvents = False

    Dim func1

    func1 = check_cell_values()

End Sub

I think instead of a regular expression it is better to use an array from the possible values but I don`t know how to get the  value after "Repeatable".
Example output:


text:
Q: KornShell Regular Expression How can I match part of a string using a regular expression in ksh scripts?
I have a string coming into my script which could be something like this:
/data/inform/far_proj/scripts/../SrcFiles/load_alfa_data.dat
I have searched for a bit on how to do a regular expression in KornShell, but I haven't been successful. What I have is this: I am looking to see if the string contains load_alfa_data
if [[ $FILENAME = @("load_alfa_data") ]]; then
   ...
fi

Thank you for your help

A: In ksh you can do case:
case "$FILENAME" in
  *load_alfa_data*) echo "found load_alfa_data" ;;
  *)                echo "nope" ;;
esac

A: The == operator in the builtin [[ command is a pattern match operator
if [[ $FILENAME == *load_alfa_data* ]]; then ...

Your pattern @("load_alfa_data") does not contain any wildcards, so it's basically doing exact string matching.
Get out of the habit of using ALL_CAPS_VARS: one day you'll write PATH=/tmp/foo and then wonder why your script is broken.


text:
Q: Ethernet controllers not working (Realtek RTL810xE, Realtek RTL8111) EDIT: I've found an appropriate driver
https://github.com/ghostrider-reborn/realtek-r8101-linux-driver
I followed instructions here and now both network cards work (I only use one at a time because I'm testing connecting them to the same network.)
Original post
I installed Kubuntu 18.04 on a computer which has previously been running Kubuntu 14.04, and I've not been able to get one of the two network cards working successfully. Unfortunately, I need both of them to be configured for my lab setup.
I've tried plugging either of them with the same ethernet cable, but only the RTL8111 ever works. dmesg doesn't have anything for Ethernet or Network in it, and journalctl -xe only mentions the successful loading of the RTL8111 driver.
Below are some diagnostic outputs that you will hopefully find useful
lshw -C network
  *-network UNCLAIMED
       description: Ethernet controller
       product: RTL810xE PCI Express Fast Ethernet controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:02:00.0
       version: 02
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list
       configuration: latency=0
       resources: ioport:b800(size=256) memory:f7cff000-f7cfffff memory:cfff0000-cfffffff
  *-network
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:01:00.0
       logical name: enp1s0
       version: 03
       serial: [redacted]
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list rom ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8168 driverversion=8.046.00-NAPI duplex=full latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:31 ioport:a800(size=256) memory:cfeff000-cfefffff memory:cfef8000-cfefbfff memory:f7be0000-f7bfffff
  *-network
       description: Ethernet interface
       physical id: 1
       logical name: enp0s26f7u1
       serial: [redacted]
       capabilities: ethernet physical
       configuration: broadcast=yes driver=rndis_host driverversion=22-Aug-2005 firmware=RNDIS device ip=192.168.42.163 link=yes multicast=yes

Kubuntu can see the network cards (the third device is my phone using USB tethering), however the first one is "UNCLAIMED"
lspci -v | grep -A20 Ethernet
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 03)
        Subsystem: ASRock Incorporation Motherboard (one of many)
        Physical Slot: 0-3
        Flags: bus master, fast devsel, latency 0, IRQ 31
        I/O ports at a800 [size=256]
        Memory at cfeff000 (64-bit, prefetchable) [size=4K]
        Memory at cfef8000 (64-bit, prefetchable) [size=16K]
        Expansion ROM at f7be0000 [disabled] [size=128K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [ac] MSI-X: Enable- Count=4 Masked-
        Capabilities: [cc] Vital Product Data
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Virtual Channel
        Capabilities: [160] Device Serial Number [redacted]
        Kernel driver in use: r8168
        Kernel modules: r8168

02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL810xE PCI Express Fast Ethernet controller (rev 02)
        Subsystem: Realtek Semiconductor Co., Ltd. RTL810xE PCI Express Fast Ethernet controller
        Physical Slot: 0-2
        Flags: bus master, fast devsel, latency 0, IRQ 11
        I/O ports at b800 [size=256]
        Memory at f7cff000 (64-bit, non-prefetchable) [size=4K]
        Memory at cfff0000 (64-bit, prefetchable) [size=64K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [ac] MSI-X: Enable- Count=2 Masked-
        Capabilities: [cc] Vital Product Data
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Virtual Channel
        Capabilities: [160] Device Serial Number [redacted]

It has loaded the kernel module for the first card, however it hasn't done anything for the second card.
lsmod
Module                  Size  Used by
intel_powerclamp       20480  0
snd_hda_codec_realtek   114688  1
coretemp               20480  0
snd_hda_codec_generic    77824  1 snd_hda_codec_realtek
kvm_intel             241664  0
ledtrig_audio          16384  2 snd_hda_codec_generic,snd_hda_codec_realtek
kvm                   647168  1 kvm_intel
snd_hda_intel          49152  5
irqbypass              16384  1 kvm
snd_hda_codec         135168  3 snd_hda_codec_generic,snd_hda_intel,snd_hda_codec_realtek
snd_hda_core           86016  4 snd_hda_codec_generic,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek
rndis_host             20480  0
snd_hwdep              20480  1 snd_hda_codec
ni_pcimio              73728  0
cdc_ether              20480  1 rndis_host
ni_tiocmd              16384  1 ni_pcimio
mite                   20480  2 ni_tiocmd,ni_pcimio
snd_pcm               102400  4 snd_hda_intel,snd_hda_codec,snd_hda_core
usbnet                 45056  2 rndis_host,cdc_ether
comedi_pci             16384  2 mite,ni_pcimio
intel_cstate           20480  0
mii                    16384  1 usbnet
ni_routing            299008  2 ni_tiocmd,ni_pcimio
input_leds             16384  0
ni_tio                 20480  2 ni_tiocmd,ni_pcimio
comedi_8255            16384  1 ni_pcimio
snd_seq_midi           20480  0
snd_seq_midi_event     16384  1 snd_seq_midi
comedi                 73728  5 mite,comedi_pci,ni_tiocmd,ni_pcimio,comedi_8255
snd_rawmidi            36864  1 snd_seq_midi
snd_seq                69632  2 snd_seq_midi,snd_seq_midi_event
gpio_ich               16384  0
snd_seq_device         16384  3 snd_seq,snd_seq_midi,snd_rawmidi
snd_timer              36864  2 snd_seq,snd_pcm
snd                    86016  19 snd_hda_codec_generic,snd_seq,snd_seq_device,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_pcm,snd_rawmidi
serio_raw              20480  0
soundcore              16384  1 snd
i5500_temp             16384  0
lpc_ich                24576  0
i7core_edac            24576  0
mac_hid                16384  0
sch_fq_codel           20480  3
parport_pc             36864  0
ppdev                  24576  0
lp                     20480  0
parport                53248  3 parport_pc,lp,ppdev
ip_tables              32768  0
x_tables               40960  1 ip_tables
autofs4                45056  2
nouveau              1871872  20
hid_generic            16384  0
video                  49152  1 nouveau
i2c_algo_bit           16384  1 nouveau
ttm                   102400  1 nouveau
mxm_wmi                16384  1 nouveau
drm_kms_helper        180224  1 nouveau
syscopyarea            16384  1 drm_kms_helper
sysfillrect            16384  1 drm_kms_helper
psmouse               151552  0
sysimgblt              16384  1 drm_kms_helper
usbhid                 53248  0
fb_sys_fops            16384  1 drm_kms_helper
hid                   126976  2 usbhid,hid_generic
drm                   483328  10 drm_kms_helper,ttm,nouveau
firewire_ohci          40960  0
pata_acpi              16384  0
ahci                   40960  0
firewire_core          65536  1 firewire_ohci
r8168                 528384  0
pata_via               16384  0
libahci                32768  1 ahci
crc_itu_t              16384  1 firewire_core
wmi                    28672  2 mxm_wmi,nouveau

5th line from the end is the driver for the RTL8111 card, and I don't know if this is actually useful for you at all.
lspci -nn

01:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 03)

02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL810xE PCI Express Fast Ethernet Controller [10ec:8136] (rev 02)

A: lspci -nn
01:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 03)

02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL810xE PCI Express Fast Ethernet Controller [10ec:8136] (rev 02)

modinfo r8169 | grep 8136 # the r8169 driver will see the RTL810xE
alias:          pci:v000010ECd00008136sv*sd*bc*sc*i*

The system is not seeing the RTL810xE ethernet card. This is because you have the r8168-dkms driver installed, which works fine for the RTL8111/8168/8411 ethernet card, but not the RTL810xE.
Recommend uninstalling the r8101 github driver, and the r8168-dkms driver, and letting the standard r8169 driver find both cards.
This would also make software updates faster if kernel updates are included, as it won't have to additionally rebuild dkms drivers.


text:
Q: How to prevent uitextfield from expanding it's width but allow its height with text? Alright, so Ive created a uitextfield programmatically here -
ideaTextField.frame = CGRectMake(0, 0, screenSize.width * (0.72), screenSize.height * (120/568)) //limit on characters
        ideaTextField.text = "Give us an idea"
        ideaTextField.center = CGPointMake(screenSize.width * 0.5, screenSize.height * 1.1)
        ideaTextField.font = UIFont(name: "Roboto", size: screenSize.height * (16/568))
        ideaTextField.textAlignment = .Center
        ideaTextField.textColor = colorWithHexString(chosenColor)

        ideaTextField.delegate = self
        ideaTextField.addTarget(self, action: "startedEntering2:", forControlEvents: UIControlEvents.TouchDown)
        view.addSubview(ideaTextField)

and as you can see I've explicitly set the width/frame and tried but cant like a label set the number of lines to 0/infinity. My problem is that when I start entering text beyond the width of the field the field just keeps expanding horizontally :

Im setting a word count limit but if anything, I need the field to ONLY expand vertically. How can I do this?

A: Using constraints would likely solve this problem. If you were to adjust the horizontal hugging and stretching values by, say 1, then I believe that it should do the trick. If you need a refresher on how to make constraints programmatically I have attached a link:
https://developer.apple.com/library/prerelease/content/documentation/UserExperience/Conceptual/AutolayoutPG/ProgrammaticallyCreatingConstraints.html
Cheers!


text:
Q: Need help on sending and receiving data through Android to MySql I am very new to android. In this program, I'm trying to make it so that when one types a first name in the edit text it will show the information of the person in an existing MySQL database I made already. Can you tell me how to improve this and also I can't figure out how to get rid of the red highlight(has error "'is' cannot be resolved") on "is" at line
Updated* this is how my code looks like. The "cannot be resolved" problem is gone.
public class PS extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        final EditText et_Text = (EditText) findViewById(R.id.et_Text);

        //add new KeyListener Callback (to record key input)
        et_Text.setOnKeyListener(new OnKeyListener() {
            //function to invoke when a key is pressed

            public boolean onKey(View v, int keyCode, KeyEvent event) {
                //check if there is
                if (event.getAction() == KeyEvent.ACTION_DOWN) {
                    //check if the right key was pressed
                    if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {

                        InputStream is = null;
                        String result = "";

                        //the name data to send
                        ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
                        nameValuePairs.add(new BasicNameValuePair("name", et_Text.getText().toString()));

                        //http post
                        if (is != null) {
                            try {

                                HttpClient httpclient = new DefaultHttpClient();
                                HttpPost httppost = new HttpPost("http://******/sampleDB/testSend.php");
                                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                                HttpResponse response = httpclient.execute(httppost);
                                HttpEntity entity = response.getEntity();
                                is = entity.getContent();
                            } catch (Exception e) {
                                Log.e("log_tag", "Error in http connection " + e.toString());
                            }
                            //convert response to string
                            try {
                                BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);
                                StringBuilder sb = new StringBuilder();
                                String line = null;
                                while ((line = reader.readLine()) != null) {
                                    sb.append(line + "\n");
                                }

                                is.close();

                                result = sb.toString();
                            } catch (Exception e) {
                                Log.e("log_tag", "Error converting result " + e.toString());
                            }

                            //parse json data
                            try {
                                JSONArray jArray = new JSONArray(result);
                                for (int i = 0; i < jArray.length(); i++) {
                                    JSONObject json_data = jArray.getJSONObject(i);
                                    Log.i("log_tag", "PersonID: " + json_data.getInt("PersonID")
                                            + ", FirstName: " + json_data.getString("FirstName")
                                            + ", LastName: " + json_data.getString("LastName")
                                            + ", Age: " + json_data.getInt("Age"));

                                }

                            } catch (JSONException e) {
                                Log.e("log_tag", "Error parsing data " + e.toString());
                            }
                            ;
                        }
                        et_Text.setText("");
                        //and clear the EditText control

                    }
                    return true;
                }

                return false;
            }
        });
    }
}

I don't have the else statement yet but then the code under the "if" is said to be a dead code... Should I use the if statement inside the try statments that have "is" in them?

A: The problem is that  is was declared inside the first try block, which limits its visibility to that block.  Try this
 // move is declaration before the try-catch
 InputStream is = null;
 try{
     ....
     // just use it here
     is = entity.getContent();
 }catch(Exception e){
     Log.e("log_tag", "Error in http connection "+e.toString());
 }
 // it will still be available here.

This will work because is will be declared outside of the try-except block.  Don't forget to add some error checking, at least an if (is != null) around where you use is
EDIT - Eror checking, what I mean: avoid that errors get to the user unhandled, it's untidy, confusing and the bottom line will be that they buy your competition.  Whereever it can go wrong you should do something to shield the user, like this
if (is != null) {
   // wrapped in if because this code assumes is exists
   BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
   StringBuilder sb = new StringBuilder();
   String line = null;
   while ((line = reader.readLine()) != null) {
       sb.append(line + "\n");
   }
   is.close();
} else {
   // do whatever you have to do to signal to the user that something went wrong.
}

EDIT2: your (is != null) check was at a very odd place.  Moved it to a better spot, suggested in my original answer, see below.
And a last suggestion: no idea what editor you use, but indentation was a horrible mess, code is hard to read without reasonable indentation.
public class PS extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        final EditText et_Text = (EditText) findViewById(R.id.et_Text);

        //add new KeyListener Callback (to record key input)
        et_Text.setOnKeyListener(new OnKeyListener() {
            //function to invoke when a key is pressed

            public boolean onKey(View v, int keyCode, KeyEvent event) {
                //check if there is
                if (event.getAction() == KeyEvent.ACTION_DOWN) {
                    //check if the right key was pressed
                    if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {

                        InputStream is = null;
                        String result = "";

                        //the name data to send
                        ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
                        nameValuePairs.add(new BasicNameValuePair("name", et_Text.getText().toString()));

                        //http post

                        try {

                            HttpClient httpclient = new DefaultHttpClient();
                            HttpPost httppost = new HttpPost("http://******/sampleDB/testSend.php");
                            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                            HttpResponse response = httpclient.execute(httppost);
                            HttpEntity entity = response.getEntity();
                            is = entity.getContent();
                        } catch (Exception e) {
                            Log.e("log_tag", "Error in http connection " + e.toString());
                        }

                        // At this point is should be set, if it isn't, tell user what went wrong
                        if (is != null) {
                            //convert response to string
                            try {
                                BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);
                                StringBuilder sb = new StringBuilder();
                                String line = null;
                                while ((line = reader.readLine()) != null) {
                                    sb.append(line + "\n");
                                }

                                is.close();

                                result = sb.toString();
                            } catch (Exception e) {
                                Log.e("log_tag", "Error converting result " + e.toString());
                            }

                            //parse json data
                            try {
                                JSONArray jArray = new JSONArray(result);
                                for (int i = 0; i < jArray.length(); i++) {
                                    JSONObject json_data = jArray.getJSONObject(i);
                                    Log.i("log_tag", "PersonID: " + json_data.getInt("PersonID")
                                            + ", FirstName: " + json_data.getString("FirstName")
                                            + ", LastName: " + json_data.getString("LastName")
                                            + ", Age: " + json_data.getInt("Age"));

                                }

                            } catch (JSONException e) {
                                Log.e("log_tag", "Error parsing data " + e.toString());
                            }

                            et_Text.setText("");
                            //and clear the EditText control
                        } else {
                            // Hey user, this went horribly wrong

                        }
                    }
                    return true;
                }

                return false;
            }
        });
    }
}


text:
Q: API exposed to find the device is capable to make call Is any API is exposed to get know the device is capable for making call via network carrier. I was looking this in WinRT Universal(8.1). So that i will work in Tab, Surface and also in WindowsPhone.

A: This api is not available in Universal apps and is only available in Windows Phone.
the api is called PhoneCallManager:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.calls.phonecallmanager.aspx
Universal apps are not 100% truly universal especially if you want to acces phone or tablet specific things like the dialer in Windows Phone or printers in Windows 8. these things are not universal yet so you have to check this in your own code.
Here some example on how to check if your code is being executed by a phone or tablet/pc:
#if WINDOWS_APP
            //Do Windows 8.1 tablet/pc stuff
#endif
#if WINDOWS_PHONE_APP
            //do Phone specific stuff
#endif

source:
https://msdn.microsoft.com/en-us/library/windows/apps/dn609832.aspx#PlatformContext


text:
Q: How do I open the hyperlink with Chrome browser in node js application? I made the file named index.html in node js application but when I click the link it opens via new node js console.
Please refer to this image

How do I open the hyperlink with Chrome browser?

GOOGLE