text:
Q: Error installing cocoapods: Failed to build gem native extension Building native extensions.  This could take a while...

ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20150610-6663-7exisu.rb extconf.rb

creating Makefile
make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
linking shared-object json/ext/generator.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [generator.bundle] Error 1

make failed, exit code 2

This is error log in terminal and i cant find the solution i update
the ruby and system and lots of stuff where i wrong- i have ios7 and
Mac-10.9

A: I suppose you have run a gem update before installing the cocoapods gem, so all your gems should be updated.
That message is a new warning introduced with XCode 5.1, that now threats unknown parameters as errors. You didn't specify which version of cocoapods and XCode you are using, but my guess is that there is a mismatch between the two. Maybe Xcode is too old? You are installing a brand new cocoapods so at least that should be the latest available.
Instead of updating XCode, you could try disabling that warning and hope that the compilation completes successfully setting an environment variable just before installing cocoapods, with this:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install cocoapods

A: I follow this steps to install Cocoapods. May be it useful for you.

*

*Open Terminal

*gem install cocoapods

*pod setup


text:
Q: Requests failing with a timeout, why? I have configured MassTransit with RabbitMQ as transport. And I just use an instance of generic IRequestClient to send requests to a consumer that then should return a response.
My problem is that every other request fails with a TimeoutException. Execute it once, the next time it fails, and then it works again.
The Consumer is not even invoked when failed.
What can be the reason for this?
I have other services share a similar name in their requests and consumers. I have tried to figure out if that is the problem.

A:
You should post the configuration code of your application using the request client and the one configuring the consumer.

If you have other consumers with the same name, it's likely they're on the same queue if you're using ConfigureEndpoints, which could be the root cause of the issue.
Since it's every-other-message that times out, that would make sense since RabbitMQ will load balance the queue across the different services with the same queue name.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Ограничить количество посещений (в секунду) сайтов ботом bing в конфигурации nginx К сайту привязано несколько доменов.
Необходимо снизить посещение сайтов (в совокупности) ботами ПС Bing.
Как преобразовать директиву
limit_req_zone $binary_remote_addr zone=one:10m rate=100r/s;

чтобы ограничение действовало не по ip, а по user_agent в котором встречается подстрока "bing"?
При превышении количества запросов со стороны этих ботов выдавать ошибку с кодом 429: limit_req_status 429;

A: Предположим что мы хотим запросы с User-Agent содержащие слово bing ограничивать 100rps независимо от IP, а все остальные запросы ограничить 100rps на IP.
Можно написать примерно такой конфиг:
map $http_user_agent $limit_key {
  default $binary_remote_addr;
  "~bing" 1;
}
...
limit_req_zone $limit_key zone=one:10m rate=100r/s;

Документация:

*

*https://nginx.org/r/map

*https://nginx.org/r/limit_req_zone


text:
Q: How to implement MQTT on Zephyr OS with cellular devices? I am a beginner on Zephyr OS and wanted to know if it is possible to implement MQTT on Zephyr OS with Cellular Devices like SIM800 or Quectel BG96 that usually work on UART and support TCP protocol which is the base of MQTT.
I looked through the example for MQTT given for Zephyr which is done over LAN but could not figure out how to implement the same with a cellular device.

A: MQTT itself does not necessitate TCP as the transport layer but you may need one transport layer. Most of the implementation out there are relying on TCP as the transport layer e.g.:

*

*Paho MQTT Client C Library

*Paho MQTT Client C++ Library
There is an implementation that only serializes and deserializes MQTT compliant packages. But this implementation is based on the MQTT-SN (sensor-network) standard and needs a MQTT-SN compliant MQTT-gateway or MQTT-Broker. Theses packages you may transfer as you like: As UART stream, memory map IO, etc.

*

*Paho MQTT-SN Package C Library
In addition, check to implement and provide a TCP/IP socket to a MQTT client Library that wraps the AT Command specification of both devices:

*

*AT Commands for TCPIP Application Toolkit

*BG96 TCP/IP AT Commands Manual


text:
Q: Two-stage rotation animation is deprecated. This application should use the smoother single-stage animation I am building a ipad application. when the applications starts i show it in landscape Right mode. But as soon as the application starts I get this message
Two-stage rotation animation is deprecated. This application should use the smoother single-stage animation

I used this method in all my classes
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

I also set my supported interface orientations (iPad) to landscape right in my plist file.
How to resolve this warning message?

A: You can also get this error message if you've run the app with an empty tab bar controller as root in your storyboard. I was just starting on an app and my UITabBarController has no view controllers yet, but is presenting a login modal.

A: I just realized - after reading this answer - that I was simply using the Tab Bar Controller wrong: the tab bar should only be used as a root controller, however I inserted a navigation controller before it.

A: The problem is that your app is using one of these methods, which were deprecated in iOS 5.0:
didAnimateFirstHalfOfRotationToInterfaceOrientation:
willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:
willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:

You need to modify your view controllers to override willAnimateRotationToInterfaceOrientation:duration: instead, and to not override any of the "HalfOfRotation" methods.

A: ckeck your array declaration for tab bar
..possible mistake u done:
  I declared array oblects after assigning
tabBarController.viewControllers = tabControlArry;
[tabControlArry addObject:navCOntroller];
[tabControlArry addObject:navController1];

correct way:
[tabControlArry addObject:navCOntroller];
[tabControlArry addObject:navController1];
tabBarController.viewControllers = tabControlArry;

A: This error message is related to TabBarController usage. You can expect this error when you don't make your tabBarController as the "root controller" for your app. So make your TabBarController as the root controller & this error will no more pester you.


text:
Q: C++ how to get folders and files names from virtual device? How to get all folders and files names in virtual device plugged to pc?
In C++;
I have problem because the virtual device not have a letter like local disc;
Path started like this "Computer\SUPRA_M727G\Internal storage"

A: You have to use Shell interfaces, namely IShellFolder and IEnumIDList.
To get an IShellFolder for the "Internal storage" folder, you can either:

*

*Use SHGetDesktopFolder() to get an IShellFolder for the root of the Shell namespace, then pass the "Computer\SUPRA_M727G\Internal storage" string to its IShellFolder::ParseDisplayName() method to get an absolute ITEMIDLIST that you can pass to its IShellFolder::BindToObject() method.

*Use SHParseDisplayName() or ILCreateFromPath() to convert the "Computer\SUPRA_M727G\Internal storage" string into an absolute ITEMIDLIST that you can pass to SHBindToObject() with its psf parameter set to NULL.
Either way, once you have an IShellFolder for the storage folder, you can use its IShellFolder::EnumObjects() method to get an IEnumIDList for enumerating its files and subfolders.  The enumeration will give you a relative ITEMIDLIST for each item.  To retrieve each item's name as a string, pass each ITEMIDLIST to its IShellFolder::GetDisplayNameOf() method, and then pass the returned STRRET to one of the StrRetTo...() functions (StrRetToBSTR(), StrRetToBuf(), or StrRetToStr()).
Refer to MSDN for more details:
Introduction to the Shell Namespace
Navigating the Shell Namespace


text:
Q: Angular modal controller scope Im having problems with the scope for a modal. Im using the Angular Bootstap library to show the modal. My code is:
angular.module('myApp.workspaces')

.controller('ModalInstanceCtrl', function ModalInstanceCtrl($scope) {

    $scope.ok = function() {

        console.log('in ModalInstanceCtrl and $scope.form is ', $scope.form);

    };

})

.controller('WorkspacesCtrl', function WorkspacesController(workspacesService, $scope, $location, $modal) {

    $scope.uploading = false;
    $scope.noWorkspaces = false;
    $scope.myWorkspaces = [];

    $scope.showModal = function() {

        $scope.opts = {
            backdrop: true,
            backdropClick: true,
            dialogFade: false,
            keyboard: true,
            templateUrl: 'assets/workspaces/modalContent.html',
            controller: 'ModalInstanceCtrl',
            resolve: {}, // empty storage
            scope: $scope
        };

        $modal.open($scope.opts);

    };
});

And modalContent.html is:

Workspace Name

    <form>
        <fieldset>
            Workspace Name:
            <input type="text" name="name" ng-model="form.name" />
        </fieldset>
    </form>

hjhhhjsad

    <button class="btn btn-primary" ng-click="ok()">OK</button>

    <button class="btn btn-warning" ng-click="cancel()">Cancel</button>

When I open the modal and then click OK,the console output is:
in ModalInstanceCtrl and $scope.form is undefined

I've tried every solution provided in a previous question here. Including:

*

*passing scope: $scope as an option to the modal

*changing ng-model="name" to ng-model="form.name"

*changing ng-model="name" to ng-model="$parent.name"

However I still cannot get access to the inout value. What am I doing wrong?
EDIT
I realised I can access the input value with
$scope.$$childHead.$$childHead.form.name

This clearly doesnt seem right though....

A: $scope.form do not exists, try
ng-modal="formName"

A: It seems you are only missing the $scope variable.
.controller('ModalInstanceCtrl', function ModalInstanceCtrl($scope) {

    $scope.form = {
        name: "";
    };

    $scope.ok = function() {

        console.log('in ModalInstanceCtrl and $scope.form is ', $scope.form);

    };

})


text:
Q: What #define flag indicates THUMB-2 instructions are available? I a version of some C code which I have optimized to use specific ARM THUMB-2 assembly instructions. I want the program to compile to use these instructions when they are available, and when they are not I want to compile the unoptimized branch.
What is the right #ifdef for this when using the ARM gcc compiler?


text:
Q: ColorBox jQuery Editing I'm using the jQuery plugin ColorBox.
I want to have it styled like facebook.
So the Photo will be on the left, and description, comments on the right.
I am not good with javascript, i'm asking if someone can take a look at the code and give me an advice on how to edit the code..
Basically, i need to replace the current div that is displaying the image with 2 DIVs with float:left.
On the first div will be loaded the image, and on the second the description and some custom html.
I'm using the fixed width/height theme.
I have taked a look, but as i said before i'm not good with javascript, and i don't know where to edit.
Hope someone can help me!

A: you don't need to edit the source of the plugin
change the css for cboxTitle & cboxLoadedContent (float:left, set some width)
to add custom content (more than the title property of the a tag) you'll have to use onLoad or onOpen callback
$("#inline").colorbox({
       onOpen : function() {
            //apend your content to cboxTitle
          }
       });

