text:
Q: Block access to C Drive Windows XP and 2003 server I have tried everything to prevent users from accessing the C: on the network through group policy but they always find a way around it (students).
They cant right click to create shortcuts but they have the shortcuts on USB and are able to run the shortcuts to access the c:.
There isnt a specific group policy that prevents access to the C drive.
Any thoughts?
Using windows xp clients with 2003 server for AD and GPolicy

A: We do this all the time with our terminal servers, just in case someone somehow manages to figure out how to open a traditional browse dialogue, Windows simply pops up a message saying that the current policy is denying them access.
In your Group Policy, find the following:

*

*User Configuration

*Administrative Template

*Windows Components

*Windows Explorer

*

*"Hide these specified drives in My Computer"

*"Prevent access to drives from My Computer"

It's been a while since I did it but I'm fairly sure these are the settings you will require. There are ways to override the default options provided, so that you can modify the drives past the fairly restrictive options provided if you need them.

A: Another alternative is to let them have access. We ended up curbing their behavior (well, destructive behavior) using Deep Freeze from Faronics; it lets you "freeze" the hard disk and then on reboot it goes back to the default state. It was cathartic when we tested it by wiping the Windows subdirectory until Windows kind of lurched and fell over...then rebooted and it came back up.
That allows the students to do whatever they want without destroying your configuration; we also found that it eliminated a lot of corruption issues with profiles and caches.
I think there are a couple other alternatives out there but I only have used DeepFreeze. There's a central console used to monitor workstations and can remotely thaw and freeze them, we also use it to get IP addresses for particular workstations.
I've worked in labs that were locked down to the point of being nearly unusable for anything. Even in class we couldn't get, for example, certain documents to open or use notepad to read source code because it wasn't allowed by the sysadmin who happened to be two hours away in a central site, and the local admin guy lamented not being able to fix certain issues without prearranging things with the central admins. And this was a college. Deep Freeze gave more freedom for getting work done without interference (it also allows at our site for certain people to get higher privileges on the local machine since any malware or alterations are erased at reboot; if they're going out of their way to install "personal" software they grow weary of having to constantly reinstall at each reboot; at least that's what we've seen).
We tried locking out things through policy when we ran 2000 terminal services; we found that the policy only locked out access from certain things like explorer. It looked like some programs (like an old copy of file manager from the 3.x days) was able to still browse the C: drive, along with some freeware file managers! Unless that was fixed, it looks like certain APIs still allowed users to get access to local drives that were supposed to be blocked out by policy. Plus we have systems that for reasons we never understood will sometimes not get the policy right away or act as if they wouldn't get any policy updates until after a reboot or two, so sometimes we had people that could bypass configuration lockouts and do things they weren't supposed to.


text:
Q: Is this a presentation of the other flag in the NAA review queue? I was just reviewing the Not An Answer Review queue and I came across this answer and flag description:

The answer has been flagged as very low quality and then it also has a flag that says:

It's not an answer, or at least not to this question, however this was accepted instead of the real answer. – May 7 '12 at 5:53  × 4

Now I am in the review queue a lot and I don't recall ever seeing this before, is this an other flag that is being shown?  What is this unusual description that I am seeing?

A: A few months back, we did a massive refactoring of the flagging system. As part of this, the old code for classifying flags was ripped out and all old flags were migrated to the new system, analyzed and classified in the process.
...in a few cases, the migration got it wrong.
Internally, those are both NAA flags - but the old one wasn't supposed to be. As a result, you get to see what someone typed into the "other" box when flagging.
This should be strictly limited to a handful of posts with old flags, and (as always in the 10K flag queue) the flagger's name won't be shown.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I get the handle of another's window (browser) from my program? WINAPI
How do I get the handle of another's window (browser) from my program?
Searching by the name of the window does not help, as the name changes.

A: For example, if you want to find Google Chrome window's handle, use the following code:
//Find the Google Chrome
HWND hGoogleChrome = FindWindowEx(NULL, NULL, L"Chrome_WidgetWin_1", NULL);

Chrome_WidgetWin_1 will rename the Chrome window's name regardless of title that changes.


text:
Q: Convert a textbox string to javascript array I have a textbox that contains the following -

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

I need to be able to convert this to an array, in exactly the same format for a graph. The code I have tried below does not work as it does not have the square brackets inside the array.
/*****SIMPLE CHART*****/
        var flashstring = document.getElementsByName('hfMessageHistory')[0].value;

        var flash = new Array();
        flash = flashstring.split(",");

        for (a in flash) {
            flash[a] = parseInt(flash[a], 10) || 0; // Explicitly include base as per Álvaro's comment
        }

        alert(flash);

        function showTooltip(x, y, contents) {
            jQuery('
' + contents + '
').css({
                position: 'absolute',
                display: 'none',
                top: y + 5,
                left: x + 5
            }).appendTo("body").fadeIn(200);
        }

        var plot = jQuery.plot(jQuery("#chartplace"),
               [{ data: [flash], label: "Messages Sent", color: "#ff6c00" }], {
                   series: {
                       lines: { show: true, fill: true, fillColor: { colors: [{ opacity: 0.05 }, { opacity: 0.15 }] } },
                       points: { show: true }
                   },
                   legend: { position: 'nw' },
                   grid: { hoverable: true, clickable: true, borderColor: '#ccc', borderWidth: 1, labelMargin: 10 },
                   yaxis: { min: 0, max: 20 }
               });

A: Avoiding other parts of your code(not clear what you're asking), you can covert a string to an array by using the bracket([]):
var str = '[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 1], [6, 6]]'
var arr = [str];

A: The string is JSON. Use JSON.parse():
var flashstring = document.getElementsByName('hfMessageHistory')[0].value;
var flash = JSON.parse(flashstring);

A: Use JSON.parse:
HTML:
<input type="text" id="text1" />
<button onclick="parse()">Parse</button>

JS:
$('#text1').val('[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 1], [6, 6]]');

function parse() {
    try {
        var parsed = JSON.parse($('#text1').val());
        console.log(parsed);
    } catch (e) {
        console.log('parse failed. Check your input');
    }
 }

JSFIDDLE.


text:
Q: Prove that $x^4 + y^4 - 3xy = 2$ is compact The exercise consists of showing that the function $f(x,y)=x^4 + y^4$ has a global minimum and maximum under the constraint $x^4 + y^4 - 2xy = 2$.
In the solution to the exercise, it it follows that the constraint is compact if we can show that $\lim_{x^2 + y^2 \rightarrow \infty} x^4 + y^4 - 3xy - 2 \rightarrow \infty$.Why this is the case?
My intuition tells me that this is because the $x^4$ and $y^4$ terms dominates the other two terms when $x$ and $y$ gets large. This would then imply that $x$ and $y$ cannot get arbitrarily big without violating the constraint. Does this imply that if the limit of the constraint was $0$, that the domain would not be compact? Is my reasoning valid?
Many thanks,

A: Note that
$$\eqalign{x^4+y^4-2xy&={1\over2}(x^2+y^2)^2+{1\over2}(x^2-y^2)^2-2xy\geq{1\over2}(x^2+y^2)^2-(x^2+y^2)\cr
&=(x^2+y^2)^2\left({1\over2}-{1\over x^2+y^2}\right)\geq{1\over4}(x^2+y^2)^2\geq4\ ,\cr}$$
as soon as $x^2+y^2\geq4$. It follows that the constraint defines a closed and bounded, hence compact, set in the plane.

A: If you prove that $\lim_{x^2+y^2\to\infty}(x^4+y^4-2xy)=\infty$, then there exists $K>0$ such that $x^2+y^2-2xy>2$ for $x^2+y^2>K$. Hence the solutions of $x^2+y^2-2xy-2=0$ are contained in the circle $x^2+y^2\le K$ and so they form a bounded set.
For the limit, you can use polar coordinates; given $x=r\cos\varphi$ and $y=r\sin\varphi$, you have, for $r\ge2$,
\begin{align}
x^4+y^4-2xy
&=r^2(r^2\cos^4\varphi+r^2\sin^4\varphi-2\cos\varphi\sin\varphi) \\[6px]
&\ge r^2(4\cos^4\varphi+4\sin^4\varphi-2\cos\varphi\sin\varphi) \\[6px]
&\ge r^2(4-8\cos^2\varphi\sin^2\varphi-2\cos\varphi\sin\varphi) \\[6px]
&=r^2(4-2\sin^22\varphi-\sin\varphi) \\[6px]
&\ge r^2
\end{align}
because $2\sin^22\varphi+\sin\varphi\le 3$.


text:
Q: Modeling class diagram from activity model How to move from activity modeling to class modeling in UML diagrams? With respect to object oriented software engineering.
Not: I am not asking for any reverse engineering tool.

A: I think you are missing what the goal of both this models are. An activity model only shows how something is achived. For example which inputs are needed, and where something happens with those. It describs a process, but doesn't take in account what technology is used. Wheres the class model is specific for object oriented languages, thus a technology. And with the class model you can't follow from the start to the end of a process, because it doesn't describe one. It only describes what you use to handle a process.
I hope this helps to clear how you have to approache this.


text:
Q: SDWebImage setImageWithURL return empty outside any other method than cellForRowAtIndexPath I am using SDWwbImage, wich i download from here:

https://github.com/rs/SDWebImage

I tested in the method: cellForRowAtIndexPath and everything works fine, here is my code:
[cell.image setImageWithURL:[NSURL URLWithString:object.imageUrl]];

Now i need to call an image outside this method (eg: heightForRowAtIndexPath, viewDidLoad), and i always get no image, here is my code:
UIImageView *test = [[UIImageView alloc] init];
[test setImageWithURL:[NSURL URLWithString:categories.imageUrl]];
NSLog(@"height: %f", test.image.size.height);

Is it disallowed to use setImageWithURL anywhere? how can i solve this?
EDITED
I tried to add the completion block to know when the download is finished and refresh the uitablevew, here is my code:
UIImageView *test = [[UIImageView alloc] init];
        [test setImageWithURL:[NSURL URLWithString:object.imageUrl]
                       placeholderImage:[UIImage imageNamed:@"ic_launcher_57@2x.png"]
                              completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
                                  counterY++;
                                  if (counterY == counterX) {
                                      NSLog(@"reloading");
                                      [self.tableView reloadData];
                                  }
        }];

But only the first time the controller is loaded, this doesnt work. Every time after this everything is fine.It looks like something cancel de download the first time.


text:
Q: Wrong time in Routes file on Laravel 7 My config/app.php has the timezone set us:
...
 'timezone' => 'Asia/Kolkata',
...

Which works fine when I use it somewhere like on tinker:
Psy Shell v0.10.4 (PHP 7.4.7 — cli) by Justin Hileman
>>> now()
=> Illuminate\Support\Carbon @1595277419 {#4447
     date: 2020-07-21 02:06:59.522138 Asia/Kolkata (+05:30),
   }
