text:
Q: Image resolution for android canvas drawings with zooming In my android app I download a image from Url and then scale accroding to the screen size before drawn on canvas as follows. This canvas can be zoomed out till 1.5x.
1) What is the best resolution for these images assuming I am supporting phones and tablets.
 InputStream is = conn.getInputStream();
    BufferedInputStream bis = new BufferedInputStream(is);
    bm = BitmapFactory.decodeStream(bis);
    Bitmap scaledBitmap = Bitmap.createScaledBitmap(bm,
                                    (int) width, (int) height, true);
    //width height are 0.75 of screen width height
    bm.recycle();
    bm = scaledBitmap;

2) I then segment the image into 10 pieces using path objects as follows and outline to the image. Outlines are not that sharp in unzoomed and zoomed images. Howto improve the line smoothness and quality.
Bitmap piecePicture = Bitmap.createBitmap(100, 100,Bitmap.Config.ARGB_8888);

Canvas gfx = new Canvas(piecePicture);
// Canvas gfx = new Canvas(bm);
Paint whitePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
whitePaint.setColor(Color.WHITE);
whitePaint.setStyle(Paint.Style.FILL_AND_STROKE);
whitePaint.setStrokeWidth(1);

                           //translatedFigure is the path object
gfx.drawPath(translatedFigure, whitePaint);

Paint paint = new Paint();
paint.setXfermode(new PorterDuffXfermode(
android.graphics.PorterDuff.Mode.SRC_IN));

gfx.drawBitmap(sourcePicture, 0,
0, paint);

Paint mPaint = new Paint(Color.RED);
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mPaint.setStrokeJoin(Paint.Join.ROUND);
mPaint.setStrokeCap(Paint.Cap.ROUND);

EmbossMaskFilter mEmboss = new EmbossMaskFilter(new float[] { 1, 1, 1 }, 0.4f, 6, 3.5f);
//new EmbossMaskFilter(new float[] { 1, 1, 1 }, 0.4f, 6, 3.5f);
BitmapShader fillBMPshader = new BitmapShader(piecePicture, TileMode.MIRROR, TileMode.CLAMP);
 mPaint.setShader(fillBMPshader);
                mEmboss = new EmbossMaskFilter(new float[] { 1, 1, 1 },0.4f, 6, 3.5f);

mPaint.setMaskFilter(mEmboss);

gfx.drawBitmap(piecePicture, 0,0, mPaint );

  //outline pen
Paint outlinePen = new Paint(Color.BLACK);
outlinePen.setStyle(Paint.Style.STROKE);
outlinePen
.setStrokeWidth(1);
outlinePen.setAntiAlias(true);

gfx.drawPath(translatedFigure, outlinePen);

A: set these flags before drawing the bitmap on the canvas.
paint.setFlags(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG);


text:
Q: ASP.NET Forms Authentication between Applications with different form credentials I have an application running ASP.NET on 3.0 framework that uses form authentication. I am now building and MVC 4 application that also uses forms authentication and I would like to share authentication between the two apps. I have both config files matching for the auth tag and exact machine key tags. I think my problem is that the ASP.NET application uses the old ASP membership provider which has the user passwords in MD5 format, and the MVC application is using simple membership, password format SHA1.
Is there a way to share user authentication between the two apps even with different credentials(password formats)?
For the main app that authenticates in the forms tag I have this
<credentials passwordFormat="MD5"/>

I am not really sure if this is my issue or what's going on.

A: Well figured out my answer. All I had to do was add in the  tag was the attribute compatibilityMode="Framework20SP2".
This was due to the fact my ASP.NET app was running on the older framework and my new MVC app was on framework 4.0

A: Your options are pretty much:

*

