text:
Q: How do I convert  tags in markdown cells when exporting in Jupyter? I've got a large report-like notebook which has got many images. Instead of using the ![title](link) syntax, I've had to use  instead, so I have better control on them.
While this works inside the notebook in Jupyter Server, the inline  tags get rendered verbatim, instead of showing up as images.
I figure the problem resides with the nbconvert module which handles the conversion, but it seems as though a similar issue has already been resolved.
My links were originally linking directly to http:// links, but I've pulled them all locally, and am still getting verbatim HTML code instead of images.

*

*Jupyter version: 4.2.1

*nbconvert version: 5.2.1

*Python: 3.6.1

*Distribution: Anaconda

*Platform: Windows

A: As discussed in this issue this may be related to how mistune (which nbconvert uses) parses html attributes. What version of mistune do you have?
If you have mistune 0.7.3 you will run into the following:
In [1]: import mistune

In [2]: mistune.markdown('\n   \n', escape=False)
Out[2]: '
<img src="link" align="right" width=100>
\n'

In [3]: mistune.markdown('\n   \n', escape=False)
Out[3]: '

\n'

In [4]: mistune.__version__
Out[4]: '0.7.3'

Whereas 0.7.4 provides:
In [1]: import mistune

In [2]: mistune.markdown('\n   \n', escape=False)
Out[2]: '

\n'

In [3]: mistune.markdown('\n   \n', escape=False)
Out[3]: '

\n'

In [4]: mistune.__version__
Out[4]: '0.7.4'

If you add quotes to your html attributes – e.g.,  – that may fix the problem.

A: Downgrading mistune solves the problem for me.
conda install mistune=0.7.2


text:
Q: Kivy - setting the background color of a button. I'm trying to set the background color of a button to blue using Kivy. I went to an RGB generation website and copied the values from there for the color I wanted however it doesn't seem to be working. My Kivy code for the button is here:
Button:
        text: 'Calories'
        font_size: 30
        on_release: app.root.current = 'calories'
        background_normal: ' '
        background_color: (51, 23, 186.0, 1)

When I run this the button goes pure white. I am also curious as to how I would get the text to change color.

A: Looking at the examples at github it seems the values aren't 0-255 RGB like you might expect but are 0.0-1.1
bubble.background_color = (1, 0, 0, .5) #50% translucent red
background_color: .8, .8, 0, 1

etc.
You'll probably need something like
background_color: .2, .1, .73, 1

A: delete background_normal: ' ', just use background_color: (R, G, B, A) pick a color in this tool and divide R, G and B by 100 A=always 1 (transparency), for example if you choose (255, 79, 25, 1) write instead (2.55, 0.79, 0.25, 1).

redpajama_set_name: RedPajamaStackExchange


text:
Q: L5 Using Hashid in middleware returns null I am using hashid to hash the id parameters in url.  I have it set up in my model to automatically hash the id.  This is working fine.  My problem is decoding the hash in a middleware returns null.  I'm not sure if this is a problem with my middleware or because of the hashing.
Model:
public function getIdAttribute($value)
    {
        $hashids = new \Hashids\Hashids(env('APP_KEY'),10);
        return $hashids->encode($value);
    }

Middleware:
<?php

namespace App\Http\Middleware;

use Closure;

class HashIdsDecode
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        dd($request->id); //Returns null on show method - example localhost:8000/invoices/afewRfshTl
        if($request->has('id'))
        {
            $hashids = new \Hashids\Hashids(env('APP_KEY'),10);
            dd($hashids->decode($request->input('id')));
        }

        return $next($request);
    }
}

Route:
Route::resource('invoices','InvoiceController');

Controller:
public function show($id)
    {
        $invoice = Invoice::find($id);
        return view('invoices.show', [
            'invoice' => $invoice,
            'page_title' => ' Invoices',
            'page_description' => 'View Invoice',
        ]);
    }

NOTE: if I bypass the middleware and do it directly in my controller like this it works but it requires me to repeat myself over and over and probably not the best way to do it.
public function show($id)
    {
        $hashids = new \Hashids\Hashids(env('APP_KEY'),10);
        $invoiceId = $hashids->decode($id)[0];
        $invoice = Invoice::find($invoiceId);

        return view('invoices.show', [
            'invoice' => $invoice,
            'page_title' => ' Invoices',
            'page_description' => 'View Invoice',
        ]);
    }

A: Personally, I would be more inclined to write a model trait. You can then use the trait on only the models required, rather than assuming every ID argument in a request is a Hash ID.
E.g.
namespace App\Models\Traits;

use Hashids\Hashids;
use Illuminate\Database\Eloquent\Builder;

trait HashedId
{
    public function scopeHashId(Builder $query, $id)
    {
        $hashIds = new Hashids(env('APP_KEY'), 10);
        $id = $hashIds->decode($id)[0];

        return $query->where('id', $id);
    }
}

Then to use it, you'd use the trait on your Invoice model (edit):
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Invoice extends Model
{
    use \App\Models\Traits\HashedId;

    // ...
}

And execute the following query in your controller:
public function show($id)
{
    $invoice = Invoice::hashId($id)->firstOrFail();

    return view('invoices.show', [
        'invoice' => $invoice,
        'page_title' => ' Invoices',
        'page_description' => 'View Invoice',
    ]);
}


text: Q: Automorphism group of $(\Bbb Z\times\Bbb Z) \rtimes \Bbb Z$ Automorphism group of $\Bbb Z\times \Bbb Z \times \Bbb Z$ is $SL(3,\Bbb Z)$. I am wondering what the automorphism group of $(\Bbb Z\times \Bbb Z) \rtimes \Bbb Z$ would be. Lets say the generators of the three $\Bbb Z$s in $(\Bbb Z\times \Bbb Z) \rtimes \Bbb Z$ are $a,b,$ and $c$ respectively. $c$ acts on $a$ and $b$ as, $cac^{-1}=b^{-1}; cbc^{-1}=a$.


text:
Q: IMAP IDLE and parralel mail processing I'm new both to IMAP and multi-thread programming, and I'd like to write a script to fetch incoming mails and process them in parallel.
Thread, Queue, Mutex and Monitor are new concepts to me, I may miss-use them in the following question and example.
The script's goal is to:

*

*receive IDLE notifications from the IMAP server when a new mail arrives

*fetch the corresponding mail

*parse its body

*generate a PDF from parsed data

*send the report through SMTP

Another aproach could be to fetch and identify mails based on their UID, thought learning IMAP & multi-thread programing is another goal.

Here's what I've got so far (IMAP part):
def self.idle(imap)
  @imap = Net::IMAP.new 'mail.company.org', 143, false # Not using TLS for test purposes
  @imap.login 'username', 'password'

  @idler_listener = Thread.new do
    loop do
      begin
        imap.examine 'INBOX'

        imap.idle do |res|
          if res.kind_of?(Net::IMAP::UntaggedResponse) and res.name == 'EXISTS'
            imap.idle_done
            Thread.new { process_email(imap) }
          end
        end

      rescue => e
        puts e.inspect
      end
    end
  end.join
end

def self.process_email(imap)
  begin
    uid  = imap.uid_search(['SUBJECT', 'MyFavoriteSubject']).last
    mail = imap.uid_fetch(uid, 'BODY[TEXT]')[0].attr['BODY[TEXT]']
    puts mail
  rescue => e
    puts e.inspect
  end
end

This example successfully prints out the body of an incoming mail. However, if several mail arrives at the same time, only one will be treated.

Q:

*

*Is this behavior due to the fact that the loop is executed in a single thread ?

*Does it illustrate the need for a queue, a thread pool, or a producer / consumer pattern ?

*Chances that this script will attempt to access the same resource at the same time are low, however, would Mutex.new.synchronize protect me against race conditions & deadlocks ?