>>> Carbon\Carbon::now()
=> Carbon\Carbon @1595277429 {#4445
     date: 2020-07-21 02:07:09.801135 Asia/Kolkata (+05:30),
   }
>>>

But when I echo the same in web.php:
Route::get('/time', function(){
    return now();
});

Returns time in UTC:
"2020-07-20T20:44:32.444592Z"

Why is it different in the route file? How can I get the current time in any of the routes files?

A: You should use controllers for this especially when there is a dynamic part to the view. As part of the application startup routes are loaded and config is loaded. My guess would that routes are loaded before config.
Also you should never use a callable in your routes as this makes it impossible to cache the routes.
I'm also curious if the call to now() from the route only returns the string you provided or if it returns a full Carbon object? Is the working directory in tinker set to your application, just to ensure you are not comparing apples vs oranges.

A: To get the date with your current timezone.
You can use DateTime, with params DateTimeZone
new Datetime("now", new DateTimeZone(config('app.timezone'));

And after, format the date.
DateTime documentation


text:
Q: launch C# exe without prompting UAC on Windows 7 I have C# executable that I want to launch on Windows 7 without the dialogbox asking for run-as-administrator..  So here is my code inside the program that launches the C# executable named testApp.exe.
Process testApp = new Process();
testApp.StartInfo.FileName = "C:\\Program Files\\Common Files\\testApp.exe";
testApp.Start();

I also create the minfest for both programs.  app.manifest for testApp.exe and app.manifest for the program that launches testApp.exe, and then I change the following line in both manifest to:
requestedExecutionLevel level="requireAdministrator" uiAccess="false"
When I double click on the testApp.exe to run it, testApp.exe program crashes, but when I run it as administrator, it works fine, no crash.  So this behavoir also happens the same when i run the program that launches the testApp.exe, testApp.exe crashes.
I must do something wrong here.  Do I need to change the name of the manifest because I use the default names that are generated by visual studio 2010.
thanks.

A: Actually you should only be using

requestedExecutionLevel level="requireAdministrator" uiAccess="false"

only when you want to run as administrator.
Change this to:

requestedExecutionLevel level="asInvoker" uiAccess="false"

And you'll be good to go.

A: Use
info.Verb = "runas"; // Provides Run as Administrator

A: my 50 cents,
instead of adding
requestedExecutionLevel level="asInvoker" uiAccess="false" in manifest you can use task scheduler to run almost anything in highest level (Administrator Mode)
source: http://www.liberalcode.com/2014/01/automating-run-as-administrator-from-c.html
although the above post talks about running it remotely, but you can easily change it to run locally.


text:
Q: Qual a melhor forma de fazer login com Angularjs Em um app utilizando AngularJS e Ionic, qual a melhor forma de fazer autenticação em uma API? Faço a verificação de login em todas as telas ou utilizo algum mecanismo de sessão?
Imagino que fazer autenticação em todas as controllers talvez consuma dados demais... Qual o melhor caminho?

A: O ideal é utilizar APIs que suportam OAuth 2, você então realiza os procedimentos iniciais para obter o bearer token e o armazena em um cookie para ser utilizado em toda requisição à API (ou pelo menos aos endpoints que requerem essa autenticação). Vou te dar um exemplo de um service que estou utilizando em uma aplicação para realizar todos os procedimentos autenticação com uma API que faz uso do OAuth 2.
Aqui está o código do service:
(function () {
    'use strict';

    angular
        .module('zigforumApp')
        .service('users', users);

    users.$inject = ['$http', '$cookies', 'TOKEN_URL'];

    function users($http, $cookies, TOKEN_URL) {
        var sv = this;

        function NoAuthenticationException(message) {
            this.name = 'AuthenticationRequired';
            this.message = message;
        }

        function AuthenticationExpiredException(message) {
            this.name = 'AuthenticationExpired';
            this.message = message;
        }

        function AuthenticationRetrievalException(message) {
            this.name = 'AuthenticationRetrieval';
            this.message = message;
        }

        sv.userData = {
            isAuthenticated: false,
            username: '',
            bearerToken: '',
            expirationDate: null
        };

        function isAuthenticationExpired(expirationDate) {
            var now = new Date();
            expirationDate = new Date(expirationDate);

            if (expirationDate - now > 0) {
                return false;
            } else {
                return true;
            }
        }

        function saveData() {
            removeData();
            $cookies.putObject('auth_data', sv.userData);
        }

        function removeData() {
            $cookies.remove('auth_data');
        }

        function retrieveSavedData() {
            var savedData = $cookies.getObject('auth_data');

            if (typeof savedData === 'undefined') {
                throw new AuthenticationRetrievalException('No authentication data exists');
            } else if (isAuthenticationExpired(savedData.expirationDate)) {
                throw new AuthenticationExpiredException('Authentication token has already expired');
            } else {
                sv.userData = savedData;
                setHttpAuthHeader();
            }
        }

        function clearUserData() {
            sv.userData.isAuthenticated = false;
            sv.userData.username = '';
            sv.userData.bearerToken = '';
            sv.userData.expirationDate = null;
        }

        function setHttpAuthHeader() {
            $http.defaults.headers.common.Authorization = 'Bearer ' + sv.userData.bearerToken;
        }

        this.isAuthenticated = function () {
            if (!(sv.userData.isAuthenticated && !isAuthenticationExpired(sv.userData.expirationDate))) {
                try {
                    retrieveSavedData();
                } catch (e) {
                    return false;
                }
            }

            return true;
        };

        this.removeAuthentication = function () {
            removeData();
            clearUserData();
            $http.defaults.headers.common.Authorization = null;
        };

        this.authenticate = function (username, password, persistData, successCallback, errorCallback) {
            this.removeAuthentication();
            var config = {
                method: 'POST',
                url: TOKEN_URL,
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded'
                },
                data: 'grant_type=password&username=' + username + '&password=' + password
            };

            $http(config)
                .success(function (data) {
                    sv.userData.isAuthenticated = true;
                    sv.userData.username = data.userName;
                    sv.userData.bearerToken = data.access_token;
                    sv.userData.expirationDate = new Date(data['.expires']);
                    setHttpAuthHeader();
                    if (persistData === true) {
                        saveData();
                    }
                    if (typeof successCallback === 'function') {
                        successCallback();
                    }
                })
                .error(function (data) {
                    if (typeof errorCallback === 'function') {
                        if (data && data.error_description) {
                            errorCallback(data.error_description);
                        } else {
                            errorCallback('Unable to contact server; please, try again later.');
                        }
                    }
                });
        };

        try {
            retrieveSavedData();
        } catch (e) { }
    }
})();

A função mais importante é a authenticate ela recebe os dados de login do usuário, faz uma requisição à API para obter o token, armazena o token em um cookie e para autenticar automaticamente todas as requisições que serão feitas daqui em diante ele adiciona esse token como header padrão.
Você pode utilizar esse service como base para montar o seu.

A: A melhor forma de fazer login com AngularJS é...
Não faça login com angularJS.
Sério. Sendo uma tecnologia que é executada no cliente, toda e qualquer regra de validação de credenciais (conexão a um endpoint para verificar usuário e senha, por exemplo) pode ser explorada por um usuário malicioso.
A melhor maneira, neste caso, envolveria delegar a responsabilidade de ações de sign-in e sign-out para outra parte da aplicação - no exemplo bem-dado por Zignd, esta tecnologia seria OAuth.
O resultado final de uma antenticação via OAuth é um token, que pode ser armazenado em LocalStorage ou em um cookie. Utilize este token para obter informações a respeito do usuário atualmente logado.


text:
Q: Using AWS Amplify authenticated user to communicate with an ALB or API Gateway? I set up my AWS Cognito integration into my React Native app using amplify add auth according to the guide, all is well and good, I'm able to register and login in the app. The cli wizard associates two app clients with the User Pool it creates: [poolid]_app_client and [poolid]_app_clientWeb.
I would like to have authenticated users be able to communicate with a web app hosted on an EC2 instance. I thought I could use an Application Load Balancer to do this by setting it up to forward authenticated requests to the EC2 instance. Problem is, I'm unable to create an Application Load Balancer default action that authenticates with the Cognito User Pool.
If I choose the App Client associated with the [poolid]_app_clientWeb, I get an error on save: Error creating listener The user pool client must have a client secret. This is the client ID exported by the amplify tools to my React Native app in aws-exports.js.
If I choose the App Client associated with the [poolid]_app_client I get Error creating listener OAuth flows must be enabled in the user pool client.
Not sure how to proceed. Is ALB the way to go or API Gateway?

A: You should have made appropriate changes in "User Pools -> App Integration -> App client" settings for your client

A: API Gateway makes this much more straightforward. After I went through Create API, I was able to create an Authorizer that connected with my Cognito User Pool (the clientWeb one). Then, after creating endpoint Resources, I associated them with the authorizer in the Method Request section of their configuration.
I could then send the identity token I get from Amplify:
(await Auth.currentSession()).idToken.jwtToken
as an HTTP header value to the endpoints I configured.


text:
Q: ON Premises connectivity issue from Azure (using site-to-site connectivity) I had recently bought Azure subscription and I have created a site-to-site VPN connectivity between the azure network & the Enterprise network. The connectivity shows as successful in the virtual network dashboard & the enterprise VPN gateway logs. We have configured the Virtual address space & the onPremises local network as mentioned in the bottom
Issue

*

*The connectivity between azure & enterprise network shows successful in the dashboard but when we try reaching the enterprise ip 116.197.178.5 we are unable to reach the IP, tried via nmap, ssh etc.

*From the **(Ubuntu Linux)**VM we are able to reach the internet but have issues with the enterprise connectivity.

*The same configuration was working in march 2014 when we had tried using the Free Azure trial account. Looks like there has been a change in Azure services sometime during march 2014

*I don't see anyways to debug this issue

*I had followed the doc in msdn site (Configure a Site-to-Site VPN in the Management Portal)
Help

*

*Can someone tell me whether I'm doing anything wrong

*Is there a way I can debug this issue
Device Route info
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         **10.2.1.1**    0.0.0.0         UG    0      0        0 eth0
default         10.2.1.1        0.0.0.0         UG    100    0        0 eth0
10.2.1.0        *               255.255.255.0   U     0      0        0 eth0

Local network
  <LocalNetworkSite name="EnterpriseNetwork">
    <AddressSpace>
      <AddressPrefix>10.1.0.0/16</AddressPrefix>
    </AddressSpace>
    <VPNGatewayAddress>xxx.197.179.249</VPNGatewayAddress>
  </LocalNetworkSite>

