text:
Q: Bind viewmodel to ui after ajax call succeeds Knockout I have a selectall toggle checkbox and checkbox in each row of data .
Now the data which is returned from the server doesnt have isSelected Observable. I have added 'isSelected' observable for each row . But the isSelected observable doesnt get bound to  the checkboxes in each row .
Here is the viewmodel :
var folderViewModel = function () {
    var self = this;
    self.Folders = ['Inbox', 'Archive', 'Sent', 'Spam'];
    self.SelectedFolder = ko.observable();
    self.Mails = ko.observableArray([]);
    self.SelectedMail = ko.observable();
    self.SelectAll = ko.observable(false);

    self.navigate = function (folder) {
        self.SelectedFolder(folder);
        //$.get('/Api/MailBox', { folder: folder }, self.Mails);

        $.ajax({
            url: "/Api/Mailbox",
            data: { folder: folder },
            success: function (data) {
                ko.mapping.fromJS(data, {}, self.Mails);
                ko.utils.arrayForEach(self.Mails(), function (mail) {
                    mail.isSelected = ko.observable(true);
                    mail.isSelected.subscribe(function (myvalue) {
                        console.log(myvalue);
                    });
                });
                console.log(ko.toJSON(self.Mails()));
            },
            statusCode: {
                404: function () {
                    alert("No Mail");
                }
            }
        });

        //ko.mapping.fromJS(data, {}, self.Mails);
        //console.log(ko.toJSON(self.Mails));
    };

    self.SelectAll.subscribe(function (newValue) {
        ko.utils.arrayForEach(self.Mails(), function (mail) {
            console.log(mail.isSelected());
            mail.isSelected(newValue);

        });
        console.log(newValue);
    }, self);

    this.navigate("Inbox");
};
ko.applyBindings(new folderViewModel());

And here is the binding .

            <input type="checkbox" data-bind="checked: SelectAll"/>
            @*<input type="checkbox" />*@

            From

            To

            Subject

            Date

            <input type="checkbox" data-bind="checked: $root.isSelected">
            @*<input type="checkbox">*@

The checkbox  <input type="checkbox" data-bind="checked: $root.isSelected"> is not getting bound to the ajax data in mails.isSelected=ko.obsevable(true). What might be the problem ?

A: First, kuddos for using the learn.knockoutjs.com example, amazing resource.
Your error is a common pitfall in KnockoutJS: you are modifying your model without updating the observables that are binded to it. See the following lines -
ko.mapping.fromJS(data, {}, self.Mails);
ko.utils.arrayForEach(self.Mails(), function (mail) { ... });

If you see, you are first creating your model for the mails and THEN adding up an extra observable. To which context this observable should be attached to? Without updating the values of each mail, your mail.isSelected is never added to the mail object.
There are two ways to solve this. The first one, you update the mail model in the forEach array:
ko.utils.arrayForEach(self.Mails(), function (mail, index) {
    // Add up the isSelected observable
    self.Mails()[index] = mail;
});

This has a performance gotcha on observable arrays that you can read here. Basically, you want to create a temp array and update the entire observable array than call the Mails() each time.
The other way is quite simple: swap the order of how are you creating the mail model:
ko.utils.arrayForEach(self.Mails(), function (mail) { ... });
ko.mapping.fromJS(data, {}, self.Mails);

FIRST, you are attaching to a data object your observable and THEN you are telling to your viewmodel "Hey! We got a new model to save it has this properties from data PLUS an observable isSelected I just added, care to bind it up?"
That being said, the property in the HTML is checked: isSelected and not checked: $root.isSelected, which was the reason why it was sort of working on the SelectAll (sort of), as the isSelected was being binded to your ViewModel instead of your mail model. You could had figure it out debugging with this handy statement:
// In any row inside your data
DEBUG DATA

That should be it, you can see your code working here as well as all its solution: http://jsfiddle.net/jjperezaguinaga/VTuHA/. I added some sample data to play around (with the /echo/json/ feature from JsFiddle) and removed some stuff, as well as an extra column that I used to debug with the last code I put. In this last column you can see the value isSelected being updated every time you click on a checked box.

A: Isn't isSelected added on each mail item, not in the root view model?. If so your binding should just be:
<input type="checkbox" data-bind="checked: isSelected">

NOTE: I also don't see a navigateToMail method available in the root view model, which will also cause problems.


text:
Q: I get a "Expected name at XX:YY" error on .json files in Eclipse. What is wrong? I have this code in it now...with the entra line after the closing }...
Here is a larger screenshot of it now!
{
  "menu" : {
    "id": "file",
    "value": "File",
    "popup": {
      "menuitem": [
        { "value" : "New", "onclick": "CreateNewDoc()" },
        { "value" : "Open", "onclick": "OpenDoc()" },
        { "value" : "Close", "onclick": "CloseDoc()" }
      ]
    }
  }
}

A: You haven't closed the } at the end of the json. The correct json would be as follows.
{
  "menu" : {
    "id": "file",
    "value": "File",
    "popup": {
      "menuitem": [
        { "value" : "New", "onclick": "CreateNewDoc()" },
        { "value" : "Open", "onclick": "OpenDoc()" },
        { "value" : "Close", "onclick": "CloseDoc()" }
      ]
    }
  }
}

A: It happened the same thing on my Eclipse Photon, and looking at some of the examples here and assistance, I tried to edit the file and save it. Errors still the same.
I did a simple trick which actually does suffice.
Using the auto format from Eclipse, Ctrl + Shift + F, then save and then undo (Ctrl + Z), the error miraculously disappeared.
Still ain't sure why the scenario is like this though.

A: Save the file in the eclipse, the error should be gone.

A: I came across the same error in STS 3.9.4 which is built on top of Eclipse Oxygen. This is thrown by the Json Validator used by Eclipse editor implementation due to the presence of the embedded comments within the Json file. Though, at runtime, this is ignored by the Jackson marshaller implementation used by the Spring Boot. Only that, Eclipse's JSON validator seems to be strict about the comments.
So, I configured the editor preferences to exclude the file from doing JSON validation as suggested at here - https://stackoverflow.com/a/41704569/5107365.

A: I had the same problem. And thanks to the tips of using Ctrl+Shift+F to see the formatting of brackets ("{" and "["). I realized there are "extra" single side brackets (like open without closing) in the Ctrl+Shift+F mode. But when I undo it using Ctrl+Z, the extra brackets were gone. It seems like some escape-sequence control codes are in the file. And it being removed when using the above trick.
It is resolved now.

A: The answer provided by danielctw here worked for me for the first time but not again. I believe the error might be due to hidden characters.
I solved this by copying the contents of the json file and pasting it into notepad(in windows) and then copying it from there and pasting it into the json file and the errors were gone.
I somewhere read about how some hidden characters are removed in a notepad file but I am not sure and if someone knows, please mention so that me and others can learn.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Blocking a item with jquery but losing the value after refresh the page I'm blocking a select list with a dynamic action(after refresh with a jquery command ('#P987_X').attr("disable", true);) after adding a value to a table so i have a button with a submit action that after submitting it goes to the same page only has the report actualized with that new value.
My problem is that when it loads the page after the submit it blocks the select list but loses the value i have selected and i'm doing the branching with "save state before branching"
And if i don't block the item it does everything right and does't lose the value.

A: This is a feature of HTML forms, not Apex-specific: the value of a disabled item is not submitted when the form is submitted.  A work-around is to copy the value of the item into another hidden item when disabling it, and then when the page is submitted copy the hidden item's value into the disabled item.
I have created a demo of the solution here on apex.oracle.com.  It works as follows:
Items

*

*P19_SELECT is the select list.  Its source value is set to &P19_SAVE., with source used "only when current value in session state is null"

*P19_NUM controls whether the select list is enabled or disabled: P19_SELECT is enabled when P19_NUM = 0, else disabled.  Default value is 0.

*P19_SAVE is used to save the value of P19_SELECT.  It could be a hidden item, I have made it visible for demo purposes.

Processes
When Submit button is pressed, the following PL/SQL page submit process runs:
:p19_num := :p19_num+1;
:p19_save := nvl(:p19_select,:p19_save);

The first statement increments the counter to make P19_SELECT disabled, the second saves the current value of P19_SELECT into P19_SAVE.
Dynamic Action
There is a single dynamic action defined as follows:

*

*When Event: page load

*When Condition none

*Condition Type: Value of Item/Column in Expression 1 != Expression 2

*Expression 1: P19_NUM

*Expression 2: 0

*True Action:

*

*Action: Disable

*Select Type: Item

*Item: P19_SELECT

*Fire on page load: checked

*False Action: (none)

The Reset button clears the cache so P19_NUM goes back to 0.


text:
Q: node_modules/react-native-vector-icons/lib/create-icon-set.js: # could not be cloned I'm using "react-native-vector-icons": "^8.1.0", and I got this error node_modules/react-native-vector-icons/lib/create-icon-set.js: #<WeakSet> could not be cloned. with iOS, any idea?
Thanks!

A: I have tried with different versions sets and found working versions.
...
"react-native": "0.63.0",
"react-native-vector-icons": "^6.6.0",
...

Hope this works fine.

A: As far as I know, that is related to the babel.
By default, we are using
"@babel/core": "7.14.0",
"@babel/runtime": "7.14.0",

these versions. But we need to downgrade to
"@babel/core": "7.12.17",
"@babel/runtime": "7.12.18",

versions.
Downgrading to these versions will solve the problem.


text:
Q: Create a 3 level dictionary from a list of strings with multiple uniqe values for each key I have a list of text strings from which I need to build a tree and as I understand the proper data structure to achieve this is a dictionary.
The size of each string is fix and the format of all elements is the same so no additional checks are necessary.
Each record of the list is a date in the format DD/MM/YYYY and the year / years should be on the root of the tree (the keys, no duplicates here), per each year may be multiple months (no duplicate months within same year) as value and per each month multiple days(no duplicate days within same month).
An example of the list of strings:

data = ['04/02/2018', '05/02/2018', '06/02/2018', '01/03/2018',
  '10/03/2018', '08/09/2017', '09/09/2017', '11/10/2017',
          '11/12/2017', '14/06/2018', '15/06/2018', '24/07/2018', '26/07/2018', '30/08/2018', '31/08/2018', '01/09/2018']

