text:
Q: How to Customize the lead in MS CRM 2011? I configured microsoft dynamics crm 2011 in my outlook express 2010.before that i was use the trial version.In that trail version i use customize for lead which is comes under the sales.But i configure with outlook after that i cant find the Customization button.How to enable the customization button in CRM tool bar or how to customize the lead form in crm?
Thanks in Advance

A: The customisations ribbon tab will only show if you have the "System Customizer" security role. You should also be able to access it via the Settings module, then Solutions.

A: It's supposed to be at Settings > Customizations > Customize the System. A new window will pop up. There, you go Entities > Lead > whatever-you-need-to-customize.
May I also suggest that prior to that, you'll create a solution (which involves creating a solution provided)? It may seem as an unnecessary step but will pay off in the long run. You'll be able to package your changes and distribute then easier.
Straight off, I can think of two gotchas, though. In order to customize, you'll need to:

*

*set the current language to base language,

*make sure that the current user has appropriate permissions

*enable customization of custom entities (doesn't apply to Lead, though)

A: Open an individual Lead record - do you see the Customise Ribbon tab there? If so, that's your answer. If not, it seems your role is not system customiser or system administrator.


text:
Q: openvswitch stt and geneve The openvswitch 2.4 states that it has support for STT and Geneve tunneling but I do not see any example/sample that shows the configuration commands.
For GRE/VXLAN: http://networkstatic.net/configuring-vxlan-and-gre-tunnels-on-openvswitch/ or http://www.ran-lifshitz.com/2014/08/24/tunneling-and-network-virtualization-nvgre-vxlan/
For STT : ??
For Geneve : ??
Can someone please provide the configuration details for stt/geneve on openvswitch ?
Thanks
PS: Newbie here, please point me to the right answer if this question has already been asked/answered although I did try to find before posting.

A: Here is tutorial that explains how to set up GRE tunneling - http://openvswitch.org/support/config-cookbooks/port-tunneling/.
Once you have verified that GRE works in your environment simply change type column in Interface table for the respective tunnel Interface to STT or Geneve method:
ovs-vsctl set Interface theTunnelInterface type=stt

To use STT or Geneve you also need to make sure that you have the right kernel module loaded that supports particular tunneling method. This is the reason I would suggest you to get GRE working first and then change to STT or Geneve.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Login Access via VBA macro to website with restricted source code My overall goal is to login to a website and download a specific link located on that page -- all of this through a VBA macro.
However, with this particular website, I cannot even view the source code of the page to look at the username/password variables, as was recommended here:
http://www.exceltrainingvideos.com/how-to-login-automatically-into-website-using-excel-vba/
This is what the webpage looks like:

I am not able to view the source code because as you can see, I see nothing back from the server until authenticated.
I have functional code to open up the browser. Just not to login.
Sub OpenInFireFoxNewTab(url As String)
  Dim pathFireFox As String
  '
  pathFireFox = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
  If Dir(pathFireFox) = "" Then pathFireFox = "C:\Program Files\Mozilla Firefox\firefox.exe"
  If Dir(pathFireFox) = "" Then
    MsgBox "FireFox Path Not Found", vbCritical, "Macro Ending"
    Exit Sub
  End If
  Shell """" & pathFireFox & """" & " -new-tab " & url, vbHide

  ' use sendKeys to send an enter acceptance
  Application.SendKeys "~", True
End Sub

I am using Mozilla because our server doesnt have an https security certificate (which came up on IE), so Mozilla was a work around.
How can I still login using VBA?
EDIT: It opens up the page, asks do you want to confirm login (prompts for pressing OK), but then never sends the OK command. Im trying to currently debug and familiarize myself with this VBA debugger.
EDIT #2: Changed sendkeys to just send a "~" with no variable. Now its moving down one row in the excel sheet, instead of pressing enter on the Mozilla window.

A: try something like this
processId = Shell("""" & pathFireFox & """" & " -new-tab " & url, vbHide)
AppActivate processId

Application.SendKeys "~", True

Update
Modern browsers use multiple processes, so I was probably a bit naive thinking that the tab process id would be the same as the starting firefox process id.
AppActivate works even with part of the window title so for Example
Shell """" & pathFireFox & """" & " -new-instance " & url
Application.Wait(Now + #0:00:05#)  ' wait few seconds for the page to load ?
AppActivate "Au"  ' example if the window title is "Authentication Required"
Application.SendKeys "~", True

Selenium is popular for browser automation and they have Selenium IDE Firefox extension that can record your actions and convert them to code. Surprisingly they support VBA too :
http://www.makeuseof.com/tag/how-to-automate-firefox-or-chrome-with-vba-and-selenium/
https://addons.mozilla.org/en-US/firefox/addon/selenium-ide-vbavbs-formatt/


text:
Q: Excel If/Then to replace text I am somewhat new to Excel, and I am not sure if I need a formula or a macro to accomplish this task.
I need to find all instances of "Jane Smith" and replace it with her employeeID, lets say its 513.
Names only appear in column A, and there may be more than one instance, so I need to search all cells under column A. I need to do this for multiple employees, so I'm guessing it a large If/Then/Else. Thanks!

A: If the name is the only text in the cell then you could look into the VLOOKUP formula.

A: Umm try this:
Sub Test()
    Dim empVal As Range
    Dim employee As String: employee = "Jane Smith"
    Dim replaceStr As String: replaceStr = "513"
    Do While Not empVal Is Nothing
    Set empVal = activSheet.Columns(1).Find(What:=employee, LookIn:=xlValues, _
                    LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
                    MatchCase:=False, SearchFormat:=False)
        If Not empVal Is Nothing Then empVal = replaceStr
    Loop
End Sub

this tries to search every possible match of "Jane Smith" and replaces it with her employeeID

A: If you are new to excel, you are not looking for a VBA solution as answered elsewhere.
The easiest way.....if you just want to replace "Jane Smith" to "513", what about this:
1.  Go to cell A1
2.  Ctrl +  Spacebar (to highlight column A)
3.  Ctrl + H (opens find/replace window)
4.  Put in "Jane Smith" in find and "513" in replace.
If you only have a few to do, this is the way to go.
If you want to use formulas to do this the right way, this is what you want:
1)  Create a new tab with 2 columns.  In column A, put all your employee names.  In column B, put the corresponding employee number.  If you have 10 employees, the table will run from A1 to B10.  Double click on the tab to name it "tab2"
2) In your current tab or file, go to cell A1 and insert a column (Alt + I + C).  Now you have a new blank column A and all the names are now in column B.  Let's say the first name starts on row 5, after all the heading stuff.  So your first name is in cell B5 hypothetically.
3)  In the new blank column A, in cell A5, use this formula:
=VLOOKUP(B5,'tab2'!$A$1:$B$10,2,0)

This formula will lookup in 'tab2' across cells A1-B10, to find what you linked in cell B5, which would be a name like "Jane Smith".  It will find this data in tab2, column A and look in the 2nd column.  The zero at the ends just tells the formula to use exact results only.
--If you wanted the numbers to stay in the new column B, there are many ways to do this, for instance, insert new column A, copy column B to column A, then write the vlookup formula in column B, looking off column A.  But this should get you started.


text:
Q: Is there a proof system for first order logic that does not use premisses and auxiliary variables? Before I have started to learn proof theory for first order logic I had the following simple (and maybe naive) expectations:

*

*We can use formal language (first order logic) to formulate expressions (statements).

*We formulate several statements that we accept without a proof (axioms).

*We have a small set of "derivation rules". A derivation rule is something that can take one or two statements and generate one (or none or several) statements that follow from the input statement(s). One example might be a rule that is based on commutativity of "and  (A and B = B and A). So, we can take an expression containing "and" and change places of two "inputs" of this binary function. A new statement should not be equivalent to the input statements. It just need to follow from input. For example: A and B -> B.

So, within this approach we can start from axioms and by applying different derivation rules we can generate new statements some of which might be useful theorems.

So far I have learned sequent calculus and Hilbert's system. Hilbert's system looks closer to what I expected / wanted but it is still not the same because of several reasons:

*

*In a proof we start from axioms and premisses (assumptions). And I want any proof to use only axioms and statements that have been proved earlier (so, no assumptions).

*In a proof we use "introductions" (universal and existential). As a result we get some "intermediate / auxiliary" formula that are not valid statements by themselves. You cannot take these statements and claim that they are some lemmas or theorems because they contain some "variables" (till the end of the proof we need to get rid of them).

So, my question is, if there is a proof system that I have naively imagined (without use of premisses and in which any statement generated in the proof is a "valid" statement that can be used as a theorem).

A: I think a typical Hilbert system is what you are looking for.
If you see premises being used, then there are probably two reasons for this:

*

*The proof uses a premise that may have been derived as a Lemma in some earlier proof. As such, we can in fact substitute those earlier proofs and get rid of those premises, and obtain a premise-free proof.

*The proof is about some domain, e.g. set theory or arithmetic or what have you. Since he theorems in those domains are not logical theorems, they have to rely on premises: axioms for those specific domains. So in that case you cannot get rid of the premises ... but that's only because you are trying to prove something beyond pure logic
Now, you also say that some proofs have lines/statements with free variables that, as such, aren't really claims by themselves. But actually, you can regard those statements as claims: any expression of the logic language requires some interpretation, and you can simply make the variable assignment part of the interpretation. As such, every line is a logically valid statement.
But if you really don't like the use of these variables, note that we can also use constants instead of the variables. The universal introduction rule can take a statement using constants and make it into a universal statement provided the use of that constant in the proof as a whole satisfies certain restrictions ... restrictions that of course make the constant really act like a variable and thus there is really no practical difference here .... but still, maybe you find this more palatable.


text:
Q: How to delete draft message using gamil api? I am using API
 var request = gapi.client.gmail.users.drafts.delete({
    'userId': userId,
    'id': draftId
  });
  request.execute(function(resp) { });
always getting error
 "domain": "global",
    "reason": "notFound",
    "message": "Not Found"


text:
Q: Маршрут через несколько точек (маркеров) google maps java Всем привет!
Есть три маркера, через которые я пытаюсь проложить маршрут. Прокладываю маршрут от marker1 до marker2 и рисую polyline так:
SupportMapFragment supportMapFragment
supportMapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.googleMap);

supportMapFragment.getMapAsync(new OnMapReadyCallback()
{
    @SuppressLint("MissingPermission")
    @Override
    public void onMapReady(final GoogleMap googleMap)
    {
        googleMap.setMyLocationEnabled(true);
        googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);

        CameraPosition cameraPosition = new CameraPosition.Builder().target(new LatLng(56.31346627, 43.99070621)).zoom(17).bearing(0).tilt(0).build();
        CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(cameraPosition);
        googleMap.moveCamera(cameraUpdate);

        Marker marker = googleMap.addMarker(new MarkerOptions().position(new LatLng(56.31346627, 43.99070621)).title("1").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)).snippet("Start"));

        Marker marker2 = googleMap.addMarker(new MarkerOptions().position(new LatLng(56.31832176, 43.99624228)).title("2"));
        marker2.setSnippet("Второй");

        Marker marker3 = googleMap.addMarker(new MarkerOptions().position(new LatLng(56.32190348, 44.00031924)).title("3").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)).snippet("Finish"));

        com.google.maps.model.LatLng destinationMarker = new com.google.maps.model.LatLng(marker2.getPosition().latitude, marker2.getPosition().longitude);

        DirectionsApiRequest directions = new DirectionsApiRequest(geoApiContext).mode(TravelMode.WALKING);
        directions.origin(new com.google.maps.model.LatLng(marker.getPosition().latitude, marker.getPosition().longitude));

        directions.destination(destinationMarker).setCallback(
                new PendingResult.Callback<DirectionsResult>()
                {
                    @Override
                    public void onResult(DirectionsResult result)
                    {
                        new Handler(Looper.getMainLooper()).post(() ->
                        {
                            for (DirectionsRoute route: result.routes)
                            {
                                List<com.google.maps.model.LatLng> decodedPath = PolylineEncoding.decode(route.overviewPolyline.getEncodedPath());
                                List<LatLng> newDecodedPath = new ArrayList<>();

                                for (com.google.maps.model.LatLng latLng: decodedPath)
                                {
                                    newDecodedPath.add(new LatLng(latLng.lat, latLng.lng));
                                }

                                Polyline polyline = googleMap.addPolyline(new PolylineOptions().addAll(newDecodedPath));
                                polyline.setColor(ContextCompat.getColor(FullMapActivity.this, R.color.colorBlack));
                            }
                        });
                    }

                    @Override
                    public void onFailure(Throwable e)
                    {
                        Log.d("ROUTES", "onFailure: " + e.getMessage());
                    }
                });
    }
});

