text:
Q: Database normalization for Addresses I am trying to build a database for a limousine company and I got stuck on how much Normalization should I do for Addresses related to Customers, Drivers, Affiliates and Orders.
Basically the Affiliate and Driver addresses look like this:
address_line_1, address_line_2, city, state, zipcode, country
My problem comes from orders and customers addresses.
They should look like this:
address_line_1, address_line_2, city, state, zipcode, country, address_type_1 (home, business), address_type_2 (pick-up, drop-off - this only needs to be included for orders).
So between all the four tables I have similarities in address fields except for two fields which differ in customer and orders table.
I need to mention that every record will be identified with unique ids.
Example:
Customer ID - 10,000 - 99,999
Order ID - 100,000 - no limit
Driver ID - a1 - a999 (maybe)
Affiliate ID - 1,000 - 9,999
These are just examples so don't spend to much time trying to understand them.
How many Addresses table should I use to create an good normalized database?
In this moment I have three ideas in my mind:

*

*One Addresses table with all the fields included plus an extra one describing the type of address (customer, order, affiliate, driver). Not really like this one.

*Two Addresses tables. One with drivers and affiliates, and one with customers and orders. For the second table I would have and field that will always be NULL for customers. Don't like this one too.

*Three Addresses tables. One for drivers and affiliates, one for customers, and one for orders. No unused fields leads me to think that this could be an better option than the other two.
Does anyone has an advice regarding these three options or maybe even a better option?
Thanks a lot.
UPDATE:
Don't bother yet about the numbering system for the tables ID. That was just an example. I still didn't had time to figure out the best numbering system. Will get to that once I got my addresses problem sorted out.
From Matt's answer I am tempted to leave the driver and affiliate tables with the addresses included and just sort out somehow the customer and order tables.
For customers, I would definitely need an Addresses table because a customer can have multiple addresses (home, business1, business2, favorite places, etc) that I want to have stored in their profile for easier access.
I forgot to mention something about the orders table which may change a little bit the equation of the problem.
For any order I would need to have a PICK-UP and DROP-OFF location. But this can be either an address (street address) or an airport. This means that the fields related to a street address cannot match the airport specific fields. So I am pretty sure that to have four entities (pu_address, pu_airpot, do_address, do_airport) inside a table (all with their specific field) would leave me to unused space and with a programming mess.
Ex:
for pick-up fields: Address_type, Address_line_1, ..., state, country, Airport, Airline, Flt no, ...
and for drop off same thing as pick-up.
So I still have a problem with the Order table for which I am not sure on how to move forward. I would need both addresses and airport pick-up and drop-off locations to be included with or without the use of extra tables.
UPDATE
Thanks again Matt. First, yes I will store addresses in separate fields. The problem still remains for orders. I will give an example on what type of pu and do a limo service use. Address: 123 Main St, Chicago, Il, 60640; Airport: ORD, AA, 123. I need to have all those fields somehow integrated into the table.
Options:
Order table
order_id, ..., pick-up fields which need to have both airports and addresses fields, drop-off fields with both airport and address fields.
This option still doesn't sound right.
Next would be to have two extra tables. One would be for addresses (including a field for recognizing pick-up or drop-off). The other one would be for airport (with a field for pu or do as well).
I don't like this option as well because I will need to do two queries in order to retrieve the information for only an order record. First I will retrieve the order information, and after I know the type of pick-up and drop-off (airport or address), I would do another query to retrieve the specific pick-up and drop-off information.
So, again... what am I doing wrong? Do I miss something?
And yes, I will definitely use some verification system to make sure that the addresses would be correct.

A: It's probably too late now, but I would suggest 1 Addresses table (address_id, address_line_1, address_line_2, city, state, zipcode, country, address_type (FK to AddressTypes table)) as this would follow the standard normalization rules.  Your Orders table will have two Foreign Key relationships with the Addresses table - pickup_address_id and delivery_address_id.  I have questions around the design of the Customers, Drivers and Affiliates tables, but without a better understanding of exactly how they relate it is difficult to prescribe a solution.
One option (but I don't know if it is the right one for you) would be to have a Parties table (party_id, party_type) which creates a supertype / subtype relationship (one to one-or-zero in each case) with Customers, Drivers and Affiliates, all of which are types of Party.  I suggest reading one or two of David C. Hay's articles on data modelling for a better understanding.

A: I actually work in the address verification industry with SmartyStreets, where processing and storing addresses is our area of expertise. In my experience I've seen a number of situations quite like yours.
I'm initially concerned with your segmenting ID numbers based on the type of record it is. If the four types of records (Customers, Drivers, Affiliates, Orders) are stored in different tables, why are the ID range limits needed? (Update: this isn't the main issue at hand really...)
Now, a bit about database design. Ideally, your design should reflect the operation of your core domain (that is, coordinating customers, orders, drivers, etc), without being coupled to merely the address data. While the addresses may be important, they're not the core operation of your business. On this ground and from what I've gathered from your original post, I would immediately hesitate to store the addresses separately from the actual record.
While you will have similar fields in each table, they represent different business purposes, and you won't risk unused, unnecessary fields. So the question isn't so much "how many address tables do I make," it's more a question of even making any tables for addresses only.
While addresses come in many shapes and forms, it's important for the limo company to have correct address information, and for your database to be normalized. The USPS (I assume you're US-based) certifies certain vendors to provide address normalization services. This is called CASS™ Certification. Run each address through a CASS™ service and you're done. The addresses will look the same, have complete information, and be deliverable, too. I suggest you start your search with something like LiveAddress, which will verify addresses at point-of-entry, or a CASS list scrubbing service, which will verify a batch of addresses at once (and warn you of duplicates).
UPDATE: In the case of several addresses a customer may have, then yes, I would advocate using a separate table for that. However, you'll still want to standardize/verify them with CASS so if needed, you can pull out duplicates later (plus you'll know the addresses actually exist).
So, except for that, consider storing each address inline with the actual record it associates with (not in separate tables).
For further questions or direction, I can personally assist.
UPDATE
About separating addresses from airports: that's potentially a valid distinction depending on your business needs, but remember that airports have addresses, too. You could add a field to your table to store the name of the firm or location the address points to, such as "O'Hare International Airport." This could consolidate a few of the fields. Also, I suggest you store the address in separate fields by component (Street, City, State, ZIP, etc).


text:
Q: ActiveMQ persistence issue while using REST I'm using default ActiveMQ (version 5.10.0) configuration which is supposed to persist the messages to the disk.
When I publish some messages on a topic, shutdown the activemq, restart it again and then start the consumer, the consumer does not receive the messages.
here is a detailed description.

*

*I subscribe a consumer on a topic X using REST interface.

*I publish a message on a topic X using REST

*I shutdown ActiveMQ and then restart it.

*I start a consumer to receive a message on topic X. Nothing is received.

So, what happened with the message I sent?
the command I use for publishing:
curl -u admin:admin -d "body=test" "http://localhost:8161/api/message/erdata" -d type=topic
the command for subscribing:
wget --user admin --password admin --save-cookies cookies.txt --load-cookies cookies.txt --keep-session-cookies "http://localhost:8161/api/message/erdata?type=topic&clientId=consumer"
UPDATE
Based on Erik's answer I've tried using virtual topics.
I've added to activemq.xml the following code:
<destinationInterceptors>
      <virtualDestinationInterceptor>
        <virtualDestinations>
          <virtualTopic name=">" prefix="VirtualTopicConsumers.*." selectorAware="false"/>
        </virtualDestinations>
      </virtualDestinationInterceptor>
    </destinationInterceptors>

I've also changed my commands for publishing and consuming.
The new command for publishing:
curl -u admin:admin -d "body=val1" "http://localhost:8161/api/message/VirtualTopic/erdata" -d type=topic

the new command for consuming:
wget --user admin --password admin --save-cookies cookies.txt --load-cookies cookies.txt --keep-session-cookies "http://localhost:8161/api/message/Consumer/A/VirtualTopic/erdata?type=queue&clientId=A"

The problem now is that I don't even receive any messages in the consumer. hawtio tells me that I have a topic VirtualTopic.erdata where there are 0 consumers, 4 messages are enqueued and there are 0 dequeued and 0 dispatched messages. There is a queue Consumer.A.VirtualTopic.erdata that has 1 consumer but there are 0 enqueued, dispatched and dequeued messages. What am I doing wrong here?
Gregor

A: Topics do not support persistence without durable subscriptions, or one of the topic to queue solutions, such as virtual topics.  However  the REST API does not support durable subscriptions,
so you are left with couple of options.
If you require that multiple subscribers get a copy of the message, and ensure the message survives an outage, you can use Virtual Topics and/or Composite queues.
However, if you only care that the next consumer gets the message then you can put straight to a queue simply by specifying "queue" as the type in your example above:
curl -u admin:admin -d "body=test" "http://localhost:8161/api/message/erdata" -d type=queue

redpajama_set_name: RedPajamaStackExchange


text:
Q: Не получается организовать вывод данных У меня есть класс лампочек lamp. Мне нужно вывести с помощью метода TEST() всю информацию, про лампы накаливания (они обозначены как n).
Для этого я создал метод gettype(), который должен получать информацию о типе лампочки, и метод тест, который должен выводить информацию о лампочке. Я пытаюсь посмотреть все экземпляры класса и, как уже написал выше, вывести информацию про те, которые лампы накаливания. Получаю кучу синтаксических ошибок, с которыми ничего не могу сделать. Буду благодарен за помощь!
Ошибки:

