text:
Q: Browsers reported SSL error when one of the server {..} blocks in NGINX configuration was removed After deleting a server {..} block from NGINX configuration and keeping two other server {..} block strange SSL errors starting showing up on the browsers:

*

*Chrome reported the error ERR_SSL_PROTOCOL_ERROR

*Firefox reported SSL_ERROR_RX_UNEXPECTED_NEW_SESSION_TICKET

*Curl reported gnutls_handshake() failed: An unexpected TLS packet was received
For some strange reason, these browser errors took place after removing one of the server {..} blocks and restarting NGINX. Running nginx -t before the restart showed a valid NGINX configuration with no problems. However, the restart introduced these problems.
I'm using Let's Encrypt certificates.
nginx -V

OUTPUT:
nginx version: nginx/1.14.0
built with OpenSSL 1.0.2g  1 Mar 2016
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_secure_link_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-threads --add-module=/build/nginx-1.14.0/debian/modules/headers-more-nginx-module --add-module=/build/nginx-1.14.0/debian/modules/nginx-auth-pam --add-module=/build/nginx-1.14.0/debian/modules/nginx-cache-purge --add-module=/build/nginx-1.14.0/debian/modules/nginx-dav-ext-module --add-module=/build/nginx-1.14.0/debian/modules/nginx-development-kit --add-module=/build/nginx-1.14.0/debian/modules/nginx-echo --add-module=/build/nginx-1.14.0/debian/modules/ngx-fancyindex --add-module=/build/nginx-1.14.0/debian/modules/nchan --add-module=/build/nginx-1.14.0/debian/modules/nginx-lua --add-module=/build/nginx-1.14.0/debian/modules/nginx-upload-progress --add-module=/build/nginx-1.14.0/debian/modules/nginx-upstream-fair --add-module=/build/nginx-1.14.0/debian/modules/ngx_http_substitutions_filter_module --add-module=/build/nginx-1.14.0/debian/modules/passenger/src/nginx_module

A: After investigating this for so much time, the only thing that solved it was:

*

*Moving all the ssl_session_tickets off; outside the server {...} blocks in NGINX

*Add a single line inside the http {..} block of nginx with:

http {
...
    ssl_session_tickets off;
...
}

The answer here helped alot:

ssl_session_tokens off breaks if it's not set the same for all
ssl-enabled server{} blocks. So if you have 2 server configurations
and and you have ssl_server_tokens set to on in one (which is the
default so it counts even if you omit it) and set to off in another,
it will break the one where it's set to off in certain browsers. The
easiest way to resolve this, unless you have multiple http{} blocks,
is to just set it to off in the http{} block. I have not tested to see
if you you can have different settings in different http{} blocks as I
haven't had need to set up more than one http{} block.

Although it might not be the exact same case, but the suggestion for moving ssl_session_tickets off; to the http {..} block and remove them from all server {..} blocks fixed the problem for me.


text:
Q: Query Notification Error We have this weird issue regarding SQL Query Notification service.
We have a main web application running with QN service so the cache item in the web get notification from SQL when the monitoring data changed. And it runs well.
   What is weird is when the other supporting web service tries to register QN subscription into SQL 2005 SP2 and this error occurs
"System Exception: SqlDependency.Start has been called for the server the command is executing against more than once, but there is no matching server/user/database Start() call for current command "
This error only happen when SQL query in SQLDependency against particular instance DB. The other instance DB works just fine.
There are not much resource can be found for QN / service broker issues. Wish anyone has similar experience can share their knowledge.

A: This is one of those SQL Server subject areas where there are not too many knowledge experts available out there, inluding dare I say, myself ;-)
My suggestion would be to post your query on the official SQL Server Service Broker Forum over at MSDN. Link below for reference:
http://social.msdn.microsoft.com/Forums/en-US/sqlservicebroker/threads

A: this means that the Start() method has already been called for this DB.
the start method has the restrictions you can see here at the bottom.

A: This is not a direct answer on the topic, but on the issue of QN/SSB resources I have a few articles on my site:

*

*http://rusanu.com/2006/06/17/the-mysterious-notification/

*http://rusanu.com/2008/01/04/sqldependencyonchange-callback-timing/

*http://rusanu.com/2007/11/10/when-it-rains-it-pours/

*http://rusanu.com/2005/12/20/troubleshooting-dialogs/
I am a former developer with the SQL Server team and I was involved with both Service Broker and, to more or less degree, with its in-house uses like Query Notifications and SqlDependency, Event Notifications, dbMail etc.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to add angular2-select in each row of table in angular2.Each row having checkbox. I added the checkbox in each row of table and each row having angular2 select also.I checked the first and second row.Then I select from first row's angular2 select.I want the selected option of first row should updated to all checked row angular2 select.But it is not updating the select checked row angular2 select.

I checked two rows and select "kray" value of first ng-select but it is not updating the second row ng-select.The second ng-selct selected value should be "kray"
Please help me.

Here is my code

        <input type="checkbox" value={{tr.id}}
            class="checkedauditors"
            id={{tr.checkboxId}}
            (click)="toggleCheck(tr,i)"
            [(ngModel)]="tr.status"
            >
            {{tr.clientCode}}
            {{tr.carrierCode}}

<my-date-picker [options]="myDatePickerOptions" id={{i}}
                (dateChanged)="onDateChanged($event)"
                [selDate]="selectedDate"
                >
                </my-date-picker>

        <ng-select id={{i}}
          [options]="optss"
          placeholder="{{tr.assignee}}"
          formControlName="selectSingle"
          (opened)="onSingleOpened1(i)"
          (closed)="onSingleClosed1()"
          (selected)="onSingleSelectedManager1($event,i)"
           [(ngModel)]="hideSelectedAuditor"
          (deselected)="onSingleDeselected($event)">
        </ng-select>

The JSON
{
    [{
        "clientCode": "NIKE",
        "carrierCode": "FDE",
        "auditDeadlineDate": "11/11/2016",
        "assignee": "Flansdon",
    }, {
        "clientCode": "NIKE",
        "carrierCode": "FDE",
        "auditDeadlineDate": "05/29/2017",
        "assignee": "Flansdon"
    },{
        "clientCode": "NIKE",
        "carrierCode": "FDE",
        "auditDeadlineDate": "06/01/2017",
        "assignee": "Flansdon"
    }],
}

mydata.ts file below
  onSingleSelectedManager1(item,index) {
    console.log("This is Index",index);
    for(let i=0;i<this.checkedArray.length;i++){
      this.checkedArray[i].assignee = item.label;
    }
  }

A: for this input you should use nested componenst.
In this component you should give the data back to the parent component by a click event.
i set up a little app to show you what i mean
test.component.ts (parent)
    import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-test',
  templateUrl: './test.component.html',
  styleUrls: ['./test.component.css']
})
export class TestComponent implements OnInit {
data: any=
    [{
        "ID":1,
        "clientCode": "NIKE",
        "carrierCode": "FDE",
        "auditDeadlineDate": "11/11/2016",
        "assignee": "Flansdon",
    }, {
        "ID":2,
        "clientCode": "NIKE",
        "carrierCode": "FDE",
        "auditDeadlineDate": "05/29/2017",
        "assignee": "Flansdon"
    },{
        "ID":3,
        "clientCode": "NIKE",
        "carrierCode": "FDE",
        "auditDeadlineDate": "06/01/2017",
        "assignee": "Flansdon"
    }]

   constructor(){}

  ngOnInit() {

  }

  Output(event){
      console.log(event)
  }

}

test.component.html

  {{tr.clientCode}}
  {{assignee}}

    <app-count [id]="tr.ID" (output)='Output($event)'></app-count>

count.component.ts (child)
    import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';

@Component({
  selector: 'app-count',
  templateUrl: './count.component.html',
  styleUrls: ['./count.component.css']
})
export class CountComponent implements OnInit {
  @Input() id: any
  @Output() output: EventEmitter<any> = new EventEmitter<any>()

  count: any
  constructor() { }

  ngOnInit() {
    console.log(this.id)
  }
  onClick(id) {
    var o: any = { id: id, count: this.count }
    this.output.emit(o)

  }
}

count.component.html
    <select [(ngModel)]="count" (click)='onClick(id)'>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>

so in this case you will get back an object with ID and the select choice.
in the function Output you can do the magic
you can also read this article about nested components
Nested Components

A: html:
<ng-select [(ngModel)]="count" (click)='onClick(id)'
  [options]="optss">
</ng-select>

ts:
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';

@Component({
  selector: 'app-count',
  templateUrl: './count.component.html',
  styleUrls: ['./count.component.css']
})
export class CountComponent implements OnInit {
  @Input() id: any
  @Output() output: EventEmitter<any> = new EventEmitter<any>()

  count: any
  optss: any[] = [
    { value: 'test1', label: 'test1' },
    { value: 'test2', label: 'test2' },
    { value: 'test3', label: 'test3' }
  ]

  constructor() { }

  ngOnInit() { }

  onClick(id) {
    var o: any = { id: id, count: this.count }
    this.output.emit(o)

  }
}


text:
Q: ASP.NET C# REST WEB API - POST Multiple JSON values I am struggling to find a solution to my problem: I have a really simple Web API in C# that GET, POST, PUT and DELETE employees nicely, but everything working with a simple JSON input:
{
   "FirstName": "Sam 10",
   "LastName": "Wicht 10",
   "Gender": "Male",
   "Salary": 140000
}

What I want to do is to POST a lot of employees, like:
"employees": [{
   "FirstName": "Sam 10",
   "LastName": "Wicht 10",
   "Gender": "Male",
   "Salary": 140000
}, {
   "FirstName": "Sam 11",
   "LastName": "Wicht 11",
   "Gender": "Male",
   "Salary": 99000
}]