Virtual network
  <VirtualNetworkSite name="Azure-network" Location="Southeast Asia">
    <AddressSpace>
      <AddressPrefix>10.2.0.0/16</AddressPrefix>
    </AddressSpace>
    <Subnets>
      <Subnet name="FrontEndSubnet">
        <AddressPrefix>10.2.0.0/24</AddressPrefix>
      </Subnet>
      <Subnet name="BackEndSubnet">
        <AddressPrefix>10.2.1.0/24</AddressPrefix>
      </Subnet>
      <Subnet name="ADDNSSubnet">
        <AddressPrefix>10.2.2.0/23</AddressPrefix>
      </Subnet>
      <Subnet name="GatewaySubnet">
        <AddressPrefix>10.2.4.0/29</AddressPrefix>
      </Subnet>
    </Subnets>
    <DnsServersRef>
      <DnsServerRef name="GoogleDNS" />
    </DnsServersRef>
    <Gateway>
      <ConnectionsToLocalNetwork>
        <LocalNetworkSiteRef name="EnterpriseNetwork">
          <Connection type="IPsec" />
        </LocalNetworkSiteRef>
      </ConnectionsToLocalNetwork>
    </Gateway>
  </VirtualNetworkSite>

A: Rosh,
The IP 116.197.178.5 is a public IP address and should be routed via the internet connections on your VMs (asusming you haven't hardcoded the route table otherwise).
Your private on-premse network is 10.2.0.0/24 and would be the only range that should be being routed via your VPN (again, assuming you haven't played with the route tables on your Azure VMs).
It sounds like you might be trying to route traffic to 116.197.178.5 via your VPN connection which would require you to hardcode the route to be via your local VPN gateway (and not the one to the Internet).
Hope this makes sense.
Simon.


text:
Q: How to Extract the Payload from Ethernet Packet (vector)? For my assignment I have been given the task of making a router. The ethernet packet datatype is vector <unsigned char> and the ethernet header is as follows:

Now I do not have much experience working with vectors, but my question is how can I extract the payload part?
For example if the ethernet packet is an ARP packet I would like to be able to use the following structure to check the opcode and essentially be able to do something like
arp_hdr *arphdr = (arp_hdr *) packet_arp;

struct arp_hdr
{
  unsigned short  arp_hrd;                 /* format of hardware address   */
  unsigned short  arp_pro;                 /* format of protocol address   */
  unsigned char   arp_hln;                 /* length of hardware address   */
  unsigned char   arp_pln;                 /* length of protocol address   */
  unsigned short  arp_op;                  /* ARP opcode (command)         */
  unsigned char   arp_sha[ETHER_ADDR_LEN]; /* sender hardware address      */
  uint32_t        arp_sip;                 /* sender IP address            */
  unsigned char   arp_tha[ETHER_ADDR_LEN]; /* target hardware address      */
  uint32_t        arp_tip;                 /* target IP address            */
} __attribute__ ((packed)) ;

And the ethernet header is also given:
struct ethernet_hdr
{
#ifndef ETHER_ADDR_LEN
#define ETHER_ADDR_LEN 6
#endif
  uint8_t  ether_dhost[ETHER_ADDR_LEN]; /* destination ethernet address */
  uint8_t  ether_shost[ETHER_ADDR_LEN]; /* source ethernet address */
  uint16_t ether_type;                  /* packet type ID */
} __attribute__ ((packed)) ;

A: To copy a vector into another vector, you can use the 5th std::vector constructor here https://en.cppreference.com/w/cpp/container/vector/vector
template< class InputIt > vector( InputIt first, InputIt last, const Allocator& alloc = Allocator() );

So to extract the payload (assuming the payload is everything in the dataframe that is not in the header) you'd do:
...assuming the existence of a std::vector<unsigned char> dataframe;
std::vector<unsigned char> payload(dataframe.begin() + sizeof(ethernet_hdr), dataframe.end());


text:
Q: IE JSON parse works if from localhost fails otherwise I'm attempting to track down a javascript exception I'm getting when parsing some JSON in IE that has been returned by an AJAX request. Normally I'd assume a JSON formatting error somewhere in my code but in this case the JSON parses fine in Chrome, FireFox & IE but in IE's case ONLY if the URL is localhost. If I change the URL to my-laptop instead, which points to exactly the same location, the JSON fails to parse in IE but is still ok in Chrome and FireFox.
The JSON is very simple. The line below is from VS.Net's debugger so the double quotes on the ends are cosmetic:
data = "{ "ID" : 15, "Name" : "Hobart" } "

The JSON is being parsed with:
data = JSON.parse(data);

I've checked everything I can think of to see if the response is different between the response from localhost and my-laptop but can't spot anything. Why would IE decide not to parse the JSON when the server hostname changes?
Update: If I open up the localhost version with IE's compatibility mode switched on then the JSON paring alsi fails. Turn off compatibility mode and it works.

A: Chin Boons answer seems wrong. Keys in JSON need quotes and a value of type Number is fine without quotes.
When you are in compatibility mode, I would suppose that JSON is simply undefined. See e.g. here: Browser-native JSON support (window.JSON)
Maybe https://github.com/douglascrockford/JSON-js might help you in that case.

A: The JSON you provided is not a valid JSON structure. Every element needs to be wrapped up with an enclosing " ".
data = "{ "ID" : "15", "Name" : "Hobart" }"

Note the 15 is now "15".
Some weaker parser and or browser combination may have better tolerance for slight deviation from specification.

A: The cause of the issue is down to IE's compatibility mode. The comments in this question led me to open up the IE Developer Tools window and the web app was running in IE7 compatibility mode. I don't know why it was doing that and the compatibility mode button is not showing up in the IE address bar. Still at least I know what the problem is now and it's a more tractable problem to resolve than debugging reams of javascript.


text:
Q: What is the mean of this? Engine bug or what?
Possible Duplicate:
Javascript scoping variables theory

Hi all,
I want to ask something stranger. Here is the code.

var a = "defined";
function f() {
   alert(a);
   var a = 5;
}
f();

alerts "undefined"
Can anyone explain that why I am getting "undefined".
Fatih..

A: That is called JavaScript Hoisting i suppose. Check out this video to learn more about it and solution to it:
http://net.tutsplus.com/tutorials/javascript-ajax/quick-tip-javascript-hoisting-explained/
To make it work, you will have to remove the var keyword form variable a:
var a = "defined";
function f() {
   alert(a);
   a = 5;
}
f();

So basically, it is a variable scope issue. The act of removing var keyword makes a variable globally available. Hence, there is no error raised this time.

A: In the function you get a new scope.
The var a in the function declares a local variable a, which masks the global one.
The assignment to a takes place later (after the alert), so until then a is undefined.
The confusing part is that it does not matter if you have the var a declaration on top or anywhere else in the function (can even be inside an if). The effect is the same: It declares a variable for that scope (effective even for code that is located before the declaration). That is why jslint recommends to declare all local variables on top.


text:
Q: How to setup vim/emacs keybindings in RStudio? RStudio constantly requires taking fingers away from "asdf-jkl;" to the arrow keys. Not very comfortable after working with IPython's Emacs keybindings.
RStudio has vim navigation for file editing, but not for the console. (And that's not the real vim navigation. Some commands do not work at all.)
How can I setup a more friendly keyboard navigation Emacs/Vim-like for the console in RStudio?

A: You can turn vim keybindings of RStudio on in Tools | Global Options | Code | Editing, like this:

Please make sure your RStudio's version is above v0.99.x!

A: On Macs, you can use Karabiner app, which enables vi/vim/emacs keybindings everywhere, including RStudio. Karabiner is more flexible and functional than native Cocoa quasi-Emacs bindings.


text:
Q: UITableView MoveRow Button position changing from right to left I am developing one Arabic application in which I want a UITableview has right to left allurement for all the control , row delete button, row insertion button , row move button all should be align right left.

A: For this you can create a custom cell and do whatever you want. Follow this link text


text:
Q: If $\sim{p}$ then $\left ( p\vee{q} \right )$ If $p=1$, then what would be the output of this$:\quad\sim{p}\rightarrow{p\vee{q}}$ ? More importantly, what is the intuition behind this ? I'm new to logic, and would appreciate any explanations !

A: If $p=1$ means $p$ is true, then $\operatorname {if }\sim p \operatorname { then } (p \operatorname { or } q)$ is true.  An implication is true any time the antecedent, here $\sim p$, is false.  The sentence will also be true any time $q$ is true, because that makes the consequent true.  Your sentence is equivalent to $(p \operatorname { or } q)$


text:
Q: iCal Feed Served Through Django Not Recognized I'm having difficulty generating a valid iCal stream using Django.
The problem I'm having is that my iCal file and stream is valid. I can visit the stream URL to download the .ics file and validate it only, import it to iCalendar or Google Calendar just fine, etc. In fact, if I host the same .ics file as a static file on my Django server and subscribe to that static URL from Google Calendar, it also works just fine. However, when giving Google Calendar the feed URL, no luck.
I've seen several similar questions on Stack Overflow and when searching Google, but most of them have the exact opposite problem (file doesn't work, stream does, or stream only works sometimes). Best I can tell from the example code they offer, I'm doing something very similar, but my feed doesn't work, so I must be missing something.
Here is the contents of the .ics file.
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Tester//Version 0.0.1//EN
BEGIN:VEVENT
SUMMARY:iCal Timed
DTSTART:20140408T202000Z
DTEND:20140408T202000Z
DTSTAMP:20141107T153835Z
UID:event_1
DESCRIPTION:iCal Comment
END:VEVENT
BEGIN:VEVENT
SUMMARY:iCal All Day
DTSTART;VALUE=DATE:20140408
DTEND;VALUE=DATE:20140409
DTSTAMP:20141107T153835Z
UID:1
DESCRIPTION:iCal Comment
END:VEVENT
END:VCALENDAR

I am using Django 1.7 with icalendar 3.8.3, and below is the code used to generated the feed.
def ical_feed(request):
    cal = icalendar.Calendar()
    cal.add('prodid', '-//Tester//Version 0.1.1//EN')
    cal.add('version', '2.0')

    for e in Event.events.filter(user_id=request.user.pk).iterator():
        event = icalendar.Event()
        event['uid'] = unicode(e.pk)
        ...
        cal.add_component(event)

    stream = cal.to_ical()

    response = HttpResponse(stream, content_type='text/calendar; charset=utf-8')
    response['Filename'] = request.user.username + '.ics'
    response['Content-Disposition'] = 'attachment; filename=' + request.user.username + '.ics'

    return response

This shouldn't matter, but Django is served through Apache 2.4.7 (Ubuntu). Aside from setting the Content-Type in my HttpResponse, is there something I need to be doing in Apache as well to make readers see this as a stream? I've heard of django-ical, and it seems like an unnecessary amount of overhead for what I'm doing, and looking at its code it sets the response with headers the same way I'm already doing.
Any insight would be greatly appreciated.
UPDATE
I misunderstood the UID, thinking it was simple an identifier for items within my feed. However, that did not resolve the issue. To further clarify the question, when trying to access my calendar from an iCal feed validator, iCalendar, or Google Calendar, I was met with an "failed iCal validation" error, and the size of the calendar always resulted in 0 bytes.
Jerry's suggestion to CURL the URL was right on. What I found was a bit embarassing, but I was so focused on the code implentation that I never walked all the way up to the Django view-level function. CURLing the URL showed that 0 bytes were returned because the user was being redirected to the /login page. I had the @login_required decorator on the view.
Thanks very much for your help, I'm marking your answer as correct, Jerry, as it provided the debugging I needed to find the solution.

A: First, try looking at your headers from a client to make sure that the headers aren't being mangled or lost somewhere. You can use curl --head and then the URL to see the full headers that a client on the same computer will receive. (If you are changing behavior based on cookies or agent information, you may want to use a plug-in or the developer tools for that particular client to see the header information.)
Second, your UIDs are not unique across the universe. Those UIDs could be duplicated somewhere else. One common practice is to append your own unique hostname to the UID to ensure that they are unique.
Finally, you didn't mention how the feed fails in Google Calendar and in iCal. Is the feed simply ignored as if it were empty? Is an error generated in either case? Or are the items showing up but not showing up correctly?


text:
Q: Use TreeMap with SOAP in Java I am trying to return a TreeMap in a method in my SOAP service, obtaining the following exception:
Exception in thread "main" javax.xml.ws.WebServiceException: Unable to create JAXBContext
    at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(Unknown Source)
    at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.postProcess(Unknown Source)
    at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(Unknown Source)
    at com.sun.xml.internal.ws.server.EndpointFactory.createSEIModel(Unknown Source)
    at com.sun.xml.internal.ws.server.EndpointFactory.createEndpoint(Unknown Source)
    at com.sun.xml.internal.ws.api.server.WSEndpoint.create(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(Unknown Source)
    at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(Unknown Source)
    at javax.xml.ws.Endpoint.publish(Unknown Source)
    at webservice.soap.ServicePublisher.main(ServicePublisher.java:15)
Caused by: java.security.PrivilegedActionException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.util.List is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at java.util.List
        at public java.util.TreeMap dictionary.jaxws.GetWordsBegginingWithResponse._return
        at dictionary.jaxws.GetWordsBegginingWithResponse

    at java.security.AccessController.doPrivileged(Native Method)
    ... 11 more
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.util.List is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at java.util.List
        at public java.util.TreeMap dictionary.jaxws.GetWordsBegginingWithResponse._return
        at dictionary.jaxws.GetWordsBegginingWithResponse

    at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source)
    at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
    at com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(Unknown Source)
    at com.sun.xml.internal.ws.developer.JAXBContextFactory$1.createJAXBContext(Unknown Source)
    at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(Unknown Source)
    at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(Unknown Source)
    ... 12 more

Why is it trying to serialize a List? Can I make it work with any other SortedMap?

A: As pointed out by @PaulVargas in the comments, TreeMap is not directly supported by JAX-B.
I resolved this issue creating my TreeMapSerializer adapting this answer JAXB: How to suppress surrounding XmlElement when using XmlJavaTypeAdapter?


text:
Q: Python - Creating a file for each item in a list I am trying to use python to create an individual text file for every item in a list.
List = open('/home/user/Documents/TestList.txt').readlines()
List2 = [s + ' time' for s in List]
for item in List2 open('/home/user/Documents/%s.txt', 'w') % (item)

This code should generate a list from a target text file.  A second list is generated using the strings from the first list with some appendage (in the case, adding ' time' to the end). My third line is where I'm running into problems.  I want to create an individual text file for each item in my new list where the name of the text file is the string of that list item.  Example: If my first list item was 'healthy time' and my second list item was 'food time', text files called "healthy time.txt" and "food time.txt" would be generated.
It appears i'm running into an issue with the open command, but I have searched extensively and found nothing regarding using open in the context of a list.

A: first use generators
List = open("/path/to/file") #no need to call readlines ( a filehandle is naturally a generator of lines)
List2 = (s.strip() + ' time' for s in List) #calling strip will remove any extra whitespace(like newlines)

this causes lazy evaluation so you are not looping and looping and looping etc
then fix your line (this is the actual problem that is causing errors in your program)
for item in List2:
    open('/home/user/Documents/%s.txt'%(item,), 'w')
           # ^this was your actual problem, the rest is just code improvements

so your whole code becomes
List = open("/path/to/file") #no need to call readlines ( a filehandle is naturally a generator of lines)
List2 = (s.strip() + ' time' for s in List)
for item in List2: #this is the only time you are actually looping through the list
    open('/home/user/Documents/%s.txt'%(item,), 'w')

now you only are looping through the list one time instead of 3 times
the suggestion to use a filePath variable to form your filename is also a very good one

A: Move your tokenization to the file path string. Right now it's outside the call to open.
for item in List2:
    filePath = '/home/user/Documents/%s.txt' % (item)
    open(filePath, 'w')


text:
Q: How do I append a column from a numpy array to a pd dataframe? I have a numpy array of 100 predicted values called first_100. If I convert these to a dataframe they are indexed as 0,1,2 etc. However, the predictions are for values that are in random indexed order, 66,201,32 etc. I want to be able to put the actual values and the predictions in the same dataframe, but I'm really struggling.
The real values are in a dataframe called first_100_train.
I've tried the following:
pd.concat([first_100, first_100_train], axis=1)

This doesn't work and for some reason returns the entire dataframe and indexed from 0 so there are lots of NaNs...
first_100_train['Prediction'] = first_100[0]

This is almost what I want, but again because the indexes are different the data doesn't match up. I'd really appreciate any suggestions.
EDIT: After managing to join the dataframes I now have this:

I'd like to be able to drop the final column...
Here is first_100.head()

and first_100_train.head()

The problem is that index 2 from first_100 actually corresponds to index 480 of first_100_train

A: Set default index values by DataFrame.reset_index and drop=True for correct alignment:
pd.concat([first_100.reset_index(drop=True),
           first_100_train.reset_index(drop=True)], axis=1)

Or if first DataFrame have default RangeIndex solution is simplify:
pd.concat([first_100,
           first_100_train.reset_index(drop=True)], axis=1)


text:
Q: Copying exact field properties to new layer using ArcPy? I fear I am missing something fundamental.
I can get a list of fields from one layer using ListFields, and look at the properties:
fields = arcpy.ListFields(feature_class)

# Iterate through the list of fields
for field in fields:
    # Print field properties
    print("Field:       {0}".format(field.name))
    print("Alias:       {0}".format(field.aliasName))
    print("Type:        {0}".format(field.type))
    print("Is Editable: {0}".format(field.editable))
    print("Required:    {0}".format(field.required))
    print("Scale:       {0}".format(field.scale))
    print("Precision:   {0}".format(field.precision))

Is there an easy way to add these fields with the exact same properties to a new layer using AddField_management?
I was hoping I could pass the field object directly and not have to decompose it into the individual properties. But the following does NOT work:
for field in fields:
    # add fields with the same properties
    arcpy.AddField_managment(feature_class2,field)

It does not seem very efficient to break out and pass every field property (field.name, field.type, etc). Surely there is a better way.
I get the error:

ERROR 000623: Invalid value type for parameter field_name

A: My solution was to use a function to create a dictionary, then unpack the dictionary in the addField function. For example:
def fieldInfoUnpack(fieldInfo,name,alias):
    return  {"field_name":name,
    "field_type":fieldInfo.type,
    "field_precision":fieldInfo.precision,
    "field_scale":fieldInfo.scale,
    "field_length":fieldInfo.length,
    "field_alias":alias,
    "field_is_nullable":fieldInfo.isNullable,
    "field_is_required":fieldInfo.required,
    "field_domain":fieldInfo.domain}
arcpy.AddField_management("roadwaysplts",**fieldInfoUnpack(fieldInfo,"newfld","fld"))

A: I think you need to do something more like this:
for field in fields:
    # add fields with the same properties
    arcpy.AddField_management(feature_class2,field.name)

but with more field properties being used as parameters.
The error message tells you that using the field object rather than accessing its properties is not an option.
If you were able to use a field object as a parameter with Add Field then that would appear in the Data Type column of the Syntax section of its Help (which it does not).

A: def batch_addfields(str_path_obj_out, str_path_obj_add, lst_str_fld_add):
    # str_path_obj_out      : absolute path to the feature class or table where the fields go
    # str_path_obj_add      : absolute path to the feature class or table from the fields come
    # lst_str_flds_add      : list of fields to add
    # assumes all field names are free in obj_out (OBJECTID should be rename)

    # Now this beatiful piece of idiomatic Python will (braggs) copy all properties
    # of n desired fields listed in lst_str_flds_add from str_path_obj_add into str_path_obj_out

    [arcpy.AddField_management(in_table = str_path_obj_out,
                                field_name = fld.name,
                                field_type = fld.type,
                                field_precision = fld.precision,
                                field_scale = fld.scale,
                                field_length = fld.length,
                                field_alias = fld.aliasName,
                                field_is_nullable = fld.isNullable,
                                field_is_required = fld.required,
                                field_domain = fld.domain
                                )
             for fld in arcpy.ListFields(str_path_obj_add)
             if fld.name in lst_str_fld_add]


text:
Q: C# Plugins and event handlers I'm trying to write some kind of plugin framework... The problem is:
I want to use methods from plugins as event handlers for controls in the host application and prevent loading plugin assembly into the main appdomain. The following code causes plugin.dll to be loaded into the main appdomain =( Is there any other way to do that?
Host application:
public partial class Form1 : Form
{
    private AssemblyLoader _aLoader = null;

    public Form1()
    {
        InitializeComponent();

        AppDomain _domain = AppDomain.CreateDomain("Remote Load");
        _aLoader = (AssemblyLoader)_domain.CreateInstanceAndUnwrap(
                                 "Loader", "Loader.AssemblyLoader");

        _aLoader.Load();

        EventHandler eh = (EventHandler)Delegate.CreateDelegate(typeof(EventHandler), _aLoader.Instance, _aLoader.Method);

        button1.Click += eh;
    }
}

AssemblyLoader:
[Serializable]
public class AssemblyLoader : MarshalByRefObject
{
    object _instance = null;
    MethodInfo _method = null;

    public void Load()
    {
        Assembly _assembly = Assembly.LoadFile(Environment.CurrentDirectory + @"\Plugin.dll");
        Type _type = _assembly.GetType("Plugin.Test");
        _instance = Activator.CreateInstance(_type);
        _method = _instance.GetType().GetMethod("TestEventHandler");
    }

    public MethodInfo Method
    {
        get { return _method; }
    }

    public object Instance
    {
        get { return _instance; }
    }
}

Plugin:
[Serializable]
public class Test
{
    public void TestEventHandler(object sender, System.EventArgs e)
    {
        MessageBox.Show("Pingback from plugin");
    }
}

A: Don't waste your valuable time writing your own framework. Use an existing:
http://clraddins.codeplex.com/
http://blogs.msdn.com/b/clraddins/
Also check this answer that talk about the comparison with MAF & MEF, the two popular frameworks.
Those framework as well written, they are .NET standard and well supported.


text:
Q: How do I resize labels, text fields, etc. in the IntelliJ Java Swing form? So, for example, I created a text field.

Tried to resize it

But once I release the mouse, it gets back to its original size

So how do I do it? How do I resize elements? And yes, I tried to change the minimum size, maximum size, preferred size but it does not work either, nothing happens.

A: You can do setLayout(null) on the parent or setPreferredSize on the components, either of which will allow you to resize your Components. But the best answer is to set your Font size to a larger size (setFont(...)) which will cause them to become bigger (have larger values in getPreferredSize) automatically.
JTextField tf = ...;
tf.setFont(tf.getFont().deriveFont(tf.getFont().getSize() * 2));


text:
Q: Try to store Object in iCloud but don't see any action iOS I use this tutorials to store object into iCloud (Key-value Storage).
My GUI had only one button that triggers: pressButton method
Here is a relevant code:
NSString *const keyStorageStr = @"keyForStore";

/* ... */

- (IBAction)pressButton:(UIButton *)sender {

    score++;

    [DemoiCloudViewController setScore: score];

    scoreCountLabel.text = [NSString stringWithFormat:@"%d", score];

    // store to preferences
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setInteger:score forKey:keyStorageStr];

    // store to iCloud
    [self setInteger:score forKey:keyStorageStr];
}

- (void)setInteger:(int)value forKey:(NSString*)key {
    [self setObject:[NSNumber numberWithInt:value] forKey:key];
}

- (void)setObject:(id)value forKey:(NSString *)key {

    NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
    if (store) {
        [store setObject:value forKey:key];
        //[store synchronize];
    }
}

And this is my handler:
NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore];
    if (store) {

        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(storeChanged:)
                                                     name:NSUbiquitousKeyValueStoreDidChangeExternallyNotification
                                                   object:store];

        [store synchronize];
    }

