INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Resources in C# MSVS I follow the instructions here How to create and use resources in .NET However when i do Properties.Resources.Name; I get "The name 'Properties' does not exist in the current context". Its driving me nuts bc i tried multiple things and googled and could not find a solution. The resource is in the same project i am using. The project is 1 form. and the code is in Form1_Load
Make sure there there are no namespace issues. The fully qualified name of the Resources class would be `YourProject.Properties.Resources`, so if something has caused the Form to be placed in a different namespace from your Properties class, you would need to use the fully qualified name to access it from the form. Use the Object Browser to browse your solution and figure out what the namespace of your Properties class is.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 2, "tags": "c#, resources" }
pdf contains unknown characters i have generated PDF in my application , there is a issue in iOS 6 ( **some irrelevant characters are showing** ) , when i am generating the PDF & the same code works fine for the previos versions of iOS 5 & iOS 4.3 I am not able to understand how to resolve , if any one know kindly resolve the issue , if you require any code snippet then leave a comment . The issue is depicted in the pic shown. !enter image description here Thanks . :)
As already meantioned in the comments to your question, you actually have the irrelevant characters in your `headers` definition: !enter image description here On the other hand, when viewing those comments on my mobile phone I saw an hour ago: !enter image description here Thus, you probably don't see those characters in your code either. I would propose retyping the whole strings "Price/Bag (in $)" and "Total Price (in $)" in your code and compiling again.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "ios, ios5, pdf, ios6, pdf generation" }
View on top of navigation bar I have a nav bar that is not displaying, in the 3D view hierarchy I can see that the front view hides the nav bar. See the screens below. The second screen is one with the same class but displayed from another flow. ![First screen \(Wrong one\)]( ![Second screen \(Good one with a custom view added that is ok\)](
Finally I found the problem! I was using MeryPopin CocoaPod and when I did dismissCurrentPopIn with animated = true the nav bar disappeared but when I changed to false it worked. I hope it might be some bug.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ios, swift, xcode" }
Does the feat Fire God's Blessing provide magical healing or mundane healing? Does the feat Fire God's Blessing provide magical healing or mundane healing? I can't find any references as to which kind of healing this is. > When in combat, if you deal fire damage to an enemy, you heal 1 hit point. You can only benefit from this healing once per round. Attacks that cause a target to catch on fire heal you each round the target takes fire damage.
## It is an example of _magical_ healing. According to the Pathfinder SRD on Archives of Nethys, natural healing1 is > With a full night’s rest (8 hours of sleep or more), you recover 1 hit point per character level. Any significant interruption during your rest prevents you from healing that night. and magical healing is > Various abilities and spells can restore hit points. It is clear that this is healing not granted by a rest and falls under the magical healing umbrella. * * * 1 The wiki seems to be formatted incorrectly, as _Natural Healing_ is part of the first paragraph in the block there.
stackexchange-rpg
{ "answer_score": 3, "question_score": 3, "tags": "pathfinder 1e, feats, magic, healing" }
Difference between seq_search([ann1, ann2]) and ann1 :: ann2? What is the difference between these two methods to do the search in Minizinc? First one: solve :: seq_search([ann1, ann2]) satisfy; Second one: solve :: ann1 :: ann2 satisfy;
The big difference is that using seperate annotations does not guarantee an order. Using `:: ann1 :: ann2` might first use the `ann2` or `ann1`, the order might not even be the same in the produced FlatZinc being send the the solver. `:: seq_search([ann1, ann2])` does guarantee the order to be first `ann1` and then `ann2`.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "search, heuristics, constraint programming, minizinc" }
How can I transpose dataset in R I have a dataset A shown as below. How can I transform dataset A to dataset B. Dataset A contains over 10,000 observations in my file. Is there any easy way to do it? Dataset A: Line 1:AB 12 23 Line 2:AB 34 56 Line 3:CD 78 90 Line 4:EF 13 45 * * * Dataset B: Line 1:AB 12 23 34 56 Line 2:CD 78 90 NA NA Line 3:EF 13 45 NA NA
Try this by using `cSplit` library(splitstackshape) library(dplyr) DatA['new']=apply(DatA[,-1], 1, paste, collapse=",") DatA=DatA%>%group_by(Alphabet)%>%summarise(new=paste(new,collapse=',')) cSplit(DatA, 2, drop = TRUE,sep=',') Alphabet new_1 new_2 new_3 new_4 1: AB 12 23 34 56 2: CD 78 90 NA NA 3: EF 13 45 NA NA * * * Data input DatA <- data.frame(Alphabet = c("AB", "AB", "CD","EF"), Value1 = c(12,34,78,13),Value2 = c(23,56,90,45),stringsAsFactors = F)
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "r" }
How should I filter a IReactiveList bound to a grid? my ViewModel has a IReactiveList which is bound to a grid in the View. I now want to filter the data based on user-driven events. My question is what is the best approach for this? The only way I can see is to create a new ReactiveList instance containing just the filtered data and set it to the ViewModel IReactiveList property each time the filter event changes. I don't like this as I'd be creating new ReactiveList instance on each filter event. Is there a better way? Obviously I could directly manipulate the View Grid filters in the VM but this would break the MVVM-ness. Thanks a lot.
Since `IReactiveList` implements `INotifyCollectionChanged`, can't you just expose a `CollectionView` from your VM instead and change the filtering on that? public class MyVM { private readonly IReactiveList data; //bind grid to this public ListCollectionView DataCollectionView { get; private set; } public MyVM(IReactiveList data) { this.data = data; this.DataCollectionView = new ListCollectionView(this.data); this.DataCollectionView.Filter = FilterData; } private bool FilterData(object o) { //filter your data how ever you want in here. } } At the point your filter changes, just call `this.DataCollectionView.Refresh()` and the data will be refiltered.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c#, wpf, mvvm, reactiveui" }
Count length of string without vowels I've a string:- a = 'abcderui' I want to count the length of the string `a` minus the vowels. What would be the fasstest wat to implement that? Currently I'm doing:- a = list(a) for i in a: if i in vowels: continue count +=1
If strings are not huge then `str.translate` is the best option: >>> a = 'abcderui' >>> len(a.translate(None, 'aeiou')) 4 **Timings:** >>> a = 'abcderui'*100 >>> %timeit len(a.translate(None, 'aeiou')) 1000000 loops, best of 3: 1.86 µs per loop >>> %timeit sum(1 for c in a if c not in 'aeiou') 10000 loops, best of 3: 53.2 µs per loop >>> %timeit len(nonvowels.findall(a)) 10000 loops, best of 3: 65.3 µs per loop >>> %timeit len(vowels.sub('', a)) 10000 loops, best of 3: 72 µs per loop
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 0, "tags": "python, string" }
SQL テーブル フィールド 命名規則について **** **** ,, **** **** ,, item **s** S
"""" * * * * RDB1"""" RDB
stackexchange-ja_stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "sql" }
Fastest way to add -movflags +faststart to an MP4 using FFMPEG, leaving everything else as-is I want to add `-movflags +faststart` to an mp4 file. Basically that is all I want to do, nothing else should be changed. I am using ffmpeg. What's the fastest way to do this? Do I have to re-encode the whole video? Or is there a better/easier way?
As simple as: ffmpeg -i in.mp4 -c copy -map 0 -movflags +faststart out.mp4 Or if you can compile FFmpeg from source, make the tool qt-faststart in the tools/ directory and run it: qt-faststart in.mp4 out.mp4 You can also use mp4box, which lets you move the MOOV atom to the start via this command: mp4box -inter 0 in.mp4 -out out.mp4 Or if you want to fully optimize for streaming by also interleaving the audio/video data so that the file can be easily streamed in realtime: mp4box -inter 500 in.mp4 -out out.mp4
stackexchange-stackoverflow
{ "answer_score": 36, "question_score": 23, "tags": "ffmpeg, mp4" }
Perl ack tool with output parameter and new lines I use `ack` very often, but something I have not been able to discover is how to make it add new lines when using the output parameter. Example echo 'name=Joe,id=123' | ack '^name=(\w+),id=(\d+)' --output="User name: $1\nUser ID: $2" I expect User name: Joe User ID: 123 but I get User name: Joe\nUser ID: 123 Anyway to make `ack` respect the new lines characters in the output? Thanks
You are passing `\n` to `ack` instead of a newline. Replace --output='User name: $1\nUser ID: $2' with --output='User name: $1 User ID: $2' or --output="$( printf 'User name: $1\nUser ID: $2' )" or --output=$'User name: $1\nUser ID: $2' # bash
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "ack" }
Debian Jessie (8) using the Parallels desktop I have installed the Debian Jessie (8) using the Parallels desktop in the MacBook Pro host. It goes fine for some time and now I keep getting message, some of the required kernel modules are missing. To solve this problem, please try to reinstall Parallels Tools using the virtual machine menu How do I install the required kernel modules?
Have you tried reinstalling Parallels Tools like the message says? That would seem to fix the problem you're having.
stackexchange-unix
{ "answer_score": 2, "question_score": 0, "tags": "debian, osx, kernel modules, parallels" }
Can't make a while loop run for the entire list Im not sure how I can run the while loop until it has checked the entire list. I have this but it just stops after it finds the first number. numbers = [23,76,45,71,98,23,65,37,93,71,37,21] target = 71 counter = 0 found = False runtime = 0 while runtime < 13: while found == False: if numbers[counter] == target: found = True else: counter = counter + 1 runtime = runtime + 1 if found == True: print("Found at position" , counter) else: print("No match found")
> I want the code to display Found at position 3 and Found at position 9 Try (use index()%20is%20an%20inbuilt,index%20where%20the%20element%20appears.&text=Parameters%20%3A,from%20where%20the%20search%20begins.) function) numbers = [23,76,45,71,98,23,65,37,93,71,37,21] offset = 0 while True: try: idx = numbers.index(71,offset) print(f'Found at position {idx}') offset = idx + 1 except ValueError: break output Found at position 3 Found at position 9
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, list, while loop" }
Delete [bootstrap-3] bootstrap-3 is a duplicate of twitter-bootstrap-3. I don't know what the rules are in that case. Should it be deleted or put as a synonym since it has only one question?
As said on the comment section, removing the tag from the question did remove the tag entirely since it has only one question.
stackexchange-meta_stackoverflow
{ "answer_score": 4, "question_score": 5, "tags": "support, tags, tag synonym process" }
how to declare a COOKIE LESS session variable in c#, only! well i mean, that as u will see in my posts, i am getting problems because of caches so i think cookie less try out how to declare a cookie less session variable without making the whole website cookie less meaning, * website should be cookieless=FALSE * vairable cookie less true
I'm not sure exactly what you're asking, but if I parsed the question right, here are a few things that may be useful: * The values stored in the session state object are **not** stored in cookies -- the only cookie sent to the browser is a session identifier, which will tell the server which session state it should fetch when responding to subsequent requests. The actual session state data is stored on the server. * If your goal here is to prevent the session cookie from being sent to the browser at all, but still allow sessions to work, you can enable cookieless sessions. You can read more about that, the pros and cons as well as how to do it, on the Cookieless ASP.NET page on MSDN.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "c#, asp.net, browser cache" }
Moving files via batch script I am trying to move files to directories that has the same name as the file, excluding the extension and add the word `footage` to the end of the directory name: For example: File `Graduation 2014.mkv` should be moved to folder `Graduation 2014 Footage` File `Graduation 2015.mkv` should be moved to folder `Graduation 2015 Footage` etc. Here is what I have tried: @echo off for %%A in (*.mkv) do ( move "%%A" "%%~nA:~0,-8" ) pause` bu I get the following error: > The filename, directory name, or volume label syntax is incorrect.*
This simple solution works for me. **Here is the Folder Names as Example:** File1_ext 12345_5678 43226343_12 224356434 File2_ext File3_ext Folder_exc File4_ext Ect-Hello **Output Tree:** C:. Move.bat 12345_5678 224356434 43226343_12 Ect-Hello File1_ext File1.mkv File2_ext File2.mkv File3_ext File3.mkv File4_ext File4.mkv Folder_exc **Batch Script:** @echo off @setlocal enabledelayedexpansion Rem | Get File Name FOR %%A IN (*.mkv) do ( Set "FileExt=%%~xA" Set "FileName=%%~nA" Rem | Get Folder Name for /f "tokens=*" %%B in ('dir /b /a:d^| find /i "!FileName!"') do ( Move "!FileName!!FileExt!" "%~dp0%%B" ) ) pause
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "batch file, cmd" }
How to get node title using this query on template? Im building a custom filter in Drupal 8 based on some queries. I got this already, here im filtering by values on body: $query = db_select('node__body', 'n') ->fields('n') ->condition('n.body_value', "%" . $searchWord . "%", 'LIKE') ->condition('n.bundle', 'mycontenttype'); $getList = $query->execute()->fetchAll(); Then i pass the variable to the Twig: return [ '#filters' => $getList, In the twig im doing: {% for oneItem in filters %} But im unable to get the title of the node here, what im missing?
1. You shouldn't do queries like like that. You should use `EntityQuery`. See < and EntityFieldQuery to search Content Type for text and select matching Nodes `EntityQuery` will return the nids. Then use the node storage's `loadMultiple` to get the node themselves. Typically something like `Drupal::entityTypeManager()->getStorage('node')->loadMultiple($nids)` 2. I would expect the Node title would be gotten in your loop with `{{ oneItem.title }}`. If that's not working I suggest installing and enabling the devel module, and sticking `{{ dump(filters) }}` in your custom template to investigate the structure you're getting
stackexchange-drupal
{ "answer_score": 2, "question_score": 1, "tags": "theming, modal dialogs" }
how to get the response time of web pages in jmeter? How to generte csv file and load csv using response time graph listener? Can any one help me in detail that **how we find response time in jmeter** ?
You can get it by adding Reporters. Please keep in mind Reporters is cpu and memory intensive components and thus should not be used while actual load test. But for sample testing you can use it and for load test run you can get response time, average,throughput etc by saving output to jtl file in JMeter. For normal/sample run Aggregate report gives Average response time, min, max, median etc. !enter image description here Summary report also gives the same with less details, !enter image description here While performing actual run you can save output of these reporters in a jtl file. After the test results can be analyzed from jtl files.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "performance, jmeter, performance testing" }
Can we use update() with find() in the laravel eloquent? When I use `update()` with `find()` and invalid `id` like User::find(100) ->update(['is_valid' => true]) I got error: > Error: Call to a member function update() on null But when I use `update()` with `where` and invalid `id` like User::where('id', 100) ->update(['is_valid' => true]) It returns `false` as expected. so what is the problem when I use `find()`? How to solve it?
if you want to use User::find(100) ->update(['is_valid' => true]) this without error you can use `optional()` helper like this optional(User::find(100)) ->update(['is_valid' => true]) ref link < * * * `User::find(0)` \---> `null` it retrun model instance if data found and if not found it it null so you cannot chain `->update()` on `null` that's why your getting error `User::where('id', 100)` \----> `eloquent instnace` it is a laravel `Eloquent` so here you can chain as many function which are avilable in `eloquent`
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "laravel, eloquent, laravel 8" }
No reputation for questions/answers in site meta I asked a question in the specific site meta and my answer was upvoted. However there was no reputation change for that site. Is that just the way it works or is that a bug?
You do not earn (or lose) rep for participation on meta sites (except Meta Stack Overflow). From the Per-Site-Meta FAQ: > Reputation here is entirely derived from the main website; your reputation is the same here as it is there, synchronized hourly. Votes here do not affect your reputation in any way. However, you can earn unique badges here on the meta site.
stackexchange-meta
{ "answer_score": 7, "question_score": 3, "tags": "discussion, up votes, per site meta" }
Using border in abline function I would like to put a black color as a 'border' using abline function. I tried: require(stats) plot(cars) abline(v=10, col='yellow2', lwd=2, border="black") ![enter image description here]( However, my yellow line does not have a black border and I got a warning and Warning message: In int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) : "border" is not a graphical parameter Some idea how to include the border here?
A line can't have a border, right? You can plot two lines instead with different weights. abline(v=10, col='black', lwd=4) abline(v=10, col='yellow2', lwd=2) This can be, of course, compressed into one line of code: abline(v=rep(100,2),col=c('black','yellow2'),lwd=c(4,2))
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "r, plot, colors" }
Diff annotation tool Among the 11 proven practices for more effective, efficient peer code review, diff annotation seems to be the one particularly well suited to tool assistance. The article is written by the architect of SmartBear's CodeCollaborator, so he of course recommends using that. Does anyone know of any alternatives? I can't think of anything that would be even close to paper+pen+marker in pure developer efficiency when it comes to explaining a piece of code.
I use SmartBear's CodeCollaborator at work, and find it really streamlines the review process. I'd definately consider it. There are also some open source alternatives worth investigating: Reitveld \- This Python based tool is loosely based on Googles internal code review tool (Mondrian). Review Board \- Another open source review tool
stackexchange-softwareengineering
{ "answer_score": 2, "question_score": 0, "tags": "tools, code reviews" }
Android: static status bar notification How to create a static status bar notification? Like in skype app or others... It must be visible while app is running, even if it runs in background.
Create a notification and include `FLAG_ONGOING_EVENT` in the set of flags. Note that when your application is finished, you should cancel the notification.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 1, "tags": "android, notifications, statusbar" }
Facebook Apps (PHP base) on Google App Engine I just finish a apps of facebook which developed with PHP, and now I'm looking for a FREE web host, after some googling, I found that some people claim they can run the application successful with Google App Engine(GAE), however, after I follow the step on these pages < I can run some basic php script, but when I include the facebook.php (require 'facebook.php') and run on facebook, it seems something wrong was happened, nothing display. Please help if someone have experience on facebook on GAE with PHP. Thanks a lots~! YK
There is not much you can do with GAE with PHP at the moment. A free alternative is to go for: * Kodingen They provide you FREE: * MySQL Support * FTP * SVN * and a lot more...
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "php, facebook, google app engine" }
Type punning - how does the compiler decide what type to use? I was reading this question here about deciding endianness and the first answer baffled me somewhat. The code used to decide big endianness is as follows: int is_big_endian(void) { union { uint32_t i; char c[4]; } bint = {0x01020304}; return bint.c[0] == 1; } My question is _how does the compiler here decide what type to use for that array_ of hex digits? Because technically it fits equally well in both that `uint32_t` or that `char[4]`. Why not just store it in the `char[4]` and skip the `union`? Is there some advantage of a `union` here that I don't see? I know this is called type-punning, but I fail to see its advantage here.
> My question is how does the compiler here decide what type to use for that array of hex digits? As with arrays and aggregate classes, the first initialiser initialises the first member; in this case `i`. (Of course, unlike those things, it doesn't make sense to have more than one initialiser). > Why not just store it in the char[4] and skip the union? Is there some advantage of a union here that I don't see? The purpose of this is to initialise the 4-byte integer, then use the `char` array to examine the individual bytes to determine the memory order. If the most significant byte (`0x01`) is stored in the first byte, then the system is "big-endian"; otherwise it's "little-endian" (or perhaps something stranger).
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "c++, unions, type punning" }
Prove $F(x)=\frac{1}{x}\int_0^xf(t)$ is convex Assume $f(x)$ is convex in $[0,\infty)$, Prove $F(x)=\frac{1}{x}\int_0^xf(t)dt$ is convex
A hint: Substitute $t:=\tau\, x$ $\ (0\leq\tau\leq 1)$ and look at the resulting integral.
stackexchange-math
{ "answer_score": 5, "question_score": 6, "tags": "calculus" }
how to upload file to ftp related path quickly in notepad++? for example: my local file path is d:/www/zencart/includes/pages/checkout_shipping/header_php.php ftp file path is ./htdocs/includes/pages/checkout_shipping/header_php.php when I modify my file in my pc , I want to update the file in my ftp the same with my local file , how to do the job quickly? not to use ftp software to find the relatived path in ftp and then upload file ,this method is too slow.
In the newest version of Notepad++ installed with all standard add-ons there is a built-in mini-FTP client. You can find it in `Plugins > NppFTP` The second option is to add network location in Windows Explorer and save it there as you'd save it on your local computer.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "ftp, notepad++" }
Enable hl-line-mode globally Running `M-x hl-line-mode` enables highlighting for the current buffer. How can i set highlighting current line to be enabled in `init.el`?
just add this to your .emacs or init.el file : `(global-hl-line-mode 1)`.
stackexchange-emacs
{ "answer_score": 14, "question_score": 5, "tags": "init file, highlighting, hl line mode" }
How unique is the session ID in Laravel? I am keeping track of article hits by storing each page view in a table along with the session ID, I then use the session ID to weed out (`count(distinct session)`) multiple hits in the users session lifetime. But how unique is the Laravel session ID? Should I also take other things into consideration, such as the time to avoid incorrect grouping? **Update:** I adjusted my SQL to take the date into account as well: select count(distinct session, DATE(created_at)) as aggregate from `article_views` where `article_id` = ? and `agent` NOT LIKE '%bot%'
Session ID is pretty unique, it can be duplicated, but the probability is very low. If you have a website with a fair traffic, it may happens once in you web site life, and will just annoy one user for one session. This is not worth to care about unless you expect to build a very high traffic website.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 6, "tags": "php, session, laravel 4" }
Specific sort a list of numbers separated by dots I have a list: L = ['1.1.1.', '1.1.10.', '1.1.11.', '1.1.12.', '1.1.13.', '1.1.2.', '1.1.3.', '1.1.4.'] I want to sort it in next order: 1.1.1. 1.1.2. 1.1.3. 1.1.4. 1.1.10. 1.1.11. 1.1.12. 1.1.13. The following method does not produce a result: L.sort(key=lambda s: int(re.search(r'.(\d+)',s).group(1)))
Just get the last part, convert that to an int and return it as the key for comparison print(sorted(L, key=lambda x: int(x.split(".")[2]))) If you want **all the parts to be considered** , you can do like this print(sorted(L, key=lambda x: [int(i) for i in x.rstrip(".").split(".")])) It removes `.` at the end of the strings, splits them based on `.` and then converts each and every part of it to an `int`. The returned list will be used for comparison. You can read more about how various sequences will be compared by Python, here **Output** ['1.1.1.','1.1.2.','1.1.3.','1.1.4.','1.1.10.','1.1.11.','1.1.12.','1.1.13.']
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 10, "tags": "python, list, sorting" }
Why does not os.system("cd mydir") work and we have to use os.chdir("mydir") instead in python? I tried doing a "pwd" or cwd, after the cd, it does not seem to work when we use os.system("cd"). Is there something going on with the way the child processes are created. This is all under Linux.
The `system` call creates a new process. If you do `system("cd ..`, you are creating a new process that then changes its own current working directory and terminates. It would be quite surprising if a child process changing its current working directory magically changed its parent's current working directory. A system where that happened would be very hard to use.
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 6, "tags": "python, sys" }
Problem with convergence of Jacobi iterative algorithm I'm dealing with Jacobi iterative method for solving sparse system of linear equations. For small matrices it works well and gives right answers even if matrix is not strictly diagonal dominant, however for the case of really big matrices ($100000*100000$) it does not converge because the matrix is not diagonal. Many articles suggest to interchange rows and columns in order to make diagonal dominant matrices, however for the case of my matrix it is always not diagonal dominant. Could anyone please, suggest me how to deal with this problem? Maybe there is some method how to choose right initial approximation or maybe there is more robust algorithm exists. I'm a newcomer in this field and I would be appreciated for any help.
The Jacobi iteration is the worst possible solver for linear systems. Furthermore, contrary to your belief (but easy to show), it is entirely independent of the ordering of the unknowns, so reordering rows and columns of the system makes absolutely no difference. There are many better methods for solving linear systems, among them CG and GMRES, and there are many good books on the subject (e.g., the one by Y. Saad). My take on many of the issues with solver and preconditioners is given in lectures 34-38 at < .
stackexchange-scicomp
{ "answer_score": 3, "question_score": 1, "tags": "matrix, linear solver, convergence" }
Do Great General's effects stack in civ 5? I know Great Generals have this effect that boosts strength of nearby units. If I have two GG set beside each other, do their effects stack?
A single unit can only benefit from the effects of one great general, even if more than one are within range.
stackexchange-gaming
{ "answer_score": 15, "question_score": 15, "tags": "civilization 5" }
Iniciar várias threads em um comando de repetição Tenho um projeto onde eu preciso iniciar 30 vezes uma _thread_ que vai executar o mesmo método, e queria fazer isso em um comando de repetição, por exemplo: for (int i = 0; i < 30; i++) { Thread t = new Thread(MetodoVoid); t.Start(); System.Threading.Thread.Sleep(1000); } Mas quando uso isso diz que o _thread_ já está em execução e da erro, como proceder?
Você está jogando tudo em uma variável só. Se quiser insistir nessa forma, tem que jogar elementos de um _array_ ou lista, assim cada _thread_ estará em uma variável. Mas leia meu comentário. Se está errando em algo tão simples, não deveria usar algo que é tão complicado fazer certo. var threads = new List<Thread>(); for (int i = 0; i < 30; i++) { threads.Add(new Thread(MetodoVoid)); threads[i].Start(); } Coloquei no **GitHub** para referência futura.
stackexchange-pt_stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "c#, .net, thread, multithreading" }
Raising an Event/Calling a Method on a MS Access form from a C# MS Access COMAddIn I have an VS 2008 C# MS Access add-in and I wanted to know how I could raise events or call methods on an MS Access form. Simply put, how do I raise an event or call a method on a Microsoft.Office.Interop.Access.Form object from within C# and get the VBA code to execute o the MS Access side. Please anyone, let me know if such a thing is possible and how.
I never found a good solution for this and had to go with a work-around. If I keep a reference to a TextBox in my C# AddIn code and I change the Text property within my C# code, if there is a VBA handler associated with that TextBox, the Change event will be raised. The Text property will not fire the change event if the text value is too great. So a work-around for that work-around is to use two TextBoxes; one to raise the event (just set the Text property to any text like the word "event") and another TextBox that stores the actual data in it's Value property. This is stupid but it works.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c#, events, ms access 2007, comaddin" }
Form data appear in browser address bar I have a Login action method in my AccountController in asp.net MVC 3 application which redirects to Relogin If login fails like this: return RedirectToAction("ReLogin", model); and here is Relogin action method public ActionResult ReLogin(LogOnModel model) { if (!string.IsNullOrWhiteSpace(model.ErrorMessage)) ModelState.AddModelError("", model.ErrorMessage); return View(model); } If I enter wrong username and password, it appears in browser address bar. How can I make it post request so that it doesn't appear in address bar ?
Instead of using a rederict passing the model which will generate a GEt call with all the parameters, You should think of saving the model in the session and then redirect to Relogin without parameters. Then you get the model from the session.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "asp.net, asp.net mvc 3" }
M2: Is there a faster way to Update Frontend Themes? When updating frontend components in Magento 2, meaning Templates as phtml, html templates for Knockout, CSS files, Less Files, Fonts, Images etc. I can only get this to work by 1. Flushing the `/var and /pub/static` folders 2. running `php bin/magento setup:static-content:deploy` for each language 3. Clearing all Caches in Magento 4. Clearing all Caches in Browser Needles to say, this whole process is pretty annoying and slow. The Magento 2 Docs show parameters to skip Themes in the deploy command, but they don't work. The whole generation takes really long and stops me from being productive. Is there no faster way to update the Frontend designs?
**From Magento version 2.1 you can deploy only specific theme,** Just run below command to update only specific theme, YOu can pass just require information to below command, only run specific theme php bin/magento setup:static-content:deploy --area=frontend --no-fonts --theme Magento/luma Extra theme are not deployed.
stackexchange-magento
{ "answer_score": 3, "question_score": 1, "tags": "magento2, frontend" }
How to remove "XXX is an application downloaded from the internet. are you sure you want to open it" at start up? Everytime I restart my mac, a pop up shows up telling me that "TunesGoWatch is an application downloaded from the internet. are you sure you want to open it?". I don't know where this message comes from and I'm not sure how to get rid of it forever (I downloaded this app very long ago but uninstalled it) It pop ups automatically at start up.
The app is almost certainly in your Login items. To check and remove it, do this: 1. Go to Apple > System Preferences > Users & Groups 2. Make sure your User Account is selected at top left 3. Click on the Login Items tab 4. Look for an item called _TunesGoWatch_ (or something else that could be triggering this) in the list of login items 5. Now remove this item by clicking on its name (so it's highlighted) and then clicking on the minus `-` button 6. Once it's removed, exit System Preferences 7. Restart your Mac to test to see if the problem still persists
stackexchange-apple
{ "answer_score": 19, "question_score": 14, "tags": "macos, applications" }
Proving that the family of subsets of $\mathbb{R}$ containing Symmetric open intervals form a topology on $\mathbb{R}$. Proving that the family subsets of $\mathbb{R}$ containing Symmetric open intervals form a topology on $\mathbb{R}$, could anyone clarify this for me especially the step of showing that arbitrary union is in the above set?
Let $\tau_S$ be the symmetric open intervals, I am assuming that $\mathbb{R}$ and $\emptyset$ are included in this. If $\\{U \alpha \\}_\alpha \subset \tau_S$, then $U_\alpha = (-\sup U_\alpha, \sup U_\alpha)$ for all indices $\alpha$. Then $\cup_\alpha U_\alpha = \cup_\alpha (-\sup U_\alpha, \sup U_\alpha) = (-\sup_\alpha \sup U_\alpha, \sup_\alpha \sup U_\alpha) \in \tau_S$. Similarly, if $U_1,...,U_n \in \tau_S$, then $\cap_k U_k = (-\min_k \sup U_k,\min_k \sup U_k) \in \tau_S$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "general topology" }
How to POST this -d in the body of HTTP request This is probably an easy question, but I haven't found a super clear answer. I basically want to convert this curl POST request: curl \ -d key=[YOUR_PRIVATE_KEY] \ -d [email protected] to an API call in Apps Scripts (I think this question goes across all languages though). I found I could just add the -d parameters as query parameters to the end of the request, but I can't seem to pass them in the body. When passing JSON I just use JSON.stringify on a javascript object and it works great. So I guess my question is how do I format this so it has the same effect as when I make the data a query string? This works great: ` Thanks in advance.
Data to be sent in the post body is added to the payload property of the options object you pass to UrlfetchApp. var payload = {key:1233456,email:"[email protected]"}; var options = {method:"POST", contentType:"application/json", payload:JSON.stringify(payload)}; var URL =" var results = UrlfetchApp.fetch(URL,options);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, rest, http, google apps script" }
jquery to update element with new value how can i use jquery to update the value inside these tags `<center></center>` **HERE IS THE HTML** <h1 id="total_contacts"><center>0</center></h1> **HERE IS MY JQUERY** I don't think my jquery is targeting the center tags. $("#total_contacts").text(total_contacts);
The id you are using is wrong. $("#total_contacts center").text(total_contacts);//not $("#total_contatcs") **Working Demo** $("#total_contacts center").text('Hi user3436467'); <script src=" <h1 id="total_contacts"><center>0</center></h1>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "jquery" }
Floating menu div css Trying to make a floating css menu. How do I get the floating div to float relative to parent container? <
Instead of using `postion:fixed` you should be using `postion:absolute` for #float-menu. Position fixed should be used when you want to fix something with respect to position of window (no matter you scroll how much or to where). Position absolute will deliver the same effect except it gets fixed to wherever it was rendered with respect to body. Putting position absolute with parent positioned to relative will deliver the effect which you are trying to achieve however it will not sustain if you scroll down. Best solution would be to change the attribute position to absolute as soon as scrolltop crosses 100px using javascript.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "css" }
Show different result based on output redirect For exmaple, the `mysql` command mysql -e 'show databases' +--------------------------+ | Database | +--------------------------+ | information_schema | | mysql | | performance_schema | +--------------------------+ But when you redirect to a file, the content is different, e.g. mysql -e 'show databases' > /tmp/test.txt cat /tmp/test.txt Database mysql performance_schema
This is done by checking if STDOUT is connected to a TTY using the `isatty()` call (in C, substitute the equivalent for your language of choice).
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "shell, stdout" }
Defining Erlang record in a module I can define a record on the erl shell via: 129> rd(person, {name=""}). person 130> #person {}. #person{name = []} 131> #person {name="dummy"}. #person{name = "dummy"} But I'm not sure how to define and use records in a module. When I create my_module.erl: -module(my_module). -record(person, {name, phone, address}). #person {name="dummy"}. ...and try to compile, I get: 132> c(my_module). my_module.erl:5: syntax error before: '#' my_module.erl:3: Warning: record person is unused error The documentation says rd is used in the shell since records are available at compile time, not runtime. So I would assume I wouldn't need to use rd in the module definition.
You have defined it right, but a record can only be used inside a function (when it's inside a module). So add something like `test_record() -> #person{name="dummy"}.` Then you can see the results from the Erlang shell with `my_module:test_record()`
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "erlang, record" }
How to build loadable builtins for Bash As I recently learned, it's possible to dynamically load custom builtins into Bash (see `enable` in the manual, and this answer). However I'm not sure how to take advantage of this feature. The linked question points to < which provides some compilation instructions, but I'm not able to reproduce them (in Bash 5.0): $ git clone $ cd bash/ $ ./configure $ make $ exec ./bash $ cd examples/loadables/ $ make $ enable -f finfo finfo bash: enable: cannot open shared object finfo: finfo: cannot open shared object file: No such file or directory (Here's the full output just in case it's helpful) Running `make` in the `examples/loadables` appears to be creating `.o` files, while (I think?) `enable` is looking for a `.so` file. Is there a step I've missed that would generate the appropriate artifacts? Is there an easier or more typical way to build custom builtins?
The filename must be an "absolute" path (in this context, that's just a path with a slash in it), or it will be looked up in `BASH_LOADABLES_PATH`, falling back to `dlopen(3)`'s search mechanism (e.g., see the Linux manpage). It seems that, despite the comments in `enable.def`, these do not include the current directory (which is a good thing, IMO). Just use a path: bash-5.0$ enable -f print print bash: enable: cannot open shared object print: print: cannot open shared object file: No such file or directory bash-5.0$ enable -f ./print print bash-5.0$ help print print: print [-Rnprs] [-u unit] [-f format] [arguments] Display arguments. Output the arguments. The -f option means to use the argument as a format string as would be supplied to printf(1). The rest of the options are as in ksh.
stackexchange-unix
{ "answer_score": 2, "question_score": 3, "tags": "bash, make, c++, shell builtin, plugin" }
Count files and folders in a zip file using PowerShell How do you count the files and folders in a zip file? I am running a verification of backups and need to compare the folder structure of the zip file against the folder structure of the windows folder is was made from. The final goal is to have a boolean value of if the source count is equal to the zip content count. This is as far as I have, so far: [Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') |out-null $ZipContents=[IO.Compression.ZipFile]::OpenRead($FilePath).Entries $ZipContents.Count This gets a raw count of everything, but hoping for a distinct count of files and a count of folders or some way to compare structures. Using 7-zip would be fine, also. These zip files can get very large, so extracting first would be too time consuming to be an option.
If you can use `7z.exe`, you may be able to do something like this: & 'C:\Program Files\7-Zip\7z.exe' l <zipfilename> | Select-Object -Last 1 | Select-String '([0-9]+) files(?:, ([0-9]+) folders)?' | ForEach-Object { $fileCount = [Int] $_.Matches[0].Groups[1].Value $dirCount = [Int] $_.Matches[0].Groups[2].Value }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "powershell, 7zip" }
Spring Cloud Netflix: Will Eureka client prefer to choose the remote service in same zone? The document says: > Eureka clients tries to talk to Eureka Server in the same zone. If there are problems talking with the server or if the server does not exist in the same zone, the clients fail over to the servers in the other zones. So I know clients will query servers at the same zone first. But my question is will clients prefer to choose the remote service at the same zone? Different zones could be mapped to different server rooms so RPC across to another zone may bring more network latency.
Same zone first, the load balancing is done using Ribbon. < > By default it will be used to locate a server in the same zone as the client because the default is a `ZonePreferenceServerListFilter`.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "netflix eureka, spring cloud netflix" }
Naming URL patterns‎ for a forum I am creating a web forum, which of the following URL pattern you preferred and why? A. Group pages: Post pages: B. Group pages: Post pages: C. Group pages: Post pages: Thanks for your opinion.
Definitely the C What does the computer folder stands for?
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": -2, "tags": "php, url, rest" }
How to make a tiled color background? ![sample design I want to recreate]( How can I create that type of solid tiled color background... should I use Illustrator for this or something else?
You could use Illustrator's "Object Mosaic" function. 1. Create your gradient. ![enter image description here]( 2. The mosaic function only works on raster images so first select your gradient object and rasterize ( _Object → Rasterize..._ ) Then run the mosaic function ( _Object → Create Object Mosaic..._ ) ![enter image description here]( 3. You can add a drop shadow effect ( _Effect → Stylize → Drop Shadow..._ ) to specific tiles by selecting them with the Direct Selection Tool (you may need to bring them forward too; right-click "Arrange → Bring to Front"). ![enter image description here]( ![enter image description here](
stackexchange-graphicdesign
{ "answer_score": 6, "question_score": 1, "tags": "adobe photoshop, adobe illustrator, print design, background" }
I cannot print color escape codes to the terminal When I run this script: fn main() { // \033[0;31m <- Red // \033[0m <- No Color println!("\033[0;31mSO\033[0m") } I expect to get SO #in red letters However, I get: 33[0;31mSO33[0m When I ran similar script in Go or Python, I get the expected output. What is going on? What am I missing? How do fix this? I am using: $ rustc --version rustc 1.3.0 (9a92aaf19 2015-09-15) $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.3 LTS Release: 14.04 Codename: trusty
Rust 1.3.0 does not seem to support octal escape strings such as `\033`. Instead, you can use hexadecimal escape strings like `\x1b`. fn main(){ println!("\x1b0;31mSO\x1b[0m") } Updated: This answer was intended that "you cannot use octal character such as `\033`, use hexadecimal character `\x1b` instead", but If you want to know about [ANSI Escape code, maybe this gist is useful.
stackexchange-stackoverflow
{ "answer_score": 46, "question_score": 16, "tags": "linux, terminal, rust" }
Users can undelete their own posts when deleted by reviewers According to this post: > If a post was deleted by users other than its owner, the owner's undelete vote will no longer instantly undelete - it will be counted just like other users' votes to undelete. > > Note that if a moderator participated in the deletion, only another moderator can undelete. This doesn't seem to be the case with posts deleted via the review queue. For example, this post (Unix 10k only) was deleted by review, but then the answerer undeleted it single-handedly: ![](
This is by-design. However, author undeletion does trigger an automatic flag so moderators can look into it and verify if it should be deleted or not. You're be surprised how many of these auto-flags I dismiss because the post should have never been deleted in the first place, or the post has been improved since deletion and is now a valid post. If I had to guesstimate, I'd say well over half.
stackexchange-meta
{ "answer_score": 12, "question_score": 9, "tags": "bug, status bydesign, deleted questions, deleted answers, vote to delete" }
Need a Regular Expression for All, C#, Regex I need regular expression that requires to extract any alpha-numeric value that is surrounded by parentheses. Note about parentheses: There could be any number of parentheses on each side, but the number of parentheses on each side match (see Ex below). Ex. Values (extract value of '1' from parentheses on each side): (1) -> 1 ((1)) -> 1 (((1))) -> 1 I have this expression but obviously its wrong and not sure how to preserve the value between (), etc. \\(([^)]*)\\)
Just use Replace(); string myString = "(((1))) - 1"; myString = myString.Replace("(", "").Replace(")", "");
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -3, "tags": "c#, .net, regex" }
Help explain method to solve two equations in two unknowns where one of the variables has a square term Given: $-\frac{96}{x^2y}+1+y=0$ $-\frac{96}{xy^2}+2+x=0$ Solve for $x$ and $y$ How should I find $x$ and $y$? I thought of using the methods I learned in linear algebra but then I noticed that there is a square in the $x$ and $y$ variable so that makes these set of equations not linear. So, linear algebra doesn't apply here (please correct me if I am wrong). A method I learned in high school is to divide the two equations together and to substitute it into the other. This is the way that my textbook shows too. But I don't know why this operation is valid i.e. does dividing the two equations really preserve the solution to the system? In linear algebra, as far as I know, dividing two equations together is not a valid row operation. Therefore, I would like to know, what is the theory behind solving this kind of system of equations.
Well, we can start doing this: $\frac{96}{x^2y} =1+y$ $\frac{96}{xy^2} =2+x$ Multiply the top equation by $x$ and the bottom by $y$, equate the right hand sides, and subtract out $xy$ gives $x = 2y$. Substituting back into the top equation and rearranging gives $$y^4 + y^3 = y^3(y+1) = 24,$$ which has solution $y=2$. Then, $x=4$.
stackexchange-math
{ "answer_score": 3, "question_score": 1, "tags": "systems of equations, rational functions" }
How to return a list of strings in Java? I want to return a list of strings when I call the method `generateArrayList(2);` It reminds me `"Method does not exist or incorrect signature: void generateArrayList(Integer) from the type anon"` Anyone help me, please! here is my class: public class StringArrayTest { public static List<String> generateArrayList(integer n){ List<String> stringArray = new List<String>(); for (integer i=0;i<n;i++){ String str= 'Test'+String.valueOf(i); stringArray.add(str); } return stringArray; } }
You have few compile time errors which needs to be corrected before it can work correctly. 1. `integer`: It will either be an `int` or an `Integer`. Use `ArrayList` 2. `new List<String>`: It's an interface. You can't instantiate an interface. 3. `'Test'`: Single quotes is used for Character literal, for Strings use double quotes. 4. Also, there's no need of `string.valueOf(i)`. Below, I have corrected all these errors. It should work now. public static List<String> generateArrayList(int n){ List<String> stringArray = new ArrayList<>(); for (int i=0;i<n;i++){ String str= "Test" + i; stringArray.add(str); } return stringArray; }
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": -3, "tags": "java, apex" }
How to accustom a 10 month old baby to interacting with pets? We have a 10-month old baby and two cats. One cat is very friendly and the other aloof. We have had cats longer than baby. Our daughter can now crawl and pick objects up--so she is eager to engage with cats. Naturally, the cats are not, but we have had few issues with safety for either (she has been swatted once or twice and cats have endured excessive fur pulling). We don't want our daughter to fear the cats, but to learn how to appropriately handle them--ie, not pull fur or tail or whiskers. We've been demonstrating that and she seems to occasionally be gentle, but not usually. How do we encourage her to engage with the cats well (without causing them discomfort and leading to them lashing out), so that neither her nor cats experience harm?
The trick in my experience is carefully monitoring and assisting in the interaction to keep everyone safe and calm. I've done this with my niece and currently with my little one. I will sit with the child and hold their hands and help them pet the cat. I make sure the baby isn't getting grabby and keep hands away from certain parts of the cat (tail, face, etc.) If either the child or the cat is getting to excited or agitated I will separate them and let them calm down before trying again. Doing this in moderation lets the baby and the cat get used to the interaction. You can also teach the idea of "being soft" to the baby. I've usually repeated that phrase while helping them pet and while demonstrating petting the cat. At this age it mostly helps to associate being nice to the cat with that phrase but it helps later with reminding them to be gentle when interacting with animals / others.
stackexchange-parenting
{ "answer_score": 4, "question_score": 4, "tags": "infant, safety, teaching, pets, animal interaction" }
Is there a solution to the constant unhandled exceptions that Powerpivot throws in Excel 2013? Each time I perform certain actions with Powerpivot in Excel 2013 it throws an exception about not being unable to cast a COM object to an interface. This happens most notably every time I try to type a function for a calculated column and when I leave the formula bar. If I click continue, the program continues as normal but this starts to become an annoyance after a while. I have researched the error but documented cases are few and forum posts about this error just seem to be ignored. Is there a solution to this problem such as an update or a different way to use it or should I just suck it up and live with it? Below is a screenshot of the error dialog. ![enter image description here](
When certain **PowerPivot** actions in **Microsoft Office 2013** have an **Unhandled exception** occur related to `'Microsoft.Office.Core.IRibbonUI' - Library not registered` try to . . . ## Repair Office 2013 > Go to **Control Panel** and from **Program and Features** , highlight the **Microsoft Office 2013** entry on your system, _right-click_ and select **Change** , and then when the **Office** window pops up for **How would you like to repair your Office programs?** start by trying **Quick Repair**. If that doesn't resolve the problem, reboot, confirm there's still an issue and then try to **Online Repair**. > > ![enter image description here]( * * * ## Further Resources * Microsoft Office 2007/2010/2013/2016 (Win) - Repairing Corrupted Program Files * How to use Office 2013 suites and programs (MSI deployment) on a computer that's running another version of Office
stackexchange-superuser
{ "answer_score": 1, "question_score": 1, "tags": "microsoft excel, microsoft excel 2013, powerpivot" }
Unexpected '{', expecting T_STRING or T_VARIABLE or '$' I have a laravel 4 web app using a third party package. It worked fine on my localhost but i've uploaded it to appfog and it's throwing the following error in the thirdparty plugin: `syntax error, unexpected '{', expecting T_STRING or T_VARIABLE or '$'` Somewhere on this line: `Mail::{$mailMethod}(Config::get('saasframe::email.view'), (array)$subscription, function($message) use ($user)` You can view the full error details here: chris-till-staging-app.eu01.aws.af.cm
Mail::{$mailMethod} Perhaps this? Are you calling a static variable? If so, try Mail::$mailMethod
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, laravel, syntax error" }
Searching for a string in HashSet<string> Performance I have a `HashSet<string>` with ~50k members. I have another list of objects that I'm iterating through one by one to determine if the object's email exists. If it does, I need to perform some action on the object. var emailList = db.Emails.Select(s => s.EmailAddress.ToLower()).ToList(); var emailHash = new HashSet<string>(emailList); var objects = db.Objects.ToList(); // everything is fine up to this point foreach (var object in objects) { if (!emailHash.Any(s => s.Equals(object.Email))) { // This takes ~0.3s Console.WriteLine("Email: {0}", object.Email); } } What can I do to speed up the evaluation of whether or not one string exists in a list of strings?
You are not using the HashSet correctly. Using Linq's `.Any()` will actually evaluate your condition against each element stored in the HashSet. To search if an item exists in a HashSet (with constant time, `O(1)`) use `emailHash.Contains(object.Email)`.
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 3, "tags": "c#, .net, c# 4.0" }
Scaling of ParDo transforms having blocking network calls I have a ParDo transform inside which I am making a blocking web service call to fetch some data. The call takes a while to return (say about 1 minute). I observed that this ParDo transform does not scale much (I am using autoscale mode) even if called on a fairly large PCollection. Perhaps this is because scaling happens only when there is heavy CPU/memory utilization and in my case, CPU/memory consumption could be low as most time is spent on waiting for the network call to return. The end result is that since scaling does not happen, only a small number of http requests are issued in parallel, and the job takes longer to finish. Any ideas/suggestions on how I can improve the situation ? Thank You Note:I am using Google Dataflow through Java SDK 1.9.1, and am open to moving to Apache Beam Java SDK
Indeed currently Dataflow limits autoscaling in case the workers are not utilizing CPU enough. This is mainly done to avoid a situation where you are doing blocking network calls in your pipeline, and as we scale up, more calls are being made and the external service gets overloaded and becomes slower, and as a result Dataflow thinks that the total amount of work to be done is even larger, and scales further up, spiraling into a positive feedback loop. The current behavior also is not optimal for this case, but it at least does not have this catastrophic failure mode. We are considering different ways to achieve the best of both worlds, but for now this is a known issue and to work around it you'll need to either specify the number of workers explicitly (thus disabling autoscaling), or perhaps add some code that burns CPU (which is, granted, very ugly).
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "google cloud dataflow, apache beam" }
Generating defined amount of the rows based on max/min of other Dataframe in pandas I have a Dataframe where I have calculated metrics below: Metrics I need to generate fixed amount of the rows for new data frame (for example 1000 or 2500), where each row will have a random number no less than minimum and no more than maximum, ideally change for +/- 1%. I was trying solution as below, but without success so far: Intervals = pd.DataFrame(np.array([[df['Close'].min(), df['Close'].max()],[0.4, 0.6],[0.4, 0.6],[0.20, 1.], [0.3, 0.4], [0.2, 0.3]])) df = pd.DataFrame(list(Intervals.apply(lambda x: np.random.uniform(low=x[0],high=x[1], size = 2500).T, axis=1))) print(df.T) Any ideas how it can be approached?
You can loop over the columns in your metrics dataframe and create an array of random numbers using `numpy.random`: pd.DataFrame({ column: np.random.uniform( low=metrics[column].min(), high=metrics[column].max(), size=1000 ) for column in metrics.columns })
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, pandas, dataframe" }
How to divide two columns element-wise in a pandas dataframe I have two columns in my pandas dataframe. I'd like to divide column `A` by column `B`, value by value, and show it as follows: import pandas as pd csv1 = pd.read_csv('auto$0$0.csv') csv2 = pd.read_csv('auto$0$8.csv') df1 = pd.DataFrame(csv1, columns=['Column A', 'Column B']) df2 = pd.DataFrame(csv2, columns=['Column A', 'Column B']) dfnew = pd.concat([df1, df2]) The columns: Column A Column B 12 2 14 7 16 8 20 5 And the expected result: Result 6 2 2 4 How do I do this?
Just divide the columns: In [158]: df['Result'] = df['Column A']/df['Column B'] df Out[158]: Column A Column B Result 0 12 2 6.0 1 14 7 2.0 2 16 8 2.0 3 20 5 4.0
stackexchange-stackoverflow
{ "answer_score": 83, "question_score": 39, "tags": "python, pandas, dataframe" }
Integer.valueOf() static function Integer b = Integer.valueOf("444",8); System.out.println(b); why b=292 I can't understand this static function and when b=Integer.valueOf("444",16); System.out.println(b) why b=1092 I appreciate your help Thanks in advance
As usual _sigh_ the docs are there to read them. < > Returns an Integer object holding the value extracted from the specified String when parsed with the radix given by the second argument. This means, if you pass 16 as second argument, the number will be interpreted as a hexadecimal number, thus: 4 * 16 ^ 2 + 4 * 16 + 4 = 1092. Same for octal, only with radix 8.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -10, "tags": "java, integer, value of" }
az cli/bicep targeted/single module deploys? Is there an az/bicep equivalent to `terraform apply -target=module.my_app.module.something`? Given a root bicep file: module app '../../../projects/my/application/app.bicep' = { name: 'app' } module test '../../../projects/my/application/test.bicep' = { name: 'test' } module sample '../../../projects/my/application/sample.bicep' = { name: 'sample' params { p1: 'p1' } } Can I provision just the `sample` module somehow? I could do something like: `az deployment sub create --template-file ../../../projects/my/application/sample.bicep -l germanywestcentral` But this is not really the same thing, because this bypasses the params passed from the root module (which provides env separations) down to the actual module.
The command you have: `az deployment sub create --template-file ../../../projects/my/application/sample.bicep -l germanywestcentral` will work just fine, you just pass the parameters you would normally pass to `root.bicep` that are needed by that module (e.g. `p1`) If you have params that are created/manipulated in `root.bicep` you'd have to decide how you marshal those values manually.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "azure devops, azure cli, azure bicep" }
unable to pull .gitignore file I've modified my .gitignore file from my VPS. Then I've commit the change and pushed to remote repo: git add .gitignore git commit -m ".gitignore changed" git push -u origin --all and then, I pull it to localhost: git pull But I get the next error: error: unable to unlink old '.gitignore' (Permission denied) I've tried changing permissions of .gitignore local file to 0777, but doesn't work. The file in remote repo has been changed, but not in my local file What could be the problem? and how could be solved?
The answer was easy: sudo git pull **Edit:** I had probably wrong permissions (better said, owner) in the `.git` directory. It's better to change the owner of this directory and files instead: sudo chown -R yourGitUser ./.git
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "git, gitignore, git pull" }
converting a date in ruby to a customised format I am looking for a method where I can convert a date into more of a human readable format... for example: 12/02/2013 can be converted to "2nd December 2013" 12/03/2013 should be converted to "3rd December 2013" 11/27/2013 can be converted to "27th November 2013" Is any function in Ruby/Rails readily available to use or I have to write on my own something to handle "st","nd","rd" and "th" besides date numbers ?
You can try this t = Time.now() t.strftime("#{t.day.ordinalize} %B %Y") It will result in 27th November 2013
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 2, "tags": "ruby on rails, ruby, rubygems" }
A special review? Must be something special - 7 close votes are not enough? < !enter image description here
If you look at each of those users you'll notice that 3 of them have less than 3,000 reputation. They can't vote to close. When you have less than 3k reputation the "Close" button in the LQP queue reads "Recommend closure" and flags a post for closure with the specific reason they chose. This is similar with the "delete" button. Once you get 20k it will change from "Recommend deletion" to just "Delete" (providing the answer meets the criteria for 20k user deletion).
stackexchange-meta_askubuntu
{ "answer_score": 10, "question_score": 6, "tags": "discussion, review" }
Add a Enterprise Wiki as a subsite in Sharepoint 2010 I created an empty SharePoint 2010 site collection in which I added many subsites like an Agile Dashboard and a Blog. I wanted to add a Enterprise Wiki but it does not show up in the list of site template. Apparently, SharePoint only allow to add Enterprise Wiki when creating a site collection from the "Publishing" category. It seems strange because for me it makes total sense to have a Wiki along with any kind of site. Do anybody has an idea how to enable this template in an empty site collection ? Regards.
I finally solved the problem myself. I realised that using the SharePoint 2010 Designer allowed me to add an Enterprise Wiki. But it was giving me an error telling me that the Publishing Infrastructure feature was not enabled on the site collection. So I just activated it from site settings and the template magically appeared in the the New Site wizard :)
stackexchange-serverfault
{ "answer_score": 0, "question_score": 0, "tags": "sharepoint 2010, wiki, templates" }
JBoss EAP5 end of service I am looking at the JBoss EAP5 end of service dates. Is it so that full support ended sometime end of 2013, but partial support is still provided 3 years after that, including e.g. Critical patches?
All information are available on the Red Hat web: < JBoss EAP 5: * Maintenance Support end: Nov 2016 * Extended Life Support end: Nov 2019 The Extended Life support covers: * Unlimited-incident technical support * Asynchronous Security Patches * Asynchronous Bug-Fix Patches
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "jboss5.x, jboss6.x" }
Design Patterns question I have a following problem I want to solve ellegantly: public interface IMyclass { } public class A { public void Init(IMyclass class){?} public IMyclass CreateMyClass(){?} } At the start of the system I want to define dynamic type of IMyClass by using Init() and during the run of the system i would like to create new instances of the type I defined at init. Notes: 1\. IMyclass must be interface 2\. The dynamic type of IMyclass known only at init (i have no constructor after :) ) 3\. I could do it using a reflection or definition method clone at IMyclass is there any better solutions? Thank you.
You could pass a _provider_ into `class A` public class A { IMyClassProvider _provider; public void Init(IMyClassProvider provider) { _provider = provider; } public IMyclass CreateMyClass() { return _provider.Create(); } } Or maybe with a constructor delegate public class A { Func<IMyclass> _ctor; public void Init(Func<IMyclass> ctor) { _ctor = ctor; } public IMyclass CreateMyClass() { return _ctor(); } } Note that both of these examples will blow up if `Init` has not been called before `CreateMyClass`, you would need some checking or better is doing your init in the constructor. Have I understood the question correctly?
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 4, "tags": "java, oop, design patterns, reflection" }
Можно ли создать div не квадратный Я хочу создать поле с квадратами (будет канвас), но повернутыми, и тогда вместо квадратов будут трапеции и параллелограммы. Мне надо создать div, чтоб он был в форме трапеции (потом повешу на них `onclick="Функция()"`). Если это возможно, дайте пример как сделать 1 такой div, или подскажите где искать информацию про это.
CSS3 Shapes там есть трапеция
stackexchange-ru_stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "canvas, html, javascript, css" }
How to detect Azure Storage type using SDK? I need to be able to detect the type of storage that a certain account offers. For example, if a user gives me their Storage Account and Key, I need to be able to detect whether or not it is a Premium LRS type of storage. I have looked at the CloudStorageAccount class without any luck. Does anyone know how I can detect this programatically?
You need to use Azure Management API's for this. Initialize StorageManagementClient object and "Get" a storage account from it. storageAccount.Properties.AccountType contains if the account is "Premium" or other Storage Nuget package for Management API is: Microsoft.WindowsAzure.Management.Storage (classic) or Microsoft.Azure.Management.Storage (v2/ARM)
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "c#, azure, azure storage" }
Spark - SELECT WHERE or filtering? What's the difference between selecting with a where clause and filtering in Spark? Are there any use cases in which one is more appropriate than the other one? When do I use DataFrame newdf = df.select(df.col("*")).where(df.col("somecol").leq(10)) and when is DataFrame newdf = df.select(df.col("*")).filter("somecol <= 10") more appropriate?
According to spark documentation " **`where()` is an alias for `filter()`**" `filter(condition)` Filters rows using the given condition. `where()` is an alias for `filter()`. **Parameters** : condition – a `Column` of `types.BooleanType` or a string of SQL expression. >>> df.filter(df.age > 3).collect() [Row(age=5, name=u'Bob')] >>> df.where(df.age == 2).collect() [Row(age=2, name=u'Alice')] >>> df.filter("age > 3").collect() [Row(age=5, name=u'Bob')] >>> df.where("age = 2").collect() [Row(age=2, name=u'Alice')]
stackexchange-stackoverflow
{ "answer_score": 132, "question_score": 83, "tags": "apache spark, apache spark sql" }
VBA - multiply columns I am running a small VBA to loop through a range of rows (27 - 52) to return a simple multiplication of column D X column E to column F. My code below crashes Excel. Can anyone point out the obvious as to where i am going wrong. I am clearly no expert! Private Sub Worksheet_Change(ByVal Target As Range) For i = 27 To 52 Cells(i, 6) = Cells(i, 4) * Cells(i, 5) Next i End Sub Thanks
I don't see how it would "crash" Excel, abyway you don't need `Change(ByVal Target As Range)`so it's simply: Private Sub foo() For i = 27 To 52 Cells(i, 6).Value = Cells(i, 4).Value * Cells(i, 5).Value Next i End Sub
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 1, "tags": "excel, vba" }
Partitions and Indexes, in which cases should be used I know some knowledges: * Partitions used to achieve better performance (like described in this article) * And indexes used to increase performance in selection operations. And as result my question: in which cases i should use indexes and in which cases i should use partitioned tables. In other words what should be better in different operations(selections,deletions,updates) indexes or partitioning of table, and why. Thanks.
Easy: you should always use indexes. Partitioning for performance is probably the most misunderstood myth out there. When you partition, the best you can hope for is on-par performance with a non-partitioned table. And yes, that is _including_ partition elimination enhancements. Reducing table scans to partition scans because of missing indexes is simply _not the answer_. Replacing table scans with index seeks or index range scans it is a _much better_ the answer. Partitioning is a _great_ feature for data maintenance and administration and for efficient ETL switch-in and switch-out operations. For a good discussion of pros and cons of partitioning, see How To Decide if You Should Use Table Partitioning.
stackexchange-dba
{ "answer_score": 8, "question_score": 2, "tags": "sql server, partitioning, index" }
Pull live prices from web page I need to pull prices from a web page in order to use them inside a Java app. Any hint about how to do this would be welcome. An example of page: Futures
Had a look at source and it getting data from " interval 1 i think means i sec. But like amnesyc said mite not be a good idea.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "java" }
Mule Cloud Hub Deployment Error How can i resolved it? I have done flow Salesforce to JIRA. Its Working fine in Local machine. When i have deployment on cloud hub its not working Its show the error. The following end point URL i am using. <http:inbound-endpoint exchange-pattern="one-way" address=" doc:name="HTTP"/> This is not working when i am deploy on cloud hub. How can resolve this problem. After deployment this type of link came. `example.cloudhub.io`. At deployement time which type of endpoint URL i can give.
Use: <http:inbound-endpoint exchange-pattern="one-way" address=" doc:name="HTTP"/>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "salesforce, mule, jira, mule studio, mule el" }
How to pass list of file names to command `hindent --style johan-tibell --line-length 80 --indent-size 4 --sort-imports -XQuasiQuotes` accepts filename as argument but how can I pass list of files as I have variable `fileNames` that contains list of file names, I want to process each file using this command, can we do without any loop? **Edit:** The variable `fileNames` is declared using: fileNames=$((git diff --cached --name-only | grep -E '*.hs'))
You can loop over using command substitution and a `for` loop: for file in $( git diff --cached --name-only | grep -E '*.hs' ); do hindent --style johan-tibell --line-length 80 --indent-size 4 --sort-imports -XQuasiQuotes ${file} done
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "bash" }
Read CSV file in Pandas Python I'm trying to read CSV file. import pandas as pd df = pd.read_csv(r'C:\Users\San\TEMP OLSTP MECH AMT.csv') df.head() But when I show the dataset, it looks messed up. ![enter image description here]( contd. ![enter image description here]( **How to fix it? Is there any set up needed?**
Your data is `;`-sheared, you need to inform `pandas` about that, try import pandas as pd df = pd.read_csv(r'C:\Users\San\TEMP OLSTP MECH AMT.csv',sep=";") df.head() Read `pandas.read_csv` docs if you want to know more
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "python, pandas, csv, export to csv" }
Drupal 7 ckeditor relative path setup issue We are developing a site using drupal 7 So we created drupal site with name of myapp, so the url is < Also another developer is working for same site in his development machine with the name of myapp2 so its < I have installed ckeditor for rich content and configured relative path for inserting images. When I insert an image in myapp site the relative path comes like 'myapp/sites/all/files/images/img1.jpg' instead of 'sites/all/files/images/img1.jpg' hense when I share my database with my other team member uses myapp2 they are not able view the inserted images. their path looks like this 'myapp2/myapp/sites/all/files/images/img1.jpg' I have used pathologic to setup the two users urls in Text Format setting page like < and http//localhost/myapp2 but not works as expected. any one help me what else I can do to solve the issue.
Finally I tried the solution found by searching various sites. I put these two path items into text formats setting /myapp/ / now its working. :) So, since the other user who have myapp2 in his development system, there would chances for forming images path like myapp2/sites/..., hence we have to add more filter items like below /myapp2/ /
stackexchange-drupal
{ "answer_score": 0, "question_score": 0, "tags": "input formats" }
Try / Except, back to try I have this code def ID(): ID = input("Enter ID: ") try: int(ID) print("Good ID") except ValueError: print("Not a string") ID() how can I do to try again to input the ID without restarting the code?
You could use a while loop. There are several ways. Here is one: def ID(): goodID = False while not goodID: ID = input("Enter ID: ") try: int(ID) print("Good ID") goodID = True except ValueError: print("Not a string") # do you mean int?? ID() I would suggest to read also `this`.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "python 3.x" }
What's the parametric equation for the general form of an ellipse rotated by any amount? What's the parametric equation for the general form of an ellipse rotated by any amount? Preferably, as a computer scientist, how can this equation be derived from the three variables: coordinate of the center/two foci and eccentricity of an ellipse? I need to generate completely random eclipses within certain bounds. The variables I described above are most convenient. This is for a personal project of mine and I can't find anybody who can help me.
Let's start with the parametric equation for a circle centered at the origin with radius 1: > x(t) = cos 2πt > > y(t) = sin 2πt To turn this into an ellipse, we multiply it by a scaling matrix of the form | a 0 | | 0 b | which gives | a 0 | | x(t) | | a x(t) | | 0 b | * | y(t) | = | b y(t) | To rotate this by θ degrees, multiply it by the rotation matrix | cos θ -sin θ | | a x(t) | |a x(t) cos θ - b y(t) sin θ| | sin θ cos θ | * | b y(t) | = |a x(t) sin θ + b y(t) cos θ| So the new parametric equation would be > x'(t) = a x(t) cos θ - b y(t) sin θ = a cos 2πt cos θ \- b sin 2πt sin θ > > y'(t) = a x(t) sin θ + b y(t) sin θ = a cos 2πt sin θ + b sin 2πt cos θ You can then translate this to have center (x0, y0) by adding these components to the parametric components. Hope this helps!
stackexchange-math
{ "answer_score": 6, "question_score": 3, "tags": "conic sections" }
How to list all 'files with path' in a windows directory, including all sub-folders in Python? I am using Python 3.8.3 64bit with a flask framework. I am trying to create a list with its path of all files in a directory, including all sub-folders. My code is import os for root, dirs, files in os.walk('/slabs'): for f in files: print(os.path.join(root, f)) However when I print this out, I get all the files with their path and filenames that include the directory in the filename. For example, I get two entries: slabs\static\urlimages\1592684282.7557473.png slabs\static\urlimages1592684282.7557473.png There is no file called urlimages1592684282.7557473.png, only urlimages\1592684282.7557473.png How do I only get the files that actually exist or remove the entry that includes the directory and filename together? Thank You in advance.
import os path = os.walk(r'slabs', topdown=True) for root, dir, files in path: for f in files: print(os.path.join(root, f)) I hope this helps!
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python 3.x, windows, flask" }
Does the inverse of an $n \times n$ matrix with columns adding to 1 also have columns adding to 1? How would I go about showing that the inverse of an $n \times n$ matrix with columns adding to one also has columns adding to one?
Let $A$ be an invertible matrix all of whose columns sum to $1$. The condition is equivalent to $A^T\bf{1}=\bf{1}$, where $\bf{1}$ denotes the column vector of all ones. Multiplying through by the inverse transpose of $A$ yields ${\bf 1}=(A^{-1})^T\bf{1}$, which means that the inverse of $A$ satisfies the same condition, as desired.
stackexchange-math
{ "answer_score": 1, "question_score": -1, "tags": "linear algebra, matrices" }
Select last row within each group with dplyr is slow I have the following R code. Essentially, I am asking R to arrange the dataset based on postcode and paon, then group them by id, and finally keep only the last row within each group. However, R requires more than 3 hours to do this. I am not sure what I am doing wrong with my code since there is no for loop here. epc2 is a vector with 324,368 rows. epc3 <- epc2 %>% arrange(postcode, paon) %>% group_by(id) %>% do(tail(., 1)) Thank you for any and all of your help.
How about: mtcars %>% arrange(cyl) %>% group_by(cyl) %>% slice(n())
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "r, performance, dplyr" }
How to modify value of variable automatically at runtime when hitting a breakpoint and continuing execution in VS? We can change value manually by changing in variable tooltip or local/auto/watch window. But I want to change value of variable automatically to some specific hardcoded value or based on a code snippet. For eg.- int main() { int a=0,b=1,c=2; //bla bla for(int i=0; i<100; ++i) { executeMe(); } //bla bla } I want to put a breakpoint on line "executeMe()" and change value of 'b' to hardcoded value 3 or based on variable value 'c', so executing instruction 'b=c'. And continues execution without stopping everytime on breakpoint. How to do this in VS?
Use the 'Print a message:' option instead of a macro. Values from code can be printed by placing them inside {}. The key is that VS will also evaluate the content as an expression - so {variable_name=0} should achieve the same as the macro example. Thanks to Tom McKeown for this solution on stackoverflow.com/a/15415763/2328412
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c++, visual studio, debugging, watch" }
Execute an external command on startup I use vim regularily for all my needs. On very rare occasions I need to open binary files via a hex editor look, and for that I start vim on the file and then run it through xxd via the command: %!xxd My question is, how can I have my command line open a file directly in this manner, if the option exists? something like typing: `gvimbin <file>` and then it opens in the right manner. Edit: to be clear, I am looking for a complete solution that allows running vim exec commands on startup.
You can execute commands _after_ Vim startup by passing them via `-c`: $ gvim -c '%!xxd' file.bin This can even be simplified so that when Vim is started in _binary mode_ (`-b` argument), it'll automatically convert the file. Put the following into your `~/.vimrc`: if &binary %!xxd endif and start with: $ gvim -b file.bin Also have a look at the hexman.vim - Simpler Hex viewing and editing plugin; it makes it easier to deal with hexdumps.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "vim, hex editors" }
im getting blank space at left side and bottom of site im getting this blank space, i searched for similar questions and applied a number of solutions but none of them worked, i discover if i erase the containerCont div the problem dissapears, thanks I have already posted this question, with an url to the page itself, somebody told i should post a scan, but stack overflow requires at least 10 reputation to post images, so i dont know how to illustrate my problem so here is the url again: <
You have given `margin-top` and also `top` for footer. Removing `top:3px;` solves the problem. #downText { width: 272px; font-size: 13px; margin-top: 3px; position: relative; margin: 0 auto; }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "html, css, space" }
System classes while enabling Assertions, what are they? What do they mean with System classes in the following statement taken from the official documentation? > To enable assertions at various granularities, use the -enableassertions, or -ea, switch. To disable assertions at various granularities, use the -disableassertions, or -da, switch. You specify the granularity with the arguments that you provide to the switch: > > * no arguments > Enables or disables assertions in all classes except **system classes**. > * ... > (emphasis mine).
"System classes" are those loaded by the boot class loader. For all intents and purposes, this means the classes documented in the standard Java APIs.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "java, assertions" }
Blocks seem to store only txIDs, where does the transaction data come from for IBD? I know that blocks store transactions. After looking into a block, I can see that it only stores txIDs. **Question 1 - Where are actual transaction objects stored?** If you tell me that it's stored in a separate database called UTXO Set, I might say that the UTXO Set only stores an unspent transactions, what about spent transactions? **Question 2** If I join the network and I am new, my node starts syncing with other nodes to download the blockchain. But since each block only contains txIds, how does my node end up validating transactions (to validate, it needs to know if `from` address has the actual balance). Does it mean that nodes also broadcast UTXO databases too and if so, how and when? I'd appreciate a good explanation on this topic.
Blocks do not contain transcation ids at all, they contain the full transactions themselves. If you are using the `getblock` rpc and seeing txids, that's just because showing the details of all of the transactions is extremely verbose, so only the txids are output. You can see the full transaction details of a block by setting the second argument to `2`.
stackexchange-bitcoin
{ "answer_score": 4, "question_score": 0, "tags": "bitcoin core, transactions, blockchain, synchronization" }
Symbols leak into Global context when using Information **Bug persisting through 13.1.0 [CASE:4972508]** * * * When debugging I found the following peculiar behaviour of `Information`: $Version Do[ Remove["Global`*"]//Quiet; Information@ToExpression@str; Names["Global`*"]//Sow, {str,Alphabet[]} ]//Reap//Last//First//Column Remove["Global`*"]//Quiet; ![enter image description here]( Other context is ok: ![enter image description here]( Here is the result from my friend. ![enter image description here]( **Where are these unexpected symbols coming from?**
This is due to usage message, with which `Information` attempts to provide for user. tmp`list1 = Reap[Do[ Remove["Global`*"]//Quiet; Information@ToExpression@str; Names["Global`*"]//Sow, {str, Alphabet[]} ]][[2,1]]; Remove["Global`*"]//Quiet; tmp`list2 = Reap[Do[ Remove["Global`*"]//Quiet; MessageName[Evaluate@ToExpression@str, "usage"]; Names["Global`*"]//Sow, {str, Alphabet[]} ]][[2,1]]; tmp`list1 === tmp`list2 (* True *) These symbols seems all to be obsolete symbols with usage messages, even for those in `Global`: In[1]:= Global`HashTable::usage Out[1]= "HashTable is a part of the object which is returned by Dispatch." This is from `$InstallationDirectory/SystemFiles/Kernel/TextResources/ChineseSimplified/Usage.m` , `English` and `Japanese` seem to not have this problem. I've already reported this to WRI.
stackexchange-mathematica
{ "answer_score": 2, "question_score": 6, "tags": "bugs, front end, contexts, internals, usage messages" }
HTML in MVC RouteLink I have a RouteLink constructed like so <p class="articleLink"> @MvcHelper.Html.RouteLink(article.Title, "Article_Route", new RouteValueDictionary() { { "articleId", article.Id }, { "seoUrl", article.SeoUrl } })) </p> However, `article.Title` could potentially contain HTML i.e. the value could be `<em>Sample</em> Title` which in turn gets rendered like so <a href="/Article/111111/Sample-Title">&lt;em&gt;Sample&lt;/em&gt; Title</a> Is there any way to prevent the HTML from being escaped, and instead to be treated as actual HTML? Or do I need to create a standard HTML `<a href...` link in this case (thus losing all the niceties associated with the RouteLink helper).
If you want HTML inside your anchor don't use the `Html.RouteLink` (because it will HTML encode the link text by default as you noticed) instead of build your `a` tag by hand with using `Url.RouteUrl` to generate the url: <p class="articleLink"> <a href="@(Url.RouteUrl("Article_Route", new RouteValueDictionary() { { "articleId", article.Id }, { "seoUrl", article.SeoUrl } }))"> @Html.Raw(article.Title) </a> </p> Or you can create your own non encoding `RouteLink` helper.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 4, "tags": "asp.net mvc, asp.net mvc 3" }
adding an item to ul and maintiang sequence - jquery sortable i have a two `ul` lists out of which one contains strings and the other contains numbers.now i should be able to place the string any where between the lists but the sequence of the number should be maintained. string 1 1 2 2 3 string 4 3 4 initial state final state how to achieve this, when i make both the lists sortable users will be allowed to move the **numbers which shouldn't be allowed**. my implementation so far JSFIDDLE
You can add a class to the elements you don't want to allow to be dragged around. Here I added "noMove" as the class and then add them to the elements: JSFiddle: < $(function(){ $(' .tree').sortable({ connectWith :'.tree', cancel: '.noMove', start : function(){ $('.glyphicon').removeClass('glyphicon-chevron-right').addClass(' glyphicon-chevron-down'); $('ul.tree').fadeIn(300); } }); });
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, jquery ui, jquery ui sortable" }
Add item in allow list of the AVG or Norton antivirus using c# Is it possible to allow or restrict items using c# asp.net?
Using ASP.Net you can't modify client's system resources. I am not sure you if can do that using a desktop application with C#
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, asp.net, operating system, antivirus" }
Постановка знаков препинания в БСП _"Все они общались и шутили, но по их движениям, беглому взгляду было видно(:) каждый боялся за свою жизнь"._ Будет ли корректно поставить двоеточие?
_Все они общались и шутили, но по их движениям, беглому взгляду было видно —_ [что] _каждый боялся за свою жизнь._ Я бы поставила тире, потому что по смыслу не хватает союза "что". (Да и тире мне нравится больше — экспрессивно выглядит, солидно.) Вот что пишет Розенталь. 2\. В бессоюзном сложном предложении с изъяснительными отношениями встречается наряду с двоеточием также тире. Сравните: _И судьи решили: если будет дождь, соревнования отменят; Заметил первый камень, решил — здесь клад, стал ковыряться_ (Тендр.). § 72. Вариативные знаки препинания. Двоеточие — тире _Сразу было видно: Збруев и Неелова — пара_ (Д. Астрахан). _Сразу было видно — такой молодец не пропадет_ (Н. Бахрошин).
stackexchange-rus
{ "answer_score": 2, "question_score": 1, "tags": "пунктуация, двоеточие, бсп" }
$x^2+px+q=0$ where $p+q=2017$, find integers only $x_1$ and $x_2$ Using a program I found one pair only x1=-1 x2=-1008, maybe there are more, but I need a step by step mathematical solution.
By Vieta: $x_1+x_2=-p$ and $x_1x_2=q$ so: $x_1x_2-x_1-x_2+1=p+q+1=2018$ $(x_1-1)(x_2-1)=2018$ So you can get $x_1$ and $x_2$ by factoring $2018$. The prime factoring of $2018$ is $2\cdot 1009$ So $2018=(\pm 1)\cdot(\pm2018)=(\pm 2)\cdot (\pm 1009)$ Which gives you $8$ solutions: $(-1,-2017),(-2017,-1),(2,2019),(2019,2),(-1,-1008),(-1008,-1),(3,1010),(1010,3)$
stackexchange-math
{ "answer_score": 2, "question_score": -1, "tags": "quadratics" }
calculate earnings with numbers in lists within dictionary, python3 stock_listings = { 'GOOGL': [125, 772.88, 941.53], 'MSFT' : [85, 56.60, 73.04], } this dictionary is formatted as 'stock_name': [shares, purchase_price, current_price] I need to calculate earning from using numbers inside the dictionary and print out earnings.. earnings = shares * (current_price - purchase_price) how would you calculate and print out the earnings? your help is greatly appreciated! Thank you so much!
You can iterate over each stock in the stock_listings dictionary. An easy `print()` solution would be like: for each_stock in stock_listings.keys(): # iterates over each stock symbol in the stock_listings curr_stock_data = stock_listings[each_stock] # gets the current stock data from the listings curr_stock_earnings = (curr_stock_data[2]-curr_stock_data[1]) * curr_stock_data[0] # calculates this stock earnings with your formula print("The stock:", each_stock, ", earned: ", curr_stock_earnings) # outputs your result This will provide an output like: The stock: MSFT , earned: 1397.4000000000003 The stock: GOOGL , earned: 21081.249999999996
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python 3.x, dictionary" }
How to access gmail attachment from my application? I have seen some questions related this question, but i am not getting about getContentResolver().query(); method ; How it is related to gmail?,How to get file from gmail to my application without download the file
It's not possible directly we have to use external api like gmail api in java and integrate that gmail api to our android application here is the link for gmail api <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "android, email attachments" }
did the Garfield Kart 2013 online mode ever leave Beta? I have seen posts about garfield kart 2013 (not furious racing) having a steam online beta mode. Did it ever leave beta. Also, does it support LAN multiplayer? thnx =)
Following a quick search, the Discussion Board on the Steam page reveals that Multiplayer is only available in Beta Version, available from the game's 'Properties' menu in your Steam Library once you have bought it. This Multiplayer is, apparently, available in both 'local' and 'online' play.
stackexchange-gaming
{ "answer_score": 1, "question_score": -2, "tags": "steam, pc" }
How i can split comma separated string in a group using LINQ I have the string of comma separated ids like 1,2,3,4,5,6,7,8,9...... etc. Please suggest how i can split them in group of "Quantity" means if Quantity=3 then group are (List) ["1,2,3"], ["4,5,6"], ["7,8,9"] etc. Range of Quantity is from 1-75.
Try this: var quantity = 3; yourList.Select((x, i) => new { Index = i, Value = x }) .GroupBy(x => x.Index / quantity ) .Select(x => x.Select(v => v.Value).ToList()) .ToList();
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#, linq, collections" }
Google Play: App's not visible with its name, but with a part of its name? My Application is called "Notificator for Steam", when I search for it it gives me the Steam App and a lot of bs, like the App of a soccer team. When I search for just "Notificator", it's on place 20 or so. Any Tips or a reason for this? de.fosefx.steamnotificator
I think google take the words separately so it will take "Notificator","for" and "Steam". It will take the more popular tag so it will be Steam. Hope it helps.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "android, google play" }