And in my C# Code, I receive, for instance a List<Employee> containing every employee from JSon and then I loop a For Each ... updating each.
Performance-wise, is this something really bad? Thinking I can limit the List size and avoid running any code if .Count() is higher than X, can you guys please let me know how to retrieve this from the JSON input?
This is the class Employee I have:
public partial class Employee
{
    public int ID { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string Gender { get; set; }
    public Nullable<int> Salary { get; set; }
}

Should I include a new Class that represents an IEnumerable<Employee> with all the parameters?
This is for learning and testing purposes, and I tried to retrieve [FromBody] List<Employee> myVariableName; returns null;

A: You're getting null because you have an enclosing employee object in your sample json. POST instead:
[{
   "FirstName": "Sam 10",
   "LastName": "Wicht 10",
   "Gender": "Male",
   "Salary": 140000
}, {
   "FirstName": "Sam 11",
   "LastName": "Wicht 11",
   "Gender": "Male",
   "Salary": 99000
}]

And that will match your controller definition of:
public ActionResult Post(List<Employee> employees)


text:
Q: Unity and Firefox are running slow Just installed Ubuntu 12.04 on my laptop. All the applications are running quite slow, so is Unity and the web browser. For example HD quality Youtube videos are lagging and scrolling down pages lags.
My specs:

*

*Ubuntu 12.04

*8 GB ddr2 800 MHz RAM

*Intel core 2 duo 2.0GHz

*750 GB HDD

A: Use Gnome panel, better than unity.
As Firefox consumes much of CPU, many people are complaining of its speed, be it Windows or Linux.
Use Google Chrome browser instead of Firefox. It is very faster.


text:
Q: React Native or Flutter Hi I want to check out a new framework to develop an app. Now I'm wondering about which one to choose, for example React Native or Flutter. Can you give me some suggestions or experiences about what to choose and maybe their advantages or disadvantages?
Thanks!

A: Summary:
React uses JS, Flutter uses Dart
The learning curve for Flutter is pretty steep since if you don't already know Dart, you're going to have to learn that too as well as a new framework (and reactive programming).
For React Native, it's pretty easy to pick up if you have used React or just JS in general which I'm sure you have.
Architecture
Flutter tends to rely on the BLoC pattern which is endorsed by Google Developers.
React Native relies on Flux and Redux.
Ecosystem
Flutter came out in May 2017 so it has less of an ecosystem than React Native which came out two full years prior.
Compilation
Flutter compiles to device-native code which you can change when you create a Flutter project. All of this is done on one thread! For intensive works, you might want to use a Dart Isolate which spins up a new spot on the memory to do intensive works while Flutter works on the UI and other stuff. Dart is designed for asynchronous workloads. Dart has Streams and Futures (basically Promises in JS). You can use a package that essentially brings in Redux to Dart to allow for Observables (better Promises).
React Native does not compile to native-device code and instead compiles to device equivalent. The JS runs on a separate thread and communicates to UI components through bridges. For asynchronous workloads, you can use Promises like in JS.
Documentation
As far as documentation goes, React Native wins at being more user-friendly than Flutter. Although, Flutter does have what they call cookbooks with easy to follow along with code samples. Overall, this is up to you.
Cross Platform
Flutter allows you to make apps for way more devices than React Native can. React Native is only for Android & iOS (though you can make web apps with react-native-web, thanks @VilleKoo) while Flutter hopes to support desktop, and web apps as well as the aforementioned iOS & Android all from a single codebase which is pretty impressive. Keep in mind, web support is in beta and desktop apps are not stable at this moment in time.
Further reading:
https://nevercode.io/blog/flutter-vs-react-native-a-developers-perspective/
https://hackr.io/blog/react-native-vs-flutter
https://hackernoon.com/react-native-vs-flutter-which-is-preferred-for-you-bba108f808

A: I see that the technical side of the question is covered pretty well by the others, but it's worth having a look at this issue from the standpoint of the technology's popularity, community support, and how it will keep up in the long run. Here is what I've found:

The category of most loved technologies due to the StackOverflow statistics shows how many specialists began using a particular tool and would like to continue working with it. By this criterion, Flutter's score is 68.17%, while React Native has 58.08% of voices. Github says that the number of open source projects is growing day by day. The statistics present the number of contributors to open-source projects. React Native has 9.1k contributors, while this number for Flutter reaches 13k. Google Trends is a metric that shows how often a particular query is entered into the search in relation to the overall search volume for a specific period. It means that it estimates a query as a percentage of all search queries in Google. We can see that Flutter's popularity amounted to nearly twice the React Native. The average number of "Flutter" queries score is 86, while React Native takes 58. With Google Trends, we can also analyze how popular other hybrid frameworks are compared to the described two. The statistics have shown us that Flutter is the best hybrid app framework in 2020, and React Native is in second place. Interestingly, if we take the 5 years' overview instead of 12 months, we can see the whole picture. The trend for Flutter has rapidly grown in the last 3 years' time. The popularity of React Native and Cordova was stable, and Xamarin's number of queries is steadily decreasing.

So as you see Flutter gains popularity very quickly, and I am rather surprised how quick it is. It looks like Flutter might be more future-proof because of the wider community, more new modules, and features, which result in better support, more updates, etc.
Here is some additional reading for you on that matter:
StackOverflow statistics 2021
Flutter vs React Native: Which is better?
Statistics about other frameworks' popularity


text:
Q: DNS Configuration and Domain Controllers on Home Network I want to experiment with Active Directory, strictly for my own education, so on my home network I launched two VMs, both Win2k8 R2 Servers (named 'Server1' and 'Server2').  I created two root domains ('alpha.com', 'bravo.com') intended to be accessible only from my LAN (obviously I don't own those domain names).
My first problem was that a ping of server1.alpha.com returned an actual internet address, rather than my VM address.  I know why that happened, but how I should fix it is my question.  I started to reason that all machines on my LAN should know that Server1.alpha.com is now a (local) DNS server.  However, all knowledge of DNS servers is DHCP-served from my WAN/LAN modem (it is a combined modem, wifi and 4 port router).
So I replaced the "dynamic" DHCP settings on my modem with two "static" entries.  I made the "primary" DNS the explicit IP of my machine server1.alpha.com.  I left the "secondary" DNS exactly as my modem had suggested (a legit internet IP address).
This "solution" mostly worked.  All machines can surf the web, and all machines now resolve server1.alpha.com to the "correct" intranet/local machine.  Nevertheless, all I really did was circumvent the problem, rather than solve it.  That is illustrated clearly by my next problem.
When I ping server2.bravo.com, I get a real IP rather than a NAT address of my local box.  Once again, the DNS servers are routing out into the real world.
So the question remains: what is the proper way to configure DNS both within my modem's DHCP settings and on my two domain controllers?  Yes, I established both my domain controllers to be DNS integrated / DNS servers.
I'm hoping that when everything is "fixed," I will also be able to ping just the common name (CN) of "server1" and "server2" and see an IP address.  Right now when I ping the common name, I get a link-local IPV6 address.  I think that means NetBIOS is handling the common-name lookup.
p.s. I hope the solution does not involve making configuration changes on every machine in my house (such as altering the hosts file), but I will do so if that is what it takes.
update An important element of this exercise, which at first I didn't properly take into account, is that the DC's I've established are only available 30% of the time (accidents happen!!).  So it turns out that my solution is to leave my network unmodified, and instead adjust the hosts file on each machine (originally I did not want that, but now it makes sense).
I would, however, be interested in knowing if there are other ways to have a machine common name resolved properly, without using DNS suffixes automatically appended.  Is there any other way to achieve that?

A: Here's one way to do it:

*

*Configure server1.alpha.com with a conditional forwarder to server1.bravo.com for the bravo.com DNS zone.

*Configure the DNS settings on the clients to append alpha.com and bravo.com to their DNS queries.
As for your ping returning IPv6 addresses: If the clients and the servers have IPv6 enabled, and they have IPv6 records registered in the DNS servers, and the servers are configured to listen on their IPv6 addresses in the DNS server properties, then they're going to return IPv6 addresses when resolving DNS queries. If you want them to return only IPv4 addresses then configure the DNS server properties not to listen on any IPv6 addresses and then delete any IPv6 records that have been created.

A: If your Windows DNS server(s) are setup to forward and cache DNS querries as well (where they also have access to the DNS root hints), then you just need to point all your systems to your DNS - not the router, ISP or anything outside of your environment.

A: Depending on how integrated you want your home computers to be with your new domain controllers, you should consider installing the DHCP service on one of the servers and disabling the DHCP service on your router. When you decommission or turn off your DCs, you can then just re-enable the DHCP service on your router without fiddling with any computers. They would simply need to be rebooted or reconnected to the LAN.
Remember that if this were a true domain environment, you would always point your workstations to your DC for DNS resolution so, when you configure the DHCP pool on your DC, set your DNS option to the IP address of the DC.
When your workstations obtain an IP, they will do so from the DC and it will tell the workstations to use the DC as their DNS server. All DNS queries will be sent to the DC at this point.
(You don't have to but) you should probably configure a forwarder to send all upstream DNS queries to the same DNS server on the internet that you configured in your router. Open the DNS management console on the DC, right-click the server node and click properties. Click the forwarders tab. Add the IP address of the DNS server in here.
Now, to rectify your other issue of being able to resolve the other domain, open the DNS management console, expand the server node, right-click the conditional forwarders node and select add new conditional forwarder. Type the domain name of the zone you want to resolve to (bravo.com) and provide the IP address of the DNS server responsible for bravo.com.
Repeat the creation of the conditional forwarder on server2.bravo.com but so that requests for hosts on alpha.com are forwarded to server1.alpha.com.
Now, when your computers request an address on the internet, the DNS server defined for the client (alpha.com) will (unless it has it cached) forward the request to the server you defined in the forwarders tab. If they request a local address in their domain (alpha.com) the DNS server will answer directly. If they request a host on bravo.com, the DNS request will be forwarded to the DNS server responsible for bravo.com.
I hope this makes sense. Very texty and probably easier to draw a diagram but it should get you  thinking in the right way.
-Lewis


text:
Q: CK Editor 4.5.3 how to remove the About button Link to CK EDITOR: http://ckeditor.com/demo#widgets
How do i remove the "?" Button. On clicking on it, It shows About CK Editor.

A: You can configure the toolbar elements to show through the config. Check the documentation: http://docs.ckeditor.com/#!/guide/dev_toolbar.
Also, you can just remove the button using config.removeButtons = 'About';. Look at http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-removeButtons.


text:
Q: The discrepancy of certain sequences To my knowledge, the best upper bound for the discrepancy of sequences of the type $(n\alpha) (\mod 1), n=1,2,...$ is
$$\frac{ND_N(\alpha)}{\log N\log\log N}\to \frac{2}{\pi^2}$$ in measure.
My first question is this: Given a particular double sequence $a_{ij}=i\alpha+j\beta (\mod 1)$, what is the optimal bound on the discrepancy in terms of $\alpha$ and $\beta$?
For $1\le i,j\le N$ it is straight forward to show that the sequence of $N^2$ terms
has a discrepancy no larger than that of its "best direction", i.e.
$$D_{N^2}(a_{ij})\le \min\{D_N(i\alpha),D_N(j\beta)\}.$$
I would very much like to know if this could be improved.
Secondly, I'm interested in the discrepancy of polynomial sequences. Given
a polynomial of order $d$, what is the discrepancy of $(p(n)) (\mod 1)$, $n=1,2,...$,
depending on $d$ and the coefficients?
I would be very grateful for any enlightenment or references you could give.

A: The standard reference for such results is Kuipers and Niederreiter, Uniform Distribution of Sequences.


text:
Q: How do i process whole SQL statement in mybatis? I'm trying to make simple SQL editor using JAVA.
Problem is mybatis mapper xml uses #{}..
I want to use whole sql statement itself without formatting.
Is it possible?
If I wanna get answer about Sql statement what I received from user, which way should i use?
Is there any way to process whole SQL statement in Java ?
※ I tried mybatis '${sql whole statement}' but i heard this way is vulnerable to security...
Thank you so much for your help!


text:
Q: Advice on creating PHP-MySQL background tasks I'm looking for advice on something I'm building: I have a PHP app that creates, updates and deletes records, but it's tightly integrated in a legacy non-sql based database, and it gets to be really really slow when you start doing lots of DB calls.
I want to make this more of a background experience for the user, so that when user creates or edits something, all the variables, arrays and objects would need to be written to a MySQL database and then a background script would kick off to read those records and process the request to the legacy database.
So I would need one table that keeps track of the task and then another table that would track all of the variables, objects, arrays and their values.
Here's what I was thinking the DB structure of the 2nd table would have to be:

*

*A column to store the task_id

*A column to store if the var is an array or an object, or NULL if it's a simple var.

*A column to store the name of the array/object var.

*A column for if it's an object, then to store the type of object it is.

*A column to store the array/object group ID. (For keeping track of what vars belongs to the object/array)

*A column to store the name of a simple var, method or name in the object/array

*A column to store the value of the var

Here would be a few examples:
1 | NULL     | NULL        | NULL          | NULL | 'foo'        | 'bar'
1 | 'array'  | 'foo_array' | NULL          | 1    | 'foo'        | 'bar'
1 | 'array'  | 'foo_array' | NULL          | 1    | 'foo2'       | 'bar2'
1 | 'object' | 'foo_obj'   | foobar_object | 2    | 'foo_method' | 'bar'
1 | 'object' | 'foo_obj'   | foobar_object | 2    | 'bar_method' | 'foo'

Does this seem like an overly complicated approach? Am I crazy and over thinking this? Can someone think of a better way I should approach this?
Thanks.

A: Use serialize()
It will generate a specially formatted string(you can store in your database). The string is special in that unserialize() can translate it back into its original php value. It maintains a variables type, value, and structure. Custom objects, and multidimensional arrays are no problem.
You still need part of your db table, this just does a lot of the work for you, and does it very well.

A: I would create a table that has a primary key (task_id perhaps) and then a column to store a serialized hash of variables (or maybe json encoded). You could even store this in the original table that keeps track of the task. I'm assuming that table would have a status column with values for:
waiting,
processing,
complete, and
error
When we do this in house we just use a tinyint(1) unsigned column. You could also add a timestamp field or three for when the task was create, started, and finished. It's all pretty straight-forward once you get rolling.


text:
Q: Jquery timer cant reset I am having a problem resetting my timer at the second run of the timer it always says that its not a function can you please help me
here is the link

        idle: 0

        talk_time: 0

        ON HOLD: 0

        AFTERTALK: 0

        TOTAL: 0

A: First thing is that there was duplicate function count_aftertalk so i had commented out and change variable function declaration type. You can compare this with old code then you will get it.
USE THIS CODE I HOPE IT WILL WORK FINE IT WILL NOT SHOW its not a function
var timer_idle;
var timer_talk;
var timer_hold;
var timer_aftertalk;

var count_idle;
var count_talk;
var count_hold;
var count_aftertalk;

var zero = parseInt("0");

count_idle = function (sec) {
    clearInterval(timer_idle);
    clearInterval(timer_talk);

    timer_idle = setInterval(function() {
        $('#ctr_idle').text(sec++);
    }, 1000);
}

count_talk = function (sec) {
    clearInterval(timer_idle);
    timer_talk = setInterval(function() {
        $('#ctr_talk').text(sec++);
    }, 1000);
}

count_hold = function (sec) {
    clearInterval(timer_talk);
    timer_hold = setInterval(function() {
        $('#ctr_hold').text(sec++);
    }, 1000);
}

count_aftertalk = function (sec) {
    clearInterval(timer_talk);
    timer_aftertalk = setInterval(function() {
        $('#ctr_aftertalk').text(sec++);
    }, 1000);
}

/*function count_aftertalk(sec) {
    clearInterval(timer_talk);
    timer_aftertalk = setInterval(function() {
        $('#ctr_aftertalk').text(sec++);
    }, 1000);
}*/

count_idle(zero);

$("#reset").click(function() {
    count_idle(zero);
  $('#ctr_talk').text(0);
  $('#ctr_hold').text(0);
  $('#ctr_aftertalk').text(0);
  $('#ctr_total').text(0);

  console.log(count_talk);
});

$("#start").click(function() {
    clearInterval(timer_idle);
    count_talk(zero);
});

$("#hold").click(function() {
    clearInterval(timer_talk);
    num = $('#ctr_hold').text();
    count_hold(num);
});

$("#unhold").click(function() {
    clearInterval(timer_hold);
    num = $('#ctr_talk').text();
    count_talk(num);
});

$("#finish").click(function() {
    clearInterval(timer_talk);
    num = $('#ctr_aftertalk').text();
    count_aftertalk(num);
});

$("#total").click(function() {

    clearInterval(timer_aftertalk);

    talk = parseInt($('#ctr_talk').text());
    hold = parseInt($('#ctr_hold').text());
    aftertalk = parseInt($('#ctr_aftertalk').text());
    sum = talk + hold + aftertalk;

    count_total = $('#ctr_total').text(sum);

});


text:
Q: Add missing unique rows to data.frame So I have two data frames that have different lengths. I'm trying to make them have similar lengths by adding the rows from dx that tdx is missing. In this instance, tdx is missing the rows where Age == "UNSP". I have other datasets that might be missing different rows; I'm looking to find a way to identify which rows are missing and then for the output add those rows; the Years column (for that row) would be NA values.
More clearly the output would be a data frame with the tx and tdx data side-by-side where the Gender and Age match.
Here's what I have tried (thanks to Richard for pointing out that I forget to add this)
(extra <- rbind(dx[8,],dx[16,]))
(extra[,3] <- NA)

ttdx <- rbind(extra,tdx, deparse.level = 1)

Then I arranged it back to normal. It works but I'd rather have a more efficient and automated way of doing this (for my other datasets)
If I had a better idea how to identify the differences between the data.frames by the computer, I would probably use dplyr or reshape2 to add the missing rows.
> head(dx,n = 12L)
   Gender   Age Year.10 Year.11 Year.12 Year.13
1  FEMALE   0-2   48020   43120   39120   14360
2  FEMALE   3-9   87930  101850   98750   85400
3  FEMALE 10-19    5700   47730   53590   18800
4  FEMALE 20-39  147230  134560   62090   71120
5  FEMALE 40-59  202770  142230  116120   98830
6  FEMALE 60-64   34980   49170   46260  110120
7  FEMALE   65+  256240  296710  254040  266690
8  FEMALE  UNSP    5500      NA      NA      NA
9    MALE   0-2   75170   52990   28110   32160
10   MALE   3-9   66360   89840   79220   39470
11   MALE 10-19   62960   15060   26700   26310
12   MALE 20-39   39670  145380  101880   94500

> head(tdx, n = 12L)
   Gender   Age Year.10 Year.11 Year.12 Year.13
1  FEMALE   0-2   36800   24560   25790   12400
2  FEMALE   3-9   77980   75810   79560   74450
3  FEMALE 10-19    5700   47730   51470   18800
4  FEMALE 20-39  147230  102400   42360   58190
5  FEMALE 40-59  179550  112510  105000   79140
6  FEMALE 60-64   33800   37380   35040   83670
7  FEMALE   65+  206270  202790  185460  225620
8    MALE   0-2   59930   46350   28110   26490
9    MALE   3-9   53260   62770   71350   32380
10   MALE 10-19   60490   15060   25260   20660
11   MALE 20-39   32490  132830   94950   88640
12   MALE 40-59   57950   70370  149790  136730

A: What ended up working is merge(dx, tdx, by=c('Gender','Age'), all=TRUE)
Thank you to Matt.


text:
Q: How to implement a distributed job queue using PostgreSQL? We have a few different tasks (eg. process image, process video) that are created when a user uploads media. The concept we have at the moment is to have a primary Task that is the container for all task types, and a Subtask which has all the metadata required to process the task.
I've seen countless cases where the answer is to use Redis, but we would like to keep a task history to calculate things like average task time, and the metadata of subtasks can be complex.
I'm not very experienced with PostgreSQL so see this as pseudocode:
BEGIN TRANSACTION;

-- Find an unclaimed task.
-- Claim the task.
-- Prevent another worker from also claiming this task.
UPDATE (
    SELECT FROM subtasks
    INNER JOIN tasks
    ON tasks.id = subtasks.id
    WHERE tasks.started_at = NULL   -- Not claimed
    ORDER BY tasks.created_at ASC   -- First in, first out
    LIMIT 1
    FOR UPDATE SKIP LOCKED  -- Don't wait for it, keep looking.
)
SET tasks.started_at = now()
RETURNING *

-- Use metadata from the subtask to perform the task.
-- If an error occurs we can roll back, unlocking the row.
-- Will this also roll back if the worker dies?

-- Mark the task as complete.
UPDATE tasks
SET completed_at = now()
WHERE tasks.id = $id

END TRANSACTION;

Will this work?

Edit 1: Using clock_timestamp() and no subselect.
BEGIN TRANSACTION

    -- Find an unclaimed task.
    SELECT FROM subtasks
    INNER JOIN tasks
    ON tasks.id = subtasks.id
    WHERE tasks.started_at = NULL   -- Not claimed
    ORDER BY tasks.created_at ASC   -- First in, first out
    LIMIT 1                         -- We only want to select a single task.
    FOR UPDATE SKIP LOCKED          -- Don't wait for it, keep looking.

    -- Claim the task.
    UPDATE tasks
    SET started_at = clock_timestamp()
    WHERE id = $taskId

    -- Use metadata from the subtask to perform the task.
    -- If an error occurs we can roll back, unlocking the row.
    -- Will this also roll back if the worker dies?

    -- Task is complete.

    -- Mark the task as complete.
    UPDATE tasks
    SET completed_at = clock_timestamp()
    WHERE id = $taskId

END TRANSACTION


text:
Q: getting " (1) no such column: _id10 " error I'm trying to retrieve the data of a particulate row in a sqlite database . and trying to display it to on a EditText but I'm getting this error , Kindly help me in solving the error !
Thanks in advance :)
here is the logcat data showing error
    12-31 22:28:17.731: E/2.4(12285): 111111
12-31 22:28:17.741: E/2.5(12285): 111111
12-31 22:28:17.771: E/SQLiteLog(12285): (1) no such column: _id10
12-31 22:28:17.791: D/AndroidRuntime(12285): Shutting down VM

here is the code : ( of the function getName , which is being used to retrieve the data of column 1  ) [getting error after log.e("2.5"....   ) ]
 public String getName(long l) {
        // TODO Auto-generated method stub
        Log.e("2.4","111111");
        String[] column = new String[]{KEY_ROWID, KEY_NAME, KEY_HOTNESS };
        Log.e("2.5","111111");
        Cursor c = ourDatabase.query(DATABASE_TABLE, column, KEY_ROWID + "" + l, null, null, null, null);
        Log.e("2.6","111111");
        if(c != null)
        {
            Log.e("2.7","111111");
            c.moveToFirst();
            Log.e("2.8","111111");
            String name = c.getString(1);
            Log.e("2.9","111111");
            return name;

        }
        return null;
    }
public String getHotness(long l)
{
    Log.e("3.1","111111");
    // TODO Auto-generated method stub
    String[] column = new String[]{KEY_ROWID, KEY_NAME, KEY_HOTNESS };
    Log.e("3.2","111111");
    Cursor c = ourDatabase.query(DATABASE_TABLE, column, KEY_ROWID + "" + l, null, null, null, null);
    Log.e("3.3","111111");
    if(c != null)

    {
        Log.e("3.4","111111");
        c.moveToFirst();
        Log.e("3.5","111111");
        String hotness = c.getString(2);
        Log.e("3.6","111111");
        return hotness;

    }
    return null;
}

And is the code of the activity which is calling this function
case R.id.bgetInfo:
        String s = sqlRow.getText().toString();
        long l = Long.parseLong(s);

        HotOrNot hon = new HotOrNot(this);
        hon.open();
        String returnedName = hon.getName(l);
        String returnedHotness = hon.getHotness(l);
        hon.close();
        Log.e("1.2","111111");
        sqlName.setText(returnedName);
        Log.e("1.3","111111");
        sqlHotness.setText(returnedHotness);
        Log.e("1.4","111111");
        break;

A: I think you missed a equal sign at:
Cursor c = ourDatabase.query(DATABASE_TABLE, column, KEY_ROWID + "" + l, null, null, null, null);

Change to:
Cursor c = ourDatabase.query(DATABASE_TABLE, column, KEY_ROWID + " = " + l, null, null, null, null);


text:
Q: Differentiate between 2 users sessions using SharedPreferences Android I am developing a login android app. I am using SharedPreferences class to maintain session. I know that  SharedPreferences class returns the same instance to all the users in the application if the pref file name is same. So, if one user stores his username and password in SharedPreferences class and another user comes in and uses the same filename, can he get access to the previous user's username and password?
How does SharedPrefereces differentiate between two users? How does we maintain different session objects for two users using SharedPreferences class so that they can't interfere in each other data?
Please clarify it...


text:
Q: What can we say about the set X? We have a certain set $X$ for which is valid: $\forall U\subset X:[ U\neq X ]\rightarrow U\nsim X$. What can we say about $X$? I think we've got to use the axiom of choice here. My first guess would be to say that $X$ is finite, but I'm not sure...

A: If you translate the definition into words, you'll see that it says that $X$ is such that no proper subset of $X$ has the same cardinality as $X$. In other words, this means that if $f\colon X\to X$ is injective, then it is surjective. This is Dedekind's definition for finiteness.
Of course finite sets have this property, but without the axiom of choice (or at least the axiom of choice for countable families of sets) we cannot prove the converse. It is consistent that the axiom of choice fails, and there are infinite sets which are Dedekind-finite.


text:
Q: Код работает в консоли, но не работаете при вызове из-под Tumpermonkey Пишу маленький юзерскрипт, застрял на моменте отправки на сервер аякса и получения ответа на него.
Если мой код протестировать в консоли, то все нормально, если же вызывать из-под Tumpermonkey, то страница становится белой и «висит» в этом режиме.
В чем может быть проблема?
if(/\/vacancy\/.*/.test(location)){
  $.ajax({
    url:'http://www.superjob.ru/vacancy/search/?
      period=0&t%5B%5D=4&catalogues=33&pay1=60000&pay0=0&experience=0&
      type_of_work=0&place_of_work=0&age=&pol=0&education=0&lng=0&
      lnlev=0&lang0=0&agency=0&moveable=0&active=0&detail_search=1&
      sbmit=1&extended=1',
    success: function(data){
      $('*').html(data);
    }
  });
}


text:
Q: Android Layout symlink/reference in another layout-XXX folder i'm currently updating my app for tablet layouts, for one of my fragments, i have one layout for phone portrait and one for phone landscape.
on tablets i want the same layout as the phone portrait layout for both, portrait and landscape. for that to work, currently i have to copy the layout from layout/ folder(phone-protrait) to my layout-sw600dp folder. is there a way to achieve this behaviour without the need to copy the whole layout file?

for drawables i found this some time ago
<bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/some_drawable"/>

is there something similar for layouts?

Thanks in advance :))