Beside a solution, if any could provide I would like also an explanation in order to understand.
This is what I wrote so far which is clearly wrong as the result is a dictionary with only last 2 items.
d = {}
for item in data:
    rec = item.split('/')
    d.update({rec[2]:{rec[1]:(rec[0])}})

The desired output for that data looks like this:
{'2017': {'09': ['08', '09'], '10': ['11'], '12': ['11']},
 '2018': {'02': ['04', '05', '06'],
          '03': ['01', '10'],
          '06': ['14', '15'],
          '07': ['24', '26'],
          '08': ['30', '31'],
          '09': ['01']}}

A: There are various way to achieve this. You could use a defaultdict from the collections module. But it can also be done use the plain dict.setdefault method.

setdefault(key[, default])
If key is in the dictionary, return its value. If not, insert key with a value of default and return default. default defaults to None.

We loop over the data, splitting it into day, month, and year strings. Then we look in the base tree for the year key, and if it doesn't exist we create a new empty dict for it. Then we look in that year dict for a month key, creating a new list for it if it doesn't exist. Finally we append the day string to the month list.
from pprint import pprint

data = [
    '04/02/2018', '05/02/2018', '06/02/2018', '01/03/2018', '10/03/2018', '08/09/2017', '09/09/2017',
    '11/10/2017', '11/12/2017', '14/06/2018', '15/06/2018', '24/07/2018', '26/07/2018', '30/08/2018',
    '31/08/2018', '01/09/2018'
]

tree = {}

for s in data:
    day, mon, year = s.split('/')
    ydict = tree.setdefault(year, {})
    mlist = ydict.setdefault(mon, [])
    mlist.append(day)

pprint(tree)

output
{'2017': {'09': ['08', '09'], '10': ['11'], '12': ['11']},
 '2018': {'02': ['04', '05', '06'],
          '03': ['01', '10'],
          '06': ['14', '15'],
          '07': ['24', '26'],
          '08': ['30', '31'],
          '09': ['01']}}

We can combine the 3 steps of the main loop into one line, but it's a bit harder to read:
for s in data:
    day, mon, year = s.split('/')
    tree.setdefault(year, {}).setdefault(mon, []).append(day)

A: You don't need a tree. You can use a dict of dicts, having lists as innermost values.
You can use a defaultdict as your main structure
result = defaultdict(defaultdict(list))

for date in data:
    day, month, year = date.split('/')
    result[year][month].append(day)

What a defaultdict does is that

*

*for the inner dict: you can append directly. If there is not a list, a new empty one is created.

*for the outer dict: similarly, you can refer to the key month assuming there is already a dict as its value. If there is not, a new one is created.


text:
Q: Making TeX PDFs compatible with Word 2016 importing I'm changing the focus of this question after experimenting a little further, I've left the original question in the quote at the bottom.
As the original question points out, newer versions of Word (I think from 2013 onward) support the importing of PDFs into editable form (though obviously with not 100% faithful reproduction).
However, Word doesn't seem to play nicely with PDFs I create with Tex, and it would be handy if they did so that my supervisor can proofread the doc.
My question therefore is what the differences are or what needs to be done to a TeX PDF in order for Word to be able to open it? Or is it impossible for some other reason?
As per the previous comments, I tried LuaLatex and XeLaTeX, but the same issues persist (see screen shots). I then thought that it might be due to the fact that on OSX, TeXShop's default encoding is Latin, but after shifting everything to UTF-8, there is still no difference - the result of file -I doc.tex states that the document is ASCII, which from my research is already a subset of UTF8.
The only other curiosity I've noticed, is that if I try to get Word to open the document, treating it as ASCII, it unchecks the box automatically, and doesn't render a preview, whereas I can select any other encoding just fine (though the preview is obviously gibberish).
There must be some subtlety here which I'm missing since PDF2DOCx.com is able to do a surprisingly faithful reconstruction of the whole TeX document that can be opened in Word.
Import process for Word
(using a PDF typeset under Unicode UTF-8 (Ascii) and exported with XeLaTeX)

I realise this has been asked a million times, but I'm going round in
  circles at the moment, and a good number of the threads are old so I'm
  wondering if there is some more up to date information around with
  regards to converting Tex files (typeset, not raw) or better yet, PDFs
  in to Word 2013 or greater .docx formats?
Specifically, I'm looking for commandline tools so that I can include
  it in a workflow?
So far I've tried with Pandoc, but there are issues with UTF-8
  formatting that I can't unpick, and you cant convert from PDF.
Word is capable of opening PDFs natively these days, and does a good
  job of it usually, but it doesn't seem to be able to read my LaTeX
  PDFs at all (if anyone has thoughts on this point too I'd be glad to
  hear them).
Despite the document being very large and complex, I've had some
  excellent results with online converters, but I'd really not like to
  have to use them each time if possible - thought this tells me it must
  be doable if only they were available on the commandline.
Has anyone come across and tools more recently perhaps that would fit
  the bill?


text:
Q: Why can't I echo into a regex-matched output file I have a file that looks like this:
filename.txt
first line
prefix=C:\Users\me\tmp\out_file.txt
second line
python args

What I'm trying to do is run the python script and then echo the output into the file C:\Users\me\tmp\out_file.txt. Running the script is very easy, but echoing the output is proving difficult. filename.txt is in C:\Users\me\tmp, so I open a powershell terminal there and execute the following:
Get-ChildItem | Get-Content -Raw | Select-String -Pattern "(?smi)(?:prefix=([^\n]*?))$.*?(python .*?)$" | %{echo "hello" > $_.Matches.Groups[1].Value}

What this is doing is matching the python script and the output file (note that in general I will be executing this script for every file, hence the pipes). But this results in the error:
Out-File: The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\me\tmp\out_file.txt'

Now, If I copy and paste that exact filename:
echo "hello" > 'C:\Users\me\tmp\out_file.txt'

The result works perfectly (it also works without the quotes). So my question is, why does this fail in the ForEach-Object loop?
In the end, I will call
ForEach-Object -Parallel {Invoke-Expression $_.Matches.Groups[2].Value > $_.Matches.Groups[1].Value}

Which (hopefully) will pipe the output into the output file, but if there is a better way of achieving this that would be helpful as well.

A: The issue is that you are capturing the CR (Carriage Return) character at the end of the line. If you look at $_.Matches.Groups[1] you'll see:
Success  : True
Name     : 1
Captures : {1}
Index    : 19
Length   : 29
Value    : C:\Users\me\tmp\out_file.txt

Note the length of 29, but the file path is only 28 characters. If you do:
Get-ChildItem | Get-Content -Raw | Select-String -Pattern "(?smi)(?:prefix=([^\n]*?))$.*?(python .*?)$" | %{$_.Matches.Groups[1].Value.ToCharArray()|%{">$_<"}}

You should see that the last few entries appear as:
>e<
>.<
>t<
>x<
>t<
><

Indicating that there's an invisible character there. You can fix that by altering your regex just a little:
"(?smi)(?:prefix=(.*?))[\r\n]+.*?(python .*?)$"


text:
Q: Any examples of stochastic processes with continuous random variables and discrete time? What are the examples of stochastic processes with continuous random variables and discrete time? Also, is Brownian motion defined on $t = [0,\infty[$?

A: Three types of examples among many possibilities:
(1) Random walks (on the line, plane, etc.) with a uniformly distributed displacement left or right at each discrete step in time. The location at a given step is a continuous random variable.
(2) Many Gibbs samplers are discrete-time ergodic Markov chains with continuous values generated at each step. The chain is contrived so that the limiting distribution of the chain is the posterior distribution of a Bayesian model. By simulating the chain and looking at many simulated values near the end of a run, one can approximate the unknown posterior distribution. (One simple example here.)
(3) Metropolis-Hastings approximations usually involve random walks in multi-dimensional spaces. At each step a random displacement in the space is made and a candidate value (often continuous) is generated, the candidate value
can be accepted or rejected according to some criterion. If rejected, the old value is replicated and a new displacement is tried. The result is
a simulated sample from a multivariate distribution. (Wikipedia discussion.)


text:
Q: Почему пишут const когда можно написать let? Я иногда вижу, что пишут const (значение этой переменной я знаю), хотя можно просто написать let. Это что, просто особенность "подчерка"?
Вот пример:
const prev = document.querySelector(".btn_prev");
const next = document.querySelector(".btn_next");

let prev = document.querySelector(".btn_prev");
let next = document.querySelector(".btn_next");

Ну зачем кнопки брать в const?
Что const не изменяемая, это я знаю.

A: 1) Добавляет читаемости коду (хоть какой то порядок пытаемся навести в анархичном JS)
А умение разбираться в чужом коде - это очень хороший навык. И если сразу увидишь const то будешь уверен, что нигде ссылка не переписывается дальше по коду. И я думаю, что следующий программер который будет разбираться в коде скажет спасибо, если будет все интуитивно понятно.
2) Самому закладывать логику кода удобнее
Когда ты сам понимаешь, как должна работать твоя функция, то и легко определить где значение должно быть железно определено и неизменяемо, а где будет действительно переменное значение переменной (классная тавтология)
PS. Нашел краткое резюме отличий между var, let и const:
var:
  // function scoped (область видимости ограничивается функцией)
  // undefined when accessing a variable before it's declared (при обращении вернет undefined)
let:
  // block scoped (область видимости ограничивается блоком  {} )
  // ReferenceError when accessing a variable before it's declared (при обращении выдаст ReferenceError)
const:
  // block scoped (область видимости ограничивается блоком  {} )
  // ReferenceError when accessing a variable before it's declared (при обращении выдаст ReferenceError)
  // can't be reassigned (невозможно переопределить)

A: если говорить практично, то const используют один раз и более не переназначают это значение, в отличии от let которым можно назначить, а потом ещё раз.
Пример:
1) const = user
2) let = user
Далее где-то, можем сделать так:
let = user + user2


text:
Q: How to catch the category to put it in my dynamic menu with voyager and laravel I am a beginner in laravel and voyager. I would like to create a dynamic menu of the categories of my posts. I created a main menu corresponding to my post categories but I can't find how to associate it with my categories dynamically on voyager.
What should I put in place of "Route for the menu item"
I would also like to replace the name of my item with an image that is not a font icon of voyager font class. Is it possible ?
I tried to create my route with this :
use App\Http\Controllers\CategoriesController;
Route::resource('categories', CategoriesController::class);
Thank you in advance for your answers !


text:
Q: Flex builder 3 word completion/intellisense stopped working for new variables For some reason code completion/intellisense has stopped working for new properties in
 our projects.