Судя по докам для прокладывания маршрута через большее количество точек, нужно добавлять waypoints. В интернете нашёл только примеры добавления через json строку.
Подскажите, можно ли с DirectionsApiRequest проложить маршрут больше, чем через две точки?

A: Методом тыка:
directions.waypoints(new com.google.maps.model.LatLng(marker2.getPosition().latitude, marker2.getPosition().longitude));


text:
Q: How to randomly select HEX colors in MySQL but avoid a specific color range? THE BACKGROUND
I am using a MySQL database to store data which I retrieve in data visualization on my website. Two out of ~800 items are of main interest in my visualization and will have a specific color code assigned to them (dark and light orange) inside a bar chart. Filters are used for the visualization, so each time a different set of items could be visible, but the 2 main items should always stick out (if existent after the filter).
DESIRED SOLUTION
I want to achieve both

*

*A colorful bar chart

*easy visual recognition of the two main items by avoiding similar colors in the chart

MY CURRENT SOLUTIONS
One way might be to just create a random set of hex colors, manually (or semi-automatically) change all colors of items that have a similar color code to those of the two main items and store it as a list to be retrieved. And for now, that would be my strategy...
But I would really like to have an automated way which would just create random hex codes, but avoid a specific color range (in my case everything orange).
I know already how to randomly create a hex code:
concat('#',SUBSTRING((lpad(hex(round(rand() * 10000000)),6,0))
Now the next step would be the avoidance of the orange color scheme.
MY QUESTION
Any ideas on how to achieve this inside a SELECT statement?
SELECT
   item,
   concat('#',SUBSTRING((lpad(hex(round(rand() * 10000000)),6,0)) as color --THIS SHOULD CHANGE
   FROM item_list

A: This is more a javascript solution, but its generates the same color for strings rather then random everytime.
// this requires tiny color // https://github.com/bgrins/TinyColor
let
    MD5=function(a){function b(a,b){var c,d,e,f,g;return e=2147483648&a,f=2147483648&b,c=1073741824&a,d=1073741824&b,g=(1073741823&a)+(1073741823&b),c&d?2147483648^g^e^f:c|d?1073741824&g?3221225472^g^e^f:1073741824^g^e^f:g^e^f}function c(a,c,d,e,f,g,h){return a=b(a,b(b(c&d|~c&e,f),h)),b(a<<g|a>>>32-g,c)}function d(a,c,d,e,f,g,h){return a=b(a,b(b(c&e|d&~e,f),h)),b(a<<g|a>>>32-g,c)}function e(a,c,d,e,f,g,h){return a=b(a,b(b(c^d^e,f),h)),b(a<<g|a>>>32-g,c)}function f(a,c,d,e,f,g,h){return a=b(a,b(b(d^(c|~e),f),h)),b(a<<g|a>>>32-g,c)}function g(a){var d,b="",c="";for(d=0;3>=d;d++)c=a>>>8*d&255,c="0"+c.toString(16),b+=c.substr(c.length-2,2);return b}var i,j,k,l,m,n,o,p,h=[];for(a=function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);128>d?b+=String.fromCharCode(d):(127<d&&2048>d?b+=String.fromCharCode(d>>6|192):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128)),b+=String.fromCharCode(63&d|128))}return b}(a),h=function(a){var b,c=a.length;b=c+8;for(var d=16*((b-b%64)/64+1),e=Array(d-1),f=0,g=0;g<c;)b=(g-g%4)/4,f=g%4*8,e[b]|=a.charCodeAt(g)<<f,g++;return b=(g-g%4)/4,e[b]|=128<<g%4*8,e[d-2]=c<<3,e[d-1]=c>>>29,e}(a),m=1732584193,n=4023233417,o=2562383102,p=271733878,a=0;a<h.length;a+=16)i=m,j=n,k=o,l=p,m=c(m,n,o,p,h[a+0],7,3614090360),p=c(p,m,n,o,h[a+1],12,3905402710),o=c(o,p,m,n,h[a+2],17,606105819),n=c(n,o,p,m,h[a+3],22,3250441966),m=c(m,n,o,p,h[a+4],7,4118548399),p=c(p,m,n,o,h[a+5],12,1200080426),o=c(o,p,m,n,h[a+6],17,2821735955),n=c(n,o,p,m,h[a+7],22,4249261313),m=c(m,n,o,p,h[a+8],7,1770035416),p=c(p,m,n,o,h[a+9],12,2336552879),o=c(o,p,m,n,h[a+10],17,4294925233),n=c(n,o,p,m,h[a+11],22,2304563134),m=c(m,n,o,p,h[a+12],7,1804603682),p=c(p,m,n,o,h[a+13],12,4254626195),o=c(o,p,m,n,h[a+14],17,2792965006),n=c(n,o,p,m,h[a+15],22,1236535329),m=d(m,n,o,p,h[a+1],5,4129170786),p=d(p,m,n,o,h[a+6],9,3225465664),o=d(o,p,m,n,h[a+11],14,643717713),n=d(n,o,p,m,h[a+0],20,3921069994),m=d(m,n,o,p,h[a+5],5,3593408605),p=d(p,m,n,o,h[a+10],9,38016083),o=d(o,p,m,n,h[a+15],14,3634488961),n=d(n,o,p,m,h[a+4],20,3889429448),m=d(m,n,o,p,h[a+9],5,568446438),p=d(p,m,n,o,h[a+14],9,3275163606),o=d(o,p,m,n,h[a+3],14,4107603335),n=d(n,o,p,m,h[a+8],20,1163531501),m=d(m,n,o,p,h[a+13],5,2850285829),p=d(p,m,n,o,h[a+2],9,4243563512),o=d(o,p,m,n,h[a+7],14,1735328473),n=d(n,o,p,m,h[a+12],20,2368359562),m=e(m,n,o,p,h[a+5],4,4294588738),p=e(p,m,n,o,h[a+8],11,2272392833),o=e(o,p,m,n,h[a+11],16,1839030562),n=e(n,o,p,m,h[a+14],23,4259657740),m=e(m,n,o,p,h[a+1],4,2763975236),p=e(p,m,n,o,h[a+4],11,1272893353),o=e(o,p,m,n,h[a+7],16,4139469664),n=e(n,o,p,m,h[a+10],23,3200236656),m=e(m,n,o,p,h[a+13],4,681279174),p=e(p,m,n,o,h[a+0],11,3936430074),o=e(o,p,m,n,h[a+3],16,3572445317),n=e(n,o,p,m,h[a+6],23,76029189),m=e(m,n,o,p,h[a+9],4,3654602809),p=e(p,m,n,o,h[a+12],11,3873151461),o=e(o,p,m,n,h[a+15],16,530742520),n=e(n,o,p,m,h[a+2],23,3299628645),m=f(m,n,o,p,h[a+0],6,4096336452),p=f(p,m,n,o,h[a+7],10,1126891415),o=f(o,p,m,n,h[a+14],15,2878612391),n=f(n,o,p,m,h[a+5],21,4237533241),m=f(m,n,o,p,h[a+12],6,1700485571),p=f(p,m,n,o,h[a+3],10,2399980690),o=f(o,p,m,n,h[a+10],15,4293915773),n=f(n,o,p,m,h[a+1],21,2240044497),m=f(m,n,o,p,h[a+8],6,1873313359),p=f(p,m,n,o,h[a+15],10,4264355552),o=f(o,p,m,n,h[a+6],15,2734768916),n=f(n,o,p,m,h[a+13],21,1309151649),m=f(m,n,o,p,h[a+4],6,4149444226),p=f(p,m,n,o,h[a+11],10,3174756917),o=f(o,p,m,n,h[a+2],15,718787259),n=f(n,o,p,m,h[a+9],21,3951481745),m=b(m,i),n=b(n,j),o=b(o,k),p=b(p,l);return(g(m)+g(n)+g(o)+g(p)).toLowerCase()},
    c = tinycolor(MD5('your title or something').substr(0,6)),
    hsv = c.toHsv();

if (hsv.h >= 16 && hsv.h <= 52) c.spin(100);
let desired_hex = c.toString();


text:
Q: Can contents of Keytab file be stored and used from Azure Key vault? I have a keytab file used for authentication when trying to connect from Azure Kubernetes Cluster to On-prem hadoop nodes.
Can I store keytab contents in Azure Key vault and read it back?

A: Technically, you should be able to. It's not implemented out of the box but you could shoe horn it in.  You'd have translate back and forth to unicode using the keytab as a secret.  You'd still need to create it as a file, and that reverts back to protecting it by permission, and then cleaning it up after your done.  So out of the box it's likely possible but there's a lot of extra manual management.


text:
Q: R - tidyverse approach to split a dataframe by columns and keep a set of common columns My question is very similar to this one, but I would prefer to have a tidyverse approach.
I have a dataset with several columns and I want to split it columnwise (not rowwise!), but keep a list of common columns in every dataset. To illustrate this, I will use the iris dataset, and let's say that Species is the common column that I want to keep.
It would be really easy to do it using just these simple operations:
iris1 <- iris[,c("Species", "Sepal.Width")]
iris2 <- iris[,c("Species", "Sepal.Length")]
iris3 <- iris[,c("Species", "Petal.Width")]
iris4 <- iris[,c("Species", "Petal.Length")]

So I want to achieve the same output as that, but in a tidyverse style and usable in a pipeline without breaking it.

A: One approach could be to make a function that extracts from iris the Species and the column (number or name) of your choice, then map those column numbers into your function.
library(dplyr)
make_df <- function(col) { iris %>% select(Species, {{ col }} )}
c(2,1,4,3) %>% purrr::map(make_df)

or as one line:
c(2,1,4,3) %>% map(~iris %>% select(Species, {{ .x }}))

This will output a list with four elements, each of which is a data frame like you describe. For many workflows that will be safer and more convenient than creating four free-floating data frames in the global environment.
c(2,1,4,3) %>% map(make_df) %>% map(head)

[[1]]
  Species Sepal.Width
1  setosa         3.5
2  setosa         3.0
3  setosa         3.2
4  setosa         3.1
5  setosa         3.6
6  setosa         3.9

[[2]]
  Species Sepal.Length
1  setosa          5.1
2  setosa          4.9
3  setosa          4.7
4  setosa          4.6
5  setosa          5.0
6  setosa          5.4

[[3]]
  Species Petal.Width
1  setosa         0.2
2  setosa         0.2
3  setosa         0.2
4  setosa         0.2
5  setosa         0.2
6  setosa         0.4

[[4]]
  Species Petal.Length
1  setosa          1.4
2  setosa          1.4
3  setosa          1.3
4  setosa          1.5
5  setosa          1.4
6  setosa          1.7