UPDATE 1:
found a possible solution here http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
i have to put a xml in values-sw600dp
<resources>
    <item name="main" type="layout">@layout/mylayout</item>
</resources>

i have not yet tested i but i think this would work!

UPDATE 2:
after testing this, i have to say it does not work... i think the issue is that i want/need to use <item name="main" type="layout">@layout/main</item> what would be some kind of circular reference, i get android.view.InflateException: Binary XML file line #8: Error inflating class fragment :((


text:
Q: Why is $\bigcap_{\mathfrak{p} \in D(f)} A_\mathfrak{p} \subset A_f$? I have some problems regarding exercise 5 in Bosch's book, chapter 6.3. Well, actually it's just the problem stated in the title. $A$ is an integral domain so the natural localization maps are injective. But I feel like I'm running in circles trying to show that inclusion. Any hint would be great.

A: The standard trick is the following:
Consider $x \in \bigcap_{\mathfrak{p} \in D(f)} A_{\mathfrak{p}},$ and let
$$\mathfrak{a}=(A:_{A}x):=\{g \in A\;|\; gx \in A\}.$$
Clearly $\mathfrak{a}$ is an ideal of $A$, and we may assume proper (otherwise $x\in A$, so there is nothing to prove).
Now let $\mathfrak{q}$ be a prime containing $\mathfrak{a}.$ Then $\mathfrak{q}$ cannot be in $D(f)$, since for any $\mathfrak{p} \in D(f)$ there is $s \in \mathfrak{a} \setminus \mathfrak{p}$ by the fact that $x \in A_{\mathfrak{p}}$ (this yoga might be best to think through on your own). So we may conclude that $f \in \mathfrak{q}.$
Altogether, we have $f \in \bigcap_{\mathfrak{q} \supseteq \mathfrak{a}} \mathfrak{q}= \sqrt{\mathfrak{a}} $. Thus, there is a power of $f$, $f^N$, which belongs to $\mathfrak{a}$, and so $f^Nx=a \in A,$ hence $x = \frac{a}{f^N}\in A_f$.