These are the symptoms:

*

*Add a new property to a class

*If you go to a different class, and you try to use that property, the intellisense dropdown doesn't show the new property. It does show the already existing ones.

*If you build the project, everything works fine, there are no errors or compiler warnings.

*The property will not show in intellisense until you restart Flex Builder (version 3).

We have tried it on different machines and als tried to set up the workspace again, but the symptoms stay the same everywhere in our project.
Anyone who has seen this behaviour before and any tips on how to resolve this?
Thanks

A: I see this behavior while flexBuilder is "Building WorkSpace" and "Refreshing WorkSpace" which, on large projects can take a few minutes sometimes. Flex builder by default builds your workspace every time you save some changes or launch/debug a project.
If you don't have "Build Automatically" checked under the "Project" menu, then your workspace will not be built with each save and you will not see your new properties until it is built, which won't be until Flex builder restarts.

A: The problem was that I was using a non-localized resource bundle that I had placed in the source folder of my project. In the compiler I added the source path "src" to the Flex Build Path settings, which is also the main folder of the source code.
This caused the problem. I have now moved the resources to another folder outside the src folder and configured the compiler accordingly. Flex Builder works all fine again.


text:
Q: SSH login problem under 12.04 server edition I've got problem with ssh login after fresh installment of 12.04 server edition.
Every time it promotes: Authentication Fail, and I am pretty sure my password is OK.
I actually tried several ssh clients and several user names, all fail.
There is no log from /var/log/auth.log
And I've enabled PasswordAuthentication in my /etc/ssh/sshd_config
Any hint would be a great help.
Thanks

A: SSH by default is logging failed connection attempts to /var/log/auth.log.
Since you just installed the system, nobody disabled it, and you cannot login.
Conclusion: You are getting connected somewhere else (on your router/firewall).
I would guess you are trying to connect over the internet (say from home to work) but you are stumbling on some network gear which also has SSH running.
You could add some more information in your post for better troubleshooting.


text:
Q: why the methods /propreties of an interface can be passed in an extension function Today I had to use an extension function which had as predicate an Interface, a kind of Interface.whateverExtensionFunction()
and a I had a class ViewModel () :InterfaceInherithingFromAnotherInterface.  The architectural idea
  behind is to maintain my viewModel tidy and delegate some heavy weight to the extension function.
I do not understand why into my ViewModel in whatever method I can call the extension function FruitColorsInterface.changeColors() as in the code below into the method cut()
I do not undersand how is possible that effectively into the extension function, I can call the interface method
If a class implements an interface this is a contract to implement the methods of the interface and not too pass an object Interface has happens in this extension class**
class testInterface(){

    @Test
    fun testInterface(){
AppleTrim().cut()
    }

}

class AppleTrimViewModel : FruitColorsInterface{
    override val red: String
        get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates.
    override val green: String
        get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates.

    override fun mixColors(): String {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun move3d() {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun spinFromTop(): Int {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    fun cut(){

        changeColors()
        //FruitColorsInterface.changeColors()//why this is error?

    }
}

interface FruitColorsInterface {
    val red :String
    val green:String

    fun mixColors(): String
    fun move3d()
    fun spinFromTop() :Int

}

fun FruitColorsInterface.changeColors(){
    println("Ehy")
    mixColors()//WHY IS THAT?

}

if I decompile in Java I get a static function where is passed an interface
    public static final void changeColors(@NotNull FruitColorsInterface $this$changeColors) {
          Intrinsics.checkParameterIsNotNull($this$changeColors, "$this$changeColors");
          String var1 = "Ehy";
          System.out.println(var1);
          $this$changeColors.mixColors();
       }
//and
   public final void cut() {
      Test_interfaceKt.changeColors(this);
   }

A: In the scope of an extension function you have an instance of the type that it extends (in your example it is FruitColorsInterface) available as this — an implicit receiver.
Using that this instance you can invoke other functions and properties available on that type, no matter whether they are members or extensions.
As to why you can call just mixColors() instead of this.mixColors() in the extension function body, it's because this is available implicitly, same as in the member function bodies, and thus it can be omitted.


text:
Q: Position Image based on Browser Width and Height I was wondering if there was anyway I could position an image based on the browser's width and height within a HTML file. I know if I wanted to change an image's width/height, I could do something like this:
<script>
    alert("Width is " + window.outerWidth + " height is " + window.outerHeight);
    var canvas = document.getElementsByTagName('img')[0];
    canvas.width = 200;
  </script>

Is there anything similar I can do for positioning an image at a specific location, based on the browser width and height. Ideally, a way that does not include media queries if possible!
Thanks!!

A: To position an image based on the browser's width and height, give it an id to target it in CSS. Then use that id to give it an absolute position, and use the vw and vh units to position it. Each 1vw is 1% of the window's width, and each 1vh is 1% of the window's height:
HTML:
<img id="myImg" src="http://i.imgur.com/5LGqY2p.jpg?1">

CSS:
#myImg {
    position: absolute;
    left: 20vw;
    top: 10vh;
}

In this example, the top left corner of your image will be 20% of the way from the left of the screen, and 10% of the way down from the top of the screen.

Read more about CSS units here: https://css-tricks.com/the-lengths-of-css/


text:
Q: Is there any way that can make each pod gets its own volume in RC template? When setting a persistentVolumeClaim in the kubernetes ReplicationController template, each pod will share the same persistent volume.
Is there any way that can make each pod gets its own volume in RC template?
i don't want to create many RCs with replicas=1 with distinct persistentVolumeClaims.

A: No, you can't. A replication controller is a pod definition (mostly). And a pod is a collection of containers and attached volumes (mostly). Each pod is identical with the other pods.
So, again, no, you can't have different definitions for each replica, they are all identical.


text:
Q: Mapstruct mapping not working if the field is private The mapstruct not working if I make Vo object field and POJO objects field as private.
POJO Class:
@Getter
@Setter
@Entity
@Table(name = "items")
public class MtampItem extends AbstractEntity implements Serializable {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "item_id")
private Long itemId;

@Column(name = "item_name", nullable = false)
private String itemName;

@Column(name = "item_quantity", nullable = false)
private Integer itemQuantity;

@Column(name = "item_packed_on", nullable = false)
private String itemPackedOn;

@OneToOne(mappedBy = "items")
private MtampPrice price;

@ManyToOne
@JoinColumn(name = "store_id", nullable = false)
private MtampStores stores;

}

@Getter
@Setter
@Entity
@Table(name = "price")
public class MtampPrice extends AbstractEntity implements Serializable {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "price_id")
private Long priceId;

@Column(name = "total_price")
private Integer totalPrice;

@Column(name = "currency")
private String currency;

@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "itemId", referencedColumnName = "item_id")
private MtampItem items;

}

@Entity
@Getter
@Setter
@Table(name = "stores")
public class MtampStores extends AbstractEntity implements Serializable {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "store_id")
private Long storeId;

@Column(name = "store_name")
private String storeName;

@Column(name = "store_address_1")
private String storeAddress1;

@Column(name = "store_address_2")
private String storeAddress2;

@Column(name = "store_location")
private String storeLocation;

@Column(name = "city")
private String city;

@Column(name = "zip_code")
private String zipcode;

@OneToMany(mappedBy = "stores", cascade = CascadeType.ALL)
private List<MtampItem> items;

 }

VO Object:
@Getter
@Setter
public class Stores implements Serializable {

private static final long serialVersionUID = -9072061519155322550L;

@JsonProperty("store_id")
private Integer storeId;

@JsonProperty("store_name")
private String storeName;

@JsonProperty("store_address1")
private String storeAddress1;

@JsonProperty("store_address2")
private String storeAddress2;

@JsonProperty("store_location")
private String storeLocation;

@JsonProperty("city")
private String city;

@JsonProperty("zipcode")
private String zipcode;

@JsonProperty("items")
private List<Item> items = null;

@JsonProperty("created_by")
private String createdBy;

@JsonProperty("created_on")
private String createdOn;

@JsonProperty("last_modified_by")
private String lastModifiedBy;

@JsonProperty("last_modified_on")
private String lastModifiedOn;

}

@Getter
@Setter
public class Price implements Serializable {

private static final long serialVersionUID = -3893171253167040027L;

@JsonProperty("price_id")
private Integer priceId;

@JsonProperty("total_price")
private Integer totalPrice;

@JsonProperty("currency")
private String currency;

}

@Getter
@Setter
public class Item implements Serializable {

private static final long serialVersionUID = -1712026895026221162L;

@JsonProperty("item_id")
private Integer itemId;

@JsonProperty("item_name")
private String itemName;

@JsonProperty("item_quantity")
private Integer itemQuantity;

@JsonProperty("item_packed_on")
private String itemPackedOn;

@JsonProperty("price")
private Price price;

}

Mapper interface:
@Mapper(componentModel = "spring")
public interface StoreMapper {

MtampStores mapStoreToEntityStores(Stores stores);

Stores mapEntityStoresToStores(MtampStores stores);

 }

When I try to build we are getting the below generated code.
@Component
public class StoreMapperImpl implements StoreMapper {

@Override
public MtampStores mapStoreToEntityStores(Stores stores) {
    if ( stores == null ) {
        return null;
    }

    MtampStores mtampStores = new MtampStores();

    return mtampStores;
}

@Override
public Stores mapEntityStoresToStores(MtampStores stores) {
    if ( stores == null ) {
        return null;
    }

    Stores stores1 = new Stores();

    return stores1;
 }
}

Issue:
When I make the field of VO and POJO class fields as private the generated code not considering the fields for mapping. Can I know where I am making mistake.


