text:
Q: Using Xming X Window Server over a VPN I have the Xming X Window Server installed on a laptop running Windows XP to connect to some UNIX development servers.
It works fine when I connect directly to the company network in the office. However, it does not work when I connect to the network remotely over a VPN.
When I start Xming when connected remotely none of my terminal Windows are displayed.
I think it may have something to do with the DISPLAY environment variable not being set correctly to the IP address of the laptop when it is connected.
I've noticed that when I do an ipconfig whilst connected remotely that my laptop has two IP addresses, the one assigned to it from the company network and the local IP address I've set up for it on my "local network" from my modem/router.
Are there some configuration changes I need to make in Xming to support its use through the VPN?

A: Chances are it's either X authentication, the X server binding to an interface, or your DISPLAY variable. I don't use Xming myself but there are some general phenomenon to check for. One test you can do to manually verify the DISPLAY variable is correct is:

*

*Start your VPN. Run ipconfig to be sure you have the two IP addresses you mentioned (your local IP and your VPN IP).

*Start Xming. Run 'netstat -n' to see how it's binding to the interface. You should see something that either says localIP:6000 or VPNIP:6000. It may not be 6000 but chances are it will be something like that. If there's no VPNIP:6000 it may be binding only to your localIP or even 127.0.0.1. That will probably not work over the VPN. Check if there are some Xming settings to make it bind to other or all interfaces.

*If you see VPNIP:6000 or something similar, take note of what it says and remote shell into your UNIX host (hopefully something like ssh, if not whatever you have to get a text terminal).

*On the UNIX terminal type 'echo $DISPLAY'. If there is nothing displayed try 'export DISPLAY=VPNIP:0.0' where VPNIP is your VPN IP address and 0.0 is the port you saw in step 3 minus 6000 with .0 at the end (i.e. 6000 = 0.0, 6010 = 10.0).

*On the UNIX host run something like 'xclock' or 'xterm' to see if it runs. The error message should be informative. It will tell you that it either couldn't connect to the host (a connectivity problem) or authentication failed (you'll need to coordinate Xauth on your host and local machine or Xhosts on your local machine).

Opening Xhosts (with + for all hosts or something similar) isn't too bad if you have a locally protected network and you're going over a VPN. Hopefully this will get you started tracking down the problem. Another option that is often useful as it works over a VPN or simple ssh connectivity is ssh tunneling or X11 forwarding over ssh. This simulates connectivity to the X server on your local box by redirecting a port on your UNIX host to the local port on your X server box. Your display will typically be something like localhost:10.0 for the local 6010 port.
X can be ornery to set up but it usually works great once you get the hang of it.

A: Thanks for the help @Stephen and @Greg Castle, using it I've managed to resolve my problem.
To provide a basic guide for others (from scratch):
Using Xwindows on a Windows PC to connect to a UNIX server over a VPN
What you need to start with:

*

*The Putty Telnet/SSH client, download putty.exe (for free) from:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

*The Xming X server, download Xming (for free) from:
http://sourceforge.net/project/showfiles.php?group_id=156984
What to do:

*

*Install both of the above on your Windows PC

*From the Windows start menu select: Programs -> Xming -> Xming

*Run the Putty.exe program in the location you downloaded it to

*In the PuTTY configuration screen do the following:

*

*Set the IP address to be the IP address of your UNIX server

*Select the SSH Protocol radio-button

*Click the SSH : Tunnels category in the left hand pane of the configuration screen

*Click the Enable X11 forwarding check-box

*Click the Open button

*Logon as usual to your UNIX server

*Check the directory containing the X windows utilities are in your path, e.g. /usr/X/bin on Solaris

*Run your X Windows commands in your putty window and they will spawn new windows on your desktop

A: I got Xming and PuTTY working with Cisco VPN by replacing the PuTTY configuration in Connection > SSH > X11 > X display location, localhost:0.0, with VPNIP:0.0. VPNIP can be seen in the VPN statistics client address information by left-clicking on the VPN client lock icon and choose Statistics....
I didn't muck with the DISPLAY environment variable on the remote host. But, like others, I modified sshd_config on the remote host, adding these lines:
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
AddressFamily inet

A: I have got same issue with Xming and Putty on a Windows 10 machine and found the solution here. I have overcome the problem just adding Tunnels to the session in PuTTY. But first you need to check;

*

*sshd_config under /etc/ssh (in rhel7).

*Enable X11 forwarding at left navigation pane Connections > SSH > X11

*iptables under /etc/sysconfig/ (in rhel7). If ports are blocked and you have permission, open the ports for 6000. I have added below line before first reject line to open ports from 6000 to 6003. It may be more specific in your case.
-A INPUT -m state --state NEW -m tcp -p tcp -m multiport --dports 5901:5903,6000:6003 -j ACCEPT
Then;

*

*Go to Connections > SSH > Tunnels in PuTTY and add a tunnel with Source Port=6000, Destination=127.0.0.1:6000 and check Remote radio button. Then click the Add button.

*After your SSH connection established, set your DISPLAY variable manually with the command below:
 export DISPLAY=127.0.0.1:0.0
More Information;

If you set DISPLAY variable as 127.0.0.1:1.0, it will communicate over 6001 port . In this case, you need to add another tunnel for port number 6001.

A: I had nothing but problems with Xming. When I could get it to work it was extremely slow (this is over a VPN). IMO X is not designed to run over slow connections its too chatty. And by slow connection I mean anything less then a LAN connection.
My solution was to use x11vnc. It lets you access your existing X11 session through VNC. I just ssh into my box through the VPN and launch:
$ x11vnc -display :0

That way I can access everything I had opened during the day. Then when I don't I just exit (Ctrl-C) in the terminal to close x11vnc.

A: Haven't have the exact problem, but I think you need to look at the xhost and make sure that the vpn remote is allowed to send data to the x server.
This link might help:
http://www.straightrunning.com/XmingNotes/trouble.php

A: You may have better luck doing X11 Forwarding through SSH rather than fiddling with your DISPLAY variable directly.  X11 Forwarding with SSH is secure and uses the existing SSH connection to tunnel, so working through a VPN should be no problem.
Fortunately this is fairly straightforward with Xming.  If you open your connection from within Xming (e.g. the plink option) I believe it sets up X11 forwarding by default.  If you connect using another SSH client (e.g. PuTTY) then you simply need to enable X11 forwarding (e.g. 'ssh -X user@host').  In PuTTY the option is under Connection -> SSH -> X11 -> click on 'Enable X11 Forwarding'.
Make sure Xming is running in the background on your laptop and do the standard X test, 'xclock'.  If you get a message like 'X connection to localhost:19.0 broken (explicit kill or server shutdown).' then Xming is most likely not running.
Also, make sure you're not explicitly setting your DISPLAY variable in any startup scripts; SSH will set up an alias (something like localhost:10 or in the example above localhost:19) for the X11 tunnel and automatically set DISPLAY to that value.  Overwriting DISPLAY will obviously mean you will no longer be pointing to the correct X11 tunnel.  The flip side of this is that other terminals that don't have SSH X11 Forwarding set can use the same DISPLAY value and take advantage of the tunnel.
I tend to prefer the PuTTY option but several of my coworkers use plink from within Xming.

A: putty + XMing - I had to set the DISPLAY environment variable manually to get things running (alongside with checking "Enable X11 forwarding" in putty - Connection/SSH/X11)
export DISPLAY=0:10.0
(it was set to "localhost:10.0", which did not work)

A: You have to add the Linux machine's DNS name(s) and IP address to the C:\Program Files\xming\X0.hosts file. File should contain:
LinuxBox.mydomain.com
LinuxBox
192.168.1.25

This is the right answer: https://www.slackwiki.com/X_Windows:_Remote_X_to_Windows_with_Xming


text:
Q: Git branch ahead of master (old repo) I get annoyed with the fact that every time I checkout to my master branch I get the message that my branch is ahead of my old repository.
A while ago I created a new repository I renamed that one to origin and renamed the other one to old but now every time that I checkout to my master to merge the current branch I get this annoying message that my master is behind on the old repository.
I do not want to get rid of the repository completely as I might need it on a later time
Does anyone have an idea how to git rid of this message?

A: Git issues this warning only when a branch is ahead of the one it is tracking. This means you not only see this warning but also experience some other inconveniences working with your master branch since it is tracking an obsolete one.
You should set the branch to track master in the new repository:
git branch -u origin/master master

redpajama_set_name: RedPajamaStackExchange


text:
Q: Angular 5 service replacement/override I created a core library for my project containing some components and services. I built the library with ng-packagr. In the consuming project which references the library I built my webapp containing components provided by the library. Nothing special so far. But sometimes I want a component (coming from my lib) calling a method from a Service outside of the lib. Is this possible? Can I somehow inject a service to a component which is defined inside a library?
Cheers

A: I've achieved this before with something like this:
Your library's service(s) should be defined as an interface rather than as a concrete implementation (as is done in OO languages quite often). If your implementing application will only sometimes want to pass in its own version of the service then you should create a Default service in your library, and use it as so:
import { Component, NgModule, ModuleWithProviders, Type, InjectionToken, Inject, Injectable } from '@angular/core';

export interface ILibService {
  aFunction(): string;
}

export const LIB_SERVICE = new InjectionToken<ILibService>('LIB_SERVICE');

export interface MyLibConfig {
  myService: Type<ILibService>;
}

@Injectable()
export class DefaultLibService implements ILibService {
  aFunction() {
    return 'default';
  }
}

@Component({
  // whatever
})
export class MyLibComponent {
  constructor(@Inject(LIB_SERVICE) libService: ILibService) {
    console.log(libService.aFunction());
  }
}

@NgModule({
  declarations: [MyLibComponent],
  exports: [MyLibComponent]
})
export class LibModule {
  static forRoot(config?: MyLibConfig): ModuleWithProviders {
    return {
      ngModule: LibModule,
      providers: [
        { provide: LIB_SERVICE, useClass: config && config.myService || DefaultLibService }
      ]
    };
  }
}

Then in your implementing application you have the ability to pass in the optional config via your library's forRoot method (note that forRoot should only be called once per application and at the highest level possible). Note that I've marked the config parameter as optional, so you should call forRoot even if you have no config to pass.
import { NgModule, Injectable } from '@angular/core';
import { LibModule, ILibService } from 'my-lib';

@Injectable()
export class OverridingService implements ILibService {
  aFunction() {
    return 'overridden!';
  }
}

@NgModule({
  imports: [LibModule.forRoot({ myService: OverridingService })]
})
export class ImplementingModule {

}

This was from memory as I don't have the code to hand at the moment so if it doesn't work for any reason let me know.


text:
Q: Return parent node and next sibling while ordering using jQuery sortable table I have a table where my thead tags can be sorted ascendingly and descendingly.
while each table row has a collapse as a next sibling table row when sorted only the table row gets sorted without its next sibling which includes it's own collapse.
I've tried using .nextElementSibling(); but the structure of the table gets messed up while rows are moved or getting sorted.
Here is my code snippet returning only the parent node without it's next sibling which i want to be ordered along with.