- (void)storeChanged:(NSNotification*)notification {/* .. never called .. */}

Here I get proper value: file://localhost/private/var/mobile/Library/Mobile%20Documents/76Z3CR95HF~com~wifi~icloud~WiFi-iCloud-Demo/
- (void)viewDidLoad
{
    [super viewDidLoad];

    ubiq = [[NSFileManager defaultManager]
                   URLForUbiquityContainerIdentifier:nil];
    if (ubiq) {
        NSLog(@"iCloud access at %@", ubiq);

        isIcloudActive = true;

    } else {
        NSLog(@"No iCloud access");
    }

When I added handler to listen on everything:
NSNotificationCenter *notifyCenter = [NSNotificationCenter defaultCenter];
    [notifyCenter addObserverForName:nil
                              object:nil
                               queue:nil
                          usingBlock:^(NSNotification* notification){
                              // Explore notification
                              NSLog(@"Notification found with:"
                                    "\r\n     name:     %@"
                                    "\r\n     object:   %@"
                                    "\r\n     userInfo: %@",
                                    [notification name],
                                    [notification object],
                                    [notification userInfo]);
                          }];

I get:
name:     _UIApplicationSystemGestureStateChangedNotification

     object:   (null)

     userInfo: (null)

From xCode iCloud stats:

Please help,
Thanks,

A: What happens if you delete your app and re-run it? Can you retrieve the value from iCloud? Unless there's some other configuration problem that you've not mentioned, my guess is that you can.
The reason: the notification that you're expecting to see only happens when the change comes from iCloud (I.e., originating from another device). The notification will not be triggered when you save a value -- why would it be? You already know the value that has been written!


text:
Q: LXC container network/routing issues I have been experimenting with LXC virtualisation in order to run virtual machines on a dedicated server, but am having trouble setting up the networking properly.
I am using veth bridged networking, as instructed here: http://blog.foaa.de/2010/05/lxc-on-debian-squeeze/ (the guide I used to setup the LXC container)
When I start the container, it functions fine, can access the Internet and accepts incoming connections to it's own IP. However, as soon as I start it, the networking on my host box (dedicated server) goes down completely, and will not come back until the server is rebooted.
The only thing I can think of that would be causing this is incorrectly configured bridging settings, however I'm not sure entirely what the proper ones should be. Any advice on how I could reconfigure this? Thanks.
Both the host node and the container itself are running Debian Squeeze, with packages upgraded to the latest versions.
Host node (dedicated server) network configuration (/etc/network/interfaces):
allow-hotplug eth0
auto br0
iface br0 inet static
    bridge_ports eth0
    bridge_fd 0
    bridge_stp off
    bridge_maxwait 0
    address 46.105.102.29
    netmask 255.255.255.0
    network 46.105.102.0
    broadcast 46.105.102.255
    gateway 46.105.102.254

LXC container network configuration (/etc/network/interfaces):
auto eth0
iface eth0 inet static
    address 94.23.153.205
    netmask 255.255.255.0
    broadcast 94.23.153.205
    post-up route add 46.105.102.254 dev eth0
    post-up route add default gw 46.105.102.254
    post-down route del 46.105.102.254 dev eth0

Container network configuration (from LXC config file):
lxc.utsname = paradox
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.hwaddr = 02:00:00:ba:47:a0
lxc.network.ipv4 = 94.23.153.205

A: Caveat: I'm not all that familiar with LXC. Regardless, I have a few observations that may be helpful, as I have quite a lot of experience with Debian networking, bridges, and VMs (specifically, qemu-kvm).
First of all, the guide explicitly states that you need to comment-out the eth0 configuration on the host's interfaces file, yet you have allow-hotplug eth0 in there. Comment that line out.
Secondly, when creating bridging setups involving physical interfaces like this, I like to add line(s) to the interfaces file to explicitly keep the physical interface(s) uninitialized. In this case, eth0 is to be added to the bridge, so I would have this:
iface eth0 inet manual

And finally, it is a little weird to have different subnets on the same bridge. Although it should work, LXC is still under heavy development, so it's possible that even slightly unconventional network setups could expose bugs. Try putting your VM on the same subnet as the host (46.105.102.0/24), so that you don't need to explicitly muck with routes in your VM.


text:
Q: Fieldset Not displaying inline I have a form with a birthday fieldset and I've tried multiple tags to force the fields to align in the same row. I have tried display: inline-block; inline; and block with no luck. Any help that you can provide would be greatly appreciated. Thank you!
this is my fieldset:
<fieldset class="birthday">
                 Birthday

                  <select class="select-style" name="BirthMonth">
                  <option value="">Month</option>
                  <option  value="01">January</option>
                  <option value="02">February</option>
                  <option value="03" >March</option>
                  <option value="04">April</option>
                  <option value="05">May</option>
                  <option value="06">June</option>
                  <option value="07">July</option>
                  <option value="08">August</option>
                  <option value="09">September</option>
                  <option value="10">October</option>
                  <option value="11">November</option>
                  <option value="12" >December</option>

                 </select>
                Day<input class="birthday" maxlength="2" name="BirthDay"  placeholder="Day" required="">
                Year <input class="birthyear" maxlength="4" name="BirthYear" placeholder="Year" required="">
              </fieldset>

this is my css:
    .quoteform2 fieldset.birthday {display: inline-block; border:0px; padding:0px; margin:0px;}
    .quoteform2 label.month {width: 135px;}
.quoteform2 .select-style {
  -webkit-appearance: button;
  -webkit-border-radius: 2px;
  -webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
  -webkit-padding-end: 20px;
  -webkit-padding-start: 2px;
  -webkit-user-select: none;
  background-image: url(images/select-arrow.png),
    -webkit-linear-gradient(#FAFAFA, #F4F4F4 40%, #E5E5E5);
  background-position: center right;
  background-repeat: no-repeat;
  border: 0px solid #FFF;
  color: #555;
  font-size: inherit;
  margin: 0;
  overflow: hidden;
  padding-top: 5px;
  padding-bottom: 5px;
  text-overflow: ellipsis;
  white-space: nowrap;}


text:
Q: How do I change the following query to a Zend Framework (1) query? Hello I have a working query but I'm kinda new to Zend how can I change the query below to a zend query?
SELECT
user_dob,
user_dob + INTERVAL(YEAR(CURRENT_TIMESTAMP) - YEAR(user_dob)) + 0 YEAR AS currbirthday
FROM user
ORDER BY CASE WHEN currbirthday < CURRENT_TIMESTAMP
THEN currbirthday + INTERVAL 1 YEAR
ELSE currbirthday
END
LIMIT 4

A: something Like this?, not tested,
$select = $sql->select ('user');

$select->columns(array(
            'user_dob',
            'currbirthday' => new Expression('user_dob + INTERVAL(YEAR(CURRENT_TIMESTAMP) - YEAR(user_dob)) + 0 YEAR')))
->order (
    new Expression('
        CASE WHEN currbirthday < CURRENT_TIMESTAMP
        THEN currbirthday + INTERVAL 1 YEAR
        ELSE currbirthday
        END'
    )
);


text:
Q: How do I know if a web page has opened in Jenkins? I want to set up Jenkins to interact with a web application and return results, but first I'm testing it out on webpage.
I simply want to interact with Random.org, to press a button to return a value, but I can't even seem to open the webpage itself.
I've tried the following code:
#Start-Process
$ie = New-Object -com InternetExplorer.Application

$ie.Navigate("https://www.random.org")
$ie.visible = $true
sleep 30

if( $ie.visible -eq $true)
    {
echo "Random.org opened"
   }
else
{
echo "Random.org did not open"
}

But this always returns the echo "Random.org did not open". I've realized now maybe $ie.visible -eq $true is not the best method to check with jenkins, as it is running in the background and cannot be seen. is there another way I can check to see if the webpage is opened?

A: Just query the busy property of your InternetExplorer.Application COM object:
#Start-Process
$ie = New-Object -com InternetExplorer.Application

$ie.Navigate("https://www.random.org")
while( $ie.busy){Start-Sleep 1}


text:
Q: Rendering of MediaWiki Infoboxes I've been creating templates based on Infoboxes on my local wiki (i.e., installed MediaWiki via Bitnami) but it isn't being rendered properly. I was hoping for a infobox similar to this one I created on Wikia.

instead I got

Granted the 1st is in the monobook skin and 2nd is in vector skin, hence I would expect some discrepancy, just not this much.

A: Actually, it looks like a simple matter of custom CSS. Wikia probably has some that your default vector skin doesn't.
Look at the classes on the generated HTML and add custom CSS for the differences (box background and border, header background, link color, font size). Then your infoboxes should appear the way you want.


text:
Q: How to represent same table (with different values) in a 1:N relationship with two other tables?
I have three tables:

*

*Guardian

*Student

*Address
One Guardian may have many Addresses and one Student may have many Addresses.
Observations:

*

*Guardian addresses can be exactly the same as the Students

*Guardian addresses can be different from the Student's

This:
addressLine1=Foo, addressLine2=Bar (Student)
is different from this
addressLine1=Foo, addressLine2=Bar (Guardian)
Just pointing out:

*

*One Guardian has many Students attached to it

*One Student has many Guardians attached to it

Guardian and Students has common attributes as well as specific ones.
Right now, I'm mapping as the snippet below:
CREATE TABLE address
  (
     id          BIGINT,
     /* OTHER FIELDS OMITTED */
     guardian_id BIGINT,
     student_id  BIGINT,
     PRIMARY KEY (id)
  )

CREATE TABLE guardian
  (
     id BIGINT,
     /* OTHER FIELDS OMITTED */
     PRIMARY KEY (id)
  )

CREATE TABLE student
  (
     id BIGINT,
     /* OTHER FIELDS OMITTED */
     PRIMARY KEY (id)
  )

ALTER TABLE address
  ADD CONSTRAINT constraint_id FOREIGN KEY (guardian_id)
  REFERENCES guardian

ALTER TABLE address
  ADD CONSTRAINT constraint_id FOREIGN KEY (student_id) REFERENCES
  student

Is this the right way? I mean, there's a better solution to this case?
*Address is not a join table if im correct. It's not made for relationship purposes. It has it's own specific fields.

A: Gardian -- M:M -- Address
Student -- M:M -- Address

You need two additional link tables like guardian_adresses and student_adresses to model this.

A: Why can't two students or two guardians have the same address?  You model limits this to one of each type.
You need junction/association tables for the two entities.  I would write this as:
CREATE TABLE addresses (
    addrees_id BIGINT PRIMARY KEY,
    . . .
);

CREATE TABLE guardians (
    guardian_id BIGINT PRIMARY KEY,
    . . .
);

CREATE TABLE students (
    student_id BIGINT PRIMARY KEY,
     /* OTHER FIELDS OMITTED */
);

CREATE TABLE guardian_addresses (
    guardian_address_id BIGINT PRIMARY KEY,
    guardian_id BIGINT NOT NULL,
    address_id BIGINT NOT NULL,
    . . .  -- other information such a date and who added
    constraint guardian_addresses_guardians foreign key (guardian_id) references guardians(guardian_id),
    constraint guardian_addresses_addresses foreign key (address_id) references addresses(address_id)
);

CREATE TABLE student_addresses (
    student_address_id BIGINT PRIMARY KEY,
    student_id BIGINT NOT NULL,
    address_id BIGINT NOT NULL,
    . . .  -- other information such a date and who added
    constraint student_addresses_guardians foreign key (student_id) references students(student_id),
    constraint student_addresses_addresses foreign key (address_id) references addresses(address_id)
);

You'll notice that this includes some other conventions:

*

*Tables are named in the plural, because they contain multiple copies of the entities.

*The primary keys are named in the singular with _id at the end.  That way, foreign key references generally use the same column name.

*The PRIMARY KEY is inline.


text:
Q: how can I use 'glGenVertexArrays' using android-ndk i'm trying to use the VertexArray with Android NDK for a project that already compiles ok and uses other Open GL ES calls ok.
For the purposes of this question let's talk about the call 'glGenVertexArrays' alone.
I found the following definition in gl2ext.h:
GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);

it is defined behind GL_GLEXT_PROTOTYPES definition. So I defined it and used it. It compiles fine but i'm getting link errors: undefined reference, so it seems it is missing from the lib file...
So, then I tried using the typedef below in gl2ext.h:
typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);