text:
Q: Print some text lines using Crystal Report formula I have some idea how to accomplish this task but I am stuck in between.
I want to print some lines based on the count of a value field in my crystal reports.
I check the number of co-applicants and based on the count, I want to print exact signature area, where they can do their signature when print outs will be taken.
Is there any way to do so?
What is the function which we use to print lines, just tell me this, rest I will manage.

A: There is no specific print function, the result of the last line of any formula is what is printed.  The easiest thing to do for calculated text output is to create a local StringVar for the output, and then have the very last line of the function be just the name of that variable (which will print the contents of the variable).
Another thing that may help: using return/newline ("\r\n") will work in a Crystal text field if you use the character codes.  "line1" + chr(13) + chr(10) + "line2"  Just be sure to set the "Can Grow" option on the field.


text:
Q: SQL Server - Linked Tables, Repeated Items Alright, I'm trying to link three different tables (Customers, Orders, and Order Details), in an effort to figure out which customers ordered the same item twice. I'm stumped. Here's what I've come up with thus far:
Select ContactName, Orders.OrderID, ProductID From Customers
inner join Orders on Customers.CustomerID = Orders.CustomerID
join [Order Details] on [Order Details].OrderID = Orders.OrderID;

I was thinking it'd be easiest to find ProductIDs that have the correlating ContactName but a different Orders.OrderID... and this is what I'm having trouble with. Any help would be much appreciated.

A: you need to select two different orders which have a detail with the same product. ("select all customers which have two different orders with the same product")
Select
  ContactName,
  o1.OrderID,
  o2.OrderID,
  od1.ProductID
From
  Customers
  inner join Orders o1 on Customers.CustomerID = o1.CustomerID
  join [Order Details] od1 on od.OrderID = o1.OrderID;
  inner join Orders o2 on Customers.CustomerID = o2.CustomerID
  join [Order Details] od2 on od.OrderID = o2.OrderID;
where
  o1.orderid <> o2.orderid
  and od1.productid = od2.productid

or use a subquery. ("select all customers which have a product detail with the same product as in another order of the same customer");
Select
  ContactName,
  o1.OrderID,
  od1.ProductID
From
  Customers
  inner join Orders o1 on Customers.CustomerID = o1.CustomerID
  join [Order Details] od1 on od.OrderID = o1.OrderID;
where
  od1.productid IN
    (SELECT od2.productid
    FROM
      Orders o2 on Customers.CustomerID = o2.CustomerID
      join [Order Details] od2 on od.OrderID = o2.OrderID
    where
      o1.orderid <> o2.orderid)

Or use group by. then you can count them. You can aggregate different values, for instance the total amount ordered or the total prize payed.
Select
  ContactName,
  od1.ProductID
  count(*) as "number of repeated orders details",
  count(distinct o1.orderid) as "number of different orders"
From
  Customers
  inner join Orders o1 on Customers.CustomerID = o1.CustomerID
  inner join [Order Details] od1 on od.OrderID = o1.OrderID;
group by
  ContactName,
  od1.productId
having
  count(distinct o1.orderid) > 1


text:
Q: How to define using statements in web.config? I'm using MySql in my asp.net project. But I don't want to type every "using MySql.Data.MySqlClient;" statement in every aspx.cs/aspx.vb file. How can I define this lines in web.config file?
I've defined some namespaces like below but this only works for aspx pages:
<?xml version="1.0"?>
<configuration>
    <system.web>
        <compilation debug="false" targetFramework="4.0"/>
        <pages>
            <namespaces>
                <add namespace="System.Web.Configuration"/>
                <add namespace="MySql.Data"/>
                <add namespace="MySql.Data.MySqlClient"/>
            </namespaces>
        </pages>
    </system.web>
</configuration>

related question : Define common namespaces for code pages in Web.Config

A: There is no way to setup global usings for the code-behinds.  You have to put the usings in the code files.

A: Yes you can. If you open %Program Files%\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates\CSharp\1033\Class.zip,
Or: %Program Files%\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033
You can modify the class.cs file within that's used to generate all new C# source files - it looks like this:
using System;
using System.Collections.Generic;
using System.Text;

namespace $rootnamespace$
{
    class $safeitemrootname$
    {
    }
}

Also, there is a file called Class.vstemplate. Open this and you can edit the following:
<Reference>
    <Assembly>System</Assembly>
        </Reference>
        <Reference>
            <Assembly>System.Data</Assembly>
        </Reference>
        <Reference>
            <Assembly>System.Xml</Assembly>
        </Reference>
    </References>

A: Just wrap your using block in a #region and collapse it. No more worry about how many usings there are.


text:
Q: What default constructors do we need to provide in each class? I always assumed that the compiler will automatically generate copy constructors and copy operators in C++ if one is not specified. Is this also the case for move constructor/move operator?
In other words, do we need to specify a move constructor and move operator to get benefits of move semantics. OR are they provided by the compiler by default?
I was reading some articles recently that state that sometimes move semantics will break if there is a custom destructor declared in a class.
When does it make sense to actually write a move constructor/move operator?


text:
Q: an error after log in: "There is already an open DataReader associated with this connection which must be closed first?" I retrieve it in my mainform:
Try
        rs.Connection = con
        cmd = "select * from cdcol.currency_rate"
        rs.CommandText = cmd
        res = rs.ExecuteReader

        While res.Read
            Dim currency = res.GetString("currency")
            ComboBox2.Items.Add(currency)
        End While
        res.Close()
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try