*Write your own ASP.Net 2.0 MembershipProvider to use the PBKDF2 algorithm to store passwords (Resetting everyone's passwords will be required).

*You don't get to override SimpleMembershipProviders storage of passwords (that I know of) so you'll have to writing your own ExtendedMembershipProvider to duplicate the ASP.Net 2.0 security mechanisms in the default MembershipProvider.
As a side note, MD5 is (in my opinion) a terrible algorithm to store passwords.  At this point from what I've read bcrypt or PBKDF2 is recommended by most security experts.
If you're interested on the changes Microsoft made to increase security in .Net releases the article Stronger Password Hashing in .NET with Microsoft's Universal Providers is a good read.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How should I publish artifacts to an artifact repository to assure that I can easily get the right binary? We are DSCM and building different branches, forks or pull requests and now I am trying to migrate to a model where we publish the binaries in an Artifact Repository (like Nexus, Artifactory or Archiva)
This has nothing to do with Java as my binaries but it seems that the only well grown generic enough solutions are those listed above.
The biggest requirement is that I want to be able to get the artefact based on the changeset from the repository.
The problem is that I discovered that artefacts are identified only by their product and version and that the version formatting has some very strict rules.
How can I do this? Does anyone solved this problem already?

A: Artifact repositories like Nexus and Artifactory are designed to store the files that are created from your source code. Generally one only does this when releasing software so it would be expected to have some sort of incrementing release number.
All source code repositories have a mechanism to "tag" the code at a particular point in time. This should be done every time you create a release, and subsequently push the resultant file(s) to Nexus/Artifactory.
There are lots and lots of strategies for creating a release number. There are some nifty approaches that use the number of commits in Git to generate a unique number:

*

*https://softwareengineering.stackexchange.com/questions/141973/how-do-you-achieve-a-numeric-versioning-scheme-with-git

*http://www.hurryupandwait.io/blog/using-git-to-version-stamp-chef-artifacts


text:
Q: Bad idea to override getContext() to non-null in Android api level 27? I'm using kotlin, and recently updated my application with compileSdkVersion/targetSdkVersion 27. There I get some compilation errors, where for instance, context is now nullable(context?) instead of non-null.
I have a base fragment class, that other fragments inherits from. Is it a bad idea to have this function?
override fun getContext(): Context {
    return super.getContext()!!
}

In the parent function, I see that you have this code:
/**
 * Return the {@link Context} this fragment is currently associated with.
 */
@Nullable
public Context getContext() {
    return mHost == null ? null : mHost.getContext();
}

Where mHost is:
// Host this fragment is attached to.
FragmentHostCallback mHost;

But the fragment will always be attached to a host, as far as I can see.
Is there any kind of scenario where mHost will be null?
Edit: In support library v27.1.0 Fragments now have requireContext(), requireActivity(), requireHost(), and requireFragmentManager() methods, which return a NonNull object of the equivalent get methods or throw an IllegalStateException.
See https://developer.android.com/reference/android/support/v4/app/Fragment.html#requireContext()

A: There can be situations where the fragment is not attached to a host. The simplest example is when the fragment is instantiated with its empty constructor and is not attached to anything. If you called getContext() in the constructor (or a method called from the constructor), it would result in a null value.
This means that overriding getContext() to return super.getContext() would make no sense. You might be able get rid of some null-checks but if it's null, your app will crash.

A: Reason being there are cases where fragments won't be attached to the parent yet but you try to access it,in such case context will be null.Best example is when you have tabs with multiple fragments and you keep switching between the tabs, most possible case is fragments will be detached and take time to attach it back but you have already switched to other tabs resulting your app to crash. So keeping context nullable is one of the best practice.


text:
Q: New project missing xml files and folders When creating a new project on Android Studio, some files are missing on my new project like:
xml files:
activity_main.xml, AndroidManifest.xml
Folders inside res folder:
layout, values
I dont know if theres more things missing. Im using windows 8 Pro

A: The only folders you need in your res folder are probably "values" with a "strings.xml" inside. and you need a "styles.xml" in the values fodler. copy this text to your styles.xml:
    <resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

</resources>

the  tags have to go in the strings.xml file too.
google for a androidmanifast xml file and copy that to it.

A: You can also check the settings when creating the project, there should be a setting that says something like:
"Generate xml files"
just some ideas


text:
Q: QGIS 3x problem with rescaling vector (shapefile) layer I would like to rescale my shapefile layer in a particular location on my map in QGIS.
Unfortunately every time my layer is rescaled in completely different location.
According to this query
Resizing shapefile features proportionally in QGIS
I can do it with Affine transformation.
Unfortunately when I run the affine transformation and fill it with my XY coordinates as well as the scale factor I am getting my layer away from my working area.

In the X and Y I put the coordinates from Gridreferencefinder.com
In the scale factor I put accordingly 1.3 for X and Y and this is working. The worst thing is the layer itself, which appear at completely different coordinates (bounded black).
I found some solution here:
Computing parameters for QGIS Affine transformation?
but it looks like it's not the quickest one.
The problem is exactly the same when using SAGA vector transformation and GRASS v.transform.
Is there any way to fix it?
Or possibly can I scale my layer manually using i.e. advanced digitizing toolbar?

A: A translation moves geometries.
You said you only want to scale them.
So do not enter offsets for a translation.


text:
Q: Package does not exist error when building with Maven I'm trying to build a pom.xml for a project I'm forking. The original project uses a pom hierarchy I can't use, so I need to write a new pom.xml.
Now, I get an annoying package xxx does not exist, for example for org.apache.commons.logging, but in my pomxml, I get the dependency:
<dependencyManagement>
  <dependencies>
    ...
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.1.1</version>
    </dependency>
    ...
  <dependencies>
<dependencyManagement>

Obviously, Maven is failing on imports like:
import org.apache.commons.logging.Log;

My pom.xml has not any parent. I'm using Maven 2 with Java 5. any clue?

A: The dependencyManagement entry above tells maven: each time a project declares a dependency like this:
<dependencies>
 ...
<dependency>
  <groupId>commons-logging</groupId>
  <artifactId>commons-logging</artifactId>
  <!-- notice there is no version -->
</dependency>

use the version form dependencyManagement: 1.1.1.
It is very useful to have dependencyManagement in your main pom, so that all projects inheriting from this pom will use consistently the same version. Changing it at this one place will cause all inheriting projects to be use another version the next time they are built.
Keep dependencyMangement in the main pom, add dependency without version in your projects.

A: If you don't have a pom hierarchy you don't need <dependencyManagement> just <dependencies>.
Remove the surrounding <dependencyManagement>.


text:
Q: Broadcom 4313 (gn) wirelless card on HP Pavilion g6 weak signal but close to AP
Possible Duplicate:
Broadcom 4313 Signal strength very low on an HP Pavilion dv4

I installed fresh Ubuntu 11.04 and i have wireless connection but i have to be very close to the router to have signal. I looked everywhere i can't manage to find a solution.
In my grub it says that i have :
3.1.4-030104 generic
old ones :
3.0.0-14 generic
3.0.0-12 generic
kernels.
I tried the solution here but i think this is for older versions of Ubuntu.
On Windows 7 the wireless card is working flawlessly. Please help me to find a solution I'll be grateful.


text:
Q: How to solve ANTLR error "Attribute references not allowed in lexer actions" After reading Chapter 10 of "The Definitive ANTLR 4 Reference", I tried to write a simple analyzer to get lexical attributes, but I got an error. How can I get the lexical attributes?
lexer grammar TestLexer;

SPACE:                       [ \t\r\n]+ -> skip;

LINE:                        INT DOT [a-z]+ {System.out.println($INT.text);};
INT:                         [0-9]+;
DOT:                         '.';

[INFO]
[INFO] --- antlr4-maven-plugin:4.9.2:antlr4 (antlr) @ parser ---
[INFO] ANTLR 4: Processing source directory /Users/Poison/IdeaProjects/parser/src/main/antlr4
[INFO] Processing grammar: me.tianshuang.parser/TestLexer.g4
[ERROR] error(128): me.tianshuang.parser/TestLexer.g4:5:65: attribute references not allowed in lexer actions: $INT.text
[ERROR] /Users/Poison/IdeaProjects/parser/me.tianshuang.parser/TestLexer.g4 [5:65]: attribute references not allowed in lexer actions: $INT.text

ANTLR4 version: 4.9.2.
Reference:
antlr4/actions.md at master · antlr/antlr4 · GitHub
How to get the token attributes in Antlr-4 lexer rule's action · Issue #1946 · antlr/antlr4 · GitHub

A:
How can I get the lexical attributes?

You can't: labels are simply not supported in lexer rules. You might say, "well, but I'm not using any labels!". But the following:
INT DOT [a-z]+ {System.out.println($INT.text);}

is just a shorthand notation for:
some_var_name=INT DOT [a-z]+ {System.out.println($some_var_name.text);}

where some_var_name is called a label.
If you remove the embedded code (the stuff between { and }), add a label before INT and then generate a lexer, you'll see the following warning being printed to stderr:

labels in lexer rules are not supported in ANTLR 4; actions cannot reference elements of lexical rules but you can use getText() to get the entire text matched for the rule

The last part means that you can grab the entire text of the lexer rule like this:
LINE
 : INT DOT [a-z]+ {System.out.println(getText());}
 ;

But grabbing text from individual parts of a lexer rule is not possible.

A: Try to separate the concerns of the lexer and other output matters: that's a main focus point of Antlr VS Bison/Flex. You can use for example visitor/listener patterns from the other chapters of the book.


text:
Q: Как реализовать проверку параметров метода на соответствие определенному типу? Как можно реализовать проверку параметров на строгое соответствие определенному типу?
Нужно чтобы метод не пытался неявно привести тип аргумента к указанному типу, а в случае не соответствия сразу кидал Exception. Например при передаче b параметра типа char, нужно, чтобы он не брал его код, а сразу кидал Ex.
Код некорректный, просто для примера
        public static string task01 (int a, double b)
    {
        if ((typeof(double) != b.GetType())) throw new ArgumentException($"Параметр {b} не является вещественным числом");
        if ((typeof(int) != a.GetType())) throw new ArgumentException($"Параметр {a} не является целым числом");

        string s1 = ("привет, " + a + '!' + '\n' + a + " + " + b + " = " + (a + b) + '\n' + "пока, " + b + "...");
        return s1;
    }

A: Во первых, проверка типов параметров - это работа компилятора, а не ваша. Если переданный параметр никак не привести к типу параметра в функции, то у вас код просто не скомпилируется.
Во вторых, в вашем примере, типы параметров будут конвертированы неявно до вызова метода - просто вызовите Console.WriteLine(task01('1', '2')); и увидите, что char, что вы передали, будет преобразован в int и double до вызова метода и внутри метода уже будут параметры типа int и double.
В третьих, если вам надо такую проверку писать для своих классов, тогда у вас вероятно проблемы с буквой L из SOLID.


text:
Q: An event delivery library in Java? I'm looking for a library that will allow me to deliver simple text events from the server to the clients via sockets. Something simple and lightweight. I can write it myself, but decided to check if such thing exists first. The idea is that there's an application that generates events (such as order rejected or an internal error occurred) and acts as a server.  Those events must be delivered to all connected clients in real-time. And a client is just a tray-icon app that pop ups the said event's text. Some simple UDP client/server. Does anyone know if there's a library out there for Java?
Thanks!

A: There are many possible solutions, but if you want simple I suggest you try Hazelcast

It is as simple as using java.util.{Queue, Set, List, Map}. Just add the hazelcast.jar into your classpath and start coding.

A: You should check out JBoss Netty and/or Apache MINA, which are both frameworks for building network protocols. It's debatable whether you consider them simple, although you can certainly build lightweight implementations with them.

A: This could be easily accomplished with XMPP pubsub.  You can use Smack to connect to the server of your choice that supports pubsub (OpenFire, ejabberd, ...) so your application that creates the events is the publisher and the clients are all subscribers.  It will require a 3rd party server to be used (many are open source), but it is just a single library for all client access.  I have experience with OpenFire and it can be set up in about 15 minutes.
Many will not consider this light weight, but rolling your own pubsub solution is really not necessary.


text: Q: SiriKit INStartCallIntent not working on iPad I've implemented Siri support in my app that supports video and VoIP calls. I am able to use Siri with my app on iPhone, but on iPad, Siri responds with "Sorry, I can't help you with that on iPad". I've found articles about Siri not working, and gone through troubleshooting with no success. I've enabled iPad in my intents extension's deployment info, and I haven't seen anything in the APIs about iPad support specifically. This is my first time working with Siri, but I'm finding it to be a black box that doesn't give us much to go on when it doesn't work as expected. Am I missing something, or is this just one of Siri's quirks?


text:
Q: JDBC SQL Exception Data Source not found in servlets I have created a database : Admission.mdb, and added it to the user DNS : "adm"
When I try to access it through java program, I use following code to connect the database
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:adm");
It worrks properly, and the program can access the database.
But, when I tried to use the same code inside a servlet, it gives following Exception:
"java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
Can someone tell me what am I doing wrong?

A: You need to indicate where the mdb file is (and what is its name). Take a look at this


text:
Q: Symfony3 Impossible to access an attribute ("small_pizza") on a string variable ("Margherita") I trying to display price, but occurs error Impossible to access an attribute ("small_pizza") on a string variable ("Margherita").
This is my Controller:
/**
     * @Route(
     *      "/menu",
     *      name = "pizza_menu"
     * )
     *
     * @Template
     */
    public function menuAction() {

        $Repo = $this->getDoctrine()->getRepository('PizzaBundle:Menu');
        $rows = $Repo->findAll();

        return array(
            'rows' => $rows
        );
    }

And this is my database:
enter image description here
In a Twig code is this:
{% for entry in rows %}

      {{ entry.id }}
      {{ entry.name }}
      {{ entry.components }}

{{ entry.name.small_pizza }}

{{ entry.name.small_pizza }}

{{ entry.name.small_pizza }}

{{ entry.name.small_pizza }}

Help me please :)

A: Try accessing to the prince entity navigating the relations so try this:

{{ entry.price.small_pizza }}

instead of

{{ entry.name.small_pizza }}

Hope this help


text:
Q: Script to check the status of a URL I have seen a few questions similar to this but have not found one that will work for my situation.
I have a list of URL's stored in a text file that I need to run through to see if they return a 404 error. I am using powershell and have been using the example here: http://gallery.technet.microsoft.com/scriptcenter/Powershell-Script-for-13a551b3#content
I am currently testing a link to a confluence page, watching the console in Chrome I can see the first status returned is a 404 - Not Found, then a dozen or so requests afterwards that are 304, 200.
I am guessing the requests after the first 404 are affecting my results, I need the script to return based on that first response.
I have tried powershell, php and javascript solutions with no luck so far.
So all in all is there a way to return an answer based on the first response alone?
The script:
## The URI list to test
$URLListFile = "H:\xxx\xxx\urlList.txt"
$URLList = Get-Content $URLListFile -ErrorAction SilentlyContinue
  $Result = @()

  Foreach($Uri in $URLList) {
  $time = try{
  $request = $null
   ## Request the URI, and measure how long the response took.
  $result1 = Measure-Command { $request = Invoke-WebRequest -Uri $uri }
  $result1.TotalMilliseconds
  }
  catch
  {
   <# If the request generated an exception (i.e.: 500 server
   error or 404 not found), we can pull the status code from the
   Exception.Response property #>
   $request = $_.Exception.Response
   $time = -1
  }
  $result += [PSCustomObject] @{
  Time = Get-Date;
  Uri = $uri;
  StatusCode = [int] $request.StatusCode;
  StatusDescription = $request.StatusDescription;
  ResponseLength = $request.RawContentLength;
  TimeTaken =  $time;
  }

}
    #Prepare email body in HTML format
if($result -ne $null)
{
    $Outputreport = "<TITLE>Website Availability Report</TITLE>
 Website Availability Report

URL	StatusCode	StatusDescription	ResponseLength	TimeTaken</TD
"
    Foreach($Entry in $Result)
    {
        if($Entry.StatusCode -ne "200")
        {
            $Outputreport += "
"
        }
        else
        {
            $Outputreport += "
"
        }
        $Outputreport += "$($Entry.uri)	$($Entry.StatusCode)	$($Entry.StatusDescription)	$($Entry.ResponseLength)	$($Entry.timetaken)
"
    }
    $Outputreport += "
"
}

$Outputreport | out-file H:\xxx\xxx\test.htm
Invoke-Expression H:\xxx\xxx\test.htm

A: If you want your script to exit from the loop after the first error, you could try something like this:
Foreach($Uri in $URLList) {
  $error.Clear()

  $time = Measure-Command { $request = Invoke-WebRequest -Uri $uri } 2>$null

  if ($error.Count -eq 0) {
    $time.TotalMilliseconds
  } else {
    $error[0].Exception.Response
    break
  }
}

AFAICS try..catch isn't needed here.


text:
Q: AngularJS, Karma - Clearing ng-dirty with setPristine In one of my unit tests I'm trying to test if ng-dirty gets removed when I setPristine on an input element.  After calling setPristine on the element I can see ng-dirty is not being removed.
I have a feeling I am calling the setPristine method incorrectly.
The logic I am trying to test for is as follows

*

*Add text to your input then

*Test for ng-dirty set the setPristine

*then check for ng-dirty again