A: A much simpler approach would be top use ColorBox with its iFrame option. I have done this such that the plugin opens an entirely new HTML page which can be styled anyway you like. In this way, you are basically using ColorBox as a windowing manager.
Good luck!


text:
Q: Question about setInterval function I want to a div to appear for 10 seconds at a time, every 1 minute.  So at the start of the minute, the div should appear for 10 seconds, go away, and then reappear again 50 seconds later, and on and on.
The only thing I have been able to figure out is how to make it disappear after 10 seconds.
$(function() {

    setInterval( function() {
        hideMsg()
    }, 10000);

    function hideMsg() {
        $('#header p').css('display', 'none');
    }
});

A: $(function() {

    showMsg();
});
function showMsg()
{
   $('#header p').css('display', '');
   setTimeout(hideMsg, 10000);
}
function hideMsg(){
   $('#header p').css('display', 'none');
  setTimeout(showMsg, 60000);
}

This is it,
showMsg will show message end timeout will execute hideMsg after 10sec then hideMsg will hide msg and timeout will execute showMsg in 1 minute.

A: use setTimeout() function
$(function() {

    setInterval( function() {
        hideMsg()

    }, 10000);

    function showMsg(){

    }

    function hideMsg() {
        $('#header p').css('display', 'none');
        setTimeout(function(){
              $('#header p').css('display', 'block');
        }, 50000);
    }
});

A: function show(){
    // whatever your show code is

    // hide after 10 seconds
    setTimeout(function() {
                   // whatever your hide code is
              }, 10000);
}

// invoke show every 60 seconds - show will hide itself after 10 seconds
var handle = window.setInterval(function() { show(); }, 60000);

A: var messageTimer = setTimeout(showMsg, 50000);
function showMsg() {
    $('#header p').show();
    clearTimeout(messageTimer);
    messageTimer = setTimeout(hideMsg, 10000);
}
function hideMsg(){
    $('#header p').hide();
    clearTimeout(messageTimer);
    messageTimer = setTimeout(showMsg, 50000);
}

A: What abou this?
   $(function() {
        var count = 0;
        setInterval( function() {
            ++count % 6 ? $('#header p').hide()
                        : $('#header p').show();
        }, 10000);
    });

A: Wanted to come up with something original using an interval timer:
$(document).ready(function() {
    var hideCnt = 0;    // 10 second interval cntr
    setInterval(function() {
        ++hideCnt;
        if (hideCnt >= 5) {
            $('#header p').toggle();
        }
        if (hideCnt >= 6) {
            hideCnt = 0;
        }
    }, 10000);
});

And a fiddle that shows the interval timer solution working: http://jsfiddle.net/jfriend00/KReau/.
And here's the more traditional flavor:
$(document).ready(function() {
    function show() {
        $('#header p').show();
        setTimeout(hide, 50000);    // hide after 50 seconds
    }
    function hide() {
        $('#header p').hide();
        setTimeout(show, 10000);  // show after 10 seconds
    }
    show();
});


text:
Q: Perl algorithm compare arrays I have a question with my algorithm in Perl programming and I can't figure it out how to manage.
I have a database in a text file with some columns and many rows. I already could read all variables and save it into a multi-dimensional array. Let's presume its like this
 1.  Jack  A  math
 2.  John  A+ math
 3.  Jack  B  sports
 4. .
 5. .
 6. .

You can see there are four columns (id  name  grade lesson)
Now my question is, I want all rows with the same name exported to a new text file. I already have the algorithm idea that I can check row number one and compare it to all other rows blow and if there was a similarity rows export them and then check row number two and compare it with all other below rows and if there was similarity export it and so on.
Is it the right algorithm that I have in mind or is there any other algorithm for doing this?
I will be appreciate if you can give me a code example or any other further steps I can take.
I want this result for my example
1. Jack A for math, B in sports
2. John A+ for math

A: I suspect that this is homework, so I will give you a solution that you can use as hints to write your own answer. If you have problems with understanding it then please ask.
use strict;
use warnings;

my %data;

while (<DATA>) {
  my ($id, $name, $grade, $lesson) = split;
  push @{ $data{$name} }, [ $grade, $lesson ];
}

my $n;
for my $name (sort keys %data) {
  my $grades = $data{$name};
  printf "%2d. %s %s\n", ++$n, $name, join ', ', map "$_->[0] in $_->[1]", @$grades;
}

__DATA__
1.  Jack  A  math
2.  John  A+ math
3.  Jack  B  sports

output
 1. Jack A in math, B in sports
 2. John A+ in math


text:
Q: rails admin and has_one including one model twice I have model that include other model by has_one relation twice. I need to be able for select each of them by dropdown list in rails_admin. There is my way:
class Unit
  include Mongoid::Document
  has_one :quiz, class_name: 'Quiz', inverse_of: :quiz_socket, dependent: :destroy
  has_one :case, class_name: 'Quiz', inverse_of: :case_socket, dependent: :destroy
  def quiz_socket_id
   self.quiz.try :q_id
  end
  def quiz_socket_id=(q_id)
   self.quiz = Quiz.find(q_id)
  end
  def case_socket_id
   self.case :c_id
  end
  def case_socket_id=(c_id)
   self.case = Quiz.find(c_id)
  end
end

Quiz model:
class Quiz
  include Mongoid::Document

  field :name

  belongs_to :quiz_socket, class_name: 'Unit', inverse_of: :quiz
  belongs_to :case_socket, class_name: 'Unit', inverse_of: :case

  validate :only_one_socket_present

  protected
  def only_one_socket_present
     errors[:case_socket] << 'only one socket can be presented' if quiz_socket.present? && case_socket.present?
  end
end

And rails_admin:
RailsAdmin.config do |config|
  config.model Unit do
    edit do
     field :quiz, :belongs_to_association
     field :case, :belongs_to_association
    end
  end
end