text:
Q: Heatmap Between Start and End Times I have a list of event space rentals and the time and date when they occur (e.g. Start: Mar 1 - 9 am, End: Mar 1 - 10 am). I'm trying to create a "heatmap" in Excel/Google Sheets so I can find out how often an event is booked at each half-hour historically.
I'm trying to answer the question, "how often is the space rented from 9 am - 9:30 am on Sundays." But extend that to every half-hour block across every day of the week. Then I will use some conditional formatting to create the heatmap by doing a gradient.
            S   M   T   W   T   F   S
9:00 AM     X   X   X   X   X   X   X
9:30 AM     X   X   X   X   X   X   X
10:00 AM    X   X   X   X   X   X   X
10:30 AM    X   X   X   X   X   X   X

In the example above, I would like to have a row for each half hour (e.g. 9 am, 9:30 am, 10 am, etc.) and a column with the day of the week (e.g. Sunday, Monday, Tuesday, etc.). Inside the table, I would like to find a formula to replace the Xs to count the number of times that space is rented for an event at that time and day of the week. If it's rented twice from 9 am to 9:30 am on Sunday, then the X would be a 2.
I tried the following formula but it's not quite calculating things correctly.
=COUNTIFS($N:$N,">="&$A2,$O:$O,"<"&$A3,$P:$P,"="&B$1)

In this example/formula above, the table with the raw data looks like this:
Column N      Column O
Start Time    End Time
6:00:00 PM    10:00:00 PM
11:30:00 AM   1:30 PM
8:00:00 PM    8:30 PM
5:30:00 PM    6:00 PM
6:00:00 PM    8:00 PM

*

*A2 = 9:00 AM

*A3 = 9:30 AM

*B1 = Sunday

A: paste in F1 cell, drag to the right and then drag down:
=COUNTA(IFERROR(FILTER($A$2:$A, $E2 >= $B$2:$B,
                                $E2 <= $C$2:$C,
                                F$1  = TEXT($A$2:$A, "ddd"))))


text:
Q: How do I call a Fn parameter for a trait function from another asynchronous function? I am using this library to implement a jsonrpc server: https://github.com/paritytech/jsonrpc.
There is a way to implement a trait and use it as middleware for the server.
The function in the trait looks like:
fn on_request<F, X>(&self, request: Request, meta: M, next: F) -> Either<Self::Future, X>
    where
        F: Fn(Request, M) -> X + Send + Sync,
        X: Future<Output = Option<Response>> + Send + 'static,
    {
}

In this function I can return a Future for a response immediately, or I can call the "next" Fn to move on to the next layer of the server.
I would like the decision of responding in the middleware vs. sending it to the next layer to be an decided asynchronously.
I have done this (simpified for this question):
pub struct SampleMiddleware;
impl Middleware<Meta> for SampleMiddleware {
    type Future = FutureResponse;
    type CallFuture = middleware::NoopCallFuture;

    fn on_request<F, X>(&self, request: Request, meta: Meta, next: F) -> Either<Self::Future, X>
    where
        F: FnOnce(Request, Meta) -> X + Send,
        X: Future<Output = Option<Response>> + Send + 'static,
    {
        Either::Left(Box::pin(SampleMiddleware::process_async(request, meta, next)))
    }
}

impl SampleMiddleware {
    async fn process_async<F, X>(req: Request, meta: Meta, next: F) -> Option<Response>
    where
        F: FnOnce(Request, Meta) -> X + Send,
        X: Future<Output = Option<Response>> + Send + 'static,
    {
        let result = SampleMiddleware::async_fn(&req, &meta).await;
        match result {
            Some(r) => {
                Some(r)
            },
            None => {
                next(req, meta).await
            }
        }
    }

    async fn async_fn(req: &Request, meta: &Meta) -> Option<Response>
    {
        return None
    }
}

However on this line:Either::Left(Box::pin(SampleMiddleware::process_async(request, meta, next)))
I get this error from the compiler:
the parameter type `F` may not live long enough
...so that the type `impl futures::Future<Output = std::option::Option<jsonrpc_core::Response>>` will meet its required lifetime bounds
consider adding an explicit lifetime bound...: `F: 'static`

I don't think I can change the lifetime bound to F because that comes from the trait I don't control.
I am pretty new to Rust and haven't quite wrapped my head around how to use lifetimes.
I think this question might boil down to how I can call a FnOnce in another thread, but not sure.


text:
Q: Count posts that include the current users email in a meta field I was hoping someone could please assist with my below code. I have a field called pds_project_manager and it contains the email address of my users assigned to projects(posts), I am wanting to count the number of posts that have the field with the current users email in it. The below code works, but if there is more than just the current users email address in the field pds_project_manager it ignores it and does note count it. The field will often have multiple email addresses in it.
$current_user = wp_get_current_user();
$display_name = $current_user->display_name;

$args_pm = array(//number of posts by pm
  'posts_per_page' => -1,
  'post_type' => 'project',
  'meta_query' => array(
            'relation' => 'AND',
    array(
        'key'   => 'status',
        'value' => '1'
    ),
    array(
        'key'   => 'pds_project_manager',
        'value' => $current_user->user_email,
     )
          )
);
$posts_pm = get_posts($args_pm);
$pm_count = count($posts_pm);//number of posts by pm

echo "$display_name's Active Projects: $pm_count";

A: Assuming that you have a serialized array represented as a string and stored in Database for your pds_project_manager field, use LIKE in your query like this:
...
array(
        'key'   => 'pds_project_manager',
        'value' => $current_user->user_email,
        'compare' => 'LIKE'
     )
...

There is a good article why not to use LIKE or not to store serialized data in Database, in case you want to know alternatives: https://wordpress.stackexchange.com/questions/16709/meta-query-with-meta-values-as-serialize-arrays


text:
Q: Unity - determine items collision with different "tags"
I'm beginning with Unity2D. I have three different colored blocks (the three lower block in the picture) going up at a constant force. Each of the lower blocks are labeled by tags of "Red", "Blue", and "Yellow". The upper blocks are also tagged by their respective colors.
Also, each object has a isTrigger boxcollider2D attached. I want to Debug.Log a message like "Game Over", if two different colors collide with each other.
I understand that I need to use OnTriggerEnter2D in some capacity, but I don't know how. Any help would be greatly appreciated!
[EDIT] Currently this is what I have (and it isn't working the way I want it to).
void OnTriggerEnter2D(Collider2D col)
{
    if (col.tag != "Red")
    {
        Debug.Log("Game Over");
    }
    if (col.tag != "Blue")
    {
        Debug.Log("Game Over");
    }
    if (col.tag != "Yellow")
    {
        Debug.Log("Game Over");
    }
}

A: You're putting. ! Marks on your if statements. This means if the tag does not equal. It would help if you would say what you mean by not working the way you want. If does not equal is what you want then I don't see a problem and it must he somewhere else in your code.

A: OnTriggerEnter2D is called every time, your gameObject collides with another collider. One of the colliding gameobjects needs a rigidbody2D or else OnTriggerEnter2D will not be called.
I assume you got a problem with the logic of the if statement and not the call of OnTriggerEnter2D and you want to call a "Game Over Function" if the tags of the colliding gameobjects are not the same.
So you want to compare the tags of both colliding gameobjects, not the tag of one colliding object with a few other tags.
private void OnTriggerEnter2D(Collider2D col)
{
    if (col.CompareTag(gameObject.tag) == false)
        Debug.Log("This is NOT the same Color!");
    else
        Debug.Log("This is the same Color!");
}


text:
Q: Accessing Dictionary values inside a list I'm trying to replicate some functionality found in MATLAB in python and am looking for a pythonic way to solve this problem.
Consider the following example.
import io
import csv

data = """name,age,height
scott,31,175
bob,45,180
george,2,100
"""

f = io.StringIO(data)
reader = csv.reader(f, delimiter=',')
fields = next(reader)
table = []

for row in reader:
    item = dict(zip(fields, row))
    table.append(item)

Some data is imported, each row is an item in a list and each column is paired up with it's field name in a dictionary.
Accessing a single field of a specific element is simple
>>> table[1]['name']
'bob'

How can I return all values of the 'name' field in the table aside from using either a for loop or a list comprehension?
ages = [x['age'] for x in table]

In MATLAB I could do the following
ages = [table(:).age]

which would return an array containing everyone's age.
Is there a way to return all of the elements of a single field from a list of items? Or is the list comprehension the best way?
[EDIT]:How about if I want to access only the first 2 elements and get their fields? Or the last 2 elements?
List Comprehension still the best way to go?
Perhaps there is a better data structure to allow this?

A: A list comprehension is your best bet for creating your list.
That said, you should be using a DictReader instead of the vanilla reader in your code:
...
f = io.StringIO(data)
reader = csv.DictReader(f) # default delimiter is ,
table = list(reader)

ages = [x['age'] for x in table]
names = [x['name'] for x in table]

A: Just an alternative approach if you are wanting to do more complex things with tables then there is pandas which is basically programmatic spreadsheet for Python:
>>> f = io.StringIO(data)
>>> import pandas as pd
>>> df = pd.DataFrame.from_csv(f)
>>> df.age
name
scott     31
bob       45
george     2
Name: age, dtype: int64
>>> df.age.values
array([31, 45,  2])
>>> df.age[-2:]
name
bob       45
george     2
Name: age, dtype: int64
>>> df.index
Index(['scott', 'bob', 'george'], dtype='object', name='name')

A: You may use collections.defaultdict() as:
from collections import defaultdict
d = defaultdict(list)

for data in table:
    for k, v in data.items():
        d[k].append(v)

d will contain the list of all values as key. For example, for accessing all the ages, do:
d['ages']


text:
Q: how to make listbox is resizable inside its parent? In a user control, I put a listbox which is bound to a dynamic datasource. This usercontrol will be in a popup window. I want to this list box can fill the rest of space of the window. Here is the Xaml I tried:

<ComboBox x:Name="cmbx1" Grid.Column="0" Grid.Row ="0" Margin="5"
                  Width="150" VerticalAlignment="Center" HorizontalAlignment="Left" SelectionChanged="filters_SelectionChanged">
  ......
</ComboBox>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Column="1" Grid.Row="0">
    <Button Content="Test" Margin="5"  Click="Button_Add" />
</StackPanel>

<DataGrid x:Name="ListGrid" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
  ......
</DataGrid>
<ComboBox x:Name="cmb2" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="5">
  ......
</ComboBox>
<ListBox x:Name="lstSharing" Grid.Row="3"  Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,10,0"
                    Width="{Binding Width, ElementName=ListGrid}">
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <tkit:WrapPanel Orientation="Horizontal" MaxWidth="650" />
        </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
    <ListBox.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal" Margin="3" Width="Auto">
                <CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}" />
                <TextBlock Text="{Binding ItemName}" Width="120" />
            </StackPanel>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

What I want it height and width of list box can be setup dynamically based on windows size, the items bound to list box. But it is not working properly. Initially, the listbox has no scrollbar, I need to resize window manually so that scrollbar on display.  I can not dynamically to change with, so I put MaxWidth =600. Otherwise, it always display all item in one row.
How to resolve this problem?

A: This is untested, but I would try something like this:
<ListBox x:Name="lstSharing"
         Grid.Row="3"
         Grid.Column="0"
         Grid.ColumnSpan="2"
         Margin="0,0,10,0"
         HorizontalAlignment="Stretch"
         VerticalAlignment="Stretch">
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <tkit:WrapPanel Orientation="Horizontal"
                            MaxWidth="{Binding ElementName=lstSharing, Path=ActualWidth}" />
        </ItemsPanelTemplate>

It's a little difficult to know whether this will work without seeing the parent containers, but it should point you in the right direction.


text:
Q: Scalar function throws error while using in SQL My question is:
Write a query to display user name and password. Password should be generated by concatenating first two characters of user name , length of the user name and last three numbers in the phone number and give an alias name as USER_PASSWORD. Sort the results based on the user name in descending order.
select
    name,
    concat(substring(name, 1, 2), cast(len(name) as varchar), cast(right(phno, 3) as varchar)) as USER_PASSWORD