n
/**
    Add text to your input,
    then test for ng-dirty set the setPristine,
    then check for ng-dirty again.
*/
it('should set pristine', function() {
    element = angular.element('<input ng-model="temp"></input>');
    element = compile(element)(scope);
    scope.$digest();
    element.val("Some Input");
    element.triggerHandler("change");
    expect(element.hasClass('ng-dirty')).toBe(true);
    element.triggerHandler('setPristine');
    console.log(element);
    expect(element.hasClass('ng-dirty')).toBe(false);
});

Which then logs
<input ng-model="temp" class="ng-scope ng-valid ng-dirty">

Can anyone point me in the right direction?
Thanks in advance

A: $setPristine is a method exposed on Angular's FormController and ngModelController.
So if you have a form named myForm:
<form name="myForm"></form>
<div ng-form="myForm"></form>

You can call myForm.$setPristine() to set all controls within it to pristine.
The same concept applies to individual controls:
<form name="myForm">
    <input name="myInput" ng-model="temp"></input>
</form>

You can call myForm.myInput.$setPristine() to set that specific control to pristine.
You shouldn't be testing for the ng-dirty classes being added/removed, that's getting into the implementation details of $setPristine itself. If the Angular devs changed ng-dirty to ng-filthy tomorrow, your tests would break.
Instead, you can trust that the Angular developers have their own tests covering the addition and removal of CSS classes and you should be concerned with testing that your code calls $setPristine correctly, i.e.:
beforeEach(function () {
    element = angular.element(
        '<form name="myForm">' +
        '   <input name="myInput" ng-model="temp"></input>' +
        '</form>'
    );
    element = compile(element)(scope);

    myForm = scope.myForm;
    spyOn(myForm, '$setPristine');
});

it('should set pristine', function () {
    // call your code

    // then assert
    expect(myForm.$setPristine).toHaveBeenCalled();
});


text:
Q: yii2: model relations error can't find another class in ubuntu server 16.04 I have upload my YII2 project to ubuntu 16.04.
My source is no problem when run on localhost on my computer, but when I run it on the server ubuntu 16.04 with network, it has a problem.
The model source can't find another relation model
public function getLokasiAwal()
{
    return $this->hasOne(KotaBandara::className(), ['id_kota' => 'lokasi_awal']);
}

and i have error

Class 'backend\models\TypeNonstaf' not found

I have found the solution, I added the following code:
use backend\models\Kotabandara;

On top in model file but, in my source in localhost,
I do not need to add that code
Can someone explain that issue??

A: As @rob006 pointed out, it appears that you had been working/running your app on a Windows local file system, which is case-preserving, but not case-sensitive.
When you first call upon a namespaced class directly or via the use operator, it passes this full class name as $className into yii\BaseYii\autoload::($className) (Yii2's global class autoloading handler), which in turn attempts to include the corresponding class file, if found.
So, on your Windows local machine, when you use backend\models\KotaBandara, it will find and include any file associated with the corresponding path alias in a case-insensitive manner, thus it will find any of:

*

*@backend/models/KotaBandara.php

*@backend/models/Kotabandara.php

*@backend/models/kotabandara.php

*@backend/models/KoTaBaNdArA.php
There can be only 1 target file with this sequence of paths/characters anyway.
However, when you migrate this code to a Ubuntu system, which is both case-preserving and case-sensitive, there is a distinct difference between KotaBandara.php and kotabandara.php and in fact both files can exist side by side, unlike on Windows.
So, you have to be precise here - on Ubuntu, use backend\models\KotaBandara will trigger the autoloader to find only the file whose path AND case matches, i.e. KotaBandara.php. If you named the file kotabandara.php, it will be found on Windows, but not on Ubuntu!


text:
Q: How does R handle filtering data frames Relatively new user to R and still trying to get my bearings on how R handles dataframes.
Specifically, I am trying to filter a data frame based on a column value.
The Python pandas equivalent would be:
df_temp = df.loc[df['col1']==1,'col1']

From my experience, this returns a Series where all values equal 1.
I'm trying to do something similar in R where I have a dataframe, I'm using the code below, however, I keep getting the full-length column returned with values of 1 and "NA"
temp <- RAVE_ITN_BVAS_ADVIS3[RAVE_ITN_BVAS_ADVIS3$`Sensorineural deafness`==1, 'Sensorineural deafness']

So my question is two-fold:

*

*Is there a better way to filter data frames in R?

*Does R simply turn all values that do not equal 1 into NA and then return the full-length column? If so, this would be frustrating as then it brings up issues with deal with NAs all the time.
Any input appreciates and let me know how I can further clarify.
Thank you all!

A: You can use the package dplyr and use the function filter:
filter(RAVE_ITN_BVAS_ADVIS3, `Sensorineural deafness`==1)

Also, I recommend you to use the package data.table:
RAVE_ITN_BVAS_ADVIS3[`Sensorineural deafness`==1]

Best

A: Thanks all for the input, I ended up finding I believe a similar issue here (thanks to Parfait's comment)
Subsetting R data frame results in mysterious NA rows
I ended up using:
temp <- RAVE_ITN_BVAS_ADVIS3[which(RAVE_ITN_BVAS_ADVIS3$`Sensorineural deafness`==1),
                             'Sensorineural deafness']

which returns:
 [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

The prior code without the use of which provided:
temp <- RAVE_ITN_BVAS_ADVIS3[RAVE_ITN_BVAS_ADVIS3$`Sensorineural deafness`==1,
                            'Sensorineural deafness']

   [1]  1  1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
  [42] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA  1 NA
  [83] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [124] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [165] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [206] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [247] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [288] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [329] NA NA NA NA NA NA  1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [370] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [411] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [452] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [493] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [534] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA  1  1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [575] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [616] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [657] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [698] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [739] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [780] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [821] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [862] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [903] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [944] NA NA NA NA NA NA NA NA NA NA NA  1 NA NA NA NA NA NA NA NA NA NA NA  1  1 NA NA NA NA NA NA NA NA NA NA  1 NA NA NA NA NA
 [985] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [ reached getOption("max.print") -- omitted 2499 entries ]


text:
Q: Biblatex multiple bibliography labelling with the 'context logic' I am writing my thesis in LaTeX with Biblatex. I made the stupid decision to update Biblatex just before finsihing, and now I have a problem with the bibliography with the new 'context logic' in Biblatex, replacing the previous method to make bibliographies and citations with pre-labels.
I have multiple bibliographies in my thesis, one for references (unlabeled), and two others for my publications (labeled with T and A). Previously, I used prefixnumbers with printbibliography to put different labels to different bibliographies, but with the new Biblatex it is deprecated, and labelprefix should be used with \newrefcontext.
I tried to modify my LaTeX source according to this simple solution: labelprefix to newrefcontext replacing prefixnumbers to printbibliography not working
The problem is that I have text both before and after the bibliographies. If I just do it like in the linked example, the citations of references from the first bibliography are labeled incorrectly after the bibliographies (the labels of the citations from the first bibliography appear all as 'A0'). If I put \endrefcontext after the last bibliography, then everything except the references from the global context (first bibliography) are labelled incorrectly (all appear as '0' in the whole text).
An MWE:
\documentclass[]{report}

\usepackage{filecontents}
\usepackage{hyperref}

\begin{filecontents}{refs.bib}
  @article{r1,
      title={r-title1},
      author={authors1},
    }
   @article{r2,
      title={r-title2},
      author={authors2},
    }
\end{filecontents}

\begin{filecontents}{thesis.bib}
  @article{t1,
      title={t-title1},
      author={authors1},
    }
   @article{t2,
      title={t-title2},
      author={authors2},
    }
\end{filecontents}

\begin{filecontents}{articles.bib}
  @article{a1,
      title={a-title1},
      author={authors1},
    }
   @article{a2,
      title={a-title2},
      author={authors2},
    }
\end{filecontents}

\usepackage[
style=numeric-comp,
backend=biber,
defernumbers=true,
]{biblatex}

\addbibresource{refs.bib}
\addbibresource{thesis.bib}
\addbibresource{articles.bib}

\DeclareBibliographyCategory{thesis}
\DeclareBibliographyCategory{articles}
\addtocategory{thesis}{t1,t2}
\addtocategory{articles}{a1,a2}

\begin{document}

%\assignrefcontextcats[labelprefix=T]{thesis}
%\assignrefcontextcats[labelprefix=A]{articles}

Some text. \cite{r1,r2,t1,t2,a1,a2}

\printbibliography[notcategory=thesis, notcategory=articles, title=References]
\newrefcontext[labelprefix=T]
\printbibliography[category=thesis,title={Publications related to the thesis}]
\newrefcontext[labelprefix=A]
\printbibliography[category=articles,title={Other publications}]
\endrefcontext

 Some text. \cite{r1,r2,t1,t2,a1,a2}

\end{document}

With the above I get

Some text. [0, 1, 0, 2, 0]

both before and after bibliographies. By uncommenting the lines with \assignrefcontextcats I can override the default context, and get

Some text. [A1, 1, T1, A2, 2, T2]

Which at least gives good labels, but the ordering is messed up.
Previously with prefixnumbers it worked perfectly, every citation label was correct in all the text, before or after bibliographies. How to do this with the new Biblatex? Thanks!


text:
Q: How can i join 2 tables conditioned with 2 different columns in Postgres? Here's some dumb example of i want to do.
Basically i need to join my "Person" table with my "Addres".
My country colcumn will be the strongest, i wanna join by it, but if my Person doesn't have a
country id i need to join it by City.
I've tried LATERAL join, but nothing has worked.
Table Addres:

id
city
country

1
null
3

2
11
null

Table Person:

id
name
city
country

1
null
3
null

2
11
null
2

A: you can use 'OR' in your join statement:
select * from person p
left join address a
on p.country = a.country
or p.city = a.city


text:
Q: Using Different Location for Eclipse's .p2 tree ("bundle pool") I currently am trying to set up Eclipse to run from /opt/eclipse.
Everything was going fine; I extract the software using the Eclipse installer to /opt/eclipse; I made a soft link to it in my /usr/bin directory so I could just type 'eclipse' to run it from anywhere in my user terminal and I thought I was done until this happened:
$ eclipse
/root/.p2/pool/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.400.v20160518-1444: cannot open shared object file: Permission denied
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
After some exploring in the /opt/eclipse/eclipse.ini and /opt/eclipse/configuration/config.ini files I came to the conclusion that when I installed Eclipse using the installer under super user permission that it installed the necessary libraries under /root directory.
I can use 'sudo eclipse' and it works but it becomes a hassle to have to enter my password every time. I am thinking of copying the .p2 file under /usr/lib to "generalize" it and allow access from any pwd as my user; would this be a smart idea or should I be doing something else?

A: The .p2 folder is a shared installation folder that is referenced by all the Eclipse instances created by the installer. Sadly, I don't think it is safe to move the existing version (I might be wrong, but I am not sure how many times it is referenced), but you can create a new one.
The concept the installer is using here is called 'Bundle pool', and you can set up as many locations for that as you like. To open the bundle pool settings, find the corresponding item in the installer UI.
In case of the simple UI, press the menu bottom on the top (1), and then select Bundle pools...:

If you are using the advanced UI, there is an dropdown list at the bottom of the first page of the wizard with the list of existing bundle pools. By clicking the button next to it, you can get to the bundle pool manager.
In both cases, in the presented dialog you can create your own bundle pool which you can put into any folder you want and then use it as a source of installation.
Finally, if you have moved all your installations to this new pool, you can safely remove your original bundle pool folder, it will not be required anymore.

A: Say that I am user me.

*

*Before installation, change the ownership of /opt/eclipse with sudo chown -R me:me /etc/eclipse so I can launch the envince-installer without sudo rights.

*Install into /opt/eclipse in simple mode. No folder on /root/.p2 gets created. The .p2 tree is installed into my home directory (but as shown in the other answer you can customize this too)

*After installation, revert the ownership of /etc/eclipse with sudo chown -R root:root /etc/eclipse. Now I can start the executable under /opt/eclipse without sudo rights since there's no need to access /root.

*I make an alias and even an item in the launcher menu to start eclipse from the desktop environment.

My specifications: Ubuntu 14.04 LTS, Java SE Runtime Environment build 1.8.0_111-b14, Eclipse Installer 1.6.0 Build 2790, Eclipse Neon

A: I ran into the same issue (home directory was getting huge) and did a hack:
$ mv ~/.p2 /opt/eclipse/p2
$ ln -s /opt/eclipse/p2 ~/.p2

The eclipse installer (... and eclipse itself) seems happy with the symlink and the "pool" information now is hosted in the /opt/eclipse area and sucks up disk space over there.
You may have to get some superuser privs to do the first move, but it does work with open permissions and multiple users adding symlinks to the same area.

A: Having had the same type of problems, I think there should be more explanation on the actual installer. However, similar to the above, this is what I did to get an install that could be used by a non-root user, and store everything 'eclipse' the same place.
1) Clear up the mess created by initial experimentation:

*

*Delete these folders from /root : .p2, .eclipse, eclipse

*Delete the unzipped installer

*Delete whatever was installed in /root/

2) Create the following folders:

*

*/opt/eclipse

*/opt/eclipse/installer (unzip your installer here)

*/opt/eclipse/pools

*/opt/eclipse/install

Run the installer as sudo.
Select Advanced install option on the GUI and add a new pool agent in the /opt/eclipse/pools folder.
Select install folder to be /opt/eclipse/install.
After installation delete any newly created folders '.p2', '.eclipse', 'eclipse' in /root.
The executable is now /opt/eclipse/install/eclipse/eclipse and can be started by a non-root user. Also, you can install new packages e.g. PyDev as a non-root user.

A: assumed, that eclipse is the folder, where your portable eclipse is installed in:
- shut down eclipse
- create a folder under eclipse (i.e. myDATA)
- edit eclipse\eclipse.ini
- under the entry -vmargs insert: -Duser.home=.\myDATA
  (take care that -Duser.home is overwritten later in the ini-file!)
- restart eclipse
now you can copy eclipse wherever you want.


text:
Q: Silverlight cross domain confusion I have a Silverlight application that does two things:
1) connects to a WCF server (hosted inside a WPF app on a different PC) and sends small packets of info (using PollingDuplexHttpBinding if it matters)
2) sends a web request for get an XML file from a different remote server for parsing
At dev time, its all running locally, but in production it will be a scattered deployment each running on a different server.
But I am running into issues that I think are related to the clientaccesspolicy.xml and crossdomain.xml files
My Silverlight app runs at a random port (as defined by VS2010)
The WCF service runs at: http://localhost:80/MyService which I can connect to just fine from the SL client (I have got a clientaccesspolicy.xml file on the WCF side)
But, and here is the part that is failing, when I send a request for the XML file, which is http://localhost/MY_TEST_SITE/thefile.xml I get the error:
The remote server returned an error: NotFound.
but I put that address into Firefox I can see the XML file no problem. I do have a clientaccesspolicy.xml in that location, which I think is correct.
If it was a cross-domain issue should I be getting a security exception here? instead of a not found exception?
How can I debug this?