Строки:
7 и 8 --->>> if (lamp[i].gettype == "n") {

8, 9, 10, 11 --->>> lamp[i].TEST();

Код:
#include <iostream>
using namespace std;

class lamp
{
public:
    //методы
    void TEST(void);
    char* gettype (void);
    void INIT(void);
    void SHOW(void);
    //конструкторы
    lamp();
    lamp(char *t, int powe, char *c, double cos);
    lamp(const lamp & obj);
    //деструктор
    ~lamp();
private:
    //данные
    char type[100]; // светодиодная, энергосберегающая или лампа накаливания
    int power;      // ЛАМПА НАКАЛИВАНИЯ - "n"
    char color[100];
    double cost;
};

lamp::lamp() {
    cout << "Этот обьект был создан в конструкторе по умолчанию.\n";
    strcpy(type, "");
    power = 0;
    strcpy(color, "");
    cost = 0;
}

lamp::lamp(char *t, int powe, char *c, double cos) {
    cout << "Этот обьект был создан в конструкторе с параметрами.\n";
    strcpy(type, t); //*t
    power = powe;
    strcpy(color, c); //*c
    cost = cos;
}

lamp::lamp(const lamp & obj) {
    cout << "Этот обьект был создан в конструкторе копирования.\n";
    strcpy(type, obj.type);
    power = obj.power;
    strcpy(color, obj.color);
    cost = obj.cost;
}

lamp::~lamp() {
    cout << "Удаление объекта деструктором.\n";
}

void lamp::SHOW(void) {
    cout << "Информация о лампе:\n";
    cout << "\nТип > " << type;
    cout << "\nМощность > " << power;
    cout << "\nЦвет > " << color;
    cout << "\nСтоимость > " << cost << endl;
}

void lamp::INIT(void) {
    cout << "Введите данные о лампе:\n";
    cout << "\nТип (если накаливания, то n) > "; cin >> type;
    cout << "\nМощность > "; cin >> power;
    cout << "\nЦвет > "; cin >> color;
    cout << "\nСтоимость > "; cin >> cost;
}

char* lamp::gettype (void) {
    return type;
}

void lamp::TEST(void) {
    cout << "\nТип > " << type;
    cout << "\nМощность > " << power;
    cout << "\nЦвет > " << color;
    cout << "\nСтоимость > " << cost << endl;
}

void main() {
    setlocale(0, "");

    // конструктор по умолчанию для 1 экземпляра класса
    lamp l1;
    cout << "Введение данных для первого товара." << endl;
    l1.INIT();

    // конструктор с параметрами для 2 экземпляра класса
    cout << endl << "Информация про второй объект: \n";
    lamp l2("накаливания", 950, "желтый", 1580);

    // конструктор копирования для третьего объекта
    cout << endl << "Информация про третий объект: \n";
    lamp l3(l2);

    // вывел информацию про все лампы с помощью метода SHOW
    l1.SHOW();
    l2.SHOW();
    l3.SHOW();

    // создаю массив из двух объектов с помощью конструктора по умолчанию
    lamp la[2];
        // ввожу данные в массив объектов с помощью метода INIT
    cout << "Заполним массив объектов из 2 элементов." << endl;
    for(int i = 0; i < 2; i++) {
        la[i].INIT();
    }
        // вывожу данные из массива объектов с помощью метода SHOW
    cout << "Показываю элементы." << endl;
    for (int i = 0; i < 2; i++) {
        la[i].SHOW();
    }

    // ищу и вывожу информацию про лампы, с типом накаливания
    cout << "Поиск и вывод информации с типом накаливания." << endl;
    for (int i = 0; i < lamp.size; i++) {
        if (lamp[i].gettype == "n") {
            cout << endl << " номер лампы : " << (i + 1) << endl;
            lamp[i].TEST();
            cout << endl;
        }
    }
    system("pause");
}

A: Никогда не проверяйте С-строки (char*), просто используя == - это вы сравниваете два указателя, и не более того...
Далее, void main()... уже много лет стандарт требует писать int main().
Еще - пожалуйста, приучите себя использовать const. Вот вы пишете
lamp(char *t, ...

Значит ли это, что ваш конструктор будет изменять переданную ему строку? Нет? Вы просто ее копируете? А откуда же об этом знать компилятору, раз вы не написали const? А менять литералы нельзя, вы не можете неявно привести "Hello" к указателю на char - только к указателю на const char. Меняйте все эти
lamp(char *t, ...

на
lamp(const char *t, ...

Вот тут
for (int i = 0; i < lamp.size; i++) {

совсем непонятно. Никакого size в вашем классе lamp нет, да и обращение lamp.size неправильное - ведь lamp - это класс, тип, но не объект! Тут надо всерьез переписывать и разбираться вам, это не синтаксическая ошибка...
То же самое и здесь -
lamp[i].gettype

непонятное обращение - через имя класса, как к массиву, обращение к функции без ()...
Знаете, какое ощущение? Вы взяли чужой код, не думая, что-то поменяли, и теперь надеетесь последовательными вопросами здесь на сайте довести его до ума, раз уж тут не делают полностью домашку за других... Очень неприятное ощущение.


text:
Q: Difference between equilibrium point and stationary point Consider the following equation:
$$
\frac{d{\mathbf{x}}}{dt} = F({\mathbf x})
$$
Let's $F({\mathbf x}_0) = 0$. Is ${\mathbf x}_0$ is equilibrium point or stationary point? What is the difference?

A: (i) When ${\bf F}({\bf x}_0)={\bf 0}$ then ${\bf x}_0$ is an equilibrium point of the ODE (system) $\dot{\bf x}={\bf F}({\bf x})$.
(ii) When $f:\ {\mathbb R}^n\to{\mathbb R}$ is a scalar function of $n\geq1$ variables then a point ${\bf p}\in{\rm dom}(f)$ is a stationary point of $f$ if $\nabla f({\bf p})={\bf 0}$, i.e., if all partial derivatives ${\partial f\over\partial x_k}$ vanish at ${\bf p}$.
(iii) Sometimes an ODE system has the form
$$\dot{\bf x}=\nabla f({\bf x})\ ,$$
where $f$ is as in (ii). In this case the equilibrium points of the ODE system coincide with the (hopefully isolated) stationary or critical points of $f$.

A: There are a number of terms that convey the same meaning of an equilibrium point. The term "stationary point" with respect to a vector field $\boldsymbol F$ has exactly the same meaning as an equilibrium point of a dynamical system $\boldsymbol {\dot x}=\boldsymbol{F(x)}$: this is a point at which $\boldsymbol F$ vanishes. Sometimes the terms fixed point, rest point, or critical point are also used in the same context. While I agree with the other answers that it would be much better to keep the term equilibrium point for continuous time dynamical systems (and fixed point for maps) and stationary point for study functions $f\colon {\bf R}^n\to{\bf R}$, the truth is that the context has to be used to infer what is meant.


text:
Q: Haskell: infinite lists - how lazy is Haskell? How lazy is Haskell?
Why does the following not know when to stop?
sum ([n^2 | n <- [1..], odd (n^2), n^2 < 100])

A: Just because 11^2 is more than 100 doesn't mean 13^2 is more than 100. Well... okay, it does, but how is GHC supposed to figure that out? It's a compiler, not a prover of arbitrary mathematical truths.

A: The expression you've given effectively desugars into:
sum $ do
    n <- [1..]
    _ <- if odd (n^2) then [()] else []
    _ <- if n^2 < 100 then [()] else []
    return (n^2)

If you have never seen the List monad then this probably seems like a weird way to use do but it turns ultimately into:
sum $ concatMap (\n -> if odd (n^2) && (n^2 < 100) then [n^2] else []) [1..]

where concatMap is in the Prelude (in earlier versions you can define it as (concat .) . map but now it applies to any Foldable, not just lists, and is therefore closer to (concat .) . fmap).
Now the key thing here is that when Haskell sees this function it stops analyzing! It is a theorem of computer science that the only general way to prove properties about arbitrary general functions is to run them -- Haskell does not peek inside, and does not give concatMap any way to peek inside, a function to try to determine if it will eventually yield [] for all further inputs!
Computers are dumb, and that is good: the smarter a program is, the harder it is to model it in your head. concatMap is a very dumb function, it just applies its function-argument to every element of the list and puts them all together with concat, and that's all it does. List comprehensions are a very dumb syntax replacement for the do notation of the list monad, that's all they do. The do notation is just a very dumb syntax replacement for the function >>= in the Monad typeclass, which for lists is concatMap. Because all of these things are very dumb, you can understand everything that goes on very easily.

A: This isn't about how lazy it is, but rather whether there is any way it can possibly know that n^2 < 100 will never be true again once it was false once. Which it doesn't.
These parts of an array comprehension are filter expressions, not stop conditions.


text:
Q: Private service object methods (Ruby + Rails) I have a PaymentManager service:
/payment_manager/
  - online_payment_creator.rb
  - manual_payment_creator.rb
  - payment_splitter.rb

Code for 3 services:
module PaymentManager
  class ManualPaymentCreator < ApplicationService
    def call
      # do stuff in transaction
      PaymentSplitter.call(a, b, c)
    end
  end
end

module PaymentManager
  class OnlinePaymentCreator < ApplicationService
    # do stuff in transaction
    PaymentSplitter.call(a2, b2, c2)
  end
end

module PaymentManager
  class PaymentSplitter < ApplicationService
    def call(x, y, z)
      # do very dangerous stuff
    end
  end
end

So, the PaymentSplitter essentially splits a payment across multiple invoices, and must be done only inside either of the other 2 services, but should never be called on its own (from a controller or in the console, etc).
I normally would make a private method inside ManualPaymentCreator but because it's needed in BOTH services, I don't know how to do that, as I can't use a simple private instance method without duplication.

A: Perhaps you are looking for inheritance and protected methods
class Foo < ApplicationService
  def public_method
  end

  protected
    #everything after here is private to this class and its descendants
    def some_method_to_be_shared_with_descendants
      #I am only accessible from this class and from descendants of this class

      ...
    end

  private
    #Everything after here is private to this class only

    def some_private_methods_that_are_only_accessible_from_this_class
    end
    ...
end

Then descendant classes like so
class Bar < Foo
  def do_something
    # can access protected methods from Foo class here as native methods
    some_res = some_method_to_be_shared_here
    # do something with some_res
  end
end

So you should descend your other 2 classes from PaymentSplitter and set the shared methods as protected

A: Perhaps a private class contained in a module might work better, eg.
module PaymentSplitting
  def self.included(klass)
    raise 'Error' unless klass.in?([ManualPaymentCreator, OnlinePaymentCreator])
  end

  class PaymentSplitter
  end
  private_constant :PaymentSplitter
end

This should allow you to freely reference PaymentSplitter in any class which includes PaymentSplitting, and you can only include PaymentSplitting in ManualPaymentCreator or OnlinePaymentCreator. Referencing PaymentSplitting::PaymentSplitter will throw a NameError: private constant exception.


text:
Q: bind variable to .net textbox.text property im trying to do a simple variable bind to a control text box but i cant for the life of me get this working. Here is the scenario two forms 1 with datagrid and  and the other with two textboxes. When i click on the datagrid i would like to pass those variables to the textboxes in FORM1. This is what i have tried with no results.
in my form1
public string myText
    {
        get { return tuidInput.Text; }
        set { tuidInput.Text = value; }
    }

then i my form two when i try to set the value i try this.
private void selectUser(object sender, DataGridViewCellEventArgs e)
    {
        userPicked.tuid = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["spriden_id"].Value.ToString();
        userPicked.Name =  dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["spriden_last_name"].Value.ToString();

        Form1 form1 = new Form1();

        form1.myText = userPicked.tuid
     }

i got that example from here http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/7308639f-640b-48bf-8293-abcbfd2292d8/
however it does not update the textbox? what should i be doing differentely?
what im i doing wrong ? how can i do this correctly i have looked at several article on here but have not been successful at any of them.
any help would be great appreciated.

A: I'm not sure if that's the case, but in:
form1.myText = userPicked.tuid
you're refering to a newly created Form1 object, initialized just 1 line above. If you'll check form1.myText property, you'll probably notice it has its value assigned, but it's not the form object you want to actually refer to.
If your textboxes are in Form2, then create a Form2 reference in Form1.
private Form2 form2 = null;
And create a property
public Form2 SecondForm
{
    set { this.form2 = value; }
}
Assign it properly and then use form2.tuidInput.Text in your Form1 normally.

A: Have you tried:
Form1 form1 = new Form1();
form1.myText.Text = userPicked.tuid;
form1.myText.Refresh();
form1.Show();

You may have to redraw the text box after reloading it.
Also, you said you want to do this correctly.  To do it "correctly" (I say it loosely because "correct" can be interpreted in sooo many ways by so many different people!) - I would like to suggest using an MVP, MVVM or MVC pattern to handle this instead of doing this business logic in the GUI.
For MVP example:
http://haacked.com/archive/2006/08/09/ASP.NETSupervisingControllerModelViewPresenterFromSchematicToUnitTestsToCode.aspx

A: none of the answers above answer the question i finally found an answer here
http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/thread/9339C805-58C6-4DC2-934F-2A4ADC67ED4D
here is all i needed to do. I changed the textbox to public and then ran this from form2 and it worked like a charm.
Form1 form1 = (Form1)Application.OpenForms["Form1"];

Thanks everyone for your responses.
Miguel


text:
Q: Validate AWS Cognito JWT Token (Access token) I am using java programming language and using the spring boot framework, I am able to generate JWT token from AWS Cognito using username and password, But now I try to validate the token when I am calling any API and this token is going in the header.
So how can I validate this?

A: All information on how to verify and validate the JWT can be found here.
https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-verifying-a-jwt.html


text:
Q: open file on server with notepad via windows cmd in python I am trying to opne a file that is located on a server using the windows cmd. What I do is basically the following thing:
import os
os.system('pushd '+ \\Server\PathToFile)
os.system('start Notepad '+ NameOfFile)

The point is that this works if I enter it by hand in the cmd. If I try to do it within python it does not work. I get this error message:
CMD.EXE was started with the path given above as current directory.
UNC-paths are not supported, therefore the windows-directory is used as
current directory.

The actual error message is in german, that's why I translated it and I'm not sure whether it's understandable or not. What actually happens is that the path where notepad is looking for the current file is  C:\Windows instead of the path that I indicated.

A: Windows doesn't support setting the current directory to an UNC path, and it wouldn't have worked anyway since those are 2 separate os.system commands.
You could mount a drive on this path and use os.chdir, but that would make it more complex yet!
You don't really need current directory change. Moreover os.system is deprecated, it's recommended to use subprocess instead.
So change your code to run the command providing full path to the file:
import subprocess
subprocess.call(["start","notepad",os.path.join("\\Server\PathToFile",NameOfFile)],shell=True)

but I suspect you'd be better off with
os.startfile(os.path.join("\\Server\PathToFile",NameOfFile))

(default associations of Windows will probably open "notepad" in background, that's one-line & simple, & users can even change the editor used by just changing text file association in windows)


text:
Q: Difference in logic notations for maths and computer science I am reading: How to prove it, A structured approach by Daniel J.Velleman
and despite it being a book based on both maths and computer science all logic statements seems to be in the "maths logic" notation like so:
$$\lor, \land, \lnot$$
However in all my computer science classes we used "computing logic" notation like so:
$$+,\cdot,\overline{A}$$
There is no explanation of when, and which, of these notations are to be used in different scenarios in the book. I personally prefer the "maths logic notation" and my best guess is that the reason it seems to be used more is that it is less ambiguous as it uses its own symbols. If this is the case is there any real reason for the "computing logic notation" to be used, or is it just used due to tradition?
Also as a side note my book stated that in maths $or$ is considered to be iclusive is there therefore a separate sign for exclusive $or$ much like $\oplus$ in computing notation?

A: If you observe, the computer science notation is similar to regular algebra notation: addition signs and multiplication signs. It becomes convenient to use when 'or' doesn't really represent a logical 'or' but a bitwise 'or', sometimes just called 'addition' (without carries):
  10010101
+ 00100101
= 10110101

'Multiplication' a.k.a. 'and' works similarly. The main difference is that the computer science notation is used more often in the context of performing this special type of arithmetic, or dealing with Boolean algebra expressions like $AB + \bar{A}C$, because it is easier to think of them that way. (E.g. There are digital circuits called 'adders'.)
The mathematical notation of $\land$, $\lor$, $\lnot$ is used exclusively for logical statements like $P(x) \land \lnot(Q(x) \lor R(x))$. I have almost never seen something like $10010101 \lor 00100101$ and it would be unintuitive to write it that way.
This duality is quite interesting when you notice that the two notations are actually talking about the same thing!


text:
Q: Sales Force Joomla Within Joomla were using RSForm then passing the data through to SalesForce eveything works apart from I'm using a html hidden field then trying to pass this through to sales force to check a checkbox... But can't get it working any ideas?
Cheers

A: Found out the problem...
It requires a 1


text:
Q: Iterate through XML node and update an element in C# without Linq I am stuck in a situation where I have to update one node element based on the condition where two other element in that node should exist than only it should update the element.
For ex: I have this XML
XML
And I want to update ItemId in detail node if EventID and SubEventId in same node are 10154 and 12 respectively.
Please suggest, i am new to DOM and C#.


text:
Q: Rally Rest API - 'Batch' processing of Project Permissions I'm currently using the C# Rally Rest API and setting project permissions for a user. This is working but permissions are being set one at a time. So, if a user needs access to 5 projects, I'm making 5 Create ProjectPermission calls. What I would really like to do is make one call into Rally with all the necessary information so it can update all the permissions at once.
I would also like to be able to set team membership in the same call. In looking at the revision history for a user, I know that Rally, internally, can update all that information in one call--since it shows only 1 revision for a bunch of changes. To accomplish the same work using my current method causes a revision for each change to happen.
Is there a way to 'batch' process these types of request to make them more efficient?

A: You are following the best/only available approach via Webservices with your N_Projects x Create ProjectPermission calls. While the User Revision History may record a single change for multiple Permission Grants made via the Rally User Interface, Rally's Webservices API requires a WSAPI call per permission.


text:
Q: Action of a Lie group on a smooth manifold Suppose a Lie group acts smoothly (but not necessarily properly or freely)
on a smooth manifold $M$. Show that each orbit is an immersed submanifold
of $M$; which is embedded if the action is proper.
This is problem 15 of chapter 21 of Lee's smooth manifolds book I was searching to solve the above problem and I'm now a little confused writing an easy argument for this. I found the following argument but this is not easy enough for me to understand:

*

*For each $p\in M$, the isotropy group $G_p = \{g\in G: g\centerdot p=p\}$ is a closed subgroup of $G$.

*The quotient space $G/G_p$ has a unique smooth manifold structure, and $G$ acts transitively on this smooth manifold by left multiplication.

*The orbit map $\mathscr O_p\colon G\to M$ given by $\mathscr O_p(g) = g\centerdot p$ descends smoothly to the quotient $G/G_p$ to give a smooth map $F_p\colon G/G_p\to M$ that is a bijection from $G/G_p$ onto the orbit $G\centerdot p$.

*The map $F_p$ is equivariant with respect to the left actions of $G$ on $G/G_p$ and $M$, and therefore it has constant rank.

*Because it is a constant-rank injection, $F_p$ is a smooth immersion, and therefore its image $G\centerdot p$ is a smoothly immersed submanifold of $M$.

Could anyone help me prove this?

A: So I am going to do this step by step. So I belive it's clear that $G_p$ is a closed subgroup of $G$, and we can consider the proper free action $G\times G_p\rightarrow G_p$ by left translation , and since $G_p$ is a closed subgroup it also has a manifold structure and we can consider the space $G/G_p$. Now we get a bijection from $G/G_p$ to the orbit $g.p$ of $p$ since we are doing the quotient by the points that would fix the orbit. Then you have that $F_p$ is an equivariant map because $g.F_p(hG_p)=g(hp)=(gh)p=(gh)G_p p=F_p(ghG_p)$. Using the fact that the action of $G$ in $G_p$ is transitive and the equivariant rank theorem you have that $F_p$ must have constant rank and then using the fact that locally for suitable coordinates $F_p$ looks like $(x_1,...,x_r)\rightarrow (x_1,...,x_k,0,...,0)$ where $k$ is the rank of $F_p$, but since $F_p$ is injective this forces $k=r$ and so you get that it's an immersion,  and so since the image of $F_p$ is the orbit of $p$ and that $F$ is an injective immersion you get the desired result.
I don't know what much could be added , is there anything that needs clarification ?


text:
Q: Multidimensional Array Validation and Insertion I have been searching and banging my head since 2 days to achieve what I want to achieve, but since google and other source could not solve my issues, am posting it here. I have a form where I submit array and post it via PHP to insert it into mysql database.
Form values

1
<input name="description[]" id="description-1" type="text" value="test1">
<input name="amount[]" id="amount-1" type="text" value="500.00">
<input name="paidby[]" id="paidby-1" type="text" value="">Company
<input name="paidto[]" id="paidto-1" type="text" value="client">

2
<input name="description[]" id="description-2" type="text">
<input name="amount[]" id="amount-2" type="text" value="400.00">
<input name="paidby[]" id="paidby-2" type="text" value="">Company
<input name="paidto[]" id="paidto-2" type="text" value="">

3
<input name="description[]" id="description-3" type="text" value="">
<input name="amount[]" id="amount-3" type="text" value="">
<input name="paidby[]" id="paidby-3" type="text" value="">
<input name="paidto[]" id="paidto-3" type="text" value="">

4
<input name="description[]" id="description-4" type="text" value="">
<input name="amount[]" id="amount-4" type="text" value="">
<input name="paidby[]" id="paidby-4" type="text" value="">
<input name="paidto[]" id="paidto-4" type="text" value="">

5
<input name="description[]" id="description-5" type="text" value="">
<input name="amount[]" id="amount-5" type="text" value="">
<input name="paidby[]" id="paidby-5" type="text" value="">
<input name="paidto[]" id="paidto-5" type="text" value="">

If you see the first row contains all required values. And on second row, only amount is entered and description field and paidto field is not entered. Hence, I do not want to process the form and should throw an error.
My php code is like this
if($_POST['sform'] == "1")
{
    foreach($_POST['description'] as $key => $desc)
    {
        if (!empty($_POST['description'][$key]) && !empty($_POST['amount'][$key]) || !empty($_POST['paidto'][$key]))
        {
            $query = 'INSERT INTO `expenses` (`amount`, `description`, `paidby`, `paidto`,) VALUES ('.$conn->qstr($_POST['amount'][$key]).', '.$conn->qstr($_POST['description'][$key]).', '.$conn->qstr($_POST['paidby'][$key]).', '.$conn->qstr($_POST['paidto'][$key]).')';
            $results = $conn->Execute($query);
        }
        else
        {
            $error = "Form contain errors, please fix";
        }
    }
}

With this code, it throws an error as well as it inserts first 2 rows data.
Where as it should not get inserted as second row description and paidby values are missing. How can I validate properly and insert only correct data to database.
Kindly help...

A: Comment with code is too long so i'll post an answer in hopes it helps you. The quickest / easiest way I see to do it would be to loop through the data twice. Once to verify it's not blank, and once to actually insert the data...
$error = '';
foreach($_POST['description'] as $key => $desc){
    if (empty($_POST['description'][$key]) || empty($_POST['amount'][$key]) || empty($_POST['paidto'][$key])) {
      $error = "Form contain errors, please fix";
      break; // this stops it from going through every input. if one fails, they all fail
    }
}

if ($error != ''){
    foreach($_POST['description'] as $key => $desc){
        $query = 'INSERT INTO `expenses` (`amount`, `description`, `paidby`, `paidto`,) VALUES ('.$conn->qstr($_POST['amount'][$key]).', '.$conn->qstr($_POST['description'][$key]).', '.$conn->qstr($_POST['paidby'][$key]).', '.$conn->qstr($_POST['paidto'][$key]).')';
        $results = $conn->Execute($query);
    }

}


text:
Q: Can I instruct my network requests to only use WiFi, even when both WiFi and Data networks are available? As far as I know, the hardware/os decides which network will execute my app's requests, if both MobileData and WiFi networks are on, judging by this answer here: In Android, if both mobile and wifi networks are available, which one is used?.
This comment here says the same: https://android.stackexchange.com/questions/57710/how-do-you-determine-if-youre-using-wi-fi-or-lte#comment79856_57919
Can I instruct  my network requests to only use WiFi, even when both WiFi and Data networks are available?
I am trying to solve this problem: The user has a setting that says "Do NOT use mobile data" which should forbid the app from sending network requests if Mobile Data is on (which can be subject of charges).
However, if that answer to my linked question is really true, that means that if both Mobile and WiFi are on, WiFi is not guaranteed to take precedence over Mobile and Mobile will still perform requests and the user will be charged.
At the moment in my code I check what type of network connection is available, and if that setting is on ("Do NOT use mobile data") I only perform requests if WiFi is ON and MobileData is OFF. If both are ON, I do NOT perform requests in order to protect the user from being charged.
However, it is difficult explaining this to my colleagues, so I am thinking - is it possible to instruct my app's network requests to be only performed via WiFi, even if both WiFi and MobileData are ON simultaneously?
PS: I just found an exactly opposite opinion, stating that if both MobileData and WiFi are on, all requests will be performed via WiFi:
https://android.stackexchange.com/questions/17774/how-can-i-tell-that-my-phone-uses-the-wi-fi-connection-for-data-traffic
I am not sure who to believe.
EDIT: I found some code snippets that are supposed to do this job:
Send request over Mobile data when WIFI is ON.(Android L) but I don't know how to test them and if they really do what I want to do here.
How to use data connection instead of WIFI when both are enabled?


text:
Q: Opengl Multitexturing and blending I explain my problem:
I have three png image, the first has channel alpha, the other two are RGB:

            frame                           mask                    background

I have to blend it all to obtain this result

now i know that i have to mask the third texture in this way:
if mask_pixel=white:
    blend_pixel=pixel with alpha 0
else if mask_pixel=black:
    blend_pixel=backgroud_pixel

and since now i have written this:
glActiveTexture(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, background);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, mask);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glActiveTexture(GL_TEXTURE2);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, frame);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
    glEnable (GL_BLEND);
        glBegin(GL_QUADS);
            glMultiTexCoord2f(GL_TEXTURE0, 0.0, 0.0);
            glMultiTexCoord2f(GL_TEXTURE1, 0.0, 0.0);
            glMultiTexCoord2f(GL_TEXTURE2, 0.0, 0.0);
            glVertex3f(-0.7, 0.0, 0.0);

            glMultiTexCoord2f(GL_TEXTURE0, 1.0, 0.0);
            glMultiTexCoord2f(GL_TEXTURE1, 1.0, 0.0);
            glMultiTexCoord2f(GL_TEXTURE2, 1.0, 0.0);
            glVertex3f(0.7, 0.0, 0.0);

            glMultiTexCoord2f(GL_TEXTURE0, 1.0, 1.0);
            glMultiTexCoord2f(GL_TEXTURE1, 1.0, 1.0);
            glMultiTexCoord2f(GL_TEXTURE2, 1.0, 1.0);
            glVertex3f(0.7, 2.6, 0.0);

            glMultiTexCoord2f(GL_TEXTURE0, 0.0, 1.0);
            glMultiTexCoord2f(GL_TEXTURE1, 0.0, 1.0);
            glMultiTexCoord2f(GL_TEXTURE2, 0.0, 1.0);
            glVertex3f(-0.7, 2.6, 0.0);
        glEnd();
    glDisable(GL_BLEND);
glActiveTexture (GL_TEXTURE2);
glDisable (GL_TEXTURE_2D);
glActiveTexture (GL_TEXTURE1);
glDisable (GL_TEXTURE_2D);
glActiveTexture (GL_TEXTURE0);
glDisable (GL_TEXTURE_2D);

but I am not sure how to use glTexEnvi to obtain the desired efect, any suggestion?

A: yes! i have reached the answer on my own:
glActiveTexture(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_SUBTRACT);
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, mask);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_SUBTRACT);
glActiveTexture(GL_TEXTURE2);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture_open);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
    glEnable (GL_BLEND);
        glBegin(GL_QUADS);
            glMultiTexCoord2f(GL_TEXTURE0, 0.0, 0.0);
            glMultiTexCoord2f(GL_TEXTURE1, 0.0, 0.0);
            glMultiTexCoord2f(GL_TEXTURE2, 0.0, 0.0);
            glVertex3f(-0.7, 0.0, 0.0);

            glMultiTexCoord2f(GL_TEXTURE0, 1.0, 0.0);
            glMultiTexCoord2f(GL_TEXTURE1, 1.0, 0.0);
            glMultiTexCoord2f(GL_TEXTURE2, 1.0, 0.0);
            glVertex3f(0.7, 0.0, 0.0);

            glMultiTexCoord2f(GL_TEXTURE0, 1.0, 1.0);
            glMultiTexCoord2f(GL_TEXTURE1, 1.0, 1.0);
            glMultiTexCoord2f(GL_TEXTURE2, 1.0, 1.0);
            glVertex3f(0.7, 2.6, 0.0);

            glMultiTexCoord2f(GL_TEXTURE0, 0.0, 1.0);
            glMultiTexCoord2f(GL_TEXTURE1, 0.0, 1.0);
            glMultiTexCoord2f(GL_TEXTURE2, 0.0, 1.0);
            glVertex3f(-0.7, 2.6, 0.0);
        glEnd();
    glDisable(GL_BLEND);
glActiveTexture (GL_TEXTURE2);
glDisable (GL_TEXTURE_2D);
glActiveTexture (GL_TEXTURE1);
glDisable (GL_TEXTURE_2D);
glActiveTexture (GL_TEXTURE0);
glDisable (GL_TEXTURE_2D);

in the mask image i have replaced the black with white and the white with trasparency


text:
Q: why .htaccess is showing me "Internal Server Error"? In my site I removed .php extension from the url using .htaccess rules. So that I can go to any page without .php extension. e.g :
http://localhost/aponit/dev/zones (there are no .php extension)

Now,I have a link in a php page to update a form data. Link is bellow :
<a class="btn btn-success btn-xs" href="<?php echo SITE_URL."update/$zone_id"?>" >Edit

This link showing following url :
http://localhost/aponit/dev/update/54

But unfortunately It's showing me error message :
Internal Server Error
I am using following .htaccess rules :
ErrorDocument 404 /not-found.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
RewriteRule ^update/([0-9]+) update?z=$1 [L]

A: Trying to:
ErrorDocument 404 /not-found.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

And post detail log file???

A: The .htaccess code that yuo have provided will not work correctly if the site does not run under root domain. For example
RewriteRule ^update/([0-9]+) update?z=$1 [L]

This code block tells the server that any URI starting with "update" following a number will be rewritten. but in your case, the URI always starts with "aponit/dev/". So this code will not work any time.
Solution
Set up a virtual host. You will get a lot of available tutorials online how to setup a virtual host based on your server software(XAMPP/WAMP etc)
If you just want to remove .php from url, use the following code in .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]


