text:
Q: Using "like" at the end of the sentence. North-East like? I've lived in the North-East of England for over 10 years now but I always wondered about this particular usage of the word "like". For years I have heard countless sentences or questions that sound like:
"Are you all right like?"
"I've been to ... and it's pretty good like"
I have learnt to use it not by literal understanding but rather the context and I know it can't be translated into other languages.
Has anybody got any idea where it came from? Are you from other part of England and use it just like the Geordies? (it's only my assumption it occurs in the North-East and nowhere else)

A: I think it's more of a dialect thing than anything. It's just a filler word, like 'Um' or 'Er'. The only difference is that it comes at the end of the sentence, and seems to be quite specific to that region. I think a few other regions have similar dialects, and also use 'like' at the end of their sentences. For example the Liverpudlian (Liverpool) accent.

A: I'd say this is best explained by this Geordie lady (at 8:37)
"wememba dat wo put 'lAke' on da end o'sentences... just because wo CAN" :-)

A: Here in the U.S., we'd say "are you, like, alright?". I've just heard this use of like at the end of a sentence and think it's the same thing - a filler, as Michael said, only it shows up in different places in sentences depending on where people live/are from.


text:
Q: Flow through a rifled pipe In turbulent flow the friction is inertial for the most part: the chaotic flow causes the fluid in the faster moving center to interchange randomly with the fluid near the edge. This eventually allows momentum from the center to be transferred to the walls of the pipe (i.e. friction).
If the pipe walls had "rifling" (an internal swirling pattern), the fluid would rotate on it's way down. Rotation inhibits momentum exchange between the center and edges because of the Coriolis effect: a parcel of fluid moving outward will find itself moving inward at half a rotation later.
Could rifling reduce friction this way, or would the extra friction from the increased surface area offset any gains? Is there a way to intuitively see which effect will "win"?
Edit: CuriousOne pointed out a study that shows rifling seems to help: From "Experimental Study on Heat Transfer and Fluid Flow in Vertical Rifled":
"The pressure drop and the energy consumed by using the rifled tube were also found to be less than that of the smooth tube."
I don't know if this is due to the rotation or because the rifles act as riblets. This study is for only a single rifled tube, so there is still room for optimization.

A: One does not need to have rifling in a cylinder to induce rifled rotation of turbulent water flow; rifling is imposed on the fluid column by transverse echoing reverberation of flow-generated sound with an imposed resonant wavelength of twice the diameter (Google "Rifled Rotation in Turbulent Cylinder Flow (20/11/13"). The rotation might be explained by Sir John Tyndall's 1867 observation that specific simple harmonic sounds trigger turbulence in a flat flame that was previously laminar. The flame remained rotated until the triggering sound ceased.
Furthermore, in turbulence in cylinders a distinct organized flow pattern develops in equal cylinder sectors – a centripetal streaming flow flanked by equal, but counter-rotating vortices. Significantly, a central streaming flow flanked by a pair of entrained counter-rotating vortices is characteristic of flow away from a simple harmonic sound generator (Gaines, 1932, Physics, 3: 209-229.) or from a simple harmonic ultrasound generator (Liebermann,1949, Phys. Rev. 75: 1415-1422). This conforms to simple harmonic resonant transverse sound that develops as turbulence onsets in cylinders.
Significantly, in Nikuradse's study of turbulence in tubes with geometric cross-sections (such as square or triangular),his illustrations show a similar distnct transverse flow pattern – a centripetal streaming flow from the boundary layer of each mid-wall, flanked by a pair of counter-rotating vortices (Nikuradse J , 1930). Although rifling develops in turbulence in cylinders (a cylindical turbulent column in a similar cylindrical tube), a triangular-shaped turbulent column in Nikuradse's tubes cannot achieve rifling (one can't rotate a tiangula , 1932, Physics, 3, 209-229.  r peg in a similar-shaped tube).
Such organized flow patterns contradict a astate of chaos.

A: According to the Wikipedia article you referenced in your comment, the advantage of rifling in a boiler tube is that it creates centrifugal force which throws the heavier water phase toward the walls of the tube, keeping the lighter steam phase in the center.  This allows better heat transfer from the walls to the water.  Similar studies address the effect of limiting the size of steam bubbles forming on the inner wall by creating enough centrifugal force acting on the water to displace the steam bubbles toward the center before they get too large.
I'm assuming your question regards fluid flow velocity, and specifically the effect of friction between the inner wall of the tube and the fluid it carries.  I don't think that Wikipedia article is helpful.  However, you may be able to compare fluid flow velocity in each type of tube by using the Reynolds number for the particular fluid.  Scroll down to "Flow in Pipe" in the Reynolds number link.  In order to make the two types of tube comparable, and to isolate the coriolis effect, it seems to me you would need to adjust the dimensions of the rifled tube so that its cross sectional area (including the effect of the rifling which increases the wetted perimeter) equals the cross sectional area of the smooth tube.
You then could perform an experiment that measures the rate at which the fluid exits each type of tube.  If the rifled tube produces a greater exit velocity, you might attribute this to the coriolis effect.

redpajama_set_name: RedPajamaStackExchange


text:
Q: iOS Bluetooth App- Check Paired Devices I build an iOS Bluetooth Enable app which connects to the external device and after connecting it pairs with the device. Now, I want to check if the user already paired the device so that i will not show the pair alert message next time?

A: Unfortunately, you can't, there is no means in the Core Bluetooth API to check pairedness. The pairing dialog is shown by iOS when needed.


text:
Q: Оптимизация .load() Нужно с одной страницы загружать версии софта на сайт (несколько мест). Строго не судите за костыли, не знаю JS, делаю простые вещи по аналогии с C++. Пока делаю таким образом:
<script>
     $( "#v1" ).load( "/vr.html #v1" );
     $( "#v2" ).load( "/vr.html #v2" );
     $( "#v3" ).load( "/vr.html #v3" );
     $( "#v4" ).load( "/vr.html #v4" );
     $( "#v5" ).load( "/vr.html #v5" );
     $( "#v6" ).load( "/vr.html #v6" );
     $( "#v7" ).load( "/vr.html #v7" );
     $( "#v8" ).load( "/vr.html #v8" );
     $( "#v9" ).load( "/vr.html #v9" );
     $( "#v10" ).load( "/vr.html #v10" );
     $( "#v11" ).load( "/vr.html #v11" );
     $( "#v12" ).load( "/vr.html #v12" );
     $( "#v13" ).load( "/vr.html #v13" );
     $( "#v14" ).load( "/vr.html #v14" );
</script>

Как это можно оптимизировать?

A: Если с циклами
 var linkCount = 14;
 for(var i = 1; i <= linkCount; i++) {
     $( "#v" + i ).load( "/vr.html #v" + i );
 }

Если же хотите, что бы не было кучи обращений к серверу, тогда сделайте что-нибудь на подобии этого:
function loadData(url) {
    var tempEl = $("<div>"); // создаем виртуальный DOM элемент
    tempEl.load(url); // загружаем в него данные один раз
    var linkCount = 14;
    for(var i = 1; i <= linkCount; i++) {
        // берем данные из виртуального элемента
        $( "#v" + i ).html( tempEl.find("#v" + i) );
    }
}

//Используем
loadData("/vr.html");


text:
Q: publishing installs, can't select "android only" audience? I am unable to select "Android only" when trying to create my audience for app installs, the radio button is disabled, see image below:

I'm using CoronaSDK for creating a game, and i publish the install when the game launches. I have all of the information setup in the App Information page (package name, class name, key hashes are all filled out).
Any idea what could be keeping me from selecting "Android only" as part of my audience?

A: It sounds like your development environment is not set up correctly.  I suspect that you haven't downloaded the API Levels needed your project. You need to download that API Level via the SDK Manager too.
http://developer.android.com/tools/help/sdk-manager.html
Also note that the Android SDK requires the 32-bit version of JDK 6, which is not installed on OS X Mavericks by default, so that could be why if that is the case.


text:
Q: Is the Frobenius property invariant by Morita equivalence? Kaplansky's sixth conjecture [Ka75] states that the dimension of a semisimple finite dimensional Hopf algebra over $\mathbb{C}$ is divisible by the dimension of its irreducible complex representations.
This property is extended as follows in [ENO11]: a spherical fusion category $\mathcal{C}$ (over $\mathbb{C}$) has the Frobenius property if for every simple object $X$ in $\mathcal{C}$ then $\frac{\mathrm{FPdim}(\mathcal{C})}{\mathrm{FPdim}(X)}$ is an algebraic integer. This paper concludes by asking whether there is a fusion category without the Frobenius property [ENO11, Question 1].
We proved in [BP22, Corollary 4.10] that the Frobenius property holds for every spherical fusion category (over $\mathbb{C}$) if and only if it is invariant by Morita equivalence. This leads to the following question:
Question: Is the Frobenius property invariant by Morita equivalence?

References
[Ka75] I. Kaplansky; Bialgebras, Lecture Notes in Mathematics. Department of Mathematics, University of Chicago (1975) iv+57 pp.
[ENO11] P. Etingof, D. Nikshych, and V. Ostrik; Weakly group-theoretical and solvable fusion categories, Adv. Math., 226 (2011), pp. 176–205.
[BP22] S. Burciu, S. Palcoux; Structure constants, Isaacs property and Extended-Haagerup fusion categories, arXiv:2210.13936


text:
Q: Real device not showing in android studio I have tried to connect my mobile phone to the computer to connect for android studio,
but there is no  any device appear in devices,
And the virtual devices with genymotion are appeared  with no problem,
I have activated Usb debugging mode and try to connect more than one device which working in other PCs ,
what can I do


text:
Q: string accept error name accept part getting skipped This is the my code and the problem is using array i am taking names and their marks input and want to print then serially but the name accepting part is not working it is taking number inputs but not the names
import java.util.Scanner;

public class ST_test
{

    public static void main(String[] args)
    {
        int i;
        Scanner sc= new Scanner(System.in);
        String a[]= new String[5];
        int num[]= new int[5];
        for(i=0;i<5;i++)
        {

            System.out.println("position mrks"+i);
            num[i]=sc.nextInt();
            System.out.println("position name "+i);
            a[i]=sc.nextLine();

        }
        for(i=0;i<5;i++)
        {
            System.out.print(" "+a[i]+" ");
            System.out.print(" "+num[i]+" ");

       }

     }
}

A: I used to encounter this error early on in my Java journey. The problem is with the Scanner class, probably a bug.
The solution that I used was to create 2 scanner class objects. One for the numeric values and the other for String values. Here is the modified code:-
import java.util.Scanner;

public class ST_test
{

public static void main(String[] args)
{
    int i;
    Scanner sc= new Scanner(System.in);
    Scanner sc1 = new Scanner(System.in); // new scanner object for Strings
    String a[]= new String[5];
    int num[]= new int[5];
    for(i=0;i<5;i++)
    {

        System.out.println("position mrks"+i);
        num[i]=sc.nextInt();
        System.out.println("position name "+i);
        a[i]=sc1.nextLine();

    }
    for(i=0;i<5;i++)
    {
        System.out.print(" "+a[i]+" ");
        System.out.print(" "+num[i]+" ");

   }

 }
 }

While this helps, it would be better to switch to BufferedReader and BufferedWriter class :)