A: Its ok I figured it out, I had something blocking on port 80, which was causing a whole heap of issues, once I switched that off, it was back to normal


text:
Q: How do I partition the 120GB SSD hard drive with ubuntu-20.* as OS so that the root has enough space? I never quite understood the ubuntu partitioning ever. As I see the root has 11GB of my 120GB hard drive even if the partition 1 on my hard drive is at least 70GB. How can I assign a partition space to the root so root has enough space? It usually fills up quickly with apps and installables and then I'm in need of installing ubuntu again.

A: Just create custom partitions. Make a /root partition of 50GB, a /boot partition of 500MB and the rest as the /home partition. That way you will have enough space for everything including 70GB for your files. You can always have your root partition smaller if you wish like 20GB or 30GB. You will have space for some time with that.
Swap partition is used to swap pages out of RAM when RAM is full. Linux doesn't use this much RAM. Depending on how much RAM you have, you may wish to have some swap space. You can always choose 3.5GB for swap and take that either on the /root or /home partition.
So the /root partition is used for all installations as you said. The /home partition is used for your files and all stuff you save as a user of the system. The /boot partition stores GRUB the bootloader and some other files required to boot the system. I explained the swap partition above. So I think you have all the info required to set up a custom partitioning.


text:
Q: Delete a line from a table in PHP i'm currently working on an admin which permit to the user who has the rights to delete any account with a button, and all the accounts are displayed in a table and stored in a database (i'm using MySQL). For each row of the , there is a delete button, and i would like that, by pressing the button of the choosed row, it delete the account of the row selected. I dont really know how to do it clearly that's why I ask.
Can someone explain me the approach that i should take and give me an idea.
Have a good day.
[the admin pannel screen][1]
Here is where I am in my code :
<?php

require_once('testadmin.php');

if(!$isAdmin) {
    header('Location: index.php');
}

include_once('./includes/head.php');
include_once('./includes/nav.php');

require_once('./lib/db.php');

// users
$stmt = $db->prepare('SELECT * FROM users');
$stmt->execute();

$users = $stmt->fetchAll();

?>

Users

        ID
        Username
        Email
        Role

    <?php
    foreach ($users as $user)
    {
        echo
        '

            '.$user['id'].'
            '.$user['username'].'
            '.$user['email'].'
            '.$user['role'].'
            <button class="btn-danger" onclick=\'return confirm("Confirm account delete?");\'>
            Delete account</button>
';
    }
    echo "
";
    ?>

delete.php :
NOTE : this is actually for delete the current connected account.
<?php
require('./lib/db.php');
session_start();

if(empty($_SESSION['user'])){
    header('Location: login.php');
}

$user = $_SESSION['user'];

$req = $db->prepare('DELETE FROM users WHERE id=:id');
$req->bindValue(':id', $user["id"], PDO::PARAM_INT);
$req->execute();

unset($_SESSION['user']);
session_destroy();
header('Location: index.php');

A: Pass the identifier for the record to the delete.php page:

Then in delete.php you can reference $_GET['id'] and use that value in your SQL query to delete that specific record.

Note of course that within delete.php you'll probably want to make sure the current user is authorized to delete that record.


text:
Q: Solaris 10, change partition size I have a ultra 10 with solaris 10. I would like to increase the size of the / partition (by reducing /export/home). I'm rarely working with solaris. Some "hands on" advice would be great :)
df -h gives:
Filsystem            storlek anv�nda tillg. kapacitet monterat p
/dev/dsk/c0t0d0s0      5,8G   4,8G   947M    84%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   214M   1,4M   212M     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
fd                       0K     0K     0K     0%    /dev/fd
swap                   212M     0K   212M     0%    /tmp
swap                   212M    56K   212M     1%    /var/run
/dev/dsk/c0t0d0s7      119G    66M   118G     1%    /export/home

EDIT:
Output from prtvtoc /dev/dsk/c0t0d0s0
* /dev/dsk/c0t0d0s0 partition map
*
* Dimensions:
*     512 bytes/sector
*     255 sectors/track
*      16 tracks/cylinder
*    4080 sectors/cylinder
*   65535 cylinders
*   65533 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
    0      2    00    1052640  12244080  13296719   /
    1      3    01          0   1052640   1052639
    2      5    00          0 267374640 267374639
    7      8    00   13296720 254077920 267374639   /export/home

The machine is from 1998. For the last 7-8 years it has had a laid-back but critical job, being a license server. The hw and os is so stable that I usually forget about its existance :) I only get reminded when we have a power break every second year or so, and when a license file is to be updated. I cleared the /var/crash dir and that gave me the 947M available at / ( / was 100% full). From the output of prtvtoc I'm guessing that I have 1GB swap that I could use to extend / @schily?? But since I guess that the now available 900M will be good for another year or five. I think I will avoid messing with the system and keep it as it is :) Thank you guys for the help and guidance anyway!

A: The root partition is usually the first partition but in some cases, the swap is located before the root partition.
You cannot shrink a filesystem and in special you cannot from the beginning.
You would first need to create some free space after the root partition....
If you have luck, the swap partition is past root and if you disable swap and reboot, you could grow your root.
The disadvantage is: If you do not have another temporary disk that allows you to copy /export/home to and back, you will need to swap into a plain file in /export/home after your changes but as your /export/home is nearly empty, this would be OK. The first you need to do is to find information about the current partitioning.
Call e.g. format and select the disk, then type par followed by pr and then 2x quit.


text:
Q: Bird flying in an open or a closed cage Assume that you are holding a cage containing a bird.  Do you have to make less effort if the bird flies from its position in the cage and manages to stay in the middle without touching the walls of the cage?
Does it make a difference whether the cage is completely closed or it has rods to let air pass?

