text:
Q: Animate view controller and reload data in table view at the same time I have a root view controller, which presents the modal view controller with standard animation (modal view controller appears from bottom to top).
Let's name this view controllers MyRootViewController and MyModalTableViewController.
The problem is animation stops if MyModalTableViewController reloads data when it appears.
For example:
- (void)openModalViewController {
  MyModalTableViewController * vc = [self.storyboard instantiateViewControllerWithIdentifier:@"myModalScreen"];
  [self presentViewController:vc animated:YES];
}

And in MyModalTableViewController I have the next code:
- (void)viewDidLoad {
  self.itemList = [[MyData sharedInstance] itemList]; // self.itemList is NSArray
}

// ...

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  MyTableViewCell * cell = [tableView dequeReusableCellWithIdentifier:@"myCell"];
  cell.item = self.itemList[indexPath.row];
  return cell;
}

So when MyModalTableViewController is loading from storyboard, it loads itemList and shows it on UITableView. And presentation animation starts only when UITableView complete to load data. I guess it because the animation and data reloading works in the same thread. So if I have 10000 items to show, it takes few seconds and only then presentation animation starts.
It is too slow. So my question is what is the best way to solve this problem?

A: Well, you can load your item list on background thread
- (void)viewDidLoad {

    //background thread
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

        //load data
        self.itemList = [[MyData sharedInstance] itemList]; // self.itemList is NSArray

        //main thread
        dispatch_async(dispatch_get_main_queue(), ^{
            //reload table
            [self.tableView reloadData];
        });

    });

}

A: In MyModalTableViewController, add a method loadData
- (void)loadData {
     self.itemList = [[MyData sharedInstance] itemList]; // self.itemList is NSArray
     [self.tableView reloadData];
 }

Use then the completion block of `presentViewController
 [self presentViewController:vc animated:YES completion:^{
    [vc loadData];
}

A: The problem caused because I'm trying to present view controller from the - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath; delegate method.
This delegate method is calling not in the main thread, that's why animations works slow. It looks too strange, because in iOS 7 I didn't have such problem. It happenes only on iOS 8 and later.
I've found the same problem in this SO topic: Slow presentViewController performance
So the solution is to implement delegate like below:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  __block UIViewController * vc = [self.storyboard instantiateViewControllerWithIdentifier:@"myVC"];
  dispatch_async(dispatch_get_main_queue(), ^{
    [self presentViewController:vc animated:YES completion:nil];
  });
}

I've looked into Apple documentation, but didn't find the notice that this delegate methods calls not in main thread: https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UITableViewDelegate_Protocol/index.html#//apple_ref/occ/intfm/UITableViewDelegate/tableView:didSelectRowAtIndexPath:
So it would be great if someone explains why this problem caused only on iOS 8 and later.

A: You can charge the itemlist in the previous view controller and set it to the new one:
- (void)openModalViewController {
  MyModalTableViewController * vc = [self.storyboard instantiateViewControllerWithIdentifier:@"myModalScreen"];
  vc.itemlist = self.itemlist;
  [self presentViewController:vc animated:YES];
}


text:
Q: How can I query a tileset from ARCGIS map service to extract a raster image? I am attempting to build a url query to access a ARCGIS tileset (map here and services directory info here) and convert it to a raster image in R. I see that the "Export Tiles Allowed" condition is set to false on the services directory, so I am trying to query through the "Tile Map" option instead. On the documentation, I see that the correct format is https://<mapservice-url>/tilemap/<level>/<row>/<column>/<width>/<height>, but I am unsure how to build this url in order to extract a raster later.
Overall, I would like to query the tileset that is cropped to a Census Block Group bounding box and extract a raster image. The following is an example of a Census Block Group polygon and obtaining bounding box points:
library(sf)
library(tigris)
library(tidyverse)
library(httr)
library(raster)
library(exactextractr)

ex_cbg <-
  block_groups("06","081", cb = T) %>%
  st_transform(2227) %>%
  .[1,]

box_list <-
    st_bbox(ex_cbg$geometry[1]) %>% unlist()

  element1 <- box_list[[1]]
  element2 <- box_list[[2]]
  element3 <- box_list[[3]]
  element4 <- box_list[[4]]

In other non-tileset queries, I have obtained the raster from the following code, which includes the bounding box constraints:
query_result <- GET(paste0("https://gis.smcgov.org/image/rest/services/SanMateoCounty_DEM2017/ImageServer/exportImage?bbox=",element1,",",element2,",",element3,",",element4,"&size=2500,2500&format=tiff&f=json"))

result <- raster(content(query_result)$href)

redpajama_set_name: RedPajamaStackExchange


text:
Q: php help resolving error Hello Im trying to make a form with a captca:
But everytime I submit it shows me that the captcha is wrong i dont know where is my mistake,
can you please look at the code and tell me ?
Here is the form: http://pastebin.com/yXx5APRD
look in the end.. for the input submit button...
Here is the captcha.php from where I get the image: http://pastebin.com/9hYnDBv4
view the comment below for the sending code pastebin

A: You can try this
http://sourceforge.net/projects/captcha/

A:   $gjetja= $_SESSION["vercode"];
  if (!preg_match($gjetja,$vercode)) {
     $error_message .= 'Incorrect verification code.
';
  }

Try replace it with
  $gjetja= $_SESSION["vercode"];
  if ($gjetja !== trim($vercode)) {
     $error_message .= 'Incorrect verification code.
';
  }


text:
Q: strpos() expects parameter 1 to be string, array given in vendor/magento/module-eav/Model/Entity/Attribute/Source/Table.php on line 160 I am getting following error on product detail page for multiselect attributes.
Warning: strpos() expects parameter 1 to be string, array given in /home/xxxxx/public_html/vendor/magento/module-eav/Model/Entity/Attribute/Source/Table.php on line 160

Exception #0 (Exception): Warning: strpos() expects parameter 1 to be string, array given in /home/xxxxx/public_html/vendor/magento/module-eav/Model/Entity/Attribute/Source/Table.php on line 160

0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'strpos() expect...', '/home/xxxx...', 160, Array)

1 /home/xxxxx/public_html/vendor/magento/module-eav/Model/Entity/Attribute/Source/Table.php(160): strpos(Array, ',')

2 /home/xxxxx/public_html/vendor/magento/module-eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php(331): Magento\Eav\Model\Entity\Attribute\Source\Table->getOptionText(Array)

3 /home/xxxxx/public_html/vendor/magento/module-eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php(176): Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend->getOption(Array)

4 /home/xxxxx/public_html/vendor/magento/module-catalog/Block/Product/View/Attributes.php(84): Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend->getValue(Object(Magento\Catalog\Model\Product\Interceptor))

5 /home/xxxxx/public_html/app/design/frontend/xxxx/xxxx/Magento_Catalog/templates/product/view/attributes.phtml(19): Magento\Catalog\Block\Product\View\Attributes->getAdditionalData();

I am using magento 2.2.3 please help

A: I ran into this issue in Magento 2.3.0 and was able to get it fixed by changing the Table.php file.
Before I explain what I did, let me preface it with you should never change core Magento file and should extend any changes into a custom module. But for me this is a small change that is needed due to an issue with the core code so it makes sense for to make the change directly, still not recommended.
Okay, so I needed to make two changes, one mentioned in another answer which is to change line 152 from
if(strpos($value, ',') !== false){`