text:
Q: useEffect. Find the parent component that defines it and wrap that definition in useCallback So this is my code in my profile actions
import axios from 'axios';

import { GET_PROFILE, PROFILE_ERROR } from './types';

// Get current users profile
export const getCurrentProfile = () => async (dispatch) => {
    try {
        const res = await axios.get('/api/profile/me');

        dispatch({
            type: GET_PROFILE,
            payload: res.data,
        });

        dispatch(getCurrentProfile());
    } catch (err) {
        dispatch({
            type: PROFILE_ERROR,
            payload: {
                msg: err.response.statusText,
                status: err.response.status,
            },
        });
    }
};

and this is my dashboard
import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { getCurrentProfile } from '../../actions/profile';

const Dashboard = ({ getCurrentProfile, auth, profile }) => {
    useEffect(() => {
        getCurrentProfile();
    }, []);

    return
Dashboard
;
};

Dashboard.propTypes = {
    getCurrentProfile: PropTypes.func.isRequired,
    auth: PropTypes.object.isRequired,
    profile: PropTypes.object.isRequired,
};

const mapStateToProps = (state) => ({
    auth: state.auth,
    profile: state.profile,
});

export default connect(mapStateToProps, { getCurrentProfile })(Dashboard);

and I get this errror "React Hook useEffect has a missing dependency:  'getCurrentProfile'. Either include it or remove the dependency array. If 'getCurrentProfile' changes too often, find the parent component that defines it and wrap that definition in useCallback"

A: As the warning says, you can can include getCurrentProfile as a dependency to useEffect.
Also since the getCurrentProfile function is being passed as a dispatch function to props form connect, its reference doesn't change and hence you need not worry about change in its reference or using useCallback to memoize it
useEffect(() => {
    getCurrentProfile();
}, [getCurrentProfile]);

Note that in the getCurrentProfile function you must not dispatch itself without a condition
export const getCurrentProfile = () => async (dispatch) => {
    try {
        const res = await axios.get('/api/profile/me');

        dispatch({
            type: GET_PROFILE,
            payload: res.data,
        });

    } catch (err) {
        dispatch({
            type: PROFILE_ERROR,
            payload: {
                msg: err.response.statusText,
                status: err.response.status,
            },
        });
    }
};

A: I guess that is the error from eslint wiht react-hooks plugin. The error mean when you use a hooks which accept array as a dependencies the plugin recommend to add any variable, function..., which have chance to change each render, inside the hook function to be included in dependency array. So how to fix it?

*

*You can include the getCurrentProfile in dependency array, but make sure you use useCallback to wrap getCurrentProfile if you define component or a custom hook.

*You can disable the effect of eslint if you wish by

useEffect(() => {
    getCurrentProfile();
   // eslint-disable-next-line react-hooks/exhaustive-deps
}, []);


text:
Q: hide body tag but still show a div

THIS SHOULD BE PRINTED

<button >Hide</button>
<button >Show</button>
<button id="print">print</button>

given is a sample code. Clicking on print button should hide body of page except the values inside "p" tags. need help as to how to achieve this ?
is there some way of making "p" tag or "div" tag act as body temporarily ?

A: Use below given function to first hide all child of body tag and then show the required child
$("body").find("*").hide();

A: I would structure your application differently as you can't show something contained within the element you have hidden.

THIS SHOULD BE PRINTED

and change your logic to something like this...
$(document).ready(function(){
    $("#print").click(function(){
        $("#hide-me").hide();
        $("#show-me").show();
        window.print();
        $("#hide-me").show();
    });
});

A: It can be risky to hide everything in the page. Also, the approach makes you ahve to add the content after hiding the body.
A better approach is to make the content you want come to the front, fill up the whole screen, and hide everything else behind it without deleting.
And it's very simply to do so.

$(function() {
  $('.show-print').on('click', function() {
    $('.print-container').addClass('active-print');
  });
});
.print-container {
  position: fixed;
  background: white;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
}

.print-container:not(.active-print) {
  display: none;
}

          Normal body content

    <button class="show-print">Print</button>

        I'm Print. I'm stronger than BODY!


text:
Q: Can one install Whole Tomato's Visual Assist X in Microsoft's Visual C++ 2010 Express Edition? Do you know software support assist for Visual C++ 2010 Express ?, as Visual Assist X for Visual Studio

A: Installing any plugin requires running the IDE in Integrated Mode (rather than Isolated Mode), which means you'll need a full version of Visual Studio. The express editions simply don't have the feature.
Couple of options to get a version capable of Integrated Mode:

*

*If you are a university student, you can download a full version of Visual Studio from MSDNAA.

*If you are a student where MSDNAA is not available, you can still get the full copy from DreanSpark if you can show proof of being a student. (A report card should suffice)

*You could purchase the full version of Visual Studio -- I'm assuming this is probably cost prohibitive.


text:
Q: Virtual host for angular 2 application in apache 2 not working I need to create a virtual host or domain for my angular 2 application.
In brief, i had followed the below steps:
1) Created virtual host file for my site (From: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts)
2) build the project in prod mode: ng build --prod (got dist folder)
These are my settings files from the above tutorial link that i had made in my server:
etc\apache2\sites-available\mydomain.com.conf
ServerName mydomain.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/Angular2/path_to_my_app

<Directory /var/www/html/Angular2/path_to_my_app>
      Options Indexes FollowSymLinks MultiViews
      AllowOverride all
      Order allow,deny
      allow from all
 </Directory>

In my windows host file added an entry to my site to map the ip
C:\Windows\System32\drivers\etc\hosts
10.*.*.*    mydomain.com

In my server etc/host added an entry
etc\hosts
127.0.0.1   mydomain.com

In my angular 2 application's src folder (where index.html resides)
<IfModule mod_rewrite.c>
  Options Indexes FollowSymLinks
  RewriteEngine On
  RewriteBase /var/www/html/Angular2/path_to_my_app
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>

And in the same folders index.html:
<base href="/var/www/html/Angular2/path_to_my_app">

My package.json has:
"start": "ng serve --host mydomain.com"

The created domain seems to load (hopefully, assuming deep links works), but when i hit mydomain.com, i get the angular2's folder structure view in my browser, not my site loaded

Where is my configuration incorrect.
Do i need to configure any other file in angular 2. If so which?

A: ServerName mydomain.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/Angular2/path_to_my_app/src
in etc\apache2\sites-available\mydomain.com.conf, append /src to DocumentRoot


text:
Q: Internet sharing on Mac to use /etc/host rules I have added two new rules to my /etc/host file. I tested them locally via my browser and they work. What I am trying to do is have any device that connects to my mac wifi module via internet sharing, to use the same rules set in my /etc/host file.

A: I found a way via DNSMasq. Just have to make sure to start dnsmasq prior to internet sharing as it appears MacOS automatically creates its own DNS on the same port.


text:
Q: Best way to apply an XSL file to an XML I recently had few XML & XSL questions( 1 & 2) for which I found solutions. I am currently applying these XSL file to the XML using the "XML tools" plugin for Notepad++. But I think this only works with XSL 1.0.
So I was wondering what is the best way to apply XSL within the XML file for sorting & adding nodes in an XML file and saving it as a new file.(Preferably open source application)

A: Install an XSLT processor like Saxon, and call this from the command line:
Transform -s:source.xml -xsl:stylesheet.xsl -o:out.xml


text:
Q: Power builder Data window - Right to left I have a field in power builder in which Right to left is enabled in properties, I still need this to be RTL as I am using Arabic, but now I lost the option to center align it. Even if I change alignment property it is still right aligned.

Is there a way to center align the field even with Right to left is enabled?


text:
Q: Jfrog artifactory password reset Screenshot_1 ScreenShot_2 I'm unable to login to jfrog artifactory with default credentials and unable to change password too.  How to reset password in Jfrog? any idea.

A: If this is the admin user then you can follow these instructions:
https://www.jfrog.com/confluence/display/JFROG/Users+and+Groups#UsersandGroups-RecreatingtheDefaultAdminUserrecreate
If you are not an admin, you can ask your administrator to reset your password.


text:
Q: Multiple values using GET method in my template? with django I am trying to send info using GET method and the django paginator.
I am using buttons to send the request and on my views display the corresponding list, that works fine. However, the problem is when I change page to page=2 or whatever, the url is replaced.
For example: you click the button A and the url should appear webpa.com/expedient?letter=A and when you clic next page, it is replaced webpa.com/expedient?page=2 instead of webpa.com/expedient?page=2&letter=A
My template is as follows:
<form action="expedient" method="GET">
<button type="submit" name="letter" value="A">A</button>
<button type="submit" name="letter" value="B">B</button>
<button type="submit" name="letter" value="C">C</button>
<button type="submit" name="letter" value="G">G</button>
<button type="submit" name="letter" value="L">L</button>
<button type="submit" name="letter" value="N">N</button>
</form>

and the paginator also in the same template is:
{% if is_paginated %}

Anterior

              {% for num in page_obj.paginator.page_range %}

{{num}}

              {% endfor %}

Siguiente

        {% endif %}

How can I send the value of the letter in the form and the page number?
I forgot to add the views code, I used a class:
class ExpedientView(ListView):
    context_object_name = 'portfolios'
    template_name = 'dashboard-admin/portfoliorecords.html'
    paginate_by = 10
    def get_queryset(self):
        queryset = Portfolio.objects.filter(moneybox__isnull=True).order_by('owner__last_name')
        letter = self.request.GET.get('letter', None)
        if letter:
            queryset = queryset.filter(owner__last_name__istartswith=letter)
        return queryset

I think I might need to add the letter received from the template and add it to the queryset or another variable perhaps? and return it to the template in the paginator code, something like:
{% if is_paginated %}

Anterior

                  {% for num in page_obj.paginator.page_range %}

{{num}}

                  {% endfor %}

Siguiente

            {% endif %}

A: I assume as per your code user first click one of the button A, B, C...
you get the value of the button in the request.GET in your views.py
and next when you want to use the value of the button you need to send the value in the context of the template
context = {
   'letter' : 'A',
    ....
}

and in your templates you need add like this

{{num}}


text:
Q: Why is no template keyword needed if an unrelated global template function with same name exists? This question is related to my previous question Compiler error when trying to call template method from private instance, which was pointed out to be related to this question: Where and why do I have to put the "template" and "typename" keywords?
So I read this and I get the idea that the C++ language definition is ambiguous so it cannot always be parsed correctly. In my case, the answer was that I need a.template f<1>() in B::test() to help the parser understand that it is dealing with a template. Fine.
But, after reading all this, why the heck is the parser suddenly able to do without the template keyword if I happen to have a completely unrelated global template function that happens to have the same name? This compiles without problems and behaves as expected:
#include <iostream>

template <int i>
void f() {std::cout << "f()\n";}

template <int N>
struct A {
    template <int i>
    void f() {std::cout << "A::f()\n";}
};

template <int N>
struct B {
    A<N> a;

    B(A<N>& a) : a(a) {}

    void test() {
        f<1>();
        a.f<1>();  // compiles without 'template' keyword!
    }
};

int main() {
    A<2> a;
    a.f<1>();   // works fine
    B<2> b(a);
    b.test();
}