A: To answer the second question first, a completely closed cage is a system which comprises the exterior cage, the air inside and the bird. So what all forces do we need to balance now? Gravity on air, bird and the cage. OK, So can the bird apply an additional force if it sits or swings or flap around the walls of the cage? And the answer might be against intuition but it is NO! Let's imagine if it was a 'yes'. If the bird could apply a force on it's own closed system (or internal force) it could accelerate its own system as long it desires. Now this isn't right, is it? Otherwise space ships could just propel themselves by their travelers constantly kicking on the inside!The air inside the cage does two things it expands and contracts (changes pressure) when the bird moves around or flaps its wings. So when the bird pushes some air towards the bottom of the cage the cage gets a force (a small impulse) which is immediately redrawn by another force now, on the top of the cage, by the elastic air that obeyed Newton's third law. In fact the bird itself will feel this recoil (that's why a bird can fly) and if the flap was strong enough it will hit the cage's top and does the same as above. So all you'll feel is an up and down movement of the cage! This is just a rearrangement of masses inside the cage, but no net forces are acting on the center of mass.Now, for an open system external forces comes in to action. To put it simply, the bird will draw some air to the inside and this new air will apply new force that you will feel as a pull (since the air could now escape through the openings, the case above is not valid!)Buoyant force has nothing much to do here except that it is what slightly reduces our weight (or the bird's) due to pure gravity by pushing us upwards since we are displacing the medium (air) we are in (Archimedes, eureka moment!) Thus the bird need to apply a force slightly less than it's gravitational force by earth in order to fly, but as I said no big deal here. Now all this would get even more interesting by imagining a balloon instead of a bird. Think about it and tell me what you think.

A: If the cage is completely closed, it doesn't make a difference if the bird is hovering inside it or if it sits on the ground. When flying, the bird pushes air to the ground which will exert a downward force on the cage exactly equal to the weight of the bird. This is a direct consequence of the conservation of momentum and Newton's second & third law. Since no additional external force is acting on the cage-bird-system when the bird is flying as compared to when it's not, the acceleration on the cage can be no different. The effect due to the flying bird only concerns the internal forces and since action=reaction, they cancel.
However, if the cage would not be closed, some of the 'wind' due to the bird could escape the cage and would become an external force, making the cage-bird-system lighter.

A: the weight of the cage will not change when a bird does anything inside it because it becomes an isolated system and all the force applied by the bird will be counted as internal force...................however when the cage is open air is free to come in and go thus affecting the weight of the cage ........in the second case momentum is not conserved....

A: Some of the above discussions are incorrect; bird accelerating changes weight of cage/bird for bird in isolated cage sitting on a weight scale due to acceleration of center of mass. Assume closed cage.  System is cage and bird.  External forces are gravity (mass bird + mass cage)x g down and force of constraint holding cage up against gravity (e.g. cord holding cage off ground or weight on a scale with cage/bird on the scale on the ground).  The force of constraint is the "weight" of the cage/bird system.  Key is (basic physics) "Sum of external forces = mass of center of mass x acceleration of center of mass"; internal forces do not matter.  As long as bird is not accelerating (e.g. stationary or hovering bird), then (mass bird + mass cage)x g down =  force of constraint holding cage up and weight (force of constraint) is not changed.  If bird is accelerating up or down the center of mass is accelerating up or down and there must be a net external force; this net external force is due to a change in force of constraint (increases if bird accelerating up so weight of system increases).  See Halliday and Resnick/ Physics (best physics book ever written).

A: Whether the cage is enclosed or open, makes no difference. So long as the bird is not close to the top or bottom of the cage (when "ground effect" would come into play) the wings circulate air around the bird/cage. There is no net wind force either up or down - just recirculation.  The bird doesn't need the ground to "push against"! It just needs to create a local pressure differential. Therefore, so long as ground effect is negated, the cage will get lighter when the bird flies. (the bird itself will have a cyclic "weight" according to whether its wings are going down or up)


text:
Q: Display multiple Array Lists from another class In our current chapter we are using arrays which I'm having some trouble creating a listing to be called upon from another class.
Goal: Display the parallel arrays from another class, this can be singular or in a group.
Question: Best or efficient way to call on a multi-parallel array with different data types?
Error: Starts with an illegal statement, as previously instructed here is the whole code, please ignore the loop display I was just testing to make sure the arrays were setup correctly.
Thanks Everyone, Yet again any assistance is much appreciated
import java.util.ArrayList;

public class Employee {

    public static void main(String[] args) {

// create an array with employee number, first name, last name, wage, and Skill
        int[] empID = {1001, 1002, 1003};
        String[] firstName = {"Barry", "Bruce", "Selina"};
        String[] lastName = {"Allen", "Wayne", "Kyle"};
        double[] wage = {10.45, 22.50, 18.20};
        String[] skill = {"Delivery Specialist", "Crime Prevention", "Feline Therapist"};
        /*
for ( int i = 0; i < empID.length; i++ )
{
System.out.print( "Employee ID: " + empID[i] + "\n");
System.out.print( "First Name: " + firstName[i] + "\n");
System.out.print( "Last Name: " + lastName[i] + "\n");
System.out.print( "Hourly Wage: $" + wage[i] + "\n");
System.out.print( "Skill: " +skill[i] );
System.out.println("\n");
}
         */
        //create an object to be called upon from another class
public ArrayList<int, String, String, double, String> getEmployee() {
        ArrayList<int, String, String, double, String> employeeList = new ArrayList<int, String, String, double, String>();
        employeeList.add(empID);
        employeeList.add(firstName);
        employeeList.add(lastName);
        employeeList.add(wage);
        employeeList.add(skill);

        return employeeList;
    }

}
} //end of class

A: First, you can't declare an ArrayList like this:
ArrayList<int, String, String, double, String>

If you want that, you can create your own object, create a class which can take these values, then you can create an ArrayList of this Object for example:
class MyClass{
   int att1;
   String att2;
   String att3;
   double att4;
   String att5;

    public MyClass(int att1, String att2, String att3, double att4, String att5) {
        this.att1 = att1;
        this.att2 = att2;
        this.att3 = att3;
        this.att4 = att4;
        this.att5 = att5;
    }
}

Then you can create an ArrayList like this :
List<MyClass> list = new ArrayList<>();

A: Going back to the basics of Java, it is an object oriented programming language so you should always aim to abstract "things" into an object if possible. You should encapsulate all of the common properties about an 'employee' into a class with all of the data as fields.
As the answer above shows, creating an ArrayList<MyClass> is the proper way of initialising arraylists as they can only take ONE type of data. You may have seen other classes take multiple types such as HashMap<Type1, Type2> but these are for a specified reason. Make sure to check the API doc first!


text:
Q: How to get auto increment work on NAVICAT I am using NAVICAT to make tables for MYSQL and I am unable to find the auto-increment attribute option for my primary key column.
id integer(10)(auto_increment)primary key

Anyone pls help me out!

A: I'm not familiar with NAVICAT but if you can run SQL statements directly, try this:
ALTER TABLE `yourTable` CHANGE `id` `id` INT(10) NOT NULL AUTO_INCREMENT

Full docs here.

A: As reported there is an auto increment checkbox in Navicat, but you have to create an integer key before, save the operation, and reselect the field, now on the bottom area the auto increment checkbox will appear.

A: click on key at the end of field, and it makes visible Auto increment option

A: I am using Navicat (10.1.0 Mac) Enterprise. In the table creation dialog, there is a checkbox for auto increment which should do the thing that you are looking for.


text:
Q: Customize the list of tcolorboxes appearance I have the following code to generate a "List of Examples" using the tcolorbox package:
\documentclass{article}
\usepackage{tcolorbox}

\newtcolorbox[auto counter, list inside=exam]{texample}[1][]{
    breakable,
    boxsep=0pt,
    leftrule=4pt,
    rightrule=0pt,
    toprule=0pt,
    bottomrule=0pt,
    top=0pt,
    bottom=0pt,
    before skip=\topsep,
    after skip=\topsep,
    arc=0pt,
    outer arc=0pt,
    colback=white,
    colframe=gray!40,
    oversize,
    title={Example~\thetcbcounter},
    fonttitle=\normalfont\bfseries,
    coltitle=black,
    fontupper=\itshape,
    detach title,before upper={\tcbtitle\hspace{0.5em}}
}

\begin{document}

\tcblistof[\section*]{exam}{Lista de Exemplos}
\pagebreak

\begin{texample}
    test
\end{texample}

\end{document}

Here is how the list looks after running this code:

However I want it to look similar to this:

So, I want the following:

*

*The "List of Examples" should be centered

*Each item in the list should be "Example   1 - title of example"

How can I do it?

A: Here is a solution I came up with (might not be the best solution though but it seems to work)
\documentclass{article}
\usepackage[most]{tcolorbox}

\tcbset{
    myexamplestyle/.style={
        boxsep=0pt,
        leftrule=4pt,
        rightrule=0pt,
        toprule=0pt,
        bottomrule=0pt,
        top=0pt,
        bottom=0pt,
        before skip=\topsep,
        after skip=\topsep,
        arc=0pt,
        outer arc=0pt,
        colback=white,
        colframe=gray!40,
        oversize,
        title={Example~\thetcbcounter},
        fonttitle=\normalfont\bfseries,
        coltitle=black,
        fontupper=\itshape,
        detach title,before upper={\tcbtitle\hspace{0.5em}},
        separator sign={\ -}
    }
}

\newtcbtheorem[auto counter, list inside=exam]{myexample}{Example}{myexamplestyle}{}

\makeatletter
    \renewcommand{\l@tcolorbox}{\@dottedtocline{1}{0pt}{2.3em}}
\makeatother

\begin{document}

