text:
Q: Fast enumeration Arrays of Dictionaries I have an array of dictionaries in following format.

myarary =  {day = 0; hour = 1; value = 0;},{day = 0; hour = 2; value = 0;}.... {day 6 =1; hour =23; value =1;}

So basically 7 days, 24 hours for each day and values 1 or 0 for each hour.
hence total of 168 dictionaries in my array.
Now my task is to extract values for a range of hours for a given day. For example, for day 6 I would have to extract hours slot between 2, 9 and another slot between 15 and 18 and so on.
I manage to solve the problem, with a nest for loop in following format
for (i =< start_of_hour_slot;i=<last_hour_of_slot); i++)
  for(j = 0; j<=6; j++)
Now this works, but its too lengthy and my code is filled with loops, there must be easier way with fast enumeration?
Secondly my for loops doesn't give me flexibility.
I like to be in a position, where I can simply extract lets say for day 7, three different hours slots, along side the values.
or maybe for multiple days like, day 3,4,5 slots 2-9, 11,15...

A: You can change your array size and format, since your data is clear, just need to make the array size to 168, and put the value 0 or 1 directly into the array. The first 24 elements put the array the day0 values, and the next 24 elements put the day1 values, ..., the last 24 elements put the day6 values. If you want to extract the values of day 3,4,5 slots 2-9, 11,15, just fetch the elements index of 3*6+2 ~ 3*6+9, 4*6+11, 5*6+15 in the array.

A: As @vadian suggested NSCompoundPredicate should work for what you're attempting to accomplish.  It looks like you may have a few typos in the NSPredicate you posted in your comments which is why it's failing to parse.
#import "ViewController.h"

@interface ViewController ()
@property (strong, nullable) NSArray <NSDictionary *> *generatedArray;
- (NSArray <NSDictionary *> *)_generateFakeDictionaryArray;
- (NSPredicate *)_predicateForDays:(NSArray <NSNumber *> *)days andHours:(NSArray <NSNumber *> *)hours;
- (NSPredicate *)_predicateForDays:(NSArray <NSNumber *> *)days andHoursBetween:(NSArray <NSNumber *> *)hoursBetween;
- (NSPredicate *)_predicateForDaysBetween:(NSArray <NSNumber *> *)daysBetween andHours:(NSArray <NSNumber *> *)hours;
- (NSPredicate *)_predicateForDaysBetween:(NSArray <NSNumber *> *)daysBetween andHoursBetween:(NSArray <NSNumber *> *)hoursBetween;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.generatedArray = [self _generateFakeDictionaryArray];
}

- (void)viewDidAppear:(BOOL)animated {
    // one day multiple hour slots
    NSPredicate *specificDaysSpecificHours = [self _predicateForDays:@[@(6)] andHours:@[@(7), @(8), @(22)]];
    // multiple days hoursBetween
    NSPredicate *daysBetweenHoursBetween = [self _predicateForDaysBetween:@[@(3), @(5)] andHoursBetween:@[@(2), @(9)]];
    // days between, specific hours
    NSPredicate *daysBetweenSpecificHours = [self _predicateForDaysBetween:@[@(3), @(5)] andHours:@[@(11), @(15)]];
    NSCompoundPredicate *compPred = [NSCompoundPredicate orPredicateWithSubpredicates:@[specificDaysSpecificHours, daysBetweenHoursBetween, daysBetweenSpecificHours]];
    NSArray <NSDictionary *> *filteredArray = [self.generatedArray filteredArrayUsingPredicate:compPred];
    NSLog(@"Filtered array = %@", filteredArray);
}

- (NSArray <NSDictionary *> *)_generateFakeDictionaryArray {
    NSInteger daysInWeek = 7;
    NSInteger hoursInDay = 24;
    NSMutableArray *dictArray = [NSMutableArray arrayWithCapacity:hoursInDay * daysInWeek];
    for (NSInteger day = 0; day < daysInWeek; day++) {
        for (NSInteger hour = 0; hour < hoursInDay; hour++) {
            NSDictionary *dayHourDict = @{@"day" : @(day), @"hour" : @(hour), @"value" : @(arc4random() % 2)};
            [dictArray addObject:dayHourDict];
        }
    }
    return [NSArray arrayWithArray:dictArray];
}

- (NSPredicate *)_predicateForDays:(NSArray <NSNumber *> *)days andHours:(NSArray <NSNumber *> *)hours {
    return [NSPredicate predicateWithFormat:@"day IN %@ AND hour IN %@", days, hours];
}

- (NSPredicate *)_predicateForDays:(NSArray <NSNumber *> *)days andHoursBetween:(NSArray <NSNumber *> *)hoursBetween {
    return [NSPredicate predicateWithFormat:@"day IN %@ AND hour BETWEEN %@", days, hoursBetween];
}

- (NSPredicate *)_predicateForDaysBetween:(NSArray <NSNumber *> *)daysBetween andHours:(NSArray <NSNumber *> *)hours {
    return [NSPredicate predicateWithFormat:@"day BETWEEN %@ AND hour IN %@", daysBetween, hours];
}

- (NSPredicate *)_predicateForDaysBetween:(NSArray <NSNumber *> *)daysBetween andHoursBetween:(NSArray <NSNumber *> *)hoursBetween {
    return [NSPredicate predicateWithFormat:@"day BETWEEN %@ AND hour BETWEEN %@", daysBetween, hoursBetween];
}

@end

Which generates this as an output:
Filtered array = (
        {
        day = 3;
        hour = 2;
        value = 1;
    },
        {
        day = 3;
        hour = 3;
        value = 0;
    },
        {
        day = 3;
        hour = 4;
        value = 0;
    },
        {
        day = 3;
        hour = 5;
        value = 1;
    },
        {
        day = 3;
        hour = 6;
        value = 0;
    },
        {
        day = 3;
        hour = 7;
        value = 0;
    },
        {
        day = 3;
        hour = 8;
        value = 0;
    },
        {
        day = 3;
        hour = 9;
        value = 1;
    },
        {
        day = 3;
        hour = 11;
        value = 0;
    },
        {
        day = 3;
        hour = 15;
        value = 1;
    },
        {
        day = 4;
        hour = 2;
        value = 1;
    },
        {
        day = 4;
        hour = 3;
        value = 1;
    },
        {
        day = 4;
        hour = 4;
        value = 1;
    },
        {
        day = 4;
        hour = 5;
        value = 1;
    },
        {
        day = 4;
        hour = 6;
        value = 1;
    },
        {
        day = 4;
        hour = 7;
        value = 1;
    },
        {
        day = 4;
        hour = 8;
        value = 0;
    },
        {
        day = 4;
        hour = 9;
        value = 1;
    },
        {
        day = 4;
        hour = 11;
        value = 1;
    },
        {
        day = 4;
        hour = 15;
        value = 1;
    },
        {
        day = 5;
        hour = 2;
        value = 1;
    },
        {
        day = 5;
        hour = 3;
        value = 0;
    },
        {
        day = 5;
        hour = 4;
        value = 1;
    },
        {
        day = 5;
        hour = 5;
        value = 0;
    },
        {
        day = 5;
        hour = 6;
        value = 0;
    },
        {
        day = 5;
        hour = 7;
        value = 1;
    },
        {
        day = 5;
        hour = 8;
        value = 1;
    },
        {
        day = 5;
        hour = 9;
        value = 0;
    },
        {
        day = 5;
        hour = 11;
        value = 0;
    },
        {
        day = 5;
        hour = 15;
        value = 1;
    },
        {
        day = 6;
        hour = 7;
        value = 1;
    },
        {
        day = 6;
        hour = 8;
        value = 1;
    },
        {
        day = 6;
        hour = 22;
        value = 1;
    }
)

https://developer.apple.com/documentation/foundation/nspredicate?language=objc
https://developer.apple.com/documentation/foundation/nscompoundpredicate?language=objc
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Predicates/AdditionalChapters/Introduction.html#//apple_ref/doc/uid/TP40001789


text:
Q: Geting multiple performance monitoring interrupt on qemu - kvm I followed steps and indications given here and can get now counter overflow interrupt one time. But I cannot get it multple times. Whatever I managed, the Iterrupt does note fires up any more. Despite I take care of clearing the interrupt mask.

A: It's hard to tell without any code but if you already received the first PMI then the counters registers are set correctly and the problem probably lies in the upper layers1.
I would check:

*

*To have sent the EOI to the LAPIC.

I assume you configured the PMI register of the local APIC with a fixed vector.
In this case, you have to send an EOI to the EOI register.
Quoting Intel (Chapter 10.8.5, Volume 3)

For all interrupts except those delivered with the NMI, SMI, INIT, ExtINT, the start-up, or INIT-Deassert delivery
  mode, the interrupt handler must include a write to the end-of-interrupt (EOI) register.

Sample code:
mov DWORD [APIC_BASE+0xb0], eax

The effective address, for an un-relocated LAPIC, is 0xfee000b0.
The written value is not relevant, I picked up a register to keep the encoding of the instruction short.
Of course, you have to access the LAPIC properly for your context.

*To have the IF flag set

To have the IF flag clear is an unlikely hypothesis but it is also quite easy to rule out.
Since an interrupt gate (but not a trap gate) clears the IF be sure the way you chose to exit the ISR restores IF properly.

1 If I remember correctly, the PMIs don't need to be rearmed.

A: This question is discussed in this forum where they discovered that it is a bug in the kernel. However, your can circumvent it doing this:
At any place where you need to reprogram the msr MSR_PERF_FIXED_CTR0 (0x38d), place these lines:
Msr::write(Msr::MSR_PERF_FIXED_CTR0, 0xfffffffffff0ull);
Msr::write(Msr::MSR_PERF_FIXED_CTRL, 0x0);
Msr::write(Msr::MSR_PERF_FIXED_CTR0, 0xfffffffffff0ull);
Msr::write(Msr::MSR_PERF_FIXED_CTRL, 0xa);

The switching between the values 0x0 and 0xa causes the kernel to reprogram the counter.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Copy Paste from Central Repository is Weird This question is a bit odd -- so bear with me.  If this is the wrong site to ask this question, please kindly advise the correct Stack site.
I use the website http://search.maven.org to find Java dependencies for my Maven-based projects.
Take this artefact as an example.
In the Dependency Information box (for Apache Maven), double click to highlight all text, then copy-paste into your favourite text editor.  Look at the raw bytes.  Something is weird.  If I paste directly into my pom.xml file, Maven cries foul during the validate stage about badly formatted XML.

Example raw text with octal literals:
<dependency>
\302\240\302\240\302\240\302\240<groupId>cglib</groupId>
\302\240\302\240\302\240\302\240<artifactId>cglib-nodep</artifactId>
\302\240\302\240\302\240\302\240<version>2.1_3</version>
</dependency>

Am I crazy or does anyone else have this issue?  Is this a problem with my web browser (Chrome), my text editor (Notepad++), my operating system (Windows 7) or the Central Repo website?
Update