(Eventhough I've not fully understand it, I think it's worth sharing this great resource from Masatoshi Seki: https://www.druby.org/sidruby/)


text:
Q: How to modify trac to create own custom Link format (TracLinks) In the open-source trac issue tracking software, when you write text in the wiki or ticket comments, you can link to a ticket using #1234 or you can link to a code changeset using r1234. This is the documentation: http://trac.edgewall.org/wiki/TracLinks
I would like to define my own link format. 3 examples of what I'd like to do:

*

*I'd like a1234 to link to a acunote ticket (which complements trac but is external to our trac installation).

*I'd like ge2a1b3caadd0986e3e3d316c01965a2495329b87 to link to a github commit (i.e. https://github.com/peritor/webistrano/commit/e2a1b3caadd0986e3e3d316c01965a2495329b87).

*I'd like CComponent to link to the Yii documentation (i.e. http://www.yiiframework.com/doc/api/1.1/CComponent)

Does anyone know how I can do this using trac v0.12. Should I use a Macro? a plugin? a Genshi template? It strikes me as something that could be quite simple if you have the know how?

A: If you want this exact syntax, you have no other choice than to create a plugin and have a Component that implements the IWikiSyntaxProvider interface.
If you can live with a slightly different syntax, for example [a:1234] for the acunote ticket, [g:e2a1b3caadd0986e3e3d316c01965a2495329b87] for the github changeset, and [y:CComponent] for the Yii documentation, then you could add the following entries to the InterMapTxt page of your Trac installation:
a    http://my.acunote.site/ticket/$1                  # Acunote ticket $1
g    https://github.com/peritor/webistrano/commit/$1   # Changeset $1 on Github
y    http://www.yiiframework.com/doc/api/1.1/$1        # Yii documentation for $1

A: Remy is correct in that your syntax is potentially making this more difficult.  The standard Trac syntax for links is resource_type:link_specifier.  If you are able to use that syntax instead, then it's fairly straightforward to use Inter-Wiki links to accomplish what you want.
If that's not an option, you can do what you describe with a custom-built plugin.  It's not as difficult as it might sound, you can use the source from an existing plugin as an example.  I have done this several times before, all you really need is a regular expression that represents the syntax you wish to use and one that represents the format of the resulting link, as well as about one page of Python code.
Update:  For an example of how to do this via a Trac plugin, there is sample code and a description in the official Trac documentation.


text:
Q: Accidentally pushed button in sublime and now I got highlighted code, even on restart After hitting something like Ctrl+Shift+Alt+F  I "highlighted" open and closed tags, but even on restart this won't go away, it's very odd and happens very often so I'm not sure what's up with that.
I use Sublime Text 3 with Predawn theme, here is an example.


text:
Q: Metadata Api name of "Manage Public Lightning Email Templates"? As the title says, what is the API name for Manage Public Lightning Email Templates?

Although I enabled/disabled it and fetched profile, I do not find any Metadata API name matching this userPermissions. Is the Name completely different from label? Unfortunately I am not finding any online reference also

A: Metadata API name 'CreateLtngTempInPub' for Manage Public Lightning Email Templates.
Below is 'userPermissions' for same
<userPermissions>
        <enabled>true</enabled>
        <name>CreateLtngTempInPub</name>
</userPermissions>

Set value of 'Manage Public Lightning Email Templates' to true on the Profile level and retrieve you can check above name in userPermissions.


text:
Q: Okular instances does not group under single icon in desktop dock on Ubuntu 17.10 After upgrading to Ubuntu 17.10, multiple instances of okular will no longer group under a single icon in the desktop dock.
I am running 17.10 under X.org, and if it matters: I am viewing PDF files with okular. All other applications I have tested work correctly. For example, multiple instances of gnome-terminal and emacs will group under a single item in the desktop dock. There was no problem with grouping for okular in 17.04.
Why is it important to have them grouped? It enables one to use a keyboard shortcut to switch between applications of the same type (Alt+|). It also makes it easier to switch between different applications (Alt+Tab) since there are fewer instances to cycle through.
How can I get okular instances to group correctly in 17.10?

A: *

*Copy the okularApplication_pdf.desktop file from /usr/share/applications to ~/.local/share/applications. For that you may run
cp /usr/share/applications/okularApplication_pdf.desktop ~/.local/share/applications/

*Open the copied file with a text editor. For example by running
gedit ~/.local/share/applications/okularApplication_pdf.desktop

*Add (or modify) the following line to the file
StartupWMClass=okular

*Save the file.

Adapted from this answer.
Edit:
If you have installed okular as a snap, you will find the desktop file at /var/lib/snapd/desktop/applications/okular_org.kde.okular.desktop
In this case the following could become your step 1:
cp /var/lib/snapd/desktop/applications/okular_org.kde.okular.desktop ~/.local/share/applications/

Then follow steps 2 to 4 as mentioned in the previous method.


text:
Q: Through LDAP unable to read members of the domain admin group from Windows Server 2012 Trying to read domain admin group members through VBScript, but unable to read. Throwing error on user server.

object not a collection

But it's working in my local test Windows Server 2012.
User Running it from member server. User is having domain admin rights.
How to check LDAP issue in server or is their anything else?
Option Explicit

'Get all member of a group INCLUDING members from ALL NESTED groups.
'Simply call the script with the samAccountName of the group.
'If the group name contains spaces it should be ENCLOSED IN QUOTES,
'IE scriptName.vbs "DOMAIN ADMINS"

Dim objGroup

'verify a group name was passed
If WScript.Arguments.Count <> 1 Then
  WScript.Echo "NO GROUP PASSED"
  WScript.Echo "Usage:  scriptName <groupSamAccountName>"
  WScript.Quit
End If

'bind to the gorup
Set objGroup = getGroup(WScript.Arguments(0))

'enumerate the groups members
enumMembers objGroup, ""

Function getGroup(strGroupName)
  Dim objConn, objRecSet, strQueryString, objRootDSE, strQueryFrom
  Const adsOpenStatic = 3

  Set objRootDSE = GetObject("LDAP://RootDSE")
  strQueryFrom = "LDAP://" & objRootDSE.Get("defaultNamingContext")

  Set objConn = WScript.CreateObject("ADODB.Connection")
  objConn.Provider = "ADsDSOObject"
  objConn.Open

  strQueryString = "SELECT AdsPath FROM '" & strQueryFrom & "' " & _
                   "WHERE samAccountName = '" & strGroupName & "'"

  Set objRecSet = WScript.CreateObject("ADODB.Recordset")

  objRecSet.Open strQueryString, objConn, adsOpenStatic

  If objRecSet.RecordCount = 1 Then
    Set getGroup = GetObject(objRecSet("AdsPath"))
  Else
    WScript.Echo UCase(strGroupName) & " was not found in the domain.(" & objRootDSE.Get("defaultNamingContext") & ")"
    WScript.Quit
  End If
End Function

Sub enumMembers(ByRef objGroup, strInheritedFrom)
  Dim objMember

  For Each objMember In objGroup.Members '<---throwing error by saying "object not a collection"
    If LCase(objMember.class) = "group" Then
      WScript.Echo objMember.SamAccountName
    End If
  Next
End Sub


text:
Q: JSON object array is stored The JSON object array is stored in the products table, need to do a query to retrieve certain objects using Laravel Query Builder. How would I retrieve the first object array, or certain parts of it? Table : products Field name : id, prodcatkey normal datatype Field name : "pricematrix" JSON data type [enter code here {"packing":"1","size":"500ml","vencode":"1EIFEL","price":"527.50"}, {"packing":"3","size":"500ml","vencode":"1EIFEL","price":"1582.50"}, {"packing":"6","size":"500ml","vencode":"1EIFEL","price":"3165.00"}, {"packing":"12","size":"500ml","vencode":"1EIFEL","price":"6330.00"} ]

A: I think you could use normal Laravel query builder to find it.
$query->whereRaw('JSON_CONTAINS(pricematrix->"$.packing",1)');

Or using
$query->whereJsonContains('pricematrix->packing', ['1', '2'])


text:
Q: UIImageView is not displayed after push navigation I'm quite new to iOS development. I'm trying to create an iPad app where I need to display an image (here I used a.png). Image shows properly on the first view controller. Then, I navigate to other view using
[self.navigationController pushViewController:<#(UIViewController *)#> animated:<#(BOOL)#>]

On the second viewcontroller, where I navigate to, I have put an UIImageView on the viewcontroller in the .xib using the interface builder. But, on running, when I navigate to the second viewcontroller, the imageview in the second viewcontroller is not displayed.
That is, on any normal viewcontroller uiimageview is working perfectly, but after navigation (i.e. self.navigationController pushViewController), the uiimageview isn't displayed in the next viewcontroller.
I tried debugging. After running the flow goes to the viewDidLoad of the second viewcontroller. I even tried to alloc the UIImageView in the viewDidLoad, on running the control goes to alloc of UIImageView, and even is allocated properly (that is not nil). But still, I'm not sure why image is not visible.Earlier I figured maybe it is not loading and on appear it is nil, but on debugging I found it is not nil.
I'm stumped. Can't figure out what I may be missing.
Suggestions please. I need help to figure out what all may be the cause of UIImageView image not being displayed.

A: check your UIImageView is Properly Connected to file's Owner or Not ??

*

*create object of UIImageView in .h file

*And Set @property and @synthesize of UIImageView

*And Then After Check Your Image (Which put on UIImageView) Has Valid Name.
EDITE:
Try To Add UIImageView Programmatically
- (void)viewDidLoad
{
    [super viewDidLoad];
    UIImageView *myImageView = [[UIImageView alloc] initWithFrame: CGRectMake(10, 10, 320, 375)] ; // set Frame as you need
    [myImageView setImage: [UIImage imageNamed:@"MYImage.png"]];
    [self.view addSubview: myImageView];
}


text:
Q: Issue when logging unicode JSON strings in the console I've made a web page (as a part of a Django app) where a JSON file is returned from a request made by the user. In the view for the page, I parse the JSON object and store the desired attributes in variables. I then add all of the variables to the context of the view so that they can be used in the corresponding html file. When I try to display each of these variables in the console, I get the error:
SyntaxError: expected expression, got '&'
I was thinking that the error could be resulting from the fact that the JSON attributes were being encoded as unicode so I tried to convert them by using the str() function as was suggested here but for some reason, I'm still getting the same error.
What could be causing the error? If the error is because of the unicode encoding of the strings, how should I properly do the conversions?
Here is the view function:
def search(request):
    form = SearchForm(request.POST or None)
    if form.is_valid():
        form_artistSelect = urllib2.quote(form.cleaned_data.get("artist_select"))
        form_city =   urllib2.quote(form.cleaned_data.get("city"))
        form_state = urllib2.quote(form.cleaned_data.get("state"))
        mile_radius = urllib2.quote(form.cleaned_data.get("radius"))
        #print "testing"
        url = "http://api.bandsintown.com/events/search?artists[]=" + form_artistSelect + "&location=" +form_city+","+ form_state+"&radius="+ mile_radius + "&format=json&app_id=YOUR_APP_ID"
        data = json.load(urllib2.urlopen(url))

        #titles = [ i.get("title") for i in data]
        raw_dts = [str(i.get("datetime")) for i in data]

        #formatted_dts = [i.get("formatted_datetime") for i in data]
        ticket_urls = [str(i.get("ticket_url")) for i in data]
        ticket_statuses = [str(i.get("ticket_status")) for i in data]
        venue_names = [str(i.get("venue").get("name")) for i in data]
        venue_cities = [str(i.get("venue").get("city")) for i in data]
        venue_region = [str(i.get("venue").get("region")) for i in data]
context = {
        "form_artistSelect" : form_artistSelect,
        "raw_dts" : raw_dts,
        "ticket_urls" : ticket_urls,
        "ticket_statuses" : ticket_statuses,
        "venue_names" : venue_names,
        "venue_cities" : venue_cities,
        "venue_region" : venue_region,
        "form" : form
    }
    return render(request,"searchform.html" , context)

EDIT:
The error is occurring inside of the html file that corresponds to the view in which I'm using the context variables for each of the JSON fields.
<script>
console.log( "form_artistSelect\n" + {{form_artistSelect}} );
console.log( "raw_dts\n" + {{raw_dts}} );
console.log( "ticket_statuses\n" + {{ticket_statuses}} );
console.log( "venue_names\n" + {{venue_names}} );
console.log( "venue_cities\n" + {{venue_cities}} );
console.log( "venue_region\n" + {{venue_region}} );
...

Here is an example link for the JSON file that I'm requesting


text:
Q: Spark REST Api with spark 2.1 We are trying to migrate from spark 1.6 to spark 2.1.
I have tried configuring spark master and worker locally, and found that spark REST api is not same as it is earlier.
With spark 1.6 when i started master, i used to get all the applications response using following url
http://localhost:8080/api/v1/applications
Now, with spark 2.1, i tried the same, but it is not as expected.
http://localhost:8080/api/v1/applications is just showing the web ui
Am i missing any configurations.?

A: To get a list of applications and their states, try: http://localhost:8080/json
You will get something like:
{
    url: "spark://...:7077",
    workers: [...],
    cores: 6,
    coresused: 0,
    memory: 19374,
    memoryused: 0,
    activeapps: [...],
    completedapps: [...],
    activedrivers: [...],
    status: "ALIVE"
}


text:
Q: How to open select input mode on keyboard's event I have a keyboard that works and I would to implement a method into "onLongPress(..)" to open a default android dialog to change input mode.
Maybe I have to launch an activity?

A: Android Framework already provides this functionality. you can show inputmethodPicker dialog like this
InputMethodManager imm = (InputMethodManager)
            getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showInputMethodPicker();


text:
Q: Why does -1 >> 1 and 0xFFFFFFFF >> 1 produce different results? I am trying to make a test to tell whether my PC performs arithmetic or logical right shift by right-shifting hexadecimal FFFFFFFF by 1.
I know that an integer -1 reads as FFFFFFFF in hexadecimal since it is the two's complement of 1.  Right-shifting -1 by 1 results in FFFFFFFF and shows the PC performed arithmetic right shift.
But if I just type in 0xFFFFFFFF >> 1, it resulted in 7FFFFFFF and shows that the PC performed logical right shift instead.  Why did that happen?  See for the code below that produced the results:
#include    <stdlib.h>
#include    <stdio.h>

int main ( int argc, char *argv[] )
{
    printf ( "%x >> 1 = %x\n", -1, -1 >> 1 );
    printf ( "%x >> 1 = %x\n", 0xffffffff, 0xffffffff >> 1 );

    return EXIT_SUCCESS;
}

The program's output was:
ffffffff >> 1 = ffffffff
ffffffff >> 1 = 7fffffff

A: It is not an assumption. What type do you think 0xffffffff is ? According to the C standard, 6.4.4.1 Integer constants, the type of the expression of a hexadecimal constant (preceded with 0x) is the first of the following which can applicably hold the represented value:
int
unsigned int
long int
unsigned long int
long long int
unsigned long long int

On your platform, 0xFFFFFFFF cannot be represented as int because int is 32 bits and only 31 bits express quantity in signed int (the standard dictates one bit is reserved for sign). The next type, unsigned int, is therefore used. Therefore no sign bit is present to extended with the shift operation, which is thereby logical rather than arithmetic.
It may not be apparent how I concluded int was 32 bits on your platform. Indeed I could not make that assumption were it not for the first line, which arithmetic-right-shifts the value of -1. The result of that shift, dumped as %x, was 0xFFFFFFFF. Had int been native 64-bits that should dump 0xFFFFFFFFFFFFFFFF instead. Without that prior knowledge, no single type conclusion of 0xFFFFFFFF could be assumed since it may well be representable as a standard signed int of width 64-bits (63+1) with value 0x00000000FFFFFFFF. The resulting shift would produce the same output you see now, thereby introducing an alternative to that postulated above.

A: Your main question is: is 0xffffffff unsigned?
From C11 §6.4.4.1 Integer constants

The type of an integer constant is the first of the corresponding list in which its value can
  be represented.

The output of your first printf line suggests that int is 32-bit on your machine. Thus it can not represent 0xffffffff, it must be unsigned.


text:
Q: Hide div if data attributes match jQuery Simple tab setup, trying to hide a nav control if the corresponding content pane is empty. I'd like to use data attribute (data-content) to match elements.
The content pane hides fine, however the nav control does not. What am I missing? I feel like I might be over thinking it a bit...
jQuery; if content tab is empty, hide corresponding nav control based on matching data attribute.
Basic structure:

$('.tabs-content li').each(function(){
      if($.trim($(this).text()) == '' && $(this).children().length == 0){

  // hides content pane
  $(this).hide();

  // should hide matching nav element
        if ($(this).attr('data-content')  == "data-content" ) {
            $('.tabs-navigation li').hide();
         }

      }
    });
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

Tab 1

Tab 2

Tab 3

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Fiddle: https://jsfiddle.net/tpveuqsk/2/

A: You can do it more simple, like this:

$('.tabs-content li').each(function(){
    if ($(this).text().trim() == "" ) {
        $(this).hide();
        var data = $(this).attr("data-content")
        $(".tabs-nav a[data-content='"+data+"']").closest("li").hide()
     }
});

Tab 1

Tab 2

Tab 3

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

A: You could use the data-content attribute for your query, and then just look for the closest li, see the code below:

$('.tabs-content li').each(function(){
  if($.trim($(this).text()) == '' && $(this).children().length == 0){

    $('[data-content="'+$(this).attr('data-content')+'"]').closest('li').hide();
  }
});

Tab 1

Tab 2

Tab 3

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

A: This should work. Save the data-content value of tabs-content item. The data-content in tabs-nav works on the "a" element not the "li" element.
You want to hide both the a en li element so see the code below:
$('.tabs-content li').each(function(){
if($.trim($(this).text()) == '' && $(this).children().length == 0){

// hides content pane
$(this).hide();

attrValue= $(this).attr('data-content');

// should hide matching nav element
$('.tabs-nav li').each(function(){
    if ($(this).find('a').attr('data-content')  === attrValue ) {
    $(this).hide();
 }
})


text:
Q: Crystal Reports putting a group in different columns I'm trying to take one group and put it in two different columns. I know you can do that for the details of a group in the section expert but it won't allow you do so for a group. The group is date that I've separated by months for the all of last year and this year to the current date and I want last year's months in one column and this year's months in another column. Like this:
    January 2011             January 2012
    February 2011            February 2012
    March 2011               March 2012
    April 2011               April 2012
    May 2011
    June 2011
    July 2011
    August 2011
    September 2011
    October 2011
    November 2011
    December 2011

That way the months are easy to compare and they can be drilled down. Any ideas?

A: *

*In Details section's 'Section Expert', select 'Format with Multiple Columns'

*Select the (now visible) Layout tab

*Select 'Format Groups with multiple column'

*Add a second group on your date field by year (make sure it is 'outside' the mm/yyyy grouping)

*Size the footer of the section you created in #4 to get each year to be in its own column

A: If you group by month name (like monthname({transaction.date}) so January 2011 and 2012 will be in the same group) then you can use a running total to summarize the years individually within that group. You can do this by creating two running total fields, one with an evaluate formula like year({transaction.date})=2010 and another with the formula year({transaction.date})=2011.
Note that running totals won't work in the group header though, so you'd need to migrate those fields down into the group footer instead.

A: How about using a cross-tab like:
           2011    2012
January      10      12
February      5      12
March         8       1

This would be a lot more flexible.


text:
Q: Validation on form I repurposed some code for working out VAT, but I need to validate it not only for empty values but for values under 3,000,000. Javascript isn't really my forte, so I'm struggling to do something that seems rather basic. So far I have this:

HTML code is as follows.
    <form name="calculator">
Salary Bill:
<input type="text" class="calcinput" name="total" title
min="0" max format value size="9" style="width: 100px; text-align: right;"
onchange="calculate(this)">

Calculate

Results

result
<input type="text" class="calcinput" name="calcvat">

A: I fixed it. The HTML works regardless (it's just old code). I was just inept at changing the .js
        total = evalnum(frm.total.value);
    if (total == "NaN")
        total = 0;
    if (total == 0) {

Became
        total = evalnum(frm.total.value);
    if (total == "NaN")
        total = 0;
    if (total < 3000000) {

I kept trying total == < 3000000 and stuff, instead of replacing the ==. As I said a very very basic change - Thanks for the help in any case :)


text:
Q: how to get the list of all files with a certain extension in all subfolders in a folder in google drive api? with this query:
"name contains '.extension' and 'folderId' in parents"

I get the immediate children with the extension ".extension" in the folder with the folderId.
How can I retrieve all files with this extension in this folder and all its subfolders?

A: I tried your approach and was able to retrieve all the files with a particular extension from google drive API. I have developed the part of my code using python.
The Query I have used:
q=f"'{folder_id}' in parents and name contains '.extension' and trashed = false"

Also, I have used other field parameters while searching such as
kind,incompleteSearch,files/size,files/id,files/name

In python; the code will look something like the below:
extension_files = self.service.files().list(
                q=f"'{folder_id}' in parents and \
                        name contains '.extension' and trashed = false",
                fields='kind,incompleteSearch,files/size,files/id,files/name'
            ).execute()

Where service you have to set up by the Google drive access token using the build() and credentials.
Hope this will help you in solving your problem.


text:
Q: Auto mouse click on a Sepcific area of screen I want to Make a software in VB.NET, which reads all screen content and click on a specific place after a specific time interval. Any one please help me how to start it.

A: Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Declare Function SetCursorPos Lib "user32" Alias "SetCursorPos" (ByVal x As Long, ByVal y As Long) As Long
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4

To set the cursor position use SetCursorPos(x,y). x and y being the screen coordinates.
To click: mouse_event(MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
You can find more details about calling Windows APIs in Visual Basic  here.


text:
Q: Как вывести изображение за границы div, используя Wordpress Visual Composer? Сразу отмечу, сайт сделан на CMS Wordpress с использованием Visual Composer. Менять это не хочу так как пользователь в дальнейшем должен обслуживать сайт.
Суть вопроса:
Есть такой блок fitness.ad-rocket.com.ua/#1514407125282-4e9c9ee0-7179 который должен выглядеть так
Но у меня не получается вывести изображение за границы блока.
Для изображения пробовал ставить
Position: absolute
z-index: 999999999
И поднимать вверх, но тогда выходит вот такое:

A: Поставьте overflow: visible; блокам:
с классом vc_custom_1514879929781
и vc_tta-panel-body
Задайте вашему img что-то вроде transform: translateY(-50%);
Результат:


text:
Q: Native implementation of an abstract method Is it permitted in Java to have a an abstract method within a class and then have it's implementation in an other with a native language using JNI.
example:
abstract class Mommy {
abstract protected void call();
}
class Son extends Mommy {
 native protected void call() /*
'native code'
*/
}

What is the expected behaviour is it a runtime error that may occurs or everything is fine with "workaround" ?

A:
What is the expected behaviour is it a runtime error that may occurs or everything is fine with "workaround" ?

Provided that you implement the native method (correctly) and load the native library containing the implementation, then everything works.

I wonder if bug prone or against any good/best practices?

Nope, and nope.
Or at least, it is not more bug prone or more against "best practice" than any use of native code.
By the way, you really ought to read James Bach's "No Best Practices" article before you bandy around dodgy terms like "best practice".

A: Seems to be working just fine. This is quite cool solution in case you want to easily switch between native implementations.
https://github.com/mkowsiak/jnicookbook/tree/master/recipes/recipeNo030
and description inside JNI Cookbook can give you quick overview on the solution
http://jnicookbook.owsiak.org/recipe-no-030/


text:
Q: How does a Meteor database mutator know if it's being called from a Meteor.method vs. normal code? If one does something on the client like
Foo.insert({blah : 1})

where Foo is a Meteor collection, this actually triggers a Meteor.method call as documented in the last paragraph of http://docs.meteor.com/#meteor_methods that executes code on both the client and the server.
However, let's say I define a method (on client and server) that does the same thing:
Meteor.methods({
  bar: function() {
    Foo.insert({blah : 1})
  }
});

Now, I trigger this on the client with
Meteor.call("bar");

Foo.insert will now be called both on the client and the server as a result of the method. However, how does the client-side invocation of insert know not to call the server again, since it is itself a method?
Moreover, is there a way to call insert on the client side without automatically triggering the canonical server-side latency-compensation call and resulting synchronization? (For why I'd want to do this, see Loading a Meteor client app with fake fire-and-forget data)

A: The client side one becomes a 'stub'. It has this isSimulation property set that makes it appear as if the data is inserted for latency compensation.
I think if a .method is run on the client the latency compensation is always enabled and it shouldn't enter in the database. So anything running on a client side method would be a 'fake' type simulation
If you try setting this.isSimulation to false you'll get some weird error that shows you that the client side insert starts to throw errors with the insert.
I'm not too sure how to run it in a false simulation. I think you'd have to run it off in some other method var dothis = function() {...} type method.
To do this 'fake fire' & forget and have client side only data, which is what I presume (please correct if I'm wrong so I change the answer) modify the _collection property in your client side method.
e.g if you have
mydata = new Meteor.Collection("something");

function something() {
    mydata.insert({..});
}

Modify the method to do this instead
mydata._collection.insert({..});

This will make sure that the data isn't synchronized to the server, yet will have the local collection have this 'fake data'.
Hope this helps!


text:
Q: How can I load three.js for specific templates I know of two main approaches for loading external libraries into meteor, (as discussed in e.g. http://www.manuel-schoebel.com/blog/use-meteor-iron-router-waiton-to-load-external-javascript).
In addition there are meteor packages to load three.js globally.
Does anyone know how to use a template - level approach to get THREE working? I don't want three.js to load on all of the routes, but my attempt so far using ~
Template.threeview.onRendered(function(){

    Session.setDefault('threejs', false);
    // is library already loaded?
    if (Session.get('threejs') === false) {
        console.log('Requesting threejs...')
        $.getScript('/js/three.min.js', function() {
            Session.set('threejs', true);
            // the THREE object should now be accessible here
            // as well as in the window environment...?
            console.log(window.THREE);
            console.log(THREE);
        });
    };
});

doesn't work - I get
undefined
Uncaught ReferenceError: THREE is not defined

in the js console window.
Any ideas?
EDIT
Found this similar question Can't find three.js after loading through Ajax which suffers the same problem - I can confirm that loading from CDN works. Does any one have a better solution?

A: Finally figured it out - the way to make this work is to edit the three.min.js source file.
Removing/commenting 'use strict'; at the start of three.min.js lets it load correctly.
This seems to be related to the following feature/issue of meteor: https://github.com/meteor/meteor/issues/1380
The CDN was un-minified and didn't contain 'use strict;'. To be safe, 'use strict;' should probably be placed after the global THREE namespace has been declared.


text:
Q: How to combine multiple rows into 1 row in R? I am having trouble combining multiple rows into 1 row, below is my current data:

I want one row of symptoms for each VAERS_ID. However, because the number of rows each VAERS_ID  is inconsistent, I am having trouble.
I have tried this:
test= data %>%
select(VAERS_ID, SYMPTOM1, SYMPTOM2, SYMPTOM3, SYPMTOM4, SYMPTOM5) %>%
group_by(VAERS_ID) %>%
mutate(Grp = paste0(SYMPTOM1,SYMPTOM1, SYMPTOM2, SYMPTOM3, SYPMTOM4, SYMPTOM5, collapse
= ",")) %>%
distinct(VAERS_ID, Grp, .keep_all = TRUE)

This gives me the original data, plus another column labeled Grp containing all of the symptoms for each VAERS_ID pasted together, with a comma between each set.
Any help would be appreciated.

A: Your approach seems right but since data cannot be copied and tested, I am not able to reproduce your error. Some changes suggested, which you can try.
since you want "ALL Symptoms" in 1 place for each VAERS_ID, which is a common real world use case and I face this often. If you don't need original data in output, simply use this
data%>%
group_by(VAERS_ID) %>%
summarise("Symptoms" = paste0(SYMPTOM1,SYMPTOM1, SYMPTOM2, SYMPTOM3, SYPMTOM4, SYMPTOM5, collapse = ",")

With mutate you get original data since it adds a new column.
To address the warning to ungroup, just added %>%ungroup at end or within summarise add .groups="drop"


text:
Q: How do I filter an ICollectionView based on the sub property of an item? I'm trying to filter by a sub property of the items (Processor objects) in my collection but am unable.  The property is a simple Boolean to indicate if the item is enabled or disabled.  Enabled items in the list should be listed in the other listbox found on the first tab (enabled processors).
Below is a full working example that can be pasted in a starter WPF application
If you uncomment this line
_selectedProcessorsView.Filter = processorFilter;

in the MainWindow_VM() constructor, the processors are no longer displayed in the configuration tab.
Two main questions:

*

*Why does the filtering affect both lists?

*How can I fix this so that the enabled processors listbox on the first tab is bound to only the checked items in the second tab?

NOTE: The three classes at the end of my code (Config, Settings, and Processor are part of a class library that I can't modify.  The WPF app is just a UI around that library.
MainWindow.xaml
<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApplication1"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">

    <Window.DataContext>
        <local:MainWindow_VM></local:MainWindow_VM>
    </Window.DataContext>

    <Grid>
        <TabControl>
            <TabItem Header="enabled processors">
                <ListBox   ItemsSource="{Binding selectedProcessorsView}"   VerticalAlignment="Top" FontSize="14">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=processorType}"></TextBlock>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </TabItem>
            <TabItem Header="configuration">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <ListView Grid.Column="0" ItemsSource="{Binding Path=reportTypes}"   SelectedItem="{Binding selectedConfiguration}">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Path=id, Mode=OneWay}"></TextBlock>
                                </StackPanel>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                    <ListView Grid.Column="1" ItemsSource="{Binding reportProcessors}"  SelectedItem="{Binding selectedProcessor}">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Header="Enabled"  >
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <CheckBox IsChecked="{Binding Path=Settings.isEnabled}" ></CheckBox>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Header="Processor"  DisplayMemberBinding="{Binding Path=processorType, Mode=OneWay}" />
                                <GridViewColumn Header="ID" DisplayMemberBinding="{Binding Path=processorId, Mode=OneWay}"   >
                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                    </ListView>
                </Grid>
            </TabItem>
        </TabControl>

    </Grid>
</Window>

MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }
    public abstract class BindableBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] String propertyName = null)
        {
            if (object.Equals(storage, value)) return false;

            storage = value;
            this.OnPropertyChanged(propertyName);
            return true;
        }

        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            var eventHandler = this.PropertyChanged;
            if (eventHandler != null)
            {
                eventHandler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }

    public class MainWindow_VM : BindableBase
    {
        public MainWindow_VM()
        {
            reportTypes.Add(new Config()
            {
                id = Guid.NewGuid().ToString(),
                Processors = new Dictionary<string, Processor>() {
                    { "Processor 1", new Processor() { processorType = "Blue" } },
                    { "Processor 2", new Processor() { processorType = "Yellow" } }
                }
            });

            reportTypes.Add(new Config()
            {
                id = Guid.NewGuid().ToString(),
                Processors = new Dictionary<string, Processor>() {
                    { "Processor 3", new Processor() { processorType = "Green" } },
                    { "Processor 4", new Processor() { processorType = "Red" } }
                }
            });

            _selectedProcessorsView = CollectionViewSource.GetDefaultView(reportProcessors);
            //_selectedProcessorsView.Filter = processorFilter;
        }

        public bool processorFilter(object item)
        {
            bool result = true;
            Processor p = item as Processor;

            if (p.Settings.isEnabled == false)
                result = false;

            return result;
        }

        private Config _selectedConfiguration;
        public Config selectedConfiguration
        {
            get { return _selectedConfiguration; }
            set
            {
                SetProperty(ref _selectedConfiguration, value);

                reportProcessors.Clear();

                foreach (KeyValuePair<string, Processor> kvp in value.Processors)
                    reportProcessors.Add(kvp.Value);
            }
        }

        public ObservableCollection<Config> reportTypes { get; } = new ObservableCollection<Config>();

        public ObservableCollection<Processor> reportProcessors { get; } = new ObservableCollection<Processor>();

        private ICollectionView _selectedProcessorsView;
        public ICollectionView selectedProcessorsView
        {
            get { return _selectedProcessorsView; }
        }
    }

///These three classes below are part of a separate class library that I cannot modify

    public class Config
    {
        public string id { get; set; }
        public Dictionary<string, Processor> Processors { get; set; }
    }
    public class Processor
    {
        public string processorType { get; set; }
        public Settings Settings { get; set; } = new Settings() {
            isEnabled = false
        };
    }
    public class Settings
    {
        public bool isEnabled { get; set; }
    }
}

A:
Why does the filtering affect both lists?

{Binding reportProcessors} and {Binding selectedProcessorsView} bind to the same view. When you bind to an ObservableCollection<T>, or any other type of source collection for that matter, you are actually binding to an automatically generated CollectionView and not to the actual source collection itself.

How can I fix this so that the enabled processors listbox on the first tab is bound to only the checked items in the second tab?

Bind to two different views. But you also need to notify the view when the isEnabled propery is actually set to a new value. Otherwise your filter won't be updated as you check the CheckBoxes. The fact that you are using a Setting class complicates this a bit but you could add a property to the Processor class and live filter on this one. Both Settings and Processor need to implement the INotifyPropertyChanged event.
Please refer to the following sample code. It should give you the idea.
public class MainWindow_VM : BindableBase
{
    public MainWindow_VM()
    {
        ...

        ListCollectionView selectedProcessorsView = new ListCollectionView(reportProcessors);
        selectedProcessorsView.LiveFilteringProperties.Add(nameof(Processor.IsEnabled));
        selectedProcessorsView.IsLiveFiltering = true;
        selectedProcessorsView.Filter = processorFilter;

        _selectedProcessorsView = selectedProcessorsView;
    }
    ...
 }

public class Processor : INotifyPropertyChanged
{
    public string processorType { get; set; }

    public Settings Settings { get; set; } = new Settings()
    {
        isEnabled = false
    };

    public bool IsEnabled => Settings.isEnabled;

    public Processor()
    {
        Settings.PropertyChanged += Settings_PropertyChanged;
    }

    private void Settings_PropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        OnPropertyChanged(nameof(IsEnabled));
    }

    public event PropertyChangedEventHandler PropertyChanged;
    protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
    {
        var eventHandler = this.PropertyChanged;
        if (eventHandler != null)
            eventHandler(this, new PropertyChangedEventArgs(propertyName));
    }
}

public class Settings : INotifyPropertyChanged
{
    private bool _isEnabled;
    public bool isEnabled
    {
        get { return _isEnabled; }
        set { _isEnabled = value; OnPropertyChanged(); }
    }

    public event PropertyChangedEventHandler PropertyChanged;
    protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
    {
        var eventHandler = this.PropertyChanged;
        if (eventHandler != null)
            eventHandler(this, new PropertyChangedEventArgs(propertyName));
    }
}

A: In the end I went with the following approach, combined mm8's answer to my first question, with my own wrapper class that acts as a viewmodel to the Processor object (model).
Whenever a checkbox is checked or unchecked, the listviewcollection is refreshed thus updating the collection displayed in the first tab.
MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }
    public abstract class BindableBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] String propertyName = null)
        {
            if (object.Equals(storage, value)) return false;

            storage = value;
            this.OnPropertyChanged(propertyName);
            return true;
        }

        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            var eventHandler = this.PropertyChanged;
            if (eventHandler != null)
            {
                eventHandler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }

    public class MainWindow_VM : BindableBase
    {
        public MainWindow_VM()
        {
            reportTypes.Add(new Config()
            {
                id = Guid.NewGuid().ToString(),
                Processors = new Dictionary<string, Processor>() {
                    { "Processor 1", new Processor() { processorType = "Blue" } },
                    { "Processor 2", new Processor() { processorType = "Yellow" } }
                }
            });

            reportTypes.Add(new Config()
            {
                id = Guid.NewGuid().ToString(),
                Processors = new Dictionary<string, Processor>() {
                    { "Processor 3", new Processor() { processorType = "Green" } },
                    { "Processor 4", new Processor() { processorType = "Red" } }
                }
            });

            selectedProcessorsView = new ListCollectionView(processors);
            selectedProcessorsView.Filter = processorFilter;
        }

        public bool processorFilter(object item)
        {
            bool result = true;
            ProcessorWrapper p = item as ProcessorWrapper;

            if (p.isEnabled == false)
                result = false;

            return result;
        }

        private Config _selectedConfiguration;
        public Config selectedConfiguration
        {
            get { return _selectedConfiguration; }
            set
            {
                SetProperty(ref _selectedConfiguration, value);

                processors.Clear();

                foreach (KeyValuePair<string, Processor> kvp in value.Processors)
                    processors.Add(new ProcessorWrapper(kvp.Value, this.selectedProcessorsView));
            }
        }

        public ObservableCollection<Config> reportTypes { get; } = new ObservableCollection<Config>();

        public ObservableCollection<ProcessorWrapper> processors { get; } = new ObservableCollection<ProcessorWrapper>();

        public ListCollectionView selectedProcessorsView { get; set; }
    }

    public class ProcessorWrapper : BindableBase
    {
        public ProcessorWrapper(Processor processor, ListCollectionView lcv)
        {
            _processor = processor;
            _lcv = lcv;
        }

        private Processor _processor;
        private ListCollectionView _lcv;

        private string _processorType;
        public string processorType
        {
            get {

                _processorType = _processor.processorType;
                return _processorType;
            }
        }

        private bool _isEnabled;
        public bool isEnabled
        {
            get {
                _isEnabled = this._processor.Settings.isEnabled;
                return _isEnabled; }
            set
            {
                SetProperty(ref _isEnabled, value);
                this._processor.Settings.isEnabled = _isEnabled;
                _lcv.Refresh();
            }
        }
    }

    /// <summary>
    /// These classes belong to a separate class library, should not be modified.
    /// </summary>

    public class Config
    {
        public string id { get; set; }
        public Dictionary<string, Processor> Processors { get; set; }
    }
    public class Processor
    {
        public string processorType { get; set; }
        public Settings Settings { get; set; } = new Settings() {
            isEnabled = false
        };
    }
    public class Settings
    {
        public bool isEnabled { get; set; }
    }
}

MainWindow.xaml
<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApplication1"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">

    <Window.DataContext>
        <local:MainWindow_VM></local:MainWindow_VM>
    </Window.DataContext>

    <Grid>
        <TabControl>
            <TabItem Header="enabled processors">
                <ListBox ItemsSource="{Binding selectedProcessorsView}" VerticalAlignment="Top" FontSize="14">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=processorType}"></TextBlock>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </TabItem>
            <TabItem Header="configuration">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <ListView Grid.Column="0" ItemsSource="{Binding Path=reportTypes}"   SelectedItem="{Binding selectedConfiguration}">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Path=id, Mode=OneWay}"></TextBlock>
                                </StackPanel>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                    <ListView Grid.Column="1" ItemsSource="{Binding processors}"  SelectedItem="{Binding selectedProcessor}">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Header="Enabled"  >
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <CheckBox IsChecked="{Binding Path=isEnabled}" />
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Header="Processor"  DisplayMemberBinding="{Binding Path=processorType, Mode=OneWay}" />
                            </GridView>
                        </ListView.View>
                    </ListView>
                </Grid>
            </TabItem>
        </TabControl>
    </Grid>