text:
Q: How to move all files and folders from current directory to another directory excluding a folder named "My Folder" in vb? I want to move all files and folders from current directory to another directory excluding a folder named "My Folder". I want to know how can I do this with vb?

A: Not really tested but might be helpful anyway:
Dim currentDir = Directory.GetCurrentDirectory() ' or whatever you call current
Dim targetDir = Path.Combine(currentDir, "Target-Directory")
Directory.CreateDirectory(targetDir)

Dim allDirs = From dir In Directory.EnumerateDirectories(currentDir, "*.*", SearchOption.AllDirectories)
              Where Not Path.GetFileName(dir).Equals("My Folder", StringComparison.InvariantCultureIgnoreCase)
For Each dir As String In allDirs
    Try
        Dim targetPath As String = Path.Combine(targetDir, Path.GetFileName(dir))
        Directory.Move(dir, targetPath)
    Catch ex As Exception
        ' log or whatever, here just ignore and continue ...
    End Try
Next

'now move the rest of the files in the troot folder
Dim filesInRoot = From file In Directory.EnumerateFiles(currentDir, "*.*", SearchOption.TopDirectoryOnly)
For Each file As String In filesInRoot
    Try
        Dim targetPath As String = Path.Combine(targetDir, Path.GetFileName(file))
        IO.File.Move(file, targetPath)
    Catch ex As Exception
        ' log or whatever, here just ignore and continue ...
    End Try