It almost works. I can select both quiz and case but after save, unit has only quiz and case is deleted from database.
There is server log:
> Processing by RailsAdmin::MainController#edit as HTML   Parameters:
> {"utf8"=>"✓",
> "authenticity_token"=>"/N9PXwsmmuNrjhprml/QR5qxtsejovf+yl4A2fqnes4=",
> "unit"=>{"summary"=>"
edh
\r\n", "name"=>"sdg", "video_link"=>"",
> "part_id"=>"54d4c680616e7444bf070000", "unit_progress_ids"=>["", ""],
> "quiz_socket_id"=>"54d866a4616e741381030000",
> "case_socket_id"=>"54d8698e616e7414cc000000"}, "return_to"=>"",
> "_save"=>"", "model_name"=>"unit", "id"=>"54d4d446616e744b00030000"}
> MOPED: 127.0.0.1:27017 COMMAND      database=admin
> command={:ismaster=>1} runtime: 2.7070ms   MOPED: 127.0.0.1:27017
> QUERY        database=samolov_development collection=admins
> selector={"$query"=>{"_id"=>BSON::ObjectId('54cb781b616e744c09000000')},
> "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil
> fields=nil runtime: 3.6702ms   MOPED: 127.0.0.1:27017 QUERY
> database=samolov_development collection=units
> selector={"_id"=>BSON::ObjectId('54d4d446616e744b00030000')} flags=[]
> limit=0 skip=0 batch_size=nil fields=nil runtime: 2.9342ms   MOPED:
> 127.0.0.1:27017 QUERY        database=samolov_development collection=unit_progresses selector={"_id"=>nil} flags=[] limit=0
> skip=0 batch_size=nil fields=nil runtime: 2.9588ms   MOPED:
> 127.0.0.1:27017 QUERY        database=samolov_development collection=unit_progresses selector={"_id"=>nil} flags=[] limit=0
> skip=0 batch_size=nil fields=nil runtime: 1.7743ms   MOPED:
> 127.0.0.1:27017 UPDATE       database=samolov_development collection=unit_progresses
> selector={"unit_id"=>BSON::ObjectId('54d4d446616e744b00030000'),
> "_id"=>{"$nin"=>[]}} update={"$set"=>{"unit_id"=>nil}} flags=[:multi]
>                          COMMAND      database=samolov_development command={:getlasterror=>1, :w=>1} runtime: 4.1075ms   MOPED:
> 127.0.0.1:27017 QUERY        database=samolov_development collection=quizzes
> selector={"_id"=>BSON::ObjectId('54d866a4616e741381030000')} flags=[]
> limit=0 skip=0 batch_size=nil fields=nil runtime: 3.9158ms   MOPED:
> 127.0.0.1:27017 QUERY        database=samolov_development collection=quizzes
> selector={"$query"=>{"quiz_socket_id"=>BSON::ObjectId('54d4d446616e744b00030000')},
> "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil
> fields=nil runtime: 4.1857ms   MOPED: 127.0.0.1:27017 QUERY
> database=samolov_development collection=questions
> selector={"quiz_id"=>BSON::ObjectId('54d866a4616e741381030000')}
> flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 2.8849ms
> MOPED: 127.0.0.1:27017 DELETE       database=samolov_development
> collection=quizzes
> selector={"_id"=>BSON::ObjectId('54d866a4616e741381030000')}
> flags=[:remove_first]
>                          COMMAND      database=samolov_development command={:getlasterror=>1, :w=>1} runtime: 3.5143ms   MOPED:
> 127.0.0.1:27017 QUERY        database=samolov_development collection=questions
> selector={"quiz_id"=>BSON::ObjectId('54d866a4616e741381030000')}
> flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 1.9553ms
> MOPED: 127.0.0.1:27017 QUERY        database=samolov_development
> collection=quizzes
> selector={"_id"=>BSON::ObjectId('54d8698e616e7414cc000000')} flags=[]
> limit=0 skip=0 batch_size=nil fields=nil runtime: 2.6045ms   MOPED:
> 127.0.0.1:27017 QUERY        database=samolov_development collection=quizzes
> selector={"$query"=>{"case_socket_id"=>BSON::ObjectId('54d4d446616e744b00030000')},
> "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil
> fields=nil runtime: 3.0093ms   MOPED: 127.0.0.1:27017 UPDATE
> database=samolov_development collection=quizzes
> selector={"_id"=>BSON::ObjectId('54d8698e616e7414cc000000')}
> update={"$set"=>{"case_socket_id"=>BSON::ObjectId('54d4d446616e744b00030000')}}
> flags=[]
>                          COMMAND      database=samolov_development command={:getlasterror=>1, :w=>1} runtime: 3.6337ms   MOPED:
> 127.0.0.1:27017 QUERY        database=samolov_development collection=questions
> selector={"quiz_id"=>BSON::ObjectId('54d8698e616e7414cc000000')}
> flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 1.9600ms
> MOPED: 127.0.0.1:27017 QUERY        database=samolov_development
> collection=parts
> selector={"$query"=>{"_id"=>BSON::ObjectId('54d4c680616e7444bf070000')},
> "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil
> fields=nil runtime: 7.6532ms


text:
Q: Replace variable of Wordpress shortcode based on select box? Is it possible to do this without Ajax, solely with vanilla JS and PHP?
What I am trying to do is:

*

*Return the shortcode in PHP (easy)

*Show it on the page (easy)

*Allow users to select a text on the front-end (HTML is easy, but how do I send this as a variable?)

*Change the shortcode variable with the chosen text on the front-end and load it dynamically on the page.

My question is: what options do I have? Is it solely Ajax or can I do this with PHP and JS-only?
function place_function() {

     return '[myshortcode place="new york"]';
}


text:
Q: Doubt in proof of existence of tensor product I have a question regarding the proof of the proposition 2.12 in Atiyah and Macdonald's book.
They say:
" Let $C$ denote the free $A$-module $A^{M \times N}$. The elements of $C$ are formal linear combinations of elements of $M \times N$ with coefficients in $A$, i.e they are expressions of the form $ \sum_{i=1}^n a_i \cdot (x_i,y_i) (a_i \in A, x_i \in M, y_i \in N).$
Let $D$ be the submodule of $C$ genearated by all elements of $C$ of the following types:
$(x+x',y)-(x,y) -(x',y) \\
(x,y+y')-(x,y) -(x,y') \\
(ax,y)- a \cdot(x,y) \\
(x,ay)- a \cdot(x,y) \\$
Let $T= C/D.$ For each basis element $(x,y)$ of $C$, let $ x \otimes y$ denote its image in $T$. Then $T$ is generated by the elements of the form $x \otimes y$ "
My doubt is why $C$ is a free  module. C can be think of sequence of coordinates of each $(x,y)$ but in such case $A(x,y)$ need not be isomorphic to $A$
Definition: a free $A$ module is of form $\oplus_{i\in I} M_i$ such that each $M_i $ is isomorphic to $A$
Please help me with this

A: Let me try to provide a kind of answer here by talking about the free abelian group on a set $X = \{A,B,C\}$ of three generators.
You'll see things like 'this is a formal sum of terms like $7A -2B + 6C$, with coefficients in the integers. $0A + 0B + 0C$ serves as an identity element, and the inverse of $aA + bB + cC$ is just $-aA -bB -cC$.'
That's all very well, but where is this "addition" and scalar multiplication taking place? What the hell does "formal sum" mean?
The answer is to define it in terms of things you already know. The "formal sum" $7A -2B + 6C$ is actually a function $f$ on the set $X$, one for which $f(A) = 7, f(B) = -2, f(C) = 6.$ Addition of formal sums is defined as ... addition of integer-valued functions, which you already know about. Inverses? That's just negation of integer-valued functions. Once you see this, it's easy to see that all the axioms for a group are satisfied, and it's pretty easy to do the conversion from "formal sum of elements of $X$" to "integer-valued function on $X$" and back again.
Now let's look at the quotation above:

Let D be the submodule of C generated by all elements of C of the following types:
$(x+x',y)-(x,y) -(x',y) \\
(x,y+y')-(x,y) -(x,y')\\
(ax, y) - a \cdot (x, y) \ldots$

and think about that third one in the case where $a$ is the element $2 \in A$. And let's suppose that $x_0$ and $y_0$ are particular elements of $X$ and $Y$. Then we can define a function $h$ on $X \times Y$ by saying that  $h(x, y) = 0$ for almost every pair $(x, y)$ except that
$$
h(2x_0, y_0) = 1\\
h(x_0, y_0) = -2.
$$
Written out in formal-sum terms, this is just
$$
(2x_0, y_0) - 2(x_0, y_0).
$$
Now $D$ contains all such formal sums, for every possible $x_0 \in X$ and $y_0 \in Y$, and lots of others (corresponding to the other rows in the description) as well.
In $C/D$, the equivalence class of our function $h$ will be the same as the equivalence class of the everywhere-zero function, so we can say that
$$
[(2x_0, y_0) - 2(x_0, y_0)] = [0]
$$
But just as when we talk of the integers mod 3, we often use the symbols $0, 1, 2$ rather than the more proper $[0], [1], [2]$, to denote the three residue classes, folks sometimes leave off the brackets and say that in $C/D$, we have
$$
(2x_0, y_0) - 2(x_0, y_0) = 0 \tag{1}
$$
When we write it like this, it's hard to tell whether this is supposed to be an equality in $C$ or in $C/D$. (It's the latter, but you can't tell that by looking!)
Now $V$ is "generated by" all single-term formal sums, i.e., functions that are $1$ on some particular element of $X \times Y$ and $0$ everywhere else. (You should think through why this is true.)
That means that $V/D$ is also generated by the equivalence classes of these "basic" formal sums; as it happens, they "overgenerate" -- there are far too many of them to be a generating set "without relations". But to help distinguish between $C$ and $C/D$, we make up a new notation:
$$
x_0 \otimes y_0
$$
is used to denote the equivalence class of $(x_0, y_0)$ in $C/D$. And now formula 1 above becomes
$$
(2x_0) \otimes y_0 - 2 (x_0 \otimes y_0) = 0
$$
or more often, that's written
$$
(2x_0) \otimes y_0 = 2 (x_0 \otimes y_0).
$$
I hope this helps a bit.


text:
Q: Parse iOS SDK v.1.7.4 FacebookUrlSchemeSuffix Does anyone know how to handle UrlShemeSuffix with the latest Parse iOS SDK? I am only seeing this now.
[PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:launchOptions];

This used to be available in a prior version of PFFacebookUtils but the v4 doesn't have it.
#ifdef PAID
    [PFFacebookUtils initializeFacebookWithUrlShemeSuffix:@"paid"];
#else
   [PFFacebookUtils initializeFacebookWithUrlShemeSuffix:@"free"];
#endif

Help please

A: Here's the solution, answering my own question: https://developers.facebook.com/bugs/115597585443651/


text: Q: Apache flume : How to detect errors in flume process I have set up flume agents and the process is working fine. However, I am not sure how to implement error detection for production environment. Any direction/guidelines regarding error handling/notification for flume implementation is appreciated.


text:
Q: How to build the Boost Python for both Python2 and Python3? I was trying to build the Boost 1.65.1 for both versions of Python I use:
./bootstrap.sh --with-python=python2 --with-python=python3

However, the first instance of the --with-python option has been ignored and I've got only /usr/local/lib/libboost_python3.* libraries.
So I've called the bootstrap in the same directory again with command:
./bootstrap.sh --with-python=python2

After that I've got both Boost Python libraries - for Python2 and Python3.
I've some doubts about this sequence of steps - the second step might damage results of the first one.
Are there any 100%-reliable ways to build the Boost Python (from sources) for both Python versions?


text:
Q: How to pass more than one variable from PHP into R? When i was learn about integrating PHP and R, i got from this source
that for passing variable from php into R have to use
 exec("Rscript my_rscript.R $N");

But it only could passing one variable into R. How if i want to pass more than one variable into R?
Any help? Thankyou in advanced :D

A: $N1="any command";
$N2="any command";

exec("Rscript my_rscript.R  $N1 $N2");


text:
Q: Don't split when the delimiter is found between square brackets I created a pipeline in Azure Data Factory which took a MongoDb JSON file as the data source and has been sinked into a CSV file.
When I click on data preview everything looks perfect, but once I actually open the exported CSV in Excel, for some reason Excel doesn't keep the format of one row where there is an array of two email addresses separated by a comma.
Instead of the cell to look like this (Desired Output):
EmailAddress
['kate@hotmail.com' , 'katie@hotmail.com']

Its displayed like this and puts the second email into the column to the right:
EmailAddress
'kate@hotmail.com'

Is there a way for Excel to actually open the CSV without doing extra formatting or to ignore delimiters if they are wrapped around []
Note:
This is in the data preview of azure data factory, but in Excel it splits this array because of the ,


text:
Q: Change colors used for rendering a MenuStrip I have a WinForms program which has a MenuStrip control at the top of the form. Each ToolStripMenuItem in the MenuStrip has a drop-down with a bunch of selections (New, Open, Save,... the usual fare).
I would like to change the color of the menu, and doing so on each of the individual parts works well enough. Unfortunately there seems to be a ToolStripDropDown control which is implicitly added to each of the menu items to hold their children, and it shows up in the native system colors and gives everything an ugly border:

Since the drop-down seems to be created implicitly by the menu items, I can't find any way to access it. Is it possible to change the background and foreground colors of the drop-down control, or will I have create it by hand outside of the designer?

A: I've opted for a more complete option inspired by the answers at How to change Menu hover color - WINFORMS. By creating a subclass of ProfessionalColorTable with all the potentially useful colors overriden (abridged code):
public class CustomColorTable : ProfessionalColorTable
{
    //a bunch of other overrides...

    public override Color ToolStripBorder
    {
        get { return Color.FromArgb(0, 0, 0); }
    }
    public override Color ToolStripDropDownBackground
    {
        get { return Color.FromArgb(64, 64, 64); }
    }
    public override Color ToolStripGradientBegin
    {
        get { return Color.FromArgb(64, 64, 64); }
    }
    public override Color ToolStripGradientEnd
    {
        get { return Color.FromArgb(64, 64, 64); }
    }
    public override Color ToolStripGradientMiddle
    {
        get { return Color.FromArgb(64, 64, 64); }
    }
}

and then adding the following to the constructor to my form:
this.menuStrip_Main.RenderMode = ToolStripRenderMode.Professional;
this.menuStrip_Main.Renderer = new ToolStripProfessionalRenderer(new CustomColorTable());

The renderer takes care of all the heavy lifting, and everything looks great. Best of all the designer can still be used to work with the MenuStrip and its children, though the appearance no longer matches.


text:
Q: Analytics for Google Calendar? I need to find out how many people use my public Google Calendar and I am unable to find any way of integrating analytics. Is this possible?

A: If you have a website there is a way to do this, but it takes a little coding.
Go to calendar settings and find "Embed This Calendar", then embed it in your website by copy/pasting the embed code. Install Google Analytics on the website and track views to the page with your calendar.
This may not work, depending on how you share your public calendar...


text:
Q: Getting values printed from dictionary without being repeated? I am trying to match a random amount of employee records to an auditor. so I made a dictionary, the key being the name of the auditors and the values being the list of the employees' names. However, as the result of this, the dictionary values become cumulative and make duplicates of themselves as iteration for auditor's name(dictionary key) goes on. How can I eliminate the duplication of the values?? (audlst is the list of auditors and Empnamelst is the list of the employees and the amount of random employee records that will be assigned to the auditor is determined by user input as empunderaud, the values(employee names) are series taken from a dataframe)
Code:
    empunderaud=input('How many records will be assigned to each auditor?')
    empunderaud=int(empunderaud)
    print('Record successfully assigned to auditors')
    #take the emp names only from Mydf
    Empnamelst=Mydf.iloc[:,0]
    #assign emps to audnames
    assigndict={}
    for audname in audlst:
            print("\nRecords assigned to",audname,': ' )
            rndemp=Empnamelst.sample(empunderaud)
            assigndict[audname]=rndemp

            print(assigndict.values())

result:
How many records will be assigned to each auditor?2
Record successfully assigned to auditors

Records assigned to ann :
dict_values([302    Carr, Claudia  N
67      Gonzalez, Maria
Name: Employee_Name, dtype: object])

Records assigned to iron :
dict_values([302    Carr, Claudia  N
67      Gonzalez, Maria
Name: Employee_Name, dtype: object, 49            Rogers, Ivan
87    Wallace, Courtney  E
Name: Employee_Name, dtype: object])

Records assigned to jin :
dict_values([302    Carr, Claudia  N
67      Gonzalez, Maria
Name: Employee_Name, dtype: object, 49            Rogers, Ivan
87    Wallace, Courtney  E
Name: Employee_Name, dtype: object, 241         Wolk, Hang  T
235    Winthrop, Jordan
Name: Employee_Name, dtype: object])

as you can see the employee names in the result are being cumulated how can make this not cumulative?


text:
Q: Changing image on hover with CSS/HTML I have this problem where I have set an image to display another image when the mouse hovers over, however the first image still appears and the new one doesn't change height and width and overlaps the other one. I'm still pretty new to HTML/CSS so I may have missed something simple. Here is the code:

#Library {
    height: 70px;
    width: 120px;
}

#Library:hover {
    background-image: url('LibraryHoverTrans.png');
    height: 70px;
    width: 120px;
}

A: One solution is to use also the first image as a background image like this:

#Library {
   background-image: url('LibraryTransparent.png');
   height: 70px;
   width: 120px;
}

#Library:hover {
   background-image: url('LibraryHoverTrans.png');
}