</Window>


text:
Q: Do I have to setup pod for every project? I am trying to learn how to use pods and i am following this tutorial, however i am stuck on point number 3, under the heading How to setup POD for your Xcode project. It's been a long time since it's showing Setting up CocoaPods master repo on the terminal, after going through some posts on SO, i checked my Activity Monitor and the process git-remote-https have consumed around 300 MB and is still in progress. I can't figure out what is consuming so much of data, also since i have navigated to the project in which i wish to use pod, is the pod setup being done for that particular project only ? What if i have to use pod in some other project, do i have to setup pod again, will it consume that much of data for that project too ?
Sorry if these questions are noobish.

A: The answer is no.
You only have to install Pod for one time.
Then in your other project, It's very simple. At first you need to create a file named Podfile, write something needed in it, like pod 'CocoaAsyncSocket'. after that, all you have to do is to run pod install


text:
Q: How to extend Google Analytics file with each view in ios? How to extend Google Analytics file with each view in ios ? I'm new to iOS and confused with the syntax.
I want to extend with this viewcontroller
@interface IXComposeViewController ()<UITextFieldDelegate,UIActionSheetDelegate,UITableViewDataSource,UITableViewDelegate,IXScrollViewDelegate>

So how should I combine these two extension?
 @interface IXComposeViewController : GAITrackedViewController