Next


text:
Q: Extension of a family of vectors to a basis of a vector space Let $V$ be a vector space. $\dim V=n$
Let $v_1,...,v_k \in V$ linearly independent.
Let $E$ be a generating set of vectors of $V$
Show that there exist $v_{k+1},...,v_n \in E$ st. $v_1,...,v_n$ are a basis of $V$.
My thoughts:
$v_1,...,v_k$ can be extended to a basis of V by vectors $v'_{k+1},...,v'_n$. Now the $v'$s can be expressed by E, but I will have to show, that the vectors of E needed will be lin. ind. to $v_1,...,v_k$ as well.

A: Hint: Show that if one of the vectors you add is a linear combination of $v_1,\dots,v_k$, then you still obtain a generating set of $V$ if you just don't add that vector.


text:
Q: sed replace xml tag I want to replace value inside a tag in an xml file using sed.
<version> xxxx-SS </version>

I want to replace xxxx-SS with some shell variable $ver .
The final result should be
<version>$ver</version>

The sed command should also quit after replacing the first instance.
So far I have been able to only append to the xxxx-SS and not been able to quit after the first match.
sed 's#\(<version>\)*\(</version>\)#\1'$ver'\2#g' test.xml

This only appends the value between -SNAPSHOT tag.Basically makes it xxxx-SS$ver