*

*I tried copying from Google Chrome and pasting into various places.  All have the same issue.  I even tried pasting into a Cygwin session running vim.  Same issue.

*I tried with Internet Explorer 9 and the text has regular whitespace (\040).

This looks like an encoding issue with either The Central Repo website, or my browser, Google Chrome.

A: If seems there is some conversion between unicode and and ASCII.
"\302\240" is a whitespace in unicode and I guess you paste it to an ANSI document and somewhere some conversion kicks in.
I can't reproduce it with Maxthon, so I guess it is an issue with Chrome or something else interferring with the pasting (like Notepad++ plugins maybe).


text:
Q: packageManager seemingly doesn't work on device I'm trying to launch a game I made on Unity from a test app.
activity_main.xml
    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <Button
        android:id="@+id/click"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="Open" />

</RelativeLayout>

MainActivity.Kt
package com.example.myApp

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.widget.Button
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

    val clickme = findViewById<Button>(R.id.click);

    clickme.setOnClickListener{
        val launchIntent =  packageManager.getLaunchIntentForPackage("com.myGame")
        if (launchIntent != null) {
            startActivity(launchIntent)
        } else {

            startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/")))
        }

    }
}

The problem is that once I run it on a device it sends me to the store even though I have the game installed on the same device. At first I thought maybe Unity messed with the package name, so I tried to open an app already installed on both the emulator and the device
 val launchIntent =  packageManager.getLaunchIntentForPackage("com.google.android.youtube")

The emulator did open YouTube with this change, but when I run the app on the device it still sends me to the playstore. I'm new to android studio, so, I'm not sure what I'm missing.
Any help would be appreciated.


text:
Q: Реально ли процедурно генерировать "connected" текстуры? Скажем, есть клетки (n)x(n) пикселей. Изначально хотел генерировать для них текстуры каким-нибудь шумовым алгоритмом, но возникла необходимость сделать соединённые текстуры, это когда одна клетка видоизменяется в зависимости от соседней клетки, контактирует с ней. Вопрос в заголовке.
P.S. "connected" потому что я вообще не представляю как правильно это назвать, в гугле пусто. Поправьте, если есть соответствующий термин.

A: Конечно реально! Они также называются tileable и seamless текстуры.
А - можете сделать текстуру размером 2n и плавно смешивать переход.
Б - многие алгоритмы поддерживают генерацию connected результатов.
Пример - https://gamedev.stackexchange.com/questions/23625/how-do-you-generate-tileable-perlin-noise


text:
Q: Can I recognize beacons when my phone Bluetooth is turned off in the Android application? Currently, Android apps recognize beacons and send and receive data.
Is there a way to recognize beacons and send and receive data even when Bluetooth is turned off?
Is it possible to turn on the Bluetooth, send and receive data, and turn it off again when the beacons are detected?

A: Bluetooth must be turned on to detect beacons on Android.  However, by declaring the BLUETOOTH_ADMIN permission an app can programmatically turn Bluetooth on and off.  Since this permission is required to scan for beacons, anyway, it is easy to do.  So, yes, you can turn Bluetooth on, scan for beacons, then turn it back off when done.
In practice, the reasons you might want to do this are rare, as Bluetooth being on uses minimal battery and system resources.   Possible motivations for doing this might be:

*

*The user has turned Bluetooth off.  An app needing to use Bluetooth temporarily might turn it on temporarily, then turn it back off to respect user wishes.

*Turning Bluetooth off and back on can sometimes clear a bad state in the Bluetooth stack.

*There are some (debatable) privacy advantages of keeping Bluetooth off.  Turning it on only briefly might help preserve some of these privacy advantages.


