text:
Q: How to apply an opacity without affecting a child element with html/css? I want to achieve this using html and css:

I have tried to set the opacity of the container to 0.3 and the box to 1, but it doesn't work: both divs have 0.3 opacity.
jsFiddle of my try here
The effect I am trying to achive is a popup box that comes on top of the page. It is highlighted by fading the content below (by lowering the opacity).

A: You can't apply an opacity property without affecting a child element!
"Opacity applies to the element as a whole, including its contents, even though the value is not inherited by child elements. Thus, the element and its children all have the same opacity relative to the element's background, even if they have different opacities relative to one another... If you do not want to apply opacity to child elements, use the background property instead." https://developer.mozilla.org/en-US/docs/Web/CSS/opacity
If you want the opacity to be applied only to the background, without affecting the child elements, use:

background-color: rgba(255, 255, 255, .3)

However, you can achieve the desired effect if you place them inside a div parent element and use CSS position property:

.parent {
  border: solid green 3px;
  position: relative;
  width: 400px;
  height: 200px;
}

.sibling-one {
  border: solid red 3px;
  position: absolute;
  box-sizing: border-box;
  width: 400px;
  height: 200px;
  opacity: .3;
 }

.sibling-two {
    border: solid blue 1px;
    margin: 10px;
    width: 200px;
    height: 100px;
    position: absolute;
    transform: translateY(50%);
}

A sibling's one element

A sibling's two element

A: Try using rgba as a 'pre content' overlay to your image, its a good way to keep things responsive and for none of the other elements to be effected.

header #inner_header_post_thumb {
  background-position: center;
  background-size: cover;
  position: relative;
  background-image: url(https://images.pexels.com/photos/730480/pexels-photo-730480.jpeg?w=1260&h=750&auto=compress&cs=tinysrgb);
  border-bottom: 4px solid #222;
}

header #inner_header_post_thumb .dark_overlay {
  position: relative;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
}

header #inner_header_post_thumb .dark_overlay .container .header-txt {
  padding-top: 220px;
  padding-bottom: 220px;
  color: #ffffff;
  text-align:center;
}

header #inner_header_post_thumb .dark_overlay .container .header-txt h1 {
  font-size: 40px;
  color: #ffffff;
}

header #inner_header_post_thumb .dark_overlay .container .header-txt h3 {
  font-size: 24px;
  color: #ffffff;
  font-weight: 300;
}

header #inner_header_post_thumb .dark_overlay .container .header-txt p {
  font-size: 18px;
  font-weight: 300;
}

header #inner_header_post_thumb .dark_overlay .container .header-txt p strong {
  font-weight: 700;
}

Title On Dark A Underlay

Have a dark background image overlay without affecting other elements

No longer any need to re-save backgrounds as .png ... Awesome

See a working codepen here

A: Using background-color: rgba(#777788, 0.3); instead of opacity could maybe fix the problem.

A: As far as I know you can't do it in a simple way. There a couple of options here:

*

*Use absolute positioning to position box "inside" the container.

#container {
    opacity: 0.3;
    background-color: #777788;
    position: absolute;
    top: 100px;
    left: 100px;
    height: 150px;
    width: 300px;
}
#box {
    opacity: 1;
    background-color: #ffffff;
    position: absolute;
    top: 110px;
    left: 110px;
    height: 130px;
    width: 270px;
}

Something in here

*Use Javascript - almost the same as above, but position and size don't have to be hardcoded.

A: Apply this css rule
.alpha60 {

/* Fallback for web browsers that doesn't support RGBa */

background: rgb(0, 0, 0);

/* RGBa with 0.6 opacity */

background: rgba(0, 0, 0, 0.6);

/* For IE 5.5 - 7*/

filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,      endColorstr=#99000000);

/* For IE 8*/

-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,     endColorstr=#99000000)";
}

In addition to this, you have to declare background: transparent for IE web browsers.
For more details visit the following link:
http://robertnyman.com/2010/01/11/css-background-transparency-without-affecting-child-elements-through-rgba-and-filters/

A: You can use opacity in combination with background color, like this:

#container {
    border: solid gold 1px;
    width: 400px;
    height: 200px;
    background:rgba(56,255,255,0.1);
}

#box {
    border: solid silver 1px;
    margin: 10px;
    width: 300px;
    height: 100px;
    background:rgba(205,206,255,0.1);
}

    containter text

        box text

Live demo

A: Any child of an element with opacity set will take on that opacity.
To achieve this style you could use rgba colours and filters for IE for the background, and opacity on the textual elements. So long as the second box isn't a child of one of the text elements, then it won't inherit the opacity.

A: Another workaround is to simply use an overlay background to create a similar effect.
I personally like a black overlay with about a 65% opacity, but for what you are trying to do you may want to use a white overlay at round 70%.
Create a small (100 x 100 or less) PNG in Photoshop or GIMP that has the color and opacity you want. Then just set that as the background of your light box.
If you create multiple PNGs at different opacities you can easily switch between them with JS or dynamically at load via backend scripting.
It's not technically what you are trying to do, but aesthetically it can give a very similar effect and UX wise accomplishes the same thing. It is also very easy to do, and widely supported across pretty much everything.

A: Opacity will always inherits by the child element regardless whatever the element in there, there is no workaround up to today have suggested, when the moving of the child element outside the transparency background is not an option like in a popup menu/dialog box creation, use of background with the rgba is the solution.
Here is a input box that i created that i can turn on or off with the class property invisible by javascript

Enter the field name:

        <input type="text" id="fieldvalue" />
        <input type="button" value="OK" id="addfname" />

CSS
#blackout {
    z-index: 9999;
    background: rgba(200, 200, 200, 0.6);
    height: 100%;
    width: 100%;
    display: block;
    padding: 0px;
    clear: both;
    float: left;
    position: absolute;
    margin-top: -10px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: -10px;
}

#blackout #middlebox {
    border: thick solid #333;
    margin: 0px;
    height: 150px;
    width: 300px;
    background-color: #FFF;
    top: 50%;
    left: 50%;
    position: absolute;
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    padding: 10px 50px 0px 50px;

}

#middlebox p {
    float: left;
    width:100%;
    clear:both;
}

#middlebox input {
    clear:both;
    margin-bottom:10px;
}

#middlebox input[type=text]{
    width:100%;
}

#middlebox input[type=button]{
    float:right;
    width:30%;
}

.invisible{
    visibility:hidden !important;
}

A: Use such elements that you can add :before or :after. My solution

         Inside of container element is not effected by opacity.

Css.
.container{
    position: relative;
}

.container::before{
    content: '';
    height: 100%;
    width: 100%;
    position: absolute;
    background-color: #000000;
    opacity: .25
}

A: This might not be the most orthodox method but you can use a small semi-transparent background image for each div / container that repeats.  It does seem that in this day and age you should be able to achieve this in pure (simple not hackish) css with no js but as the answers above show it isn't that straight forward...
Using a tiled image might seem dated but will work no worries across all browsers.

A: You can add a container's sibling absolutely positioned behind container, with the same size, and apply opacity to it.
And use no background on your container.
Now container's children have no opaque parent and the problem vanishes.


text:
Q: Install docker 1.11 on Fedora 21 I need to install docker 1.11.x on Fedora 21. I'm not familiar with this distro so have followed the instructions on the docker website but only 1.9.1 is available.
Any ideas on how to install 1.11? Perhaps I need to point to a different repo?

