text:
Q: Google SteppedArea chart - custom tooltips two animated datasets I have a SteppedArea Google chart and I need custom tooltips after animating both of the datasets. But it unfortunately works only in the second dataset. My guess is, that there will be some problem with in my first dataset using
data1.addRows([values[1][index]]);

and in the second dataset i'm using
data1.setValue(index2, 1, values[0][index2][1]);

I tried to uset the setValue() function in both datasets, but in the first there is an error, because there are no rows existing when i want to set the value.
I had addRows() in both cases, but had to change due to wrong animation of the second dataset - here's the explanation: Google charts - animation of stepped chart
See the fiddle for demonstration: https://codepen.io/jan_cafourek/pen/ybzqRa
Thank you in advance

A: first, tooltip role columns may only represent one series column
and must follow the series they represent
to have a tooltip for each series, you will need to add another column to the data table...
var data1 = new google.visualization.DataTable();
data1.addColumn("number", "Year");
data1.addColumn("number", "One");
data1.addColumn({type:'string', role: 'tooltip'});  // <-- tooltip for "One"
data1.addColumn("number", "Two");
data1.addColumn({type:'string', role: 'tooltip'});  // <-- tooltip for "Two"

this will change the structure of the array data...
var values = [
  [
    [1, 1.22, 'tooltip one', null, null],
    [2, 1.22, 'tooltip one', null, null],
    [3, 1.22, 'tooltip one', null, null],
    [4, 1.22, 'tooltip one', null, null],
    [5, 1.22, 'tooltip one', null, null],
    [6, 1.55, 'tooltip one', null, null],
    [7, 1.55, 'tooltip one', null, null],
    [8, 1.55, 'tooltip one', null, null],
    [9, 1.90, 'tooltip one', null, null],
    [10, 1.90, 'tooltip one', null, null]
  ],
  [
    [1, null, null, 2.11,'tooltip two'],
    [2, null, null, 2.11,'tooltip two'],
    [3, null, null, 2.11,'tooltip two'],
    [4, null, null, 0.80,'tooltip two'],
    [5, null, null, 0.80,'tooltip two'],
    [6, null, null, 0.80,'tooltip two'],
    [7, null, null, 0.80,'tooltip two'],
    [8, null, null, 1.00,'tooltip two'],
    [9, null, null, 2.10,'tooltip two'],
    [10, null, null, 2.10,'tooltip two']
  ]
];

finally, you can only set one column value at a time using setValue,
so need to add another setValue for the tooltip...
data1.setValue(index2, 1, values[0][index2][1]);
data1.setValue(index2, 2, values[0][index2][2]);

see following working snippet...

google.charts.load("current", {
  callback: function () {
    drawStepChart();
  },
  packages: ["corechart", "table"]
});

// two sets of values
var values = [
  [
    [1, 1.22, 'tooltip one', null, null],
    [2, 1.22, 'tooltip one', null, null],
    [3, 1.22, 'tooltip one', null, null],
    [4, 1.22, 'tooltip one', null, null],
    [5, 1.22, 'tooltip one', null, null],
    [6, 1.55, 'tooltip one', null, null],
    [7, 1.55, 'tooltip one', null, null],
    [8, 1.55, 'tooltip one', null, null],
    [9, 1.90, 'tooltip one', null, null],
    [10, 1.90, 'tooltip one', null, null]
  ],
  [
    [1, null, null, 2.11,'tooltip two'],
    [2, null, null, 2.11,'tooltip two'],
    [3, null, null, 2.11,'tooltip two'],
    [4, null, null, 0.80,'tooltip two'],
    [5, null, null, 0.80,'tooltip two'],
    [6, null, null, 0.80,'tooltip two'],
    [7, null, null, 0.80,'tooltip two'],
    [8, null, null, 1.00,'tooltip two'],
    [9, null, null, 2.10,'tooltip two'],
    [10, null, null, 2.10,'tooltip two']
  ]
];

function drawStepChart() {
  var data1 = new google.visualization.DataTable();
  data1.addColumn("number", "Year");
  data1.addColumn("number", "One");
  data1.addColumn({type:'string', role: 'tooltip'});
  data1.addColumn("number", "Two");
  data1.addColumn({type:'string', role: 'tooltip'});

  var options = {
    animation: { duration: 50 },
    areaOpacity: 0
  };

  var stepchart = new google.visualization.SteppedAreaChart(
    document.getElementById("step")
  );

  var index = 0;
  var index2 = 0;
  var animate1 = function() {
    if (index < values[1].length) {
      data1.addRows([values[1][index]]);
      stepchart.draw(data1, options);
      index++;
    } else {
      if (index2 < values[0].length) {
        data1.setValue(index2, 1, values[0][index2][1]);
        data1.setValue(index2, 2, values[0][index2][2]);
        stepchart.draw(data1, options);
        index2++;
      }
    }
  };
  google.visualization.events.addListener(
    stepchart,
    "animationfinish",
    animate1
  );
  stepchart.draw(data1, options);
  animate1();
}
#step {
  width: 100%;
  height: 500px;
}


text:
Q: Makefile to process a folder's contents I have a folder with some markdown files I want to process using pandoc and output them into another folder for a Jekyll site. I am attempting to use the following Makefile:
MARKDOWN = $(wildcard *.md)

jekyll-build : _posts/$(MARKDOWN)
        bundle exec jekyll build

_posts/%.md : source/%.md
        pandoc -s -t markdown-citations -o $@ $<

However, instead of looking for the contents of the _posts folder, make is looking for any *.md files in the current working directory (where I have an index.md file), then complains it can't find _posts/index.md. From this question I gather it's the expected behavior of pattern rules, so my question is: how do I get make to look for all existing files in the source folder and run the recipe on each one of them?