I found that the global function must:

*

*be called f

*be a template function

*be defined before B
Otherwise, it can be pretty much anything. So
template <typename T, unsigned k>
void *f(double x, const char *s) {return NULL;}

works just as well to help the parser out that a.f<1>() in B::test() is in fact to be parsed as a.template f<1>().
What is the compiler thinking? Like: "Well, the guy already has a global template function called f<>(), so when I'm parsing this completely unrelated expression a.f<1>() inside B::test(), I'm going to assume that it's also a template function?" What is this?
What did I miss when reading Where and why do I have to put the "template" and "typename" keywords??
Update
The code above compiles for me with all of:

*

*i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)

*Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)

*g++-4.8 (GCC) 4.8.2

I also tested with the compiler flags -pedantic -Wall -Wextra and with -std=c++11 for g++-4.8. It worked in all cases.
Update 2
This also works without template keyword:
// ...
template <int N, template <int> class A>
struct B {
    A<N> a;

    B(A<N>& a) : a(a) {}

    void test() {
        f<1>();
        a.f<1>();  // compiles without 'template' keyword!
    }
};

int main() {
    A<2> a;
    a.f<1>();   // works fine
    B<2, A> b(a);
    b.test();
}

A: I think g++ is correct and the code should compile without .template. According to the standard (at least up to my understanding),
3.4.5/1 (page 55 of N3936)
In a class member access expression (5.2.5), if the . or -> token is immediately followed by an identifier followed by a <, the identifier must be looked up to determine whether the < is the beginning of a template argument list (14.2) or a less-than operator. The identifier is first looked up in the class of the object expression. If the identifier is not found, it is then looked up in the context of the entire postfix-expression and shall name a class template.


text:
Q: Java - Eclipse JTextField too big I have added a JTextField to a JPanel using the Window Builder in Eclipse and no matter what I tried, the text field is displayed like this:

(source: gyazo.com)
I have tried to change the preferred size, the maximum and minimum sizes and it still appears like this.
How do I fix this? What have I done wrong?
Thanks in advance.
UPDATE

Code: (it is all automatically generated by Google's Window Builder)

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import java.awt.Dimension;

public class Main extends JFrame {

private JPanel contentPane;
private JTextField textField;

/**
 * Launch the application.
 */
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                Main frame = new Main();
                frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

/**
 * Create the frame.
 */
public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 450, 300);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new BorderLayout(0, 0));
    setContentPane(contentPane);

    textField = new JTextField();
    textField.setSize(new Dimension(6, 3));
    textField.setMinimumSize(new Dimension(6, 5));
    textField.setMaximumSize(new Dimension(6, 3));
    textField.setPreferredSize(new Dimension(6, 3));
    contentPane.add(textField, BorderLayout.WEST);
    textField.setColumns(10);
}

}

A: You could simply use the default layout manager FlowLayout for the JPanel contentPane. This will respect the components preferred size:
Remove (or comment out):
contentPane.setLayout(new BorderLayout(0, 0));

Always better to use a layout manager and avoid calling the setXXXSize methods for components for sizing. You can override getPreferredSize if necessary.
See: Doing Without a Layout Manager


text:
Q: How to make searches more natural? Having documents with Name and Description fields.
Name having more weight Description
I want to get documents ordered by score like this:

*

*Exact match

*Partial match

*Fuzzy match

*Fuzzy Partial match

*Proximity terms score higher.

I'm doing this surgery to get something similar to what I want:
public Task<DocumentSearchResult<T>> SearchWithFuzzyAsync<T>(string searchTerm, SearchParameters sp) where T: class
{
sp.SearchMode = SearchMode.All;
sp.QueryType = QueryType.Full;
searchTerm = Sanitize(searchTerm).Trim();
var keywordTrimmedFuzzy = searchTerm.Replace(" ", "~ ");
if (string.IsNullOrWhiteSpace(searchTerm))
{
    return Task.FromResult(new DocumentSearchResult<T>());
}
var searchTerms = $"({searchTerm})
        || ({keywordTrimmedFuzzy}~)
        || ({keywordTrimmedFuzzy}*)^0.8";
return indexClient.Documents.SearchAsync<T>(searchTerms, sp);

Am I missing something or should I construct this type of thing to get some decent results?
The problem I see with this approach is that I cannot let my users use the search engine to it's full extent (like having the option to use - or advanced syntaxes) unless I manage on my code.
Wouldn't it be easier if you could do something like:
sp.UseFuzzySearch = true;
sp.UsePartialMatch = true;
sp.ProximityTreshold = 4;
indexClient.Documents.SearchAsync<T>(term, sp);

instead of creating wonky search strings? What am I missing?

A: Right now, rewriting user queries to include fuzzy and/or partial matches is the best you can do, if you don't want to expose the query language to your users.
I agree that a configurable query parser that performed some of these transformations for you would be nice. Interestingly, not many of our customers have requested it. Please create a UserVoice idea to help us prioritize.
Relative importance of fields (field boosting) can be defined with Scoring Profiles. Therefore, if you want to give a higher weight to the Name field, you don't have to rewrite the search query.
Note, that wildcard and prefix queries always contribute constant score to the overall documents score, more details in the scoring section of the How full text search works in Azure Search article.


text:
Q: Logging message in Django running through Apache I am running Ubuntu 14.04 on my notebook and I am using Django 1.6.4 (with virtualenv) together with Apache 2.4.7.
I set up a site and want to log from my views some debugging information to my logfile called homepage.log (the name of my app is homepage). When I run my site with Django's built-in server all messages are shown in the logfile but when running with Apache no message lands in the file. My project is located under /home/nick/Workspace/Web/kleyboldt_django/ (kleyboldt is the name of the guy I am writting for). There I have my wsgi file, my virtual environment called env and my actual project called kleyboldt-homepage. I would like to log in kleyboldt_homepage/homepage.log. My setup is:
/etc/apache2/sites-available/mks.conf
WSGIDaemonProcess mks.com python-path=/home/nick/Workspace/Web/kleyboldt_django/kleyboldt_homepage:/home/nick/Workspace/Web/kleyboldt_django/env/lib/python2.7/site-packages
WSGIProcessGroup mks.com

<VirtualHost *:80>
    ...
    <Directory /home/nick/Workspace/Web/kleyboldt_django/kleyboldt_homepage/static/static>
        Require all granted
    </Directory>

    <Directory /home/nick/Workspace/Web/kleyboldt_django/kleyboldt_homepage/static/media>
        Require all granted
    </Directory>

    WSGIScriptAlias / /home/nick/Workspace/Web/kleyboldt_django/kleyboldt.wsgi

    ServerName mks.com

    <Directory /home/nick/Workspace/Web/kleyboldt_django/>
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>

    <Directory /home/nick/Workspace/Web/kleyboldt_django/env/lib/python2.7/site-packages/>
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog /home/nick/Workspace/Web/kleyboldt_django/kleyboldt_homepage/homepage.log
    LogLevel debug
</VirtualHost>

/home/nick/Workspace/Web/kleyboldt_django/kleyboldt_homepage/kleyboldt_homepage/settings.py
...
LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s:\t %(message)s',
            'datefmt': '%d/%B/%Y %H:%M:%S',
        },
        'simple': {
            'format': '%(levelname)s %(message)s',
        },
    },
    'handlers': {
        'null': {
            'level': 'DEBUG',
            'class': 'django.utils.log.NullHandler',
        },
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',

  'formatter': 'simple',
    },
    'file': {
        'level': 'DEBUG',
        'class': 'logging.FileHandler',
        'filename': 'homepage.log',
        'formatter': 'verbose',
    }
},
'loggers': {
    'kleyboldt_homepage': {
        'handlers': ['console', 'file'],
        'level': 'DEBUG',
    },
},

}
/home/nick/Workspace/Web/kleyboldt_django/kleyboldt_homepage/homepage/views.py
import logging

logger = logging.getLogger('kleyboldt_homepage')

def home(request):
    logger.warning("test")
    return render(request, 'homepage/home.html', {})

When running Apache the warning never appears.
Update 1
I changed the logfile to /tmp/homepage.log but then Apache shows an error message telling me that a misconfiguration was discovered. Because I set the error log in my VirtualHost to my logfile for my homepage Apache dumped the error message in it.
/home/nick/Workspace/Web/kleyboldt_django/kleyboldt_homepage/homepage.log
[Sat May 03 14:00:04.996997 2014] [authz_core:debug] [pid 16747] mod_authz_core.c(802): [client 127.0.0.1:47319] AH01626: authorization result of Require all granted: granted, referer: http://mks.com/
[Sat May 03 14:00:04.997084 2014] [authz_core:debug] [pid 16747] mod_authz_core.c(802): [client 127.0.0.1:47319] AH01626: authorization result of <RequireAny>: granted, referer: http://mks.com/
[Sat May 03 14:00:04.997272 2014] [authz_core:debug] [pid 16747] mod_authz_core.c(802): [client 127.0.0.1:47319] AH01626: authorization result of Require all granted: granted, referer: http://mks.com/
[Sat May 03 14:00:04.997295 2014] [authz_core:debug] [pid 16747] mod_authz_core.c(802): [client 127.0.0.1:47319] AH01626: authorization result of <RequireAny>: granted, referer: http://mks.com/
[Sat May 03 14:00:05.015130 2014] [:info] [pid 16746] [remote 127.0.0.1:36049] mod_wsgi (pid=16746, process='mks.com', application='mks.com|'): Loading WSGI script '/home/nick/Workspace/Web/kleyboldt_django/kleyboldt.wsgi'.
[Sat May 03 14:00:05.187017 2014] [:error] [pid 16746] [remote 127.0.0.1:36049] mod_wsgi (pid=16746): Exception occurred processing WSGI script '/home/nick/Workspace/Web/kleyboldt_django/kleyboldt.wsgi'.
[Sat May 03 14:00:05.187112 2014] [:error] [pid 16746] [remote 127.0.0.1:36049] Traceback (most recent call last):
[Sat May 03 14:00:05.187145 2014] [:error] [pid 16746] [remote 127.0.0.1:36049]   File "/home/nick/Workspace/Web/kleyboldt_django/env/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 187, in __call__
[Sat May 03 14:00:05.187282 2014] [:error] [pid 16746] [remote 127.0.0.1:36049]     self.load_middleware()
[Sat May 03 14:00:05.187329 2014] [:error] [pid 16746] [remote 127.0.0.1:36049]   File "/home/nick/Workspace/Web/kleyboldt_django/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 46, in load_middleware
[Sat May 03 14:00:05.187481 2014] [:error] [pid 16746] [remote 127.0.0.1:36049]     for middleware_path in settings.MIDDLEWARE_CLASSES:
[Sat May 03 14:00:05.187542 2014] [:error] [pid 16746] [remote 127.0.0.1:36049]   File "/home/nick/Workspace/Web/kleyboldt_django/env/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
[Sat May 03 14:00:05.187652 2014] [:error] [pid 16746] [remote 127.0.0.1:36049]     self._setup(name)
[Sat May 03 14:00:05.187710 2014] [:error] [pid 16746] [remote 127.0.0.1:36049]   File "/home/nick/Workspace/Web/kleyboldt_django/env/lib/python2.7/site-packages/django/conf/__init__.py", line 50, in _setup
[Sat May 03 14:00:05.187746 2014] [:error] [pid 16746] [remote 127.0.0.1:36049]     self._configure_logging()
[Sat May 03 14:00:05.187793 2014] [:error] [pid 16746] [remote 127.0.0.1:36049]   File "/home/nick/Workspace/Web/kleyboldt_django/env/lib/python2.7/site-packages/django/conf/__init__.py", line 80, in _configure_logging
[Sat May 03 14:00:05.187827 2014] [:error] [pid 16746] [remote 127.0.0.1:36049]     logging_config_func(self.LOGGING)
[Sat May 03 14:00:05.187887 2014] [:error] [pid 16746] [remote 127.0.0.1:36049]   File "/usr/lib/python2.7/logging/config.py", line 794, in dictConfig
[Sat May 03 14:00:05.188141 2014] [:error] [pid 16746] [remote 127.0.0.1:36049]     dictConfigClass(config).configure()
[Sat May 03 14:00:05.188182 2014] [:error] [pid 16746] [remote 127.0.0.1:36049]   File "/usr/lib/python2.7/logging/config.py", line 576, in configure
[Sat May 03 14:00:05.188218 2014] [:error] [pid 16746] [remote 127.0.0.1:36049]     '%r: %s' % (name, e))
[Sat May 03 14:00:05.188255 2014] [:error] [pid 16746] [remote 127.0.0.1:36049] ValueError: Unable to configure handler 'file': [Errno 13] Permission denied: '/tmp/homepage.log'