A: curl -o docker.tar.gz https://get.docker.com/builds/Linux/x86_64/docker-1.11.2.tgz
tar xzvf docker.tar.gz
sudo mv docker/* /usr/bin/

With this code your are downloading the binaries compiled for your by Docker and you are coping that into a $PATH dir in order to use that around your system.

A: I simply needed to update fedora to 22

redpajama_set_name: RedPajamaStackExchange


text:
Q: Change colour of data bound Itemtemplate on selected I have a small problem.
I am binding an XML File to an itemGridView and an itemListView
The Databind: (Works perfectly fine, just providing what I've done here)
 var data = from query in xdoc.Descendants("Colour")
                       select new ColourClass
                       {
                           Colour = "FFFF0000"

                       };
            itemGridView.DataContext = data;
            itemListView.DataContext = data;

I want to change the color of the text when the item in the grid is selected (change the color permanently that is). I wrote up this: It doesn't seem to work.
    void ItemView_ItemClick(object sender, ItemClickEventArgs e)
    {

        ((ColourClass) e.ClickedItem).Colour = "#FF46FF00";

    }

My XAML:
<GridView
            x:Name="itemGridView"
            AutomationProperties.AutomationId="ItemsGridView"
            AutomationProperties.Name="Items"
            TabIndex="1"
            Grid.RowSpan="2"
            Padding="116,136,116,46"
            ItemsSource="{Binding}"
            ItemTemplate="{StaticResource Standard250x250ItemTemplate}"
            SelectionMode="None"
            IsSwipeEnabled="false"
            IsItemClickEnabled="True"
            ItemClick="ItemView_ItemClick"/>

And the standard template:
<DataTemplate x:Key="Standard250x250ItemTemplate">
    <Grid HorizontalAlignment="Left" Width="400" Height="60">
        <StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}">
            <TextBlock Text="test" Foreground="{Binding Colour, Mode=TwoWay}" Style="{StaticResource AppIDTextStyle}" Height="60" Margin="15,0,15,0"/>
        </StackPanel>
    </Grid>
</DataTemplate>

How would I go about changing the colour of a particular item in the Standard 250 template used in gridview?
I have tried to change the colour through databinding itself, but am open to easier ways of doing it.
All I need happening is the colour of the item changing from red to green when the user clicks on the item.

A: UPDATE 1
INotifyPropertyChanged will also work for you. I am giving simplest demo which will help you. I suspect how are you binding Foreground with help of string property Colour without using converter class implementing IValueConverter.
XAML
<GridView x:Name="gv" SelectionMode="None" IsItemClickEnabled="True" ItemClick="gv_ItemClick_1">
    <GridView.ItemTemplate>
        <DataTemplate>
            <TextBlock FontSize="20" Text="{Binding Color}" Width="200" />
        </DataTemplate>
    </GridView.ItemTemplate>
</GridView>

C#
protected override void OnNavigatedTo(NavigationEventArgs e)
{
    gv.ItemsSource = new List<ColourClass>
    {
        new ColourClass("abc"),
        new ColourClass("dsd"),
        new ColourClass("yhd"),
        new ColourClass("nve"),
        new ColourClass("a3e"),
    };
}

private void gv_ItemClick_1(object sender, ItemClickEventArgs e)
{
    ((ColourClass)e.ClickedItem).Color = "#FF46FF00";
}

public class ColourClass : INotifyPropertyChanged
{
    private string _Color;
    public string Color
    {
        get { return _Color; }
        set { _Color = value; OnPropertyChanged("Color"); }
    }

    public ColourClass(string c)
    {
        Color = c;
    }

    public event PropertyChangedEventHandler PropertyChanged;

    private void OnPropertyChanged(string Prop)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(Prop));
        }
    }
}

These will help you.
Metro App ListView SelectedItem Selected VisualState
Controlling The DataTemplate

A: Figured out how. Thanks to Xyroid for the code, helped a lot
In the class:
    private string _colour;

    public string Colour
    {
        get { return _colour; }
        set
        {
            _colour = value;
            NotifyPropertyChanged("Colour");
        }
    }

In the method:
   ((AppToDownload) e.ClickedItem).Colour = "#FF46FF00";


text:
Q: Como comparar a estrutura de duas tabelas e atualizar a outra? A pergunta é a mesma do título:
Como comparar a estrutura de duas tabelas e atualizar a outra?
Tenho um banco de dados online, o qual pretendo atualizar a estrutura do mesmo. Tenho também alguns clientes que usam bancos dedados offline em suas máquinas.
Quero que, quando meu cliente tiver internet, ele compare a estrutura do banco dele com a do banco online. Caso haja diferença, ele atualize.

A: Dá pra fazer através do Workbench do MySql:
Primeiro, você tem que converter seu schema em um model, faça assim:

*

*Database > Reverse Engineer

*Selecione o banco de dados > Next

*Next

*Selecione o schema que quer converter > Next

*Next

*Selecione as tabelas > Execute >

*Next

*Finish

Após ter convertido o schema em model, faça:

*

*Database > Synchronize with Any Source

*Next

*Send Updates To > Destination Database Server > Next

*Preencha os dados do Banco Alvo > Next

*Next

*Selecione a tabela que quer sincronizar > Next

*Next

*Serão listadas todas as alterações disponíveis > Next

*Execute >

Será gerado um txt com as alterações possíveis e ao clicar em Execute > ele irá executar todas as alterações e deixar as estruturas dos dois bancos idênticas.
Caso tenha algum erro, será listado também.


text:
Q: C array and pointer parameters I am getting the following warning:
expected 'float **' but argument is of type 'float (*)[6]'

Here is my code:
//state and error are output parameters
void func(float* state[6], float* err[6][6]);

int main()
{
  float state[6];
  float err[6][6];

  func(&state, &err);

  return 0;
}

I want state and err to be ouptut parameters, so state should be a pointer to an array, and err should be a pointer to a 2 dimensional array.

A: Change your code to:
void func(float state[], float err[][6]);

int main()
{
  float state[6];
  float err[6][6];

  func(state, err);

  return 0;
}

To understand why, you need to know that float* err[6][6] is a 6x6 array of pointers to float, not a pointer to a 6x6 array of floats.

A: #include <stdio.h>

void func(float (*state)[6], float (*err)[6][6]){
    printf("%f, %f\n", (*state)[2], (*err)[1][2]);//3.000000, 3.300000
}

int main()
{
  float state[6]={1.0f,2.0f,3.0f};
  float err[6][6]={{1.0f,2.0f,3.0f},{1.1f,2.2f,3.3f}};

  func(&state, &err);

  return 0;
}

A: In most contexts, an expression of array type will be converted to an expression of pointer type; this means when you pass an array expression to a function as a parameter, what the function will receive is a pointer.  The exceptions to this rule are when the array expression is an operand of the sizeof or unary & operators, or is a string literal being used to initialize an array in a declaration.
In the context of a function parameter declaration, T a[] and T a[N] are treated the same as T *a; all three declare a as a pointer to T, not as an array of T.
So, going by your declarations
float state[6];
float err[6][6];

the type of the expression state is "6-element array of float", which in most contexts will be converted to "pointer to float", or float *.  Similarly, the type of the expression err is "6-element array of 6-element array of float", which will be converted to "pointer to 6-element array of float", or float (*)[6].
The type of the expression &state is "pointer to 6-element array of float", or float (*)[6], and the type of &err is "pointer to 6-element array of 6-element array of float", or float (*)[6][6].
So, if the call to func is
func(&state, &err);

then the prototype must be
void func(float (*state)[6], float (*err)[6][6])

and you would need to explicitly dereference state and err before applying any subscript:
(*state)[i] = ...;
(*err)[i][j] = ...;

If the call is
func(state, err);

then the prototype must be
void func (float *state, float (*err)[6])

and you would not need to explicitly dereference either state or err:
state[i] = ...;
err[i][j] = ...;

So, which do you use?  Personally, I'd go with the second option; it's a little cleaner.

A: Whereas inside a function, T[][] and T** can be used pretty much interchangeably, when they are being passed as arguments there are caveats. The 'pointer-to-pointer' pattern uses only enough memory to store the variable itself (typically the same as the word size of the processor) and relies on the programmer to somehow generate the correct offsets into the data, whereas with array syntax, the compiler also needs to know the stride of the structure so it can address rows correctly. Personally I don't like passing arrays as parameters for just this reason: it makes the stride fixed at compile time. Better, in my opinion, to always go the T** route with auxiliary parameters for rows and columns.

A: void func(float* state[6], float* err[6][6]);

int main()
{
  float state[6];
  float err[6][6];

  func(&state, &err);

  return 0;
}

Both of the following two declarations are identical...
char *message = "Hello World!";
char message[13] = "Hello World!"; /* "Hello World!" is 12 chars + \0 termination */

Arrays are pointers, just treated differently.
So, to pass the address of message in either of those declarations to func1(char*) OR func1(char[]), you say func1(message); That passes the address.
Arrays can only be passed as addresses to the first value. Run the following program to demonstrate that fact.
#include <stdio.h>
void func(float* array);

int main()
{
  float state[6];
  int i = 0;
  printf ( "Sizeof state: %d\n", sizeof(state) );
  for ( i = 0; i < 6; i ++ ) { state[i] = i+1; }
  func(state);

  return 0;
}

void func ( float *array )
{
 printf ( "Sizeof float: %d\n", sizeof(float) );
 printf ( "Sizeof array: %d\n", sizeof(array) );
 printf ( "Value in array[0] = %f\n", array[0] );
 printf ( "Value in *array = %f\n", *array );
 array++;
 printf ( "Value in array[-1] = %f\n", array[-1] );
 printf ( "Value in array[0] = %f\n", array[0] );
 printf ( "Value in *array = %f\n", *array );
}

So, your call to func(float* state[6], float* err[6][6] ); is declaring a 2 level pointer, and a 3 level pointer. Similar functionality, but the same call, can be achieved with func(float **state, float ***err );
Needless to say, not what you are aiming for.


text:
Q: Do attributes make your objects heavy Hi I have a class that I will be adding lots of attributes onto its properties. It could be about 3 per property. these attributes will be used by a T4 template to determine how to wrap the object in html. eg I could wrap my textbox in a span and that span in a div and give the div a css class.
will my class be heavy?

A: No, attributes are metadata. They are baked into the assembly at compile time. If there is nothing reading them at runtime you shouldn't worry about performance or your object being heavy.

A: They do make your application heavier in maintenance costs. If you do branch per feature, you will have way more conflicts to resolve than if you went with conventions instead.


text:
Q: How to monitor the progress of Map? I have a function doSomethingComplicated[...] that takes about 10s on average to evaluate. My list, listOfArgs has about 10000 elements. I'd like to monitor the progress of Map[doSomethingComplicated, listOfArgs] without having it ever occupying a big area of the screen.  What's best way to do that?