//sortelements function
jQuery.fn.sortElements = (function(){
    var sort = [].sort;

    return function(comparator, getSortable) {

        getSortable = getSortable || function(){return this;};

        var placements = this.map(function(){

            var sortElement = getSortable.call(this),
                parentNode = sortElement.parentNode,

                // Since the element itself will change position, we have
                // to have some way of storing it's original position in
                // the DOM. The easiest way is to have a 'flag' node:
                nextSibling = parentNode.insertBefore(
                    document.createTextNode(''),
                    sortElement.nextSibling
                );

            return function() {

                if (parentNode === this) {
                    throw new Error(
                        "You can't sort elements if any one is a descendant of another."
                    );
                }

                // Insert before flag:
                parentNode.insertBefore(this, nextSibling);
                // Remove flag:
                parentNode.removeChild(nextSibling);

            };

        });

        return sort.call(this, comparator).each(function(i){
            placements[i].call(getSortable.call(this));
        });

    };

})();

$(document).ready(function () {
            var table = $('#comparetable');

            $('.sortable')
                .wrapInner('')
                .each(function(){

                    var th = $(this),
                        thIndex = th.index(),
                        inverse = false;

                    th.click(function(){
                        table.find('td').filter(function(){
                            return $(this).index() === thIndex;
                        }).sortElements(function(a, b){
                                return parseInt($.text([a])) > parseInt($.text([b])) ?
                                  inverse ? -1 : 1
                                  : inverse ? 1 : -1;
                        }, function(){
                            // parentNode is the element we want to move and the next element to be moved is to be added here.
                            return  this.parentNode;
                        });

                        inverse = !inverse;

                    });
                });
            });

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

                Plan
                Group Premium
                In Patient
                Out Patient

                    Chronic & Pre-existing disease
                Medication
                Dental
                Optical
                Maternity
                Actions

                    50,928

                    750,928

                    20,928

                    30,928

                    50,928

                    83,928

                    34,928

                    54,928

                        Details

Class : Private

Network : Private

Family : Private

Physiotherapy : Private

Dental : Private

Optical : Private

Maternity : Private

Life insurance : Private

                    250,928

                    120,928

                    30,928

                    60,928

                    60,928

                    80,928

                    80,928

                    30,928

                        Details

Class : Private

Network : Private

Family : Private

Physiotherapy : Private

Dental : Private

Optical : Private

Maternity : Private

Life insurance : Private

                    50,928

                    510,928

                    32,928

                    54,928

                    66,928

                    75,928

                    23,928

                    24,928

                        Details

Class : Private

Network : Private

Family : Private

Physiotherapy : Private

Dental : Private

Optical : Private

Maternity : Private

Life insurance : Private


text:
Q: Matplotlib Animation plotting the same thing for every frame I am trying to recreate the animation in this video.
Currently, my code plots, but each frame is the same frame as the last. I am trying to first plot the vertices, then plot each dot one at a time. The points are precalculated, so all I want is to plot the current point and the points before it. The next step will be for me to make an animation (edit: i.e. gif or mp4), but that is after I can get this part working.
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import numpy as np
import random

vertices = np.array([[0,0],
            [2,0],
            [1,2.5]])

dots = 100

def newPos(index, old_x, old_y):
    vertex_x = vertices[index][0]
    vertex_y = vertices[index][1]
    new_x = 0.5*(vertex_x + old_x)
    new_y = 0.5*(vertex_y + old_y)
    return([new_x,new_y])

global points
points = np.array([[0.25, 0.1]])

for i in range(dots-1):
    points = np.concatenate((points, [newPos(random.randint(0,2), points[i][0], points[i][1])]), axis = 0)

plt.figure()

global index
index = 0

def animate(i):
    plt.cla()

    global index
    index += 1

    plt.plot(vertices[0][0], vertices[0][1], 'o')

    global points
    plt.plot(points[0:index][0], points[0:index][1], 'o', color = '#1f77b4')

    plt.legend(['index = {0}'.format(index)], loc='upper left')

    plt.tight_layout()

while index < dots:
    ani = FuncAnimation(plt.gcf(), animate, interval=15000/dots)

    plt.title('Chaos Game with {0} Vertices and {1} Steps'.format(len(vertices), dots))

    plt.show()

A: It seems like you misunderstood how matplotlib.animation.funcanimation works, I'll strongly advise you to look at some of the many examples to be found online. Let's try with this version as follows:
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
import random

vertices = np.array([[0,0],
                     [2,0],
                     [1,2.5],
                     [0,0]])

dots = 1000

# lower and higher bounds for x to be generated
int_lb = np.min(vertices[:,0])
int_hb = np.max(vertices[:,0])

def newPos(index, old_x, old_y):
    vertex_x = vertices[index][0]
    vertex_y = vertices[index][1]
    new_x = 0.5*(vertex_x + old_x)
    new_y = 0.5*(vertex_y + old_y)
    return([new_x,new_y])

# evaluating all your points
points = np.array([[0.25, 0.1]])
for j in range(dots-1):
    points = np.concatenate((points, [newPos(random.randint(int_lb,int_hb), points[j][0], points[j][1])]), axis=0)

fig = plt.figure()
ax = plt.gca()
ax.set_xlim([np.min(vertices[:,0])-0.05*np.max(vertices[:,0]),1.05*np.max(vertices[:,0])])
ax.set_ylim([np.min(vertices[:,1])-0.05*np.max(vertices[:,1]),1.05*np.max(vertices[:,1])])
ax.set_title('Chaos Game with {a} Vertices and {b} Steps'.format(a=len(vertices)-1, b=dots))
# draw boundaries
ax.plot(vertices[:,0],vertices[:,1],'k-', linewidth=1)
# initialize scatter object for current step and all evaluated dots
scat_curr = ax.scatter([], [], marker='X', s=15, c='black')
scat_dots = ax.scatter([], [], marker='o', s=5, c='#1f77b4',zorder=-1)

def init():
    scat_curr.set_offsets(np.c_[vertices[0,0], vertices[0,1]])
    scat_dots.set_offsets(np.c_[vertices[0,0], vertices[0,1]])
    return scat_curr, scat_dots

def animate(i):
    scat_curr.set_offsets(np.c_[points[i,0], points[i,1]])
    scat_dots.set_offsets(np.c_[points[:i,0], points[:i,1]])
    ax.legend([scat_curr],['iter i = {a}'.format(a=i)], loc='upper left')
    return scat_curr, scat_dots

anim = animation.FuncAnimation(fig, animate, init_func=init, frames=dots, interval=10)

Writer = animation.writers['ffmpeg']
writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)

anim.save('some_nice_triforces.mp4', writer=writer)

which gives:

If you have any questions, I will add some more comments but since this is mainly your own work here I am sure that you will figure out that what you have tried was far more complex than what it should have been :). Hope this helps.


text:
Q: Are Services in Kubernetes simply reverse proxies that allow a constant point of contact? I'm researching Kubernetes Services (that is one of the kinds of k8s components, much like Pods and ReplicaSets).  They seem to function like reverse proxies, but I know k8s internally uses DNS, so perhaps they are some kind of load balancing DNS?  Also it would somehow mean, that since a Pod can be relocated or exist on many nodes it couldn't simply be a Reverse Proxy since it too would need to be addressable, but share a single IP on many machines... (obviously struggling to imagine how they were built without looking directly at the source code -- yet).
What makes up a K8s Service?  DNS + Reverse Proxy, or something more/less?  Some kind of networking trick?

A: Regular ClusterIP services
Ensuring network connectivity for type: ClusterIP Services is the responsibility of the kube-proxy -- a component that typically runs on each and every node of your cluster. The kube-proxy does this by intercepting outgoing traffic from Pods on each node and filtering traffic targeted at service IPs. Since it is connected to the Kubernetes API, the kube-proxy can determine which Pod IPs are associated with each service IP and can forward the traffic accordingly.
Conceptually, the kube-proxy might be considered similar to a reverse proxy (hence the name), but typically uses IPtables rules (or, starting at Kubernetes 1.9 optionally IPVS). Each created service will result in a set of IPtables rules on every node that intercepts and forwards traffic targeted at the service IP to the respective Pod IPs (service IPs are purely virtual and exist only in these IPtables rules; nowhere in the entire cluster you will find an actual network interface holding that IP).
Load balancing is also implemented via IPtables rules (or IPVS). Load balancing always occurs on the source node that the traffic originates from.
Here's an example from the Debug Services section of the documentation:
u@node$ iptables-save | grep hostnames
-A KUBE-SEP-57KPRZ3JQVENLNBR -s 10.244.3.6/32 -m comment --comment "default/hostnames:" -j MARK --set-xmark 0x00004000/0x00004000
-A KUBE-SEP-57KPRZ3JQVENLNBR -p tcp -m comment --comment "default/hostnames:" -m tcp -j DNAT --to-destination 10.244.3.6:9376
-A KUBE-SEP-WNBA2IHDGP2BOBGZ -s 10.244.1.7/32 -m comment --comment "default/hostnames:" -j MARK --set-xmark 0x00004000/0x00004000
-A KUBE-SEP-WNBA2IHDGP2BOBGZ -p tcp -m comment --comment "default/hostnames:" -m tcp -j DNAT --to-destination 10.244.1.7:9376
-A KUBE-SEP-X3P2623AGDH6CDF3 -s 10.244.2.3/32 -m comment --comment "default/hostnames:" -j MARK --set-xmark 0x00004000/0x00004000
-A KUBE-SEP-X3P2623AGDH6CDF3 -p tcp -m comment --comment "default/hostnames:" -m tcp -j DNAT --to-destination 10.244.2.3:9376
-A KUBE-SERVICES -d 10.0.1.175/32 -p tcp -m comment --comment "default/hostnames: cluster IP" -m tcp --dport 80 -j KUBE-SVC-NWV5X2332I4OT4T3
-A KUBE-SVC-NWV5X2332I4OT4T3 -m comment --comment "default/hostnames:" -m statistic --mode random --probability 0.33332999982 -j KUBE-SEP-WNBA2IHDGP2BOBGZ
-A KUBE-SVC-NWV5X2332I4OT4T3 -m comment --comment "default/hostnames:" -m statistic --mode random --probability 0.50000000000 -j KUBE-SEP-X3P2623AGDH6CDF3
-A KUBE-SVC-NWV5X2332I4OT4T3 -m comment --comment "default/hostnames:" -j KUBE-SEP-57KPRZ3JQVENLNBR

For more information, have a look at the Virtual IPs and Service Proxies section in the manual.
Headless services
Besides regular ClusterIP services, there are also Headless Services (which are declares by specifying the property clusterIP: None when creating the service). These will not use the kube-proxy; instead, their DNS hostname will directly resolve to all Pod IPs that are associated with the service. Load balancing is achieved via regular DNS round-robin.