Confused with syntax,please help.

A: You did it exactly right, for screen tracking in Google Analytics you only need to perform two simple steps:

*

*the UIViewController that should be tracked needs to inherit from GAITrackedViewController, so your suggested syntax is correct: @interface IXComposeViewController : GAITrackedViewController

*add the line self.screenName = @"screen: IXComposeViewController"; // or any other string in your viewWillAppear or viewDidAppear
To make it clear, in your header-file, you need to extend GAITrackedViewController, so it would look somewhat like this:
IXComposeViewController.h
#import "GAITrackedViewController.h"

@interface IXComposeViewController : GAITrackedViewController
// declare public properties and methods
@end

IXComposeViewController.m
@implementation IXComposeViewController

- (void)viewWillAppear:(BOOL)animated {
  [super viewWillAppear:animated];
  self.screenName = @"About Screen";
}
@end


text:
Q: Use result of WITH clause to filter WHERE ... IN columnName I want to use the result of a WITH clause to filter a query like below:
WITH Max_Dates AS (
    SELECT MAX(created_date) AS maxdate
    FROM transactions
    GROUP BY DATE (created_date)
)
SELECT *
FROM transactions
WHERE created_date IN Max_Dates -- can I somehow reference column maxdate as a list here?

The syntax is incorrect. I know I can use the content of the WITH clause as a subquery in the WHERE below to get the result I want, but I want to know specifically if the WITH result can be used.
My question is, is there a general syntax for using a column from a WITH clause to filter as a list in a WHERE ... IN {list}?
As per this blog it seems it should be possible to use WHERE created_at IN Max_Dates.maxdate, but I'm using MySQL 8.0.29 and it doesn't like that syntax - Error: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Max_Dates.maxdate' at line 8")