If your hover image has a different size, you've got to set them like so:
#Library:hover {
   background-image: url('LibraryHoverTrans.png');
   width: [IMAGE_WIDTH_IN_PIXELS]px;
   height: [IMAGE_HEIGHT_IN_PIXELS]px;
}

A:

.hover_image:hover {text-decoration: none} /* Optional (avoid undesired underscore if a is used as wrapper) */
.hide {display:none}
/* Do the shift: */
.hover_image:hover img:first-child{display:none}
.hover_image:hover img:last-child{display:inline-block}

To try to improve this Rashid's good answer I'm adding some comments:
The trick is done over the wrapper of the image to be swapped (an 'a' tag this time but maybe another) so the 'hover_image' class has been put there.
Advantages:

*

*Keeping both images url together in the same place helps if they need to be changed.

*Seems to work with old navigators too (CSS2 standard).

*It's self explanatory.

*The hover image is preloaded (no delay after hovering).

A: The problem with all the previous answers is that the hover image isn't loaded with the page so when the browser calls it, it takes time to load and the whole thing doesn't look really good.
What I do is that I put the original image and the hover image in 1 element and hide the hover image at first. Then at hover in I display the hover image and hide the old one, and at hover out I do the opposite.
HTML:

JavaScript/jQuery:
function hvr(dom, action)
{
    if (action == 'in')
    {
        $(dom).find("[col=g]").css("display", "none");
        $(dom).find("[col=b]").css("display", "inline-block");
    }

    else
    {
        $(dom).find("[col=b]").css("display", "none");
        $(dom).find("[col=g]").css("display", "inline-block");
    }
}

This to me is the easiest and most efficient way to do it.

A: What I usually do is that I create a double image with both states, acting like kind of a two-frame film which I then use with as background for the original element so that the element has width / height set in pixels, resulting in showing only one half of the image.  Then what the hover state defines is basically "move the film to show the other frame".
For example, imagine that the image has to be a gray Tux, that we need to change to colorful Tux on hover.  And the "hosting" element is a span with id "tuxie".

*

*I create 50 x 25 image with two Tuxes, one in color and other gray,

*then assign the image as a background for a 25 x 25 span,

*and finally set the hover to simply move the background 25px left.

The minimal code:

and the image:

Advantages are:

*

*By putting both frames in one file, it's ensured that they are loaded
at once.  This avoids the ugly glitch on slower connections when the
other frame never loads immediately, so first hover never works properly.

*It may be easier to manage your images this way since "paired" frames
are never confused.

*With smart use of Javascript or CSS selector, one can extend this and
include even more frames in one file.
In theory you could put even multiple buttons in single file and govern
their display by coordinates, although such approach could get quickly
out of hand.
Note that this is built with background CSS property, so if you really need to use with s, you must not set the src property since that overlaps the background. (Come to think that clever use of transparency here could lead to interesting results, but probably very dependent on quality of image as well as of the engine.).

A: Use content:
#Library {
    height: 70px;
    width: 120px;
}

#Library:hover {
    content: url('http://www.furrytalk.com/wp-content/uploads/2010/05/2.jpg');
    height: 70px;
    width: 120px;
}

JSFiddle

A: You can replace the image of an HTML IMG without needing to make any background image changes to the container div.
This is obtained using the CSS property box-sizing: border-box; (It gives you a possibility to put a kind of hover effect on an  very efficiently.)
To do this, apply a class like this to your image:
.image-replacement {
  display: block;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  background: url(http://akamaicovers.oreilly.com/images/9780596517748/cat.gif) no-repeat;/* this image will be shown over the image iSRC */
  width: 180px;
  height: 236px;
  padding-left: 180px;
}

Sample code: http://codepen.io/chriscoyier/pen/cJEjs
Original article:
http://css-tricks.com/replace-the-image-in-an-img-with-css/
Hope this will help some of you guys who don't want to put a div to obtain an image having a "hover" effect.
Posting here the sample code:
HTML:

jQuery:
$("#myImage").mouseover(function () {
    $(this).attr("class", "image-replacement");
});
$("#myImage").mouseout(function () {
    $(this).attr("class", "ClassBeforeImage-replacement");
});

A: You can't use CSS to change image SRC attributes (unless the browser supports it).
You may want to use jQuery with the hover event.
$("#Library ").hover(
    function () {
         $(this).attr("src","isHover.jpg");
    },
    function () {
        $(this).attr("src","notHover.jpg");
    }
);

A:

.foo img:last-child{display:none}
.foo:hover img:first-child{display:none}
.foo:hover img:last-child{display:inline-block}

A: Another option is to use JS:

A: Change the img tag to a div and give it a background in CSS.

A: try one of them

or if you using image as a button in form

<input type="image" id="proceed" src="images/icons/proceed_button.png" alt"Go to Facebook page" onMouseOver="fnover();"onMouseOut="fnout();" onclick="fnclick()">
function fnover()
        {
            var myimg2 = document.getElementById("proceed");
            myimg2.src = "images/icons/proceed_button2.png";
        }

        function fnout()
        {
            var myimg2 = document.getElementById("proceed");
            myimg2.src = "images/icons/proceed_button.png";
        }

A: The problem is that you set the first image through 'src' attribute and on hover added to the image a background-image.
try this:
in html use:

then in css:
#Library {
    height: 70px;
    width: 120px;
    background-image: url('LibraryTransparent.png');
}

#Library:hover {
    background-image: url('LibraryHoverTrans.png');
}

A: check this fiddle
I think the image path may be wrong in your case
the syntax looks right
background-image:url('http://www.bluecowcreative.ca/wp-content/uploads/2013/08/hi.jpg');

A: In the way that you're doing things, it won't happen. You're changing the background image of the image, which is being blocked by the original image. Changing the height and width also won't happen. To change the src attribute of the image, you would need Javascript or a Javascript Library such as jQuery. You could however, change the image to a simple div (text) box, and have a background image that changes on hover, even though the div box itself will be empty. Here's how.

#emptydiv {

background-image: url("LibraryHover.png");
height: 70px;
width: 120px;

}
#emptydiv:hover {

background-image: url("LibraryHoverTrans.png");
height: 700px;
width: 1200px;

}

I hope this is what you're asking for :)

A: With everyones answer using the background-image option they're missing one attribute. The height and width will set the container size for the image but won't resize the image itself. background-size is needed to compress or stretch the image to fit this container. I've used the example from the 'best answer'

#Library {
   background-image: url('LibraryTransparent.png');
   background-size: 120px;
   height: 70px;
   width: 120px;
}

#Library:hover {
   background-image: url('LibraryHoverTrans.png');
}

A: My jquery solution.
function changeOverImage(element) {
        var url = $(element).prop('src'),
            url_over = $(element).data('change-over')
        ;

        $(element)
            .prop('src', url_over)
            .data('change-over', url)
        ;
    }
    $(document).delegate('img[data-change-over]', 'mouseover', function () {
        changeOverImage(this);
    });
    $(document).delegate('img[data-change-over]', 'mouseout', function () {
        changeOverImage(this);
    });

and html

Demo: JSFiddle demo
Regards

A: Live Example: JSFiddle
The Accepted answer has some problem. The image wasn't resized there. Use background-size property for resizing the image.
HTML:

CSS:
#image {
   background-image: url('image1');
   background-size: 300px 390px;
   width: 300px;
   height:390px;
}

#image:hover{
  background: url("image2");
  background-size: 300px 390px;
}

A: What I would recommend is to use only CSS if possible.
My solution would be:
HTML:

CSS:
img#img{
    background: url("pictureNumberOne.png");
    background-size: 100px 100px;
    /* Optional transition: */
    transition: background 0.25s ease-in-out;
}
img#img:hover{
    background: url("pictureNumberTwo.png");
    background-size: 100px 100px;
}