Obviously Apache does not have the permissions to write to this file. Therefore I changed the group of /tmp/homepage.log to www. Now writting debug messages to this file works. Now I changed the group of homepage.log in my project also to www. Unfortunately it does not work. The error log shows that Apache does not have permissions to write in my project folder. What should I change?

A: Try setting the logfilename to a full path for now.
'filename': 'homepage.log', try 'filename': '/tmp/homepage.log',
If that works, you can use os.path to set it relative to your app folder.

A: After some attempts I fixed the problem by changing the user of homepage.log to www-data and reloading Apache2. It could happen that you see an error message when you reload the server and then open the site immediatately.


text:
Q: Using Factory with DryIoc and getting object by string I am just testing invertion control using DryIoc library. Please check above to get the picture.
I have that factory class:
 'FactoryConnections using IoC Dry
    Public Class FactoryConnections

        Private Shared ReadOnly Container As Container

        Shared Sub New()
            Container = New Container()
            With Container

                .Register(Of ISftp, Sftp)
                .Register(Of ISaop, Soap)

                '.Register(Of IFtp, Ftp)
                .Register(Of IFtp, Ftp)(serviceKey:= "some string value")
            End With
        End Sub

        Public Shared Function ResolveService(Of T As IProtocol)(value As Iprotocol) As T
            Return Container.Resolve(Of T)
        End Function
    End Class

Just shortly according to invertion:
A ->  Y  (A uses Y)
A -> Interface B -> Y (in this case A doesn't know about Y)

we can read my solution the same:
A -> IFtp -> Ftp

Therefore instead of getting directly object like: Ftp, Sftp or Soap code should ask factory to get one of them based on the interface therefore calling point doesn't know exactly what concrete object is using but it knows who implements that - that's at elast my understanding. Therefore i could ask calling them via interfaces. This is what i am trying to do however from string value (project related requirment).
Dim myProtocol As String = "IFtp"

And as mentioned having that i want to get proper object from my factory in this case i should get New instance of Ftp right?
Note that parent interface for IFtp, ISoap, ISftp is IProtocol
I was trying like this:
Dim myProtocol As String = "IFtp"
Dim itemprotocol As type = Type.GetType(myProtocol)
Dim realprotocolobject = FactoryConnections.ResolveService(TypeOf(itemprotocol))

and also tried like this:
Dim myProtocol As String = "IFtp"
Dim realprotocolobject = FactoryConnections.ResolveService(Of IProtocol)(myProtocol)

What's wrong, What am i doing wrong?
One more thing: what is the diffrence between those lines?
(just saw this serviceKey somwhere..)
.Register(Of IFtp, Ftp)
.Register(Of IFtp, Ftp)(serviceKey:= "some string value")

Further discussionre reference:
Factory class:
https://1drv.ms/i/s!AkQvbwpYPYoIh0IqruVthcndFyOM
UnitTestClass:
https://1drv.ms/i/s!AkQvbwpYPYoIh0G7iEfy427aJXXw

A: I don't know how to write correct VB, so try to answer with C#. Hope it can be easily translated.
You may use serviceKey both in registration and resolve to identify the service from many of the same type, e.g. IProtocol.
container.Register<IProtocol, Ftp>(serviceKey: "ftp");
container.Register<IProtocol, Sftp>(serviceKey: "sftp");

Later:
var p = container.Resolve<IProtocol>(serviceKey: "sftp");
Assert.IsInstanceOf<Sftp>(p);

You may get all protocols with ResolveMany or by injecting an array or IEnumerable parameter.
var ps = container.ResolveMany<IProtocol>();
Assert.AreEqual(2, ps.Count());

Note that I did not specify serviceKey in ResolveMany.
Injecting keyed dependency
There may be a case when you want deep down dependency to be resolved by key. Then when registering dependency consumer you may specify it like this:
container.Register<ProtocolUser>(
    made: Parameters.Of.Type<IProtocol>(serviceKey: "ftp"));
var pu = container.Resolve<ProtocolUser>();
Assert.IsInstanceOf<Ftp>(pu.Protocol);

There are also other approaches, e.g. using requiredServiceType.
Here is example:
container.Register<IFtp, Ftp();
container.Register<ISftp, Sftp();

Let's assume that both IFtp and ISftp implement IProtocol.
There are two ways to specify that you want IFtp for IProtocol dependency (without using service keys).
First option, when you register dependency consumer/holder:
 container.Register<ProtocolUser>(
    made: Parameters.Of.Type<IProtocol, IFtp>());

Second option, to specify globally per container, which will affect all dependencies of IProtocol type.
var specializedContainer = container.With(
    Parameters.Of.Type<IProtocol, IFtp>());


text:
Q: Getting RSA exponent from public key I'm using RSA to encrypt and decrypt some messages. It works great, but I also need a way to get exponent and convert it to string so I can write it in simple text file. I'm using RSACryotoServiceProvider.
Edit 1 (using BigInteger):
byte[] e_jav=javni_klj.Exponent;
BigInteger bigInteger=new BigInteger(e_jav);
MessageBox.Show("e: " + bigInteger);


text:
Q: Is there a better alternative to relocate cakephp3 config folder I am using Cakephp3 and would like to know if there is a better alternative to relocating the config folder.
The issue rises from the fact that everytime I have to refresh the production app, i copy over the entire app from development to production and reconfigure the required settings in the config folder.
After some iterations of this process, I started to make a backup of the config folder and after copying the app, restore the config folder.
After some time even this started to get tedious, so I ended up hacking the cake files and folders.

*

*I relocated the config folder outside the root directory

*Created a symbolic link in the root directory poiting to the config directory outside the root directory.

*Updated the ROOT constant in config/paths.php to the real root folder

*In webroot/index.php redefined the bootstrap.php require location

So as long as long as I dont update the cakephp core, I can copy over the dev app to the prod app and all the config stays the same.
I would like to know if some one has a simpler approach.
Thanks

A: After some research and reading carefully the comments in related bootstrap file, I found a solution for, well at least, my problem.
The problem basically was that I had to refresh the database, email, debug settings define in the app.php file, everytime I uploaded the app from my dev server to my prod server.
Reading the comments in the bootstrap file I found the comment which stated:
Load an environment local configuration file.
You can use a file like app_local.php to provide local overrides to your
shared configuration.

So this allows me to redefine the configurations defined in the app.php file. However I wanted this to me more dynamic, so I ended up creating an APP_INSTANCE_NAME constant in the bootstrap.php file of the webroot directory as follows
// /config/bootstrap.php
define('APP_INSTANCE_NAME', strtolower(gethostname()));

and later in the bootstrap file, i did the following:
Configure::load('app_' . APP_INSTANCE_NAME, 'default');

with this change, the configuration that gets loaded is based on the server hostname and I dont have to relocate the config folder. Hope this helps someone with cakephp3
Thanks to jason and greg's comments which motivated me to read the comments more carefully.


text:
Q: Creating excel and word files alternatives Im being digging a little bit about the possibility of creating excel and word data using METEOR javascript framework does anybody has an idea how this could be achieved?? Any recommendation? I haven't found nothing about it, and I think I should come with some random solution the thing is that I have to use javascript for this I guess.
I know it is too early to request this kind of stuff in the meteor community but if somebody have an idea how to implementing this using only javascript I would glad to hear about it...
I'm looking some similar libraries as http://phpexcel.codeplex.com/
UPDATE ---
After 1 year using meteor, I think that this is not at all a concern of the meteor framework and shouldn't be, the solution relay more from a javascript perspective, there are some package in npm to achieve this. And you can import them inside meteor without problems.

A: This is still a great question! Officegen does the job:
var officegen = require('officegen');

var myDoc = officegen('<type>');

// Supported types:
// 'pptx' or 'ppsx' - Microsoft Powerpoint based document.
// 'docx' - Microsoft Word based document.
// 'xlsx' - Microsoft Excel based document.


text:
Q: tic tac toe game in JavaScript does not display that game is a draw I have created a small game using JavaScript. The problem is that it does not display that the game is a draw.
I have tried a lot but as a beginner I don't understand it. The errors are commented in the code below

let turn = "X";
let cells = document.querySelectorAll('[data-cell]');
let message = document.querySelector('#print');
let restart = document.querySelector('#but');
let steps = {
    X : [],
    O : []
}

const winConditions= [
    [0,1,2],
    [3,4,5],
    [6,7,8],

    [0,3,6],
    [1,4,7],
    [2,5,8],

    [0,4,8],
    [2,4,6],
];

//console.log(winConditions);

cells.forEach ( cell => {
    cell.addEventListener ("click",() => move(cell) );
});
restart.addEventListener("click", restartGame);
//console.log(inputs);

function move(cell) {
    cell.value = turn; //marking cells with X or O depends on turn
    cell.style.pointerEvents = 'none'; //making cell not clickable
//taking index of the cell and push it to step tracker
    let cellIndex = parseInt ( cell.getAttribute("data-cell"));
    if ( turn === 'X') {
        steps.X.push(cellIndex);
    } else {
        steps.O.push(cellIndex);
    }

changeTurn();
}
//functon bellow does not display when game is Draw!!!
function changeTurn() {
    let winner = validateWin();

    if (winner) {
        stopGame(${winner}'s win!);
    } else if (!winner && steps.X.length + steps.O.lenght === 9 ){
        stopGame(Draw!);
    } else {
        if(turn === 'X'){
            turn = 'O';
        } else {
            turn = 'X';
        }
        message.innerHTML = ${turn}'s turn;
    }
}
//does not show when X is winner???
function validateWin () {

    let win = null;
    let winner = null;
    if ( turn === 'X') {
        win = winConditions.some(winCondition => {
            return winCondition.every( condition => steps.X.includes(condition));
        });
        if (win) winner = 'X';

    } else if ( turn === 'O') {
        win = winConditions.some(winCondition => {
            return winCondition.every(condition => steps.O.includes(condition));
        });
        if (win) winner = 'O';
    }
    return winner;
    }

function stopGame(msg) {
    message.innerHTML = msg;
    cells.forEach(cell => {
        cell.style.pointerEvents = 'none';
    });
}

function restartGame() {
    steps.O = [];
    steps.X = [];
    turn = 'X';
    message.innerHTML = "X's turn";
    cells.forEach(cell => {
        cell.value = null;
        cell.style.pointerEvents = 'auto';
    });
}
* {
  margin: 0;
  padding: 0;
}

h1 {
  color: orangered;
  font-size: 45px;
}

/* 3*3 Grid */

#b1,
#b2,
#b3,
#b4,
#b5,
#b6,
#b7,
#b8,
#b9 {
  width: 80px;
  height: 52px;
  margin: auto;
  border: 1px solid gray;
  border-radius: 6px;
  font-size: 30px;
  text-align: center;
}

/* Reset Button */

#but {
  box-sizing: border-box;
  width: 95px;
  height: 40px;
  border: 1px solid dodgerblue;
  margin: auto;
  border-radius: 4px;
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  background-color: dodgerblue;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

/* Player turn space */

#print {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  color: dodgerblue;
  font-size: 20px;
}