A: WITH Max_Dates AS
(
  SELECT MAX(created_date) AS maxdate
  FROM transactions
  GROUP BY DATE (created_date)
)
SELECT *
FROM transactions
WHERE created_date IN (select maxdate from Max_Dates)

The CTE (Common Table Expression) Max_Dates is a resultset that potentially has multiple columns, so you must specify the specific column from Max_Dates that should be used to build the list of values for the IN expression.


text:
Q: Bash: Parse CSV with quotes, commas and newlines Say I have the following csv file:
 id,message,time
 123,"Sorry, This message
 has commas and newlines",2016-03-28T20:26:39
 456,"It makes the problem non-trivial",2016-03-28T20:26:41

I want to write a bash command that will return only the time column.  i.e.
time
2016-03-28T20:26:39
2016-03-28T20:26:41

What is the most straight forward way to do this?  You can assume the availability of standard unix utils such as awk, gawk, cut, grep, etc.
Note the presence of "" which escape , and newline characters which make trivial attempts with
cut -d , -f 3 file.csv

futile.

A: As said here
gawk -v RS='"' 'NR % 2 == 0 { gsub(/\n/, "") } { printf("%s%s", $0, RT) }' file.csv \
 | awk -F, '{print $NF}'

To handle specifically those newlines that are in doubly-quoted strings and leave those alone that are outside them, using GNU awk (for RT):
gawk -v RS='"' 'NR % 2 == 0 { gsub(/\n/, "") } { printf("%s%s", $0, RT) }' file

This works by splitting the file along " characters and removing newlines in every other block.
Output
time
2016-03-28T20:26:39
2016-03-28T20:26:41