That (not defining the src attribute) also ensures that transparent images (or images with transparent parts) are shown correctly (otherwise, if the second pic would be half-transparent, you would also see parts of the first picture).
The background-size attribute is used to set the height and width of a background-image.
If (for any reason) you don't want to change the bg-image of an image, you could also put the image in a div-container as following:
HTML:

... and so on.

A: Use "content:;" at the hover.This works.

A: Just use Photoshop and create two of the same image, the 1st one being how you want it to look, the 2nd being how you want it to look when it's hovered over. I'm wrapping the image in an  tag, because I'm assuming that it's what you want. For this example I'm doing a facebook icon which is desaturated, but when hovered over it will show the blue color of facebook.

A: Here is the simple trick. Just copy and paste it.
<!DOCTYPE html>

    <title>Change Image on Hover in CSS</title>

A: I had a similar problem.
With my button defined like:
<button  id="myButton" class="myButtonClass"></button>

I had the background styling like this:
#myButton{ background-image:url(img/picture.jpg)}

.myButtonClass{background-image:url(img/picture.jpg)}

.myButtonClass:hover{background-image:url(img/picture_hover.jpg)}

When I switched it to:
#myButton{}

.myButtonClass{background-image:url(img/picture.jpg)}

.myButtonClass:hover{background-image:url(img/picture_hover.jpg)}

The hover over feature worked just fine.
(not addressing other attributes like size and position of image or of container, just the background image changing)


text:
Q: Marionette/puppet sci-fi show with replaced limbs and alien control I watched this sci-fi show as a kid during the late 1980s in South Africa. The show itself likely came from Japan. It definitely wasn't a domestic production.
The show's protagonists were human like, in conflicts with aliens. The aliens captured many of the humans during the course of the show and somehow converted them to do their bidding. The conversion included the removing of one of the human's arms and replacing it with something either mechanical or insect like. The humans also then wore a type of head gear (very Borg-like), which allowed the aliens to control them.
Towards the end of the show, one of the humans controlled by the aliens was liberated and ended up helping the humans.
The name "Commander Mary" comes to mind, but it may have nothing to do with the original Japanese name.

A: According to your description, I'm quite sure it is X-Bomber (also known as Star Fleet), a Japanese puppet series.
From Wikpedia:

The year is 2999 and the Earth is at peace following the Space Wars.
  The safety of the human race is ensured by Earth Defense Force (EDF).
  Shortly before the turn of the fourth millennium, the peace is broken
  by the appearance of a gigantic alien battle cruiser. Powerless to
  defend itself, the EDF' Pluto base is completely destroyed and the
  evil Commander Makara reveals that the same fate awaits the Earth
  unless the mysterious F-Zero-One is handed over to her.

This is the link for the Wikia of the show.
This is the main starship:

For instance one of the human characters was "converted" this way by the evil empire:


text:
Q: Laravel 5: How to set parameters Response::json($data) as json_encode($data, JSON_UNESCAPED_UNICODE)? Laravel 5: I have problem with unicode.
if I do
return Response::json(['data' => 'Что то']);

Receive {data: \u043e\u0431\u044c\u044f}
I want set parameter JSON_UNESCAPED_UNICODE to Response::json()
The following does not work:
Response::json(['data' => 'Что то'], JSON_UNESCAPED_UNICODE)

A: Set JSON_UNESCAPED_UNICODE as 4th parameter:
return Response::json(['data' => 'Что то'], 200, [], JSON_UNESCAPED_UNICODE);


text:
Q: opengl 2.1 and textures I'm trying to show a texture(yes it is a pot) with opengl 2.1 and glsl 120, but i'm not sure on how to do it, all i can get is a black quad, i've been following this tutorials: A Textured Cube, OpenGl - Textures and what i have understood is that i need to:

*

*Specify the texture coordinates to attach to each vertex(in my case are 6 vertices, a cube without indexing)

*Load the texture and bind it in a texture unit(default is 0)

*call glDrawArrays

*Inside the shaders i need to:

*Receive the texture coords in an attribute in the vertex shader and pass it to the fragment shader through a varying variable

*In the fragment shader use a sampler object to sample a pixel, in the position specified by the varying variable, from the texture.

Is it all correct?
Here is how i create the texture VBO and load the texture:
void Application::onStart(){
unsigned int format;
SDL_Surface* img;

float quadCoords[] = {
        -0.5f, -0.5f, 0.0f,
        0.5f, -0.5f, 0.0f,
        0.5f, 0.5f, 0.0f,
        0.5f, 0.5f, 0.0f,
        -0.5f, 0.5f, 0.0f,
        -0.5f, -0.5f, 0.0f};

const float texCoords[] = {
        0.0f, 0.0f,
        1.0f, 0.0f,
        1.0f, 1.0f,
        1.0f, 1.0f,
        0.0f, 1.0f,
        0.0f, 0.0f};

//shader loading omitted ...
sprogram.bind(); // call glUseProgram(programId)
//set the sampler value to 0 -> use texture unit 0
sprogram.loadValue(sprogram.getUniformLocation(SAMPLER), 0);

//quad
glGenBuffers(1, &quadBuffer);
glBindBuffer(GL_ARRAY_BUFFER, quadBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(float)*18, quadCoords, GL_STATIC_DRAW);
//texture
glGenBuffers(1, &textureBuffer);
glBindBuffer(GL_ARRAY_BUFFER, textureBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(float)*12, texCoords, GL_STATIC_DRAW);

//load texture
img = IMG_Load("resources/images/crate.jpg");

if(img == nullptr)
    throw std::runtime_error(SDL_GetError());

glGenTextures(1, &this->texture);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, this->texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img->w, img->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, img->pixels);

SDL_FreeSurface(img);
}

rendering phase:
glClear(GL_COLOR_BUFFER_BIT);

glEnableVertexAttribArray(COORDS);
glBindBuffer(GL_ARRAY_BUFFER, quadBuffer);
glVertexAttribPointer(COORDS, 3, GL_FLOAT, GL_FALSE, 0, nullptr);

glEnableVertexAttribArray(TEX_COORDS);
glBindBuffer(GL_ARRAY_BUFFER, textureBuffer);
glVertexAttribPointer(TEX_COORDS, 2, GL_FLOAT, GL_FALSE, 0, nullptr);

//draw the vertices
glDrawArrays(GL_TRIANGLES, 0, 6);

vertex shader:
#version 120

attribute vec3 coord;
attribute vec2 texCoord;

varying vec2 UV;

void main(){
    gl_Position = vec4(coord.x, coord.y, coord.z, 1.0);
    UV = texCoord;
}

fragment shader:
#version 120

uniform sampler2D tex;
varying vec2 UV;

void main(){
    gl_FragColor.rgb = texture2D(tex, UV).rgb;
    gl_FragColor.a = 1.0;
}

I know that the tutorials use out instead of varying so i tried to "convert" the code, also there is this tutorial: Simple Texture - LightHouse that explain the gl_MultiTexCoord0 attribute and gl_TexCoord array wich are built in, but this is almost the same thing i'm doing. I want to know if 'm doing it all right and if not, i would like to know how to show a simple 2d texture in the screen with opengl 2.1 and glsl 120

A: Do you have a particular reason to use opengl 2.1 with glsl version 1.2 ? If not stick to the openGl 3.0 because its easier to understand imho.
My guess is you have 2 big problems :
First of all getting a black quad: If its size occupies your hole app then its the background color. That means it doesn't draw anything at all .
I think(by testing this) OpenGL has a default program which will activate and even if you have already set a vertex array/buffer object on the gpu.It should render as a white quad in your window... So that might be ur 1st problem . I dont know if opengl 2.1 has vertex buffer arrays but opengl 3.0 has and you should definetly make use of that!
Second : you don't use your shader program in the rendering phase;
Call this function before drawing your quad:
glUseProgram(myProgram); // The myProgram variable is your compiled shader program
If by any chance you would like me to explain how to draw your quad using OpegGL 3.0 ++ let me know :) ...It is not far from what you already wrote in your code .


text:
Q: Why constructor/destructor are defined like this in g++ produced assembly code? I wrote a simple C++ program with which defined a class like below:
#include <iostream>

using namespace std;

class Computer
{
public:
  Computer();
  ~Computer();
};

Computer::Computer()
{
}

Computer::~Computer()
{
}

int main()
{
  Computer compute;
    return 0;
}

When I use g++(Test is on x86 32bit Linux with g++ 4.6.3.) to produce the ctors and dtors, I get these definitions at the end of section .ctors.
    .globl  _ZN8ComputerC1Ev
    .set    _ZN8ComputerC1Ev,_ZN8ComputerC2Ev
    .globl  _ZN8ComputerD1Ev
    .set    _ZN8ComputerD1Ev,_ZN8ComputerD2Ev

After digging into the assembly code produced, I figured out that _ZN8ComputerC1Ev should be the function name which is used when class Computer is constructed, while _ZN8ComputerC2Ev is the name of class Computer's constructor. The same thing happens in Computer's destructor declaring and invoking.
It seems that a table is built, linking the constructor and its implementation.
So my questions are:

*

*What actually is this  constructor/destructor information for?

*Where can I find them in ELF format?
I dumped related .ctors and .init_array section, but I just can not find the meta data that defined the relation between _ZN8ComputerC1Ev and _ZN8ComputerC2Ev...

A: There is no table here. .globl and .set are so-called assembler directives or pseudo ops. They signal something to the assembler, but do not necessarily result in production of actual code or data. From the docs:

.global symbol, .globl symbol
.global makes the symbol visible to ld. If you define symbol in your
  partial program, its value is made available to other partial programs
  that are linked with it. Otherwise, symbol takes its attributes from a
  symbol of the same name from another file linked into the same
  program.
.set symbol, expression
Set the value of symbol to expression. This changes symbol's value and
  type to conform to expression.

So the fragment you quote just ensures that the constructor is available for linking in case it's referenced by other compile units. The only effect of it you normally see in the final ELF is the presence of those symbols in the symbol table (if it has not been stripped).
Now, you may be curious about why you have two different names for the constructor (e.g. _ZN8ComputerC1Ev and _ZN8ComputerC2Ev). The answer is somewhat complicated so I will refer you to another SO question which addresses it in some detail:
Dual emission of constructor symbols


text:
Q: Regex: Get First Param My Regex:
#\<param name\=\"src\"+.+\"\s\/\>#