to
if (is_array($value)) {

and then comment out line 154
//value = explode(',',$value);

as the explode function cannot accept an array as it's second parameter.
After making these changes I was able to browse again. I'm not entirely sure of any possible issues that this may bring up, but it has been working for me.

A: This is magento2 bug. we should update following code
public function getOptionText($value)
{
    $isMultiple = false;
    if (is_array($value)) {
        $isMultiple = true;
        $value = explode(',', $value);
    }

    $options = $this->getSpecificOptions($value, false);

    if ($isMultiple) {
        $values = [];
        foreach ($options as $item) {
            if (in_array($item['value'], $value)) {
                $values[] = $item['label'];
            }
        }
        return $values;
    }

    foreach ($options as $item) {
        if ($item['value'] == $value) {
            return $item['label'];
        }
    }
    return false;
}


text:
Q: Write a class SequenceCheck with a method sequenceCheck(int[] arr)  Use the array to print true if the elements 1,2,3 are present in the array. They need not be consecutive in the array. Print false otherwise...

A: public class SequenceCheck{

 static void sequenceCheck(int arr[]){
     int c= 0;
   for( int i =0;i<arr.length;i++){
       if (arr[i]==1)
          c++;
       if (arr[i]==2)
          c++;
       if (arr[i]==3)
          c++;

  }

  if (c==3)
     System.out.println("true");
  else
     System.out.println("false");

}
  public static void main(String args[]){
    int array[]={1,2,3,4,5,6,7,8,9,0};
    sequenceCheck(array);
  }
}


text:
Q: Load data into a datagrid asynchronously I'm loading in a datagrid view some data (1,200,000 rows), And the App is taking too much time to load and sometimes freezes.
I don't know how to load them asynchronously ? (with progressBar maybe).
Can I find some help here ?

A: I have an application in which I'm doing something very similar using Threading. This code should update your datagrid one line at a time while the code behind is running.
using System.Windows.Threading;

private void Run()
{
    try
    {
        var t = new Thread(Read) { IsBackground = true };
        t.Start();
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

private void Read()
{
    foreach (/* whatever you are looping through */)
    {
        /* I recommend creating a class for the result use that for the
           datagrid filling. */
        var sr = new ResultClass()

        /* do all you code to generate your results */

        Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                               (ThreadStart)(() => dgResults.AddItem(sr)));
    }
}

A: Break up the data loading into smaller chunks, say 100 to 1000 rows at a time. If the WPF grid is databound to your data collection, and the collection is an observable collection (implements INotifyCollectionChanged), WPF will auto update the display as new data is added to the collection.
You should also consider using virtualized list controls or grids in conjunction with paging data sources, so that only the data that is currently shown on the screen will be loaded (instead of 1.2 million rows of data in memory).  This will perform the "chunking" for you and will enable you to present basically an infinite amount of data to the user with very little memory use or network lag.
Check out this SO article on retrieving data asynchronously for a virtual listbox: How do I populate a ListView in virtual mode asynchronously?


text:
Q: failing to reset language selection after sync I am facing a problem which I am not aware how to resolve. Let me describe elaborately below:
I have a commonViewModel kendo class where event like save, cancel are written. I am facing problem with the save event of this class.
    save: function () {
    var that = this;
    var routeLanguage = "";
    that._showBackConfirmation(false);
    that.set("isFormSubmitted", true);
    console.log("form is valid, sending the save request!");

    if (vm.get("languageTabsVm.selectedLanguage")) {
        routeLanguage = "/" + vm.get("languageTabsVm.selectedLanguage");
    }
    else if (that.get("model.Languages") && that.get("model.Languages").length > 1) {
        that.get("model.Languages").forEach(function (lang) {
            if (lang.get("IsActive") === true) {
                //sätt cv-visning till det språk jag senast redigerade på detta item
                routeLanguage = "/" + lang.LanguageId;
            }
        });
    }

    //if i call the function _loadDefaultLanguageSelection here, it
    // works. because, the datasource is not synced yet.

    //Make sure the datasource are syncing changes to the server (includes all crud)
    return that.dataSource.sync().fail(function (e) {

        //i need to do something here to be in the same language tab. But
       //as i am changing directly in to model, it is not possible. But
       //saving directly to model is essential because that model is
       //shared to other viewmodel for language tab synching purpose.
        that.set("isFormSubmitted", false);
        console.log("form rejected");
    }).done(function () {
        if (that.get("isPersonaldetail")) {
            var name = that.get("model.Name");
            if (name.length > 12)
                name = name.substring(0, 11) + "...";
            $("#profileName").text(name);
        }
        that.set("isFormSubmitted", false);

        that.set("isSelected", false);

        // it is called from here right now. but it is failing because
        // model is updated but not synced in that function
        that._loadDefaultLanguageSelection();
        router.navigate(that.nextRoute + routeLanguage);
    });
},
_loadDefaultLanguageSelection: function () {
    var that = this;
    if (that.get("model.Languages") && that.get("model.Languages").length > 1) {
        that.get("model.Languages").forEach(function (lang) {
            if (!that.get("isPersonaldetail")) {
                lang.set("IsActive", lang.get("LanguageId") === vm.get("languageTabsVm.selectedLanguage"));
            }
        });

    }
},

So, my question is, how can i resolve this problem. one solution is i will have to sync twice. that is not nice. So, I am looking for efficient solution.


text:
Q: Isn't the following addition wrong on manifold as done in Frankel book? In ch-$4$ when calculating expression of Lie derivative using Hadamard's Lemma before $(4.4)$ Frankel's do following manipulation:
$$\lim_{t\rightarrow0}\frac{\textbf{Y}_{\phi_tx}(f)-\textbf{Y}_x(f)}{t}$$
$$=\textbf{X}_x\{\textbf{Y}(f)\}$$
various symbol stands for

*

*$\textbf{Y}$, $\textbf{X}$ are vector field on manifold $M^n$

*$\phi_t$ is the flow associated with $\textbf{X}$

*$x$ is the point where we're taking the Lie derivative

*$f$ is a test function

My problem is how the subtraction is done of $\textbf{Y}$ at two different points. Intuitively the result make sense thats how vector differentiation is done in $\mathrm{R}^n$ but as far as I know we can add vectors only on the Tangent space of a point they're defined by the operator $\frac{d}{d\lambda}$. So does the flow $\phi_t$ here acts as the curve and $t$ can be called the parameter analogous to $\lambda$?

A: Remember that $\mathbf Y_x$ is the vector (not vector field) from $\mathbf Y$ at the point $x$.  A vector eats a function and spits out a real number.  As both $\mathbf Y_{\phi_t x}(f)$ and $\mathbf Y_x(f)$ are numbers, you can subtract them without issue.

A: The tangent space can be defined in multiple ways (see https://en.wikipedia.org/wiki/Tangent_space). I have not read Frankels book, but I assume from your post that he defines a tangent vector as a linear map of smooth functions $f$ on the manifold to $\mathbb{R}$, i.e. $\mathbf{Y}_x: C_{\infty}(M^n) \rightarrow \mathbb{R}$, so $\mathbf{Y}_x(f), \mathbf{Y}_{\phi_tx}(f)$ are just real numbers.
The equivalence with the tangent-space as defined by equivalence classes of curves is also explained in the wiki article. The identification of the tangent-space with tangential arrows attached to a (sub)manifold is more apparent with the curve definition.


text:
Q: eclipse.log.level in Eclipse RCP config.ini file not working? I am using service Logger (workbench Logger) to log in Eclipse RCP.
I have used it many locations where it is used for logging INFO, WARNING and ERROR as well.
I had set eclipse.log.level = ERROR in the launch configuration (tab) of the product file. Now I expect it to log only ERROR logs in the log file.
But when I am launching from the product file it is logging all the INFO logs also. My understanding is wrong on eclipse.log.level? or anything else has to be done?

A: Since this is a system property you set it with
-Declipse.log.level=ERROR

in the 'VM arguments' section of the 'Arguments' tab on the launch configuration.


text:
Q: What will be default isolation level of transaction in case of hibernate with oracle? i am using Hibernate with oracle . What will be default isolation level if transaction if i don't set it explicitly. Will it be read_commited (default for oracle)?If i want to set it something else say serilizable how can i set it in hibernate?

A: Will it be read_commited (default for oracle)?
Yes
If i want to set it something else say serilizable how can i set it in hibernate?
Look for hibernate.connection.isolation config param in hibernate manual.
You may also check session lock


text:
Q: PostgreSQL Query to change columns to uppercase I am working on a mySQL to PostgreSQL database migration using pgloader. One of the issues I am facing is that my application is looking for any tables beginning with "ao_" to be "AO_" which I was able to solve by making them all uppercase, however the corresponding columns also need to be uppercase.
Is there a good way to make JUST the "AO_" table columns be all uppercase. It does not seem very efficient to just do this for 400 tables with approximately 10 columns per table:
ALTER TABLE "AO_54307E_QUEUE" RENAME project_id TO "PROJECT_ID";

Is there maybe some kind of wildcard we could use to just grab the "AO_" tables and then have all the columns be uppercase?

A: I would recommend you against doing it, and I am quoting from the documentation.

Quoting an identifier also makes it case-sensitive, whereas unquoted
  names are always folded to lower case.
  If you want to write portable applications you are
  advised to always quote a particular name or never quote it.

So, quoting "JUST the "AO_" table columns be all uppercase" seems like a bad idea.
If you still wish to proceed, you may use a loop through information_schema.columns and run dynamic ALTER statements.
DO $$
DECLARE
rec RECORD;

 BEGIN

for rec IN (  SELECT column_name,table_name,table_schema
               FROM  information_schema.columns
               WHERE   table_name  like 'AO_%'
               AND     column_name like 'ao_%'  )
  LOOP

   EXECUTE format ( 'ALTER TABLE  %I.%I RENAME %I TO %I' ,
                     rec.table_schema,rec.table_name,rec.column_name,
                     upper(rec.column_name)) ;
   RAISE NOTICE 'COLUMN %  in Table %.% RENAMED',

rec.column_name,rec.table_schema,rec.table_name;

  END LOOP;
END$$;

Demo


text:
Q: Postfix doesn't send emails until after systemctl restart postfix I'm been trying to set up smtp postfix on Ubuntu 18.04. I've finally got it so that gmail recipients see SPF and DKIM pass (although it still ends up in the spam folder, not sure why?)
However, when sending emails, it most of the time it doesn't send them until after I restart the process with sudo systemctl restart postfix.
When I do systemctl status postfix, it says active (exited).
I'm not sure why this is, any ideas? I want the emails to send straight away without me having to restart it like this.
Please let me know if I should provide any other info / files:
/etc/postfix/main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more compl$

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default$
# fresh installs.
compatibility_level = 2

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_$
smtp_tls_session_cache_database = btree:${data_directory}/smtp_sc$

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc pac$
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenti$
myhostname = [removed].com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, localhost.$mydomain, localhost.learn$
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all

# Milter configuration
milter_default_action = accept
milter_protocol = 6
smtpd_milters = local:opendkim/opendkim.sock
non_smtpd_milters = $smtpd_milters

postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
inet_interfaces = loopback-only
inet_protocols = all
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
milter_default_action = accept
milter_protocol = 6
mydestination = $myhostname, localhost.$mydomain, localhost.[removed].com, [removed].com, [removed].local, localhost.local, localhost
myhostname = [removed].com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
non_smtpd_milters = $smtpd_milters
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_milters = local:opendkim/opendkim.sock
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

/var/log/mail.log
Apr 28 10:18:25 [removed] postfix/postfix-script[1679]: starting the Postfix mail system
Apr 28 10:18:25 [removed] postfix/master[1681]: daemon started -- version 3.3.0, configuration /etc/postfix
Apr 28 10:18:25 [removed] postfix/pickup[1682]: E88CD81E22: uid=0 from=<no-reply@[removed].com>
Apr 28 10:18:25 [removed] opendkim[1456]: OpenDKIM Filter: mi_stop=1
Apr 28 10:18:25 [removed] opendkim[1456]: OpenDKIM Filter v2.11.0 terminating with status 0, errno = 0
Apr 28 10:18:25 [removed] postfix/cleanup[1685]: warning: milter local:opendkim/opendkim.sock: can't read SMFIC_OPTNEG reply packet header: Connection reset by peer
Apr 28 10:18:25 [removed] postfix/cleanup[1685]: warning: milter local:opendkim/opendkim.sock: read error in initial handshake
Apr 28 10:18:25 [removed] postfix/cleanup[1685]: E88CD81E22: message-id=<222b02b2-6a3c-3e6f-5083-b9889f5be672@[removed].com>
Apr 28 10:18:25 [removed] postfix/qmgr[1683]: E88CD81E22: from=<no-reply@[removed].com>, size=1357, nrcpt=1 (queue active)
Apr 28 10:18:25 [removed] opendkim[1692]: OpenDKIM Filter v2.11.0 starting (args: -x /etc/opendkim.conf)
Apr 28 10:18:28 [removed] postfix/smtp[1690]: E88CD81E22: to=<[removed]@gmail.com>, relay=gmail-smtp-in.l.google.com[2404:6800:4003:c06::1b]:25, delay=545, delays=542/0.01/1.4/1.5, dsn=2.0.0, stat$
Apr 28 10:18:28 [removed] postfix/qmgr[1683]: E88CD81E22: removed
Apr 28 10:19:13 [removed] postfix/pickup[1682]: A30DB81E22: uid=0 from=<no-reply@[removed].com>
Apr 28 10:19:13 [removed] postfix/cleanup[1685]: A30DB81E22: message-id=<2e5c7f36-b481-4815-e666-3f057951f498@[removed].com>
Apr 28 10:19:13 [removed] opendkim[1692]: KeyTable entry for 'default._domainkey.[removed].com' corrupt
Apr 28 10:19:13 [removed] opendkim[1692]: A30DB81E22: error loading key 'default._domainkey.[removed].com'
Apr 28 10:19:13 [removed] postfix/cleanup[1685]: A30DB81E22: milter-reject: END-OF-MESSAGE from localhost[127.0.0.1]: 4.7.1 Service unavailable - try again later; from=<no-reply@[removed]$
Apr 28 10:19:25 [removed] postfix/pickup[1682]: A71D981E22: uid=0 from=<no-reply@[removed].com>
Apr 28 10:19:25 [removed] postfix/cleanup[1685]: A71D981E22: message-id=<2e5c7f36-b481-4815-e666-3f057951f498@[removed].com>
Apr 28 10:19:25 [removed] opendkim[1692]: KeyTable entry for 'default._domainkey.[removed].com' corrupt
Apr 28 10:19:25 [removed] opendkim[1692]: A71D981E22: error loading key 'default._domainkey.[removed].com'
Apr 28 10:19:25 [removed] postfix/cleanup[1685]: A71D981E22: milter-reject: END-OF-MESSAGE from localhost[127.0.0.1]: 4.7.1 Service unavailable - try again later; from=<no-reply@[removed]$

A: Thanks to people who commented, eventually I found this which instructed me to comment out certain lines in /etc/opendkim.conf:
KeyFile /etc/opendkim/keys/mail.private
#KeyTable /etc/opendkim/KeyTable
#SigningTable /etc/opendkim/SigningTable

Then I set up rDNS with the PTR record. Now, the emails are sent immediately without needing to do restarts, and I get perfect 10/10 scores on mail-tester


text:
Q: Accessing Map attribute with dynamic key in Struts 2 OGNL I have a list of Strings that are attribute names and a Map.
I'm trying to access a model(ex.project) in the map using attribute name in string list.
Here is what I have now.
<s:iterator value="theMap" var="element">

    <s:iterator value="attributeList" var="attrName">

<s:property value="#element.Project.#attrName" />

    </s:iterator>

</s:iterator>

If I hard code the attribute name it works fine:

<s:property value="#element.Project.projectName" />

Any advice is appreciated.

A: Using OGNL <s:property value="#element.Project[#attrName]" />


text:
Q: Why I cannot delete an account in 24 hours? I deleted a profile yesterday. The system claimed it was to be deleted in 24 hours. However, I see the following message today.

This account is scheduled to be deleted 5 mins ago. To cancel deletion, click here.

Why the account isn't deleted on time? 5 mins after the deadline?

A: Deletions do not take place the moment the 24 hours is up. There is a scheduled task that runs once an hour that checks for profiles past the scheduled deletion time and deletes them all in a batch process. If your countdown is past the 24-hour mark, it will be deleted as soon as that task runs next.
There are also circumstances which can cause that deletion to be halted and placed in a queue for manual review by staff, but your profile doesn't meet any of those criteria.


text:
Q: Fetch api [object object] I got a php page with the following JSON
{"id":"1","name":"name1","books":[{"id":"1","title":"title1"},{"id":"2","title":"title2"}]}

I am trying to fetch this but i keep getting the following  output:
name1 [object Object], [object Object]

I use the following javascript code for the fetch:
window.onload=Send;
function Send() {
    var buttonSend = document.getElementById("buttonSend");
    buttonSend.onclick=HandleClick;
}

function HandleClick() {
    var $id = document.getElementById("textAuthorID").value;
    const URL = 'http://192.168.33.22/opdracht3/list.php?id=';
    fetch(URL + $id)
        .then( function(response) {return response.json(); })
        .then( function(data){ writeOutput(data.name + " " + data.books.join(", ")); } )
        .catch( function(exception) {writeOutput( exception );});
}

function writeOutput(text) {
    var textNode = document.createTextNode(text + "\n");
    var output = document.getElementById("divOutput");
    output.appendChild(textNode);
}

Could anyone help me out to display the names of the books?


text:
Q: hierarchical symbol lookup for shared libs? Question: With g++/clang, is it possible to have nested link-map linker settings, or hierarchical link-map list namespacing? I'd like to keep py37 and py39 loaded libs' symbols separated due to conflicts, but allow their sublibs to find the symbols they provide.
Details:
I have 2 external libs I'm loading with conflicting symbols, so I load them with RTLD_LOCAL. For brevity, these are py37 and py39.
Unfortunately, sublibs that py39 code loads depend on symbols defined in py39, and I can only make it work if py39 is loaded with RTLD_GLOBAL so the sublibs are happy. But then this conflicts with py37.
Other Details:
My current solution is very inefficient: completely load and unload with RTLD_GLOBAL (including init python), every time I do some work with the sublibs. I have to treat the sublibs as a black box because I have no clue what users will run there, but it needs to run "like normal" for them.


text:
Q: Changing single column with mixed character and numbers into just numerical in rstudio I'm working on a project for school that needs to use Rstudio for data analysis.
We have some columns with one character and numerics. We are trying to change this into just numerics. FYI We are not experienced users in any programming languages.
For example:
We have a dataset with the following variables:
Period - TPeriod - Brand etc
Although Tperiod is all in numerics, both period and brand are not. They each include a single letter.
Ex:
Period
b20160399992 (meaning 2016/march)
Brand
b007 (meaning a brand name)
(There are 56 brands, all following the same sequence -- b001 to b056)
We want to change the brand column or set a keyword for the brand column so that we can use b007 as just 7.
We think by changing this into just 7, we can compare them to their sale units/price etc.
If anyone could help, that would be greatly appreciated.
thank you
we have tried to use dplyr but could not follow through.
again we are not experienced in any programming languages as we are just learning R for data analysis.

A: This is a two step procedure (although they can be combined for convenience).
First you need to take a substring of your variable that gets rid of characters you don't want, for the Brand variable this is the first character.
Then you want to convert this to numeric.
Assuming your dataframe is called df you can do this by taking a substring of the variable and converting it to numeric.
library(dplyr)

df <- df %>%
      mutate(brand_numeric = as.numeric(substr(Brand, 2)))

This is a commonly asked question though and you should get in the habit of searching the forums for solutions first.


text:
Q: Bootstrap first container override second container I created a simple webpage with bootstrap that include two containers :
First container :

*

*A white column taking 7/12 of the first row

*A black column taking 5/12 of the second row
Second container (under the first one)

*A grey page

The first container takes all the page and if you scroll down to the second container, it also takes all the page height
HTML :

            left

            right

details

CSS :

html,
body {
    height: 100%;
}

.nopadding {
    margin: 0 !important;
    padding: 0 !important;
}

.left {
    background: white;
    color: black;
    height: 100%;
}

.right {
    background: black;
    color: white;
    height: 100%;
}

.details {
    background: grey;
    color: white;
    height: 100%;
}

Here are screenshots of the page (when the page has place to display the black column, everything works. But when I resize the window, it goes under the grey container [I saw that using z-index]) :

I would like the black column to be right under the white one when I resize and the grey column to be under the black column when I resize.
Thanks!

A: First, you are overrating the power of h-100, then you mixed h-100 with css incorrectly, basically you set on container and row height with h-100 and then in css you defined .left and .right with height of 100% so... Since your containers cannot be higher then 100% and contents (.left and .right) are 100% your ".right" is hidden out of bounds of your row because .left already took all available space...
For a starter I've would recommend to use weather bootstrap classes or css, it's pretty easy to have all that without defining your own css in bootstrap...


text:
Q: Laravel 5.3 Eager Loading Selected Fields I have this code:
 $products = \App\Product::whereIn('id', $arrayKeys)
                ->with('photo')
                ->get();

And the result is:

If I use select code like this one:
 $products = \App\Product::whereIn('id', $arrayKeys)
                ->select(['desc'])
                ->with('photo')
                ->get();

I can't see the photo. Is there a way to it? So that I can get the selected fields as well as the photo relationship.


text:
Q: Json string to Java object with dynamic keys I want to insert a REST API response to java object. My sample response as below.
    {
        "key1": [
          {
            "name": "test1",
            "id": "id1",
          }
        ],
        "key2": [
          {
            "name": "test2",
            "id": "id2",
          },
          {
            "name": "test3",
            "id": "id3",
          }
        ]
      }

For that I created "User" class for repeating object
@Data
public class User {
    private String name;
    private String id;
}

API response body only accept Class<T> and for that I parsed Map.class to that function as I want to insert json response data to Map<String, List<User>> instead of java class object.
public Mono<Map> getUserInfo(String number) {
        return apiAdaptor.getRequest(urlConfiguration.getUserApi(), Map.class, true
                , number);
    }

public <T> Mono<T> getRequest(String url, Class<T> responseClass, boolean isDds,
                                  String... urlArgs) {
        return Mono.just(this.accessToken)
                .flatMap(token -> this.webClient.get()
                        .uri(url, urlArgs)
                        .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
                        .exchange()
                        .flatMap(clientResponse -> getClassResponse(clientResponse, responseClass, isDds))
                );
    }

private UserResponse handleSuccess(Map map) {
        Map<String, List<User>> apiRes = map;
}

But when I looping through API response (apiRes) it gave "java.util.LinkedHashMap cannot be cast to User". As I checked, if Jackson cannot identified the exact format it will automatically converted to "LinkedHashMap". Please help.
Please note that I'm new to java development.

A: One trick is to declare class of its own to preserve generic types to be compiled and casted correctly. So like:
@SuppressWarnings("serial")
public class DynKeyUserMap extends HashMap<String, List<User>> {}

Then instead of using Map.class use DynKeyUserMap.class to prevent casting problems.

A: I am not sure which Httpclient you are using for your development. However with a RestTemplate Client you do as below
Map<String, List<User>> responseMap= new HashMap<>();
ResponseEntity<Map<String, List<User>>> response =new RestTemplateBuilder().build().getForEntity(url, responseMap.getClass());

I used the builder so that default message converters are used.


text:
Q: How to lay a button right after the ellipsis in text view? I have a textview which has been already truncated by this:
self.textView.textContainer.maximumNumberOfLines = 2;
self.textView.textContainer.lineBreakMode = NSLineBreakByTruncatingTail;

Now, I wanna lay a button right after the ellipsis, so I can expand it at my own, but I dont have any idea how to do it. Could you suggest me some solutions?
Thanks.


text:
Q: Why there is no .bss segment in COFF object file? A simple hello world program:
#include <stdio.h>

int main(void)
{
    printf("Hello, world!\n");
    return 0;
}

After dumpbin it with /HEADERS flag, i get those segments:
  8 .bss
  A0 .debug$S
  62 .drectve
  F .rdata
  8B .text$mn

If compile the program with /TC, so that it's a C program, i get those segments after the same use of a dumpbin:
2000 .data
1000 .gfids
7000 .rdata
1000 .reloc
10000 .text

point is:
How do i get this similar kind of output:
# objdump -hrt hello.o
hello.o:     file format elf32-i386

Sections:
Idx Name          Size     VMA       LMA       File off  Algn
  0 .text         00000011 00000000  00000000  00000034  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .data         00000000 00000000  00000000  00000048  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000000 00000000  00000000  00000048  2**2
                  ALLOC
  3 .rodata.str1.1 0000000d  00000000  00000000  00000048 2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .comment      00000033  00000000 00000000  00000055  2**0
                  CONTENTS, READONLY

SYMBOL TABLE:
00000000 l    df *ABS*  00000000 hello.c
00000000 l    d  .text  00000000
00000000 l    d  .data  00000000
00000000 l    d  .bss   00000000
00000000 l    d  .rodata.str1.1 00000000
00000000 l    d  .comment       00000000
00000000 g    F  .text  00000011 main
00000000         *UND*  00000000 puts


text:
Q: vshost.exe not terminating properly in Visual Studio 2015 I am in charge of testing VS 2015 and how it works with our current applications for my employer. We currently use VS 2013 for everything we have, so I know there are no issues there. The problem I am having is that it appears the vshost.exe isn't terminating correctly or something. I have not narrowed down the exact issue but so far that is what I believe.
Here is how I get my error:

*

*Run my app in debug

*Open a few windows

*Hit the "Stop Debug" button (the little red square)

*Clean Solution

*Rebuild Solution

After my rebuild I get the following errors in the EXE:
Error       Could not copy "obj\Debug\APP.exe" to "..\..\bin\APP.exe". Exceeded retry count of 10. Failed.
Error       Unable to copy file "obj\Debug\APP.exe" to "..\..\bin\CRM.exe". The process cannot access the file '..\..\bin\APP.exe' because it is being used by another process.

If I open the Task Manager and manually end the vshost.exe process I can successfully rebuild again, no issues. If I take the same steps, however, I am no longer able to build.
I tested these steps in 2013 and did not have an issue.
Also note that disabling the "Enable the Visual Studio hosting process" does alleviate the issue, however I do not want to disable this option.
Has anyone else had this issue? I know we are still early in release. Any suggestions/solutions to try? Is it possible there is something wrong in our code (which I highly doubt since I would then get the error in 2013, most likely).
Thanks for any help I receive!
EDIT: This is a WPF application written in .Net 4.0 using C#. Also, I have verified that the issue also occurs if I exit the application normally (IE I open a window then close it with the shutdown mode on LastWindowClosed)
SECOND EDIT: This is a new issue that presented itself in Visual Studio 2015 with the addition of the new live diagnostic tools.

A: I have found that if I have the "Enable Diagnostic Tools while debugging" option enabled in the debug settings I get this error. If I disable this option, the error goes away. I am not sure if this is a bug in Visual Studio but I would assume so, unless I need to do something else to shut them down properly. If anyone has comments or concerns, feel free to leave a note.

A: Probably late for the original question (and I see that he had a workaround), but as per MSDN, VSHOST.exe is only an enabler for improving Debug performance or facilitates scenarios such as partial trust debugging. If you do not need that support or can bear the cost of starting a process and attaching the debugger on each debug session, go ahead and disable the hosting process from project designer -> Debug -> Clear the box "Enable Visual Studio hosting process"


text:
Q: Compact embedding for Sobolev space involving time Let $d \in \mathbb{N}$ and $\Omega$ be a bounded domain of $\mathbb{R}^d$.
Consider $m,n,p,q \in \mathbb{N}$ and $T>0$.
Is the space $W^{m,p}([0,T],W^{n,q}(\Omega))$ compactly embedded in any space of continuous functions (such as $C^k([0,T],C^l(\Omega))$ with $k,l\in\mathbb{N}$ ) ?
I guess it is true if $n=m$ and $p=q$, in which case we have
$W^{m,p}([0,T],W^{m,p}(\Omega)) = W^{m,p}(]0,T[\times\Omega)$
and we can use classical compact Sobolev embeddings of Rellich-Kondrachov (right?). However, I did not find any references concerning the general case.
Less general results involving compact embeddings for spaces like $L^p([0,T],W^{n,q}(\Omega))$ or $L^{\infty}([0,T],W^{n,q}(\Omega))$ could be a good start too.
Thanks !

A: The paper "Compact embeddings of vector-valued Sobolev and Besov spaces" by Amann should probably cover your questions.


text:
Q: Term for Only "Unbelieved Warner" I'm looking for a word, phrase, or idiom to describe a person or fictional device.
In stories, especially horror and fantasy, there can be a character who is dismissed when they try to tell others what (they think) is happening.
I would like for this term to make no judgments on such characters, their messages, or deliveries.
For example, some of the related terms I find assume predisposition.
If the message is foreboding, a related term might be doomsayer:

one given to forebodings and predictions of impending calamity

Other terms question the character's reliability, like Chicken Little:

one who warns of or predicts calamity especially without justification

or this definition of alarmist, which challenges the sensibility of the warning:

a person who tends to raise alarms, especially without sufficient reason, as by exaggerating dangers or prophesying calamities.

Another phrase, cry wolf, carries the stigma that the warning is untrue:

to cry or complain about something when nothing is really wrong. (From the story wherein a child sounds the alarm frequently about a wolf when there is no wolf, only to be ignored when there actually is a wolf.)

These are labels other characters might apply to our subject.
But suppose our subject:

*

*Speaks truth (that is, what he says is truly happening), or at least earnestly believes his claim

*Presents his issue sensibly

*Has not engaged in lying, joking, or other practices that would give others reason not to believe him

Then I don't believe any of these terms do justice in describing him, even if his claim is ridiculous.
In a sense, I'm looking for a hypernym to all the above terms.
The words are all about people who warn and are not believed, but they have negative connotations appended to them: reasons to be skeptical (if not dismissive) of such a person's warnings.
Is there a term that means only "someone who warns others, who do not believe him"?
If not, is there one to describe "an honest person who warns others sensibly and yet is not believed"?

A: Such a person is often termed a Cassandra.

A: Because I know my Greek mythology, metaphoric Cassandra is perfectly accessible to me. But it's a bit "literary", and I wouldn't normally use it in conversation because many people wouldn't know what I meant. In my opinion you're much more likely to be understood if you say someone is...

a [lone] voice [crying] in the wilderness
An individual advocating a course of action or proclaiming a message, who is unheeded; an individual whose opinion is proved to be right despite being ignored or contradicted by others

It's from John the Baptist in the Bible saying "I am the voice of one crying in the wilderness" when proclaiming the imminent coming of Christ, but even people who don't know that will normally be familiar with the more general use.

By way of illustrating the difference in prevalence beyond the dreaming spires of academia, check out Google results for "farage" "voice in the wilderness" and "farage" "cassandra" (Nigel Farage is a politician who's long advocated Britain's withdrawal from the European Union, but heretofore has been largely dismissed/ignored by the political establishment). Obviously there's a "gender clash" in calling Farage a Cassandra, but I'd say the main reason newspapers etc., aren't likely to do this is simply because they know many of their readers won't get the reference.


text:
Q: echo non english word in TideSDK I have installed TideSDK 1.3.1 beta, i have a simple php file:
<?php
header("Content-type: text/plain;charset=utf-8");
?>
<html>
<head>
<meta charset=utf-8>
<title>TideSDK</title>
</head>
<body>
<?php
echo "¡aló";
?>
</body>
</html>

but output is:
<html>
<head>
<meta charset=utf-8>
<title>TideSDK</title>
</head>
<body>
¡aló</body>
</htm

what happen to </html> at the end of output.
if i change code to echo "¡aló ¡aló";, last line of output change to  </h.
if i copy code to apache server,output  is correct.
is there any mistake in my code, or this is a bug?

A: Your PHP file was "ANSI as UTF8" encoded, which seemed to cause the problem.
After I fixed the file encoding and converted it to UTF8 (i used Notepad++ for this task, which has a easy function for that), it worked fine.
Find the fixed files here: http://d.pr/f/UksA


text:
Q: Multi-Indexed fillna in Pandas I have a multi-indexed dataframe and I'm looking to backfill missing values within a group. The dataframe I have currently looks like this:
df = pd.DataFrame({
                'group': ['group_a'] * 7 + ['group_b'] * 3 + ['group_c'] * 2,
                'Date': ["2013-06-11",
                        "2013-07-02",
                        "2013-07-09",
                        "2013-07-30",
                        "2013-08-06",
                        "2013-09-03",
                        "2013-10-01",
                        "2013-07-09",
                        "2013-08-06",
                        "2013-09-03",
                        "2013-07-09",
                        "2013-09-03"],
                 'Value': [np.nan, np.nan, np.nan,  9,  4, 40, 18, np.nan, np.nan, 5, np.nan, 2]})

df.Date = df['Date'].apply(lambda x: pd.to_datetime(x).date())
df = df.set_index(['group', 'Date'])

I'm trying to get a dataframe that backfills the missing values within the group.
Like this:
Group   Date        Value
group_a 2013-06-11      9
        2013-07-02      9
        2013-07-09      9
        2013-07-30      9
        2013-08-06      4
        2013-09-03     40
        2013-10-01     18
group_b 2013-07-09      5
        2013-08-06      5
        2013-09-03      5
group_c 2013-07-09      2
        2013-09-03      2

I tried using pd.fillna('Value', inplace=True), but I get a warning on setting a value on copy, which I've since figured out is related to the presence of the multi-index. Is there a way to make fillna work for multi-indexed rows? Also, ideally I'd be able to apply the fillna to only one column and not the entire dataframe.
Any insight on this would be great.

A: Use groupby(level=0) then bfill and update:
df.update(df.groupby(level=0).bfill())
df

Note: update changes df inplace.

Other alternatives
df = df.groupby(level='group').bfill()

df = df.unstack(0).bfill().stack().swaplevel(0, 1).reindex_like(df)

Column specific
df.Value = df.groupby(level=0).Value.bfill()


text:
Q: What is zero (deleted) in pmap output? Whats does the zero (deleted) under Mapping column mean from the output of pmap -x pid command in Linux? How is it different from anon? I couldn't find anything from the man page.
Address   Kbytes     RSS   Dirty Mode   Mapping
adf00000     132      36      36 rw---    [ anon ]
adf21000     892       0       0 -----    [ anon ]
ae0ff000       4       0       0 -----    [ anon ]
aea69000     504       0       0 rw-s-  zero (deleted)
aeae7000       4       0       0 -----    [ anon ]
aeae8000    8192      24      24 rw---    [ anon ]
af2e8000   65536   11968       0 rw-s-  apc.eEfjkY (deleted)
b32fd000     236       8       0 r-x--  libxslt.so.1.1.26
b3338000       4       4       4 rw---  libxslt.so.1.1.26

A: You can observe that the mappings that are shared indicated by the 's' under the mode column are shown as deleted.
The shared mappings declared by the MAP_SHARED flag in the mmap call will be shown as deleted in the pmap since the shared memory regions used by processes have to be counted only once.
As for the zero all mappings that are not backed by a file are zero initialized. We know that the linux allocates memory only when the data is written to it.
Therefore any region that is shared and uninitialised (no data written on to it by process) will be accounted by pmap as zero(deleted).
Also i observed that if u remove the MAP_SHARED and replace it with say MAP_PRIVATE ,
addr = mmap(NULL,4096,PROT_READ | PROT_WRITE,MAP_ANON|MAP_PRIVATE,-1,0)
the zero(deleted) will no longer appear in pmap output.


text:
Q: RavenDB Embedded license not registering I have added RavenDB.Embedded@5.2.2 to an ASP.NET Core 5.0 application and I am attempting to configure the license without entering it into the studio GUI form. I have 2 licenses: a community and a developer -when I copy/paste either into the studio GUI it works.
I have tried:

*

*Putting the license json into a file called license.json in the Server directory

*Setting the command line arguments to include --License.Path=C:/path/to/the/license.json

*Setting the License.Path key in settings.json to the path to the license

*Steps 2 and 3 but with License and the text value of the license

My expectation is that when setting the license via configuration, the studio should not prompt me for a license. Perhaps my assumption is wrong about this.
Has anyone successfully configured a RavenDB embedded instance without the web form?

A: From the RavenDB team:

Hi,
License is only automatically activated on a non-bootstrapped server (new, empty one). It can be done e.g. like that:

EmbeddedServer.Instance.StartServer(new ServerOptions
{
CommandLineArgs = new List<string>
{
"--License.Path=D:\\temp\\lic.json"
}
});

But if you previously bootstrapped the server (e.g. created a database and there was no license in the env variables or command line args), then license will not be automatically activated. If this was done, then you can issue a POST to https://github.com/ravendb/... with the license JSON.


text:
Q: C++ Vector.erase() causing segmentation fault I have a C++ vector and it has some blank elements in it. I wanted to remove any empty string elements from the vector. I tried this code:
for (i = 0; i < myvector.size();i++) {
  if (myvector[i] == "") {
    myvector.erase(myvector.begin()+i);
  }
}

When I run this code I get a segmentation fault. Is there something wrong with it? Or does this code work for any of you?

A: It appears that you want the usual remove-erase idiom:
#include <algorithm>
#include <functional>

myvector.erase(std::remove_if(myvector.begin(), myvector.end(),
                              std::mem_fn(&std::string::empty)),
               myvector.end());

A: If you have for example vec=["A","","B","C"] and you're delete the element a[1], now 'vec' is long 3 not 4, so vec[3] causes segmentation fault.
Try this:
for (vector<...>::iterator i=myvector.begin();
              i != myvector.end(); /* do nothing here */) {
   if (i->empty()) {
      i=myvector.erase(i);
   } else {
     ++i;
   }
}

However Kerrek's solution is more elegant.

A: First of all, I'm sorry for my English (I'm Brazilian and I'm using the Google translator). But your problem is not exclusively about deleting an item outside the vector, but about accessing its element. Think about the following situation: I have a vector v = {1, 4, 2} and I want to exclude all even numbers using a for and an iterator. When the iterator arrives at the second element (v [2]) it will exclude 4, making the vector {1,2}. But before leaving the for loop, the iterator is still pointing to the second element (v [2]), which is the last element. When it exits, the iterator will be incremented (i ++) and will be equal to v.end (). Therefore, even if it does not give a segmentation fault, the algorithm will not remove all even numbers and, if v was equal to {1,3,4}, it would give the segmentation fault. To fix this, right when you use v.erase (), use i-- (which in the case of your code, which does not directly use the iterator, will work in the same way).Or you can use an increment condition, as in the previous answer, but the iterator needs to be updated correctly.


text:
Q: The fundamental group of torus bundle A torus bundle is labeled by an element $M$ of $SL(2,\mathbb{Z})$ -- the mapping class group of a torus. How to compute the fundamental group of a torus bundle from the 2-by-2 matrix $M \in SL(2,\mathbb{Z})$? Any references?

A: Take a look at the section on monodromy in my old preprint (Rigidity of Fibering, arxiv.org 1106.4595.)

A: A quick google search on "fundamental group of a mapping torus" gives many hits - eg:
https://math.stackexchange.com/questions/39589/fundamental-group-of-mapping-torus?rq=1


text:
Q: Hiding parameter prevents other parameters from refreshing I have the first parameter (client drop down) that passes an ID to the second parameter to be used in the 3rd and 4th parameter.  During testing all the parameters are set to visible to verify what's being passed.  As soon as I hide that second parameter the rest don't refresh.  Again, visible, correct info flowing through, hidden, DOA.  I have this set up exactly like this on at least a dozen other reports with no issue.  I'm not real sure where this going wrong since I can see the correct value being passed while visible?

A: I was able to duplicate your issue. While I can't find a reference to support my supposition, I believe that hidden parameters (even those with a default value) are not evaluated until rendering, which would explain this behavior. Data sets that drive parameter values are run prior to the report being rendered.
As you're talking about having trouble with dependencies between the parameter values, I assume you're using queries to drive your available values for parameters three and four. If this is the case, then simply embed the logic that relates the value(s) of parameter 1 to the value(s) of parameter 3 into the query that drives parameter 3's available values. By cutting out Parameter 2 and incorporating it into the query logic for parameter 3, you will work around this issue.
If you're having trouble accomplishing this, reply in a comment and I'll see if I can help. As it stands, I don't know enough about what you're trying to do to help any more.


text:
Q: gdb can't run programs linked against libcrypto On raspbian , I can't run a program linked with libcrypto from gdb. It doesn't matter what the program contains. Example:
(gdb) r
Starting program: /home/pi/test/test
Program received signal SIGILL, Illegal instruction.
0x400844c0 in ?? () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
(gdb) signal SIGILL
Continuing with signal SIGILL.
Cannot access memory at address 0x0
Program received signal SIGILL, Illegal instruction.
0x400844c8 in ?? () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
(gdb) signal SIGILL
Continuing with signal SIGILL.
Cannot access memory at address 0x0
[Inferior 1 (process 1566) exited normally]
(gdb)

*


text:
Q: How do you export a 3d-model in QGIS to a file that can be read in Rhino? I am really new to QGIS and haven't really gotten familiar with all the functions yet. I've made a 3D map/model in QGIS, and would like to export this in a file format so that I can use it as a terrain model in Rhino. How do I do this?

A: You probably don't have to export the 3D view. This is just a visualisation. The source data is what you want to be looking at. Am guessing that your source data is going to be a Digital Elevation Model (DEM) or TIN. Possibly a raster gridded dataset might be suitable also.
All of this will of course depend on what Rhino can support as an input file.
The question might be more suited to being a 'What GIS formats does Rhino software accept as input"


text:
Q: Windows 8 tablet keyboard dock hard drive I've bought an ASUS TX300CA Windows 8 transformer tablet which has a detachable keyboard dock.
The tablet is a Core i7 machine and has serious power - so I want to use it to do sporadic and ad-hoc software development on it.
The tablet has a neat feature that although the detachable tablet part has only a 128Gb SSD, when you attach the keyboard dock, you get an additonal 500Gb of magnetic hard drive.
What I want to be able to do is to install applications so that they will install either completely on the tablet drive or completely on the dock drive.
For example, I'd like to put most of Microsoft Office on the tablet, but put say Microsoft Visual Studio on the dock drive.
Can this be done?  What's best practice for this?
TIA,
Paolo

A: You can certainly install software on an external drive, typically if "Advanced" is chosen during program installation, you can choose an alternate location for the install.
Obviously when you're not docked, you won't be able to use Visual Studio if it's installed on another drive. You'll also probably encounter some missing file errors if you try to use any context menus the program might install as well.
Finally, all of the registry information and any files or drivers (e.g. any files that would go into %WINDIR% or system32/SysWOW64) that need to be installed along with the software will be placed on your SSD or main Windows volume.


text:
Q: ColumnMapping.Add alternative I have my PowerShell script:
$dataSource = "HPVIE1APARBLD21";
$database = "tempdb"

$connection = New-Object System.Data.SqlClient.SqlConnection;  #setting connection
$connection.ConnectionString = "Server=$dataSource;Database=$database;Integrated Security=True;";
$connection.Open();

$command = New-Object System.Data.SqlClient.SqlCommand;
$command.Connection = $connection;

$as = New-Object System.Data.SqlClient.SqlDataAdapter;
$as.SelectCommand = $command;
$filename = 'C:\XML\apc.xml';            #file to be loaded into sql server database table

$ds = New-Object System.Data.DataSet;
$ds.ReadXml($filename);    #reading from the file -- line gives output InferSchema

$dt = New-Object System.Data.DataTable;
$dt=$ds.Tables[0];

$bcp = New-Object "Data.SqlClient.SqlBulkCopy" $connection; #bulkcopy to the destination table.
$bcp.DestinationTableName = "dbo.tempor";

$bcp.ColumnMappings.Count;
$bcp.ColumnMappings.Clear();

$bcp.ColumnMappings.Add("StartTime","StartTime");
$bcp.ColumnMappings.Add("EndTime","EndTime");
$bcp.ColumnMappings.Add("Status","Status");
$bcp.ColumnMappings.Add("ProcessedTime","ProcessedTime");
$bcp.ColumnMappings.Add("ScheduleId","ScheduleId");
$bcp.ColumnMappings.Add("Model","Model");
$bcp.ColumnMappings.Add("ModelVersion","ModelVersion");
$bcp.ColumnMappings.Add("ModelVersionState","ModelVersionState");
$bcp.ColumnMappings.Add("ModifiedTime","ModifiedTime");
$bcp.ColumnMappings.Add("WriteBackLastRunTime","WriteBackLastRunTime");
$bcp.ColumnMappings.Add("ModifiedBy","ModifiedBy");
$bcp.ColumnMappings.Add("ModelType","ModelType");
$bcp.ColumnMappings.Add("IsTimeRange","IsTimeRange");
$bcp.ColumnMappings.Add("WriteBackStatus","WriteBackStatus");
$bcp.ColumnMappings.Add("RetryWriteBack","RetryWriteBack");
$bcp.ColumnMappings.Add("NumOfRetry","NumOfRetry");
$bcp.ColumnMappings.Add("FrequencyUnits","FrequencyUnits");
$bcp.ColumnMappings.Add("ScheduleType","ScheduleType");
$bcp.ColumnMappings.Add("CustomType","CustomType");
$bcp.ColumnMappings.Add("WritebackProcessedTime","WritebackProcessedTime");
$bcp.ColumnMappings.Add("DiagStatus","DiagStatus");
$bcp.ColumnMappings.Add("AccountingPeriodCase_PK_ID","AccountingPeriodCase_PK_ID");

$bcp.ColumnMappings.Count;

if ($connection.State -ne [Data.ConnectionState]::Open) {

    "Connection to DB is not open."

    Exit

}

$bcp.WriteToServer("$dt");        #writing to server  -- not loading content of xml file to sql server table
$connection.Close();

Now for this script, my output is:
I want to insert the values of the following xml file: apc.xml
    <?xml version="1.0" standalone="yes"?>
<NewDataSet>

        <StartTime>2017-01-14T18:30:00+05:30</StartTime>
        <EndTime>2017-01-15T18:30:00+05:30</EndTime>
        <Status>1</Status>
        <ProcessedTime>2017-04-06T05:51:18.843+05:30</ProcessedTime>
        <ScheduleId>db6f3178-4702-456c-904b-2cd833b54efa</ScheduleId>
        <Model>Gasco_Hotfix</Model>
        <ModelVersion>G3</ModelVersion>
        <ModelVersionState>1</ModelVersionState>
        <ModifiedTime>2017-04-06T05:51:58.48+05:30</ModifiedTime>
        <ModifiedBy>l4-dc\ilbinstall</ModifiedBy>
        <ModelType>1</ModelType>
        <IsTimeRange>true</IsTimeRange>
        <RetryWriteBack>false</RetryWriteBack>
        <NumOfRetry>0</NumOfRetry>
        <FrequencyUnits>2</FrequencyUnits>
        <ScheduleType>1</ScheduleType>
        <CustomType>0</CustomType>
        <DiagStatus>2</DiagStatus>
        <AccountingPeriodCase_PK_ID>9544940d-8d1a-e711-80d3-0050569c2fb6</AccountingPeriodCase_PK_ID>

        <StartTime>2017-01-15T18:30:00+05:30</StartTime>
        <EndTime>2017-01-16T18:30:00+05:30</EndTime>
        <Status>1</Status>
        <ProcessedTime>2017-04-06T05:51:18.843+05:30</ProcessedTime>
        <ScheduleId>db6f3178-4702-456c-904b-2cd833b54efa</ScheduleId>
        <Model>Gasco_Hotfix</Model>
        <ModelVersion>G3</ModelVersion>
        <ModelVersionState>1</ModelVersionState>
        <ModifiedTime>2017-04-06T05:52:29.073+05:30</ModifiedTime>
        <ModifiedBy>l4-dc\ilbinstall</ModifiedBy>
        <ModelType>1</ModelType>
        <IsTimeRange>true</IsTimeRange>
        <RetryWriteBack>false</RetryWriteBack>
        <NumOfRetry>0</NumOfRetry>
        <FrequencyUnits>2</FrequencyUnits>
        <ScheduleType>1</ScheduleType>
        <CustomType>0</CustomType>
        <DiagStatus>2</DiagStatus>
        <AccountingPeriodCase_PK_ID>9644940d-8d1a-e711-80d3-0050569c2fb6</AccountingPeriodCase_PK_ID>

 </NewDataSet>

Into the table dbo.tempor in the database tempdb.
Could anyone help me up with the error?
And also, i would like to know if there is a method to not add column mappings manually by writing each column names. I mean, is there a way to dynamically add columns without having to manually type up each column name?
The purpose is sometimes in future i would have to add more columns to the original table, then again i can't come back to the script and do changes manually. So if there is an alternative method please do help me up with it.
Thank you.

A: I think, that this appraoch cannot get the XMLs schema automatically. I'd try an approach like this:
DECLARE @xml XML=
N'<?xml version="1.0" standalone="yes"?>
<NewDataSet>

        <StartTime>2017-01-14T18:30:00+05:30</StartTime>
        <EndTime>2017-01-15T18:30:00+05:30</EndTime>
        <Status>1</Status>
        <ProcessedTime>2017-04-06T05:51:18.843+05:30</ProcessedTime>
        <ScheduleId>db6f3178-4702-456c-904b-2cd833b54efa</ScheduleId>
        <Model>Gasco_Hotfix</Model>
        <ModelVersion>G3</ModelVersion>
        <ModelVersionState>1</ModelVersionState>
        <ModifiedTime>2017-04-06T05:51:58.48+05:30</ModifiedTime>
        <ModifiedBy>l4-dc\ilbinstall</ModifiedBy>
        <ModelType>1</ModelType>
        <IsTimeRange>true</IsTimeRange>
        <RetryWriteBack>false</RetryWriteBack>
        <NumOfRetry>0</NumOfRetry>
        <FrequencyUnits>2</FrequencyUnits>
        <ScheduleType>1</ScheduleType>
        <CustomType>0</CustomType>
        <DiagStatus>2</DiagStatus>
        <AccountingPeriodCase_PK_ID>9544940d-8d1a-e711-80d3-0050569c2fb6</AccountingPeriodCase_PK_ID>

        <StartTime>2017-01-15T18:30:00+05:30</StartTime>
        <EndTime>2017-01-16T18:30:00+05:30</EndTime>
        <Status>1</Status>
        <ProcessedTime>2017-04-06T05:51:18.843+05:30</ProcessedTime>
        <ScheduleId>db6f3178-4702-456c-904b-2cd833b54efa</ScheduleId>
        <Model>Gasco_Hotfix</Model>
        <ModelVersion>G3</ModelVersion>
        <ModelVersionState>1</ModelVersionState>
        <ModifiedTime>2017-04-06T05:52:29.073+05:30</ModifiedTime>
        <ModifiedBy>l4-dc\ilbinstall</ModifiedBy>
        <ModelType>1</ModelType>
        <IsTimeRange>true</IsTimeRange>
        <RetryWriteBack>false</RetryWriteBack>
        <NumOfRetry>0</NumOfRetry>
        <FrequencyUnits>2</FrequencyUnits>
        <ScheduleType>1</ScheduleType>
        <CustomType>0</CustomType>
        <DiagStatus>2</DiagStatus>
        <AccountingPeriodCase_PK_ID>9644940d-8d1a-e711-80d3-0050569c2fb6</AccountingPeriodCase_PK_ID>

 </NewDataSet>';

--The query will read all columns and insert this to the target table
 INSERT INTO dbo.tempor(StartTime,EndTime,[Status],ProcessedTime /*more columns*/)
 SELECT t.value(N'(StartTime/text())[1]',N'datetime') AS StartTime
       ,t.value(N'(EndTime/text())[1]',N'datetime') AS EndTime
       ,t.value(N'(Status/text())[1]',N'int') AS [Status]
       ,t.value(N'(ProcessedTime/text())[1]',N'datetime') AS ProcessedTime
       --and so on
 FROM @xml.nodes(N'/NewDataSet/Table') AS A(t);

Some explanation
To test this, you can copy my script (together with the XML declaration) into a new SSMS query window and execute it. .nodes() returns all (repeated)
 nodes as derived table.
Using SQL-Server's native XML support allows for fast and typesafe queries. Your XML looks clean and neat, so this should be rather easy.
If this is possible for you, I'd create a stored procedure accepting the XML as input (either NVARCHAR(MAX) or XML). You can call this from PS as a one-liner.
If you expect issues (wrong/missing data) it is recommended to use a tolerant staging table, use this for validation, cleansing, and do the final import from there.

The purpose is sometimes in future i would have to add more columns to
  the original table, then again i can't come back to the script and do
  changes manually.

When you come back to add more columns to the table, it is easy to add them to the SP too...


text:
Q: Setting/Accessing Nunjucks global variables within a NodeJS/KeystoneJS project I've spent all of this morning searching for how to do this, and have come up stumped.
The project I'm working on is built on KeystoneJS/NodeJS.  It's using Nunjucks which I've only got a few days basic experience of.
My issue is that after loading the config vars that sets the URI's/Ports of the services, I then want to set these up as Nunjucks variables, so within the html views, I can use those as the src locations.
I can't share all the code here, as I'm working on a government (UK) project but here's enough I hope.
Keystone.js
// Require keystone
var keystone = require('keystone');
var cons = require('consolidate');
var nunjucks = require('nunjucks');
var env = new nunjucks.Environment(null);

env.addGlobal('provision_uri', 3);

This loads initially, after routing it calls:
Login.js
var keystone = require('keystone');
var nunjucks = require('nunjucks');

exports = module.exports = function (req, res) {

    var view = new keystone.View(req, res);
    var locals = res.locals;

    // locals.section is used to set the currently selected
    // item in the header navigation.
    locals.section = 'home';

    var env = new nunjucks.Environment(null);
    var provision_uri = env.getGlobal('provision_uri',3);

    console.log(`Uri ${provision_uri}`); **<-- ERRORS HERE**

    // Render the view
    view.render('login', {
        title: 'User Login',
        description: 'Login to your Account',
        provision_uri: provision_uri
    });
};

Login.html

<form action="{{provision_uri}}/session" method="post" name="user">

When I then start the project, the landing page loads, click on the login page and within console I get:

GET /provision/ 304 74.147 ms
Error thrown for request: /login
Error: global not found: provision_uri

I've checked this Question however it doesn't answer what I need but I looked up the environment.addGlobal given as an answer.  That did seem to be what I wanted, but still it wouldn't work.  I found this question which provided hope.
Any ideas would be great, I do have a work-around but would like to learn how to use these.
Thanks,
Colin

A: You don't need to create new instance of nunjucks environment on each render call. The new scope (environment) has empty global space.
var nunjucks = require('nunjucks');
var env = new nunjucks.Environment(null);
env.addGlobal('provision_uri', 3);
...
exports = module.exports = function (req, res) {
    ...
    var provision_uri = env.getGlobal('provision_uri',3);
    console.log(provision_uri);

    view.render('login', {
        title: 'User Login',
        description: 'Login to your Account',
        // provision_uri: provision_uri // it's not necessary
    });
}


text:
Q: converting existing puppeteer tests to playwright Trying to convert my existing puppeteer test to playwright. The instruction here is not very clear. Has anyone able to do this successfully? What steps did you follow?
https://github.com/checkly/puppeteer-to-playwright#-getting-started
downloaded the repo. Tried running npm run convert -- -d my-puppeteer-script.js (changed test file name to cookies.js. I get this:
puppeteer-to-playwright@1.0.0 convert
> jscodeshift --run-in-band "-d" "cookies.js"

Skipping path cookies.js which does not exist.
No files selected, nothing to do.
All done.
Results:
0 errors
0 unmodified
0 skipped
0 ok
Time elapsed: 0.002seconds
Tgebrehiwot4@C02FL3CBMD6R puppeteer-to-playwright % npm install -g jscodeshift
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/jscodeshift
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/jscodeshift'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/jscodeshift'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/jscodeshift'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/Tgebrehiwot4/.npm/_logs/2022-10-27T17_55_03_898Z-debug-0.log
Tgebrehiwot4@C02FL3CBMD6R puppeteer-to-playwright %

A: [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/jscodeshift']

This is a permission error, you need to check the folder/file permissions to ensure you have the necessary permissions to perform the actions it needs.
This question can help you how to change the permissions for a specific folder on Linux.


text:
Q: Travel though all  and replace .png with .svg How can I, in javascript or jquery, travel through each of the <img /> tag in a page, check if it is a .png extension, replace the .png extension, if it is a .png extension, with .svg?

A: EDIT:
The following is an edited version of my original answer thanks to the helpful comments.
$('img').each(function() {
  var img_src = $(this).attr('src');
  var new_src = img_src.replace(/\.png$/, '.svg');
  $(this).attr('src', new_src);
});

Original
I haven't tested this, but believe it should work.
$('img').each(function() {
  var img_src = $(this).attr('src');

  if(img_src.indexOf('.png')) {
    var new_src = img_src.replace('.png','.svg');
    $(this).attr('src', new_src);
  }
});

A: Instead of explicitly looping, you can take advantage of one of .attr()'s overloads:
$("img").attr("src", function (idx, attr) {
    return attr.replace(/\.png$/, ".svg");
});

Reference:

*

*http://api.jquery.com/attr/#attr-attributeName-functionindex--attr

A: I don't understand the sense of this question, anyway this is the code(it is untested, but it should work);
var imgs = document.getElementsByTagName('img');
for (var i in imgs) {
    var img = imgs[i],
        ext = img.src.split('.').pop();
    if (ext.toLower() == 'png') {
        img.src = img.src.replace(/\.png$/, '.svg');
    }
}


text:
Q: C++ Error C3078 cannot 'new' an array of unknown bounds Hi I'm new to programming and struggling with these application. Here is the error code:

Error  C3078   you cannot 'new' an array of unknown bounds line 17

I am struggling to understand and grasp the concept of pointers. Any help is great thanks for looking at my code.
#include <iostream>
#include <iomanip>;
using namespace std;

//function prototypes
int getArray(int num);
void selectionsortArray(int *[], int);
double findAverage(int *scores, int nums);
void showSortedArray(int *[], int);

int main()
{
int *scores = new int[]; // To dynamically allocate an array

double total = 0, //accumulator
        average; //to hold average test scores

int testScores, // To hold the amount of test scores the user will enter
    count; //Counter variable

// Request the amount of test scores the user would like to enter
cout << "How many test scores do you wish to process: ";
cin >> testScores;

getArray(testScores);

selectionsortArray(&scores, testScores);

cout << "Test scores sorted:\n\n";
showSortedArray(&scores, testScores);

average = findAverage(scores, testScores);

//set precision
cout << setprecision(2) << fixed;
cout << "\tAverage Score\n";
cout << average;

}

int getArray(int num)
{
int *array, ptr; //set array pointer equal to 0
int count;

cout << "\tPlease enter Test Scores by percent:\n";
for (count = 0; count < num; count++)
{
    cout << "Test score #" << (count+1)<< ": ";
    cin >> array[count];
}

ptr = *array; //Set the ptr to be returned with the array

return ptr; // return ptr
}

void selectionsortArray(int *arr[], int testScores)
{
int startscan, minIndex;
int *minElem;

for (startscan = 0; startscan < (testScores - 1); startscan++)
{
    minIndex = startscan;
    minElem = arr[startscan];
    for(int index = startscan + 1; index < testScores; index++)
    {
        if (*(arr[index]) < *minElem)
        {
            minElem = arr[index];
            minIndex = index;
        }
    }
    arr[minIndex] = arr[startscan];
    arr[startscan] = minElem;
}
}

void showSortedArray(int *arr[], int testScores)
{
for ( int count = 0; count < testScores; count ++)
    cout << *(arr[count]) << " \n";
}

double findAverage(int *scores, int testScores)
{
double average = 0;

for (int count = 0; count < testScores; count++)
    average += scores[count];

average /= testScores;

return average;
}

A: int *scores = new int[]; // To dynamically allocate an array

Above line will fail with the error message you specified in question, since you didnt specify the array length for initialization. In C++ array declaration using dynamic allocation need a constant integer as array size.
If you change your code as follow, or a number suitable for your need in place of 10 , will solve your issue.
int *scores = new int[10]; // To dynamically allocate an array

Since you allocate memory using new operator, you should deallocate after usage as follows:
delete[] scores;

A: Your error is here:
int *scores = new int[]; // To dynamically allocate an array

You can't do this in C++. If you don't know the size of array you can create the pointer:
int *scores;

When you will know the size, you will be able to allocate memory on heap:
scores = new int[5]; // To dynamically allocate an array

About the difference between static and dynamic allocation you can read here:
Declaring array of int
And delete scores after you are done with it or you will get memory leak.


text:
Q: Monoatomic fluids and free space around atoms In monoatomic fluids the atoms can move quite freely around each other. Is there any thermodynamic/statistical mechanic equation how much free space there is between the atoms? This has to be proportional to temperature.

A: Here's a way to get a decent distance estimate for solids, liquids or gases.:
for solids or liquids, you can get the number density, $n$, of atoms or molecules (as needed), from the density, Avogadro's number ($6.02E23$) and the molecular weight ($\rho,N_a,W$:
$$n = \frac{\rho N_a}{W}$$
for a gas with pressure, temperature and the boltzmann constant ($P,T,k_B$):
$$n = \frac{P}{k_B T}$$
Then, $n^{-1}$ gives a volume per molecule. Take that volume to be spherical solve for the radius ($r$).
$$r=\left(\frac{3}{4n}\right)^{1/3}$$
There are probably arguments for some kind of coefficient that would make this a bit more accurate, based on packing efficiency or somesuch, but this will basically get you the answer.
For example, with iron ($\rho = 7874 \, kg/m^3,W=0.056 \, kg/mol$) you get $r=207 \, nm$, while the atomic diameter is $252 \, nm$. For aluminum ($\rho = 2700 \, kg/m^3,W=0.027 \, kg/mol$), you get $r=232 \, nm$while the atomic diameter is $286 \, nm$.
For air at $101325 \, kPa, 298 \, K$ you get $3.12 \, nm$ while the mean free path is $\sim 68 \, nm$.


text:
Q: Django: Validate GET parameter I offer discount codes in my checkout. I created form where users can type in the discount code and click on apply. The form checks if the discount code is valid and then applies it.
Now I want to add the functionality to add to the url domain.com/event/?discount=ABC
I want to check if request.GET is set an then somehow redirect it to the 'form' / transform it into a request.POST, so I can validate it. I am currently struggling to find the right approach to do that. Do you have any suggestions on how I could use the GET-parameter and validate it the same way as I would use the form?
views.py
def dispatch(self, request, *args, **kwargs):
    # Provide discount_code to all functions
    self.discount_code = None

    # Check if discount code is saved as a session
    self.discount_code_session = request.session.get(
        request.event.discount_code_cookie(), None)
    if self.discount_code_session:
        self.discount_code = Discount.objects.filter(
            code=self.discount_code_session,
            event=self.request.event.pk
        ).first()

@transaction.atomic
def post(self, request, *args, **kwargs):

    # Discount Code
    if self.discount_form.is_valid():
        discount_code = self.discount_form.cleaned_data['code']
        request.session[request.event.discount_code_cookie()] = discount_code
        return redirect('events:detail', request.organizer.slug, request.event.slug)

forms.py
class DiscountFormEventPage(forms.ModelForm):
    # Remove required attribute from HTML elements
    use_required_attribute = False
    class Meta:
        model = Discount
        fields = (
            'code',
        )
    def __init__(self, *args, **kwargs):
        self.event = kwargs.pop('event')
        super().__init__(*args, **kwargs)
        for visible_field in self.visible_fields():
            visible_field.field.widget.attrs['class'] = 'form-control'
    def clean_code(self):
        input_code = self.cleaned_data['code']
        # Check if discount code exists
        discount_code = self.event.discounts.filter(code=input_code).first()
        if not discount_code:
            raise forms.ValidationError(_("The discount code couldn't be found."),
                                        code='code_exists')
        elif not discount_code.is_active():
                raise forms.ValidationError(_("This discount code is not available\
                                               anymore."),
                                            code='code_not_active')
        return input_code

UPDATE:
I now added this here in my view.py (DetailView):
def get(self, request, *args, **kwargs):

    discount_code_get = request.GET.get('code')
    if discount_code_get:
        return DiscountFormEventPage(
            prefix='discount',
            data=request.GET,
            event=self.request.event,
        )

A: I don't see where you're getting the parameter, is it what your question is about? You can get it as follow:
# request.GET is a dict-like object
code = request.GET['discount']
# safer alternative against KeyError
code = request.GET.get('discount')
# if discount may be specified multiple times
code = request.GET.getlist('discount')

If you want to use a form to validate the incoming data, you should be able to pass it as first argument:
form = DiscountFormEventPage(request.GET)
if form.is_valid():
     data = form.cleaned_data
     return redirect('events:detail', request.organizer.slug, request.event.slug)

A: I could solve it now with this code. Thank you to Bruno for helping me to find the right track:
def get(self, request, *args, **kwargs):
    # Apply discount via GET parameter ?code=DISCOUNT
    discount_code_get = request.GET.get('code')
    if discount_code_get:
        self.discount_form = DiscountFormEventPage(
            data=request.GET,
            event=self.request.event,
        )
    if self.discount_form.is_valid():
        discount_code = self.discount_form.cleaned_data['code']
        request.session[request.event.discount_code_cookie()] = discount_code
        return redirect('events:detail', request.organizer.slug, request.event.slug)
    return super().get(request, *args, **kwargs)


text:
Q: jps command shows DFSAdmin process iam using hadoop apache 2.7.1
on centos 7 environment
and i have an HA Cluster which consists of two name nodes(mn1 and mn2)
 and 6 data nodes
issuing jps on mn1 shows
34734 DFSZKFailoverController
34245 NameNode
31529 DFSAdmin
34551 JournalNode
34822 Jps
3857 QuorumPeerMain

and issuing jps on mn2 shows
26272 JournalNode
26483 Jps
26110 NameNode
26388 DFSZKFailoverController
2259 QuorumPeerMain

what does DFSAdmin Process in mn1 jps output refers to ?

A: i noticed that this dfsadmin process appeared in the following scenario:
when number of failed journal nodes exceeds possible numbers of journal nodes for cluster to continue working
Which is defined in formula
(N-1)/ 2 where N is number of journal nodes
So the cluster will not continue to work and active name node shut downs
so if i started accepted number of journal nodes and name node again
jps on active name node shows dfsadmin process
and this problem was solved by restarting all cluster services a gian


text:
Q: Identify elements from df1 in df2, then add column in df2 in those rows that were coincident using R I have a dataframe with two columns (genome) and a dataframe with one column (list_SSNP).
What I am trying to do is to add a third and fourth columns in my Genome dataframe and add the value "1" for those positions in Genome that appear in list_SSNP and, separately, in list_SCPG.
I am trying to get an output dataframe that looks like this:
Gene_Symbol       CHR        SNP
A1BG             19q13.43
PDE1C            12p13.31     1

This is part of the content of Genome and I have included a reproducible example:
Genome <- c()
Genome$Gene_Symbol <- c("A1BG", "A1BG-AS1", "A1CF", "A2M", "PDE1C")
Genome$CHR <- c("19q13.43", "19q13.43", "10q11.23", "12p13.31", "12p13.31")
Gene_Symbol CHR
        1   A1BG        19q13.43
        2   A1BG-AS1    19q13.43
        3   A1CF        10q11.23
        4   A2M         12p13.31
        5   PDE1C       12p13.31

And this is part of the content of list_SSNP:
list_SSNP <- c("PDE1C", "IMMP2L", "ZCCHC14", "NOS1AP", "HARBI1")
    Gene_Symbol
1   PDE1C
2   IMMP2L
3   ZCCHC14
4   NOS1AP
5   HARBI1

Using only 1 of the dataframes (list_SSNP), which is what I am attempting to do first, what I have tried to do is a loop through the genome dataframe and for element i (row) in my Genome if the element i of my list_SSNP dataframe is like element i in my Genome dataframe, then add the number 1 to a third column, but when I execute this code, nothing happens.
Full_genome <- read.table("FULL_GENOME.txt", header=TRUE, sep = "\t", dec = ',', na.strings=c("","NA"), fill=TRUE)
Genome <- Full_genome[,c(2,3)]
names(Genome) <- c("Gene_Symbol", "CHR")

list_SSNP <- as.data.frame(Gene_SSNP$Gene_Symbol)

for (i in 1: dim (Genome) [1]) {
  if(list_SSNP[i] %in% Genome[i,1]){
    Genome[i,3] <- 1
  }
}

Just to further clarify, I have checked that all the elements from list_SSNP appear in Genome, so it is absolutely certain that it is not a matter of not finding any coincidences.
EDIT:
I have come to realize that my example does not specify that the entries in list_SSNP and Genome are unique and have no duplicates and that Genome has about 30k lines of entries, while list_SSNP has 49. I just want to add a column in Genome and a number 1 in those rows where the entry exists in both Genome and list_SSNP.

A: I believe this could help. You can try this code:
#Data
Genome <- data.frame(Gene_Symbol = c("A1BG", "A1BG-AS1", "A1CF", "A2M", "PDE1C"),
                     CHR = c("19q13.43", "19q13.43", "10q11.23", "12p13.31", "12p13.31"),
                     stringsAsFactors = F)
list_SSNP <- c("PDE1C", "IMMP2L", "ZCCHC14", "NOS1AP", "HARBI1")
#Collapse
vecc <- paste0(list_SSNP,collapse = '|')
#Contrast
Genome$SNP <- as.numeric(grepl(pattern = vecc,x = Genome$Gene_Symbol))

Output:
  Gene_Symbol      CHR SNP
1        A1BG 19q13.43   0
2    A1BG-AS1 19q13.43   0
3        A1CF 10q11.23   0
4         A2M 12p13.31   0
5       PDE1C 12p13.31   1

A: I may miss something important here, but the problem is formulated quite specifically to its domain. So, when I abtsracted it, I may have overseen an issue with my proposed solultion.
However, I understand that list_SSNP can have a SNP entry multiple times. So first of all, you could create a list of unique SNPs with the count of its occurences
library(dplyr)

list_SSNP = data.frame(SNP = c("PDE1C", "IMMP2L", "ZCCHC14", "NOS1AP", "HARBI1"))
unique_SSNP = list_SSNP %>%
    group_by(SNP) %>%
    # the summarize() could be replaced by count I guess, but I usually use this for more control
    summarize(count = n())

And now you use a left_join
Genome = data.frame(Gene_Symbol = c("A1BG", "A1BG-AS1", "A1CF", "A2M", "PDE1C"),
                     CHR = c("19q13.43", "19q13.43", "10q11.23", "12p13.31", "12p13.31"),
                     stringsAsFactors = F)

Genome_extended = Genome %>%
    left_join(unique_SSNP, by = c("Gene_Symbol" = "SNP"))

The count column in the extended dataframe would be NAs for non-existing SNPs and you could fill the NAs with a variety of commands from dplyr, tidyr or even base R.


text:
Q: Need to handle dynamic params in angular UI router, and load templates accordingly I need to handle dynamic params in angular ui-router and load templates according also if someone use link to come on my site, he should be able to reach at desired page. I need to use it for multiple parameters and get the value form server to related values.
.state('home', {
url: '/:shop',
views: {
    "mainbox": {
        templateUrl: "app/shop/main.html",
        controller: "shopMainCtrl",
        controllerAs: "shop"
    }
    // xyz.com/wallmart  should be landed here
}

})
.state('course', {
    url: '/:shop/:area',
    views: {
        "mainbox": {
            templateUrl: "app/area/nav.html",
            controller: "areaNavCtrl",
            controllerAs: "areaNav"

        }
        //xyz.com/wallmart/california  should be landed here
    }

})
.state('area.food', {
    url: '/food',
    views: {
        "mainboxcontent": {
            templateUrl: "app/area/food.html",
            controller: "foodMainCtrl",
            controllerAs: "food"

        }//xyz.com/wallmart/california/food  should be landed here
    }

}).state('area.cloths', {
    url: '/cloths',
    views: {
        "mainboxcontent": {
            templateUrl: "app/area/cloths.html",
            controller: "clothsCtrl",
            controllerAs: "cloths"

        }
        //xyz.com/wallmart/california/cloths  should be landed here
    }

})

.state('buy', {
    url: '/:shop/:area/:buy',
    views: {
        "mainbox": {
            templateUrl: "app/buy/buynow.html",
            controller: "buyMainCtrl",
            controllerAs: "buyNow"
        }
        //xyz.com/wallmart/california/iphone  should be landed here
    }

})

A: https://github.com/angular-ui/ui-router/wiki
templateProvider is something you may try.
stackoverflow: Angular UI Router: decide child state template on the basis of parent resolved object


text:
Q: R plot method for a S3 subject I am trying to write a plot method for a object of S3 class shwehart. This plot should show values of Xi, should include warning limits and actions limits lines.
I tried to use plot.shewhart(x,y,...) and R gave me a plot, but without straight lines.
Could anyone help me? Thanks in advance.
aa<-c(1:10)
bb<-c(127,128,128.5,125.5,129,126.5,129,126,125,130)
samean<-data.frame(aa,bb)

class(samean)<-"shewhart"

plot.shewhart<-function(x){
  mu=127
  sigma=3.4
  plot(x<-samean[,1],y<-samean[,2], type="b", col="blue",
       xlim<-c(0,10), ylim<-c(120,140)   )

  abline(h=mu, col="blue")
  abline(h=mu+3*sigma/sqrt(100), col="green")
  abline(h=mu-3*sigma/sqrt(100), col="green")
}

plot(samean)

A: You have two problems in the code you post.
1) You want to use samean like a data frame--you want things like samean[, 1] to work--but also like your new class shewhart. So you don't want to replace the data.frame class, you want to extend it. We change your line
# class(samean)<-"shewhart" # bad
class(samean) <- c("shewhart", class(samean)) # good

This way it is still a data.frame, it's just a special type of data frame:
class(samean)
# [1] "shewhart"   "data.frame"

2) For function arguments, use = not <-. This is a problem in your plot command. Also, your function names its input x, so you should refer to it only as x inside the function.
# plot(x<-samean[,1],y<-samean[,2], type="b", col="blue",
   xlim<-c(0,10), ylim<-c(120,140)   ) # bad

plot(x = x[,1], y = x[,2], type = "b", col = "blue",
   xlim = c(0,10), ylim = c(120,140)   ) # good

With these changes, the code works as you describe. I re-formatted for readability, but the only real changes are the ones mentioned above.
aa <- c(1:10)
bb <- c(127, 128, 128.5, 125.5, 129, 126.5, 129, 126, 125, 130)
samean <- data.frame(aa, bb)

class(samean) <- c("shewhart", class(samean))

plot.shewhart <- function(x) {
  mu = 127
  sigma = 3.4
  plot(
    x = x[, 1],
    y = x[, 2],
    type = "b",
    col = "blue",
    xlim = c(0, 10),
    ylim = c(120, 140)
  )

  abline(h = mu, col = "blue")
  abline(h = mu + 3 * sigma / sqrt(100), col = "green")
  abline(h = mu - 3 * sigma / sqrt(100), col = "green")
}

plot(samean)

Please do not delete your question now that it has been answered.