like this:
PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays;
glGenVertexArrays = (PFNGLGENVERTEXARRAYSOESPROC) eglGetProcAddress("glGenVertexArraysOES");

and ... nothing, returns NULL.
I also tries "glGenVertexArrays" ... nothing, still returns NULL
any ideas would be appreciated. Thank you.

A: You are trying OpenGL ES Extensions which may or may not be supported.
http://www.khronos.org/opengles/documentation/opengles1_0/html/glIntro.html
Just because it is in the standard header doesn't mean that Android or any particular implementation actually has that API.


text:
Q: wpf : how to show a data set in a grid view? i'm moving from windows form to wpf but now i have a problem.
i get info from database(sql server) and store that in a dataset and i want to show that in a datagrid (dg)
DataSet ds = new DataSet();
SqlConnection sc = new SqlConnection("mysqlconnection");
SqlDataAdapter sd = new SqlDataAdapter();
sc.Open();
sd.SelectCommand = new SqlCommand("SELECT * FROM table_1", sc);
sd.Fill(ds);
dg.DataContext = ds.Tables[0].DefaultView;//here is the problem
sc.Close();

in windows forms it was dg.DataSrouce but i can't find that in wpf, any help ?

A: Either add ItemsSource="{Binding}" to your DataGrid definition or change
dg.DataContext = ds.Tables[0].DefaultView;