Then use awk to split the columns and display the last column

A: CSV is a format which needs a proper parser (i.e. which can't be parsed with regular expressions alone). If you have Python installed, use the csv module instead of plain BASH.
If not, consider csvkit which has a lot of powerful tools to process CSV files from the command line.
See also:

*

*https://unix.stackexchange.com/questions/7425/is-there-a-robust-command-line-tool-for-processing-csv-files

A: As chepner said, you are encouraged to use a programming language which is able to parse csv.
Here comes an example in python:
import csv

with open('a.csv', 'rb') as csvfile:
    reader = csv.reader(csvfile, quotechar='"')
    for row in reader:
        print(row[-1]) # row[-1] gives the last column

A: another awk alternative using FS
$ awk -F'"' '!(NF%2){getline remainder;$0=$0 OFS remainder}
                NR>1{sub(/,/,"",$NF); print $NF}' file

2016-03-28T20:26:39
2016-03-28T20:26:41

A: I ran into something similar when attempting to deal with lspci -m output, but the embedded newlines would need to be escaped first (though IFS=, should work here, since it abuses bash' quote evaluation).
Here's an example
f:13.3 "System peripheral" "Intel Corporation" "Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel Target Address Decoder" -r01 "Super Micro Computer Inc" "Device 0838"

And the only reasonable way I can find to bring that into bash is along the lines of:
# echo 'f:13.3 "System peripheral" "Intel Corporation" "Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel Target Address Decoder" -r01 "Super Micro Computer Inc" "Device 0838"' | { eval array=($(cat)); declare -p array; }
declare -a array='([0]="f:13.3" [1]="System peripheral" [2]="Intel Corporation" [3]="Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel Target Address Decoder" [4]="-r01" [5]="Super Micro Computer Inc" [6]="Device 0838")'
#

Not a full answer, but might help!

A: Vanilla bash script
save this code as parse_csv.sh, give it execution privilege (chmod +x parse_csv.sh)
#!/bin/bash
# vim: ts=4 sw=4 hidden nowrap
# @copyright Copyright © 2021 Carlos Barcellos <carlosbar at gmail.com>
# @license https://www.gnu.org/licenses/lgpl-3.0.en.html

if [ "$1" = "-h" -o "$1" = "--help" -o "$1" = "-v" ]; then
    echo "parse csv 0.1"
    echo ""
    echo "parse_csv.sh [csv file] [delimiter]"
    echo "  csv file    csv file to parse; default stdin"
    echo "  delimiter   delimiter to use. default is comma"
    exit 0
fi
delim=,
if [ $# -ge 1 ]; then
    [ -n "$1" ] && file="$1"
    [ -n "$2" -a "$2" != "\"" ] && delim="$2"
fi
processLine() {
    if [[ ! "$1" =~ \" ]]; then
        (
           IFSS="$delim" fields=($1)
           echo  "${fields[@]}"
        )
        return 0
    fi
    under_scape=0
    fields=()
    acc=
    for (( x=0; x < ${#1}; x++ )); do
        if [ "${1:x:1}" = "${delim:0:1}" -o $((x+1)) -ge ${#1} ] && [ $under_scape -ne 1 ]; then
            [ "${1:x:1}" != "${delim:0:1}" ] && acc="${acc}${1:x:1}"
            fields+=($acc)
            acc=
        elif [ "${1:x:1}" = "\"" ]; then
            if [ $under_scape -eq 1 ] && [ "${1:x+1:1}" = "\"" ]; then
                acc="${acc}${1:x:1}"
            else
                under_scape=$((!under_scape))
            fi
            [ $((x+1)) -ge ${#1} ] && fields+=($acc)
        else
            acc="${acc}${1:x:1}"
        fi
    done
    echo  "${fields[@]}"
    return 0
 }
 while read -r line; do
     processLine "$line"
 done < ${file:-/dev/stdin}

Then use: parse_csv.sh "csv file". To print only the last col, you can change the echo  "${fields[@]}" to  echo  "${fields[-1]}"

A: Perl to the rescue! Use the Text::CSV_XS module to handle CSV.
perl -MText::CSV_XS=csv -we 'csv(in => $ARGV[0],
                                 on_in => sub { $_[1] = [ $_[1][-1] ] })
                            ' -- file.csv

*

*the csv subroutine processes the csv

*in specifies the input file, $ARGV[0] contains the first command line argument, i.e. file.csv here

*on_in specifies code to run. It gets the current row as the second argument, i.e. $_[1]. We just set the whole row to the contents of the last column.

A: I think you are overthinking it.
$: echo time; grep -Eo '[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$' file
time
2016-03-28T20:26:39
2016-03-28T20:26:41

If you want to check for that comma just to be sure,
$: echo time; sed -En '/,[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/{ s/.*,//; p; }' file
time
2016-03-28T20:26:39
2016-03-28T20:26:41

A: csvquote is designed for exactly this kind of thing. It santizes the file (reversibly) and allows awk to depend on commas being field separators and newlines being record separators.

A: awk -F, '!/This/{print $NF}' file

time
2016-03-28T20:26:39
2016-03-28T20:26:41


text:
Q: Query String Value Is Not Working Inside The Javascript Hello stackoverflow community, I am facing a problem where my query string isn't working and it's inside the javascript, I use isset and empty to test out results and it keeps saying failed. Here is the code:
events:'load.php?loadfor="$id"',

The code is inside a fullcalendar script, I want to load an event for specific person.Full code :
$(document).on('click', '.click_hire', function(){

    var to_user_id = $(this).data('touserid');
    $id = $(this).data('touserid');

    var calendar = $('#calendar').fullCalendar({
        nextDayThreshold: '23:59:00',
        forceRerenderToDisplay: true,
        disableDragging: true,
        header:{
                left:'prev,next today',
                right:'title',
                center:''
            },
            events:'load.php?loadfor="$id"',
            selectable:true,
            selectHelper:true,
            select: function(start, end, allDay)
            {
                $("#popup").show();
                var start = $.fullCalendar.formatDate(start, "YY-MM-DD HH:mm:ss");
                var end = $.fullCalendar.formatDate(end, "YY-MM-DD HH:mm:ss");
                $.ajax({
                    url:"get.popup.php",
                    method:"POST",
                    data:{start:start, end:end, to_user_id:to_user_id},
                    success:function(data){
                        $('#popup').html(data);
                    }
                })
            }

        });

});

For the testing i put it on my get.popout.php.
if(isset($_GET['loadfor']))
{
    echo "
Success
";
}
else if(empty($_GET['loadfor']))
{
    echo "
Failed
";
}


text:
Q: C# Connect to Oracle DataBase Error ORA-12545: Connect failed because target host or object does not exist I want to connect to Oracle database from C# but I can't
Because this errors that ORA-12545: Connect failed because target host or object does not exist
so how can i ?
C# code
  string strConn = "Data Source =(DESCRIPTION =" +
                                 "(ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-EIQ5MRF)(PORT = 1521))" +
                                 "(CONNECT_DATA =" +
                                 " (SERVER = DEDICATED)" +
                                 "(SERVICE_NAME = XE)" +
                                 ")" +
                                 ");User Id =system;password=bluesky;";
                OracleConnection conn = new OracleConnection(strConn);

                conn.Open();
                conn.Close();

listener.ora

SID_LIST_LISTENER =   (SID_LIST =
      (SID_DESC =
        (SID_NAME = PLSExtProc)
        (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
        (PROGRAM = extproc)
      )
      (SID_DESC =
        (SID_NAME = CLRExtProc)
        (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
        (PROGRAM = extproc)
      )   )
LISTENER =   (DESCRIPTION_LIST =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
        (ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-EIQ5MRF)(PORT = 1521))
      )   )
DEFAULT_SERVICE_LISTENER = (XE)
tnsnames.ora
XE =   (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-EIQ5MRF)(PORT = 1521))
      (CONNECT_DATA =
        (SERVER = DEDICATED)
        (SERVICE_NAME = XE)
      )   )
EXTPROC_CONNECTION_DATA =   (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      )
      (CONNECT_DATA =
        (SID = PLSExtProc)
        (PRESENTATION = RO)
      )   )
ORACLR_CONNECTION_DATA =    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      )
      (CONNECT_DATA =
        (SID = CLRExtProc)
        (PRESENTATION = RO)
      )    )

A: The error

ORA-12454: connect failed because target host or object does not exist

It's mean you have problem with connection string, check all access data, machine name once again and try use this connection string, you forgot add "ADDRESS_LIST" , check doc. here.
Using ODP.NET without tnsnames.ora, should be like
    var sampleConn= @"Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=    (PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))
                    (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));
                     User Id=myUsername;Password=myPassword;"

So you connection string should look like
   string strCon =@"Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=DESKTOP-EIQ5MRF)(PORT=1521)))
                             (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XE)));
                             User Id = system; Password = bluesky; ";


text:
Q: Double For loops in R How do you properly write a double for loop in R?
For example, in C I would do
int i, j;
for (i = 1; i < 6; i++) {
    for (j=i; j <= 3; j++) {
        printf("%i,%i\n",i,j);
    }
    // Do more operations for i > 3...
}

which would generate the (artificial) sequence:
1,1
1,2
1,3
2,2
2,3
3,3

In R you do not get the same behaviour when you write
for (i in 1:6) {
    for (j in i:3) {
        print(paste(i,j,sep=","))
    }
}

so I've been reduced to doing something like
for (i in 1:6) {
    j <- i
    while (j <= 3) {
        print(paste(i,j,sep=","))
        j <- j+1
    }
}

Is there a better way?
As Shane mentioned, maybe I should make this clear: I am particularly interested in the code-style matching the mathematics to make it easier for students to understand. It seems that students are the most comfortable with for loops.
In particular, I want my students to simulate a LIBOR market model. The dynamics of the forward rate are to be simulated under the same probability measure. As such, for each time step and each
 forward rate, the appropriate drift correction \mu_i needs to be calculated and added.

A: The issue here is that i:3 is meaningful when i>3. For example, 5:3 gives (5,4,3). All you need is a simple if statement to prevent the second loop being run when i>3.
for (i in 1:6) {
    if(i < 4) {
        for (j in i:3) {
            print(paste(i,j,sep=","))
        }
    }
    # Do more operations for i > 3...
}

However, if possible try to avoid the explicit looping. Dirk's and Shane's answers provide some ideas on how to do this.

A: Sorry for asking what is potentially a dumb question, but in what sense can R not do this?  This works perfectly fine for me:
N <- 5
for (i in 0:(2*N)) {
   for (j in i:N) {
        print(paste(i,j,sep=","))
    }
}

Could it be that you just didn't put parentheses around the end of your sequence?
Edit:  I see...you want to enforce that the sequence i:3 is always <= 3?  I don't think that's possible with either a sequence or within the clause of a for statement.  You can set a break within the loop, but that's no better than your current approach:
for (i in 1:6) {
    for (j in i:3) {
        if(j > 3) break()
        print(paste(i,j,sep=","))
    }
}

Here's another way to generate this sequence without a for loop:
x <- cbind(rep(c(1,2,3), 3),
    rep(c(1,2,3), each=3))

Or with expand.grid (as per Dirk's suggestion):
x <- expand.grid(x=1:3, y=1:3)

Then remove the unwanted cases:
x[x[,1] >= x[,2],]

Edit 2: This may not suit your needs, but I believe that Quantlib has a Libor Market Model implementation.  I'm not sure if it's exposed in RQuantlib.

A: You can of course nest loops:
R> for (i in 1:3) for (j in 1:3) cat(i,j,i*j, "\n")
1 1 1
1 2 2
1 3 3
2 1 2
2 2 4
2 3 6
3 1 3
3 2 6
3 3 9
R>

There is general sense that you should not as vectorised calls can be easier to read and write:
R> outer(1:3,1:3, "*")
     [,1] [,2] [,3]
[1,]    1    2    3
[2,]    2    4    6
[3,]    3    6    9
R>

but if it is easier to develop with nexted loops, then do so.
As for the 'second index dependent on first index' issue you can use lower.tri(), upper.tri() or indexing to achieve that too.
R> X <- expand.grid(x=1:3, y=1:3)
R> X <- X[ X$x >= X$y, ]
R> outer(X$x, X$y, "*")
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]    1    1    1    2    2    3
[2,]    2    2    2    4    4    6
[3,]    3    3    3    6    6    9
[4,]    2    2    2    4    4    6
[5,]    3    3    3    6    6    9
[6,]    3    3    3    6    6    9
R>


text:
Q: How to assign a sequential number to ThreadPoolExecutor worker assuming the following code example where a list of files getting uploaded, using  ThreadPoolExecutor as executor.
    def upload_segments(segment_upload_list):
        def __upload(object_path_pair):
            libera_resource.upload_file(*object_path_pair)
            print("Segment uploaded!")

        with ThreadPoolExecutor() as executor:
            executor.map(__upload, segment_upload_list)
    upload_segments(segment_upload_list)

How can I assign a number to the point where I'm in my list in this multithreaded scenario? I want to display something like this in the end:
"Segment 10/4310 uploaded."
I'm aware that the output cannot be sequential here due to the nature of multithreading, but it would at least provide a progress overview. I guess counting the number of threads I've already started would also do the trick here to count the number of segments already uploaded
Thanks in advance

A: Here's an illustration of how to use a global counter like I suggested in a comment. Each upload is being simulated by having each worker thread sleep for a random amount of time.
from concurrent.futures import ThreadPoolExecutor
from time import sleep
import threading
import random

count_lock = threading.Lock()
count = 0

def upload_file(segment):
    global count

    print(f'Uploading segment #{segment}...')
    sleep(random.uniform(1, 5))  # Simulate variable-length upload.
    with count_lock:
        count += 1
        print(f'  {count} of {len(segment_upload_list)} uploaded.')

def upload_segments(segment_upload_list):
    global count

    count = 0
    with ThreadPoolExecutor(max_workers=3) as executor:
        executor.map(upload_file, segment_upload_list)

    print('\nAll segments uploaded!')

segment_upload_list = list(range(1, 11))
upload_segments(segment_upload_list)

Sample output. Note how it immediately starts 3 upload task threads, and then starts another one everytime one finishes. This is because of the limit specified when the ThreadPoolExecutor was created. As you can see it doesn't really matter which one of the three performed that task as I said in my even earlier comment.
Uploading segment #1...
Uploading segment #2...
Uploading segment #3...
  1 of 10 uploaded.
Uploading segment #4...
  2 of 10 uploaded.
Uploading segment #5...
  3 of 10 uploaded.
Uploading segment #6...
  4 of 10 uploaded.
Uploading segment #7...
  5 of 10 uploaded.
Uploading segment #8...
  6 of 10 uploaded.
Uploading segment #9...
  7 of 10 uploaded.
Uploading segment #10...
  8 of 10 uploaded.
  9 of 10 uploaded.
  10 of 10 uploaded.

All segments uploaded!


text:
Q: Altova's and Cooktop's different result I have lookup table from this table we take result if buyeritemcode=substring(field[@id='0'], 11,3) then subfamily=subfamily from lookup table, otherwise '9':
<lookup>
    <Code>
        <BuyerItemCode>439</BuyerItemCode>
        <Subfamily>016</Subfamily>
    </Code>
</lookup>

Xml file looks:
<document>
    <line id="14">
        <field id="0"><![CDATA[MMM4443 419280600000]]></field>
    </line>
    <line id="15">
        <field id="0"><![CDATA[MMM4443 414390600000]]></field>
    </line>
</document>

I need to compare this data with lookup.xml and if data not compare insert constant 9. With altova v11 my program works, with cooktop doesn't, I mean comparing is false.
My program looks:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="date exsl">
    <xsl:output omit-xml-declaration="yes" indent="yes"/>
    <xsl:key name="ProdSubfamily" match="Subfamily" use="../BuyerItemCode"/>
    <xsl:template match="/">
        <Interchange>
            <Group>
                <Message>
                    <xsl:if test="/document/line[(substring(field[@id='0'], 1,3)='MMM')]">
                        <xsl:apply-templates mode="MMM" select="/document"/>
                    </xsl:if>
                </Message>
            </Group>
        </Interchange>
    </xsl:template>
    <xsl:template mode="MMM" match="/document">
        <PriceCatalogue-Lines>
            <xsl:for-each select="/document/line[contains(substring(field[@id='0'], 1,3),'MMM') and not(contains(substring(field[@id='0'],9,1),'0'))]">
                <xsl:variable name="inputProd" select="substring(field[@id='0'], 11,3)"/>
                <Line>
                    <Line-Item>
                        <LineNumber>
                            <xsl:value-of select="position()"/>
                        </LineNumber>
                        <BuyerItemCode>
                            <xsl:value-of select="substring(field[@id='0'], 11,3)"/>
                        </BuyerItemCode>
                        <SubFamily>
                            <xsl:choose>
                                <xsl:when test="substring(field[@id='0'], 11,3) = document('lookup.xml')/*/*/BuyerItemCode">
                                    <xsl:for-each select="document('lookup.xml')">
                                        <xsl:for-each select="key('ProdSubfamily',$inputProd)">
                                            <xsl:value-of select="."/>
                                        </xsl:for-each>
                                    </xsl:for-each>
                                </xsl:when>
                                <xsl:otherwise>
                                    <xsl:value-of select="'9'"/>
                                </xsl:otherwise>
                            </xsl:choose>
                        </SubFamily>
                    </Line-Item>
                </Line>
            </xsl:for-each>
        </PriceCatalogue-Lines>
    </xsl:template>
</xsl:stylesheet>

Correct result which I get with Altova and I want to will get this result with cooktop:
<Interchange>
    <Group>
        <Message>
            <PriceCatalogue-Lines>
                <Line>
                    <Line-Item>
                        <LineNumber>1</LineNumber>
                        <BuyerItemCode>928</BuyerItemCode>
                        <SubFamily>9</SubFamily>
                    </Line-Item>
                </Line>
                <Line>
                    <Line-Item>
                        <LineNumber>2</LineNumber>
                        <BuyerItemCode>439</BuyerItemCode>
                        <SubFamily>016</SubFamily>
                    </Line-Item>
                </Line>
            </PriceCatalogue-Lines>
        </Message>
    </Group>
</Interchange>

BAD result which I get with Cooktop:
<Interchange>
<Group>
<Message>
<PriceCatalogue-Lines>
<Line>
<Line-Item>
<LineNumber>1</LineNumber>
<BuyerItemCode>928</BuyerItemCode>
<SubFamily>9</SubFamily>
</Line-Item>
</Line>
<Line>
<Line-Item>
<LineNumber>2</LineNumber>
<BuyerItemCode>439</BuyerItemCode>
<SubFamily>9</SubFamily>
</Line-Item>
</Line>
</PriceCatalogue-Lines>
</Message>
</Group>
</Interchange>

A: The problem is in the source XML document:
The CDATA sections contain an unnecessary [ character and it is the first character of the text node. This means that:
substring(field[@id='0'], 1,3)='MMM'

is always false()
Solution:
Replace:
<field id="0"><![CDATA[[MMM4443 419280600000]]></field>

with:
<field id="0"><![CDATA[MMM4443 419280600000]]></field>

Also replace:
<field id="0"><![CDATA[[MMM4443 414390600000]]></field>

with
<field id="0"><![CDATA[MMM4443 414390600000]]></field>

Now, regardless of the XSLT processor used (I have 9 of them at home and could run this on 8 of them: MSXML3/4, .NET XslCompiledTransform and XslTransform, AltovaXML, Saxon 6.5.4, Saxon 9.1.05 and XQSharp), the result of the transformation is what I guess you wanted:
<Interchange>
  <Group>
    <Message>
      <PriceCatalogue-Lines>
        <Line>
          <Line-Item>
            <LineNumber>1</LineNumber>
            <BuyerItemCode>928</BuyerItemCode>
            <SubFamily>9</SubFamily>
          </Line-Item>
        </Line>
        <Line>
          <Line-Item>
            <LineNumber>2</LineNumber>
            <BuyerItemCode>439</BuyerItemCode>
            <SubFamily>016</SubFamily>
          </Line-Item>
        </Line>
      </PriceCatalogue-Lines>
    </Message>
  </Group>
</Interchange>

My guess is that Cooktop's XSLT processor needs some configuration in order to be enabled to execute the document() function -- study the available documentation how to do this.

A: Petras, the output you're seeing could mean the XSLT processor is not able to find the lookup.xml file.
Since you're using a relative URL ('lookup.xml'), do you know what the base URL is? In other words, relative to what?
By default, I believe the base URL used is that of the stylesheet. If you pass a second argument to document(), you can explicitly set the base URL. E.g.:
document('lookup.xml', /)

would look for 'lookup.xml' relative to the input XML file.
You could fix the problem, or at least find out if that is the problem, by providing an absolute URL to 'lookup.xml'. Why don't you try that, and let us know if it worked. E.g.
document('/home/lars/lookup.xml')

or
document('file:///c:/temp/lookup.xml')

P.S. XML Cooktop has been a great piece of software, but it seems to be rather old and now apparently unmaintained. This becomes a problem when glitches appear. You might want to try other XSLT tools, like OxygenXML or StylusStudio, that are still maintained.


text:
Q: Replacing incorrectly entered dates in sql server I have ran a query is SQL server. there is a name category and every category has a date that it started... however sometimes data was incorrectly entered in the front end so when I do the data pull it returns two start dates per category when in reality just the earliest date should be present. is there any sql code I can throw into this join query that replaces all situations when a category has two dates with the earliest one?

A: From what I understand, you need to use the MIN() function to get only the earliest entered event when querying your table. You can achieve this my using something similar to the following:
SELECT
categoryName,
MIN(categoryDate)
FROM Category
GROUP BY categoryName

However, I am not sure this is what you need since we have no dataset to verify against. Ideally, you can explain in a more clear way, what you need to achieve, and we can help you better.


text:
Q: How to compare integers with accuracy in Python? I have a tuple for color. For example, (218, 174, 84). The task is to increase each red, green and blue value by some increment and then compare it with an accuracy 1. How can I do this in Pythonic way? Do you know best practices?
Color: (218, 174, 84)
Increment: 5
For red value 222, 223, 224 is legal. Green: 178, 179, 180, Blue: 88, 89, 90.

A: def valid_color(orig_color, new_color, increment):
    return all(c1 + increment - 1 <= c2 <= c1 + increment + 1 for c1, c2 in zip(orig_color, new_color))

Use zip() to pair up the components of the original color and the color you're comparing with. Then use comparison operators to test that each component is valid.

A: If you would like to use python magic and use just ==, you could do:
class Color(tuple):
    def __init__(self, *_, inc=0):
        self.inc = inc

    def __eq__(self, other):
        return all(c1 + self.inc - 1 <= c2 <= c1 + self.inc + 1 for (c1, c2) in zip(self, other))

c = Color((1, 2, 3), inc=5)
c2 = Color((5, 6, 8))
print(c == c2)


text:
Q: Touchpad Recognied as ImPS/2 Generic Wheel Mouse My touchpad is being recognized as a generic mouse and it's creating a lot of problems with just everyday things. I've tried several distros including Ubuntu (16.04, 16.10, 17.04), Arch and currently Manjaro.
I can't zoom and when I go to type in anything, the slightest touch will result in the touchpad recognizing a click, stealing focus away from what I was doing. On my previous model, I could disable that by setting maxTapTime=0.
I'm using a Acer Aspire V5-573G. Is there anyway of getting the system to recognize the touchpad as a touchpad and not a mouse? From what I've read, I may have to wait for the kernel to add support. If that's the case, how do I encourage it? Is it possible for me to write my own drivers and if so, could someone point me in the right direction? Thanks in advance!
I've provided some outputs but I'm not sure if that's enough so please let me know if I'm missing anything.
uname -a
Linux brandyn-laptop 4.9.20-1-MANJARO #1 SMP PREEMPT Fri Mar 31 17:49:34 UTC 2017 x86_64 GNU/Linux

xinput
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ ImPS/2 Generic Wheel Mouse                id=13   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Video Bus                                 id=8    [slave  keyboard (3)]
    ↳ Power Button                              id=9    [slave  keyboard (3)]
    ↳ Sleep Button                              id=10   [slave  keyboard (3)]
    ↳ HD WebCam                                 id=11   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=12   [slave  keyboard (3)]
    ↳ Acer WMI hotkeys                          id=14   [slave  keyboard (3)]

lspci
00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 09)
00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 09)
00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 09)
00:14.0 USB controller: Intel Corporation 8 Series USB xHCI HC (rev 04)
00:16.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev 04)
00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 1 (rev e4)
00:1c.2 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 3 (rev e4)
00:1c.3 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 4 (rev e4)
00:1c.4 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 5 (rev e4)
00:1d.0 USB controller: Intel Corporation 8 Series USB EHCI #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation 8 Series LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 8 Series SATA Controller 1 [AHCI mode] (rev 04)
00:1f.3 SMBus: Intel Corporation 8 Series SMBus Controller (rev 04)
01:00.0 3D controller: NVIDIA Corporation GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M] (rev a1)
04:00.0 Network controller: Qualcomm Atheros AR9462 Wireless Network Adapter (rev 01)
05:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTL8411B PCI Express Card Reader (rev 01)
05:00.1 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 14)