from
    users
order by
    name desc;

I get this error:

cast(len(name) as varchar),

*

*ERROR at line 5: ORA-00906: missing left parenthesis

Thanks

A: Concat() is limited to two arguments in Oracle. Use || instead.
with my_data as (
  select 'abcdefg' as name, 12345 as phno from dual
  )
select
name,
  substr(name, 1, 2) ||
  length(name) ||
  substr(to_char(phno),-3) as user_password
from my_data

| NAME    | USER_PASSWORD |
| --------|---------------|
| abcdefg | ab7345        |

fiddle

A: You have five issues:

*

*CONCAT only takes two arguments so you either need CONCAT(a, CONCAT(b, c)) or use the || string concatenation operator a || b || c

*CAST requires the data type and length CAST(a AS VARCHAR2(10))

*SUBSTRING is not an Oracle function, you want SUBSTR;

*LEN is not an Oracle function, you want LENGTH;

*RIGHT is not an Oracle function, your want SUBSTR with a negative index.

SELECT name,
       concat(
         substr(name, 1, 2),
         concat(
           cast(length(name) as varchar2(10)),
           cast(SUBSTR(phno, -3) as varchar2(10))
         )
       ) as USER_PASSWORD
from   users
order by name desc;

However, you do not need to explicitly use CAST as you can use an implicit conversion between data types:
SELECT name,
       substr(name, 1, 2) || length(name) || SUBSTR(phno, -3) as USER_PASSWORD
from   users
order by name desc;

Which, for the sample data:
CREATE TABLE users (name, phno) AS
  SELECT 'Benny', '0123111' FROM DUAL UNION ALL
  SELECT 'Betty', '4567111' FROM DUAL UNION ALL
  SELECT 'Beryl', '2222111' FROM DUAL;

Both output:

NAME
USER_PASSWORD

Betty
Be5111

Beryl
Be5111

Benny
Be5111

fiddle

Which leads to the final point, don't generate obvious passwords; generate random or pseudo-random passwords. Then don't store them as plain text; instead store them as a salted-hash.


text:
Q: TypeScript: Parameter type in inherited method should be inferred The TypeScript compiler accepts the following code without signaling an error:
class S {
    f(p: number) {
        console.log(`${p + 1}`);
    }
}

class C extends S {
    f(p) {
        super.f(p)
    }
}

let a: C = new C();
let b: C = new C();

a.f(41);  // -> 42
b.f('x'); // -> x1

TypeScript being a statically typed language, shouldn't the compiler infer the parameter type of p in the inherited method f to number? Why is an assignment of the wrong typed string value left uncaught, producing weird behavior?

A: class C extends S {
    f(p) {
        super.f(p)
    }
}

This code is equivalent to this code:
class C extends S {
    f(p: any) { // <---- parameter is 'any'
        super.f(p)
    }
}

This means you can invoke C#f with any argument type. This is a valid substitution for your class to make because it's valid to have a derived method be more general than its base method.
This behavior is understood to be a bit counterintuitive, so there's a feature accepting PRs for this in the language to automatically type p as string in this case.


text:
Q: How to sync app data when server add or update the record I have developed an Android app which gets data from MySQL, but the problem is that when insert, update & delete happen so it loads all the data from server, and I want to sync only that record which is insert or update.
This is my code:
@Override
protected void onHandleIntent(Intent intent) {
    try {
            //Activity activity = (Activity)context;
            Log.d("st", String.valueOf(System.currentTimeMillis()));
            DataBaseHelper dataBaseHelper = new DataBaseHelper(context);
            dataBaseHelper.createDataBase();
            dataBaseHelper.openDataBase();
            HttpClient httpclient = new DefaultHttpClient();

            //utils.getdata("Userid");
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MMM-yyyy hh:mm a");
            Date date = new Date();
            String link = "http://ec2-52-4-106-227.compute-1.amazonaws.com/capalinoappaws/apis/getProcurementDaily.php?currentDate="+simpleDateFormat.format(date);
            link = link.replace(" ","%20");
            HttpPost httppost = new HttpPost(link);

            ResponseHandler<String> responseHandler = new BasicResponseHandler();

            final String response = httpclient.execute(httppost,
                    responseHandler);

            Log.i("Response", "Response : " + response);
            if (!dataBaseHelper.sqliteDataBase.isOpen())
                dataBaseHelper.openDataBase();
            dataBaseHelper.delete("ProcurementMaster");
            JSONArray jsonarray = new JSONArray(response);
            for (int i = 0; i < jsonarray.length(); i++) {
                JSONObject jsonobj = jsonarray.getJSONObject(i);

                String ProcurementID = jsonobj.getString("ProcurementID");
                String ProcurementEPIN = jsonobj.getString("ProcurementEPIN");
                String ProcurementSource = jsonobj.getString("ProcurementSource");
                String ProcurementAgencyID = jsonobj.getString("ProcurementAgencyID");

                        /*ProcurementAgencyID = ProcurementAgencyID.replace(")","");
                        ProcurementAgencyID = ProcurementAgencyID.replace("(","");*/
                ProcurementAgencyID = ProcurementAgencyID.replace("'","\\u0027");

                String ProcurementTypeIDP = jsonobj.getString("ProcurementTypeIDP");
                String ProcurementTitle = jsonobj.getString("ProcurementTitle");
                //Log.d("ProcurementTitle",ProcurementTitle);
/*
                        ProcurementTitle = ProcurementTitle.replace(")","");
                        ProcurementTitle = ProcurementTitle.replace("(","");*/
                ProcurementTitle = ProcurementTitle.replace("'","''");

                String ProcurementShortDescription = jsonobj.getString("ProcurementShortDescription");

                        /*ProcurementShortDescription = ProcurementShortDescription.replace(")","");
                        ProcurementShortDescription = ProcurementShortDescription.replace("(","");*/
                ProcurementShortDescription = ProcurementShortDescription.replace("'","''");

                String ProcurementLongDescription = jsonobj.getString("ProcurementLongDescription");

                        /*ProcurementLongDescription = ProcurementLongDescription.replace(")","");
                        ProcurementLongDescription = ProcurementLongDescription.replace("(","");*/
                ProcurementLongDescription = ProcurementLongDescription.replace("'","''");

                String ProcurementProposalDeadline = jsonobj.getString("ProcurementProposalDeadline");
                String ProcurementPreConferenceDate = jsonobj.getString("ProcurementPreConferenceDate");
                String ProcurementQuestionDeadline = jsonobj.getString("ProcurementQuestionDeadline");
                String ProcurementAgencyURL = jsonobj.getString("ProcurementAgencyURL");

                String ProcurementDocument1URL = jsonobj.getString("ProcurementDocument1URL");
                String ProcurementDocument2URL = jsonobj.getString("ProcurementDocument2URL");
                String ProcurementDocument3URL = jsonobj.getString("ProcurementDocument3URL");
                String ProcurementDocument4URL = jsonobj.getString("ProcurementDocument4URL");
                String ProcurementDocument5URL = jsonobj.getString("ProcurementDocument5URL");
                String ProcurementAddedDate = jsonobj.getString("ProcurementAddedDate");

                String ProcurementContractValueID = jsonobj.getString("ProcurementContractValueID");
                String Status = jsonobj.getString("Status");
                String LASTEDITEDUSERNAME = jsonobj.getString("LASTEDITEDUSERNAME");
                String PDFPath = jsonobj.getString("PDFPath");

                boolean isInserted = dataBaseHelper.InsertProcurementMaster(new ProcMaster(Integer.valueOf(ProcurementID), ProcurementEPIN, ProcurementSource,
                        ProcurementAgencyID, ProcurementTypeIDP, ProcurementTitle,ProcurementShortDescription,ProcurementLongDescription,ProcurementProposalDeadline,
                        ProcurementPreConferenceDate,ProcurementQuestionDeadline,ProcurementAgencyURL,ProcurementDocument1URL,ProcurementDocument2URL,ProcurementDocument3URL,
                        ProcurementDocument4URL,ProcurementDocument5URL,ProcurementAddedDate,ProcurementContractValueID,Status,LASTEDITEDUSERNAME,PDFPath));
                //Log.d("InsertProcurementMaster", "Inserted");

                //list_data.add(new ListData(image, contentShortDescription, ContentRelevantDateTime));

                //isinserted = dataBaseHelper.InsertUserProcurmentTracking(been);
            }

            Log.d("et", String.valueOf(System.currentTimeMillis()));

        } catch (Exception e) {
                                  e.printStackTrace();
                              }
}

A: try implementing sockets on client and server side.
https://socket.io/


text:
Q: Add a outer circular strip to donut pie chart I have been trying to built a donut pie chart that looks like this
main issue is the outer strip ..
how do i get this outer strip ..
Please point me in the right direction

I am trying to use flotchart but i am open to use any other suggestion if you can guide
this is what i have rid so far

Here is jsfiddle

A: You could plot another donut, bigger with a larger inner hole and position it behind your plot, not more elegant but working without move to SVG (that I think could be a better choice)
HTML

JS
 $.plot(report_score_summary_outer, data_score_summary, {
    series: {
        pie: {
            innerRadius: 0.8,
      width: 0.1,
            show: true,
      label: {
                show: false
            }
        }
    },
  legend: {
        show: false
    }
});

I updated your jsfiddle