text:
Q: Find an example of metric space which is not true the follow equation $\overline {T(x_0,r)}\subset T[x,r]=\{x:d(x,x_0 \leq r)\}$ I now that the follow:
In the metric space $(X,d)$ for every ball $T(x_0, r)$ goes $\overline {T(x_0,r)}\subset T[x,r]=\{x:d(x,x_0 \leq r)\}.$
But I didn`t know how to:
Find an example of metric space which is not true equation.
Please help me. Thanks for your help and your attention. Thanks once again

A: Equip $X = \{ a, b \}$ with the discrete metric. Then $T(a,1) = \{ a \}$, $\overline{T(a,1)} = \{ a \}$ but $T[a,1] = \{ a, b \}$, so the inclusion $\overline{T(a,1)} \subset T[a,1]$ is strict.


text:
Q: Should I specify any path to access the header files in Xcode? I have the source code for a video decoder. The code was executed without any problem on the MAC terminal.
Now, I need to port it on iOS. The source code has around 20 source files and 40 header files. I have created a project in Xcode 4.2 and put all of these in the project folder, without creating separate folders for headers and source files. When I tried building, its giving errors since the source files are not able to access the needed header files.
Is there any path that I need to specify for the headers?
Please help. Thanks in advance!

A: What about :

*

*Project Target

*Build Settings

*User Header Search Paths (set it to your header path)

*Always Search User Paths (set it to YES)

*These steps should (normally) resolve any "header not found"-related issues.


text:
Q: read always read less octet than asked For homework, I have to create a client/server program to store data. The client reads a file and sends it to the server via socket, the server receives it and stores the data. The final goal is to implement sharding between several servers.
The program works well but the read function always read less data than I asked for when the client and server are not in the same machine
Here is my code for reading:
static inline size_t reliableRead(const int sourceSocket, void* data, const size_t nBytes)
{
    size_t dataRead = 0;
    unsigned int lossInARaw = 0;

    do
    {   const size_t readStatus = read(sourceSocket,data+dataRead,nBytes - dataRead);

        if (readStatus == (unsigned)-1)
        {
            LOG_ERRNO_ERROR("error on read");
            break;
        }

        dataRead += readStatus;

        if (readStatus != nBytes)
            LOG_WARNING("data loss(%u): read %zu/%zuo",++lossInARaw,dataRead,nBytes);
    } while (dataRead < nBytes);

    return dataRead;
}

Here is the result when I try to read blocks of 1024o then 8192o. First client and server are two differrents hosts, then on the same
server-side when receiving data sliced in blocks of 1024o from the client on another machine

server-side when receiving data sliced in blocks of 8192o from the client on another machine

server-side when receiving data when the client is also on the machine

From the image, read is clearly capable of reading more than 1024o. I have never socket programming before, so maybe I am missing something, how can I make the read function reads mor often the amount of data I asked it to read ? Because even without displaying the warning, this clearly increases the sending time (don't mind the timing messag, it is clearly off, I will work on that)

A: For recv, rather than read, POSIX specifies the MSG_WAITALL flag, which you should be able to use to prevent needless context switches to your thread when all it would do is just re-request the remainder of a would-be-partial read.

MSG_WAITALL On SOCK_STREAM sockets this requests that the function
block until the full amount of data can be returned. The function may
return the smaller amount of data if the socket is a message-based
socket, if a signal is caught, if the connection is terminated, if
MSG_PEEK was specified, or if an error is pending for the socket.


text:
Q: CultureInfo.ClearCachedData is not working properly in .net 4.6 and older for WPF only Consider the following simple WPF application:
XAML (MainWindow):
<StackPanel>
    <TextBlock x:Name="Old"/>
    <TextBlock x:Name="New"/>
</StackPanel>

Codebehind:
  public MainWindow()
        {
            InitializeComponent();
            SystemEvents.UserPreferenceChanged += (sender, args) =>
            {
                Old.Text = $"Old culture name {CultureInfo.CurrentCulture.Name}";
                CultureInfo.CurrentCulture.ClearCachedData();
                New.Text = $"New culture name {CultureInfo.CurrentCulture.Name}";
            };
        }

Each time the user changes their regional settings it will print to Old TextBlock the old culture's name and, after calling ClearCachedData, the new culture's name will be set on New TextBlock. This is the window where I change these settings in Clock and Region section within Control Panel:

Now, if you build targeting 4.5.2 or less, it will work as expected and you will receive, after actually changing the setting, an output similar to this:

Now, build targeting 4.6 or later versions, you get something like this:

If you are targeting 4.6 or later, no matter how many times you change the number format region, no matter how many times you call ClearCachedData, CurrentCulture will not change...
But wait! Things get weirder... If you put above code into a Console App (using Console.WriteLine instead of course), it works not depending in which framework you chose (4.5.2, 4.6, anything..), strange isn't it? That is why I wrote "WPF only" in the title.. but I do not know for sure if this happens in any other platform other than WPF
There is still another crazy thing in this tale, since I have been playing around with this issue since yesterday, I found a trikcy way to make WPF or Console apps, targeting 4.5.2 or below, working wrong, just as the one targeting 4.6 and older. Simply setting CultureInfo.DefaultThreadCurrentCulture to anything different from null will break things apart.
public MainWindow()
{
    InitializeComponent();

    CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CurrentCulture;

    SystemEvents.UserPreferenceChanged += (sender, args) =>
    {
        Old.Text = $"Old culture name {CultureInfo.CurrentCulture.Name}";
        CultureInfo.CurrentCulture.ClearCachedData();
        New.Text = $"New culture name {CultureInfo.CurrentCulture.Name}";
    };
}

The above code will behave as if it were targeting 4.6. So, what I thought was that WPF targeting 4.6 was setting CultureInfo.DefaultThreadCurrentCulture in some way, but after testing this theory I am really stuck, because it is null by default, event in 4.6 and older...
So, is this a bug in WPF and/or .NET 4.6? I have not been able to find this breaking change reported.
Please, anything that shed some light on this will be appreciated. Also, if this is a bug and anyone know where could I report it, please tell me.
Note: I tag this question with C# as it is the language I am using, although I consider this issue is language independent.

A: For those visitors from the future and beyond who may will be having the same issue. I found a sort of workaround:
    public MainWindow()
    {
        InitializeComponent();

        CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CurrentCulture;

        SystemEvents.UserPreferenceChanged += (sender, args) =>
        {
            Old.Text = $"Old culture name {CultureInfo.CurrentCulture.Name}";
            CultureInfo.CurrentCulture.ClearCachedData();
            CultureInfo.CurrentCulture = new Thread(() => { }).CurrentCulture;
            New.Text = $"New culture name {CultureInfo.CurrentCulture.Name}";
        };
    }

The above code will work in both building options: 4.5.2 and earlier, or 4.6 and later. Notice that the call to ClearCachedData is still a must. We create a new thread instance and we manually update our CurrentCulture to that of the new thread.
Happy coding!


text:
Q: MVVM Light and Undo / Redo? I am probably mixing up some responsibilities (and maybe even terminology) here, but I can't quite wrap my head around this.
Is there any relationship between the Command Pattern and the Commands found in MVVM Light (and therefore aswell in WPF)? I would really love to implement some kind of undo / redo mechanism but can't quite figure out if there is an "MVVM Light way" of doing it.
And if this is not in relation to MVVM Light, how could I approach commanding with Undo / Redo in "raw" by not working against MVVM Light WPF?

A: The commanding in MVVM Light and WPF in general is a way to encapsulate arbitrary sets of functionality within a single object and interface, and to wire up any number of UI elements to execute that action.
These commands can be incorporated into a command pattern implementation of undo/redo functionality, but you need more.
You can roll your own command stack, which is the route I've taken in my current WPF project (using Prism).
Basically, it is a shift of mindset where every change that a user can make through the UI

*

*is wrapped in a command

*has a corresponding undo command

*gets pushed to a stack

There are also open-source projects available to help with this, including http://undo.codeplex.com/, which is a side project of Kirill Osenkov, a member of the Visual Studio team.

A: I implemented undo / redo for a WPF application and publishing my undo / redo code to http://muf.codeplex.com/.
I considered trying the recommended approach of using the Command pattern to encapsulate the logic. It seems good on paper, but in my case it seemed very challenging to figure out how to put every action into a command that could reliably undo / redo a set of changes. Instead, I took the approach of "monitoring" the underlying model for changes and then storing those changes in the undo stack. This is kind of like the command pattern, but in a "bottom up" approach. The undo actions "fall out" as a result of changing the model.
The actions are gathered by intercepting changes in the setters of the model, storing them into a unit of change with delegates for undoing / redoing the change, and then putting that on a stack of changes. The MUF library includes the logic for managing the stack, creating a unit of change, and more.
Comments and questions are welcome on the codeplex site ( http://muf.codeplex.com/ ). You'll also find complete documentation and sample apps there.
You can also get it via NuGet. Just look for "MUF" or "Monitored Undo Framework". It includes support for Silverlight 4.0, as well as .NET 3.5, 4.0, and WP7.

A: I don't know of any inherent undo/redo functionality in MVVM or WPF I'm afraid.
MVVM Light is a very good lightweight toolkit for rapidly implementing MVVM only. Any additional patterns you're going to have to implement yourself.


text:
Q: NoMethodError (undefined method `name' for nil:NilClass) I am trying to upload images without gem to a model called "Course Classifications", before I was using the gem "Paperclip".
Rails Version is Rails 3.0.10
When I am trying to create a "Course Classification", I get the following error:
undefined method `name 'for nil: NilClass
I suppose it must be something regarding the image that I am trying to upload, because when I do not load an image, the model is created normally.
according to my console the error is in the line of the method 'create' 'if @course_clasification.save'
What can be?
The 'puts' throw me the following:
"PARAMS: {\"name\"=>\"Prueba12312\", \"description\"=>\"\", \"status\"=>\"1\", \"picture\"=>#<ActionDispatch::Http::UploadedFile:0x0055ffb16c36d8 @original_filename=\"Selección_250.png\", @content_type=\"image/png\", @headers=\"Content-Disposition: form-data; name=\\\"course_clasification[picture]\\\"; filename=\\\"Selecci\\xC3\\xB3n_250.png\\\"\\r\\nContent-Type: image/png\\r\\n\", @tempfile=#<Tempfile:/tmp/RackMultipart20210722-21412-xnr47e>>}"
"NAME: Prueba12312"

My code is the following:
Controller:
     def create
        @course_clasification = CourseClasification.new(params[:course_clasification])
        p "PARAMS: #{params[:course_clasification]}"
        if params[:course_clasification].present?
          file = params[:course_clasification][:picture]
          File.open(Rails.root.join('public','uploads', file.original_filename), 'wb') do |f|
            f.write(file.read)
          end
        end
        respond_to do |format|
          if @course_clasification.save
            format.html { redirect_to(course_clasifications_path, :notice => 'Classification was created') }
            format.xml  { render :xml => @course_clasification, :status => :created, :location => @course_clasification }
          else
            format.html { render :action => "new" }
            format.xml  { render :xml => @course_clasification.errors, :status => :unprocessable_entity }
          end
        end
      end

  def upload
    uploaded_io = params.require(:course_clasification).permit(:picture)
    File.open(Rails.root.join('public','uploads',uploaded_io.original_filename), 'wb') do |file|
      file.write(uploaded_io.read)
    end
  end

Model:
class CourseClasification < ActiveRecord::Base
    has_many :courses
    has_many :enrollments

  validates :name, presence: true
=begin
    has_attached_file :avatar
    # Validate content type
    validates_attachment_content_type :avatar, content_type: /\Aimage/
    # Validate filename
    validates_attachment_file_name :avatar, matches: [/png\Z/, /jpe?g\Z/]
    # Explicitly do not validate
    do_not_validate_attachment_file_type :avatar
=end
    scope :actives, -> { where('status = 1') }
    scope :inactives, -> { where('status = 0') }

end

Form:
<%= form_for(@course_clasification, html: { style: "flex-direction: column; width: 50%;", :multipart => true }) do |f| %>

    <%= link_to ' Regresar'.html_safe, course_clasifications_path, class: "btn-button button--indigo" %>
    <%= f.submit((" " + t('action.save')).html_safe, :alt => "Guardar", :title => "Guardar", :class => "button__submit btn-button button--green", :style => "font-family: FontAwesome, verdana, sans-serif; float: right; margin-top: 0; margin-right: 7px;") %>

  <% lang = current_user.localization.languaje %>
  <% if @course_clasification.errors.any? %>

<%= t('activerecord.errors.template.header', count: @course_clasification.errors.size, model: t('activerecord.models.course_clasification')) %>:

        <%= t('activerecord.errors.template.body') %>

      <% @course_clasification.errors.full_messages.each do |msg| %>

<%= msg %>

      <% end %>

  <% end %>

    <%= f.label t('str_name_areas_'+ lang) %>

    <%= f.text_field :name %>

    <%= f.label "Agregar imágen a player" %>

    <%= f.file_field :picture %>
    <%# if @course_clasification.avatar? %>
      <%# image_tag @course_clasification.avatar.url(:thumb) %>
    <%# end %>

<% end %>

Schema:
class CreateCourseClasification < ActiveRecord::Migration
  def self.up
    create_table :course_clasifications do |t|
      t.string :name
      t.text :description
      t.boolean :status
      t.string :picture

      t.timestamps
    end
  end

end

A: One problem that I'm seeing is that you're not using Strong Parameters.
That means that
@course_clasification = CourseClasification.new(params[:course_clasification])
Will basically try to create an empty object since non of the params is whitelisted (whatever is not whitelisted is basically omitted by Rails), so the ActiveRecord object is invalid and the save fails.
Change it to something like
def course_classification_params
    # make sure to list all the save params!
    params.permit(:name, :description, :status, ...)
end

@course_clasification = CourseClasification.new(course_classification_params[:course_clasification])


text:
Q: Facing issue for writing junit test case for the below method.Kindly let me know any suggestions how to mock below jdbc save method in java Below is the java code which need to mock using juint mockito framework it is having @FunctionalInterface public interface PreparedStatementSetter we also need to be mock.
public boolean saveObject(ContentObject contentObject) {
        int result = 0;

        try {
            result = getJdbcTemplateWriter().update(PostgresConstants.SAVE_OBJECTS,
                    new PreparedStatementSetter() {
                        @Override
                        public void setValues(PreparedStatement preStmt) throws SQLException {

                            preStmt.setString(1,
                                    (contentObject.getId() != null)
                                            ? contentObject.getId().trim()
                                            : contentObject.getId());
                            preStmt.setString(2,
                                    (contentObject.getName() != null)
                                            ? contentObject.getName().trim()
                                            : contentObject.getName());
                        }
                    });
        } catch (Exception ex) {
            logger.error(ApplicationConstants.OBJECTS_FAILED_TO_SAVE, ex.getMessage());
            throw new Exception(ex,
                    ApplicationConstants.OBJECTS_FAILED_TO_SAVE);
        }

        return result > 0;
    }


text:
Q: Transferring data to GPU while kernel is running to save time GPU is really fast when it comes to paralleled computation and out performs CPU with being 15-30 ( some have reported even 50 ) times faster however,
GPU memory is very limited compared to CPU memory and communication between GPU memory and CPU is not as fast.
Lets say we have some data what won't fit into GPU ram but we still want to use
it's wonders to compute. What we can do is split that data into pieces and feed it into GPU one by one.
Sending large data to GPU can take time and one might think, what if we would split a data piece into two and feed the first half, run the kernel and then feed the other half while kernel is running.
By that logic we should save some time because data transfer should be going on while computation is, hopefully not interrupting it's job and when finished, it can just, well, continue it's job without needs for waiting a new data path.
I must say that I'm new to gpgpu, new to cuda but I have been experimenting around with simple cuda codes and have noticed that the function cudaMemcpy used to transfer data between CPU and GPU will block if kerner is running. It will wait until kernel is finished and then will do its job.

My question, is it possible to accomplish something like that described above and if so, could one show an example or provide some information source of how it could be done?
Thank you!

A:
is it possible to accomplish something like that described above

Yes, it's possible. What you're describing is a pipelined algorithm, and CUDA has various asynchronous capabilities to enable it.
The asynchronous concurrent execution section of the programming guide covers the necessary elements in CUDA to make it work.  To use your example, there exists a non-blocking version of cudaMemcpy, called cudaMemcpyAsync.  You'll need to understand CUDA streams and how to use them.
I would also suggest this presentation which covers most of what is needed.
Finally, here is a worked example.  That particular example happens to use CUDA stream callbacks, but those are not necessary for basic pipelining.  They enable additional host-oriented processing to be asynchronously triggered at various points in the pipeline, but the basic chunking of data, and delivery of data while processing is occurring does not depend on stream callbacks.  Note also the linked CUDA sample codes in that answer, which may be useful for study/learning.


text:
Q: GRUB failed to install after GRUB Rescue I created a new partition on Windows from unallocated space (I already had 4 primary partitions, so it seems it created a dynamic partition), then when I reboot I enter in the GRUB Rescue.
I used instmod and then I could boot to Ubuntu.
I tried to install GRUB with boot-repair and from command line
Using boot repair
First I get the error
SFS detected. You may want to retry after converting Windows dynamic partitioning (SFS partitions) to a basic disk

Then I just continued with boot repair and
GRUB failed to install to the following devices:

/dev/sda

Command line
sudo update-grub
sudo grub-install dev/sda

I get the same GRUB failed to install as I mentioned above
Using bootable usb
I tried boot repair and I get the same errors as when using it on PC.
Windows is not booting, when trying I get:
error: device format "lad/a1eb ... /volume1" invalid must be (f|h)dN with 0<=N<128

My HD:

A: What I did: I formated the disk and installed everything again. As I had backup of windows partition, it was just time loss.


text:
Q: how to know if user have denied the global location service or just the location service of the app? How to detect if user have denied the global location service or just the location service of the app ?
we can use authorizationStatus with kCLAuthorizationStatusDenied but this say:

The that user explicitly denied the use of location services for this
  app OR location services are currently disabled in Settings.


text: Q: My app crash when I receive a push and the app was close by the user I would like to test in x-code how to close my app by double tapping the home button and swipe up the app, and close it. Then I would tap on the push notification to open again the app. My problem is, when the app is closed this way and I receive and tap on the push notification, the app crashes before open. I need to handle this so that's the reason of my question.


text:
Q: Are characters unlocked by number of individual track races completed? When trying to unlock characters,  is the amount of races needed the amount of individual tracks or the amount of complete versus races  (say you do 4-track races,  does that set of 4 count as 4 or 1 toward the total?)

A: A race is one single track.
A group of four races on four different tracks is a cup.
For unlocking characters via the racing criteria, finishing a four track cup would count as four individual races.


text:
Q: Chef custom resource properties I created a cookbook using:
chef generate cookbook demo
chef generate attribute default
chef generate resource package

recipes\default.rb:
demo_package 'Demo'

resources\package.rb:
property :resource_prop1, String
property :resource_prop2, String

default_action :install

load_current_value do
  puts
  puts "the current value before change for 'test_prop1': #{resource_prop1}"
  puts "the current value before change for 'test_prop2': #{resource_prop2}"
  resource_prop1 = node['demo_resource']['test_prop1']
  resource_prop2 = node['demo_resource']['test_prop2']
  puts "the current value after change for 'test_prop1': #{resource_prop1}"
  puts "the current value after change for 'test_prop2': #{resource_prop2}"
end

action :install do
    puts "the current value after load properties for 'test_prop1': #{new_resource.resource_prop1}"
    puts "the current value after load properties for 'test_prop2': #{new_resource.resource_prop2}"
end

attributes\default.rb:
default['demo_resource'] = {}
default['demo_resource']['test_prop1'] = 'test value 1'
default['demo_resource']['test_prop2'] = 'test value 2'

I expected the output to look like this:
the current value before change for 'test_prop1':
the current value before change for 'test_prop2':
the current value after change for 'test_prop1': test value 1
the current value after change for 'test_prop2': test value 2
the current value after load properties for 'test_prop1': test value 1
the current value after load properties for 'test_prop2': test value 2

but I actually got:
the current value before change for 'test_prop1':
the current value before change for 'test_prop2':
the current value after change for 'test_prop1': test value 1
the current value after change for 'test_prop2': test value 2
the current value after load properties for 'test_prop1':
the current value after load properties for 'test_prop2':

I am trying to figure out the proper way of referencing the properties of a resource from the action block. What am I doing wrong?

UPDATE
I tried changing this line:
puts "the current value after load properties for 'test_prop1': #{new_resource.resource_prop1}"

into this:
puts "the current value after load properties for 'test_prop1': #{resource_prop1}"

but I got this error:
NameError undefined local variable or method `resource_prop1' for #<#Class:0x0000000007b51178>:0x00000000084b3680> Did you mean?  resources

