qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
72,523,117
Say I have a dataframe that ***looks*** like this (wasn't sure how to actually rep. this data, given its size): ``` minutes <- seq(0,585, by = 15) salinity <- as.numeric(sample(x = 29:55, size = 40, replace = TRUE)) site <- c(1, 2, 3, ...etc.) year <- c(2020, 2019, ...etc.) season <- c("Dry", "Wet") df <- cbind.dat...
2022/06/06
[ "https://Stackoverflow.com/questions/72523117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16401542/" ]
Just change the volar version **0.37.2 to 0.36.0** and everyting will be fine. Note: I spent coulple of hours and didn't find the exact solution and then simply tried this; then everything worked fine. This link helped to get some idea regarading this issue: <https://github.com/microsoft/TypeScript/issues/28631#issue...
Fixed on `0.37.3`, so you don't have to alter your config or anything - <https://github.com/johnsoncodehk/volar/issues/1405#issuecomment-1149618450>
8,595,332
So my code was working before. I don't know what I did for this to happen and I can't seem to fix it. I've seen people say to reset the ModelState. ( ModelState.Clear(); ) But that didn't help. Also, it doesn't help that I'm still fairly new to MVC. Any help would be appreciated. Thanks. Controller: ``` public Ac...
2011/12/21
[ "https://Stackoverflow.com/questions/8595332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1026288/" ]
If your ModelState is not valid on your POST action, you need to repopulate your SelectList properties: ``` if( ModelState.IsValid ) { // save and redirect // ... } // repopulate your SelectList properties: model.CategoryItems = GetCategories(); return View(model); ``` Do not repopulate the entire model b...
another way i have find the solution is take hidden field. so in your case you could do as below: ``` @Html.HiddenFor(model => model.CategoryId) ``` Now with another field form also post and set CategoryId in respective model.
2,067,436
Right now, I'm working on a project which requires sequential text key generation. I need to seed the key generator with an integer corresponding to a certain key, which the constructor converts to a key. My key generator overloads the increment operators so that the string is incremented directly, rather than what I ...
2010/01/14
[ "https://Stackoverflow.com/questions/2067436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136846/" ]
Rather than doing a find, why don't you have a reverse translation array? The array index would be the character, and the value in the array would be its numeric value (or index into the other array). ``` key[place] = charset[reverse_charset[key[place]] + 1]; ```
Perhaps you would be better off working with indexes into the charset, and then converting them to actual characters when needed? That would save you the overhead of searching for characters in the charset. And converting a charset index into a character would be a constant-time operation, unlike the inverse. Store y...
2,067,436
Right now, I'm working on a project which requires sequential text key generation. I need to seed the key generator with an integer corresponding to a certain key, which the constructor converts to a key. My key generator overloads the increment operators so that the string is incremented directly, rather than what I ...
2010/01/14
[ "https://Stackoverflow.com/questions/2067436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136846/" ]
Rather than doing a find, why don't you have a reverse translation array? The array index would be the character, and the value in the array would be its numeric value (or index into the other array). ``` key[place] = charset[reverse_charset[key[place]] + 1]; ```
I am not sure I understood what you wanted to do exactly but here is a little console program that prints out a sequence of 36\*36\*36 3-digit keys in base 36 using your charset as the digits. So it starts at aaa and ends at 999. ``` #include <stdio.h> typedef int Number; const size_t N = 3; size_t B = 36; Number key[...
2,067,436
Right now, I'm working on a project which requires sequential text key generation. I need to seed the key generator with an integer corresponding to a certain key, which the constructor converts to a key. My key generator overloads the increment operators so that the string is incremented directly, rather than what I ...
2010/01/14
[ "https://Stackoverflow.com/questions/2067436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136846/" ]
You could store a vector of the same length as your key, where each element in the vector was the index in the charset of the corresponding character in the key. For example, if `key[0]` was 'c', then `thisVector[0]` would be 2, since 'c' is the 3rd character in the character set. Then all operations would be perfor...
Perhaps you would be better off working with indexes into the charset, and then converting them to actual characters when needed? That would save you the overhead of searching for characters in the charset. And converting a charset index into a character would be a constant-time operation, unlike the inverse. Store y...
2,067,436
Right now, I'm working on a project which requires sequential text key generation. I need to seed the key generator with an integer corresponding to a certain key, which the constructor converts to a key. My key generator overloads the increment operators so that the string is incremented directly, rather than what I ...
2010/01/14
[ "https://Stackoverflow.com/questions/2067436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136846/" ]
You could store a vector of the same length as your key, where each element in the vector was the index in the charset of the corresponding character in the key. For example, if `key[0]` was 'c', then `thisVector[0]` would be 2, since 'c' is the 3rd character in the character set. Then all operations would be perfor...
I am not sure I understood what you wanted to do exactly but here is a little console program that prints out a sequence of 36\*36\*36 3-digit keys in base 36 using your charset as the digits. So it starts at aaa and ends at 999. ``` #include <stdio.h> typedef int Number; const size_t N = 3; size_t B = 36; Number key[...
2,067,436
Right now, I'm working on a project which requires sequential text key generation. I need to seed the key generator with an integer corresponding to a certain key, which the constructor converts to a key. My key generator overloads the increment operators so that the string is incremented directly, rather than what I ...
2010/01/14
[ "https://Stackoverflow.com/questions/2067436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136846/" ]
This is another version of the generalized base conversion problem, with n=36. What you want to do is view your key as an unsigned integer, and view the "string" that you're handing out as a base 36 (a-z + 0-9) representation of that key. Handing out a key then becomes converting the "next key" value to the base36 st...
Perhaps you would be better off working with indexes into the charset, and then converting them to actual characters when needed? That would save you the overhead of searching for characters in the charset. And converting a charset index into a character would be a constant-time operation, unlike the inverse. Store y...
2,067,436
Right now, I'm working on a project which requires sequential text key generation. I need to seed the key generator with an integer corresponding to a certain key, which the constructor converts to a key. My key generator overloads the increment operators so that the string is incremented directly, rather than what I ...
2010/01/14
[ "https://Stackoverflow.com/questions/2067436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136846/" ]
I am not sure I understood what you wanted to do exactly but here is a little console program that prints out a sequence of 36\*36\*36 3-digit keys in base 36 using your charset as the digits. So it starts at aaa and ends at 999. ``` #include <stdio.h> typedef int Number; const size_t N = 3; size_t B = 36; Number key[...
Perhaps you would be better off working with indexes into the charset, and then converting them to actual characters when needed? That would save you the overhead of searching for characters in the charset. And converting a charset index into a character would be a constant-time operation, unlike the inverse. Store y...
2,067,436
Right now, I'm working on a project which requires sequential text key generation. I need to seed the key generator with an integer corresponding to a certain key, which the constructor converts to a key. My key generator overloads the increment operators so that the string is incremented directly, rather than what I ...
2010/01/14
[ "https://Stackoverflow.com/questions/2067436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136846/" ]
This is another version of the generalized base conversion problem, with n=36. What you want to do is view your key as an unsigned integer, and view the "string" that you're handing out as a base 36 (a-z + 0-9) representation of that key. Handing out a key then becomes converting the "next key" value to the base36 st...
I am not sure I understood what you wanted to do exactly but here is a little console program that prints out a sequence of 36\*36\*36 3-digit keys in base 36 using your charset as the digits. So it starts at aaa and ends at 999. ``` #include <stdio.h> typedef int Number; const size_t N = 3; size_t B = 36; Number key[...
11,172,620
I am struggling with linking ALAssetsLibrary in my code. I have googled a lot on this and followed more than one tutorial to the last dot yet I am still where I began. ``` Ld /Users/vedprakash/Library/Developer/Xcode/DerivedData/PickThumb-gmvprlkgmgexedeojbaoeidbadnw/Build/Products/Debug-iphonesimulator/PickThumb.ap...
2012/06/23
[ "https://Stackoverflow.com/questions/11172620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1477296/" ]
You need to add the `AssetsLibrary` framework to the “Link Binary With Libraries” build phase of your `PickThumb` target. [How to "add existing frameworks" in Xcode 4?](https://stackoverflow.com/questions/3352664/how-to-add-existing-frameworks-in-xcode-4)
In Xcode 10.2 I just added ``` AssetsLibrary.framework ``` in the Target>Build Phases> Link Binary With Libraries section
14,763,212
Compare const and non-const pointers. Is the comparison legal? Any special care for such comparison. Thanks.
2013/02/07
[ "https://Stackoverflow.com/questions/14763212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2052376/" ]
A pointer to `T` can be implicitly converted into a const pointer to `T`; similarly, a pointer to `T` can be implicitly converted into a pointer to `const T`. The compiler will do either of those conversions, or both, as needed when you try to compare a pointer to a const pointer. There's nothing there that's any more ...
The purpose of const as in > > const char\* p > > > is to promise that you will not change it. In theory, a non-const pointer should never be pointing at the same location in the same code, as a matter of good coding practice that is. In practice, you may end up making something const because it makes your life ...
3,804,875
How would you suggest using `AsEnumerable` on a non-generic `IQueryable`? I cannot use the `Cast<T>` or `OfType<T>` methods to get an `IQueryable<object>` before calling `AsEnumerable`, since these methods have their own explicit translation by the underlying `IQueryProvider` and will break the query translation if I ...
2010/09/27
[ "https://Stackoverflow.com/questions/3804875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/326518/" ]
Since the interface `IQueryable` inherits from `IEnumerable` why not: ``` IQueryable queryable; IEnumerable<T> = (queryable as IEnumerable).Cast<T>(); ``` **Edit** There are two `Cast<>` extension methods: ``` public static IQueryable<TResult> Cast<TResult>(this IQueryable source) public static IEnumerable<TResu...
The type `IQueryable` inherits from the non-generic `IEnumerable` so this extension method doesn't seem to serve any purpose. Why not just use it as `IEnumerable` directly?
3,804,875
How would you suggest using `AsEnumerable` on a non-generic `IQueryable`? I cannot use the `Cast<T>` or `OfType<T>` methods to get an `IQueryable<object>` before calling `AsEnumerable`, since these methods have their own explicit translation by the underlying `IQueryProvider` and will break the query translation if I ...
2010/09/27
[ "https://Stackoverflow.com/questions/3804875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/326518/" ]
Since the interface `IQueryable` inherits from `IEnumerable` why not: ``` IQueryable queryable; IEnumerable<T> = (queryable as IEnumerable).Cast<T>(); ``` **Edit** There are two `Cast<>` extension methods: ``` public static IQueryable<TResult> Cast<TResult>(this IQueryable source) public static IEnumerable<TResu...
JaredPar's answer in other words: ``` public static IEnumerable AsEnumerable(this IEnumerable source) { return source; } ``` Usage: ``` IQueryable queryable = // ... IEnumerable enumerable = queryable.AsEnumerable(); IEnumerable<Foo> result = enumerable.Cast<Foo>(); // ↑ // ...
3,804,875
How would you suggest using `AsEnumerable` on a non-generic `IQueryable`? I cannot use the `Cast<T>` or `OfType<T>` methods to get an `IQueryable<object>` before calling `AsEnumerable`, since these methods have their own explicit translation by the underlying `IQueryProvider` and will break the query translation if I ...
2010/09/27
[ "https://Stackoverflow.com/questions/3804875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/326518/" ]
Since the interface `IQueryable` inherits from `IEnumerable` why not: ``` IQueryable queryable; IEnumerable<T> = (queryable as IEnumerable).Cast<T>(); ``` **Edit** There are two `Cast<>` extension methods: ``` public static IQueryable<TResult> Cast<TResult>(this IQueryable source) public static IEnumerable<TResu...
To clarify, you are trying to add a "force expression evaluation" to your linq expression tree so that part of the expression tree is evaluated against the underlying provider (linq to SQL for example) and the rest is evaluated in memory (linq to objects). But you want to be able to specify the entire express tree with...
8,733,999
I have an rss parser as part of my app code, and it is working fine and loading the rss xml file and populating the tableview fine. The problem is with a refresh/reload button, which does reload the rss data, but it APPENDS the new data to the table and the table just grows and grows in size. What the behaviour shoul...
2012/01/04
[ "https://Stackoverflow.com/questions/8733999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1076261/" ]
Actually, have now solved this! Was due to "autoreleasing" elements of the array, so after clearing this out, they were invalid. Removing `autorelease` and just releasing these objects in the final dealloc worked.
The Code **EXC\_BAD\_ACCESS** does mean, that you want connect at a variable that does not exists anymore. In your code example, I can see, the problem to see at the following two lines of code: ``` [activityIndicator release]; [activityIndicator startAnimating]; ``` You release the activityIdicator befor starting ...
21,279,393
I have some questions about XMLHttpRequest using $.Post $.Ajax: 1- How the server side verifies if the request was sent from same browser? 2- How the server side verifies if session user who sent the request has been changed on same browser? (ex: user logout and another user login on same browser) 3- Do I need any s...
2014/01/22
[ "https://Stackoverflow.com/questions/21279393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2007059/" ]
1. Browsers and servers use cookies to check whether request was sent from same browser. Every request will have cookies attached. 2. The basic idea about the sessions is simple. Whenever you send a request to the server, the session variable (if present) will be sent along with the request to your server. Again, if yo...
1. It doesn't 2. By whatever mechanism it uses to track who is logged in for any other kind of request (presumably the data your server side application stores in the session will change) 3. No
222,298
The effect I'm looking for in the end is to have the first line in some paragraphs bolded. These would be the first paragraph of each section in my post. This kind of effect is used on [this](http://www.bloomberg.com/features/2016-how-to-hack-an-election/) Bloomberg.com post. Notice the first paragraph in the post and ...
2016/04/01
[ "https://wordpress.stackexchange.com/questions/222298", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/91575/" ]
I figured this out. Even though Wordpress automatically adds the `<p>` tag and doesn't show it to you in the editor (in either the 'visual' or 'text' editor views), you can type it in anyway in the 'text' editor view, along with a class. So to do this, go to the 'text' editor view, and just type, e.g., `<p class="sect...
If you want to add specific styles to a specific section within the paragraph you can create a element with a class name, and then add styles within your stylesheet. Or, in this case, you can just use to make a line bold.
47,012,120
I have a dataframe of IDs and addresses. Normally, I would expect each recurring ID to have the same address in all observations, but some of my IDs have different addresses. I want to locate those observations that are duplicated on ID, but have at least 2 different addresses. Then, I want to randomize a new ID for on...
2017/10/30
[ "https://Stackoverflow.com/questions/47012120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4732998/" ]
Here's a solution with `tidyr` and functions `nest` / `unnest` ``` library(tidyr) library(dplyr) df %>% group_by(ID,Address) %>% nest %>% `[<-`(duplicated(.$ID),"ID",max(.$ID, na.rm = TRUE) + 1:sum(duplicated(.$ID))) %>% unnest # # A tibble: 13 x 3 # ID Address rand # <dbl> <fctr> <int> # 1 1 x ...
An option would be `data.table`. After grouping by 'ID', `if` the number of `unique` 'Address' is greater than 1 and the 'Address' is not equal to the first `unique` 'Address', then get the row index (`.I`) and assign those 'ID' with the 'ID's that are not already in the original dataset ``` library(data.table) i1 <- ...
42,362,024
I am getting the following crash for a lot of users : ``` Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Set java.util.Map.keySet()' on a null object reference at com.google.android.gms.internal.zzbtn.zza(Unknown Source) at com.google.android.gms.internal.zzbtn.run...
2017/02/21
[ "https://Stackoverflow.com/questions/42362024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3904327/" ]
Hint: 1. Produce `[f x1,...,f xn]` first, applying `f` to every member. 2. Then, write a function that takes `[y1,...,yn]` and `w` and produces an interleaving `[y1,w,y2,w,...,yn]`. This can be done by recursion. (There's also a library function for that, but it's not important.) 3. Compose both, to obtain `[f x1, ","...
How about this: ``` import Data.List flist f list = "[" ++ (intercalate "," $ map f list) ++ "]" ``` `intercalate` puts Strings in between of other Strings, it is (in this case) [a slightly configurable version of `unwords`](https://stackoverflow.com/questions/5521560/haskell-words-unwords-delimiter).
48,247,393
I am trying to preload server form in the constructor of client form, in a separate thread. My reason is that server load is time consuming. Here's the client form, you can see in the constructor that I am calling `Preload()`. There's also a button, clicking on it should show the server, which should be fast since the...
2018/01/14
[ "https://Stackoverflow.com/questions/48247393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9018083/" ]
You need to rethink your design. You should create all forms from the main UI thread, and offload the heavy lifting(non UI stuff) to the background threads. Calling UI methods from background threads results in undefined behavior or exceptions. Also, I think you misunderstand what `await` does. You call `Preload()` sy...
Send in constructor; ``` public partial class ServerUser : Form { public ServerUser(Form1 form1) { InitializeComponent(); form1.Preload(); } public void LoadDocument() { ConfigureSource(); } public void ConfigureSource() { InvokeUpdateControls(); } public void InvokeUpdateControls() { UpdateCon...
128,840
We need to do some user documentation for a product we have been working on for the past few sprints. We are now starting a new project in the next sprint and the PO is making the documentation for the product produced previously a User story for this sprint. I am just wondering your opinion on this approach. Personal...
2012/01/06
[ "https://softwareengineering.stackexchange.com/questions/128840", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/40251/" ]
"As a user of X, I need to know how X works" seems like a legitimate user story to me. This could result in written documentation or online help. The point isn't just code--it's meeting the users' requirements.
Ideally, documentation is part of every user story and never builds up. But, in the real world, that often doesn't happen. In that case, you should create a user story for catching up on a specific missing piece of documentation. You're right, it doesn't produce any code. But it does satisfy a user requirement and sho...
128,840
We need to do some user documentation for a product we have been working on for the past few sprints. We are now starting a new project in the next sprint and the PO is making the documentation for the product produced previously a User story for this sprint. I am just wondering your opinion on this approach. Personal...
2012/01/06
[ "https://softwareengineering.stackexchange.com/questions/128840", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/40251/" ]
Ideally, documentation is part of every user story and never builds up. But, in the real world, that often doesn't happen. In that case, you should create a user story for catching up on a specific missing piece of documentation. You're right, it doesn't produce any code. But it does satisfy a user requirement and sho...
I agree with pdr's documentation assessment if its about requirement, technical or project documentation. Ideally it should be incorporated into sprint work. Product documentation I feel is very different as it is an actual user requested deliverable and directly provides value to the user. This should be understood o...
128,840
We need to do some user documentation for a product we have been working on for the past few sprints. We are now starting a new project in the next sprint and the PO is making the documentation for the product produced previously a User story for this sprint. I am just wondering your opinion on this approach. Personal...
2012/01/06
[ "https://softwareengineering.stackexchange.com/questions/128840", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/40251/" ]
Ideally, documentation is part of every user story and never builds up. But, in the real world, that often doesn't happen. In that case, you should create a user story for catching up on a specific missing piece of documentation. You're right, it doesn't produce any code. But it does satisfy a user requirement and sho...
In our organization, the tooling team, in charge of our maintaining and enhancing our continuous integration system is using Scrum to help them manage their work. They are not writing code but they are practicing Scrum nonetheless. To answer your question specifically, I would ask if the team considers that the docume...
128,840
We need to do some user documentation for a product we have been working on for the past few sprints. We are now starting a new project in the next sprint and the PO is making the documentation for the product produced previously a User story for this sprint. I am just wondering your opinion on this approach. Personal...
2012/01/06
[ "https://softwareengineering.stackexchange.com/questions/128840", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/40251/" ]
"As a user of X, I need to know how X works" seems like a legitimate user story to me. This could result in written documentation or online help. The point isn't just code--it's meeting the users' requirements.
I agree with pdr's documentation assessment if its about requirement, technical or project documentation. Ideally it should be incorporated into sprint work. Product documentation I feel is very different as it is an actual user requested deliverable and directly provides value to the user. This should be understood o...
128,840
We need to do some user documentation for a product we have been working on for the past few sprints. We are now starting a new project in the next sprint and the PO is making the documentation for the product produced previously a User story for this sprint. I am just wondering your opinion on this approach. Personal...
2012/01/06
[ "https://softwareengineering.stackexchange.com/questions/128840", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/40251/" ]
"As a user of X, I need to know how X works" seems like a legitimate user story to me. This could result in written documentation or online help. The point isn't just code--it's meeting the users' requirements.
In our organization, the tooling team, in charge of our maintaining and enhancing our continuous integration system is using Scrum to help them manage their work. They are not writing code but they are practicing Scrum nonetheless. To answer your question specifically, I would ask if the team considers that the docume...
128,840
We need to do some user documentation for a product we have been working on for the past few sprints. We are now starting a new project in the next sprint and the PO is making the documentation for the product produced previously a User story for this sprint. I am just wondering your opinion on this approach. Personal...
2012/01/06
[ "https://softwareengineering.stackexchange.com/questions/128840", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/40251/" ]
I agree with pdr's documentation assessment if its about requirement, technical or project documentation. Ideally it should be incorporated into sprint work. Product documentation I feel is very different as it is an actual user requested deliverable and directly provides value to the user. This should be understood o...
In our organization, the tooling team, in charge of our maintaining and enhancing our continuous integration system is using Scrum to help them manage their work. They are not writing code but they are practicing Scrum nonetheless. To answer your question specifically, I would ask if the team considers that the docume...
65,896,559
I have some items inside of my `LinearLayout` and what I want to do is, arrange the items vertically in a way that it would spread evenly with default margin across the items. This is what I have now : [![enter image description here](https://i.stack.imgur.com/SFnCR.png)](https://i.stack.imgur.com/SFnCR.png) So All ...
2021/01/26
[ "https://Stackoverflow.com/questions/65896559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10881932/" ]
Try this instead of FrameLayout: ``` <RelativeLayout android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:layout_marginTop="25dp"> <com.google.android.material.floatingactionbutton.FloatingActionButton android:layout_width="wrap_content" ...
You can use the `layout_weight="value"` property. So you can set the weight for each FAB so that they can evenly get separated in the layout. For example if you want three FABs evenly seperate, you can set `layout_weight="1"` for each FAB, then it will seperate evenly. You can also use Decimal Values instead of 1.
32,501,002
I'm removing the hash value with `parent.location.hash = ''` but that instantly makes the browser jump to the top of the page - can I just remove the `#!ajax-url-part` from the browser without making it jump to the top of the page? Thank you.
2015/09/10
[ "https://Stackoverflow.com/questions/32501002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2065540/" ]
As OP wants, I put my comment in an answer because is a valid answer: You can read this blog: <http://spoiledmilk.com/blog/html5-changing-the-browser-url-without-refreshing-page/> The trick is as easy as this: ``` window.history.pushState(“object or string”, “Title”, “/new-url”); ``` Good luck!
window.location.href.substr(0, window.location.href.indexOf('#')) or window.location.href.split('#')[0]
58,178,874
I am trying to make a **checkbox** smaller and change the size of border I have tried playing around with layout in XML and `.width()`or `.height` in Kotlin. Neither does anything to change the size of it. I went to the tutorial that was recommended to others that asked these questions, but I did not understand what h...
2019/10/01
[ "https://Stackoverflow.com/questions/58178874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12146689/" ]
The `break` only breaks the for-loop but then continues with the code below. You probably just say `return` instead or `System.exit(0);`
You need a boolean flag. Set the flag to false, when there is any negative number. Check the flag before checking max number. ``` Scanner sc = new Scanner(System.in); int a[] = new int[6]; boolean flag = true; for (int i = 0; i < a.length; i++) { a[i] = sc.nextInt(); // To exit loop if (a[i] < 0) { ...
58,178,874
I am trying to make a **checkbox** smaller and change the size of border I have tried playing around with layout in XML and `.width()`or `.height` in Kotlin. Neither does anything to change the size of it. I went to the tutorial that was recommended to others that asked these questions, but I did not understand what h...
2019/10/01
[ "https://Stackoverflow.com/questions/58178874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12146689/" ]
This can be simplified a bit, no need to keep an array: ``` public class HighestMark { private static final int MAX_INPUT = 6; // could just hard-code this in loop, but good practice to set constants private static final Scanner SCAN = new Scanner(System.in); public static void main(String[] args) { int h...
You need a boolean flag. Set the flag to false, when there is any negative number. Check the flag before checking max number. ``` Scanner sc = new Scanner(System.in); int a[] = new int[6]; boolean flag = true; for (int i = 0; i < a.length; i++) { a[i] = sc.nextInt(); // To exit loop if (a[i] < 0) { ...
68,773,352
I have an array of 5 divs ``` `<div id="cap-left2"</div>` `<div id="cap-left1"</div>` `<div id="cap-base"</div>` `<div id="cap-right1"></div>` `<div id="cap-right2"</div>` ``` all these divs have a background . In my javascript I have : ``` let items = [capBase,capLeft1,capLeft2,capRight1,capRight2]; ``` this wor...
2021/08/13
[ "https://Stackoverflow.com/questions/68773352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16028691/" ]
Java has random number generator support via the `java.util.Random` class. This class 'works' by having a seed value, then giving you some random data based on this seed value, which then updates the seed value to something new. This pragmatically means: * 2 instances of j.u.Random with the same seed value will produ...
You could get the hashcode of the string, then use that to seed a random number generator. Use the RNG to get numbers in the range 1 - 10.
14,686,001
I have some text files in a directory. I would like to read all the files in this directory and if the file has the following line `SAMPLE 350 AN INTEGER OF TYPE :DECIMAL : CAN BE ASSEMBLED BY` move that file with its all contents to another directory. How can I do this?
2013/02/04
[ "https://Stackoverflow.com/questions/14686001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2039457/" ]
Using `find` and `grep`: ``` $ find . -type f -exec \ fgrep -l "SAMPLE 350 AN INTEGER OF TYPE :DECIMAL : CAN BE ASSEMBLED BY" {} \; \ | xargs -i% mv % /path/to/new/dir ```
This is easy in bash: ``` grep -l "PATTERN" * ``` gives you a list of files that contains PATTERN in current directory. So unless you have too many files you could do: ``` mv `grep -l "SAMPLE 350 AN INTEGER OF TYPE :DECIMAL : CAN BE ASSEMBLED BY"` /another/directory ``` The back ticks (they are no normal quotes) ...
14,686,001
I have some text files in a directory. I would like to read all the files in this directory and if the file has the following line `SAMPLE 350 AN INTEGER OF TYPE :DECIMAL : CAN BE ASSEMBLED BY` move that file with its all contents to another directory. How can I do this?
2013/02/04
[ "https://Stackoverflow.com/questions/14686001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2039457/" ]
Using `find` and `grep`: ``` $ find . -type f -exec \ fgrep -l "SAMPLE 350 AN INTEGER OF TYPE :DECIMAL : CAN BE ASSEMBLED BY" {} \; \ | xargs -i% mv % /path/to/new/dir ```
Here is a solution in python. The os.path.isdir() was necessary to bypass subdirectories. The "and file[-3:] != '.py'" is needed if running this .py script from the source directory. Alternately you could just check for the name of the script if you need to move .py files. ``` import os import shutil src = '/source' ...
21,910,653
So i made test code: ``` $fopen = fopen('./mydata.csv',"r"); $data = fgetcsv($fopen, 1000, ","); fclose($fopen); $fp = fopen('mynewdata.csv','a'); fputcsv($fp,$data,','); fclose($fp); ``` Content of mydata.csv file: > > string "some thing", sec string,next string > > > New content of mynewdata.csv file...
2014/02/20
[ "https://Stackoverflow.com/questions/21910653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1847939/" ]
As you can see by the [`fputcsv` documentation](http://dk1.php.net/fputcsv): > > int fputcsv ( resource $handle , array $fields [, string $delimiter = ',' [, string $enclosure = '"' ]] ) > > > The last parameter is the enclosure. Since you haven't defined yours, it defaults to `"`, and then it has to escape your ...
Thank you guys for your replay. But the answer is different. I step on php bug: <https://bugs.php.net/bug.php?id=51496> If some of you guy's out there know the solution, please write it. My php version 5.4.6. Edit. So to get rid of that problem insted of function fgetcsv and fputcsv i did way around: ``` $handle ...
4,912,154
I have two models: User ``` has_one :email ``` Email ``` belongs_to :user ``` I put the email\_id foreign key (NOT NULL) inside users table. Now I'm trying to save it in the following way: ``` @email = Email.new(params[:email]) @email.user = User.new(params[:user]) @email.save ``` This raises a db exception, ...
2011/02/06
[ "https://Stackoverflow.com/questions/4912154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130111/" ]
Yes, but only by invoking it: ``` Func<object> func = delegate { return a; }; // or Func<object> func = () => a; object b = func(); ``` And of course, the following is a lot simpler... ``` object b = a; ``` --- In the comments, cross-thread exceptions are mentioned; this can be fixed as follows: If the delegate...
Just declare somewhere these static functions: ``` public delegate object AnonymousDelegate(); public static object GetDelegateResult(AnonymousDelegate function) { return function.Invoke(); } ``` And anywhere use it as you want like this: ``` object item = GetDelegateResult(delegate { return "TEST"; }); ``` ...
4,912,154
I have two models: User ``` has_one :email ``` Email ``` belongs_to :user ``` I put the email\_id foreign key (NOT NULL) inside users table. Now I'm trying to save it in the following way: ``` @email = Email.new(params[:email]) @email.user = User.new(params[:user]) @email.save ``` This raises a db exception, ...
2011/02/06
[ "https://Stackoverflow.com/questions/4912154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130111/" ]
Yes, but only by invoking it: ``` Func<object> func = delegate { return a; }; // or Func<object> func = () => a; object b = func(); ``` And of course, the following is a lot simpler... ``` object b = a; ``` --- In the comments, cross-thread exceptions are mentioned; this can be fixed as follows: If the delegate...
``` using System; public delegate int ReturnedDelegate(string s); class AnonymousDelegate { static void Main() { ReturnedDelegate len = delegate(string s) { return s.Length; }; Console.WriteLine(len("hello world")); } } ```
4,912,154
I have two models: User ``` has_one :email ``` Email ``` belongs_to :user ``` I put the email\_id foreign key (NOT NULL) inside users table. Now I'm trying to save it in the following way: ``` @email = Email.new(params[:email]) @email.user = User.new(params[:user]) @email.save ``` This raises a db exception, ...
2011/02/06
[ "https://Stackoverflow.com/questions/4912154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130111/" ]
Just declare somewhere these static functions: ``` public delegate object AnonymousDelegate(); public static object GetDelegateResult(AnonymousDelegate function) { return function.Invoke(); } ``` And anywhere use it as you want like this: ``` object item = GetDelegateResult(delegate { return "TEST"; }); ``` ...
``` using System; public delegate int ReturnedDelegate(string s); class AnonymousDelegate { static void Main() { ReturnedDelegate len = delegate(string s) { return s.Length; }; Console.WriteLine(len("hello world")); } } ```
29,308,901
So i have `.cont` that's centered in using position absolute and is height 80% of body. Inside it there are two divs. One is fixed height. And other one needs to expand to rest of parent, `.cont`. So How do i make it expand to parent. One other requirement is that content in both of these needs to be vertically and...
2015/03/27
[ "https://Stackoverflow.com/questions/29308901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1319799/" ]
Here you go. Absolutely position the white container with a top-padding that equals the height of your fixed-height top div. Then give the top div a z-index so it goes over your white box: Fiddle - <http://jsfiddle.net/24jocwu5/2/> ``` * {margin: 0; padding: 0;} html, body { height: 100%; background-color: #...
This is what you want? Only position fixed and right and left 0 <http://jsfiddle.net/pabliiitoo/24jocwu5/1/> ``` .fillRest { position: fixed; left: 0; right: 0; background-color: red; min-height: 80px; } ```
29,308,901
So i have `.cont` that's centered in using position absolute and is height 80% of body. Inside it there are two divs. One is fixed height. And other one needs to expand to rest of parent, `.cont`. So How do i make it expand to parent. One other requirement is that content in both of these needs to be vertically and...
2015/03/27
[ "https://Stackoverflow.com/questions/29308901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1319799/" ]
You can use flexbox for this ``` .cont { display: flex; flex-direction: column; } .cont > div { display: flex; } .fillRest { flex: 1; } ``` [**Working Fiddle**](http://jsfiddle.net/z24x0rvo/)
This is what you want? Only position fixed and right and left 0 <http://jsfiddle.net/pabliiitoo/24jocwu5/1/> ``` .fillRest { position: fixed; left: 0; right: 0; background-color: red; min-height: 80px; } ```
29,308,901
So i have `.cont` that's centered in using position absolute and is height 80% of body. Inside it there are two divs. One is fixed height. And other one needs to expand to rest of parent, `.cont`. So How do i make it expand to parent. One other requirement is that content in both of these needs to be vertically and...
2015/03/27
[ "https://Stackoverflow.com/questions/29308901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1319799/" ]
Here you go. Absolutely position the white container with a top-padding that equals the height of your fixed-height top div. Then give the top div a z-index so it goes over your white box: Fiddle - <http://jsfiddle.net/24jocwu5/2/> ``` * {margin: 0; padding: 0;} html, body { height: 100%; background-color: #...
In order to expand the .fillRest to the rest of its parent .cont, you need to set it's height to a percentage. I estimate about 20~30% is what you want in order to maintain a similar look to the image you've provided here. To test it, grab a very large paragraph full of letters and anything you want and put it where t...
29,308,901
So i have `.cont` that's centered in using position absolute and is height 80% of body. Inside it there are two divs. One is fixed height. And other one needs to expand to rest of parent, `.cont`. So How do i make it expand to parent. One other requirement is that content in both of these needs to be vertically and...
2015/03/27
[ "https://Stackoverflow.com/questions/29308901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1319799/" ]
You can use flexbox for this ``` .cont { display: flex; flex-direction: column; } .cont > div { display: flex; } .fillRest { flex: 1; } ``` [**Working Fiddle**](http://jsfiddle.net/z24x0rvo/)
In order to expand the .fillRest to the rest of its parent .cont, you need to set it's height to a percentage. I estimate about 20~30% is what you want in order to maintain a similar look to the image you've provided here. To test it, grab a very large paragraph full of letters and anything you want and put it where t...
29,308,901
So i have `.cont` that's centered in using position absolute and is height 80% of body. Inside it there are two divs. One is fixed height. And other one needs to expand to rest of parent, `.cont`. So How do i make it expand to parent. One other requirement is that content in both of these needs to be vertically and...
2015/03/27
[ "https://Stackoverflow.com/questions/29308901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1319799/" ]
Here you go. Absolutely position the white container with a top-padding that equals the height of your fixed-height top div. Then give the top div a z-index so it goes over your white box: Fiddle - <http://jsfiddle.net/24jocwu5/2/> ``` * {margin: 0; padding: 0;} html, body { height: 100%; background-color: #...
Personally, I think the way you're going about this is all wrong. But maybe something like this would work. <http://jsfiddle.net/24jocwu5/5/> CSS selectors I changed: ``` .cont { position: absolute; top: 0; bottom: 0; right: 0; left: 0; background-color: #1af; width: 400px; margin: 10% auto; ...
29,308,901
So i have `.cont` that's centered in using position absolute and is height 80% of body. Inside it there are two divs. One is fixed height. And other one needs to expand to rest of parent, `.cont`. So How do i make it expand to parent. One other requirement is that content in both of these needs to be vertically and...
2015/03/27
[ "https://Stackoverflow.com/questions/29308901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1319799/" ]
Here you go. Absolutely position the white container with a top-padding that equals the height of your fixed-height top div. Then give the top div a z-index so it goes over your white box: Fiddle - <http://jsfiddle.net/24jocwu5/2/> ``` * {margin: 0; padding: 0;} html, body { height: 100%; background-color: #...
This is Summary Of Ways.. First two ways posted here-- 1. [FlexBox Method](https://stackoverflow.com/questions/29308901/how-do-i-get-last-div-to-expand-parents-height/29309253#29309253) 100% WORKS 2. [Padding Method](https://stackoverflow.com/questions/29308901/how-do-i-get-last-div-to-expand-parents-height/29309196#2...
29,308,901
So i have `.cont` that's centered in using position absolute and is height 80% of body. Inside it there are two divs. One is fixed height. And other one needs to expand to rest of parent, `.cont`. So How do i make it expand to parent. One other requirement is that content in both of these needs to be vertically and...
2015/03/27
[ "https://Stackoverflow.com/questions/29308901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1319799/" ]
You can use flexbox for this ``` .cont { display: flex; flex-direction: column; } .cont > div { display: flex; } .fillRest { flex: 1; } ``` [**Working Fiddle**](http://jsfiddle.net/z24x0rvo/)
Personally, I think the way you're going about this is all wrong. But maybe something like this would work. <http://jsfiddle.net/24jocwu5/5/> CSS selectors I changed: ``` .cont { position: absolute; top: 0; bottom: 0; right: 0; left: 0; background-color: #1af; width: 400px; margin: 10% auto; ...
29,308,901
So i have `.cont` that's centered in using position absolute and is height 80% of body. Inside it there are two divs. One is fixed height. And other one needs to expand to rest of parent, `.cont`. So How do i make it expand to parent. One other requirement is that content in both of these needs to be vertically and...
2015/03/27
[ "https://Stackoverflow.com/questions/29308901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1319799/" ]
You can use flexbox for this ``` .cont { display: flex; flex-direction: column; } .cont > div { display: flex; } .fillRest { flex: 1; } ``` [**Working Fiddle**](http://jsfiddle.net/z24x0rvo/)
This is Summary Of Ways.. First two ways posted here-- 1. [FlexBox Method](https://stackoverflow.com/questions/29308901/how-do-i-get-last-div-to-expand-parents-height/29309253#29309253) 100% WORKS 2. [Padding Method](https://stackoverflow.com/questions/29308901/how-do-i-get-last-div-to-expand-parents-height/29309196#2...
46,316
Pleasures for us is pain & suffering for the animals which are slaughtered. When we are causing suffering & pain to others, we lose moral rights to expect not the same ever happened to us. In case of animal slaughtering, do we also lose the moral rights to mourn if our beloved ones are killed the same way which we, bei...
2017/10/01
[ "https://philosophy.stackexchange.com/questions/46316", "https://philosophy.stackexchange.com", "https://philosophy.stackexchange.com/users/23084/" ]
> > *moral rights* > > > "Rights" aren't a moral or ethical category. They are a juridical category. > > *to mourn* > > > To "mourn", on the other hand, is psychological, not moral or juridical, phenomenon. So, the "moral right to mourn" is a conflation of disparate concepts, which becomes meaningless at al...
Sea urchins can kill off kelp forest if left unchecked. It was meat-eating sea otters who restored the forests, where other critters can have a place to live. Goats are capable of turning grasslands into deserts. It was meat-eating wolfs who checked the goats' number and kept alive the grassland, where other critters ...
3,565
This comes from one of my favorite interview questions, though apparently it is now a fairly well-known puzzle. I have no way of knowing, but if you have already heard the answer it would be polite to let others try instead. ### Task: Write a function that takes as input a singly-linked list and returns true if it lo...
2011/08/26
[ "https://codegolf.stackexchange.com/questions/3565", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/2360/" ]
C, non-golfed ------------- The idea is to have to pointers p1 and p2 that traverse the list. p2 moves twice as fast as p1. If p2 reaches p1 at some point then there is a loop. Here is the C code (not tested, though). ``` struct node { void *value; struct node *next; }; int has_loops(struct node *p) { struct n...
Ada --- The "Floyd's Cycle-Finding Algorithm" is the best solution. It's also called "The Tortoise and the Hare Algorithm". linked\_lists.ads: ``` generic type Element_Type is private; package Linked_Lists is type Node is private; type List is private; function Has_Loops (L : List) return Boolean; pri...
3,565
This comes from one of my favorite interview questions, though apparently it is now a fairly well-known puzzle. I have no way of knowing, but if you have already heard the answer it would be polite to let others try instead. ### Task: Write a function that takes as input a singly-linked list and returns true if it lo...
2011/08/26
[ "https://codegolf.stackexchange.com/questions/3565", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/2360/" ]
C, non-golfed ------------- The idea is to have to pointers p1 and p2 that traverse the list. p2 moves twice as fast as p1. If p2 reaches p1 at some point then there is a loop. Here is the C code (not tested, though). ``` struct node { void *value; struct node *next; }; int has_loops(struct node *p) { struct n...
Since the solution is already in the open, I think it's fair to step in now with Brent's algorithm, which is the one I'm familiar with from integer factorisation. ``` #define bool int #define false 0 #define true 1 bool has_loops(struct node *first) { if (!first) return false; struct node *a = first, *b = fi...
3,565
This comes from one of my favorite interview questions, though apparently it is now a fairly well-known puzzle. I have no way of knowing, but if you have already heard the answer it would be polite to let others try instead. ### Task: Write a function that takes as input a singly-linked list and returns true if it lo...
2011/08/26
[ "https://codegolf.stackexchange.com/questions/3565", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/2360/" ]
C, non-golfed ------------- The idea is to have to pointers p1 and p2 that traverse the list. p2 moves twice as fast as p1. If p2 reaches p1 at some point then there is a loop. Here is the C code (not tested, though). ``` struct node { void *value; struct node *next; }; int has_loops(struct node *p) { struct n...
Haskell ------- Naive algorithm: ``` import Data.Set (Set) import qualified Data.Set as Set type Id = Integer data Node a = Node { getValue :: a, getId :: Id } hasLoop :: [Node a] -> Bool hasLoop = hasLoop' Set.empty hasLoop' :: Set Id => [Node a] -> Bool hasLoop' set xs = case ns of [] -> False x:xs' -> let ...
3,565
This comes from one of my favorite interview questions, though apparently it is now a fairly well-known puzzle. I have no way of knowing, but if you have already heard the answer it would be polite to let others try instead. ### Task: Write a function that takes as input a singly-linked list and returns true if it lo...
2011/08/26
[ "https://codegolf.stackexchange.com/questions/3565", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/2360/" ]
C, non-golfed ------------- The idea is to have to pointers p1 and p2 that traverse the list. p2 moves twice as fast as p1. If p2 reaches p1 at some point then there is a loop. Here is the C code (not tested, though). ``` struct node { void *value; struct node *next; }; int has_loops(struct node *p) { struct n...
D = This is a solution I thought of myself. It runs in O(n) and uses O(1) memory. What I'm doing is simply iterating through the list and reversing all the pointers. If the list contains a cycle, you'll eventually end up at the beginning of the list and otherwise you end up at the end, which is somewhere else if your...
3,565
This comes from one of my favorite interview questions, though apparently it is now a fairly well-known puzzle. I have no way of knowing, but if you have already heard the answer it would be polite to let others try instead. ### Task: Write a function that takes as input a singly-linked list and returns true if it lo...
2011/08/26
[ "https://codegolf.stackexchange.com/questions/3565", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/2360/" ]
Ada --- The "Floyd's Cycle-Finding Algorithm" is the best solution. It's also called "The Tortoise and the Hare Algorithm". linked\_lists.ads: ``` generic type Element_Type is private; package Linked_Lists is type Node is private; type List is private; function Has_Loops (L : List) return Boolean; pri...
Haskell ------- Naive algorithm: ``` import Data.Set (Set) import qualified Data.Set as Set type Id = Integer data Node a = Node { getValue :: a, getId :: Id } hasLoop :: [Node a] -> Bool hasLoop = hasLoop' Set.empty hasLoop' :: Set Id => [Node a] -> Bool hasLoop' set xs = case ns of [] -> False x:xs' -> let ...
3,565
This comes from one of my favorite interview questions, though apparently it is now a fairly well-known puzzle. I have no way of knowing, but if you have already heard the answer it would be polite to let others try instead. ### Task: Write a function that takes as input a singly-linked list and returns true if it lo...
2011/08/26
[ "https://codegolf.stackexchange.com/questions/3565", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/2360/" ]
Ada --- The "Floyd's Cycle-Finding Algorithm" is the best solution. It's also called "The Tortoise and the Hare Algorithm". linked\_lists.ads: ``` generic type Element_Type is private; package Linked_Lists is type Node is private; type List is private; function Has_Loops (L : List) return Boolean; pri...
D = This is a solution I thought of myself. It runs in O(n) and uses O(1) memory. What I'm doing is simply iterating through the list and reversing all the pointers. If the list contains a cycle, you'll eventually end up at the beginning of the list and otherwise you end up at the end, which is somewhere else if your...
3,565
This comes from one of my favorite interview questions, though apparently it is now a fairly well-known puzzle. I have no way of knowing, but if you have already heard the answer it would be polite to let others try instead. ### Task: Write a function that takes as input a singly-linked list and returns true if it lo...
2011/08/26
[ "https://codegolf.stackexchange.com/questions/3565", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/2360/" ]
Since the solution is already in the open, I think it's fair to step in now with Brent's algorithm, which is the one I'm familiar with from integer factorisation. ``` #define bool int #define false 0 #define true 1 bool has_loops(struct node *first) { if (!first) return false; struct node *a = first, *b = fi...
Haskell ------- Naive algorithm: ``` import Data.Set (Set) import qualified Data.Set as Set type Id = Integer data Node a = Node { getValue :: a, getId :: Id } hasLoop :: [Node a] -> Bool hasLoop = hasLoop' Set.empty hasLoop' :: Set Id => [Node a] -> Bool hasLoop' set xs = case ns of [] -> False x:xs' -> let ...
3,565
This comes from one of my favorite interview questions, though apparently it is now a fairly well-known puzzle. I have no way of knowing, but if you have already heard the answer it would be polite to let others try instead. ### Task: Write a function that takes as input a singly-linked list and returns true if it lo...
2011/08/26
[ "https://codegolf.stackexchange.com/questions/3565", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/2360/" ]
Since the solution is already in the open, I think it's fair to step in now with Brent's algorithm, which is the one I'm familiar with from integer factorisation. ``` #define bool int #define false 0 #define true 1 bool has_loops(struct node *first) { if (!first) return false; struct node *a = first, *b = fi...
D = This is a solution I thought of myself. It runs in O(n) and uses O(1) memory. What I'm doing is simply iterating through the list and reversing all the pointers. If the list contains a cycle, you'll eventually end up at the beginning of the list and otherwise you end up at the end, which is somewhere else if your...
1,556,716
I distributed an iPhone application to some testers who are using Windows. On their machines, the application that I built (in the form of an .app bundle) appeared as a directory. That makes sense because a .app bundle **is** actually a directory. What mechanism does Mac OS X use to display these bundles as files with...
2009/10/12
[ "https://Stackoverflow.com/questions/1556716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/105382/" ]
No, but why would you want to? An .app on Mac is not equivalent to an .exe on Windows - if you explore the .app bundle on a Mac (using "Show Package Contents"), you'll see an actual executable program inside. *This* program is more the equivalent of a Windows .exe, and you can liken the entire .app bundle to the Progra...
It's kind of the same magic that lets zip files appear as "compressed folders". It's what the shell does but I am afraid you have no way of hooking into such things.
1,556,716
I distributed an iPhone application to some testers who are using Windows. On their machines, the application that I built (in the form of an .app bundle) appeared as a directory. That makes sense because a .app bundle **is** actually a directory. What mechanism does Mac OS X use to display these bundles as files with...
2009/10/12
[ "https://Stackoverflow.com/questions/1556716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/105382/" ]
It's kind of the same magic that lets zip files appear as "compressed folders". It's what the shell does but I am afraid you have no way of hooking into such things.
If you are distributing to Windows users all will go much better if you give them IPA files instead of app bundles. The easiest way to create an IPA file is to drag the .app bundle into iTunes, and then look for the IPA file that it generates for you.
1,556,716
I distributed an iPhone application to some testers who are using Windows. On their machines, the application that I built (in the form of an .app bundle) appeared as a directory. That makes sense because a .app bundle **is** actually a directory. What mechanism does Mac OS X use to display these bundles as files with...
2009/10/12
[ "https://Stackoverflow.com/questions/1556716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/105382/" ]
No, but why would you want to? An .app on Mac is not equivalent to an .exe on Windows - if you explore the .app bundle on a Mac (using "Show Package Contents"), you'll see an actual executable program inside. *This* program is more the equivalent of a Windows .exe, and you can liken the entire .app bundle to the Progra...
If you are distributing to Windows users all will go much better if you give them IPA files instead of app bundles. The easiest way to create an IPA file is to drag the .app bundle into iTunes, and then look for the IPA file that it generates for you.
23,783,427
i am a beginner in haskell programming and very often i get the error ``` xxx.hs:30:1: parse error on input `xxx' ``` And often there is a little bit playing with the format the solution. Its the same code and it looks the same, but after playing around, the error is gone. At the moment I've got the error ``` Lo...
2014/05/21
[ "https://Stackoverflow.com/questions/23783427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3420062/" ]
The problem is not with `lookupAll`, it's actually with the previous two lines of code ``` if fst (head list) == x then snd (head list) : [] lookupOne x (tail list) ``` You haven't included an `else` on this if statement. My guess is that you meant ``` if fst (head list) == x then snd (head list) : [] else lookupOn...
I think @bheklilr is right - you're missing an `else`. You could fix this particular formatting problem, however, by forming `lookupOne` as a function composition, rather than writing your own new recursive function. For example, you can get the right kind of behaviour by defining `lookupOne` like this: ``` lookupOn...
30,633,378
I cannot find a way to change the color of an Excel data bar based on value. Current formatting options only permit different colors based on positive/negative values. I'm currently using Excel 2010. I would like to have the color of a data bar show up as 'red' if the value if between 0-0.3, 'yellow' if the value is b...
2015/06/04
[ "https://Stackoverflow.com/questions/30633378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4971822/" ]
Data bars only support one color per set. The idea is that the length of the data bar gives you an indication of high, medium or low. Conditional colors can be achieved with color scales. What you describe sounds like a combination of the two, but that does not exist in Excel and I don't see an easy way to hack it....
In your case, highlight the cell will be more suitable as we can not form data bar with multiple colors Conditional Formationg >Manage Rules...>New Rule Under Select a Rule Type, choose "Use a formula to determince which cells to format" and set your rules there ![enter image description here](https://i.stack...
30,633,378
I cannot find a way to change the color of an Excel data bar based on value. Current formatting options only permit different colors based on positive/negative values. I'm currently using Excel 2010. I would like to have the color of a data bar show up as 'red' if the value if between 0-0.3, 'yellow' if the value is b...
2015/06/04
[ "https://Stackoverflow.com/questions/30633378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4971822/" ]
Data bars only support one color per set. The idea is that the length of the data bar gives you an indication of high, medium or low. Conditional colors can be achieved with color scales. What you describe sounds like a combination of the two, but that does not exist in Excel and I don't see an easy way to hack it....
I setup conditional formatting in the cell adjacent to the data bar that changes color based on the value in the target cell (green, yellow, red, orange). I then loop through the VBA below to update the data bar color based on the conditional formatting in the adjacent cell. ``` Dim intCount As Integer Dim db As DataB...
30,633,378
I cannot find a way to change the color of an Excel data bar based on value. Current formatting options only permit different colors based on positive/negative values. I'm currently using Excel 2010. I would like to have the color of a data bar show up as 'red' if the value if between 0-0.3, 'yellow' if the value is b...
2015/06/04
[ "https://Stackoverflow.com/questions/30633378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4971822/" ]
Data bars only support one color per set. The idea is that the length of the data bar gives you an indication of high, medium or low. Conditional colors can be achieved with color scales. What you describe sounds like a combination of the two, but that does not exist in Excel and I don't see an easy way to hack it....
Instead of creating conditional formatting for a range of cells, I conditionally formatted each cell individually using VBA based on the two subs below. The result is shown in the link below the code. Hope this helps. ``` ' The purpose of this sub is to add a data bar to an individual cell ' The value in the cell is e...
30,633,378
I cannot find a way to change the color of an Excel data bar based on value. Current formatting options only permit different colors based on positive/negative values. I'm currently using Excel 2010. I would like to have the color of a data bar show up as 'red' if the value if between 0-0.3, 'yellow' if the value is b...
2015/06/04
[ "https://Stackoverflow.com/questions/30633378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4971822/" ]
I setup conditional formatting in the cell adjacent to the data bar that changes color based on the value in the target cell (green, yellow, red, orange). I then loop through the VBA below to update the data bar color based on the conditional formatting in the adjacent cell. ``` Dim intCount As Integer Dim db As DataB...
In your case, highlight the cell will be more suitable as we can not form data bar with multiple colors Conditional Formationg >Manage Rules...>New Rule Under Select a Rule Type, choose "Use a formula to determince which cells to format" and set your rules there ![enter image description here](https://i.stack...
30,633,378
I cannot find a way to change the color of an Excel data bar based on value. Current formatting options only permit different colors based on positive/negative values. I'm currently using Excel 2010. I would like to have the color of a data bar show up as 'red' if the value if between 0-0.3, 'yellow' if the value is b...
2015/06/04
[ "https://Stackoverflow.com/questions/30633378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4971822/" ]
I setup conditional formatting in the cell adjacent to the data bar that changes color based on the value in the target cell (green, yellow, red, orange). I then loop through the VBA below to update the data bar color based on the conditional formatting in the adjacent cell. ``` Dim intCount As Integer Dim db As DataB...
Instead of creating conditional formatting for a range of cells, I conditionally formatted each cell individually using VBA based on the two subs below. The result is shown in the link below the code. Hope this helps. ``` ' The purpose of this sub is to add a data bar to an individual cell ' The value in the cell is e...
497,407
We started a TCP/IP introductory course at work today, and learned about the different classes of network addresses: ``` Class A addresses are from 0.0.0.0 thru 127.x.x.x Class B addresses are from 128.0.0.0 thru 191.x.x.x Class C addresses are from 192.0.0.0 thru 223.x.x.x Class D addresses are from 224.0.0.0 thru 23...
2012/11/01
[ "https://superuser.com/questions/497407", "https://superuser.com", "https://superuser.com/users/115033/" ]
There are no classes, they were deprecated in 1994 (seriously, that was 18 years ago as of writing this). Your teacher should be **fired** for even mentioning them (outside a *history* class) as it will only confuse you when you learn how networks actually work. Networks are subnetted using CIDR (and expressed in CIDR...
For a bit of perspective, classful network types are still used as a common terminology for internal and private (RFC1918) networks. It's true that since BPG4, CIDR has made classful Internet boundaries meaningless, but when talking about interior networks and classful routing protocols, it's still useful to know the ...
6,127,157
I have a solution with 15+ projects in there While jumping to a class is easy enough in VS2008/2010 with RightClick-Goto definition which jumps to the file containing the definition, but how to locate the project which contains this new class/file ?? I seem to recall it's possible using some "magic" keystrokes/menu b...
2011/05/25
[ "https://Stackoverflow.com/questions/6127157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135852/" ]
That is one well defined question! There is a question over what is a model. I believe there is a definition floating around as to what constitutes a model in the backbone world, and I'm not sure your strategy is in keeping with that definition. Also you are storing the state in both the url, and the model. You can ju...
> > 2) How can I avoid my views setting an attribute on the model which they themselves listen for? > > > You don't. Your model should be doing validation on any attributes you try to update so your view *needs* to listen in case your setting of the attribute failed or the validation changed the value. What your ...
17,057,338
why i ask this question because i always worried about code like this style ``` def callsomething(x): if x in (3,4,5,6): #do something ``` if the function callsomething was called frequently ,did the (3,4,5,6) waste too much space and time?in some language like C, it might be putted into data segment lik...
2013/06/12
[ "https://Stackoverflow.com/questions/17057338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2003548/" ]
Don't worry, it's stored as a constant (which explains why it's faster than you expected) ``` >>> def callsomething(x): ... if x in (3,4,5,6): pass ... >>> import dis >>> dis.dis(callsomething) 2 0 LOAD_FAST 0 (x) 3 LOAD_CONST 5 ((3, 4, 5, 6)) 6...
If you really want to do a hack so that you can get constants for things beyond tuples, you could do something gross like ``` def foo(x, dont_use_this=frozenset([1,2,3])): if x in dont_use_this: # do something return x ``` But don't do that.
401,043
What are some ways of documenting pitfalls and gotchas when working with a codebase with a team of developers? I'm working with a team of developers on a big codebase and there's lots of small little things that cause headaches and frustrations in code, configuration, and testing. It doesn't seem appropriate to put the...
2019/11/13
[ "https://softwareengineering.stackexchange.com/questions/401043", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/128090/" ]
Quirks and hacks which are easy to explain could be explained in a form of a **comment**. After all, the purpose of the comments is exactly that—come to a rescue when one cannot or doesn't have enough resources to make unclear code clearer. The goal here is to help a programmer who's reading a given line of code (or se...
No quirks would be better ------------------------- First and foremost, the [principle of least astonishment](https://en.wikipedia.org/wiki/Principle_of_least_astonishment) applies: > > A typical formulation of the principle, from 1984, is: "If a necessary feature has a high astonishment factor, it may be necessary...
71,398,009
I have a Python script using Brownie that occasionally triggers a swap on Uniswap by sending a transaction to Optimism Network. It worked well for a few days (did multiple transactions successfully), but now each time it triggers a transaction, I get an error message: > > TransactionError: Tx dropped without known r...
2022/03/08
[ "https://Stackoverflow.com/questions/71398009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18410235/" ]
There is a possibility that one of your methods seeks data off-chain and is being called prematurely before the confirmation is received. I had the same problem, and I managed to sort it out by adding time.sleep(60) at the end of the function that seeks for data off-chain
"Dropped and replaced" means the transaction is being replaced by a new one, Eth is being overloaded with a new gas fee. My guess is that you need to increase your gas costs in order to average the price.
70,900,373
Like in this example, <https://www.duden.de/rechtschreibung/Regen_Niederschlag> , the words are sorted in the following way: "regelwidrig, Regelwidrigkeit, Regelzeit, regen, Regen, Regenabflussrohr, Regenanlage, regenarm, Regenbö, Regenbogen..." that is, it is a "more non-case-sensitive" sorting than Collections.Sort()...
2022/01/28
[ "https://Stackoverflow.com/questions/70900373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17677104/" ]
* You can use `String.CASE_INSENSITIVE_ORDER` to order strings in case-insensitive way. * If you also at the same time want to farther specify order of elements which current comparator considers as equal (like `String.CASE_INSENSITIVE_ORDER` would do for `"Regen"` and `"regen"`) then you can use [`Comparator#thenCompa...
Just use a oneliner "Comparator.comparing" ``` List<String> regen = new ArrayList<String>( ); for(String x : new String[]{"regelwidrig", "Regelwidrigkeit", "Regelzeit", "regen", "Regen", "Regenabflussrohr", "Regenanlage", "regenarm", "Regenbö", "Regenbogen"}) { regen.add(x); } Collections.sort...
70,900,373
Like in this example, <https://www.duden.de/rechtschreibung/Regen_Niederschlag> , the words are sorted in the following way: "regelwidrig, Regelwidrigkeit, Regelzeit, regen, Regen, Regenabflussrohr, Regenanlage, regenarm, Regenbö, Regenbogen..." that is, it is a "more non-case-sensitive" sorting than Collections.Sort()...
2022/01/28
[ "https://Stackoverflow.com/questions/70900373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17677104/" ]
Just use a oneliner "Comparator.comparing" ``` List<String> regen = new ArrayList<String>( ); for(String x : new String[]{"regelwidrig", "Regelwidrigkeit", "Regelzeit", "regen", "Regen", "Regenabflussrohr", "Regenanlage", "regenarm", "Regenbö", "Regenbogen"}) { regen.add(x); } Collections.sort...
The reason why strings are sorted the way they are naturally sorted is because the ASCII values for these characters have a lower value for *UPPERCASE* than for *lowercase*. In this case, all words starts with "R" and the ASCII value of uppercase "R" is 82 (52 hex), whereas lowercase "R" is 114 (72 hex). For that reaso...
70,900,373
Like in this example, <https://www.duden.de/rechtschreibung/Regen_Niederschlag> , the words are sorted in the following way: "regelwidrig, Regelwidrigkeit, Regelzeit, regen, Regen, Regenabflussrohr, Regenanlage, regenarm, Regenbö, Regenbogen..." that is, it is a "more non-case-sensitive" sorting than Collections.Sort()...
2022/01/28
[ "https://Stackoverflow.com/questions/70900373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17677104/" ]
Collators ========= Use the `Collator` class for locale-sensitive `String` comparison. Specifically, Java has support for German [collators](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/text/Collator.html): ``` Collator collator = Collator.getInstance(Locale.GERMAN); regen.sort(collator); ``` ...
Just use a oneliner "Comparator.comparing" ``` List<String> regen = new ArrayList<String>( ); for(String x : new String[]{"regelwidrig", "Regelwidrigkeit", "Regelzeit", "regen", "Regen", "Regenabflussrohr", "Regenanlage", "regenarm", "Regenbö", "Regenbogen"}) { regen.add(x); } Collections.sort...
70,900,373
Like in this example, <https://www.duden.de/rechtschreibung/Regen_Niederschlag> , the words are sorted in the following way: "regelwidrig, Regelwidrigkeit, Regelzeit, regen, Regen, Regenabflussrohr, Regenanlage, regenarm, Regenbö, Regenbogen..." that is, it is a "more non-case-sensitive" sorting than Collections.Sort()...
2022/01/28
[ "https://Stackoverflow.com/questions/70900373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17677104/" ]
* You can use `String.CASE_INSENSITIVE_ORDER` to order strings in case-insensitive way. * If you also at the same time want to farther specify order of elements which current comparator considers as equal (like `String.CASE_INSENSITIVE_ORDER` would do for `"Regen"` and `"regen"`) then you can use [`Comparator#thenCompa...
The reason why strings are sorted the way they are naturally sorted is because the ASCII values for these characters have a lower value for *UPPERCASE* than for *lowercase*. In this case, all words starts with "R" and the ASCII value of uppercase "R" is 82 (52 hex), whereas lowercase "R" is 114 (72 hex). For that reaso...
70,900,373
Like in this example, <https://www.duden.de/rechtschreibung/Regen_Niederschlag> , the words are sorted in the following way: "regelwidrig, Regelwidrigkeit, Regelzeit, regen, Regen, Regenabflussrohr, Regenanlage, regenarm, Regenbö, Regenbogen..." that is, it is a "more non-case-sensitive" sorting than Collections.Sort()...
2022/01/28
[ "https://Stackoverflow.com/questions/70900373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17677104/" ]
* You can use `String.CASE_INSENSITIVE_ORDER` to order strings in case-insensitive way. * If you also at the same time want to farther specify order of elements which current comparator considers as equal (like `String.CASE_INSENSITIVE_ORDER` would do for `"Regen"` and `"regen"`) then you can use [`Comparator#thenCompa...
Collators ========= Use the `Collator` class for locale-sensitive `String` comparison. Specifically, Java has support for German [collators](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/text/Collator.html): ``` Collator collator = Collator.getInstance(Locale.GERMAN); regen.sort(collator); ``` ...
70,900,373
Like in this example, <https://www.duden.de/rechtschreibung/Regen_Niederschlag> , the words are sorted in the following way: "regelwidrig, Regelwidrigkeit, Regelzeit, regen, Regen, Regenabflussrohr, Regenanlage, regenarm, Regenbö, Regenbogen..." that is, it is a "more non-case-sensitive" sorting than Collections.Sort()...
2022/01/28
[ "https://Stackoverflow.com/questions/70900373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17677104/" ]
Collators ========= Use the `Collator` class for locale-sensitive `String` comparison. Specifically, Java has support for German [collators](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/text/Collator.html): ``` Collator collator = Collator.getInstance(Locale.GERMAN); regen.sort(collator); ``` ...
The reason why strings are sorted the way they are naturally sorted is because the ASCII values for these characters have a lower value for *UPPERCASE* than for *lowercase*. In this case, all words starts with "R" and the ASCII value of uppercase "R" is 82 (52 hex), whereas lowercase "R" is 114 (72 hex). For that reaso...
548,798
The exercise is to find the accumulation points of the set $S=\{(\frac {1} {n}, \frac {1} {m}) \space m, n \in \mathbb N\}$ I'm trying to prove that if $A$={accumulation points of the set $S$}, then $A=\{(0,0), (\frac {1} {n},0),(0,\frac {1} {m}) \space n,m \in \mathbb N\}$. I could prove that the set of the right sid...
2013/11/02
[ "https://math.stackexchange.com/questions/548798", "https://math.stackexchange.com", "https://math.stackexchange.com/users/100106/" ]
I think you might mean $N\cap Z(G) \neq \{e\}$. In which case, 1. Use the Class equation 2. If $x\in N$, then the conjugacy class $C(x) \subset N$
If $H$,$K$ are any subgroups of a group $G$, with identity $e$, then $H \setminus K \neq \langle e \rangle $, since $e \in H,K$ and hence $e \not\in H \setminus K $. Your question is a special case of that.
10,131,208
In my assets, I have a file called `maps.js.erb`, basically with only the following (debugging) content: ``` alert("<%= @map.width %>"); ``` This JS file is loaded through the `show.html.erb` view belonging to maps. ``` <%= javascript_include_tag params[:controller] %> <h1><%= @map.title %></h1> … ``` The HTML fi...
2012/04/12
[ "https://Stackoverflow.com/questions/10131208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/435093/" ]
Ryan Bates did a screencast right on that topic - you might wanna check it out: <http://railscasts.com/episodes/324-passing-data-to-javascript> --- In the `html.erb` file, you can define the variables: ``` <%= javascript_tag do %> window.productsURL = "<%=j products_url %>"; window.products = <%=raw Product.li...
You cannot have @map.title evaluated in a common js file, because that file is generated and served once, before later invokations of the controller, and then cached. However, you can have javascript in your HTML page. That javascript can be generated with a constant value supplied by <%= @map.title %>. Put the javas...
10,131,208
In my assets, I have a file called `maps.js.erb`, basically with only the following (debugging) content: ``` alert("<%= @map.width %>"); ``` This JS file is loaded through the `show.html.erb` view belonging to maps. ``` <%= javascript_include_tag params[:controller] %> <h1><%= @map.title %></h1> … ``` The HTML fi...
2012/04/12
[ "https://Stackoverflow.com/questions/10131208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/435093/" ]
Ryan Bates did a screencast right on that topic - you might wanna check it out: <http://railscasts.com/episodes/324-passing-data-to-javascript> --- In the `html.erb` file, you can define the variables: ``` <%= javascript_tag do %> window.productsURL = "<%=j products_url %>"; window.products = <%=raw Product.li...
Don't forget to use `escape_javascript()`.
10,131,208
In my assets, I have a file called `maps.js.erb`, basically with only the following (debugging) content: ``` alert("<%= @map.width %>"); ``` This JS file is loaded through the `show.html.erb` view belonging to maps. ``` <%= javascript_include_tag params[:controller] %> <h1><%= @map.title %></h1> … ``` The HTML fi...
2012/04/12
[ "https://Stackoverflow.com/questions/10131208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/435093/" ]
You cannot have @map.title evaluated in a common js file, because that file is generated and served once, before later invokations of the controller, and then cached. However, you can have javascript in your HTML page. That javascript can be generated with a constant value supplied by <%= @map.title %>. Put the javas...
Don't forget to use `escape_javascript()`.
57,708
I can imagine that finding $p,q,n$ are easy, but my text book also says the $e$ can be found rapidly, so how does modern RSA find this $e$? ![RSA as a Public Key System](https://i.stack.imgur.com/LBR7F.png)
2018/03/22
[ "https://crypto.stackexchange.com/questions/57708", "https://crypto.stackexchange.com", "https://crypto.stackexchange.com/users/-1/" ]
A simple way to achieve this with common algorithms would be to do the following: 1. Choose a random key (key) 2. Encrypt the data using the random key (encrData) 3. Hash the encrypted data (encrHash) 4. Xor the key and the hash (xorKey) 5. The result data would be the encrypted data + the Xor key (encrData+xorKey) T...
Let's take the simplest cipher I can think of which the key is not obvious: [ROT13](https://en.wikipedia.org/wiki/ROT13). You replace a letter with the 13th letter after it, in the alphabet. Because there are 26 letters in the alphabet, you don't need to inverse the algorithm for decryption. Is ROT13 an example of keyl...
57,708
I can imagine that finding $p,q,n$ are easy, but my text book also says the $e$ can be found rapidly, so how does modern RSA find this $e$? ![RSA as a Public Key System](https://i.stack.imgur.com/LBR7F.png)
2018/03/22
[ "https://crypto.stackexchange.com/questions/57708", "https://crypto.stackexchange.com", "https://crypto.stackexchange.com/users/-1/" ]
A simple way to achieve this with common algorithms would be to do the following: 1. Choose a random key (key) 2. Encrypt the data using the random key (encrData) 3. Hash the encrypted data (encrHash) 4. Xor the key and the hash (xorKey) 5. The result data would be the encrypted data + the Xor key (encrData+xorKey) T...
I believe this can be achieved, but of course you need to secure both of your encryption and decryption algorithms. Hide it on a very secure server with a rest endpoint where authentication is needed to be able to use the rest service. so to use the algorithm you need to send authenticated requests to your secure endpo...
57,708
I can imagine that finding $p,q,n$ are easy, but my text book also says the $e$ can be found rapidly, so how does modern RSA find this $e$? ![RSA as a Public Key System](https://i.stack.imgur.com/LBR7F.png)
2018/03/22
[ "https://crypto.stackexchange.com/questions/57708", "https://crypto.stackexchange.com", "https://crypto.stackexchange.com/users/-1/" ]
[OAEP](https://en.wikipedia.org/wiki/Optimal_asymmetric_encryption_padding) - Optimal Asymmetric Encryption Padding may be what you want. In RSA public-key encryption system, in order to prevent partial decryption, OAEP padding is used. In essence, it's a Feistel network with randomizing element. When used alone, i...
One-time pad it =============== Given the following conditions... * [Alice](https://en.wikipedia.org/wiki/Alice_and_Bob) has a plain-text. She wants to encrypt that. * After encrypting it, Alice obtains several cipher-texts. * Alice wants to give the cipher-texts to people that are not authorised to read the plain-te...
57,708
I can imagine that finding $p,q,n$ are easy, but my text book also says the $e$ can be found rapidly, so how does modern RSA find this $e$? ![RSA as a Public Key System](https://i.stack.imgur.com/LBR7F.png)
2018/03/22
[ "https://crypto.stackexchange.com/questions/57708", "https://crypto.stackexchange.com", "https://crypto.stackexchange.com/users/-1/" ]
[OAEP](https://en.wikipedia.org/wiki/Optimal_asymmetric_encryption_padding) - Optimal Asymmetric Encryption Padding may be what you want. In RSA public-key encryption system, in order to prevent partial decryption, OAEP padding is used. In essence, it's a Feistel network with randomizing element. When used alone, i...
I believe this can be achieved, but of course you need to secure both of your encryption and decryption algorithms. Hide it on a very secure server with a rest endpoint where authentication is needed to be able to use the rest service. so to use the algorithm you need to send authenticated requests to your secure endpo...
57,708
I can imagine that finding $p,q,n$ are easy, but my text book also says the $e$ can be found rapidly, so how does modern RSA find this $e$? ![RSA as a Public Key System](https://i.stack.imgur.com/LBR7F.png)
2018/03/22
[ "https://crypto.stackexchange.com/questions/57708", "https://crypto.stackexchange.com", "https://crypto.stackexchange.com/users/-1/" ]
Secret Sharing may be another option to consider. It allows you to take a value, break it up into arbitrarily many pieces, and possession of a subset of these pieces, not the entire set, makes reconstruction of the original value impossible. This is done by multiple means, the simplest of which is with respect to addit...
One-time pad it =============== Given the following conditions... * [Alice](https://en.wikipedia.org/wiki/Alice_and_Bob) has a plain-text. She wants to encrypt that. * After encrypting it, Alice obtains several cipher-texts. * Alice wants to give the cipher-texts to people that are not authorised to read the plain-te...
57,708
I can imagine that finding $p,q,n$ are easy, but my text book also says the $e$ can be found rapidly, so how does modern RSA find this $e$? ![RSA as a Public Key System](https://i.stack.imgur.com/LBR7F.png)
2018/03/22
[ "https://crypto.stackexchange.com/questions/57708", "https://crypto.stackexchange.com", "https://crypto.stackexchange.com/users/-1/" ]
Secret Sharing may be another option to consider. It allows you to take a value, break it up into arbitrarily many pieces, and possession of a subset of these pieces, not the entire set, makes reconstruction of the original value impossible. This is done by multiple means, the simplest of which is with respect to addit...
The "key" is secret data that are used in encryption with known "algorithm". Of course you can make keyless algorithm - get permutation, shifting stuff around, bit inversion, whatever. Employ any known strong encryption with built-in values. Mix and match all you want! However, this effectively makes algorithm itself t...
57,708
I can imagine that finding $p,q,n$ are easy, but my text book also says the $e$ can be found rapidly, so how does modern RSA find this $e$? ![RSA as a Public Key System](https://i.stack.imgur.com/LBR7F.png)
2018/03/22
[ "https://crypto.stackexchange.com/questions/57708", "https://crypto.stackexchange.com", "https://crypto.stackexchange.com/users/-1/" ]
Clarification ------------- > > I'm wondering whether there exists an encoding/hashing/encryption scheme whereby the original string can always be derived in its entirety given the entire encoded/hashed/encrypted string, and nothing else (no key/password). But also, no portion of the original string can be derived gi...
Let's take the simplest cipher I can think of which the key is not obvious: [ROT13](https://en.wikipedia.org/wiki/ROT13). You replace a letter with the 13th letter after it, in the alphabet. Because there are 26 letters in the alphabet, you don't need to inverse the algorithm for decryption. Is ROT13 an example of keyl...
57,708
I can imagine that finding $p,q,n$ are easy, but my text book also says the $e$ can be found rapidly, so how does modern RSA find this $e$? ![RSA as a Public Key System](https://i.stack.imgur.com/LBR7F.png)
2018/03/22
[ "https://crypto.stackexchange.com/questions/57708", "https://crypto.stackexchange.com", "https://crypto.stackexchange.com/users/-1/" ]
The "key" is secret data that are used in encryption with known "algorithm". Of course you can make keyless algorithm - get permutation, shifting stuff around, bit inversion, whatever. Employ any known strong encryption with built-in values. Mix and match all you want! However, this effectively makes algorithm itself t...
One-time pad it =============== Given the following conditions... * [Alice](https://en.wikipedia.org/wiki/Alice_and_Bob) has a plain-text. She wants to encrypt that. * After encrypting it, Alice obtains several cipher-texts. * Alice wants to give the cipher-texts to people that are not authorised to read the plain-te...
57,708
I can imagine that finding $p,q,n$ are easy, but my text book also says the $e$ can be found rapidly, so how does modern RSA find this $e$? ![RSA as a Public Key System](https://i.stack.imgur.com/LBR7F.png)
2018/03/22
[ "https://crypto.stackexchange.com/questions/57708", "https://crypto.stackexchange.com", "https://crypto.stackexchange.com/users/-1/" ]
Clarification ------------- > > I'm wondering whether there exists an encoding/hashing/encryption scheme whereby the original string can always be derived in its entirety given the entire encoded/hashed/encrypted string, and nothing else (no key/password). But also, no portion of the original string can be derived gi...
A simple way to achieve this with common algorithms would be to do the following: 1. Choose a random key (key) 2. Encrypt the data using the random key (encrData) 3. Hash the encrypted data (encrHash) 4. Xor the key and the hash (xorKey) 5. The result data would be the encrypted data + the Xor key (encrData+xorKey) T...
57,708
I can imagine that finding $p,q,n$ are easy, but my text book also says the $e$ can be found rapidly, so how does modern RSA find this $e$? ![RSA as a Public Key System](https://i.stack.imgur.com/LBR7F.png)
2018/03/22
[ "https://crypto.stackexchange.com/questions/57708", "https://crypto.stackexchange.com", "https://crypto.stackexchange.com/users/-1/" ]
Clarification ------------- > > I'm wondering whether there exists an encoding/hashing/encryption scheme whereby the original string can always be derived in its entirety given the entire encoded/hashed/encrypted string, and nothing else (no key/password). But also, no portion of the original string can be derived gi...
One-time pad it =============== Given the following conditions... * [Alice](https://en.wikipedia.org/wiki/Alice_and_Bob) has a plain-text. She wants to encrypt that. * After encrypting it, Alice obtains several cipher-texts. * Alice wants to give the cipher-texts to people that are not authorised to read the plain-te...
19,334,041
I moved a database from SQL Server 2012 to Azure. I don't want to use the user `master`, so I created a user `test`. This is what I did for database XXX on Azure: ``` create user test from login test with default_schema=[dbo] exec sp_addrolemember 'db_owner','test' ``` I checked, and the database objects I am intere...
2013/10/12
[ "https://Stackoverflow.com/questions/19334041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/936293/" ]
I had just, for the first time, used the Plesk panel on my website hosting service to download an "Export Dump" file of my hosted SQL Server database. After needing to use a different StackOverflow Question/Answer to understand how to use what I had downloaded, then in SQL Server Management studio I went into Security...
Grant permissions for that user is needed
19,334,041
I moved a database from SQL Server 2012 to Azure. I don't want to use the user `master`, so I created a user `test`. This is what I did for database XXX on Azure: ``` create user test from login test with default_schema=[dbo] exec sp_addrolemember 'db_owner','test' ``` I checked, and the database objects I am intere...
2013/10/12
[ "https://Stackoverflow.com/questions/19334041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/936293/" ]
Using SSMS, I made sure the user had connect permissions on both the database and ReportServer. On the specific database being queried, under properties, I mapped their credentials and enabled datareader and public permissions. Also, as others have stated-I made sure there were no denyread/denywrite boxes selected. ...
I resolve my problem doing this. [IMPORTANT NOTE: It allows escalated (expanded) privileges to the particular account, possibly more than are needed for individual scenario]. 1. Go to '**Object Explorer**' of SQL Management Studio. 2. Expand **Security**, then **Login**. 3. Select the user you are working with, then ...
19,334,041
I moved a database from SQL Server 2012 to Azure. I don't want to use the user `master`, so I created a user `test`. This is what I did for database XXX on Azure: ``` create user test from login test with default_schema=[dbo] exec sp_addrolemember 'db_owner','test' ``` I checked, and the database objects I am intere...
2013/10/12
[ "https://Stackoverflow.com/questions/19334041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/936293/" ]
Using SSMS, I made sure the user had connect permissions on both the database and ReportServer. On the specific database being queried, under properties, I mapped their credentials and enabled datareader and public permissions. Also, as others have stated-I made sure there were no denyread/denywrite boxes selected. ...
Check space of your database.this error comes when space increased compare to space given to database.
19,334,041
I moved a database from SQL Server 2012 to Azure. I don't want to use the user `master`, so I created a user `test`. This is what I did for database XXX on Azure: ``` create user test from login test with default_schema=[dbo] exec sp_addrolemember 'db_owner','test' ``` I checked, and the database objects I am intere...
2013/10/12
[ "https://Stackoverflow.com/questions/19334041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/936293/" ]
1. Open SQL Management Studio 2. Expand your database 3. Expand the "Security" Folder 4. Expand "Users" 5. Right click the user (the one that's trying to perform the query) and select `Properties`. 6. Select page `Membership`. 7. Make sure you uncheck `db_denydatareader` `db_denydatawriter` [![enter image descripti...
This is how I was able to solve the problem when I faced it 1. Start SQL Management Studio. 2. Expand the Server Node (in the 'Object Explorer'). 3. Expand the Databases Node and then expand the specific Database which you are trying to access using the specific user. 4. Expand the Users node under the Security node ...
19,334,041
I moved a database from SQL Server 2012 to Azure. I don't want to use the user `master`, so I created a user `test`. This is what I did for database XXX on Azure: ``` create user test from login test with default_schema=[dbo] exec sp_addrolemember 'db_owner','test' ``` I checked, and the database objects I am intere...
2013/10/12
[ "https://Stackoverflow.com/questions/19334041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/936293/" ]
The syntax to grant select permission on a specific table : ``` USE YourDB; GRANT SELECT ON dbo.functionName TO UserName; ``` To grant the select permission on all tables in the database: ``` USE YourDB; GRANT SELECT TO UserName; ```
I resolve my problem doing this. [IMPORTANT NOTE: It allows escalated (expanded) privileges to the particular account, possibly more than are needed for individual scenario]. 1. Go to '**Object Explorer**' of SQL Management Studio. 2. Expand **Security**, then **Login**. 3. Select the user you are working with, then ...
19,334,041
I moved a database from SQL Server 2012 to Azure. I don't want to use the user `master`, so I created a user `test`. This is what I did for database XXX on Azure: ``` create user test from login test with default_schema=[dbo] exec sp_addrolemember 'db_owner','test' ``` I checked, and the database objects I am intere...
2013/10/12
[ "https://Stackoverflow.com/questions/19334041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/936293/" ]
Using SSMS, I made sure the user had connect permissions on both the database and ReportServer. On the specific database being queried, under properties, I mapped their credentials and enabled datareader and public permissions. Also, as others have stated-I made sure there were no denyread/denywrite boxes selected. ...
May be your Plesk panel or other panel subscription has been expired....please check subscription End.
19,334,041
I moved a database from SQL Server 2012 to Azure. I don't want to use the user `master`, so I created a user `test`. This is what I did for database XXX on Azure: ``` create user test from login test with default_schema=[dbo] exec sp_addrolemember 'db_owner','test' ``` I checked, and the database objects I am intere...
2013/10/12
[ "https://Stackoverflow.com/questions/19334041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/936293/" ]
I think the problem is with the user having **deny privileges**. This error comes when the user which you have created does not have the sufficient privileges to access your tables in the database. Do grant the privilege to the user in order to get what you want. **[GRANT](https://learn.microsoft.com/en-us/sql/t-sql/...
Grant permissions for that user is needed
19,334,041
I moved a database from SQL Server 2012 to Azure. I don't want to use the user `master`, so I created a user `test`. This is what I did for database XXX on Azure: ``` create user test from login test with default_schema=[dbo] exec sp_addrolemember 'db_owner','test' ``` I checked, and the database objects I am intere...
2013/10/12
[ "https://Stackoverflow.com/questions/19334041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/936293/" ]
The syntax to grant select permission on a specific table : ``` USE YourDB; GRANT SELECT ON dbo.functionName TO UserName; ``` To grant the select permission on all tables in the database: ``` USE YourDB; GRANT SELECT TO UserName; ```
I had just, for the first time, used the Plesk panel on my website hosting service to download an "Export Dump" file of my hosted SQL Server database. After needing to use a different StackOverflow Question/Answer to understand how to use what I had downloaded, then in SQL Server Management studio I went into Security...
19,334,041
I moved a database from SQL Server 2012 to Azure. I don't want to use the user `master`, so I created a user `test`. This is what I did for database XXX on Azure: ``` create user test from login test with default_schema=[dbo] exec sp_addrolemember 'db_owner','test' ``` I checked, and the database objects I am intere...
2013/10/12
[ "https://Stackoverflow.com/questions/19334041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/936293/" ]
1. Open SQL Management Studio 2. Expand your database 3. Expand the "Security" Folder 4. Expand "Users" 5. Right click the user (the one that's trying to perform the query) and select `Properties`. 6. Select page `Membership`. 7. Make sure you uncheck `db_denydatareader` `db_denydatawriter` [![enter image descripti...
I resolve my problem doing this. [IMPORTANT NOTE: It allows escalated (expanded) privileges to the particular account, possibly more than are needed for individual scenario]. 1. Go to '**Object Explorer**' of SQL Management Studio. 2. Expand **Security**, then **Login**. 3. Select the user you are working with, then ...
19,334,041
I moved a database from SQL Server 2012 to Azure. I don't want to use the user `master`, so I created a user `test`. This is what I did for database XXX on Azure: ``` create user test from login test with default_schema=[dbo] exec sp_addrolemember 'db_owner','test' ``` I checked, and the database objects I am intere...
2013/10/12
[ "https://Stackoverflow.com/questions/19334041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/936293/" ]
I think the problem is with the user having **deny privileges**. This error comes when the user which you have created does not have the sufficient privileges to access your tables in the database. Do grant the privilege to the user in order to get what you want. **[GRANT](https://learn.microsoft.com/en-us/sql/t-sql/...
Check space of your database.this error comes when space increased compare to space given to database.
6,372,248
I have a problem and need some help. My application uses outlook to send email with attachments. Right now i need to find out when the email with attachment has been send out completely by outlook. I tried to follow this [link](http://social.msdn.microsoft.com/forums/en-US/vsto/thread/d891c669-21af-4ce4-b24b-8f6eb23082...
2011/06/16
[ "https://Stackoverflow.com/questions/6372248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/293240/" ]
Mostly not, modern CPU's are very fast... The most notable improvement is the speed in the download speeds. Strip out any unnecessary comments sent down the wire to the browser, minify CSS, JavaScript files, use CDN's etc.
It depends how many comments there are. In general though, most developers have a live version of all their code that is compressed- no whitespace outside of text formatting, no comments, etc. And an offline version that is developer-friendly with all the extra formatting and so on. Another thing to note is with '//'...
1,002,429
I used to have a Server 2003 R2 Hyper-V VM instance running on an Server 2012 R2. The performance was very good. THen, I was told that 2003 wasn't being supported anymore by a software package I use, so I upgraded to 2008 R2, and that's when all my SMB shares took a nosedive. When I attempt to navigate to my network d...
2020/02/09
[ "https://serverfault.com/questions/1002429", "https://serverfault.com", "https://serverfault.com/users/559370/" ]
I should have read [the manual](https://www.freedesktop.org/software/systemd/man/systemd.link.html) more carefully. > > The first (in lexical order) of the link files that matches a given device is applied. Note that a default file 99-default.link is shipped by the system. Any user-supplied .link should hence have a ...
As per [systemd.network](https://www.freedesktop.org/software/systemd/man/systemd.network.html) link aliases are not (yet?) supported.