/* Main container */

#main {
  text-align: center;
}

/* Game Instruction Text */

#ins {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  color: dodgerblue;
  font-size: 17px;
}

TIC TAC TOE

  <input class="cell" data-cell="0" type="text" id="b1" readonly>
  <input class="cell" data-cell="1" type="text" id="b2" readonly>
  <input class="cell" data-cell="2" type="text" id="b3" readonly>

  <input class="cell" data-cell="3" type="text" id="b4" readonly>
  <input class="cell" data-cell="4" type="text" id="b5" readonly>
  <input class="cell" data-cell="5" type="text" id="b6" readonly>

  <input class="cell" data-cell="6" type="text" id="b7" readonly>
  <input class="cell" data-cell="7" type="text" id="b8" readonly>
  <input class="cell" data-cell="8" type="text" id="b9" readonly>

  <button id="but">
            RESET
        </button>

 X's Turn

A: *

*spelling mistake - 2nd length in if (!winner && steps.X.length + steps.O.length === 9) {

*Missing backtics

I shortened some of the code too.
Here is the fixed code

let turn = "X";
let cells = document.querySelectorAll('[data-cell]');
let message = document.querySelector('#print');
let restart = document.querySelector('#but');
let steps = {
  X: [],
  O: []
}

const winConditions = [
  [0, 1, 2],
  [3, 4, 5],
  [6, 7, 8],

  [0, 3, 6],
  [1, 4, 7],
  [2, 5, 8],

  [0, 4, 8],
  [2, 4, 6],
];

//console.log(winConditions);

cells.forEach(cell => {
  cell.addEventListener("click", () => move(cell));
});
restart.addEventListener("click", restartGame);
//console.log(inputs);

function move(cell) {
  cell.value = turn; //marking cells with X or O depends on turn
  cell.style.pointerEvents = 'none'; //making cell not clickable
  //taking index of the cell and push it to step tracker
  let cellIndex = parseInt(cell.getAttribute("data-cell"));
  steps[turn].push(cellIndex);
  changeTurn();
}
//functon bellow does not display when game is Draw!!!
function changeTurn() {
  let winner = validateWin();
  if (winner) {
    stopGame(`${winner} wins!`);
  } else if (!winner && steps.X.length + steps.O.length === 9) {
    stopGame("Draw!");
  } else {
    turn = turn === 'X' ? 'O' : 'X';
    message.innerHTML = `${turn}'s turn`;
  }
}

function validateWin() {
  return winConditions
    .some(winCondition =>  winCondition
      .every(condition => steps[turn].includes(condition))) ?  turn : null;
}

function stopGame(msg) {
  message.innerHTML = msg;
  cells.forEach(cell => {
    cell.style.pointerEvents = 'none';
  });
}

function restartGame() {
  steps.O = [];
  steps.X = [];
  turn = 'X';
  message.innerHTML = "X's turn";
  cells.forEach(cell => {
    cell.value = null;
    cell.style.pointerEvents = 'auto';
  });
}
* {
  margin: 0;
  padding: 0;
}

h1 {
  color: orangered;
  font-size: 45px;
}

/* 3*3 Grid */

#b1,
#b2,
#b3,
#b4,
#b5,
#b6,
#b7,
#b8,
#b9 {
  width: 80px;
  height: 52px;
  margin: auto;
  border: 1px solid gray;
  border-radius: 6px;
  font-size: 30px;
  text-align: center;
}

/* Reset Button */

#but {
  box-sizing: border-box;
  width: 95px;
  height: 40px;
  border: 1px solid dodgerblue;
  margin: auto;
  border-radius: 4px;
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  background-color: dodgerblue;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

/* Player turn space */

#print {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  color: dodgerblue;
  font-size: 20px;
}

/* Main container */

#main {
  text-align: center;
}

/* Game Instruction Text */

#ins {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  color: dodgerblue;
  font-size: 17px;
}

TIC TAC TOE

  <input class="cell" data-cell="0" type="text" id="b1" readonly>
  <input class="cell" data-cell="1" type="text" id="b2" readonly>
  <input class="cell" data-cell="2" type="text" id="b3" readonly>

  <input class="cell" data-cell="3" type="text" id="b4" readonly>
  <input class="cell" data-cell="4" type="text" id="b5" readonly>
  <input class="cell" data-cell="5" type="text" id="b6" readonly>

  <input class="cell" data-cell="6" type="text" id="b7" readonly>
  <input class="cell" data-cell="7" type="text" id="b8" readonly>
  <input class="cell" data-cell="8" type="text" id="b9" readonly>

  <button id="but">
            RESET
        </button>

 X's Turn


text:
Q: DDD - Aggregate with large relation that is part of invariant Say I have two models
Project and Task
A project can have many tasks, but a project can only have one task with a status of in_progress at any time.
As far as I understand it, this is normally handled as part of a root aggregate's domain invariant
In this case however, the list of tasks associated with a project is potentially unbounded, so it doesn't really fit well in my opinion, but at the same time the project should control and maintain the aforementioned invariant
Any suggestions on how best to model this?

A: Sounds like you have a relation between project and task, which should be 1-to-1.
project inProgress task

And your constraint is that such a relation should be unique for each project
That in turn suggests that your Project API includes members like
TaskId currentTask()
void changeTasks(TaskId nextTask)


text:
Q: Dynamic attribute value element locator in Protractor When I add a new button with some value it gets dynamically added into DOM. Non-Angular HTML element for this button is:

    25.19 EUR
<button type="button" class="btn btn-default removeParent">

</button>

Once I remove this button I want to check it is not present anymore. Element that I'm searching for is data-value="2519"and this could be anything I set, like for example 2000, 1000, 500, 1050,...
In page object file I have tried to use the following:
this.newValueButtonIsNotPresent = function(item) {
        newValueButton = browser.element(by.id("containerQUICK_ADD_POINTS")).all(by.css('[data-value="' + item + '"]'));
        return newValueButton.not.isPresent();
    };

And in spec file I call this function as follows:
var twentyEurosButtonAttributeValue = '2000';