UPDATE 2
I was able to workaround this issue by modifying the local_current_value block as follows:
load_current_value do |package|
  puts
  puts "the current value before change for 'test_prop1': #{package.resource_prop1}"
  puts "the current value before change for 'test_prop2': #{package.resource_prop2}"
  package.resource_prop1 = node['demo_resource']['test_prop1']
  package.resource_prop2 = node['demo_resource']['test_prop2']
  puts "the current value after change for 'test_prop1': #{package.resource_prop1}"
  puts "the current value after change for 'test_prop2': #{package.resource_prop2}"
end

A: There are 2 objects in custom resources: current_resource and new_resource. You create the new_resource, when you use your custom resource in a recipe:
demo_package 'Demo' do
  resource_prop1 'foo'
  resource_prop2 'bar'
end

Inside the load_current_value you should be loading the current state of the resource. For example, if you are to create a file with some path and owner, then in load_current_resource you should get the file and its current owner, for the later check, if the resource has changed. In your current method you actually assign current_resource.resource_prop1 and current_resource.prop2.
And as new_resource and current_resource are different objects, the values you set in load_current_resource are not passed from current_resource to new_resource.
If you need the loaded values inside action block, use current_resource:
action :install do
    puts "the current value after load properties for 'test_prop1': #{current_resource.resource_prop1}"
    puts "the current value after load properties for 'test_prop2': #{current_resource.resource_prop2}"