A: For services and routing within the cluster mostly iptables  except when you are explicitly using ipvs (which would partially use iptables) or something like Cillium (which allows you to plugin BFP). The kube-proxy in each node manages the iptable rules. More information on how the proxy modes here.
On the DNS side, Kubernetes runs either kube-dns (1.10 or older) or coredns (1.11 or newer) and essentially all services and pods get registered in the that DNS service for other pods/containers to find them. For example, a service will have an FQDN like this: my-service.my-namespace.svc.cluster.local  More information on that here.


text:
Q: needed any running example for ng-sidebar implementation I am new to angular2 i want to create sidebar using ng-sidebar ,
But the documentation they had given in readme.MD doc is quite confusing .I am not able to implement in my already build application.
If somebody have any implement experience in ng-sidebar please let me know how to call that component in my application?
I am very much confused about forRoot method.

A: Setup:

*

*Run npm install --save ng-sidebar

*In your app.module.ts, add following:
import { SidebarModule } from 'ng-sidebar';

Add SidebarModule.forRoot() inside imports: [] in @NgModule, should look like something like below:
@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, SidebarModule.forRoot()],
  bootstrap: [AppComponent],
})

*In app.component.html add:
<ng-sidebar-container>

  <ng-sidebar [(opened)]="_opened">

Sidebar contents

  </ng-sidebar>

    <button (click)="_toggleSidebar()">Toggle sidebar</button>

</ng-sidebar-container>

In app.component.ts add:
private _opened: boolean = false;

private _toggleSidebar() {
  this._opened = !this._opened;
}

Working demo
Code of working demo/Example of calling ng-sidebar in component

A: For Angular6, if you are facing the issue that the sidebar is not appearing (silently failing without appearing),
add a height style element in the code provided by @Nehal like this:
<ng-sidebar-container style = "height: 100vh">
    <ng-sidebar [(opened)]="_opened" mode = "push" >

 this is in sidebar

    </ng-sidebar>

        <button (click)="_toggleSidebar()">Toggle sidebar</button>

</ng-sidebar-container>

See my previous answer for the Working Code


text:
Q: Bulma - Navbar logo image is not adapting to the navbar heigh. How can I change the logo image fit? I have just started using Bulma (bulma.io) and want this image to resize to the navbar height which I belive by default is 3.25rem (16px base font-size) but it is not.
I have tried resizing the image to 600px x 140px no luck, I have googled around a lot and still cant fix it. Yet if I use the example bulma image which is 600px x 140px it works? Here is the code Using the bulma image

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">

or jsfiddle
My code

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">

or jsfiddle

A: The logo image you are referring to is 640x640 with white space, either you crop the logo image or use it as background-image as shown below