\begingroup
    \renewcommand\numberline[1]{Example #1 - }
    \tcblistof[\section*]{exam}{\centering Lista de Exemplos}
\endgroup

\begin{myexample}{Title of example}{}
    Example of an example
\end{myexample}

\begin{myexample}{Title of second example}{}
    Second example of an example
\end{myexample}

\end{document}

In this code, I've switched from using tcolorbox to tcbtheorem, which allows you to give the examples names. The code \renewcommand{\l@tcolorbox}{\@dottedtocline{1}{0pt}{2.3em}} is there to fix some spacing issues in the list. The code \renewcommand\numberline[1]{Example #1 - } adds the labels to the front of each entry in the list.


text:
Q: Is there a formula or function to clean away unique identifier in 1 cell? For example, I have a list of data as per Column A. Is there a formula or way to clean up the data so that it will reflect the end product in Column B? Thank you.

A: If one has access to TEXTJOIN then formula in B1:
=TEXTJOIN(CHAR(10),1,FILTERXML("<t><s>"&SUBSTITUTE(SUBSTITUTE(A1,CHAR(10),"#"),"#","</s><s>")&"</s></t>","//s[position() mod 2 = 1]"))

Or, if you sure all values after # are numeric:
=TEXTJOIN(CHAR(10),1,FILTERXML("<t><s>"&SUBSTITUTE(SUBSTITUTE(A1,CHAR(10),"#"),"#","</s><s>")&"</s></t>","//s[.*0!=0]"))

Note: Enter through CtrlShiftEnter

For more FILTERXML "tricks", see here


text:
Q: How to access the TextField From a BeanFieldGroup? how can I set the BeanFieldGroup value to TextField that is created within the following statement:
private TextField name  = new TextField("Name");
BeanFieldGroup<MyBean> binder = new BeanFieldGroup<MyBean>(MyBean.class);
BeanFieldGroup<MyBean> fieldGroup = new BeanFieldGroup<MyBean>(MyBean.class);

fieldGroup.setItemDataSource(new MyBean());
fieldGroup.bindMemberFields(this);
layout.addComponent(TextField);

i try to set
name = (TextField) binder.getField("name");

but value bean value didn't get please guide
Thanks in advance

A: You are using two BeanFieldGroup Objects, binding on the first (fieldGroup) and getting the Field from the second (binder).
This works for me:
public class MyUI extends UI {

@Getter
@Setter
private TextField name = new TextField("Name");

@Override
public final void init(VaadinRequest request) {
    VerticalLayout layout = new VerticalLayout();
    BeanFieldGroup<MyBean> fieldGroup = new BeanFieldGroup<MyBean>(MyBean.class);

    fieldGroup.setItemDataSource(new MyBean());
    fieldGroup.bindMemberFields(this);
    name = (TextField) fieldGroup.getField("name");
    layout.addComponent(name);
    setContent(layout);
}

public static class MyBean {
    @Getter
    @Setter
    private String name;
}
}


text:
Q: What does the GUID in C# Programs in the AssemblyInfo.cs? I'm wondering for what the GUID in the AssemblyInfo.cs in C# Programs is:
[assembly: Guid("a4df9f47-b2d9-49a9-b237-09220857c051")]
The commentary says it's for COM objects, but why do they need a GUID?
Is the GUID accessibly externally?
So if it's only for COMs, do you need a GUID when you set [assembly: ComVisible(false)]?

A: Guid (Globally unique identifier) is used to identify your component by outside world. When you write a project which is going to be used as COM (Component Object Model) you will have to give a unique name. For this reason you need to apply GUID attribute.
More info at http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.guidattribute.aspx
You can remove it if you won't be exposing it as COM on assembly level

A: All .Net assemblies have a GUID.
This attribute sets it; otherwise, it will be randomly generated by the compiler.
This GUID is not used by much.


text:
Q: Fetching a lazy OneToOne entity fetches every other OneToOne entities within the same object Using Entity entity = hibernateTemplate.get(Entity.class, id); when I hit a entity.getChild() which is a OneToOne relation, every other OneToOne relations are loaded as well. I use hibernate 5.4.1-Final.
I use bytecode enhancement as below :
<configuration>
    <failOnError>true</failOnError>
    <enableLazyInitialization>true</enableLazyInitialization>
    <enableDirtyTracking>false</enableDirtyTracking>
    <enableAssociationManagement>true</enableAssociationManagement>
</configuration>

A.java
@Entity
@Table(name = "A")
public class A {

    @Id
    @Column(name = "ID_A")
    private String id;

    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ID_A")
    @LazyToOne(LazyToOneOption.NO_PROXY)
    private B b;

    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ID_A")
    @LazyToOne(LazyToOneOption.NO_PROXY)
    private C c;

...
getters/setters
...

B.java
@Entity
@Table(name = "B")
public class B {

    @Id
    @Column(name = "ID_A")
    private String id;

}

C.java
@Entity
@Table(name = "C")
public class C {

    @Id
    @Column(name = "ID_A")
    private String id;

}

So when I do
A a = hibernateTemplate.get(A.class, "100");
// triggers an Hibernate query only on A entity. The B and C aren't fetched => OK

// Hibernate: select a0_.ID_A as ID_A_27_0_ from A a0_ where a0_.ID_A=?

a.getB(); // ERROR : triggers two queries : one on C and one on B
// Hibernate: select c0_.ID_A as ID_A _26_0_ from C c0_ where c0_.ID_A =?
// Hibernate: select b0_.ID_A as ID_A _13_0_ from B b0_ where b0_.ID_A =?

Even if I fetch the B in an HQLQuery, I still have a query to C :
Query<A> queryA = hibernateTemplate.createHQLQuery("from A a join fetch a.b where a.id=:id", A.class);
queryA.setParameter("id", "100");
A a = queryA.uniqueResult(); // triggers an inner join
// Hibernate: select a0_.as ID_A1_27_0_, b1_.ID_A as ID_A1_13_1_ from A a0_ inner join B b1_ on a0_.ID_A=b1_.ID_A where a0_.ID_A=?
a.getB(); // KO -> triggers a query to select C !
// Hibernate: select c0_.ID_A as ID_A1_26_0_ from C c0_ where c0_.ID_A=?

I've tried to do a double mapping (OneToOne with mappedBy specified) without success.
The PK of B and C are the same as A.
I expect the a.getB(); not to trigger the fetch of C. Is this a hibernate bug ? I can't find anything regarding this behaviour in their documentation.
Is my mapping correct ?

A: It seems that it works as designed :) b and c belong to the same default "LazyGroup". If any of b or c needs to be loaded, the whole group will.
Quote from the bytecode enhancer documentation :

Lazy attributes can be designated to be loaded together and this is
  called a "lazy group". By default, all singular attributes are part of
  a single group, meaning that when one lazy singular attribute is
  accessed all lazy singular attributes are loaded. Lazy plural
  attributes, by default, are each a lazy group by themselves. This
  behavior is explicitly controllable through the
  @org.hibernate.annotations.LazyGroup annotation.

Just add the @LazyGroup("b") on the b field, and @LazyGroup("c") on c and it should work as expected : b will be loaded only on getB(), anc c on getC().
More on this here and here.


text:
Q: Using ng-bootstrap with angular-cli 1.0.0-beta.18 I'm using angular-cli 1.0.0-beta. 18 and trying to load ng-bootstrap using the guidline at https://ng-bootstrap.github.io/#/getting-started
Steps:
Install ng-bootstrap using
npm install --save @ng-bootstrap/ng-bootstrap

Added the following to app.module.ts
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';

@NgModule({
  declarations: [AppComponent, ...],
  imports: [NgbModule.forRoot(), ...],
  bootstrap: [AppComponent]
})
export class AppModule {
}

For my ibox-tools.module.ts I have
import {NgModule} from "@angular/core";
import {BrowserModule} from "@angular/platform-browser";
import {IboxToolsComponent} from "./ibox-tools.component.ts";
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';

@NgModule({
    declarations: [IboxToolsComponent],
    imports     : [NgbModule, BrowserModule],
    exports     : [IboxToolsComponent],
})

export class IboxToolsModule {}

And then I try to use ngbDropdown module in my ibox-tools.template.html

            <button class="btn btn-outline-primary" id="dropdownMenu1" ngbDropdownToggle>Toggle dropdown</button>

                <button class="dropdown-item">Action - 1</button>
                <button class="dropdown-item">Another Action</button>
                <button class="dropdown-item">Something else is here</button>

But ngbDropdown doesnt work. I dont get any errors, bootstrap4.css is included etc.
The getting started guide tells me to use
map: {
  '@ng-bootstrap/ng-bootstrap': 'node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js',
}

If im using SystemJS, but I dont think thats the case, as angular-cli 1.0.0-beta. 18 is using Webpack and should load ng-bootstrap automatically. Am I wrong here? I dont find any place where I should add the mapping, anyone else managed to use ng-bootstrap with angular-cli 1.0.0-beta. 18?

A: Sorry, my bad. Im still learning angular2 and the problem was that I included my ibox-tools.component.ts into another module, and not the ibox-tools.module.ts which was needed, so I missed ng-bootstrap for the secondary module which was imported in ibox-tools.module.ts ;)
So webpack is working great and no need for mapping as you had to with systemjs.
Hope you understand my answer, if not just ask and I can try to explain better.


text:
Q: Firebase package name is not same as in manifest. Can I change it? I was about to upload my Android app to Play Store, but as I uploaded it said package name with com.example is not allowed. So I changed package name in my Android project. In Firebase I already have a package with com.example. Can I change the package name in Firebase? Its really important. My database is huge so I cannot afford to copy all those data into another account. What should I do? I have all my data in Firebase database.

A: Well, you can add another application to Firebase project and remove the com.example one, in the Firebase console project overview
https://console.firebase.google.com/project/ ** PROJECT ID ** /overview
Click "Add another app", add your new package, follow the instructions to replace the existing google services json file and delete the previous app from the project:
Project Settings > Select App > Advanced Options > Delete this app

A: in Android studio 2.3.1 it's automatically updated using the firebase option.  Try to configure again using Android Studio
Just click
Tools->Firebase and select which service is required for your app and it pop up the dialog like below and sync it so in console updating that information .


text:
Q: Observed Forbitten exception often in kibana dashboard I'm observing the below error message often in kibana. If I restarted the images and it looks fine for while but I'm loosing all my data as I explained in this below link.
The data is getting lost whenever I restart the docker/elk image
Error Message:
Erased the hostname in the snapshot.

I just searched and found that the below script will resolved that issue:
Script:
  PUT kindle_s_builds/_settings
     {
      "index":
       {
        "blocks":
        {
          "read_only_allow_delete": "false"
        }
       }
     }

Output:
  {
     "acknowledged" : true
  }

Kibana version : 6.6.0 and using docker/elk image to host the kibana dashboard.
But nothing helps. Can anyone let me know how can I resolve this issue? and what is the root cause and how to overcome this?

A: Looks like your ES cluster has gone into read-only mode due to very less disk space.
Can you check if your ES cluster is having sufficient disk space? You can run this curl command
curl -u username:password -XGET "http://ES_HOST:9200/_cat/allocation?v&pretty"

to know about the free disk space in your cluster.
Also, have a look at Elasticsearch error: cluster_block_exception [FORBIDDEN/12/index read-only / allow delete (api)], flood stage disk watermark exceeded

A: There are two angles to your problem:

*

*The indexes are becoming read only and allow delete because you ran out of disk and as a way to warn you elastic did that. You already found the solution which is to set read_only_allow_delete as false on affected indexes.

*You are losing your data because whenever the container is destroyed and created again the history is lost. You need to mount a physical disk folder inside your container. You can use the -v option in the docker run command as below:
docker run -p 5601:5601 -p 9200:9200  -p 5044:5044 -v /Users/mk/data:/var/lib/elasticsearch --name elk sebp/elk

This will serve as a persistent storage for your data and every time the container is destroyed, the data will be safe on disk.


text:
Q: Find the set of complex numbers $z$ which satisfy: $\left\lvert\frac{z-3}{z+3}\right\rvert=2$ Find the set of complex numbers $z$ which satisfy
$$\left\lvert\frac{z-3}{z+3}\right\rvert=2\text.$$
I need help on that one. Thank you.