text:
Q: Prism v4 CURRENT Documentation/Tutorials and Usage/Penetration I've been spending quite alot of time recently trying to learn XAML/C#/WPF/Silverlight, trying to build a Desktop application as well as a web application to go along with it, re-using the same code if possible.
Prism seems like the optimal tool to do this, allowing me to keep both MVVM, Silverlight and DesktopWPF in mind all at once. However, my concern derives from two places:
1) Almost all of the videos/examples I have been reading (wrt PRISM) are Prism v2, save for the 342 page Prism v4 documentation I am going through right now. Also it seems like documentation/updates in the whole Prism world are very sparse, PRISM v4 was last updated over a year ago.
This causes problems when I watch a video showing me how to do something in Prism v2, then I learn that Silverlight v4 has actually brought some breakthrough that means I can do the same thing in a much more logical manner. Is there any updated tutorials, at least ones the outline the changes w.r.t. Prism (eg ICommand support, few changes to Region). I'm learning this for the first time and I'd rather learn v4 than v2 and know all of the updated practices.
2) The PROJECT LINKER VS2010 extension (which seems 100% neccessary in order to do a multi-target WPF & Silverlight deployment re-using the same code base, has only been downloaded 5000 times?! Does this mean there are at most 5000 companies even TRYING to deploy apps to both WPF and Silverlight at the same time? Why is that? It seems (to me at least) that being able to write 1 code base that deploys to both Desktops and web-based platforms is a HUGE advantage, but it worries me if I am one of only 5000 people doing a dual WPF/Silverlight development that perhaps there is another better solution?
Basically, is there any resource for updated Prism v4 documentation/practices, and is PRISM/Project linker for VS2010 a reliable way to start coding a dual Desktop/Web-based application starting from the ground up?

A: We have created a number of large PRISM projects (V2 and V4) for WPF and Silverlight with lots of shared code and have run into the same issues you have.
With regard to item 1: we just read up everything and try to bear the date of the docs in mind. PRISM always makes us feel like we are trail blazing, so you are not alone in that respect.
With regard to item 2: On the basis that simplest is often best (and our raw C# code is just raw C# code, regardless of platform), we keep separate libraries for our WPF and Silverlight projects and WinForms etc, but if the code needs to be shared we keep the original in a common .Net library (just for storage) and use the "link" option for including files in other projects.
(forgive the following as overkill, I am playing with SnagIt:)).
Add existing item...

Add as a linked file...

The file remains in the original place and the file icon has a little link symbol in the project...
We also find ourselves back here at Stack Overflow quite a lot for these sort of issues, so at least you are in good company.


text:
Q: Integer compare operations using xslt I have this xml file:
<?xml version="1.0" ?>

<CATALOG>
  <CD>
    <TITLE>Empire Burlesque</TITLE>
    <ARTIST>Bob Dylan</ARTIST>
    <COUNTRY>USA</COUNTRY>
    <COMPANY>Columbia</COMPANY>
    <PRICE>10.90</PRICE>
    <YEAR>1985</YEAR>
  </CD>
  <CD>
    <TITLE>The very best of</TITLE>
    <ARTIST>Cat Stevens</ARTIST>
    <COUNTRY>USA</COUNTRY>
    <COMPANY>Island</COMPANY>
    <PRICE>11.90</PRICE>
    <YEAR>1994</YEAR>
  </CD>-----so on

I'm trying to search this xml doc using another xml which is like
<search_conditions>
    <condition>
        <price min="20" max="45"/>
    </condition>
</search_conditions>

This is my code that i wrote:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" />

    <xsl:template match="/">
        <xsl:call-template name="query1"/>
    </xsl:template>

    <xsl:template name="query1">
        <xsl:variable name="minPrice" select="document('search.xml')/search_conditions/condition/price/@min" />
        <xsl:variable name="maxPrice" select="document('search.xml')/search_conditions/condition/price/@max" />

                Title
                Artist
                Company
                Year

            <xsl:for-each select="//CD">

            <xsl:if test="PRICE > $minPrice" >
                <xsl:if test="PRICE < $maxPrice" >

                        <xsl:value-of select="TITLE" />

                        <xsl:value-of select="ARTIST" />

                        <xsl:value-of select="COMPANY" />

                        <xsl:value-of select="YEAR" />

                </xsl:if>
            </xsl:if>
        </xsl:for-each>

    </xsl:template>

but when im trying to run this thing, nothing is printing out. Why? what am i doing wrong here? Can someone help please?

A: The expressions to be used are these:
<xsl:variable name="minPrice" select="document('search.xml')/search_conditions/condition/price/@min" />
<xsl:variable name="maxPrice"  select="document('search.xml')/search_conditions/condition/price/@max" />


text:
Q: Easiest way to use custom fonts? - android the way i found for using custom fonts on my android app is using the below code
TextView txt = (TextView) findViewById(R.id.textView1);
        Typeface font = Typeface.createFromAsset(getAssets(), "ABCD.TTF");
        txt.setTypeface(font);

i've stored the ABCD.TTF in assets folder..
and ya it works, no probs in tat.. the thing is i have to add the above code for each and every texts,buttons,etc i have.. and its really a time consuming thing if theres lots of texts and buttons in various activity :(
what i need is an alternate method to do it, an easiest one to do it..
like using a single block of code not repeatative like the above to change the fonts for all the stuffs..
else doing it in the xml
or is there any way to add our custom font to the inbuilt typeface where normal,sans,serif,monospace are present.

A:
like using a single block of code not repeatative like the above to change the fonts for all the stuffs..

There are a few ways of doing this already addressed in various StackOverflow answers. Here is that iterates over the children of a ViewGroup and apply a Typeface to all that implement TextView:
- https://stackoverflow.com/a/7580370/115145

else doing it in the xml

Sorry, this is not supported.

or is there any way to add our custom font to the inbuilt typeface where normal,sans,serif,monospace are present.

Sorry, this is not supported, except if you build your own firmware.

A: You can use simple EasyFonts third party library to set variety of custom font to your TextView. By using this library you should not have to worry about downloading and adding fonts into the assets/fonts folder. Also about Typeface object creation.
Simply:
TextView myTextView = (TextView)findViewById(R.id.myTextView);
myTextView.setTypeface(EasyFonts.robotoThin(this));


text:
Q: How can I loop the script 1000 times to get the data in different cells and get URL value from different cells? How can I loop the script 1000 times to get the data in different cells and get URL value from different cells?
Private Sub CommandButton1_Click()

    Dim ie As InternetExplorer
    Dim ht As HTMLDocument

    Set ie = New InternetExplorer
    ie.Visible = True
    ie.navigate Workbooks("FINAL-1").Worksheets("sheet1").Range("A2").Value

    Do While ie.readyState <> READYSTATE_COMPLETE
    Loop

    Set ht = ie.document

    Workbooks("FINAL-1").Worksheets("sheet1").Range("C").Value = ht.getElementById("addr1").Value
    'Workbooks("FINAL-1").Worksheets("sheet1").Range("C2").Value = ht.getElementById("fullName").Value
    'Workbooks("FINAL-1").Worksheets("sheet1").Range("d2").Value = ht.getElementById("addr1").Value
    Workbooks("FINAL-1").Worksheets("sheet1").Range("D").Value = ht.getElementById("dob").Value
    Workbooks("FINAL-1").Worksheets("sheet1").Range("E").Value = ht.getElementById("applyDte").Value
    Workbooks("FINAL-1").Worksheets("sheet1").Range("B").Value = ht.getElementById("idNo").Value
    'Workbooks("FINAL-1").Worksheets("sheet1").Range("G2").Value = ht.getElementById("genderMtdtId").Value

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub

A: Set ie = New InternetExplorer

ie.Visible = True

ie.navigate Workbooks("FINAL-1").Worksheets("sheet1").Range("A2").Value

Do While ie.readyState <> READYSTATE_COMPLETE

Loop


text:
Q: Recover data on Fragment without call BDD In my application, datas are loading while the splash screen is displayed. When it's done, the user can enter new data that are displayed in a fragment and insert in the database. Moreover, new data entered by the user allows to compute a variable that is also displayed in a custom view (in the fragment) and insert in the database. So, outside the splash screen, I'm using only db.insert().
I have several fragments and I want to recover my datas when I swith from one fragment to another without call the database with db.get()
Now, when I switch to another fragment (using navigation drawer) and go back to the previous one, my data are no more displayed...
Indeed, I want to limit call to the database when the app is running.
UPDATE
A little update to be more explicit :)
I have an Activity handling a Navigation Drawer. For the moment, I switch between 2 fragments (Frag1 & Frag2).
In the first fragment I have a custom view (named for example CustomView1) and some TextView (TextView1 & TextView2).
Through an item in action bar, TextView1 can be updated by the user. The value set for TextView1 is also insert in a database. Automatically, TextView2 is updated with the previous value of TextView1 as below :
     /**
     * Listener to see if TextView1 change
     **/

    TextView1.addTextChangedListener(new TextWatcher() {
        String X;
        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {

            X = charSequence.toString();
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {

        }

        @Override
        public void afterTextChanged(Editable editable) {
            TextView2.setText(X);
        }
    });

When I switch to Frag2 and back to Frag1, TextView1 & TextView2 are empty and nothing is display.
I tried to use onSaveInstanceState like this :
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    super.onSaveInstanceState(savedInstanceState);

    savedInstanceState.putFloat("mTextView1", mTextView1);
    savedInstanceState.putFloat("mTextView2", mTextView2);
}

and in onCreateView :
if(savedInstanceState != null) {
        // Restore last state
        mTextView1 = savedInstanceState.getFloat("mTextView1");
        mTextView2= savedInstanceState.getFloat("mTextView2");
    }

My savedInstanceState is always returning null...
This is how I switch between fragment :
private void selectItem(int position) {
    // update the main content by replacing fragments

    switch(position){
        case 0:
            Fragment1 Frag1 = new Fragment1();
            FragmentTransaction fragTransaction = getSupportFragmentManager().beginTransaction();
            fragTransaction.replace(R.id.content_frame,Frag1,"TAG1");
            fragTransaction.commit();
            break;
        case 1:
            Fragment2 Frag2 = new Fragment2 ();
            FragmentTransaction fragTransaction1 = getSupportFragmentManager().beginTransaction();
            fragTransaction1.replace(R.id.content_frame,Frag2,"TAG2");
            fragTransaction1.commit();
            break;
    }

    // update selected item and title, then close the drawer
    mDrawerList.setItemChecked(position, true);
    setTitle(mSection[position]);
    mDrawerLayout.closeDrawer(mDrawerList);
}

Solution
I am using SharedPreference during user action to store data I want (moreover, these data are insert in the database)
SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE);
                               SharedPreferences.Editor editor = sharedPref.edit();
                               editor.putFloat("mKey1", value1);
                               editor.commit();

In onCreate, I get data I stored previously :
sharedPref = this.getActivity().getPreferences(Context.MODE_PRIVATE);
             if(sharedPref!=null) {
                variable1 = sharedPref.getFloat("mKey1",DEFAULT_VALUE);
             }
TextView1.setText(String.valueOf(variable1));

As TextView1 is updated, TextView2 is update too with the listener taking the previous value of TextView1.

A: I solved the issue by using SharedPreference


text:
Q: Spring Security Login: Password can be seen in the View Source I am using Spring security and able to logIn through my custome page with method="post" only, but not method="get", I need to get Login via method="get" so that no one can see my password in the view source.

Any help would be appreciated.

A: To use POST you need to configure UsernamePasswordAuthenticationFilter manually and not to use http.formLogin():
protected void configure(HttpSecurity http) throws Exception {
    UsernamePasswordAuthenticationFilter authFilter = new UsernamePasswordAuthenticationFilter();
    authFilter.setPostOnly(false);
    http
    //       other configuration...
            .addFilterAfter(authFilter, LogoutFilter.class);
}

But you have to be aware that GET method is totally insecure - your password will be transferred through query parameter of an URL like www.yoursite.com/j_spring_security_check?j_password=some_password. And many and many HTTP servers log incoming URLs in their log files. So your password will eventually appear in logs which is not good at all.


text:
Q: Firebase IP Restrictions We're about to develop a chat engine using Firebase that will be used in schools. This means that it will appear to Firebase that there are potentially up to 60 simultaneous connections from one IP address. I imagine that this might look like an attack or dodgy traffic.
Does anyone know if that is likely to cause a problem? Is Firebase likely to block such IP addresses?

A:
Does anyone know if that is likely to cause a problem?

It won't cause any problem.

Is Firebase likely to block such IP addresses?

Why would they wanna block it?
Is it because:

This means that it will appear to Firebase that there are potentially up to 60 simultaneous connections from on IP address

What did you expect? If 60 people from different machines with different IP address make requests to Firebases, I expect Firebase to see them as separate connections, and there's nothing wrong with that.
Check the firebase pricing for more details on how much simultaneous connections are possible with the 'Spark Free' subscription you're on now, and when you might need to upgrade.


text:
Q: Having trouble with credentials (google smtp) I'm a very new Python coder so please don't go too harsh on me, thanks.
I'm trying to make an emailer using smtplib and I'm having trouble with handing the users credentials to Google.
Full code:
mailcheck = input("This mailer is only for gmail, want to continue? (yes or no)")

# GMAIL SMTP INFORMATION
if mailcheck == "yes" or mailcheck == "Yes" or mailcheck == "y":
    smtp_server = 'smtp.gmail.com'
    port = 587
    set_server = "gmail"
else:
    print("Hey, sorry this program is only for Gmail")

#USER CREDENTIALS + RECEIVER

username = input("Google Email?")
password = input("Password?")
receiver = input("Who to send it to?")
subject = input("Subject of the email?")
econtents = input("What to put in the email?")
amount = input("Amount of emails to send?")

credentials = username + password
global d1
global d2

try:
    server = smtplib.SMTP(smtp_server, port)
    server.ehlo()

    server.starttls()
    server.login(username, password)

    print("Sending" + amount, "to", receiver)

    for i in range(1, int(amount) + 1):
        message = "From" + credentials[0] + '\nSubject' + subject + '\n' + econtents
        time.sleep(random.uniform(d1, d2))
        server.sendmail(credentials[0], receiver, message)
        print("\nEmail Sent!")

    else:
        print("Finished sending emails")