end

Answer to Update 2
When you are passing a parameter to load_corrent_resource, this parameter actually references new_resource. This is sometimes helpful, if

*

*You need some values from new_resource to calculate values of the current_resource.

*You need to calculate and assign some value of the new_resource.

There is a convention to call this parameter desired, like this:
load_current_value do |desired|
  # will assign current_resource.resource_prop1 = calculate_value(new_resource.resource_prop1)
  resource_prop1 calculate_value(desired.resource_prop1)
  [...]
  # will assign new_resource.resource_prop2
  desired.resource_prop2 some_calculation
end

A: see custom resources, in your case it should be something like
new_resource.resource_prop1


text:
Q: Natural examples of multiplicatively-graded rings A ring $A$ is multiplicatively graded if, as an additive group, it decomposes as
$$A=\bigoplus_{n\geq 1} A_n$$
and the product satisfies $A_n \times A_m \rightarrow A_{nm}$.
A natural example of such a ring is the ring of Dirichlet polynomials:
$$A=\mathbf{C}[1^s, 2^s, 3^s, \dots]$$
with $\deg(n^s)=n$, $1^s=1$. More generally, if $M$ is a monoid equipped with a monoid morphism $\deg : M \to (\mathbf{N}_{>0}, \times)$, then the monoid algebra $\mathbf C[M]$ has a natural structure of multiplicatively graded algebra.
Are there other examples of such objects which arise naturally in mathematics?


text:
Q: how to do constructor injection when mapping a class as component in nhibernate? For mapping component in nhibernate , is there a way in the hmb file we can indicate a overlaoded constructor to be used instead of default one.
In below mapping nHibernate will use the default constructor of MyClass when reading data from database - I am wondering if we can instruct nhibernate to use a overloaded constructor instead ?
 <component name="MyProperty" class="MyClass" >
  <property name="Member1" column="member_1" />
  <property name="Member2" column="member_2" />
  <property name="Member3" column="member_3" />
</component >

Edit #1
Alternatively , does nHibernate allow to map a static value to a property instead of a column ?
Something like below:
     <component name="MyProperty" class="MyClass" >
  <property name="Member1" column="member_1" />
  <property name="Member2" column="member_2" />
  <property name="Member3" **value="555"** />
</component >

A: The only standard way you can use constructor with parameters in NHibernate using select new HQL construct:
select new Family(mother, mate, offspr)
from Eg.DomesticCat as mother
    join mother.Mate as mate
    left join mother.Kittens as offspr

Otherwise it uses parameterless constructors for all purposes. I'm not sure whether this can be altered by hacking NHibernate internals (IClassPersister, IInterceptor, etc.)

A: NHibernate will always use the default constructor to instantiate an object of the type, (unless you want to create some kind of DTO and retrieve it via HQL) and then it will use the properties (or backing  fields if specified) to populate the object.
If you have a type for which you do not want to expose a default (no-args) constructor, but you want to make sure that you can only instantiate the type via a specific constructor, then I always do it like this:
public class MyClass
{
    private MyClass()
    {
       // Default constructor has been made private, so it is not usable
       // by user code, but NHibernate requires a default constructor
       // (it may be private)
    }

    public MyClass( int member1, int member2, string member3 )
    {
    }
}


text:
Q: "Server start failed on port 9876: Error: EACCES: permission denied" on 'ng test' Angular Unit Tests Whilst running my Unit Tests in watch mode, Chrome suddenly quit and I now can no longer run 'ng test'. This randomly occurred, and has not happened in over a year of working on these tests.
The error I am getting is:
Server start failed on port 9876: Error: EACCES: permission denied

I am running on a Mac, and have tried restarting both VSCode and my laptop multiple times. There is little to no documentation that I could find on the internet that describes my issue.
My question: Why am I getting this error and how do I fix it? Otherwise, how can I go about finding out more information about this issue by looking at the port usages and how I could go about resting them or similar.
Thanks in Advance!

A: This was fixed by removing ./node_modules using:
sudo rm -r node_modules
and then re-installed using:
npm install

A: May be you need to uninstall node modules and reinstall them to fix the issue.
Please try to execute in super user mode(root user) like this
sudo rm -r node_modules

You may also need to re-install using:
sudo npm install

Use this command to run Unit Tests in watch mode
ng t --code-coverage --watch --browsers Chrome


text:
Q: Sending PDF via email works when command run on console, but not when run by a cron job I've become stuck, I want to send a custom report via email in a pdf format. It's strange because it works correctly when I run the command via the console, but when it's run via a cron job nothing happens.
I'll appreciate it greatly if someone can point me in the right direction.
P.S. I know the cron functions correctly as it works perfectly if the attachment is a pdf.
Please see my code below.
Many thanks!
        $config = array('auth' => 'login',
            'username' => 'someemail@gmail.co.uk',
            'password' => 'somepassword',
            'ssl' => 'tls');

        $transport = new \Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);

        $mail = new \Zend_Mail();
        $mail->setBodyText("Hello, please see " . $fileName . " attached.");
        $mail->setSubject($fileName . " " . $this->getNextDeliveryDate());
        $mail->setFrom('someemail@gmail.co.uk', $fileName . $this->getNextDeliveryDate());
        $mail->addTo('someemail@gmail.co.uk', 'Info');
        $mail->addTo('someemail2@gmail.co.uk', '');

        $fileContents = fopen($this->directory->getAbsolutePath($filepath), 'r');
        $attachment = new \Zend_Mime_Part($fileContents);
        $attachment->type = 'application/pdf';
        $attachment->disposition = \Zend_Mime::DISPOSITION_ATTACHMENT;
        $attachment->encoding = \Zend_Mime::ENCODING_BASE64;
        $attachment->filename = $fileName . $this->getNextDeliveryDate() . ".pdf";

        $mail->addAttachment($attachment);

        try {
            $transport->send($mail);
        } catch (\Exception $e) {
          //  var_dump($e->getMessage());
        }
    }

Since posting this, I still haven't had any luck. I've switched it to sending via csv on the corn job and it works perfectly, would anyone know what I'm doing wrong?
Update:
From further investigation, it appears to stop working when this function runs via cron;
    public function generatePDF($itemDataRaw, $filename){

    ksort($itemDataRaw);

    $this->state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
    $html =  $this->_blockFactory->createBlock('Magento\Backend\Block\Template')
        ->setTemplate('Ozark_Managment::stocklist/stock.phtml')
        ->setData('itemDataRaw', $itemDataRaw)
        ->setData("nextDeliveryDate", $this->getNextDeliveryDate())
        ->toHtml();

    // instantiate and use the dompdf class
    $dompdf = new Dompdf();
    $dompdf->loadHtml($html);
    $options = $dompdf->getOptions();
    $options->set(['isRemoteEnabled' => true]);
    $dompdf->setOptions($options);
    // (Optional) Setup the paper size and orientation
    $dompdf->setPaper('A4', 'portrait');

    // Render the HTML as PDF
    gc_collect_cycles();
    gc_disable();
    $dompdf->render();
    gc_enable();
    gc_collect_cycles();

    $name = date('m-d-Y-H-i-s');
    $filepath = 'export/itemsreq/'. $filename . $name . '.pdf';
    $this->directory->create('export/itemsreq');
    $sheet = $dompdf->output();

    $stream = $this->directory->openFile($filepath, 'w+');
    $stream->write($sheet);
    $stream->close();
    return $filepath;
}

Update 2:
I checked the cron_schedule table for the message, and it was "Area Code already set" So I set up a try and except block on the below, and it worked! Now the problem is my PDF is blank!
try {
        $this->state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
    } catch (\Exception $e) {
        var_dump($this->state->getAreaCode());
    }

A: I've managed to solve this. Basically, what I was finding that when a cron us run, it sets the area code as Crontab, so to get around this I emulate a state under adminhtml area code. Please see my code below.
    public function generatePDF($itemDataRaw, $filename){
    ksort($itemDataRaw);
    $filepath = '';
    try {
       $this->state->emulateAreaCode(
            'adminhtml',
            function () use ($filename, $itemDataRaw, &$filepath) {
                $html =  $this->_blockFactory->createBlock('Magento\Framework\View\Element\Template')
                    ->setTemplate('Vendor_Name::stocklist/stock.phtml')
                    ->setData('itemDataRaw', $itemDataRaw)
                    ->setData("nextDeliveryDate", $this->getNextDeliveryDate())
                    ->toHtml();

                // instantiate and use the dompdf class
                $dompdf = new Dompdf();
                $dompdf->loadHtml($html);
                $options = $dompdf->getOptions();
                $options->set(['isRemoteEnabled' => true]);
                $dompdf->setOptions($options);
                // (Optional) Setup the paper size and orientation
                $dompdf->setPaper('A4', 'portrait');

                // Render the HTML as PDF
                gc_collect_cycles();
                gc_disable();

                //$_SERVER["SCRIPT_FILENAME"] = "";

                $dompdf->render();
                gc_enable();
                gc_collect_cycles();

                $name = date('m-d-Y-H-i-s');
                $filepath = 'export/itemsreq/'. $filename . $name . '.pdf';
                $this->directory->create('export/itemsreq');
                $sheet = $dompdf->output();

                $stream = $this->directory->openFile($filepath, 'w+');
                $stream->write($sheet);
                $stream->close();
            }
        );
    } catch (\Exception $e) {
        var_dump($e->getMessage());
    }

    return $filepath;
}


text:
Q: date field without time in a datagrid, trunc not working In my database (oracle 10g) I have in my table :
...
Date_ DATE NOT NULL,
...