.navbar-item {
  background: url(https://preview.ibb.co/bVUFKU/logo_transparent.png) no-repeat center center;
  background-size: cover;
  width: 152px
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">


text:
Q: Linux boot issue I get this text:
[sdb] no caching node page found
[sdb] assuming drive cache: write though.
wrong diagnostic page : asked for 1 got 8.
Failed to get diagnostic page 0x1.
Failed to bind enclosure -19


text:
Q: Redemption using filter on a custom datetime field in contacts I'm having a problem using a filter on a custom date in contacts.
RDOItems Contacts = null;
string strSearch = string.Empty;

strSearch = AddQuotes("http://schemas.microsoft.com/mapi/string/{01234567-8901-2345-C678-901234567801}/CustomFieldString");

strSearch += " <> '' ";

strSearch += " AND ";
strSearch +=  AddQuotes("http://schemas.microsoft.com/mapi/string/{01234567-8901-2345-C678-901234567802}/CustomFieldDate");
strSearch += " < ";
strSearch += "'2010-04-28 18:00'";

Contacts = (RDOItems)synContacts.Items.Restrict(strSearch)

When i use only the first part of the filter (CustomFieldString) i get the right contacts, but when i expand the filter with the datetime field no contacts are returned.
Thanks,
Spitje

A: If the named MAPI property has a string as anid (as oppoosed to an integer), there is no way to specify the property type in the DASL name, so Redemption assumes string.
If the property was added to the folder fields, the property definition will be stored in a hidden message in that folder, and you can use just the property name (CustomFieldDate)
Otherwise you can you call GetIdsFromNames to figure out the property tag, "or" it with the appropriate type (PT_SYSTIME), then contruct the DASL name that looks like a regular (not named) MAPI property:
e.g. http://schemas.microsoft.com/mapi/proptag/0x80650040
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool


text:
Q: I can't update new mentions (tweepy) My bot doesn't reply to new mentions, it keeps seeing ones he has already replied to.
Whenever I run my this code, the while loop keeps going (it's an infinite loop) and when I add new mentions it doesn't update.
What should I do? I already tried mentions.clear(), but it didn't help.
import tweepy
import time
from pprint import pprint

def get_already_responded(file_name):
    with open(file_name, "r") as file:
        seen = set()

        for line in file:
            seen.add(line.strip())
    return seen

def add_already_responded(responded_id, file_name):
    with open(file_name, "w") as file:
        file.write(str(responded_id) + "\n")

FILE = 'responded.txt'
auth = tweepy.OAuthHandler('removed', 'removed')
auth.set_access_token('removed-removed',
                      'removed')

api = tweepy.API(auth)

mentions = api.mentions_timeline()

# necessary: id, user, text
"""dict_keys(
['_api', '_json', 'created_at', 'id', 'id_str', 'text', 'truncated', 'entities', 'source', 'source_url', 'in_reply_to_status_id', 'in_reply_to_status_id_str', 'in_reply_to_user_id',
 'in_reply_to_user_id_str', 'in_reply_to_screen_name', 'author', 'user', 'geo', 'coordinates', 'place', 'contributors',
  'is_quote_status', 'retweet_count', 'favorite_count', 'favorited', 'retweeted', 'possibly_sensitive', 'lang']
)
"""

while True:
    seen = get_already_responded(FILE)
    for mention in mentions:
        userScreenName = mention.user.screen_name
        tweetId = mention.id
        textMsg = mention.text.split()[1:]

        print(f'{userScreenName} - {tweetId} --> {textMsg}')

        try:
            if tweetId not in seen:
                api.update_status(status=f"@{userScreenName} ur msg ---> {textMsg}", in_reply_to_status_id=tweetId)
                seen.add(tweetId)
        except tweepy.error.TweepError:
            add_already_responded(tweetId, FILE)


text:
Q: $MSYSTEM variable in bashrc NOTE
I am using Windows 7. On installing msysgit and GitHub for Windows, I found that git bash can be called from the folders. I opened up the terminal and first thing I wanted was to change how it displays in the console.
Here is what echo $PS1 gave me:
\[\033]0;$MSYSTEM:\w\007 \033[32m\]\u@\h \[\033[33m\w$(__git_ps1)\033[0m\] $

I've been modifying my bash's PS1 for some time now, and know most of the content there is. But I have never ever seen $MSYSTEM before.
Google resulted in nothing except some results about using it to set $MSYSTEM=MINGW32 which of course isn't the case here.
So, what does MSYSTEM variable do? Also, when I create a file .bashrc and put this line there; the terminal now shows a blank-space just before my username. This is because of the empty space in this segment \007 \033 but it was absent before. Here are the screenshots when I use a custom .bashrc and when I don't:

Without bashrc

With bashrc
I know why the newline is absent from my customized terminal; but the questions are:

*

*What is $MSYSTEM?

*Why is the first blank-space space missing in first case?

A: It sets the Window title to the value of MSYSTEM variable. As far as the
space, it looks like you messed up the final newline, notice carefully
export PS1='\[\033]0;$MSYSTEM:\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '

in the variable above each start of a new line insert a literal newline
character into the PS1.
How to change the title of an xterm


text:
Q: Regex - find string by excluding part of it I have text: "Johnny Alan Walker  Sint Jansstraat 7, 1012 HG Amsterdam +123456789012"
Is is possible to find Lastname and phone?
Exclude address?
Address regex is this: "([A-Z]{1,}[a-z]{1,}\s){2}[0-9]{0,4}\,\s{1,}[0-9]{4}\s[A-Z]{2}\s{1,}[a-zA-Z]{1,}" (two words from capital, housenumber, comma, postal code and city)
I want result string to be "Walker +123456789012"

A: You could do....
\w+\s+\w+\s+(\w+).*(\+\d+)

And your capture groups should match up pretty well with what you're trying to match...
Essentially this will "disregard" your first and second "words" (first / middle name) and then disregard EVERYTHING from in between until it finds a + then captures the digits after it.
Live example:  https://regex101.com/r/MjJCSv/1
In theory if your last name and your address will always be separated by more than 1 space you can shorten this a little bit and write it as
(\w+)\s{2,}.*(\+\d+)

Live example of this functionality:  https://regex101.com/r/vGGB4z/1
Example implementation of the later in java:  http://ideone.com/RExAEO

A: You can use the following to capture just the surname and the phone number.
The first part ((\w+\s){3}) will capture the 3rd occurrence of a word followed by a space.
The second part (.+?) will capture everything
The third part ((\+?\d+)$) will capture an optional + (phone number prefix) and the rest of the phone number, up to the end of the string.
(\w+\s){3}.+?(\+?\d+)$

*

*\1 - The surname

*\2 - The phone number

https://regex101.com/r/gqu0tt/4
But, IF the surname and the address is separated with more than 1 space, then you can use
(\w+)\s{2,}.+?(\+?\d+)$

*

*\1 - The surname

*\2 - The phone number

https://regex101.com/r/gqu0tt/5

I've tested these expressions on the Java engine, and they give back the correct match

A: This should do what you need, and also doesn't assume three names (works without a middle name present), so it's a little more flexible in case you run into entries for people who don't have a middle name:
.*?(\w+)\s*(?:[A-Z]{1,}[a-z]{1,}\s){2}[0-9]{0,4}\,\s{1,}[0-9]{4}\s[A-Z]{2}\s{1,}[a-zA-Z]{1,}\s*(\+\d+)

*

*.*?(\w+)\s* - Capture the last word before the whitespace before the address. .*? will lazily match anything up to the word preceeding the address, but not capture. \s* will match the whitespace between the word and the address.

*(?:[A-Z]{1,}[a-z]{1,}\s){2}[0-9]{0,4}\,\s{1,}[0-9]{4}\s[A-Z]{2}\s{1,}[a-zA-Z]{1,} - your address regex but using a non-capturing group (?:)

*\s*(\+\d+) - Captures the + and following numbers. \s* will match the whitespace between the address and the +.

I reused your address regex, but made the capture group non-capturing. Then we match the last word before the address (the last name) using (\w+), and the + and following numbers after the address using (\+\d+).
Here it is in action: https://regex101.com/r/YGiaJT/1


text:
Q: SQL SELECT statement containing AS I have the SQL query:
select title, scale / next_scale, c
from ( select title, scale, scale*D0 AS c,
              lead(scale) over(partition by title order by scale asc) as next_scale,
              row_number() over(partition by title order by scale asc) as agg_row
       from signatures
     ) agg
where agg_row = 1;

and it works as expected. However, what I really want the sorting "scale" value to be an arithmetic operation between several columns, so I tried using an AS clause (shown above) and modify the query to:
select title, scale / next_scale, c
from ( select title, scale, scale*D0 AS c,
              lead(scale) over(partition by title order by c asc) as next_scale,
              row_number() over(partition by title order by c asc) as agg_row
       from signatures
     ) agg
where agg_row = 1;

However, it fails at the ORDER BY c. Why is this? I can substitute ORDER BY scale*D0 and it works just fine. However, I will eventually want to use a term like: scale*D0*D1*D2*...*D100; and I don't want to have to calculate that 3 different times - not to mention the physical length of the query. I am hoping to have scale*D0*D1*D2*...*D100 AS c and then ORDER BY c.
Is this possible?
I am using PostgreSQL.
Many thanks,
Brett

A: Calculate c in a subquery:
select title, scale / next_scale, c
from ( select title, scale, c,
              lead(scale) over(partition by title order by c asc) as next_scale,
              row_number() over(partition by title order by c asc) as agg_row
       from (select title, scale, scale * D0 AS c from signatures) signatures_calc
     ) agg
where agg_row = 1;

A: You can ORDER BY the ordinal number of the column:
select title, scale / next_scale, c
from ( select title, scale, scale*D0 AS c,
          lead(scale) over(partition by title order by scale asc) as next_scale,
          row_number() over(partition by title order by scale asc) as agg_row
   from signatures
 ) agg
where agg_row = 1
order by 3;

A: When put the order by is the sub query, should fill the bill
select title, scale / next_scale, c
from ( select title, scale, scale*D0 AS c,
          lead(scale) over(partition by title order by scale asc) as next_scale,
          row_number() over(partition by title order by scale asc) as agg_row
       from signatures
       order by 3
 ) agg
where agg_row = 1;


text:
Q: $\sum_{n=1}^{\infty}\frac{\sin (nx^2)}{1+n^3}$ represents a differentiable function Show that the following series of function defines a continuous differentiable function function in $\mathbb R$.
$$\sum_{n=1}^{\infty}\frac{\sin (nx^2)}{1+n^3}.$$
We have , $|f_n(x)|=\left|\frac{\sin (nx^2)}{1+n^3}\right|\le \frac{1}{1+n^3}\le \frac{1}{n^3}=M_n \text{ (say) }$
As, $\sum M_n$ is convergent so, the given series is uniformly convergent. Also , each $f_n(x)$ is a continuous function in $\mathbb R$. So, the given series converges to a continuous function , say $f(x)$.
But how we can show that $f(x)$ is differentiable function ?
Please help...

A: Thew derivative of $f_n$ is continuous and is given by
$$
f'_n(x)=\frac{2\,n\,x\sin (n\,x^2)}{1+n^3}.
$$
If $|x|\le R$, then
$$
|f'_n(x)|\le\frac{2\,n\,R}{1+n^3}\le\frac{2\,R}{n^2}.
$$
Since $\sum1/n^2<\infty$, The series $\sum f'_n$ is uniformly convergent on $[-R,R]$. This, together with the convergence of $\sum f_n$, proves that $f$ is differentiable and
$$
f'(x)=\sum_{n=1}^\infty f'_n(x),\quad x\in\mathbb{R}.
$$


text:
Q: Cross platform build system with IDE? I've been searching since around a year for a combination of C++ build system and IDE which brings the following features:

*

*Cross plattform build system that builds atleast on Windows, Linux and Mac OS.

*Some sort of inteligent code completion (IntelliSense of Visual Studio, that thing fromEclipse).

*Debugger integrated inside the IDE (starting debugging, setting breakpoints in the code, ...).

*No need to restart programms all over to build, or edit code.

It doesn't matter for me on which operating system the IDE runs, only important aspect is that there is a way to build on other plattforms (possibly without requiring that IDE). The closest I got to these was a combination of CMake + VisualStudio. Problem with that is, that every time you want to adjust your build process (add or delete a file) you have to restart VisualStudio and reconfigure all settings, CMake won't set for you.

A: The Qt framework uses Qmake - it has a cross platform ide QtCreator that uses the qmake .pro files.
There is also a plugin for visual studio that will convert .pro to and from visual studio projects

A: I have investigated a solution like the one you are looking for and haven't found anything satisfactory. I'm currently maintaining separate project files for each of my platforms (Visual Studio, XCode for OSX and iOS, makefiles for Linux, Android and webOS). I have found that it isn't a lot of work to keep them in sync, so I don't mind.
But in any case, here are a couple of ideas that I think are the most promising to achieve what you want:

*

*I think the CMake solution that you are using is the best, but it is true that each time you regenerate your project custom settings are lost. You may want to generate a patch file with all your settings, so that you can reapply those changes after running CMake to update your projects. This should work for settings stored in text files, so it works for .sln, .vcxproj, vcxproj.filters and vcxproj.user files.

*You may have some luck  with Eclipse or Netbeans. Both are cross-platform IDEs that will allow you to work with a single project file on multiple platforms. If you have your project under source control, then you can commit the project files from your main platform, and then on other platforms you just check out the projects and make the necessary changes to the settings (directories, etc.). You just need to remember to always commit changes to the projects from the main platform, and on the other ones the local changes will stay only in your local source tree.
Option #2 above is decent, but not an option for me, as I have developed an addiction to the VS debugger, it is so much better than anything else that I would not consider any setup that does not include it.
Good luck!

A: Codeblocks also has a cross-platform build system.
Codeblocks builds itself through its Codeblocks project file.

A: Here is what I ended up doing:

*

*I stuck to CMake over qmake, since it simply seems more powerful, and is easy to install seperatly. Also both only generate Makefiles so they pretty much do the same for me.

*Since the Eclipse/VisualStudio project files created by CMake are only there for building I couldn't use them (running/debugging inside of IDE is not possible). Now I'm creating standard Makefiles and then build these with a hand mantainend Eclipse Project.

*I added a filesystem link to my source directory and code completion and debugging are working.


text:
Q: Knowing the Value or Result on each variable SQL stored procedure This is my stored procedure:
CREATE PROCEDURE _spCalc
   (@Num01 decimal(18,0), @Num02 decimal(18,0), @Num03 decimal(18,0))
AS
BEGIN
   DECLARE @Var01 float, DECLARE @Var02 float, DECLARE @Var03 float

   SET @Var01 = @Num01 * 1000
   SET @Var02 = @Num02 - ((POWER(6.53 * @Var01, 0.5)) / (POWER(@Num03, 0.5)))
   SET @Var03 = (1 - 3.4680733 * LOG(@Var02) + 1.8779192 * POWER(LOG(@Var02), 2))

   INSERT INTO _myTable(Num01, Num02, Num03, Num04)
   VALUES (@Num01, @Num02, @Num03, ((@Var02 + @Var03 + @Num01) * 1000))
END

My question is, how can I test and know the result of each variable that I declared? I want to compare the result with the calculation on excel format. Just want to make sure, the result is the same.
Cheers,

A: we can use "print @var01". repeat for different variable names before or after calculation.this shows up in messages section of results.
or
we can use " select @var01 as var01,@var02 as var02,@var03 as var03" before your insert statement.this gives you a table like output during execution
you can extend the print or select with other variables as needed.

A: I could not add further comments for some reasons.
"try the calculations as separate "select" before assigning to variable"
select @Num01 * 1000 as @Var01
select @Num02 - ((POWER(6.53 * @Var01, 0.5)) / (POWER(@Num03, 0.5))) as @Var02
select (1 - 3.4680733 * LOG(@Var02) + 1.8779192 * POWER(LOG(@Var02), 2))

substitute the values that u pass to the procedure accordingly


text:
Q: mongodb shell not responding after running update query with $set I am writing a query to find and update an array in a document, but mongo shell is not responding after running the update query using $set. The array in the document is not updated, and also no response is shown for any of the commands ran after update.
My update query looks as below,
db.TestFlowSteps.update(
  {"testFlowId":"23","testRunDetail.testRunDetailId":"1"},
  {$set: {'testRunDetail.$.applicationId':'5'}})
)

This is an example document:
{
   "_id":ObjectId("58c92abd43df987ae87e1c79"),
   "testFlowId":"23",
   "testRunDetail":[

      {
         "testRunDetailId":"1",
         "testRunId":"23",
         "applicationName":"APP",
         "applicationId":"41",
         "testCaseId":"818",
         "testCaseName":"Test123",
         "browserMode":"YES",
         "index":1,
         "edit":false
      }
   ]
}


text:
Q: Getter method must return a double - how to implement DecimalFormat? I need the getter to return a double to .2 decimal spaces...
public double getPrice () {

   double totalPrice = 0.00;
   DecimalFormat deciFormat = new DecimalFormat("#.00");

...
return Double.valueOf(deciFormat.format(totalPrice));

but when I check the result in my .jsp it's still only to 1 decimal space. Any and all insight would be greatly appreciated.

A: Changed the method return type to a String.
Did a "Clean and build" and String.Format did the job!


text:
Q: Need Java Editor Written in JavaScript I am writing a an interface for a web application that requires a user to write a small blob of Java in a JavaScript text area.  I would like to know if there exists an editor written in JavaScript that can do Java syntax checking?  Google searches produce JavaScript editors but no Java Editors written in JavaScript.  (Granted, I only looked 5 pages deep)

A: Do you need syntax checking (i.e. checking if the code is valid and compilable), or just syntax highlighting (making it pretty colors)? If the latter, then search for a syntax highlighting editor, not "Java editor."
If you need actual syntax checking you'll probably need to either do that on the server side (with an Ajax call) or write a Java applet to do it in the page. Writing a Java parser in JavaScript is certainly possible, but probably beyond the practical scope of what you're trying to do.
Either way, this Wikipedia article would be a great place to start: Comparison of JavaScript-based source code editors.

A: You might get some ideas from this Wikipedia page.


text:
Q: FSharp.Core version errors during startup of an Azure worker role I have a well-established project that includes three worker roles. This project has always used F#, not in the worker roles themselves, but in the functions that they call.  I've recently added another worker role to the project but the architecture (C# worker roles calling F# code) remains the same.  Since these changes I've been getting these messages after deployment:
Could not load file or assembly 'FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

This happens during Autofac dependency resolution:
Autofac.Core.DependencyResolutionException", "exceptionMessage": "An exception was thrown while invoking the constructor 'Void .ctor(Amazon.DynamoDBv2.AmazonDynamoDBConfig

I know this is a well known issue, and the solution is generally to add some binding redirects.  I've added a redirect thus:
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />

...to every project in the solution that has an app.config, which includes all the worker roles.  I've also verified that every reference to FSharp.core uses version 4.3.1.0 and has copy local set to true.
I've also tried adding FSharp.core to the C# projects in the solution via the FSharp.Core nuget package.

A: I'm not sure why you would need a BR here as it sounds to me like this was always working and just adding a new worker role has somehow botched things up.
Without knowing your deployment process, I would suggest firstly just performing a manual package of the Cloud Service (you can do this directly from within Visual Studio or the command line using cspack). This will give you a zip file which contains all the code that will be deployed into the worker role - make sure that this contains FSharp.Core (and the correct version).
I would also suggest doing a quick diff (if you're not already done so) with what has changed since you added the new worker role in.
Lastly - watch out with the FSharp.Core Nuget package - FSharp.Core is treated differently by Visual Studio and by default won't reference the Nuget version if there's already a version of FSharp.Core referenced in the project.


text:
Q: Android - error: Default constructor not found for type error: System.MissingMethodException: 'Default constructor not found for type ProjectName.Library.IImageCropperWrapper'
getting an eror on line:
 DependencyService.Get<IImageCropperWrapper>().ShowFromFile(this, imageFile);

i already have a constructor so no idea why im getting this error.
code where error is occurring
 [assembly: Dependency(typeof(IImageCropperWrapper))]
namespace ProjectName.Library
{
   public  class ImageCropper
    {
        public static ImageCropper Current { get; set; }
        ...

        public ImageCropper()
        {
            Current = this;
        }

        public async void Show(Page page, string imageFile = null)
        {
          //take picture code
                file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
                {
                    PhotoSize = ImageSize,
                    CompressionQuality = ImageCompressionQuality,
                });
               imageFile = file.Path;

           //error here
           DependencyService.Get<IImageCropperWrapper>().ShowFromFile(this, imageFile);
        }
    }
}

below i have a interface of imagecropper class
namespace ProjectName.Library
{
    public interface IImageCropperWrapper
    {
        void ShowFromFile(ImageCropper imageCropper, string imageFile);

        byte[] GetBytes(string imageFile);
    }
}

In my View Class, I am calling ImageCropper class like
async void OnButtonClick(object sender, EventArgs e)
    {
           new ImageCropper()
                {
                    Success = (imageFile) =>
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            ImagePage1.Source = ImageSource.FromFile(imageFile);
                        });
                    }
                }.Show(this);
}


text:
Q: BoxLayout Displaying Incorrectly I'm trying to create a pretty simple application that has a JSplitPane (which is divided into a JTabbedPane and a JPanel) above a status bar panel. I want to use a simple layout (i.e. BoxLayout, FlowLayout, or BorderLayout), but I've tried and they all give me the same error. I've simplified the code as much as possible to show the error.
The error is that there should only be 2 regions in the main box layout (the frame): a top (with the JSplitPane, which has the black border) and a bottom (with the JPanel status bar). However, when I add the status bar, a third region is created in the upper left that contains nothing. Any ideas on how to get rid of it?
public static void main(String[] args) {
    JFrame frame = new JFrame("Application");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS));

    // Create left side of the application
    JTabbedPane tabby = new JTabbedPane(JTabbedPane.LEFT);

    // Create right side of the application
    JPanel rightPanel = new JPanel(new BorderLayout());

    // Create the status bar at the bottom
    JPanel statusBar = new JPanel(new BorderLayout());
    JPanel statusBarPanel = new JPanel();
    statusBarLabel = new JLabel("Status Bar");
    statusBarPanel.add(statusBarLabel);
    parent.add(statusBarPanel);

    JSplitPane mainPain = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tabby, rightPanel);
    frame.add(mainPain);
    frame.add(statusBar);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