A: Using xml/html parsers is the right way to manipulate xml/html documents. Don't use sed/awk tools for such cases.
xmlstarlet solution:
xmlstarlet ed -u "//version[1]" -v $ver test.xml

*

*ed - edit mode

*-u - update action

*//version[1] - xpath expression to select the first version tag

*-v $ver - the new value for selected node

A: You may try to use awk, it would more simple to achieve what you desire,
$ cp test.xml test_orig.xml

$ awk '/<version> xxxx-SS <\/version>/{gsub(/<version> xxxx-SS <\/version>/,"<version> $ver </version>",$0)}1' test_orig.xml > test.xml
$ cat test.xml
...
<version> $ver </version>
...

$ rm test_orig.xml

The command would substitute xxxx-SS to test (modify the var value to what you want)


text:
Q: Tooltip that's not linked to any particular control I'm trying to make something like a spellchecker, that will list possible words under the current caret position. I thought I would do this by creating a tooltip, moving it according to the caret's location, and changing the text inside the tooltip.
I'm having problems.
I'm trying to show the tooltip with tip.Show(form, x, y);
However, this app is running from the systray. It has no GUI elements aside from that? What do I use as the form parameter? the notifyIcon1, Form1, etc. do not work.
I would start with an example that displayed a static tooltip that moved along with my mouse cursor or something. Can someone point me in the right direction?
Thanks

A: You may be able to do this but not using a tooltip class as that is quite limiting, there is a fantastic tooltip helper called VXPLib, using html formatting (which I suppose would give your listing of words an edge - say in different colours). The VXPLib is a COM object (written in C++) but accessible from the .NET language and there is a wrapper that can do it for you along with code samples. I have tried them and they actually work and make it look nice...See here for more information.
Hope this helps,
Best regards,
Tom.

A: If there's no GUI in your application, then in what application are you to providing a spell checker?
If you are integrating your application with another existing application (even non-.NET applications), then you need to obtain the handle (HWND) of the other application and convert it to a System.Windows.Forms.IWin32Window.  Once you do this, you can use that handle as the form in the ToolTip.Show method.
Here is the code you need:
using System.Diagnostics;

//...

public class MyWindow : System.Windows.Forms.IWin32Window
{
    private IntPtr _hwnd;

    public IntPtr Handle
    {
        get
        {
            return _hwnd;
        }
    }

    public MyWindow(IntPtr handle)
    {
        _hwnd = handle;
    }

    //...

    public static MyWindow GetWindowFromName(string processName)
    {
        Process[] procs = Process.GetProcessesByName(processName);
        if (procs.Length != 0)
        {
            return new MyWindow(procs[0].MainWindowHandle);
        }
        else
        {
            throw new ApplicationException(String.Format("{0} is not running", processName));
        }
    }
}

//...

tip.Show("this worked...", MyWindow.GetWindowFromName("Notepad"), 0, 0, 2000);

A: I posted an answer in this thread that uses a transparent, maximized for to simulate drawing a tooltip anywhere on the screen, including the desktop. Maybe it will help: Creating a tooltip from a system-tray only app
Edit: Copied the code over from the linked post for ease of reading :-)
Here you go, use a transparent, maximized form that you BringToFront() before showing the ToolTip
Form1 Code:
using System;
using System.Windows.Forms;

namespace SO_ToolTip
{
    public partial class Form1 : Form
    {
        Random _Random = new Random();
        ToolTip _ToolTip = new ToolTip();

        public Form1()
        {
            InitializeComponent();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            BringToFront();
            _ToolTip.Show("Blah blah... Blah blah... Blah blah...", this, _Random.Next(0, Width), _Random.Next(0, Height), 10000);
        }
    }
}