to
dg.ItemsSource = ds.Tables[0].DefaultView;

Update
Try to add AutoGenerateColumns="True"
<DataGrid Name="dg"
          AutoGenerateColumns="True"
          ItemsSource="{Binding}"
          ...>


text:
Q: Как убрать opacity у дочернего элемента? Есть примерно такой код:

test test test

Вот тут реализация на jsfiddle - http://jsfiddle.net/U5CLR/
Как убрать opacity (точнее вернуть его к значению 1) для блока #block3?
Спасибо.
A: Выхода два:
а) Избавиться от наследования, вынести #block3 из #block2;
б) Избавиться от opacity, заменив его rgba(...) для цветов и полупрозрачными *.png для изображений.
A: полупрозрачность:
#block2
{
 background: rgba(255, 0, 0, 0.5); /*красный цвет поменяете на свой*/
}

opacity убрать надо везде
A: Как вариант, заменить бг на полупрозрачный пнг!


text: Q: Is there an option to generate a report in Jira to show all of the backups? I have a cron job that is set up to backup the system every day at low-traffic hours. However, I need a monthly report to show at which time the backup was created and if it was successfull. Could anyone help me with that?


text:
Q: Add non-click function inside of a click function I have the following problem. I have a .one("click") function with a variable that raises itself, and I need to add a function, that triggers, when the variable hits the wanted point. I mean, in the following code I need to use the connect function for the last 'last' img with the 'home' img, after the Result variable turns 9, which will produce a line between them, and I'll have a complete circle. Please read the code and try clicking on all img-es so that you can understand, what i need to achieve. Thanks in advance.
Here's the code:
$(document).ready(function() {
    var Result = 0;

    $('img').one("click", function(){
        if( $('img.home').length == 0 ){
                        $(this).addClass('home');
        }

        if(Result <= 9){
            var $elem2 = $('span.last');
            var $elem1 = $(this).parent();
            $(this).toggleClass('selected');

            if ($elem2.length > 0) {
                connect($elem1[0], $elem2[0], "#0F0", 5);
            }
            else {
                $elem1.addClass('last');
            }

            $('span').removeClass('last');
            $elem1.addClass('last');
            Result++;
        }
    });

});

function connect(div1, div2, color, thickness) {
    var off1 = getOffset(div1);
    var off2 = getOffset(div2);
            // bottom right
    var x1 = off1.left + off1.width;
    var y1 = off1.top + off1.height;
            // top right
    var x2 = off2.left + off2.width;
    var y2 = off2.top;
            // distance
    var length = Math.sqrt(((x2-x1) * (x2-x1)) + ((y2-y1) * (y2-y1)));
        distanz += parseInt(length);
            // center
    var cx = ((x1 + x2) / 2) - (length / 2);
    var cy = ((y1 + y2) / 2) - (thickness / 2);
            // angle
    var angle = Math.atan2((y1-y2),(x1-x2))*(180/Math.PI);
            // make hr
    var htmlLine = "<div style='padding:0px; margin:0px; height:" + thickness + "px; background-color:" + color + "; line-height:1px; position:absolute; left:" + cx + "px; top:" + cy + "px; width:" + length + "px; -moz-transform:rotate(" + angle + "deg); -webkit-transform:rotate(" + angle + "deg); -o-transform:rotate(" + angle + "deg); -ms-transform:rotate(" + angle + "deg); transform:rotate(" + angle + "deg);' />";
htmlLine = $(htmlLine);

    $('body').append(htmlLine);
    return htmlLine;
}

function getOffset( el ) {
    var x = 0;
    var y = 0;
    var w = el.offsetWidth|0;
    var h = el.offsetHeight|0;
    while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) {
            x += el.offsetLeft - el.scrollLeft;
            y += el.offsetTop - el.scrollTop;
            el = el.offsetParent;
        }
    return { top: y, left: x, width: w, height: h };
}

jsfiddle: http://jsfiddle.net/CDQhX/4/
I want to execute the connect(home and span images) after the last line is done and the Result is 9. This can't be done inside the click function, since I'm not clicking anywhere to trigger it. My knowledge don't let me work the problem around. So I appreciate any help. I'll be really glad to receive answers.

A: First of all, what do you mean you are not clicking anywhere and you want it executed when the last img is clicked. Can't you just check if the img is last when it is clicked, and execute what you need?
Also, on the other hand, you can try setTimeout and setInterval as described here: http://www.w3.org/TR/2011/WD-html5-20110525/timers.html
So, for example, you could do something like this:
setInterval( function() {
  //do your thing
}, 500);

Which will execute the function every 500 milliseconds, so you could use that for periodic checking of your variables.


text:
Q: Ontology Representation of this sentence I have a problem in Protege to represent this sentence in ontology protege
"DeveloperCSharp is an Engineer who is expert in C# not in Java and Python" My ontology image


text:
Q: Find one word and replace it with a list in VS code I'm looking for a way to find one character (for example "#" ) and replace it with a list in Visual studio code.
The list would be

https:/example/12323.jpg
https:/example/224342.jpg
https:/example/31213.jpg
....
....
....
....
+ 500 more

For example:

+500 more

# To be replaced by elements on my list like this:

Is there any way to do that in VS code with the find and replace feature and regular expression maybe?
Thanks in advance.


text:
Q: Totally real Galois extension of given degree
Let $n≥1$ be an integer. I would like to prove (or disprove) the existence of a subfield $K \subset \Bbb R$ such that $K/\Bbb Q$ is Galois and has degree $n$.