A: Using MapIndexed, which also gives you the index of the element in the list instead of Map would be very convenient. That way, you can set up a Print or a PrintTemporary cell. For example:
Clear[f]
f = (Pause[0.2]; PrintTemporary[First@#2]; #^2) &; (* your complicated function *)
MapIndexed[f, Range[10]]

(* 1
   2
   ...
   ...
  {1, 4, 9, 16, 25, 36, 49, 64, 81, 100} *)

With a PrintTemporary cell, it prints all the output, but the cell disappears when the evaluation is complete, saving you the trouble of cleaning the mess.
You can also print directly to the messages notebook using the PrintToConsole function from my answer here. This keeps your current working notebook clean and you can always check in the other to see the progress.

Another option is to use side-effects and increment a variable, which allows you to use Monitor. For example:
Clear[g]
g = (Pause[0.2]; i = First@#2 + 1; #^2) &;
Block[{i = 1}, Monitor[MapIndexed[g, Range[10]], i]]

See this answer by Brett Champion for the different ways in which you can create a progress bar to suit your needs.

A: With the 10.3 release and introduction of Echo there is neat simple way:
Just wrap Echo around w/e you map:
Echo[f[#]] & /@ Range[5]

And if you want to suppress large outputs, you can do something like
MapIndexed[(Echo["", First[#2]]; Sin[#1]) &, Range[5]]

which is similar to print but pretty.


text:
Q: Sharepoint web services to edit existing list from desktop Perhaps I am not asking or searching for this correctly:
I want to have a desktop script (currently using python) that will update a list on a sharepoint site.
The current script reads various file shares, ftp sites and a ArcGIS database to determine which metadata files have been updated and published.  The script then writes all these results to a Excel spreadsheet.
We would like to do the same thing, but keep the data in a Share Point list instead of a spreadsheet.  We don't need to upload any files (which is what I keep running across in my search) but just update or add to a list.
We could care less about what language or tools we use, we just don't have access to any custom coding on the Share Point server.

A: You should be able to use the lists webservice on the Sharepoint server,
the url is normally:
 http://host/sitename/_vti_bin/lists.asmx
you are looking at the UpdateListItems webservice call.  I don't know python but I use C# and work with sharepoint every day you can find a working example on MSDN on a Windows app to call the web service.


text:
Q: HTML within Javascript Function Not Working Properly I am using the following JavaScript function:
function Projects()
{
    var PrjTb1 = "<input type=text id=PrjNme size=100/>"
    var PrjTb2 = "<textarea rows=5 col=200 wrap=hard></textarea>"
    var Info = "1. Project or activity name:
" + PrjTb1 + "

2. Project or activity description:
" + PrjTb2
    if (document.getElementById('PrjNo').value == 1)
    {
        document.getElementById('AllPrj').innerHTML = "Project or activity 1.

" + Info
    }
}

This function executes well, after an onclick event; however, certain portions of the HTML within the declared variables are not working.  For example, within the variable PrjTb2, my textarea's rows and columns do not change.  Also, I cannot add the HTML tags
 and
 anywhere within the variables to create an indentation.  What is interesting is that both the textarea properties and the HTML tags,
 and
, work within the body of my form, just not in my JS function.  Would anyone know what I am doing wrong.

A: It could be that your browser is caching your Javascript. Try clearing your cache.

A: Not sure if its the problem, but I'd enclose all your parameters in quotes.
<input type=text id=PrjNme size=100/>

should really be:
<input type='text' id='PrjNme' size='100' />

additionally, depending on your Doctype, you may want to change

to

Things that are allowed in direct HTML are not necessarily allowed using innerHTML. For example, in Firefox, try embedding a form within a form in JS vs html, or in IE, try putting a block element inside an inline element. They both work fine, if you have it in HTML, but if you try it with innerHTML, both browsers will complain.

A: I don't know if your syntax error are due to copying you code here, but here is a couple of things I noticed in your code.

*

*Are you omitting semi-columns at the end of you lines on purpose?

*HTML proprieties should be surrounded by quotation marks. (Although not necessary)

Also regarding the

, did you put those inside a definition list (dl)?
Because they shouldn't be used as standalone tags.


text:
Q: Need some suggestions for database design for Invoices in a multi-tenant app I need some guidance on designing the schema for invoices in a multi-tenant application.
I have a table called EmployeePay which holds all the information required to generate an invoice. The invoice table would have the invoice number, invoice created date and VAT rate. I am thinking to create a Sequence object for each Tenant to generate an invoice number.
EmployeePay Table: EmployeeID, Hours, Rate, InvoiceID (FK)

Invoice Table: InvoiceID (PK) (Identity), InvoiceNumber, InvoiceDate, VATRate, TenantID

Is it okay to have hundreds of Sequence objects in a database, as I'll have to create one for each tenant? I'll also have to create same amount of stored procedures which returns the next invoice number (I prefer a separate stored procedure for each tenant rather than having one large stored procedure with hundreds of choices in a select case statement).
Another concern is, is it theoretical to insert into the master table (Invoice) based on the transaction table (EmployeePay) and then use its primary key(InvoiceID) to update the transaction table?
Thanks in advance.

A: First make sure the relationship either this is one to many or many to many. If you are considering one employee that will have many invoices then its one to many relationship and you can create your table as under:
EmployeePay Table: EmployeeID (PK) (Identity), Hours, Rate

Invoice Table: InvoiceID (PK) (Identity), EmployeeID (FK), InvoiceNumber, InvoiceDate, VATRate, TenantID

EDIT:
I don't know which database you are using but for increment sequence check:

*

*for MySQL check this LINK.

*If you are using Oracle then check this LINK

A: I would suggest you to create another table can be called as InvoiceNumber, this will contain InvoiceNumberId(Int),TenantId (Fk), CurrentSequenceNumber(Int).
Significance of CurrentSequenceNumber is that it will be simple integer number which can be used to generate next Invoicenumber.InvoiceNumberId will be a Identity columns for Primary key purpose (you may or may not have it).
Structure of the Table will look like below.

Now you need to create only One Stored Procedure which will take input parameter as TenantId and will have responsiblity to generate next Invoice number by reading CurrentSequenceNumber from above table.
For example if we need to generate new Invoice Id for Tenant with id as 15 then SP will have your Business logic I am assuming Just creating a String with "Inv-" as prefix with incremented value of CurrentSequenceNumber so output of Procedure will be.
Inv-0009
Then after generation of this number SP will increment value to 9 for InvoiceNumberId 3.
So everything will be managed by Single table and Single procedure only.


text:
Q: Group ListView Items like a TreeView in WPF I have a ListView which is starting to have too many items to have on one window. I would have a ComboBox to choose a subset to display, but all need to be available. I want to be able to collapse and expand logical portions of items, under parents. The number of groupings will be dynamic.
I need a ListView not a TreeView as the ListView defines a custom ListBox. To achieve this I followed this guide: http://blogs.msdn.com/b/permanenttan/archive/2009/01/19/wpf-listview-with-check-boxes-and-no-clipping.aspx
To summarise, it is had two columns, the first contains a CheckBox, and the second contains a corresponding TextBlock. This is so I can select a row without checking the box.
<ListView>
  <ListView.View>
     <GridView>
       column definintions....

It is the <ListView.View> which isn't available in TreeView which is why I believe I must stick with ListView.
Attempting to enclose the listview in a treeview didn't go well, it would result in me having to define separate listviews and therefore the whole column definition for each . As is my understanding. Avoiding a template too would be ideal but I would settle for this.
Ideally the ObservableCollection which populates the ListView can remain unchanged, I'd prefer not having a List of these.


text:
Q: Can't install SQL Server 2008 R2 management tool (complete) I have SQL Server 2008 R2 Express installed on my workstation. I'm in the process of learning Entity Framework, and wanted to use the Management Studio Profiler to help understand the SQL commands generated by EF.
Since the Express version does not include the Profiler, I installed SQL Server 2008-R2 Developer side-by-side with Express. The installation went perfectly and I had no problem adding my databases to the full Server installation.
The problem is that Management Studio – Complete was not installed with the full SQL Server so I still don't have access to the profiler. I re-ran the installer so I could install the Complete version, but it is greyed out and I cannot select it for installation.
Can someone help me get Management Studio – Complete installed?
If I have to uninstall the Express version, will that hurt anything (I have VS2010 Ultimate installed as well)?
Thanks!

A: I ran into this and had the hardest time getting the Management Tools - Complete to install.  I finally got it working by running the upgrade.  Even though it was already Enterprise edition with nothing obvious to upgrade I went through the update wizard.  After that I was able to do the install of the complete tools.
Steps:
Run the installer -> Maintenance -> Edition Upgrade -> follow the wizard.
Then -> Run the installer -> Installation -> New SQL Server stand-alone ... -> ... "Add features to existing install" -> Management Tools - Complete.

A: To solve the problem I uninstalled SQL express and the Basic version of Server Management Studio.
Uninstalling SQL Express is not intuitive as it does not appear as a separate item in the "Programs and Features" window.
To uninstall it, I right-clicked on "Microsoft SQL Server 2008 R2 (64-bit)" and selected Uninstall/Change".  This opened a dialog, from which I selected 'Remove'. I navigated though the process until I arrived at a screen which allowed me to elect to remove the Express version (all items with 'Express' in the name). I also elected to remove Management Studio Basic.
After SQL Server Express and Management Studio Basic were uninstalled, I started the SQL Server 2008 R2 installer; this time I was able to select Management Studio Complete for installation.
The installation process executed normally; when it finished the Complete version of Management Studio was available and I was able to execute the Profiler.
Uninstalling SQL Server Express appears to have done no harm to my system; I was able to modify the Server Explorer data connection in VS2010 to connect to my database in the full version of SQL Explorer.
This process outlined above worked for me; YMMV.

A: In my case I was trying to install instance features, while SQL Management Studio is a Shared feature.

A: Another way of installing SQL Management Studio is to install another instance using SQL With Tools or the Advance Services issue. Do not look into another instance that is already installed.


text:
Q: Creating view models in WP7 using MVVMLight v 4.0 I just started building a windows phone application and i am very much conscious about the    application's memory constraints. So my doubt is, is there any advantage for dynamic view models over static view models. I think if i create static view models, while the time of application launching the memory will be allocated for all my view models and  it may eventually increase my application's memory usage. How i can tackle this situation. I found in V 4.0. A SimpleIOC container is added along with the libraries, how i can make use of that. provide some samples or documentations that make me learn the technology easier.

A: Unless you have a highly complex model, the memory consumed by your view models will be trivial compared to the memory required to store your UI assets such as images, UI controls, views etc ...
Just create the view models in the most natural way. People do not use MVVMLight or IoC containers in order to reduce memory usage, they use them to help structure their code.
I would advise you to start simple, without any frameworks, and structure your code sensibly. I wrote a blog post a while back that shows how to use MVVM for WP7.


text:
Q: Interface grants access to Object? I just started to work with Entity Framework and in order to use ObjectMaterialized and SavingChanges events I have to cast a class which implements DbContext to IObjectContextAdapter interface in this way:
var context = (this as IObjectContextAdapter).ObjectContext;

In the book that I'm reading it says that DbContext does not expose the ObjectContext directly but it implements the IObjectContextAdapter which grants access to that object.
My question:How does exactly casting that object to an interface "grants access" to ObjectContext?
I looked in the DbContext class and it does not have any ObjectContext object.Also it does not inherit any other object,just implements IObjectContextAdapter interface.
So how and from where exactly is the object accessed ?


text:
Q: LINQ to SQL Join issues with FirstOrDefault() I posted a question earlier, but I've narrowed down the problems now and it's something pretty different. Basically, I have a rather long query which aims to select values from a database into a custom structure (which I'll show below), but I'm having issues with the joining - paticulary trying to only select the first row of a join. Here is my query:
IENumerable<VehicleDetails> list = (
    from s in dc.Vehicles
    join veh in dc.VehicleTypes
        on s.VehicleType equals veh.ID into vg
    from v in vg.DefaultIfEmpty()
    join consignments in dc.Consignments
        .FirstOrDefault(x => x.TripDate > dateFrom &&
            x.TripDate < dateTo &&
            x.DeliveryDepot == depot.Letter &&
            (x.DeliveryStatus == 2 || x.DeliveryStatus == 3))
        on new
        {
            Reg = s.VehicleReg,
            Depot = s.VehicleDepot
        } equals new
        {
            Reg = consignments.VehicleReg,
            Depot = consignments.DeliveryDepot
        } into con
    from c in con.DefaultIfEmpty()
    select new
    {
        VehicleType = (
            s.VehicleType == null ? "?":
            v.VehicleType1.ToString()),
        TotalRate = c.Rate + c.AddCharges,
        VehicleReg = (string.IsNullOrEmpty(c.VehicleReg) ?
            c.Subcontractor: c.VehicleReg),
        VehicleTypeName = (v.VehicleTypeDescription ==  null ?
            "SubContractor": v.VehicleTypeDescription)
    });

My struct:
public struct VehicleDetails
{
     internal string VehicleType;
     internal decimal TotalRate;
     internal string VehicleReg;
     internal string VehicleTypeName;
}

With the FirstOrDefault() in the second join, I get:

The type of one of the expressions in
  the join clause is incorrect. Type
  inference failed in the call to group
  join.

Without it (and replacing the FirstOrDefault with a Where instead), I get an error about implicity converting an anonymoustype into a 'vehicledetials' type. Both errors occur on the from c in con.DefaultIfEmpty() call.
Any ideas would be much, much appreciated

A: FirstOrDefault() will eagerly return a single element, but what you need is a collection (IQueryable) of elements.
So
dc.Consignments
    .Where(x => x.TripDate > dateFrom &&
                x.TripDate < dateTo &&
                x.DeliveryDepot == depot.Letter &&
                (x.DeliveryStatus == 2 || x.DeliveryStatus == 3))
   .Take(1)

will return a deferred collection that will have only one element.

A: Why don't you make your query more simpler!!

*

*I highly recommend to use FirstOrDefault() at the end of the query (last method of your query).

*Put your condition on Where better instead of FirstOrDefault since you're going to put it at the end

I think your mistake here is FirstOrDefault with join, when u're using join you should join with a collection not a single item (single is the result of FirstOrDefault)


text:
Q: Uniqueness of a Hahn Banach extension Let $M = \{(x_n) \in l_1: x_1-3x_2=0\}$ and $f: M \to \mathbb{R}$ given by $f((x_n)) = x_1$. Let $g: l_1 \to \mathbb{R}$ be the Hahn Banach extension of $f$.
Show that  $g$ is unique.
I know that $\|g\|=\|f\|$. So, I tried to compute $\|f\|$.
It's easy to see $\|f\| \leq 1$. But I couldn't prove $\|f\|=1$.
And I don't know what to do with the equality $\|g\|=\|f\|$ in order to prove that  $g$ is
unique.
I would really appreciate your help

A: First note that $M=\left\{(3y,y,x_3,x_4,x_5,\ldots)\in l_1:y,x_i\in\mathbb{R}\right\}$, so $l_1=M\oplus\mathbb{R}(1,0,0,0,\ldots)$.
Now note that $|f(3,1,0,0,\ldots)|=3$, so $\Vert f\Vert\geq 3/4$. Show that in fact for every $x\in M$, $|f(x)|\leq\frac{3}{4}\Vert x\Vert$, and then conclude that $\Vert f\Vert=3/4$. This seems weird, but it happens because we are working in a subspace of $l_1$.
A Hahn-Banach extension has the property that $\Vert g\Vert=\Vert f\Vert=3/4$, and $g$ is determined by $\alpha=g(1,0,0,0,\ldots)$. Now note that
\begin{align*}
g(x_1,x_2,x_3,\ldots)&=g(3x_2,x_2,x_3,\ldots)+g(x_1-3x_2,0,0,\ldots)\\
&=f(3x_2,x_2,x_3,\ldots)+g(x_1-3x_2,0,0,\ldots)\\
&=3x_2+(x_1-3x_2)\alpha
\end{align*}
So we want to find $\alpha$ such that
$$|3x_2+(x_1-3x_2)\alpha|\leq\frac{3}{4}(|x_1|+|x_2|)$$
for all $x_1$ and $x_2$. Letting $x_1=tx_2$, this is equivalent to finding $\alpha$ for which
$$|3+(t-3)\alpha|\leq\frac{3}{4}(|t|+1)$$
for all $t\in\mathbb{R}$.
Maybe you can solve the rest.
HINT: Do not try to solve this by taking squares to get rid of the absolute values, because I think you will get something of order $8$ on $\alpha$ in the end. Instead, substitute for some values of $t$ which make the expression simpler, or see how it behaves when $t\to\infty$, etc...


text:
Q: Selenium Webdriver: Selecting menu item in multi-level menu Selenium WebDriver in Visual Studio With C#.
I've create a driver Object, which I'm using an instance of.
I'm trying to Access the top menu on this site: http://store.demoqa.com/
The second menu element, "Product Category", has a submenu. I'm trying to emulate a mouse-over of the "Product Category" element, then select and click the first element in the list (Accessories).
This is what I've got so far, pieced together by several searches here and elsewhere. It works up the point of clicking on the menu item ("Accessories"). I see that the top element is selected, and that the menu item is "selected" because it slightly indents when hovering the mouse over it. However, from there I cannot seem to Click() it.
"menu-item-33" is the top menu item, Product Category.
"menu-item-34" is the sub menu item Accessories.
Actions action = new Actions(FFDriver.Instance);
IWebElement we = FFDriver.Instance.FindElement(By.Id("menu-item-33"));
action.MoveToElement(we).MoveToElement(FFDriver.Instance.FindElement(By.Id("menu-item-34"))).Click().Build().Perform();

It moves to the correct item, but the Click() function doesn't seem to work, since the page isn't changed.
Pardon me if this is too little information, but I've tried to keep it narrowed down to the code that seems to be the struggle.

A: I do not see why the code you have wouldn't work. However, you can try implementing some explicit wait if necessary. I have tried the following and it works. Note: I always suggest you to use id for locating element. But, I thought I show you another option and directly finding the anchor will be wiser for submenu item
By byId = By.Id("menu-item-33");
By css = By.CssSelector("a[href*='product-category/accessories']");

Actions action = new Actions(_driver);
IWebElement we = _driver.FindElement(byId);
action.MoveToElement(we).Build().Perform();
new WebDriverWait(_driver,TimeSpan.FromSeconds(2)).Until(ExpectedConditions.ElementIsVisible(css)).Click();


text:
Q: how to split tests when writing integration test in flutter I'm trying to write an integration test with flutter.
In some cases I need to repeat the same process.
such as adding a new line
I want to make these new line insertion codes as a separate method and call them wherever I want in the test.
but I couldn't find how to do
How can I make some test lines a method in the integration test and call it like a method in the test case I want?

A: this is the solution i was looking for:
class HomeRobot {
  const HomeRobot(this.tester);
  final WidgetTester tester;
  Future<void> findTitle() async {}
  Future<void> scrollThePage({bool scrollUp = false}) async {}
  Future<void> clickFirstButton() async {}
  Future<void> clickSecondButton() async {}
}

https://medium.com/flutter-community/integration-testing-in-flutter-b25c62ec287c


text:
Q: Symfony form - run validation on load (pre validate the form) My app allows pieces of content to be saved to the database whilst status = draft. The form is made up of some fields that are required (e.g title) and then a bunch of other fields in a sub form that saves into a JSON array on the entity, alongside title.
I have validation constraints on the sub form fields, but don't want to enforce them if status = draft. In addition,  I want to run the validation rules on form load so that the user knows what fields are required when the record moves to published, as this displays form errors but you can still save the form.
I've partly achieved this by, in my edit action, cloning the form and faking a submit on it. This generates the form errors. I can then render the cloned version with errors, but process and save the non-cloned version (to which I run $form->clearErrors(true)  to effectively ignore validation when the status is draft)
It works but I wondered if there's a better way. I tried with FormEvents but couldn't achieve the validation on load.

A: Too big for a comment, so as an answer, but more like a bigger than comment idea ;)
As you have a Form made up of sub-Form objects, have considered making a Model object for each Form? That way you can make a matching validation group. You would not save the Model objects to the database.
It would allow you to also provide feedback to the user as you can validate each sub-Form separately for the Model objects.
Once a user saves the form without checking "Draft" (or the realy submit button, or however you've set this up), you catch that. When a User does this, you create a new Entity, you fill that with all data from all Model objects. You then create a new Validator instance and add to it all of the Validation Group's you created earlier.
You then run $validator->validate($entity, null, ['validation-group-model1', 'validation-group-model2']) (which is what happens internally anyway) and use the output to provide the user with the result.

Obviously, when editing existing Entity you need to populate all Model objects with data from the Entity.


text:
Q: How to submit custom input file type data in php? I am not able to send the file data to the form's action page. I am using Laravel 8.
<label for='inputProductDescription' class='form-label'>Product Images</label>
<input id="fancy-file-upload" type="file" name="files[]" accept=".jpg, .png, image/jpeg, image/png" multiple>

Using jquery.fancy-fileupload.js, this jquery
my action file code:
function add_product(Request $req) {
    $images = $req->file('file');
    if($req->hasFile('file')):
        foreach ($images as $item):
            $var = date_create();
            $time = date_format($var, 'YmdHis');
            $imageName = $time . '-' . $item->getClientOriginalName();
            $path = $item->move(base_path() . '\public\assets\upload\images', $imageName);
            $arr[] = $imageName;
        endforeach;
    endif;

    return $imageName;
}

When I am uploading the image, $imageName is giving me an error, it is not defined.

A: declare the $imageName property like global into the method.
  $imageName = null;
  $images = $req->hasFile('file') ? $req->file('file') : null;
   if($images)
      foreach ($images as $item)
        $time = now()->format('YmdHis');
        $imageName = $time . '-' . $item->getClientOriginalName();
        $path=  $item->move(base_path() . '\public\assets\upload\images', $imageName);
        $arr[] = $imageName; // seems this is unnecessary line of code
      endforeach;
    endif;

   return $imageName;


text:
Q: Erro duarante o commit no git Errei ao digitar um comando no git:
**git commit -m inicialcommit*
Recebi essa mensagem, porém não sei o que significa.
C:\Users\alex.jose.silva\Documents\demo2 (master -> origin)
λ git commit -m inicialcommit
[master (root-commit) 25dd6f5] inicialcommit
 20 files changed, 970 insertions(+)
 create mode 100644 demo/.gitignore
 create mode 100644 demo/.mvn/wrapper/maven-wrapper.jar
 create mode 100644 demo/.mvn/wrapper/maven-wrapper.properties
 create mode 100644 demo/bin/.gitignore
 create mode 100644 demo/bin/.mvn/wrapper/maven-wrapper.jar
 create mode 100644 demo/bin/.mvn/wrapper/maven-wrapper.properties
 create mode 100644 demo/bin/mvnw
 create mode 100644 demo/bin/mvnw.cmd
 create mode 100644 demo/bin/pom.xml
 create mode 100644 demo/bin/src/main/java/com/developer/demo/DemoApplication.class
 create mode 100644 demo/bin/src/main/resources/application.properties
 create mode 100644 demo/bin/src/test/java/com/developer/demo/DemoApplicationTests.class
 create mode 100644 demo/mvnw
 create mode 100644 demo/mvnw.cmd
 create mode 100644 demo/pom.xml
 create mode 100644 demo/src/main/java/com/developer/demo/DemoApplication.java
 create mode 100644 demo/src/main/resources/application.properties
 create mode 100644 demo/src/main/resources/static/index.html
 create mode 100644 demo/src/main/resources/templates/tela.html
 create mode 100644 demo/src/test/java/com/developer/demo/DemoApplicationTests.java

A: O que aconteceu foi que você gerou um commit com a mensagem "inicialcommit" para a sua árvore de commits. Essa mensagem apenas mostra quantos arquivos foram modificados, quantas inserções, quantas deleções e quais os arquivos foram commitados.

A: O commit de fato aconteceu! Nesse caso, foram 20 arquivos modificados e mais de 970 inserções. Agora é só dar um git push pra enviar ao servidor as modificações.


text:
Q: infinitive with to as a noun modifier
I have a paper to write before class.

I can say this, if I'm not mistaken, this way:

I have a paper which is to be written before class.

What has happened here? What is the name of this?
Another example:

The inherent desire to develop that technique caused him to spend 11 years on it.

Here this can be said in this way:

The inherent desire (which was to/in order to) develop that technique caused him to spend 11 years on it.

Could you give me a link for further study?

A: Unless you want to sound extremely formal and educated, just use the infinitive.

I have a paper which is to be written before class.

Would be said to a boss that you've never met before when you're trying to get a day off to write the paper, possibly over email, for example.

I have a paper to write before class.

Would be used pretty much everywhere else.

A: I'm not sure of all the details,
but I believe that the infinitive is not modifying the noun.
Rather, the noun is the (direct) object of the verb (infinitive).

I have a paper to write before class.

=

I have to write a paper before class.

It seems that "have" is being used to mean something like "need".
Note that this construct can work without the noun object:

I have to eat.

You can see this mentioned in this EL&U question:
Omitting the last "to" in "All {I need to / have to / must} do is (to?) do something".
The answer to When should a verb be followed by a gerund instead of an infinitive? addresses the large issue,
but, curiously, doesn't say much about "have".

A:
... a paper to write  /  a paper to be written
  ... a desire to develop that technique

These are two very different NOUN TO VERB constructions.
The first "derives" from a clause in which NOUN is the Patient of VERB (its Direct Object in the first, active version, its Subject in the second, passive version). This, as you correctly observe, may be paraphrased with a relative clause   which is to write  /  which is to be written.
The second, however, derives from a construction in which NOUN is originally a verb taking an infinitive clause as its complement:

I desire apples. I desire a fulfilling life. I desire to develop that technique.

Your proposed relative clauses don't work there, because they disrupt this particular syntactic relationship: now the noun desire lacks its necessary complement.


text:
Q: Python strings within lists I did not seem to find anyone asking this same question, but if it's already out there then I apologize and would appreciate a link.
For the question.
currently working with this list:
nouns = ['house','bee','ducks','blouse','cars']

I'm trying to make a program that changes words in the plural to singular and words in the singular to plural. I'm intending to try and change the list by using index numbers, something like:
for index, word in enumerate(nouns):
if word[-1] is 'e':
  print nouns[index]==word[-1]+'s'
    print nouns

I'm still very new to Python, but currently stuck. Any kind of help or hint will be much appreciated.

A: nouns = ['house','bee','ducks','blouse','cars']
for index, word in enumerate(nouns):
    if word[-1] == 'e':
        # if this word ends with e, add s
        nouns[index] = word+'s'
    elif word[-1] == 's':
        # if this word ends with s, remove last char
        nouns[index] = word[:-1]
print nouns

Note that this works for the particular list that you provided, but cannot grantee other collection of words because of plurals like men

A: What about this
nouns = ['house','bee','ducks','blouse','cars']

plurals = [x + 's' if x.endswith('e') else x for x in nouns]


text:
Q: Set image from a String path on viewpagerindicator's iconpageindicator I need to change the iconpageindicator's image from the SD Card. So, i need to use a String of image path instead of the resource id.
Normally, i did something like this :
public class CustomPagerAdapter extends FragmentPagerAdapter implements IconPagerAdapter

Where the IconPagerAdapter :
public interface IconPagerAdapter {
    /**
     * Get icon representing the page at {@code index} in the adapter.
     */
    int getIconResId(int index);

    // From PagerAdapter
    int getCount();
}

As you can see, the only supported type is int or the resource id, but i need to use a String.
Have anyone accomplished this? Please kindly help me.
Thanks a lot.

A: Just Change the type from int to String and change set Image Resource in IconPageIndicator to String path


text:
Q: How to set custom font from Resources for custom control? I have created a custom control by overriding from control. I have implemented some customization to serialize and deserialize the font settings. However, when I set the font from resources by using AddMemoryFont() method, the font is not getting updated to the control. Even I have overridden the Font property and FontChanged event and called the base functions.
Is there something I'm missing to update the font from resources? If yes, share any suggestions to update the font.
Sample
Note
Getting the font from resources as in the suggestion Custom Font
Thanks in Advance,
Arulpriya

A: i have checked this. I can also able to reproduce the issue in my side. i have resolved this by creating new font with FontFamily, not with FaceName.
return new Font(privateFontCollection.Familes[0],10f);

Can you pls try this?


text:
Q: Copy and PasteSpecial Table Values and Formatting I am still new with VBA but decided using VBA to streamline a Monthly report I am working on for our payroll would be the most efficient way, I wish to export a range I3:U2270 into a new sheet named from a cell in the summary sheet. Everything works fine except formatting.
If I use xlPasteAll the formatting is perfect, but it shows values as formulas.
If I use:
.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
.PasteSpecial Paste:=xlPasteColumnWidths
.PasteSpecial Paste:=xlPasteFormats

The data and cell widths are perfect, but because some data is in Tables, it doesn't bring the formatting across.
Any ideas would be appreciated!
Sub MonthlySummaryExport()

    Dim NewSheetName As String
    Dim Newsheet As Object
    On Error Resume Next
    NewSheetName = Worksheets("Monthly Summary").Range("T1")
    If NewSheetName = "" Then Exit Sub
        Set Newsheet = Sheets(NewSheetName)
        If Not Newsheet Is Nothing Then
            MsgBox "Sheet cannot be created as there is already a worksheet with the same name" & " " & (NewSheetName)
            Exit Sub
            End If
            Sheets.Add(, Sheets(Sheets.Count)).Name = NewSheetName

    'Copy and PasteSpecial a between worksheets
    Worksheets("Monthly Summary").Range("I3:U2270").Copy

    With Worksheets(NewSheetName).Range("A1")
    .PasteSpecial Paste:=xlPasteValuesAndNumberFormats
    .PasteSpecial Paste:=xlPasteColumnWidths
    .PasteSpecial Paste:=xlPasteFormats
    End With

    'Disable marching ants around copied range
    Application.CutCopyMode = False
End Sub

A: Copy everything including formulas, then change formulas to values in the copy
'Copy and PasteSpecial a between worksheets
    dim dest as range
    set dest = Worksheets(NewSheetName).Range("A1")
    Worksheets("Monthly Summary").Range("I3:U2270").Copy dest
    dest.currentregion.copy
    dest.pastespecial xlPasteValues


text:
Q: Handle unknown content-type of response with Alamofire I use Alamofire to do requests to a rest service. If the request is successful the server returns a JSON with content-type application/json. But if the request fails the server returns a simple String.
So, I don't know how to handle on it with Alamofire, because I don't know how the response look like. I need a solution to handle on the different response types.
This code I can use to handle on a successful request:
request(.POST, wholeUrl, parameters: parameters, encoding: .Custom(encodingClosure))
            //.validate()
        .responseJSON {
            (request, response, data, error) -> Void in

                //check if error is returned
                if (error == nil) {
                    //this crashes if simple string is returned
                    JSONresponse = JSON(object: data!)
                }

And this code I can use to handle on failed request:
    request(.POST, wholeUrl, parameters: parameters, encoding: .Custom(encodingClosure))
            //.validate()
        .responseString {
            (request, response, data, error) -> Void in

                //check if error is returned
                if (error == nil) {
                    responseText = data!
                }

A: Don't specify the response type, and don't comment out the .validate().
Check for error, and then proceed accordingly
request(.POST, wholeUrl, parameters: parameters, encoding: .Custom(encodingClosure))
        .validate()
    .response {
        (request, response, data, error) -> Void in

            //check if error is returned
            if (error == nil) {
                //this is the success case, so you know its JSON
                //response = JSON(object: data!)
            }
            else {
                 //this is the failure case, so its a String
            }
     }

A: I've solved my problem:
request(.POST, wholeUrl, parameters: parameters, encoding: .Custom(encodingClosure))
    .validate()
.response {
    (request, response, data, error) -> Void in

        //check if error is returned
        if (error == nil) {
            var serializationError: NSError?
            let json: AnyObject? = NSJSONSerialization.JSONObjectWithData(data! as! NSData, options: NSJSONReadingOptions.AllowFragments, error: &serializationError)

            JSONresponse = JSON(object: json!)
        }
        else {
             //this is the failure case, so its a String
        }
 }

A: Swift 4
If you are expecting JSON on success and a String on error, you should call the .validate() hook and try parsing the response data as a string if the request fails.
import Alamofire
import SwiftyJSON

...

Alamofire.request("http://domain/endpoint", method: .get, parameters: nil, encoding: JSONEncoding.default, headers: nil)
    .validate()
    .responseJSON(completionHandler: { response in
        if let error = response.error {
            if let data = response.data, let errMsg = String(bytes: data, encoding: .utf8) {
                print("Error string from server: \(errMsg)")
            } else {
                print("Error message from Alamofire: \(error.localizedDescription)")
            }
        }
        guard let data = response.result.value else {
            print("Unable to parse response data")
            return
        }
        print("JSON from server: \(JSON(data))")
    })


text:
Q: Fortran interface with C types I have the following which I'm trying to compile with gfortran 9:
module eiface
  use, intrinsic :: iso_c_binding

  implicit none

  abstract interface
    function AlertMessage(atype, szFmt)
      integer(c_int32_t) :: atype
      type(c_ptr(c_char)) :: szFmt
    end function
  end interface

  ...

I believe the interface is meant to go after the implicit none but I get the following error:
Error: Parameter 'c_int32_t' at (1) has not been declared or is a variable, which does not reduce to a constant expression
If I get rid of the C types then it compiles fine.
Is there a way to use C types here?

A: An interface body is a separate scope and the USE (and other specifications) in the module do not apply to it. To use (in this case) iso_c_bindings in the interface body, you must put the USE statement in that same interface body.
Also in Fortran's C-interop you don't declare pointer-to-specific-type as in C; you have one Fortran type TYPE(C_PTR) which corresponds to all C object pointer types, and one TYPE(C_FUNPTR) which corresponds to all C function pointer types (remembering that in C 'function' includes both value-returning and non-value-returning, i.e. the equivalent of both Fortran FUNCTION and SUBROUTINE).
Finally, if this is actually a C (or C-compatible e.g. C++ extern "C") routine you are interfacing to, it should also specify BIND(C).
module eiface
  abstract interface
    function AlertMessage(atype,szFmt) ! bind(c)?
      use,intrinsic :: iso_c_binding
      integer(c_int32_t) :: atype
      type(c_ptr) :: szFmt
    end function
  end interface
end module

A: You have to import the C datatypes from the module scope into each subroutine of your interface (remember that in Fortran, single subroutines have no external dependencies by default):
  abstract interface
    function AlertMessage(atype, szFmt)
      import c_int32_t,c_ptr ! Import C datatypes from module into this interface
      integer(c_int32_t) :: atype
      type(c_ptr) :: szFmt
    end function
  end interface


text:
Q: Conditions that can make a MySQL COMMIT query fail? I have an application where I run an explicit COMMIT query on a MySQL standalone server
COMMIT;

The query works as expected in the vast majority of cases, but sometimes the query seems successful but at the same time seems not to commit the transaction to the DB.
So I was digging into the possibility that a COMMIT query could fail. I found this similar question: https://stackoverflow.com/questions/3960189/can-a-commit-statement-in-sql-ever-fail-how
but on the official MySQL doc never mentions that a COMMIT can fail.
I want to understand in which conditions a commit query can fail and how to reproduce it, possibly supported by official doc pages.

A: This depends entirely on how you setup the transaction.
If you have START TRANSACTION and COMMIT; surrounding a series of INSERT, UPDATE, and DELETE queries, there are some commands that trigger an implicit commit:

*

*ALTER TABLE

*CREATE INDEX

*DROP DATABASE

*DROP INDEX

*DROP TABLE

*RENAME TABLE

*TRUNCATE TABLE

*LOCK TABLES

*UNLOCK TABLES

*SET AUTOCOMMIT = 1

*BEGIN (can break another BEGIN or START TRANSACTION)

*START TRANSACTION (can break another START TRANSACTION or BEGIN)

I have mentioned this before in the DBA StackExchange

*

*Mar 06, 2018 : Can you rollback a query in state 'committing alter table to storage engine'

*Aug 21, 2015 : Transactional DDL workflow for MySQL

*Feb 12, 2014 : row locking within ACID transaction innodb

*Mar 15, 2013 : MySQL backup InnoDB
You can see the latest list of commands that trigger implicit commits in the MySQL 5.7 Docs. Why consider implicit commits ? Data may commit out of context with other data too soon or too late.
Aside from these commands, terminating a DB Connection will implicitly rollback a transaction. You should monitor the status variables Aborted_connects and Aborted_clients to see if DB Connections are failing on entry or in session.

A: The problem was not on the COMMIT query, the problem was that during that transaction an implicit rollback happens.
As the documentation says, this can happen if a deadlock occures during the transaction.


text:
Q: Nifi: Can I use variables for the Kerberos Principal and the Kerberos Keytab? I have files coming in from three different sources to a "PutHDFS" processor. These three sources all have separate keytabs and are going to separate directories. Since the name of the source is in the filename, I was able to create a variable called "source_name" and I can use this to make a directory just fine, something like this:
/my/hdfs/directory/${source_name}/reports

I wanted to do something similar with the the Kerberos Principal and the Kerberos Keytab, like this:
Kerberos Principal: ${source_name}@acme.com
Kerberos Keytab: /home/nifi/keytabs/${source_name}.keytab
However, Nifi is reading these values literally and I get errors that it "couldn't authenticate ${source_name}@acme.com"
The Nifi documentation says that these fields support expression language, but in Nifi itself (version 1.7), it says that the fields only support "Variable Registry Only." Despite extensive searching, I'm still unable to determine what "Variable Registry Only" means. Am I forced to hard-code the kerberos values?

A: Expression language allows referencing values from several different sources and it works in a hierarchy which is described here:
https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#Using_Custom_Properties
When it says "Variable Registry Only" it means values from incoming flow files are not accessible to the expression language statements of that property.
The primary reason for this is usually because those values need to be used in a way that can't be done per flow file. For example, the HDFS processors need to perform a kerberos login when the processor starts and then periodically renew the ticket. Doing this for an infinite number of incoming flow file values becomes problematic to manage.
Update:
This may be a better description of the hierarchy of values expression language can access:
https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/expression/ExpressionLanguageScope.java#L20-L38


text:
Q: Get an array of specific added children I'm using the following array to add children to the stage:
for(var i=0;i<6;i++) {
    var aCherry=new cCherry()
    aCherry.y=10
    aCherry.x=10+100*i
    stage.addChild(aCherry)
}

Now I want to modify each cherry based on another array. Something like this:
var cherryLetter:Array=[1,0,0,0,0,0]
    for(i=0;i<6;++) {
        if(cherryLetter[i]) stage.getChildByName("aCherry")[i].y+=90
    }

Clearly stage.getChildByName("aCherry")[i] isn't correct, but coming from JavaScript this makes the most sense to me and should accurately portray what I'm trying to achieve for you guys reading this. So, how would I actually do this? This being getting an array of children added to the stage under a certain name or class (so an array of cCherry would work too, if necessary), then using them in a way similar to the above loop.

A: Here is my recommendation for how the code might look, based on the desire to use getChildByName() to find the instances of your cCherry class. Please note that I've changed the class name to Cherry in the example (which I recommend, since capitalizing class names is AS3 convention). Also, it's good practice to end statements with semi-colons. While it's usually optional, there are cases where omitting the semi-colon can produce very difficult to track down runtime bugs, so I recommend getting int he habit of using them. I also recommend including type in all your variable declarations, as shown with var aCherry:Cherry, for example.
var i:int;
for(i=0; i<6; ++i)
{
    var aCherry:Cherry=new Cherry(); // Note, it's my recommendation that you rename cCherry class to Cherry (convention)
    aCherry.y=10;
    aCherry.x=10+100*i;
    aCherry.name = "aCherry" + String(i); // String() cast for clarity only, not necessary
    stage.addChild(aCherry);
}

and
var cherryLetter:Array=[1,0,0,0,0,0];
for(i=0; i<6; ++i)
{
    var cherry:Cherry = stage.getChildByName("aCherry" + String(i)) as Cherry;
    if(cherry && cherryLetter[i]) cherry.y += 90;
}


text:
Q: Passing a method pointer for a new method to base class I'd like to be able to call any arbitary method (which are generic methods) defined in a derived class from the base class.  The base class doesn't know about them. I'd somehow like to get this pointer and the virtual table offset and be able to call it.  Class A doesn't actually need to be the base class, it could be a separete class which doesn't know anything about B but needs to call the methods. Is it possible?
class A
{
public:
    typedef void (A::*Method)();

    void call(Method p)
    {
        //...
    }
};

class B : public A
{
public:
    virtual void meth1()
    {
    }
    virtual void meth2()
    {
    }
    virtual void test()
    {
        call(&TestTask::meth1);
        call(&TestTask::meth2);
    }
};

Errors:
test.cpp:420:30: error: no matching function for call to 'B::call(void (TestTask::*)())'
         call(&TestTask::meth1);
                              ^
test.cpp:420:30: note: candidate is:
test.cpp:402:10: note: void A::call(A::Method)
     void call(Method p)
          ^
test.cpp:402:10: note:   no known conversion for argument 1 from 'void (TestTask::*)()' to 'A::Method {aka void (A::*)()}'
test.cpp:421:30: error: no matching function for call to 'B::call(void (TestTask::*)())'
         call(&TestTask::meth2);

A: Non-static member functions need an object to act on, so you can't simply call the member-function pointer by itself. You could define a template to call a member of any class, given an object of that class:
template <class Class>
void call(Class & c, void (C::*method)()) {
    (c.*method)();
}

If that's not what you want, then you'll need to clarify what you do want.

A: You can use the CRTP pattern to accomplish what you are trying.
template <typename T> struct A
{
   typedef void (T::*Method)();

   void call(Method m)
   {
      (static_cast<T*>(this)->*m)();
   }
};

struct B : A<B>
{
   void meth1(){}
   void meth2(){}

   void test()
   {
      call(&B::meth1);
      call(&B::meth2);
   }
};


text:
Q: Angular directive not working if loaded with RequireJS I have a directive that works correctly when RequireJS is not used, and I'm trying to migrate it to an application based on RequireJS.
The directive wraps an Angular UI modal, and uses transclude to populate the modal elements (modal elements are defined in the controller that declares the directive). The problem is that if loaded with RequireJS, the modal does not show ANY elements (i.e. it's empty).
This is the plunk of the directive that works correctly without RequireJS. You will see a modal populated with elements.
This is the plunk of the directive that is loaded with RequireJS. You will see that the modal is empty.
There are no errors thrown when the modal is displayed empty, so I'm not sure how to tackle this problem. Any help will be greatly appreciated.
This is the directive:
define(['app','uiBootstrap'], function (app) {

'use strict';
app.directive("theModal", function($timeout,$uibModal) {
          return {
            restrict: "AE",
            scope: {
                control: '='
            },
            transclude: true,
            link: function (scope, element, attrs, ctrl, transclude) {

              scope.control = scope.control || {}

                scope.control.openModal = function () {

                var instance = $uibModal.open({
                      animation: false,
                      scope: scope,
                      windowClass: 'the-modal',
                      template: '
in the template

',
                      appendTo: element
                });

                $timeout(function (){
                     transclude(scope.$parent, function(clonedContent){
                       element.find('.content').append(clonedContent);
                     })
                },10);

                };

            }
          }
    });
});

And this is how I invoke it:

    <button ng-click="open()">open it!</button>

some text

        <input type="text" ng-model="input1" />

A: The issue is you have circular dependency.  The app needs your modal module to display things correctly, but your modal directive needs that app.  The solution is to load your modal directive into a separate module.
Define a separate Angular Module for Modal
// contents of modal.js (remove app dependency)
define(['uiBootstrap'], function () {
    'use strict';
    var mod = angular.module('modal', ['ui.bootstrap']);
    mod.directive("theModal", function($timeout, $uibModal) {
        return {
            restrict: "AE",
            scope: {
                control: '='
            },
            transclude: true,
            link: function (scope, element, attrs, ctrl, transclude){
              // removed code for brevity
            }
        }
    });
    mod.directive("theButton", function($timeout) {
        return {
            restrict: "AE",
            scope: {
                control: '='
            },
            transclude: true,
            link: function (scope, element, attrs, ctrl, transclude){
              // removed code for brevity
            }
        }
    });
    return mod;
});

Make app depend on Modal
// contents of app.js
define([
    'angular',
    'uiBootstrap',
    'uiRouter',
    'modal'         // <--- the modal.js directive
], function (angular) {
    'use strict';
     return angular.module('app', ['ui.bootstrap','ui.router', 'modal']); // <--- also add it here
});


text:
Q: Is there a navigation stack in Blazor? It's easy enough to use NavigationManager.NavigateTo() to move between pages, but I am wondering if there is a way to navigate to a page such that I can navigate back without losing state on the first page.
I'm looking for something like NavigationManager.Push("myurl"), and the corresponding Navigationmanager.Pop().

A: I'm afraid the answer is no... Currently Blazor does not support such features. Instead you may store your state in the local storage, and retrieved it when navigating back.
Consider posting an issue in github asking for such features, though I believe it has been done long before. There's an article about state by Steve Anderson in the docs...Review it for new features.


text:
Q: Limit SQLServer Full text search to top 3 releavent answer I am a SQL newbie sorry if this is a simple thing
My data in sql is like this
My DATA:
Content    sl.no
KTUU Alaskas News Source Alaskas Top News Storm Watch Weather Politics Sports Health Business Headlines 16419
Lawn Care Business Service Providers Lawn Care Business Information Lawn Mowing Companies Lawn Care Directory   17113
Hydrophilic polyurethane foams medical consumer personal care cosmetics agricultural products Rynel     17183
Care Patient Care Product Manufacturer  17752
Bartlett Tree Experts Leader Residential Commercial Tree Care Services  17890
Safe Earth Lawn & Garden Care   17920
Carolina Outdoor Care Inc   17972
Glenwood Autism Behavioral Health us difference 17997
Mental Health North Central Alabama 18092
East Alabama Mental Health  18093
Jacksonville Mental Health  18094
Mental Health Assn-Madison Cty  18095
Baptist Health Ctr  18136
Mental Health Wellness Information Community Counseling Services    18150
Dayspring Behavioral Health 18162
Daysprings Behavioral Health    18164
Families Outpatient Mental Health Counseling Services   18167
Families Outpatient Mental Health Counseling Services   18168
Health Resources Of Arkansas    18170
Mental Health Council Of Ar 18172

If I run the following query
SELECT TOP 3 * FROM TABLE_NAME where FREETEXT(content,'health care')

I get the first three rows rather then the first three row which are
  closer to the answer

How to get the first three most relevant Query.
And Can the query be fast as like the previous one

A: Use FREETEXTTABLE instead of FREETEXT. This will give you a result set of matches including a Rank which you can order by.Refer this for more insight
SELECT TOP 3 RANK, [KEY]
FROM FREETEXTTABLE(TABLE_NAME,content,'health care')
ORDER BY RANK DESC

Join by KEY to get the columns from the original table.
SELECT TOP 3 TABLE_NAME.*
FROM FREETEXTTABLE(TABLE_NAME,content,'health care') as fullTextResults
join TABLE_NAME on fullTextResults.[KEY] = TABLE_NAME.Id
ORDER BY fullTextResults.RANK DESC


text:
Q: Why is it valid to pass static types in and out of interface methods in C#? I noticed that the following code seems to compile just fine, when I would've expected multiple errors:
public interface ITest
{
    Math Foo(MathF x, ref Console y);
}

Math, MathF, and Console are all static classes - is there any reason why this is valid, or is it just an oddity of the specification/compiler? When attempting to implement the interface, you then receive an error (I guess that means you can make an interface that's impossible to implement, which is kinda cool)
What's more, I can go one worse:
using System;

namespace StaticParams
{
    internal class Program
    {
        static void Main(string[] args)
        {
            ITest.Bar(null);
        }

        public interface ITest
        {
            Math Foo(MathF x, ref Console y);

            static void Bar(Math x)
            {
                Baz(x);
            }

            static void Baz(Math x)
            {
                Console.WriteLine("Hello World" + x + "!"); // x is null so we can't do much with it
            }
        }
    }
}

Output:
Hello World!

Tested in VS 2022, using both C# 8.0 + .NET Core 3.1, and C# 10.0 + .NET 6.0.4.

A:
is there any reason why this is valid, or is it just an oddity of the specification/compiler?

Questions like this can be difficult to answer. The strict literal answer is because that's how C#'s grammar is defined.
Quoting from
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/interfaces :
interface_declaration
    : attributes? interface_modifier* 'partial'? 'interface'
      identifier variant_type_parameter_list? interface_base?
      type_parameter_constraints_clause* interface_body ';'?
    ;

interface_body
    : '{' interface_member_declaration* '}'
    ;

interface_member_declaration
    : interface_method_declaration
    | interface_property_declaration
    | interface_event_declaration
    | interface_indexer_declaration
    ;

interface_method_declaration
    : attributes? 'new'? return_type identifier type_parameter_list?
      '(' formal_parameter_list? ')' type_parameter_constraints_clause* ';'
    ;

The attributes, return_type, identifier, and formal_parameter_list of an interface method declaration have the same meaning as those of a method declaration in a class (§14.6).

From there you'll have to knock yourself out with this:
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/classes#146-methods

But of course that's not really an enlightening answer. I think what you really want to know is "what is the wisdom in allowing insanity like this?". Which of course is an opinion-based question. So I'll answer that with these opinions of mine:

*

*It would probably just make the language or its implementation more complex to prevent it at this level

*It's already prevented at another level—it's impossible to implement that interface as you pointed out, so already nobody is able to write useful code like that

*Why not allow it when there's already so much other insanity out there?


text:
Q: gunicorn on heroku: binding to localhost I've been following the tutorial on https://devcenter.heroku.com/articles/django#declare-process-types-with-procfile.
It went smoothly except for one thing that bothers me.
After starting foreman I should see the following:
$ foreman start
2013-04-03 16:11:22 [8469] [INFO] Starting gunicorn 0.17.2
2013-04-03 16:11:22 [8469] [INFO] Listening at: http://127.0.0.1:8000 (8469)

However, I get:
Starting gunicorn 17.5
Listening at: http://0.0.0.0:5000

How can I change it so that it listens only to my local machine (ie. 127.0.0.1)?
My Procfile contains only
web: gunicorn hellodjango.wsgi

thanks!

A: This looks to be the default IP address used when you run use gunicorn to serve a WSGI app with foreman.
Running your django app without foreman like this:
gunicorn hellodjango.wsgi:application

Will bind it to gunicorn's default, 127.0.0.1:8000
2013-08-23 00:02:54 [45352] [INFO] Starting gunicorn 17.5
2013-08-23 00:02:54 [45352] [INFO] Listening at: http://127.0.0.1:8000 (45352)
2013-08-23 00:02:54 [45352] [INFO] Using worker: sync
2013-08-23 00:02:54 [45355] [INFO] Booting worker with pid: 45355

And specifying in your Procfile which binding to use:
web: gunicorn -b 127.0.0.1:8000 hellodjango.wsgi

Will bind it to 127.0.0.1:8000, or whatever you specify.
00:06:26 web.1  | started with pid 45384
00:06:26 web.1  | 2013-08-23 00:06:26 [45384] [INFO] Starting gunicorn 17.5
00:06:26 web.1  | 2013-08-23 00:06:26 [45384] [INFO] Listening at: http://127.0.0.1:8000 (45384)
00:06:26 web.1  | 2013-08-23 00:06:26 [45384] [INFO] Using worker: sync
00:06:26 web.1  | 2013-08-23 00:06:26 [45387] [INFO] Booting worker with pid: 45387

I'd be interested to find exactly where foreman tells gunicorn to use 0.0.0.0 as a default.


text:
Q: Insert value new cell good morning
this script adds a cell below, it is wrong I would rather copy the value of E2 and paste it in E3, E4 etc etc every 1 hour.
Thanks to those who solve my problem.
  var activeSheet = SpreadsheetApp.getActiveSheet();
  SpreadsheetApp.getActiveSheet().getRange('E2').setValue(jsonResponse.price);
  var sheet =SpreadsheetApp.getActiveSheet()
  var range = sheet.getRange("E2:E2");
  range.insertCells(SpreadsheetApp.Dimension.ROWS);

A: Time-driven trigger:
The script you shared will effectively shift the cells in column E down, with E3 containing the newest value (E2 will be blank). You want this function to run automatically each hour. For this, you need to install a time-driven trigger. The trigger needed in this case would be everyHours(n). You can install either manually, by following these steps, or programmatically, by running the following function once:
function createHourTrigger() {
  var triggeredFunction = "shiftAndSet"; // Triggered function name, change accordingly
  ScriptApp.newTrigger(triggeredFunction)
    .timeBased()
    .everyHours(1)
    .create();
}

Note:
Your script has a certain amount of repetition and could be reduced to this (the code to retrieve jsonResponse is obviously missing):
function shiftAndSet() {
  var range = SpreadsheetApp.getActiveSheet().getRange("E2");
  range.setValue(jsonResponse.price);
  range.insertCells(SpreadsheetApp.Dimension.ROWS);
}

Also, if you want E2 and not E3 to have the newest value at the end of each execution, you could change the order of actions, like this:
function shiftAndSet() {
  var range = SpreadsheetApp.getActiveSheet().getRange("E2");
  range.insertCells(SpreadsheetApp.Dimension.ROWS);
  range.setValue(jsonResponse.price);
}


text:
Q: Run-time error '1004': Sorting in sheetchange I have simple problem using a sort macro. When I import data from my other Workbook, the workbook run the macro below in SheetChange and receive the run-time error.
HOWEVER, it is working completely fine if I just run the macro when the Workbook is open.
I don´t know if I have to replace Range with ActiveWorkbook or something, but I think I have tried a lot of different stuff, still without luck :(
I want it to sort from column B, starting in row 13 and until the last row/column. It is dynamic, so it will change every time I import stuff.
Sub TESTSORT()
Dim startCol, myCol As String
Dim startRow, lastRow, lastCol As Long
Dim ws As Worksheet
Dim Rng, cell As Range

Application.ScreenUpdating = False
Set ws = ThisWorkbook.Sheets("Sheet1")

With ws
startCol = "A"
startRow = 13
lastRow = ws.Range(startCol & ws.Rows.Count).End(xlUp).Row
'lastCol = ws.Cells(2, ws.Columns.Count).End(xlToLeft).Column
lastCol = ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRange.Columns.Count).Column

myCol = GetColumnLetter(lastCol)

Set Rng = ws.Range(startCol & startRow & ":" & myCol & lastRow)

' I GET THE ERROR HERE
Range(.Cells(13, 1), .Cells(lastRow, lastCol)).Sort key1:=Range("B13:B" & lastRow),
order1:=xlAscending, Header:=xlNo

End With
Application.ScreenUpdating = True
End Sub

Function GetColumnLetter(colNum As Long) As String
Dim vArr
vArr = Split(Cells(1, colNum).Address(True, False), "$")
GetColumnLetter = vArr(0)
End Function

A: It looks like you've got some issues inside your With statement... using Range instead of .Range in several places. I've tried to clean it up a bit below...
Sub TESTSORT()
Dim startCol, myCol As String
Dim startRow, lastRow, lastCol As Long
Dim ws, ws2 As Worksheet
Dim Rng, cell As Range

Set ws2 = ActiveSheet 'Preserves a reference to the active sheet as ws2
ThisWorkbook.Activate 'Makes this workbook the one that is displayed

Application.ScreenUpdating = False
Set ws = ThisWorkbook.Sheets("Sheet1")

With ws
    startCol = "A"
    startRow = 13
    lastRow = .Range(startCol & .Rows.Count).End(xlUp).Row
    'lastCol = .Cells(2, .Columns.Count).End(xlToLeft).Column
    lastCol = ws2.UsedRange.Columns(ws2.UsedRange.Columns.Count).Column

    myCol = GetColumnLetter(lastCol)

    Set Rng = .Range(startCol & startRow & ":" & myCol & lastRow)

    ' I GET THE ERROR HERE
    .Range(.Cells(13, 1), .Cells(lastRow, lastCol)).Sort key1:=.Range("B13:B" & lastRow),
    order1:=xlAscending, Header:=xlNo

    End With
Application.ScreenUpdating = True
End Sub

Function GetColumnLetter(colNum As Long) As String
Dim vArr
vArr = Split(Cells(1, colNum).Address(True, False), "$")
GetColumnLetter = vArr(0)
End Function


text:
Q: Having trouble getting FineUploader's Initial File List feature working I've spent too much time on this feature already. I've read the documentation, I've searched Stackoverflow. The problem I'm having is that I always get success = false and of course no files are loaded. Documentation says if it has a problem parsing any item in the response but I'm at a loss as to what I'm doing wrong.
Here is what my server returns in response to the Inital Files request:
{{
    "uuid": "3377cc66-51d2-4e80-a695-f9018e379b7b",
    "path": "~/UploadedFiles/6f633f07-b23a-43f1-8256-f0dfe9fc9abb",
    "originalFilename": "Cut Offs.png",
    "name": "636785647541018142.png",
    "size": null,
    "thumbnailUrl": null
}}

On the client side I am able to retrieve each of these properties just fine. Thinking that perhaps it was choking on something else I reduced it down to just the uuid and the name as those are the only ones required but I got the same result. It didn't work and the success parameter comes in as false.
The sessionRequestComplete is firing off just fine but success is always false.
Here is what I have on the server:
public FineUploaderResult GetFiles(string type)
{
    List<FormDocument> documents = (List<FormDocument>) Session["IVRFiles"];

    JObject json = new JObject();

    if ( documents != null && documents.Count > 0 )
    {
        string jsonString = JsonConvert.SerializeObject(documents);

        jsonString = jsonString.TrimStart(new char[] { '[' }).TrimEnd(new char[] { ']' });
        json = JObject.Parse(jsonString);
    }
    return new FineUploaderResult(true, json);

}
Am I not returning the proper thing? Here's the constructor for FineUploader Result in case that helps.
public FineUploaderResult(bool success, object otherData = null, string error = null, bool? preventRetry = null)
{
    _success = success;
    _error = error;
    _preventRetry = preventRetry;

    if (otherData != null)
        _otherData = JObject.FromObject(otherData);
}

Any help would be most appreciated.

A: Got it figured out. What I was returning wasn't what I should have been. I was using that FineUploaderResult class but I don't believe I should have been. So I replaced all that json string and serialize and convert stuff to something far more simple and it worked. Here's what I have on the server now:
public ActionResult GetFiles(string type)
{
    List<FormDocument> documents = (List<FormDocument>) Session["IVRFiles"];

    return Json(documents, JsonRequestBehavior.AllowGet);
}

And this works just fine.


text:
Q: Archive data (table rows) mysql I have data in a table row associated with a user.  I'd like to archive the old data based on year.  However, the data is associated with a count for the user, i.e. each user has purchased a "post" and each "post" is a row in the table.  If I just delete (drop the row) the "post" my software will automatically adjust the number of available "posts" back to the user.
I'd like to be able to archive or delete old "posts" in the database, without crediting the use of the post back to the user.  The php is something like: user1 has 30 credited "posts" of which 15 have been used therefore 15 "posts" remain.  Dropping the row manually results in: user1 has 14 "posts" used and 16 "posts" remaining.
I'd like to clean out the old "posts" about 80,000 of them.
Is there a standard method of doing something like this?


text:
Q: scrapy crawling multiple pages [3 levels] but scraped data not linking properly I'm trying to scrape 3 levels of data: Tv name -> season -> episodes. The issue I'm having is that I'm getting all the episodes, but the first two levels is not linking. For example season 1 has 5 episodes and season 2 have 10 episodes, the output I'm getting is saying season 2 has 15 episodes and season 1 nowhere to be found.
def parse(self, response):
        jsonresponse = json.loads(response.body_as_unicode())

#for each television show extract the url to get the seasons
        for sel in jsonresponse["tv"]:
            item = TV()
            item['tv_name'] = sel['title']
            item['tv_url'] = sel['url']

            request = Request(item['tv_url'], callback = self.parse_season_details)
            request.meta['item'] = item
            yield request

    def parse_season_details(self, response):
        jsonresponse = json.loads(response.body_as_unicode())
        item = response.meta['item']

        for sel in jsonresponse["seasons"]:
            item['tv_season'] = sel['season_no']
            item['tv_season_url'] = sel['season_url']

            request = Request(item['tv_season_url'], callback = self.parse_episode_details)
            request.meta['item'] = item
            yield request

#okay I found my tv show, extracted number of seasons, now I'm going into each season to get the episode details

    def parse_episode_details(self, response):
        jsonresponse = json.loads(response.body_as_unicode())
        item = response.meta['item']

        for sel in jsonresponse["episodes"]:
            item['tv_episode_number'] = sel["ep"]
            item['tv_episode_name'] = sel['name']
            item['tv_episode_description'] = sel['description']
            yield item

However - the output I get is this (lets say season 1 has 2 eps and season 2 has 3 eps)

*

*tvshow season2 ep1

*tvshow season2 ep2

*tvshow season2 ep1

*tvshow season2 ep2

*tvshow season2 ep3

I've done some debugging but it seems to be the order it is executed. For the 2nd level, season2 is the latest to be scraped and overwrites season1 and it gets passed onto third level which proceeds to extract episode details.
If anyone has any ideas on how to resolve this it will be great appreciated!!!
Thanks

A: You should instantiate a new item to yield each time.
Assuming TV() is an item class
class TV(Item):
    ....

Than you should have a separate item = TV() for each episode
If you want to pass data from top levels - pass the data itself and create an Item only when you actually yield it:
def parse(self, response):
        jsonresponse = json.loads(response.body_as_unicode())

#for each television show extract the url to get the seasons
        for sel in jsonresponse["tv"]:

            request = Request(sel['url'], callback = self.parse_season_details)
            request.meta['tv_name'] = sel['title']
            request.meta['tv_url'] = sel['url']
            yield request


text:
Q: WHERE Clause with STUFF function I want to do a query, that I get some ID an separate then with commas, and put it on my where clause.
But occurs the following error

Msg 245, Level 16, State 1, Line 10
  Conversion failed when converting the nvarchar value '2998,2999,3000,3001,3002,3003,3004,3005,3006,3007,3008,3009,3010,3011,3012,3013,3482,3483,3484,3485,3486,3487,3488,3489,3490,3491,3492,3493,3494,3495,...

I tried some cast, but doesn't work.
Sample query:
SELECT A.ID, A.ID_PERIODO_GESTAO, A.ID_FILIAL, A.ID_RESPONSAVEL_AREA, A.ID_PARENT, A.ID_SOURCE, A.COD_AREA, A.DESC_AREA, A.ATIVO, A.USER_LOGIN_RESP, A.NOME_RESP, A.DESC_FILIAL, A.COD_AREA_SUP, A.FOTO_PATH,
A.COLABORADOR_ID,
CASE WHEN (SELECT COUNT(B.ID_COLABORADOR) FROM COLABORADOR_AREA B WHERE B.ID_AREA = A.ID GROUP BY B.ID_AREA) IS NULL THEN 0 ELSE
(SELECT COUNT(B.ID_COLABORADOR) FROM COLABORADOR_AREA B WHERE B.ID_AREA = A.ID GROUP BY B.ID_AREA) END AS QTD_COLABORADORES,
A.LEVEL_TREE,LEN(A.LEVEL_TREE),

STUFF(
           (SELECT ',' + CAST(VW.ID AS VARCHAR(10))
            FROM VW_AREA VW
            WHERE LEN(VW.LEVEL_TREE) > LEN(A.LEVEL_TREE)
            AND VW.ID_PERIODO_GESTAO = 2
            FOR XML PATH('')), 1, 1, '')

FROM VW_AREA A
LEFT JOIN dbo.COLABORADOR_AREA ON dbo.COLABORADOR_AREA.ID_COLABORADOR = A.COLABORADOR_ID
WHERE A.ID_FILIAL IN (9) AND A.ID_PERIODO_GESTAO = 2

UNION

SELECT A.ID, A.ID_PERIODO_GESTAO, A.ID_FILIAL, A.ID_RESPONSAVEL_AREA, A.ID_PARENT, A.ID_SOURCE, A.COD_AREA, A.DESC_AREA, A.ATIVO, A.USER_LOGIN_RESP, A.NOME_RESP, A.DESC_FILIAL, A.COD_AREA_SUP, A.FOTO_PATH,
A.COLABORADOR_ID,
CASE WHEN (SELECT COUNT(B.ID_COLABORADOR) FROM COLABORADOR_AREA B WHERE B.ID_AREA = A.ID GROUP BY B.ID_AREA) IS NULL THEN 0 ELSE
(SELECT COUNT(B.ID_COLABORADOR) FROM COLABORADOR_AREA B WHERE B.ID_AREA = A.ID GROUP BY B.ID_AREA) END AS QTD_COLABORADORES,
A.LEVEL_TREE, LEN(A.LEVEL_TREE),

    STUFF(
            (SELECT ',' + CAST(VW.ID AS VARCHAR(10))
             FROM VW_AREA VW
             WHERE LEN(VW.LEVEL_TREE) > LEN(A.LEVEL_TREE)
             AND VW.ID_PERIODO_GESTAO = 2
             FOR XML PATH('')), 1, 1, '') AS

FROM VW_AREA A
LEFT JOIN dbo.COLABORADOR_AREA ON dbo.COLABORADOR_AREA.ID_COLABORADOR = A.COLABORADOR_ID
JOIN CTE4 ON A.ID = CTE4.ID_PARENT
WHERE A.ID_PERIODO_GESTAO = 2
AND (A.ID IN (CTE4.ID_PARENT))

RESULT
QTD_COLABORATOR    LEVEL_TREE     QTD_CARACTER_IN_LEVEL_TREE
1                  002            3

The last column, with the STUFF function, will contains data like that
2997,2998,2999,3000,3001,3002,3003,3004,3005,3006,3007,3008,3009,3010,3011,3012,3013,3014,3015,3016,3017
This is all ID that contains more then 3 caracter in LEVEL_TREE

A: That will never work. You're trying to use an in comparator against a string. Hence the syntax error. Is there a reason you can't do this?
SELECT SUM(A.ID)
 FROM COLABORATOR A
 WHERE A.ID IN (SELECT VW.ID FROM VW_AREA VW)

A: Hi STUFF will make your values comma separated, and the IN Clause will expect a Result Set of INTs, so there it crashes,
You might be able to do it with Dynamic String execution like this:
SET @sqlCommand = 'SELECT ' + @columnList + ' FROM customers WHERE City = ' + @city
EXEC (@sqlCommand)


text:
Q: $\displaystyle d(f,g)=\sup_{a\leq x \leq b} |f(x)-g(x)|+ \sup_{a\leq x \leq b} |f'(x)-g'(x)|, \quad f,g \in X$. Then d is a metric Hello stackexchange!
(Firstly, I'm sorry if this question asked before like that, I've searched something on this website but I couldn't find an answer such I wanted)
Let $X$ be the set of all continuously differentiable functions on $[a,b]$.
$\displaystyle d(f,g)=\sup_{a\leq x \leq b} |f(x)-g(x)|+ \sup_{a\leq x \leq b} |f'(x)-g'(x)|, \quad f,g \in X$.
Then d is a metric on X.
Well, today I focused on this problem and tried that:
Firstly, let $$d_{1}(f,g) := \sup_{a\leq x \leq b} |f(x)-g(x)| \quad f,g \in X$$
and $$d_{2}(f,g) := \sup_{a\leq x \leq b} |f'(x)-g'(x)|, \quad f,g \in X$$
So, if $d_{1}(f,g)$ and $d_{2}(f,g)$ are metrics, then $d(f,g) = d_{1}(f,g) + d_{2}(f,g)$ is also a metric.
We can easily show that $d_{1}(f,g)$ is a metric.
But we know, $d_{2}(f,g)$ is not a metric. (For example, let $f(x)$ and $g(x)$ be a constant function.)
So, $\textbf{this way doesn't work!}$
Unfortunately, I stuck at that point.
I'm open for any small pieces of hints! Thanks!

A: You do not need that $d_2$ is a metric. It suffices that it is a pseudometric. See https://en.wikipedia.org/wiki/Pseudometric_space. But this is trivial because $d_2(f,g) = d_1(f',g')$.
Then clearly $d = d_1 +d_2$ is a pseudometric. It is a metric because $d_1(f,g) \le d(f,g)$: If $d(f,g)= 0$, then also $d_1(f,g) = 0$.


text:
Q: Windows Phone 8.0/coding4fun v1.6.1/InputPrompt disappears on Windows 10 Phones I have an app, written for Windows Phone 8.0 with Coding4Fun version 1.6.1. When I run the app on Windows 10 Phone, Coding4Fun InputPrompt disappears when the keyboard appears. This happens only on device, in all emulators everything is ok. Any idea, what should I do?

A: I got this solved by upgrading the 8.0 project to 8.1 Silverlight project in VS2013. 8.1 Silverlight app runs now correctly also in Windows 10 phone.


text:
Q: How can I get the children process list in kernel code I want to get to the children task (process) list of a process, here is the code:
void myFunc()
{
    struct task_struct* current_task;
    struct task_struct* child_task;
    struct list_head children_list;

    current_task = current;
    children_list = current_task->children;
    child_task = list_entry(&children_list,struct task_struct,tasks);
    printk("KERN_INFO I am parent: %d, my child is: %d \n",
            current_task->pid,child_task->pid);
}

The current pid is right, but the child pid is not correct.
What am I doing wrong?

A: child_task = list_entry(&children_list,struct task_struct,children);

Note, the last parameter to the list_entry should be children
btw: if you are not very familiar with list_entry, following article is a good source:
http://isis.poly.edu/kulesh/stuff/src/klist/


text:
Q: how to reload child state in angular js
Flavors

Config:
 .state('azure.overview', {
    url:'/azureOverview',
    templateUrl  :'partials/azure/azureOverview.html',
    controller : 'azureOverviewCtrl'
  })
controller $scope.init() { }

I have used this snippet but my parent state also reloading but i want only child state to reload

A: @Lakshmi You may have your answer here:
As of 0.2.14 you also have an option to just reload the current state and not it's parent.
So $state.go(people.search, {}, {reload: true}); would reload the people state as well as all its childs.
While $state.go(people.search, {}, {reload: "people.search"}); would not reload the people state but would reload people.search and its childs.

A: There is a working plunker
Previously, for this question: in ui-router, how to re-resolve only the most local state?, I created this plunker
which shows, that we can use params : {} to define state parameter which is not in the url.. but could be used as "change trigger", forcing just a child state to reload.
Here we can see these states:
  .state('azure', {
      url: "/azure",
      templateUrl: 'tpl.azure.html',
      controller: 'azureOverviewCtrl',
  })
  .state('azure.overview', {
      url: "/overview",
      params: { updater : 1, },
      templateUrl: 'tpl.overview.html',
      controller: 'OverCtrl',
  })

Now, we can create this reload link, which simply sends incremented updater number:

  Flavors reloading

And with this incrementation, we can be sure, that reload link - will reload this child state
Check it here

A: The native, built-in functionality of ui-router is:
when navigating among children, form one child state to another child, parent is NEVER reloaded
unless we will explicitly change that built in behaviour, e.g. via decorator as you did and force the reload with passing these options:
  { reload: true}

You can also find similar type of solution in this post
AngularJS UI Router $state reload child state only


text:
Q: Write an integer number as binary to a file with PowerShell I'm trying to write an unsigned integer (its 4-byte DWORD binary representation) to a file with PowerShell, but all the alternatives I've tried only write text.
Let's say I have this number:
$number = [Int] 255
The file content should be FF000000 (binary), not 255 (text).
I'm not a PowerShell expert, so I appreciate any help.

A: Found a solution:
$number = [Int] 255
# Convert the number to a byte[4] array
$bytes  = [System.BitConverter]::GetBytes($number)
# Write the bytes to a file
Add-Content -Path "D:\FILE.BIN" -Value $bytes -Encoding Byte

A: For this I think we need to rely on .Net classes.
You can get an array of bytes [byte[]] by using [System.BitConverter]::GetBytes().
From there you need a way to write bytes to the file without them being converted to strings.
For that, use [System.IO.File]::WriteAllBytes().
So combined, code like this would do it:
$number = [int]255
$bytes = [System.BitConverter]::GetBytes($number)
[System.IO.File]::WriteAllBytes('C:\MyPath\To\File.bin', $bytes)