A: Take square both sides then we get
$$|z-3|^2=4|z+3|^2.$$
Evaluate it (using the fact $|z|^2=z\overline{z}$ and $2\operatorname{Re}z=z+\overline{z}$) then
$$3|z|^2+30\operatorname{Re}z+27=0$$
Let $z=x+iy$. From above equation, we get
$$x^2+10x+y^2+9=0$$
and is equivalent to $(x+5)^2+y^2=4^2$

Details: From $|z-3|^2=4|z+3|^2$, we get
$$(z-3)\overline{(z-3)}=4(z+3)\overline{(z+3)}$$
and is equivalent to
$$(z-3)(\overline{z}-3)=4(z+3)(\overline{z}+3).$$
Expand the above equality then
$$z\overline{z}-3(z+\overline{z})+9=4(z\overline{z}+3(z+\overline{z})+9)$$
Note that $z\overline{z}=|z|^2$ and $z+\overline{z}=2\operatorname{Re}(z)$ (you can check it easily - take $z=x+iy$ and calculate it) so
$$3|z|^2+30\operatorname{Re}z+27=0$$

A: Putting  $\;z=x+iy\;,\;\;x,y\in\Bbb R\;$ :
$$\left|\frac{z-3}{z+3}\right|=2\iff |(x-3)+iy|^2=4|(x+3)+iy|^2\iff$$
$$x^2-6x+9+y^2=4x^2+24x+36+4y^2\iff$$
$$x^2+10x+y^2=-9\iff (x-5)^2+y^2=16$$
Thus, the set of complex numbers fulfilling the above condition is a circle of radius four.

A: $$\begin{align}
\left\lvert\frac{z-3}{z+3}\right\rvert=2\\
\left\lvert1-\frac{6}{z+3}\right\rvert=2\\
\left\lvert\frac16-\frac{1}{z+3}\right\rvert=\frac13\\
\left\lvert\frac16-Q\right\rvert=\frac13
\end{align}$$
where $Q=\frac{1}{z+3}$. This last equation shows us $Q$ is along a circle of radius $\frac13$ centered at $\frac16$. The reciprocal of a circle in the complex plane is another circle. The circle $Q$ is on has a diameter passing through $-1/6$ and $1/2$ on the real line. So after we take the reciprocal, we have a circle with a diameter on the real line passing through $-6$ and $2$, and so its center is at $-2$ and radius is $4$.
So $z+3$ is on this circle. And then finally, $z$ is on a circle of radius $4$ centered at $-5$. That is, the solution set is the same as for $\left\lvert z+5\right\rvert=4$.


text:
Q: I was attempting to run a minecraft server on 1.8.9 on my raspberry pi. I followed a tutorial and when I attempted to run it is gave this message Does anyone have any idea what is causing this and how to fix it? I am not familiar with Linux and would like some help/

A: Let me introduce you to a huge component of debugging. Taking your error and googleing it.
That brought me to our sister site about Ubuntu. https://askubuntu.com/questions/695560/assistive-technology-not-found-awterror
I don't understand much of it, but if I read this right, you got the wrong version of OpenJDK (Open Java DevKit?)


text:
Q: Integrating BlackBerry application with Flurry Has anyone been able to successfully integrate Flurry with a BlackBerry mobile application? I have imported the FlurryAgent.jar into my project, yet when I go to run the application I am given the error "Module 'FlurryAgent' not found."  I have tried the following:

*

*Preverifying the .jar file

*Adding the .jar file to the build path of a library project (that my main project references)

It is still not working for me after trying the above - I'm getting ready to pull my hair out, there really isn't a helpful guide to do this.
Thanks!

A: In your project properties, go to the Java Build Path section, and then the Order and Export Tab. Make sure the check box for the Flurry component is checked.
That solved it for me.

A: Flurry was working fine for me in an application I did a year ago. I just added the FlurryAgent.jar file to the build path and then called FlurryAgent.onEvent(String);
I was using NetBeans IDE with Blackberry JDE 4.5

A: The supplied jar is already preverified, so that should have no effect. Mugur is right that the flurry jar must be included in the build path of the application project and must be included in the built application.

A: We (Localytics) provide our client libraries in source code to make integration with BlackBerry much, much easier.
We compete with Flurry, but you might want to give it a try: http://wiki.localytics.com


text:
Q: JSF - Is it possible to list some bean attributes via reflection using c:forEach or ui:repeat? Suppose I'd like to do something like this
<ui:repeat value="#{myMB.fields}" var="field">
<p:outputLabel for="#{field}" value="#{field}:" style="width:100px;"/>
<p:outputLabel id="#{field}" value="#{my.someobject.#{field}}"/>
</ui:repeat>

"fields" are the attributes of some bean (can be retrieved using reflection or not)
is it possible to be done using c:forEach or ui:repeat?

A: You should be able to do with ui:repeat no problem:
<ui:repeat value="#{myMB.fields}" var="field">
  <p:outputLabel for="#{field.some_id}" value="#{field.some_value}:" style="width:100px;"/>
  <p:outputLabel id="#{field.some_id}" value="#{my.someobject.#{field.value}}"/>
</ui:repeat>

public class myMB {

  List<Field> fields = new ArrayList<Field>();

  // Constructor
  public MyMB() {
    // Set some values in fields
  }

  // Getters and Setters
}

public class Field {
    int some_id = 10;
    String some_value = "Something"

    // Getters and setters
  }

Is that what you're asking?


text:
Q: Must I build in order to get rid of error in Eclipse? Is there a setting I can change s/t Eclipse will auto-correct its error warning system when I fix the error without having to build the project? For instance, in the following code I have left a semicolon out of the code:
#include <iostream>
#include <string>

using String = std::string;

class Entity
{
private:
    String my_Name;
public:
    Entity() : my_Name("new name"){}
    Entity(const String& name) : my_Name(name){}

    const String& GetName() const {return my_Name;}
};

int main()
{
    std::cin.get()
}

The Eclipse IDE will underline the following line: std::cin.get() in red and highlights it in gray. This is all well and good but if I simply add a semicolon the error highlighting and underlining doesn't go away; not until I build the program does it go away.
So is there a setting I can change somewhere so that I do not have to build the project for that error highlighting and underlining to go away?
Note: Maybe this is just a fluke? It doesn't seem to do this with every error.

A: No.
You can clear the errors from the "Problems" window at the bottom. If it is not open you can open it using Window -> Show View -> Problems. If you want to clear the errors, right-click on the Errors (or Warnings) in the Problems view and select "delete" to make them go away.

A: I'm not getting the stated behavior, the underline for std::cin.get() disappears almost immediately after adding a semicolon without even saving file or messing with the Problems window. Anyway, you may want to check the following Eclipse settings tab:

C/C++ -> Editor -> Scalability (especially Disable Editor life parsing)
C/C++ -> Editor -> Indexer


text:
Q: No previous knowledge of programming, considering electrical engineering I am still at school and wont finish until 2015 but i have seen people control doors, toy cars etc with their iphones and i really want to get in to something like that.
I have a lot of spare time and was wondering where i would start, i want to try some projects that help my understanding of electronics and also help me decide if this field is really for me.
I have no idea how they control toy cars, doors, tv's so i would really appreciate it if someone could guide me in the right direction.

A: While this question is not within the norms for this site, it is one frequently asked, so here is an outline, take it where you will:

*

*It would behoove you to get a couple of books to gather a preliminary understanding of electronic design in general, e.g.

*

*Practical Electronics for Inventors, Third Edition,

*Starting Electronics Construction: Techniques, Equipment and Projects,

*Getting Started in Electronics

*Read up on the various hobbyist electronics sites, and forums of hobby-friendly electronics platforms (such as, dare I say it, Arduino) to see what people are doing in areas like controlling RC cars and remotely locking doors.

*This article is interesting reading, and might provide you insight on why a site like this one isn't the ideal place to start.

Subsequently, with some clarity on a project to take up, this site would be useful for asking specific questions around a problem being faced, so long as the questions demonstrate good initial effort towards solving the problem.

A: See if there is a hackerspace or other hobbyist group nearby. You'll meet people at all levels of expertise with varied onterests who will be only too willing to help you along. Plus you'd likely have use of a larger kit of tool than you'd likely want to own initially.

A: Figure out what you have a passion for doing and start there. If it's photography, make camera control gadgets for panoramic pictures or remote control or automation for wildlife photography.
I can't see anyone get passionate about door openers but maybe that's just me...
But when you encounter difficulties and you will, that passion, whatever it is, will drive you on to actually get through them and get it working.
Plus that way you may discover a niche need that enough other people share, to build a viable product or business around.


text:
Q: Segmentation fault upon input with getline() I'm trying to write a simple program that takes in the users input, then prints it out. It's to keep doing this until the user types "done".
When I run the code below, I input "01", then get a Segmentation Fault ( core dumped ).
I think this has something to do with getline(), but I don't know.  I would appreciate it if someone could explain to me why it's not working and how to fix it.
#include <stdio.h>
#include <stdlib.h>

int main(){

char* line;
size_t size ;
size = 100;
char* done;
done = "done";
printf("0");
while ( strcmp(line, "done") != 0 ) {
    printf("1");
    getline(&line, &size, stdin);
    printf("2");
    printf("%s\n", line);
    }
return 0;
}

A: You are not allocating memory for:
char* line;

line is an invalid pointer before it points to a valid object. Use malloc to allocate memory, e.g., line =  malloc(size);

A: Here you just have a pointer that is pointing to nothing (actually garbage):
char* line;

From the man page for getline():

If *lineptr is NULL, then getline() will allocate a buffer for storing the line, which should be freed by the user program. (In this case, the value in *n is ignored.)
Alternatively, before calling getline(), *lineptr can contain a pointer to a malloc(3)-allocated buffer *n bytes in size. If the buffer is not large enough to hold the line, getline() resizes it with realloc(3), updating *lineptr and *n as necessary.
In either case, on a successful call, *lineptr and *n will be updated to reflect the buffer address and allocated size respectively.

So, note that you cannot use a stack-allocated buffer for getline.
The easier way to do this, is to initialize line to NULL and let getline handle the allocation for you:
char* line = NULL;
int size = 0;
getline(&line, &size, stdin);   // line and size are updated with buffer addr and size.
//...
free(line);

A: char* line = malloc(size * sizeof(char));

When no more necessary remember to free the memory:
free(line);


text:
Q: In clojure, how does one refer to java functions when not calling immediately? Consider the .indexOf function. I get that I can call (.indexOf [1 2 3] 2) if I just need to use the function immediately. But what if I want to pass the function as an argument to some other function, such as map? The following doesn't work, returning a CompilerException "Unable to resolve symbol":
(map .indexOf [[1 2 3] [4 5 6]] [2 4])