In my WPF application, I plan on using a calendar to insert the date, but for now as a test I've inserted manually like so :
..., TO_DATE('21/02/16','DD/MM/YY'), ...

The problem is when I display this table from a DataSet into a DataGrid in WPF, it always shows up as 21/02/2016 12:00:00 AM. But select date_ from tablename; in the sqlplus command line shows me 21-FEB-2016, and I also updated the table with trunc(date_) in sqlplus but the time still shows in the datagrid
If I try something like
query = ("select column1, column2, trunc(date_) from tablename");

or
query = ("select column1, column2, to_date(date_, 'dd/mm/yyyy') from tablename");

then the column name in the datagrid just changes to "trunc(date)" but still shows the time.
Bonus question:
query = ("select column1, column2, date_ AS Date from tablename");

throws an out of bounds exception, why?

A: Here is what your problem - in ORA your data stored as date [no hours, min, sec, etc]. But when you load your DataTable in your DataSet, your .net provider automatically converts your Oracle type into DateTime. DateTime, as you know, has time part. If you want to show only date, you have 2 ways. You either code special grid column, which will display <value>.ToString("dd/MM/yy"), or simply, edit your query to auto-load your date as string, using to_char
query = "select column1, column2, to_char(date_, 'dd/mm/yyyy') AS MyDate  from tablename";

Actually, there are many ways of doing it but the principal issue here is that .net types don't match oracle types and somewhere you need to convert something. Usually, you display string representation of a data type. But when you save, you convert input into DB data type.


text:
Q: web3js signing the message using private key I tried using web3.eth.accounts.sign('hello', 'PrivateKey') to sign my message and used web3.eth.accounts.recover(signatureObject) to recover the address
but it does not return me the correct address. I am using web3 version : 1.0.0-beta.34. Any help ?


text:
Q: How to create video captions (.srt) for a Facebook page using Graph API? According to the Graph API v2.x, Facebook allows client applications to create captions for an existing video by uploading .srt files. See https://developers.facebook.com/docs/graph-api/reference/v2.5/video/captions/. Has anyone ever gotten this to work ?
My graph API create captions requests return with a 200 response and {'success': True}, but afterwards the Facebook video doesn't contain any captions. However, when I use the browser to upload the same .srt files, it works.
I'm using Python and the requests library to send my requests:
r = requests.post(url, files={"filename.en_US.srt": open(abspath, 'rb')})

What am I missing here?

A: The python call is wrong, it should be:
r = requests.post(url, files={'captions_file': ("filename.en_US.srt":
                   open(abspath, 'rb'), "application/octet-stream"})

In that case the API returns the same response, but the captions are added to the video. See also https://developers.facebook.com/bugs/677584865713231/


text:
Q: System.DirectoryServices is not recognised in the namespace 'System' I'm trying to use System.DirectoryServices in a web site project and I'm getting this error:

The type or namespace name 'DirectoryServices' does not exist in the namespace 'System' (are you missing an assembly reference?)

My project has a reference to System.DirectoryServices in web.config:
<add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

And I do have using System.DirectoryServices in the files where I want to use it.
Does anybody have a clue where to look for the problem?

A: I think you should install Directory Services Package.
Install-Package System.DirectoryServices -Version 4.0.0

Directory Services Package

A: Shot in the dark: have you tried adding to the web.config:
<compilation debug="true">
     <assemblies>
          <add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
     </assemblies>
</compilation>

A: Is the web-server (IIS or whatever) configured to run the folder as an application (i.e. shows as a cog), and is it using the correct version of ASP.NET? If it is running as 1.1, bits of it might work - but it would fail to find that 2.0 assembly in the 1.1 GAC.

A: This is a very old thread but just to provide a complete answer for the sake of posterity ;)
This issue occurs if the project is missing a reference to the .Net Component System.DirectoryServices
Adding this reference in the usual manner prefered by you will resolve the issue.

A: *

*Right click on References under your solution.

*Select Add Reference.
The reference can be found under the Framework Assemblies list.
Select System.DirectoryServices and click Add.

A: Is this a web site project, or a web application project. With the latter, references are handled via the .csproj - i.e. via the "References" node in Solution Explorer.

A: On Solution Explorer right-click your project, then from the resulting menu, click on Add Reference, then under the .NET tab navigate to DirectoryServices.AccountManagement

A: These problems occur when you are working with older .net version  and trying to build with the latest IDE
It depends on which version of IDE you are using and also the current code version.
Check the web config,
In my case, I was using the Latest version i.e 4.7 and directoryService assembly are still referring to C#4.0.
Add below if you are using Latest version of id i.e 4.7
  <system.web>
  <location>

<compilation debug="false" numRecompilesBeforeAppRestart="100" targetFramework="4.7">
        <assemblies>
<add assembly="System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.DirectoryServices.AccountManagement, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
 </assemblies>
      </compilation>
</system.web>
  </location>

A: I had the same problem when I tried to convert website to web-app.
It looks like vs failing to load the assembly should be related to versioning.
switch to web.config and add the assembly to it as bellow. make sure the DLL version is matching your application targeted .NET version.
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </assemblies>
    </compilation>
  </system.web>
</configuration>

for getting a public key you need to launch Developer Command Prompt for VS. Change to GAC directory related framework on above ex C:\Windows\Microsoft.NET\Framework\v4.0.30319
and call
sn -T System.DirectoryServices.dll


text:
Q: What is the best free program to burn DVD movies from DVD movie files that are present on the hard drive the way ImgBurn does it in Windows? Evaluating burning programs is difficult: it takes more time to find how things really are, and meanwhile the errors are very unpleasant. Also, a lot of people, in Linux as well as in Windows, seem to take it very lightly when evaluating burning software. I have read  along the years a lot of good comments on all sort of Windows programs that after a while prove not to worth trying - at the expense of my time, lost data and nerves. Burning software is good until it is proved otherwise, which usually doesn't take to long. They should be discussed against reliable benchmarks set by well confirmed software: Nero, and lately ImgBurn (and maybe also CDBurnerXP) in Windows.
I have looked at AcetoneISO, Brasero, and K3B (which many recommend) but they seem more limited than the mentioned Windows apps. They are all said to work, but then at a more basic level (create ISO, burn them, etc.). When it comes to something like creating a DVD movie disk from DVD movie files present on the hard drive, it seems to me that I would have to firstly create the ISO and then burn it, which involves using more hard drive space and more time.
My own experience with the most recommended Ubuntu burning software (k3b, k9copy) was bad. (Could it be related to their k-related condition and my Xfce DE?)
One is not bound to give a second try to one peace of software that crashes or gives an unreadable disk the first time. In Ubuntu the situation on the matter is for now similar to that in Windows of some years ago when Nero ruled unrivaled. Until came ImgBurn - which, yes, works in Wine.
(There is a Nero 4 for Linux. It costs money. The sweetest taboo.)
What other options are there?
(I am in Xubuntu 11.10).

A: I'm using K9copy, and I love it.

k9copy provides the following features:

*

*The video stream can be compressed to make the video fit on any    configurable target size

*DVD Burning

*Transcode DVD using mencoder or ffmpeg with configurable presets

*Creation of ISO images

*The possibility of choosing which audio and subtitle tracks to copy

*Title preview (video only)

*The ability to preserve the original menus 1

You can get it at the USC
1Source:Ubuntu Apps Directory

Another option to create a DVD movie disk from DVD movie files present on the hard drive, Use Bombono

Bombono DVD is easy to use program for making DVD-Video. The main features of Bombono DVD are:

*

*excellent MPEG viewer: Timeline and Monitor

*real WYSIWYG Menu Editor with live thumbnails

*comfortable Drag-N-Drop support

*you can author to folder, make ISO-image or burn directly to DVD

*reauthoring: you can import video from DVD discs. 2
2Source:Ubuntu Apps Directory


text:
Q: ArenaLib and WSM The WSM documentation states that

Typical tools for such purposes would include ARENA, and there exists also a Modelica implementation of that tool and modeling methodology, called the ARENALib.

Does anyone know where to find the appropriate library to be used in WSM, how to install and to use?

A: I affraid this question will be closed due to off topic but, you'll find  Modelica Libraries, i.e. a collection of free and commercial libraries there:
Modelica Libraries.
Quote: This page contains a list of Modelica libraries (both free and commercial) - see the short overview of libraries for details.
ARENALib has a page you can contact the author Victorino Sanz, if the email is still valid.
Good Luck & Have Fun
Edit
See also DESLib Free library for Parallel DEVS and Process-Oriented Modeling in Modelica.
This library contains four packages that can be used to model discrete-event systems:

*

*RandomLib can be used to generate random numbers and variates,
following continuous and discrete probability distributions.

*DEVSLib can be used to model discrete-event systems following the Parallel DEVS formalism.

*SIMANLib can be used to model discrete-event systems following the process-oriented approach. Its functionalities are equivalent to some of the functionalities of the SIMAN modeling language.

*ARENALib can be used to model discrete-event systems following the process-oriented approach. Its functionalities are equivalent to some of the functionalities of BasicProcess Panel in the Arena simulation environment.

Or see DESLib Modelica Library
Parallel DEVS and Process-Oriented Modeling in Modelica, Author Victorino Sanz