Form1 Designer Code: So you can see the forms properties:
namespace SO_ToolTip
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.SuspendLayout();
            //
            // timer1
            //
            this.timer1.Enabled = true;
            this.timer1.Interval = 1000;
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 264);
            this.ControlBox = false;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "Form1";
            this.Opacity = 0;
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Timer timer1;

    }
}

Update: With ControlBox = false; and Opacity = 0; the form is not only visually transparent but is immune to user input. That is even when the Form1 above if the top most window clicking in it's area falls through to the next window/desktop. Just as if the form wasn't there. The BringToFront() before showing the tooltip is required because otherwise the tooltip could be drawn under other windows, which is not what you want.

A: I have worked on creating a tooltip that is "not linked to any particular control", because I wanted to replace one of my AutoHotkey scripts which uses the ToolTip command.
I have my code stored at: https://bitbucket.org/tahir-hassan/dotnettooltip
All you do is, instantiate the control, set the text it displays, set the coordinates, and call Show method:
var tooltip = new ToolTipLib.ToolTip()
{
    Text = "this is a nice toolTip",
    LocationX = 100,
    LocationY = 200
};

tooltip.Show();


text:
Q: good way (with low latency) to get items from multiple dynamodb tables? I have several dynamodb tables, table A, table B, table C and table D.
I want to get item A from table A, item B from table B, item C from table C and item D from table D.
Currently I make 4 dynamodb getItem calls to 4 tables to get the items sequentially. Each call cost ~12 millisecond, total ~50 millisecond.
ItemA a = tableA.getItem("A");
ItemB b = tableB.getItem("B");
ItemC c = tableC.getItem("C");
ItemD d = tableD.getItem("D");

Is there a better way to make the calls to reduce latency? Not sure how i can make it parallel here.

A: If the requests, as in your example, are not dependent on one another - in other words, you don't need to know the result of the first request to send the second, you don't need to do them sequentially (one after another) - you can start all four in parallel.
How to start four requests in parallel depends on the specific programming you are using, but you have an even easier option: Send just one BatchGetItem request - with the four requests in it. DynamoDB will do all these requests in parallel for you.


text:
Q: Probability with average of measures I am trying to solve Problem 2 from this problem set.

Let $\mathbf{Y}$ be the avreage of $5$ independent measurements.
  For a single measurement one have $\sigma^2 = 0.060^2$ and $\mu = 6.8$.
$\textbf{b})$ What is the probability that $\mathbf{Y}$ deviates more than $0.06$ from $\mu$ ?

I tried to use the probability that one measurement deviated more than $0.06$ from $\mu$. And then the total probability should be $1 - P(\text{all are below } 0.06)$.
But I see that this is wrong.
I also tried calculating
$$
    1 - P\left( Z < \frac{5\cdot 6.8- (5\cdot 6.8 + 0.06)}{\sigma/\sqrt{5}} \right)= 1 - P(Z<\sqrt{5\ \!})
$$
Which also turns out to be false. The correct answer should be
P = $0.026$, but I can not quite get there. I am not experienced with dealing with
the average of independent measurements, so any literature, hints or tips is very welcome.

A: The questions says "results which are assumed to be independent and normally distributed", which is important to note.
In effect you are being asked to find the distribution of $Y$ (which is a mean, not a sum as in your expression).

*

*What is the expected value of $Y$? (It is not $5\cdot 6.8$.)

*What is the standard deviation of $Y$? (As you seem to say, it is $\sigma/\sqrt5$.)
Now, what is the probability of $Y$ deviates from $\mu$ by more than $0.06$?  Remember that $Y$ might be greater than or less than $\mu$, and the deviation here probably means the absolute value of the difference.


text:
Q: INTERVAL expression in Spring Data JPA Native Query I have Spring JPA.
I have a query like this in sql oracle:
SELECT * FROM MY_TABLE WHERE  SYSDATE > MY_DATE + INTERVAL '10' DAY;

I have a CrudRepository in which I use the above query in native mode, like this:
@Query(nativeQuery = true,
            value = "SELECT * FROM MY_TABLE WHERE  SYSDATE > MY_DATE + INTERVAL :myValue DAY")
public List<Object[]> myMethod(@Param("myValue") String myValue );

I get ORA-00933:
Passing myValue as integer between quotes I get ORA-01867
Passing myValue as integer without quotes I get ORA-00933
How to do it?

A: See comments on question, there is a similar question/answer for spring/jpa/postgresql, solution for me is:
@Query(nativeQuery = true,
            value = "SELECT * FROM MY_TABLE WHERE  SYSDATE > MY_DATE + :myValue * (INTERVAL 1 DAY"))
public List<Object[]> myMethod(@Param("myValue") int myValue );