The problem is that stops at the second /> but I want just the first <param>.
  <param name="example" src="hello.swf" />
  <param name="stuff2" />

So how should I get just the first param?

A: Probably something like this...
#param name="([a-zA-Z0-9]+)" src="(.*?)"#is

Your result should be in $match[2]


text:
Q: extracting recurring pattern with regular expressions I have some text where a list of (id (in the form Pnumber) , a dash and a name) are written.
like in:
P1 - code23
P2 - name asd, P3 -name3
P3 - 837/55 P5 - code/55

as you see the couples PX - name can be divided by \n, comma,or simple spaces.
with the regexp pattern
(((?<id>P\d)(\s)?-(\s)?(?<name>(.)*)(,)?(\n)?))

I can extract the name group of matches repeated on different lines, but not the one divided by , or space.
the names extracted from the text above are
code23 (right)
name asd, P3 -name3 (wrong)
837/55 P5 - code/55 (wrong)

How can I modify my pattern?

A: You may try
(?<id>P\d+)\s*-\s*(?<name>.*?)(?=$|,?\s*P\d)

See the regex demo (\r? added in the demo only because multiline mode is on and the input is multiline, if the strings are handled separately, no \r? and multiline mode are necessary).
Explanation:

*

*(?<id>P\d+) -Group ID, P + 1+ digits

*\s*-\s* - 0+ whitespaces, - and again 0+ whitespaces

*(?<name>.*?) - Group NAME that captures 0+ chars other than newline up to the first

*(?=$|,?\s*P\d) - end of string (yes, the only one) or an optional comma, 0+ whitespaces, P and a digit.

Results:


text:
Q: What is the advantage of workdocs over s3 They both pretty much offers the same service and purpose, i don't see any reason why one would use workdocs over s3.

A: Amazon WorkDocs is an online document editor and file sharing system. AWS describes it as a "fully managed, secure enterprise storage and sharing service with strong administrative controls and feedback capabilities that improve user productivity."
Amazon Simple Storage Service (S3) is a data storage service. AWS describes it as "storage for the internet".
To give an example:

*

*Amazon Workdocs is like Google Docs

*Amazon S3 is like Google Drive (sort of)

People would use WorkDocs if they wish to collaborate on documents with other people (eg review documents, add comments, share documents in a team, mount a drive of shared documents). Amazon S3 does not provide those capabilities.


text:
Q: oath implicit grant flow client on java or c# Is it possible to request a security token on java or C# from AD FS using implicit grant flow ? It looks like that is only possible in JS (in a browser). Thank you  in advance for your answers.

A: ADFS 3.0 only supports authorization code grant.
ADFS vNext (Server 2016) will support this.
Azure AD also supports this currently.


text:
Q: How to make a input search for list view in android i need to make a input search for listview in android through the code below, how to write the code and where do i put it.
I'm new in Android Thanks you advanced
all_products.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <!-- Editext for Search -->
    <EditText android:id="@+id/inputSearch"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="Search products.."
        android:inputType="textVisiblePassword"/>

    <!-- Main ListView
         Always give id value as list(@android:id/list)
    -->
    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>

</LinearLayout>

my code:
AllProductsActivity.java
package com.bsmartlb.connectandroidphp;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

public class AllProductsActivity extends ListActivity {

    String limit;

    // Progress Dialog
    private ProgressDialog pDialog;

    // Creating JSON Parser object
    JSONParser jParser = new JSONParser();

    ArrayList<HashMap<String, String>> productsList;

    // url to get all products list
    private static String url_all_products = "http://bsmart-lb.com/androidhive/get_items.php";

    // JSON Node names
    private static final String TAG_SUCCESS = "success";
    private static final String TAG_PRODUCTS = "products";
    private static final String TAG_PID = "pid";
    private static final String TAG_NAME = "name";

    // products JSONArray
    JSONArray products = null;

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

        TextView txtLimit = (TextView) findViewById(R.id.limit_label);
        Intent i = getIntent();
        // Receiving the Data
        limit = i.getStringExtra("limit");
        txtLimit.setText(limit);

        // Hashmap for ListView
        productsList = new ArrayList<HashMap<String, String>>();

        // Loading products in Background Thread
        new LoadAllProducts().execute();

        // Get listview
        ListView lv = getListView();

        // on seleting single product
        // launching Edit Product Screen
        lv.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {
                // getting values from selected ListItem
                String pid = ((TextView) view.findViewById(R.id.pid)).getText()
                        .toString();

                // Starting new intent
                //Intent in = new Intent(getApplicationContext(), EditProductActivity.class);
                Intent in = new Intent(getApplicationContext(), SingleMenuItemActivity.class);

                // sending pid to next activity
                in.putExtra(TAG_PID, pid);

                // starting new activity and expecting some response back
                startActivityForResult(in, 100);

            }
        });

    }

    // Response from Edit Product Activity
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        // if result code 100
        if (resultCode == 100) {
            // if result code 100 is received
            // means user edited/deleted product
            // reload this screen again
            Intent intent = getIntent();
            finish();
            startActivity(intent);
        }

    }

    /**
     * Background Async Task to Load all product by making HTTP Request
     * */
    class LoadAllProducts extends AsyncTask<String, String, String> {

        /**
         * Before starting background thread Show Progress Dialog
         * */
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pDialog = new ProgressDialog(AllProductsActivity.this);
            pDialog.setMessage("Loading products. Please wait...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(false);
            pDialog.show();
        }

        /**
         * getting All products from url
         * */
        protected String doInBackground(String... args) {
            // Building Parameters
            List<NameValuePair> params = new ArrayList<NameValuePair>();

            params.add(new BasicNameValuePair("limit", limit));

            // getting JSON string from URL
            JSONObject json = jParser.makeHttpRequest(url_all_products, "GET", params);

            // Check your log cat for JSON reponse
            Log.d("All Products: ", json.toString());

            try {
                // Checking for SUCCESS TAG
                int success = json.getInt(TAG_SUCCESS);

                if (success == 1) {
                    // products found
                    // Getting Array of Products
                    products = json.getJSONArray(TAG_PRODUCTS);

                    // looping through All Products
                    for (int i = 0; i < products.length(); i++) {
                        JSONObject c = products.getJSONObject(i);

                        // Storing each json item in variable
                        String id = c.getString(TAG_PID);
                        String name = c.getString(TAG_NAME);

                        // creating new HashMap
                        HashMap<String, String> map = new HashMap<String, String>();

                        // adding each child node to HashMap key => value
                        map.put(TAG_PID, id);
                        map.put(TAG_NAME, name);

                        // adding HashList to ArrayList
                        productsList.add(map);
                    }
                } else {
                    // no products found
                    // Launch Add New product Activity
                    Intent i = new Intent(getApplicationContext(),
                            NewProductActivity.class);
                    // Closing all previous activities
                    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    startActivity(i);
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        /**
         * After completing background task Dismiss the progress dialog
         * **/
        protected void onPostExecute(String file_url) {
            // dismiss the dialog after getting all products
            pDialog.dismiss();
            // updating UI from Background Thread
            runOnUiThread(new Runnable() {
                public void run() {
                    /**
                     * Updating parsed JSON data into ListView
                     * */
                    ListAdapter adapter = new SimpleAdapter(
                            AllProductsActivity.this, productsList,
                            R.layout.list_item, new String[] { TAG_PID,
                                    TAG_NAME},
                            new int[] { R.id.pid, R.id.name });
                    // updating listview
                    setListAdapter(adapter);
                }
            });

        }

    }
}

A: main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
                android:layout_width="fill_parent"
android:layout_height="fill_parent"
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:orientation="vertical">
<EditText android:id="@+id/EditText01"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:hint="Search">
</EditText>

<ListView android:id="@+id/ListView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>

ListViewSearchExample.java
package com.ListViewSearchExample;

import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;

public class ListViewSearchExample extends Activity
{
private ListView lv;
private EditText et;
private String listview_array[] = { "ONE", "TWO", "THREE", "FOUR", "FIVE",
"SIX", "SEVEN", "EIGHT", "NINE", "TEN" };
private ArrayList<String> array_sort= new ArrayList<String>();
int textlength=0;

public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

lv = (ListView) findViewById(R.id.ListView01);
et = (EditText) findViewById(R.id.EditText01);
lv.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, listview_array));

et.addTextChangedListener(new TextWatcher()
{
public void afterTextChanged(Editable s)
{
                                                                // Abstract Method of TextWatcher Interface.
}
public void beforeTextChanged(CharSequence s,
int start, int count, int after)
{
// Abstract Method of TextWatcher Interface.
}
public void onTextChanged(CharSequence s,
int start, int before, int count)
{
textlength = et.getText().length();
array_sort.clear();
for (int i = 0; i < listview_array.length; i++)
{
if (textlength <= listview_array[i].length())
{
if(et.getText().toString().equalsIgnoreCase(
(String)
listview_array[i].subSequence(0,
textlength)))
{
                                                                                array_sort.add(listview_array[i]);
                                                                                }
                                                                                }
                                                                }
lv.setAdapter(new ArrayAdapter<String>
(ListViewSearchExample.this,
android.R.layout.simple_list_item_1, array_sort));
}
});
}
}

Output:

A: Kindly find working code for your search list:
package com.bsmartlb.connectandroidphp;

    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;

    import org.apache.http.NameValuePair;
    import org.apache.http.message.BasicNameValuePair;
    import org.json.JSONArray;
    import org.json.JSONException;
    import org.json.JSONObject;

    import android.app.ListActivity;
    import android.app.ProgressDialog;
    import android.content.Intent;
    import android.os.AsyncTask;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.View;
    import android.widget.AdapterView;
    import android.widget.AdapterView.OnItemClickListener;
    import android.widget.ListAdapter;
    import android.widget.ListView;
    import android.widget.SimpleAdapter;
    import android.widget.TextView;

    public class AllProductsActivity extends ListActivity {

    SimpleAdapter adapter;

    EditText inputSearch;

    String limit;

    // Progress Dialog
    private ProgressDialog pDialog;

    // Creating JSON Parser object
    JSONParser jParser = new JSONParser();

    ArrayList<HashMap<String, String>> productsList;

    // url to get all products list
    private static String url_all_products = "http://bsmart-lb.com/androidhive/get_items.php";

    // JSON Node names
    private static final String TAG_SUCCESS = "success";
    private static final String TAG_PRODUCTS = "products";
    private static final String TAG_PID = "pid";
    private static final String TAG_NAME = "name";

    // products JSONArray
    JSONArray products = null;

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

        TextView txtLimit = (TextView) findViewById(R.id.limit_label);
        Intent i = getIntent();
        // Receiving the Data
        limit = i.getStringExtra("limit");
        txtLimit.setText(limit);

        // Hashmap for ListView
        productsList = new ArrayList<HashMap<String, String>>();

        // Loading products in Background Thread
        new LoadAllProducts().execute();

        // Get listview
        ListView lv = getListView();

        // on seleting single product
        // launching Edit Product Screen
        lv.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {
                // getting values from selected ListItem
                String pid = ((TextView) view.findViewById(R.id.pid)).getText()
                        .toString();

                // Starting new intent
                //Intent in = new Intent(getApplicationContext(), EditProductActivity.class);
                Intent in = new Intent(getApplicationContext(), SingleMenuItemActivity.class);

                // sending pid to next activity
                in.putExtra(TAG_PID, pid);

                // starting new activity and expecting some response back
                startActivityForResult(in, 100);

            }
        });

    }

    // Response from Edit Product Activity
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        // if result code 100
        if (resultCode == 100) {
            // if result code 100 is received
            // means user edited/deleted product
            // reload this screen again
            Intent intent = getIntent();
            finish();
            startActivity(intent);
        }

    }

    /**
     * Background Async Task to Load all product by making HTTP Request
     * */
    class LoadAllProducts extends AsyncTask<String, String, String> {

        /**
         * Before starting background thread Show Progress Dialog
         * */
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pDialog = new ProgressDialog(AllProductsActivity.this);
            pDialog.setMessage("Loading products. Please wait...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(false);
            pDialog.show();
        }

        /**
         * getting All products from url
         * */
        protected String doInBackground(String... args) {
            // Building Parameters
            List<NameValuePair> params = new ArrayList<NameValuePair>();

            params.add(new BasicNameValuePair("limit", limit));

            // getting JSON string from URL
            JSONObject json = jParser.makeHttpRequest(url_all_products, "GET", params);

            // Check your log cat for JSON reponse
            Log.d("All Products: ", json.toString());

            try {
                // Checking for SUCCESS TAG
                int success = json.getInt(TAG_SUCCESS);

                if (success == 1) {
                    // products found
                    // Getting Array of Products
                    products = json.getJSONArray(TAG_PRODUCTS);

                    // looping through All Products
                    for (int i = 0; i < products.length(); i++) {
                        JSONObject c = products.getJSONObject(i);

                        // Storing each json item in variable
                        String id = c.getString(TAG_PID);
                        String name = c.getString(TAG_NAME);

                        // creating new HashMap
                        HashMap<String, String> map = new HashMap<String, String>();

                        // adding each child node to HashMap key => value
                        map.put(TAG_PID, id);
                        map.put(TAG_NAME, name);

                        // adding HashList to ArrayList
                        productsList.add(map);
                    }
                } else {
                    // no products found
                    // Launch Add New product Activity
                    Intent i = new Intent(getApplicationContext(),
                            NewProductActivity.class);
                    // Closing all previous activities
                    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    startActivity(i);
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        /**
         * After completing background task Dismiss the progress dialog
         * **/
        protected void onPostExecute(String file_url) {
            // dismiss the dialog after getting all products
            pDialog.dismiss();
            // updating UI from Background Thread
            runOnUiThread(new Runnable() {
                public void run() {
                    /**
                     * Updating parsed JSON data into ListView
                     * */
                    adapter = new SimpleAdapter(
                            AllProductsActivity.this, productsList,
                            R.layout.list_item, new String[] { TAG_PID,
                                    TAG_NAME},
                            new int[] { R.id.pid, R.id.name });
                    // updating listview
                    setListAdapter(adapter);
                    /**
                     * Enabling Search Filter
                     * */
                    inputSearch = (EditText) findViewById(R.id.inputSearch);

                    inputSearch.addTextChangedListener(new TextWatcher() {

                        @Override
                        public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
                            // When user changed the Text
                            AllProductsActivity.this.adapter.getFilter().filter(cs);
                        }

                        @Override
                        public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
                                int arg3) {
                            // TODO Auto-generated method stub

                        }

                        @Override
                        public void afterTextChanged(Editable arg0) {
                            // TODO Auto-generated method stub
                        }
                    });
                }
            });

        }

    }
}


text:
Q: RuntimeException - Namespace "Numbers\Bundle\NumbersBundle" does not contain any mapped entities To generate my Symfony Entities I have some Doctrine schemas. E.g at
src/Numbers/Bundle/NumbersBundle/config/doctrine/Numbers.orm.yml

[UPDATE: also tried this with the same problem...
src/Numbers/Bundle/NumbersBundle/Resources/config/doctrine/Number.orm.yml ]

and I'm running:
php bin/console doctrine:generate:entities Numbers/Bundle/NumbersBundle

which gives
Generating entities for namespace "Numbers\Bundle\NumbersBundle"

[RuntimeException]
Namespace "Numbers\Bundle\NumbersBundle" does not contain any mapped entities.

If it helps the YML is:
# src/Numbers/Bundle/NumbersBundle/Resources/config/doctrine/Numbers.orm.yml
Numbers\Bundle\NumbersBundle\Entity\Number:
  type: entity
  table: numbers
  id:
    id:
      type: integer
      generator: { strategy: AUTO }
  fields:
    value:
      type: integer
      unique: true
    name:
      type: string
      length: 255
      unique: true

Any suggestions what the problem might be or how you can debug this to see what bin/console doctrine:generate:entities is doing?
UPDATE
For what it's worth with -vvv I get this (doesn't seem to help much though):
php bin/console -vvv doctrine:generate:entities Numbers\Bundle\NumbersBundle
Generating entities for namespace "NumbersBundleNumbersBundle"

[RuntimeException]
Namespace "NumbersBundleNumbersBundle" does not contain any mapped entities.

Exception trace:
 () at /Users/snowcrash/numbers/vendor/doctrine/doctrine-bundle/Mapping/DisconnectedMetadataFactory.php:103
 Doctrine\Bundle\DoctrineBundle\Mapping\DisconnectedMetadataFactory->getNamespaceMetadata() at /Users/snowcrash/numbers/vendor/doctrine/doctrine-bundle/Command/GenerateEntitiesDoctrineCommand.php:109
 Doctrine\Bundle\DoctrineBundle\Command\GenerateEntitiesDoctrineCommand->execute() at /Users/snowcrash/numbers/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /Users/snowcrash/numbers/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:846
 Symfony\Component\Console\Application->doRunCommand() at /Users/snowcrash/numbers/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:191
 Symfony\Component\Console\Application->doRun() at /Users/snowcrash/numbers/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:80
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Users/snowcrash/numbers/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:122
 Symfony\Component\Console\Application->run() at /Users/snowcrash/numbers/bin/console:28

doctrine:generate:entities [--path PATH] [--no-backup] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> <name>

UPDATE 2
Now with a simpler Namespace:
# src/NumbersBundle/Resources/config/doctrine/Number.orm.yml
NumberBundle\Entity\Number:
  type: entity
  table: numbers
  id:
    id:
      type: integer
      generator: { strategy: AUTO }
  fields:
    value:
      type: integer
      unique: true
    name:
      type: string
      length: 255
      unique: true

php bin/console doctrine:generate:entities NumbersBundle
Generating entities for namespace "NumbersBundle"

  [RuntimeException]
  Namespace "NumbersBundle" does not contain any mapped entities.

with the file at
src/NumbersBundle/Resources/config/doctrine/Number.orm.yml

and specifying the Entity:
php bin/console doctrine:generate:entities NumbersBundle:Number

  [Doctrine\ORM\ORMException]
  Unknown Entity namespace alias 'NumbersBundle'.


text:
Q: Why RegOpenKey() returning error 2 on 64 bit Win7 I've read this Question which appears to be duplicate of what I'm asking however I am actually asking WHY I'm seeing different Wow6432Node behavior on two different Win7 64 bit computers
My VB6 32 bit application is trying to read a registry entry at
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SigToolESI.SigToolESIDevice2016 HideCaptureWindow = N

using the call RegOpenKey().  This registry key is put there by the applications 32 bit installer built with Wise InstallBuilder 8.12.
On my 64 bit Win7 development system it works fine.  On a client's 64 bit Win7 computer the app is getting an error 2 "Not Found".  The client has also installed on a 32 bit computer running XP and it works fine there.  I understand that what must be happening is the app is requesting to read from non-Wow6432Node and not finding the key there because the key is being redirected to Wow6432Node
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\SigToolESI.SigToolESIDevice2016 HideCaptureWindow =

Because when the client looks with Regedit at the non-Wow6432Node registry entry they find the expected key but they don't find it at the Wow6432Node location.  What I don't understand is if both the application and the installer are 32 bit programs why didn't they both write and read from the Wow6432Node?  And why is it behaving one way on my development computer and differently on the clients if we both ran the same installer and both have 64 bit Windows installed?
I've read this link but what I read doesn't seem to match up with what I am observing of redirection of 32 bit applications.  From what I read in the link it seems like both the 32 bit installer and my 32 bit app should be reading and writing their registry entries to Wow6432Node.  But what I'm observing is that on my 64 bit Win7 development system the installer writes to non-Wow6432Node and app reads from non-Wow6432Node (success) On client's 64 bit Win7 system the 32 bit installer writes to non-Wow6432Node but 32 bit application reads from Wow6432Node and fails.
Here is the view from Regedit of Classes in Wow6432Node and Non-Wow sections on my Win7 development system
SOFTWARE\Wow6432Node\Classes
SOFTWARE\Classes
Update 8-4-2017  I had the client manually create an entry for the key in Wow6432Node section with regedit to try and confirm that it is a Wow6432Node issue.
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\SigToolESI.SigToolESIDevice2016 HideCaptureWindow = N