A: MARKDOWN = $(wildcard source/*.md)

POSTS := $(patsubst source/%,_posts/%, $(MARKDOWN))

jekyll-build : $(POSTS)
    ...

_posts/%.md : source/%.md
    ...

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can you get the list of items that match a QSortFilterProxyFilter? I have a QSortFilterProxyModel filter items in a QStandardItemModel. I want to be able to see how many items match my filter. Is this possible?
I expect that if my QStandardItemModel has 10 items and my QSortFilterProxyModel only shows 4 after applying the QRegEx that the number 4 is queryable.
Update
This is for a QTableView


text:
Q: Moving Game Object with UI Buttons I am trying to set up control of Player game object by UI buttons.
2d top down view scene.
I want to transfer Player object smoothly on fixed distance (0.8 for Axix X for left-right direction and 2.4 for up-down)when I release left/right/up/down ui buttons.
Here i found code for smooth movement but there Player is moving all the time while ui button is pressed.
Can you help me to make it move on mouse up (pointer up) and to move for public x= 0.8f for left/right, and public y = 2.4f for up/down
And at the same time i want to use different speed (peblic) for moves on x and y Axis
Its ok if it should be totally other script using smth like transform.translate
Kindly guide to for any possible solution for this. Thanks
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;

public class PlayerControl : MonoBehaviour
{

    float movX;
    float movY;
    Rigidbody2D rb;

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
    }

    void Update()
    {
        movX = CrossPlatformInputManager.GetAxisRaw("Horizontal");
        movY = CrossPlatformInputManager.GetAxisRaw("Vertical");

          rb.velocity = new Vector2(movX * 1, movY * 1);

    }
}

A: This script can be moved by the WASD keys.
This should move your gameObject by the requested amount over x amount of time(speed).
Currently it can be only moved when it'S reached its destionation but you can easily modify this :), by stopping the coroutine
using System.Collections;
using UnityEngine;

public class PlayerControl : MonoBehaviour
{
    // We gonna move by WASD keys

    [Header("Speed & Movement settings")]
    [SerializeField]
    float Speed = 2.0f;
    [SerializeField]
    float movSpeedX = 0.8f;
    [SerializeField]
    float movSpeedY = 2.4f;

    bool ReachedTarget = true;

    void Update()
    {
        if (ReachedTarget)
        {
            Vector2 dest = Vector2.zero;
            Vector2 currentPos = transform.position;
            if (Input.GetKeyUp(KeyCode.W))
            {
                dest = currentPos + (Vector2.up * movSpeedY);
                StartCoroutine(moveTo(dest, Speed));
            }
            else if (Input.GetKeyUp(KeyCode.S))
            {
                dest = currentPos + (Vector2.down * movSpeedY);
                StartCoroutine(moveTo(dest, Speed));
            }
            else if (Input.GetKeyUp(KeyCode.D))
            {
                dest = currentPos + (Vector2.right * movSpeedX);
                StartCoroutine(moveTo(dest, Speed));
            }
            else if (Input.GetKeyUp(KeyCode.A))
            {
                dest = currentPos + (Vector2.left * movSpeedX);
                StartCoroutine(moveTo(dest, Speed));
            }
        }
    }

    // Time to take is in seconds
    IEnumerator moveTo(Vector2 TargetPosition, float TimetoTake)
    {
        Vector2 originalPosition = transform.position;
        float Time_taken = 0f;
        ReachedTarget = false;
        while (Time_taken < 1)
        {
            Time_taken += Time.deltaTime / TimetoTake;
            // Interpolating between the original and target position this basically provides your "speed"
            transform.position = Vector2.Lerp(originalPosition, TargetPosition, Time_taken);
            yield return null;
        }
        Time_taken = 0;
        transform.position = TargetPosition;
        ReachedTarget = true;
    }
}

A: I can't find any documentation of CrossPlatformInputManager, and I know nothing about it. But if you need to get the event of "release a key" instead of "press the key", try this: Input.GetKeyUp.

Description
Returns true during the frame the user releases the key identified by
  name.
You need to call this function from the Update function, since the
  state gets reset each frame. It will not return true until the user
  has pressed the key and released it again.
For the list of key identifiers see Conventional Game Input. When
  dealing with input it is recommended to use Input.GetAxis and
  Input.GetButton instead since it allows end-users to configure the
  keys.
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    void Update()
    {
        if (Input.GetKeyUp("space"))
        {
            print("Space key was released");
        }
    }
}

If you want to stop the rigid body, you need to reset its velocity to
zero. Or you can use
Rigidbody2D.MovePosition
to move it a certain distance.

Parameters
position The new position for the Rigidbody object.
Description
Moves the rigidbody to position.
Moves the rigidbody to the specified position by calculating the
  appropriate linear velocity required to move the rigidbody to that
  position during the next physics update. During the move, neither
  gravity or linear drag will affect the body. This causes the object to
  rapidly move from the existing position, through the world, to the
  specified position.
Because this feature allows a rigidbody to be moved rapidly to the
  specified position through the world, any colliders attached to the
  rigidbody will react as expected i.e. they will produce collisions
  and/or triggers. This also means that if the colliders produce a
  collision then it will affect the rigidbody movement and potentially
  stop it from reaching the specified position during the next physics
  update. If the rigidbody is kinematic then any collisions won't affect
  the rigidbody itself and will only affect any other dynamic colliders.
2D rigidbodies have a fixed limit on how fast they can move therefore
  attempting to move large distances over short time-scales can result
  in the rigidbody not reaching the specified position during the next
  physics update. It is recommended that you use this for relatively
  small distance movements only.
It is important to understand that the actual position change will
  only occur during the next physics update therefore calling this
  method repeatedly without waiting for the next physics update will
  result in the last call being used. For this reason, it is recommended
  that it is called during the FixedUpdate callback.
Note: MovePosition is intended for use with kinematic rigidbodies.
// Move sprite bottom left to upper right.  It does not stop moving.
// The Rigidbody2D gives the position for the cube.

using UnityEngine;
using System.Collections;

public class Example : MonoBehaviour
{
    public Texture2D tex;

    private Vector2 velocity;
    private Rigidbody2D rb2D;
    private Sprite mySprite;
    private SpriteRenderer sr;

    void Awake()
    {
        sr = gameObject.AddComponent<SpriteRenderer>();
        rb2D = gameObject.AddComponent<Rigidbody2D>();
    }

    void Start()
    {
        mySprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), new Vector2(0.5f, 0.5f), 100.0f);
        velocity = new Vector2(1.75f, 1.1f);
        sr.color = new Color(0.9f, 0.9f, 0.0f, 1.0f);

        transform.position = new Vector3(-2.0f, -2.0f, 0.0f);
        sr.sprite = mySprite;
    }

    void FixedUpdate()
    {
        rb2D.MovePosition(rb2D.position + velocity * Time.fixedDeltaTime);
    }
}

Both documents have an example.
Or you don't want to user keyboard but UI buttons, try this: IPointerDownHandler and IPointerUpHandler

Description
  Interface to implement if you wish to receive OnPointerDown callbacks.
Detects ongoing mouse clicks until release of the mouse button. Use
  IPointerUpHandler to handle the release of the mouse button.
//Attach this script to the GameObject you would like to have mouse clicks detected on
//This script outputs a message to the Console when a click is currently detected or when it is released on the GameObject with this script attached

using UnityEngine;
using UnityEngine.EventSystems;

public class Example : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
    //Detect current clicks on the GameObject (the one with the script attached)
    public void OnPointerDown(PointerEventData pointerEventData)
    {
        //Output the name of the GameObject that is being clicked
        Debug.Log(name + "Game Object Click in Progress");
    }

    //Detect if clicks are no longer registering
    public void OnPointerUp(PointerEventData pointerEventData)
    {
        Debug.Log(name + "No longer being clicked");
    }
}


text:
Q: How to use Azure AD SSO SAML for Jira, when Jira is also already setup to use local AD This tutorial is great and easy to get setup with Azure AD integrated for Jira: https://docs.microsoft.com/en-us/azure/active-directory/active-directory-saas-jiramicrosoft-tutorial
The only problem with it is, as outlined it requires that the usernames are in email address form within Jira, and stored in the local Jira internal directory.
What if I want to leverage all the existing usernames and keep them using local AD but leverage Azure AD only as a redundancy?
When trying this setup and test logging into Jira it says "User is not available in JIRA. Please contact your JIRA admin."  I think this is because it's trying to use the email address returned as the username in the SAML query as the username in Jira, but we're using just the straight up username from active directory, not the full email.

A: Turns out to do this you only have to make one change.  In the Azure portal, go to Azure AD and find the Jira SAML SSO app registration (this same thing would probably work for other SAML/SSO apps that have the same requirement).
In that app, click the link under 'Managed Application in local directory' then click the 'Single Sign-on' to configure the SAML properites that are sent back.  For the User Identifier, change it from its default of name.userprincipalname to the aptly named and convenient 'name.onpremisessamaccountname' and Save your changes.


text:
Q: TypeError when running jasmine specs that use a jQuery plugin built using the Widget factory I'm using a jQuery plugin called toggleEdit for inline editing.
Everything works fine when the code is actually used in the page.
However, my test suite fails with the following error:
TypeError: Cannot call method 'remove' of undefined
I tracked it down to be triggered from within the clear method of this particular plugin. Its source file can be found here.
There are two relevant bits in that code:
1- The _init function
self.element.addClass("toggleEdit toggleEdit-edit toggleEdit-edit-" +
self._tag(self.element))
//store reference to preview element
.data("toggleEdit-preview", self.p);

As you can see, when the plugin is first instantiated it uses the data structure on self to store the newly created element.
2- The clear function
self.element.data("toggleEdit-preview").remove();

The clear function then tries to access that structure and retrieve the element. That's when, while inside a jasmine spec, it fails with the aforementioned exception.
Has anyone seen anything similar?
EDIT:
This is my spec, it's the simplest piece of code able to reproduce the error:
it("should update the given attribute on the server", function(){
  $('#user-details input, #user-details select').toggleEdit(); //this line triggers the error
});

http://alz.so/static/plugins/toggleedit/jquery.toggleedit.js

A: I was taking a look at the source for toggleEdit and it seems that the only 2 times the function clear is called is just before self.element.data gets set:
if (typeof self.element.data("toggleEdit-preview") !== "undefined") {
     self.clear();
     self.disableEvents();
}

And at destroy function:
destroy: function() {
         var self = this;
         self.clear();
         self.disableEvents();
         $.Widget.prototype.destroy.apply(self, arguments);
       }

Since the first call seems to be protected, I ask you a somewhat dumb question: Is it possible that destroy is being called twice?

A: Found my problem: old version of the jQuery + jQuery UI duo. Upgrading them resolves the exception.


text:
Q: QMenu QThread Implementation error I am trying to move my QSystemTrayIcon  module to a separate thread. I am getting the below error while running the application. The Initialize() method addAction causing the error.
QWidget: Must construct a QApplication before a QPaintDevice
My sample code snippets:
Declared the global variable
     QMenu myMenu;
Member Variable in the header file
     QAction* openFile;
In the constructor
     openFile = new QAction(parent);
Initialize()
{
myMenu.addAction(openFile);
}

 void myApp::run()
 {
     Initialize()
 }

A: You must not use any GUI-related classes outside your main thread, i.e. the one QApplication was created in. Hence you cannot move your QSystemTrayIcon stuff in a separate thread.  And no, there is no workaround.

A: You are approaching this problem backwards. The reason that "The TrayIcon menus are not displaying if some functionality is running at the background Menus will display after the process completion." is because you are blocking the GUI thread when you wait for things. Do not block the GUI thread by waiting on things. Most of Qt provides signals that fire when things get accomplished (when they succeed or fail). Those are the nonblocking APIs that you should be using.


text:
Q: using pinvoke with structs and pointers I am trying to pinvoke a c function within my c# code.  It takes a struct and a double as an input and returns a struct of the same type.  I've defined the struct the same in the c and c# code.  when pinvoking the c function I get an exception "Methods type signature is not PInvoke compatible".  Can somebody spot what I'm doing wrong?  Thanks
C:
typedef struct myStruct_struct
{
     double prefix[8];
     int length;
     double array[1];
}
myStruct;

extern "C" __declspec( dllexport ) myStruct *doSomething(const myStruct *inStruct, double val)
{
   myStruct *outStruct;
   //doSomething ...
   return outStruct;
}

C#:
[StructLayout(LayoutKind.Sequential)]
public struct myStruct
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
    public double[] Prefix;
    public int Length;
    public IntPtr ArrayPtr;

    public void MarshalArray(double[] array)
    {
        Length = array.Length;
        int pointerSize = IntPtr.Size + (8 * Length);
        ArrayPtr = Marshal.AllocHGlobal(Marshal.SizeOf(pointerSize));
        Marshal.Copy(array, 0, ArrayPtr, Length);
    }

    public double[] UnMarshalArray()
    {
        double[] array = new double[Length];
        Marshal.Copy(ArrayPtr, array, 0, Length);
        return array;
    }
}

[DllImport("testing.dll", EntryPoint = "doSomething", SetLastError = true, CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
    public static extern IntPtr test_doSomething(IntPtr inStruct, double val);

private void button1_Click(object sender, EventArgs e)
{
    try
    {
        myStruct s = createStruct();
        myStruct result = MarshalIn(test_doSomething(MarshalOut(s), 2));
    }
    catch (Exception exc)
    {
        Console.WriteLine(exc.Message);
    }
}

private myStruct MarshalIn(IntPtr intPtr)
{
    myStruct s = (myStruct)Marshal.PtrToStructure(intPtr, typeof(myStruct));

    s.UnMarshalArray();

    return s;
}

private IntPtr MarshalOut(myStruct s)
{
    double[] array = new double[] { 1, 1, 2, 2, 1, 1, 2, 2 };
    s.MarshalArray(array);

    IntPtr outPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(myStruct)));

    Marshal.StructureToPtr(s, outPtr, true);

    return outPtr;
}

A: I understand this might not be the best solution in the world, but it is working for me in my tests, so I will leave you to infer things that you may personally need to do with regard to memory releasing, and leave you to your own judgment regarding that.
I personally HATE using Marshal.Copy and Buffer.BlockCopy.  I wrote my own line of functions for this, here: http://nmcsmem.codeplex.com/  (Specifically the DTCSMemory project -> MemPtr structure), but I programmed this with the standard functions for easy portability.  I have to admit, I may be doing some funky things with the bytes there, but I was just making doubly (no pun intended) sure.
IntPtr.Size has to be used if the structure is packed with normal packing.  Normally, a simple structure interop would take care of that, but we are not using simply structure interop, here.  If the structure is byte-packed, then you'll want to change the places where it says 'IntPtr.Size' back to just '4'.
That said, provided that we have this in C:
typedef struct myStruct_struct
{
    int length;
    double array[1];
}
myStruct;

__declspec(dllexport) myStruct *doSomething(const myStruct *inStruct, double val)
{
    int i = sizeof(double);

    //doSomething ...
    myStruct *outStruct = (myStruct*)GlobalAlloc(0, sizeof(void*) + (8 * 256));
    ZeroMemory(outStruct, sizeof(void*) + (8 * 256));
    outStruct->length = 256;
    outStruct->array[0] = inStruct->array[0] + val;

    return outStruct;
}

Then this code in C# would work:
  public class Program
    {

        /// <summary>
        /// myStruct is not marshaled, directly.
        /// </summary>
        public struct myStruct
        {

            public int Length;
            public double[] Array;

            private IntPtr _ptr;

            /// <summary>
            /// Custom marshal a structure in from interop (and optionally free the original pointer).
            /// </summary>
            /// <param name="ptr"></param>
            /// <param name="freeOrig"></param>
            /// <returns></returns>
            public static myStruct MarshalIn(IntPtr ptr, bool freeOrig = true)
            {
                byte[] by = new byte[4];
                myStruct ns = new myStruct();

                Marshal.Copy(ptr, by, 0, 4);
                ns.Length = BitConverter.ToInt32(by, 0);

                ns.Array = new double[ns.Length];
                by = new byte[ns.Length * 8];

                Marshal.Copy(ptr + IntPtr.Size, by, 0, by.Length);
                Buffer.BlockCopy(by, 0, ns.Array, 0, by.Length);
                if (freeOrig) Marshal.FreeHGlobal(ptr);

                return ns;
            }

            /// <summary>
            /// Custom marshal a structure for calling interop.
            /// </summary>
            /// <returns></returns>
            public IntPtr MarshalOut()
            {
                IntPtr ptr;
                int l = IntPtr.Size + (8 * Array.Length);
                ptr = Marshal.AllocHGlobal(l);

                byte[] by = BitConverter.GetBytes(Length);

                Marshal.Copy(by, 0, ptr, 4);

                by = new byte[Length * 8];
                Buffer.BlockCopy(Array, 0, by, 0, by.Length);
                Marshal.Copy(by, 0, ptr + IntPtr.Size, by.Length);

                _ptr = ptr;
                return ptr;
            }

            /// <summary>
            /// Free any associated pointer with this structure created with MarshalOut().
            /// </summary>
            public void Free()
            {
                if (_ptr != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(_ptr);
                    _ptr = IntPtr.Zero;
                }
            }
        }

        [DllImport("mylib.dll", SetLastError = true, CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr doSomething(IntPtr inStruct, double val);

        static void Main()
        {

            // let's do some math.

            myStruct ms = new myStruct(), ms2;
            ms.Array = new double[1];

            ms.Length = 1;
            ms.Array[0] = 424.444;

            ms2 = myStruct.MarshalIn(doSomething(ms.MarshalOut(), 524.444));

            // Free this after the call.
            ms.Free();

        }

    }


text:
Q: Setting up 301 redirects using htaccess I'm trying to set up 301 redirects for a site which has been restructured.
What I currently have is along the lines of:
 Redirect 301 /old-page$ /new-page
 Redirect 301 /old-page/subpage /different-page

The second redirect works fine, but the first doesn't. If I remove the $, the second redirect will return
  /new-page/subpage

I'm clearly doing something wrong but I don't know enough about redirects to figure it out.

A: EDIT
Added code 301 to the R (redirect) modifier
RewriteRule ^/old-page/(.*) /different-page/$1 [R=301,L]

Is that what u need?

A: You're trying to use regex in your first rule by placing $ but issue is that Redirect directive doesn't support regex. You should use RedirectMatch like this:
RedirectMatch 301 ^/old-page/?$ /new-page
RedirectMatch 301 ^/old-page/subpage /different-page


text:
Q: navigationController = null in TableViewController's pushViewController method (popover) First of all, sorry for my English.
I'm trying to do an app for iPad with a navigation controller which pushes view controllers when a button "Next" is selected. But I also want to have a popover, called from a button in the nav bar, that allows the user to "jump" from one view controller to another, pushing it with the tableView:didSelectRowAtIndexPath: and the pushViewController:animated: methods, but it's not working.
Summary:
Tab bar -> switches between FirstViewController and SecondViewController (works just fine)
Nav bar (button Next) -> switches between SecondViewController, FirstSlideController and SecondSlideController (it's also good)
Popover -> user selects SecondViewController, FirstSlideController or SecondSlideController (here's the problem!)
Codes:
AppDelegate
UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
UINavigationController *navigationController1 = [[UINavigationController alloc] initWithRootViewController:viewController1];
UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
UINavigationController *navigationController2 = [[UINavigationController alloc] initWithRootViewController:viewController2];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = @[navigationController1, navigationController2];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;

TableViewController(popover)'s didSelectRowAtIndexPath method:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

if(indexPath.row == 0){
 FirstSlideController *detailViewController = [[FirstSlideController alloc] initWithNibName:@"FirstSlideController" bundle:nil];
 [self.navigationController pushViewController:detailViewController animated:YES];
}

else if(indexPath.row == 1){
    SecondSlideController *detailViewController = [[SecondSlideController alloc] initWithNibName:@"SecondSlideController" bundle:nil];
    [self.navigationController pushViewController:detailViewController animated:YES];
}
else{
    SecondViewController *detailViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
    [self.navigationController pushViewController:detailViewController animated:YES];
}

}
SecondViewController (with delegate suggested by maros)
-(void) showPopover:(id) sender
{
   TableViewController *PopoverView = [[TableViewController alloc] initWithNibName:@"TableViewController" bundle:nil];
   self.popOver = [[UIPopoverController alloc] initWithContentViewController:PopoverView];
   self.popOver.delegate = self;
   [self.popOver presentPopoverFromBarButtonItem:self.navigationItem.leftBarButtonItem permittedArrowDirections: UIPopoverArrowDirectionUp animated: YES];
}

I tried to print self.navigationController and it says it's null. I'd appreciate any help.
Thank you.

A: Presnented UIPopoverController is not pushed on the navigation stack in the view controller from which it was presented. It is a separate view controller.
Therefore the navigationController inside the popover is nil.
What I would recommend you is to create a delegate MyNavigationPopoverDelegate (the class that creates a popover (PopoverController). Pass it's instance as an delegate to the TableViewController.
After users clicks on some button inside popover, call delegate's method to processes button clicks (myNavigationPopover:(UIPopoverController*)popover clickedButtonAtIndex:(NSInteger)buttonIndex).
Then maybe dismiss delegate?
and finally change navigation however you want! :)
@protocol MyNavigationPopoverDelegate
- (void) myNavigationPopover:(UIPopoverController*)popover clickedButtonAtIndex:(NSInteger)buttonIndex;
@end

@interface TableViewController : UITableVieController // your viewController in popover
... // your code
@property (nonatomic, weak) NSObject <MyNavigationPopoverDelegate> * delegate;
... // your code
@end

@implementation TableViewController
...
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.delegate myNavigationPopover:self clickedButtonAtIndex:indexPath.row];
}
...
@end

// defines that SecondViewController implements the delegate's method
@interface SecondViewController <MyNavigationPopoverDelegate> : UIViewController
  // your code
@end

// code where you presenting popover
@implementation SecondViewController

// This is the method that is executed after your button press and it is responsible for presenting a popover
- (void) presentPopover{
   ...
   myPopover.delegate = self; // setting the delegate
   [myPopover presentPopoverFromXXX ...]; // however you present it
   ...
}

 - (void) myNavigationPopover:(UIPopoverController*)popover clickedButtonAtIndex:(NSInteger)buttonIndex
 {
 UINavigationController *currentNavigationController = ; // get the navigation controller from the tab bar

 if(buttonIndex == 0){
      FirstSlideController *detailViewController = [[FirstSlideController alloc] initWithNibName:@"FirstSlideController" bundle:nil];
      [currentNavigationController pushViewController:detailViewController animated:YES];
 }

 else if(buttonIndex == 1){
      SecondSlideController *detailViewController = [[SecondSlideController alloc] initWithNibName:@"SecondSlideController" bundle:nil];
      [currentNavigationController pushViewController:detailViewController animated:YES];
 }
 else{
      SecondViewController *detailViewController = [[SecondViewController alloc]         initWithNibName:@"SecondViewController" bundle:nil];
      [currentNavigationController pushViewController:detailViewController animated:YES];
 }
}

@end;


text:
Q: Get consecutive count on repeated values with complex partition by in Postgres Given a set of 3 columns (blue columns: student, semester, grade) I need to calculate for how many consecutive semesters has each student had the same grade (green column) using a query in Postgres.
(first consecutive semester with avg 8: consec = 1. second consec semester with avg 8: consec = 2...)
Sample data fiddle: https://www.db-fiddle.com/f/v31a5Bpere26tXQb5L1fFJ/0
Expected result:

I have tried using
ROW_NUMBER() OVER(partition by student)

ROW_NUMBER() OVER(partition by avg_grade)

ROW_NUMBER() OVER(partition by student, avg_grade)

ROW_NUMBER() OVER(partition by student, semester)

But none of the above get the expected results.
Thanks a lot for your help!

A: This is a type of gap and islands problem.  The simplest method is probably to define the groups using the difference between a sequence per grade and semester.  Then use row_number() on more time:
select g.*,
       row_number() over (partition by student, avg_grade, semester - seqnum order by semester) as consec_avg
from (select g.*,
             row_number() over (partition by student, avg_grade order by semester) as seqnum
      from grades
     ) g;

Here is a db<>fiddle.


text:
Q: How to deal if writev only write part of the data? My data is naturally segmented, and comes from different sources so I use writev function as follows.
char *buf0 = "short string\n";
struct bar *my_bar;
my_baz = get_my_baz();
iov[0].iov_base = buf0;
iov[0].iov_len = strlen(buf0);
iov[1].iov_base = my_bar;
iov[1].iov_len = sizeof (struct bar);
bytes_written = writev (sockfd, iov, 3);

I want to send all my data. What if writev only write partial data in one time, for example:
bytes_written = 1;

How do I to continue to send the remain data?
In write function, we can do as follows enter link description here, how about writev?

A: *

*Increment iov[0].iov_base by bytes_written.

*Decrement iov[0].iov_len by bytes_written.

*Take care of underflows, i.e. if iov[0].iov_len goes negative, remember it, set it to zero, and propagate the difference into iov[1] in the same way as (1) and (2), and so on until closure.

However if you're in blocking mode this is a non-issue, as the case of a short write can never arise.


text:
Q: On the correct definition of a *triangle* in an additive category Given that we are in some additive category with "shift functors" (i.e., additive auto-equivalences) $A \mapsto A[n]$, Mark Haiman defines a triangle to be a sequence $A \rightarrow B \rightarrow C \rightarrow A[1]$ such that the composition of any two consecutive morphisms is zero. However, after looking elsewhere, it appears that this last condition is usually not included in the definition of a triangle.
Could somebody shed some light on this? Thank you.


text:
Q: Can/Should I list inherited properties for a JAXB mapped bean in the "propOrder" annotation? I have a bunch of JAXB annotated classes that have a field in common, so I moved that field to a super class, like this
public class Base {
    protected SomeType commonField;
}

@XmlRootElement(name = "foo") @XmlType(propOrder = { "commonField", "fooField" })
public class Foo extends Base {
    private SomeOtherType fooField;
}

@XmlRootElement(name = "bar") @XmlType(propOrder = { "commonField", "barField" })
public class Bar extends Base {
    private SomeOtherType barField;
}

Now whenever I marshall one of Foo or Bar I get an IllegalAnnotationException complaining about commonField being listed in propOrder but not present in the class. Removing it from the propOrder annotation everything works fine, but I thougt I was supposed to list all of the mapped fields. What am I missing?

A: The fields/properties from the inherited class will always appear before the fields/properties on the child classes.  This means that by default you can not specify them in the propOrder on the child type.  If however you mark the parent class as @XmlTransient the fields/properties will be treated as belonging to the child classes and can be included in the propOrder.

*

*http://bdoughan.blogspot.com/2011/06/ignoring-inheritance-with-xmltransient.html


text:
Q: Can't find a way to make ellipsize="marquee" always scroll using Fragments? I'm having trouble making my TextView to always ellipsize="marquee". I'm using SherlockActionBar with tabs and fragments.
Here are the sourse codes:
TabbedDataViewer.java (this code is taken from the example that comes with ABS)
public class TabbedDataViewer extends SherlockFragmentActivity{

    private TabHost mTabHost;
    private ViewPager mViewPager;
    private TabsAdapter mTabsAdapter;

    @Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tabbed_data_viewer_main);

        mTabHost = (TabHost) findViewById(android.R.id.tabhost);
        mTabHost.setup();

        mViewPager = (ViewPager) findViewById(R.id.pager);

        mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager);

        mTabsAdapter.addTab(
                mTabHost.newTabSpec(Constants.TAB1_ID).setIndicator(
                        getString(R.string.personal_data)), PersonalDataTab.class, null);

        if(savedInstanceState != null){
            mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab"));
        }
    }

    public static class TabsAdapter extends FragmentPagerAdapter implements
            TabHost.OnTabChangeListener, ViewPager.OnPageChangeListener{
        private final Context mContext;
        private final TabHost mTabHost;
        private final ViewPager mViewPager;
        private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>();

        static final class TabInfo{
            private final String tag;
            private final Class<?> clss;
            private final Bundle args;

            TabInfo(String _tag, Class<?> _class, Bundle _args){
                tag = _tag;
                clss = _class;
                args = _args;
            }
        }

        static class DummyTabFactory implements TabHost.TabContentFactory{
            private final Context mContext;

            public DummyTabFactory(Context context){
                mContext = context;
            }

            @Override
            public View createTabContent(String tag){
                View v = new View(mContext);
                v.setMinimumWidth(0);
                v.setMinimumHeight(0);
                return v;
            }
        }

        public TabsAdapter(FragmentActivity activity, TabHost tabHost, ViewPager pager){
            super(activity.getSupportFragmentManager());
            mContext = activity;
            mTabHost = tabHost;
            mViewPager = pager;
            mTabHost.setOnTabChangedListener(this);
            mViewPager.setAdapter(this);
            mViewPager.setOnPageChangeListener(this);
        }

        public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args){
            tabSpec.setContent(new DummyTabFactory(mContext));
            String tag = tabSpec.getTag();

            TabInfo info = new TabInfo(tag, clss, args);
            mTabs.add(info);
            mTabHost.addTab(tabSpec);
            notifyDataSetChanged();
        }

        @Override
        public int getCount(){
            return mTabs.size();
        }

        @Override
        public Fragment getItem(int position){
            TabInfo info = mTabs.get(position);
            return Fragment.instantiate(mContext, info.clss.getName(), info.args);
        }

        @Override
        public void onTabChanged(String tabId){
            int position = mTabHost.getCurrentTab();
            mViewPager.setCurrentItem(position);
        }

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels){
        }

        @Override
        public void onPageSelected(int position){
            // Unfortunately when TabHost changes the current tab, it kindly
            // also takes care of putting focus on it when not in touch mode.
            // The jerk.
            // This hack tries to prevent this from pulling focus out of our
            // ViewPager.
            TabWidget widget = mTabHost.getTabWidget();
            int oldFocusability = widget.getDescendantFocusability();
            widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
            mTabHost.setCurrentTab(position);
            widget.setDescendantFocusability(oldFocusability);
        }

        @Override
        public void onPageScrollStateChanged(int state){
        }
    }
}

PersonalDataTab.java
public class PersonalDataTab extends SherlockFragment{

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

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
        View v = inflater.inflate(R.layout.activity_personal_data_tab, container, false);

        TextView tvFirstName = (TextView) v.findViewById(R.id.tv_first_name);
        tvFirstName.setText(TabbedDataViewer.sDataMap.get(Constants.TAG_FIRST_NAME));

        return v;
    }
}

activity_tabbed_data_viewer_main.xml
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0"
            android:orientation="horizontal" />

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="0" />

        <android.support.v4.view.ViewPager
            android:id="@+id/pager"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />
    </LinearLayout>
</TabHost>

activity_personal_data_tab.xml
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TableLayout
        android:id="@+id/tableLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/first_name_c_s"
                android:textAppearance="?android:attr/textAppearanceMedium" />

            <TextView
                android:id="@+id/tv_first_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="marquee"
                android:textAppearance="?android:attr/textAppearanceMedium" />
        </TableRow>
    </TableLayout>
</ScrollView>

I've tried everything described here Is there a way to make ellipsize="marquee" always scroll? - those solutions worked for me when I was using just tabHost (no SherlockActionBar or Fragment).
By the way, just noticed that in PlayMarket App the applications' names which are too long to fit on the screen do not scroll at all.
And I would be more than grateful if anybody could give me a hint on how to update the TextView from the class PersonalDataTab.java as now I can only update it from the main class i.e. TabbedDataViewer

A: Try this:
tvFirstName.setSelected(true);

EDIT:
add this params on your TextView XML:
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:freezesText="true"
            android:gravity="left"
            android:marqueeRepeatLimit="marquee_forever"
            android:maxLines="1"
            android:scrollHorizontally="true"
            android:singleLine="true"

A: Solved the problem with scrolling by setting the weights to textViews:
<TableRow
    android:id="@+id/tableRow5"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/textView5"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.3"
        android:text="@string/address_c"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/tv_address"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="5"
        android:ellipsize="marquee"
        android:singleLine="true"
        android:textAppearance="?android:attr/textAppearanceMedium" />

</TableRow>

...and a single line in the activity: tvFirstName.setSelected(true);


text:
Q: One Model association with two models I have a model 'Match' that belongs to a modell called 'Team'. The Team has many matches. It looks like this:
 $class Match < ActiveRecord::Base
 belongs_to :home_team, :class_name => "Team"
 belongs_to :away_team, :class_name => "Team"

 class Team < ActiveRecord::Base
 has_many :matches

In the database i have set up properly the two needed fields home_team_id and away_team_id in the 'matches'-table.
I have tried a multiple ways but whenever I do something like this in my match-controller:
 @matches = Match.find(:all, :include => :team)
 # Or:
 @matches = Match.where('team.gender = ?', true)

I get this error:
Association named 'team' was not found; perhaps you misspelled it?

It seems to me the association does not work. Any ideas?

A: You haven't added any team association you have added home_team and away_team so include home team and away team in your code.or create team association
One more thing how will you  know which one is home team and away team there should be one foreign key needed for home team or and away team and add foreign_key in your code to identify them.


text:
Q: Site with a bitcoin miner script I found some of my users visiting a site that seemed to have a Bitcoin mining JS script in its code:
<script src = "hxxps://coin-hive.com/lib/coinhive.min.js"></script><script>
var miner = new CoinHive.Anonymous('3858f62230ac3c915f300c664312c63f');
miner.start();
</script>

My question is, with this are the users still infected even if they navigate away from the page? Do these sort of programs only work while the user has the page open in the browser?

A: Coinhive does not appear to be "malware" since it does not appear to do anything particularly harmful to the user's computer. If that is the case, the users computers were never "infected" with anything.
It is extremely common these days for websites to load tons of third party scripts and cookies in the background and do hundreds of things you are not aware of every time you use the internet. Most sites load a Google Analytics tracking script when you visit them, even though you did not authorize them to do that. But that would not be considered malware. Most sites load persistent third-party cookies that track your presence from one website to another and create a massive profile of your online habits. This is why you could be shopping for shoes on one site, and then suddenly find that Facebook is serving you ads for shoes. But that also is generally not considered malware.
In terms of "harm" or "unwanted activity", persistent tracking could be said to be more invasive than a coin mining script. The coin mining script is probably just using some of the memory and CPU power of the end user's computer, which is no different from the hundreds of other javascript libraries that are getting loaded in the background without your knowledge.

A: I am not familiar with the coin-hive service, but actually script which you have provided contains such lines:
    var JobThread = function() {
            this.worker = new Worker(CoinHive.CRYPTONIGHT_WORKER_BLOB);
            this.worker.onmessage = this.onReady.bind(this);
            ...
    };

As you see it is using Workers. I was not investigatin the whole script, but anyway using web workers means that some operations can be running even after page was closed. More information in this post.
So the very first answer to your question is YES, users can be possibly infected for some time after page was closed (in theory, if script is written in such way).
But actually script seems to be terminated very soon by the system itself. Also coin-hive platform is not positioned as a malware and should be safe for users system.
I don't think that you should worry about that at all.

A:
with this are the users still infected even if they navigate away from
  the page?

No

Do these sort of programs only work while the user has the page open
  in the browser?

Yes, the script will only run on the website that includes it, while the page is open in the browser
UPGRADE:
More information about this script: https://coin-hive.com/

Coinhive offers a JavaScript miner for the Monero Blockchain (...) that you can embed in your website. Your users run the miner directly in their Browser

And https://coin-hive.com/documentation/miner

The miner runs until you explicitely stop it again or the user
  navigates away.


text:
Q: How to setup username and password with Slick's source code generator? Following the directions in this page: http://slick.typesafe.com/doc/2.0.0/code-generation.html
we see that something like the following segment of code is required to generate models for mysql tables
val url = "jdbc:mysql://127.0.0.1/SOME_DB_SCHEMA?characterEncoding=UTF-8&useUnicode=true"

val slickDriver = "scala.slick.driver.MySQLDriver"

  val jdbcDriver = "com.mysql.jdbc.Driver"

  val outputFolder = "/some/path"

  val pkg = "com.pligor.server"

  scala.slick.model.codegen.SourceCodeGenerator.main(
    Array(slickDriver, jdbcDriver, url, outputFolder, pkg)
  )

These parameteres are enough for an H2 database as the example in the link has it.
How to include username and password for the MySQL database?

A: From several links found in the internet and also based on the cvogt's answer this is the minimum that you need to do.
Note that this is a general solution for sbt. If you are dealing with play framework you might find it easier to perform this task with the relevant plugin
First of all you need a new sbt project because of all the library dependencies that are needed to be referenced in order for slick source generator to run.
Create the new sbt project using this tutorial: http://scalatutorials.com/beginner/2013/07/18/getting-started-with-sbt/
Preferably use the method Setup using giter8
If it happens to work with Intellij then you need to create file project/plugins.sbt and insert inside this line: addSbtPlugin("com.hanhuy.sbt" % "sbt-idea" % "1.6.0").
Execute gen-idea in sbt to generate an intellij project.
With giter8 you get an auto-generated file ProjectNameBuild.scala inside project folder. Open this and include at least these library dependencies:
libraryDependencies ++= List(
    "mysql" % "mysql-connector-java" % "5.1.27",
    "com.typesafe.slick" %% "slick" % "2.0.0",
    "org.slf4j" % "slf4j-nop" % "1.6.4",
    "org.scala-lang" % "scala-reflect" % scala_version
  )

where scala version is the variable private val scala_version = "2.10.3"
Now create the custom source code generator that looks like that:
import scala.slick.model.codegen.SourceCodeGenerator

object CustomSourceCodeGenerator {

import scala.slick.driver.JdbcProfile

import scala.reflect.runtime.currentMirror

def execute(url: String,
          jdbcDriver: String,
          user: String,
          password: String,
          slickDriver: String,
          outputFolder: String,
          pkg: String) = {
val driver: JdbcProfile = currentMirror.reflectModule(
  currentMirror.staticModule(slickDriver)
).instance.asInstanceOf[JdbcProfile]

driver.simple.Database.forURL(
  url,
  driver = jdbcDriver,
  user = user,
  password = password
).withSession {
  implicit session =>
    new SourceCodeGenerator(driver.createModel).writeToFile(slickDriver, outputFolder, pkg)
    }
  }
}

Finally you need to call this execute method inside main project object. Find the file ProjectName.scala that was auto-generated by giter8.
Inside it you will find a println call since this is merely a "hello world" application. Above println call something like that:
CustomSourceCodeGenerator.execute(
url = "jdbc:mysql://127.0.0.1/SOME_DB_SCHEMA?characterEncoding=UTF-8&useUnicode=true",
slickDriver = "scala.slick.driver.MySQLDriver",
jdbcDriver = "com.mysql.jdbc.Driver",
outputFolder = "/some/path",
pkg = "com.pligor.server",
user = "root",
password = "xxxxxyourpasswordxxxxx"
)

This way every time you execute sbt run you are going to generate the Table classes required by Slick automatically

A: Note that at least for 2.0.1 this is fixed. Just add username and password to the end of the Array as Strings

A: This has been asked and answered here: https://groups.google.com/forum/#!msg/scalaquery/UcS4_wyrJq0/obLHheIWIXEJ . Currently you need to customize the code generator. A PR for 2.0.1 is in the queue.

A: My solution is nearly the same as George's answer, but I'll add mine anyway. This is the entire file I use to generate code for my mysql database in an SBT project.
SlickAutoGen.scala
package mypackage

import slick.model.codegen.SourceCodeGenerator

object CodeGen {

  def main(args: Array[String]) {
    SourceCodeGenerator.main(
      Array(
        "scala.slick.driver.MySQLDriver",
        "com.mysql.jdbc.Driver",
        "jdbc:mysql://localhost:3306/mydb",
        "src/main/scala/",
        "mypackage",
        "root",
        "" // I don't use a password on localhost
      )
    )
  }
}

build.sbt
// build.sbt --- Scala build tool settings

libraryDependencies ++= List(
  "com.typesafe.slick" %% "slick" % "2.0.1",
  "mysql" % "mysql-connector-java" % "5.1.24",
  ...
)

To use this, just modify settings, save in project root directory and run as follows:
$ sbt
> runMain mypackage.CodeGen


text:
Q: How to easily bump a package for a PPA? What's the easiest way to bump the version number for a package that shall be uploaded to a Launchpad PPA?
For instance, what I do now is that on each new release I unpack the previous *.debian.tar.gz, then open debian/changelog, copy/paste top-most entry:
package (1.67-1~precise~ppa1) precise; urgency=low

  * New upstream release.

 -- Name Surname <email@smth.asd>  Wed, 19 Mar 2014 22:22:03 +0200

Then modify 1.67 to 1.68, and manually change date to Tue, 03 Mar 2015, and save file.
There surely must be a simpler way to do this...

A: After unpacking the *.debian.tar.gz file, you can use the dch commands to create new changelog entries. For example, dch -i would (probably) bump up the version to 1.67-1~precise~ppa2. You can instead use dch -v "1.68-1~precise~ppa1" to specify the new version.
Note that dch can also take in another argument that represents the message for that changelog entry. For example, dch -v "1.68-1~precise~ppa1" "New upstream release.". You can append to an existing changelog entry by doing dch -a "Another message.".
Note that all of the above commands leave the distribution as UNRELEASED, signifying that it's not ready to be released. You can have dch mark it as released by running dch -r --distribution precise "" (empty message at the end).
To set your name/email combination, you can define the appropriate environment variables in ~/.bashrc:
export DEBEMAIL="address@someemail.dom"
export DEBFULLNAME="Name Surname"

See also:

*

*How do I set environment variables?


text:
Q: How to stop the webservice call when we move to another view I am doing one application.  In it, I did the web service part for each view.  So when I moved to another view without completion of present view we service, then I need to stop the web service call in the present view.
Please tell me how to do this. My sample code to start the service is given below:
 NSMutableURLRequest *request=[[NSMutableURLRequest alloc]init];
  request=[self GetRequest];

NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration delegate:nil delegateQueue:nil];
NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
    jsonArray = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];

.
.
.

A: -(void)viewWillDisappear:(BOOL)animated
{
    [task cancel];
}

and use @property(nonatomic,retain)NSURLSessionTask *task;


text:
Q: How can I import hbase in python? I'm trying to play around with hbase in python and I am using the cloudera repository to install the hadoop/hbase packages.  It seems to work as I can access and work on the database using the shell but its not fully working within python.
I know to communicate with hbase I need thrift so I downloaded and complied it from source, I can import thrift into python but when I do from hbase import Hbase, I get module not found errors.
Does anyone know what package/module I would need to get it to work? I tried to look around easy_install and yum(I'm using centos6) and no luck.  I did find an article where a person using debain installed it by doing sudo aptiutde install python-hbase  I don't have that command/package, so I'm not sure how to get it(or if I have to compile from source to get it).
Also if it helps, I installed most of the base from cloudera and followed some instructions(the ones didn't require install) from http://yannramin.com/2008/07/19/using-facebook-thrift-with-python-and-hbase/
Any help/tips/suggestions would be great.
Thanks!

A: Have a look at HappyBase (see https://github.com/wbolster/happybase for info). It is the modern way to interact with HBase from Python. It covers the complete Thrift API but wraps it in a much better interface.

A: Okay, I figured it out.  If anyone else is having problems with this in the future its actually pretty easy.  In the step where you run thrift --gen py Hbase.thrift, it creates a hbase folder in the location you ran that command.  Simply take that command and copy it to your default module folder(or in the folder where you run your program and it should work).

A: *

*search for /src/contrib/thriftfs/gen-py under hadoop installation folder

*Copy the output of thrift --gen py Hbase.thrif onto the location below (part till /home/hadoop/data/ will differ in your case) /home/hadoop/data/hadoop-1.0.4/src/contrib/thriftfs/gen-py

then
$ python
import sys
sys.path.append("/home/hadoop/data/hadoop-1.0.4/src/contrib/thriftfs/gen-py")
import hbase

It should work now


text: Q: How to get fingerprint of a user from android fingerprint sensor and store it in database? I am developing an application in which I want to use fingerprint for  authentication. I don't know how to read the fingerprint and store it in my own database. I used Fingerprintmanager class but don't have a clue how to read the fingerprint to get enrolled or register the user in my database.


text:
Q: Inserting page number on the landscape page I inserted a landscaped page in my document to containing large table. The pagination before, and after the landscape page appear correctly: 13, 15.
However, the page number on the landscaped page did not appear, just continued on following page.
The following code reproduce the issue:
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize\bfseries}
\usepackage{tabularx}
\usepackage{blindtext}
\renewcommand\tabularxcolumn[1]{m{#1}}

\begin{document}

\chapter{Introduction}
\blindtext

\afterpage{
    \clearpage
    \thispagestyle{empty}
    \begin{landscape}
        \centering
        \begin{table}
        \caption{A summary of previous studies and methods employed \textit{(*N/A = Not available)}.}
        \label{distance-duration}
        \begin{tabularx}{\linewidth}{lccXcccr}
            \toprule
            \thead{Author(s)}  & \thead{modes\\ detected} & \thead{Classifier used}  & \thead{Features}   & \thead{Population}  & \thead{External\\ Data used}  & \thead{Period} & \thead{Accuracy} \\
            \midrule
        Author 1 & 4 & DT & distance, velocity \& acceleration statistics & 45 users [GeoLife] & No &6 months & 72.80\%\\
        \midrule
    Author 2 &5 & Fuzzy engine &  speed acceleration statistics &4,882 users &No &6.65 days & N/A\\
        \bottomrule
        \end{tabularx}
         \hfill
        \end{table}
    \end{landscape}
    \clearpage
}

\chapter{Body}
\blindtext

\end{document}

How do I fix it?

A: You have \thispagestyle{empty} as part of your landscape page construction. That removes the headers and footers, so no page number will show up. Remove this and you'll see the page number in the usual spot.
If you wish to adjust the placement of the page number (since the page is in landscape), you could define a new page style or position it elsewhere using eso-pic. Using the latter suggestion, you can still use \thispagestyle{empty} and place the following additional code directly after it:
\AddToShipoutPictureBG*{%
  \AtPageLowerLeft{%
    \raisebox{\dimexpr.5\paperheight-.5\height}{%
      \makebox[.9\paperwidth][r]{%
        \rotatebox{90}{\thepage}
      }% \makebox
    }% \raisebox
  }% \AtPageCenter
}% \AddToShipoutPictureBG*

The above code puts \thepage 90% down the page. You can play around with different options of .9\paperwidth and place the page number to suit your needs.


text:
Q: How to reference interface property I define an interface and build a class inherit it.
interface IOperator
{
    int Priority{ get; }
    string Identifier { get; }
    int Dimension { get; }

    Expression GetExpression(IVariable[] variables);
    object Excute(IVariable[] variables);

}

public class Op_Muti:IOperator
{
    int IOperator.Priority { get { return 40; } }
    string IOperator.Identifier { get { return "*"; } }
    int IOperator.Dimension { get { return 2; } }

public object IOperator.Excute(IVariable[] variables)
{
    throw new ArgumentOutOfRangeException(string.Format("{0} can't apply to {1}", Identifier, variables[0].VarType.ToString()));
}

}
The Identifier is defined in interface
string Identifier { get; }

and implement in class Op_Muti
string IOperator.Identifier { get { return "*"; } }

but can't reference in
throw new ArgumentOutOfRangeException(string.Format("{0} can't apply to {1}", Identifier, variables[0].VarType.ToString()));

Why?


text:
Q: Function Parameters Across Different Assemblies Suppose I have a function DoStuff that is defined in the assembly A.dll. This function takes a Func<T> parameter. I call this function inside of B.dll as DoStuff(() => ...).
Where is the Func<T> evaluated? It appears to be inside of B.dll, but I would expect it to be inside of A.dll. What happens if the Func<T> requires external references? Am I forced to include them in B.dll? Can I force it to execute inside A.dll?

A: The lambda is compiled into B and executed there.
You can read up more on how it works here: What are C# lambda's compiled into? A stackframe, an instance of an anonymous type, or?

A:
Where is the Func evaluated?

You are passing the function definition from B to A.  The compiled code exists in B.  A presumably executes the function as part of DoStuff.

What happens if the Func<T> requires external references?

Then those dependencies will need to be referenced by project B and will need to get included in the final build, which may mean referencing them from the executing project (the WCF service from your comments) as well.


text:
Q: problems reading 2d byte array from a text file I'm having problems reading a byte array back from a text file that I had already written the byte array to.
Here is the code for writing the byte array to the file
    FileOutputStream fout = new FileOutputStream(new File("C:\\Users\\lvannini\\Desktop\\FileSystem\\diskFiles\\", fileName));
    for(int i = 0; i < 64; ++i){
        for(int j = 0; j < 64; ++j)
            fout.write(String.valueOf(ldisk[i][j]).getBytes());
        fout.write(System.lineSeparator().getBytes()); //write line break;

As far as I'm aware, this part is working correctly, because my output text file contains the appropriate contents of the 2d array I am using. An example of the first 9 lines of the text file are printed as follows:
00-1-16000000000000000000000000000000000000000000000000000000000000
00024000700000000000000090000000000071000100001100000000000800000000
-1-1-1-1000000000000-1-1-1-1000000000000-1-1-1-1000000000000-1-1-1-1000000000000
-1-1-1-1000000000000-1-1-1-1000000000000-1-1-1-1000000000000-1-1-1-1000000000000
-1-1-1-1000000000000-1-1-1-1000000000000-1-1-1-1000000000000-1-1-1-1000000000000
-1-1-1-1000000000000-1-1-1-1000000000000-1-1-1-1000000000000-1-1-1-1000000000000
-1-1-1-1000000000000-1-1-1-1000000000000-1-1-1-1000000000000-1-1-1-1000000000000
10010010000001979899000021021111110000900000000000000010000000000000000800000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000

However, using this following code to read back from the file into the 2D array:
FileInputStream fin = new FileInputStream("C:\\Users\\lvannini\\Desktop\\FileSystem\\diskFiles\\" + fileName);
    for(int i = 0; i < 64; ++i)
        fin.read(ldisk[i]);

    fin.close();

gives me the actual ASCII values of each byte being read in. For instance, after reading in the first line of the text file, my 2d array, ldisk[0], contains:
48 48 45 49 45 49 54 48 48 48 . . .

Where am I losing the translation from the byte values to the ascii values? I'm suspecting I'm saving the byte values to the text file incorrectly. Any advice/responses are very much appreciated! Thanks again.

A:
Where am I losing the translation from the byte values to the ASCII values?

FileInputStream.read() is giving you the ASCII code for the byte. See ASCII table, which reveals you're not losing the translation.
Just cast that ASCII code to a character code:
char c = (char)fin.read(ldisk[i]);

OR subtract 48 from it to get the integer value:
-48 + fin.read(ldisk[i])

You still have to deal with the minus signs taking up bytes, so your
for(int i = 0; i < 64; ++i)

is inadequate with 64 as limit when there are minus signs in the file.

A: Your problem is with FileInputStream. There are many ways get ASCII values of each byte being read but the easiest is probably BufferedReader with defined charset.
Charset charset = Charset.forName("US-ASCII");
BufferedReader in = Files.newBufferedReader(C:\\Users\\lvannini\\Desktop\\FileSystem\\diskFiles\\" + fileName, charset);

String line;
while((line = in.readLine()) != null)
{
   //do something with your input
}
in.close();


text:
Q: How to convert values from 2 different hour and minute column in ti time stamp or char in single column in oracle I have values in 2 different columns like this

How do I gather it in to one single column like this
Result_column
14:08
09:36
19:07
11:11

Date will remain in its separate column. How to achieve this.
I  want to do this becoz I have time in other table in this format 19:11:38
and I want to compare both.

A: Use a group of CONCAT function.
Query
select
concat(
    concat(
        case when click_hr < 10
        then concat('0', cast(click_hr  as varchar(100)))
        else cast(click_hr as varchar(100)) end,
       ':')
   , case when click_min < 10
   then concat('0', cast(click_min as varchar(100)))
   else cast(click_min as varchar(100)) end) as result
from your_table_name;

A: If you need the resultant value to be in time format i.e. hh:mi:ss, below could be an option.
SELECT click_date,
       to_char(to_Date(click_hr || to_char(click_min, '09') || 00, 'hh24miss'), 'hh24:mi:ss') AS TIME
FROM table1

Result:
CLICK_DATE              TIME
--------------------------------
17.10.2017 00:00:00     14:08:00
19.10.2017 00:00:00     09:36:00
24.10.2017 00:00:00     19:07:00

DEMO

A: A DATE data type always has a year, month, day, hour, minute and second components - your IDE is probably just not showing them to you.
Do not store the values as separate columns, store them in the date:
CREATE TABLE table_name( click_date ) AS
SELECT TO_DATE( '2017-10-10 14:08:00', 'YYYY-MM-DD HH24:MI:SS' ) FROM DUAL UNION ALL
SELECT TO_DATE( '2017-10-19 09:36:00', 'YYYY-MM-DD HH24:MI:SS' ) FROM DUAL UNION ALL
SELECT TO_DATE( '2017-10-24 19:07:00', 'YYYY-MM-DD HH24:MI:SS' ) FROM DUAL UNION ALL
SELECT TO_DATE( '2017-09-29 11:11:00', 'YYYY-MM-DD HH24:MI:SS' ) FROM DUAL UNION ALL
SELECT TO_DATE( '2017-10-02 18:18:00', 'YYYY-MM-DD HH24:MI:SS' ) FROM DUAL UNION ALL
SELECT TO_DATE( '2017-09-27 12:08:00', 'YYYY-MM-DD HH24:MI:SS' ) FROM DUAL UNION ALL
SELECT TO_DATE( '2017-10-05 10:37:00', 'YYYY-MM-DD HH24:MI:SS' ) FROM DUAL UNION ALL
SELECT TO_DATE( '2017-10-05 11:43:00', 'YYYY-MM-DD HH24:MI:SS' ) FROM DUAL UNION ALL
SELECT TO_DATE( '2017-10-14 12:41:00', 'YYYY-MM-DD HH24:MI:SS' ) FROM DUAL;

Then you can just do:
SELECT TO_CHAR( click_date, 'HH24:MI' ) AS time
FROM   table_name

or, to get the value as an interval:
SELECT click_date - TRUNC( click_date ) AS time
FROM   table_name

With your current table structure you can get an interval as:
SELECT NUMTODSINTERVAL( click_hr, 'HOUR' )
       + NUMTODSINTERVAL( click_min, 'MINUTE' ) AS time
FROM   table_name

Or, as a string:
SELECT TO_CHAR( click_hr, '00' ) || ':' || TO_CHAR( click_min, '00' ) AS time
FROM   table_name


text:
Q: Not able to connect firebase to flutter application (android part) In order to connect firebase to flutter on android I have executed the steps given in the link https://firebase.google.com/docs/flutter/setup?platform=android .
And as soon as I open android/app/build.gradle my android studio shows an error "Cannot resolve symbol 'GradleException'".
Cannot resolve symbol 'GradleException' error message
Error message 1
Error message 1 continued
Error message 1 ends here...


text:
Q: Prove G is Abelian Let $G$ be a group and $a,b\in G$.
given that $(ab)^k=a^k b^k$ and $(ab)^{k+2}=a^{k+2} b^{k+2}$ for some $k\in \mathbb N$.
prove that $G$ is abelian.
So far my attempt was: $(ab)^{k+2}=(ab)(ab)^k(ab) \Longrightarrow a^{k+2}b^{k+2}=(ab)a^kb^k(ab) \Longrightarrow a^kb^k=b^{-1}a^{k+1}b^{k+1}a^{-1}$
and from here I'm stuck.
I noticed there was a similar question but there was given that also $(ab)^{k+1}=a^{k+1}b^{k+1}$ which is missing in my question.
thanks for your help.

A: The statement you want to prove is false in general. Let $k=1$ for example, and let
$$G = \langle x,y,z \mid x^3 = y^3 = z^3 = 1, yz = zyx, xy = yx, xz = zx\rangle$$
be the group found in this answer. Then $G$ is not abelian, but $G$ has exponent three. It thus holds that $(ab)^3 = e = a^3 b^3$ for all $a,b \in G$, and moreover it obviously holds that $(ab)^1 = ab = a^1 b^1$. There are some $k$ for which the statement is true though, for example when $k = 3$, the group is necessarily abelian. This answer gives more insight on what values of $k$ could make it work.


text:
Q: Add or Edit relation fields in Content Manager of Strapi I am building a simple recipe website by Strapi. Now I want to make one Recipe has so many Ingredient. Therefore, there are two collections, They are in Many way relationship (Since I don't need to point back or link back to Recipe)
However, in Content Manager, I have to create some Ingredient items before creating one Recipe.
Is it possible to create or edit Ingredient while create Recipe in the same page?

A: Yes, this is possible using components in strapi. So basically, you'll need to create a Recipe collection and Ingredient component, and link to the component to Recipe collection as a repeatable component. So this way when you create a Recipe entry, you'll be able to add/edit the ingredients entries on the fly.
Have a look at this link to learn how to create a component.
Once you've created the component, follow the steps below to link it to the Recipe collection:

*

*Edit the Recipe collection and add an existing component.

*Set the component as a Repeating component.

*Your model configuration should look similar to this.

*Save the changes to the Recipe collection and then try creating an entry. You'll be presented with the following user interface that lets you edit/add ingredients on the fly.

*Publish the entries and hit the find API will the populate key in URL like so:
http://localhost:1337/api/receipes?populate=ingredients


text:
Q: Livecycle - Pagination - Top of page I got a problem.
I would like to have a repeating subform on the first bodypage("Sida1" bould one), that should repeat on the first masterpage(Page1). I want it to start at the top of the first master page all the time. But if I set it that way I think it might work, it gives me a white blank page at start and then work as intended(it start repeating subforms in the top of the masterpage (Page1)).
Seems like it will create one extra masterpage of the one you set it to, if you set it to be Top of page "Page1". It will create on master page to much. Atleast if you have those setting of the body page that is the first bodypage.
I don't have 10 reputaion to upload a images, so i will mark up how the hierarchy looks like:

*

*Form

*

*(Master Pages)
Page1
Page2
Page3
//Body pages comes below this..
-Sida1
-Sida2
-Sida3
-(Variables)


text:
Q: gameloop thread crash onresume i am just finishing up a small game i did, second one, based on code done by java4edu:
http://www.edu4java.com/en/game/game0-en.html
however after my mods, i have run to a glitch where whenever i , resume, rotate screen,  change the screen to (load from gallery), or anything that sends canvas to background; onresume, i get an error in which logcat always points to this:
    canvas.drawBitmap(bka, 0, 0, null);
i think though more importantly is that i need stop my gameloop thread at the approiate times, so that it refreshes and reloads the draw values,  but idk, advice pls!!?
package com.doggy.__elite;

import android.annotation.SuppressLint;
import android.graphics.Canvas;

public class GameLoopThread extends Thread {
       static final long FPS = 100;
       private GameView view;
       private boolean running = false;

       public GameLoopThread(GameView view) {
             this.view = view;
       }

       public void setRunning(boolean run) {
             running = run;
       }

       @SuppressLint("WrongCall")
    @Override
       public void run() {

             while (running) {
                    Canvas c = null;

                    try {
                           c = view.getHolder().lockCanvas();
                           synchronized (view.getHolder()) {
                                  view.onDraw(c);
                           }
                    } finally {
                           if (c != null) {
                                  view.getHolder().unlockCanvasAndPost(c);
                           }
                    }

             }
       }

}

line 141 is either:
        bka = Bitmap.createScaledBitmap(bka, Dwidtha, Dheighta, true);
--or--
        canvas.drawBitmap(bka, 0, 0, null);
i found the on pause problem, i just had to add:
    public void onPause(Bundle savedInstanceState) {
        super.onPause();
    }
:)
this is what happens when resumeing:
11-24 12:16:12.538: E/AndroidRuntime(20772): FATAL EXCEPTION: main
11-24 12:16:12.538: E/AndroidRuntime(20772): java.lang.NullPointerException
11-24 12:16:12.538: E/AndroidRuntime(20772):    at com.doggy.__elite.GameView$1.surfaceCreated(GameView.java:66)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at android.view.SurfaceView.updateWindow(SurfaceView.java:545)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:226)
11-24 12:16:12.538: E/AndroidRuntime(20772): at android.view.View.dispatchWindowVisibilityChanged(View.java:5851)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:951)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:951)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:951)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1038)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2583)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at android.os.Looper.loop(Looper.java:137)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at android.app.ActivityThread.main(ActivityThread.java:4508)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at java.lang.reflect.Method.invokeNative(Native Method)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at java.lang.reflect.Method.invoke(Method.java:511)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
11-24 12:16:12.538: E/AndroidRuntime(20772):    at dalvik.system.NativeStart.main(Native Method)
line 66 is:
                gameLoopThread.setRunning(true);


text:
Q: SkinnablePopUpContainer not destroyed I am monitoring my internet connection. When there is no service available I get an Event from my URLMonitor. I am listening to this event and calling a function that opens a SkinnablePopUpContainer. It is a very simple Component I have no listeners attached to it and it is defined only inside the function. When the user clicks the button inside the SkinnablePopUpContainer I close the component and try to destroy it using all possible ways I know of. When I check the Profiler Tool from Flash Builder the SkinnablePopUpContainer is still there. How do I destroy this component freeing the memory it is using.
Here is the listener function:
        protected function onNoServiceAvailable(e:*):void
        {
            var noserviceWindow:NoInternetError = new NoInternetError();
            noserviceWindow.open(this,false);
            noserviceWindow.x= 0;
            noserviceWindow.y= 0;
            noserviceWindow.width = SharedObject.getLocal('localObj').data.appMeasures.appWidth;
            noserviceWindow.height = SharedObject.getLocal('localObj').data.appMeasures.appHeight+200;
        }

and here is my SkinnablePopUpContainer
<?xml version="1.0" encoding="utf-8"?>
<s:SkinnablePopUpContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:nxTextInput="nx.components.extended.nxTextInput.*"
         xmlns:nxButton="nx.components.extended.nxButton.*"
         backgroundAlpha="0.4"
         horizontalCenter="0" verticalCenter="0"  width="100%" height="100%">
    <fx:Script>
    <![CDATA[

        protected function loginButton_clickHandler(event:Event):void
        {
            loginButton.removeEventListener(MouseEvent.CLICK,loginButton_clickHandler);
            this.close();
            var ob = this;
            ob = null;
        }

    ]]>
</fx:Script>
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Panel title="Fehler"
         horizontalCenter="0" verticalCenter="0"  color="white">
    <s:VGroup horizontalAlign="center" verticalAlign="middle" gap="20"
              height="100%" width="100%">
        <s:BitmapImage source="@Embed('assets/nxInspect/mobile/assetsCI/redAssets/alert_80x80.png')"  id="iconBitmpapDownOnline" verticalCenter="0" />
        <s:Label id="serviceFailure" text="Keine internetverbindung." width="90%" styleName="interactable" textAlign="center" color="white"/>
        <nxButton:NxButton id="loginButton" label="OK" width="100%" height="100" click="loginButton_clickHandler(event)" styleName="alert"/>
    </s:VGroup>

</s:Panel>

A: First off, the line var ob = this; just creates a reference variable to "this". Setting this variable to null will not make it delete itself. It will just re-reference the variable you just created to null again, so those 2 lines are useless.
Because you've contained your local variable noserviceWindow within the scope of the function onNoServiceAvailable, it should automatically be marked for Garbage Collection when there are no more references to it. If your profiler is recognizing it's existence, then there is probably another reference to it somewhere in your code.


text:
Q: Unable to receive PushIO notifications I made an android app according to this guide: http://docs.oracle.com/cloud/latest/marketingcs_gs/OMCFA/android/step-by-step/
I have used standard xml configuration. I am able to register my device into the PushIO and this is my log:
D/pushio﹕ Google Play Services found, using GCM for notification service.
D/pushio﹕ mRegisteringNotificationPreferences: null,mScheduledNotificationPreferences: null
D/pushio﹕ Get All PushIO Preferences
D/pushio﹕ mPushIOPersistenceManagerMap: 0
D/pushio﹕ Scheduling a new registration in 15 seconds
I/Broadcast registered﹕ true
D/Activity﹕ #1 setTransGradationModeColor false
D/OpenGLRenderer﹕ Enabling debug mode 0
D/pushio﹕ Starting registration...
D/pushio﹕ Register - Request String: dt=xxx
D/pushio﹕ Registration with push.io servers successful!

The problem is, I never receive any notification.
On top of that, the PushIO manager from which I am pushing doesn't show any number of 'Sent' notifications, though it shows on top of the image, that it was sent. See picture (might be just a bug in the UI, not sure):

My Manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.otoincreasedk.increasepushio">

    <uses-permission android:name="com.example.otoincreasedk.increasepushio.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.INTERNET"/>

    <permission android:name="com.example.otoincreasedk.increasepushio.permission.PUSHIO_MESSAGE"
        android:protectionLevel="signature"/>
    <uses-permission android:name="com.example.otoincreasedk.increasepushio.permission.PUSHIO_MESSAGE"/>
    <permission android:name="com.example.otoincreasedk.increasepushio.permission.C2D_MESSAGE" android:protectionLevel="signature" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:node="replace">
        <meta-data android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <receiver android:name="com.pushio.manager.PushIOBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action  android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="com.example.otoincreasedk.increasepushio" />
            </intent-filter>
        </receiver>

        <activity android:name="com.pushio.manager.PushIOActivityLauncher" android:exported="true" />
        <service android:name="com.pushio.manager.PushIOGCMIntentService" />
        <service android:name="com.pushio.manager.PushIOEngagementService" />
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <!--
                <receiver
                    android:name="com.example.otoincreasedk.increasepushio.NotificationBroadcastReceiver"
                    android:exported="false">
                    <intent-filter>
                        <action  android:name="com.example.otoincreasedk.increasepushio.PUSHIOPUSH"/>
                        <category android:name="android.intent.category.DEFAULT" />
                    </intent-filter>
                </receiver>
        -->

    </application>

</manifest>

My MainActivity's onCreate method:
// Instantiate the Push IO Manager:
PushIOManager pushIOManager = PushIOManager.getInstance(this);

// Ensure that any registration changes with Google get reflected with Push IO.
// Also registers for Broadcast Push Notifications (All Users).
pushIOManager.ensureRegistration();


text:
Q: Overriding Standard Edit Button On case, I did create a VF page to override the "Edit" standard button provided by Salesforce. I need to redirect it based on the record type of the record for which the edit is clicked. In the below code, if the record type matched, it is redirecting to a VF page and an Id is passed as parameter.
Issue: If the record type doesn't match, my guess is that it should take the page to standard edit page. But I am seeing the error (attached). Please let me know if I am doing anything wrong.

A: Off of the top of my head, I suspect that null should be Case.Id instead, and you need the override parameter to prevent infinite recursion:
action="{!URLFOR(CASE(Case.RecordType.Name, 'Embrel Support Program', $Action.Case.Edit,
    Case.Id, [id=Case.Id], true))}"

Some actions require the record Id of the record to edit. Technically, passing the id parameter to the case edit action may also contribute to the problem, so you might be better off using two different URLFOR:
action="{!IF(Case.RecordType.Name='Embrel Support Program',URLFOR(...),URLFOR(...))}"


text:
Q: Js background video Adjusting Centre I am trying to get my video to centre itself no mater what screen it uses.
I have the css to make sure the video all ways covers the screen according to ratio changes and not trying to get the css for left to change so that it centres the video at all times.
HTML
div class="heroWrapper"
  video autoplay muted loop class="videojsfix" id="myVideo"
    source src="/video/crystal.mp4" type="video/mp4"
  video
div

JS:
var windowSize = window.innerWidth;
var VideoWidth = document.getElementById ("myVideo").offsetWidth;
var difference = windowSize-VideoWidth;
var video = document.getElementById ("myVideo") ;
var moveDifference = ((difference)/2);

    if( VideoWidth > windowSize){
        $(".videojsfix").css({
        left: 'moveDifference'
    }); };

The idea is that it measures the overlap of the video and divides this by 2. This then give with the number i need to add to the video left css to move it into the centre of the screen.
Can someone say why this isn't working ?

A: Kindly check whether you are applying proper CSS or not.
if( VideoWidth > windowSize){
    $(".videojsfix").css({
    left: 'moveDifference'
}); };

if( VideoWidth > windowSize){
    $(".videojsfix").css({
    left: 'moveDifference'+ 'px';
}); };


text:
Q: SqlCommand-class force SELECT only? I'm developing a application that's for SQL-surveillance, it's just a console application that will run each 5min on a bunch of servers. It has a config file with connection string and sql query. The thing is I would like the program to accept SELECT queries only.
I colleague told me he thought I could set something in the SqlCommand-class but I've been googling for a while without any success. Anyone got a clean solution on my problem? I've thought about searching the query for different words but it's to much that can go wrong.
Any suggestions are welcome!

A: The database table itself can be restricted.
you can revoke all permission but select from the user of your application.
search for REVOKE/GRANT commands for SQL-SERVER.

A: This isn't going to be possible unless your application builds the entire SELECT statement itself.
The issue is that even if you ensure the first word is SELECT there is nothing stopping a malicuous user terminating the command and then issuing an EXEC or UPDATE statement also.
The best solution is to ensure that the user account referenced in your connection string has limited permissions to the SQL objects and thus only SELECT from supported objects will work.

A: Granting privileges would be the better way to go, but you can still parse the statement, even if its a series of SQL commands, using something like this:
bool OkToRun = true;
foreach(string s in TheQueryString.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
    if (!s.Trim().ToUpper().StartsWith("SELECT "))
        OkToRun = false;


text:
Q: Can a gas be compressed to a higher density than its liquid counterpart? Given a volume of a gas (such as Hydrogen, or any other gas)
At near 0 Kelvin in temperature, and near 0 barometric pressure (vacuum).
Can the gas be mechanically compressed to such an extent, that the gas has a higher density than the same substance would have as a liquid at the same temperature?
Or is every gas guaranteed to condense into the literal liquid state before reaching the necessary pressure to achieve such density?
(If the gas heats up in the process of being compressed, I imagine this could complicate things.)


text:
Q: How many Allocations can TURN server create? I am talking about Nat Traversal. There is a limit to the UDP port number of a server. So i think a TURN server can create 64k Allocations total which means only 64k clients can communicate with other peers though a TURN server at a time.
Is there a way to break the limit and have more clients to communicate without import more TURN server.


text:
Q: Snapshotting mirrored Git repository What is the proposed (most effective) way for creating snapshots for local mirrors of Git repositories?
Let say, I have created a local mirror of following Git repository:
git://source.codeaurora.org/external/imx/linux-imx.git

It is visible on my local git mirror as follows:
/var/www/html/git-mirror/source.codeaurora.org/imx/linux-imx.git

The build process fetches sources directly from this directory, now from my local mirror. I need to be able to re-create the build at any later point, but it is not possible, if e.g. the used branch was removed from the remote Git repository, and the local mirror is kept up-to-date to remote repository.
My first idea was to use cp -al (i.e. hard link copies) and rsync to create these snapshots so, that the build process can later on refer to this snapshot. This way, I would have e.g. following directory structure on my local git mirror server:
/var/www/html/git-mirror-snapshot/<snapshot_id>/source.codeaurora.org/imx/linux-imx.git

There must be some ready-made solution for this, but so far I have not found such.


text:
Q: Calculate Sum of Products Over Time With Changes in Historical Values Given two (simplified) tables in Access 2010:
**tblDailyLabour**
DailyLabourID - PK
DateRecorded
EmployeeID
QtyHours

**tblEmployeeHistory**
EmpHistoryID - PK
DateApplicable
EmployeeID
PayRate

Employee1 is entered into the database today. He's set in an 'Address Book' of employees with various values assigned to him. As of today he has a PayRate of $23.50/hr.
So from today moving forward, all hours logged will be calculated against today's rate for Employee1 at (23.50 * [QtyHours])
A month goes by and Employee1 gets a wage increase to $25.00/hr. This value is logged as a new entry in the 'Employee History' and is active as of, say, April 17th. So from April 17th onward he is now being calculated at (25.00 * [QtyHours]).
On a daily report this is straight forward as a query checks the report date and calculates the totals for Employee1. Whether the report is March 17th or April 25th, the query looks up the assigned rate and figures the total cost.
However, if I were to create an administrative report that was to evaluate the total cost of all days between March 17th and June 3rd, there may be several changes in the employee rates that need to be accounted for.
This is where I'm having a problem. I can't figure out how to not show any previous rates if DateApplicable is <= DateRecorded.
How might I go about writing a query that determines the rate on each day - dependent on the value in the Employee History - and calculate a total sum?
I apologize in advance if this question isn't phrased very well, but thanks a heap for any help!

A: I think it might be easier if you did a date range (start date & end date) in the 'address book' instead of just the start date.
On the current record, make the end date 12/31/9999. When entering a new current record, update the end date of the last record.