except smtplib.SMTPRecipientsRefused:
        print("Recipient refused. Invalid email address?")

except smtplib.SMTPAuthenticationError:
        print("Unable to authenticate with server. Ensure the details are correct.")

except smtplib.SMTPServerDisconnected:
        print("Server disconnected for an unknown reason.")

except smtplib.SMTPConnectError:
        print("Unable to connect to server.")

The error :
Unable to authenticate with server. Ensure the details are correct.

This means it went wrong with the login process. It should be going wrong somewhere in this part:
 #USER CREDENTIALS + RECEIVER

username = input("Google Email?")
password = input("Password?")
receiver = input("Who to send it to?")
subject = input("Subject of the email?")
econtents = input("What to put in the email?")
amount = input("Amount of emails to send?")

credentials = username + password
global d1
global d2

try:
    server = smtplib.SMTP(smtp_server, port)
    server.ehlo()

    server.starttls()
    server.login(username, password)

    print("Sending" + amount, "to", receiver)

    for i in range(1, int(amount) + 1):
        message = "From" + credentials[0] + '\nSubject' + subject + '\n' + econtents
        time.sleep(random.uniform(d1, d2))
        server.sendmail(credentials[0], receiver, message)
        print("\nEmail Sent!")

I think it's because of the credentials = username + password which doesn't work, but I have no idea how I'd fix it.
If anyone knows what I'd have to change to fix this that'd be great!

A: Instead of adding those two strings, you're meaning to put them in an array. In Python, that's either
credentials = [username, password]

or
credentials = list(username, password)

But that doesn't seem to be your issue. Your issue is related to the login() function as you get the SMTPAuthenticationError exception. The smtplib documentation says that after running .starttls(), you should run .ehlo() again. Try to run that before logging in. Additionally, you could try to generate an SSL instance on port 465.
(Ctrl+F for .starttls())
https://docs.python.org/2/library/smtplib.html


text:
Q: Symfony2: The session id is too long or contains illegal characters I always get this error when I have some time without updating a project, only occurs in the development environment.
Warning: session_start() [function.session-start]: The session id contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,'

How to avoid? or Why does this happen?
i use:

*

*Symfony 2.0.9

*Linux Mint 12 3.0.0-14-generic x86_64

*PHP 5.3.6-13ubuntu3.3

A: You might be using Mink or Behat. Please, make sure that they are loaded only for their environment and not dev/prod. See:
https://github.com/symfony/symfony/issues/1766

A: Delete your browser cookies. It fixed the error for me


text:
Q: Is there a way to pass the value of a model field as a parameter to models.ImageField(storage=function) within same Model class StorageModel(models.Model):
    user = models.ForeignKey(Profile, on_delete=models.CASCADE, related_name="profile", null=False)
    file_meta = models.ImageField(storage=UserDataStorage(profile=user), blank=False, null=False)

class UserDataStorage(S3Boto3Storage):
    location = common.AWS_LOCATION_TEST
    file_overwrite = False

    def __init__(self, *args, **kwargs):
        for k, v in kwargs.items():
            print("omg")
            print(v)

        super(UserDataStorage, self).__init__(*args, **kwargs)

How to pass the field user as an argument to the object UserDataStorage?
The problem here is, field user gets passed down to UserDataStorage but as a type <django.db.models.fields.related.ForeignKey>. I want a Profile instance here.
Is this achieveable in Django?

A: It's not possible the way you describe it. At this moment (when the code is initialized) the is no request/user objects to send.
What you can do is to pass a callable to the upload_to kwarg as explained in the docs.
This way when the callable is executed, you will have the model instance being saved, and this instance have the user attribute.
def user_directory_path(instance, filename):
    # file will be uploaded to MEDIA_ROOT/user_<id>/<filename>
    return 'user_{0}/{1}'.format(instance.user.id, filename)

class StorageModel(models.Model):
    user = models.ForeignKey(Profile, on_delete=models.CASCADE, related_name="profile", null=False)
    file_meta = models.ImageField(
        upload_to=user_directory_path,
        storage=UserDataStorage(),
        blank=False, null=False
    )


text:
Q: gulp-compass error "You need to have Ruby and Compass installed and in your system PATH" I'm using gulp-compass to compile my scss to css using gulp task. I'm running on Windows 7.
My Gulp task:
gulp.task('styles', function() {
      gulp.src('./sass/design.scss')
    .pipe(compass({
      config_file: './config.rb',
      css: 'stylesheets',
      sass: 'sass',
      require: ['susy', 'breakpoint']
    }))
    .pipe(gulp.dest('dest/css'));
});

I get the following error message:
Error: You need to have Ruby and Compass installed and in your system PATH for this task to work.

I have Ruby and Compass installed and in my system PATH so I can't see what's the problem.
I tried re-installing both Ruby and Compass and it didn't help either.
When I tried to use the same task on a Mac system it worked fine.
Replacing the gulp-compass plugin to gulp-ruby-sass is not an option due to a bug they have which block me from using certain sass features I need to use.

A: I don't have Windows 7 environment. I think you must add the following path to your system PATH.
C:\Ruby193\bin

*

*http://www.tutorialspoint.com/ruby/ruby_installation_windows.htm

*http://rubyonwindowsguides.github.io/book/ch01-01.html

A: I encountered this issue and resolved it by removing double quotes from my system path.
I had an entry for:
c:\"Program Files"\Perforce;

I changed it to:
c:\Program Files\Perforce;

The script apparently can't handle double quotes.
You can also get around this by explicitly adding the ruby folder to the "External Web Tools" locations but fixing the path is a better solution.


text:
Q: Is my closed solution to the following Heaviside integral correct? I'm considering the following integral:
$$\int^a_b H(g(x))\:dx$$
Where $a$ and $b$ are constants, H is the Heaviside function, see
https://en.wikipedia.org/wiki/Heaviside_step_function#Discrete_form
And $g(x)$ some function. In order to evaluate this I've try integration by parts:
$$ \int^a_b {dv\over dx} u \: dx = \left.uv\right|^a_b -\int^a_b {du\over dx} v\: dx $$
Set $u = H(g(x))$ and ${dv\over dx} = 1$. Then:
$$ {du\over dx} = {d\over dx}H(g(x)) = g'(x)\delta(g(x)), \:\: v = \int dx = x  $$
The former determined via Wolfram alpha. Substituting we find:
$$  \left. H(g(x)) x \right|^a_b -\int^a_b g'(x)\delta(g(x)) x\: dx $$
$$  H(g(a))a - H(g(b))b  -\int^a_b g'(x)\delta(g(x)) x\: dx $$
Now we must evaluate:
$$\int^a_b g'(x)\delta(g(x)) x\: dx$$
I believe I am right in saying that
$$\int^{+\infty}_{-\infty} \delta(g(x)) f(x) dx = \sum_{x_0: \{g(x_0)=0 | -\infty < x_0 < +\infty \}} {f(x_0)\over|g^\prime(x_0)| } $$
Hence
$$\int^a_b g'(x)\delta(g(x)) x\: dx =  \sum_{x_0} {g^\prime(x_0) x_0\over|g^\prime(x_0)| } = \sum_{x_0: \{g(x_0)=0 | b\leq x_0\leq a \} } sgn(g^\prime(x_0)) x_0$$
Where $sgn(x)$ is the sign of $x$. Hence
$$\int^a_b H(g(x))\:dx = H(g(a))a - H(g(b))b -  \sum_{x_0: \{g(x_0)=0 | b\leq x_0\leq a \} } sgn(g^\prime(x_0)) x_0 $$
If I consider a trivial example:
$$\int^{2\pi}_0 H(\sin(x))\:dx = \pi$$
Wolfram suggest that the answer is $\pi$. The roots we seek are in the range $g(b)<x_i=g^{-1}(0)<g(a) => \sin(0)<x_i=g^{-1}(0)<\sin(2\pi) => 0 <x_i=\sin^{-1}(0)< 0$, which leaves only $x_1=0$. Substituting into my equation we get:
$$ 2\pi H(\sin(2\pi)) - [H(\sin(0))\times0] - (0)  =2\pi$$
Clearly my derivation is wrong somewhere. Where have I made a mistake?

A: $H$ is not differentiable and so you cannot use integration by parts (unless you evaluate the limits very carefully). In the present case, better writing simply
$$
\int_0^{2\pi}H(\sin x)\,dx=\int_0^\pi 1\,dx=\pi,
$$
since $H(\sin x)=0$ for $x\not\in[0,\pi]$.

