text:
Q: Why not use HTML tags in websites' text editors? I may need to implement this sometime in the future, but I think the trigger for the question now is mainly curiosity.
I thought of how to write a text editor to a web site I'll build soon, and saw this site's (and other's) way, so I thought - isn't it a bit too complicated? If tags should be used from the first place, why not let users use HTML tags? The only reason I can think of is HTML injection which I don't know much about, but it sounds like an easy issue to solve, isn't it?
Thank you.

A: Simply because not all of your users will know HTML. *bold text* is a lot more easy to understand (and read in it's raw form) than bold text. Especially if you get into links.
The reason we use Markdown, Textile and the rest is to provide a nice alternative that's accessible to more users.
Of course you can still provide the ability to use HTML to your users (it's in the Markdown spec) but you'll have to do a lot of checking to make sure there's nothing malicious going on - for example, blocking


text:
Q: Could not locate configuration file GoogleService-Info.plist when using FirebaseApp.configure(options:) In my project I have different targets for the same app with different configurations (Production / Staging / QA). As suggested by the Firebase docs I added a plist file for each trarget and initializing FirebaseApp by passing the correct configuration file in this way:
let configPath = Bundle.main.path(forResource: NAME_OF_PLIST_FOR_CURRENT_TARGET ofType: ".plist")!
let options = FirebaseOptions(contentsOfFile: configPath)!
FirebaseApp.configure(options: options)

I also removed from my project the GoogleService-Info.plist file as suggested in docs here to ensure reliable Analytics reports.
When I run the app in the console I see these messages.
[Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
[Firebase/Analytics][I-ACS020006] Google App ID from GoogleService-Info.plist is empty. Please, define GOOGLE_APP_ID in GoogleService-Info.plist for Analytics to work reliably. See
[Firebase/Analytics][I-ACS025020] Analytics requires Google App ID from GoogleService-Info.plist. Your data may be lost. Google App ID has been changed. Original, new ID: (nil), MYAPPID

Am I doing something wrong? Could this configuration lead to lost Analytics? (as console message suggest)

A: After several attempts it seemed that, despite the error messages in the console, Firebase was configured correctly.
Nonetheless I decided to adopt the solution proposed by @Micgal, thus having multiple files named GoogleService-Info.plist in separate filesystem directories and adding each one to the corresponding target. I can then initialize Firebase with FirebaseApp.configure() which works as expected without generating error messages.

A: Alternative workaround to having separate folders for GoogleService-Info.plist is adding additional step in Build Phases, to copy appropriate file. Just go to Targets / Build Phases and add new script by clicking on "New Run Script Phase". Script could be something like:
cp "${SRCROOT}/${PROJECT}/${FIREBASE_CONFIG_FILE}.plist" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleService-Info.plist"

where FIREBASE_CONFIG_FILE is defined in Build Settings as User-Defined settings which has different values for various configurations. And then just calling FirebaseApp.configure().
There is also a dedicated ticket on Firebase github

A: maybe you have to add this needed file (GoogleService-Info.plist) to you project ressources. Open yourproject.xcworkspace in Xcode and in the Project navigator click right on Ressources folder and select 'Add files to...'.

A: Select the GoogleService-Info.plist in the left pane, then uncheck/recheck the Target Membership checkbox for your project.

A: When you use flutter:
I ran the flutter cli to add Firebase to my project, using the flutterfire configure command. This added the GoogleService_Info.plist to my project, but didn't register the file in the .xcworpspace file.
So I had to right-click on the Runner-folder in Xcode, choose Add Files to "Runner"..., and select the file GoogleService_Info.plist

redpajama_set_name: RedPajamaStackExchange


text:
Q: Add alt text in google.maps.MarkerImage I have an application that uses google maps. The application works fine, however when use WAVE tool to check the web accessibility, it shows the application has nine missing alternative text. After study the code, I guess my javascript function occurs the errors.
Thanks geocodezip let me know that the MarkerImage was deprecated in v3.10, so I modified the code. However The WAVE result still shows the same web accessibility issue. May I know which part I make the mistake for the Icon part please?
//previous code is removed as the MarkerImage was deprecated in v3.10
//so the code has been modified
g_1Icon = {
    url: IMG_MARKER_1,
    //also try but not work the WAVE still displays the web
    accessibility issue.
   // icon: IMG_MARKER_1,
    size: new google.maps.Size(52, 29),
    origin: new google.maps.Point(0, 0),
    anchor: new google.maps.Point(7, 31),
    title:'put alt text here'
};
g_2Icon = {
    url: IMG_MARKER_2,
    //also try but not work the WAVE still displays the web
    accessibility issue.
    // icon: IMG_MARKER_2,
    size: new google.maps.Size(21, 31),
    origin: new google.maps.Point(0, 0),
    anchor: new google.maps.Point(7, 31),
    title:'put alt text here'
};
g_3Icon = {
    IMG_MARKER_3,
    //also try but not work the WAVE still displays the web
    accessibility issue.
   // icon: IMG_MARKER_3,
    size: new google.maps.Size(21, 31),
    origin: new google.maps.Point(0, 0),
    anchor: new google.maps.Point(7, 31),
    title:'put alt text here'
};

g_4Icon = {
    url: IMG_MARKER_4,
    //also try but not work the WAVE still displays the web
    accessibility issue.
   // icon: IMG_MARKER_4,
    size: new google.maps.Size(21, 31),
    origin: new google.maps.Point(0, 0),
    anchor: new google.maps.Point(7, 31),
    title:'put alt text here'
};

g_5Icon = {
    url: IMG_MARKER_5,
    //also try but not work the WAVE still displays the web
    accessibility issue.
   // icon: IMG_MARKER_5,
    size: new google.maps.Size(21, 31),
    origin: new google.maps.Point(0, 0),
    anchor: new google.maps.Point(7, 31),
    title:'put alt text here'
};

g_6Icon = {
    //also try but not work the WAVE still displays the web
    accessibility issue.
   // icon: IMG_MARKER_6,
    url: IMG_MARKER_6,
    size: new google.maps.Size(21, 31),
    origin: new google.maps.Point(0, 0),
    anchor: new google.maps.Point(7, 31),
    title:'put alt text here'
};

g_7Icon ={
    url: IMG_MARKER_7,
    //also try but not work the WAVE still displays the web
    accessibility issue.
   // icon: IMG_MARKER_7,
    size: new google.maps.Size(21, 31),
    origin: new google.maps.Point(0, 0),
    anchor: new google.maps.Point(7, 31),
    title:'put alt text here'
};

g_8Icon ={
    //also try but not work the WAVE still displays the web
    accessibility issue.
   // icon: IMG_MARKER_8,
    url: IMG_MARKER_8,
    size: new google.maps.Size(21, 31),
    origin: new google.maps.Point(0, 0),
    anchor: new google.maps.Point(7, 31),
    title:'put alt text here'
};

g_9Icon = {
    url: IMG_MARKER_9,
    //also try but not work the WAVE still displays the web
    accessibility issue.
   // icon: IMG_MARKER_9,
    size: new google.maps.Size(21, 31),
    origin: new google.maps.Point(0, 0),
    anchor: new google.maps.Point(7, 31),
    title:'put alt text here'
};

I try to find more information about the WAVE result, it shows these images missing alternative text.
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22none%22%20d%3D%22M0%200h24v24H0V0z%22/%3E%3Cpath%20fill%3D%22%23666%22%20d%3D%22M12.06%209.06l4-4-4-4-1.41%201.41%201.59%201.59h-.18c-2.3%200-4.6.88-6.35%202.64-3.52%203.51-3.52%209.21%200%2012.72%201.5%201.5%203.4%202.36%205.36%202.58v-2.02c-1.44-.21-2.84-.86-3.95-1.97-2.73-2.73-2.73-7.17%200-9.9%201.37-1.37%203.16-2.05%204.95-2.05h.17l-1.59%201.59%201.41%201.41zm8.94%203c-.19-1.74-.88-3.32-1.91-4.61l-1.43%201.43c.69.92%201.15%202%201.32%203.18H21zm-7.94%207.92V22c1.74-.19%203.32-.88%204.61-1.91l-1.43-1.43c-.91.68-2%201.15-3.18%201.32zm4.6-2.74l1.43%201.43c1.04-1.29%201.72-2.88%201.91-4.61h-2.02c-.17%201.18-.64%202.27-1.32%203.18z%22/%3E%3C/svg%3E" style="width: 20px; height: 20px;">

I search it from the code but it does not exist in the application (I don't find the code that use those images). So does it mean those images are generated by the google map?
Grateful if someone can give some advices about this issue or let me know my mistakes please. Thank you.
Reference:
https://developers.google.com/maps/documentation/javascript/markers#convertingtoicon
Marker off-set on Google Map API v3
Google maps API: Marker image positioning

google-map tiles missing alt tag causing lower accessibility score

https://litzdigital.com/blog/making-google-maps-controls-more-accessible/

https://www.javatpoint.com/jquery-attr


text:
Q: Loopback tcp connection acceleration I am trying to send some bytes to a third party application ( running on same server ) using tcp loopback connection using following code.
struct sockaddr_in serv_addr;
struct hostent *server;
int sockfd = socket(PF_INET, SOCK_STREAM, 0);
server = gethostbyname(host_address);

bzero((char *) &serv_addr, sizeof (serv_addr));
serv_addr.sin_family = AF_INET;

bcopy((char *) server->h_addr, (char *) &serv_addr.sin_addr.s_addr, server->h_length);

/**** Port No. Set   ****/
serv_addr.sin_port = htons(portno);
int sockKeepAliveOption = 1;
int al = setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, (void*) &sockKeepAliveOption, sizeof (sockKeepAliveOption));
if (al == -1) {
    std::cout << "Setsocket option err: SO_KEEPALIVE --unable to set keep alive tcp connection." << std::endl;
}
else {
    std::cout << "S0_KEEPALIVE set, with SOL_SOCKET.. . ..\n" << std::endl;
}

I am sending 400 bytes at one time and sending 100 times in a second. I am using following code to send
int n = send(sockfd,sendB,400, ONLOAD_MSG_WARM);

MY problem is, I am getting high jitter. I am getting minimum latency 3 us, avg 7 us and max 19 us. How can i optimized it?
Thanks
Edit on 8/28/2014.
Let me add few more information. I am also receiving data from same port in  different thread but after I send. I am also assigning one core to each thread by following code and all cpu except core 0 are isolated from scheduler.
        thread1= new std::thread(myfunction, input1, input2);
        pthread_t thread_hnd = thread1->native_handle();
        CPU_SET(5, &cpuset);
        s = pthread_setaffinity_np(thread_hnd, sizeof (cpu_set_t), &cpuset);

I am getting good number (3 or 4 us) when I am sending continuously at every 1 ms but if frequency is less ( say 1-5 in a second ) then some time i get around 20 us but avg is around 7 us.
Can listening and sending on same port from different thread create jitter ?
2ND Edit on 8/28/2014.
Here is my cpu state. It is not going to C3. Core 2 [7] is the thread from where I am sending data through loop back.
 Cpu speed from cpuinfo 3499.00Mhz
 True Frequency (without accounting Turbo) 3499 MHz

 Socket [0] - [physical cores=6, logical cores=6, max online cores ever=6]
 CPU Multiplier 35x || Bus clock frequency (BCLK) 99.97 MHz
 TURBO ENABLED on 6 Cores, Hyper Threading OFF
 Max Frequency without considering Turbo 3598.97 MHz (99.97 x [36])
 Max TURBO Multiplier (if Enabled) with 1/2/3/4/5/6 cores is  38x/37x/36x/36x/36x/36x
 Real Current Frequency 3600.17 MHz (Max of below)
    Core [core-id]  :Actual Freq (Mult.)      C0%   Halt(C1)%  C3 %   C6 %  Temp
    Core 1 [0]:       3600.17 (36.01x)      1.08    98.9       0       0    41
    Core 2 [1]:       3595.44 (35.96x)      1.07    98.9       0       0    46
    Core 3 [2]:       3595.28 (35.96x)         1    99.1       0       0    40
    Core 4 [3]:       3599.01 (36.00x)         1    99.9       0       0    46
    Core 5 [4]:       3599.51 (36.01x)         0     100       0       0    50
    Core 6 [5]:       3598.97 (36.00x)       100       0       0       0    56

  Socket [1] - [physical cores=6, logical cores=6, max online cores ever=6]
  CPU Multiplier 35x || Bus clock frequency (BCLK) 99.97 MHz
  TURBO ENABLED on 6 Cores, Hyper Threading OFF
  Max Frequency without considering Turbo 3598.97 MHz (99.97 x [36])
  Max TURBO Multiplier (if Enabled) with 1/2/3/4/5/6 cores is  38x/37x/36x/36x/36x/36x
  Real Current Frequency 3600.12 MHz (Max of below)
    Core [core-id]  :Actual Freq (Mult.)      C0%   Halt(C1)%  C3 %   C6 %  Temp
    Core 1 [6]:       3598.97 (36.00x)       100       0       0       0    56
    Core 2 [7]:       3598.51 (36.00x)      1.12    98.8       0       0    49
    Core 3 [8]:       3599.98 (36.01x)      1.94      98       0       0    45
    Core 4 [9]:       3598.97 (36.00x)       100       0       0       0    56
    Core 5 [10]:      3599.48 (36.01x)         1    99.9       0       0    48
    Core 6 [11]:      3600.12 (36.01x)      3.44    96.5       0       0    45

 C0 = Processor running without halting
 C1 = Processor running with halts (States >C0 are power saver)
 C3 = Cores running with PLL turned off and core cache turned off
 C6 = Everything in C3 + core state saved to last level cache
 Above values in table are in percentage over the last 1 sec
 [core-id] refers to core-id number in /proc/cpuinfo

A: First of all, there are techniques to maybe speed this up, but that won't necessarily solve jitter. Most speed optimizations also rely on asynchronous socket handling and are mainly of help when receiving data, less when sending data.
What might help is setting the TCP_NODELAY option. This will make sure packets are sent out as quickly as possible, by disabling the Nagle algorithm. Essentially the Nagle algorithm tries to append multiple TCP buffers in a single packet to maximize throughput at the cost of latency/jitter.
Also, remember that timing on such low resolution is tricky at best. Double check your timer resolution (clock_getres) and keep in mind that any system interrupt and process scheduling can affect timing. Your actual jitter might be better than what you time.

A: Can you try sched_setaffinity(2) on your networking thread?  If your code is single-threaded, it will be easier to use its wrapper taskset(1).

*

*CPU Affinity

*http://www.cyberciti.biz/faq/taskset-cpu-affinity-command/
Moreover, it would be best to boot Linux with the isolcpus parameter so that other irrelevant processes will not bother your experiment.

*

*https://askubuntu.com/questions/165075/how-to-get-isolcpus-kernel-parameter-working-with-precise-12-04-amd64
Update on C State
Is it possible that your CPU is sleeping too deeply (>= C3) ?

*

*http://feedsforyou.blogspot.com/2008/07/acpi-states.html
This tool might be helpful in monitoring the C state:

*

*https://code.google.com/p/i7z/
You might want to tweak the intel_idle.max_cstate kernel parameter or something similar, depending on your CPU and kernel version.

*

*Cf. How to set intel_idle.max_cstate=0 to disable c-states?


text:
Q: Object of class PrestaShopWebservice could not be converted to string Estoy consumiendo un webservice de una tienda de prestashop 1.7 en donde estoy extrayendo algunos datos, el tema aca es que estoy obteniendo un error en algunos casos y por una parte no entiendo bien el error, motivo por el cual no se bien como solucionarlo, el error es el siguiente:
[2022-10-26 19:32:01] local.ERROR: Object of class PrestaShopWebservice could not be converted to string {"exception":"[object] (Error(code: 0): Object of class PrestaShopWebservice could not be converted to string at D:\\WebApps\\sistema\\app\\Jobs\\syncCustomerDniPrestashop.php:61)
[stacktrace]

Tengo un job programado en Laravel como lo muestro en el siguiente codigo, para este caso tengo todos los id de los clientes, correspondiente a las de 76 mil registros, estos los paso por un foreach y los recorro, por cada id voy a un endpoint que contiene informacion de un cliente y traigo esa informacion, de momento de los 76 mil registros, solo he logrado obtener alrededor de 17 mil registros con la informacion completa, sin embargo en algun momento me arroja el error ya mencionado, Object of class PrestaShopWebservice could not be converted to string
<?php

namespace App\Jobs;

use App\Models\ApiLog;
use App\Models\Customer;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

use PrestaShopWebservice;
use PrestaShopWebserviceException;

class syncCustomerDniPrestashop implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public function handle()
    {
        $customerNumber = Customer::select('id', 'prestashop_id')
                                    ->orderBy('prestashop_id', 'ASC')
                                    ->get();

        foreach($customerNumber as $number) {
            try {
                $webService = new PrestaShopWebservice('https://mywebsite.cl/', 'apikey', false);
                // call to retrieve all customers
                $xml = $webService->get([
                    'resource' => 'addresses',
                    'filter[id_customer]' => $number->prestashop_id, // Here we use hard coded value but of course you could get this ID from a request parameter or anywhere else
                ]);
                $resources = $xml->addresses->children();
                    foreach($resources as $resource) {
                        $attributes = $resource->attributes();
                        $resourceId = $attributes['id'];
                        //dd($resourceId);
                        $neworder = Customer::updateOrCreate(
                            ['prestashop_id' => $number->prestashop_id],
                            ['id_address_prestashop' => $resourceId]
                        );
                    }
            } catch (PrestaShopWebserviceException $ex) {
                // Shows a message related to the error
                echo 'Other error: <br />' . $ex->getMessage();
                $neworder = ApiLog::Create(
                    [
                        'idendpoint' => $number->prestashop_id,
                        'endpoint' => 'Obteniendo direcciones completas, syncCustomerFromPrestashop',
                        'errordetails' => $ex->getMessage(),
                        'fechaerror' => now(),
                    ]
                );
            }
        }
    }
}

Frente a esto no se bien como obtener mas informacion al respecto o bien si hay alguna forma que pueda utilizar para resolver, una alternativa que estaba probando es hacer un casts en el modelo de Laravel,
    protected $casts = [
        'telephone' => 'string',
        'telephone_2' => 'string',
        'email' => 'string',
        'name' => 'string',
        'id_address_prestashop' => 'string',
        'dni' => 'string'
    ];

Alguna idea o algo que pueda corregir o agregar en mi codigo?


text:
Q: How to import/parse fxcop/stylecop generated xml reports in TeamCity Our team's build is run via command. It also generates fxcop and stylecop report xml files.
How to import/parse them into TeamCity?
There is a Build feature XML report processing - which one supports fxcop/stylecop? Is there a plugin for that maybe?

A: You can tell TeamCity to watch specific file location for FxCop reports. Just write the following service message to stdout (through, for example, echo command from cmd file):
##teamcity[importData type='FxCop' path='<PATH>']
where PATH is path where you expect report to appear during the build. TeamCity will watch PATH when it receives this service message until end of the build.
For more information please refer to this page in TeamCity documentation


text:
Q: How to specify language on Google Place API for iOS I'm using GMSAutocompleteViewController.
It can search address by input-form in Japanese.
And API display a lists written by Japanese.
But the name of the Place choosen is in English.
Please tell me how to specify a language on Google Place API for iOS.
func viewController(_ viewController: GMSAutocompleteViewController, didAutocompleteWith place: GMSPlace) {

    print(place)
    print("Place name: \(place.name)") //<- I want a Japanese,but English
    print("Place address: \(place.formattedAddress)")
    print("Place attributions: \(place.attributions)")
    self.dismiss(animated: true, completion: nil)
}


text:
Q: react-select createable option - adding group label I've created this cool sandbox that utilises react-select and the creatable feature. It allows you to select from a prepopulated dropdown and at the same time create a custom option by typing into the select field. Once you have typed into the field your option becomes available in the select list.
I have added in options to be grouped - pre-existing fields are fine, but new options I would like to be grouped by a default value e.g. "new group".
Any help would be appreciated.
https://codesandbox.io/s/p5x7m478rm
import React from "react";
import { Field, reduxForm, FieldArray } from "redux-form";
import TextField from "material-ui/TextField";
import { RadioButton, RadioButtonGroup } from "material-ui/RadioButton";
import Checkbox from "material-ui/Checkbox";
import SelectField from "material-ui/SelectField";
import MenuItem from "material-ui/MenuItem";
import asyncValidate from "./asyncValidate";
import validate from "./validate";
import CreatableSelect from "react-select/lib/Creatable";
const CustomStyle = {
  option: (base, state) => ({
    ...base,
    display: "inline",
    marginRight: "10px",
    backgroundColor: state.isSelected ? "#00285C" : "#eee",
    cursor: "pointer"
  }),
  menuList: () => ({
    padding: 10,
    display: "inline-flex"
  }),
  menu: () => ({
    position: "relative"
  })
};

const createOption = (label: string) => ({
  label,
  value: label.toLowerCase().replace(/\W/g, "")
});

const formatGroupLabel = data => (

    {data.label}

);

class LastNameSelectInput extends React.Component {
  constructor(props) {
    super(props);
  }

  state = {
    value: this.props.options[0].options,
    options: this.props.options
  };
  handleCreate = input => (inputValue: any) => {
    this.setState({ isLoading: true });
    setTimeout(() => {
      const { options, value } = this.state;
      const newOption = createOption(inputValue);
      this.setState({
        isLoading: false,
        options: [...options, newOption],
        value: newOption,
        formatGroupLabel: "new label"
      });
      input.onChange(newOption);
    }, 1000);
  };

  isValidNewOption = (inputValue, selectValue, selectOptions) => {
    if (
      inputValue.trim().length === 0 ||
      selectOptions.find(option => option.name === inputValue)
    ) {
      return false;
    }
    return true;
  };

  render() {
    const { input, options } = this.props;
    return (

        <CreatableSelect
          classNamePrefix="react-select"
          options={this.state.options}
          menuIsOpen={true}
          onChange={value => {
            let newValue = input.onChange(value);
            this.setState({ value: newValue });
          }}
          onBlur={() => input.onBlur(input.value)}
          onCreateOption={this.handleCreate(input)}
          value={this.state.value}
          styles={CustomStyle}
          isClearable
          isValidNewOption={this.isValidNewOption}
          formatGroupLabel={formatGroupLabel}
        />

    );
  }
}

const MaterialUiForm = props => {
  const { handleSubmit, options, pristine, reset, submitting } = props;

  return (
    <form onSubmit={handleSubmit}>

        <Field name="option" component={LastNameSelectInput} {...props} />

    </form>
  );
};

export default reduxForm({
  form: "MaterialUiForm", // a unique identifier for this form
  validate,
  asyncValidate
})(MaterialUiForm);

A: To achieve your goal I have changed the function handleCreate you have provided and the options props. You can see a live example here.
In MaterialUiForm.js
handleCreate = input => (inputValue: any) => {
this.setState({ isLoading: true });
setTimeout(() => {
  const { options } = this.state;
  const newOption = createOption(inputValue);
  options.map(option => {
    if (option.label === "New group") {
      return {
        label: option.label,
        options: option.options.push(newOption)
      };
    }
    return option;
  });
  this.setState({
    isLoading: false,
    options: [...options],
    value: newOption,
    formatGroupLabel: "new label"
  });
  input.onChange(newOption);
}, 1000);

In index.js
<MaterialUiForm
      onSubmit={showResults}
      initialValues={{
        option: colourOptions,
        option: flavourOptions
      }}
      options={[
        {
          label: "New group",
          options: []
        },
        {
          label: "Colours",
          options: colourOptions
        },
        {
          label: "Flavours",
          options: flavourOptions
        }
      ]}
    />

There is different and probably smarter way to do it but the logic is the good one.


text:
Q: magento2 ko issue in cart-items.js I try to classify the items by type in checkout order summary.
I added the classifyItems function in cart-items.js
    classifyItems: function()  {
        var ItemsTab=[];
        var Items = this.getItems();
        for(var key in Items) {
            var itemType=Items[key].product_type;
            if (typeof ItemsTab[itemType] === 'undefined') {ItemsTab[itemType]=[];}
            ItemsTab[itemType][key]=Items[key];
        }
        console.log('classified items');
        console.log(ItemsTab);
        return ItemsTab;
    }

when I do in cart-items.html

the different product types are displayed, but when I want to go further :

I have got an error : classifyItems is not defined
Thank you for your help,

A: If you use foreach, then new scope will be created.
Acoording ko.js documentation:
You can use $parent to refer to data from outside the foreach, e.g.

         likes the blog post

In your case:

But you can use already exist item instead of reloading of classifyItems()


text:
Q: How do I add new items to a cart and iterate through them to display using php? I am trying to pass data from a product page into a shopping cart page using an array.  There are multiple attributes that the viewcart.php will receive from the previous page (price, link, title, and retailer). I'd like to save them all using an array.  For each additional item a customer adds to the shopping cart, I'm trying to get a counter variable ($i) to increment an array $_SESSION['cart'][$i]['attribute'].  How do I do this?
I'm not sure this is the right way to add new products to the cart.  In the end, I'd like a way to be able to display all the products in the cart using a for loop.  This is the start I have so far on the shopping cart script:
<?php

  // The shopping cart needs sessions, so start one
  session_start();

  @$link = $_GET['link'];
$price = $_GET['price'];
$title = $_GET['title'];
$retailer = $_GET['retailer'];

  if($link) {
    //new item selected
    if(!isset($_SESSION['cart'])) {
      $_SESSION['cart'] = array();
      $_SESSION['items'] = 0;
      $_SESSION['total_price'] ='0.00';
    }

    if(isset($_SESSION['cart'][$link])) {
      $_SESSION['cart'][$link]++;
    } else {
      $_SESSION['cart'][$link] = 1;
    }

  }

  if(($_SESSION['cart']) && (array_count_values($_SESSION['cart']))) {
    echo " in your cart and we're working to display them";
  }
  else {
    echo "
There are no items in your cart

";
  }

?>

This is the for loop that I'm thinking I could use.  I'm looking for some way to display all the items in the array.
for ($x=0; $x<=$i; $i++)
  {
  echo "The price is " . $_SESSION['cart'][$x][price] . "  Retailer is " . $_SESSION['cart'][$x]    [retailer] . "
";
  }

A: You could:
Have another session variable with the counter and increment it each add?
Or
$i= Count($_SESSION['cart'])+1;

Or
Don't specify an index at all:
$tmp["cart"]["retailer"] = "123";
Etc etc..
$_SESSION['cart'][] = $tmp["cart"];
I would be storing the products into a database if I was you..

A: The easiest way to do this is by creating a temp_cart table in your database.. in which you should store the items that user adds to their cart.. Then on checkout page.. you can simply display them using select query. In that way.. it will be easier for you to allow the user to edit their cart on viewcart.php page.

A: I don't like the way you are doing this. Session management is very simple for shopping carts. Keep your session as lite as possible. Storing price in the session is very bad way, as it can be easily manipulated.
Here is a simple example of what you can use.
if(isset($_SESSION['items'][$_GET['item_id']])) {
    $_SESSION['items'][$_GET['item_id']]++; //add one to the total count
} else {
    $_SESSION['items'][$_GET['item_id']] = 1; //If added for the first time
}

Now process it
foreach($_SESSION['items'] as $id => $count) {
     echo $id; // product id
     echo $count; // product count
}

P.S: Remember to sanitize the input. I have omitted that


text:
Q: Error 404 on new module installation in magento 1.9 and fixing it by logout I am working in magento 1.9 . I developed new module , when i install it in new instance , it gave Error 404 .
If i Logout, it fix the issue but i want to fix the issue via code . So i try to write a logout code in setup script , but no luck with it . My code looks like
 public function expireAdminSession() {
    // loguot code
     $adminSession = Mage::getSingleton('admin/session');
     $adminSession->unsetAll();
     $adminSession->getCookie()->delete($adminSession->getSessionName());
}

I have called that function in construct. .
Any body please help or tell me any other solution to logout via code .
Thank you in advance .

A: I think it's default behaviour of Magento after installing any custom module to instance.
You have to follow proper steps in order to avoid this. (In short its not bug It's feature of Magento).

*

*Copy necessary files to server.

*Than after completion uploading go to configuration and refresh cache and flush cache.

*Logout of admin and re-login to admin panel.

Now, You are ready to go with your custom module.
Note : It's not my personal thinking. You will find above instruction in most of the premium Magento Partner's Module Installation Guide.


text:
Q: Calculate the average without including last score How can I calculate the average without including the last game. I don't want to include the last game as to end the loop the user needs to input -1. So, when the user types -1 this game is being included into the average, when it shouldn't be as this to end the game, not actual points. Is there a way around this?
while (points != -1)
{
total = total + points;
game++;
cout << "Enter the points for game " << game << ": ";
cin >> points;
average = total / game;
}

cout << "\nThe total points are " << total << endl;
cout << "\n The average points are " << average << endl;
system("PAUSE");
return 0;
}

A: It's a bit hard to tell exactly what you want, partly based on description and the missing code. I'm assuming that -1 means "stop the loop"
Here is what I think you're looking for:
game = 0;
total = 0;

while (1) {
    ++game;
    cout << "Enter the points for game " << game << ": ";
    cin >> points;

    if (points == -1)
        break;

    total = total + points;
}

game -= 1;

if (game > 0)
    average = total / game;
else
    average = 0;

cout << "\nThe total points are " << total << endl;
cout << "\n The average points are " << average << endl;
system("PAUSE");
return 0;

A: You can just test your points before you divide the total and decrement if it's -1 this way:
while (points != -1)
{
total = total + points;
game++;
cout << "Enter the points for game " << game << ": ";
cin >> points;
if(points==-1){
game--;}
average = total / game;
}

cout << "\nThe total points are " << total << endl;
cout << "\n The average points are " << average << endl;
system("PAUSE");
return 0;
}

A: while (points != -1) // <--3
{
total = total + points;
game++;
cout << "Enter the points for game " << game << ": "; // <--1
cin >> points;
average = total / game; // <--2
}

I marked the order of operations. The problem is that you're adding points to be averaged after checking for '-1'.
while (temp != -1)
{
    total = total + points;
    cout << "Enter the points for game " << game << ": ";
    cin >> temp;
    if(temp != -1)
    {
        game++;
        points = temp;
        average = total / game;
    }
}

I added a variable to temporarily hold the input value to be checked before modifying the primary variables to be averaged.


text:
Q: Hadoop resource manager jdk 8 dependency When I am trying to create a single cluster Hadoop environment, I cannot load the Node Manager or Resource Manager. From the log I get the error:
Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource
Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource
  at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
  at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
  at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

... 83 more

I gather this is from a dependency on javax.activation from JDK8. The only online solution I could find involved changing these two lines in the yarn-env.sh file in the usr/local/Cellar/hadoop/{version}/libexec/etc/hadoop folder:
export YARN_RESOURCEMANAGER_OPTS="--add-modules=ALL-SYSTEM"

export YARN_NODEMANAGER_OPTS="--add-modules=ALL-SYSTEM"

This did not work and I continue to get the same error in the log when trying to run the YARN manager. Can anyone advise as to how to get around this dependency?
Environment:
Mac OS Catalina 10.15.2
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
Apache Hadoop 2.10.0

A: You can set JAVA_HOME variable in hadoop-env.sh to the location of a Java 8 installation, then it should start okay
Alternatively, use Docker or a pre-built quickstart VM such as those from Cloudera


text:
Q: Shortest meeting point of two paths
Explanation :
In the example picture above there is a green circle following an arbitrary path.
I want the red circle to meet the green circle in the minimum steps possible as demonstrated in the picture.
The circles can move to any of the 8 adjacent cells in one step and black cells can't be traversed.
The paths are represented as a list of coordinates. In this case, the green path
is [(0,3),(0,2),(0,1)...(5,0)].
To find the shortest meeting point I can iterate though each coordinate in the green path list and use the A* algorithm to find the shortest path from the red circle to that coordinate. If the length of the path returned is equal to the number of steps it takes the green circle to get to that coordinate, then the shortest meeting point path is found.
This is of course, a brute force approach and the java code looks something like this:
List<Coord> minMeetingPointPath(Coord redLoc, List<Coord> greenPath) {
    for (int step = 0; step < greenPath.size(); step++) {
        Coord greenLoc = greenPath.get(step);
        List<Coord> redPath = shortestPathAStar(redLoc, greenLoc);
        if (redPath.size() == step)
            return redPath;
    }
    return null;
}

Question
So my question is:

*

*Is there a more efficient way to solve this problem without using a brute force approach?

A: I have 2 ways you could make it more efficient
1) start with the goal.
  start with the green ball. Find (and keep track of) the shortest path from the green position to the red node position. This on it's own will not reduce the search but if you limit the depth of the search to the move number (ie move 0 search to depth of 0 move 1 search to a depth of 1 ... move n search to a depth of n) it will reduce the time you spend searching since you will only be searching to the relevant depth, anything past that point is of no value and does not need to be checked.
2) Don't search at all if you don't need to. Give your search a seance of depth, you already have each node with an x,y positions of the start and finish so before you do your A* search check the move number and the straight line distance
For example: the shortest distance between 0,5 (green current position) and 0,0 (red start position) is 5 so if the green object is on move is move 4 or less you know there is no way to get there even if there is nothing blocking the way. however if it is move 5 or more you know there might a way to get to that location in time so it is worth searching to see how long the path actually takes.


text:
Q: Clock doesn't seem to tick I have been working on a program for class which acts as a stopwatch, but I've been having troubles where it doesn't work. (Only one digit, the first that would be shown on the four digit display is ever used, and it is always at 0.)
After putting the whole program through a simulation, and seeing it work correctly there, I can only come to the conclusion that the clock is never changing.
As I see it, these are the relevant parts of my code, but feel free to ask for more.
From the top module:
module stopwatch(
    [...]
    input clk,
    [...]
    );

From the User Constraint File:
 ## Clock signal
 NET "clk"   LOC = "E3" | IOSTANDARD = "LVCMOS33";                  #Bank = 35, Pin name = IO_L12P_T1_MRCC_35,                  Sch name = CLK100MHZ
 #NET "clk" TNM_NET = sys_clk_pin;
 #TIMESPEC TS_sys_clk_pin = PERIOD sys_clk_pin 100 MHz HIGH 50%;

I have four synthesis warnings.
 WARNING:HDLCompiler:413 - "C:\<REDACTED>\counter2bit.v" Line 31: Result of 3-bit expression is truncated to fit in 2-bit target.
 WARNING:HDLCompiler:462 - "C:\<REDACTED>\clock_divider_true.v" Line 42: if-condition does not match any sensitivity list edge
 WARNING:HDLCompiler:413 - "C:\<REDACTED>\count_10.v" Line 37: Result of 5-bit expression is truncated to fit in 4-bit target.
 WARNING:Xst:2677 - Node <decimal_counter/count3/En_next> of sequential type is unconnected in block <stopwatch>.

In counter2bit.v, the truncation is intentional, so long as it's shaving off the MSB; I don't want the third bit anyway. The if condition doesn't match any sensitivity list edge by design; I don't want it updating when that variable does. The truncated 5-bit expression should never happen because it resets when it updates and the value is 4'd9. count3 is the last block in the counter, and I am not planning on using the En_next to enable another counter.

A: What you should do is make a bit of really simple test code to blink an LED at around 1 Hz.  If that works, then the clock is working.  This code can be incredibly simple:
module test(input wire clk, output led)

reg [31:0] cnt = 50000000;
reg led = 0;

always @(posedge clk) begin
    if (cnt > 0) begin
        cnt <= cnt - 1;
    end else begin
        cnt <= 50000000;
        led <= ~led;
    end
end

endmodule

If you can get that to blink and LED, then there must be some other issue with your code.
Also, you should really make sure to specify the clock frequency in the UCF file to make sure that the tools will optimize your design correctly for the required clock frequency.


text:
Q: Android 4.0+ Error in Reading APN for sending an MMS java.lang.SecurityException: No permission to write APN settings: Neither user 10099 nor   current process has android.permission.WRITE_APN_SETTINGS.

What is the reason for getting this error when compiling the code of sending MMS? Why can't I read APNs in Android 4.0 and up?

A: I am directly copied the answer from here which is given by CommonsWare.
This appears to be an intentional change. The git commit where they added this defense includes the following comment:
 Since the DB may contain corp passwords, we should secure it. Using the same permission as writing to the DB as the read is potentially as damaging as a write.

It is conceivable that your issue will cause them to consider adding a separate read permission, but at least for the time being, this is a regression in 4.2.


text:
Q: Azure Devops and yaml pipelines creation How to create Azure devops yaml Pipleine.I'm currently trying to create multiple build pipelines for my Angular app in Azure DevOps using the new YAML way. … As far as I can tell from the docs it is not possible to define multiple pipelines in a single .yml file either. Is this scenario currently not supported in Azure DevOps

A: To create a pipeline, the simplified steps are ...

*

*Go to the project you want to create the pipeline in

*Go to the 'Pipelines' menu

*Click the blue 'New pipeline' button on the top right corner

*Follow the wizard that will help you set up your YAML pipeline

You can also read Create your first pipeline
As far as multiple pipelines in one .yml file: no, you define one pipeline in one yaml file. But that doesn't mean you cannot have multiple stages in one pipeline.

A stage is a logical boundary in the pipeline. It can be used to mark separation of concerns (for example, Build, QA, and production). Each stage contains one or more jobs. When you define multiple stages in a pipeline, by default, they run one after the other. You can specify the conditions for when a stage runs. When you are thinking about whether you need a stage, ask yourself:

*

*Do separate groups manage different parts of this pipeline? For example, you could have a test manager that manages the jobs that relate to testing and a different manager that manages jobs related to production deployment. In this case, it makes sense to have separate stages for testing and production.

*Is there a set of approvals that are connected to a specific job or set of jobs? If so, you can use stages to break your jobs into logical groups that require approvals.

*Are there jobs that need to run a long time? If you have part of your pipeline that will have an extended run time, it makes sense to divide them into their own stage.

and

You can organize pipeline jobs into stages. Stages are the major divisions in a pipeline: "build this app", "run these tests", and "deploy to pre-production" are good examples of stages. They are logical boundaries in your pipeline where you can pause the pipeline and perform various checks.

Source for the last snippet and an interesting read: Add stages, dependencies, & conditions.


text:
Q: How to upload (post) a video to Facebook using an Android app? Trying to have a simple video upload app, found this answer which eclipse says many of the functions there are deprecated.
https://stackoverflow.com/a/6924732/1525654
I'm using the latest Facebook SDK (version 3.16).
Is there a simple example for taking a video from the SD card and post it onto a Facebook's wall ?

A: Here's what I did.
First your callback,
private Request.Callback requestCallback = new Request.Callback() {

        @Override
        public void onCompleted(Response response) {
            if(response.getError() == null) {
                Toast.makeText(YourActivity.this, "Posted to Facebook.", Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(YourActivity.this, "Post to Facebook failed.", Toast.LENGTH_SHORT).show();
            }
        }
    };

Then, see if you have the publish_actions permission already,
private boolean isSubsetOf(Collection<String> subset, Collection<String> superset) {
        for(String string : subset) {
            if(!superset.contains(string)) {
                return false;
            }
        }

        return true;
    }

Then put this method inside your onClick() method
public void uploadVideoToFb(String caption) {
        // Get Facebook's active session.
        Session session = Session.getActiveSession();

        /*
         * Check published permissions first.
         */
        List<String> permissionList = session.getPermissions();
        if(!isSubsetOf(FacebookFragment.PERMISSIONS, permissionList)) {
            /*pendingPublishReauthorization = true;*/
            /*
             * Set additional permission requests to be able
             * to publish on the Facebook feed.
             * Inside PERMISSIONS is just "publish_actions".
             */
            Session.NewPermissionsRequest newPermissionRequest = new Session.NewPermissionsRequest(this, FacebookFragment.PERMISSIONS);
            session.requestNewPublishPermissions(newPermissionRequest);
            return;
        }

        new TaskDownloadAndPostToFb(this, caption).execute();

    }

Our publish_action permission,
public static final List<String> PERMISSIONS = Arrays.asList("publish_actions");

Then here's my AsyncTask,
@Override
    public void onPostExecute(Integer result) {
        String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath() + filename;
        File videoFile = new File(baseDir);
        if(videoFile.exists()) {
            Session session = Session.getActiveSession();
            if(session != null) {
                try {
                    Request request = Request.newUploadVideoRequest(session, videoFileLocal, requestCallback);
                    /*
                     * Take note of where to get the reference
                     of your bundle, it should always be
                     request.getParameters()
                     */
                    Bundle params = request.getParameters();
                    params.putString("description", this.caption);
                    request.setParameters(params);

                    request.executeAsync();

                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
            }

        } else {
            Log.i(TAG, "Video not found.");
        }

    }

Also, I have edited a lot of my code, of course, for security reasons. Let me know if something is lacking and broken.
I'm using Facebook's latest SDK 3.17 as of August 7, 2014


text:
Q: How to use Java LZO Library? I am trying to use LZO Compression Decompression Library in my Java Program but I could not find a single example how to use it for compression and decompression of data.How to write main function so that it would work as entry point for my code.
I visited from (Java LZO compression library), but I did not gotten any reference.
I am implementing github code from Here:
When I compile this above github code in Eclipse then Error occurred.
example:selection does not contain main type


text:
Q: How to write Unit Test for manager running dao? I'm having a simple test design problem, which I would like to solve once and for all.
I'm pretty used to regular Java design pattern where there is some Manager interface (or facade)  and a set of DAO interfaces. Concrete implementation of ManagerImpl is using concrete implementations of DaoImpl.
Right now I'm at the point of implementation, where I don't have a database connected to my project yet, so I guess this is a perfect time to write proper unit tests without DB :-)
I was able to mock some methods of my manager by using mockito, but since the Test Under Method (or so called System Under Test) is using DAO internally, I would have to mock the DAO as well. Unfortunately I cannot do that without setting concrete DAO implementation in my manager, like myManager.setMyDao(mockedDao), but now I would have to pull out this setMyDao method into interface, which of course breaks encapsulation and makes my clean and perfect interfaces look like garbage.
So the question is: How to mock DAO in tests while preserving clean Manager-Dao architecture?

A: You should unit test concrete implementations, i.e. ManagerImplTest, which will explicitly create ManagerImpl and therefore you have all setMyDao methods available for mocks. Your test will not know about Manager interface.
BTW, it is not always necessary to create interfaces for everything. In most cases only single implementation of managers and daos will exist. If there is no any other strong reason (e.g. Spring AOP proxies or dependency separations), I guess it's better don't create interfaces for everything in sake of simplicity.

A: You can get rid of set methods altogether and inject factory. This way no extra method is exposed (in fact, no extra method even exists) and problem disappears. Then in test you configure factory mock to return DAO mocks and from that point on it's plain and simple.


text:
Q: A multiple choice question concerning first order linear differential equations Consider the initial value problem $$y'(t)=f(t)y(t)$$ with $y(0)=1$ where $f:\mathbb{R}\rightarrow \mathbb{R}$ is a  continuous function.
Then this initial value problem has
(1) Infinitely many solutions for some $f$
(2)a unique solution in $\mathbb{R}$
(3) no solution in $\mathbb{R}$ for some $f$
(4) a solution in an interval containing $0$, but not on $\mathbb{R}$ for some $f$
My efforts
$$\frac{dy(t)}{y(t)} = f(t)dt$$
$$\log y(t) = \int_0^tf(t)dt +C$$
Now at $t=0$ $y=1$ so we get
$$0=0+C$$
So $$y(t)=\exp(\int_0^tf(t)dt)$$
So either $2$ is true or $4$ is true? I am not able to go further from here. What logic should I use now
Edit:
Since $\int_{0}^{t} f$ is continuous and $e^x$ is continuous and composition of continuous function is continuous so $2$ is true. Is this a correct way of thinking?

A: I think the correct choice is (2) and only (2).
I reason as follows:
For $f(t) \in C(\Bbb R, \Bbb R)$, consider the function
$F_f: \Bbb R \times \Bbb R \to \Bbb R, \; F_f(y, t) = yf(t); \tag 1$
then $F_f(y, t)$ is (a.) jointly continuous in $y$ and $t$, and (b.) (locally in $t$) Lipschitz continuous in $y$.
To see (a.), note that $F_f(y, t) = yf(t)$ is the product of the two continuous functions $y: \Bbb R \to \Bbb R$ and $f: \Bbb R \to \Bbb R$, and that multiplication is itself continuous from $\Bbb R \times \Bbb R \to \Bbb R$.
As for (b.), we have, for $y, z, t \in \Bbb R$,
$\vert F(z, t) - F(y, t) \vert = \vert zf(t) - yf(t) \vert = \vert(z - y)f(t) \vert = \vert z - y \vert \vert f(t) \vert; \tag 2$
now since $f: \Bbb R \to \Bbb R$ is continuous, in any closed interval $I_{t_0}$ about any $t_0 \in \Bbb R$, $f(t)$ is bounded there; thus, there is a neighborhood $J_{t_0} \subset I_{t_0}$ of $t_0$ and a constant $L_J > 0$ such that
$\vert f(t) \vert < L_J, \; t \in J_{t_0}; \tag 3$
thus for $z, y \in \Bbb R$ and $t \in J$ we have
$\vert F(z, t) - F(y, t) \vert < L_J \vert z - y \vert, \tag 4$
which shows that $F(y, t)$ is Lipschitz continuous on some interval $J_{t_0}$ containing $t_0$; thus, by the Picard-Lindeloef theorem the exists a unique solution to our differential equation
$\dot y = F(y, t) = f(t)y, \; y(t_0) = y_0, \tag 5$
on some interval $(t_0 - \epsilon, t_0 + \epsilon)$ containing $t_0$; furthermore, since this is true for any $t_0$, such integral curves may be maximally extended to all of $\Bbb R$ and thus we see there exists a unique, global solution passing through any $(y_0, t_0) \in \Bbb R \times \Bbb R$; since this is true for any $f(t) \in C(\Bbb R, \Bbb R)$, we may rule out possibilities (1) and (3) in our OP Stammering Mathematician's list.  Similarly, we may eliminate item (4) from consideration since, as we have seen, there is a solution for every $f$ in an interval about any $t_0$, $t_0 = 0$ included.
So, (2) is true and only (2) is true.
The particularly simple form of $F(y, t) = f(t)y$ in fact makes it possible to verify the above results in an immediate, practical way without resorting to the theoretial arguments presented above; indeed, if
$y(t_0) = y_0 \ne 0 \tag 6$
for some $t_0 \in \Bbb R$, then in a neighborhood of $t_0$ we have
$\dfrac{\dot y(t)}{y(t)} = f(t), \tag 7$
whence
$\dfrac{d\ln y(t)}{dt} = f(t), \tag 8$
so that
$\ln \left (\dfrac{y(t)}{y(t_0)} \right ) = \ln y(t) - \ln y(t_0) = \displaystyle \int_{t_0}^t \dfrac{d\ln y(s)}{ds} \; ds = \int_{t_0}^t f(s) \; ds, \tag 9$
and so
$y(t) = y(t_0) \exp \left (\displaystyle \int_{t_0}^t f(s) \; ds \right ). \tag{10}$
The solution (10) is easily seen to be valid, unique, and to extend to all $\Bbb R$, and binds as long as $y(t_0) \ne 0$ for some $t_0 \in \Bbb R$; the only other alternative is $y(t) = 0$ everywhere, which is also seen to be a unique global solution.
Finally, if we choose with our OP
$y(0) = 1, \tag{11}$
we find the unique global solution to be
$y(t) = \exp \left ( \displaystyle \int_0^t f(s) \; ds \right ), \tag{12}$
in accord with our previous calculations.

A: You are correct. Since the integral, $\int _0^t f(t)dt $ exists for all t, you have a solution for all t.


text:
Q: Looking for AspectJ Parser I am looking for a parser that gives me information of an AspectJ source file. Information like defined pointcuts, advices, ....
I searched on Google for some time, but didn't find anything usefull. It seems to be possible to use the parser that is included in the AspectJ compiler, but I couldnt find any information on how to use it.
The most promising thing I found are that unit tests: http://eclipsesourcecode.appspot.com/jsrcs/org.eclipse.ajdt/AJDT_src/org.eclipse.ajdt.core.tests/src/org/eclipse/ajdt/core/tests/javaelements/AspectElementTests.java.html
These tests test exactly what I want to do, but I couldnt find any information about the org.eclipse.ajdt.core.tests.javaelements.* classes that are used there.
Can someone help me?

A: You will need to access the AspectJ git repository.  It is available here:
http://git.eclipse.org/c/aspectj/org.aspectj.git/
In there, look for the org.aspectj.org.eclipse.jdt.internal.compiler.parser.Parser class.
This is the parser and only the parser.  If you are looking to do something like what AJDT is doing, this is far from enough.  You will have to start with org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.  But, there's still a lot of mucking around you'd need to to to find all the cross-cutting relationships.
THe nicest way to go about this is to create an eclipse plugin that calls into AJDT code.

A: I think the author mentioned recently that it is a hand-written parser so I suspect you will not find a different parser besides the one that is part of AspectJ/AJDT itself.
Since it is open source, your best bet is to look at the source code.
You might want to ask at the AspectJ mailing list https://dev.eclipse.org/mailman/listinfo/aspectj-users.

A: There is also AspectBench Compiler (abc) for AspectJ.


text:
Q: Morphsim from F_p[[X_1,...,X_d]]. Let f: F_p[[X_1,...,X_d]] --->> R be a surjection from a power series ring. Also assume that there is another surjection g: F_p[[Y_1,...,Y_d]] --->> R to the same local ring R.
Question: Is it possible to find an isomorphism h: F_p[[X_1,...,X_d]] \cong F_p[[Y_1,...,Y_d]] such that f = g \circ h ?
Namely we make the morphism commutative with respect to given morphisms f and g.
Please teach me. Many thanks.
Pierre MATSUMI@gmail.com

A: I think this is possible (over any base field $k$, not just $\mathbb{F}_p$). You can rephrase your question to ask: if an isomorphism $\phi: k[[x_1, \dots, x_d]]/I \to k[[y_1, \dots, y_d]]/J$ is specified, when can it be lifted to an isomorphism $k[[x_1, \dots, x_d]] \to k[y_1 , \dots, y_d]]$? Or even further, if you're given a surjection $$\pi: A = k[[x_1, \dots, x_d]] \to k[[y_1, \dots, y_d]]/J = B,$$ when does it come from an isomorphism $$\widetilde{\pi} : A \to C = k[[y_1, \dots, y_d]]?$$ Perhaps this follows from some "formal" properties, but in any case it's not a difficult exercise. You work with the map on tangent spaces
$$
\overline{\pi} : {\frak{m}}_A/{\frak{m}}_A^2 \to {\frak{m}}_B/ {\frak{m}}_B^2 \cong {\frak{m}}_C/ (J \cap {\frak{m}}_C + {\frak{m}}_C^2)
$$
 which must be surjective. So you just have to extend it to an isomorphism of the $d$-dimensional vector spaces, by choosing an isomorphism of $K = \mathrm{ker}(\overline{\pi})$ with $(J \cap {\frak{m}}_C + {\frak{m}}_C^2)/ {\frak{m}}_C^2$, and then it will automatically induce an isomorphism $\widetilde{\pi}$.


text:
Q: chrome app window.open() cannot be closed later I'm building a chrome-app and I need to open new tab and close it later on, here is a simplify version of my code:
open(url) {
    this.tab = window.open(url);
}

close() {
    this.tab.close();
}

The open method works, but when I try to close, chrome thinks that the tab is already closed and just do nothing (there is no exception or something like that)
The exact same code works perfectly on web (tab is opened and then closed).
Tried to use chrome.app.window.create but it only allows local windows.
Is there any limitation that i'm not aware of?
Do I have any other solution besides building a chrome extension as well?

A: To get the tab that is selected in the specified window, use  'chrome.tabs.query()' with the argument {'active': true}, then close it with  'chrome.tabs.remove().
chrome.tabs.query({ currentWindow: true, active: true }, function     (tabs) {
chrome.tabs.remove(tab.id, function() { });
});


text:
Q: Where can I find zsh man pages? I installed the packages zsh and zsh-doc, but when I type man zsh, I get no manual entry for zsh. Where can I find zsh docs?

A: You can find the docs in /usr/share/doc/zsh-common. I suspect if you also install zsh-common, you will also find the man pages.
ZSH(1)                      General Commands Manual                     ZSH(1)

NAME
       zsh - the Z shell

OVERVIEW
       Because  zsh contains many features, the zsh manual has been split into
       a number of sections:

       zsh          Zsh overview (this section)
       zshroadmap   Informal introduction to the manual
       zshmisc      Anything not fitting into the other sections
<snip>

It appears to be a bug: https://bugs.launchpad.net/ubuntu/+source/zsh/+bug/1242108 Posts #21 and 22 suggest work-arounds. It is apparently fixed for Ubuntu 14.10 as it works perfectly on my system.


text:
Q: How to send the time series data generated using jmeter[Docker Container] script to influxdb[Not a Docker instance] in K8S Following is the Dockerfile of my jmeter container
FROM java:8-jdk

ARG JMETER_VERSION="3.3"
ENV JMETER_HOME /opt/apache-jmeter-${JMETER_VERSION}
ENV JMETER_BIN  ${JMETER_HOME}/bin
ENV JMETER_DOWNLOAD_URL  https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_VERSION}.tgz

# download and extract JMeter
RUN mkdir /tmp/dependencies
RUN curl -L --silent ${JMETER_DOWNLOAD_URL} > /tmp/dependencies/apache-jmeter-${JMETER_VERSION}.tgz

RUN tar -xzf /tmp/dependencies/apache-jmeter-${JMETER_VERSION}.tgz -C /opt && \
    rm -rf /tmp/dependencies

# Set global PATH such that "jmeter" command is found
ENV PATH $PATH:$JMETER_BIN

COPY plugins/lib/*.jar ${JMETER_HOME}/lib/
COPY plugins/lib/ext/*.jar ${JMETER_HOME}/lib/ext/
COPY jmeter.sh ${JMETER_HOME}/bin/

COPY entrypoint.sh /

WORKDIR ${JMETER_HOME}

ENTRYPOINT ["/entrypoint.sh"]

I trigger the build via Jenkins where I have parameterized the scenarios, environment, threads etc.
My script has influxdb endpoints where the time series data will be sent which will be later showed in grafana.
It worked well when I had set up following docker container services locally ,individually and creating a network of it.

*

*Jenkins

*Jmeter

*InfluxDB

*Grafana

Now, in real-world I have to deal with only one Docker container Jmeter. At this point in time, I am not sure how can I do volume mapping with Jmeter container and InfluxDB which is not the container but aws instance. How will I send the data to it?
Help would be gladly appreciated. Thank you

A: You can use telegraf
https://www.influxdata.com/time-series-platform/telegraf/
it offers you a variety of input plugins you can combine from different sources and integrations
https://www.influxdata.com/products/integrations/

A: Now, in real-world I have to deal with only one Docker container Jmeter

based on this assumption, the only thing that actually changes from your container's perspective is the endpoint of InfluxDB, which is still configurable*.
In K8S world, if you want to access services living outside of the cluster (e.g. InfluxDB running on AWS instance) you need to map them to the cluster network via concept of Service without the selectors.
* endpoint from the link I shared would have a name 'my-service:80' (yes, that's it)


text:
Q: Swap every two bits of an unknown variable type I need to swap every two adjacent bits as a generic operation which will do so for every variable type given.
I thought of the needed masks and operations for every single byte:
(var & 0x55) << 1 | (var & 0xAA) >> 1

But how do I make this apply for let's say an integer?
Do I need to create an array of sizeof(int) unsigned chars with the above masks and apply the operation that way?

A: You can do this byte by byte (the same as char by char).
For example:
int n = 0xAA55A55A;
unsigned char *p = (unsigned char *) &n;

for (; p < (unsigned char *) &n + sizeof(n); p++)
   *p = (*p & 0x55) << 1 | (*p & 0xAA) >> 1;

A: Two suggestions:
Instead of using the logic operations, you can use a look up table of 256 chars.:
char lookUpTable[256] = {0x00, 0x02, 0x01 ...};

If you dont want to initialize this lookup statically, you can write a function that initialize it using logic operations.
When you want to swap byte b, you either  simply write lookUpTable[b], or you wrap this with a function.
As for swapping any type, you write a function that does something like:
void SwapBits(char* data, size_t len)
{
    For (; len > 0; len--)
    {
        *data = lookUpTable[*data];
        data++;
    }
}

You then use this like this:
AnyType swapMe = whatever;
SwapBits((char*)(&swapMe), sizeof(AnyType));

Note this replaces the "contents" of swapMe.
One more thing, the right shift behavior is architecrure specific, some architectures may sign extend on right shift. It would be more generic to use an expression like:
SwappedByte = ((Byte >> 1)&0x55) | ((Byte << 1)&0xaa)

As this way you remove any sign extension artifacts.

A: Something like this. Cast the address of any variable to a char * and you can iterate over the bytes.
#include <stdio.h>

char swap_c(char);
void swap_r(char *, int);

int main(void) {
    char c = 10;
    c = swap_c(c);
    printf("%i\n", c);
    int i = 10;
    char * r = (char *) &i; //you can cast the address of any variable into a char *
    swap_r(r, sizeof(int));
    printf("%i\n", i);
}

void swap_r(char * c, int length) {
    int i = 0;
    while(i < length) {
        c[i] = swap_c(c[i]);
        i++;
    }
}

char swap_c(char c) {
    return (c & 0x55) << 1 | (c & 0xAA) >> 1;
}

//1010
//0101


text:
Q: How to define mongoDB database connection variable globally I have worked to node js + mysql. but now i am going to node js + mongoDB
I am in need to connect database and make a variable for globally use.
I am very much confused how we can define variable for globally use.
var mongodb = require('mongodb');
var MongoClient = mongodb.MongoClient;
var url = 'mongodb://localhost:27017/mydb';

MongoClient.connect(url, function (err, db) {
  if (err) {
    console.log('Unable to connect to the mongoDB server. Error:', err);
  } else {
    //HURRAY!! We are connected. :)
    console.log('Connection established to', url);

    // do some work here with the database.

    db.close();
  }
});


text:
Q: ldap query to find all computers in a security groups This is what I  try:
public List<string> GetUsersInGroup(string domain, string group)
{
   List<string> groupMemebers = new List<string>();
   DirectoryEntry entry = new DirectoryEntry("LDAP://" + domain);
   DirectorySearcher groupSearch = new DirectorySearcher(entry);
   groupSearch.Filter = "(&(objectclass=group)(samaccountname=" + group +"))";
   groupSearch.PropertiesToLoad.Add("DistinguishedName");
   SearchResult srG = groupSearch.FindOne();
   String DN = srG.Properties["DistinguishedName"][0].ToString();
   entry.RefreshCache(new string[] { "memberOf" });
   DirectorySearcher mySearcher = new DirectorySearcher(entry);
   mySearcher.Filter = "(|(&(objectClass=computer)(memberOf=" + DN + "))(&(objectClass=User)(memberOf=" + DN + ")))";

   SearchResultCollection srcg = mySearcher.FindAll();

   foreach (SearchResult resEnt in srcg)
   {
       groupMemebers.Add(resEnt.GetDirectoryEntry().Name.ToString());
   }

   return groupMemebers;
}

Edit:
It's good to find USERS belong the group but I can get the Computers (memberOF) the group if group is "Domain Computers" or "Domain Controllers" (primary Groups!).
Some one can help me?

A: The primary group of an object (user or computer) in AD is stored in a property called "primaryGroupID". For example, for users this is generally 513, which means that the primary group is "Domain Users".
The built-in groups (Domain Users, Domain Computers etc) have many members, and storing the membership in the usual way through the "member" property would cause performance issues. This is why you don't see "Domain Computers" in the memberof property.
Basically, if you want to find computers that are members of "Domain Computers", you must run the query
(&(objectClass=computer)(primaryGroupID=515))

Check How to use the PrimaryGroupID attribute to find the primary group for a user - this applies also to computers.
Also check Well-known security identifiers in Windows operating systems


text:
Q: PowerPoint in Latex Is it possible to make a powerpoint presentation but using LaTeX?
Can you give some useful advices to start with?
The presentation is about chemistry.

A: As Johannes_B well pointed, the editor that  doesn't matter at all. BTW, I used Gummi for this example (yet another LaTeX editor, available in Debian)
What really matter in your case (I guess)  is:
$ firefox https://www.ctan.org/pkg/lshort-spanish
$ texdoc beamer
$ texdoc chemfig
$ texdoc everything ...
$ firefox https://en.wikibooks.org/wiki/LaTeX/Mathematics
$ firefox https://www.ctan.org/topic/chemistry

To start with all this mess you need a example of presentation, not a programme. Here you are one with some maths and chemistry to start to play:

\documentclass{beamer}
\usetheme{Madrid}
\usepackage{chemfig}
\setbeamertemplate{navigation symbols}{} % si no los quiero
\setbeamersize{text margin left=2em,text margin right=2em}
\usepackage[utf8]{inputenc}

\title{Mi linda \\ presentación}
\author{Santiago Miranda}
\date{\today}
\begin{document}

\begin{frame}[plain]
\maketitle
\end{frame}

\begin{frame}[plain]
\tableofcontents
\end{frame}

\section{Matemáticas}

\begin{frame}{Una fórrmulas ...}{ ...sin sentido alguno}
Considerando que:
\vfill
\[\sum^j_i = \sqrt{\frac{(x-y)^\epsilon}{\log(\rho)}}  \]
\vfill
Y que \ldots

\[ P\left(A=2\middle|\frac{A^2}{B}>4\right) \]
\vfill
Está claro que no tengo ni idea de lo que he escrito.
\end{frame}

\section{Química}

\begin{frame}{Me sube la adrenalina}{(cuando uso Beamer)}
\centering
\chemfig{*6((-HO)-=-(-(<[::60]OH)-[::-60]-[::-60,,,2]
HN-[::+60]CH_3)=-(-HO)=)}
\end{frame}

\begin{frame}{Pero usando otras presentaciones}
{me sube el\ldots}
\centering
\setatomsep{2em}
\chemfig{[:30]R-(=[::+60]O)-[::-60]O-*6(--*6(=--*6(-*5(---(-(-[::+60]Me)
-[::-60]-[::-60]-[::+60]-[::-60](-[::-60]Me)-[::+60]Me)-)-(-[::+0]Me)---)--)-(-[::+0]Me)---)}
\vfill
\visible<2>{\alert{\huge COLESTEROL}}
\end{frame}
\end{document}


text:
Q: How to add google ads interstitial in PhoneGap? How to add the Google ads interstitial in my Phone Gap project.
Please send me link or example for reference.

A: See the following link and find the demo to add Interstitial ads in phone gap.
github.com/floatinghotpot/cordova-admob-pro


text:
Q: Is freeglut the standard OpenGL Window manager on Linux? I'm going to be porting a java OpenGL game engine that I wrote in Java to C on Linux.
My main question is what is the defacto Window management utility to use for OpenGL applications in Linux? Is it freeglut?
If freeglut isn't what is most commonly used; then what tends to be the most used?

A: There is no "defacto" OpenGL window management utility on any platform. FreeGLUT is commonly used, but that doesn't mean anything. What matters is what you use it for.
In general, FreeGLUT is not for "serious" applications. It's for self-contained demos, tutorials, and the like. While there are APIs to give you control over the main loop, the default API (the one that 99.9% of sample code will use) has FreeGLUT manage the main loop. For most games involving time pressure or animation of some kind, this is generally unacceptable.
You may be able to get your code working under FreeGLUT (though there's no reason it can't just be Java code either), or you may not. But also be advised that FreeGLUT doesn't have very good input routines (at least, not for games), and it has zero sound capabilities.


text:
Q: Count days in MATLAB I need to count X days starting on some specific day, but I don't know how to sum these days accosrding to the number of days on each month (e.g. February having 28 or 29, March 31 but April 30...).
I know there is the function daysact( startDate, endDate ), but this way I have to try dates until I reach the result I want, and what I need is for the program to count X days from the startDate and return the endDate. For example, if I want to count 90 days from tomorrow, I have done:
startDate = '8-jan-2016';
endDate = '7-apr-2016';
numDays = daysact( startDate, endDate );

but I have had to try dates until the function returned exactly 90 (I know it's fairly simple, but the final program will have to do this for different values of days and different starting dates...)

A: startDate = '8-jan-2016';
NumDays = 90;
tmp = datevec(startDate);
tmp(3)=tmp(3)+90;
endDate = datestr(tmp)

This uses datevec to transform your string into a vector of [Y M D HH MM SS], so by adding the desired number of days, 90, to the third element you add 90 days to the start date. Then transform the vector back using datestr, which makes it a recognisable date again.
As per @excaza's comment datenum does approximately the same thing, returning the number of days since 0 January 0000, so the same could be accomplished using:
startDate = '8-jan-2016';
NumDays = 90;
endDate = datestr(datenum(startDate)+NumDays);

which is a bit more concise, at the cost of having to convert everything to fractions of days.
One-lining it because why not:
endDate = datestr(datenum('8-jan-2016')+90);

A: 2014b and later:
datetime(2016,1,8) + days(90)
datetime(2016,1,8) + 90

datetime('today') + days(90)
datetime('today') + 90

datetime('tomorrow') + days(90)
datetime('tomorrow') + 90

A: I wanted to post this as an alternative.  It was mentioned by @excaza in a comment to @Adriaan's answer.
myDate = datenum(2016,1,8); % datenumber for january 8 2016
newDate = myDate + 90; % add 90 days
newDate2 = myDate + 2/24; % add 2 hours
newDate3 = myDate + 93/1440; % add 93 minutes

Then you can print the dates with datestr.
datestr(newDate)

ans =

07-Apr-2016

>> datestr(newDate2)

ans =

08-Jan-2016 02:00:00

>> datestr(newDate3)

ans =

08-Jan-2016 01:33:00

datenum can take many inputs and even user defined formats to read the date strings.


text:
Q: Showing a Plot3D and a StreamPlot on one Manipulated Graphic I'm trying to combine a Plot3D and a StreamPlot to one Manipulate Graphics diagram so that the StreamPlot appears on the $x-y$ axis. Was wondering how this could be done because my attempt does not work. This question is not a duplicate of an earlier post which was about a possible error that kept appearing. This is something completely different!
    Waves =
Plot3D[Re[
H + Amp*Exp[-y*Abs[f]/Sqrt[9.81*H]]*
Exp[I*(k*x - (Sqrt[9.81*H])*t)]],
{x, -80000, 80000},
{y, 0, 100000},
PlotPoints -> 30, MeshStyle -> None,
PlotStyle -> Directive[
Opacity[0.65], Blue, Specularity[LightBlue, 10]
]
];
VelocityDiagram =
Dynamic[
StreamPlot[{Sqrt[9.81/H]*
Re[Amp*Exp[-y*Abs[f]/Sqrt[9.81*H]]*
Exp[I*(k*x - (Sqrt[9.81*H])*t)]], 0},
{x, -80000, 80000},
{y, 0, 100000}
]
];
Manipulate[
Show[Waves, VelocityDiagram,
PlotRange -> {0, H + Amp},
BoxRatios -> {1, 1, .6}, FaceGrids -> {Back, Left}],
{{t, 0, "Time {s}"}, 0, 1000},
{{Amp, 20, "Wave Amplitude"}, 0, H},
{{k, 0, "Waves per Metre (x-direction)"}, 0, 0.0005},
{{H, 100, "Depth"}, 0, 500},
{{f, 0, "Coriolis Coefficient"}, -0.001, 0.001}
]`

A: In order to plot the StreamPlot on a plane with the z value at the origin let's first create an example.
sp = With[
  {
   t = 0,
   Amp = 20,
   k = 0,
   H = 100,
   f = 0
   },
  StreamPlot[{Sqrt[9.81/H]*
     Re[Amp*Exp[-y*Abs[f]/Sqrt[9.81*H]]*
       Exp[I*(k*x - (Sqrt[9.81*H])*t)]], 0},
    {x, -80000, 80000}, {y, 0, 100000}]
  ]

We can extract out a portion that contains arrows and it looks like this:
sp[[1, 2, 3, 3]]

(* {{Arrowheads[{{0.02, 1.}}],
  Arrow[{{54421.9, 81872.3}, {56855.8, 81872.3}, {59289.7,
     81872.3}, {60775.2, 81872.3}, {62260.7, 81872.3}, {63746.2,
     81872.3}, {65231.7, 81872.3}, {66717.2, 81872.3}, {67686.4,
     81872.3}}]}, {Arrowheads[{{0.0180664, 1.}}],
  Arrow[{{68018., 81872.3}, {68202.8, 81872.3}, {69688.3,
     81872.3}, {71173.8, 81872.3}, {72659.3, 81872.3}, {74144.8,
     81872.3}, {75630.3, 81872.3}, {77115.9, 81872.3}, {78601.4,
     81872.3}, {80000., 81872.3}}]}} *)

We will want to replace a two dimensional point contained within an Arrow with a three dimensional point that has a z value of 0. Here is a simple example:
Arrow[{{1, 2}, {3, 4}}] /.
 Arrow[point_] :> Arrow[Cases[point, {x_, y_} -> {x, y, 0}]]

(* Arrow[{{1, 2, 0}, {3, 4, 0}}] *)

and a slightly more challenging example in a nested list along with Arrowheads.
{
  {Arrowheads[{0.02, 1}],
   Arrow[{{1, 2}, {3, 4}}]}, {Arrowheads[{0.02, 1}],
   Arrow[{{5, 6}, {7, 8}}]}
  } /. Arrow[point_] :> Arrow[Cases[point, {x_, y_} -> {x, y, 0}]]

(* {{Arrowheads[{0.02, 1}],
  Arrow[{{1, 2, 0}, {3, 4, 0}}]}, {Arrowheads[{0.02, 1}],
  Arrow[{{5, 6, 0}, {7, 8, 0}}]}} *)

Now let's see if we can use Show and make a 3D plot of the 2D sp figure.
With[
 {
  t = 0,
  Amp = 20,
  k = 0.0001,
  H = 100,
  f = 0
  },
 Graphics3D[
  sp[[1]] /.
   Arrow[point_] :> Arrow[Cases[point, {x_, y_} -> {x, y, 0}]],
  PlotRange -> {0, H + Amp},
  BoxRatios -> {1, 1, .6},
  Axes -> True
  ]
 ]

Finally we use Manipulate in order to see the changes as the parameters change. Note that the Dynamic that was wrapping the StreamPlot is dropped as everything contained within Manipulate is already wrapped in Dynamic.
Manipulate[
 Show[
  Plot3D[
   Re[H +
     Amp*Exp[-y*Abs[f]/Sqrt[9.81*H]]*Exp[I*(k*x - (Sqrt[9.81*H])*t)]],
   {x, -80000, 80000},
   {y, 0, 100000},
   PlotPoints -> 30,
   MeshStyle -> None,
   PlotStyle -> Directive[
     Opacity[0.65],
     Blue,
     Specularity[LightBlue, 10]
     ],
   PlotRange -> {0, H + Amp},
   BoxRatios -> {1, 1, .6}
   ],
  Graphics3D[
   StreamPlot[{Sqrt[9.81/H]*
        Re[Amp*Exp[-y*Abs[f]/Sqrt[9.81*H]]*
          Exp[I*(k*x - (Sqrt[9.81*H])*t)]], 0}, {x, -80000,
       80000}, {y, 0, 100000}][[1]] /.
    Arrow[point_] :> Arrow[Cases[point, {x_, y_} -> {x, y, 0}]]
   ]
  ],
 {{t, 0, "Time {s}"}, 0, 1000},
 {{Amp, 20, "Wave Amplitude"}, 0, H},
 {{k, 0.0001, "Waves per Metre (x-direction)"}, 0, 0.0005},
 {{H, 100, "Depth"}, 0, 500},
 {{f, 0, "Coriolis Coefficient"}, -0.001, 0.001}
 ]


text:
Q: How do I make changes in base.css for WordPress I need to change an image background for some blog posts on a website using WordPress. I've tracked the element source to be located in the base.css. As far as I can tell I don't have direct access to edit the file, but I'm assuming that there is somewhere that I can modify it. I want to change the background style of the Testimonial posts on the Testimonials page. The element that I need to modify is testi-container's url image. Here is the website address. www.avantirecruiters.com
How can I change the style using CSS?

A: You do have class called body class called 'category-testimonials'
.category-testimonials .testi-container
for image you  can always use
.category-testimonials .testi-container{background:url('');}


text:
Q: shell variable not be replace with actually value try to get string from configuration file, e.g.
ORACLE_BASE=/a/b
while read line; do
    if [[ $line =~ ^ORACLE_HOME ]]; then
       ORACLE_HOME=`echo $line | sed -e 's/ORACLE_HOME=//g'`
       ORACLE_HOME=$ORACLE_HOME
       echo "ORACLE_HOME=$ORACLE_HOME"
    fi
done < ./conf/setupSM.conf

output like:

ORACLE_HOME=${ORACLE_BASE}/product/12.1.0/dbhome_1

But the expecting output should be:

ORACLE_HOME=/a/b/product/12.1.0/dbhome_1

but ${ORACLE_BASE} still not be replaced by the value, what should to do to make it work

A: There is only a single pass of variable interpolation. A variable containing another variable in its value will not be expanded.
In your limited scenario, you could consider using eval; or if it's just a single variable which may or may not be present, do the interpolation in your sed script:
ORACLE_HOME=`echo "$line" |
    sed -e 's/ORACLE_HOME=//' \
        -e "s/\${\?ORACLE_BASE}\?/$ORACLE_BASE/"`

Note that the /g flag serves no useful purpose here (it wuld only be useful if you needed to replace multiple occurrences on the same line) and the proper quoting of "$line". You should also consider using lowercase for your own variable names, to avoid having them clash with system variables.
The shell loop isn't really necessary or useful, either; I would refactor the sed script to loop over the entire file, and print only the last occurrence. This is not hard to do in sed, either, but I'd go with Awk, which is slightly less of a write-only language.
ORACLE_HOME=$(awk -F= -v b="$ORACLE_BASE" '$1 == "ORACLE_HOME" { o=$2 }
    END { sub("${?ORACLE_BASE}?", b, o); print o }' ./conf/setupSM.conf)

A: When ./conf/setupSM.conf has lines like
ORACLE_HOME=${ORACLE_BASE}/product/12.1.0/dbhome_1

(without spaces or in double quotes)
and you want ORACLE_BASE to be evaluated to your current settings, source your conf file (with a dot):
ORACLE_BASE=/a/b
. ./conf/setupSM.conf
echo "ORACLE_HOME=${ORACLE_HOME}"

This should give
ORACLE_HOME=/a/b/product/12.1.0/dbhome_1


text:
Q: Problem with \left\langle \right\rangle in continued fractions $$
 {\bf A}_3+
   \left\langle{\cfrac{\bf I}{{\bf A}_2+
     \left\langle\cfrac{\bf I}{{\bf A}_1+
      \left\langle\cfrac{\bf I}{{\bf A}_0}\right\rangle_1^{-1}}
     \right\rangle_2^{-1}}}
   \right\rangle_3^{-1}
$$

Indices 1, 2, 3 should be close to the corresponding brackets (I do not know how to do that) see a picture

A: You can use the scalerel package (I knew it can be useful):
\documentclass{article}
\usepackage{amsmath}
\usepackage{scalerel}
\newcommand{\bA}{\mathbf{A}}
\newcommand{\bI}{\mathbf{I}}

\begin{document}
\[
  \bA_3+
  {\stretchleftright
    {\bigg\langle}
    {\dfrac{\bI}{\bA_2+
     {\stretchleftright
      {\bigg\langle}
      {\dfrac{\bI}{\bA_1+
       {\stretchleftright
         {\bigg\langle}
         {\dfrac{\bI}{\bA_0}}
         {\bigg\rangle}}_{\!1}^{\!-1}}}
      {\bigg\rangle}}_{\!\!2}^{\!\!-1}}}
    {\bigg\rangle}}_{\!\!3}^{\!\!-1}
\]
\end{document}

Actually, the innermost fraction could be dealt with using the standard \left and \right, I used the same construction for uniformity. Some negative space has been added to the superscripts and subscripts.
If you prefer a different vertical alignment, some more tricks are needed:
\documentclass{article}
\usepackage{amsmath}
\usepackage{scalerel}
\newcommand{\bA}{\mathbf{A}}
\newcommand{\bI}{\mathbf{I}}

\newcommand{\leftrightangle}[1]{%
  \vcenter{%
    \hbox{%
      $\displaystyle\stretchleftright{\bigg\langle}{#1}{\bigg\rangle}$%
    }%
  }%
}

\begin{document}
\[
  \bA_3+
  \leftrightangle{
    \frac{\bI}{\bA_2+
     \leftrightangle{
      \frac{\bI}{\bA_1+
       \leftrightangle{
         \frac{\bI}{\bA_0}
       }_{\!\!1}^{\!\!-1}}
     }_{\!\!2}^{\!\!-1}}
  }_{\!\!3}^{\!\!-1}
\]
\end{document}

A: I guess one way to proceed is to load a math font package that provides extra-large angle brackets "out of the box".
One such package is mtpro2. It provides the instruction \LEFTRIGHT\langle\rangle{...}, where {...} is the material to be typeset between the angle brackets. The height of the angle brackets made possible by this package does have a limit -- 10cm (4 inches). I trust (hope?!) that this limit won't impose a meaningful constraint on your typesetting needs.
Note that while the "full" mtpro2 package isn't free of charge, its "lite" subset -- which is all you need for the example at hand -- is in fact free. Note further that mtpro2 uses Times Roman-style fonts; this feature may, or may not, be to your liking.

\documentclass{article}
\usepackage{amsmath}         % for \cfrac macro
\usepackage[lite]{mtpro2}    % for `\LEFTRIGHT` macro
\newcommand{\bA}{\mathbf{A}} % two shortcut macros
\newcommand{\bI}{\mathbf{I}}
\begin{document}
\[
  \bA_3+
  \LEFTRIGHT\langle\rangle{\cfrac{\bI}{\bA_2+
     \LEFTRIGHT\langle\rangle{\cfrac{\bI}{\bA_1+
        \LEFTRIGHT\langle\rangle{\frac{\bI}{\bA_0}}_{1}^{-1}}}
     _{\!2}^{\!-1}}} % provide some spacing adjustments
  _{\!\!3}^{\!\!-1} % ditto
\]
\end{document}


text:
Q: What is the nature of $e^{ix}$, real or complex? Since, $e^{i\pi}=-1$,
right part of the equation ($-1$) is real and left part is seemingly complex as
$e^{ix}=\cos(x)+i\sin(x)$ which is a complex number( I am not sure though).
I am a freshman, and don't know much regarding Euler's equations and advanced Mathematics.

A: Real numbers are also complex numbers; their imaginary part is $0$.  If $x$ is a real number then $e^{ix}$ is, in general, complex, but, in special cases, it can be real.  The only real numbers of the form $e^{ix}$ ($x$ real) are $1$ and $-1$.

A: Because $e^{ix}=\cos(x) + i\sin(x)$, it is only "real" when $\sin(x) = 0$, namely when $x = n \pi$ for $n \in \mathbb{Z}$. For every other value of $x$, $e^{ix}$ has a complex component. Note that I put "real" with quotes because $\mathbb{R} \subset \mathbb{C}$.


text:
Q: What is the most efficient way to create a 2d string array of initally repetitive data? In Python, typically to define said game board I would have used the following code:
board = [['0','0','0','0','0','0','0','0','0','0'] for i in range(10)]

However, using Java the only way I have been able to find so far to produce the same result would be to do:
public static String[][] board = {
        {"0","0","0","0","0","0","0","0","0","0"},
        {"0","0","0","0","0","0","0","0","0","0"},
        {"0","0","0","0","0","0","0","0","0","0"},
        {"0","0","0","0","0","0","0","0","0","0"},
        {"0","0","0","0","0","0","0","0","0","0"},
        {"0","0","0","0","0","0","0","0","0","0"},
        {"0","0","0","0","0","0","0","0","0","0"},
        {"0","0","0","0","0","0","0","0","0","0"},
        {"0","0","0","0","0","0","0","0","0","0"},
        {"0","0","0","0","0","0","0","0","0","0"}};

Surely there must be a more efficient way of doing this. I know I can do it efficiently if it were to be integers, but it has to be strings given the situation. I had thought a for loop would also have applied, but I can't seem to find the right syntax for it; perhaps it isn't applicable for Java. Are there any suggestions?

A: You can loop over each row and use Arrays.fill:
public static String[][] board = new String[rows][cols];
static {
    for (String[] row : board) Arrays.fill(row, "0");
}

Demo

A: You can use nested for loops to create the 10 rows and 10 columns. So within the first loop (which creates a "row"), you'd add another loop to fill the "columns."
String[][] board = new String[10][10];

// 10 rows
for (int i = 0; i < 10; i++) {
    // 10 columns
    for (int j = 0; j < 10; j++) {
        // Set the value of this row/column
        board[i][j] = "0";
    }
}

This obviously isn't as elegant as Python's one-line solution, but it does what you need.
There are other ways to do this (such as just adding a full 10-digit array to the board array in each loop), but I find this to be best for scalability and readability.

For further clarity, if you may possibly need to change the number of rows or columns in the future, it would be better to move those values to variables and use those instead:
int rows = 10;
int cols = 10;

String[][] board = new String[rows][cols];

for (int i = 0; i < rows; i++) {
    for (int j = 0; j < cols; i++) {
        board[i][j] = "0";
    }
}

This way you only need to update the variables instead of also modifying the for loops and array declaration.

A: You can do it like this. Since Strings are immutable, it's safe to use clone() here. Thanks to @iota for suggesting setAll
int n = 10;
String[][] arr = new String[n][n];
Arrays.fill(arr[0], "0");
Arrays.setAll(arr, i->arr[0].clone());

for(String[] a : arr) {
    System.out.println(Arrays.toString(a));
}

Prints
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

A: This is a hybrid of for loop and manually creating one row of cells.
String[][] board = new String[10][];
for (int i = 0; i < 10; i++) {
    board[i] = new String[]{"0","0","0","0","0","0","0","0","0","0"};
}

A: The following is a stream-based solution to the problem that uses a functional style, rather than an iterative style:
return Stream.generate(() ->
                Collections.nCopies(10, "0").toArray(String[]::new))
        .limit(10)
        .toArray(String[][]::new);

Note that depending on the readability, etc. requirements, a classic iterative style may be deemed more desirable.
Explanation
Collections.nCopies(10, "0") creates a List<String> of 10 "0" values.  This is converted to a String array using Collection.toArray(IntFunction).  This takes an IntFunction which generates an array of a given length.  String[]::new is a constructor lambda which implements IntFunction<String[]>, creating an array of the given length.
Stream.generate creates an infinite stream with each element created by a call to a given Supplier.  In this case, the supplier creates the aforementioned 10-element long list, resulting in a Stream<String[]>.  A generator is used, rather than Collections.nCopies, since each String[] in the String[][] needs be a different object.
The infinite stream is limited to just ten elements using Stream.limit(10).
Finally, the Stream<String[]> is collected into a String[][] by using Stream.toArray(IntFunction), which works in the same manner as the Collection.toArray method already described.

A: String#repeat since 11
String[][] board = new String[10][];

*

*Arrays.setAll - for each row repeat 0 ten times and split into an array:
Arrays.setAll(board, i -> "0".repeat(10).split(""));

*Arrays.fill - in this case, the result is the same:
Arrays.fill(board, "0".repeat(10).split(""));

Output:
Arrays.stream(board).map(Arrays::toString).forEach(System.out::println);

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

See also: How can I fill this 2D array with X characters?


text:
Q: In QM perturbation theory, is the system generally in an eigenstate of the perturbing Hamiltonian, $\hat H_1$? In my notes the derivation of the second order energy correction we don't do the following:
$$\sum_k a_{nk}\langle\phi_n|\hat H_1|\phi_k\rangle=\sum_ka_{nk}E_k^{(1)}\langle\phi_n|\phi_k\rangle$$
where $\phi_n$ and $\phi_k$ are eigenstates of the unperturbed Hamiltonian and $\hat H_1$ is the perturbing Hamiltonian. Is this because the eigenstates of the unperturbed system are not necessarily eigenstates of the perturbation? I'm not sure why else this wouldn't work.

A: Indeed, the eigenstates of the unperturbed Hamiltonian ($\hat{H}_0$) are not the eigenstates of the perturbation ($\hat{H}_1$) - otherwise one wouldn't need the perturbation theory, since the perturbing Hamiltonian is diagonal: it does not mix the states and merely adds a correction to the energy levels of $\hat{H}_0$.
Let me further note that frequently when presenting the perturbation theory one assumes that the diagonal part of $\hat{H}_1$ is already incorporated into $\hat{H}_0$, i.e. $\langle n |\hat{H}_1 |n\rangle = 0$. In some treatments it may appear as the first order correction $E_n^{(1)} = \langle n |\hat{H}_1 |n\rangle$ - note that the states on the right and the left here are the same, unlike in the equation that you wrote, which is probably incorrect or based on a different definition of $E_n^{(1)}$.


text:
Q: Issues writing file metadata with Java nio I'm looking to add a custom metadata tag to any type of file using  functionality from java.nio.file.Files. I have been able to read metadata correctly, but am having issues whenever I try to set metadata.
I've tried to set a custom metadata element with a plain string using Files.setAttribute with the following
    Path photo = Paths.get("C:\\Users\\some\\picture\\path\\2634.jpeg");
    try{
        BasicFileAttributes attrs = Files.readAttributes(photo, BasicFileAttributes.class);
        Files.setAttribute(photo, "user:tags", "test");
        String attribute = Files.getAttribute(photo, "user:tags").toString();
        System.out.println(attribute);
    }
    catch (IOException ioex){
        ioex.printStackTrace();
    }

but end up with the following error :
Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.nio.ByteBuffer
if I try to cast that string to a ByteBuffer like so
    Path photo = Paths.get("C:\\Users\\some\\picture\\path\\2634.jpeg");
    try{
        BasicFileAttributes attrs = Files.readAttributes(photo, BasicFileAttributes.class);
        Files.setAttribute(photo, "user:tags", ByteBuffer.wrap(("test").getBytes("UTF-8")));
        String attribute = Files.getAttribute(photo, "user:tags").toString();
        System.out.println(attribute);
    }
    catch (IOException ioex){
        ioex.printStackTrace();
    }

instead of outputting the text 'test', it outputs the strange character string '[B@14e3f41'
What is the proper way to convert a String to a bytebuffer and have it be convertable back into a string, and is there a more customizable way to modify metadata on a File using java?

A: User defined attributes, that is any attribute defined by UserDefinedFileAttributeView (provided that your FileSystem supports them!), are readable/writable from Java as byte arrays; if a given attribute contains text content, it is then process dependent what the encoding will be for the string in question.
Now, you are using the .{get,set}Attribute() methods, which means that you have two options to write user attributes:

*

*either using a ByteBuffer like you did; or

*using a plain byte array.

What you will read out of it however is a byte array, always.
From the javadoc link above (emphasis mine):

Where dynamic access to file attributes is required, the getAttribute method may be used to read the attribute value. The attribute value is returned as a byte array (byte[]). The setAttribute method may be used to write the value of a user-defined attribute from a buffer (as if by invoking the write method), or byte array (byte[]).

So, in your case:

*

*in order to write the attribute, obtain a byte array with the requested encoding from your string:
final Charset utf8 = StandardCharsets.UTF_8;
final String myAttrValue = "Mémé dans les orties";
final byte[] userAttributeValue = myAttrValue.getBytes(utf8);
Files.setAttribute(photo, "user:tags", userAttributeValue);

*in order to read the attribute, you'll need to cast the result of .getAttribute() to a byte array, and then obtain a string out of it, again using the correct encoding:
final Charset utf8 = StandardCharsets.UTF_8;
final byte[] userAttributeValue
    = (byte[]) Files.readAttribute(photo, "user:tags");
final String myAttrValue = new String(userAttributeValue, utf8);

A peek into the other solution, just in case...
As already mentioned, what you want to deal with is a UserDefinedFileAttributeView. The Files class allows you to obtain any FileAttributeView implementation using this method:
final UserDefinedFileAttributeView view
    = Files.getFileAttributeView(photo, UserDefinedFileAttributeView.class);

Now, once you have this view at your disposal, you may read from, or write to, it.
For instance, here is how you would read your particular attribute; note that here we only use the attribute name, since the view (with name "user") is already there:
final Charset utf8 = StandardCharsets.UTF_8;
final int attrSize = view.size("tags");
final ByteBuffer buf = ByteBuffer.allocate(attrSize);
view.read("tags", buf);
return new String(buf.array(), utf8);

In order to write, you'll need to wrap the byte array into a ByteBuffer:
final Charset utf8 = StandardCharsets.UTF_8;
final int array = tagValue.getBytes(utf8);
final ByteBuffer buf = ByteBuffer.wrap(array);
view.write("tags", buf);

Like I said, it gives you more control, but is more involved.
Final note: as the name pretty much dictates, user defined attributes are user defined; a given attribute for this view may, or may not, exist. It is your responsibility to correctly handle errors if an attribute does not exist etc; the JDK offers no such thing as NoSuchAttributeException for this kind of scenario.


text:
Q: Extract the Certificate files - Self-Signed Certificate I have created a self-signed certificate on my Kubernetes cluster. I can now see that the certificate is showing the status READY = True. When I describe the secret of this certificate, I can see the below.
Output of Secret
How do I extract the above files so I can use them to secure my website?

A: I found the answer. The keys are stored in the secret that we provide in the certificate.yaml file! I just had to do an edit secret and copied the content over.


text:
Q: How to create class that inherits from TextBox I want to make a custom TextBox class that inherits TextBox
and overrides onKeyDown event to make Tab functionality when key Enter is pressed.
There is duplicates of this question but none of the answers I found make sense so I want to open a fresh discussion.
I don't want to Inherit from UserControl but from TextBox... is this really that hard to do? I can't seem to find straightfoward tutorial or example on how to do this.
Something like this:
public partial class CustomTextBox : TextBox
{
    public CustomTextBox()
    {
        this.KeyDown += customKeyDown;
    }

    void customKeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.Enter)
        {
            SendKeys.Send("{TAB}");
        }
    }
}

Please keep in mind that I have very little experience with working with UserControls or CustomControls and it was long time ago so I forgot the key things

A: You just override OnKeyDown event handler, no need for UserControl here.
Class below moves to next control when ENTER key is pressed in single- or multiline textbox. When multiline, ENTER can be inserted by pressing SHIFT+ENTER.
As added bonus, annoying "ding" sound is suppressed (in simplest possible way which works well if you do not need to handle the key outside the control).
namespace YourNameSpace
{
    public class CustomTextBox : TextBox
    {
        protected override void OnKeyDown(KeyEventArgs e)
        {
            base.OnKeyDown(e);

            if (e.KeyCode == Keys.Enter && (!Multiline || Multiline && !e.Shift))
            {
                SendKeys.Send("{TAB}");
                // Removes "ding" sound by NOT passing the key down to container
                e.SuppressKeyPress = true;
            }
        }
    }
}