udevadm info -q path -n /dev/input/event16
/devices/platform/i8042/seriol/input/input9/event16

A: You have a touchpad connected to the PS/2 mouse port (Linux driver i8042, named after the original chip), which is why it's auto-detected as a generic mice.
Try using the synaptics driver (packages xf86-input-synaptics, xserver-xorg-input-synaptics etc. depending on distro) driver, as recommended e.g. here.
Look in /dev/input/by-path/ and identify the symlink that is similar to the device path you just found, and links to your current /dev/input/eventX for the touchpad. The numbers
for input devices are not guaranteed to be stable across boots (though they often are), so it's better to use such a symlink.
Make a xorg.conf file (standard path is /etc/X11/xorg.conf) with the following section
Section "InputClass"
   Identifier "touchpad"
   Driver "synaptics"
   MatchIsTouchpad "1"
   MatchDevicePath "/dev/input/by-path/path_to_your_touchpad"
EndSection

Add Option parameters to configure it. Look at /var/log/Xorg.0.log after restarting X or rebooting to see if everything works.
Read the driver man page and google for "linux synaptics driver" etc. for more information.
Edit:
If there's no symlink /dev/input/by-path on the number does change on reboot, try /dev/input/by-id. If this doesn't work, either, you need a udev rule. Do
udevadm info -a -p /devices/platform/i8042/seriol/input/...