The result was he got the same error.  So perhaps my premise is somehow off that the clients system is trying to read the Wow3264Node section. What else could be causing error 2?  It certainly seems suspicious that it fails on his 64 bit Win7 system but not on 32 bit XP.
Here is the VB code that is failing.  Note that the error occurs when trying to open the SigToolESIDevice2016 key before even specifying the value name HideCaptureWindow.  The SigToolESIDevice2016 key is created by registering the ActiveX VB component and not as I earlier stated when the installer adds HideCaptureWindow value:
Called with strPath="SOFTWARE\\Classes\\SigToolESI.SigToolESIDevice2016"
            strValue="HideCaptureWindow"

    Private Function RegKeyGetString(hBaseKey As Long, strPath As String, strValue As String)
        Dim hKey
        Dim status As Long

        'Open the key
        status = RegOpenKey(hBaseKey, strPath, hKey)

        If status <> 0 Then
            MsgBox ("RegOpenKey(" & hBaseKey & ", """ & strPath & """, """ & strValue _
            & """) = " & status)
            RegKeyGetString = ""
            Exit Function
        End If

        'Get the key's content
        RegKeyGetString = RegQueryStringValue(hKey, strValue)

        'Close the key
        RegCloseKey hKey
    End Function

A: It turns out this was not related to WOW64 at all but was caused by the particular client not having write access to the registry key and the code requesting "Full Access" when trying to read the key.  The non-extended RegOpenKey() assumes full access instead of READ_ONLY
Here was the code change.
-    'Open the key
-10  status = RegOpenKey(hBaseKey, strPath, hKey)

+    ' Open the key for READ ONLY accesss Some clients were getting
+    ' access error on this call when RegOpenKey() was used which
+    ' requests full access instead of RegOpenKeyEx() with READ ONLY
+    ' access.
+10  status = RegOpenKeyEx(hBaseKey, strPath, 0, KEY_READ, hKey)


text:
Q: Can typescript infer that an argument has been validated? I'm still learning Typescript and Javascript so please excuse me if I am missing something.
The problem is as follows:
Currently VSCode does not infer that I throw an error if email is undefined when calling this.defined(email). This is due to validateEmail() accepting a string? and will not compile because it thinks it could still receive an undefined value (is my deduction at least). Is there a way to tell the compiler this is ok? or am I missing something?
I would like to call Validate.validateEmail() from other classes and the problem arises in those classes as well.
Validate.ts
export default class Validate {
    static validateEmail(email?: string) {
        // TODO: Test this regex properly.
        const emailRegex = new RegExp('^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$')

        this.defined(email);
        this.notEmpty(email);

        if (!emailRegex.test(email)) {
            throw new SyntaxError("The email entered is not valid");
        }
    }

    static defined(text?: string) {
        if (!text) {
            throw new SyntaxError("The text recieved was not defined.");
        }
    }

    static notEmpty(text: string) {
        if (text.length < 1) {
            throw new SyntaxError("The text entered is empty.");
        }
    }
}

A: You can use a type guard. The type guard asserts the type of a particular variable like this:
export default class Validate {
  public static validateEmail(email?: string) {
    const emailRegex = new RegExp(
      '^(([^<>()[]\\.,;:s@"]+(.[^<>()[]\\.,;:s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$'
    );

    if (!Validate.defined(email)) {
      throw new SyntaxError('The text recieved was not defined.');
    }

    if (!emailRegex.test(email)) {
      throw new SyntaxError('The email entered is not valid');
    }
  }

  public static defined(text?: string): text is string {
    return !!text;
  }

  public static notEmpty(text: string) {
    if (text.length < 1) {
      throw new SyntaxError('The text entered is empty.');
    }
  }
}

The downside is that you still need an if statement and the throw expression is outside of the function.
Or you can do something like this, which avoids those problems, but requires you to reassign email to the result of the function.
export default class Validate {
  public static validateEmail(email?: string) {
    const emailRegex = new RegExp(
      '^(([^<>()[]\\.,;:s@"]+(.[^<>()[]\\.,;:s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$'
    );

    email = Validate.defined(email);

    if (!emailRegex.test(email)) {
      throw new SyntaxError('The email entered is not valid');
    }
  }

  public static defined(text?: string): string {
    if (!text) {
      throw new SyntaxError('The text recieved was not defined.');
    }
    return text;
  }

  public static notEmpty(text: string) {
    if (text.length < 1) {
      throw new SyntaxError('The text entered is empty.');
    }
  }
}

A: The compiler can sometimes recognize that a variable is of a type narrower than its annotated or inferred type at certain points in the code, by analyzing the control flow.  In the following code block, the compiler understands that email cannot be undefined if the flow of control reaches the this.notEmpty() call, and thus there is no error:
if (!email) {
    throw new SyntaxError("The text received was not defined.");
}

this.notEmpty(email); // okay

As you've discovered, though, simply refactoring the code to make the check happen in a different function does not work.  The compiler generally does not follow control flow into functions and methods when performing control flow analysis.  This is a tradeoff (see Microsoft/TypeScript#9998 in GitHub for more info): it's not feasible for the compiler to simulate the program running on all possible inputs, by analyzing the possible control flow paths through all possible function calls, so it has to use a heuristic somewhere; in this case, the heuristic is generally "assume function calls have no impact on variable types".  Therefore the call to this.defined(email) has no impact on the type of email as seen by the compiler, and thus it complains about this.notEmpty(email).

Luckily, TypeScript 3.7 introduced "assertion functions"; you can give a function a special return type that tells the compiler that a variable passed to the function will be narrowed by the function, and it will use this as part of its control flow analysis.  While the compiler doesn't infer such function signatures itself, at least now you can manually annotate that defined() asserts something about its argument:
static defined(text?: string): asserts text {
    if (!text) {
        throw new SyntaxError("The text recieved was not defined.");
    }
}

The return type of defined() is asserts text, which means that text will be verified as truthy if defined() returns.  And this fixes your original example:
this.defined(email);
this.notEmpty(email); // okay now!

Looks good.  Okay, hope that helps; good luck!
Playground link to code

A: The reason why your code is not compiling is because notEmpty needs to accept a nullable string. That is because at the call site you are passing a nullable string as an argument.The following code fixes the problems with your code.
export default class Validate {
    static validateEmail(email?: string) {
        // TODO: Test this regex properly.
        const emailRegex = new RegExp('^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$')

        this.defined(email);
        this.notEmpty(email);

        if (email && !emailRegex.test(email)) {
            throw new SyntaxError("The email entered is not valid");
        }
    }

    static defined(text?: string) {
        if (!text) {
            throw new SyntaxError("The text recieved was not defined.");
        }
    }

    static notEmpty(text?: string) {
        if (text && text.length < 1) {
            throw new SyntaxError("The text entered is empty.");
        }
    }
}


text:
Q: task deadlock when invoking in worker threads I have a windows form program (**VS 2010 .NET 4 **) that detecting recursively folders and sub folders of a directory and optimizing files.
I do it by tasking library and have a progressbar that shows progress of item and label near progressbar that shows current file.
I have a SetText(string text) method and delegate  (delegate void SetTextCallback(string text);) which use for this purpose. when I want to show a messagebox at the end of process I think it deadlock. but when I don't use task.Wait(); in button6_Click it goes ok and UI won't hang.
this is my code:
    public partial class Form1 : Form
    {

int MaxFileCounter = 0;
    static int FileCounter = 0;

delegate void SetTextCallback(string text);
delegate void SetProgressCallback(int i);

private void button6_Click(object sender, EventArgs e)
{
    Task task = Task.Factory.StartNew(() =>
    {
        editFiles(txtFilePath.Text);
    });

    task.Wait();

    MessageBox.Show("finished");
}

private void editFiles(string directoryPath)
{
    try
    {
        //DirectoryInfo dirInfo = new DirectoryInfo(txtFilePath.Text);
        DirectoryInfo dirInfo = new DirectoryInfo(directoryPath);
        //string[] extensionArray = { ".jpg", ".png", ".gif" ,".jpeg"};
        string[] extensionArray = txtExtensionList.Text.Split(';');
        HashSet<string> allowedExtensions = new HashSet<string>(extensionArray, StringComparer.OrdinalIgnoreCase);

        FileInfo[] files = Array.FindAll(dirInfo.GetFiles(), f => allowedExtensions.Contains(f.Extension));
        writeFiles(files);

        foreach (DirectoryInfo dir in dirInfo.GetDirectories())
        {
            editFiles(dir.FullName);
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

private void writeFiles(FileInfo[] files)
{
    try
    {
        foreach (FileInfo fileinfo in files)
        {
            MemoryStream mo;

            using (Image image = Image.FromFile(fileinfo.FullName))
            {

                SetText(fileinfo.FullName);

                FileCounter++;

                SetProgress(FileCounter * 100 / MaxFileCounter);

                mo = (MemoryStream)optimizeImage(image, int.Parse(txtPercent.Text));
            }

            byte[] bt = new byte[mo.Length];
            mo.Read(bt, 0, bt.Length);
            mo.Flush();
            mo.Close();

            string fullpath = fileinfo.FullName;

            File.WriteAllBytes(fullpath, bt);

        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

private void SetText(string text)
{
    // InvokeRequired required compares the thread ID of the
    // calling thread to the thread ID of the creating thread.
    // If these threads are different, it returns true.
    if (lblFileName.InvokeRequired)
    {
        SetTextCallback d = new SetTextCallback(SetText);
        this.Invoke(d, new object[] { text });
    }
    else
    {
        this.lblFileName.Text = text;
    }
}
private void SetProgress(int i)
{
    if (progressBar1.InvokeRequired)
    {
        SetProgressCallback p = new SetProgressCallback(SetProgress);
        this.Invoke(p, new object[] { i });
    }
    else
    {
        this.progressBar1.Value = i;
    }
}
}

how can I handle it?

A:     this.Invoke(d, new object[] { text });

The point of using a Task is to not wait for it.  If you do anyway then you'll hang the UI thread.  It goes catatonic, no longer being responsive to notifications from Windows.  Including the ones that your own code generates, like the Invoke() call does.  Which sends a message to the UI thread to go look for the delegate to invoke.
So the Invoke() call cannot complete, the UI thread is hung.  The Task.Wait() call cannot complete since the task is hung on the Invoke() call.  A deadly embrace, one of the standard threading bugs called deadlock.
Note how BeginInvoke() doesn't have this problem, it doesn't wait for completion.  Solves the deadlock, doesn't provide you with a live update since you still have a UI thread that's dead to the world.  You must remove the Wait() call.  You can get the MessageBox.Show() call to run by adding a task continuation with TaskScheduler.FromCurrentSynchronizationContext().  And you need to fret about getting this task to stop when the user closes the window, letting it continue running will not (in general) turn out well.  The async/await keywords added to C# version 5 are a more general solution to this problem.