and this in my tabcontrol
Try
            rs.Connection = con
            cmd = "select * from cdcol.currency_rate where currency='" & ComboBox2.Text & "'"
            rs.CommandText = cmd
            res = rs.ExecuteReader
        While res.Read
            If sell.Checked = True Then
                buy.Text = res.GetDouble("buy_rate")
                coderate.Text = res.GetString("code")
            End If
            If buy.Checked = True Then
                sell.Text = res.GetDouble("sell_rate")
                coderate.Text = ("PHP")
            End If
        End While
        res.Close()
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try

when i log in there was an error,
what's wrong with my codes ?
please help me ..

A: A few things could be going on, hard to tell without all the code but I'll give you some ideas.  I'm assuming this is a WinForms app (also assuming this is SQL Server)?
If you've verified that all your DataReader's are being closed properly then it is possible that you have two DataReaders actually trying to read at the same time if they're using a shared connection in your program (you say you're using a tab control and executing a query, if you have one reader running somewhere and then you click on a tab you could run into that scenario).  If that is your desired behavior you can allow multiple recordsets by adding the multiple active result sets flag to your connection string:
https://msdn.microsoft.com/en-us/library/h32h3abf(v=vs.110).aspx
Something like this:
Dim connectionString As String = "Data Source=MSSQL1;" & _
"Initial Catalog=AdventureWorks;Integrated Security=SSPI;" & _
"MultipleActiveResultSets=True"

