qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
45,673,422
**Check this [Jsfiddle](https://jsfiddle.net/fcg48csy/5/) first.** Here my `<input>` with has a `height of 10px;` has given a `padding of 10px;`, I know it is not a right way of giving style. But still, **it's working perfectly in Chrome, IE and Safari** but it is an another story when it came to **Firefox it crops my...
2017/08/14
[ "https://Stackoverflow.com/questions/45673422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7629714/" ]
Please check if it works for [you](https://jsfiddle.net/anmolsandal/fcg48csy/7/) ``` input { padding: 10px; font-size: 14px; font-weight: normal; width: 100%; line-height: 18px; height: auto; } ```
They count height and padding differently, try this. Use only height or only padding. Here I add height and only x padding ``` input { font-size: 14px; font-weight: normal; width: 100%; height: 30px; padding: 0 10px; } ```
5,557,392
What is the meaning of operator() in C++? I see that is often used for "functors," or function objects such as comparators. But then how are such functions called? Is it useful in other situations? And how many parameters can I declare for such an operator? E.g., is the following acceptable? ``` bool operator() (Foo f...
2011/04/05
[ "https://Stackoverflow.com/questions/5557392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/250096/" ]
If you implement `operator()` for a class `C`, then if `c` is an object of type `C` you can write `c()`, which invokes `c.operator()()`. You can have as many parameters to `operator()` as you like. For one good example of when `operator()` is useful, see here: <http://www.parashift.com/c++-faq-lite/operator-overloadi...
It's just a normal function that gets called when you apply function-call syntax to a user-defined type. So it has all the restrictions and features of a regular member function. It can be a template, it can take as many parameters as you want, it needs a return type, it can be `const`, etc.
5,557,392
What is the meaning of operator() in C++? I see that is often used for "functors," or function objects such as comparators. But then how are such functions called? Is it useful in other situations? And how many parameters can I declare for such an operator? E.g., is the following acceptable? ``` bool operator() (Foo f...
2011/04/05
[ "https://Stackoverflow.com/questions/5557392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/250096/" ]
Let's say you have a function object class, `Func`, with `operator()` defined. If you have an instance of that class, you can simply place parentheses after the expression referring to that instance: ``` Func myFunc; myFunc(); // Calls the operator() member function ``` As an example from the standard library, we ca...
It's just a normal function that gets called when you apply function-call syntax to a user-defined type. So it has all the restrictions and features of a regular member function. It can be a template, it can take as many parameters as you want, it needs a return type, it can be `const`, etc.
5,557,392
What is the meaning of operator() in C++? I see that is often used for "functors," or function objects such as comparators. But then how are such functions called? Is it useful in other situations? And how many parameters can I declare for such an operator? E.g., is the following acceptable? ``` bool operator() (Foo f...
2011/04/05
[ "https://Stackoverflow.com/questions/5557392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/250096/" ]
Like any overloaded operator, `operator()` is a strange-looking name of a function. It must be a member function of a class or struct, but there are no restrictions on its arguments other than the usual rules for all functions. To evaluate the expression `x(`*args*`)` when the type of `x` is a class type, C++ will att...
It's just a normal function that gets called when you apply function-call syntax to a user-defined type. So it has all the restrictions and features of a regular member function. It can be a template, it can take as many parameters as you want, it needs a return type, it can be `const`, etc.
5,557,392
What is the meaning of operator() in C++? I see that is often used for "functors," or function objects such as comparators. But then how are such functions called? Is it useful in other situations? And how many parameters can I declare for such an operator? E.g., is the following acceptable? ``` bool operator() (Foo f...
2011/04/05
[ "https://Stackoverflow.com/questions/5557392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/250096/" ]
One point which I didn't see mentioned, was that although in syntax its invocation looks very similar to that of a regular non-member (dare I say, C-style) function. One difference is that since a functor/function-object is an instance of a class/struct, it can have an associated state. For non-member functions this c...
It's just a normal function that gets called when you apply function-call syntax to a user-defined type. So it has all the restrictions and features of a regular member function. It can be a template, it can take as many parameters as you want, it needs a return type, it can be `const`, etc.
5,557,392
What is the meaning of operator() in C++? I see that is often used for "functors," or function objects such as comparators. But then how are such functions called? Is it useful in other situations? And how many parameters can I declare for such an operator? E.g., is the following acceptable? ``` bool operator() (Foo f...
2011/04/05
[ "https://Stackoverflow.com/questions/5557392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/250096/" ]
Let's say you have a function object class, `Func`, with `operator()` defined. If you have an instance of that class, you can simply place parentheses after the expression referring to that instance: ``` Func myFunc; myFunc(); // Calls the operator() member function ``` As an example from the standard library, we ca...
If you implement `operator()` for a class `C`, then if `c` is an object of type `C` you can write `c()`, which invokes `c.operator()()`. You can have as many parameters to `operator()` as you like. For one good example of when `operator()` is useful, see here: <http://www.parashift.com/c++-faq-lite/operator-overloadi...
5,557,392
What is the meaning of operator() in C++? I see that is often used for "functors," or function objects such as comparators. But then how are such functions called? Is it useful in other situations? And how many parameters can I declare for such an operator? E.g., is the following acceptable? ``` bool operator() (Foo f...
2011/04/05
[ "https://Stackoverflow.com/questions/5557392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/250096/" ]
If you implement `operator()` for a class `C`, then if `c` is an object of type `C` you can write `c()`, which invokes `c.operator()()`. You can have as many parameters to `operator()` as you like. For one good example of when `operator()` is useful, see here: <http://www.parashift.com/c++-faq-lite/operator-overloadi...
Like any overloaded operator, `operator()` is a strange-looking name of a function. It must be a member function of a class or struct, but there are no restrictions on its arguments other than the usual rules for all functions. To evaluate the expression `x(`*args*`)` when the type of `x` is a class type, C++ will att...
5,557,392
What is the meaning of operator() in C++? I see that is often used for "functors," or function objects such as comparators. But then how are such functions called? Is it useful in other situations? And how many parameters can I declare for such an operator? E.g., is the following acceptable? ``` bool operator() (Foo f...
2011/04/05
[ "https://Stackoverflow.com/questions/5557392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/250096/" ]
Let's say you have a function object class, `Func`, with `operator()` defined. If you have an instance of that class, you can simply place parentheses after the expression referring to that instance: ``` Func myFunc; myFunc(); // Calls the operator() member function ``` As an example from the standard library, we ca...
Like any overloaded operator, `operator()` is a strange-looking name of a function. It must be a member function of a class or struct, but there are no restrictions on its arguments other than the usual rules for all functions. To evaluate the expression `x(`*args*`)` when the type of `x` is a class type, C++ will att...
5,557,392
What is the meaning of operator() in C++? I see that is often used for "functors," or function objects such as comparators. But then how are such functions called? Is it useful in other situations? And how many parameters can I declare for such an operator? E.g., is the following acceptable? ``` bool operator() (Foo f...
2011/04/05
[ "https://Stackoverflow.com/questions/5557392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/250096/" ]
Let's say you have a function object class, `Func`, with `operator()` defined. If you have an instance of that class, you can simply place parentheses after the expression referring to that instance: ``` Func myFunc; myFunc(); // Calls the operator() member function ``` As an example from the standard library, we ca...
One point which I didn't see mentioned, was that although in syntax its invocation looks very similar to that of a regular non-member (dare I say, C-style) function. One difference is that since a functor/function-object is an instance of a class/struct, it can have an associated state. For non-member functions this c...
5,557,392
What is the meaning of operator() in C++? I see that is often used for "functors," or function objects such as comparators. But then how are such functions called? Is it useful in other situations? And how many parameters can I declare for such an operator? E.g., is the following acceptable? ``` bool operator() (Foo f...
2011/04/05
[ "https://Stackoverflow.com/questions/5557392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/250096/" ]
One point which I didn't see mentioned, was that although in syntax its invocation looks very similar to that of a regular non-member (dare I say, C-style) function. One difference is that since a functor/function-object is an instance of a class/struct, it can have an associated state. For non-member functions this c...
Like any overloaded operator, `operator()` is a strange-looking name of a function. It must be a member function of a class or struct, but there are no restrictions on its arguments other than the usual rules for all functions. To evaluate the expression `x(`*args*`)` when the type of `x` is a class type, C++ will att...
105,181
I have a transactional Replication (Non-SQL Server Publishers - Oracle) implemented for one SQL Server Database. Let's say Publishers: A, B Subscriber: C Note: * I can not modify the Oracle DBs. * The Publishers have the same DB schema. * On the subscriber I have the same tables, with one column more "Publisher" to i...
2015/06/25
[ "https://dba.stackexchange.com/questions/105181", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/68120/" ]
I'm not sure of the limitations of transactional replication, but with BCP you can create a view on the table that contains only columns that exist in the BCP file, and load into that view rather than the table. How do you define the data for the publisher column at the moment?
it is failing because snapshot agent is generating a bcp file that does *NOT* contain that extra column, when it runs against Publisher B. Distribution agent is trying to apply a bcp file that has one less column into the subscriber table. I think what you want to do it initialize without a snapshot. I don't know if th...
6,802,905
how do I use a vslider as the scrollbar for a list? I've got this, but can't figure it out from here: ``` <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" ...
2011/07/23
[ "https://Stackoverflow.com/questions/6802905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522962/" ]
It's totally possible, and I aims to proove it! All joking aside, here it is working with just some simple binding, you were very close! ``` <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" x...
The best way I can suggest you to reach your goal is skinning. Create a skin for `VScrollBar` which looks the same as `VSlider`. Then create custom `Scroller` skin (take `spark.skins.spark.ScrollerSkin` as a pattern) and assign these scroller skins there. Then create your custom `List` skin (based on `spark.skins.spark...
6,802,905
how do I use a vslider as the scrollbar for a list? I've got this, but can't figure it out from here: ``` <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" ...
2011/07/23
[ "https://Stackoverflow.com/questions/6802905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522962/" ]
It's totally possible, and I aims to proove it! All joking aside, here it is working with just some simple binding, you were very close! ``` <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" x...
> > how do I use a vslider as the scrollbar for a list? I've got this, but > can't figure it out from here: > > > Unfortunately, I do not believe this is possible without significant rework. The list is implemented, inside the ListSkin, as a Scroller and a DataGroup. The Scroller has two skin parts, the vert...
1,787,137
so I'm taking an intro to probability course and this question was given as part of the first assignment. I've read over notes and course material but nothing seems to be relevant to question such as this (i.e. all outcomes a1, a2, etc. not having equal probability). I've guessed that I need to incorporate partitions i...
2016/05/16
[ "https://math.stackexchange.com/questions/1787137", "https://math.stackexchange.com", "https://math.stackexchange.com/users/285275/" ]
> > Let the sample space $Ω = \{a\_1, a\_2, a\_3, a\_4, a\_5, a\_6\}$ be given. Assume that: Let $A = \{a\_1, a\_2, a3\}, B =\{a\_2, a\_4\}, C = \{a\_4, a\_5, a\_6\}, D = \{a\_2\}$ and $E = \{a\_4\}$. If $P(A) = P(B) = P(C)$ and $P(D) = 2P(E)$. > > > $$\begin{array}{|l|l:6l|}\hline & a\_1 & a\_2 & a\_3 & a\_4 & a\...
Work it out where the probability of a1, a2... a6 is equal. For a, that's the probability for a1 or a3 but not a2, which is P(a1, a3), which is 1/3. For b, which is for A or E, which is P(a1, a2, a3, a4), which is 2/3. I expect you can work out the third one. (If you can't, ask me.)
2,413,577
Hello I have a Subclass which needs to cover multiple Discriminator Values. something like: @DiscriminatorValue(value = "ACT","DNR","ATT" ) would do me perfect. we have existing data where several discriminators can be mapped to one class (as they are similar types of what our system will consider the same thing)
2010/03/10
[ "https://Stackoverflow.com/questions/2413577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/290095/" ]
You can use DiscriminatorFormula: ``` // Base class @DiscriminatorFormula("case when value in ('ACT','DNR','ATT') then 1 when 'OTH' then 2 else 3 end") // Subclass @DiscriminatorValue("1") // maps to ACT, DNR, ATT ```
A subclass has exactly 1 discriminator value. You can add additional subclasses under the existing subclass for the extra discriminator values. Subclasses need not have additional properties or behavior.
24,846,280
I'm trying to insert variables values to a data base but it comes out as 'undefined'. It is all inside device ready. I'm testing 1st with the variable 'absenceDateFrom'. ``` var absenceType = document.getElementById('absenceType') var absenceText = document.getElementById('noteNewAbsence') var ...
2014/07/20
[ "https://Stackoverflow.com/questions/24846280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3856911/" ]
You already mentioned it here, graceful degradation. Use the font-feature setting and if a browser does not support opentype features then the user will receive all the content still, with the worst-case scenario being full-size capitals; nothing is lost. I'd say that is a graceful degradation. Aa an alternative you...
Stop thinking OpenType for a moment and think content: you need different styling for semantically different data (in this case, smallcaps styling for a special religious word) That's literally what HTML markup was invented for. Just auto-wrap those words in `<span class="smallcapped">` markup with javascript, and have...
24,846,280
I'm trying to insert variables values to a data base but it comes out as 'undefined'. It is all inside device ready. I'm testing 1st with the variable 'absenceDateFrom'. ``` var absenceType = document.getElementById('absenceType') var absenceText = document.getElementById('noteNewAbsence') var ...
2014/07/20
[ "https://Stackoverflow.com/questions/24846280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3856911/" ]
*Last updated 2016/02/28.* I spent a considerable amount of time researching this and wrestling with it. After digging around as best I could, the top solutions for now are: ### `@supports` Take advantage of the `@supports` rule in browsers. This is what I initially opted to do on this project.[1] You use the rule t...
You already mentioned it here, graceful degradation. Use the font-feature setting and if a browser does not support opentype features then the user will receive all the content still, with the worst-case scenario being full-size capitals; nothing is lost. I'd say that is a graceful degradation. Aa an alternative you...
24,846,280
I'm trying to insert variables values to a data base but it comes out as 'undefined'. It is all inside device ready. I'm testing 1st with the variable 'absenceDateFrom'. ``` var absenceType = document.getElementById('absenceType') var absenceText = document.getElementById('noteNewAbsence') var ...
2014/07/20
[ "https://Stackoverflow.com/questions/24846280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3856911/" ]
Support for `font-feature-settings:"smcp"` has improved in recent browsers. [Chrome 48 fixes the letter-spacing bug](https://bugs.chromium.org/p/chromium/issues/detail?id=461482). And according to caniuse.com, upcoming versions of Safari for both iOS and Desktop will support it. The prefixed version is still required f...
You already mentioned it here, graceful degradation. Use the font-feature setting and if a browser does not support opentype features then the user will receive all the content still, with the worst-case scenario being full-size capitals; nothing is lost. I'd say that is a graceful degradation. Aa an alternative you...
24,846,280
I'm trying to insert variables values to a data base but it comes out as 'undefined'. It is all inside device ready. I'm testing 1st with the variable 'absenceDateFrom'. ``` var absenceType = document.getElementById('absenceType') var absenceText = document.getElementById('noteNewAbsence') var ...
2014/07/20
[ "https://Stackoverflow.com/questions/24846280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3856911/" ]
*Last updated 2016/02/28.* I spent a considerable amount of time researching this and wrestling with it. After digging around as best I could, the top solutions for now are: ### `@supports` Take advantage of the `@supports` rule in browsers. This is what I initially opted to do on this project.[1] You use the rule t...
Stop thinking OpenType for a moment and think content: you need different styling for semantically different data (in this case, smallcaps styling for a special religious word) That's literally what HTML markup was invented for. Just auto-wrap those words in `<span class="smallcapped">` markup with javascript, and have...
24,846,280
I'm trying to insert variables values to a data base but it comes out as 'undefined'. It is all inside device ready. I'm testing 1st with the variable 'absenceDateFrom'. ``` var absenceType = document.getElementById('absenceType') var absenceText = document.getElementById('noteNewAbsence') var ...
2014/07/20
[ "https://Stackoverflow.com/questions/24846280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3856911/" ]
Support for `font-feature-settings:"smcp"` has improved in recent browsers. [Chrome 48 fixes the letter-spacing bug](https://bugs.chromium.org/p/chromium/issues/detail?id=461482). And according to caniuse.com, upcoming versions of Safari for both iOS and Desktop will support it. The prefixed version is still required f...
Stop thinking OpenType for a moment and think content: you need different styling for semantically different data (in this case, smallcaps styling for a special religious word) That's literally what HTML markup was invented for. Just auto-wrap those words in `<span class="smallcapped">` markup with javascript, and have...
24,846,280
I'm trying to insert variables values to a data base but it comes out as 'undefined'. It is all inside device ready. I'm testing 1st with the variable 'absenceDateFrom'. ``` var absenceType = document.getElementById('absenceType') var absenceText = document.getElementById('noteNewAbsence') var ...
2014/07/20
[ "https://Stackoverflow.com/questions/24846280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3856911/" ]
*Last updated 2016/02/28.* I spent a considerable amount of time researching this and wrestling with it. After digging around as best I could, the top solutions for now are: ### `@supports` Take advantage of the `@supports` rule in browsers. This is what I initially opted to do on this project.[1] You use the rule t...
Support for `font-feature-settings:"smcp"` has improved in recent browsers. [Chrome 48 fixes the letter-spacing bug](https://bugs.chromium.org/p/chromium/issues/detail?id=461482). And according to caniuse.com, upcoming versions of Safari for both iOS and Desktop will support it. The prefixed version is still required f...
19,680,871
I am producing a hash "message" containing Message attributes like this: ``` message = Message.create_from_mail_message(mail, @current_sender_email, expires_at, public, message_type) ``` Now I want to add an additional attribute "access\_key" to this hash "message" problem is this attribute is not in Message model...
2013/10/30
[ "https://Stackoverflow.com/questions/19680871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2936044/" ]
Try this: ``` message.merge!('access_key' => Reciept.access_key) ```
``` message.merge!{access_key: Reciept.access_key} ```
19,680,871
I am producing a hash "message" containing Message attributes like this: ``` message = Message.create_from_mail_message(mail, @current_sender_email, expires_at, public, message_type) ``` Now I want to add an additional attribute "access\_key" to this hash "message" problem is this attribute is not in Message model...
2013/10/30
[ "https://Stackoverflow.com/questions/19680871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2936044/" ]
You should merge the access\_key with value in message hash like: message.merge!("access\_key" => Reciept.access\_key)
``` message.merge!{access_key: Reciept.access_key} ```
19,680,871
I am producing a hash "message" containing Message attributes like this: ``` message = Message.create_from_mail_message(mail, @current_sender_email, expires_at, public, message_type) ``` Now I want to add an additional attribute "access\_key" to this hash "message" problem is this attribute is not in Message model...
2013/10/30
[ "https://Stackoverflow.com/questions/19680871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2936044/" ]
``` message.merge!{access_key: Reciept.access_key} ```
the Standar say: ``` message.merge(:access_key=>Reciept.access_key) ``` I hope can i help you.
19,680,871
I am producing a hash "message" containing Message attributes like this: ``` message = Message.create_from_mail_message(mail, @current_sender_email, expires_at, public, message_type) ``` Now I want to add an additional attribute "access\_key" to this hash "message" problem is this attribute is not in Message model...
2013/10/30
[ "https://Stackoverflow.com/questions/19680871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2936044/" ]
You should merge the access\_key with value in message hash like: message.merge!("access\_key" => Reciept.access\_key)
Try this: ``` message.merge!('access_key' => Reciept.access_key) ```
19,680,871
I am producing a hash "message" containing Message attributes like this: ``` message = Message.create_from_mail_message(mail, @current_sender_email, expires_at, public, message_type) ``` Now I want to add an additional attribute "access\_key" to this hash "message" problem is this attribute is not in Message model...
2013/10/30
[ "https://Stackoverflow.com/questions/19680871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2936044/" ]
Try this: ``` message.merge!('access_key' => Reciept.access_key) ```
the Standar say: ``` message.merge(:access_key=>Reciept.access_key) ``` I hope can i help you.
19,680,871
I am producing a hash "message" containing Message attributes like this: ``` message = Message.create_from_mail_message(mail, @current_sender_email, expires_at, public, message_type) ``` Now I want to add an additional attribute "access\_key" to this hash "message" problem is this attribute is not in Message model...
2013/10/30
[ "https://Stackoverflow.com/questions/19680871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2936044/" ]
You should merge the access\_key with value in message hash like: message.merge!("access\_key" => Reciept.access\_key)
the Standar say: ``` message.merge(:access_key=>Reciept.access_key) ``` I hope can i help you.
3,673,616
I have this question in a homework assignment for my Computer Languages class. I'm trying to figure out what each one means, but I'm getting stuck. > > Errors in a computer program can be > classified according to when they are > detected and, if they are detected at > compile time, what part of the > compiler de...
2010/09/09
[ "https://Stackoverflow.com/questions/3673616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/186155/" ]
UPDATE: Rails 5: ``` ActiveRecord::Type::Boolean.new.deserialize('0') ``` UPDATE: Rails 4.2 has public API for this: ``` ActiveRecord::Type::Boolean.new.type_cast_from_user("0") # false ``` PREVIOUS ANSWER: ActiveRecord maintains a list of representations for true/false in <https://github.com/rails/rails/blob/ma...
You could convert all your boolean params to real booleans like this: ``` %w(show_all, show_featured).each do |bool_param| params[bool_param.to_sym] = params[bool_param.to_sym] == "true" end ``` In this solution, nil parameters would become false.
3,673,616
I have this question in a homework assignment for my Computer Languages class. I'm trying to figure out what each one means, but I'm getting stuck. > > Errors in a computer program can be > classified according to when they are > detected and, if they are detected at > compile time, what part of the > compiler de...
2010/09/09
[ "https://Stackoverflow.com/questions/3673616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/186155/" ]
I wanted to comment on zetetic answer but as I can't do that yet I'll post this as an answer. If you use `@show_all = params[:show_all] == "1"` then you can drop `? true : false` because `params[:show_all] == "1"` statement itself will evaluate to true or false and thus ternary operator is not needed.
You could just do ``` @show_all = params[:show_all].downcase == 'true' ```
3,673,616
I have this question in a homework assignment for my Computer Languages class. I'm trying to figure out what each one means, but I'm getting stuck. > > Errors in a computer program can be > classified according to when they are > detected and, if they are detected at > compile time, what part of the > compiler de...
2010/09/09
[ "https://Stackoverflow.com/questions/3673616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/186155/" ]
It's worth noting that if you're passing down a value to an **ActiveModel** in Rails > 5.2, the simpler solution is to use `attribute`, ``` class Model include ActiveModel::Attributes attribute :show_all, :boolean end Model.new(show_all: '0').show_all # => false ``` As can be seen [here](https://api.rubyonrail...
You could convert all your boolean params to real booleans like this: ``` %w(show_all, show_featured).each do |bool_param| params[bool_param.to_sym] = params[bool_param.to_sym] == "true" end ``` In this solution, nil parameters would become false.
3,673,616
I have this question in a homework assignment for my Computer Languages class. I'm trying to figure out what each one means, but I'm getting stuck. > > Errors in a computer program can be > classified according to when they are > detected and, if they are detected at > compile time, what part of the > compiler de...
2010/09/09
[ "https://Stackoverflow.com/questions/3673616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/186155/" ]
You could just do ``` @show_all = params[:show_all].downcase == 'true' ```
You can add the following to your model: ``` def show_all= value @show_all = ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value) end ```
3,673,616
I have this question in a homework assignment for my Computer Languages class. I'm trying to figure out what each one means, but I'm getting stuck. > > Errors in a computer program can be > classified according to when they are > detected and, if they are detected at > compile time, what part of the > compiler de...
2010/09/09
[ "https://Stackoverflow.com/questions/3673616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/186155/" ]
UPDATE: Rails 5: ``` ActiveRecord::Type::Boolean.new.deserialize('0') ``` UPDATE: Rails 4.2 has public API for this: ``` ActiveRecord::Type::Boolean.new.type_cast_from_user("0") # false ``` PREVIOUS ANSWER: ActiveRecord maintains a list of representations for true/false in <https://github.com/rails/rails/blob/ma...
It's worth noting that if you're passing down a value to an **ActiveModel** in Rails > 5.2, the simpler solution is to use `attribute`, ``` class Model include ActiveModel::Attributes attribute :show_all, :boolean end Model.new(show_all: '0').show_all # => false ``` As can be seen [here](https://api.rubyonrail...
3,673,616
I have this question in a homework assignment for my Computer Languages class. I'm trying to figure out what each one means, but I'm getting stuck. > > Errors in a computer program can be > classified according to when they are > detected and, if they are detected at > compile time, what part of the > compiler de...
2010/09/09
[ "https://Stackoverflow.com/questions/3673616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/186155/" ]
I wanted to comment on zetetic answer but as I can't do that yet I'll post this as an answer. If you use `@show_all = params[:show_all] == "1"` then you can drop `? true : false` because `params[:show_all] == "1"` statement itself will evaluate to true or false and thus ternary operator is not needed.
While not explicitly what the question is about I feel this is appropriately related; If you're trying to pass true boolean variables in a **rails test** then you're going to want the following syntax. ``` post :update, params: { id: user.id }, body: { attribute: true }.to_json, as: :json ``` I arrived at this threa...
3,673,616
I have this question in a homework assignment for my Computer Languages class. I'm trying to figure out what each one means, but I'm getting stuck. > > Errors in a computer program can be > classified according to when they are > detected and, if they are detected at > compile time, what part of the > compiler de...
2010/09/09
[ "https://Stackoverflow.com/questions/3673616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/186155/" ]
I think the simplest solution is to test "boolean" parameters against their String representation. ``` @show_all = params[:show_all] if @show_all.to_s == "true" # do stuff end ``` Regardless of whether Rails delivers the parameter as the String "true" or "false" or an actual TrueClass or FalseClass, this test wil...
Another approach is to pass only the key without a value. Although using `ActiveRecord::Type::Boolean.new.type_cast_from_user(value)` is pretty neat, there might be a situation when assigning a value to the param key is redundant. Consider the following: On my products index view by default I want to show only scoped ...
3,673,616
I have this question in a homework assignment for my Computer Languages class. I'm trying to figure out what each one means, but I'm getting stuck. > > Errors in a computer program can be > classified according to when they are > detected and, if they are detected at > compile time, what part of the > compiler de...
2010/09/09
[ "https://Stackoverflow.com/questions/3673616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/186155/" ]
``` @show_all = params[:show_all] == "1" ? true : false ``` This should work nicely if you're passing the value in from a checkbox -- a missing key in a hash generates nil, which evaluates to false in a conditional. **EDIT** As pointed out [here](https://stackoverflow.com/questions/3673607/how-do-i-submit-a-boolean...
I think the simplest solution is to test "boolean" parameters against their String representation. ``` @show_all = params[:show_all] if @show_all.to_s == "true" # do stuff end ``` Regardless of whether Rails delivers the parameter as the String "true" or "false" or an actual TrueClass or FalseClass, this test wil...
3,673,616
I have this question in a homework assignment for my Computer Languages class. I'm trying to figure out what each one means, but I'm getting stuck. > > Errors in a computer program can be > classified according to when they are > detected and, if they are detected at > compile time, what part of the > compiler de...
2010/09/09
[ "https://Stackoverflow.com/questions/3673616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/186155/" ]
I wanted to comment on zetetic answer but as I can't do that yet I'll post this as an answer. If you use `@show_all = params[:show_all] == "1"` then you can drop `? true : false` because `params[:show_all] == "1"` statement itself will evaluate to true or false and thus ternary operator is not needed.
It's worth noting that if you're passing down a value to an **ActiveModel** in Rails > 5.2, the simpler solution is to use `attribute`, ``` class Model include ActiveModel::Attributes attribute :show_all, :boolean end Model.new(show_all: '0').show_all # => false ``` As can be seen [here](https://api.rubyonrail...
3,673,616
I have this question in a homework assignment for my Computer Languages class. I'm trying to figure out what each one means, but I'm getting stuck. > > Errors in a computer program can be > classified according to when they are > detected and, if they are detected at > compile time, what part of the > compiler de...
2010/09/09
[ "https://Stackoverflow.com/questions/3673616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/186155/" ]
I think the simplest solution is to test "boolean" parameters against their String representation. ``` @show_all = params[:show_all] if @show_all.to_s == "true" # do stuff end ``` Regardless of whether Rails delivers the parameter as the String "true" or "false" or an actual TrueClass or FalseClass, this test wil...
While not explicitly what the question is about I feel this is appropriately related; If you're trying to pass true boolean variables in a **rails test** then you're going to want the following syntax. ``` post :update, params: { id: user.id }, body: { attribute: true }.to_json, as: :json ``` I arrived at this threa...
65,887,059
We are using the chart.js library. The framework used is Slim from Rails. I'm using JavaScript.   I get an Error: > > Uncaught SyntaxError: Unexpected token 'if' error in the > if(user.activity\_type === "groupA"). > > > ``` script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.min.js" javas...
2021/01/25
[ "https://Stackoverflow.com/questions/65887059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14872966/" ]
I got it working now, i initialized a new pointer that points to the predecessor, just before the `h= h->next;` statement, so for example `predecessor = h;`
What type of variables have you created in `node`? If it has a `key` in ascending order to keep track of your nodes, then you can get the key of predecessor by subtracting one from `key of node with minimum value`. Or you could create a double linked link list which points to previous element as well by making a pointe...
1,960,055
Here's the proof from the book I'm reading that proves there are infinitely many primes: > > We want to show that it is not the case that there only finitely many primes. Suppose there are finitely many primes. We shall show that this assumption leads to a contradiction. Let $p\_1, p\_2,...,p\_n$ be all the primes th...
2016/10/08
[ "https://math.stackexchange.com/questions/1960055", "https://math.stackexchange.com", "https://math.stackexchange.com/users/174798/" ]
This is an excellent example of a proof that is traditionally phrased as a proof by contradiction but is much better understood constructively. From a constructive viewpoint, the proof shows that given any list of primes $p\_1, \ldots, p\_n$ there is a prime $q$ (any prime divisor of $p\_1p\_2\ldots p\_n + 1$) that is ...
1. Either $ 6 $ primes you considered are not all the primes, or $ 30031 $ is a new prime. Either way assumption is false. Proof by contradiction. 2. No, you haven't shown that two more primes exist. In this example yes, but not in general 3. Again, based on your assumption you reached something impossible that $q $ di...
1,960,055
Here's the proof from the book I'm reading that proves there are infinitely many primes: > > We want to show that it is not the case that there only finitely many primes. Suppose there are finitely many primes. We shall show that this assumption leads to a contradiction. Let $p\_1, p\_2,...,p\_n$ be all the primes th...
2016/10/08
[ "https://math.stackexchange.com/questions/1960055", "https://math.stackexchange.com", "https://math.stackexchange.com/users/174798/" ]
You ask in #1 if the proof breaks down. No. What breaks down is the assumption that there are no more primes. You assumed you had a complete list of primes. Then you constructed a number that is not divisible by any of the primes in your list. Only two possibilities remain: Either the number you constructed is prime, o...
Here is a non-mathematical approach to the logic behind the proof by contradiction... Suppose your assumption is that a suspect in a brutal murder is innocent because he said he couldn't have been at the location the person was murdered. You feel as though he is possibly telling the truth, but what you do know is that...
1,960,055
Here's the proof from the book I'm reading that proves there are infinitely many primes: > > We want to show that it is not the case that there only finitely many primes. Suppose there are finitely many primes. We shall show that this assumption leads to a contradiction. Let $p\_1, p\_2,...,p\_n$ be all the primes th...
2016/10/08
[ "https://math.stackexchange.com/questions/1960055", "https://math.stackexchange.com", "https://math.stackexchange.com/users/174798/" ]
This is an excellent example of a proof that is traditionally phrased as a proof by contradiction but is much better understood constructively. From a constructive viewpoint, the proof shows that given any list of primes $p\_1, \ldots, p\_n$ there is a prime $q$ (any prime divisor of $p\_1p\_2\ldots p\_n + 1$) that is ...
> > Suppose only 6 primes exist: 2,3,5,7,11,13 > > > However, none of the 6 primes listed, (2,3,5,7,11,13), divides 30,031. > > > Then we already have a contradiction. Since there are only 6 primes (we supposed that at the beginning) and none of them divide 30,031, then 30,031 must be prime. However, 30,031 is n...
1,960,055
Here's the proof from the book I'm reading that proves there are infinitely many primes: > > We want to show that it is not the case that there only finitely many primes. Suppose there are finitely many primes. We shall show that this assumption leads to a contradiction. Let $p\_1, p\_2,...,p\_n$ be all the primes th...
2016/10/08
[ "https://math.stackexchange.com/questions/1960055", "https://math.stackexchange.com", "https://math.stackexchange.com/users/174798/" ]
Here is a non-mathematical approach to the logic behind the proof by contradiction... Suppose your assumption is that a suspect in a brutal murder is innocent because he said he couldn't have been at the location the person was murdered. You feel as though he is possibly telling the truth, but what you do know is that...
1. Well... yes... it does break down. You assumed that there are only 6 primes and reached a contradiction. You've successfully proved that there **aren't** only 6 primes. 2. Under the assumption that there are only 6 primes 30,031 **isn't** factorizable. 3. In [proof by contradiction](https://en.wikipedia.org/wiki/Pro...
1,960,055
Here's the proof from the book I'm reading that proves there are infinitely many primes: > > We want to show that it is not the case that there only finitely many primes. Suppose there are finitely many primes. We shall show that this assumption leads to a contradiction. Let $p\_1, p\_2,...,p\_n$ be all the primes th...
2016/10/08
[ "https://math.stackexchange.com/questions/1960055", "https://math.stackexchange.com", "https://math.stackexchange.com/users/174798/" ]
This is an excellent example of a proof that is traditionally phrased as a proof by contradiction but is much better understood constructively. From a constructive viewpoint, the proof shows that given any list of primes $p\_1, \ldots, p\_n$ there is a prime $q$ (any prime divisor of $p\_1p\_2\ldots p\_n + 1$) that is ...
The proof is essentially overexplaining. The point of contradiction would have been much clearer if the author had: 1. Reached it earlier. 2. Introduced less notation. Since $p\_1\cdots p\_n+1$ cannot have any of $p\_1,...,p\_n$ as a prime factor we already have a contradiction. The rest is just explaining to death ...
1,960,055
Here's the proof from the book I'm reading that proves there are infinitely many primes: > > We want to show that it is not the case that there only finitely many primes. Suppose there are finitely many primes. We shall show that this assumption leads to a contradiction. Let $p\_1, p\_2,...,p\_n$ be all the primes th...
2016/10/08
[ "https://math.stackexchange.com/questions/1960055", "https://math.stackexchange.com", "https://math.stackexchange.com/users/174798/" ]
1. The proof does break down in a sense. You have reached a contradiction, which means the hypothesis that there are finitely many primes can not possibly be true. 2. So you thought you had 6 primes, you found 2 extra. Can you just add these two to your list and get all of the primes? If you repeat the process on these...
Here is a non-mathematical approach to the logic behind the proof by contradiction... Suppose your assumption is that a suspect in a brutal murder is innocent because he said he couldn't have been at the location the person was murdered. You feel as though he is possibly telling the truth, but what you do know is that...
1,960,055
Here's the proof from the book I'm reading that proves there are infinitely many primes: > > We want to show that it is not the case that there only finitely many primes. Suppose there are finitely many primes. We shall show that this assumption leads to a contradiction. Let $p\_1, p\_2,...,p\_n$ be all the primes th...
2016/10/08
[ "https://math.stackexchange.com/questions/1960055", "https://math.stackexchange.com", "https://math.stackexchange.com/users/174798/" ]
1. The proof does break down in a sense. You have reached a contradiction, which means the hypothesis that there are finitely many primes can not possibly be true. 2. So you thought you had 6 primes, you found 2 extra. Can you just add these two to your list and get all of the primes? If you repeat the process on these...
Point 1: It's a *theorem* that any natural number $n>1$ has a prime factor. The proof is easy: for any number $n>1$, the smallest natural number $a>1$ which divides $n$ *is* prime (if it were not prime, it would not be the smallest). Point 2: Yes, you have proved there are more than six primes. So what? The proof by c...
1,960,055
Here's the proof from the book I'm reading that proves there are infinitely many primes: > > We want to show that it is not the case that there only finitely many primes. Suppose there are finitely many primes. We shall show that this assumption leads to a contradiction. Let $p\_1, p\_2,...,p\_n$ be all the primes th...
2016/10/08
[ "https://math.stackexchange.com/questions/1960055", "https://math.stackexchange.com", "https://math.stackexchange.com/users/174798/" ]
> > Suppose only 6 primes exist: 2,3,5,7,11,13 > > > However, none of the 6 primes listed, (2,3,5,7,11,13), divides 30,031. > > > Then we already have a contradiction. Since there are only 6 primes (we supposed that at the beginning) and none of them divide 30,031, then 30,031 must be prime. However, 30,031 is n...
1. Well... yes... it does break down. You assumed that there are only 6 primes and reached a contradiction. You've successfully proved that there **aren't** only 6 primes. 2. Under the assumption that there are only 6 primes 30,031 **isn't** factorizable. 3. In [proof by contradiction](https://en.wikipedia.org/wiki/Pro...
1,960,055
Here's the proof from the book I'm reading that proves there are infinitely many primes: > > We want to show that it is not the case that there only finitely many primes. Suppose there are finitely many primes. We shall show that this assumption leads to a contradiction. Let $p\_1, p\_2,...,p\_n$ be all the primes th...
2016/10/08
[ "https://math.stackexchange.com/questions/1960055", "https://math.stackexchange.com", "https://math.stackexchange.com/users/174798/" ]
This is an excellent example of a proof that is traditionally phrased as a proof by contradiction but is much better understood constructively. From a constructive viewpoint, the proof shows that given any list of primes $p\_1, \ldots, p\_n$ there is a prime $q$ (any prime divisor of $p\_1p\_2\ldots p\_n + 1$) that is ...
Point 1: It's a *theorem* that any natural number $n>1$ has a prime factor. The proof is easy: for any number $n>1$, the smallest natural number $a>1$ which divides $n$ *is* prime (if it were not prime, it would not be the smallest). Point 2: Yes, you have proved there are more than six primes. So what? The proof by c...
1,960,055
Here's the proof from the book I'm reading that proves there are infinitely many primes: > > We want to show that it is not the case that there only finitely many primes. Suppose there are finitely many primes. We shall show that this assumption leads to a contradiction. Let $p\_1, p\_2,...,p\_n$ be all the primes th...
2016/10/08
[ "https://math.stackexchange.com/questions/1960055", "https://math.stackexchange.com", "https://math.stackexchange.com/users/174798/" ]
The proof is essentially overexplaining. The point of contradiction would have been much clearer if the author had: 1. Reached it earlier. 2. Introduced less notation. Since $p\_1\cdots p\_n+1$ cannot have any of $p\_1,...,p\_n$ as a prime factor we already have a contradiction. The rest is just explaining to death ...
1. Either $ 6 $ primes you considered are not all the primes, or $ 30031 $ is a new prime. Either way assumption is false. Proof by contradiction. 2. No, you haven't shown that two more primes exist. In this example yes, but not in general 3. Again, based on your assumption you reached something impossible that $q $ di...
14,854,340
I'm looking for the list of the images loaded in a webpage, but I can find it.. In Chrome I can list the images going to the Inspector > Resources > Frames > Images. FF 15.0.1 FB 1.10.6
2013/02/13
[ "https://Stackoverflow.com/questions/14854340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/248959/" ]
You can do this in firebug extension. Choose "Net" in toolbar than "images" and after you reload the page you can see all images has been loaded.
This way can be used to list, as well as save all media files of the page at once ``` Right click -> View Page Info -> Click on "Media" tab ``` You can select an image (or all images) and "Save As"
54,080,117
I have a dataframe, how can I convert the values in a column to a list of corresponding integers based on which range they belong to. For example, ``` test = pd.DataFrame({"price": [0.1, 0.5, 0.2, 0.11, 0.8, 0.3, 0.9, 1.0, 0.47]}) out[1]: price 0 0.10 1 0.50 2 0.20 3 0.11 4 0.80 ...
2019/01/07
[ "https://Stackoverflow.com/questions/54080117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10830052/" ]
You can use pandas cut ``` bins = np.arange(0, 1.1, 0.1) labels = np.arange(1, 11) test['price_new'] = pd.cut(test.price, bins = bins, labels = labels) price price_new 0 0.10 1 1 0.50 5 2 0.20 2 3 0.11 2 4 0.80 8 5 0.30 3 6 0.90 9 7 1.00 10 8 0.47 5 ``` Edit: Create bi...
Why not trying something like: ``` df['price_new'] = (df['price']*10).round() ```
54,080,117
I have a dataframe, how can I convert the values in a column to a list of corresponding integers based on which range they belong to. For example, ``` test = pd.DataFrame({"price": [0.1, 0.5, 0.2, 0.11, 0.8, 0.3, 0.9, 1.0, 0.47]}) out[1]: price 0 0.10 1 0.50 2 0.20 3 0.11 4 0.80 ...
2019/01/07
[ "https://Stackoverflow.com/questions/54080117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10830052/" ]
You can use pandas cut ``` bins = np.arange(0, 1.1, 0.1) labels = np.arange(1, 11) test['price_new'] = pd.cut(test.price, bins = bins, labels = labels) price price_new 0 0.10 1 1 0.50 5 2 0.20 2 3 0.11 2 4 0.80 8 5 0.30 3 6 0.90 9 7 1.00 10 8 0.47 5 ``` Edit: Create bi...
For this use case, you can just use the round function and scale the numbers to get your desired output. ``` import pandas as pd df = pd.DataFrame({"price": [0.1, 0.5, 0.2, 0.11, 0.8, 0.3, 0.9, 1.0, 0.47]}) df['price_new'] = df.price.multiply(10).round() print(df) #Output: price price_new 0 0.10 1.0 1 0...
54,080,117
I have a dataframe, how can I convert the values in a column to a list of corresponding integers based on which range they belong to. For example, ``` test = pd.DataFrame({"price": [0.1, 0.5, 0.2, 0.11, 0.8, 0.3, 0.9, 1.0, 0.47]}) out[1]: price 0 0.10 1 0.50 2 0.20 3 0.11 4 0.80 ...
2019/01/07
[ "https://Stackoverflow.com/questions/54080117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10830052/" ]
You can use pandas cut ``` bins = np.arange(0, 1.1, 0.1) labels = np.arange(1, 11) test['price_new'] = pd.cut(test.price, bins = bins, labels = labels) price price_new 0 0.10 1 1 0.50 5 2 0.20 2 3 0.11 2 4 0.80 8 5 0.30 3 6 0.90 9 7 1.00 10 8 0.47 5 ``` Edit: Create bi...
More like a ceiling round ``` np.ceil(df.price.mul(10)).astype(int) Out[369]: 0 1 1 5 2 2 3 2 4 8 5 3 6 9 7 10 8 5 Name: price, dtype: int32 ```
21,539
If I'm playing an online game such as World of Warcraft, how would I say the idiomatic expression "level up" in French? I know I see "monter niveau" and such, but how would it be said colloquially? For instance, how would I say,"I just leveled up to level 100."?
2016/08/14
[ "https://french.stackexchange.com/questions/21539", "https://french.stackexchange.com", "https://french.stackexchange.com/users/11171/" ]
I will say: "Je viens de passer au niveau 100"! "I just reached level 100" For a game we will more use the verb "passer" in the sense of "to go, to pass, to reach" than "monter" which means "going up"!
Adding to what Loky said (**passer** niveau 100)... To be fair, most MMORPG player don't use the purest french to express themself when they speak about their game, and some of them are young. Also as you'd expect the french academy does not bother with video game. > > J'ai up [level/niveau] 100 > > > J'ai ding [le...
6,115,960
I am new to the world of coding as well as CSS and have noticed that when I resize my browser, all my float elements move to say the right and the user is forced to scroll horizontally to view say the menu. Firstly is there a need to prevent float elements not changing their position? Secondly, is there a way I can...
2011/05/24
[ "https://Stackoverflow.com/questions/6115960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/700543/" ]
Floats are a pain in the butt. Primarily because of the one browser that refuses to follow the universal web standards. Yeah, that one. There are a million and one tricks to avoid these problems. I tell my team to follow these steps: 1. Use absolutely positioned elements sparingly. If you position based on another el...
I'd suggest you figure out if you want to support differing resolutions, depending on your target audience. Elements moving around isn't necessarily a bad thing, and planning in advance how you want your site to layout depending on viewport size could be important. If you can't find a fixed-width, "one layout to rule ...
3,848,205
Let $V$ be a finite dimensional vector space over the field $K$, with a nondegenerate scalar product$\langle, \rangle$. If $A: V\to V$ is a linear map such that $\langle Av, Aw\rangle=\langle v, w\rangle$ for all $v, w\in V$, show that $\det(A)=\pm 1$. The solution said: In the general case we also have $A^\*A=AA^\...
2020/10/02
[ "https://math.stackexchange.com/questions/3848205", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
Let $B=A^TA$. Then $\langle v, Bw\rangle=\langle v, w\rangle$. Hence $\langle v, Bw-w\rangle=0$ for every $v, w$. Take $v=Bw-w$. You get $||v||=0$, so $v=0$. Thus for every $w, Bw=w$, so $B=A^TA=I$. Since $\det(A)=\det(A^T)$, we have $\det(A^2)=1$, so $\det(A)=\pm 1$.
$A$ is a linear operator on a coordinate vector space $\mathbb F^n$. When you say the matrix $J$ 'represents' the non-degerate scalar product, I interpret this to mean there is some basis chosen and given by the hyper-vector $\mathbf B$ (this is also a square matrix since we are dealing with a coordinate vector spa...
3,848,205
Let $V$ be a finite dimensional vector space over the field $K$, with a nondegenerate scalar product$\langle, \rangle$. If $A: V\to V$ is a linear map such that $\langle Av, Aw\rangle=\langle v, w\rangle$ for all $v, w\in V$, show that $\det(A)=\pm 1$. The solution said: In the general case we also have $A^\*A=AA^\...
2020/10/02
[ "https://math.stackexchange.com/questions/3848205", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
Let $B=A^TA$. Then $\langle v, Bw\rangle=\langle v, w\rangle$. Hence $\langle v, Bw-w\rangle=0$ for every $v, w$. Take $v=Bw-w$. You get $||v||=0$, so $v=0$. Thus for every $w, Bw=w$, so $B=A^TA=I$. Since $\det(A)=\det(A^T)$, we have $\det(A^2)=1$, so $\det(A)=\pm 1$.
The confusing part is that in this solution there is only one notation being used for two different inner products. Let's say that $V = \mathbb{R}^n$. Then an abstract vector $v \in V$ or an abstract linear operator $A \colon V \to V$ may be treated as column vector $[v] \in \mathbb{K}^n$ or a matrix $[A] \in \operator...
3,848,205
Let $V$ be a finite dimensional vector space over the field $K$, with a nondegenerate scalar product$\langle, \rangle$. If $A: V\to V$ is a linear map such that $\langle Av, Aw\rangle=\langle v, w\rangle$ for all $v, w\in V$, show that $\det(A)=\pm 1$. The solution said: In the general case we also have $A^\*A=AA^\...
2020/10/02
[ "https://math.stackexchange.com/questions/3848205", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
The confusing part is that in this solution there is only one notation being used for two different inner products. Let's say that $V = \mathbb{R}^n$. Then an abstract vector $v \in V$ or an abstract linear operator $A \colon V \to V$ may be treated as column vector $[v] \in \mathbb{K}^n$ or a matrix $[A] \in \operator...
$A$ is a linear operator on a coordinate vector space $\mathbb F^n$. When you say the matrix $J$ 'represents' the non-degerate scalar product, I interpret this to mean there is some basis chosen and given by the hyper-vector $\mathbf B$ (this is also a square matrix since we are dealing with a coordinate vector spa...
60,963,680
i want to see an image that i have uploaded on my rest api. [here is the file i have uploaded](https://i.stack.imgur.com/EqE1M.png) i have try this code, ``` public function MostrarImagenUsuario($id){ $usuario = Usuario::find($id); $link = Storage::disk('public')->url('app/'.$usuario->foto); return respo...
2020/04/01
[ "https://Stackoverflow.com/questions/60963680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11521893/" ]
your code does not work because you try get image from non public directory in laravel all public asset always store in root public folder. in the case of images you can store in storage/app/public but whwn you want to get image always use public/ folder and it both connected with the sync link. ``` php artisan storag...
Make sure you have created storage link by calling php artisan storage:link Then you can get the url of your storage file. $url = Storage::url('file.jpg');
60,963,680
i want to see an image that i have uploaded on my rest api. [here is the file i have uploaded](https://i.stack.imgur.com/EqE1M.png) i have try this code, ``` public function MostrarImagenUsuario($id){ $usuario = Usuario::find($id); $link = Storage::disk('public')->url('app/'.$usuario->foto); return respo...
2020/04/01
[ "https://Stackoverflow.com/questions/60963680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11521893/" ]
your code does not work because you try get image from non public directory in laravel all public asset always store in root public folder. in the case of images you can store in storage/app/public but whwn you want to get image always use public/ folder and it both connected with the sync link. ``` php artisan storag...
Use like this in the model This function is execute when you get the image property ``` public function getImageAttribute($value) { if (!$value) { return 'http://placehold.it/160x160'; } return env("APP_URL")."/storage/phones/".$value; } ``` This function is execute when you set the image pro...
48,900,171
I'm dabbling with localization in Swift. It's been pretty straightforward until I have to deal with possessive. Say I have these phrases in English: `Carol's car is red.` `Kris' car is red.` In French, they would be `La voiture de Carol est rouge` `La voiture de Kris est rouge` How would I set up my `Localizable...
2018/02/21
[ "https://Stackoverflow.com/questions/48900171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5429504/" ]
Once you have added a new document then you need to call below API for the recipient to create new Tabs on the new document: ``` POST /v2/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs ``` [DS Docs](https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeRecipientTabs/create/) Example: ...
If the new document's fields (Tabs) are managed by a template, then you can use Composite Templates to have the document "processed" by the right template. Ask this as a new question if you want to investigate this route.
44,709,619
How would I make the below function changes lines `$(this).html(sourcesArray[tableNumber-1].forecast[i].alt.high)` and `$(this).html(sourcesArray[tableNumber-1].forecast[i].alt.low)` by removing the `.alt` from both lines if `true` is passed into `simplePar`? ``` function switchTempUnitOnForecastTables(simplePar) { f...
2017/06/22
[ "https://Stackoverflow.com/questions/44709619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8201432/" ]
When asking a question like this, it helps to break it down to a simplified version - so it's not about your specific code. Here is one way to think about it. It can surely be more complex and check types and the number of args etc. ``` var thing = { name: 'Derek', alt: { name: '@sheriffderek', }, }; functi...
You can solve this with a ternary expression (which is just a compact version of `if(){}...then{}`) : ``` var obj = sourcesArray[tableNumber-1].forecast[i]; $(this).html(simplePar ? obj[hiLo] : obj.alt[hiLo]).removeClass('fadeOut').addClass('fadeIn'); // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this expres...
19,900,433
What does this symbol in database mean ⊆? for example for projection in relational algebra : ΠLR take a subset of the attributes of a relation R, where L ⊆ R.
2013/11/11
[ "https://Stackoverflow.com/questions/19900433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2978141/" ]
L ⊆ R means L is a subset of R. For every element in L, the element exists in R.
L ⊆ R means L is a subset of R ('is contained in'). [L could also be equal to the whole of R].
19,900,433
What does this symbol in database mean ⊆? for example for projection in relational algebra : ΠLR take a subset of the attributes of a relation R, where L ⊆ R.
2013/11/11
[ "https://Stackoverflow.com/questions/19900433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2978141/" ]
L ⊆ R means L is a subset of R. For every element in L, the element exists in R.
L ⊆ R means L is subset of or equal to R.
19,900,433
What does this symbol in database mean ⊆? for example for projection in relational algebra : ΠLR take a subset of the attributes of a relation R, where L ⊆ R.
2013/11/11
[ "https://Stackoverflow.com/questions/19900433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2978141/" ]
L ⊆ R means L is a subset of R. For every element in L, the element exists in R.
L and R make set of attributes
19,900,433
What does this symbol in database mean ⊆? for example for projection in relational algebra : ΠLR take a subset of the attributes of a relation R, where L ⊆ R.
2013/11/11
[ "https://Stackoverflow.com/questions/19900433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2978141/" ]
L ⊆ R means L is a subset of R. For every element in L, the element exists in R.
L ⊆ R means literally L is a subset of R. In order to understand it here is an example, we have two sets A and B: ``` A = {1, 4, 5} B = {1, 2, 3, 4, 5} ``` where A is a subset of B, because all numbers from set A can be found in set B. Also, we can see it as a diagram: [![enter image description here](https://i.s...
19,900,433
What does this symbol in database mean ⊆? for example for projection in relational algebra : ΠLR take a subset of the attributes of a relation R, where L ⊆ R.
2013/11/11
[ "https://Stackoverflow.com/questions/19900433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2978141/" ]
L ⊆ R means L is a subset of R ('is contained in'). [L could also be equal to the whole of R].
L ⊆ R means literally L is a subset of R. In order to understand it here is an example, we have two sets A and B: ``` A = {1, 4, 5} B = {1, 2, 3, 4, 5} ``` where A is a subset of B, because all numbers from set A can be found in set B. Also, we can see it as a diagram: [![enter image description here](https://i.s...
19,900,433
What does this symbol in database mean ⊆? for example for projection in relational algebra : ΠLR take a subset of the attributes of a relation R, where L ⊆ R.
2013/11/11
[ "https://Stackoverflow.com/questions/19900433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2978141/" ]
L ⊆ R means L is subset of or equal to R.
L ⊆ R means literally L is a subset of R. In order to understand it here is an example, we have two sets A and B: ``` A = {1, 4, 5} B = {1, 2, 3, 4, 5} ``` where A is a subset of B, because all numbers from set A can be found in set B. Also, we can see it as a diagram: [![enter image description here](https://i.s...
19,900,433
What does this symbol in database mean ⊆? for example for projection in relational algebra : ΠLR take a subset of the attributes of a relation R, where L ⊆ R.
2013/11/11
[ "https://Stackoverflow.com/questions/19900433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2978141/" ]
L and R make set of attributes
L ⊆ R means literally L is a subset of R. In order to understand it here is an example, we have two sets A and B: ``` A = {1, 4, 5} B = {1, 2, 3, 4, 5} ``` where A is a subset of B, because all numbers from set A can be found in set B. Also, we can see it as a diagram: [![enter image description here](https://i.s...
10,091,458
I am trying to stress test a client/server system by emulating multiple clients connecting to the server. There is a thread per client. BUT, when I run the following code (ClientStartEmulator() represents a client), threads run sequentially rather than concurrently. (despite there being multiple thread yields and sleep...
2012/04/10
[ "https://Stackoverflow.com/questions/10091458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1018513/" ]
You should be calling `client.start()` which starts the thread in the background. By calling `client.run()` you are executing the run method in the calling thread instead. Not what you want I assume. From the `Thread` code: ``` /** * Causes this thread to begin execution; the Java Virtual Machine * calls the <code...
`start` calls `run` so instead of `client.run()` replace with `client.start()` the new thread moves to runnable or running state
46,949,972
I have 2 Classes in ssservice.h: ``` class ssverbindungsdaten { public: ssverbindungsdaten(); ~ssverbindungsdaten(); int id; string test; }; class softswitch{ public: softswitch(); ~softswitch(); list<ssverbindungsdaten> holeAlleRohdate...
2017/10/26
[ "https://Stackoverflow.com/questions/46949972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7884887/" ]
``` list<ssverbindungsdaten> *listTmp = new list<ssverbindungsdaten>; ``` The "new" keyword in c++ actually allocates a new pointer, so you are manually allocating a pointer to a list of ssverbindungsdaten objects. If you want to create a default instance of the class or list just use `list<ssverbindungen> listTmp;...
If you skip all the `new` and pointers, the code will be *a lot* simpler: ``` int main(int argc, char *argv[]) { //TODO: Mulithreading std::cout << "Starte ..."; softswitch ss; list<ssverbindungsdaten> liSSVVerbinngsdaten = ss.holeAlleRohdaten(); return 0; } ``` C++ is not at all like Java or ...
46,949,972
I have 2 Classes in ssservice.h: ``` class ssverbindungsdaten { public: ssverbindungsdaten(); ~ssverbindungsdaten(); int id; string test; }; class softswitch{ public: softswitch(); ~softswitch(); list<ssverbindungsdaten> holeAlleRohdate...
2017/10/26
[ "https://Stackoverflow.com/questions/46949972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7884887/" ]
``` list<ssverbindungsdaten> *listTmp = new list<ssverbindungsdaten>; ``` The "new" keyword in c++ actually allocates a new pointer, so you are manually allocating a pointer to a list of ssverbindungsdaten objects. If you want to create a default instance of the class or list just use `list<ssverbindungen> listTmp;...
You should do what the others say about pointers, smart pointers, naming, ... But your error is ``` liSSVVerbinngsdaten = ss->holeAlleRohdaten(); ``` `liSSVVerbinngsdaten` is a pointer to a list and `ss->holeAlleRohdaten()` returns a list. You can fix your program by returning a pointer ssservice.h: ``` class s...
46,949,972
I have 2 Classes in ssservice.h: ``` class ssverbindungsdaten { public: ssverbindungsdaten(); ~ssverbindungsdaten(); int id; string test; }; class softswitch{ public: softswitch(); ~softswitch(); list<ssverbindungsdaten> holeAlleRohdate...
2017/10/26
[ "https://Stackoverflow.com/questions/46949972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7884887/" ]
You should do what the others say about pointers, smart pointers, naming, ... But your error is ``` liSSVVerbinngsdaten = ss->holeAlleRohdaten(); ``` `liSSVVerbinngsdaten` is a pointer to a list and `ss->holeAlleRohdaten()` returns a list. You can fix your program by returning a pointer ssservice.h: ``` class s...
If you skip all the `new` and pointers, the code will be *a lot* simpler: ``` int main(int argc, char *argv[]) { //TODO: Mulithreading std::cout << "Starte ..."; softswitch ss; list<ssverbindungsdaten> liSSVVerbinngsdaten = ss.holeAlleRohdaten(); return 0; } ``` C++ is not at all like Java or ...
22,380,864
In previous versions of IE developer tools you were able to open the source of CSS files in the debugger. This was of most use to verify that they had actually been downloaded / referenced correctly, ie if the request for a stylesheet returned a 404 error then thats the route cause of my styles not being applied. Ho...
2014/03/13
[ "https://Stackoverflow.com/questions/22380864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1286358/" ]
I don't believe so. There is a Connect issue reporting this and MS says they have it on their backlog for a "potential" future release. [IE11: CSS tab missing in new F12 Developer Tools](http://connect.microsoft.com/IE/feedback/details/811076/ie11-css-tab-missing-in-new-f12-developer-tools) Update: Microsoft has annou...
I was surprised to discover this today, and resorted to using the Chrome F12 tool - Under the Resources Tab in the left hand panel you can expand Frames to access Images, Scripts and Stylesheets for your page - CSS are in the last of these of course. It goes without saying that this only helps if you have access to Ch...
22,380,864
In previous versions of IE developer tools you were able to open the source of CSS files in the debugger. This was of most use to verify that they had actually been downloaded / referenced correctly, ie if the request for a stylesheet returned a 404 error then thats the route cause of my styles not being applied. Ho...
2014/03/13
[ "https://Stackoverflow.com/questions/22380864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1286358/" ]
I don't believe so. There is a Connect issue reporting this and MS says they have it on their backlog for a "potential" future release. [IE11: CSS tab missing in new F12 Developer Tools](http://connect.microsoft.com/IE/feedback/details/811076/ie11-css-tab-missing-in-new-f12-developer-tools) Update: Microsoft has annou...
The CSS tab is missing, and the debugger does not list CSS files either. However, If you find an element in the dom explorer with styles applied from a css file, you can then click on the file name and open the entire file.
22,380,864
In previous versions of IE developer tools you were able to open the source of CSS files in the debugger. This was of most use to verify that they had actually been downloaded / referenced correctly, ie if the request for a stylesheet returned a 404 error then thats the route cause of my styles not being applied. Ho...
2014/03/13
[ "https://Stackoverflow.com/questions/22380864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1286358/" ]
I don't believe so. There is a Connect issue reporting this and MS says they have it on their backlog for a "potential" future release. [IE11: CSS tab missing in new F12 Developer Tools](http://connect.microsoft.com/IE/feedback/details/811076/ie11-css-tab-missing-in-new-f12-developer-tools) Update: Microsoft has annou...
In developer tools, go to the Network tab. Click the arrow (when you hover over it, it will say "Enable network traffic capturing"). It will turn into a square to indicate that it is capturing network traffic. Refresh the page. Click type to sort by type and look for "text/css". Double click the file. Click "Response b...
22,380,864
In previous versions of IE developer tools you were able to open the source of CSS files in the debugger. This was of most use to verify that they had actually been downloaded / referenced correctly, ie if the request for a stylesheet returned a 404 error then thats the route cause of my styles not being applied. Ho...
2014/03/13
[ "https://Stackoverflow.com/questions/22380864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1286358/" ]
The CSS tab is missing, and the debugger does not list CSS files either. However, If you find an element in the dom explorer with styles applied from a css file, you can then click on the file name and open the entire file.
I was surprised to discover this today, and resorted to using the Chrome F12 tool - Under the Resources Tab in the left hand panel you can expand Frames to access Images, Scripts and Stylesheets for your page - CSS are in the last of these of course. It goes without saying that this only helps if you have access to Ch...
22,380,864
In previous versions of IE developer tools you were able to open the source of CSS files in the debugger. This was of most use to verify that they had actually been downloaded / referenced correctly, ie if the request for a stylesheet returned a 404 error then thats the route cause of my styles not being applied. Ho...
2014/03/13
[ "https://Stackoverflow.com/questions/22380864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1286358/" ]
The CSS tab is missing, and the debugger does not list CSS files either. However, If you find an element in the dom explorer with styles applied from a css file, you can then click on the file name and open the entire file.
In developer tools, go to the Network tab. Click the arrow (when you hover over it, it will say "Enable network traffic capturing"). It will turn into a square to indicate that it is capturing network traffic. Refresh the page. Click type to sort by type and look for "text/css". Double click the file. Click "Response b...
7,283,633
For the `[Submitted On]` column, when `@fiscalyear` is selected, I want only data ending that fiscal year. For example if `@fiscalyear = 2011` I want the data with `[Submitted On]` column ending with only the 2011 or `null` and likewise for the other years which is 2010 and 2012. Right now the problem is when i select...
2011/09/02
[ "https://Stackoverflow.com/questions/7283633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/900746/" ]
If you want to ensure a 1:1 mapping then use an encryption (i.e. a permutation), not a hash. Encryption has to be 1:1 because it can be decrypted. If you want 32 bit numbers then use [Hasty Pudding Cypher](http://en.wikipedia.org/wiki/Hasty_Pudding_cipher) or just write a simple four round Feistel cypher. Here's one ...
Do what Henrik said in his second suggestion. But since these values seem to be used by people (else you wouldn't want to randomize them). Take one additional step. Multiply the sequential number by a large prime and reduce mod N where N is a power of 2. But choose N to be 2 bits smaller than you can store. Next, multi...
7,283,633
For the `[Submitted On]` column, when `@fiscalyear` is selected, I want only data ending that fiscal year. For example if `@fiscalyear = 2011` I want the data with `[Submitted On]` column ending with only the 2011 or `null` and likewise for the other years which is 2010 and 2012. Right now the problem is when i select...
2011/09/02
[ "https://Stackoverflow.com/questions/7283633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/900746/" ]
Do what Henrik said in his second suggestion. But since these values seem to be used by people (else you wouldn't want to randomize them). Take one additional step. Multiply the sequential number by a large prime and reduce mod N where N is a power of 2. But choose N to be 2 bits smaller than you can store. Next, multi...
You can use mod operation for big prime number. your number \* big prime number 1 / big prime number 2. Prime number 1 should be bigger than second. Seconds should be close to 2^32 but less than it. Than it will be hard to substitute. Prime 1 and Prime 2 should be constants.
7,283,633
For the `[Submitted On]` column, when `@fiscalyear` is selected, I want only data ending that fiscal year. For example if `@fiscalyear = 2011` I want the data with `[Submitted On]` column ending with only the 2011 or `null` and likewise for the other years which is 2010 and 2012. Right now the problem is when i select...
2011/09/02
[ "https://Stackoverflow.com/questions/7283633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/900746/" ]
If you want to ensure a 1:1 mapping then use an encryption (i.e. a permutation), not a hash. Encryption has to be 1:1 because it can be decrypted. If you want 32 bit numbers then use [Hasty Pudding Cypher](http://en.wikipedia.org/wiki/Hasty_Pudding_cipher) or just write a simple four round Feistel cypher. Here's one ...
There is an exceedingly simple solution that none have posted, even though an answer has been selected I highly advise any visiting this question to consider the nature of binary representations, and the application of modulos arithmetic. Given an finite range of integers, all the values can be permuted in any order t...
7,283,633
For the `[Submitted On]` column, when `@fiscalyear` is selected, I want only data ending that fiscal year. For example if `@fiscalyear = 2011` I want the data with `[Submitted On]` column ending with only the 2011 or `null` and likewise for the other years which is 2010 and 2012. Right now the problem is when i select...
2011/09/02
[ "https://Stackoverflow.com/questions/7283633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/900746/" ]
You could simply XOR with 0xDEADBEEF, if that's good enough. Alternatively multiply by an odd number mod 2^32. For the inverse mapping just multiply by the [multiplicative inverse](http://en.wikipedia.org/wiki/Modular_multiplicative_inverse) Example: n = 2345678901; multiplicative inverse (mod 2^32): 2313902621 For t...
If you want to ensure a 1:1 mapping then use an encryption (i.e. a permutation), not a hash. Encryption has to be 1:1 because it can be decrypted. If you want 32 bit numbers then use [Hasty Pudding Cypher](http://en.wikipedia.org/wiki/Hasty_Pudding_cipher) or just write a simple four round Feistel cypher. Here's one ...
7,283,633
For the `[Submitted On]` column, when `@fiscalyear` is selected, I want only data ending that fiscal year. For example if `@fiscalyear = 2011` I want the data with `[Submitted On]` column ending with only the 2011 or `null` and likewise for the other years which is 2010 and 2012. Right now the problem is when i select...
2011/09/02
[ "https://Stackoverflow.com/questions/7283633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/900746/" ]
Do what Henrik said in his second suggestion. But since these values seem to be used by people (else you wouldn't want to randomize them). Take one additional step. Multiply the sequential number by a large prime and reduce mod N where N is a power of 2. But choose N to be 2 bits smaller than you can store. Next, multi...
There is an exceedingly simple solution that none have posted, even though an answer has been selected I highly advise any visiting this question to consider the nature of binary representations, and the application of modulos arithmetic. Given an finite range of integers, all the values can be permuted in any order t...
7,283,633
For the `[Submitted On]` column, when `@fiscalyear` is selected, I want only data ending that fiscal year. For example if `@fiscalyear = 2011` I want the data with `[Submitted On]` column ending with only the 2011 or `null` and likewise for the other years which is 2010 and 2012. Right now the problem is when i select...
2011/09/02
[ "https://Stackoverflow.com/questions/7283633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/900746/" ]
You could simply XOR with 0xDEADBEEF, if that's good enough. Alternatively multiply by an odd number mod 2^32. For the inverse mapping just multiply by the [multiplicative inverse](http://en.wikipedia.org/wiki/Modular_multiplicative_inverse) Example: n = 2345678901; multiplicative inverse (mod 2^32): 2313902621 For t...
Do what Henrik said in his second suggestion. But since these values seem to be used by people (else you wouldn't want to randomize them). Take one additional step. Multiply the sequential number by a large prime and reduce mod N where N is a power of 2. But choose N to be 2 bits smaller than you can store. Next, multi...
7,283,633
For the `[Submitted On]` column, when `@fiscalyear` is selected, I want only data ending that fiscal year. For example if `@fiscalyear = 2011` I want the data with `[Submitted On]` column ending with only the 2011 or `null` and likewise for the other years which is 2010 and 2012. Right now the problem is when i select...
2011/09/02
[ "https://Stackoverflow.com/questions/7283633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/900746/" ]
You could simply XOR with 0xDEADBEEF, if that's good enough. Alternatively multiply by an odd number mod 2^32. For the inverse mapping just multiply by the [multiplicative inverse](http://en.wikipedia.org/wiki/Modular_multiplicative_inverse) Example: n = 2345678901; multiplicative inverse (mod 2^32): 2313902621 For t...
There is an exceedingly simple solution that none have posted, even though an answer has been selected I highly advise any visiting this question to consider the nature of binary representations, and the application of modulos arithmetic. Given an finite range of integers, all the values can be permuted in any order t...
7,283,633
For the `[Submitted On]` column, when `@fiscalyear` is selected, I want only data ending that fiscal year. For example if `@fiscalyear = 2011` I want the data with `[Submitted On]` column ending with only the 2011 or `null` and likewise for the other years which is 2010 and 2012. Right now the problem is when i select...
2011/09/02
[ "https://Stackoverflow.com/questions/7283633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/900746/" ]
If you want to ensure a 1:1 mapping then use an encryption (i.e. a permutation), not a hash. Encryption has to be 1:1 because it can be decrypted. If you want 32 bit numbers then use [Hasty Pudding Cypher](http://en.wikipedia.org/wiki/Hasty_Pudding_cipher) or just write a simple four round Feistel cypher. Here's one ...
You can use mod operation for big prime number. your number \* big prime number 1 / big prime number 2. Prime number 1 should be bigger than second. Seconds should be close to 2^32 but less than it. Than it will be hard to substitute. Prime 1 and Prime 2 should be constants.
7,283,633
For the `[Submitted On]` column, when `@fiscalyear` is selected, I want only data ending that fiscal year. For example if `@fiscalyear = 2011` I want the data with `[Submitted On]` column ending with only the 2011 or `null` and likewise for the other years which is 2010 and 2012. Right now the problem is when i select...
2011/09/02
[ "https://Stackoverflow.com/questions/7283633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/900746/" ]
If you want to ensure a 1:1 mapping then use an encryption (i.e. a permutation), not a hash. Encryption has to be 1:1 because it can be decrypted. If you want 32 bit numbers then use [Hasty Pudding Cypher](http://en.wikipedia.org/wiki/Hasty_Pudding_cipher) or just write a simple four round Feistel cypher. Here's one ...
For our application, we use bit shuffle to generate the ID. It is very easy to reverse back to the original ID. ``` func (m Meeting) MeetingCode() uint { hashed := (m.ID + 10000000) & 0x00FFFFFF chunks := [24]uint{} for i := 0; i < 24; i++ { chunks[i] = hashed >> i & 0x1 } shuffle := [24]ui...
7,283,633
For the `[Submitted On]` column, when `@fiscalyear` is selected, I want only data ending that fiscal year. For example if `@fiscalyear = 2011` I want the data with `[Submitted On]` column ending with only the 2011 or `null` and likewise for the other years which is 2010 and 2012. Right now the problem is when i select...
2011/09/02
[ "https://Stackoverflow.com/questions/7283633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/900746/" ]
For our application, we use bit shuffle to generate the ID. It is very easy to reverse back to the original ID. ``` func (m Meeting) MeetingCode() uint { hashed := (m.ID + 10000000) & 0x00FFFFFF chunks := [24]uint{} for i := 0; i < 24; i++ { chunks[i] = hashed >> i & 0x1 } shuffle := [24]ui...
There is an exceedingly simple solution that none have posted, even though an answer has been selected I highly advise any visiting this question to consider the nature of binary representations, and the application of modulos arithmetic. Given an finite range of integers, all the values can be permuted in any order t...
2,643,908
**Input**: A 2-dimensional array NxN - Matrix - with positive and negative elements. **Output**: A submatrix of any size such that its summation is the maximum among all possible submatrices. **Requirement**: Algorithm complexity to be of **O(N^3)** **History:** With the help of the Algorithmist, Larry and a mod...
2010/04/15
[ "https://Stackoverflow.com/questions/2643908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/317274/" ]
With the help of the [Algorithmist](http://www.algorithmist.com/index.php/UVa_108) and Larry and a modification of Kadane's Algorithm, here is my solution: ``` int dim = matrix.length; //computing the vertical prefix sum for columns int[][] ps = new int[dim][dim]; for (int i = 0; i < dim; i++) { fo...
Have a look at [JAMA](http://math.nist.gov/javanumerics/jama/ "JAMA") package; I believe it will make your life easier.
2,643,908
**Input**: A 2-dimensional array NxN - Matrix - with positive and negative elements. **Output**: A submatrix of any size such that its summation is the maximum among all possible submatrices. **Requirement**: Algorithm complexity to be of **O(N^3)** **History:** With the help of the Algorithmist, Larry and a mod...
2010/04/15
[ "https://Stackoverflow.com/questions/2643908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/317274/" ]
Have a look at [JAMA](http://math.nist.gov/javanumerics/jama/ "JAMA") package; I believe it will make your life easier.
I would just parse the NxN array removing the -ves whatever remains is the highest sum of a sub matrix. The question doesn't say you have to leave the original matrix intact or that the order matters.
2,643,908
**Input**: A 2-dimensional array NxN - Matrix - with positive and negative elements. **Output**: A submatrix of any size such that its summation is the maximum among all possible submatrices. **Requirement**: Algorithm complexity to be of **O(N^3)** **History:** With the help of the Algorithmist, Larry and a mod...
2010/04/15
[ "https://Stackoverflow.com/questions/2643908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/317274/" ]
About recovering the actual submatrix, and not just the maximum sum, here's what I got. Sorry I do not have time to translate my code to your java version, so I'm posting my Ruby code with some comments in the key parts ```rb def max_contiguous_submatrix_n3(m) rows = m.count cols = rows ? m.first.count : 0 vps ...
this is my implementation of 2D Kadane algorithm. I think it is more clear. The concept is based on just kadane algorithm. The first and second loop of the main part (that is in the bottom of the code) is to pick every combination of the rows and 3rd loop is to use 1D kadane algorithm by every following column sum (tha...
2,643,908
**Input**: A 2-dimensional array NxN - Matrix - with positive and negative elements. **Output**: A submatrix of any size such that its summation is the maximum among all possible submatrices. **Requirement**: Algorithm complexity to be of **O(N^3)** **History:** With the help of the Algorithmist, Larry and a mod...
2010/04/15
[ "https://Stackoverflow.com/questions/2643908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/317274/" ]
About recovering the actual submatrix, and not just the maximum sum, here's what I got. Sorry I do not have time to translate my code to your java version, so I'm posting my Ruby code with some comments in the key parts ```rb def max_contiguous_submatrix_n3(m) rows = m.count cols = rows ? m.first.count : 0 vps ...
Here is my solution. It's O(n^3) in time and O(n^2) space. <https://gist.github.com/toliuweijing/6097144> ``` // 0th O(n) on all candidate bottoms @B. // 1th O(n) on candidate tops @T. // 2th O(n) on finding the maximum @left/@right match. int maxRect(vector<vector<int> >& mat) { int n = mat.size(); ...
2,643,908
**Input**: A 2-dimensional array NxN - Matrix - with positive and negative elements. **Output**: A submatrix of any size such that its summation is the maximum among all possible submatrices. **Requirement**: Algorithm complexity to be of **O(N^3)** **History:** With the help of the Algorithmist, Larry and a mod...
2010/04/15
[ "https://Stackoverflow.com/questions/2643908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/317274/" ]
Here's an explanation to go with the posted code. There are two key tricks to make this work efficiently: (I) Kadane's algorithm and (II) using prefix sums. You also need to (III) apply the tricks to the matrix. **Part I: Kadane's algorithm** Kadane's algorithm is a way to find a contiguous subsequence with maximum s...
With the help of the [Algorithmist](http://www.algorithmist.com/index.php/UVa_108) and Larry and a modification of Kadane's Algorithm, here is my solution: ``` int dim = matrix.length; //computing the vertical prefix sum for columns int[][] ps = new int[dim][dim]; for (int i = 0; i < dim; i++) { fo...
2,643,908
**Input**: A 2-dimensional array NxN - Matrix - with positive and negative elements. **Output**: A submatrix of any size such that its summation is the maximum among all possible submatrices. **Requirement**: Algorithm complexity to be of **O(N^3)** **History:** With the help of the Algorithmist, Larry and a mod...
2010/04/15
[ "https://Stackoverflow.com/questions/2643908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/317274/" ]
Have a look at [JAMA](http://math.nist.gov/javanumerics/jama/ "JAMA") package; I believe it will make your life easier.
Here is my solution. It's O(n^3) in time and O(n^2) space. <https://gist.github.com/toliuweijing/6097144> ``` // 0th O(n) on all candidate bottoms @B. // 1th O(n) on candidate tops @T. // 2th O(n) on finding the maximum @left/@right match. int maxRect(vector<vector<int> >& mat) { int n = mat.size(); ...
2,643,908
**Input**: A 2-dimensional array NxN - Matrix - with positive and negative elements. **Output**: A submatrix of any size such that its summation is the maximum among all possible submatrices. **Requirement**: Algorithm complexity to be of **O(N^3)** **History:** With the help of the Algorithmist, Larry and a mod...
2010/04/15
[ "https://Stackoverflow.com/questions/2643908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/317274/" ]
There are already plenty of answers, but here is another Java implementation I wrote. It compares 3 solutions: 1. Naïve (brute force) - O(n^6) time 2. The obvious DP solution - O(n^4) time and O(n^3) space 3. The more clever DP solution based on Kadane's algorithm - O(n^3) time and O(n^2) space There are sample runs ...
I am going to post an answer here and can add actual c++ code if it is requested because I had recently worked through this. Some rumors of a divide and conqueror that can solve this in O(N^2) are out there but I haven't seen any code to support this. In my experience the following is what I have found. ``` O(i^3j...
2,643,908
**Input**: A 2-dimensional array NxN - Matrix - with positive and negative elements. **Output**: A submatrix of any size such that its summation is the maximum among all possible submatrices. **Requirement**: Algorithm complexity to be of **O(N^3)** **History:** With the help of the Algorithmist, Larry and a mod...
2010/04/15
[ "https://Stackoverflow.com/questions/2643908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/317274/" ]
There are already plenty of answers, but here is another Java implementation I wrote. It compares 3 solutions: 1. Naïve (brute force) - O(n^6) time 2. The obvious DP solution - O(n^4) time and O(n^3) space 3. The more clever DP solution based on Kadane's algorithm - O(n^3) time and O(n^2) space There are sample runs ...
Here is a Java version of Ernesto implementation with some modifications: ```java public int[][] findMaximumSubMatrix(int[][] matrix){ int dim = matrix.length; //computing the vertical prefix sum for columns int[][] ps = new int[dim][dim]; for (int i = 0; i < dim; i++) { for (int j = 0; j < dim...
2,643,908
**Input**: A 2-dimensional array NxN - Matrix - with positive and negative elements. **Output**: A submatrix of any size such that its summation is the maximum among all possible submatrices. **Requirement**: Algorithm complexity to be of **O(N^3)** **History:** With the help of the Algorithmist, Larry and a mod...
2010/04/15
[ "https://Stackoverflow.com/questions/2643908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/317274/" ]
There are already plenty of answers, but here is another Java implementation I wrote. It compares 3 solutions: 1. Naïve (brute force) - O(n^6) time 2. The obvious DP solution - O(n^4) time and O(n^3) space 3. The more clever DP solution based on Kadane's algorithm - O(n^3) time and O(n^2) space There are sample runs ...
Here is my solution. It's O(n^3) in time and O(n^2) space. <https://gist.github.com/toliuweijing/6097144> ``` // 0th O(n) on all candidate bottoms @B. // 1th O(n) on candidate tops @T. // 2th O(n) on finding the maximum @left/@right match. int maxRect(vector<vector<int> >& mat) { int n = mat.size(); ...
2,643,908
**Input**: A 2-dimensional array NxN - Matrix - with positive and negative elements. **Output**: A submatrix of any size such that its summation is the maximum among all possible submatrices. **Requirement**: Algorithm complexity to be of **O(N^3)** **History:** With the help of the Algorithmist, Larry and a mod...
2010/04/15
[ "https://Stackoverflow.com/questions/2643908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/317274/" ]
Here is a Java version of Ernesto implementation with some modifications: ```java public int[][] findMaximumSubMatrix(int[][] matrix){ int dim = matrix.length; //computing the vertical prefix sum for columns int[][] ps = new int[dim][dim]; for (int i = 0; i < dim; i++) { for (int j = 0; j < dim...
this is my implementation of 2D Kadane algorithm. I think it is more clear. The concept is based on just kadane algorithm. The first and second loop of the main part (that is in the bottom of the code) is to pick every combination of the rows and 3rd loop is to use 1D kadane algorithm by every following column sum (tha...
43,981,369
I have 2 dictionaries the first one has a key that are match multiple duplicate values in the second one: ``` var firstDic = new Dictionary<string, string>(); firstDic.Add("123", "Value1"); firstDic.Add("456", "Value2"); firstDic.Add("789", "Value3"); firstDic.Add("000", "Value4"); var secondDic = new Dictionary<stri...
2017/05/15
[ "https://Stackoverflow.com/questions/43981369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6832396/" ]
Then you don't need to use `FirstOrDefault()`, just use the `Where()` which will return a collection back : ``` var myKeys = secondDic.Where(x => x.Value == item.Key); ``` and then you can iterate over it: ``` foreach(var item in myKeys) { } ``` or do whatever business logic needs to be applied.
This may help ``` var result = secondDic.Where(s => firstDic.Any(f => f.Key == s.Value)) .Select(s => s.Key) .ToList(); ```
10,538,747
Is it a simple way to compare is field of TIMESTAMP type get into last **n** hours? I can do the calculation based on the day and time, but is it possible something like ``` timestamp > SYSDATE - 1 ``` (SYSDATE - 1) is yesterday, as far as understand, so that will check if timestamp is within the last 24 hours. Th...
2012/05/10
[ "https://Stackoverflow.com/questions/10538747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/766022/" ]
You can use like ``` timestamp > to_timestamp(sysdate-1) ```
You can do this: timestamp > cast(sysdate-1 as timestamp)
10,538,747
Is it a simple way to compare is field of TIMESTAMP type get into last **n** hours? I can do the calculation based on the day and time, but is it possible something like ``` timestamp > SYSDATE - 1 ``` (SYSDATE - 1) is yesterday, as far as understand, so that will check if timestamp is within the last 24 hours. Th...
2012/05/10
[ "https://Stackoverflow.com/questions/10538747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/766022/" ]
You can add/subtract non-integers too, e.g.: ``` SELECT SYSDATE - 0.5 FROM dual; ``` means 12 hours before now.
You can do this: timestamp > cast(sysdate-1 as timestamp)