text:
Q: Detect a blank webpage in WebView android I was wondering if there was a way to detect blank webpages using the webview.
Actually, this is a college app and so, it would not look appealing if the app loads a blank page and was thinking of using WebView.loadURL("
Oops! We have an empty page here
") when I encounter a blank page.
So is there a way to implement this?
Btw. this is a case when the loaded URL webpage is empty and not a rendering issue or whatever it is called!

A: There are two possible cases:

*

*Page does not load.

*Page loads, but is blank.

Solutions to each case:

*

*Attach a WebViewClient to your WebView, where you override onReceivedError() to find out more about the error.

*Attach a WebViewClient to your WebView and in onPageFinished() use javascript to check how many child nodes  has. If it has no child nodes you can show your default html page.

To get number of child nodes you can use the javascriptInterface class like this:
webView.loadUrl("javascript: var count = document.body.childNodes; jsInterface.childCount(count.length);")


text:
Q: Avoid reload view after orientation change I am new to android development . I have been puzzled by this problem in recent times .
 Every time orientation changes my view gets reloaded. I want to avoid this. This is happening   on change from landscape to portrait and vice versa.

A: Put below line in your manifest in activity:
android:configChanges="orientation|screenSize"

So, your activity should look like:
<activity
            android:configChanges="orientation|screenSize"
            android:name=".YourActivity"/>

This way prevent destroying activity on orientation changes.

A: The reason why Android is reloading the view after the orientation has changed is that this view is most probably another view than the one that was displayed before the orientation change happened, e.g. with new layout, font sizes, imageviews or other resources. The Android system is able to automatically load suitable resources for different screen dimensions (e.g. height, width, density ... ) in case of an orientation change.
For this to happen, Android first calls the activity's onDestroy() method, followed by a call to its onCreate() method to enable the activity to reload resources and activity state.
If for some reason you do not want this behaviour, you can follow the above advice and add an android:configChanges attribute to your activity element. In this case Android calls the activity's onConfigurationChanged() method instead of onDestroy() and onCreate(). onConfigurationChanged() is the method to place your code to adapt to the new orientation, if necessary. If not, it can also be left empty.
For further reading, see http://developer.android.com/guide/topics/resources/runtime-changes.html


text:
Q: Drupal docker image not able to connect to MySQL database I am using docker on Ubuntu 18.04 having Drupal 8 and MySQL images. Also using Nginx as a web server (not an image in docker). Now during the installation of Drupal 8 on port 8080, it's not connecting to MySQL server. I am getting the error as:
Error by drupal
I am entering the correct database username and password.
But I am not sure about the advanced settings.
I have tried the host as my-ip:8080, 127.0.0.1:8080 but it didn't work.


text:
Q: Javamail IMAP - Searching mail by date returning wrong results Im trying to get emails of a certain date from an inbox in outlook using IMAP, but im getting emails from dates that dont correspond to the date im using for my search, my code is the following:
SimpleDateFormat df1 = new SimpleDateFormat( "MM/dd/yy" );
String dt="10/02/18";
java.util.Date dDate = df1.parse(dt);

/*
Connection code to the email goes here
*/

SearchTerm st = new ReceivedDateTerm(ComparisonTerm.EQ,dDate);
IMAPFolder inbox = (IMAPFolder) store.getFolder("INBOX");
inbox.open(Folder.READ_WRITE);
Message[] messages = inbox.search(st);
int total = messages.length;

/* RESULTS */

println("\nTotal_Email = " + messages.length);
for (int index = 0; index < total; index++) {
            Date date=message.getReceivedDate();
            System.out.println("DATE RECEIVED="+date);
}

Im getting the following result when I use the date "10/01/18"

Total_Email = 5
DATE RECEIVED=Mon Oct 01 17:45:44 COT 2018
DATE RECEIVED=Mon Oct 01 16:43:27 COT 2018
DATE RECEIVED=Mon Oct 01 16:17:11 COT 2018
DATE RECEIVED=Mon Oct 01 15:37:38 COT 2018
DATE RECEIVED=Mon Oct 01 14:53:48 COT 2018

And then Im getting the following result when I use the date "10/02/18"

Total_Email = 6
DATE RECEIVED=Tue Oct 02 08:09:53 COT 2018
DATE RECEIVED=Mon Oct 01 23:21:34 COT 2018
DATE RECEIVED=Mon Oct 01 22:37:22 COT 2018
DATE RECEIVED=Mon Oct 01 21:33:37 COT 2018
DATE RECEIVED=Mon Oct 01 20:21:20 COT 2018
DATE RECEIVED=Mon Oct 01 19:11:50 COT 2018

My guess is that it has to do with my timezone, I live in Colombia and my timezone is GMT-5, Is there any way to fix and get the correct results ?

A: No, IMAP is not timezone aware, and it is server specific what timezone it computes and reports the results in.  You may need to request more than you need and do client side filtering.
Most of the large multinational servers use UTC for convenience, so you'd have to fetch the two days overlapping the period you're interested in.


text:
Q: How to compare a list of integers and then sort it ascending? I am learning how to sort and compare the dimension of squares in ArrayList. The dimension of the squares first ordered by length. If two squares have the same length, the squares requiring the shorter width should come first.
public class Square {
private int length;
private int width;

public Square(int length, int width) {
    this.length = length;
    this.width = width;
}
}

public class Dimension {
private int length;
private int width;
ArrayList<Square> Dimension = new ArrayList<>();

public void addSquare(int length, int width) {
    Dimension.add(new Square(length, width));
}

public void sortDimension() {
    Collections.sort(Dimension, (length, width) -> length.compareTo(width));
}

public static void main(String[] args) {
    Square square;
    Dimension dimension = new Dimension();
    dimension.addSquare(10, 5);
    dimension.addSquare(8, 8);
    dimension.addSquare(10, 2);
    dimension.addSquare(12, 10);
    dimension.addSquare(8, 5);
    dimension.sortDimension();

    for(int i=0; i<Dimension.size();i++ ) {
        System.out.println(Dimension.get(i));
    }
}
}

I found the Collections.sort(List, (obj1, obj2) -> obj1.compareTo(obj2)) on the internet, but it does not work on my code. The compiler says cannot convert from Obj to int.
I need your suggestion on this matter. Thank you.

A: *

*Don't use the word Dimension everywhere, for the class, for naming variables, here are suggestions
ArrayList<Square> dims = new ArrayList<>(); // for the class attribut

Dimension value = new Dimension(); // in the main

*When providind a custom Comparator, you get a pair of object and need to determine the first one, you don't get it's properties
Collections.sort(dims, (o1, o2) -> ); // Both o1 and o2 are Square instances

// You'd get for something like
Collections.sort(dims, (o1, o2) -> o1.getLength() == o2.getLength() ?
                                   o1.getWidth() - o2.getWidth() :
                                   o1.getLength() - o2.getLength());

*But you can use Comparator interface that provides nice methods
dims.sort(Comparator.comparing(Square::getLength).thenComparing(Square::getWidth));

Then in the main to access the list you need to go from the instance, as value.dims.size(). And with a nice toString in Square class it' be ok
class Square {
    private int length, width;
    public Square(int length, int width) {
        this.length = length;
        this.width = width;
    }
    public int getLength() {return length;}
    public int getWidth() {return width; }
    @Override
    public String toString() {return "Square{" + "length=" + length + ", width=" + width + '}';}
}

class Dimension {

    private ArrayList<Square> dims = new ArrayList<>();

    public static void main(String[] args) {
        Dimension value = new Dimension();
        value.addSquare(10, 5);
        value.addSquare(8, 8);
        value.addSquare(10, 2);
        value.addSquare(12, 10);
        value.addSquare(8, 5);
        value.sortDimension();

        for (int i = 0; i < value.dims.size(); i++) {
            System.out.println(value.dims.get(i));
        }
    }

    public void addSquare(int length, int width) {
        dims.add(new Square(length, width));
    }
    public void sortDimension() {
        dims.sort(Comparator.comparing(Square::getLength).thenComparing(Square::getWidth));
    }
}


text:
Q: coefplot: Putting names of regressions with vertical option Currently, I have the following code:
sysuse auto, clear
estimates clear

gen year=.
replace year=1988 if foreign==0
replace year=1989 if foreign==1

regress price mpg trunk length turn if year==1988
estimates store Year1988

regress price mpg trunk length turn if year==1989
estimates store Year1989

coefplot Year1988 Year1989, vertical keep(trunk) xline(0) xlabel("")

This generates:

However, I want to put custom names for each stored regression set of results like:

How can I do this? I tried xtick and xlabel but it doesn't work.
Note: Answer without vertical option can be found here.

A: The idea is the same:
sysuse auto, clear
estimates clear

gen year=.
replace year=1988 if foreign==0
replace year=1989 if foreign==1

regress price mpg trunk length turn if year==1988
estimates store Year1988

regress price mpg trunk length turn if year==1989
estimates store Year1989

local gap1 : display _dup(45) " "
local gap2 : display _dup(40) " "

coefplot Year1988 Year1989, vertical keep(trunk) xline(0) ///
coeflabels(trunk = `""|`gap1'|""1988`gap2'1989""') ///
xlabel(, notick labgap(0)) xline(0) legend(off)


text:
Q: Arduino WiFi enabled LED I am currently looking in various Arduino.
I'd like to build a very specific device:
I'd like to have a lamp (using a RGB LED (already have one)) that can change the color (or do custom routines like blinking etc...).
But these specifications must be met:

*

*Battery powered (so all items must use minimum power)

*WiFi enabled

It's sufficient if I can change the color (or trigger a routine) from a computer on the same network (via netcat or curl).
I looked in the WiFly shield. Is there another shield which is maybe better?
What main Arduino main board is best for my purpose?
Update:
As there are some follow up questions:

*

*The Arduino is not a must. I thought it would be the easiest solution. The raspberry pi didn't come to mind, but is an excellent suggestion. However I'm not sure if it is that easy to hook an LED on to it, also I'm not sure about the Power supply (given that I would be using an USB Wifi Dongle).

*I didn't think that the power supply would that big of a deal as the LED would rarely been switched on (once every few days). Is the idling in the WiFi so power intense?

*For the background of what I'm trying to build: I want to build an extreme feedback device (a device to indicate the status of the automated tests in a software project) to carry around.

A: Based off of your two specifications of

Battery powered (so all items must use minimum power)
WiFi enabled

I would recommend not going with an Arduino at all as it will be much more difficult to meet the minimum power requirement. In order to minimize your power you will need to look into spinning your own board with a very low power microcontroller. It seems like almost every microcontroller company sells some version of ultra low power, but the MSP430 seems to be the most widely used line for low power.
As far as the WiFi enabled part, this is a little bit more difficult to get to be low powered. If you are fine with having your device waking up to check in to see what it needs to do with the LED then you can get your power even lower. However, my guess is that you are actually wanting to be able to send your device a packet at any time to tell it to do something with the LED. In order to go this path with lowest power you would be best rolling your own WiFi solution, but my guess also is that you do not care to do this. So you will want to look for a module that will do this for you. Roving Networks has a few options that support 4uA sleep mode and 38mA active.
With all of that said, if you still want to go with an Arduino (even though you didn't say it was a requirement) you will have to settle for very poor battery life. By very poor battery life I mean something less then a day unless you want to lug around a car battery.

A: There are some really nice (and $6 cheap) Bluetooth UART modules which might be a much cheaper alternative if you are more interested in being wireless, than specifically using Wi-Fi.  I use these (http://www.ebay.com/itm/190433073764) with Arduino and they are very easy to get fired up.  As Cornbread Ninja suggests, Xbee was practically invented for your exact need, but it's still more expensive than the BT option.
It's also true that there arn't going to be any really low power solutions for you which ever way you go, unless you are really keen on going off piste with some exotic uCs, but I'm guessing if your original plan was an Arduino and Wifly, or a rPi and a wifi dongle, this isn't a huge issue for you.
finally, check out the electric Imp too, that could be an option. http://electricimp.com/

A: The Arduino Uno should meet your needs.  You might want to look into the xbee shield.


text:
Q: Find the exact matched string from the variable In the below code, $Result variable has the following information. I need to iterate below each line in $Result variable and get the <APPPOOL NAME> that is, "DefaultAppPool","Classic .NET AppPool" & ".NET v2.0 Classic" as an input to the second Invoke-Command saved in $Result2. Please advise how this can be accomplished.
$Result output:

APPPOOL "DefaultAppPool" (MgdVersion:v4.0,MgdMode:Integrated,state:Started)
APPPOOL "Classic .NET AppPool" (MgdVersion:v2.0,MgdMode:Classic,state:Started)
APPPOOL ".NET v2.0 Classic" (MgdVersion:v2.0,MgdMode:Classic,state:Started)

$Username = '<username>'
$Password = '<Password>'
$pass = ConvertTo-SecureString -AsPlainText $Password -Force
$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username, $pass

$input_file_path = "servers.txt"
$output_path = "result.txt"

foreach ($server in Get-Content $input_file_path) {
    $Result = Invoke-Command -ComputerName $server -Credential $Cred -ScriptBlock {
        C:\Windows\system32\inetsrv\appcmd.exe list apppools
    }
    $Result | Add-Content $output_path
    $Result2 = Invoke-Command -ComputerName #server -Credential $Cred -ScriptBlock {
        C:\Windows\system32\inetsrv\appcmd.exe list apppools <APPPOOL NAME> /text:processmodel.username
    }
}


text:
Q: RESTKIT : How to abort unfinished network calls if new request is sent Is there any way to abort all unfinished network calls which haven't returned responses yet when new network request is called?
Currently all request are getting added in NSOperationQueue. So I want to have one request at a time.

A: Did you set maxConcurrentOperationCount = 1 for your NSOperationQueue?

A: Using the object manager, call cancelAllObjectRequestOperationsWithMethod:matchingPathPattern: - though this does mean you need to know which patterns you want to cancel (or all potential patterns).
Alternatively you can get all of the operations on the queue and cancel them...
Usually you would only cancel one request when a new one is made so the pattern option suffices.


text:
Q: c:forEach not working I have a problem with a taglib method c:forEach. I want to get a List of languages from a servlet class and show it on a jsp page with c:forEach. But it is just showing nothing^^ an empty select tag.
The for each loop in the jsp file (i have taglib import and already tried without c:out):
...
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
...
<c:forEach var="lang" items="${registrationServlet.inputLangs}">
  <option><c:out value="${lang}"></c:out></option>
</c:forEach>

My Servlet Class (it is a servlet because I have to do some form submitting stuff with it too):
...
// List of languages to choose from
List<String> inputLangs;
...
// Query the languages from the database
public List<String> getInputLangs() {
    try {
        String query = "SELECT DISTINCT Lang FROM country";
        ResultSet result = DbConnection.read(query);
        while (result.next()) {
            inputLangs.add(result.getString("lang"));
        }
    } catch (SQLException e) {
        System.err.println("Couldn't get languages from DB.");
    }
    return inputLangs;
}

What am I doing wrong?^^
BTW. it works with pure java:
<%
RegistrationServlet reg = new RegistrationServlet();
for (String lang : reg.getInputLangs()) {
%>
  <option><%=lang%></option>
<%
}
%>

But as far as I know that's a no go in jsp files ;)

A: ${registrationServlet.inputLangs} means:

*

*find an attribute named "registrationServlet" in the page scope

*if not found, find an attribute named "registrationServlet" in the request scope

*if not found, find an attribute named "registrationServlet" in the session scope

*if not found, find an attribute named "registrationServlet" in the application scope

*if found, call getInputLangs() on the found object

So, if you haven't stored any instance of RegistrationServlet in any scope, this expression will always evaluate to null. If you keep this design, the doGet() (or doPost()) method of your servlet should have the following line:
request.setAttribute("registrationServlet", this);

But it would be much cleaner to have
request.setAttribute("inputLangs", getInputLangs());

and, in the JSP:
<c:forEach var="lang" items="${inputLangs}">

A: Have you got correct JSTL jar files on your class path?
In your case JSTL 1.1 JAR file in the /WEB-INF/lib
https://stackoverflow.com/tags/jstl/info


text:
Q: How to draw a line in the shape of a square with rounded corners? I am very glad of your help! I use the following code:
Paint mPaintShape = new Paint();
mPaintShape.setStrokeWidth(AppUtill.dp2px(getContext(), 4));
mPaintShape.setColor(mNormalColor);
mPaintShape.setStyle(Paint.Style.STROKE);

@Override
    protected void onDraw(Canvas canvas) {
        RectF rect = new RectF(0, 0, mSize, mSize);
        canvas.drawRoundRect(rect, mCornerRadius, mCornerRadius, mPaintShape);
    }

And I get the following result. But I want to have rounded outer corners
How can i do this?

A: First create a style file as given
allround.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
    <shape  android:shape="rectangle">
        <solid
            android:color="#ff6600" />
        <stroke
            android:width="2dp"
            android:color="#EAD61C" />
        <corners
            android:radius="7dp" />
        <padding
            android:left="5dp"
            android:top="5dp"
            android:right="5dp"
            android:bottom="5dp" />
    </shape>
</item>
<item>
    <shape android:shape="rectangle">
        <gradient
            android:startColor="#ffff00"
            android:endColor="#FEC34D"
            android:angle="270" />
        <stroke
            android:width="2dp"
            android:color="#2f6699" />
        <corners
            android:radius="7dp" />
        <padding
            android:left="5dp"
            android:top="5dp"
            android:right="5dp"
            android:bottom="5dp" />
    </shape>
</item>
</selector>

and apply this style in your layout component as follow-
android:background="@drawable/allround"

OR YOU can USE>>>>>>>>>>
RectF r = new RectF(1,2,3,4);
canvas.drawRoundRect(r, 0, 0, mPaint);

A: Try this:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true"
        android:drawableRight="@drawable/btnpressed">
        <shape>
            <solid
                android:color="#6B0000" />
            <stroke
                android:width="3dp"
                android:color="#6B0000" />
            <corners
                android:radius="6dp" />
            <padding
                android:left="10dp"
                android:top="10dp"
                android:right="10dp"
                android:bottom="10dp" />
        </shape>
    </item>

    <item>
        <shape>
            <gradient
                android:startColor="#794C3F"
                android:endColor="#794C3F"
                android:angle="270" />
            <stroke
                android:width="3dp"
                android:color="#794C3F" />
            <corners
                android:radius="7dp" />
            <padding
                android:left="10dp"
                android:top="10dp"
                android:right="10dp"
                android:bottom="10dp" />
        </shape>
    </item>
</selector>

A: This solution uses Canvas.drawLine() and  Canvas.draw Arc(). I introduced the offset and set 'mSize' according to the measured Height/ Width to be sure that the desired stroke width is visible on all edges. Modifiying the 'mCornerRadius' will, of course, change the corners.
I used a red Paint with corner radius 8 to get this:

    @Override
protected void onDraw(Canvas canvas)
{
    // to make sure that the whole shape fits into the View
    // (else some lines may be thinner/ missing)
    mSize = Math.min(getMeasuredHeight(), getMeasuredWidth())*0.8f;

    float offset_top = 4;
    float offset_left = 4;
    float sizeMinusRadius = mSize - mCornerRadius;

    // horizontal lines
    canvas.drawLine(offset_left + mCornerRadius, offset_top, offset_left + sizeMinusRadius, offset_top, mPaintShape);
    canvas.drawLine(offset_left + mCornerRadius, offset_top + mSize, offset_left + sizeMinusRadius, offset_top + mSize, mPaintShape);

    // vertical lines
    canvas.drawLine(offset_left, offset_top + mCornerRadius, offset_left, offset_top + sizeMinusRadius, mPaintShape);
    canvas.drawLine(offset_left + mSize, offset_top + mCornerRadius, offset_left + mSize, offset_top + sizeMinusRadius, mPaintShape);

    // corner bottom left
    RectF rBottomLeft = new RectF(offset_left,
          offset_top + mSize - 2 * mCornerRadius, offset_left + 2 * mCornerRadius,
          offset_top + mSize);
    canvas.drawArc(rBottomLeft, 90, 90, false, mPaintShape);
    // corner bottom right
    RectF rBottomRight = new RectF(offset_left + mSize - 2 * mCornerRadius,
        offset_top + mSize - 2 * mCornerRadius, offset_left + mSize, offset_top + mSize);
    canvas.drawArc(rBottomRight, 0, 90, false, mPaintShape);
    // corner top left
    RectF rTopLeft = new RectF(offset_left, offset_top,
                offset_left + 2 * mCornerRadius, offset_top + 2 * mCornerRadius);
    canvas.drawArc(rTopLeft, 180, 90, false, mPaintShape);
    // corner top right
    RectF rTopRight = new RectF(offset_left + mSize - 2 * mCornerRadius, offset_top,
                            offset_left + mSize, offset_top + 2 * mCornerRadius);
    canvas.drawArc(rTopRight, 270, 90, false, mPaintShape);
}


text:
Q: tab and arrow keys weird behavior in redhat I am facing some weird behavior when trying to ssh to the server by using either Iterm2 or OSX Terminal. Basically, the issue is when using tab for auto-completion, it will print one more random extra char in the end, for example:
//the 'e' is extra in this case
$ cd keys/e

And when trying to use any arrow keys for navigation, it basically does not work at all.
//^[[C^[[C^[[C^[[C^[[C^[[C^[[C are printed by pressing arrow keys
$ cd keys/^[[C^[[C^[[C^[[C^[[C^[[C^[[Ce

//Kernel Version
OS Version: 2.6.39-400.246.2.el6uek.x86_64

//Distribution Information
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.6 (Santiago)

But it works just fine in my macbook, I was guessing it is caused by my server profile setting up, but I have double-checked that I do not have either of the following files in my home:
$ vi .bash_profile
$ vi .bashrc

Any help will be appreciated.

A: I had it figured out, it is because of my default shell in the server is ksh, need to ask the system admin to change it to bash or zsh.

A: What you termed "navigation" is part of line-editing.
If you're using ksh, the way to best use its line-editing capabilities is to turn on emacs mode:
set -o emacs

Apparently ksh's developer doesn't use vi, because the vi-mode is very limited.  However, emacs mode is the default.
In your question, the cursor-keys are in normal mode (the ^[[ characters), which is assumed if TERM=linux, while other terminals conventionally use application mode (^[O characters).  If your TERM is set incorrectly, that might confuse ksh.  Some people define aliases in their shell initialization to make the shell work with either.
See for example Make Arrow and delete keys work in KornShell command line.  The solutions in that answer should work for you, since RHEL6 (and CentOS6) use ksh-93:
Name        : ksh                          Relocations: (not relocatable)
Version     : 20120801                          Vendor: CentOS
Release     : 28.el6_7.3                    Build Date: Tue Sep 22 11:08:59 2015
Install Date: Mon Mar 28 16:22:50 2016         Build Host: c6b9.bsys.dev.centos>
Group       : System Environment/Shells     Source RPM: ksh-20120801-28.el6_7.3>
Size        : 1743023                          License: EPL
Signature   : RSA/SHA1, Tue Sep 22 14:35:03 2015, Key ID 0946fca2c105b9de
Packager    : CentOS BuildSystem <http://bugs.centos.org>
URL         : http://www.kornshell.com/
Summary     : The Original ATT Korn Shell
Description :
KSH-93 is the most recent version of the KornShell by David Korn of
AT&T Bell Laboratories.
KornShell is a shell programming language, which is upward compatible
with "sh" (the Bourne Shell).

Further reading:

*

*2.1 Enabling Command-line Editing (Learning the Korn Shell)

*Command Line Editing in Bash and Ksh notes

Some actions are also bound to keys with special markings, eg: Up Arrow, Del (or Delete). These are also shown where applicable. Note that these might not work if the terminal emulation is incorrect, ksh does not support them as well as does bash.


text:
Q: Zeep Client Service Request missing element new to Python/Zeep, please be gentle
when posting the following to my endpoint, all is working as expected:
<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">
    <Body>
        <PassThroughReq xmlns="http://amsservices.com/">
            <XMLinput>
                <INPUT>
                    <Account value="account" />
                    <Username value="username" />
                    <Password value="password" />
                    <Serverpool value="serverpool" />
                    <ProgramName name="WEBSERVICE.GET.POLICY.DATA.IDS" />
                    <Command cmd="279898" />
                </INPUT>
            </XMLinput>
        </PassThroughReq>
    </Body>
</Envelope>

I'm attempting to replicate the request with the following code:
import os
from zeep import Client

account = os.environ.get('sgws_account')
username = os.environ.get('sgws_username')
password = os.environ.get('sgws_password')
serverpool = os.environ.get('sgws_serverpool')
wsdl = os.environ.get('sgws_wsdl')

client = Client(wsdl)

xmlInput = {
    'INPUT':{
        'Account':account,
        'Username':username,
        'Password':password,
        'Serverpool':serverpool,
        'ProgramName':'WEBSERVICE.GET.POLICY.DATA.IDS',
        'Command':'279898'
    }
}

ptr = client.get_element('ns0:PassThroughReq')(xmlInput)

client.service.PassThroughReq(XMLinput=ptr)

the result is "Missing element for Any"
I've also tried the request as follows, with the same result:
client.service.PassThroughReq(ptr)

relative Global elements in the wdsl are:
ns0:PassThroughReq(XMLinput: {_value_1: ANY})

I will paste the full Traceback in a comment below.
I'm hoping this is a simple miss, due to ignorance, on my part but any light you may be able to shed would be greatly appreciated.


text:
Q: Ping with java to multiplatform I need to perform ping to some ip/machine. The code may be executed on any kind of platform (windows, linux, mac) and i need to get the information about loss and the round trip time.
so java's exec of ping is not good enough because then i need to parse ping response as string, which is different per platform and per OS language.
so what do i need to do? I know there is something like JNI, but i'm new to java, so need a little help here.
it still means i need to have native implementation per platform?
Any examples or suggestions?

A: Since java is not platform independent you can ask which OS you have using the System.getProperty("os.name") and parse the response or define the command according to it.
Alternatively you can use isReachable(int timeout) in InetAddress which seems to be the closest implementation to the ICMP ECHO REQUEST, but it will not provide you the information about loss and round trip time.
Another Idea would be to use tracert/tracepath instead of ping to get the round trip? check this thread for some more information.

A: You can't do real ICMP with pure Java. The reasonably portable jpcap library provides a nice Java interface to native libraries, though, including ICMP (ping).

A: I guess parsing is still your easiest option. I would be suprised if you needed more than this regex:
time[<=]([0-9.]+)[ ]?ms

Enclosed in parentheses you will get the time like 1 or 14 or 1.239 which can be fed to Float.parseFloat().

A: I have used JNI to get the ping command.
I have implemented the ping using native (C) and then wrapped it with JNI.
The downgrade is that need to compile the C dll per platform.


text:
Q: Apache POI error when running as a jar I have a program that runs in Eclipse fine, but when exported into a jar file it gives me this error:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/Encryp
tedDocumentException
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.privateGetMethodRecursive(Unknown Source)
    at java.lang.Class.getMethod0(Unknown Source)
    at java.lang.Class.getMethod(Unknown Source)
    at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
    at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.EncryptedDocumentException
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 7 more

I have added the apache poi jar files to my built path so I am unsure why it cannot find that EncryptedCocumentException class.


text:
Q: MySQL JOIN: strings not returning I'm using this MySQL query, called by MySQL:
SELECT tf_posts.*, tf_threads.thread_id FROM tf_threads LEFT JOIN tf_posts ON tf_threads.thread_id=54
When I use mysql_fetch_array I get an array full of each field, but the actual values for the fields are acting very strangely indeed...
Any numeric or date fields are returned just fine; I can use them in the array. Any text fields, however, are empty. The array returned is shown below in it's raw form:
Array
(
    [0] =>
    [id] =>
    [1] =>
    [thread_id] => 820515612
    [2] =>
    [poster_id] =>
    [3] =>
    [title] =>
    [4] =>
    [body] =>
    [5] =>
    [date] =>
    [6] =>
    [edit_date] =>
    [7] =>
    [edited] =>
    [8] =>
    [draft] =>
    [9] =>
    [spam] =>
    [10] => 820515612
)

Ignore the numerical indexes here - I'm interested in the named ones. The fields body and title are text fields (CHAR()), and are, obviously, not displaying when they should be.
What have I done wrong or missed here? Is it because I'm using CHAR()? I strongly doubt it but I'm not great with MySQL.
EDIT:
The idea of this query is to select all threads from one table (tf_threads), and take the first post under that thread from another table (tf_posts) and use the posts title field as the title for the thread.
Thanks,
James

A: Your join clause doesn't make sense to me. It looks like you're trying to get all posts for thread_id 54, but you're not joining the two tables, and you're not getting any data from the tf_threads table other than thread_id, which I presume is also present in your tf_posts table. Why not just use a WHERE clause:
SELECT * FROM tf_posts WHERE thread_id = 54

If this doesn't work, please post your table descriptions and what the query should return.
To answer your edit, you need to actually join the tables then, and with an INNER JOIN if you only want one post - a LEFT JOIN would give you all posts for each thread.
SELECT tf_threads.*, tf_posts.* FROM tf_threads INNER JOIN tf_posts
   ON tf_threads.thread_id = tf_posts.thread_id
   ORDER BY tf_posts.date ASC

This should give you all threads and the first post (as determined by the date column) for each thread.

A: SELECT tf_posts.*, tf_threads.thread_id FROM tf_threads LEFT JOIN tf_posts ON tf_threads.thread_id=54
looks wrong
the ON clause should be joining the 2 tables together using fields in both tables
SELECT tf_posts.*, tf_threads.thread_id
FROM tf_threads LEFT JOIN tf_posts ON tf_posts.thread_id = tf_threads.thread_id
WHERE tf_threads.thread_id = 54
And as Thilo says if you already have the thread ID just use that to limit the posts table with a where clause


text:
Q: Castle ResolveAll returns empty array Here is how my assembly (TestAssembly) looks
Class BaseClass
{
....
....
}

Interface I1
{
....
....
}

Interface I2 : I1
{
....
....
}
Interface I3 : I1
{
....
....
}
Class A : BaseClass, I2
{
....
....
}

Class B : BaseClass, I3
{
....
....
}

I am using Castle Windsor to Register and Resolve all these components.
container.Register(AllTypes.FromAssemblyNamed("TestAssembly")
                            .BasedOn<I1>()
                            .LifestyleSingleton());

Down the line I am trying to ResolveAll Types of I1 (Interface I1) using
container.ResolveAll<I1>();

in hopes of getting an array of objects A and B. Instead I get an empty array. Whats wrong?

A: I believe you need to tell the container which services to associate with the interface, something like:
container.Register(AllTypes.FromAssemblyNamed("TestAssembly")
    .BasedOn<I1>()
    .WithServiceBase()
    .LifestyleSingleton());

A: I seem to have found answers for my questions (see my comments to Hans Jonus's response).
In case of interface inheritance, there is fluent API where in you can specify what interface the service should be using.
Using the example mentioned in the question:
container.Register(Classes.FromAssemblyNamed("TestAssembly")
                   .BasedOn<I1>()
                   .WithService.FirstInterface());

This lets you resolve a specific instances of classes A and B using
I2 ObjA = container.Resolve<I2>();
I3 ObjB = container.Resolve<I3>();

Or, if you want all the instances which are implementing the base interface (I1), you have to register in this way.
container.Register(Classes.FromAssemblyNamed("TestAssembly")
                   .BasedOn<I1>()
                   .WithService.AllInterfaces()
                   );

This way you can do all you want, I mean.
I2 ObjA = container.Resolve<I2>();
I3 ObjB = container.Resolve<I3>();
I1[] ObjArray = container.ResolveAll<I1>();

But this increases the size of the container. I am not sure how it impacts the performance. I will post my findings as I figure out. I appreciate any comments on this. Thanks.


text:
Q: Cancel a method execution in an Aspect (which has been catched by "before") Basicly I'm trying to cancel method execution in an aspect.
So, here's my program:
I have

*

*a Sender Application

*a receiver Application (let's call it the Central Monitor)
In the Sender App :
I have,

*

*An Activity (ın this activity, I have a method called callMethodA() )

*An Aspect (In this aspect, I'm catching before the callMethodA() execution and in this before structure, I'm starting the Service )

*A Service (When this service is started, it basicly sends a String to the Receiver App by Broadcast)

In the Receiver App:
I have :

*

*An Activity ( When a string is broadcasted by sender app, then it receives the broadcast by broadcastreceiver and puts the string into an automaton which checks some condition and when automaton completes, then Result string is broadcasted back to the sender App)

So here's my actual question :
When the Sender App receives the Result string (In the sender's Activity), if the Result is Success, then I want to allow callMethodA() to be executed( this can be done by doing simply nothing, because we caught the callMethodA() execution with before and if we do nothing, then this method will be executed. )
But if the Result is FAIL then I want this method not to be executed and also I want whole program to keep running (I mean for this broadcast result, callMethodA() doesn't have to be executed, It can be executed on the next broadcast result according to the automaton result), also I want to cancel it in the aspect.
Simply, please teach me how can I cancel a method execution in an aspect.
Here's the Sender App codes:
Sender1Activity.java
 package com.example.sender;

import java.util.Random;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class Sender1Activity extends Activity {
    Button btn_send;
    public Intent serviceIntent;
    public Context context;

    //The initial state for automaton Result is Success, nothing fancy.
    static String string_AutomatonResult = "Success";

    public int id;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // context = getApplicationContext();
        setContentView(R.layout.activity_sender1);
        // serviceIntent = new Intent(context, senderService.class);
        btn_send = (Button) findViewById(R.id.buttonSend);

        methodCallerHandler.removeCallbacks(hMyValueTask);
        methodCallerHandler.post(hMyValueTask);

        registerReceiver(broadcastReceiver_AutomatonResult, new IntentFilter(
                "intent_AutomatonResult"));

    }

    // callMethodA()  is called in the random time. It's just provides randomness
    public Handler methodCallerHandler = new Handler();
    public Runnable hMyValueTask = new Runnable() {
        public void run() {
            int n = new Random().nextInt(3000);
            System.out.println("A random delay : " + (float) n / 1000
                    + " seconds");
            callMethodA(new View(getApplicationContext()));
            methodCallerHandler.postDelayed(hMyValueTask, (long) n);

        }
    };

    // The actual method who starts everything, it does simply nothing for now.
    public void callMethodA(View v) {

        System.out.println("MethodA called");
    }

    // Receives Automaton result from the receiver via BroadcastReceiver
    public BroadcastReceiver broadcastReceiver_AutomatonResult = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            Bundle bundle = intent.getExtras();
            if (bundle != null) {
                string_AutomatonResult = bundle
                        .getString("automatonResult_Put_String");
                System.out
                        .println("***************************************************************");
                System.out.println("** Automaton Result returned to Sender1 : "
                        + string_AutomatonResult + "**");
                System.out
                        .println("***************************************************************");
            }
        }
    };

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public void onDestroy() {
        unregisterReceiver(broadcastReceiver_AutomatonResult);
        stopService(serviceIntent);
    }

}

senderService.java
package com.example.sender;

import java.util.Random;

import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;

//Sends "a" string to the receiver via Broadcast
public class senderService extends Service {

    String value = String.valueOf("a");

    @Override
    public void onCreate() {
        super.onCreate();

    }

    public int onStartCommand(Intent intent, int flags, int startId) {
        mSendValue.removeCallbacks(hMyValueTask);
        mSendValue.post(hMyValueTask);
        return startId;
    }

    public Handler mSendValue = new Handler();
    public Runnable hMyValueTask = new Runnable() {
        public void run() {
            publishBuiltinAccelResults(value);

        }
    };

    @Override
    public void onDestroy() {
    }

    public void publishBuiltinAccelResults(String value) {

        Intent intent = new Intent("ResultsA");
        intent.putExtra("resultA", value);
        sendBroadcast(intent);
    }

    @Override
    public IBinder onBind(Intent intent) {
        // TODO Auto-generated method stub
        return null;
    }

}

Test.aj  (Sender's aspect)
package com.example.sender;

import android.app.Activity;
import android.content.Intent;

public aspect Test {
    int i = 1;

    // pointcut for the callMethodA() execution.
    pointcut pointcutCatchMethod(Activity activity) :  execution(* callMethodA(*))
     && target(activity);

    // a hopeless try for me to cancel the method execution, see below please
    pointcut pointcutMethodAExecution() : execution(* callMethodA(*));

    // before callMethodA() execution, start sendService which sends string "a"
    // to the Receiver
    before(Activity activity) : pointcutCatchMethod(activity) {

        System.out.println("******" + "Beginning of " + i
                + "th Aspect *************************");
        Intent sendIntent = new Intent(activity.getApplicationContext(),
                senderService.class);

        System.out.println("SenderService is starting");
        activity.startService(sendIntent);

        System.out
                .println(" callMethodA() cought by before aspect , aspect No: "
                        + i);
        i++;

    }

    // a hopeless try, for example, here, when string_AutomatonResult is FAIL,
    // then I want to cancel callMethodA() execution, then I want also whole
    // program to keep running.
    Object around() : pointcutMethodAExecution(){
        Object result = proceed();
        System.out.println("aut res : "
                + Sender1Activity.string_AutomatonResult);
        System.out.println("******" + "End of " + i
                + "th Aspect ******************");
        return result;
    }

}

Receiver Application codes below:
ReceiverActivity.java
package com.example.receiver;

import android.app.Activity;

public class ReceiverActivity extends Activity {

    TextView txt_recA;
    TextView txt_recB;
    TextView txt_packageNumber;
    String returningStringInput;
    TextView txt_nowReceived;

    int state = 1;
    String automatonResult = "Init";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Integer pkg_number_int = 0;

        setContentView(R.layout.activity_receiver);
        txt_recA = (TextView) findViewById(R.id.txt_recA);
        txt_recB = (TextView) findViewById(R.id.txt_recB);
        txt_nowReceived = (TextView) findViewById(R.id.txt_nowReceived);
        txt_packageNumber = (TextView) findViewById(R.id.txt_packageNumber);

        registerReceiver(receiverResultsA, new IntentFilter("ResultsA"));
        registerReceiver(receiverResultsB, new IntentFilter("ResultsB"));

    }

    // Broadcast Receiver for the string "a" coming from Sender1.
    public BroadcastReceiver receiverResultsA = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            Bundle bundle = intent.getExtras();
            if (bundle != null) {
                String sentStringA = bundle.getString("resultA");
                returningStringInput = sentStringA;
                AutomatonAB(sentStringA);
                txt_recA.setText(sentStringA);
                txt_nowReceived.setText("Now Received String : " + sentStringA);

            }
        }
    };

    // Ignore this BroadcastReceiver, because I have 2 Senders actually. This is
    // for other sender
    public BroadcastReceiver receiverResultsB = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            Bundle bundle = intent.getExtras();
            if (bundle != null) {
                String sentStringB = bundle.getString("resultB");
                returningStringInput = sentStringB;

                AutomatonAB(sentStringB);

                txt_nowReceived.setText("Now Received String : " + sentStringB);

                txt_recB.setText(sentStringB);

            }
        }
    };

    @Override
    protected void onDestroy() {
        super.onDestroy();

        // unregisterReceiver(receiverResultsPackageNumber);
        unregisterReceiver(receiverResultsA);
        unregisterReceiver(receiverResultsB);

    }

    // Automaton for checking the strings coming from the senders. In the end,
    // it broadcasts the result to the senders (FAIL or SUCCESS)
    public String AutomatonAB(String returningString) {
        int stringIntValue = 0;

        // to use Java version below than 1.7, 'cause string value
        // cannot be used on switch...
        if (returningString.equals("a")) {
            stringIntValue = 1;
        } else if (returningString.equals("b")) {
            stringIntValue = 2;

        } else {
            System.out.println("No input");
        }

        switch (stringIntValue) {

        case 1:
            switch (state) {
            case 1:
                System.out.println("Status : Passing from State 1 to State 2");
                state = 2;
                System.out.println(" Success ");
                // Status : Passing from State 1 to State 2 :
                automatonResult = "Success2";

                break;
            case 2:
                System.out
                        .println("Status : Passing from State2 to Failure State");
                state = 3;
                System.out.println(" Failure ");
                // Status : Passing from State2 to Failure State :
                automatonResult = "Failure";

                break;

            default:
                break;

            }

            break;

        case 2:
            switch (state) {
            case 1:
                System.out
                        .println("Status : Passing from State 1 to Failure State");
                state = 3;
                System.out.println(" Failure ");
                // Status : Passing from State 1 to Failure State :
                automatonResult = "Failure";

                break;

            case 2:
                System.out.println("Status : Passing from State 2 to State 1");
                state = 1;
                System.out.println(" Success ");
                // Status : Passing from State 2 to State 1 :
                automatonResult = "Success1";
                break;
            default:
                break;
            }

            break;

        default:
            break;
        }

        // to make automaton keep going on the next turns.
        if (state == 3) {
            state = 1;
        }

        System.out.println("automata result : " + automatonResult);
        txt_packageNumber.setText(automatonResult);

        //Broadcast the automaton result to the senders
        Intent intent = new Intent("intent_AutomatonResult");
        intent.putExtra("automatonResult_Put_String", automatonResult);
        sendBroadcast(intent);

        return automatonResult;
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

}

A: I've resolved my problem, using Around advice is the solution,

*

*if we use proceed() then method is going to be executed, if we don't then it is not going to.

*if method returns a value, you can manipulate the methods return value in around advice like:
return null.
or if the method is void , then simply don't call the proceed().


text:
Q: ProGuard didnt compile with Joda Time used in Windows Actually this is an answer and not a question anymore:
I did spent many hours on Windows using JodaTime to be included in my Android project using ProGuard
Proguard Configuration:
-libraryjars C:\Users\Reto\Documents\GitHub\advanceIT\LoveClockPAY\libs\joda-time-2.1.jar

I had the following errors:

*

*ProGuard didnt find my JAR and said:
Can't read [C:\Users\Reto\Documents\GitHub\advanceIT\LoveClockPAY\libs\joda-time-2.1.jar] (No such file or directory)
Solution
-libraryjars libs/joda-time-2.1.jar

*ProGuard didnt wanna compile and thrown many line of errors like this:
Warning: org.joda.time.base.AbstractDuration can't find referenced class org.joda.convert.ToString
Solution
# Exclude those 2 dependency classes, cause otherwise it wont compile
-dontwarn org.joda.convert.FromString
-dontwarn org.joda.convert.ToString

A: Or alternatively as solution for problem 2. you can add an implementation included in joda-convert-xxx.jar. It can be found on the joda-convert homepage
Then just add a following line into your proguard configuration :
-libraryjars YOUR_DIR_WITHS_JARS/joda-convert-1.3.1.jar


text:
Q: How to get a length of lists in Pandas dataframe I have a dataframe in pandas like this:
                                                             List
2013-12-22 15:25:02  [good morning, good afternoon, good evening]
2009-12-14 14:29:32             [happy new year, happy birthday,]
2013-12-22 15:42:00                      [happy, sad, mad, chill]

how do I get something like this
                                                             List Len
2013-12-22 15:25:02  [good morning, good afternoon, good evening]   3
2009-12-14 14:29:32             [happy new year, happy birthday,]   2
2013-12-22 15:42:00                      [happy, sad, mad, chill]   4

I tried df['List'].str.len(),
but it returns the length in terms of how many words are in this list.

A: I think your solution is nice, if lists in column List:
print (type(df.iat[0, df.columns.get_loc('List')]))
<class 'list'>

df['Len'] = df['List'].str.len()

Solution if not missing values:
df['Len'] = df['List'].apply(len)

If not, first remove possible , in start of end by Series.str.strip and then count number of , with Series.str.count:
print (type(df.iat[0, df.columns.get_loc('List')]))
<class 'str'>

df['Len'] = df['List'].str.strip(' ,[]').str.count(',') + 1
print (df)
                                                             List  Len
2013-12-22 15:25:02  [good morning, good afternoon, good evening]    3
2009-12-14 14:29:32             [happy new year, happy birthday,]    2
2013-12-22 15:42:00                      [happy, sad, mad, chill]    4

If need also convert values to lists:
df['List'] = df['List'].str.strip(' ,[]').str.split(', ')
print (type(df.iat[0, df.columns.get_loc('List')]))
<class 'list'>

df['Len'] = df['List'].str.len()
print (df)
                                                             List  Len
2013-12-22 15:25:02  [good morning, good afternoon, good evening]    3
2009-12-14 14:29:32              [happy new year, happy birthday]    2
2013-12-22 15:42:00                      [happy, sad, mad, chill]    4

A: You can use this
df['Len']=df['List'].apply(lambda x: len(x))

A: Use DataFrame.transform
Ex.
df['Len'] = df['List'].transform(len)
print(df)

                                                             List  Len
2013-12-22 15:25:02  [good morning, good afternoon, good evening]    3
2009-12-14 14:29:32              [happy new year, happy birthday]    2
2013-12-22 15:42:00                      [happy, sad, mad, chill]    4

A: If your List column is str:
df['Len'] = df['List'].map(lambda x: len(x.split(',')))

A: I do not find any problem with your code. It should work fine. As mentioned by @moys you can also use apply method to create a new column which contains the length of the list column.
df['length']=df['List'].apply(lambda row: len(row))
print(df)
                                                             List  length
2013-12-22 15:25:02  [good morning, good afternoon, good evening]    3
2009-12-14 14:29:32              [happy new year, happy birthday]    2
2013-12-22 15:42:00                      [happy, sad, mad, chill]    4

Let me know if you have any issues regarding this.


text:
Q: How to append items to a file that contains a json array? I'm trying to append user_id to user_blacklist.json:
def follow(self, user_id):
    with open('user_blacklist.json', 'w') as fp:
    json.dump(user_id, fp)

user_blacklist.json looks like this:
{
    "user_blacklist": [
      "1691998847",
      "1691998847",
      "APPEND_NEW_ID_HERE"
    ]
}

But as you can see, I'm overwriting the whole file with user_id, instead of appending to the list. I'm sure it's easy, but I have zero experience with Python.

A: You have to read all json, add element and save all json.
with open('user_blacklist.json', 'r') as fp:
    data = json.load(fp)

data['user_blacklist'].append(user_id)

with open('user_blacklist.json', 'w') as fp:
    json.dump(data, fp)


text:
Q: SQL query - how to aggregate only contiguous periods without lag or lead? I'am still a novice and excuse for my english. You see that I have two persons with different periods of time and I want to aggregate the periods if they are contiguous. I don't know how to use for example the min() and max() functions related to the next line or the line before to compare the date. Or is there in easier way to solve this? I only have SQL Server 2008 R2 without the lag and lead-functions.
Sample data:
DECLARE @Table TABLE(
    PersonID INT,
    FROM    date,
    TO date
)

INSERT INTO @Table SELECT 1,'2011-01-01','2011-04-30'
INSERT INTO @Table SELECT 1,'2011-05-01','2011-08-31'
INSERT INTO @Table SELECT 1,'2011-09-01','2011-12-31'
INSERT INTO @Table SELECT 1,'2012-01-01','2012-03-31'

INSERT INTO @Table SELECT 2,'2011-03-01','2011-06-30'
INSERT INTO @Table SELECT 2,'2011-07-01','2011-10-31'
INSERT INTO @Table SELECT 2,'2013-01-01','2013-04-30'
INSERT INTO @Table SELECT 2,'2013-05-01','2013-08-31'

I expect something like this and look especially on PersonID 2:
 PersonID FROM TO
 1 , 2011-01-01 , 2012-03-31
 2 , 2011-03-01 , 2011-10-31
 2 , 2013-01-01 , 2013-08-31

A: This is a hard problem that would be made easier with cumulative sums and lag() or lead().  You can still do the work.  I prefer to express it using correlated subqueries.
The logic starts by identifying which records are connected to the "next" record by an overlap.  The following query uses this logic to define OverlapWithPrev.
      select *
      from (select t.*,
                   (select top 1 1
                    from t t2
                    where t2.personid = t.personid and
                          t2.fromd < t.fromd and
                          t2.tod >= dateadd(d, -1, t.fromd)
                    order by t2.fromd
                   ) as OverlapWithPrev
            from t
           ) t

This takes on the value of 1 when there is a previous record and NULL when there is not one.
Then with this information, the query then finds for each record the next record that is not overlapped with the previous one (and on the same person).  When you have a sequence of overlapping records, then all will have the same such next record, and the next record is used for aggregation.
Here is the full query:
with tp as
     (select *
      from (select t.*,
                   (select top 1 1
                    from t t2
                    where t2.personid = t.personid and
                          t2.fromd < t.fromd and
                          t2.tod >= dateadd(d, -1, t.fromd)
                    order by t2.fromd
                   ) as OverlapWithPrev
            from t
           ) t
     )
select personid, min(fromd) as fromd, max(tod) as tod
from (select tp.*,
             (select top 1 fromd
              from tp tp2
              where tp2.OverlapWithPrev is null and
                    tp2.personid = tp.personid and
                    tp2.fromd > tp.fromd
             ) as NextFromD
      from tp
     ) tp
group by personid, NextFromD;

Here is a SQLFiddle to show how it works.


text:
Q: Many-to-Many extra field in activejdbc I have 3 tables:
person (person_id, person_name),
game (game_id, game_name)

and the linked table
play(person_id, game_id, score).

With ActiveJdbc I use many2many annotation and it works fine to get all games for 1 person
List<Game> games = person.get(Game.class, "person_id = ?", personId);

My question is how to get the value "score"?
I tried game.getScore() but it obviously didn't work
edit:
I want the complete list of game from 1 person. Here is the result I want
game1 | 21
game2 | 33
game3 | 44

In SQL in should be something like:
select game.name, play.score
from game join play on (game.game_id = play.game_id)
join person on (game.person_id = person.person_id)
where person_id = 1;

A: There is probably more than one way of doing this, but here is a way. You can think of Many-to-Many relationship as two One-to-Many relationships, where Play is a child of both, Person and Game. Then you approach from a different angle:
List<Play> plays = Play.where("person_id = ?", 1).include(Person.class, Game.class);

By using include() you are also optimizing and running fewer queries: http://javalite.io/lazy_and_eager.
Depending on your query conditions, you might have just one play:
Game game = plays.get(0).parent(Game.class);
Person = plays.get(0).parent(Person.class);

If course, you'd be able to get to your score:
int score = plays.get(0).getScore();

hope it helps!


text:
Q: passing a pointer to a char array in c I wrote a small test program to see how I can pass a pointer to a char array to a function.  This is my code:
#include <stdio.h>
#include <string.h>

int scopy(char *org ){
    printf("the value of org is %s" , org);
    printf("\n");
}

int main(void)
{
    char original[11];
    strcpy(original , "helloworld");

    scopy(original);

    printf("the value of original now is %s" , original);

    return 0;
}

My knowledge of pointers tells me that org is a pointer that is passed the memory address of original[0] , when I execute this program I observe a few things that has confused me and has caused me to doubt the facts I have learnt about pointers.
when I print org I get the complete word back . but according to the logic if pointers isnt this supposed to print out the memory address;
when I try printing out out[1] , out[2] , codepad tells me that the process has ended abnormally
My  basic doubt in this question is what exactly is org doing , I understand it is a char pointer pointing to a memory address (which??) . Any help would be appreciated . I am very new to c programming .
Also when I try a while loop like
while(out[i] !='\0')
printf("%s",out[i]);

it does not terminate at the '\0' . the strcpy documentation states that the '\0' is copied to the char array.

A: org is a pointer to a char, which is what you're passing in scopy (a pointer to the first element of an array). When you use the specifier %s in printf you are treating a pointer to a char as a string; if you want to print its value as a pointer you should use %p instead. For example: printf("The memory address in org is %p\n", org);
From what you say I get the feeling you think that %s will convert a number to a string. It won't do that, it expects a pointer to the first character of a string.
Remember that the name of an array is equivalent to &array[0], i.e. when you pass the name of an array in a function you are passing a pointer to the first element. So here, when you call scopy(original) it's the same as writing scopy(&original[0]), and since original[0] is a char and & is a pointer to it, that's why your function takes char *.

A: Yes, you're right, when you call scopy(original); , scopy gets passed a pointer to the 1. element in the original array.
scopy(original); is the exact same as scopy(&original[0]);
However, you use %s with printf. %s expects the matching argument to be a char pointer , poiting to a sequence of chars, and the end of that sequence is a 0 byte. That's what C calls a string.
That means you can't do e.g. printf("%s",org[i]); , since org[i] is a char, it's not a char pointer into an array that ends with a 0 byte.
You can print a single char by doing prinf["%c", org[0]) `while(out[i] !='\0')
Or for your while loop:
while(out[i] !='\0')
  printf("%c",out[i]);

And you could also try:
while(out[i] !='\0')
  printf("%s",&out[i]);


text:
Q: How Can I Bind the Roles Array into the view to display the data The below is is the method to display the team member grid.
 function CreateRecruiterGrid() {
    var searchKeyWord = $("#txtAdKeyWords").val();
    var foreName = $("#txtForeName").val();
    var surName = $("#txtSurname").val();
    var email = $("#txtEmail").val();
    var orgId = $("#ddlRoles").val();
    var vUrl = '@Url.Action("List","Team")';
    var vColumnHeaderNames = ["RecruiterId", "EmailVerified", "FORE NAME", "SUR NAME", "EMAIL", "ROLES", "ACTIONS"];
    jQuery(function ($) {
        var gridSelector = "#grid-table";
        var pagerSelector = "#grid-pager";
        jQuery(gridSelector).jqGrid({
            url: vUrl,
            datatype: 'json',
            type: 'GET',
            height: "auto",
            colNames: vColumnHeaderNames,
            colModel: [
                { name: 'RecruiterId', index: 'RecruiterId', key: true, hidden: true },
                { name: 'EmailVerified', index: 'EmailVerified', hidden: true },
                { name: 'Forename', index: 'Forename', width: 180, align: "left" },
                { name: 'Surname', index: 'Surname', width: 200, align: "left" },
                { name: 'Email', index: 'Email', width: 200, align: "left" },
                { name: 'Role', index: 'Role', width: 200, align: "center" },
                { name: 'Action', index: 'Action', width: 140, align: 'center', editable: false, sortable: false, search: false }
            ],
            viewrecords: true,
            viewpages: true,
            gridComplete: function () {
                var ids = $('#grid-table').jqGrid('getDataIDs');
                for (var i = 0; i < ids.length; i++) {
                    var recId = ids[i];
                    var rowData = $('#grid-table').jqGrid('getRowData', recId);
                    var rowHtml = "
";
                    rowHtml += "Delete";
                    $('#grid-table').jqGrid('setRowData', ids[i], { Action: rowHtml });
                };
            },
            jsonReader: {
                root: 'RecruiterData',
                id: 'RecruiterId',
                records: 'Records',
                rows: 'PageSize',
                page: 'PageIndex',
                total: 'TotalPages',
                repeatitems: false
            },
            rowNum: 100,
            rowList: [2, 10, 50, 100],
            pager: pagerSelector,
            altRows: true,
            multiselect: true,
            multiboxonly: true,
            loadonce: false,
            beforeRequest: function () {
                var p = this.p, pd = p.postData;
                p.url = '@Url.Action("List", "XpressJobsTeam")'
                    + '?pageNumber=' + pd.page
                    + '&recordsPerPage=' + pd.rows
                    + '&keyWord=' + searchKeyWord
                    + '&sortVal='
                    + '&forename=' + foreName
                    + '&surname=' + surName
                    + '&email=' + email
                    + '&orgId=' + orgId;
                p.postData = {};
                $("#load_grid-table").text("Retrieving Team Members...");
            },
            loadComplete: function () {
                var table = this;
                setTimeout(function () {
                    styleCheckbox(table);
                    updateActionIcons(table);
                    updatePagerIcons(table);
                    enableTooltips(table);
                }, 0);
                $("#recruiterGridContainer div").each(function () {
                    if (!$(this).hasClass("ui-pg-div") && !$(this).hasClass("loading")) {
                        if ($(this).hasClass("ui-jqgrid-hbox")) {
                            $(this).attr('style', 'width:100%;padding-right:0;');
                        }
                        else {
                            $(this).attr('style', 'width:100%;');
                        }
                    }
                });
                $("#recruiterGridContainer table").each(function () {
                    if (!$(this).hasClass("navtable")) {
                        if ($(this).hasClass("ui-pg-table")) {
                            $("#grid-pager_left").attr('style', 'width:35%');
                            $(this).attr('style', 'width:100%;margin-top:5px;');
                        } else {
                            $(this).attr('style', 'width:100%');
                        }
                    }
                });
            },
            caption: "team Members",
            autowidth: true
        });

Currently the grid is visible as below.

The details of the roles of each person is receiving to the controller in my implemented method.But its not displayed in the grid.The Roles are received as an array.(As one member can have one or more roles).
As I understand the issue is with data binding.I want to know how can I bind the roles array in the Jquery method above. I have tried several ways but no success.
I am new to Jquery and any help is appreciated.
---UPDATED---
What I have tried.
changed the line as
{ name: 'Role', index: 'Role', width: 200, align: "left", formatter: roleFormatter },

and implemented function is as below.
   function roleFormatter(cellvalue, options, rowObject) {
        let selectedRoles = "";
        for (var role in cellvalue)
        {
            selectedRoles += role.RecruiterRole;
        }
        return selectedRoles;
    }


text:
Q: Best Linux for a single application & fast boot? (also How-to?) I'm looking for a way to run Celtx,a screenwriting software on a Linux Distro and nothing else, no bluetooth, internet/WiFi, media, games, nothing, not even a desktop. Just boot up the OS and Bam! Celtx. Also, a fast boot would be great.
P.S. I'd need to automount a NTFS partition.
Any ideas?
Thanks

A: You can strip any linux distro down to the bare bones - the simplest thing to do is take a distro you already are familiar with and boot into run level 1 - the standard 'single user mode'.  You won't have networking or any daemons, but you may have a desktop, depending on what you're using.  You could define a custom run level to do whatever.  Run level 4 is usually used for this.  It's undefined, so you can make it whatever you want.
Alternatively, take a look at the linux distros tuned for smallness
EDIT
Linux is not exactly famous for speedy boot times, but the less you run at startup, the faster it will be.

A: As mentioned by DaveParillo, any distibution can be stripped down to next to nothing. However, building a system from the ground up is probably preferable in your case. This is what Arch Linux was designed for. If you are comfortable with this idea, continue...
--

*
*
Follow the official or beginner's installation guide to install the base system.

*
To mount your NTFS partition automatically, open up your /etc/fstab and add the following line (/dev/sdb1 being the NTFS partition and /mnt/device being the mount point):
/dev/sdb1 /mnt/device ntfs defaults 1 0

*
If you want to be able to log in automatically you will need to take a few extra steps. First, install mingetty from the Arch User Respository (AUR). Here is a small guide to help you do that if you are unfamiliar with Arch Linux.
Next, open up /etc/inittab and change the line that looks like:
c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux

to the following:
c1:2345:respawn:/sbin/mingetty --autologin username tty1 linux

*
Install X by executing the following commands as root:
pacman -Syu
pacman -S libgl xorg xf86-input-evdev mesa vesa

Configure X with:
Xorg -configure
cp /root/xorg.conf.new /etc/X11/xorg.conf

If xorg is giving you problems you can refer to the wiki.
(If sound is also needed you can follow the steps that are given here)

*
Edit your ~/.bash_profile so that when you log into TTY1 X will start automatically:
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
    exec startx
    logout
fi

*
Edit ~/.xinitrc and include the following (replacing celtx with whatever command starts the program you want to run):
exec celtx
shutdown -h now

Once you quit celtx Arch Linux will shut down.
You also mentioned that you would like a fast boot time. I'm not sure how this compares to what you are looking for, but on a ~7 year old computer I managed to get mine down to 23 seconds by following this guide.


text:
Q: What is $\mathbb FG$ for $\mathbb F$ a field and $G$ a finite group? I have encountered the notation $\mathbb FG$ for $\mathbb F$ a field and $G$ a finite group, but I don't know what this stands for. I am to show that the center of $R=\mathbb FG$ is a linear subspace of $R$ and prove its dimension is equal to the number of conjugacy classes in $G$.
What is $\mathbb FG$?

A: It's what is frequently called a group algebra.  Basically, it is a vector space over $\mathbb{F}$ with the basis being elements of the group (treated as formal symbols).  So if your group was $\{e, a, a^{2}\}$ (with $a^{3} = e$), then
$$\mathbb{F}G = \{ c_{1}\cdot e +c_{2} \cdot a + c_{3} \cdot a^{2} \ : \ c_{i} \in \mathbb{F}\}.$$
In addition to being a vector space, you have a multiplication of vectors that uses the group multiplication.

A: It stands for group ring which appears in group representation theory.


text:
Q: Animate ScaleX and ScaleY over time with tween not working in CocosSharp I am trying to animate the ScaleX and ScaleY properties of my Sprite using the following code. Nothing is happening though. I am used to using UIViews and the UIView.Animate method which allows me to set my end result and a duration. Is something like this possible with cocos?
        baloon.RunAction(new CCActionTween(.009f, "ScaleX", baloon.ScaleX,  (float)(w / baloon.ContentSize.Width)));
        baloon.RunAction(new CCActionTween(.009f, "ScaleY", baloon.ScaleY,  (float)(h / baloon.ContentSize.Height)));


text:
Q: How to find a basis for $R^3$ which contains a basis of im(C)? Find a basis for $R^3$ which contains a basis of $im(C)$ (image of C), where
$$C=\begin{pmatrix}1 & 2 & 3&4\\\ 2 & -4 & 6& -2\\ -1 & 2 & -3 &1   \end{pmatrix}$$
I managed to row-reduce the matrix to
$$C=\begin{pmatrix}1 & 2 & 3&4\\\ 0 & 8 & 0& 6\\ 0 & 0 & 0 &4   \end{pmatrix}$$
Therefore, a basis of $im(C)$ is given by the leading columns:
$$Basis = {\begin{pmatrix}1\\2\\-1 \end{pmatrix}, \begin{pmatrix}2\\-4\\2 \end{pmatrix}, \begin{pmatrix}4\\-2\\1 \end{pmatrix}}$$
However, what does the question mean by "Find a basis for $R^3$ which contains a basis of im(C)?According to the answers, one possible answer is:
{$\begin{pmatrix}1\\2\\-1 \end{pmatrix}, \begin{pmatrix}2\\-4\\2 \end{pmatrix}, \begin{pmatrix}0\\1\\0 \end{pmatrix}$}

A: You've made a calculation error, as the rank of your matrix is actually two, not three. If the rank of $C$ was three, you could have chosen any basis of $\mathbb{R}^3$ (not necessarily even consisting of some of the columns of $C$). But in your case, we have
$$ \begin{pmatrix} 3 \\ 6 \\ -3 \end{pmatrix} = 3 \begin{pmatrix} 1 \\ 2 \\ -1 \end{pmatrix}, \\
\begin{pmatrix} 4 \\ -2 \\ 1 \end{pmatrix} = \frac{3}{2} \begin{pmatrix} 1 \\ 2 \\ -1 \end{pmatrix} + \frac{5}{4} \begin{pmatrix} 2 \\ -4 \\ 2 \end{pmatrix}$$
so the last two columns depend linearly on the first two columns. To find a basis for $\mathbb{R}^3$ which contains a basis of $\operatorname{im}(C)$, choose any two linearly independent columns of $C$ such as the first two and add to them any third vector which is linearly independent of the chosen columns of $C$.


text:
Q: $G=\{(x,y)\in\Bbb R^2 | 1\leq x^2 + y^2\leq16 \text{ and } 0\leq x \text{ and }0\leq y \}$ Calculate $\underset{G}{\int\int}xy^2dxdy $ I'm making some exercises for my analysis exam, and i'm having trouble with this exercise.
$G=\{(x,y)\in\Bbb R^2 | 1\leq x^2 + y^2\leq16 \text{ and } 0\leq x \text{ and }0\leq y  \}$
Calculate $$\underset{G}{\int\int}xy^2dxdy $$
I think that:
$$\underset{G}{\int\int}xy^2dxdy = \int_0^{\tfrac{1}{2}\pi}\int_1^4 r^4 \cos \theta \sin \theta^2 dr d\theta $$
But I don't how to continue. Am I on the right track?

A: As you've got:
$$
\underset{G}{\int\int}xy^2dxdy = \int_0^{\tfrac{1}{2}\pi}\int_1^4 r^4 \cos \theta \sin^2 \theta dr d\theta = \int_1^4 r^4dr\int_0^1 u^2 du=
\left. \frac{r^5}{5}\right|_{r=1}^4 \, \left.\frac{u^3}{3}\right|_{u=0}^1=
\frac{4^5-1^5}{5}\frac{1-0}{3}=\frac{1023}{15},
$$
where I used the substitution $u=\sin \theta \Rightarrow du=\cos \theta d\theta$.


text:
Q: Should we consider for overflow when use Neon intrinsics such as vadd_s8 If we have such C code
spatial_pred= (cur[mrefs] + cur[prefs])>>1;

when transform to Neon intrinsics
int8x8_t cur_mrefs = vld1_s8(cur+mrefs);
int8x8_t cur_prefs = vld1_s8(cur+prefs);
int8x8_t spatial_pred = vshr_n_s8(vadd_s8(cur_mrefs, cur_prefs), 1);

Do we need to consider for overflow when vadd_s8(cur_mrefs, cur_prefs)? Whether we should use vadd_s16 instead?

A: If you don't want to lose overflow information, you should first move int8x8_t to int16x8_t then do the summing.
If you want result to saturate then you should use vqadd.
Vector saturating add: vqadd -> Vr[i]:=sat<size>(Va[i]+Vb[i])

If you just want to convert C version you should use vhadd or vrhadd (rounds) which does halving the sum instead of trying to do shift as a second step.
Vector halving add: vhadd -> Vr[i]:=(Va[i]+Vb[i])>>1
Vector rounding halving add: vrhadd -> Vr[i]:=(Va[i]+Vb[i]+1)>>1


text:
Q: Working with a cathode-based LED seven-segment display I have recently purchased an Arduino micro and am using it to learn more about electronics and embedded systems. I have a numeric LED display HDSP-H101 with the following circuit diagram, and I am trying to figure out how I can use the digital I/O pins on the Arduino to activate different segments of the display.

simulate this circuit – Schematic created using CircuitLab
If the diodes were oriented the opposite way, it would be a simple matter of connecting the output pins (and a resistive load) to each of the pins and the cathode to ground and then when the pin was set to HIGH a forward-bias voltage would be applied across the LED and it would light up. However, in this case a reverse-bias voltage would be applied and therefore I am unsure of the best way to selectively light each segment?

A: A simple common anode display like you have is just the opposite of a common cathode display. Just reverse (invert the logic). Connect the common pin to V+ (5v for a regular arduino), and each segment pin to an appropriatte resistor then to the arduino pins.
Since you are inverting the logic HIGH turns off the segment, LOW turns it on. The arduino pin acts like the ground. Simple.
Just keep in mind the arduino pin and port current limits.

A: Use an open collector inverter IC such as an SN74ALS05A (BJT based) or an open drain buffer like the 74LCX07 (FET based).
In such a configuration, you wire up a positive voltage supply to the common anode of the display then route each output through a current-limiting resistor and an output on the inverter or buffer IC. The current will flow through the internal transistors in the IC to ground, completing the circuit and lighting up the display segment.

A: Connect the middle pin on the top or on the bottom to 5v on the arduino.Make sure you use a current limiting resistor. And connect the other pins to the digital pins on the arduino. To light up a segment, just drive the pin low. In this case the pins would be sinking current. Just make sure the total current is within safe limits for the arduino.


text:
Q: CXF JAX-RS 2.0 client, difficulty adding compression and/or logging interceptors I am trying to use the JAX-RS 2.0 client in CSF 3.x, but am having some difficulty finding a way to programatically add interceptors to the client. I'n particular I'm trying to add the regular gzip and logging interceptors, something that worked well on the server side, to the client side as well.
I would prefer to use the JAX-RS standard client, rather than the CXF-specific WebClient or Proxy methods. I'm not opposed to some CXF-specific code in configuring the client, or using a different API than can then be converted to a JAX-RS standard Client/WebTarget, but to tie the entire client to CXF is undesirable to me.
I can accomplish what I intend to do by implementing my own Client(Request|Response)Filters, but it would be preferable to reused the well-tested logic that CXF already contains for this purpose.
This all seems rather simple to do if I was using Jersey, but does anyone have any idea on how to do this in CXF?


text:
Q: Postfix: Recipient address rejected: Invalid HELO/EHLO; Must be a FQDN or an address literal When sending emails, I receive undelivered mail with the following message "Recipient address rejected: Invalid HELO/EHLO; Must be a FQDN or an address literal, not 'xxx' 554 5.7.1" from certain webservers (where xxx is the name of my VPS).
I checked the logs but didn't find anything suspicious.
The postfix configuration is as follows (should be fairly default):
# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

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

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

readme_directory = /usr/share/doc/postfix

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

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

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = vm19243
alias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
alias_database = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
myorigin = /etc/mailname
mydestination = vm19243, localhost, localhost.localdomain
relayhost =
mynetworks = 127.0.0.0/8 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
virtual_alias_domains =
virtual_alias_maps = hash:/var/lib/mailman/data/virtual-mailman, proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, proxy:mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /var/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
inet_protocols = all
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf
smtpd_tls_security_level = may
transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
relay_domains = mysql:/etc/postfix/mysql-virtual_relaydomains.cf
relay_recipient_maps = mysql:/etc/postfix/mysql-virtual_relayrecipientmaps.cf
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipi$
smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf

I tried playing around with different "smtpd_relay_restrictions" setups but to no avail.
I have also checked the spam blacklists but the IP does not seem to be blacklisted (according to mxtoolbox.com).
I welcome any suggestions!
Running on Debian 8.6, postfix version 2.11.3

A: Either change myhostname to include the domain (must exist as a register on the dns server of that domain and be accesible publicly) or leave myhostname as is and force the helo with the public domain by using smtp_helo_name
So it could be

myhostname = vm19243.domain.com

Or it could be

myhostname = vm19243
smtp_helo_name = mail.domain.com


text:
Q: Implementing 3D-Touch with swift on View Im experimenting with the 3D-Touch/Force-Touch these days and Im new to iOS Development.
If I search for 3D-Touch in Swift - I always find something about Peek & Pop or Quick-Actions on Home Screen.
I want to ask, if its possible to initiate a 3D-Touch somewhere on my View? For example - Every time I make a 3D-Touch, a rectangle will be shown on that specific Touch-position. And after that make some other gestures with the rectangle.
Thanks in advance!


text:
Q: Regularity of Laplace equation on non-convex polyhedral domain This might be a known problem, but I could not find a precise answer.
I have the following Laplace equation
\begin{equation}
\begin{cases}
-\Delta u = f & x \in \Omega;\\
\quad\: u = g & x \in \partial \Omega,
\end{cases}
\end{equation}
on a GENERAL polyhedral domain $\Omega \subset\mathbb{R}^3$ (the only assumption is that $\Omega$ has finitely many faces), with $f\in\mathcal{C}^{\infty}(\Omega)$ and $g\in\mathcal{C}^0(\partial\Omega)$. Assume that there exists $\varepsilon > 0$ such that, for each face $F$ of $\partial\Omega$, the restriction $g_{|F} \in H^{1+\varepsilon}(F)$. Two questions:

*

*Does there exist $\eta > 0$ such that $u\in H^{\frac{3}{2}+\eta}(\Omega)$?

*Is it true that $u\in\mathcal{C}^0(\Omega)$?

Note that claim 1 implies 2.