It is easy to construct such a subfield for $n=2^k$: one can take $K=\Bbb Q(\sqrt 2, \sqrt 3, \sqrt 5, ..., \sqrt{p_k})\;$ where $p_k$ is the $k$-th prime number.
I found that the irreducible polynomial $x^3-6x+2 \in \Bbb Q[X]$ (Eisenstein's criterion with $p=2$) has three real roots, so its splitting field $K$ satisfies my conditions for $n=3$. Then I'm done with $n=3\cdot 2^k$ thanks to compositum of fields.
Apparently, a Galois extension of odd degree must be totally real. In all cases, I don't know how to construct, in general or in particular cases ($n$ prime for instance), such a totally real Galois extension $K/\Bbb Q$ of degree $n$.
Thank you for your help!

A: Fix $n$, and choose a prime $p$ such that $p\equiv 1$ (mod $2n$). Dirichlet's theorem on primes in arithmetic progressions guarantees the existence of infinitely many such primes.
If $K=\mathbb{Q}(\zeta_p)$, then $K$ is a Galois extension of $\mathbb{Q}$ with $\mathrm{Gal}(K/\mathbb{Q})$ cyclic of order $p-1$. If $F=\mathbb{Q}(\zeta_p+\zeta_p^{-1})$ then $F$ is totally real and $[K:F]=2$, hence $F$ is Galois over $\mathbb{Q}$ with $\mathrm{Gal}(F/\mathbb{Q})$ cyclic of order $\frac{p-1}{2}$.
Now $n$ divides $\frac{p-1}{2}$ by our choice of $p$, hence $G=\mathrm{Gal}(F/\mathbb{Q})$ has a subgroup $H$ of index $n$. Let $E=F^H$, then $E$ is Galois over $\mathbb{Q}$, is totally real, and $[E:\mathbb{Q}]=[G:H]=n$.


text:
Q: This is (a) team work
*

*This is team work.

*This is a team work.

Which is correct?
You work or collaborate together with someone is the intended meaning.

A: If you are referring to the quality of people working together as a team, then say teamwork - one word.  But you have to be talking about people and not an activity.
Work as a noun means "a productive activity" or "a result of a productive activity."  A person, however, is typically not considered a work (though his/her parents may disagree).
So you can qualify the noun work with the word team to mean something like "a productive activity for the team" or "the result of a productive activity by the team", but this does not really translate to "a quality of people working together as a team."
Idiomatically, no one says "This is a team work" because of possibility of confusion with teamwork.  You can say the more common string of words "This is a team effort" to mean that an effort should not be done by one person.

A: This is team work. (For nouns)
Without including "a" it's similar to say
"This is stackexchange.com" or
"This is E entertainment television"
It's correct if we're trying to say that this what we do represents the truly team work (noun)
This is a team work. (for the action of do things together)
Including "a" it's correct if we mean that We do this together, this(action) is a team work, you know why? because we're a team, teams do team work (noun).
I hope it helps!

A: 1, This is team work, is most correct, but would only be used in very specific cases.

Great job guys in setting up the reception hall, this is team work! (While pointing to the work just done.)

The noun form of this expression is most often "Team Effort".

We've got an hour to set up the reception hall, let's make this a team effort.


text:
Q: Conditions for a map to be $\mathbb{R}$-linear Given a map $f:\mathbb{R}^m\rightarrow \mathbb{R}^n$, is the condition that for all $x,y$ in $\mathbb{R}^m$, $f(x+y)=f(x)+f(y)$ enough for $f$ to be $\mathbb{R}$-linear? I cannot prove it or think of a counter example.

A: It should also satisfy:
$$f(ax)=af(x).$$


text:
Q: Modal not closing the embedded iframe of a video I have this demo of a video in my footer which is using my external CSS files and works fine.

But when I actually added it the project, it will do everything other than close the video. After pressing the play button in the footer, a modal fills the screen but apparently not the entire screen.

But when I click to close, the modal closes but not the iframe

Here is my code
HTML

BruxZir Hammer Test

Watch how it holds up to a hammer

CSS
.homepage-video { background-color: black; }
.homepage-video { background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/101702/lab-interior.jpg'); }
.homepage-video {
  background-position: center -60px;
  background-repeat: no-repeat;
}
.homepage-video { background-size: cover; }

.hv-container {
  background-color: rgba(30,30,4, 0.6);
  min-height: 240px;
  position: relative;
}
.hv-player {
  width: 320px;
  max-width: 100%;
  margin: 0 auto;
  position: absolute;
  top: 30px;
  left:0; right: 0;
  padding-top: 20px;
  text-align:center;
}
.hv-player, .hv-player h3, .hv-play { color: #f4f3f3; }
.hv-play {
  border: 3px solid #fff;
  cursor:pointer;
  padding: 4px 18px;
  border-radius: 13px;
  font-size: 30px
}

/* reset for IE*/
body { height:100%; margin:0; padding:0; }
/* code */
#overlay {
  visibility: hidden;
  position: absolute;
  left: 0px;
  top: 0px;
  width:100%;
  height:100%;
  z-index: 1000;
}

#overlay { background-color: #222;}
/* must have these resets */
html, body{ height: 100%; padding: 0; margin: 0;}

/* code begins*/
.featured-video { height: 100%; width: 100%; }
.featured-video iframe {
  height: 100%;
  width: 100%;
  margin-right: auto;
  margin-left: auto;
  vertical-align: middle;
}
#overlay i {
  color: #999;
  font-size: 48px;
  margin: 10px;
}

JS
function overlay() {
  el = document.getElementById("overlay");
  el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
}

A: Try using:
display: none
// and
display: block

instead of
visibility: hidden
// and
visibility: visible

Ive updated the demo here:
http://codepen.io/anon/pen/tBKnc


text:
Q: Visual Studio 2012, virtual keypress combination I am a newbie in Visual studio,
I don't know how to press keyboard keys virtually.
    If (text1.Text = 1) Then
        'code for CTRL+DOWN
    End If
    If (text1.Text = 2) Then
        'code for CTRL+UP
    End If

I have no idea how to press keys virtually,
Please help

A: I like to use Windows Input Simulator. You can make combinations with this library.
InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_C)


text:
Q: Random order numbers in the opencart I have a website in opencart and currently its running very good but the problem is the random order number one order number is 3361 and the second order number is 3381 for the same day. I can't understand where is all those 20 order goes. Please provide me the method how to solve this problem so that i can get the order number in serial.

A: The truth is:
OpenCart creates new order anytime the "Order Confirm" page is displayed. This is the last step in ordering process after which the order is confirmed and pending and emails are sent.
However anytime on confirm page a user hits page refresh or goes back to change something and comes back on confirm page (step) again a new order ID is generated (in other words, a new order is created while throwing that older one away).
This is why sometimes between two real orders the ID is not continuous - but if You opened up Your phpMyAdmin and looked at the orders table You would find out that there are IDs continuously used by orders that are unfinished thus not visible in administration.

A: I think opencart allocate an order number to each client when they plug an item to cart.
Then if the client doesn't finalize the purchase and clear the cart that number is simply forgotten.


text:
Q: Using jqGrid on IIS7 I have jqGrid running fine locally in VS 2008 in a ASP.NET MVC project. When I upload the project to the server (W2008, IIS7) I get an error in IE 8, Object doesn't support this property or method on the call to jqGrid. In Firebug -  jqGrid is not a function. All other JQuery plugins works fine (before and after the upload). Any ideas what could be causing this?

A: I found the problem was with the var pathtojsfiles in the jquery.jqGrid.js file. /scripts/js/ works fine locally, but on the server I had to use the full path http://servername/project/Scripts/js/"

A: I had a different problem with JQGrid on IIS7.5 where the columns were displaying but there was no data in the grid. Changing the app pool of the application to the classic app pool fixed this..bit of a weird one.


text:
Q: svn revert a single property on a directory? How can I revert one of several properties on a directory from svn command line?
My svn trunk has a property svn:externals to import an external repo.
/trunk
  svn:external = /external/trunk

When I set up a new branch foo, the external is changed to point to a branch as well:
/branches/foo
  svn:external = /external/branches/foo

Sometimes when I merge a branch back into the trunk, that property gets copied over and I end up with:
/trunk
  svn:external = /external/branches/foo

Normally I could run svn revert . --depth=empty to undo the property merge, but there are other properties on the dir that would be reverted as well, specifically svn:mergeinfo. From my GUI client I can revert individual properties pretty easily, but I don't always remember to do so. Is there a way to do the same thing directly from svn cmd line, or do I need to write some crazy wrapper for svn propget to get and undo the diff?

A: svn propset svn:externals "$(svn propget svn:externals . -r HEAD)" .
this sets the property to the HEAD value.  This is a valid workaround since revert can only be applied to all properties, and doesn't exist for individual properties.

A: For my future reference more than for you, seeing as you probably have the answer...
svn propget PROPNAMETOREVERT `svn info | perl -ne 'print if s/URL: (.*)/\1/'` | perl -ne 'chomp; print' | svn propset PROPNAMETOREVERT  -F - .

Worked for me (on a one line property, might need modification for one with multiple lines).
Which could clearly do with being a script :-)


text:
Q: Dynamically change carousel images based on click event I have 3 elements arranged in a row. I want to show a carousel pop-up on click of the columns in the row. The issue is I am not able to change the images of carousal based on selected column element.
Here is my complete code:

 <!DOCTYPE html>

      <title>Bootstrap Example</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

The above code generates the below output:

On click of any image it is loading the carousal but the images of carousal are fixed to my array elements var m = ['img_chania.jpg','img_chania2.jpg', 'img_flower.jpg','img_flower2.jpg']; as mentioned in my above code.
But I want to show only the selected images which are present in my input json shops.categories[selectedItem].images
I tried using onclick javascript event on column element, but the code is not recognising it. What is the correct way to do this.
I want to do this using plain javascript.

A: First you need to get rid of the call to processCarousel(); in line 39.
Your main problem is, that inside of your content variable you are passing the string of the argument variable rather than the argument itself. Try this instead:
content += '
';

This way you are just passing the index of the category that needs to be rendered.
Then you will have to have the shops object available inside of the processCarousel function as well, so I moved it up, outside the function scope.
This will result in further problems inside of you processCarousel function. You will have to set your your images like this var m = shops[i].images; instead of var m = ['img_chania.jpg', 'img_chania2.jpg', 'img_flower.jpg', 'img_flower2.jpg'];
This will throw another error further down.
innerContent += '

'; will not work. Instead you will have to use m[i].href as your source inside your image tag.
This will now pass the config to the Carousel which will then render just fine.
You might want to think about giving variables speaking names and avoiding variables like 'm'.
var shops = JSON.parse('{ "id": "shopping", "categories": [ { "id": "Amazon", "name": "Amazon", "link": "https://images-na.ssl-images-amazon.com/images/G/01/SellerCentral/legal/amazon-logo_transparent._CB303899249_.png", "images": [ { "href": "https://images-na.ssl-images-amazon.com/images/G/01/credit/img16/CBCC/marketing/marketingpage/products._V524365396_.png" }, { "href": "http://static4.uk.businessinsider.com/image/575adbe2dd0895c4098b46ba/the-50-most-popular-products-on-amazon.jpg" } ] }, { "id": "Google", "name": "Google", "link": "http://pngimg.com/uploads/google/google_PNG19644.png", "images": [ { "href": "https://www.clipartmax.com/png/middle/147-1476512_google-google-products-logos-png.png" }, { "href": "https://xvp.akamaized.net/assets/illustrations/unblock-google/unblock-google-with-a-vpn-fc1e32f59d9c50bae315c2c8506a91e2.png" } ] }, { "id": "Apple", "name": "Apple", "link": "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8a/Apple_Logo.svg/2000px-Apple_Logo.svg.png", "images": [ { "href": "https://c.slashgear.com/wp-content/uploads/2018/03/apple-mfi-logos-update-2018-980x620.jpg" }, { "href": "https://support.apple.com/library/content/dam/edam/applecare/images/en_US/applemusic/itunes-apple-logo-apple-music-giftcard.jpg" } ] } ] }');
var row = 1;
var content = "";
shops = shops.categories;