A: The derivation is almost correct, but because you are integrating, the endpoints need to be excluded.
So the solution is
$$
  \int_b^a H(g(x)) \,\mathrm{d}x
  =
  x H(g(x)) \big|_{b^+}^{a^-} - \sum_{x \in S} x \,\mathrm{sign}(g'(x))
$$
where $S = \{ x : b < x < a \wedge g(x) = 0 \}$ and the surface term is
$$
  x H(g(x)) \big|_{b^+}^{a^-} = \lim_{x \to a^-} x H(g(x)) - \lim_{x \to b^+} x H(g(x)).
$$
For the specific example,
$$
\begin{align}
  \int_0^{2\pi} H(\sin x) \,\mathrm{d}x
  &= x H(\sin x) \big|_{0^+}^{2\pi^-}
     - \sum_{x \in \{ \pi \}} x \,\mathrm{sign}(\cos x) \\
  &= 2\pi \cdot 0 - 0 \cdot 1 - \pi \cdot (-1) \\
  &= \pi
\end{align}
$$
as required.


text:
Q: Parsing results from LTSpice step function I have a CLLC circuit in which I am trying to find values of the inductors and capacitors. I know the circuit needs a gain of at least 10 dB at 50kHz and below 1 db at around 30-40KHz. This has to be true while varying the load. I have set up the circuit in ltspice where I am using the .step function to sweep through component values and am looking at the bode plots.
The problem is I have so many graphs on the screen that I cannot keep track of them all. In the 1000s. Is there a way I can only display the simulations which have over 10dB at 50KHz and under 1db below 30Khz? Basically I want to get rid of all the sims that don't meet my criteria. The circuit is way too complex for me to solve mathematical.
It's for a tank in a resonant tank charger. The load will vary from 4ohm to 12homs.  The circuit is bidirectional and it would be helpful if the transfer function is similar in both directions. What other info should I post? I've been trying to make something similar to the circuit in this article. https://www.researchgate.net/profile/Ho_Sung_Kim3/publication/260496284_Design_Methodology_of_Bidirectional_CLLC_Resonant_Converter_for_High-Frequency_Isolation_of_DC_Distribution_Systems/links/00b7d5347ada7c098b000000/Design-Methodology-of-Bidirectional-CLLC-Resonant-Converter-for-High-Frequency-Isolation-of-DC-Distribution-Systems.pdf
 I understand basic laplace transforms but not enough to put this all together yet. I'm not overly interested in high efficiency, I know the load varies by a lot.

A: Why are you doing it the hard way?

or an easier way.
C1=3.3uF,  L1=4uH, L2=2uH, C2=3.3uF, R=>1.5 Ohm
C1 in series with L1, L2 shunt, C2 series, R load shunt.
If using a voltage source Zs=0
Q > 11dB at 50kHz, < -30dB at 10kHz
Swap L1,L2 for higher Q.


text:
Q: What file formats does HDHomeRun DVR's app scan/monitor? Title is the question. I'm using file conversion software, MCEBuddy to trim  video files, mpg - HDHomeRun Unprocessed, and would prefer to convert the file to a format more widely adopted, ideally supported and optimal for Plex. My initial thought was mp4, however the files don't seems to show up on the front end, HDHomeRuns app. The support docs or forum don't seem to detail this.

A: After testing a few formats it seems their app searches for only hdhomerun format (mpg). Their support confirmed this, and they place metadata in the first part of the file. skipping trim in the first five minutes part of processing to remove commercials works on my end.


text:
Q: Parse a text file representing a map into a quad tree structure I have to create a pseudo wolfenstein 3D as an assignement in school, and I need a structure to represent the map. As all the calculations will be based on a two-dimensionnal grid, I thought that a quad tree would be what I needed.
How would you parse a file that contains this for example:

1 1 1 1 1 1 1 1

1 0 0 0 0 0 0 1

1 0 0 1 0 0 0 1

1 0 0 1 0 0 0 1

1 0 0 1 0 0 0 1

1 1 1 1 1 1 1 1

where the 1s are wall blocks and the 0s empty blocks, into a quad tree structure?

A: You have a couple of options here.  One way would be to read the entire file into memory into some kind of array, and then build the quadtree top-down from there.  This is probably the most straightforward way to do this, as long as the map is not extremely huge.
Another option would be to build the tree bottom-up from each individual node at the bottom, then once you have parsed enough nodes to form a parent node from what you have read, do so.  In this example, you would form leaf nodes for each value read.  Then on even columns on even rows, after you have formed your leaf node, form your second-level nodes from there.
You will get this kind of structure:
1 1 1 1 1 1 1 1
1 2 1 2 1 2 1 2
1 1 1 1 1 1 1 1
1 2 1 3 1 2 1 3
1 1 1 1 1 1 1 1
1 2 1 2 1 2 1 2
1 1 1 1 1 1 1 1
1 2 1 3 1 2 1 4

Each number represents the highest level of node to form once reading the number in that position.  Also form all levels below each (i.e. on level 3, also form a level 2 node and a leaf (level 1) node).

A: You could build the tree in a top-down manner: Asumming that the whole array (let's say it's dimension is 8x8) is mixed with zeros and ones, partition it, e. g. in 4x4 tiles. Now check whether each tile contains only ones or zeros or both. When a tile contains both, then partition it again (2x2) and recheck. Repeat until you are on "pixel"-level (1x1). You can store this in a struct containing pointers to the four neighboring tiles.
This picture on Wikipedia shows it pretty good.


text:
Q: Filtering by args in Stored Proc I have a problem with my code :P obviously right?! Anyway...here's what it is...I want to have a STORED PROC that takes 3 args (@cat, @cutPrice, @option) and returns multiple results that have a type similar to @cat, and a price that is < or > @cutPrice depending on the @option keyword 'above' or 'below'. The problem is when I execute this...
EXEC spBookByPrice
@cat = 'business', @cutPrice = 0.00, @option = 'above'

...I get no results, but @option = ' ' shows all prices. Anyway here's my code....
ALTER PROC spBookByPrice
@cat varchar(12), @cutPrice money, @option varchar(5)
AS
BEGIN
    SELECT
    title AS 'Title:',
    type AS 'Category:',
    price AS 'Price:',
    CASE
        WHEN price >= @cutPrice THEN 'above'
        WHEN price < @cutPrice THEN 'below'
        --ELSE NULL
    END AS 'Option:'
    FROM dbo.titles
    WHERE 'Option:' LIKE '%' + @option + '%'
    GROUP BY type, title, price
    HAVING type LIKE '%' + @cat + '%'
END

A: Is this what you need:
ALTER PROC spBookByPrice
@cat varchar(12), @cutPrice money, @option varchar(5)
AS
BEGIN
    SELECT
    title AS [Title:],
    type AS [Category:],
    price AS [Price:],
    CASE
        WHEN price >= @cutPrice THEN 'above'
        WHEN price < @cutPrice THEN 'below'
        --ELSE NULL
    END AS [Option:]
    FROM dbo.titles
    WHERE (CASE WHEN price >= @cutPrice THEN 'above'
                WHEN price < @cutPrice THEN 'below'
            --ELSE NULL
            END) LIKE '%' + @option + '%'
    GROUP BY type, title, price
    HAVING type LIKE '%' + @cat + '%'
END

A: select title [Title:], type [Category:], price [Price:],
  [Option:] = iif(price >= @cutPrice, 'above', 'below')
from titles
where type like concat('%', @cat, '%') and (@option = ''
   or (@option='below' and price < @cutPrice)
   or (@option='above' and price >= @cutPrice))


text:
Q: Disable JhiAlertService from using TranslateService to translate message When i use my service to print a message, the JhiAlertService tries to translate the message, how can i disable?

import { Injectable } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { JhiAlertService } from 'ng-jhipster';

@Injectable({
    providedIn: 'root'
})
export class MessageServiceService {

    constructor(public translate: TranslateService, public alertService: JhiAlertService) {
        this.getTranslations();
    }

 getTranslations(){
  this.clientError1 = this.translate.instant('global.error.clientError1');
  this.clientError2 = this.translate.instant('global.error.clientError2');
 }

    printError(name, clientnumber) {
        this.alertService.error(
            this.clientError1 + name + this.clientError2 + clientnumber
        );
    }
}

A: Unfortunately I have not found a way to not activate the translate;
however, to solve the problem it is sufficient to pass the variables between the parameters as follows:
String:
MSG_STR: "Hello {{user}}"

Alert command:
this.alertService.error(MSG_STR, {user: 'Max'}));

Result:
Hello Max


text:
Q: Move Google Data Studio reports to Workspace account I am using free Gmail account for my Google Data Studio insights. I am now using Google Workspace.
How do I migrate my reports associated with my Gmail account to my new workspace account?

A: Your dashboards are not "inside" your Gmail account.  They are just owned by your Gmail account.
To make them available to a new account, just share your dashboard with the new account.  Doing so, you can make the new member the owner of the dashboard (and you can even remove the access from previous user if really desired).
To add users:

*

*Click "Share"

*In "Add people" tab, add who you wish to view the report

*You can select if you want to allow the person to just view or edit the dashboard

To change owner:

*

*Click "Share"

*In "Manage access" tab, click on the combo "Can edit"/"Can view" right of the name of who you want to be the owner

*Select "Make owner"


text:
Q: Regex Match range numbers between 13000 to 99999 I am trying to write some form validation, I need one of the inputs to be 13000-99999.
(^[1-1][3-3]?[0-9]?[0-9]?[0-9]?$|^[0-9][0-9][0-9][0-9][0-9]$)

It does not work as expected and it match all the following :
10   \\ matched but it should not
10000   \\ matched but it should not
12999
13000
20000
99999

can anyone help me? Thanks!

A: Although the way you are doing this is not ideal.  But if you are doing with this approach, your regex needs some changes:
(^[1-1][3-9][0-9][0-9][0-9]$|^[2-9][0-9][0-9][0-9][0-9]$)

This is because if the 1st digit is a 1, then the second number should be between a 3 and a 9.  If the 2nd digit is a 2, then any of 0-9 is valid for the second digit.  The last three digits are always 0-9 range.

A: You have more than one issue here

(^[1-1][3-3]?[0-9]?[0-9]?[0-9]?$|^[0-9][0-9][0-9][0-9][0-9]$)

1 - You have to remove all question mark ?
2 - In the second pattern in the first part [3-3] should be from [3-9]
3 - In the second part after | this should be from [2-9]
You can use one of the following regex (^[1-1][3-9][0-9][0-9][0-9]$|^[2-9][0-9][0-9][0-9][0-9]$), (^[1-1][3-9]|^[2-9][0-9])[0-9][0-9][0-9]$ or  1[3-9]\d{3}|[2-9]\d{4}
first you need to match any number that start from 1 and from 3 to 9 or start from 2 to 9 and any number 0 to 9 and all rest number can any from 0 to 9


text:
Q: Decay of matter I was watching Stephen Hawking's documentary and in there he explained how he realized why black holes eventually disintegrate:

There are ripples in space, an antiparticle and a particle get created for a brief time then annihilate each other. When this happens very close to a black hole sometimes an antiparticle will be sucked in, but normal particle will escape. Hence the black hole radiation is due to extra particles escaping and black hole disintegration is due to antimatter getting sucked in.

That made me think what happens around ordinary matter. If the antiparticle is close enough to a normal particle then it will annihilated. So is this what is responsible for Radioactive Decay? And how does it affect normal matter? For example a human being? Does it mean that all the atoms will eventually disintegrate?
I am not QM savy so if you can explain it in layman terms that would be very appreciated.

A: At least for the radioactive decay that most people are familiar with, and that you're probably talking about, electroweak force is the cause.

A: I'm going to give this a shot, cause I think it's a fun question, but you probobly should work it out a bit more.
Virtual particles, or particle/anti-particle creation looks like 1 electron and 1 anti electron (for example) existing briefly then cancelling each other out.   If it happens in the void of space, they interact with each other and - poof, gone.   They (as I understand it) borrow energy from the future, are created and annihilate each other with no net energy created.
If they are created near an atom - it's perfectly reasonable to say that the anti-electron meets an electron around an atom - but all that happens in this scenario is that the "non virtual" electron is replaced by the virtual electron. - nothing really changes.
Same if you have a quark/antiquark, where if an anti-up quark meets an up quark in the nucleus, you have the virtual up quark ready to replace it - so it doesn't explain the Proton to Neutron or Neutron to proton change known as beta decay.
unless it's a virtual W or Z boson . . . not sure where to go with that, as that's a bit over my pay-grade, but there's a question about that here:   Are W & Z bosons virtual or not?
Your idea, I think, works for electron capture.   (Both Electron Capture and Beta decay described in the link below).
http://www.livescience.com/49254-weak-force.html
I'm, however, a layman who enjoys physics as a hobby, not a professor, so take my explanation with a grain or two of skepticism.

A:
... is this what is responsible for Radioactive Decay?

Sort of ... radioactive decay occurs when the final state (result of the decay) has lower energy than the initial nucleus and the barrier is occasionally surmounted. This barrier penetration and the virtual pair at the black hole horizon are both quantum processes, so they have a little physics in common.

And how does it affect normal matter?
  For example a human being?
  Does it mean that all the atoms will eventually disintegrate?

Fortunately, Hawking's ideas do not affect normal matter. The pair creation can be used to understand why a black hole evaporates. Stable nuclei and atoms have an infinite lifetime - all the higher-order quantum loop corrections have been accounted for in calculating the stable (infinite) lifetime. So human beings, or at least the atoms they're made of, aren't going to go away any time soon. Our current best guess for the future of the universe (say 100 trillion years from now) is a cold, dark place, with nothing going on, but all the atoms are still there doing essentially nothing. There will be zero-point fluctuations, but there will be zero point in those - OK?!


text:
Q: How to identify if a OneDrive DriveItem permission identity is a group or a user We are getting the permissions of a driveItem using Microsoft Graph as documented here.
Each returned permission object usually contains a grantedTo field that has an IdentitySet as its value. But the issue with that is that each Identity is always a user:
"grantedTo": {
    "user": {
        "displayName": "data Owners",
        "email": "data@example.onmicrosoft.com",
        "id": "94c3e81b-f6fb-43c6-8df5-b98462ccf191"
    }
}

"grantedTo": {
    "user": {
        "displayName": "Data Members"
    }
}

This occurs even though those are Groups. So there's no way, using this data, to identify with certainty what is a Group and what is a User.
We want to avoid any additional request to do so as this can become quite inefficient.
Thus we are asking is there a way to identify if it is a group or user, without any additional API requests? For example some undocumented query parameters or relationships?

A: I'm afraid this isn't possible because the IdentitySet itself doesn't distinguish between Users and Groups:
{
  "application": {"@odata.type": "microsoft.graph.identity"},
  "device": {"@odata.type": "microsoft.graph.identity"},
  "user": {"@odata.type": "microsoft.graph.identity"}
}