A:
I'm trying to create a pretty simple application that has a JSplitPane (which is divided into a JTabbedPane and a JPanel) above a status bar panel.

Normally you would just use the default BorderLayout of the frame and then do:
frame.add(splitPane, BorderLayout.CENTER);
frame.add(statusBar, BorderLayout.PAGE_END);

A status bar is typically one or more labels that display information so they are display in a fixed size at the bottom.
The other panel will then contain the main components of the application. These components will then get any extra space available to the frame as it is resized.

but I've tried and they all give me the same error

parent.add(statusBarPanel);

The variable "parent" doesn't exist. Get rid of it. Add the status bar to the frame as shown above.

A: not sure if thats it, but it seems, like you add 2 Panels when adding the Statusbar.
You got a statusBarPanel which is added to "parent", and statusBar, which is added to the frame itself. Maybe thats your 3rd Panel.


text:
Q: Proof for $\bigwedge_{n=1}^\infty\bigvee_{k=n}^\infty x_k = \limsup x_n$ How I can show the truth of this relationship?
$$\bigwedge_{n=1}^\infty\bigvee_{k=n}^\infty x_k = \limsup x_n$$
The definition of $\limsup x_n$ is
$$\limsup x_n = \inf_n\left[\sup_{k\ge n}x_k\right]$$


text:
Q: c++ write all values of an array into txt file I've defined var like
typedef struct{
    float x;
    float y;
    float z;
} 3DPOINT;

then, in my code, I set an array that contains 3DPOINT
3DPOINT myArray[1280];

I properly fill this array and now I need to write each position into txt file.
std::ofstream fs("c:\\testvalues.txt");

for (int i=0;i<1280;i++)
    {
        //here I must get array position data and convert it to string
        fs<<myArrayPositionToString<<"\x0D\x0A";
    }

    fs.close();

A: This looks like a homework problem, but the << operator of fstream does the conversion for you.
fs<<myArray[i].x<<"\t"<<myArray[i].y<<"\t"<<myArray[i].z<<endl;

The "\t"-s are tabs, you can also use simple spaces if you'd like.

A: If you want to use operator<< on your struct, you will have to define an operator<< function for your structure.
Search StackOverflow for "overloading insertion operator ostream".
Also search the web for "C++ FAQ operator overloading <<".


text:
Q: What is the best estimation for the following? Let $f$ be 1-periodic and $f\in L_{p}[0,1]$ where $p>1.$  Let  $D_{n}$ $n=0,1,2,..$ be the dyadic partition of $[0,1].$ Consider
$$
F_{n}(x)=\frac{1}{|I^{n}_{j}|}\int_{I^{n}_{j}}f(t)dt, \,\,\,\,x\in I^{n}_{j}\in D_{n}.
$$
Q. What is the best estimate (depending on $n$) for the following?
$$\|f-F_{n}\|_{L_{p}[0,1]}\leq?$$


text:
Q: record video with AVFoundation with custom dimensions? I am recording an MOV file using AVFoundation but im having trouble finding out how to change the dimensions of the video. I have videoGravity property of captureVideoPreviewLayer set to AVLayerVideoGravityResizeAspectFill and the UIView showing the preview layer has custom dimensions (not the same aspect ratio of the screen).
Recording works fine but the dimensions of the recorded video are the same as the aspect ratio of the screen. How can i record with the aspect ratio of the UIView or the preview layer?

A: Here is best sample code to record video using AVFoundation
https://developer.apple.com/library/ios/#samplecode/RosyWriter/Introduction/Intro.html#//apple_ref/doc/uid/DTS40011110
In File: RosyWriterVideoProcessor.m
Method Name
- (BOOL) setupAssetWriterVideoInput:(CMFormatDescriptionRef)currentFormatDescription

In videoCompressionSettings you can change dimension, hope this will help you.


text:
Q: Why I only get the value of the last row in my table when I click the 'AddToCart' in other row I have this code in php

        <form method="POST" action="addtocart.php">

                Items
                Price(PhP)
                Quantity
                Action

                <?php
                $item=mysqli_query($conn,"select * from store");
                while($pqrow=mysqli_fetch_array($item)){
                    $iid=$pqrow['id_item'];

                ?>

                    <?php echo $pqrow['item']; ?>
                <input type="hidden" name="price" value="<?php echo $pqrow['price']; ?>"><?php echo $pqrow['price']; ?>
                <input type="number" style="width: 70px;" name="qty" value="1">
                <input type="hidden" name="item" value="<?php echo $iid; ?>"><input class="btn btn-success btn-md" type="submit" name="addtocart" value="AddToCart<?php echo $iid; ?>">

<?php } ?>

</form>

When I click AddToCart in first row, the value of the last row has been fetch. I want to get the id and the input quantity when I click the AddToCart in 1st row.

A: As you have only one form tag and multiple inputs with same name on this form, value of next input overwrites previous one. As a result you always have value of the last row.
You can fix it for example with creating a separate form for every row, e.g:

            Items
            Price(PhP)
            Quantity
            Action

    <?php
        $item = mysqli_query($conn,"select * from store");
        while ($pqrow=mysqli_fetch_array($item)) {
            $iid=$pqrow['id_item'];?>

                <?php echo $pqrow['item']; ?>
            <?php echo $pqrow['price']; ?>
            <input type="number" style="width: 70px;" name="qty" value="1">

                <form method="POST" action="addtocart.php">
                    <input type="hidden" name="price" value="<?php echo $pqrow['price']; ?>">
                    <input type="hidden" name="item" value="<?php echo $iid; ?>">
                    <input class="btn btn-success btn-md" type="submit" name="addtocart" value="AddToCart<?php echo $iid; ?>">
                </form>

        <?php } ?>

In this case you should track with javascript the value of quantity field. Of course, you can move <input type="number"> in a form too, but this will break your markup.
Also, if you're familiar with javascript, you can add some client preprocessing (getting values from inputs of a certain row) and use ajax-request to send these values to server.


text:
Q: jQuery Chosen - get (multiple) selected labels (not the value) How to get the selected option's text from the Chosen select?
So not just the .val() but the option label/text

A: $("#objId option :selected").text();

Above jQuery statement should do it for.

A: //Below code return name of the drop downn
$('#availableRevisionBatch option:selected').text()

//Below code return value of the drop downn
$('#availableRevisionBatch option:selected').val()

A: The only way that work for me, was doing something like this:
var options = $("#ddl option:selected");

var values = $.map(options, function (option) {
    return option.text;
});

Where values is an array.
Hope that it helps...

A: You can check this for single select.
<select class="chzn-select" id="CHSNID" onchange="alert($('#CHSNID_chzn a span').text())">

Or
$(function(){
     $('#CHSNID').change(function(){
     var text = $('#CHSNID_chzn a span').text();
     console.log(text);
   });
});

A: You can simply use this to get the label.
$('.result-selected').html()

or
$('.options option:selected').html()

A: Used:
    $("#list option[value='"+id+"']").text();
To retrieve the label of the selected value

A: To get text values for multiple select:
<select id="sTags" class="chosen" multiple />

Jquery:
    $.map($("#sTags_chosen").find(".search-choice span"), function (option) {
        return $(option).text()
    });

A: none of the above answers worked for me and so after searching a lot finally got the answer to retrieve the "label" value of the selected element
$("#your_select_id option:selected").attr('label');

A: The below will get the label & here is a JSFiddle showing how to get the chosen dropdown's value or label field using the latest chosen jquery plug-in version 1.4.2. https://jsfiddle.net/hayoeu/4usazfdm/2/
$(".chzn-select option:selected").text();


text:
Q: reactjs make https (not http) requests with axios I'm trying to make https requests to the server using axios. Most of the tutorials regarding axios specify how to make http requests.
I make the requests whenever users login. Here is my current request:
axios.post('/api/login/authentication', {
  email: email,
  password: password
})
.then(response => {
  this.props.history.push('/MainPage')
})
.catch(error => {
  console.log(error)
})

Can anyone help me convert this to an https request?