function process() {
  for (var i = 0; i < shops.length; i++) {
    if (row == 1) {
      content += '
'
    }
    content += '
';
    content += '
';
    if (row == 3) {
      row = 0;
      content += '
';
    }
    row++;
  }
  document.getElementById("placeholder").innerHTML = content;
}

function processCarousel(i) {
  //var m = ['img_chania.jpg', 'img_chania2.jpg', 'img_flower.jpg', 'img_flower2.jpg'];
  var m = shops[i].images;
  var carouselInner = document.getElementById("carousel-inner");
  var carouselIndicators = document.getElementById("carousel-indicators");
  var innerContent = "";
  var indicatorsContent = "";
  for (var i = 0; i < m.length; i++) {
    var c = "";
    if (i == 0) {
      c = " active";
    }
    innerContent += '

';
    indicatorsContent += '

';
  }
  carouselInner.innerHTML = innerContent;
  carouselIndicators.innerHTML = indicatorsContent;
  var carouselExampleGeneric = document.getElementById("carousel-example-generic");
  //carouselExampleGeneric.carousel();
}


text:
Q: How to make text up and under the transform widget?
I'm trying to make this particular UI and I can't figure out how to create the 'Playlist for you:' and 'Playlist of the week' up and down the transform widget respectively.
This is my main.dart file.

import 'package:flutter/material.dart';
import 'package:secondlife_mobile/PageViewHolder.dart';
import 'package:provider/provider.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Perspective PageView',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  late PageViewHolder holder;
  late PageController _controller;
  double fraction =
      0.57; // By using this fraction, we're telling the PageView to show the 50% of the previous and the next page area along with the main page

  @override
  void initState() {
    super.initState();
    holder = PageViewHolder(value: 2.0);
    _controller = PageController(initialPage: 2, viewportFraction: fraction);
    _controller.addListener(() {
      holder.setValue(_controller.page);
    });
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
        child: Scaffold(
      appBar: AppBar(
        title: const Text("Perspective PageView"),
      ),
      body: Container(
        child: Center(
          child: AspectRatio(
            aspectRatio: 1,
            child: ChangeNotifierProvider<PageViewHolder>.value(
              value: holder,
              child: PageView.builder(
                  controller: _controller,
                  itemCount: 4,
                  physics: const BouncingScrollPhysics(),
                  itemBuilder: (context, index) {
                    return MyPage(
                      number: index.toDouble(),
                      fraction: fraction,
                    );
                  }),
            ),
          ),
        ),
      ),
    ));
  }
}

class MyPage extends StatelessWidget {
  final number;
  final double? fraction;

  const MyPage({super.key, this.number, this.fraction});

  @override
  Widget build(BuildContext context) {
    double? value = Provider.of<PageViewHolder>(context).value;
    double diff = (number - value);
    // diff is negative = left page
    // diff is 0 = current page
    // diff is positive = next page

    //Matrix for Elements
    final Matrix4 pvMatrix = Matrix4.identity()
      ..setEntry(3, 2, 1 / 0.9) //Increasing Scale by 90%
      ..setEntry(1, 1, fraction!) //Changing Scale Along Y Axis
      ..setEntry(3, 0, 0.004 * -diff); //Changing Perspective Along X Axis

    final Matrix4 shadowMatrix = Matrix4.identity()
      ..setEntry(3, 3, 1 / 1.6) //Increasing Scale by 60%
      ..setEntry(3, 1, -0.004) //Changing Scale Along Y Axis
      ..setEntry(3, 0, 0.002 * diff) //Changing Perspective along X Axis
      ..rotateX(1.309); //Rotating Shadow along X Axis

    return Stack(
      fit: StackFit.expand,
      alignment: FractionalOffset.center,
      children: [
        Transform.translate(
          offset: const Offset(0.0, -47.5),
          child: Transform(
            transform: pvMatrix,
            alignment: FractionalOffset.center,
            child: Container(
              decoration: BoxDecoration(boxShadow: [
                BoxShadow(
                  color: Colors.grey.withOpacity(0.5),
                  blurRadius: 11.0,
                  spreadRadius: 4.0,
                  offset: const Offset(
                      13.0, 35.0), // shadow direction: bottom right
                )
              ]),
              child: Image.asset(
                  "assets/images/image_${number.toInt() + 1}.jpg",
                  fit: BoxFit.fill),
            ),
          ),
        ),
      ],
    );
  }
}

And this is how the result of the main.dart file looks like.
I've tried implementing the Column widget with a Text near the Stack widget but my vscode responded that it is a dead code.
I would be very grateful if I could figure out this problem :)

A: Wrap your body in a Column() preceded by a SingleChildScrollView() coz you'll have to scroll vertically too with it's content not overflowing the screen
body:SingleChildScrollView(
    child: SizedBox(
          height:MediaQuery.of(context).size.height,
         child: Column(
               crossAxisAlignment:CrossAxisAlignment.start,
             children:[
       ////Your Playlist for you text
              Text('Playlist for you'),
             const SizedBox(height:15.0),
             Container(
        child: Center(
          child: AspectRatio(
            aspectRatio: 1,
            child: ChangeNotifierProvider<PageViewHolder>.value(
              value: holder,
              child: PageView.builder(
                  controller: _controller,
                  itemCount: 4,
                  physics: const BouncingScrollPhysics(),
                  itemBuilder: (context, index) {
                    return MyPage(
                      number: index.toDouble(),
                      fraction: fraction,
                    );
                  }),
            ),
          ),
        ),
      ),
       const SizedBox(height:15.0),
       ////Your Playlist of the week text
              Text('Playlist of the week'),

         ],
       ),
     ),
   ),


text:
Q: Explosion of a Markov chain I am considering a Markov chain i continunous time  on the countable state space $S=\lbrace 0 \rbrace\cup \lbrace (i,j) \mid i \in \lbrace A,B,C,D,E,F \rbrace , j \in \mathbb{N} \rbrace$. The transistion intensities are gived by
\begin{align}
q_{(i,j),(i,j+1)} & =j\beta_i,& j\in \mathbb{N},\ i\in \lbrace A,B,C,D,E,F \rbrace \\
q_{(i,j),(i,j-1)} & =j\delta_i,& j\geq 2,\ i\in \lbrace A,B,C,D,E,F \rbrace\\
q_{(i,1),0} & =\delta_i,& i\in \lbrace A,B,C,D,E,F \rbrace\\
q_{0,(i,1)} & =1,& i\in\lbrace A,B,C,D,E,F \rbrace
\end{align}
Now my problem is to give a heuristic argument that explosion does not occur for instance by giving a lower bound on the expected time of the n-th jump of the Markov chain.
I have drawn the transition diagram for the chain, and I understand the structure of the process, but I can't get on with the problem.
I have a theorem which says that explosion is possible iff
$$\sum_{i=1}^\infty \frac{1}{\beta_i}+\frac{\delta_i}{\beta_i\beta_{i-1}} + \cdots + \frac{\delta_i\cdots \delta_1}{\beta_i\cdots \beta_0}<\infty$$
where $\beta_i=q_{i,i+1}$, $\delta_{i+1}=q_{i+1,i}$ and $-(\beta_{i+1}+\delta_{i+1})=q_{i+1,i+1}$ are the intensities for the process, but I cant find the right expression for the sum. I hope someone can help!


text:
Q: Converting to Ionic 4, but old Ionic 3 pages appear on second run I am converting an existing Ionic 3 app to Ionic 4. The first time I run the app on an Android emulator, I get the new Ionic 4 app. The second time I run the same app, I get the Ionic 3 app!
I did the conversion by starting with a new Ionic 4 starter project, generating new pages etc and then migrating the content into the new pages from the Ionic 3 app.
I build the new app with ionic cordova build android and it generates an APK: platforms/android/app/build/outputs/apk/debug/app-debug.apk
I install the APK on an emulator with adb install -r platforms/android/app/build/outputs/apk/debug/app-debug.apk
Then, as I described, the first time the app runs, it shows the new Ionic 4 app. I know it's the new app because I've added "Ionic 4" to the top nav toolbar. Then if I dismiss the app and run it again, I get the old Ionic 3 app come up instead. It's not even the current version of the Ionic 3 app - it's some older version of the app. I don't know where it's getting this old source from.
If I uninstall the app and re-install it, I again get the new Ionic 4 app one time only before it goes back to the Ionic 3 app.
I've tried:

*

*Creating a brand new emulator, so the Ionic 3 app has never been installed on it. No change.

*Removing and re-adding the android platform. No change.

*Checked that the pages are definitely only in my project once (so I don't have version 3 and 4 pages together).

*Tried debug and release builds. No change.

Any thoughts? I'm running out of ideas.

A: Install Ionic 4 Globally

ionicframework

npm install -g ionic

A: I finally found the answer. The Ionic 4 app now includes the cordova-plugin-ionic plugin, which will automatically attempt to upgrade the app at runtime from the Ionic Pro repository. This upgrade runs in the background by default when you launch the app. We had an Ionic 3 version of the app in the Ionic Pro repository, with the same APP_ID as the Ionic 4 app. So when our Ionic 4 app ran, it silently "upgraded" itself to the Ionic 3 version of the app. Then the next launch of the app would run the Ionic 3 version of the app.


text:
Q: How to use if condition inside if I want to use an If() inside an If() statement. Is it possible without putting Else() before.
My Code:
For i = 3 To 24
  If i < 25 Then
    sourcef = Sheets("Macro Control").Range("B" & i)
    fname = "Z:\ISC-Product Costing\Manufacturing Controlling\03_BUDGETS\2019\Chocolate\OP'19\Reporting\Plant Submission\OP'19 Deck " & sourcef & ".xlsx"
    Workbooks.Open fname, UpdateLinks:=0
    Set wC3 = ActiveWorkbook
    Set wC1 = wC3.Sheets("Conversion P&L")
    Set wC2 = ThisWorkbook.Sheets(sourcef)
    Sheets("Conversion P&L").Select
    ThisWorkbook.Activate
    Sheets(sourcef).Select
    Call CompareColumns
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "EUR"
    Range("B2").Select
    ("some more Code")

    wC3.Activate
    ActiveWindow.Close savechanges:=False
  Else
  End If
Next i

(some more code)
End Sub

I want to add one more If after Call CompareColumns. How to do it?
Call CompareColumns is another macro in which value for "same" will be defined as True or False. I want to add If Same = True then "Code continues" Else go to wc3. Activate.

A: You can use as much 'If' as you want. And you also dont need to use the else case.
If .... Then

   If .... Then
   ....
   Else
   ....
   End If

End If

In your case:
If i < 25 Then
   Code...
 If i < 25 Then
   Call CompareColumns
   Rest of code....
 Else
  wc3.Activate
  Rest of code....
 End If
End If

A: If you need more if you can use select case:
i.e.
Select Case yourInput
    Case Is <= 25
        'your code
    Case Is >= 70
        'your code
    Case Else
        'your code
End Select