qid
int64
1
74.6M
question
stringlengths
45
24.2k
date
stringlengths
10
10
metadata
stringlengths
101
178
response_j
stringlengths
32
23.2k
response_k
stringlengths
21
13.2k
25,457,631
Im having a problem with my css, when my paragraph is long, I want that my text continues aligned with my test that are alongside the image. But Im not having this, Im having my text to go left when it exceeds the image height, as you see in my image. And also, I'm having a blank space, marked by the circle in my pic...
2014/08/23
['https://Stackoverflow.com/questions/25457631', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3026353/']
Just add **float:right; position:relative** for your paragraph and adjust the width of paragraph if it is positioning below the image.
Add a div for your image in html file and add this in your css ``` #image{ width:210px; height:1000px; float:left; } ```
25,457,631
Im having a problem with my css, when my paragraph is long, I want that my text continues aligned with my test that are alongside the image. But Im not having this, Im having my text to go left when it exceeds the image height, as you see in my image. And also, I'm having a blank space, marked by the circle in my pic...
2014/08/23
['https://Stackoverflow.com/questions/25457631', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3026353/']
You could wrap the paragraph in a div tag: ``` <img src="http://www.peacethroughpie.org/wp-content/uploads/2013/09/baked-pie.jpg"> <div><p> ... </p></div> ``` Then you could set the div to a width of 100% - width of image and float it to the right. ``` img { float: left; width: 20%; } div { display: blo...
Add a div for your image in html file and add this in your css ``` #image{ width:210px; height:1000px; float:left; } ```
1,860,155
If the name is like "david" it comes within the allotted space.... but if the name is like "john pal abraham desouza" the allotted space increases automatically.. So i need to have the name occupied in the allotted space by auto resizing the font.. Suggest me a solution..
2009/12/07
['https://Stackoverflow.com/questions/1860155', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/174796/']
It sounds to me like what you want to do is roll your own Custom .NET Membership Provider. It will allow you to use the built-in ASP.NET Authentication/Authorization attributes on your Controller Actions while giving you complete control over the implementation inside the provider (which will allow you to code it to m...
If you go ahead and create your own custom solution, you will have a better idea of how difficult it is and what features you want. This will help you to evaluate off-the-shelf solutions for future projects. OTOH, spending time developing functionality that is already readily available means you won't be spending that...
1,860,155
If the name is like "david" it comes within the allotted space.... but if the name is like "john pal abraham desouza" the allotted space increases automatically.. So i need to have the name occupied in the allotted space by auto resizing the font.. Suggest me a solution..
2009/12/07
['https://Stackoverflow.com/questions/1860155', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/174796/']
It sounds to me like what you want to do is roll your own Custom .NET Membership Provider. It will allow you to use the built-in ASP.NET Authentication/Authorization attributes on your Controller Actions while giving you complete control over the implementation inside the provider (which will allow you to code it to m...
I think you recognize where the thin parts in your consideration are: namely in that you've included how to do what you're doing as motive in why you're doing it and the NIH (funny: I'd never seen that before) issue. Putting those aside, your provider is something that you could potentially reuse and it may simplify s...
1,860,155
If the name is like "david" it comes within the allotted space.... but if the name is like "john pal abraham desouza" the allotted space increases automatically.. So i need to have the name occupied in the allotted space by auto resizing the font.. Suggest me a solution..
2009/12/07
['https://Stackoverflow.com/questions/1860155', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/174796/']
It sounds to me like what you want to do is roll your own Custom .NET Membership Provider. It will allow you to use the built-in ASP.NET Authentication/Authorization attributes on your Controller Actions while giving you complete control over the implementation inside the provider (which will allow you to code it to m...
I too am working on a pet Project using ASP.net MVC and db4o and did the same thing, so you're at least not alone in going down that route :). One of the biggest reasons for me to start playing around with db4o as persistence layer is that especially authorization on field level (i.e I'm allowed to see Person A's first...
2,568,467
In our organization, we are still on .net 1.1 environment, using javascript, a few open source applications/widgets. Development is done using Visual Studio 2003, grid view, and iframes. Our application works in Internet Explorer 7 and IE 8 (in compatibilily mode). Can anyone give any basic steps we can take to get our...
2010/04/02
['https://Stackoverflow.com/questions/2568467', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
Use jQuery for reliable cross browser JavaScript Was it VS 2k or VS 2k3 that "helped" the developer by rewriting their HTML (in all CAPS no less)?
Make your HTML markup standards compliant. I find that developing my website following W3C standards ensure that my sites work in all major browsers. I also develop in Firefox and then fix IE using conditional stylesheets. The .NET version does not matter on browser compatibility.
2,568,467
In our organization, we are still on .net 1.1 environment, using javascript, a few open source applications/widgets. Development is done using Visual Studio 2003, grid view, and iframes. Our application works in Internet Explorer 7 and IE 8 (in compatibilily mode). Can anyone give any basic steps we can take to get our...
2010/04/02
['https://Stackoverflow.com/questions/2568467', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
Use jQuery for reliable cross browser JavaScript Was it VS 2k or VS 2k3 that "helped" the developer by rewriting their HTML (in all CAPS no less)?
.Net in its 2.0 iteration got *a lot* better (compared to 1.1) at producing cross-browser, and certainly *more* standards-compliant code (although not perfect by any means). If you can upgrade to 2.0 this will get you a lot of progress on the standards compliance front for free (unless your own controls / html render...
2,568,467
In our organization, we are still on .net 1.1 environment, using javascript, a few open source applications/widgets. Development is done using Visual Studio 2003, grid view, and iframes. Our application works in Internet Explorer 7 and IE 8 (in compatibilily mode). Can anyone give any basic steps we can take to get our...
2010/04/02
['https://Stackoverflow.com/questions/2568467', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
Use jQuery for reliable cross browser JavaScript Was it VS 2k or VS 2k3 that "helped" the developer by rewriting their HTML (in all CAPS no less)?
1. Install and Run Firefox (and get the Firebug addon). 2. Enter your application and open the Firebug console (F12) to see what issues your application is encountering. (in the Console Tab) 3. Start with the Errors. 1. Change any JavaScript that is doing things like *document.all.xxxx* to use **document.getElementByI...
2,568,467
In our organization, we are still on .net 1.1 environment, using javascript, a few open source applications/widgets. Development is done using Visual Studio 2003, grid view, and iframes. Our application works in Internet Explorer 7 and IE 8 (in compatibilily mode). Can anyone give any basic steps we can take to get our...
2010/04/02
['https://Stackoverflow.com/questions/2568467', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
Make your HTML markup standards compliant. I find that developing my website following W3C standards ensure that my sites work in all major browsers. I also develop in Firefox and then fix IE using conditional stylesheets. The .NET version does not matter on browser compatibility.
.Net in its 2.0 iteration got *a lot* better (compared to 1.1) at producing cross-browser, and certainly *more* standards-compliant code (although not perfect by any means). If you can upgrade to 2.0 this will get you a lot of progress on the standards compliance front for free (unless your own controls / html render...
2,568,467
In our organization, we are still on .net 1.1 environment, using javascript, a few open source applications/widgets. Development is done using Visual Studio 2003, grid view, and iframes. Our application works in Internet Explorer 7 and IE 8 (in compatibilily mode). Can anyone give any basic steps we can take to get our...
2010/04/02
['https://Stackoverflow.com/questions/2568467', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
1. Install and Run Firefox (and get the Firebug addon). 2. Enter your application and open the Firebug console (F12) to see what issues your application is encountering. (in the Console Tab) 3. Start with the Errors. 1. Change any JavaScript that is doing things like *document.all.xxxx* to use **document.getElementByI...
.Net in its 2.0 iteration got *a lot* better (compared to 1.1) at producing cross-browser, and certainly *more* standards-compliant code (although not perfect by any means). If you can upgrade to 2.0 this will get you a lot of progress on the standards compliance front for free (unless your own controls / html render...
9,699,529
In a website I am working on, there is an advanced search form with several fields, some of them dynamic that show up / hide depending on what is being selected on the search form. Data expected to be big in the database and records are spread over several tables in a very normalized fashion. Is there a recommendatio...
2012/03/14
['https://Stackoverflow.com/questions/9699529', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/248665/']
The purpose of `final` but non-`static` variables is to have an object-wide constant. It should be initialized in the constructor: ``` class Passenger { final int b; Passenger(int b) { this.b = b; } } ``` If you are always assigning a constant literal value (`0`) to the `final` variable, it does...
If you have multiple instances of `Passenger` class, I would go for making it static. While this has little benefit when talking about an `int` variable, this could save some memory if you have complex objects. This is because a static variable belongs to a class, not to an instance, thus memory space for it will be re...
9,699,529
In a website I am working on, there is an advanced search form with several fields, some of them dynamic that show up / hide depending on what is being selected on the search form. Data expected to be big in the database and records are spread over several tables in a very normalized fashion. Is there a recommendatio...
2012/03/14
['https://Stackoverflow.com/questions/9699529', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/248665/']
If you have multiple instances of `Passenger` class, I would go for making it static. While this has little benefit when talking about an `int` variable, this could save some memory if you have complex objects. This is because a static variable belongs to a class, not to an instance, thus memory space for it will be re...
A `final` primitive is the same as a `static final` primitive (except more efficient) A `final` reference to an immutable object the same as a `static final` reference of the same. A `final` reference to a mutable object is NOT the same as a `static final` reference of the same. ``` final int i = 0; // same as stati...
9,699,529
In a website I am working on, there is an advanced search form with several fields, some of them dynamic that show up / hide depending on what is being selected on the search form. Data expected to be big in the database and records are spread over several tables in a very normalized fashion. Is there a recommendatio...
2012/03/14
['https://Stackoverflow.com/questions/9699529', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/248665/']
The purpose of `final` but non-`static` variables is to have an object-wide constant. It should be initialized in the constructor: ``` class Passenger { final int b; Passenger(int b) { this.b = b; } } ``` If you are always assigning a constant literal value (`0`) to the `final` variable, it does...
A `final` primitive is the same as a `static final` primitive (except more efficient) A `final` reference to an immutable object the same as a `static final` reference of the same. A `final` reference to a mutable object is NOT the same as a `static final` reference of the same. ``` final int i = 0; // same as stati...
9,699,529
In a website I am working on, there is an advanced search form with several fields, some of them dynamic that show up / hide depending on what is being selected on the search form. Data expected to be big in the database and records are spread over several tables in a very normalized fashion. Is there a recommendatio...
2012/03/14
['https://Stackoverflow.com/questions/9699529', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/248665/']
It depends on the purpose of b. Usually constants are there for a specific purpose. If you make it static you could accidentally change it in some instance of that class and that will affect all the others.
In java, the `static` attribute basically means: **associated with the type itself, rather than an instance of the type**. In other words you can reference a static variable without creating instances of that type... Whereas in the case of just using `final` you'd need to instantiate the class. So, yes, to answer you...
9,699,529
In a website I am working on, there is an advanced search form with several fields, some of them dynamic that show up / hide depending on what is being selected on the search form. Data expected to be big in the database and records are spread over several tables in a very normalized fashion. Is there a recommendatio...
2012/03/14
['https://Stackoverflow.com/questions/9699529', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/248665/']
The purpose of `final` but non-`static` variables is to have an object-wide constant. It should be initialized in the constructor: ``` class Passenger { final int b; Passenger(int b) { this.b = b; } } ``` If you are always assigning a constant literal value (`0`) to the `final` variable, it does...
In java, the `static` attribute basically means: **associated with the type itself, rather than an instance of the type**. In other words you can reference a static variable without creating instances of that type... Whereas in the case of just using `final` you'd need to instantiate the class. So, yes, to answer you...
9,699,529
In a website I am working on, there is an advanced search form with several fields, some of them dynamic that show up / hide depending on what is being selected on the search form. Data expected to be big in the database and records are spread over several tables in a very normalized fashion. Is there a recommendatio...
2012/03/14
['https://Stackoverflow.com/questions/9699529', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/248665/']
It depends on the purpose of b. Usually constants are there for a specific purpose. If you make it static you could accidentally change it in some instance of that class and that will affect all the others.
A `final` variable is defined when you need a constant, so you can assign a value just once. Using `static`, instead, you are defining a variable shared by all the objects of that type (like a global variable) and it is not associated with a certain object itself.
9,699,529
In a website I am working on, there is an advanced search form with several fields, some of them dynamic that show up / hide depending on what is being selected on the search form. Data expected to be big in the database and records are spread over several tables in a very normalized fashion. Is there a recommendatio...
2012/03/14
['https://Stackoverflow.com/questions/9699529', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/248665/']
The purpose of `final` but non-`static` variables is to have an object-wide constant. It should be initialized in the constructor: ``` class Passenger { final int b; Passenger(int b) { this.b = b; } } ``` If you are always assigning a constant literal value (`0`) to the `final` variable, it does...
It depends on the purpose of b. Usually constants are there for a specific purpose. If you make it static you could accidentally change it in some instance of that class and that will affect all the others.
9,699,529
In a website I am working on, there is an advanced search form with several fields, some of them dynamic that show up / hide depending on what is being selected on the search form. Data expected to be big in the database and records are spread over several tables in a very normalized fashion. Is there a recommendatio...
2012/03/14
['https://Stackoverflow.com/questions/9699529', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/248665/']
It depends on the purpose of b. Usually constants are there for a specific purpose. If you make it static you could accidentally change it in some instance of that class and that will affect all the others.
A `final` primitive is the same as a `static final` primitive (except more efficient) A `final` reference to an immutable object the same as a `static final` reference of the same. A `final` reference to a mutable object is NOT the same as a `static final` reference of the same. ``` final int i = 0; // same as stati...
9,699,529
In a website I am working on, there is an advanced search form with several fields, some of them dynamic that show up / hide depending on what is being selected on the search form. Data expected to be big in the database and records are spread over several tables in a very normalized fashion. Is there a recommendatio...
2012/03/14
['https://Stackoverflow.com/questions/9699529', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/248665/']
The purpose of `final` but non-`static` variables is to have an object-wide constant. It should be initialized in the constructor: ``` class Passenger { final int b; Passenger(int b) { this.b = b; } } ``` If you are always assigning a constant literal value (`0`) to the `final` variable, it does...
A `final` variable is defined when you need a constant, so you can assign a value just once. Using `static`, instead, you are defining a variable shared by all the objects of that type (like a global variable) and it is not associated with a certain object itself.
9,699,529
In a website I am working on, there is an advanced search form with several fields, some of them dynamic that show up / hide depending on what is being selected on the search form. Data expected to be big in the database and records are spread over several tables in a very normalized fashion. Is there a recommendatio...
2012/03/14
['https://Stackoverflow.com/questions/9699529', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/248665/']
If you have multiple instances of `Passenger` class, I would go for making it static. While this has little benefit when talking about an `int` variable, this could save some memory if you have complex objects. This is because a static variable belongs to a class, not to an instance, thus memory space for it will be re...
A `final` variable is defined when you need a constant, so you can assign a value just once. Using `static`, instead, you are defining a variable shared by all the objects of that type (like a global variable) and it is not associated with a certain object itself.
64,261,847
So I wrote a model that computes results over various parameters via a nested loop. Each computation returns a list of `len(columns) = 10` elements, which is added to a list of lists (`res`). Say I compute my results for some parameters `len(alpha) = 2`, `len(gamma) = 2`, `rep = 3`, where rep is the number of repetiti...
2020/10/08
['https://Stackoverflow.com/questions/64261847', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/11436649/']
In some cases a pythonic code is a matter of style, one of its idioms is using list comprehension instead of loop so writing `result = [sum(j) for j in (zip(*i))]` is simpler than iterating over `zip(*i)`. On the other hand nested list comprehension looks more complex so **don't** do ``` avg_res = [[i/repetitions for...
It was a bit hard to follow your instructions, but as I caught, you attempt to try sum over all element in N'th list and divide it by repetitions. ``` res = [list(range(i,i+10)) for i in range(10)] N = 4 repetitions = 3 average_of_Nth_lists = sum([num for iter,item in enumerate(res) for num in item if iter%N==0])/repe...
9,450,204
I need create a link to `users/id/microposts` where `id` is the user id. I was wondering how I could do that with `link_to`? The HTML code is I am using for the moment is : ``` <strong><a href="/users/<%= @user.id %>/microposts">Microposts</a></strong> <%= user.microposts.count %> ``` Which renders the following : ...
2012/02/26
['https://Stackoverflow.com/questions/9450204', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1146764/']
Python uses dictionaries to keep local and global variables in. When looking up a variable reference, it will look into the local dict first. If you want to reference a variable in the global dictionary, put the global keyword in front of it. Also see answers to [this](https://stackoverflow.com/questions/370357/python...
I agree with user18044, however, is your confusion about the ’f(f)’? I agree that can be really confusing, especially in a non typed language. The argument to ’f’ is a function handle that has a local type scope with name ’f’. The way python decides which ’f’ gets used is explained by 18044. Python looks at the name ’f...
9,450,204
I need create a link to `users/id/microposts` where `id` is the user id. I was wondering how I could do that with `link_to`? The HTML code is I am using for the moment is : ``` <strong><a href="/users/<%= @user.id %>/microposts">Microposts</a></strong> <%= user.microposts.count %> ``` Which renders the following : ...
2012/02/26
['https://Stackoverflow.com/questions/9450204', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1146764/']
Python uses dictionaries to keep local and global variables in. When looking up a variable reference, it will look into the local dict first. If you want to reference a variable in the global dictionary, put the global keyword in front of it. Also see answers to [this](https://stackoverflow.com/questions/370357/python...
The locals for a function consist of everything that was passed in, and every variable that is assigned to and not explicitly tagged as `global` (or `nonlocal` in 3.x). The globals consist of everything that can be seen at global scope, including the function itself. When a name is referenced, it is looked up in the ...
56,877,001
As I clarify code, I rename and edit a file *so much* that git doesn't recognize it as a rename. A fix: commit rename of old file; then, commit the new file. How can I do this nicely with git, *after* all the editing? --- `git stash` doesn't recognize the new filename. Currently I do this: * move the new file els...
2019/07/03
['https://Stackoverflow.com/questions/56877001', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4930344/']
Git doesn't provide a really nice way to do this, but this works. Assumptions: * `foo` is the old name of the file, and the name the modified file still has on disk * `bar` is the new name you want it to have * There are no changes staged in the index Then do: ``` git update-index --add --cacheinfo "$(git ls-files -...
I guess it will sound simplistic, but the simplest solution is: When you're editing a file, and have a bunch of pending edits, and you decide the file needs to be renamed, (1) make a note that you need to rename it (2) get the file to a state where you can commit the changes you have (3) commit it (4) rename it (5) c...
58,065,328
I'm using NuxtJS's auth module and trying to get the Bearer token and a custom cookie that contains a sessionType on nuxtServerInit so I can update the `store` with a `mutation`, but it only works when I reload the page. If I close the browser and go directly to my app url, I keep getting undefined for auth.\_token.lo...
2019/09/23
['https://Stackoverflow.com/questions/58065328', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7666951/']
Having it work with F5 and not by hitting enter makes me suspect that it just works sometimes and sometimes it doesn't, because `F5` and `Enter` should trigger same behaviour on Nuxt (apart from some cache headers). The only suspicious thing about you code is the usage of an `async` function when the function is not r...
I've had the same issue and found out that `nuxtServerInit` is triggered first before the cookie was set like via a express middleware.
140,021
How to get number of subsites in a site collection using Powershell?
2015/04/29
['https://sharepoint.stackexchange.com/questions/140021', 'https://sharepoint.stackexchange.com', 'https://sharepoint.stackexchange.com/users/41443/']
or simply: ``` $site = Get-SPSite http://YourSharePointSite $site.AllWebs.Count ```
``` if ($ver.Version.Major -gt 1) {$host.Runspace.ThreadOptions = "ReuseThread"} if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) { Add-PSSnapin "Microsoft.SharePoint.PowerShell" } $sites = Get-SPSite <SiteCollectionUrl> $noOfWebs = 0 foreach ($web in $sites.AllWe...
140,021
How to get number of subsites in a site collection using Powershell?
2015/04/29
['https://sharepoint.stackexchange.com/questions/140021', 'https://sharepoint.stackexchange.com', 'https://sharepoint.stackexchange.com/users/41443/']
``` if ($ver.Version.Major -gt 1) {$host.Runspace.ThreadOptions = "ReuseThread"} if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) { Add-PSSnapin "Microsoft.SharePoint.PowerShell" } $sites = Get-SPSite <SiteCollectionUrl> $noOfWebs = 0 foreach ($web in $sites.AllWe...
Using the following code, within the SharePoint Management Shell, you can get the count of Web Applications in the Farm, Site Collections in Web Application, Sites in Site Collection. ``` Write-Host "Web Applications in Farm" $WebApplications = Get-SPWebApplication $WebApplications | Measure-Object | Format-List Count...
140,021
How to get number of subsites in a site collection using Powershell?
2015/04/29
['https://sharepoint.stackexchange.com/questions/140021', 'https://sharepoint.stackexchange.com', 'https://sharepoint.stackexchange.com/users/41443/']
or simply: ``` $site = Get-SPSite http://YourSharePointSite $site.AllWebs.Count ```
Using the following code, within the SharePoint Management Shell, you can get the count of Web Applications in the Farm, Site Collections in Web Application, Sites in Site Collection. ``` Write-Host "Web Applications in Farm" $WebApplications = Get-SPWebApplication $WebApplications | Measure-Object | Format-List Count...
20,010,268
I have base structure as given below ``` Sales.Customers Sales.Orders Sales.OrderDetails --------------- ------------ ------------------ country orderid orderid custid custid qty ``` So I need return United States customers, and for each customer return the total...
2013/11/15
['https://Stackoverflow.com/questions/20010268', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1739325/']
This should do: ``` SELECT C.custid, COUNT(DISTINCT O.orderid) as numorders, SUM(OD.qty) as totalqty FROM Sales.Customers AS C INNER JOIN Sales.Orders AS O ON C.custid = O.custid INNER JOIN Sales.OrderDetails AS OD ON O.orderid = OD.orderid WHERE country = 'USA' GROUP BY C.custid ORDER BY C.c...
Upon a bit more reading, you have two things wrong. You're summing orders instead of counting, and you're grouping on quantity. Try: ``` SELECT C.custid, COUNT(distinct O.orderid) as numorders, SUM(OD.qty) as totalqty FROM Sales.Customers AS C JOIN Sales.Orders AS O ON C.custid = O.custid JOIN Sales.OrderDetails...
3,875,021
This is a general best practice question about creating parent / child relationships with objects. Let's say I have Wheel and Car objects and I want to Add a Wheel object to car object ``` public class Car{ private List<Wheel> wheels = new List<Wheel>(); void AddWheel ( Wheel WheelToAdd) { ...
2010/10/06
['https://Stackoverflow.com/questions/3875021', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/425095/']
You might want to consider having a setter that only sets `Wheel.parentCar` if that setting is null, but only if you're able to assume that your first setting will be valid and are thus able to disregard any other attempts. Edit: but yes, that would be the proper place to add the `Car` object. You could also do a chec...
I'm going to go with "Don't". A wheel isn't just a property of a `Car`. A wheel could be used on a `Trailer` or a `Cart` or a `FerrisWheel` (ok, maybe that's a bit of a stretch). The point is, by making the car which uses the wheel a property of the wheel itself, you couple your wheel's design to being used on a car, a...
3,875,021
This is a general best practice question about creating parent / child relationships with objects. Let's say I have Wheel and Car objects and I want to Add a Wheel object to car object ``` public class Car{ private List<Wheel> wheels = new List<Wheel>(); void AddWheel ( Wheel WheelToAdd) { ...
2010/10/06
['https://Stackoverflow.com/questions/3875021', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/425095/']
You might want to consider having a setter that only sets `Wheel.parentCar` if that setting is null, but only if you're able to assume that your first setting will be valid and are thus able to disregard any other attempts. Edit: but yes, that would be the proper place to add the `Car` object. You could also do a chec...
May be a little left of centre but conceptually a wheel is a "part" of a car. Did you consider using partial classes? A passenger is a "part" of a queue. I find the use of partial classes and well defined interfaces is very useful in some scenarios. You can abstract out aspects of whole object into interfaces and imple...
3,875,021
This is a general best practice question about creating parent / child relationships with objects. Let's say I have Wheel and Car objects and I want to Add a Wheel object to car object ``` public class Car{ private List<Wheel> wheels = new List<Wheel>(); void AddWheel ( Wheel WheelToAdd) { ...
2010/10/06
['https://Stackoverflow.com/questions/3875021', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/425095/']
Bidirectional relationships tend to be very difficult to implement correctly. The prevailing advice here should be "don't do that, most likely you don't actually need it, and it will do you more harm than good." If, after much careful consideration, you decide a bidirectional relationship is warranted, you can make th...
I'm going to go with "Don't". A wheel isn't just a property of a `Car`. A wheel could be used on a `Trailer` or a `Cart` or a `FerrisWheel` (ok, maybe that's a bit of a stretch). The point is, by making the car which uses the wheel a property of the wheel itself, you couple your wheel's design to being used on a car, a...
3,875,021
This is a general best practice question about creating parent / child relationships with objects. Let's say I have Wheel and Car objects and I want to Add a Wheel object to car object ``` public class Car{ private List<Wheel> wheels = new List<Wheel>(); void AddWheel ( Wheel WheelToAdd) { ...
2010/10/06
['https://Stackoverflow.com/questions/3875021', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/425095/']
Bidirectional relationships tend to be very difficult to implement correctly. The prevailing advice here should be "don't do that, most likely you don't actually need it, and it will do you more harm than good." If, after much careful consideration, you decide a bidirectional relationship is warranted, you can make th...
May be a little left of centre but conceptually a wheel is a "part" of a car. Did you consider using partial classes? A passenger is a "part" of a queue. I find the use of partial classes and well defined interfaces is very useful in some scenarios. You can abstract out aspects of whole object into interfaces and imple...
3,875,021
This is a general best practice question about creating parent / child relationships with objects. Let's say I have Wheel and Car objects and I want to Add a Wheel object to car object ``` public class Car{ private List<Wheel> wheels = new List<Wheel>(); void AddWheel ( Wheel WheelToAdd) { ...
2010/10/06
['https://Stackoverflow.com/questions/3875021', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/425095/']
You might want to consider having a setter that only sets `Wheel.parentCar` if that setting is null, but only if you're able to assume that your first setting will be valid and are thus able to disregard any other attempts. Edit: but yes, that would be the proper place to add the `Car` object. You could also do a chec...
Take a look at [Is it bad practice for a child object to have a pointer to its parent?](https://stackoverflow.com/questions/3724092/is-it-bad-practice-for-a-child-object-to-have-a-pointer-to-its-parent)
3,875,021
This is a general best practice question about creating parent / child relationships with objects. Let's say I have Wheel and Car objects and I want to Add a Wheel object to car object ``` public class Car{ private List<Wheel> wheels = new List<Wheel>(); void AddWheel ( Wheel WheelToAdd) { ...
2010/10/06
['https://Stackoverflow.com/questions/3875021', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/425095/']
Bidirectional relationships tend to be very difficult to implement correctly. The prevailing advice here should be "don't do that, most likely you don't actually need it, and it will do you more harm than good." If, after much careful consideration, you decide a bidirectional relationship is warranted, you can make th...
Question: Can the Wheel instance be assigned to a different Car instance later in time? 1) If yes, the expose a public method to set the parentCar. You *could* make it a fluent method, for ease of code: ``` public class Wheel { private Car parentCar; public ParentCar { get { ...
3,875,021
This is a general best practice question about creating parent / child relationships with objects. Let's say I have Wheel and Car objects and I want to Add a Wheel object to car object ``` public class Car{ private List<Wheel> wheels = new List<Wheel>(); void AddWheel ( Wheel WheelToAdd) { ...
2010/10/06
['https://Stackoverflow.com/questions/3875021', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/425095/']
Bidirectional relationships tend to be very difficult to implement correctly. The prevailing advice here should be "don't do that, most likely you don't actually need it, and it will do you more harm than good." If, after much careful consideration, you decide a bidirectional relationship is warranted, you can make th...
It makes sense to me for the Car property of the Wheel object to be writable because there's nothing to stop you moving a Wheel from one ToyotaCamry (subclass of Car) to another. Though you might want to have a Drivable property on the original car to check that List.Count is still 4 before allowing Car.Drive() to be c...
3,875,021
This is a general best practice question about creating parent / child relationships with objects. Let's say I have Wheel and Car objects and I want to Add a Wheel object to car object ``` public class Car{ private List<Wheel> wheels = new List<Wheel>(); void AddWheel ( Wheel WheelToAdd) { ...
2010/10/06
['https://Stackoverflow.com/questions/3875021', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/425095/']
A better design methodology, (Domain Driven Design) specifies that you should first decide what the domain model requirements are for these entities... Not all entities need to be independantly accessible, and if `Wheel` falls into this category, every instance of it will always be a child member of a `Car` object and ...
Question: Can the Wheel instance be assigned to a different Car instance later in time? 1) If yes, the expose a public method to set the parentCar. You *could* make it a fluent method, for ease of code: ``` public class Wheel { private Car parentCar; public ParentCar { get { ...
3,875,021
This is a general best practice question about creating parent / child relationships with objects. Let's say I have Wheel and Car objects and I want to Add a Wheel object to car object ``` public class Car{ private List<Wheel> wheels = new List<Wheel>(); void AddWheel ( Wheel WheelToAdd) { ...
2010/10/06
['https://Stackoverflow.com/questions/3875021', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/425095/']
You might want to consider having a setter that only sets `Wheel.parentCar` if that setting is null, but only if you're able to assume that your first setting will be valid and are thus able to disregard any other attempts. Edit: but yes, that would be the proper place to add the `Car` object. You could also do a chec...
It makes sense to me for the Car property of the Wheel object to be writable because there's nothing to stop you moving a Wheel from one ToyotaCamry (subclass of Car) to another. Though you might want to have a Drivable property on the original car to check that List.Count is still 4 before allowing Car.Drive() to be c...
3,875,021
This is a general best practice question about creating parent / child relationships with objects. Let's say I have Wheel and Car objects and I want to Add a Wheel object to car object ``` public class Car{ private List<Wheel> wheels = new List<Wheel>(); void AddWheel ( Wheel WheelToAdd) { ...
2010/10/06
['https://Stackoverflow.com/questions/3875021', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/425095/']
A better design methodology, (Domain Driven Design) specifies that you should first decide what the domain model requirements are for these entities... Not all entities need to be independantly accessible, and if `Wheel` falls into this category, every instance of it will always be a child member of a `Car` object and ...
It makes sense to me for the Car property of the Wheel object to be writable because there's nothing to stop you moving a Wheel from one ToyotaCamry (subclass of Car) to another. Though you might want to have a Drivable property on the original car to check that List.Count is still 4 before allowing Car.Drive() to be c...
575,755
I am running a regression model in R including the following variables: * Intent = continuous DV * Attitude = continuous IV * Story = categorical IV in 4 levels: Consumer, Heritage, Vision and Product * Style = categorical IV in 4 levels: Amiable, Analytical, Driver and Expressive Categorical variables are dummy code...
2022/05/18
['https://stats.stackexchange.com/questions/575755', 'https://stats.stackexchange.com', 'https://stats.stackexchange.com/users/358498/']
I agree this is odd, but I suppose it could be caused by tied scores showing up in particular quartiles. Suppose we have 100 subjects that get scores from 1 to 100 in 1-point intervals, except that everybody who would have had a score between 26 and 50 instead gets a score of 30. In this case, the average score percent...
You said: "*The message is the perceived scores, and the actual scores are shown as a line for reference*" but I disagree. **It doesn't matter that they aren't straight.** Consider this, a variant of the upper left subplot: [![enter image description here](https://i.stack.imgur.com/Vxxcg.png)](https://i.stack.imgu...
114,415
Voldemort couldn't kill Harry as long as he called the Dursleys home. Why didn't he just murder the Dursleys? This would prevent Harry from being able to live there.
2016/01/11
['https://scifi.stackexchange.com/questions/114415', 'https://scifi.stackexchange.com', 'https://scifi.stackexchange.com/users/55866/']
The traditional fanon answer is "there were blood wards protecting the house". It would not, however, have stopped Voldemort (or his Death Eaters) from attacking the Dursleys when they were out (as proved by Umbridge's dementor attack). That said, Voldemort would have needed to figure out 1) that Harry lived at the Du...
The Dursleys were safe by the same form of magic that kept Harry safe. However, all of them were only safe within the bounds of their home, till Harry came of age(i.e., he turned 17). Harry or any one of the Dursleys could have been attacked outside their home. Thus, when Harry was about to turn 17, the Order of Phoeni...
114,415
Voldemort couldn't kill Harry as long as he called the Dursleys home. Why didn't he just murder the Dursleys? This would prevent Harry from being able to live there.
2016/01/11
['https://scifi.stackexchange.com/questions/114415', 'https://scifi.stackexchange.com', 'https://scifi.stackexchange.com/users/55866/']
The traditional fanon answer is "there were blood wards protecting the house". It would not, however, have stopped Voldemort (or his Death Eaters) from attacking the Dursleys when they were out (as proved by Umbridge's dementor attack). That said, Voldemort would have needed to figure out 1) that Harry lived at the Du...
What would he achieve with this? According to Dumbledore: > > The magic I evoked fifteen years ago means that Harry has powerful > protection while he can still call this house ‘home.’ > > > Harry and Aunt Marge are the only living relatives of the Dursleys. So if the Dursleys are killed, then Harry will inher...
114,415
Voldemort couldn't kill Harry as long as he called the Dursleys home. Why didn't he just murder the Dursleys? This would prevent Harry from being able to live there.
2016/01/11
['https://scifi.stackexchange.com/questions/114415', 'https://scifi.stackexchange.com', 'https://scifi.stackexchange.com/users/55866/']
The Dursleys were safe by the same form of magic that kept Harry safe. However, all of them were only safe within the bounds of their home, till Harry came of age(i.e., he turned 17). Harry or any one of the Dursleys could have been attacked outside their home. Thus, when Harry was about to turn 17, the Order of Phoeni...
What would he achieve with this? According to Dumbledore: > > The magic I evoked fifteen years ago means that Harry has powerful > protection while he can still call this house ‘home.’ > > > Harry and Aunt Marge are the only living relatives of the Dursleys. So if the Dursleys are killed, then Harry will inher...
15,243,891
Hi, I'm trying to do a simple app with Hibernate and Maven. I've created hibernate.cfg.xml and mapping file contacts.hbm.xml. **Once I start it I get an exception:** ``` SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http:/...
2013/03/06
['https://Stackoverflow.com/questions/15243891', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/304911/']
To get you started, I'll give an example with `S3` classes: ``` # create an S3 class using setClass: setClass("S3_class", representation("list")) # create an object of S3_class S3_obj <- new("S3_class", list(x=sample(10), y=sample(10))) ``` Now, you can function-overload internal functions, for example, `length` fun...
R also has function closures, which fits your example quite nicely ``` test = function() { len = 0 set_length = function(l = 0) len <<-l get_length = function() len return(list(set_length=set_length, get_length=get_length)) } ``` this gives: ``` R> m = test() R> m$set_length(10) R> m$get_length() [1] 10 R> ...
28,200,567
I'd like to disable some features of a web app I'm building, if the browser is Tor Browser. Can I inside the browser itself (client side, not server side) find out if the browser is Tor Browser? I would prefer a solution that didn't issue any HTTP requests to match the browser's IP against Tor exit nodes. Background:...
2015/01/28
['https://Stackoverflow.com/questions/28200567', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/694469/']
The "official" way to detect tor is to check the user's IP address and see if it's a tor exit node. Tor runs [TorDNSEL](https://www.torproject.org/projects/tordnsel.html.en) for this purpose. Here's a PHP implementation of a TorDNSEL lookup from a tutorial by [Irongeek](http://www.irongeek.com/i.php?page=security/dete...
There is no reliable way to detect the TOR Browser... That's kind of a goal of that browser. If you find a reliable way, chances are somebody else finds it too, tells the TOR developers and they close it. E.g. all TOR Browser bundles report bogus, but reasonable User-Agents. The current release version e.g. says it is...
28,200,567
I'd like to disable some features of a web app I'm building, if the browser is Tor Browser. Can I inside the browser itself (client side, not server side) find out if the browser is Tor Browser? I would prefer a solution that didn't issue any HTTP requests to match the browser's IP against Tor exit nodes. Background:...
2015/01/28
['https://Stackoverflow.com/questions/28200567', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/694469/']
The Tor browser is not designed to be undetectable (that's impossible to do). Rather, it is designed so that all copies are indistinguishable from each other: you cannot track a browser from one site to another, or from one visit to another, strictly through [browser fingerprinting](https://panopticlick.eff.org/). Thi...
The "official" way to detect tor is to check the user's IP address and see if it's a tor exit node. Tor runs [TorDNSEL](https://www.torproject.org/projects/tordnsel.html.en) for this purpose. Here's a PHP implementation of a TorDNSEL lookup from a tutorial by [Irongeek](http://www.irongeek.com/i.php?page=security/dete...
28,200,567
I'd like to disable some features of a web app I'm building, if the browser is Tor Browser. Can I inside the browser itself (client side, not server side) find out if the browser is Tor Browser? I would prefer a solution that didn't issue any HTTP requests to match the browser's IP against Tor exit nodes. Background:...
2015/01/28
['https://Stackoverflow.com/questions/28200567', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/694469/']
The "official" way to detect tor is to check the user's IP address and see if it's a tor exit node. Tor runs [TorDNSEL](https://www.torproject.org/projects/tordnsel.html.en) for this purpose. Here's a PHP implementation of a TorDNSEL lookup from a tutorial by [Irongeek](http://www.irongeek.com/i.php?page=security/dete...
By the firefox resource bundle you can check it. The resource:// URI scheme is used by Firefox to call on-disk resources from internal modules and extensions. But some of these resources may also be included to any web page and executed via script tag. Mozilla developers is not consider the resources as a fingerprint...
28,200,567
I'd like to disable some features of a web app I'm building, if the browser is Tor Browser. Can I inside the browser itself (client side, not server side) find out if the browser is Tor Browser? I would prefer a solution that didn't issue any HTTP requests to match the browser's IP against Tor exit nodes. Background:...
2015/01/28
['https://Stackoverflow.com/questions/28200567', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/694469/']
The "official" way to detect tor is to check the user's IP address and see if it's a tor exit node. Tor runs [TorDNSEL](https://www.torproject.org/projects/tordnsel.html.en) for this purpose. Here's a PHP implementation of a TorDNSEL lookup from a tutorial by [Irongeek](http://www.irongeek.com/i.php?page=security/dete...
There might be a quite reliable way. Check if it returns you a blank (white) image when you try to Base64 it using canvas. [When you do so an notification is shown.](https://i.stack.imgur.com/eMYJ9.png) No matter what user chooses JS returns a white image. So you can try to base64 (<-- it's a verb ;)) a non white imag...
28,200,567
I'd like to disable some features of a web app I'm building, if the browser is Tor Browser. Can I inside the browser itself (client side, not server side) find out if the browser is Tor Browser? I would prefer a solution that didn't issue any HTTP requests to match the browser's IP against Tor exit nodes. Background:...
2015/01/28
['https://Stackoverflow.com/questions/28200567', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/694469/']
The Tor browser is not designed to be undetectable (that's impossible to do). Rather, it is designed so that all copies are indistinguishable from each other: you cannot track a browser from one site to another, or from one visit to another, strictly through [browser fingerprinting](https://panopticlick.eff.org/). Thi...
There is no reliable way to detect the TOR Browser... That's kind of a goal of that browser. If you find a reliable way, chances are somebody else finds it too, tells the TOR developers and they close it. E.g. all TOR Browser bundles report bogus, but reasonable User-Agents. The current release version e.g. says it is...
28,200,567
I'd like to disable some features of a web app I'm building, if the browser is Tor Browser. Can I inside the browser itself (client side, not server side) find out if the browser is Tor Browser? I would prefer a solution that didn't issue any HTTP requests to match the browser's IP against Tor exit nodes. Background:...
2015/01/28
['https://Stackoverflow.com/questions/28200567', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/694469/']
There is no reliable way to detect the TOR Browser... That's kind of a goal of that browser. If you find a reliable way, chances are somebody else finds it too, tells the TOR developers and they close it. E.g. all TOR Browser bundles report bogus, but reasonable User-Agents. The current release version e.g. says it is...
By the firefox resource bundle you can check it. The resource:// URI scheme is used by Firefox to call on-disk resources from internal modules and extensions. But some of these resources may also be included to any web page and executed via script tag. Mozilla developers is not consider the resources as a fingerprint...
28,200,567
I'd like to disable some features of a web app I'm building, if the browser is Tor Browser. Can I inside the browser itself (client side, not server side) find out if the browser is Tor Browser? I would prefer a solution that didn't issue any HTTP requests to match the browser's IP against Tor exit nodes. Background:...
2015/01/28
['https://Stackoverflow.com/questions/28200567', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/694469/']
The Tor browser is not designed to be undetectable (that's impossible to do). Rather, it is designed so that all copies are indistinguishable from each other: you cannot track a browser from one site to another, or from one visit to another, strictly through [browser fingerprinting](https://panopticlick.eff.org/). Thi...
By the firefox resource bundle you can check it. The resource:// URI scheme is used by Firefox to call on-disk resources from internal modules and extensions. But some of these resources may also be included to any web page and executed via script tag. Mozilla developers is not consider the resources as a fingerprint...
28,200,567
I'd like to disable some features of a web app I'm building, if the browser is Tor Browser. Can I inside the browser itself (client side, not server side) find out if the browser is Tor Browser? I would prefer a solution that didn't issue any HTTP requests to match the browser's IP against Tor exit nodes. Background:...
2015/01/28
['https://Stackoverflow.com/questions/28200567', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/694469/']
The Tor browser is not designed to be undetectable (that's impossible to do). Rather, it is designed so that all copies are indistinguishable from each other: you cannot track a browser from one site to another, or from one visit to another, strictly through [browser fingerprinting](https://panopticlick.eff.org/). Thi...
There might be a quite reliable way. Check if it returns you a blank (white) image when you try to Base64 it using canvas. [When you do so an notification is shown.](https://i.stack.imgur.com/eMYJ9.png) No matter what user chooses JS returns a white image. So you can try to base64 (<-- it's a verb ;)) a non white imag...
28,200,567
I'd like to disable some features of a web app I'm building, if the browser is Tor Browser. Can I inside the browser itself (client side, not server side) find out if the browser is Tor Browser? I would prefer a solution that didn't issue any HTTP requests to match the browser's IP against Tor exit nodes. Background:...
2015/01/28
['https://Stackoverflow.com/questions/28200567', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/694469/']
There might be a quite reliable way. Check if it returns you a blank (white) image when you try to Base64 it using canvas. [When you do so an notification is shown.](https://i.stack.imgur.com/eMYJ9.png) No matter what user chooses JS returns a white image. So you can try to base64 (<-- it's a verb ;)) a non white imag...
By the firefox resource bundle you can check it. The resource:// URI scheme is used by Firefox to call on-disk resources from internal modules and extensions. But some of these resources may also be included to any web page and executed via script tag. Mozilla developers is not consider the resources as a fingerprint...
425,836
What I mean by this question is, as we say that the electric field energy around a charge is the self energy of the charge, similarly can we say that the magnetic field energy around a current carrying wire is the Self Energy of the current? If yes, then following questions arise : 1. Why the current is associated wit...
2018/08/31
['https://physics.stackexchange.com/questions/425836', 'https://physics.stackexchange.com', 'https://physics.stackexchange.com/users/185612/']
It would be inappropriate to say that a current carrying wire would have Self Energy, in form of Magnetic Field Energy. Self Energy of charges are different from this concept. In electrical circuits, for a very small duration of time, when current was growing in the circuit, the current was variable, due to which the...
Potential energy is a book-keeping device. Only *differences* in potential energy correspond to real energy. Since the electric and magnetic vector fields are defined by changes in potentials, any electromagnetic field with non-zero $\mathbf{E}$ or $\mathbf{B}$ has a (real) energy density, and this energy density is es...
44,068,795
can we override Apache CXF generated HTML page i tried ``` <init-param> <param-name>hide-service-list-page</param-name> <param-value>true</param-value> </init-param> ``` but it shows "No service was found" instead of showing this how can we show different html page. Thanks
2017/05/19
['https://Stackoverflow.com/questions/44068795', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2088219/']
Apache cxf use a class called `FormattedServiceListWriter` to generate the html page that you are talking about, you can take a look of the code [here](https://github.com/apache/cxf/blob/a36af6323505211479c875fb9923cc6dcbc6ac95/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServi...
You can try this in your **web.xml** to override the service list path ``` <init-param> <param-name>service-list-path</param-name> <param-value>/*</param-value> </init-param> ```
20,331
Has anyone thought about the possibility of a programming language, and a compiler, such that the compiler can automatically do worst-case asymptotic analysis? The use case I have in mind is a programming language where I write code, and compile. The compiler tells me that my code runs in O(n^2) (for example). It does ...
2013/12/26
['https://cstheory.stackexchange.com/questions/20331', 'https://cstheory.stackexchange.com', 'https://cstheory.stackexchange.com/users/492/']
Implicit Complexity has taught us that (some) complexity classes can be classified by type systems, in the sense that there are type systems that only accept polynomial programs, for example. One more practical-minded offshoot of this research is [RAML](http://raml.tcs.ifi.lmu.de/documentation/papers) (Resource Aware M...
I actually thought about the same question a while ago. Here is the train of thought I had: As you said the halting problem is an issue. To avoid this we need a language which only allows programs that always halt. On the other hand our language needs to be expressive enough to deal with most common problems(e.g. it s...
20,331
Has anyone thought about the possibility of a programming language, and a compiler, such that the compiler can automatically do worst-case asymptotic analysis? The use case I have in mind is a programming language where I write code, and compile. The compiler tells me that my code runs in O(n^2) (for example). It does ...
2013/12/26
['https://cstheory.stackexchange.com/questions/20331', 'https://cstheory.stackexchange.com', 'https://cstheory.stackexchange.com/users/492/']
The [COSTA tool](http://costa.ls.fi.upm.es/~costa/costa/costa.php) developed by the [COSTA research group](http://costa.ls.fi.upm.es/web/) does exactly what you want. Given a program (in Java bytecode format), the tool produces a cost equation based on a cost model provided by the programmer. The cost model can involve...
I actually thought about the same question a while ago. Here is the train of thought I had: As you said the halting problem is an issue. To avoid this we need a language which only allows programs that always halt. On the other hand our language needs to be expressive enough to deal with most common problems(e.g. it s...
20,331
Has anyone thought about the possibility of a programming language, and a compiler, such that the compiler can automatically do worst-case asymptotic analysis? The use case I have in mind is a programming language where I write code, and compile. The compiler tells me that my code runs in O(n^2) (for example). It does ...
2013/12/26
['https://cstheory.stackexchange.com/questions/20331', 'https://cstheory.stackexchange.com', 'https://cstheory.stackexchange.com/users/492/']
Implicit Complexity has taught us that (some) complexity classes can be classified by type systems, in the sense that there are type systems that only accept polynomial programs, for example. One more practical-minded offshoot of this research is [RAML](http://raml.tcs.ifi.lmu.de/documentation/papers) (Resource Aware M...
The [COSTA tool](http://costa.ls.fi.upm.es/~costa/costa/costa.php) developed by the [COSTA research group](http://costa.ls.fi.upm.es/web/) does exactly what you want. Given a program (in Java bytecode format), the tool produces a cost equation based on a cost model provided by the programmer. The cost model can involve...
3,778,961
I need to show $(0,1)$, $[0,1)$ and $[0,1]$ are not homeomorphic using intermediate value theorem (without using connectedness). I have already did proved that $(0,1)$, $[0,1]$ are not homeomorphic but I struggle with the 2 other couples. My proof: assume there is an homeomorphism $f:(0,1)\rightarrow[0,1]$ and take $...
2020/08/03
['https://math.stackexchange.com/questions/3778961', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/813552/']
$[0,1]$ is compact but the other two are not. Hence none of them are homeomorphic to $[0,1]$. Now to show that $(0,1)$ and $[0,1)$ are not homeomorphic. Suppose $f:[0,1)\to(0,1)$ is a homomorphism. Then $f(0)\in (0,1)$ so $(0,1)\setminus \{f(0)\}$ is a disconnected set. But $f((0,1))=(0,1)\setminus \{f(0)\}$, which...
Observe that if $\;f:X\to Y\;$ is a homeomorphism between two toplogical spaces and $\;x\in X\;$ then $$\;g:X\setminus\{x\}\to Y\setminus\{f(x)\}\;,\;\;g(a)=f(a)\;\;\forall\;a\in X\setminus\{x\}\;$$ is also a homeomorphism on the respective top. spaces with the induced topology, and thus: if $$f:[0,1)\to(0,1)\;\;\te...
3,778,961
I need to show $(0,1)$, $[0,1)$ and $[0,1]$ are not homeomorphic using intermediate value theorem (without using connectedness). I have already did proved that $(0,1)$, $[0,1]$ are not homeomorphic but I struggle with the 2 other couples. My proof: assume there is an homeomorphism $f:(0,1)\rightarrow[0,1]$ and take $...
2020/08/03
['https://math.stackexchange.com/questions/3778961', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/813552/']
You have to be a little more careful: you’ve written your argument on the assumption that $a<b$, but it could be that $b<a$, in which case it’s the interval $[b,a]$ that maps to $[0,1]$. You get the same contradiction, of course. HINT: The same argument works if the domain of $f$ is $[0,1)$. For $(0,1)$ and $[0,1)$ yo...
$[0,1]$ is compact but the other two are not. Hence none of them are homeomorphic to $[0,1]$. Now to show that $(0,1)$ and $[0,1)$ are not homeomorphic. Suppose $f:[0,1)\to(0,1)$ is a homomorphism. Then $f(0)\in (0,1)$ so $(0,1)\setminus \{f(0)\}$ is a disconnected set. But $f((0,1))=(0,1)\setminus \{f(0)\}$, which...
3,778,961
I need to show $(0,1)$, $[0,1)$ and $[0,1]$ are not homeomorphic using intermediate value theorem (without using connectedness). I have already did proved that $(0,1)$, $[0,1]$ are not homeomorphic but I struggle with the 2 other couples. My proof: assume there is an homeomorphism $f:(0,1)\rightarrow[0,1]$ and take $...
2020/08/03
['https://math.stackexchange.com/questions/3778961', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/813552/']
Suppose $f:(0,1)\to [0,1)$ is a homeomorphism. Then $\exists x\in(0,1)$ such that $f(x)=0$. By continuity for every $\epsilon >0$, $ \exists y<x<z$ such that $\{f(y),f(z)\}\subset[0,\epsilon)$. Without loss of generality assume that $f(y)<f(z)$. Now by intermediate value property of $f$, we have $f$ on $(x,z)$ attain...
$[0,1]$ is compact but the other two are not. Hence none of them are homeomorphic to $[0,1]$. Now to show that $(0,1)$ and $[0,1)$ are not homeomorphic. Suppose $f:[0,1)\to(0,1)$ is a homomorphism. Then $f(0)\in (0,1)$ so $(0,1)\setminus \{f(0)\}$ is a disconnected set. But $f((0,1))=(0,1)\setminus \{f(0)\}$, which...
3,778,961
I need to show $(0,1)$, $[0,1)$ and $[0,1]$ are not homeomorphic using intermediate value theorem (without using connectedness). I have already did proved that $(0,1)$, $[0,1]$ are not homeomorphic but I struggle with the 2 other couples. My proof: assume there is an homeomorphism $f:(0,1)\rightarrow[0,1]$ and take $...
2020/08/03
['https://math.stackexchange.com/questions/3778961', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/813552/']
You have to be a little more careful: you’ve written your argument on the assumption that $a<b$, but it could be that $b<a$, in which case it’s the interval $[b,a]$ that maps to $[0,1]$. You get the same contradiction, of course. HINT: The same argument works if the domain of $f$ is $[0,1)$. For $(0,1)$ and $[0,1)$ yo...
Observe that if $\;f:X\to Y\;$ is a homeomorphism between two toplogical spaces and $\;x\in X\;$ then $$\;g:X\setminus\{x\}\to Y\setminus\{f(x)\}\;,\;\;g(a)=f(a)\;\;\forall\;a\in X\setminus\{x\}\;$$ is also a homeomorphism on the respective top. spaces with the induced topology, and thus: if $$f:[0,1)\to(0,1)\;\;\te...
3,778,961
I need to show $(0,1)$, $[0,1)$ and $[0,1]$ are not homeomorphic using intermediate value theorem (without using connectedness). I have already did proved that $(0,1)$, $[0,1]$ are not homeomorphic but I struggle with the 2 other couples. My proof: assume there is an homeomorphism $f:(0,1)\rightarrow[0,1]$ and take $...
2020/08/03
['https://math.stackexchange.com/questions/3778961', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/813552/']
Suppose $f:(0,1)\to [0,1)$ is a homeomorphism. Then $\exists x\in(0,1)$ such that $f(x)=0$. By continuity for every $\epsilon >0$, $ \exists y<x<z$ such that $\{f(y),f(z)\}\subset[0,\epsilon)$. Without loss of generality assume that $f(y)<f(z)$. Now by intermediate value property of $f$, we have $f$ on $(x,z)$ attain...
Observe that if $\;f:X\to Y\;$ is a homeomorphism between two toplogical spaces and $\;x\in X\;$ then $$\;g:X\setminus\{x\}\to Y\setminus\{f(x)\}\;,\;\;g(a)=f(a)\;\;\forall\;a\in X\setminus\{x\}\;$$ is also a homeomorphism on the respective top. spaces with the induced topology, and thus: if $$f:[0,1)\to(0,1)\;\;\te...
3,778,961
I need to show $(0,1)$, $[0,1)$ and $[0,1]$ are not homeomorphic using intermediate value theorem (without using connectedness). I have already did proved that $(0,1)$, $[0,1]$ are not homeomorphic but I struggle with the 2 other couples. My proof: assume there is an homeomorphism $f:(0,1)\rightarrow[0,1]$ and take $...
2020/08/03
['https://math.stackexchange.com/questions/3778961', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/813552/']
You have to be a little more careful: you’ve written your argument on the assumption that $a<b$, but it could be that $b<a$, in which case it’s the interval $[b,a]$ that maps to $[0,1]$. You get the same contradiction, of course. HINT: The same argument works if the domain of $f$ is $[0,1)$. For $(0,1)$ and $[0,1)$ yo...
Suppose $f:(0,1)\to [0,1)$ is a homeomorphism. Then $\exists x\in(0,1)$ such that $f(x)=0$. By continuity for every $\epsilon >0$, $ \exists y<x<z$ such that $\{f(y),f(z)\}\subset[0,\epsilon)$. Without loss of generality assume that $f(y)<f(z)$. Now by intermediate value property of $f$, we have $f$ on $(x,z)$ attain...
62,405,675
I have a problem with generics in swift. Let's expose my code. ``` protocol FooProtocol { associatedtype T } protocol Fooable { } extension Int : Fooable { } extension String: Fooable { } class AnyFoo<T>: FooProtocol { init<P: FooProtocol>(p: P) where P.T == T { } } class FooIntImpClass: FooProtocol { ...
2020/06/16
['https://Stackoverflow.com/questions/62405675', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6239013/']
EDIT to respond to the edit to the question: `createTwo` doesn't work because you have the same misconception as I said in my original answer. `createTwo` decided on its own that `F` should be either `String` or `Int`, rather than "any type that conforms to `Fooable`". For `createOne`, you have another common misconc...
Is the following what you tried to achieve? (compiled & tested with Xcode 11.4) ``` func createOne() -> some FooProtocol { let anyFoo = AnyFoo(p: FooImpClass()) return anyFoo } ```
62,405,675
I have a problem with generics in swift. Let's expose my code. ``` protocol FooProtocol { associatedtype T } protocol Fooable { } extension Int : Fooable { } extension String: Fooable { } class AnyFoo<T>: FooProtocol { init<P: FooProtocol>(p: P) where P.T == T { } } class FooIntImpClass: FooProtocol { ...
2020/06/16
['https://Stackoverflow.com/questions/62405675', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6239013/']
EDIT to respond to the edit to the question: `createTwo` doesn't work because you have the same misconception as I said in my original answer. `createTwo` decided on its own that `F` should be either `String` or `Int`, rather than "any type that conforms to `Fooable`". For `createOne`, you have another common misconc...
**EDIT** I finally managed to keep your `where clause` :) **EDIT** Still not sure what you want to do, and I still agree with @Sweeper but I love to badly abuse generics :) : ``` protocol FooProtocol { associatedtype T init() } protocol Fooable { } extension Int : Fooable { } extension String: Fooable { } ...
62,405,675
I have a problem with generics in swift. Let's expose my code. ``` protocol FooProtocol { associatedtype T } protocol Fooable { } extension Int : Fooable { } extension String: Fooable { } class AnyFoo<T>: FooProtocol { init<P: FooProtocol>(p: P) where P.T == T { } } class FooIntImpClass: FooProtocol { ...
2020/06/16
['https://Stackoverflow.com/questions/62405675', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6239013/']
Is the following what you tried to achieve? (compiled & tested with Xcode 11.4) ``` func createOne() -> some FooProtocol { let anyFoo = AnyFoo(p: FooImpClass()) return anyFoo } ```
**EDIT** I finally managed to keep your `where clause` :) **EDIT** Still not sure what you want to do, and I still agree with @Sweeper but I love to badly abuse generics :) : ``` protocol FooProtocol { associatedtype T init() } protocol Fooable { } extension Int : Fooable { } extension String: Fooable { } ...
52,306,898
I’m learning Common Lisp, using CCL. I get a warning when I use a global variable locally. Why does CCL provide this functionality? What is the purpose of this? ``` (setf n 75) ;;;This function works, but gets a warning about ;;;n being an undeclared free variable. (defun use-global () (write n) ) ;;;This function ...
2018/09/13
['https://Stackoverflow.com/questions/52306898', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10305445/']
`Setf` and `setq` do not introduce new variables, they modify existing ones. In order to define something like global variables, use `defvar` or `defparameter`. These are conventionally written with a leading and ending `*`, and they are automatically declared *globally special*. This means that whenever you re-bind t...
Quick googling suggests in Common Lisp is it done as something like: ``` (defvar *n* 75) (defun use-global () (write *n*)) (use-global) ``` Note the asterisk that decorate global names by convention.
52,306,898
I’m learning Common Lisp, using CCL. I get a warning when I use a global variable locally. Why does CCL provide this functionality? What is the purpose of this? ``` (setf n 75) ;;;This function works, but gets a warning about ;;;n being an undeclared free variable. (defun use-global () (write n) ) ;;;This function ...
2018/09/13
['https://Stackoverflow.com/questions/52306898', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10305445/']
The warning provides little value. The variable is bound by a prior top-level assignment, which creates a binding in the [global environment](http://clhs.lisp.se/Body/26_glo_g.htm#global_environment) making that variable a global variable. It simply being accessed, which is likely what is intended by the programmer. A...
Quick googling suggests in Common Lisp is it done as something like: ``` (defvar *n* 75) (defun use-global () (write *n*)) (use-global) ``` Note the asterisk that decorate global names by convention.
52,306,898
I’m learning Common Lisp, using CCL. I get a warning when I use a global variable locally. Why does CCL provide this functionality? What is the purpose of this? ``` (setf n 75) ;;;This function works, but gets a warning about ;;;n being an undeclared free variable. (defun use-global () (write n) ) ;;;This function ...
2018/09/13
['https://Stackoverflow.com/questions/52306898', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10305445/']
`Setf` and `setq` do not introduce new variables, they modify existing ones. In order to define something like global variables, use `defvar` or `defparameter`. These are conventionally written with a leading and ending `*`, and they are automatically declared *globally special*. This means that whenever you re-bind t...
The warning provides little value. The variable is bound by a prior top-level assignment, which creates a binding in the [global environment](http://clhs.lisp.se/Body/26_glo_g.htm#global_environment) making that variable a global variable. It simply being accessed, which is likely what is intended by the programmer. A...
1,401,673
I was using Bash as my default shell on macOS but I decided to switch to Fish. I am trying to switch between different versions of Java. In bash it was done using the `~/.bash_profile` ``` export JAVA_HOME=`/usr/libexec/java_home -v 1.7` ``` I have set the equivalent on Fish `~/.config/fish/fish_variables` ``` se...
2019/02/03
['https://superuser.com/questions/1401673', 'https://superuser.com', 'https://superuser.com/users/806634/']
While I am not deeply familiar with [Fish](https://fishshell.com), based on what I am reading it seems like the issue is with the backticks in your command: ``` /usr/libexec/java_home -v 1.7 ``` You see that is just like this in Bash: ``` $(/usr/libexec/java_home -v 1.7) ``` Keep that in mind and look at [this Fi...
``` function javaenv if test (count $argv) -eq 0 /usr/libexec/java_home -V else switch $argv[1] case 'ls' /usr/libexec/java_home -V case 'set' set -xU JAVA_HOME (/usr/libexec/java_home -v $argv[2]) end end end ``` Can put the function above in ~/.confi...
41,505,915
In C#, I made a textbox that accept only numbers, but I want to make a code to accept a time in the following format: "\_\_\_\_:\_\_\_\_:\_\_\_\_" so that when the user writes part of it, it completes the missing with zeros; Example: The user writes: "\_2:12:\_3" it should complete it as "02:12:03". Does anybody have ...
2017/01/06
['https://Stackoverflow.com/questions/41505915', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7383939/']
I think the best would be to use the Replace() function in C# as follow: ``` string x = "this is an example of a string with a _ character"; string z = x.Replace('_', '0'); ```
``` private void SearchBar_TextChanged(object sender, TextChangedEventArgs e) { int value = int.Parse(YourTextBox.Text); if (value<10) { YourTextBox.Text = "0" + value; } } ``` and Ofcourse you can add other logic like if the user enters ...
37,952,883
So right now I'm making an interactive graph in excel, where the user can select a variety of options via drop down menus. For example, if the user wants to change the color of one of the charts to red, they select the drop down menu for that chart, select red, and then the chart turns red. I've written macros to do th...
2016/06/21
['https://Stackoverflow.com/questions/37952883', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6495811/']
Time for some mapping! Reference the VBScript runtime and create a new `Scripting.Dictionary` object. ``` Dim colorActions As Dictionary Set colorActions = New Dictionary ``` Or, don't reference the VBScript runtime and use late-binding to create the dictionary instead: ``` Dim colorActions As Object Set colorActio...
As @findwindow has stated in the comments, you may benefit from a `Select` statement. Consider the example below: - ``` If Target = Range("F16") Then 'Checks to see if the color is being changed for the Elevation Graph Select Case Worksheets("Reference_Sheet").Range("H9").Value Case "Black" ...
37,952,883
So right now I'm making an interactive graph in excel, where the user can select a variety of options via drop down menus. For example, if the user wants to change the color of one of the charts to red, they select the drop down menu for that chart, select red, and then the chart turns red. I've written macros to do th...
2016/06/21
['https://Stackoverflow.com/questions/37952883', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6495811/']
Time for some mapping! Reference the VBScript runtime and create a new `Scripting.Dictionary` object. ``` Dim colorActions As Dictionary Set colorActions = New Dictionary ``` Or, don't reference the VBScript runtime and use late-binding to create the dictionary instead: ``` Dim colorActions As Object Set colorActio...
``` If Target = Range("F16") Then Select Case Worksheets("Reference_Sheet").Range("H9").Value Case "Black" Call Black_Line_ELE Case "Tan" Call Tan_ELE Case 'Do this for all cases End Select End If ``` [Look here for more details](https://msdn.microsoft.com/...
25,931,781
I have to implement a search in following method, Let : ``` Dim checkin As String = "This is the base string, i have to find a word here" Dim valueSearch As String="to find a word" ``` Now the algorithm to be implemented is: * Dim str() As String = Split(checkin , " ") * Dim Position As Integer * `Position`=Find ...
2014/09/19
['https://Stackoverflow.com/questions/25931781', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
I made a Ribbon.xml for every addin, that has the same structure. I've set a "namespace" in every ribbon.xml, that will help the controls to be added to the same tab, everytime. ``` <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load" xmlns:x="NAMESPACE FOR EVERY TAB"> //the name...
We use [Add In Express](http://www.add-in-express.com/) at our work place. It's really easy to use and does everything. It's paid though. Also please look at [this](https://stackoverflow.com/questions/7135480/office-add-in-ribbons-same-tab-with-2-addins) answer.
64,066,995
Essentially when the browser window goes larger thh div stays centered and creates white space on the outside. I want the same thing to happen when the browser window goes smaller. I want to see less of the div but keep it centered. At the moment I see less of the div but the left side locks so I end up only seeing a s...
2020/09/25
['https://Stackoverflow.com/questions/64066995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14341030/']
You can try ``` #page-container { width:1920px; margin-left: -960px; position: relative; left: 50%; } ```
You can put the pageContainer on `absolute` position as follows. ``` #page-container { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 1920px; } ```
64,066,995
Essentially when the browser window goes larger thh div stays centered and creates white space on the outside. I want the same thing to happen when the browser window goes smaller. I want to see less of the div but keep it centered. At the moment I see less of the div but the left side locks so I end up only seeing a s...
2020/09/25
['https://Stackoverflow.com/questions/64066995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14341030/']
You can try ``` #page-container { width:1920px; margin-left: -960px; position: relative; left: 50%; } ```
What about use flexbox? ```css body { font-family: 'Noto Sans', sans-serif; margin: 0; padding: 0; } #page-container { width: 1920px; display: flex; align-items: center; justify-content: center; } ``` ```html <div id="page-container"> <img src="https://placeimg.com/640/480/any"> </div> ```
64,066,995
Essentially when the browser window goes larger thh div stays centered and creates white space on the outside. I want the same thing to happen when the browser window goes smaller. I want to see less of the div but keep it centered. At the moment I see less of the div but the left side locks so I end up only seeing a s...
2020/09/25
['https://Stackoverflow.com/questions/64066995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14341030/']
You can try ``` #page-container { width:1920px; margin-left: -960px; position: relative; left: 50%; } ```
Do you really want the horizontal scroll bar? If you don't, I prefer not to define the width(especially in pixel), as the width of every device varies. Instead, you can define width as `width:100%` or `width:100vw`, this helps to fit the div according to the screen size. You can try this code: ``` body { font-fam...
64,066,995
Essentially when the browser window goes larger thh div stays centered and creates white space on the outside. I want the same thing to happen when the browser window goes smaller. I want to see less of the div but keep it centered. At the moment I see less of the div but the left side locks so I end up only seeing a s...
2020/09/25
['https://Stackoverflow.com/questions/64066995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14341030/']
You can put the pageContainer on `absolute` position as follows. ``` #page-container { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 1920px; } ```
What about use flexbox? ```css body { font-family: 'Noto Sans', sans-serif; margin: 0; padding: 0; } #page-container { width: 1920px; display: flex; align-items: center; justify-content: center; } ``` ```html <div id="page-container"> <img src="https://placeimg.com/640/480/any"> </div> ```
64,066,995
Essentially when the browser window goes larger thh div stays centered and creates white space on the outside. I want the same thing to happen when the browser window goes smaller. I want to see less of the div but keep it centered. At the moment I see less of the div but the left side locks so I end up only seeing a s...
2020/09/25
['https://Stackoverflow.com/questions/64066995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14341030/']
Do you really want the horizontal scroll bar? If you don't, I prefer not to define the width(especially in pixel), as the width of every device varies. Instead, you can define width as `width:100%` or `width:100vw`, this helps to fit the div according to the screen size. You can try this code: ``` body { font-fam...
What about use flexbox? ```css body { font-family: 'Noto Sans', sans-serif; margin: 0; padding: 0; } #page-container { width: 1920px; display: flex; align-items: center; justify-content: center; } ``` ```html <div id="page-container"> <img src="https://placeimg.com/640/480/any"> </div> ```
7,195,248
What is the difference between NULL and character(0) | integer(0) etc? ``` > identical(NULL, character(0)) [1] FALSE > is.null(integer(0)) [1] FALSE > str(character(0)) chr(0) > str(NULL) NULL ``` In general it seems you can pass `NULL` as parameters into functions, and that an empty vector is generally return...
2011/08/25
['https://Stackoverflow.com/questions/7195248', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/602276/']
The [R Language Definitio](http://cran.r-project.org/doc/manuals/R-lang.html)n has this on `NULL`: > > There is a special object called NULL. It is used whenever there is a need to indicate or > specify that an object is absent. It should not be confused with a vector or list of zero > length. The NULL object has ...
Here's a partial answer, beginning by simply quoting the R Language Definition Guide: > > There is a special object called NULL. It is used whenever there is a > need to indicate or specify that an object is absent. It should not be > confused with a vector or list of zero length. The NULL object has no > type and...
7,195,248
What is the difference between NULL and character(0) | integer(0) etc? ``` > identical(NULL, character(0)) [1] FALSE > is.null(integer(0)) [1] FALSE > str(character(0)) chr(0) > str(NULL) NULL ``` In general it seems you can pass `NULL` as parameters into functions, and that an empty vector is generally return...
2011/08/25
['https://Stackoverflow.com/questions/7195248', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/602276/']
The other guys have the right answers, but I want to add a few curiosities. First, it's not *quite* true that NULL "is used whenever there is a need to indicate or specify that an object is absent" as it says in the doc. There are actually 2 other "no data" values in R (not counting NA, which is not a complete value)....
Here's a partial answer, beginning by simply quoting the R Language Definition Guide: > > There is a special object called NULL. It is used whenever there is a > need to indicate or specify that an object is absent. It should not be > confused with a vector or list of zero length. The NULL object has no > type and...
7,195,248
What is the difference between NULL and character(0) | integer(0) etc? ``` > identical(NULL, character(0)) [1] FALSE > is.null(integer(0)) [1] FALSE > str(character(0)) chr(0) > str(NULL) NULL ``` In general it seems you can pass `NULL` as parameters into functions, and that an empty vector is generally return...
2011/08/25
['https://Stackoverflow.com/questions/7195248', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/602276/']
The [R Language Definitio](http://cran.r-project.org/doc/manuals/R-lang.html)n has this on `NULL`: > > There is a special object called NULL. It is used whenever there is a need to indicate or > specify that an object is absent. It should not be confused with a vector or list of zero > length. The NULL object has ...
The other guys have the right answers, but I want to add a few curiosities. First, it's not *quite* true that NULL "is used whenever there is a need to indicate or specify that an object is absent" as it says in the doc. There are actually 2 other "no data" values in R (not counting NA, which is not a complete value)....
29,628
Is there anyway to sync Outlook's calendar with Google's calendar? I've tried [following this](http://support.google.com/calendar/bin/answer.py?hl=en&answer=89955) before but it doesn't work properly. I'm using Windows 7 and Outlook 2010. The thing is, it's really easy to check my Google Calendar on my phone since I h...
2012/08/02
['https://webapps.stackexchange.com/questions/29628', 'https://webapps.stackexchange.com', 'https://webapps.stackexchange.com/users/22630/']
You can use ``` in:(anywhere -inbox) label:unread ``` or ``` in:anywhere label:(unread -inbox) ``` `in:anywhere` is the same as "All Mail": mails in inbox, archived, and sent mails. When used in conjection with labels, like `label:any`, it further expands to trash, spam, draft as well. The `()` after the `:` ma...
You can create a filter if you use the condensed short syntax like so: ``` -label:{inbox trash sent spam} ``` This won't overly help your situation though, since filters only operate on incoming mail. Your best alternative at this stage may be to bookmark the search so you can quickly mark all as read. For somethi...
1,660,424
In the linear fractional transformation $T(z)=\frac{az+b}{cz+d}$, if we define $T(-\frac{d}{c})=\infty$, then what is $T(\infty)$?
2016/02/17
['https://math.stackexchange.com/questions/1660424', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/296257/']
It is $a/c$. You can always think of it as $\lim\_{z\to\infty}T(z)$.
There is no need to "define" these things... since, in fact, $G=GL\_2(\mathbb C)$ acts on complex projective one-space, a.k.a. the Riemann sphere, in homogeneous coordinates: coordinates are $\pmatrix{\omega\_1\cr \omega\_2}$ mod scalars $\mathbb C^\times$. $\mathbb C$ imbeds by $z\to \pmatrix{z \cr 1}$. Then the actio...
1,660,424
In the linear fractional transformation $T(z)=\frac{az+b}{cz+d}$, if we define $T(-\frac{d}{c})=\infty$, then what is $T(\infty)$?
2016/02/17
['https://math.stackexchange.com/questions/1660424', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/296257/']
It is $a/c$. You can always think of it as $\lim\_{z\to\infty}T(z)$.
$$\lim\_{z\to\infty}T(z)=\lim\_{z\to 0}T(1/z)=\lim\_{z\to 0}\frac{a/z+b}{c/z+d}=\lim\_{z\to 0}\frac{a+bz}{c+dz}=a/c.$$
1,660,424
In the linear fractional transformation $T(z)=\frac{az+b}{cz+d}$, if we define $T(-\frac{d}{c})=\infty$, then what is $T(\infty)$?
2016/02/17
['https://math.stackexchange.com/questions/1660424', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/296257/']
There is no need to "define" these things... since, in fact, $G=GL\_2(\mathbb C)$ acts on complex projective one-space, a.k.a. the Riemann sphere, in homogeneous coordinates: coordinates are $\pmatrix{\omega\_1\cr \omega\_2}$ mod scalars $\mathbb C^\times$. $\mathbb C$ imbeds by $z\to \pmatrix{z \cr 1}$. Then the actio...
$$\lim\_{z\to\infty}T(z)=\lim\_{z\to 0}T(1/z)=\lim\_{z\to 0}\frac{a/z+b}{c/z+d}=\lim\_{z\to 0}\frac{a+bz}{c+dz}=a/c.$$
42,660,684
I have a very simple problem I am trying to solve but cannot wrap my head around it. I have three tables of identical structure ``` t1.id, t1.cust_id, t1.name, t1.value t2.id, t2.cust_id, t2.name, t2.value t3.id, t3.cust_id, t3.name, t3.value ``` Customers appear in some tables but not in others; the 'value' recor...
2017/03/08
['https://Stackoverflow.com/questions/42660684', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1234414/']
Use `union all` to combine the rows from 3 tables and then use aggregation. ``` select cust_id,name,sum(t1val),sum(t2val),sum(t3val) from ( select id, cust_id, name, value as t1val, null as t2val, null as t3val from t1 union all select id, cust_id, name, null, value, null from t2 union all select id, cust_id, name, nu...
You can do it with `SELECT`, e.g.: ``` SELECT ( (SELECT COALESCE(SUM(value),0) FROM t1 WHERE cust_id = 100) + (SELECT COALESCE(SUM(value),0) FROM t2 WHERE cust_id = 100) + (SELECT COALESCE(SUM(value),0) FROM t3 WHERE cust_id = 100) ) as total; ``` Here's the **[SQL Fi...
16,865,303
I am changing an existing data storage php code from `mysql_*` functions to PDO as well changing it from Procedural to OOB programming. I was updating the SQL statements when I noticed something, fairly far into the rewriting process. I am setting up an array for multiple tables `INSERT` and `UPDATE` queries, as I was...
2013/05/31
['https://Stackoverflow.com/questions/16865303', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2200704/']
Using named placeholders (:col\_name), you can put them in any order as you please. However, using positional placeholders (?) - you need to put them in order.
It doesn't matter as long as you use named parameters ( `:somename` ). The binding simply tells your database engine "where I wrote the placeholder `:abc`, fill with this value. Where I wrote placeholder `:xyz`, put this other value". Think about how the code would look like if you were binding each value separately i...
32,143,770
Preface - I'm pretty new to Python, having had more experience in another language. I have a text file with single column list of strings in the generic (but slightly varying) format "./abc123a1/type/1ab2\_x\_data\_type.file.type" I need to extract the abc123a1 and the 1ab2 portions from all several hundred of the ro...
2015/08/21
['https://Stackoverflow.com/questions/32143770', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5252432/']
IMHO, you were not far from making it work. The problem is that you read once the whole file just to print the lines, and then (once at end of file) you try to put them into a list... and get an empty list ! You should read the file only once: ``` import sys import csv listOfData = [] with open(sys.argv[1]) as f: ...
I am not sure about your regex (it will most probably not work) , but the reason why your current (non-regex , simple) code does not work is because - ``` with open(sys.argv[1]) as f: print "yes" for line in f: print line for line in f: listOfData.append([line]) ``` As you can see you are...
32,143,770
Preface - I'm pretty new to Python, having had more experience in another language. I have a text file with single column list of strings in the generic (but slightly varying) format "./abc123a1/type/1ab2\_x\_data\_type.file.type" I need to extract the abc123a1 and the 1ab2 portions from all several hundred of the ro...
2015/08/21
['https://Stackoverflow.com/questions/32143770', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5252432/']
IMHO, you were not far from making it work. The problem is that you read once the whole file just to print the lines, and then (once at end of file) you try to put them into a list... and get an empty list ! You should read the file only once: ``` import sys import csv listOfData = [] with open(sys.argv[1]) as f: ...
I think at least part of the problem is the two `for` loops in the following: ``` with open(sys.argv[1]) as f: print "yes" for line in f: print line for line in f: listOfData.append([line]) ``` The first one `print`s all the lines of `f`, so there's nothing left for the second one to iter...
32,143,770
Preface - I'm pretty new to Python, having had more experience in another language. I have a text file with single column list of strings in the generic (but slightly varying) format "./abc123a1/type/1ab2\_x\_data\_type.file.type" I need to extract the abc123a1 and the 1ab2 portions from all several hundred of the ro...
2015/08/21
['https://Stackoverflow.com/questions/32143770', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5252432/']
IMHO, you were not far from making it work. The problem is that you read once the whole file just to print the lines, and then (once at end of file) you try to put them into a list... and get an empty list ! You should read the file only once: ``` import sys import csv listOfData = [] with open(sys.argv[1]) as f: ...
Are you sure you need all of the regular expressions? You seem to be parsing a list of paths and filenames. The path could be split up using a `split` command, for example: ``` print "./abc123a1/type/1ab2_a_data_type.file.type".split("/") ``` Would give: ``` ['.', 'abc123a1', 'type', '1ab2_a_data_type.file.type'] ...
206,391
I am taking part in a robotics competition, where the challenge is to create a pair of robots which successfully navigate a series of obstacles. However, the rules state that of the two robots, only one must have a driving actuator. The other must somehow be moved by the other robot, WITHOUT PHYSICAL CONTACT. I could ...
2015/09/11
['https://physics.stackexchange.com/questions/206391', 'https://physics.stackexchange.com', 'https://physics.stackexchange.com/users/92488/']
The average *vector* momentum of an electron bound to an atom is exactly zero. (Otherwise, the electron would leave the atom!) The average *magnitude* of the momentum can't be zero, because of the uncertainty principle. So Feynman is using the approximation $\vec p = \vec 0 + \Delta p \hat p$, where the magnitude $\De...
In QM that electron would need more and more kinetic energy when it closes to nucleus, so at some point Coulombic force becomes too weak. The result is an equilibrium position with nucleus, i.e. hydrogen atom. Heisenberg's uncertainty principle is useless when it comes to hydrogenic $1/r$ potential, but for harmonic o...
206,391
I am taking part in a robotics competition, where the challenge is to create a pair of robots which successfully navigate a series of obstacles. However, the rules state that of the two robots, only one must have a driving actuator. The other must somehow be moved by the other robot, WITHOUT PHYSICAL CONTACT. I could ...
2015/09/11
['https://physics.stackexchange.com/questions/206391', 'https://physics.stackexchange.com', 'https://physics.stackexchange.com/users/92488/']
This might be a bit helpful. The uncertainty in the momentum of an electron in an atom is defined as: $(\Delta P )^{2}= \langle P^{2}\rangle-\langle P\rangle^{2}$. An electron bounded by the nucleus, has an average momentum of zero, which means ($\Delta P)^2 = {\langle P^{2}\rangle}$, but again, Feynman's explain, as...
In QM that electron would need more and more kinetic energy when it closes to nucleus, so at some point Coulombic force becomes too weak. The result is an equilibrium position with nucleus, i.e. hydrogen atom. Heisenberg's uncertainty principle is useless when it comes to hydrogenic $1/r$ potential, but for harmonic o...
206,391
I am taking part in a robotics competition, where the challenge is to create a pair of robots which successfully navigate a series of obstacles. However, the rules state that of the two robots, only one must have a driving actuator. The other must somehow be moved by the other robot, WITHOUT PHYSICAL CONTACT. I could ...
2015/09/11
['https://physics.stackexchange.com/questions/206391', 'https://physics.stackexchange.com', 'https://physics.stackexchange.com/users/92488/']
The average *vector* momentum of an electron bound to an atom is exactly zero. (Otherwise, the electron would leave the atom!) The average *magnitude* of the momentum can't be zero, because of the uncertainty principle. So Feynman is using the approximation $\vec p = \vec 0 + \Delta p \hat p$, where the magnitude $\De...
This might be a bit helpful. The uncertainty in the momentum of an electron in an atom is defined as: $(\Delta P )^{2}= \langle P^{2}\rangle-\langle P\rangle^{2}$. An electron bounded by the nucleus, has an average momentum of zero, which means ($\Delta P)^2 = {\langle P^{2}\rangle}$, but again, Feynman's explain, as...
14,001
How must I populate a playa hidden input field (in a safecracker form) with multiple entries? I tried passing the entry IDs separated by comma, semicolon, bar, but nothing seems to work. Only the first entry in the array gets saved. How do I have to format the entry IDs for multiple relationships to be saved? Update:...
2013/09/23
['https://expressionengine.stackexchange.com/questions/14001', 'https://expressionengine.stackexchange.com', 'https://expressionengine.stackexchange.com/users/779/']
You'll want to actually use multiple hidden fields, each adding to an array: ``` <input type="hidden" name="cf_playa_field[selections][]" value="123"> <input type="hidden" name="cf_playa_field[selections][]" value="456"> ``` You could also potentially write an extension to rework the POST data if you absolutely must...
OK, I got this squared away. It seems like my name="0" inputs were causing the errors. Now I remove the complete hidden input when a checkbox is unchecked and create a new one on the fly when a checkbox is checked.
62,804,224
My OpenCL program involves having about 7 billion work-items. In my C++ program, I would set this to my global\_item\_size: ``` size_t global_item_size = 7200000000; ``` If my program is compiled to 64-bit systems (x64), this global size is OK, since SIZE\_MAX (the maximum value of size\_t) is much larger than 7 bil...
2020/07/08
['https://Stackoverflow.com/questions/62804224', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6702334/']
`proc_res_field` doesn't know anything about `i` or `a` ``` Function proc_res_field(Tstruct As TestMDate) Debug.Print Tstruct.MonthS Debug.Print Tstruct.MonthD Debug.Print Tstruct.StartD Debug.Print Tstruct.EndD proc_res_field = 1 '? End Function ```
It is a common error, I forgot it too, but functions return something. ``` Function proc_res_field(Tstruct As TestMDate) as integer proc_res_field=7 End Function ``` And at the call: ``` a=proc_res_field(your_tstruct) ``` Just as example, setup the correct params and return types that you want to use.
32,537,116
Im trying days to understand how I can convert a SQL query to a query builder style in laravel. My SQL query is: ``` $tagid = Db::select("SELECT `id` FROM `wouter_blog_tags` WHERE `slug` = '".$this->param('slug')."'"); $blog = Db::select("SELECT * FROM `wouter_blog_posts` WHERE `published`...
2015/09/12
['https://Stackoverflow.com/questions/32537116', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3618513/']
This work for me: > > DB::table('wouter\_blog\_posts') > ->whereNotNull('published') > ->where('published', 1) > ->whereNotNull('published\_at') > ->whereRaw('`published_at` < NOW()') > ->whereRaw("(SELECT count(\*) > FROM `wouter_blog_tags` > INNER JOIN `wouter_blog_posts_tags` ON `wouter_blog_tags`.`id` = ...
The following Query Builder code will give you the exact SQL query you have within your `DB::select`: ``` DB::table('wouter_blog_posts') ->whereNotNull('published') ->where('published', 1) ->whereNotNull('published_at') ->whereRaw('`published_at` < NOW()') ->where(DB::raw('1'), '<=', function ($que...
3,996,048
I've got a sortable list which is using `connectWith` to ensure it can only be sorted within its own types of list. Now I'm trying to make a droppable trash can element that appears at the bottom on the viewport when an item is being sorted. This element is outside the context of the lists and simply deletes any eleme...
2010/10/22
['https://Stackoverflow.com/questions/3996048', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/192/']
Since `connectWith` accepts a selector, you can provide it a selector that selects both the other connected lists and your trash can. ``` $("#sortable1, #sortable2").sortable({ connectWith: '.connectedSortable, #trash' }).disableSelection(); $("#trash").droppable({ accept: ".connectedSortable li", hoverCl...
How about making the trash can a `.dropZone` as well? Then you would get a proper `drop` event, and you could handle the deleting properly. There may be side effects of making the trash can a sortable, but I figure they should be easy to work around. If this doesn't meet your requirements, could you throw up a demo [...
45,003,631
I have a column where a date store in ddmmyy format (e.g. 151216). How can I convert it to yyyy-mm-dd format (e.g 2016-12-15) for calculating a date difference from the current date? I try using DATE\_FORMAT function but its not appropriate for this.
2017/07/10
['https://Stackoverflow.com/questions/45003631', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2231075/']
If you want to get the date difference, you can use `to_days()` after converting the string to a date using `str_to_date()`: ``` select to_days(curdate()) - to_days(str_to_date(col, '%d%m%y')) ``` or `datediff()`: ``` select datediff(curdate(), str_to_date(col, '%d%m%y')) ``` or `timestampdiff()`: ``` select tim...
You can use the function, `STR_TO_DATE()` for this. ``` STR_TO_DATE('151216', '%d%m%y') ``` A query would look something like: ``` select foo.bar from foo where STR_TO_DATE(foo.baz, '%d%m%y') < CURDATE() ``` Note: Since both `STR_TO_DATE()` and `CURDATE()` return date objects, there's no reason to cha...