describe("....
    it ("...
        expect(predefined.newValueButtonIsNotPresent(twentyEurosButtonAttributeValue)).toBeTruthy();

I know this is not correct, but how I can achieve something like that or is there another way?

A: Stupid me, I found a simple solution. Instead dynamically locating an element I located the first on the list, which is always the one, which was newly added and then checked if it's text does not match:
Page object file:
this.newValueButtonIsNotPresent = function() {
        newValueButton = browser.element(by.id("containerQUICK_ADD_POINTS")).all(by.tagName('li')).first();
        return newValueButton.getText();
    };

Spec file:
// verify element 20.00 EUR is not present
predefined.newValueButtonIsNotPresent().then(function(value) {
    expect(value).not.toEqual(twentyEurosText);
});


text:
Q: Trigonometry equation simplification So, I've been given the trig equation: $$\csc^2x - \cot 2x = 1$$ Using the identity and rearranging $$\cot^22x + 1 = \csc^22x$$ the equation simplifies to $$\cot^22x - \cot2x = 0$$ factoring out $\cot 2x$ $$ \cot 2x (\cot 2x -1) = 0$$ I've bee told to solve $\forall x | 0\leq x\leq180$
So... $$ \cot 2x = 0 $$or$$ \cot 2x = 1 $$
$$ \frac{1}{\tan2x} = 0 \Rightarrow 1 = 0 \times \tan 2x $$ therefore no solutions.
$$ \cot 2x = 1 \Rightarrow \tan 2x = 1 $$ $$ x\in\{22.5,112.5\}$$
Both of my solutions were correct, but I lost marks since apparently there are two extra solutions! 45 & 135 degrees. I don't know where I went wrong in my workings and was wondering if someone could tell me what I did wrong.
-Thanks

A: cot 2x = 0
cot 2x = cot 90
As cot 90 = 0
2x = 90
x = 45
So $ x\in\{45,135\}$


text:
Q: .Net 1.1 can't run debugging in Visual Studio 2003 I'm trying to start WebProject in VS2003, but I got the error:"Unable to start debugging on the web server. The project is not configured to be debugged."
I use Visual Studio 2003 on WinXP on virtual drive with IIS 5.1
I already tried to change properties on catalog, where project placed. It didn't make any change. Is there any solution for this?


text:
Q: Are grequests responses in the same order as the requests? I am using the grequests to asynchronously download data from a website using the same url but different parameters.
For example,
unsent_requests = []
for param in params: # assume params is a list containing different parameters or query strings
    unsent_requests.append(grequests.get(url = url, params = param))

responses = grequests.map(unsent)

How can I possibly get to know which response from responses belongs to which request from unsent_requests? Or are the responses in the same order as the unsent requests?
PS: response.url does not give any clue because a completely different url returns.

A: Responses are in the same order as the requests, as shown in the usage example:
>>> reqs = [
...    grequests.get('http://httpbin.org/delay/1', timeout=0.001),
...    grequests.get('http://fakedomain/'),
...    grequests.get('http://httpbin.org/status/500')]
>>> grequests.map(reqs, exception_handler=exception_handler)
Request failed
Request failed
[None, None, <Response [500]>]

A: No, they are not, the very nature of asynchronous requests means that despite being processed in order, the actual responses are not guaranteed to be in order.
This is why the response contains the originalrequest, which you can see by iterating through the result of map and printing response.request.url.


text:
Q: Intellij on Linux: Menu: jdk > javap option I use Intellij community 2018 on Ubuntu. How can I have a jdk option in the menu that appears after right clicking inside the editor window?
I don't know if this option is built into the IDE or some external plugin.
This jdk option should have (at least) 2 javap options to disassemble class files.
See the following screen shot. Taken from an older Intellij on Mac.

A: You can configure an external tool to run javap on the active file using the $FilePath$ macro as an argument. Set the tool group to jdk.
If you want to get the output for the .class file while right clicking inside the source .java file, you may use something like this for the argument: $OutputPath$/$FileDirRelativeToSourcepath$/$FileNameWithoutExtension$.class
Note that IntelliJ IDEA has a built-in disassembler and some third-party plug-ins to view the byte code, so you may not need this tool at all.


text:
Q: Battery wasting via voltage regulator I made a circuit for a tape (or block) LED that will turn on with 12V.
I had two 9V batteries, so to convert them to 12V supply that is suitable for LED I used two linear 8V and 5V regulators - connecting them together  gave me an almost 13V supply.
That worked but what happened is that after a few days the batteries wasted and drops to 0V and 2V. (The lights were off and that happened.)
What's the problem in my circuit? Are the linear regulators wasting power?

A: The 7800 series of regulators take a quiescent current of a few milliamps.  This is probably what's burning down your 9V batteries when you're not operating the unit.  Modern LDOs can be had with quiescent currents in the microamp range.
When operating, your efficiency is under 70%--not bad for really low duty cycle, but if your on time is significant you might consider a switching supply.  Second choice would be to put the batteries in series and use a single LDO with low Iq to regulate from 18 to 13V.

A: Your Linear Regulator configuration is not optimal, and as @Cristobol already mentioned, their quiescent current is draining your battery. The quiescent current problem could be improved if you physically disconnect the batteries if the circuit is not in operation as shown in the following picture:

If you are comfortable with DCDC converters, you could also use a boost converter, e.g.  LM2733 and connect both batteries in parallel as follows:

A typical arrangement for the boost converter is shown in the following picture (feedback resistors must be accordingly defined to obtain 13V):


text:
Q: auth issues with angular and firebase, undefined is not a function, how to? i am trying to use the firebase user authentication and management to register, login, etc a user
but i have issues getting $getAuth() or $createUser(), they come in as undefined is not a function, also $getCurrentUser() seems to be missing
example:
angular.module('starter.services', [])

    .factory('Auth', function ($q, $firebase, FBURL, $location, $rootScope, localStorageService) {

        var ref = new Firebase(FBURL);
        var auth = $firebase(ref);

console.log(auth.$getAuth()); //undefined is not a function

any ideas?
i am using AngularFire 0.9.0, Firebase v2.0.4, AngularJS v1.3.3.

A: You seem to have some copy/paste/modify errors from the examples. $getAuth is an AngularFire method, so it is not defined on a regulare Firebase JavaScript ref.
The simplest example I could quickly code up:
angular.module('app', ['firebase'])
  .constant('FBURL', "https://your.firebaseio.com")
  .factory("Auth", function($firebaseAuth, FBURL) {
    var ref = new Firebase(FBURL);
    return $firebaseAuth(ref);
  })
  .controller('MainCtrl', function ($scope, Auth) {
    $scope.auth = Auth;
    console.log(Auth.$getAuth());
  })
;

Note that this will only log something meaningful if the user is logged in, otherwise it will log null.


text:
Q: Huge memory leak / bloat after Upgrading from Rails 3.0 to Rails 3.2 (Ruby 1.9.3 + Passenger) Last week we upgraded a small project which was running on Rails 3.0.1 to Rails 3.2.2.
Shortly after the upgrade we recognized that occasionally, 2-3 times a day, we're seening a huge Phusion Passenger process (1-5 GB).
We're running Phusion Passenger 3.0.11 and Ruby 1.9.3-p0. We already tried different Ruby version (1.9.2-p290 and 1.9.3-p125) without a success.
Afterwards, we tried to track our memory usage with Oink. Unfortunately Oink doesn't show the reason for the memory bloat - The large processes seem to not write to the logfiles anymore.
When we downgraded back to Rails 3.0.1 the problem is gone. Does anyone have similar problems? We really checked our code for possible memory leaks, such as too many ActiveRecord instances, but didn't find any.
Do you think it's worth it to try Unicorn instead of Passenger? Or is it likely that we'll run into the same problem?
Any suggestions about how to trace the memory leak are welcome. We already set up newrelic, but it doesn't show detailed information about the memory leak.

A: If this is Red Hat compatible Linux, you can use SystemTap. I am not sure if SystemTap is available on Debian/Ubuntu systems, if not there is alternative called DTrace. Here are some articles - I have been pretty successful with tracking down several regressions, although none of these were memory issues (maybe you can find a STP script that could do the trick for you). Read here:
http://lukas.zapletalovi.com/2012/02/peek-into-your-ruby-app-with-systemtap.html
http://lukas.zapletalovi.com/2012/01/probing-ruby-apps-with-systemtap-in.html
http://sourceware.org/systemtap/wiki/RubyMarker
The last link shows probes you can hoop into in SystemTaps in Ruby. There are thinks like gc runs or memory allocations, could help you. Good luck!

A: I would be interested to know what passenger-memory-stats shows and what type of Memory you have passenger set for PassengerMaxPoolSize PassengerPoolIdleTime and any other passenger settings.
How did you upgrade passenger?
What is your apache setup like?  prefork or worker?
I suspect that you are seeing poor gc performance, attempt to tune them by putting this in a wrapper around the ruby that passenger uses:
#!/bin/sh
export RUBY_HEAP_MIN_SLOTS=600000
export RUBY_GC_MALLOC_LIMIT=59000000
export RUBY_FREE_MIN=200000
exec "/usr/bin/ruby" "$@"

It should fix some performance issues you are seeing in general due to poor ruby gc defaults.


text:
Q: Rendering components inside Lightning Email Templates Is it possible to reference a lightning component or any other component inside a lightning email template?
For example with classic email templates we can use components if visualforce email template type is selected, more complex logic and custom css can be used by utilizing components and pages in this way.


text:
Q: IP Telephone call to RTP Stream Can anyone please tell me if it is possible to publish the voice from an IP based telephone to a RTP based media server - like a Wowza Media Server or Flash Media Server?
Thanks

A: You probably need to give more info if you want a more specific answer, but a quick response is that yes it is possible.
If the IP phones is something you are building or can modify then you can simply send any outgoing RTP packets both to the other end of the call and the media server, and forward any received RTP packets to the media server.
If you are not able to modify the phone, then you may still be able to achieve what you are looking for by 'mirroring' the RTP packets that are sent to and received from the IP phone, to the RTP media server (see http://en.wikipedia.org/wiki/Port_mirroring for an overview of port mirroring, and www.audiocodes.com/filehandler.ashx?fileid=43289 for some specific discussion on 'tapping' phone calls).
Note, that you need to be aware of the law if this is to record or 'tap' live calls. Even if they are your own calls on your own phone, different countries have different laws about what can and cannot be recorded and what notification you have to give the parties involved in the call (this is why calls to call centers etc often start with a message that the call may be recorded for training or other purposes).


text:
Q: How to have a button that sends more than one value back to the ActionResult with jquery? I have this button with which I want to send data back to the ActioResult. I want to send and id and an entity name. The id works fine, but when I also want to send the entity name it does not work. How do I send back multiple variables to the ActionResult? This is my html/javascript:
@model test.Web.Framework.Areas.Administration.Models.TabNotesModel
@using (UI.DocumentReadyScript())
{
    if (Model.meta.id.HasValue)
    {
        UI.jQuery("#tbl" + Model.meta.modelname).flexigrid(Model.Grid);
        }
    }
<form method="post" action="@Url.Action("TabNotes", new { cmd = "refresh" })"  id="@Model.meta.modelname">

@using (UI.BeginBlock("Administation.TabNotes", UI.Label("Notes", "Notes").ToString(), test.Web.Framework.Core.enumIcons.pencil, false, false))
{

}
</form>

<button type="button" id="load-partial">Create Note</button>

and my ActionResult. The modelEntity stays null. The itemId does get the number.
   public ActionResult CreateNote(
        [ModelBinder(typeof(Models.JsonModelBinder))]
        NoteModel Model, string cmd, long? itemId, string modelEntity)
    {

        if (cmd == "Save")
        {
            Model.meta.message = "Note saved";
            Entity entity = NotesRepository.GetEntity(modelEntity);
            NotesRepository.StoreNote(Model.subject, Model.text, entity, itemId);
            return RedirectToAction("TabNotes", new { modelEntity = modelEntity, id = itemId});
        }

        Model.meta.modelname = "CreateNote";
        Model.meta.JsViewModelType = "EditNoteModel";
        Model.meta.PostAction = Url.Action("CreateNote", new { cmd = "Save", itemId = itemId, modelEntity = modelEntity});

        return PartialView("CreateNotePartial",Model);

        }

A: Url.Action only takes route values there, so you I think you need a route to cope with the second parameter. I assume your current route already has itemId which is why it works.


text:
Q: When does a browser send HTTP payload separately from the HTTP request? Under what circumstances would you expect a web browser split an HTTP request into two IP packets, even if the sum of the packet sizes is still less than the maximum segment size? I would assume that this would always be sent as a single packet, but my experience is showing otherwise.
Using Microsoft Network Monitor to analyze HTTP traffic, I occasionally see a request that is divided into two IP packets, as shown below
HTTP:Request, POST /foobar.htm (PacketID=55178, TotalLength=528)
  POST /foobar.htm HTTP/1.1
  Content-Type: application/x-www-form-urlencoded
  ...etc...

HTTP:HTTP Payload, URL: /foo.htm (PacketID=55179, TotalLength=98)
  param1=foo&param2=bar&param3=foo+bar

I've only seen this happening on Windows XP clients so far, but it doesn't happen on all XP clients. And on the affected systems, both IE8 and Firefox exhibit the same double-packet behaviour.

Some context: We recently started using a third-party software package that provides a web application on our intranet. But instead of using a real web server like IIS or Apache, the software implements its own HTTP server internally.
Because the server uses a naive implementation of HTTP, it only inspects the first packet of an HTTP request, and misses the arguments sent in the second packet. This causes the request to fail.

A: It's random and unpredictable, and if you care, you are doing something horribly wrong.

Because the server uses a naive implementation of HTTP, it only inspects the first packet of an HTTP request, and misses the arguments sent in the second packet. This causes the request to fail.

I can't figure out what you're trying to say there. If it's actually looking at packets, it's an implementation of TCP, not HTTP (since the packets are packets according to the TCP specification). A sensible HTTP implementation would never be looking at packets at all.
If you really mean the HTTP server looks at the packets, then it has to reconstruct the TCP data stream and then follow the HTTP protocol. The end of an HTTP request is marked with two <CRLF>s in the TCP byte stream. Any other method of detecting the end of an HTTP request is broken.
Since the first packet does not contain an HTTP end-of-request sequence, it clearly cannot contain the entire request.
An HTTP server must follow the HTTP specification, or it's not an HTTP server. The HTTP specification only specifies what bytes go in the TCP data stream. It says nothing about segmentation, which is good because in practice applications would have no way to control that. It specifies how the end of a request is identified, and code that doesn't comply with that specification is not an HTTP server. It implements an HTTP-like protocol that may or may not be compatible with HTTP.

A: How are the POSTs in question being made - are the ones that are spilt made via XMLHTTPRequest i.e. AJAX?
AJAX POSTs send the headers and body as at least two separate TCP packets.
There's a blog post about it on the Yahoo developer network from a few years back.


text:
Q: Downloading photos from Facebook group pages I'm trying to set up an easy way for folks to share photos for a reunion, then use those photos in a slideshow.
Since everybody is on facebook, that would be the preferred method.
There is already a facebook group in place for the reunion.
When folks start adding photos, what would be the best way to download those photos without relying on outside 3rd-party web services?
I tried a few browser plugins/extensions, but they were a few years old and didn't work (I assume because of the changes facebook has gone through since the plugins were last updated).
Any suggestions?

A: I list below several solutions which might help you in downloading group photos.
Not having a Facebook group I cannot test them, so you will have to check which one
works well for your group.
Website: PicknZip
Applications: Fotobounce, PhotoGrabber, fbDownloader
Android: PicDownloader
iPhone: PhotoJacker
Browser: Save-images extensions exist for all major browsers.

A: Facebook no more support this function.
https://developers.facebook.com/docs/reference/api/group/
Once there was "photos" object, now they removed it (maybe privacy issue???)
If they dont take it back it will be "harder" to download photos, since you cant do any automatic task without api access.
When they wil take back this api you can use this method to retrieve a json object with photo links:
https://stackoverflow.com/questions/4869595/retrieve-photos-from-a-facebook-group-using-the-graphapi


text:
Q: Continuity of a function proof approach Given a positive number b and a set E ⊆ R, let us say that a function f : E → R has
property X(b) on E provided that for each pair x, y ∈ E, |f(y) − f(x)| ≤ b|y − x|
How do I go about showing that if f has property X(b) on E then f is continuous on E?
what is the intuition here?

A: If $f(x)$ has property $X(b)$ on $E$ , then we can get that for any $\epsilon > 0$ , we can get a $0 <\delta < \frac \epsilon b $ set $|y-x| < \delta$ , follows
$$
|f(y) - f(x)| \le b|y-x| <\epsilon
$$
that's the definition of Uniform convergence


text:
Q: subprocess.run managing optional stdin and stdout In python >= 3.5 we can give optional stdout, stdin, stderr to  subprocess.run()
per the docs:

Valid values are PIPE, DEVNULL, an existing file descriptor (a positive integer),
  an existing file object, and None. PIPE indicates that a new pipe to the child
  should be created

I want to support passing through (at least) None or existing file objects whilst managing resources pythonically.
How should I manage the optional file resources in something like:
import subprocess

def wraps_subprocess(args=['ls', '-l'], stdin=None, stdout=None):
    # ... do important stuff
    subprocess.run(args=args, stdin=stdin, stdout=stdout)

A: A custom contextmanager (idea taken from this answer) seems to work:
import contextlib

@contextlib.contextmanager
def awesome_open(path_or_file_or_none, mode='rb'):
    if isinstance(path_or_file_or_none, str):
        file_ = needs_closed = open(path_or_file_or_none, mode)
    else:
        file_ = path_or_file_or_none
        needs_closed = None
    try:
        yield file_
    finally:
        if needs_closed:
            needs_closed.close()

which would be used used like
import subprocess
def wraps_subprocess(args=['ls', '-l'], stdin=None, stdout=None):
    # ... do important stuff
    with awesome_open(stdin, mode='rb') as fin, awesome_open(stdout, mode='wb') as fout:
        subprocess.run(args=args, stdin=fin, stdout=fout)

But I think there is probably a better way.


text:
Q: Converting mouse position functionality to work with touchscreen I'm developing in Unity, C#, and I have a bit of code that checks for player activity based on mouse position and it's working well but I'm needing to also check player activity on a touchscreen (not a mobile phone touchscreen, but a touchscreen attached to a pc). How should I modify the code that I have below to also work with touch?
    private void Start()
    {
        InvokeRepeating("LastMousePosition", 0, _checkMousePositionTimingInterval);
    }

    private void Update()
    {
        _currentMousePosition = Input.mousePosition;
    }

    void LastMousePosition()
    {
        _prevMousePosition = Input.mousePosition;
    }

    void CheckPlayerIdle()
    {
        if (_currentMousePosition != _prevMousePosition)
            UserActive = true;
        else if (_currentMousePosition == _prevMousePosition)
            UserActive = false;
    }

A: Well for touch you start your inactivity timer if you don't get any touch inputs and wait for x duration.
for eg:
private void Update()
{
  if(Input.touchCount == 0)
  {
    if(!checkingForInactivity)
    {
      checkingForInactivity = true;
      myRoutine = StartCoroutine(CheckForInactivity());
    }
  }
  else
  {
    if(checkingForInactivity) StopCoroutine(myRoutine);
  }
}

 Ienumrable CheckForInactivity()
 {
   yield new waitForSecond(3.0f);
   //user is inactive
 }
}


text:
Q: Performance of Column Family in Cassandra DB I have a table where my queries will be purely based on the id and created_time, I have the 50 other columns which will be queried purely based on the id and created_time, I can design it in two ways,

*

*Either by multiple small tables with 5 column each for all 50 parameters

*A single table with all 50 columns with id and created_at as primary
key

Which will be better, my rows will increase tremendously, so should I bother on the length of column family while modelling?

A: Actually, you need to have small tables to decrease the load on single table and should also try to maintain a query based table. If the query used contains the read statement to get all the 50 columns, then you can proceed with single table. But if you are planning to get part of data in each of your query, then you should maintain query based small tables which will redistribute the data evenly across the nodes or maintain multiple partitions as alex suggested(but you cannot get range based queries).

A: This really depends on how you structure of your partition key & distribution of data inside partition.  CQL has some limits, like, max 2 billion cells per partitions, but this is a theoretical limit, and practical limits - something like, not having partitions bigger than 100Mb, etc. (DSE has recommendations in the planning guide).
If you'll always search by id & created_time, and not doing range queries on created_time, then you may even have the composite partition key comprising of both - this will distribute data more evenly across the cluster. Otherwise make sure that you don't have too much data inside partitions.
Or you can add another another piece into partition key, for example, sometimes people add the truncated date-time into partition key, for example, time rounded to hour, or to the day - but this will affect your queries.  It's really depends on them.

A: Sort of in line with what Alex mentions, the determining factor here is going to be the size of your various partitions (which is an extension of the size of your columns).
Practically speaking, you can have problems going both ways - partitions that are too narrow can be as problematic as partitions that are too wide, so this is the type of thing you may want to try benchmarking and seeing which works best. I suspect for normal data models (staying away from the pathological edge cases), either will work just fine, and you won't see a meaningful difference (assuming 3.11).
In 3.11.x, Cassandra does a better job of skipping unrequested values than in 3.0.x, so if you do choose to join it all in one table, do consider using 3.11.2 or whatever the latest available release is in the 3.11 (or newer) branch.


text:
Q: Building a Visual Studio Package based on another one I want to add my own project type based on IronStudio. So,

*

*I downloaded the source for and compiled the latest version of IronPython, then

*I created a new Visual Studio Package.

*I added the Templates\Projects\MyProject folders, and added a file to it, and set its property "Include in VSIX" to true.

Then modified the main Package class to be derived from IronStudio's PythonProjectPackage instead, and set the ProvideProjectFactory property:
[ProvideProjectFactory(
    typeof(PythonProjectFactory),
    "Django Project",
    "Django Project Files (*.myproj);*.myproj",
    "myproj", "myproj",
    @"Templates\Projects\MyProject",
    LanguageVsTemplate="MyProject")]
public sealed class MyPackage : PythonProjectPackage

And ran it. But MyProject isn't showing up in the project templates. Why not?
The generated .pkgdef file looks like this:
[$RootKey$\InstalledProducts\VSPackage3Package]
@="#110"
"Package"="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
"PID"="1.0"
"ProductDetails"="#112"
"LogoID"="#400"
[$RootKey$\Packages\{5cd7435c-7461-459f-80bc-c0c79e9d462f}]
@="Microsoft.VSPackage3.VSPackage3Package, VSPackage3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a4f1577d825253f8"
"InprocServer32"="$WinDir$\SYSTEM32\MSCOREE.DLL"
"Class"="Microsoft.VSPackage3.VSPackage3Package"
"CodeBase"="$PackageFolder$\VSPackage3.dll"
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}]
"Package"="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}\Extensions]
"py"=dword:00000020
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}\LogicalViews]
"{7651a701-06e5-11d1-8ebd-00a0c90f26ea}"=""
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}\LogicalViews]
"{7651a702-06e5-11d1-8ebd-00a0c90f26ea}"=""
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}\LogicalViews]
"{7651a703-06e5-11d1-8ebd-00a0c90f26ea}"=""
[$RootKey$\CLSID\{888888fd-3c4a-40da-aefb-5ac10f5e8b30}]
@="Microsoft.IronPythonTools.Project.PythonGeneralPropertyPage"
"InprocServer32"="$WinDir$\SYSTEM32\MSCOREE.DLL"
"Class"="Microsoft.IronPythonTools.Project.PythonGeneralPropertyPage"
"CodeBase"="$PackageFolder$\VSPackage3.dll"
"ThreadingModel"="Both"
[$RootKey$\Projects\{888888a0-9f3d-457c-b088-3a5042f75d52}]
@="PythonProjectFactory"
"DisplayName"="My Project"
"DisplayProjectFileExtensions"="My Project Files (*.myproj);*.myproj"
"Package"="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
"DefaultProjectExtension"="myproj"
"PossibleProjectExtensions"="myproj"
"ProjectTemplatesDir"="$PackageFolder$\Templates\Projects\MyProject"
"Language(VsTemplate)"="MyProject"
[$RootKey$\NewProjectTemplates\TemplateDirs\{5cd7435c-7461-459f-80bc-c0c79e9d462f}\/1]
@="My Project"
"SortPriority"=dword:00000064
"TemplatesDir"="$PackageFolder$\Templates\Projects\MyProject"
[$RootKey$\Projects\{888888a0-9f3d-457c-b088-3a5042f75d52}]
@="PythonProjectFactory"
"DisplayName"="IronPython"
"DisplayProjectFileExtensions"="IronPython Project Files (*.pyproj);*.pyproj"
"Package"="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
"DefaultProjectExtension"="pyproj"
"PossibleProjectExtensions"="pyproj"
"ProjectTemplatesDir"="$PackageFolder$\.\NullPath"
"Language(VsTemplate)"="IronPython"
[$RootKey$\NewProjectTemplates\TemplateDirs\{5cd7435c-7461-459f-80bc-c0c79e9d462f}\/1]
@="IronPython"
"SortPriority"=dword:00000064
"TemplatesDir"="$PackageFolder$\.\NullPath"
[$RootKey$\Services\{b98e41c4-581e-3532-beee-06829b683d39}]
@="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
"Name"="IPythonStarter"