text:
Q: Getting solutions to Ricci-DeTurck flow from solutions to Ricci flow Let $\overline{g}(t)$ be a solution to the Ricci flow, $\tilde{g}$ be an arbitrary (fixed) background metric and denote by $\varphi_{t}$ the solution of the harmonic map heat flow
$$\frac{\partial}{\partial t} \varphi_{t}=\Delta_{\bar{g}(t), \bar{g}} \varphi$$
with respect to $\overline{g}(t)$ and $\tilde{g}$. I want to check that
$$g(t) = \left(\varphi_{t}^{-1}\right)^{*} \bar{g}(t)$$
solves Ricci-DeTurck flow. My calculations yield:
$$\begin{aligned}
\frac{\partial}{\partial t} g(t) &=\frac{\partial}{\partial t}\left(\left(\varphi_{t}^{-1}\right)^{*} \bar{g}(t)\right) \\
&=\left(\varphi_{t}^{-1}\right)^{*}\left(\frac{\partial}{\partial t} \bar{g}(t)\right)+ \left(\varphi_{t}^{-1}\right)^{*}\left(\mathcal{L}_{\left(\frac{\partial}{\partial t} \varphi_{t}^{-1}  \right)}\bar{g}(t)\right)
\end{aligned}$$
But in the book I'm reading, their computations yield:
$$\begin{aligned}
\frac{\partial}{\partial t} g(t) &=\frac{\partial}{\partial t}\left(\left(\varphi_{t}^{-1}\right)^{*} \bar{g}(t)\right) \\
&=\left(\varphi_{t}^{-1}\right)^{*}\left(\frac{\partial}{\partial t} \bar{g}(t)\right)+\mathcal{L}_{\left(\varphi_{t}^{-1}\right)^{*}\left(\frac{\partial}{\partial t} \varphi_{t}\right)}\left[\left(\varphi_{t}^{-1}\right)^{*} \bar{g}(t)\right] \\ &=\left(\varphi_{t}^{-1}\right)^{*}(-2 \operatorname{Rc}[\bar{g}(t)])+\mathcal{L}_{\left(\varphi_{t}^{-1}\right)^{*}\left(\varphi_{t}^{*}[W(t)]\right)}[g(t)]
\end{aligned}$$
But I'm having some trouble getting from:
$$\left(\varphi_{t}^{-1}\right)^{*}\left(\mathcal{L}_{\left(\frac{\partial}{\partial t} \varphi_{t}^{-1}  \right)}\bar{g}(t)\right)$$
to
$$\mathcal{L}_{\left(\varphi_{t}^{-1}\right)^{*}\left(\frac{\partial}{\partial t} \varphi_{t}\right)}\left[\left(\varphi_{t}^{-1}\right)^{*} \bar{g}(t)\right]$$
And also, my understanding is that
$$\frac{\partial}{\partial t} \varphi_{t}=\Delta_{\bar{g}(t), \bar{g}} \varphi = - W \circ \varphi$$
How could the above equal $\varphi_{t}^{*}[W(t)]$?


text:
Q: Store serializable data in char or string variable in Java Serializable a = randomForest.getClassificationByMaxProb(attributes);
System.out.println("Assigned class: " + a);

I am getting the result:
Assigned class: 1

I want to store that class which is 1 into any char or int variable.

A: If a contains 1, which means toString() method return 1, you can do the following

int iSerizable = Integer.parseInt(a.toString());


text:
Q: Navigation written inside header tag but shown below the header So I had some problems making a responsive navigation bar with Gatsby. After 2 weeks, I've finally managed to make it work but there is one last problem.
I've put my navigation inside my header for logic reasons. Normally the navbar is hidden but when you touch or click the hamburger menu, the navigation is visible but the point is:
My header is a P tag together with the Icon div. When toggled, the navigation is forced inside the header but I want to make my navigation appear BELOW the header.
Any ways to do this?
This is my code for the header
import React, { useState } from 'react'
import Navbar from '../navbar/navbar'

const Header = () => {
const [toggleNav, setToggleNav]=useState(false);

const showNav = () => setToggleNav(!toggleNav);

    return(

STIJN REYGAERTS

            <div className={`${toggleNav ? 'NavigationVisible': 'Navigation' }`}><Navbar />

    )
}

export default Header


text:
Q: Upload/Store big CSV files in Oracle DB and update the files on subsequent uploads Could somebody please let me know the best way to store a csv file in oracle DB(note :  number of columns in csv file are unknown to me, and I don't want to create an equivalent table for every csv file that gets uploaded)
My requirement is like below :

*

*On first upload, just save the entire csv file in some column of a table.

*On second upload, I want to merge the new content with the older one.

Example : first upload has data for the duration jan-2020 to dec-2020(some 2000 rows) and second upload has data for duration jan-2021 to dec-2021(some 1000 rows). Now by merge I basically mean, I want to combine data for (jan-2020 to dec-2020) and (jan-2021 to dec-2021) and store the result(3000 rows) back in CSV_DATA column shown below.
First upload
ID    MODIFIED_DATE      CSV_DATA
1     2/2/2021           ...
2     3/2/2021           ...

second upload for ID = 1
ID    MODIFIED_DATE      CSV_DATA
1     20/2/2021          ...
2     3/2/2021           ...

Many thanks in advance !!!

A: Add a column with timestamp and keep only the new data after updating your table


text:
Q: Intergenic Regions? I have a bed file with genes on the plus and minus strands. I want to get the intergenic regions between the genes on the positive and negative strands. Is there any way to do this with an awk command? Thanks so much!
Edit: The second and third columns are gene start and stop sites. Basically I want to subtract the number in the third column and the number in the preceding second row if there is a + sign starting from the bottom. If the last column has a - sign I also want to start from the bottom but subtract the number in the second column and the number in the preceding third row.
Desired output
chr1  820983    (860759-820983)    ENSG00000269308 591    +
chr1   818542     (818542-369634)   ENSG00000235249 587   +
ch1 738637     (738637-623056)      ENSG00000185097 589   -
ch1 621546     (621546-140379)      ENSG00000237683  586 -

Input
chr1    13885   140379  ENSG00000237683 586 -
chr1    36854   369634  ENSG00000235249 587 +
chr1    621546  623056  ENSG00000185097 589 -
chr1    738637  740137  ENSG00000269831 590 -
chr1    818542  820983  ENSG00000269308 591 +
chr1    860759  875671  ENSG00000187634 591 +

A: I still don't understand your explanation and desired output completely (why are some column 1 values chr1 and some ch1? why is column 2 in the first row 820983 rather than 860759?), however this may be enough to get you started.
If you don't care about the order of output, the simplest thing would seem to be to reverse the order of lines in the file, an then simply keep a rolling record of the most recent column 2 values for the + and - entries, and print/subtract them when the next + or - is encountered:
$ tac file.bed | awk '
>   $NF ~ /+/ {if(last2p) print $1, last2p, "(" last2p "-" $3 ")", $4, $5, $6; last2p = $2}
>   $NF ~ /-/ {if(last2m) print $1, last2m, "(" last2m "-" $3 ")", $4, $5, $6; last2m = $2}
> '
chr1 860759 (860759-820983) ENSG00000269308 591 +
chr1 738637 (738637-623056) ENSG00000185097 589 -
chr1 818542 (818542-369634) ENSG00000235249 587 +
chr1 621546 (621546-140379) ENSG00000237683 586 -

If you do care about the output order, then you can construct a pair of arrays plus and minus say, then iterate over them in reverse looking "up" for the next matching + or -.  This is too big for a one-liner so presented here as an executable awk script:
$ cat chr.awk
#!/usr/bin/gawk -f

function fooprint(a,i, j,p,q) {
  split(a[i], p);
  for(j=i-1;j>0;j--) {
    if(j in a) {
      split(a[j], q);
      print q[1], p[2], "(" p[2] "-" q[3] ")", q[4], q[5], q[6];
      break;
    }
  }
}

$NF ~ /+/ {plus[FNR] = $0}
$NF ~ /-/ {minus[FNR] = $0}

END {
  for(i=NR; i>1; i--) {
    if (i in plus)
      fooprint(plus,i);
    else if (i in minus)
      fooprint(minus,i);
  }
}

then
$ ./chr.awk file.bed
chr1 860759 (860759-820983) ENSG00000269308 591 +
chr1 818542 (818542-369634) ENSG00000235249 587 +
chr1 738637 (738637-623056) ENSG00000185097 589 -
chr1 621546 (621546-140379) ENSG00000237683 586 -


text:
Q: PHP Parse HTML code
Possible Duplicate:
Best methods to parse HTML

How can I parse HTML code held in a PHP variable if it something like:

T1
Lorem ipsum.
T2
The quick red fox...
T3
... jumps over the lazy brown FROG!

I want to only get the text that's between the headings and I understand that it's not a good idea to use Regular Expressions.

A: Use PHP Document Object Model:
<?php
   $str = '
T1
Lorem ipsum.
T2
The quick red fox...
T3
... jumps over the lazy brown FROG';
   $DOM = new DOMDocument;
   $DOM->loadHTML($str);

   //get all H1
   $items = $DOM->getElementsByTagName('h1');

   //display all H1 text
   for ($i = 0; $i < $items->length; $i++)
        echo $items->item($i)->nodeValue . "
";
?>

This outputs as:
 T1
 T2
 T3

[EDIT]: After OP Clarification:
If you want the content like Lorem ipsum. etc, you can directly use this regex:
<?php
   $str = '
T1
Lorem ipsum.
T2
The quick red fox...
T3
... jumps over the lazy brown FROG';
   echo preg_replace("#
.*?
#", "", $str);
?>

this outputs:

Lorem ipsum.The quick red fox...... jumps over the lazy brown FROG


text:
Q: Accessing associative array inside an object I have looked everywhere for this but nobody seems to use associative arrays in objects. Here is my object:
var player = {
     Level: 1,
     Stats: [{Defense : 5}, {Attack: 1}, {Luck: 3}]
};

I need to access the values of Defense, Attack, and Luck, but how?
I have tried this but it hasn't worked:
player.Stats.Defense
player.Stats.Attack
player.Stats.Luck

Any ideas? Thanks!
P.S. Does it make a difference that I am using jQuery?

A: You've said you're in control of the structure. If so, change it to this:
var player = {
     Level: 1,
     Stats: {Defense : 5, Attack: 1, Luck: 3}
};

Note that Stats is now an object, not an array. Then you access that information the way you tried to, player.Stats.Defense and so on. There's no reason to make Stats an array of dissimilar objects, that just makes your life difficult.
You've used the term "associative array" which makes me think you have a PHP background. That term isn't commonly used in the JavaScript world, to avoid confusion with arrays. "Object," "map," or "dictionary" are the terms usually used, probably in that order, all referring to objects ({}). Probably nine times out of ten, if you would use an associative array for something in PHP, you'd use an object for it in JavaScript (in addition to using objects for the same sort of thing you use objects for in PHP).

P.S. Does it make a difference that I am using jQuery?

No, this is language-level rather than library-level, but it's a perfectly reasonable question.

(Making this a CW answer because it's basically what all the comments on the question are saying.)

A: as Stats: [{Defense : 5}, {Attack: 1}, {Luck: 3}] is array of objects, you need to do:
player.Stats[0].Defense
player.Stats[1].Attack
player.Stats[2].Luck

A: Here player.Stats is an array of objects. So you'll have to use index for accessing those objects.
var player = {
     Level: 1,
     Stats: [{Defense : 5}, {Attack: 1}, {Luck: 3}]
};

Use these :
player.Stats[0].Defense
player.Stats[1].Attack
player.Stats[2].Luck