Obviously I could wrap a call to .indexOf inside some anonymous function to the same effect:
(map #(.indexOf %1 %2) [[1 2 3] [4 5 6]] [2 4])

but that's not what I'm asking. Is there another way to refer to .indexOf such that a wrapping function wouldn't be necessary? If this isn't possible, is there a good reason why this isn't supported?

A: Clojure functions are instances of the IFn interface, meaning they can be invoked. On the other hand, a java method does not implement the interface and cannot be used as a higher order function.
As Alister Lee pointed out, you can use memfn to wrap the method call. But if you check the  documentation you'll see that the anonymous function approach that you mention is the preferred way to do what you are asking for.

A: Firstly .indexOf is not a function. The snippet
(.indexOf [1 2 3] 2)

or the equivalent form
(. [1 2 3] indexOf 3)

is called the Dot special form. A special form is not evaluated by the same rules as for a function application. In this case, the special rule is that the first argument is treated as the target object and the second argument (if it is a symbol) is assumed to be a method or a field on the target object. Now, it is clear why .indexOf is not a valid symbol or a function.
You are right that we could wrap the member access with a first-class function and use that in the map method. As Alister Lee mentions above, memfn is handy for this purpose:
(map (memfn indexOf elem) [[1 2 3] [4 5 6]] [2 4])

A: Java methods were not designed to be first class functions. They don't act like first class functions, and aren't implemented like them either. Passing java methods around without classes doesn't really make much sense.
So that Clojure can be a functional language, it creates things that are first class functions, that are meant to be used and passed around without needing an owning class (implementation wise they are singleton classes, since we have to use the JVM's model of things for implementation).
If we tried to make Java methods act like clojure first class functions, we would have to either have a much less powerful basis for our functions (lowering the bar for functions so they really behaved like methods), or a bunch of tedious special case exceptions to memorize about method functions vs. real functions. The decision was made that we are better off acknowledging that methods were never meant to be true functions, and not treating them as if they were. Especially when it is so easy to wrap a call to a method in a function (as you show).

A: Only one clarification
".indexOf" is not exactly a function but a "dot" plus a "name function or instanceMember". I mean that the function in this case is the union of this elements so your "name function" needs the java object which contextualize the real function.
Good luck
Juan

A: I dunno - but shouldnt
(def j-fn #(.indexOf %1 %2))
(j-fn "foox" "x")
;=> 3

pretty much do what you expect?
Basically wrap it in a anon-fn


text:
Q: glitches in animation made with gganimate I can't tell if I have an R or a computer issue. When I recreate the demo on gganimate's webpage:
library(gganimate)
p <- ggplot(iris, aes(x = Petal.Width, y = Petal.Length)) +
  geom_point()
anim = p +
  transition_states(Species,
                    transition_length = 2,
                    state_length = 1)
anim_save("test.gif")

I get this:

The code runs, but the gif is all glitchy.
Is this an R issue? Or a computer issue? I'm on Windows 10.


text:
Q: Return a .zip file containing several .csv files to the browser with ZipOutputStream To begin with, I am well aware that a similar topic is available on Stack OverFlow, but this one does not answer my problem. That's why I'm making this post.
At the moment, my program is able to search for ".csv" files locally, according to certain criteria, to add them to a list, and then to create a file in ".zip" format, which contains all these files. This works without any problem.
Now, I want to download this ".zip" file, from a Web interface, with a button. The connection between the code and the button works, but when I open my downloaded ".zip" file, it contains only one file, and not all the ".csv" files it is supposed to contain. Where can the problem come from?
Here is my code:
FileOutputStream baos = new FileOutputStream("myZip.zip");
ZipOutputStream zos = new ZipOutputStream(baos);

for(String sCurrent : selectedFiles){
    zos.putNextEntry(new ZipEntry(new File(sCurrent).getName()));
    Files.copy(Paths.get(sCurrent), zos);
    zos.closeEntry();
}
zos.close();
response.getOutputStream().flush();
response.getOutputStream().close();

A: You are closing the ZIP after sending the response. Swap the order:
zos.close();
response.getOutputStream().write(baos.toByteArray());

It would be more efficient if you use try-with-resources to handle close, Files.copy(Paths.get(currentFile), zos); to transfer the files, and if you ZIP straight to the output stream because you might risk out of memory exceptions for large files:
ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());

A: Not an answer so much as consolidation based on @DuncG
            ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());

            for (String path : selectedFiles) {
                zos.putNextEntry(new ZipEntry(new File(path).getName()));
                Files.copy(Paths.get(path), zos);
                zos.closeEntry();
            }
            zos.close();


text:
Q: Cross Server Domain Data Pull jQuery..Ajax? Is it possible to pull source data from another domain (not currently owned) using jQuery Ajax method?  If not any other method?
Trying to see if I can pull a specified a tag given its container (:contains). More specifically in the example below, I want to simply put an alert of how many 4-star ratings there are:
$(document).ready(function(){
    $.ajax({
        url: "http://www.google.com/products/seller?hl=en&q=burkett+restaurant+equipment&zmi=basequipment.com&cmi=12986189937115136&sa=X",
        context: document.body,
        dataType: 'html',

        success: function(data){
            var fourStars = $(data).find('a[href*="rate=4"]').text();
            alert(fourStars);
        }
    });
});

A: You cannot access any resource outside the current domain using jQuery ajax method unless you use JSONP or any other hack.
You can take a look at cross domain access with YQL and jQuery.
http://net.tutsplus.com/tutorials/javascript-ajax/quick-tip-cross-domain-ajax-request-with-yql-and-jquery/

A: Normally I would say load the page into an iframe and parse that, but google products will give the error: Refused to display document because display forbidden by X-Frame-Options. when you try to load it into an iframe.
You could consider using the Google Content API: http://code.google.com/apis/gdata/docs/2.0/reference.html#Queries

A: You can't make a direct ajax call to Google due to the same origin policy. However, you CAN make a php file (or other scripting file) and use it as a proxy, and then make an ajax call to your php file.
For example, make an "ajax.php" file in the same directory, containing this:
<?php
$page = file_get_contents ("http://www.google.com/products/seller?hl=en&q=burkett+restaurant+equipment&zmi=basequipment.com&cmi=12986189937115136&sa=X");
print $page;
?>

Then from your jQuery code, change the url to:
    url: "ajax.php",

A: Basically, you can't do that, and for a clear reason. If you don't control the other site, all you can do is proxy the requests through your own server.
If you do control the other site, add some JSONP functionality to it (it's actually quite simple), but be careful not to give out user-specific info, since it can, obviously, be used by everyone else too.
If you actually meant Google when you said "another domain (not currently owned)" ;), they have a JSONP API - see http://code.google.com/apis/gdata/docs/json.html - json-in-script.


text:
Q: How do I prevent users from going 'back' but retain the cache after a logout in JSP? I need to leave cache enabled and disable the user from seeing the information once they go back after logging out.
I'm aware that cached pages showing upon logout + back button is by design within browsers.  I'm aware that disabling cache is a way to force logout + back to force a revalidation.
With JSP (CQ5 specifically), is this even possible?
I have the following solutions in mind, but am not sure which is the best approach for my needs:

*

*Disable cache everywhere.  This works, but is unacceptable because the publisher we are using will be too busy re-upping pages.

*"Logout" button POSTs to Page A.  Page A kills the session and forwards the user to Page B with some "You have been logged out" message.  "Back" from Page B will pop the message browsers provide about having to re-post values.  Yes = they log back out (harmless at this point) and get forwarded to Page B again.  No = they sit at Page A harmlessly.  But, "back" + "no" + "back" may land them on the cached page, or a selection from history would still show a cached page.

*"Logout" button pops a new window, asking if they're sure/warning them to close their session.  "I'm sure" does a window.opener.reload() or window.opener.close().  But, if JavaScript is disabled, we're doomed.

*"Logout" posts to the current page.  All pages check the existence of some POSTd value.  If present, forward to Page B with a "you have been logged out message".  Similar to #2.  This will essentially re-cache the page into a "You have been logged out" page, but "Back back" or history will still have cached pages.

Is there some way to manually clear a user's cache, or force the validation check to happen even on cached pages?  I'm out of ideas here...

A: Your problem here is that you are trying to cache something that should be kept secret. Caching information behind a password is not secure and is a risk.
However, it may make sense to cache the generic html parts of a page behind a password. Anything that any logged in user can see is OK in this regard. It is only the specific information such as username, address, phone number etc that is sensitive.
If you make a separate JSON call to pull down the data, the infomration will be lightweight, but still secure, as it is not cached on the system, but also not padded with html formatting etc.
The page can also have the intelligence to display a log in challenge if the users session has been interrupted for whatever reason, they retype and continue from where they left off, whilst still keeping the back button in place.
I would also think if there is any sensitive information is kept in the history, such as id's, actions etc, that can be a problem as well.
Just a few things to consider.


text:
Q: Unable to use org.apache.common.lang3.builder.toStringBuilder in eclipse's expressions view, during debug This was my original problem : How can I send/export the whole content of a variable to a text file/xml file/clipboard? (the question is still open to suggestions BTW) . Now i am trying to execute the code given by artbristol inside the Expressions View but haven't been succesful, even though i did add the jars to my build path.Apparently including the lang3 jar in the build path does not make it visible to eclipse when debugging (I can, however, import lang3 classes into my project's .java files after adding the jar to the build path )
Thanks

A: If you are adding whole content
org.apache.commons.io.FileUtils.writeStringToFile(
    new java.io.File("C:\\objectAsString.txt"),
    org.apache.commons.lang3.builder.ToStringBuilder.reflectionToString(
    variableToInspect,
    org.apache.commons.lang3.builder.ToStringStyle.MULTI_LINE_STYLE))

to expression view, yes it won't show you the content.
You have to add only this:
org.apache.commons.lang3.builder.ToStringBuilder.reflectionToString(
        variableToInspect,
        org.apache.commons.lang3.builder.ToStringStyle.MULTI_LINE_STYLE)

Then select the expression in ExpressionView, it will show you the content.


text:
Q: Error while compiling Python script into .exe I am trying to compile a python script to .exe from the Python library pyinstaller. However, i got an error, as shown below:
TypeError: an integer is required (got type bytes)

I'm fairly sure its not an error with my file, what can i do to fix this? I'm trying to compile this to an .exe in the first place because it is my math project and i want anyone to be able to play it. My code: http://www.github.com/averwhy/UltraCoin
EDIT: Full error: https://pastebin.com/VVrUBGNn

A: Its an issue with pyinstaller.
run
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz
source:
https://github.com/pyinstaller/pyinstaller/issues/4265