A: All URLs have two parts

*

*Domain - http://yourdomain.com

*Path - /path-to-your-endpoint
1. Use default domain
In axios, if you specify just the path, it will use the domain in the address bar by default.
For example, the code below will make a call to whatever domain is in your address bar and append this path to it. If the domain is http, your api request will be a http call and if the domain is https, the api request will be a https call. Usually localhost is http and you will be making http calls in localhost.
axios.post('/api/login/authentication', {

2. Specify full URL with domain
On the other hand, you can pass full URL to axios request and you will be making https calls by default.
axios.post('https://yourdomain.com/api/login/authentication', {

2. Use axios baseURL option
You can also set baseURL in axios
axios({
  method: 'post',
  baseURL: 'https://yourdomain.com/api/',
  url: '/login/authentication',
  data: {
    email: email,
    password: password
  }
}).then(response => {
  this.props.history.push('/MainPage')
})
.catch(error => {
  console.log(error)
});


text:
Q: $G=HK$ then the index of a subgroup is determined by $H$ and $K$ Let $G=HK$ s.t. $H\cap K=1$ and let $R$ be a any subgroup of $G$.
I wonder necessary and suffucient condition for the equality,
$$|G:R|=|H:H\cap R||K:K\cap R|$$
Note that if $H$ and $K$ are normal and $(|H|,|K|)=1$ then above equality is true, which can be proven easily.

A: Suppose that $G=HK$ with $H \cap K=1$. Then (assuming $G$ is finite), the conclusion holds for all subgroups $R$ if and only if $H,K \unlhd G$ and $(|H|,|K|)=1$.
You can do the "if" part. For the "only if" part, if $H \not\unlhd G$, then there exists $k \in K \setminus N_G(H)$, and the conclusion fails for $R = k^{-1}Hk$. Similarly if $K \not\unlhd G$.
If $H,K \unlhd G$ (so $G \cong H \times K$), but $(|H|,|K|) \ne 1$, then there is a prime $p$ dividing both $|H|$ aand $|K|$, and the conclusion fails for $R = \langle hk\rangle$, where $h \in H$ and $k \in K$ both have order $p$.


text:
Q: Can I use the first OR last 16 characters of a Guid and it still be unique? Objective
Generate a unique 16-character key, to use as a batch name, that doesn't require any type of storage (e.g. a unique counter).
Background
I have a Windows service that runs every 30 seconds. I picks up messages off of an MQ and processes them in a batch. One of the service calls I'm making is requiring a 16-character batch name now. They don't care what the batch name is, it just needs to be unique across all batches.
Question
If I generate a Guid, can I use the first or last 16 characters of that string and it still be unique for my needs?

A: No.
Raymond Chen explains why in great detail in GUIDs are globally unique, but substrings of GUIDs aren't.
However, if you are running this on a single machine, then you don't need your ID to be globally unique - merely locally unique. Therefore, you can drop the MAC address requirement from the GUID algorithm he describes. Also, if you know that only one will be generated every 30 seconds, you can drop the collision part of the algorithm. This pretty much leaves you using the date-time as qujck suggests.

A: No is the simple answer. Why not use the date/time?
For example, here's some Oracle generated GUIDs
D71CDF38BB3B6026E0430A9A9A286026
D71CDF38BB3C6026E0430A9A9A286026
D71CDF38BB3D6026E0430A9A9A286026
D71CDF38BB3E6026E0430A9A9A286026
D71CDF38BB3F6026E0430A9A9A286026
D71CDF38BB406026E0430A9A9A286026


text:
Q: jQuery UI: draggable "resets" loop variable? I'm working on a page that has a number of draggable "nodes" on it, each with a numeric ID. I create these based on some server-side data I get:
for(var nodeid in data) { // data fetched by AJAX request

    // makeHTML generates an HTML snippet with ID #node-{nodeid}
    $("body").append(makeHTML(nodeid));

    // make nodes draggable, calling node action on stop
    $("#node-" + nodeid).draggable({
        stop: function(event, ui) {
            performAction(nodeid);
        }
    });
}

The objects all appear on the page and are labeled/given IDs as I expect, but whenever I drag something, it always calls performAction() with the last ID in the loop, rather than the ID associated with the dragged object.
Is there a reason nodeid isn't being passed to performAction() properly? Do I need to declare something about the loop differently?


text:
Q: Nested type problem I just tried to create this simple implementation:
class Test
{
   private int abc = 0;

   public class TestClass
   {
      private void changeABC()
      {
         abc = 123;
      }
   }
}

If I compile it, it will complain:

Cannot access a non-static member of outer type 'A.Test' via nested type 'B.Test.TestClass'

I dont like the solution of setting: static int abc = 0;
Is there any other solution for this?

A: The inner class needs a reference to an instance of the outer class:
class Test
{
   private int abc = 0;

   public class TestClass
   {
      private void changeABC(Test test)
      {
         test.abc = 123;
      }
   }
}

A: You are probably coming from a Java background where this code would work as expected.
In C#, nested types are static (in the parlance of Java), i.e. they are not bound to an instance of the parent class. This is why your code fails. You need to somehow pass an instance of the parent class to the child class and access its member abc.

A: I don't see why TestClass should change the parent Test when its an instance class.
Maybe me example would shed light on this:
class Test
{
   public Test()
   {
     TestClass test = new TestClass();//create a new **instance** here
     test.changeABC(this);//give the instance of Test to TestClass
     Console.WriteLine(abc);//will print 123
   }
   int abc = 0;

   public class TestClass
   {
      public void changeABC(Test t)
      {
         t.abc = 123;
      }
   }
}

Use Like this:
Test theTest = new Test();

A: From C# nested classes are like C++ nested classes, not Java inner classes

When you declare a class inside
  another class, the inner class still
  acts like a regular class. The nesting
  controls access and visibility, but
  not behavior. In other words, all the
  rules you learned about regular
  classes also apply to nested classes.
In Java, the inner class has a secret
  this$0 member which remembers the
  instance of the outer class to which
  it was bound.
In other words, Java inner classes are
  syntactic sugar that is not available
  to C#. In C#, you have to do it
  manually.


text:
Q: Best way to upload files by client to remote server? I have two servers.
The first (Main) is the server which has installed the script and database.
The second (Remote) is the server which has uploaded files only (just for storage).
Now I'm confused about how to upload the files, and I have 2 ideas to do that, and I don't know if them the best ways or not.
The ideas:

*

*Upload the file by ajax to the main server first and make all security
operations like (check size, type, and so on), then upload
again to the second server (remote server).

*Upload the file by ajax to the second (remote server) directly,
and make all checks and security operations in there, then send the file information to the first server (main) to store the file information into database (Not recommended).

I want to know how behave the big upload sites in store the files that uploaded by users, the idea of how can they upload the files to remote servers ?

A: Both mechanisms are valid. In fact we tried both of them in two of our products. Each of them comes with their pros and cons.
Assumption: Main server serves the Web UI.
Lets have the two servers named main.com and remote.com.
The main factors that you need to consider are:

*

*Cross-Origin Resource Sharing (CORS): The most straightforward way to check whether this is a big issue is whether you need to support IE <= 9. Legacy IE does not support XHR2 so AJAX file upload is not possible. There are popular fallbacks (e.g. iframe transport) but each comes with their own problems.

*Bandwidth: If file is uploaded to main.com first then to remote.com, then the required bandwidth is doubled. Depending whether your servers are behind load-balancers, the requirement will vary. Uploading directly to remote.com uses bandwidth efficiently.

*API response time: Unless your API is doing optimistic update, it needs to wait until the file is fully reuploaded to remote.com before it can respond reliably. Also, this depends on the RTT between main.com and remote.com.

*Number of API domain: This is a small issue. Web client has to specify which domain to use for which API. However it does relate to CORS issue above.

*Performance: If web server is handling file upload, it might have issue with performance when the server is processing large files (or large quantities of file). It might affect other users.
Mechanisms
1. Client uploads to main.com. main.com re-uploads to remote.com

*

*CORS: No issue

*Bandwidth: Double

*Response time: Double (round trip); normal (optimistic)

*API domain: One

*Performance: Might affects web services

2. Client uploads to remote.com. remote.com sends info to main.com

*

*CORS: Have issue

*Bandwidth: Efficient

*Response time: Efficient

*API domain: Two

*Performance: No issue

3. [EXTRA] Client uploads to main.com. main.com streams the file to remote.com. remote.com sends file information back.

*

*CORS: No issue

*Bandwidth: Double

*Response time: Less than double (streamed)

*API domain: One

*Performance: Better than method 1 for its better memory footprint

Conclusion
Depending on your use case, you need to use different mechanism. For our case, we use method 2 (direct upload) for our legacy product because we need to support legacy browsers (IE 7, FF 3). Cross domain issues are stabbing us all the time for many different cases (e.g. when customers are behind proxies, etc.).
We use method 1 for our new product. Bandwidth and response time issues are still okay for normal cases, but when web server and remote server are deployed across continental, the performance is inferior. We have made many optimizations to make it acceptable but it is still worse than method 2.
Method 3 is used by myself in a side project. It is included here because I think it is a good candidate too.
Edit
The difference of streaming (method 3) and re-uploading (method 1) is mainly how the file is stored in main.com. This impacts resource allocation.
For re-uploading, an uploaded 2GB file is first stored in main.com, then re-uploaded to remote.com. main.com has to allocate resources to temporarily store the file (disk space, memory, CPU for IO). Also, being a serial process, the total time needed to complete the upload to remote.com is doubled (assuming time to upload to main.com equals to time to upload to remote.com).
For streaming, a file being uploaded to main.com is simultaneously uploaded to remote.com. Since main.com uploads a chunk of the file to remote.com as soon as it received the chunk, the upload processes are overlapped, resulting in shorter upload time (less than double). In another words, if there is no processing needed at main.com, main.com is effectively a proxy to remote.com. Also, since the file is not stored as a whole on main.com (chunks are normally stored in memory), it does not consume that much resources than re-uploading. However, if main.com needs to process the file as a whole, then streaming does not bring much benefits.


text:
Q: Unable to create User I use the ASP.NET Membership class to create user credentials and manage user settings. The code is as below: it's working fine in my local machine but it throws an exception on the production server..  What could be the reason? Can give me a clue? Anyone?

try
{
    MembershipUser newUser =
        Membership.CreateUser(txtUserName.Text, txtPassword.Text);
}
catch (MembershipCreateUserException ex)
{
    divErrorPanel1.Visible = true;
    ShowErrorMessage(lblMessage, GetErrorMessage(ex.StatusCode));
    return;
}

A: Check the MembershipCreateUserException.StatusCode property for explaning the exception.

Gets a description of the reason for the exception.

These are possibilities.

*

*"Username already exists. Please enter a different user name.";

*"A username for that e-mail address already exists. Please enter a different e-mail address.";

*"The password provided is invalid. Please enter a valid password value.";

*"The e-mail address provided is invalid. Please check the value and try again.";

*"The password retrieval answer provided is invalid. Please check the value and try again.";

*"The password retrieval question provided is invalid. Please check the value and try again.";

*"The user name provided is invalid. Please check the value and try again.";

*"The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your
  system administrator.";

*"The user creation request has been canceled. Please verify your entry and try again. If the problem persists, please contact your
  system administrator.";

*"An unknown error occurred. Please verify your entry and try again. If the problem persists, please contact your system administrator.";

A: Try the overloaded method
MembershipCreateStatus status;
MembershipUser newuser = Membership.CreateUser(username, password, email,
   "Give default question as empty", "Give default answer as empty", IsApprovedTrueOrFalse, out status);

The current overload you are using never worked for me too. I don't know why so I was forced to use this overload. May be related to some settings in the web.config whether to make some fields required.

A: in your web.config, try setting the following property to false
requiresQuestionAndAnswer="false"

in  node


text:
Q: Deleting the last record instead of selected one and how can I add edit function to it I'm fetching data from database table into page when I'm trying to delete a particular record instead its deleting the last record in table.
This is fetchtable.php. How can i add edit functionality in it? Please if possible give a detailed answer:
<?php
require 'conn.php';
$tfetch = "select ID,firstname,lastname,gender,email, password from signup";
if ($stmt = mysqli_prepare ($conn,$tfetch))
{
    mysqli_stmt_execute ($stmt);
    mysqli_stmt_bind_result ($stmt, $id, $fn, $ln, $gen, $email, $pass );
    mysqli_stmt_store_result ($stmt);

}
mysqli_close ($conn);
?>

And this is the page in which I'm fetching:
<?php
include'fetchtable.php';
if(isset($_POST['del']))
{
    require 'conn.php';
    $id=$_POST['del_id'];
    $stmt = "DELETE FROM signup WHERE ID =$id";
    mysqli_query($conn,$stmt);
    mysqli_execute($stmt);
    $row=mysqli_affected_rows($conn);
    if($row==1)
    {
        echo " sucess ! record was deleted ";
    }
    else
    {
        echo " record was not deleted ";
    }
    mysqli_close($conn);
}
?>

<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post">
    <?php
    echo "<table border='1' cellpadding='2' cellspacing='2'";
    echo "
ID	First Name	Last Name	Gender	Email	Password	Delete	";
    while (mysqli_stmt_fetch($stmt))
    {
        echo"
";
        echo "".$id."	";
        echo "". "$fn" ."	";
        echo "". "$ln" ."	";
        echo "". "$gen"."	";
        echo "". "$email"."	";
        echo "". "$pass" ."	";
        echo ' <input type="hidden" name="del_id" value="'.$id.'" /> <input type="submit" name="del" value="delete" /> 	';
        echo"
";
    }
    ?>
</form>

EDIT : Found solution just include the while loop in form rather than including while within a form

A: It's deleting the last record b/c you variable $id is same in both fetch and delete.
$delete_id = $_POST['del_id'];
$del_stmt = "DELETE FROM signup WHERE ID =$delete_id";
mysqli_query($conn,$del_stmt);
mysqli_execute($del_stmt);


text:
Q: Returning multiple lists in C# I'm using a custom class to store information about files found in a directory based upon a regex, and I need to return these filelists from a method. Here's some psuedocode of how it's currently working:
class FileList {
//propertes of the file here, such as regex name, source folder and whether it needs to be deleted after copying
}

..
..

foreach (file in directory that matches regex)
{
    new filelist
    //Set all the properties
}

return allfilelists;

But how do I return the all the lists, or is there a better way of doing this?
Thanks

A: Why not return a list of FileLists?
var allfilelists = new List<FileList >();
foreach (file in directory that matches regex)
{
    new filelist
    //Set all the properties
    allfilelists.Add(fileList);
}

A: Any reason not to return a List<FileList> or something similar? (There's a choice of abstraction here - you could declare that the method returns IEnumerable<FileList>, IList<FileList>, List<FileList> etc.)

A: Alternatively you can return IEnumerable<FileList> on the method and use the yield keyword to use deferred execution and eliminate the overhead of the List object (as little as it is).

A: You can use List<FileList> or FileList[].


text:
Q: how can read column data from gridview readonly column I am trying to read the column value of gridview read only column.but it makes error as
Specified argument was out of the range of valid values the following is my code in rowupdate event in asp.net gridview
 protected void branchgrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            comp.ADMISSIONNUMBER = Convert.ToInt32((TextBox)studacgrid.Rows[e.RowIndex].FindControl("AdmissionNumber"));
        //comp.ADMISSIONNUMBER = Convert.ToInt32(studacgrid.Rows[e.RowIndex].Cells[1]
        comp.MEDIUM =Convert.ToString ((TextBox)studacgrid.Rows[e.RowIndex].FindControl("Medium"));
        comp.CLASSNAME =Convert.ToString ((TextBox)studacgrid.Rows[e.RowIndex].FindControl("Class"));
        comp.ACADAMICYEAR = Convert.ToString((TextBox)studacgrid.Rows[e.RowIndex].FindControl("Academicyear"));
        comp.SECTIONNAME = Convert.ToChar(((TextBox)studacgrid.Rows[e.RowIndex].Cells[7].Controls[0]).Text.ToString());

       }


text:
Q: How to deploy an API that uses Sucrase with Heroku I'm using Sucrase to not use the CommonJS syntax of import. So to do that, I have installed the sucrase dependency and the Nodemon configure is set to register sucrase after Node runs every file.
That my Nodemon config:
{
  "execMap": {
    "js": "node -r sucrase/register"
  }
}

But the problem is that it just runs on development and I'm not finding a solution to run the app with the Procfile
web: node ./src/server.js & node ./src/queue.js

Heroku error logs:
2019-11-10T01:59:01.073862+00:00 app[web.1]: import Bee from 'beequeue';
2019-11-10T01:59:01.073864+00:00 app[web.1]: ^^^^^^
2019-11-10T01:59:01.073866+00:00 app[web.1]:
2019-11-10T01:59:01.073867+00:00 app[web.1]: SyntaxError: Cannot use import statement outside a module

A: Sucrase's just for development, and behind the scenes it needs to convert the imports to the common js sintax. So to deploy your app, you can first run the build command provided in the Sucrase Docs, and then change the command of your procfile.
To generate the build, run this command:
 sucrase ./src -d /build --transforms javascript,imports

If you're using Typescript:
 sucrase ./src -d /build --transforms typescript,imports

and then, in your procfile:
web: node ./build/server.js & node ./build/queue.js

*

*But is not recommended to deploy on heroku because of the dyno, you can work with these builds in your server and a ci service like travis ci, circle ci or buddy that has a nice interface and you don't to do a lot of configurations.


text:
Q: how can we differentiate the image filter effects? How can we differentiate the image filter effects? on what basis we can check the image filters like based on color matrix or pixels?Actually iam developing the image filter library in java so i want to know the difference between each image filters. ex vintage effect, Polaroid effect,sepia effect..etc.
Try to help me.
Thaks in advance

A: The article Image processing with Java 2D offers an accessible introduction to several common techniques, including convolution, lookup tables and thresholding.

A: If you mean literal categorization of image filters, I find out this web link gives some good categories:
http://www.jhlabs.com/ip/filters/index.html


text:
Q: Store shop opening times This is more of an app design question so forgive me if it's not relevant.
The app I am working on is designed to show what shops are open in the area and I am not sure what is the best way to store this information. I get the information from a database (I didn't design) that supplies an array of boolean values that determine if the shop is open during that time or not. Each boolean value represents a 15 minute slot e.g. 07:00-07:15.
This is split down into days but not specific dates, for instance the shop could be open Mon-Fri 09:00-17:00 but Sat 09:00-20:00 so the model I keep will have to know what the day is but not necessarily the date.
What I'm not sure about is how to store all of this for ease/speed of lookup because I want the view to be able to update in real time (shops change from open to closed without refresh). I have considered adding a table to the DB that contains opening times for any shop (using proper times and days) and then let SQLite do all the hard work allowing the Java to assume the shop is closed unless it gets a record back but that feels a little clunky because it might be better to hold the opening times in memory somehow.
Any help you can give would be awesome.

A: I assume your DB looks like this:
("Bob's Bakery", [0,0,1,1,1,1, ... ])
("Aunt McGee's Gun-O-Rama", [0,0,0,0,1,1, ... ])
....

In my example above I define that the bit-array starts at 07:00 AM. The "..." express my lazyness to continue until 12:00 PM :)
You could populate a hash map with that data, so you end up with a mapping of "start-of-15-min-slot" to "open shop". something like this (simple pseudo code to visualize my idea):
openShops = {
   ("07:30",{"Bob's Bakery"}),
   ("07:45",{"Bob's Bakery"}),
   ("08:00",{"Bob's Bakery","Aunt McGee's Gun-O-Rama"}),
   ("08:15",{"Bob's Bakery","Aunt McGee's Gun-O-Rama"}),
   ...
}

This way you only have to calculate the beginning of the current 15 min slot and perform one look-up. Let's says you want to open shops for 08:02, then you just have to divide the minutes by 15 (without remainder) and use the result as the value for the minutes in the query:
2 div 15 = 0 → 08:00 → openShops.get("08:00") → ("Bob's Bakery","Aunt McGee's Gun-O-Rama")

A: I will ignore the database side, as you claim to be getting an array of boolean primitive values from the array.
Enum, EnumSet, EnumMap
On the Java side, you can use the surprisingly powerful enum facility in Java along with an EnumSet.
Define an enum for all the time slots. I'll include only a few for brevity. I add a displayName for a prettier label for each enum item.
enum QuarterHour {
    T_0700_0715, T_0715_0730, T_0730_0745, T_0745_0800;

    public String displayName;
    public LocalTime start, stop;

    private QuarterHour () {
        // Soft-code the members of each enum item by parsing its name.
        this.displayName = this.name ().replace ( "T_" , "" ).replace ( "_" , "-" );
        String[] tokens = this.displayName.split ( "-" ); // Extract the start and stop times from the left and right parts of this string.
        String t1 = tokens[ 0 ].substring ( 0 , 2 ) + ":" + tokens[ 0 ].substring ( 2 );
        String t2 = tokens[ 1 ].substring ( 0 , 2 ) + ":" + tokens[ 1 ].substring ( 2 );
        this.start = LocalTime.parse ( t1 );
        this.stop = LocalTime.parse ( t2 );
        System.out.println ( "Debug construction of each QuarterHour enum item: " + this.name () + " with displayName: " + this.displayName + " from " + this.start + " to " + this.stop );
    }

}

Java offers the very fast and very small EnumSet and EnumMap classes to collect Enum instances. Each is respectively an implementation of Set and Map like any other implementation. What is special is that because they are dedicated to Enum instances, they can be highly optimized by using bitmaps internally. So they use very little memory and execute extremely quickly.
Ignoring your boolean array for a moment, here is some example code showing how to use the EnumSet and EnumMap.
DayOfWeek
Our map uses the built-in DayOfWeek enum that represents each of the seven days of the week, Monday-Sunday.
java.time
The DayOfWeek enum is part of the java.time framework built into Java 8 and later. These classes supplant the old troublesome date-time classes such as java.util.Date. See Oracle Tutorial. Much of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport and further adapted to Android in ThreeTenABP.
Example code
In this example I have the weekdays opening the full hour 07:00 to 08:00 (four quarter-hours) and the weekend opening a half-hour later 07:30 to 08:00 (two quarter-hours).
EnumMap<DayOfWeek , EnumSet<QuarterHour>> days = new EnumMap<> ( DayOfWeek.class );
EnumSet quarterHoursWhenOpen = EnumSet.of ( QuarterHour.T_0700_0715 , QuarterHour.T_0715_0730 , QuarterHour.T_0730_0745 , QuarterHour.T_0745_0800 );
EnumSet quarterHoursWhenOpen2 = EnumSet.of ( QuarterHour.T_0730_0745 , QuarterHour.T_0745_0800 );

days.put ( DayOfWeek.MONDAY , quarterHoursWhenOpen );
days.put ( DayOfWeek.TUESDAY , quarterHoursWhenOpen );
days.put ( DayOfWeek.WEDNESDAY , quarterHoursWhenOpen );
days.put ( DayOfWeek.THURSDAY , quarterHoursWhenOpen );
days.put ( DayOfWeek.FRIDAY , quarterHoursWhenOpen );
days.put ( DayOfWeek.SATURDAY , quarterHoursWhenOpen2 );
days.put ( DayOfWeek.SUNDAY , quarterHoursWhenOpen2 );

Dump to console. By default the toString method being implicitly called on our QuarterHours enum by default uses the name of the element. For presentation to your users you would call the displayName method I defined rather than call the built-in toString. That toString method is defined as being intended for "programmer-friendly" string values rather than user-oriented presentation strings.
System.out.println ( "days: " + days );

days: {MONDAY=[T_0700_0715, T_0715_0730, T_0730_0745, T_0745_0800], TUESDAY=[T_0700_0715, T_0715_0730, T_0730_0745, T_0745_0800], WEDNESDAY=[T_0700_0715, T_0715_0730, T_0730_0745, T_0745_0800], THURSDAY=[T_0700_0715, T_0715_0730, T_0730_0745, T_0745_0800], FRIDAY=[T_0700_0715, T_0715_0730, T_0730_0745, T_0745_0800], SATURDAY=[T_0730_0745, T_0745_0800], SUNDAY=[T_0730_0745, T_0745_0800]}

By the way, this naming of start-stop times follows the common approach in handling spans of time called "Half-Open" where the start is inclusive while the ending is exclusive.
Conversion
All we have left to do is convert back-and-forth to/from EnumSet QuarterHours and boolean array. For more information, see my Question: Convert between EnumSet and array of boolean values. Here I use the simple for loop approach, but look at the other answers for the more compact Lambda & streams syntax available in Java 8 and later.
The following code calls the values method on an enum. This method is annoyingly not documented on the Enum class because the method is synthetically created by the compiler for tricky internal technicalities as discussed in this Question. The upshot is that the method returns an array of all the items in the enum.
Caveat: All this code is untested, only run this once. Use at your own risk.
From EnumSet to array
// From EnumSet to array of boolean primitives.
QuarterHour[] quarterHoursOfDay = QuarterHour.values ();
boolean[] quarterHoursIfOpen = new boolean[ quarterHoursOfDay.length ];
EnumSet<QuarterHour> enumSet = days.get ( DayOfWeek.SATURDAY );
for ( int i = 0 ; i < quarterHoursOfDay.length ; i ++ ) {
    quarterHoursIfOpen[ i ] = enumSet.contains ( quarterHoursOfDay[ i ] );
}

Dump to console.
System.out.println ( "For " + DayOfWeek.SATURDAY + " array quarterHoursIfOpen: " + Arrays.toString ( quarterHoursIfOpen ) );

For SATURDAY array quarterHoursIfOpen: [false, false, true, true]

From array to EnumSet
Going the other direction, from the array of boolean quarterHoursIfOpen above to a fresh EnumSet named enumSet2 below.
// From array of boolean to EnumSet.
EnumSet<QuarterHour> enumSet2 = EnumSet.noneOf ( QuarterHour.class );
QuarterHour[] quarterHoursOfDay2 = QuarterHour.values ();
for ( int i = 0 ; i < quarterHoursOfDay2.length ; i ++ ) {
    boolean isOpen = quarterHoursIfOpen[ i ];
    if ( isOpen ) {
        enumSet2.add ( quarterHoursOfDay[ i ] );
    }
}

Dump to console.
System.out.println ( "enumSet2: " + enumSet2 );

enumSet2: [T_0730_0745, T_0745_0800]

Generate source code
Here is some source code to generate source code to name all 24-hours worth of quarter hour enum names.
StringBuilder enums = new StringBuilder ();
LocalTime start = LocalTime.MIN;
for ( int i = 0 ; i < ( 24 * 4 ) ; i ++ ) {
    if ( enums.length () > 0 ) {
        enums.append ( " , " );
    }
    LocalTime stop = start.plusMinutes ( 15 );
    String name = "T_" + start.toString () + "_" + stop.toString ();
    name = name.replaceAll ( ":" , "" );
    enums.append ( name );
    // Setup next loop
    start = stop;
}
System.out.println ( "enums: " + enums );

enums: T_0000_0015 , T_0015_0030 , T_0030_0045 , T_0045_0100 , T_0100_0115 , T_0115_0130 , T_0130_0145 , T_0145_0200 , T_0200_0215 , T_0215_0230 , T_0230_0245 , T_0245_0300 , T_0300_0315 , T_0315_0330 , T_0330_0345 , T_0345_0400 , T_0400_0415 , T_0415_0430 , T_0430_0445 , T_0445_0500 , T_0500_0515 , T_0515_0530 , T_0530_0545 , T_0545_0600 , T_0600_0615 , T_0615_0630 , T_0630_0645 , T_0645_0700 , T_0700_0715 , T_0715_0730 , T_0730_0745 , T_0745_0800 , T_0800_0815 , T_0815_0830 , T_0830_0845 , T_0845_0900 , T_0900_0915 , T_0915_0930 , T_0930_0945 , T_0945_1000 , T_1000_1015 , T_1015_1030 , T_1030_1045 , T_1045_1100 , T_1100_1115 , T_1115_1130 , T_1130_1145 , T_1145_1200 , T_1200_1215 , T_1215_1230 , T_1230_1245 , T_1245_1300 , T_1300_1315 , T_1315_1330 , T_1330_1345 , T_1345_1400 , T_1400_1415 , T_1415_1430 , T_1430_1445 , T_1445_1500 , T_1500_1515 , T_1515_1530 , T_1530_1545 , T_1545_1600 , T_1600_1615 , T_1615_1630 , T_1630_1645 , T_1645_1700 , T_1700_1715 , T_1715_1730 , T_1730_1745 , T_1745_1800 , T_1800_1815 , T_1815_1830 , T_1830_1845 , T_1845_1900 , T_1900_1915 , T_1915_1930 , T_1930_1945 , T_1945_2000 , T_2000_2015 , T_2015_2030 , T_2030_2045 , T_2045_2100 , T_2100_2115 , T_2115_2130 , T_2130_2145 , T_2145_2200 , T_2200_2215 , T_2215_2230 , T_2230_2245 , T_2245_2300 , T_2300_2315 , T_2315_2330 , T_2330_2345 , T_2345_0000


text:
Q: Why is my Ctrl-key disabled in iTerm.app? I'm trying to use the new iTerm app on my Snow Leopard Mac, but my Ctrl seems to be completely dead (as in non-responsive, as in nothing happens when I type Ctrl+a except for an outputed 'a') and I haven't found anything useful while googling. The closest match was this thread here on stackoverflow, but everything in Terminal.app works as it should.
And, even more strange - I can Ctrl+z myself out of applications, but I can't save files in Emacs (C-x C-s) or any other keyboard shortcuts that uses a Ctrl shortcut. And it's not local, since Ctrl is as broken on my iMac as it is on other unix computers I've sshed onto with iTerm. I've tried both in bash and zsh.
I've tried to remove all files concerning iTerm.app in my ~/Library/Application Support, and I've tried the very latest version (currently 13 h old) of iTerm I could lay my hands on, but to no avail.
Any ideas?

A: This seems to be an iTerm bug.
You can work around it by creating a key mapping in the profile settings.
Add a mapping for ^x so it sends 0x18 (which is the encoded form of ctrl+x).

A: I suggest to check this post to see if the ctrl key is enabled in your preferences
https://apple.stackexchange.com/questions/52041/how-to-press-control-key-on-mac
Did you try to configure key bindings for this terminal emulator as specified in the iTerm wiki:
http://code.google.com/p/iterm2/wiki/Keybindings
at last, have you try set -o emacs or set -o vi?
If it works, set it in your ~/.bashrc to run it at login.


text:
Q: Why is this Json.Net conversion from XML and JSON not working? You can enter either of these URLs into a browser and verify that they return valid xml:
http://maps.googleapis.com/maps/api/geocode/xml?`address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false"

...or json:
http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false%22

...but when attempting to get the xml programmatically using this code (after installing Json.NET via NuGet into my project and dropping a dataGridView on my Windows form):
dataGridView1.DataSource = GetLocationData("http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false");

private JArray GetLocationData(string uri)
{
    var webRequest = (HttpWebRequest)WebRequest.Create(uri);
    var webResponse = (HttpWebResponse)webRequest.GetResponse();
    var reader = new StreamReader(webResponse.GetResponseStream());
    string s = reader.ReadToEnd();
    return JsonConvert.DeserializeObject<JArray>(s);
}

...I get:
Newtonsoft.Json.JsonReaderException was unhandled
  _message=Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
I thought, okay, this actually is json code, not xml, so I replaced "xml" with "json" in the URL, expecting more joy in Mudville.
However, when attempting to get the same data as json, I also get an exception, namely, "System.InvalidCastException was unhandled  _message=Unable to cast object of type 'Newtonsoft.Json.Linq.JObject' to type 'Newtonsoft.Json.Linq.JArray'."
Why, and how can I fix it? Is it possible to also grab the data as xml?

A: Using the json URL is correct. Your problem is that the JSON response is not giving you an array which is your error.
Notice that the response you get back is an object denoted by the {
{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "1600",
               "short_name" : "1600",
               "types" : [ "street_number" ]
            },
    ....

If it was an array, you would get back [ instead. You should use JObject or a custom model instead of JArray. The results element is what contains the actual array that you will need to loop through.
Pseudo for the result you are actually getting in the response:
object
{
    Result[] results;
    string status;
}

You can also grab the XML version if you want, but then you need to actually have an object model defined to match and use the XmlSerializer to deserialize it or load it into an XmlDocument (lots of ways to work with XML). However, you cannot pass XML into the JSON serializer as it is expecting a JSON string.
EDIT:
There are methods on JsonConvert to convert from XML. See this answer here: How to convert JSON to XML or XML to JSON?