text:
Q: return value optimization vs rvalue reference I learned about return value optimization (Object return in C++, http://en.wikipedia.org/wiki/Return_value_optimization, http://blog.knatten.org/2011/08/26/dont-be-afraid-of-returning-by-value-know-the-return-value-optimization/) that prevents temporary object generation.
I also learned about rvalue reference (http://www.cprogramming.com/c++11/rvalue-references-and-move-semantics-in-c++11.html) that also can be used to prevent temporary object generation.
Practically, can I just return value not worrying about performance degradation from copying objects?
I mean, are those two code snippet equivalent?
A hello()
{
    A a(20);
    cout << &a << endl;
    return a;
}

// rvalue reference to prevent temporary object creation
A&& a = hello();
cout << &a << endl;

// expects compiler remove the temporary object
A a = hello();
cout << &a << endl;

A: First and foremost you should return by value if you logically want to give the caller a new object. If RVO can't occur then a move will happen. If I move can't happen, a copy will happen. Move's are often trivial, but it depends on the object obviously. If you are returning a non-movable type which is expensive to copy, it becomes a more difficult decision of whether you can rely on RVO. Luckily, that should be a rare case.
RVO is so widely applicable that it's fairly difficult to make it not happen. I know on some compilers a ternary statement for the return value will break it though. In VS at least, NRVO won't happen in debug. So, it's worth noting debug build performance will be affected.
Look at the assembly your compiler generated for your particular code above to see if it's the same for both cases. It most likely is.


text:
Q: How to expand Virtual Box VM Storage I have read through a few Superuser questions and on google and used every way I can think of after looking through the documents on how to expand my virtual box storage.
I am running Windows 10, AMD Ryzen 1600, 16gb RAM.
VBox --version = 6.0.
EDIT: current size = 20,000 not dynamic
The error that returns is below:
C:\Program Files\Oracle\VirtualBox>VBoxManage modifyvdi --resize 32000 5abb39a5-8f61-43d9-ad20-4810d026b68f
0%...
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage.exe: error: Failed to resize medium
VBoxManage.exe: error: Resizing to new size 33554432000 is not yet supported for medium 'C:\Users\colto\VirtualBox VMs\linuxMint\linuxMint.vdi'
VBoxManage.exe: error: Details: code VBOX_E_NOT_SUPPORTED (0x80bb0009), component MediumWrap, interface IMedium
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleModifyMedium(struct HandlerArg *)" at line 768 of file VBoxManageDisk.cpp

I have also tried running it as modifyhd and modifymedium.
    C:\Program Files\Oracle\VirtualBox>VBoxManage showhdinfo "C:\Users\colto\VirtualBox VMs\linuxMint\linuxMint.vdi"
UUID:           5abb39a5-8f61-43d9-ad20-4810d026b68f
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       C:\Users\colto\VirtualBox VMs\linuxMint\linuxMint.vdi
Storage format: VDI
Format variant: fixed default
Capacity:       20612 MBytes
Size on disk:   20615 MBytes
Encryption:     disabled
In use by VMs:  linuxMint (UUID: 51c5a4fd-f68c-47c7-bc59-d1acec94c163)

A: I really wanted a fixed hard disk but I also needed the ability to change this dynamically, and none of the answers (at the time) were adequate to my needs so here is my answer to my question:
The simplest way to complete this if you have a fixed storage setting is to simply copy the .vdi in question. This can be done through the GUI in the current VBox version at the time of writing this.

*

*Click the top menu (above your virtual machines list) "tools"

*Enter hard disk tab on right hand GUI

*right click and copy the .vdi you'd like to expand

*Name the copied .vdi and be sure to select "dynamic"

*After it is done copying, enter the .vdi settings that was created,
click "Storage"

*Attach the copied .vdi to SATA

*The copied versions size will now be able to be changed inside the
"tools>hardisk" menu that you entered at the beginning of this list

After changing the size run your newly copied machine and enter the disk management section (wherever that may be on your virtual OS) and expand the newly freed space to be used.
If you prefer a fixed storage, you can always revert it back by following these steps but instead of selecting dynamic, select "fixed". Clone, as far as I can tell doesn't work unless you use the terminal and tag it correctly as the GUI automatically sets the hard disk type to that it was cloned from.


text:
Q: Class won't calculate what it should, also: sorting arrays of objects? I'm trying to write a program that will allow the user to create "loan" objects and measure the total amount that they have to pay after putting it through an interest equation. I'm having two problems with it that i've been messing with for a few hours but can't figure out for some reason. The biggest problem is that the class that is supposed to calculate the total payment of the loan after plugging in variables, but it ALWAYS returns zero and I can't figure out why. Is it a problem with syntax? I created a test loan class to test out the program that creates ten random loans with ten random time lengths and both the "totalPay" and the "monthlyPay" (which is dependent on totalPay) is always zero.
The second problem is that I was trying to sort the ten random loans based on the numberOfYears of the loan, but I can't get it to work! I tried a few methods for sorting and the one I included is the most recent and probably the one that's the dumbest hahaha but it's the one that I was playing with most recently. I've included all the code below, any ideas?
Loan class:
(it's a little long but the important thing is just the main loan class, totalPayment, and monthlyPayment )
public class Loan {

double annualInterestRate = 2.5;
int numberOfYears = 1;
double loanAmount = 1000;
double base;
double exponent;
double totalPay;
String summary;
double monthly;
String[] list = new String[10];
String s;

/**
 * creates default loan with 2.5 annual interest rate 1 year and 1000$
 */
public Loan(){
}

/**
 *       totalPay = amount(1+rate/12)^(year*12)
 *
 * @param anualInterestRate
 * @param numberOfYears
 * @param loanAmount
 */
public Loan(double anualInterestRate, int numberOfYears, double loanAmount){

    base = (double) ( loanAmount * (1+anualInterestRate/12));
    exponent = (double) (numberOfYears * 12);
    totalPay = (double) Math.pow(base, exponent);
}

/**
 *
 * @return total payment
 */
public double totalPayment(){
    return this.totalPay;
}

/**
 *
 * @return Monthly Payment
 */
public double monthlyPayment(){
    monthly = (totalPay/12);
    return monthly;
}

}

TestLoan:
import java.util.Random;

public class TestLoan {

public static void main (String[] args){

    Random r = new Random();

    Loan[] list = new Loan[10];

    for (int i = 0; i < 10; i++){
        Loan x = new Loan();
        list[i] = x;
        System.out.println(list[i].toString());
    }

    System.out.println();
    System.out.println();

    for (int i = 0; i < 9; i++){
        list[i].setNumberOfYears(r.nextInt(30));
        if (list[i].getNumberOfYears() > list[i+1].getNumberOfYears())
            list[i] = list[i+1];
        System.out.println(list[i].toString());
        }

}
}

Thank you for looking!
Edit got rid of the irrelevant code

A: You set the number of years, but you never calculate the base, exponent or totalPay.  That only happens in a constructor you never call.
What you need to do is move functional code out of the constructor and into a calculation method.  That constructor should be for constructing the object.
old constructor:
public Loan(double anualInterestRate, int numberOfYears, double loanAmount) {
    base = (double) (loanAmount * (1 + anualInterestRate / 12));
    exponent = (double) (numberOfYears * 12);
    totalPay = (double) Math.pow(base, exponent);
}

better way:
public Loan(double annualInterestRate, int numberOfYears, double loanAmount) {
    this.annualInterestRate = annualInterestRate;
    this.numberOfYears = numberOfYears;
    this.loanAmount = loanAmount;
}

public void calculatePay() {
    base = (double) (loanAmount * (1 + annualInterestRate / 12));
    exponent = (double) (numberOfYears * 12);
    totalPay = (double) Math.pow(base, exponent);
}

Also, your method for sorting is flawed. You should decide what a good natural ordering for Loan is, then implement the Comparable interface.
Then you could use an existing sort library like this:
    for (int i = 0; i < 9; i++) {
        list[i].setNumberOfYears(r.nextInt(30));
        list[i].calculatePay();
    }
    Arrays.sort(list);
    for (Loan loan: list) {
        System.out.println(loan);
    }


text:
Q: Continuous Axis Chart with Slider Range won't draw? I'm finding myself in over my head on this web development project, and was hoping someone could help me better understand why one of my google charts will not draw on my page.
I have a working test page with the chart drawing how I want it, this is the jsfiddle for it so you can have the exact code if you wish to test
http://jsfiddle.net/dlaliberte/pfTqP/
I pulled the code directly from this page where it works, and put it into my page that already has 4 other working google charts on it. Now when I add in this chart it doesn't give me any errors but it just will not draw.
I'm going to post the javascript for the first chart that works and the chart I'm trying to fix (separated with '###'), and the spot on my page where it's set to draw, I'm hoping someone with more experience could help me spot where the issue is coming from, as after several hours of tweaking and running over it I'm still not sure what's going wrong.
    //################################### UPDATED JAVASCRIPT ####################################

And here is the spot I'm drawing the chart on my page, it's in a set of 4 tabs so the user can tab through different charts, so far it's worked perfectly.

Current Demand - Hourly Usage

Usage

Demand

Daily

Monthly

      <button class="btn btn-primary raised" onclick="changeLineRange();">
                Ascending
              </button>

              <button class="btn btn-primary raised" onclick="changeLineRangeBack();">
                Descending
              </button>

      <button class="btn btn-primary raised" onclick="changeRange();">
                Ascending
              </button>

              <button class="btn btn-primary raised" onclick="changeRangeBack();">
                Descending
              </button>

  // ############################## THIS IS THE TAB PANEL WHERE I'M DRAWING THE NEW CHART ############################

I'm not sure what else you might need to see, again I'm out of my element here and trying to get a grasp on how to achieve this, thanks!

A: there are a couple issues here...
first, code is mixed from both the old and new versions of google charts
the old library uses jsapi to load the library

the new library uses the gstatic library

according to the release notes...

The version of Google Charts that remains available via the jsapi loader is no longer being updated consistently. Please use the new gstatic loader from now on.

next, the load statement and callback should only be used once per page
once the callback fires, you can draw as many charts as needed
the callback can also be placed directly in the load statement
try setup similar to the following...
google.charts.load('current', {
  callback: drawCharts,
  packages: ['controls', 'corechart']
});

function drawCharts() {
  drawLineChart();
  drawVisualization();
}

function drawLineChart() {
  ...
}

function drawVisualization() {
  ...
}


text:
Q: emacs lisp: how to add to link/hyperlink to another file just like that in *H e l p* we can get help with "C-h ..." and emacs show a Help buffer,and jump to other place with the link . How can I make something like that with elisp, link to another buffer or show something else?

A: You are looking at "clickable text"
Read this for more explanation.
Or this if you are going to be using org-mode.

A: The builtin Button package provides a convenient way.  For example,
(require 'button)
(insert-button "foo" 'action (lambda (x) (find-file user-init-file)))

will insert a button/link labeled "foo" that when activated (by pressing Enter while point is over the label or middle clicking) will bring up the init file.
Here is another example that mimics a www link,
(insert-button "fsf"
               'action (lambda (x) (browse-url (button-get x 'url)))
               'url "http://www.fsf.org")

See Elisp Reference Manual 38.17 Buttons.


text:
Q: A soma dos N primeiros números primos
Escreva um programa que leia um inteiro não negativo e imprima a soma dos N primeiros números primos.

Não estou conseguindo somar os N primeiros números primos e sim somar até o número primo digitado.
Se eu digitar 5 por exemplo aparece 2 3 5 e a soma que é 10. Mas no caso teria que aparecer 2 3 5 7 11 e a soma que daria 28.
Meu código:
n = int(input('Digite um número inteiro positico: '))
soma = 0
for num in range(2, n + 1):
    primo = True
    for i in range(2, num):
        if num % i == 0:
           primo = False
    if primo:
        print(num)
        soma += num
print(soma)

A: Eu faria assim:
n = int(input('Digite um número inteiro positivo: '))
soma = 0
conta = 0
num = 2
while conta < n:
    primo = True
    for i in range(2, num):
        if num % i == 0:
           primo = False
           break
    if primo:
        print(num)
        soma += num
        conta += 1
    num += 1
print(soma)

Veja funcionando no ideone. E no repl.it. Também coloquei no GitHub para referência futura.
A contagem de quantos números são primos. e portanto somados. deve ser independente da evolução dos números que são considerados primos. O código da pergunta está parando quando o número que pode ser primo chega no limite. Então num evoluirá em cada passo como o código está fazendo, mas a contagem de quantos está pegando é a condição para termino das repetições.
Daria para usar só for mas teria que por um if, não vi vantagem.


text:
Q: (Python3) How handle C/C++ dependencies with Pip/Pypi? I have C/C++ dependencies (TA-Lib) for the Python package that I developed. Not being user-friendly, I don't want the user to install or compile C to use my package. Simply, I just want the user to be able to install my package with pip install <package>.
So, I installed my C dependency in the setup.py before the setup() function by substituing the setup's commands (install, develop, build, etc.).
Here is the code:
import platform
from setuptools import setup
from setuptools.command.install import install
from setuptools.command.develop import develop
from distutils.command.build import build
from distutils.command.build_ext import build_ext
from distutils.command.sdist import sdist
from wheel.bdist_wheel import bdist_wheel
import os

WINDOW_OS = "Windows"
LINUX_OS = "Linux"
CURRENT_OS = platform.system()

def talib_install():
    dir = "build_helper"
    if CURRENT_OS == LINUX_OS:
        os.system(f"cd {dir} && sh talib-install.sh")
    elif CURRENT_OS == WINDOW_OS:
        os.system(f"pip install {dir} TA_Lib-0.4.24-cp39-cp39-win_amd64.whl")
    else:
        raise Exception("Unknown OS")

class TalibBuild(build):
    def get_sub_commands(self):
        # Force "build_ext" invocation.
        commands = build.get_sub_commands(self)
        for c in commands:
            if c == 'build_ext':
                return commands
        return ['build_ext'] + commands

class TalibBuildExt(build_ext):
    def run(self):
        talib_install()
        build_ext.run(self)

class TalibSdit(sdist):
    def run(self) -> None:
        talib_install()
        return super().run()

class TalibDevelop(develop):
    def run(self) -> None:
        talib_install()
        return super().run()

    def finalize_options(self) -> None:
        return super().finalize_options()

class TalibInstall(install):
    def run(self):
        talib_install()
        install.run(self)

    def finalize_options(self) -> None:
        return super().finalize_options()

class TalibBdistWheel(bdist_wheel):
    def run(self):
        talib_install()
        # Run wheel build command
        super().run()

    def finalize_options(self):
        super().finalize_options()

cmdclass = {
    "install": TalibInstall,
    "develop": TalibDevelop,
    "sdist": TalibSdit,
    "bdist_wheel": TalibBdistWheel,
    "build": TalibBuild,
    "build_ext": TalibBuildExt
}

install_requirements = [
    "setuptools==59.5.0",
    "tensorboard",
    "torch-tb-profiler",
    "geneticalgorithm2"
]

talib_install()
setup(
    data_files=["build_helper/talib-install.sh"],
    install_requires=install_requirements,
    cmdclass=cmdclass
)

In local, the following commands are working well: pip install -e . and pip setup.py install.
The problem occurs when I upload my package on Pypi and try installing it on Colab using pip install mypackage. I have the feeling that the installation does not pass through the C code installation step. (I make sure that I have talib-install.sh script in the data_files.)
Moreover, in my release I have two files: wheel archive and source archive. When I execute pip install <link_to_the_source_achive> on Colab, the C code installation works. But pip install <link_to_the_wheel> doesn't work.
I thought that, by default, pip uses the wheel archive to install. I deleted it so that not having a choice, pip chooses the source. But it doesn't work either...
What is the difference between pip install <package> and pip install <link_to_source>? How pip is working? Any thoughts about how I can resolve my issue?
(I am working on Linux but I want it to work on Windows and MacOs too.)
Thank you very much.


text:
Q: Powershell script to check IPv4 and IPv6 pattern recursively in the entire drive I want to extract IPv4 and IPv6 pattern wherever used in the bunch of files/codes. I am using the below script but that fetches me only IPv4.
$regex = "\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b"
cd "D:\"
$excluded = @("*.pdf", "*.jpg", "*.jpeg", "*.dll", "*.exe", "*.gif", "*.png", "*.css", "*.vbproj", "*.vspscc", "*.rpt", "*.pdb", "*.zip", "*.rar", "*.flv", "*.cache", "*.dat", "*.bin", "*.sln", "*.wmv", "*.mpg", "*.mpeg", "*.tif", "*.ppt", "*.pptx" ,"*.pps", "*.pub", "*.swf", "*.msi")
Get-ChildItem -Recurse -exclude $excluded |
Select-String -Pattern $regex | Select-Object path,line,linenumber,filename | Export-Csv -Path "D:\result.csv" -notype

How can I fetch all the possible patterns of IPv6 addresses along with IPv4, recursively. I am using Powershell 2.0

A: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?*$

I hope this helps. From : Javascript regex to validate IPv4 and IPv6 address, no hostnames
Example of PowerShell use :
"0000:0000:0000:0000:0000:0000:0000:0001" -match "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?$"


text:
Q: common lisp exception handling (condition and restart) I have been read the common lisp "Practical Common Lisp" exception handling chapter for days, but I am now so confused with the samples and the explanations, in the meanwhile I tried to write some testing sample, but it didn't work as I expected, below is my testing samples.

*

*Condition definition
(define-condition evenp-error (error)
  ((text :initarg :text :reader text)))

*Define function that prints odd number
(defun filter-evenp (lst)
  (dolist (x lst)
    (if (not (evenp x))
      (print x)
      (error 'evenp-error :text x))))

*Restart function
(defun skip-evenp (c) (invoke-start 'skip-evenp))

*Restart case
(restart-case (filter-evenp (list 1 2 3 4 5))
  (skip-evenp () nil))

All I want to do is to print all odd numbers and skip the even errors, what is wrong with my sample? anybody help? many thanks in advance!!

A: Practical Common Lisp is quite detailed but it is true that the condition system might require some time to get used to. You might be interested by Kent Pitman's articles: Exceptional Situations in Lisp  and Condition Handling in the Lisp Language Family.
Those are referenced in What's a condition system and why do you want one?. There are also many other references lilke this Wikibooks entry or C2 wiki's CommonLispConditionSystem entry.
Defining a restart
A RESTART-CASE basically says:

I am going to execute this form and I don't care if it signals a condition or not. But if it does and you want to recover from that situation, here are different ways I can work around the problem (retry, ignore, etc.).

You generally cannot say how to recover from an error in the code being called at the call point. In other words, it is filter-evenp which should wrap the code with a restart-case in-order to provide alternative paths. For your example, it would be sufficient to use CERROR, which signals an error while establishing a CONTINUE restart.
(if (evenp x)
  (cerror "Ignore even number" 'evenp-error :text x)
  (print x))

As an exercise you can try to replace (cerror ...) with an explicit restart-case construct.
Then, if you test your code, you should see your debugger pop up and show you the CONTINUE restart. If you defined your own restart, you can name it differently.
Invoking the restart
In your skip-evenp function, you were invoking a restart that was not established a at this point, and I think you were confused with skip-evenp naming both a restart and a function.
What you should do is handle the error by invoking the restart.
Here, you want the code that signals an error to continue, so you really don't want to unwind the execution stack. That's why you have to use HANDLER-BIND.
(handler-bind ((evenp-error (lambda (e) (invoke-restart 'continue))))
  (filter-evenp '(1 2 3 4)))
1
3

You can of course extract the anonymous lambda into a custom function, like you did.

A: You need to put your RESTART-CASE to where you want to restart the execution at:
(defun filter-evenp (lst)
  (dolist (x lst)
    (restart-case
        (if (not (evenp x))
            (print x)
            (error 'evenp-error :text x))
      (skip-evenp () nil))))

Then you should use HANDLER-BIND to handle the error:
(handler-bind ((evenp-error #'skip-evenp))
  (filter-evenp (list 1 2 3 4 5)))


text:
Q: Strange variable type declaration when I had a look on the sources of opensc, especial the libpkcs11.c file, I found a type declaration combined with a function call which I just don't understand:
CK_RV rv, (*c_get_function_list)(CK_FUNCTION_LIST_PTR_PTR);
c_get_function_list = (CK_RV (*)(CK_FUNCTION_LIST_PTR_PTR)) sc_dlsym(mod->handle, "C_GetFunctionList");

I know that:

*

*CK_RV is a typedef for unsigned long

*CK_FUNCTION_LIST_PTR_PTR is a typedef for something like **ck_function_list where ck_function_list is a struct

*rv is a variable

*c_get_function_list is a variable

But if I split the first line and substitute the typedefs with their original values , I get something like:
unsigned long rv;
unsigned long (*c_get_function_list)(**ck_function_list);

So, what does the (**ck_function_list) in the second line mean ?
Thanks in advance,
Robert

A: unsigned long (*c_get_function_list)(<param>);

is a function pointer to a function whose prototype is.
unsigned long func(<param>);

The pointer here is c_get_function_list

A: c_get_function_list is pointer to function. When assigned, you can call the pointed function like normal function call: c_get_function_list( param ).


text:
Q: jquery table row selector based on user input How do I select rows depending on what's in an input box?
Here's what I have so far:

<form>
    <input id="btnFilter" name="btnFilter">
</form>

            Heading 1
            Heading 2

            A
            X

            ABC
            D

A: If you want a search, :contains() is probably what you're after, for example:
$('tr:contains("' + myInput + '")').show();

You can try it out here, or a cell-begins-with only version:
$('td').filter(function() {
  return $.text([this]).indexOf(myInput) == 0
}).parent().show();

You can try that version here.

A: $(document).ready(function() {
    $('#btnFilter').keyup(function() {
        var myInput = $(this).val();
        $('tbody tr').hide().find('td:contains("'+myInput+'")').parents('tr:first').show()
    });
});


text:
Q: Is it true that higher delta T (outsideT - insideT) will in HVAC systems will result in lower power usage? I have been comparing our server room logs for power usage, compressor usage, and outside temperature and I'm not sure if something is wrong with my understanding how these systems work, or if something is wrong with our records.

*

*Hot day: +30C outside, ~50% compressor use, ~25 KW electricity use

*Cold day: -30C outside, ~50% compressor use, ~25 KW electricity use

*Inside it's constant 23C

*Equipment that this is cooling generates about 28 KW worth of heat as measured by UPS readout.

*This is an 20 year old Liebert 20T HVAC unit hooked up outside condenser.

*~25 KW includes the condenser electricity use

*Compressor readings go in increments of 0,25,50,75 and 100%

*This Liebert has 2 compressors in it and
from what I gather (maybe wrong?) each compressor has three speed
modes.  Off, Medium, High.  So if two compressors are on medium that's 25+25=50% or if one is high and other medium that's 75%.  If both are on high that's 100% readout.

I would think that on a cold day the compressor use should be way lower than on a hot day.   I also assume that lower compressor utilization means large reduction in electricity use.
We have one reading per day (manually entered), and because the compressor use  oscillates between 25 - 50 - 75 as it's internal thermostat tries to maintain 23C steady, it's possible that we were unlucky and we got reading during the very short time it was in the "up" part of the curve on the cold day.   But I took averages of those numbers to eliminate that possibility.  The 50% and 25 KW are averages over multiple days.  I rounded them (+/-10%) for the purpose of of highlighting that they are essentially the same.  The effect I'm looking for is 30% to 80% difference due to temperature.   On the really cold day wouldn't the cooling be essentially free?
Are my readings wrong or am I completely wrong in my assumption that there should be massive power savings during cold weather with this kind of system?