The MSDN article gives you much more info about it.  In your scenario this will probably work.  MSDN offers this though (which is your other option, use a connection per method you need it and dispose of it when you're done):

"MARS is not designed to remove all requirements for multiple
  connections in an application. If an application needs true parallel
  execution of commands against a server, multiple connections should be
  used."


text:
Q: Cross-domain validation in PHP I am currently working on a project that revolves around the following:
Page 1 ( domain1 ) redirecting to Page 2 ( domain2 ) redirecting to Page 3 ( domain2 )
I wanna make sure that the Page 2 contents is NOT shown unless the user is confirmed to have visited Page 1 first. For obvious reasons, I cannot use sessions and cookies, since domain1 and domain2 are two separate domains.
$_SERVER['HTTP_REFERER'] is a possible solution, but it can be modified or even stripped from the browser requests, so I have no guarantee I won't inadvertently block legitimate users by using it.
How would I go about doing it?

A: Yes. You cannot set cookie without direct request from browser.
You can pass a token while redirecting from http://page1 to http://page2/?token=hash_function($salt,$user_ip).
More complex way is to generate token on domain with page1 and recheck it with direct request from page2 server to page1 server. This allows you to create "one-time" tokens and even user changed his ip during session (really rare case) - this redirect still be valid.


text:
Q: Change the drupal 8 folder with htaccess So I have installed and got a site at
example.com/sites/prod
and want users to go to
example.com/
to see the site. I have a .htaccess file that does the trick, along with the trusted hosts installed, but I have hit a problem where if I go to
example.com/user
I hit the following message

Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it.

I assume it is an new feature from drupal 8 as I had successfully done this in 7.
The error also occurs if you submit a contact form.
I have tried googling around but I am getting confused.

A: My use case was one where the Drupal install, only used for backend (fully decoupled), could not "live" in the root. As for your case I used the .htaccess file to define a series of redirects and ran into the problem that for example ../backend/node/26/edit?destination=/backend/admin/content would result in the error you mention after form save.
Adding the below to the settings.php solved the problem:
$settings['trusted_host_patterns'] = array(
  '^example\.com$',
  '^www\.example\.com$',
  '^localhost$',
);

Obviously change the URL with your own.


text:
Q: Saving state of angular app between page reloads What would be a good approach to implement state persistence between page reloads? Right now I am not talking about state in context of ngrx. I am referring to that case when you refresh the page and everything seems to be gone : user is logged out, all changes that are not saved on backend are gone and so on.
At first I thought that this can be somehow implemented using localStorage and then init everything in ngOnInit() in every component I need, but it sounds like inventing a wheel. I believe there should be a ready solution, or some pattern.
Please advise.

A: A quick search in the web points to ngrx-store-localstorage which helps to store  application state in localstorage. A sample implementation from their website below.

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { StoreModule, ActionReducerMap, ActionReducer, MetaReducer } from '@ngrx/store';
import { localStorageSync } from 'ngrx-store-localstorage';
import { reducers } from './reducers';

const reducers: ActionReducerMap<IState> = {todos, visibilityFilter};

export function localStorageSyncReducer(reducer: ActionReducer<any>): ActionReducer<any> {
  return localStorageSync({keys: ['todos']})(reducer);
}
const metaReducers: Array<MetaReducer<any, any>> = [localStorageSyncReducer];

@NgModule({
  imports: [
    BrowserModule,
    StoreModule.forRoot(
        reducers,
        {metaReducers}
    )
  ]
})
export class MyAppModule {}

A: You can store the stuff you need in localstorage, an write actions (because you mentioned ngrx) that access the localstorage, store it in the state and all the components just access that data though selector or any other preferred way. Hope that helps


text:
Q: QFTP commandFinished is sent too early QT version 5.4.
I am trying to download all the files from a specific directory, with QFtp.
Sometimes the signal commandFinished(int, bool) is sent too early.
I use the signal dataTransferProgress(qint64, qint64), to check my download progress.
When it works i have got an output like :
Download 1
dataTransferProgress 0/150
dataTransferProgress 150/150
commandFinished
Dowload 2
dataTransferProgress 0/250
dataTransferProgress 250/250
commandFinished

And my files are ok
When it doesn't work i have :
Download 1
dataTransferProgress 0/150
commandFinished
Dowload 2
150/150
0/250
commandFinished

The file 1 is empty.
The file 2 contains the file 1 datas.
My FTP object
class ActionFTP : public QFtp
{

Q_OBJECT
public:

ParamConnexion parametres;
QString FTP_export="exportX3_OFT/";
QString FTP_import="exportOFT_X3/";
QString FTP_historique="historique/";
QString OFT_export;
QString OFT_import;
QString OFT_historique;
QString ficConfig;
QFile *file;
QSettings *settings;

ActionFTP(QObject *parent = 0, QString fichierConfig = "config.ini", int detail = 0);
~ActionFTP();

bool recupFichier_X3_OFT(const QString&); // Function to download the File
bool ftpestdeconnecte(); // Check if my ftp is deconnected
void connecter(); // Connect me to the FTP
void deconnecter(); // Disconnect me from the FTP
void ContenuRepertoireFTP(); // List all the files in the FTP directory
bool getCommandEnCours(){return commandEnCours;} // Check if a command is already running
QList<QUrlInfo> getListePrete(){return listeFichiers;} // Return if the list of the
bool commandEnCours;

private :
int idEnCours;
QList<QUrlInfo> listeFichiers;

private slots:
void slot_append(QString info); // Get some informations
void ftpCommandFinished(int id, bool err);
void ftpCommandStarted(int id);
void remplirList(QUrlInfo);
void ftpdatatransferprogress(qint64, qint64);

signals :
void signal_connexionFaite(bool); // Send when I'm connected
void signal_deconnexionFaite(bool); // Send when I'm disconnected
void signal_append(QString infos); // Send some informations
void signal_listePrete(bool); // List ready
void fintransfertfichierrecup(); // When the get command is finished.
};

#endif // ACTIONFTP_H

.cpp
// I use a QSettings to get the different Path and the FTP Username/Login/Port/Host/TransferMode
ActionFTP::ActionFTP(QObject *parent, QString fichierConfig, int detail ) : QFtp(parent)
{
    settings = new QSettings(fichierConfig, QSettings::IniFormat);
    OFT_export=settings->value("Echange/DossierOFT").toString();
    OFT_import=settings->value("Echange/DossierX3").toString();
    OFT_historique=settings->value("Echange/DossierHistorique").toString();
    connect(this, SIGNAL(signal_append(QString)),this,SLOT(slot_append(QString)));
    connect(this, SIGNAL(commandFinished(int, bool)),this, SLOT(ftpCommandFinished(int, bool)));
    connect(this,SIGNAL(commandStarted(int)), this, SLOT(ftpCommandStarted(int)));
    connect(this, SIGNAL(listInfo(QUrlInfo)), this, SLOT(remplirList(QUrlInfo)));
    connect(this, SIGNAL(dataTransferProgress(qint64,qint64)), this, SLOT(ftpdatatransferprogress(qint64, qint64)));
    ficConfig=fichierConfig;
    majParametres();

}

void ActionFTP::ftpdatatransferprogress(qint64 un, qint64 deux){
    qDebug()<<un<<deux;
}

ActionFTP::~ActionFTP()
{

}

bool ActionFTP::recupFichier_X3_OFT(const QString &fichier){
    if(commandEnCours){ // A command is already running
        QString infos = "Une commande est déjà en cours.";
        emit signal_append(infos);
    }
    else{
     file = new QFile(OFT_import+fichier);
     if(file->exists())file->remove();

     QString infos = "Demande de r�cup�ration du fichier " + FTP_export+fichier;
     emit signal_append(infos);

     qDebug()<<"return de file->open "<<file->open(QIODevice::ReadWrite); // Always return TRUE
     get(FTP_export+fichier, file, Binary); // Get command
    }
    return true;
}

void ActionFTP::slot_append(QString info){
    qDebug()<<info;
}

bool ActionFTP::ftpestdeconnecte()
{
    if (state()==QFtp::Unconnected)
        return true;
    return false;
}

void ActionFTP::connecter() {
        setTransferMode((QFtp::TransferMode)parametres.TransfertMode);
        if(!commandEnCours)
            connectToHost(parametres.Hostname, parametres.Port);
        else{
            QString infos = "Une commande est déjà en cours.";
            emit signal_append(infos);
        }
}

void ActionFTP::deconnecter() {
    if(commandEnCours){
        QString infos = "Une commande est déjà en cours.";
        emit signal_append(infos);
    }
    else{
     close();
    }
}

void ActionFTP::remplirList(QUrlInfo t){
    listeFichiers.push_back(t);
}

void ActionFTP::ContenuRepertoireFTP(){ //Ask the list of files name in the directory
    if(commandEnCours){
        QString infos = "Une commande est déjà en cours.";
        emit signal_append(infos);
    }
    else{
        listeFichiers.clear();
        list(FTP_export);
    }
}

void ActionFTP::ftpCommandStarted(int id){
    idEnCours = id;
    commandEnCours=true;
    qDebug()<<"dans commandStarted "<<id;
}

void ActionFTP::ftpCommandFinished(int id, bool err) {
    qDebug()<<"dans ftpCommandFinished"<<id<<err;
    QString infos;
    if(err) {
        infos = QString(" Erreur lors de la commande %i de type %i").arg(id, currentCommand());
        erreurFTP(infos);
    }
    else {
        infos += " OK";
    }
    emit signal_append(infos);
    if(idEnCours==id){
        QString infos;

        switch(currentCommand()) {
        case QFtp::None :
            break;
        case QFtp::SetTransferMode :
            break;
        case QFtp::SetProxy :
            break;
        case QFtp::ConnectToHost :
            if(!err)
                login(parametres.UserName, parametres.Password);
            else
                 emit signal_connexionFaite(err);
            break;
        case QFtp::Login :
            commandEnCours = false;
            emit signal_connexionFaite(err);
            break;
        case QFtp::Close :
            commandEnCours = false; // Signifier qu'il n'y a plus de transfert en cours
            emit signal_deconnexionFaite(err);
            break;
        case QFtp::List :
            commandEnCours=false;
            emit signal_listePrete(err);
            break;
        case QFtp::Cd :
            break;
        case QFtp::Get :
            file->close();
            file = 0;
            commandEnCours = false; // Signifier qu'il n'y a plus de transfert en cours
            emit fintransfertfichierrecup();
            qDebug()<<"signal get emit";
            break;
        case QFtp::Put :
            commandEnCours = false; // Signifier qu'il n'y a plus de transfert en cours
            emit fintransfertfichierenvoi();
            break;
        case QFtp::Remove :
            commandEnCours = false;
            emit fintransfertfichiersuppr();
            break;
        case QFtp::Mkdir :
            break;
        case QFtp::Rmdir :
            break;
        case QFtp::Rename :
            break;
        case QFtp::RawCommand :
            break;
        default :
            infos = "Commande inconnue !!";
        }
        idEnCours = 0;
    }
}

My object who calls my FTP object
  class TacheEchanges : public QTimer
  {
      Q_OBJECT
  public:
  explicit TacheEchanges(QObject *parent = 0);

  signals:

  public slots:

  private slots:
  virtual void slot_check();

  protected:

  private:
  ActionFTP *ftp; // My FTP object
  QList<QUrlInfo> listDownload; // List of the files name
  int indiceDownload; // Iterator

  private slots:
  void continuerDownload();  // When one file is downloaded
  void connexionFaite(bool); // When I am connected to the FTP
  void listePrete(bool); // When my command list is done

  };

  #endif // TACHEECHANGES_H

.cpp
TacheEchanges::TacheEchanges(GestionBdD_Hizkia* bdd, QObject *parent)
    : QTimer(parent)
{

        settings =new QSettings(FICHIERCONFIG, QSettings::IniFormat);

try{

        path_fichiersreference="";
        path_poursage="";
        path_historique="";
        jobs = QList<Job>();
        ftp = new ActionFTP(this, FICHIERCONFIG);

        connect(this, SIGNAL(timeout()), this, SLOT(slot_check()));
        connect(ftp,SIGNAL(fintransfertfichierenvoi()),this,SLOT(continuerUpload()));
        connect(ftp, SIGNAL(signal_connexionFaite(bool)), this, SLOT(connexionFaite(bool)));
        connect(ftp, SIGNAL(signal_listePrete(bool)), this, SLOT(listePrete(bool)));

     //Differente path
     path_fichiersreference =settings->value("Echange/DossierX3").toString();
     path_historique =settings->value("Echange/DossierHistorique").toString();
     path_poursage=settings->value("Echange/DossierOFT").toString();
     indiceDownload=0;

  }

        catch(ErreurGeneriqueException &e) {
        desc.message = "TacheEchanges\n"+ e.what();
        desc.niveau = NIVEAU_CRITIQUE;
        InterfaceBdD::historiser(desc);
        qDebug() << desc.message;

        }

        catch(...) {
     //   QDebug() << "TacheEchanges\n" << e.get_message();

        desc.message = "TacheEchanges ERREUR INCONNUE";

        desc.niveau = NIVEAU_CRITIQUE;
        InterfaceBdD::historiser(desc);
        qDebug() << desc.message;

        }
}

// If i am connected, i try to get the list of files name
void TacheEchanges::connexionFaite(bool err){
    if(err)
        throw new ErreurGeneriqueException("Impossible de se connecter");
    else
        ftp->ContenuRepertoireFTP();
}

void TacheEchanges::slot_check()
{
        ftp->connecter();
}

// I take the list and start the download
void TacheEchanges::listePrete(bool err){
    if(!err){
        listDownload = ftp->getListePrete();
        continuerDownload();
    }
    else{
        throw new ErreurBasiqueException("Un problème est survenu lors de la récupération de la liste des fichiers présents sur le FTP.");
    }
}

void TacheEchanges::continuerDownload(){
    if(indiceDownload==listDownload.size()){
        indiceDownload=0;
        continuerSuppression();
        return;
    }
    else{
        ftp->recupFichier_X3_OFT(listDownload.at(indiceDownload).name());
        indiceDownload++;
    }
}

A: Also have look here for difference between active and passive

A: Ok, when i am trying to connect to the FTP I use
setTransferMode(QFtp::TransferMode);

I used the default value QFtp::Active, if I put QFtp::Passive it works.


text:
Q: Showing that a matrix is a orthogonal projector The matrix norm of the matrix in the matrix for matrix

A: Assume that $X$ is a column vector that is a particular linear combination of columns of $Q$ plus something that is orthogonal to $\mathcal S$.
Work out what the elements of $Q^TX$ are, and then what $QQ^TX$ must be.


text:
Q: Jest Redux test issue I am just trying to figure out how to do tests on components that are wrapped with connect. How do I properly define the redux state prop to my component?
● PendingContract with connect/Redux › +++ render the connected(SMART) component
TypeError: Cannot read property 'find' of undefined

Original Component code:
// Dependencies
import React, { Component } from 'react';
import CSSModules from 'react-css-modules';
import { connect } from 'react-redux';
import * as actions from '../../../../actions';
import PendingContractDetail from './pending-contract-

detail/PendingContractDetail';

// CSS
import styles from './PendingContract.css';

export class PendingContract extends Component {

  componentWillMount() {
    this.props.getSinglePendingContract(this.props.params.contract);
  }

  render() {
    let contract;
    if (this.props.contract) {
      const contractDetails = this.props.contract;
      contract = (
        <PendingContractDetail
         accepted={contractDetails.accepted}
         contractId={contractDetails.contractId}
         contractName={contractDetails.contractName}
         details={contractDetails.details}
         status={contractDetails.status}
         timeCreated={contractDetails.timeCreated}
         type={contractDetails.type} />
      );
    } else {
      contract = 'Loading...'
    };

    return (

          {contract}

    );
  }
}

function mapStateToProps(state) {
  return {
    contract: state.pendingContracts.contract
  }
}

const PendingContractWithCSS = CSSModules(PendingContract, styles);

export default connect(mapStateToProps, actions)(PendingContractWithCSS);

Test Code as follows:
import React from 'react';
import reduxThunk from 'redux-thunk';
import { Provider } from 'react-redux';
import { shallow, mount } from 'enzyme';
import PendingContract from './PendingContract';

import configureStore from 'redux-mock-store';

jest.mock('react-css-modules', () => Component => Component);

describe('PendingContract with connect/Redux', () => {
  const initialState = {
    contract: {
      accepted: true,
      contractId: 1234,
      contractName: 'Test Contract',
      details: { test: 'test'},
      status: 'Accepted',
      type: 'Sports'
    }
  };

  const mockStore = configureStore([reduxThunk])
  let store,wrapper;

  beforeEach(()=>{
    store = mockStore(initialState)
    wrapper = mount(<Provider store={store}><PendingContract {...initialState} /></Provider>)
  })

  it('+++ render the connected(SMART) component', () => {
    expect(wrapper.find(PendingContract).length).toEqual(1)
  });

  // it('+++ check Prop matches with initialState', () => {
  //   expect(wrapper.find(PendingContract).prop('contract')).toEqual(initialState.contract)
  // });
});

A: You need to import connected component if you are trying to fully test it with mount:
import React from 'react';
import reduxThunk from 'redux-thunk';
import { Provider } from 'react-redux';
import { shallow, mount } from 'enzyme';
import ConnectedPendingContract, { PendingContract } from './PendingContract';
import configureStore from 'redux-mock-store';

jest.mock('react-css-modules', () => Component => Component);

describe('PendingContract with connect/Redux', () => {
  const initialState = {
    contract: {
      accepted: true,
      contractId: 1234,
      contractName: 'Test Contract',
      details: { test: 'test'},
      status: 'Accepted',
      type: 'Sports'
    }
  };

  const mockStore = configureStore([reduxThunk])
  let store,wrapper;

  beforeEach(()=>{
    store = mockStore(initialState)
    wrapper = mount(<Provider store={store}><ConnectedPendingContract {...initialState} /></Provider>)
  })

  it('+++ render the connected(SMART) component', () => {
    expect(wrapper.find(PendingContract).length).toEqual(1)
  });

  // it('+++ check Prop matches with initialState', () => {
  //   expect(wrapper.find(PendingContract).prop('contract')).toEqual(initialState.contract)
  // });
});


text:
Q: (Oracle DSEE) LDAP browsing index with parameters in the vlvFilter I'm running into some problems creating a browsing index for VLV searches.
The oracle docs (https://docs.oracle.com/cd/E19693-01/819-0995/bcatq/index.html) state that
The vlvFilter is the same LDAP filter that is used in the client search operations.

The filter I am using for the VLV searches however is parameterised, e.g.
(&(objectclass=MySpecialObjectClass)(modificationTimestamp>=$someDynamicValue))

So any ideas what should be put in the vlvFilter attribute for this browsing index?
Thanks!

A: You cannot use VLVIndex for filters that are constantly changing. VLVIndex are meant to provide consistent scrolling lists of results.
VLV must also come with a Sorting order.
It looks like to me that you may just need to index the modifyTimeStamp (for ordering) and use the Page Result Control to avoid getting all entries at once.


text:
Q: Get the accuracy of individual test images in image segmentation I am using CNNs in Tensorflow for image segmentation.I know how to compute the training accuracy
 #compute the accuracy
    correct_prediction  = tf.equal(tf.argmax(flat_logits, 1), tf.argmax(y,1))
    accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

[train_accuracy] = sess.run([accuracy], feed_dict={x: batch_x, y:batch_y})

is it possible to compute the accuracy of the accuracy of each individual tested images?

A: Yes, it is possible. You can do it by simply writing:
test_accuracy = sess.run(accuracy, feed_dict={x: x_test, y:y_test})

where x_test is your single test image (say of size [1, width, height, depth] and y_test is the corresponding output.


text:
Q: Select the first id from table I want to list all the entries depending on my subcategory. So i want to display the entries list on load home page without previous selecting any categories or subcategories.
I've made a query that is returning list of entries, but putting manually subCategoryId.
Here is the query:
 int userId = WebSecurity.GetUserId(User.Identity.Name);

  var preQuery = (from sub in dc.SubCategory
                  join c in dc.Category on sub.SubCategoryId equals c.Id
                  join u in dc.User on c.UserId equals u.UserId
                  where u.UserId == userId
                  select sub.SubCategoryId).Take(1).FirstOrDefault();

        var query = (from e in dc.Entry
                     join sub in dc.SubCategory on e.SubCategoryId equals sub.SubCategoryId
                     join cat in dc.Category on sub.CategoryId equals cat.Id
                     join u in dc.User on cat.UserId equals u.UserId
                     where ((u.UserId == userId) && (cat.UserId == userId)
                         && (sub.CategoryId == cat.Id) && (e.SubCategoryId == preQuery ))
                     select e).ToList();

        return View(query);

So my point is that i want instead of writing manually id of 6, want to take the list of subcategories ids and select the first id from it. I've made prequery but still not the required result.Any suggestions what i am doing wrong?

A: I was able to get a solution for my question, so i am posting the solution. If anyone has a suggestion of optimizing the solution, is welcome to share.
  int userId = WebSecurity.GetUserId(User.Identity.Name);

        var preQuery = (from e in dc.Entry
                     join sub in dc.SubCategory on e.SubCategoryId equals sub.SubCategoryId
                     join cat in dc.Category on sub.CategoryId equals cat.Id
                     join u in dc.User on cat.UserId equals u.UserId
                     where u.UserId == userId
                     select e.SubCategoryId).Take(1);

        var query = (from e in dc.Entry
                     join sub in dc.SubCategory on e.SubCategoryId equals sub.SubCategoryId
                     join cat in dc.Category on sub.CategoryId equals cat.Id
                     join u in dc.User on cat.UserId equals u.UserId
                     where ((u.UserId == userId) && (cat.UserId == userId)
                         && (sub.CategoryId == cat.Id) && (e.SubCategoryId == preQuery.FirstOrDefault()))
                     select e).ToList();

        return View(query);


text:
Q: The wireless network appears to have been compromised and will be disabled for about a minute I just received a message on my Mac OS X system telling me:

The wireless network appears to have been compromised and will be disabled for about a minute.†

(It's a wireless WPA2-PSK secured network BTW)
Sample message:

I looked in the logs of my router (a Zyxel P-2602HW-D1A) only to see a few (outbound) "syn flood TCP ATTACK" logs, but those were from like a week ago, other than that nothing. What tools on Mac OS X do I have to analyse this security breach occurence? Are there some security logs on Mac OS X that I can inspect?
What other measurements should I take? And how serious should I take this warning from Mac OS X?
System: Macbook Pro Intel Core 2 Duo 2.2 Ghz
OS: Mac OS X 10.5.8
Network: wireless WPA2-PSK
Relevant software: Parallels Desktop with Windows XP (was open, but stopped at the time)
Other systems on my network:
Windows XP SP3 desktop (was running at the time)
If you need any more info, don't hestitate to ask.

† The actual message was in Dutch, probably something like the following from /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/
ClientController.bundle/Contents/Resources/Dutch.lproj:

Het draadloze netwerk wordt gedurende ongeveer een minuut uitgeschakeld omdat de beveiliging ervan is aangetast.

A: That's the message you get when the AirPort card/driver detects two TKIP "MIChael" MIC (Message Integrity Check) failures within 60 seconds, or is notified of such failures by the AP.
TKIP encryption, which was the basis of original WPA and may still be enabled under WPA2 in what's known as "WPA2 Mixed Mode", had a tiny likelihood of random MIC failures, but two failures within 60 seconds is too unlikely to be randomness, so the WPA spec treats it as an attack, and requires the network to go down for a minute or two to thwart attackers.
The AES-CCMP encryption that is the basis of WPA2 also has a MIC (well, they call it a MAC -- Message Authentication Check -- it's the 'M' of CCMP), but I don't recall off the top of my head what's supposed to happen if there's an AES-CCMP MAC failure.  I don't think it involves downing the network temporarily though.
By far the most likely scenario is that you just happened to hit some bug where either the AP or the client screwed up its MIC handling, or where the MIC-failure-handling code got accidentally triggered.
I've seen wireless cards have bugs in this area, especially running in promiscuous mode.  You might want to make sure that Parallels or something else isn't putting your wireless card into promiscuous mode.  Run ifconfig en1 (if en1 is your AirPort card, as it typically is) and look in the interface flag list ("UP,BROADCAST...") for the PROMISC flag. Some VM software uses Promiscuous mode to enable "bridged" or "shared" networking, at least for wired Ethernet interfaces. Because many wireless cards don't handle promiscuous mode well, most modern VM software is careful not to put a wireless interface into promiscuous mode.
It's possible, but unlikely, that someone was messing with you by forging an 802.11 de-auth frame with the relevant reason code, which the client then dutifully reported up the stack.
By far the least likely scenario is that someone was actually launching an attack on your network.
If the problem happens again, an 802.11 monitor-mode packet trace is probably the best way to record the attack.  But I feel that explaining how to do a good 802.11 monitor-mode packet trace under 10.5.8 is beyond the scope of this answer. I will mention that /var/log/system.log might tell you more about what the AirPort client/driver software saw at the time, and you can increase the log level a bit with
sudo /usr/libexec/airportd -d

Snow Leopard has much better AirPort debug logging, so if you upgrade to Snow Leopard, the command is:
sudo /usr/libexec/airportd debug +AllUserland +AllDriver +AllVendor

Sniffing is easy on Snow Leopard:
sudo /usr/libexec/airportd en1 sniff 1

(That example assumes your AirPort card is en1, and your AP is on channel 1.)

A: As per this thread, the message comes from the AirPort driver when it detects a problem with the TKIP Message Integrity Check or the associated checksum.
So basically either your network is compromised by  TKIP injection attacks, or simply the router is incorrectly calculating the MIC or checksum, or the packets got corrupted during transmission due to interference from another routers operating on similar frequency ranges.
The suggested way of avoiding this is to change to a different router or, if possible, only use WPA2 encryption.
See: How to avoid the WPA wireless security standard attack?

TKIP was created as a quick fix for older APs and clients that were crippled by WEP. Instead of using the same key to encrypt every packet, TKIP uses RC4 with a different key for each packet. These per-packet keys neutralize WEP encryption crackers. In addition, TKIP uses a keyed Message Integrity Check (MIC) to detect packets that are replayed or forged. Anyone can send (that is, inject) a TKIP-encrypted packet that has been captured and modified, but those packets are dropped because the MIC and checksum do not match the data carried by the packet. APs using TKIP usually transmit an error report when the first bad MIC is received. If a second bad packet arrives within 60 seconds, the AP stops listening for another minute and then "rekeys" the WLAN, requiring all clients to start using a new "pairwise master key" to generate both the MIC key and those per-packet encryption keys.
This plugged the gaping holes left by WEP. All WPA-certified products can use TKIP and its MIC to resist 802.11 data eavesdropping, forgery, and replay attacks.


text:
Q: How can I determine an NPC's level? Basically, I want to try to do a survivalist, perma-death playthrough of Skyrim on master difficulty on PC.
I tried it a few months ago and it was really, really fun. You think about things a lot more before rushing into battles, and it actually feels like you're actually there, especially when you refuse to fast travel. You start pining for peaceful locations when your potions are running low and you're stuck in forsworn turf.
The thing is, on this previous play-through, I was killed by a bounty hunter in one hit. Despite all my precautionary wards, amulets and potions, this guy came up to me and killed me in one. He looked like just a normal human (rather than a dragon priest or anything) so there was no way of telling he was going to do this.
How can I view an NPC's level?  Or prevent being one-shotted?

A: You can use the console command getlevel after targeting the NPC to determine his level. This obviously only works on PC, there is no way to do that on a console.
As for not getting one-hit killed, you need to use smithing to improve your armor and get some magic resistance.

A: Here's what you're looking for.
Display Enemy Level
https://www.nexusmods.com/skyrim/mods/90041

A: Many enemies are harder when you level up because they level with you. They have a minimum amount for example a giant's minimum level is 36. The NPC with the highest level is Arngier in High Hrothgar who is level 150.

A: I know this thread is old... But this might help those looking anyway.
Guess the Distance mod, on nexusmods, helps with this. It is fairly immersive specially with the telescope addon.
http://www.nexusmods.com/skyrim/mods/30816/


text:
Q: Saber linha e arquivo que está executando um método Quero saber se é possível saber a linha e arquivo que está sendo executado um método. Por exemplo, tenho uma class Log, com ela faço registros de logs dos usuários.
Log.php
<?php
/**
* Classe de Logs
*/
class Log
{
   var $con;

   private $error, $orig;

   function __construct($userid = NULL) {
      global $con;
      $this->con = $con;
      $this->obs = '';
   }

   function SetError($error, $type = 1, $concat = FALSE, $register = TRUE){
      $this->error = ($concat ? $this->error."\n ".$error : $error);
      $this->orig = 'Arquivo: '.__FILE__."\n Linha: ".__LINE__;
      if($register) $this->RegisterLog($error);
      return FALSE;
   }

Arte.php (linha 85)
  } else return $this->SetError('Não foi possível carregar os produtos.');

NOTA: A CLASSE ARTE ESTENDE A CLASSE LOG
Quando entrasse nessa linha, gostaria que a variável $this->orig tivesse o seguinte valor:

Arquivo: C:\xampp\htdocs\projeto\app\class\Arte.php Linha: 85

Mas vem o valor:

Arquivo: C:\xampp\htdocs\projeto\app\class\Log.php Linha: 19

É possível fazer isso? Tem alguma outra alternativa que posso fazer?
PS.: Se possível gostaria de não passar essas informações por parâmetros, pois teria que mexer em muita coisa.

A: Você pode fazer usando a função debug_backtrace() :
class Caller extends Log {

    function test() {
        // Chama a função na classe log
        parent::setLog();
    }

}

class Log {
    // Metodo de log
    public function setLog() {
        var_dump(debug_backtrace());
    }

}

$caller = new Caller();
$caller->test();

Saída:
array (size=2)
  0 =>
    array (size=7)
      'file' => string '/home/edi/NetBeansProjects/zion/testes/test.php' (length=47)
      'line' => int 7
      'function' => string 'setLog' (length=6)
      'class' => string 'Log' (length=3)
      'object' =>
        object(Caller)[1]
      'type' => string '->' (length=2)
      'args' =>
        array (size=0)
          empty
  1 =>
    array (size=7)
      'file' => string '/home/edi/NetBeansProjects/zion/testes/test.php' (length=47)
      'line' => int 24
      'function' => string 'test' (length=4)
      'class' => string 'Caller' (length=6)
      'object' =>
        object(Caller)[1]
      'type' => string '->' (length=2)
      'args' =>
        array (size=0)
          empty

http://php.net/manual/en/function.debug-backtrace.php


text:
Q: Unable to use 'vi' on Ubuntu 12.04 Whenever I try to open any text file using vi or vim, I get the following error,
vim: error while loading shared libraries: libtcl8.5.so.0: cannot open shared object file: No such file or directory

I compiled and installed tcl 8.6 from source to take care of this dependency but it still doesnt work. What could be the issue?

A: Try this command in a terminal:
sudo apt-get --reinstall install tcl8.5

A: Please install vim using
sudo apt-get install vim

and use
sudo apt-get -f install

if there are any dependency problems.


text:
Q: Displaying certain word count for multiple files in bash So i am trying to write a program that counts how many instances in a file a word appears in a certain file. I am able to to find how many times one word with one file by
a=`grep -c $1 Samplefile.txt`
echo "you matched: $a times for word $1 "

how would i do this for multiple files.
The first thing I got to work used a sample input of
    (Program1 word file). this next requirement needs me to be able to do Program2 word file1 file2 for input

A: Just use shel glob to make grep run for multiple files:
grep -c "$1" *.txt

Here this grep will run for all *.txt files instead of just Samplefile.txt
Output will be like this:
abc.txt:3
Samplefile.txt:5
xyz.txt:0

Alternatively you can do same in for loop:
for f in *.txt; do
    grep -Hc "$1" "$f"
done

EDIT: As per comment if you want to run it for known set of file then use
for f in "XXX" "YYY"; do
    grep -Hc "$1" "$f"
done


text:
Q: querySelector(".class").remove() goes very slow on iphone but not so much on android, what could it be? I've made a design portfolio, basically the whole website is just one page and for each project, there's a div that pops out and show the content (images and embedded Vimeo videos)
What I've noticed is that when closing a project on mobile (either using 'x' button or opening another project) it takes very very long (about 2/4 seconds) on iphone 8 while on an older android phone it takes less, even though with the andorid it's overall bit more laggy.
this is the website
I've also checked on google page speed insight but I couldn't figure out why on iphone is slower than desktop or android mobile.
Can you please help me understand what could I do to trying speeding up the website? Do you have any advice about what to check or tests to run? I know I haven't provided a short code example and I apologize if this kind of question are not accepted, in that case I'll remove the post
Thank you very much!


text:
Q: Basic Angular POST Format Explanation I really don't understand what I am doing with angular post. For example:
$http.post("http://localhost:999333/api/econdata", $scope.econData)
.success(function (response) { $scope.responseEconData = response; });
}

So, I have a post. I am only GUESSING at what I am doing - the angular "$http" object has a method called post that takes some parameters - the link to my POST controller (what url to post to) and "econData," which is the post message. I believe it can be overloaded, but whatever.
However, I don't understand the ".success" format at all. Why is there what looks like another method? Can someone explain this to me or break it down into "simpler" code?
Also, why is the post self-invoking? What do I do if I want to run the post onClick or something?
edit: The code posted is inside a controller and works perfectly. I just don't understand why/how.

A: Promises are a way of handling asynchronous functions.  The post method returns a promise before it actually posts anything, i.e., it returns the promise object immediately. At that point the promise doesn't hold the result of the post, but it does have a success method that you then use to define a function that will be called when the post completes. The argument that will be passed to that function will be the response from the post.

A: As i understand it, the http post returns a promise object . Success is calling the success function on the promise object.
Angular docs:
The $http service is a function which takes a single argument — a configuration object — that is used to generate an HTTP request and returns apromise with two $http specific methods: success and error.

A: $http is asynchronous.  The success method of the $http service call accepts a callback handler, that angularjs will call for you when it eventually succeeds.  The argument passed to your success handler will be the return value from your service call, converted to JSON format.


text:
Q: Delay in playing sounds using AVAudioPlayer -(IBAction)playSound{ AVAudioPlayer *myExampleSound;

NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:@"myaudiofile" ofType:@"caf"];

myExampleSound =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:NULL];

myExampleSound.delegate = self;

[myExampleSound play];

}

I want to play a beep sound when a button is clicked. I had used the above code. But it is taking some delay in playing the sound.
Anyone please help.

A: There are two sources of the delay. The first one is bigger and can be eliminated using the prepareToPlay method of AVAudioPlayer. This means you have to declare myExampleSound as a class variable and initialize it some time before you are going to need it (and of course call the prepareToPlay after initialization):
- (void) viewDidLoadOrSomethingLikeThat
{
    NSString *myExamplePath = [[NSBundle mainBundle]
        pathForResource:@"myaudiofile" ofType:@"caf"];
    myExampleSound =[[AVAudioPlayer alloc] initWithContentsOfURL:
        [NSURL fileURLWithPath:myExamplePath] error:NULL];
    myExampleSound.delegate = self;
    [myExampleSound prepareToPlay];
}

- (IBAction) playSound {
    [myExampleSound play];
}

This should take the lag down to about 20 milliseconds, which is probably fine for your needs. If not, you'll have to abandon AVAudioPlayer and switch to some other way of playing the sounds (like the Finch sound engine).
See also my own question about lags in AVAudioPlayer.

A: AudioServicesPlaySystemSound is an option. Tutorial here, sample code here.


text:
Q: Creating 10 circles in android I am trying to create some Circles inside my layout, here is my drawable.circle code:
 <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <gradient
        android:angle="270"
        android:endColor="#80FF00FF"
        android:startColor="#FFFF0000" />
</shape>

but since I am trying to create 10 of this view and also do some functions on them I can't create them inside my layout file, I want to use array of views - here is what I got so far:
private View imageViewArray[];
private Random rand;
private int layoutwidth;
private int layoutheight;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    rand = new Random();
    Display display = getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    layoutwidth = size.x;
    layoutheight = size.y;
    imageViewArray = new ImageView[10];
    for (int i = 0; i < 10; i++) {
        imageViewArray[i] = new View(this);
        imageViewArray[i].setTag(i);
        randomx = rand.nextInt((layoutwidth - layoutwidth / 3) + layoutwidth / 3);
        randomy = rand.nextInt(layoutheight - layoutheight / 3);
        imageViewArray[i].setX(randomx);
        imageViewArray[i].setY(randomy);
        rlt.addView(imageViewArray[i]);
    }

How do I assign Circle.xml to all of these views? imageViewArray[i].set?

A: There's no reason not to draw them in the xml, except if the random part is necessary.
Anyway, in order to add views to your main view, create a layout with the circle only. Then inflate it.
final View inflatedView = LayoutInflater.from(this).inflate(R.layout.your_circle_id, null);
/*Manipulate the inflated view (for example, change location)*/
LinearLayout container = (LinearLayout)findViewById(R.id.your_main_layout);
container.addView(inflatedView);

I hope that I got you correctly. Change the LinearLayout if it's off a different type.

A: You can add your drawable xml file as background resource to the ImageView:
imageViewArray[i].setBackgroundResource(R.drawable.circle);

A: You should use java graphics classes to do it.


text:
Q: In Swift: the example below why must I place (let one) next to .Success for the code to work? In the example below why must I place (let one) next to .Success for the code to work? Why is it not (let = one) or just (one)? I am trying to understand the syntax.
enum Status {
    case Success(String)
    case Failure(String)
}
let downloadStatus = Status.Failure("Network connection unavailable")

switch downloadStatus {
case .Success(let one):
    println(one)
case .Failure(let two):
    println(two)
}

A: This is known as value binding.  The value contained in the enum value is temporarily bound to the variable in the case.  If you use let the value will be bound to a constant and if you use var it will be bound to a variable.
let downloadStatus = Status.Failure("Network connection unavailable")

switch downloadStatus {
case .Success(let one):
    println(one)
case .Failure(var two):
    two += "!!!"  // two is a var, so I can modify it
    println(two)
}

A:
I am trying to understand the syntax

There is nothing to understand. That simply is the syntax for extracting the associated value from an enum case. It's like the masks when you play Calvinball - no one is allowed to question them.
Now, you might object that this syntax is kind of clumsy and annoying. You have to go through the rigmarole of a switch statement just to pull out the associated value?!? That is a perfectly valid complaint, people have been making it since Swift was unveiled in June 2014, and the folks at Apple know that it's kind of weird and may change it in future. But for now, that's the syntax, and that's all there is to know about it.


text:
Q: Processing toolbox nowhere to be found I have just downloaded the newest version of QGIS (3.2) and the processing toolbox is nowhere to be found. It says that it is now apart of the core package, but i cannot find it on anywhere on the program.

A: You can open it up with Ctrl + Alt + T.
Or you can click on the Processing Toolbox Icon:

A: You have to activate the plugin "Processing" in the Plugin-Manager.

A: Click on Processing > Toolbox on the Menu Toolbar. Then you can bring it back with Ctl+Alt+T.

A: Try disabling 'Processing' in plugins by unchecking it. Close the plugins pop-up.
Re-open plugins and re-enable 'Processing'. Close the plugins pop-up again.
Look for the icon in the toolbar or press CTRL+ALT+T

A: @Arthur R, thank you. That is correct and totally fixed it: enable "Processing" plug-in.
Other answers that reference Processing drop down menu, the toolbox symbol, or ctrl+alt+t are not helpful for this issue because none of those appear without the plug-in enabled.


text:
Q: How to get multitouch support in Bluestacks? I was playing The Room on Bluestacks, and the game requires features of a real android device such as multitouch, tilt, shake and swipe. Although the first level was quite simple, and required only swiping, I finished it quickly. But the second chapter has many functions like tilt and multitouch. I don't know what it has in the third chapter as this game has 5 chapters in all, and I was stuck at the chapter 2 multitouch part where I have to swipe to switches at the same time. So is there a way to complete it?

A: I actually opened a thread on their forum about this. While there are 3rd party options, as mentioned by lucky (I personally couldn't be bothered messing around trying to get these to work), there is currently no support within Bluestacks itself.
Bluestacks forum thread

A: As mentioned in a post from the xda-developers forum,

If you want experience multitouch on bluestack but your windows not
  have multitouch screen install Droidmote Client on your phone (free),
  install Droidmote Server for windows on your windows. For
  example, in google maps you can zoom in out rotate with two finger etc.

With your android phone, with one application called DroidMote Client, you can control another android Phone or Tablet, a Windows pc or a Linux pc, on wich you have installed DroidMote Server.
Features:
Remote Mouse:
[✔] Remote Multitouch Touchpad
[✔] Two Fingers Scroll Zoom Rotate
[✔] Remote Keyboard
[✔] Remote Mediaplayer
[✔] Remote Dpad
[✔] Remote Multitouch Gamepad
[✔] Remote Control with accelerometer
[✔] Two virtual analog stick on screen
[✔] Touch emulation allows you to map buttons and analog sticks to the screen. Play all your favourite games with full analog support, even those without built-in controller support!
[✔] TouchMouse for games that not support a real mouse
[✔] Voice dictation with android keyboard
[✔] Gesture typing with android 4.2 keyboard
Further more information on this thread.

A: I did the following, there is an option in the keyboard, where it says swipe, if you add the swipe function and for example Left is A, then Right is D, and press both at the same time it does the 2 finger swipe, but it only works on both sides and up and down. I got my issue resolved like that.


text:
Q: How do you update a state with a time interval using redux toolkits? I have the following initial state and slice objects. How do I add values to the hand array every second using dispatch? My intention is to have each dispatch be completed before the next one. I looked at createAsyncThunk but I wasn't clear on how to implement it on the same action repeatedly with a time interval.
const initialState = {
    hand: [],
};

export const stateSlice = createSlice({
    name: 'black',
    initialState,
    reducers: {
        updateHand: (state, action) => {
            state.hand = [...state.hand, action.payload]
        }
    }
});

Thanks.