text:
Q: MySQL REPLACE(a, b) equivalent in mongodb? I'm trying to replace a pattern in mongodb. In MySQL I just do
UPDATE table SET field = REPLACE(field, ?, ?)

What about mongodb? I need to work on a collection with 200K records, looping through the collection and write back is a bad idea. I need a builtin function to do that.
Tried to google for REPLACE method, but didn't find anything releated


text:
Q: ubuntu 20.04 applications menu has no icons, but can launch softwares from the side bar tray that still has icons I upgraded from Ubuntu 18.04 LTS to 20.04 yesterday, The update ran successfully and rebooted the system.
As soon as I logged in to the desktop, I clicked on the applications menu and there were no icons. I tried searching for existing installed software but it kept showing me "Searching . . . ".
I went to the frequents tab and the menu crashed and some notification about an internal error has been detected was shown.

A: I had the same problem. To fix it, type:
sudo apt install --reinstall gnome-control-center

If you have trouble logging in after reboot, do:

*

*ctrl + alt + f2

*Login in

*sudo apt update

*sudo apt upgrade

*sudo reboot
Good luck.


text:
Q: print tuple beautifully with newline >>> print(("hello\nworld", "hello2"))
('hello\nworld', 'hello2')

How to make it print:
('hello
world', 'hello2')

I mean it must not print \n as the symbol but implement this symbol and make a new line.
Python version is 3.4.
I tried to use pprint but it does the same:
>>> import pprint
>>> pp = pprint.PrettyPrinter(indent=4)
>>> pp.pprint(("hello\nworld"))
'hello\nworld'

A: There isn't anything that will do that kind of printing for you automatically. Python containers by default use repr to convert their contents to strings (even when you call str on the container, rather than repr). This is to avoid ambiguity from things like ["foo, bar", "baz"] (if the quotes didn't get included, you couldn't tell if there were two or three items were in the list).
You can do your own formatting of your tuple, however, and get the output you want:
print("({})".format(", ".join(tup)))

A: If you didn't want the parentheses and commas, it would be a simple matter of using the * operator:
>>> t = ("hello\nworld", "hello2")
>>> print(*t)
hello
world hello2

If you want it to print the parentheses and commas but also turn '\n' into newlines, you'll have to code that behavior, as @Peter says.
>>> print('(' + ', '.join(t) + ')')
(hello
world, hello2)

A: Writing:
print("('Hello\nworld', 'hello2')")

will literally print:
('hello
world', 'hello2')

If you are just wanting a new line inserted in your string, use this:
print("Line1\nLine2")

the \n is the escape sequence for a new line, terminating the current line and signaling the start of the next line.
For comparing it to the code you have, you should note the placement of the " symbols, denoting the beginning and end of the string.

A: >>> t = ("hello\nworld", "hello2")
>>> print '({})'.format(', '.join("'{}'".format(value) for value in t))
('hello
world', 'hello2')

This won't be correct if the strings contain ' marks.
Be aware that Python's formatting does clever things to deal with strings containing quotation marks.

A: Here is a more complex example from some Ansible output that was annoying me:
import pprint

f={
    "failed": True,
    "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'dict object' has no attribute 'uid'\n\nThe error appears to have been in '/usr/local/etc/ansible/roles/singleplatform-eng.users/tasks/main.yml': line 7, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Per-user group creation\n  ^ here\n"
    }

def ppdump(data):
    print pprint.pformat(data, indent=4, width=-1).replace('\\n', '\n')

ppdump(f)
{   'failed': True,
    'msg': "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'dict object'
has no attribute 'uid'

The error appears to have been in '/usr/local/etc/ansible/roles/singleplatform-eng.users/tasks/main.yml': line 7, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: Per-user group creation
  ^ here
"}

The problem is that pprint escapes out newlines, so I just unescape them.

A: You can do something like this:
v = [(1,2),(2,3),(4,5)]
for item in v:
    n1,n2 = item
    print(n1,n2)

Refer to this https://i.stack.imgur.com/rEfiM.png


text:
Q: Issue with R if else loop: Conditions only partly executed I have the following data frame:
Row    Repro Number2
1      1     EWC
2     NA     LWY
3      7     EWS
4     NA     LWC
5     NA     EWC
6     NA     LWC
7      3     EWY
8     NA    LW2Y
9     NA Unknown
10    NA     LWC
11     1     EWC
12    NA     LWY
13    NA     EWY
14    NA     LWY
15    NA Unknown
16    NA     LWC

On this data frame, I am using the following loop:
for (i in 1:nrow(df3)) {
  if(df3$Number2[i+1]=="Unknown" & is.na(df3$Repro[i])) {
    df3$Number2[i]="Unknown"
  } else{
    df3$Number2[i]==df3$Number2[i]
  }
}

While the loop does run, I get an error code at the end and the data frame ends up not looking like the result I want.
My issue is that while the code is carrying out its intended purpose (replacing values in the number2 column with "Unknown" if the value after it is also "Unknown" and the associated Repro value is NA), it is only doing it with "Unknown" values that are initially in the datafreame. I want it to also take into account the new "Unknowns" added and carry out the loop conditions with those too.
Here is the error code:
Error in if (df3$Number2[i + 1] == "Unknown" & is.na(df3$Repro[i])) { :
  missing value where TRUE/FALSE needed

And here is the data frame after running the loop. I have added another column called "Number2.Correct" showing what I want the Number2 column to actually look like. The   issue is with the rows 12 and 13 - These should be "Unknowns" and not "LWY" and "EWY", respectively.
   Repro Number2  Number2.Correct
1      1     EWC  EWC
2     NA     LWY  LWY
3      7     EWS  EWS
4     NA     LWC  LWC
5     NA     EWC  EWC
6     NA     LWC  LWC
7      3     EWY  EWY
8     NA Unknown  Unknown
9     NA Unknown  Unknown
10    NA     LWC  LWC
11     1     EWC  EWC
12    NA     LWY  Unknown
13    NA     EWY  Unknown
14    NA Unknown  Unknown
15    NA Unknown  Unknown
16    NA     LWC  LEW

In the end, I have two questions:

*

*How do I change my code to give me the result I want?

*Why is the error code appearing and is it partly responsible for the issue?

A: for (i in rev(1:nrow(df3))) {
  if (df3$Number2[i + 1] == "Unknown" & is.na(df3$Repro[i]) & i + 1 < nrow(df3)) {
    df3$Number2[i] <- "Unknown"
  } else {
    df3$Number2[i] == df3$Number2[i]
  }
}

df3
#>    Row Repro Number2
#> 1    1     1     EWC
#> 2    2    NA     LWY
#> 3    3     7     EWS
#> 4    4    NA     LWC
#> 5    5    NA     EWC
#> 6    6    NA     LWC
#> 7    7     3     EWY
#> 8    8    NA Unknown
#> 9    9    NA Unknown
#> 10  10    NA     LWC
#> 11  11     1     EWC
#> 12  12    NA Unknown
#> 13  13    NA Unknown
#> 14  14    NA Unknown
#> 15  15    NA Unknown
#> 16  16    NA     LWC

Created on 2023-01-09 with reprex v2.0.2
You had two issues:

*

*i + 1 is out of range for the final row in your data; I added another condition (i + 1 < nrow(df3))

*The desired output you posted suggests that you want to look for Unknown from bottom to top, not top to bottom. You can reverse the order with rev()

A: The i+1 goes out of range after the nrow of the data.  We may use a group by approach with tidyverse
library(dplyr)
library(tidyr)
library(data.table)
 df3 %>%
  mutate(grp = replace(replace(Number2, Number2 != "Unknown", NA),
    Number2 == "Unknown", seq_len(sum(Number2 == "Unknown")))) %>%
  fill(grp, .direction = "updown") %>%
  group_by(grp, grp2 = rleid(is.na(Repro))) %>%
  mutate(Number2 = case_when(is.na(Repro) &
    row_number() < match("Unknown", Number2) ~ "Unknown",
    TRUE ~ Number2)) %>%
  ungroup %>%
  select(-grp, -grp2)

-output
# A tibble: 16 × 3
     Row Repro Number2
   <int> <int> <chr>
 1     1     1 EWC
 2     2    NA LWY
 3     3     7 EWS
 4     4    NA LWC
 5     5    NA EWC
 6     6    NA LWC
 7     7     3 EWY
 8     8    NA Unknown
 9     9    NA Unknown
10    10    NA LWC
11    11     1 EWC
12    12    NA Unknown
13    13    NA Unknown
14    14    NA Unknown
15    15    NA Unknown
16    16    NA LWC

data
df3 <- structure(list(Row = 1:16, Repro = c(1L, NA, 7L, NA, NA, NA,
3L, NA, NA, NA, 1L, NA, NA, NA, NA, NA), Number2 = c("EWC", "LWY",
"EWS", "LWC", "EWC", "LWC", "EWY", "LW2Y", "Unknown", "LWC",
"EWC", "LWY", "EWY", "LWY", "Unknown", "LWC")),
 class = "data.frame", row.names = c(NA,
-16L))

A: The reason that the code fails is because nrow(df3)+1 is out of range. so the for loop needs to be 1:(nrow(df3)-1)
To iteratively update Number2, one easy way (although not elegant) is to use while loop. The stopping condition is when new and old Number2 is the same.
while(T){
  df3$Number2_new <- df3$Number2
  for (i in 1:(nrow(df3)-1)) {
    if(df3$Number2_new[i+1]=="Unknown" & is.na(df3$Repro[i])) {
      df3$Number2_new[i]="Unknown"
    } else{
      df3$Number2_new[i]==df3$Number2_new[i]
    }
  }

  if(all(df3$Number2==df3$Number2_new)){
    df3 <- df3%>%
      mutate(Number2=Number2_new)%>%
      select(-Number2_new)
    break
  }else{
    df3 <- df3%>%
      mutate(Number2=Number2_new)%>%
      select(-Number2_new)
  }
}

df3

   Row Repro Number2
1    1     1     EWC
2    2    NA     LWY
3    3     7     EWS
4    4    NA     LWC
5    5    NA     EWC
6    6    NA     LWC
7    7     3     EWY
8    8    NA Unknown
9    9    NA Unknown
10  10    NA     LWC
11  11     1     EWC
12  12    NA Unknown
13  13    NA Unknown
14  14    NA Unknown
15  15    NA Unknown
16  16    NA     LWC


text:
Q: Is it possible to break a carbon dioxide molecule using electromagnetic waves? I'm no expert in physics, but I was just wondering if breaking apart $\rm CO_2$ into oxygen and carbon would be possible using certain electromagnetic wave?

A: Yes it is possible but not that easy as freecharly says. As it is mad of one carbon and two oxigen atoms, the splitting process has more possible end products. The energetically preferred one is carbon monoxide and an oxygen atom (CO + O ). But researchers discover a new way to have (C + 02)...look for example this article: https://phys.org/news/2014-10-oxygen-molecules-carbon-dioxide.html ;)

A: Yes you can decompose $CO_2$ with electromagnetic waves (light). It is possible to ionize carbon dioxide with ultra-violett light with a photon energy of about 13.78 eV. And, for sure, you can decompose the whole molecule into atoms with light of appropriate photon energies.


text:
Q: how to prevent data duplication in sqlite I'm trying to insert only unique data into SQLite, so i found in android documentation that i can use insertWithOnConflict(table, nullColumnHack, contentValue, ignore_conflict) but it works exactly as the regular insert(); . honestly, I did not understand nullColumnHack I tried null and my column name but still the same result, please help
this is my code
public void insertNewList(String list_name)
    {
        SQLiteDatabase db= this.getWritableDatabase();
        ContentValues cv = new ContentValues();
        cv.put(DB_COLUMN, list_name);
        db.insertWithOnConflict(DB_TABLE, null, cv, db.CONFLICT_IGNORE);

    }

DB_TABLE is my table name which is: lists_name