with the current path, this will walk up the path tree and show attributes you can use to identify it. Make a new udev rule file, on my system it would be something like /etc/udev/rules.d/70-acer-touchpad.rules, and your rule will probably look something like
ACTION=="add", SUBSYSTEMS=="serio", ATTRS{foo}=="foo", ATTRS{bar}="bar", SYMLINK+="input/by-id/acer-touchpad"

Details depend on your systen and the attributes you see, and will need tweaking until it works. Google "write udev rule" for tutorials etc., and man udevadm.
Edit
According to the udevadm output,
looking at parent device '/devices/platform/i8042/serio1/input/input7':
  KERNELS=="input7"
  SUBSYSTEMS=="input"
  DRIVERS==""
  ATTRS{name}=="ImPS/2 Generic Wheel Mouse"
  ATTRS{phys}=="isa0060/serio1/input0"
  ATTRS{properties}=="1"
  ATTRS{uniq}==""

looking at parent device '/devices/platform/i8042/serio1':
  KERNELS=="serio1"
  SUBSYSTEMS=="serio"
  DRIVERS=="psmouse"
  ATTRS{bind_mode}=="auto"
  ATTRS{description}=="i8042 AUX port"
  ATTRS{firmware_id}==""
  ATTRS{protocol}=="ImPS/2"
  ATTRS{rate}=="100"
  ATTRS{resetafter}=="5"
  ATTRS{resolution}=="200"
  ATTRS{resync_time}=="0"

I'd try ATTRS{phys}=="isa0060/serio1/input0" first. Maybe you need to change SUBSYSTEMS=="serio" to SUBSYSTEMS=="input" if it doesn't work.


text:
Q: Links open when scrolling on touch devices/mobile On all touch devices both Android and iPhone and iPad, when scrolling with finger over a link the site opens the link instead of ignoring the press and just scrolling as touch devices normally do when scrolling.
I'm using WordPress 4.2.15 and building my own child theme off of twentythirteen.
Link: joshuachronstedt.dk
Plugins:
Advanced Custom Fields,
Advanced Custom Fields Multiligual,
Advanced iFrame,
All in one Favicon,
Disable Emails,
Duplicate Theme,
Insert Headers and Footers,
Instagram Feed,
jQuery Smooth Scroll (I have tried disabling this),
No Image Links,
Page Animations And Transitions,
Simple Custom Post Order,
SVG Support,
UpdraftPlus,
Video Thumbnails,
What The File,
WP-PageNavi,
WP Load More Posts,
WPML Multiligual CMS,
WPML String Translation,
WPML Translation Management.
Hope someone can help :)

A: I could confirm on your shared site that some javascript code is causing this issue.
This code may be generated by plugins used on your site so please try temporary deactivating all plugins and see whether everything works fine and then enable the plugins one by one to see which plugin is generating it if any.
Also this can be generated by child theme used on your site so to confirm it just temporary use the twentythirteen theme instead of child theme on your site. If everything works fine then it's your child theme generating that code.


text:
Q: How do I setText from AppDelegate to ViewController? I have a single view application. It has myAppDelegate and myViewController. In a earlier learning project I did from a book, myViewController.h contained the following:
IBOutlet UILabel *textField;

And to display text to that label on the iPhone, it had you put the following in myViewController.m:
[textField setText:@"Hello World!"];

And it worked! Pretty! But...how do I accomplish the same from myAppDelegate? If I put that same line above inside myAppDelegate.m, inside:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

I get an error: Use of undeclared identifier 'textField'.
So I can I print text to that same label inside myViewController from myAppDelegate?
Thanks!!

A: The best answer would probably be, "Don't...because the view controller should be responsible for its own views."
However, practically, you need to have a reference to your view controller in order to change one of its properties.  The syntax would be something of the form [controller.textField setText:@"Hello World!"];, but with your own variable name as the target.  The exact statement would depend on what's currently in your didFinishLaunchingWithOptions: method and how your app delegate and view controller are connected to each other.


text:
Q: PTR record created, but not found We are a small ISP, using linux DNS servers. Recently a client has asked us to create a rDNS zone for a specific IP address, which is used for a mail server. They keep getting message failures for some emails due to lack of PTR records and valid rDNS.
We created the rDNS zone the same way as all of the other rDNS zones are created. The only difference is that, outside of our network the PTR record is not found, but only for that specific IP address.
Does anyone know what could be the cause of this?

A: Use the trace option in dig to debug delegation path from the root nameservers. A couple of re-runs is usually needed to follow different referals.
For example ip-address of serverfault.com:
dig +trace -x 198.252.206.140