I just want to get the bare bones up and running so I can start overriding some functionality (like the Add New Item dialog).

A: Update:
Reading my initial analysis once again increases my impression that some of the required components are missing (e.g. a dedicated ProjectFactory) and/or wired up incorrectly - from the MSDN documentation of the ProvideProjectFactoryAttribute Class:

ProvideProjectFactoryAttribute declares that a package provides a project factory.

And further:

If a VSPackage declares that it provides a project factory, it should create the factory and offer it to Visual Studio in the Initialize method of the Package-derived class.

You package is declaring to provide PythonProjectFactory, but (likely) doesn't offer it to VS, rather it is offered by the IronPython package. In turn you are providing arguments within the ProvideProjectFactory attribute list which PythonProjectFactory won't know about when asked for by VS.
Consequently you should at least provide a dedicated ProjectFactory yourself as per the walkthrough, wire up the classes accordingly and see how this turns out regarding the issues outlined below.

Initial analysis:
There appear to be several issues here at first sight - have you followed any tutorial on how to do this? In case, please note that some of those easily discoverable via search engines are outdated still. Either way I'd try working through and/or comparing your result with Walkthrough: Part 1 - Creating a Basic Project System from the MSDN documentation for VS 2010; please note that even this one is claimed to be outdated a bit according to the Community Content section on the bottom of the page.
Here is what I'd look into myself given the code you present, comparing with the walkthrough on the fly for more insights:

*

*You realized already that the duplicate fragment starting with the GUID above PythonProjectFactory doesn't make sense - this is essentially trying to register two packages at once, which, even if allowed at all syntactically (which I doubt), can't possibly work like so due to both being registered with the same GUID [cross checking with the sample file in section Examining the Template Registration confirms this suspicion, as expected there is only one such fragment].

*

*Please note that the GUID in question is the one identifying PythonProjectFactory (as per the respective source code), see below for more on this.

        [Guid(PythonConstants.ProjectFactoryGuid)]
        public class PythonProjectFactory : ProjectFactory {

*

*Given .pkgdef is a generated file the next question is where this duplication/violation stems from. When two generated artifacts end up with the same GUID the respective definition in the sources is most likely messed up somehow, usually due to copy&paste duplication. Consequently you should verify whether {5cd7435c-7461-459f-80bc-c0c79e9d462f} is defined and referenced as intended, though here might be one or two other causes as well for this, see below.

*A Package class needs to be identified by a GUID and the VS wizard generates some already in Guids.cs and references it accordingly on the class definition, however, the following is missing in your fragment [cross checking with the sample fragment in section To register the project template confirms this omission as well]:
    [Guid(GuidList.guidMyPackagePkgString)]
    public sealed class MyPackage : Package

*

*Likewise it appears incorrect to derive MyPackage from PythonProjectPackage but reference PythonProjectFactory still rather than providing MyFactory as well (including a dedicated GUID), because the latter tells Visual Studio the location of your project template folder [see section Creating a Skeletal Project Factory]:

*

*While it might well be possible to simply reuse all functionality from the base class PythonProjectFactory, inheriting is likely required simply because the factory must have a dedicated GUID too (as outlined in the walkthrough) in order to properly wire up the attribute specified data.

*Likely unrelated, but still suspicious is that your two code blocks don't relate, as the Package class definition specifies Django Project Files (*.myproj);*.myproj, yet the result shows My Project Files (*.myproj);*.myproj.

*

*Have you by chance mixed this from different builds or is this really a result of a clean one?

Good luck!

A: This stackoverflow posting might be helpful: VS2010: VSIX installation doesn't deploy item templates inside it
If this is not what you're looking for, try to see if you're missing something around the creation of custom project templates, I believe that's where the "missing link" is:

*

*For VS 2008:
http://blogs.msdn.com/b/webdevelopertips/archive/2008/12/02/tip-32-did-you-know-how-to-easily-create-your-own-project-templates.aspx

*For VS 2010:
http://blog.reybango.com/2010/09/21/how-to-create-html5-website-and-page-templates-for-visual-studio-2010/

*

*and on MSDN:
http://msdn.microsoft.com/en-us/library/s365byhx.aspx

*and here is how to create a project
template manually:
http://msdn.microsoft.com/en-us/library/ms185291.aspx

*and here is how to create a new item template in VS 2010: http://msdn.microsoft.com/en-us/library/ms247113.aspx
Hope this helps

A: $PackageFolder$.\NullPath may have something to do with it.


text:
Q: Error while using JIC for image compression in client-side Using a solution in this question by brunobar79. My problem is that I am getting the following error;

Uncaught TypeError: Failed to execute 'drawImage' on
'CanvasRenderingContext2D': The provided value is not of type
'(CSSImageValue or HTMLImageElement or SVGImageElement or
HTMLVideoElement or HTMLCanvasElement or ImageBitmap or
OffscreenCanvas)'

My JS;
<script type="text/javascript">
var jic = {
        compress: function(source_img_obj, quality, output_format){

             var mime_type = "image/jpeg";
             if(typeof output_format !== "undefined" && output_format=="png"){
                mime_type = "image/png";
             };

             var cvs = document.createElement('canvas');
             cvs.width = source_img_obj.naturalWidth;
             cvs.height = source_img_obj.naturalHeight;
             var ctx = cvs.getContext("2d").drawImage(source_img_obj, 0, 0);
             var newImageData = cvs.toDataURL(mime_type, quality/100);
             var result_image_obj = new Image();
             result_image_obj.src = newImageData;
             return result_image_obj;
        },
}
function myFunction(){
    var source_img = document.getElementById("source_img"),
        target_img = document.getElementById("target_img");
    var quality =  80,
    output_format = 'jpg';
    target_img.src = jic.compress(source_img,quality,output_format).src;
    console.log("I am a myFunction!");
};
</script>

snippet of my HTML;
<form>   <img src="" id="target_img"> </form>
<button onclick="myFunction()" >compress</button>

Another developer has added the HTML/Python code hence not really sure what to add here from that. The <form> has source_img defined as an ID in it.
The client's requirement is that when an image, once selected, should get compressed and then placed in <img> after the compress button is clicked.This is the first time I am using image compression using JS in the client-side and I am considerably new to JS. Please advise.


text:
Q: Set value button programmatically If I had 100 buttons I want to set text = "Save" and the id is an auto number like saveButton_1, saveButton_2 what the best way to do it? The button isn't dynamic generated can be accessed via code behind.
Current I do it like this but seem to long.
saveButton_1.value = saveButton_2.value ... till 100 = "Save"

A:     foreach (Button btn in this.Controls.OfType<Button>())
    {
        btn.Text = "Save";
    }

A: Expanding a bit @Adil 's answer, if you have your buttons within a container you can get them using the HtmlButton type
IEnumerable< HtmlButton> btns = buttonContainer.Controls.OfType<HtmlButton>();

if(btns != null)
{
     //get only the ones that have a special class to know which ones you need to update
     var btnList = btns.Where(x => x.Attributes["class"] == "save-button");

     //update the text for all that passed the filter
     foreach(HtmlButton ctrl in btnList)
     {
        ctrl.InnerText = "Save Me";
     }
}

Html
<div id="buttonContainer" runat="server">
    <button id="save1" type="button" class="save-button"  runat="server">save 1</button>
    <button id="save2" type="button" class="save-button" runat="server">save 1</button>
    <button id="save3" type="button" class="save-button" runat="server">save 1</button>
    <button id="save4" type="button" class="save-button" runat="server">save 1</button>
    <button id="save5" type="button" runat="server">not save</button>
    <button id="save6" type="button" class="save-button" runat="server">save 1</button>
    <button id="save7" type="button" class="save-button" runat="server">save 1</button>
    <button id="save8" type="button" class="save-button" runat="server">save 1</button>
    <button id="save9" type="button" class="save-button" runat="server">save 1</button>
</div>

If you don't have the button on the same container then you  will need to loop through the controls you have in order get to the proper htmlbuttons


text:
Q: Release fixes with only some changes from CVS trunk without using branches I have this kind of situation:
CVS trunk - all changes, stable ad unstable, are made to trunk.
production - major releases are made creating tags on CVS, but minor fixes are made manually, merging only the requested changes from trunk.
I'm not allowed to use branches, so I need an alternative solution to simplify or automate the process, because right now the risk of errors is too high.
Can anyone help me? Thanks!

A: You're right, that simple solution you're looking for - it's called branching.
Why are you not allowed to use branches? is it programmatically enforced?  That's you're problem, and it is solvable - hopefully by canning the guy who forbids you.


text:
Q: cfscript - uploading a file I'm trying to upload a file using cfscript on a CF11 server
But every time I upload a file it rejects the mime type.
Sample error:
"The MIME type or the Extension of the uploaded file text/plain was not accepted by the server."
There is little documentation on ColdFusion, even less on ColdFusion script. Please help. .
Here's the code:
// define allowed file types
allowed_filetypes = {
   txt="text/plain",
   pdf="application/pdf",
   doc="application/msword",
   ppt="application/vnd.ms-powerpoint",
   xls="application/vnd.ms-excel"
};

mime_arr = [];
for (key in allowed_filetypes
{
    ArrayAppend(mime_arr, allowed_filetypes[key]);
}
allowed_mimetypes = '"' & ArrayToList(mime_arr, '","') & '"';

//upload file
if( structKeyExists( form, "thefile_input" )) {

    allowed_extensions = lcase(StructKeyList(allowed_filetypes,","));

    try {
        uploadedFile = fileUpload( getTempDirectory(), "thefile_input", allowed_mimetypes, "MakeUnique" );

        // move uploaded file to destination...
    }
    catch ( any e ){
        writeOutput( e.message );
    }
}

A: stupid mistake.
I needed to adjust this line to:
    allowed_mimetypes = ArrayToList(mime_arr, ',');


text:
Q: Analyzing huge amount of JSON files on S3 I have huge amount of json files, >100TB size in total, each json file is 10GB bzipped, and each line contain a json object, and they are stored on s3

*

*If I want to transform the json into csv (also stored on s3) so I can import them into redshift directly, is writing custom code using hadoop the only choice?

*Would it be possible to do adhoc query on the json file without transform the data into other format (since I don't want to convert them into other format first every time I need to do query as the source is growing)

A: The quickest and easiest way would be to launch an EMR cluster loaded with Hive to do the heavy lifting for this. By using the JsonSerde, you can easily transform the data into csv format.  This would only require you to do a insert the data into a CSV formatted table from the JSON formatted table.
A good tutorial for handling the JsonSerde can be found here:
http://aws.amazon.com/articles/2855
Also a good library used for CSV format is:
https://github.com/ogrodnek/csv-serde
The EMR cluster can be short-lived and only necessary for that one job, which can also span across low cost spot instances.
Once you have the CSV format, the Redshift COPY documentation should suffice.
http://docs.aws.amazon.com/redshift/latest/dg/r_COPY.html


text:
Q: Winform BindingSource does not get Initialized I have a few forms where the controls are bound to a BindingSource. I am saving the data to the database when user clicks 'Save' button. The controls are bound so that I do not have to detect the changes manually.
Everything works as expected except when the users close the form and then reopen it. It looks like the BindingSource does not get initialized second/subsequent time. Because the call below returns null on reopen (after setting the datasource)
Supplier currentSupplier = (Supplier)supplierBindingSource.Current;

The interesting part is that the data gets displayed. So it is successfully setting the data source.
However if I dispose the BindingSource and set it to null on form closed event, then it throws NullExceptionReference on the same code above when the form is shown second time. And this time the code celow in the constructor does not work:
supplierBindingSource.DataSource = qry;
The forms open on a Mdi container. I tried opening as a separate form and also as Dialog. But nothing seems to work.