qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
6,781,886
can anybody tell me that in c# why does char takes two bytes although it can be stored in one byte. Don't you think it is wastage of a memory. if not , then how is extra 1-byte used? in simple words ..please make me clear what is the use of extra 8-bits.!!
2011/07/21
[ "https://Stackoverflow.com/questions/6781886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/856755/" ]
> > although it can be stored in one byte > > > What makes you think that? It only takes one byte to represent every character in the English language, but other languages use other characters. Consider the number of different alphabets (Latin, Chinese, Arabic, Cyrillic...), and the number of symbols in each of t...
because utf-8 was probably still too young for microsoft to consider using it
354,899
I created this script to do date calculation between a date and today, but for some reason I get a decimal number. How can I just get the number of date without decimal point ? Tried to use a roundup formula but that's messy, what the best way to handle this? ``` set theDateWantedValue to "25/03/2019" set [dayVal, ...
2019/03/26
[ "https://apple.stackexchange.com/questions/354899", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/124098/" ]
Maybe using a different approach will accomplish what you were looking for? ``` set someDate to "09/ 09 / 2019" set theDate to date someDate set currentDate to (current date) set secondsBetweenDates to (theDate - currentDate) set timeInDays to (secondsBetweenDates div days) set timeInWeeks to (secondsBetweenDates div...
maybe adding " as integer" ? although that won't remove the negative sign ``` set dateDelaybetwentheDate to ((date (theDateWantedValue as string)) - (current date)) / days as integer ```
36,184,206
Basically I'm building an iOS app which allows users to track their moods throughout the month so that they can evaluate when they are most stressed and when they are most happy. Each day, users can write a block of information about the day and colour code each day so that in a list view they can quickly see how the ...
2016/03/23
[ "https://Stackoverflow.com/questions/36184206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5605583/" ]
As I have already commented, you will have to loop over array and compute html and set it. Your function `clearAndShow` will set last value only. I have taken liberty to update your code. You should not save data in different arrays. Its better to use one array with proper constructed object. [JSFiddle](https://jsfid...
Please try and change your js code like below, not the most elegant but a start: ``` function clearAndShow () { // Clear our fields titleInput.value = ""; nameInput.value = ""; ticketInput.value = ""; // Show our output messageBox.innerHTML = ""; messageBox.innerHTML += "<tr>"; messageBox.innerHTML +=...
36,184,206
Basically I'm building an iOS app which allows users to track their moods throughout the month so that they can evaluate when they are most stressed and when they are most happy. Each day, users can write a block of information about the day and colour code each day so that in a list view they can quickly see how the ...
2016/03/23
[ "https://Stackoverflow.com/questions/36184206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5605583/" ]
As I have already commented, you will have to loop over array and compute html and set it. Your function `clearAndShow` will set last value only. I have taken liberty to update your code. You should not save data in different arrays. Its better to use one array with proper constructed object. [JSFiddle](https://jsfid...
you deleted your last question about the numbering of authors, but I wrote a big answer to you for it. Just for you to have it : -------------------------------------------------------------------------------------------------------------------------------- Wow, man you have several problems in your logic. First, you...
36,184,206
Basically I'm building an iOS app which allows users to track their moods throughout the month so that they can evaluate when they are most stressed and when they are most happy. Each day, users can write a block of information about the day and colour code each day so that in a list view they can quickly see how the ...
2016/03/23
[ "https://Stackoverflow.com/questions/36184206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5605583/" ]
Please try and change your js code like below, not the most elegant but a start: ``` function clearAndShow () { // Clear our fields titleInput.value = ""; nameInput.value = ""; ticketInput.value = ""; // Show our output messageBox.innerHTML = ""; messageBox.innerHTML += "<tr>"; messageBox.innerHTML +=...
you deleted your last question about the numbering of authors, but I wrote a big answer to you for it. Just for you to have it : -------------------------------------------------------------------------------------------------------------------------------- Wow, man you have several problems in your logic. First, you...
2,335
I've been having problems compiling wolf's miners. Are there any pre-built linux miners, and if not, what are the packages that I need to fully build his CPU and GPU miners?
2016/10/15
[ "https://monero.stackexchange.com/questions/2335", "https://monero.stackexchange.com", "https://monero.stackexchange.com/users/727/" ]
No, and in my experience you shouldn't rely on anyone trying to give you compiled resources. For the CPU miner you would need at least "automake libcurl4-openssl-dev make", those are the names for Ubuntu. For the GPU miner if you are using R9 cards you can use these instructions. <https://www.reddit.com/r/Monero/comme...
For **CPU** Miner on linux, you can check Yam releases here: <https://mega.nz/#F!UlkU0RyR!E8n4CFkqVu0WoOnsJnQkSg> And for **GPU** releases, you could try Claymore v9.1, available here: <https://drive.google.com/drive/folders/0B69wv2iqszefdkVDNkxla3BCZHc> Note: Both are **closed source**.
2,335
I've been having problems compiling wolf's miners. Are there any pre-built linux miners, and if not, what are the packages that I need to fully build his CPU and GPU miners?
2016/10/15
[ "https://monero.stackexchange.com/questions/2335", "https://monero.stackexchange.com", "https://monero.stackexchange.com/users/727/" ]
No, and in my experience you shouldn't rely on anyone trying to give you compiled resources. For the CPU miner you would need at least "automake libcurl4-openssl-dev make", those are the names for Ubuntu. For the GPU miner if you are using R9 cards you can use these instructions. <https://www.reddit.com/r/Monero/comme...
There is no pre-built linux pool miner provided by the core team. You can only solo mine with the official binaries. For Wolf's CPU Miner, you need "libcurl4-openssl-dev make automake gcc" For his GPU Miner, You can refer to [this SE question](https://monero.stackexchange.com/q/1626/110)
2,335
I've been having problems compiling wolf's miners. Are there any pre-built linux miners, and if not, what are the packages that I need to fully build his CPU and GPU miners?
2016/10/15
[ "https://monero.stackexchange.com/questions/2335", "https://monero.stackexchange.com", "https://monero.stackexchange.com/users/727/" ]
No, and in my experience you shouldn't rely on anyone trying to give you compiled resources. For the CPU miner you would need at least "automake libcurl4-openssl-dev make", those are the names for Ubuntu. For the GPU miner if you are using R9 cards you can use these instructions. <https://www.reddit.com/r/Monero/comme...
Most pools maintain a "Getting started" page which includes a list of available miners, as well as startup instructions. Links to binaries (or to announcement pages which old those, to reasonably enough ensure the link is from the original author) are included. See for instance <http://monero.crypto-pool.fr/#getting_s...
2,335
I've been having problems compiling wolf's miners. Are there any pre-built linux miners, and if not, what are the packages that I need to fully build his CPU and GPU miners?
2016/10/15
[ "https://monero.stackexchange.com/questions/2335", "https://monero.stackexchange.com", "https://monero.stackexchange.com/users/727/" ]
For **CPU** Miner on linux, you can check Yam releases here: <https://mega.nz/#F!UlkU0RyR!E8n4CFkqVu0WoOnsJnQkSg> And for **GPU** releases, you could try Claymore v9.1, available here: <https://drive.google.com/drive/folders/0B69wv2iqszefdkVDNkxla3BCZHc> Note: Both are **closed source**.
There is no pre-built linux pool miner provided by the core team. You can only solo mine with the official binaries. For Wolf's CPU Miner, you need "libcurl4-openssl-dev make automake gcc" For his GPU Miner, You can refer to [this SE question](https://monero.stackexchange.com/q/1626/110)
2,335
I've been having problems compiling wolf's miners. Are there any pre-built linux miners, and if not, what are the packages that I need to fully build his CPU and GPU miners?
2016/10/15
[ "https://monero.stackexchange.com/questions/2335", "https://monero.stackexchange.com", "https://monero.stackexchange.com/users/727/" ]
For **CPU** Miner on linux, you can check Yam releases here: <https://mega.nz/#F!UlkU0RyR!E8n4CFkqVu0WoOnsJnQkSg> And for **GPU** releases, you could try Claymore v9.1, available here: <https://drive.google.com/drive/folders/0B69wv2iqszefdkVDNkxla3BCZHc> Note: Both are **closed source**.
Most pools maintain a "Getting started" page which includes a list of available miners, as well as startup instructions. Links to binaries (or to announcement pages which old those, to reasonably enough ensure the link is from the original author) are included. See for instance <http://monero.crypto-pool.fr/#getting_s...
2,335
I've been having problems compiling wolf's miners. Are there any pre-built linux miners, and if not, what are the packages that I need to fully build his CPU and GPU miners?
2016/10/15
[ "https://monero.stackexchange.com/questions/2335", "https://monero.stackexchange.com", "https://monero.stackexchange.com/users/727/" ]
There is no pre-built linux pool miner provided by the core team. You can only solo mine with the official binaries. For Wolf's CPU Miner, you need "libcurl4-openssl-dev make automake gcc" For his GPU Miner, You can refer to [this SE question](https://monero.stackexchange.com/q/1626/110)
Most pools maintain a "Getting started" page which includes a list of available miners, as well as startup instructions. Links to binaries (or to announcement pages which old those, to reasonably enough ensure the link is from the original author) are included. See for instance <http://monero.crypto-pool.fr/#getting_s...
34,290,418
I have created a wallboard application for a service desk team, which uses WPF for front-end and the Cisco database of the phones in the back-end. The application is made of two screens that show different information, and these are displayed in the same screen and change between each other with a `System.Timers.Timer`...
2015/12/15
[ "https://Stackoverflow.com/questions/34290418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2141621/" ]
It sounds like you're writing a kiosk application (ie. full-screen, non-interactive). If this is the case I think you would be better off having a single window and switching the views inside it, rather than switching between two separate windows. Also, you need to separate the database query work from the refreshing o...
Try to use `Dispatcher.CurrentDispatcher` instead of `window.Dispatcher` and BeginInvoke: ``` Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.DataBind, new Action(() => { window.Visibility = visibility; })); ``` **Updated** Switch your timer to DispatcherTimer: ``` timer = new Dispatcher...
24,961
From the start of the game what is the longest possible series of consecutive white moves where white can do those moves no matter what black does? So I want the longest list of moves white can do after starting the game no matter what moves black does. So what is the maximum number of moves he can plan ahead and be s...
2019/07/24
[ "https://chess.stackexchange.com/questions/24961", "https://chess.stackexchange.com", "https://chess.stackexchange.com/users/19618/" ]
Three moves. On move 3, Black can crash through with his queen on f2 or d2 via several different squares, forcing White to respond. There is no series of White moves that can prevent all such checks. ``` [FEN ""] 1. Nf3 (1. e3 e5 2. c3 Qf6 3. g3 Qxf2+) 1... c6 (1... e5 2. c3 Qh4 3. e3 Qxf2+) 2. g3 Qa5 (2... Qb6 3. c...
The accepted answer gives the correct number, but is incomplete. It's true that Black can always force either 3. ... Q(x)d2+ or 3. ... Q(x)f2+. However, what if White could choose a fourth move that is valid even if such a check is made? The only possible options are 4. Kd1, 4. Kf1, 4. Kd2 or 4. Kf2. It turns out that ...
42,280,058
as the title says I'm getting an error code when I attempt render one of my website pages. Here are the parts of the traceback that are pointing to my code: ``` File "/vagrant/catalog/project.py", line 48, in newMenuItem return render_template('newMenuItem.html', restaurant_id=restaurant.id) File "/vagrant/...
2017/02/16
[ "https://Stackoverflow.com/questions/42280058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7416542/" ]
So create it like this ``` $file = date('Ymd') . '-dumpDB.sql.gz'; system(sprintf( 'mysqldump --no-tablespaces --opt -h%s -u%s -p"%s" %s | gzip > %s/%s', $host, $user, $pass, $db, getenv('DOCUMENT_ROOT'), $file )); ```
this should work... it just appends the date to the filename. ``` system(sprintf( 'mysqldump --no-tablespaces --opt -h%s -u%s -p"%s" %s | gzip > %s/%s-dumpDB.sql.gz', $host, $user, $pass, $db, getenv('DOCUMENT_ROOT'), date("Ymd") )); ```
42,280,058
as the title says I'm getting an error code when I attempt render one of my website pages. Here are the parts of the traceback that are pointing to my code: ``` File "/vagrant/catalog/project.py", line 48, in newMenuItem return render_template('newMenuItem.html', restaurant_id=restaurant.id) File "/vagrant/...
2017/02/16
[ "https://Stackoverflow.com/questions/42280058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7416542/" ]
So create it like this ``` $file = date('Ymd') . '-dumpDB.sql.gz'; system(sprintf( 'mysqldump --no-tablespaces --opt -h%s -u%s -p"%s" %s | gzip > %s/%s', $host, $user, $pass, $db, getenv('DOCUMENT_ROOT'), $file )); ```
Use `date('Ymd')` output: `20170216` ``` $file = date('Ymd') . '-dumpDB.sql.gz'; //20170216-dumpDB.sql.gz system(sprintf( 'mysqldump --no-tablespaces --opt -h%s -u%s -p"%s" %s | gzip > %s/%s', $host, $user, $pass, $db, getenv('DOCUMENT_ROOT'), $file )); ```
36,225,212
I am implementing a Huffman encoder. Huffman trees are built bottom-up using a priority queue. I have a simple node class with pointers to two other nodes. The loop that builds the tree is: ``` while(q.size() > 1) { huffnode n1 = q.top(); q.pop(); huffnode n2 = q.top(); q.pop(); q.push(huffnode((c...
2016/03/25
[ "https://Stackoverflow.com/questions/36225212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3043521/" ]
When you have the curly braces `{}` you are in a new scope. and variables declared in that scope are local to that scope and only valid inside that scope. When the scope ends, which for you your loop is every time the loop iterates, the scope disappears and the variables in that scope are destructed and exists no more....
C++ does not have garbage collection, and does not allocate objects on the heap unless you tell it to -- you need to manage your memory yourself. If you want to build a dynamically allocated tree, you need to allocate your nodes on the heap explicitly, by using `new` or some higher-level library facility. You will als...
36,225,212
I am implementing a Huffman encoder. Huffman trees are built bottom-up using a priority queue. I have a simple node class with pointers to two other nodes. The loop that builds the tree is: ``` while(q.size() > 1) { huffnode n1 = q.top(); q.pop(); huffnode n2 = q.top(); q.pop(); q.push(huffnode((c...
2016/03/25
[ "https://Stackoverflow.com/questions/36225212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3043521/" ]
When you have the curly braces `{}` you are in a new scope. and variables declared in that scope are local to that scope and only valid inside that scope. When the scope ends, which for you your loop is every time the loop iterates, the scope disappears and the variables in that scope are destructed and exists no more....
comingstorm is right. I need to use `new`. The fixed code is ``` while(q.size() > 1) { huffnode* n1 = new huffnode(q.top().data, q.top().freq, q.top().left, q.top().right); q.pop(); huffnode* n2 = new huffnode(q.top().data, q.top().freq, q.top().left, q.top().right); q.pop(); q.push(huffnode((ch...
11,436,755
Here's what I am trying to write: ``` public void Foo<T>(T parameter) { otherObject.Bar<T>(parameter); } ``` The signature of the Bar() method is: ``` public void Bar<T>(T parameter) where T: class ``` So I get a compile error because the T in Foo's signature doesn't have the same constraint. Unfortunately I c...
2012/07/11
[ "https://Stackoverflow.com/questions/11436755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38908/" ]
You can use the [`dynamic` keyword](http://msdn.microsoft.com/en-us/library/dd264741.aspx) like this: ``` public void Foo<T>(T parameter) { dynamic p = parameter otherObject.Bar(p); } ``` What's happening is that the resolution of the call to `otherObject.Bar` is being made at run-time, because one of the p...
``` public void Foo<T>(T parameter) { otherObject.Bar<object>(parameter); } ```
11,436,755
Here's what I am trying to write: ``` public void Foo<T>(T parameter) { otherObject.Bar<T>(parameter); } ``` The signature of the Bar() method is: ``` public void Bar<T>(T parameter) where T: class ``` So I get a compile error because the T in Foo's signature doesn't have the same constraint. Unfortunately I c...
2012/07/11
[ "https://Stackoverflow.com/questions/11436755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38908/" ]
You can use the [`dynamic` keyword](http://msdn.microsoft.com/en-us/library/dd264741.aspx) like this: ``` public void Foo<T>(T parameter) { dynamic p = parameter otherObject.Bar(p); } ``` What's happening is that the resolution of the call to `otherObject.Bar` is being made at run-time, because one of the p...
If you are the owner of otherObject.Bar, could you not just remove the class constraint? of that method. Or create a new similar method without the constraint? casperOne. I am not sure your answer is correct, as you have the class constraint on your Foo method. The question stated that this was not possible as Foo was...
11,436,755
Here's what I am trying to write: ``` public void Foo<T>(T parameter) { otherObject.Bar<T>(parameter); } ``` The signature of the Bar() method is: ``` public void Bar<T>(T parameter) where T: class ``` So I get a compile error because the T in Foo's signature doesn't have the same constraint. Unfortunately I c...
2012/07/11
[ "https://Stackoverflow.com/questions/11436755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38908/" ]
You can use the [`dynamic` keyword](http://msdn.microsoft.com/en-us/library/dd264741.aspx) like this: ``` public void Foo<T>(T parameter) { dynamic p = parameter otherObject.Bar(p); } ``` What's happening is that the resolution of the call to `otherObject.Bar` is being made at run-time, because one of the p...
Here's a slightly different take on casperOne's answer, using implicit interface implementation: ``` public void Foo<T>(T parameter) where T: class { otherObject.Bar<T>(parameter); } void IFoo.Foo<T>(T parameter){ Foo((dynamic)parameter); } ``` This allows you to include the constraint on anything that know...
11,436,755
Here's what I am trying to write: ``` public void Foo<T>(T parameter) { otherObject.Bar<T>(parameter); } ``` The signature of the Bar() method is: ``` public void Bar<T>(T parameter) where T: class ``` So I get a compile error because the T in Foo's signature doesn't have the same constraint. Unfortunately I c...
2012/07/11
[ "https://Stackoverflow.com/questions/11436755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38908/" ]
``` public void Foo<T>(T parameter) { otherObject.Bar<object>(parameter); } ```
If you are the owner of otherObject.Bar, could you not just remove the class constraint? of that method. Or create a new similar method without the constraint? casperOne. I am not sure your answer is correct, as you have the class constraint on your Foo method. The question stated that this was not possible as Foo was...
11,436,755
Here's what I am trying to write: ``` public void Foo<T>(T parameter) { otherObject.Bar<T>(parameter); } ``` The signature of the Bar() method is: ``` public void Bar<T>(T parameter) where T: class ``` So I get a compile error because the T in Foo's signature doesn't have the same constraint. Unfortunately I c...
2012/07/11
[ "https://Stackoverflow.com/questions/11436755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38908/" ]
Here's a slightly different take on casperOne's answer, using implicit interface implementation: ``` public void Foo<T>(T parameter) where T: class { otherObject.Bar<T>(parameter); } void IFoo.Foo<T>(T parameter){ Foo((dynamic)parameter); } ``` This allows you to include the constraint on anything that know...
If you are the owner of otherObject.Bar, could you not just remove the class constraint? of that method. Or create a new similar method without the constraint? casperOne. I am not sure your answer is correct, as you have the class constraint on your Foo method. The question stated that this was not possible as Foo was...
2,659,908
If I convert a UTC datetime to swedish format, summertime is included (CEST). However, while creating a datetime with sweden as the timezone, it gets CET instead of CEST. Why is this? ``` >>> # Modified for readability >>> import pytz >>> import datetime >>> sweden = pytz.timezone('Europe/Stockholm') >>> >>> datetime....
2010/04/17
[ "https://Stackoverflow.com/questions/2659908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/311998/" ]
The `sweden` object specifies the CET time zone by default but contains enough information to know when CEST starts and stop. In the first example, you create a `datetime` object and convert it to local time. The `sweden` object knows that the UTC time you passed occurs during daylight savings time and can convert it ...
Timezone abbreviations are not unique. For example "IST" could refer to "Irish Standard Time", "Iranian Standard Time", "Indian Standard Time" or "Isreali Standard Time". You shouldn't rely on parsing that, and instead should use zoneinfo timezones.
18,062,063
How do i pass a bool from the viewmodel to the view and change the value. For example in my viewmodel i have created a bool ``` public bool load { get { return m_load; } set { m_load = value; OnPropertyChanged(this, o => o.load); } } ``` I then have my `SelectedVm` code ``` public Vi...
2013/08/05
[ "https://Stackoverflow.com/questions/18062063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2653666/" ]
Ok if you want to get value of Load in View and you want to do it in pure MVVM pattern then create DependencyProperty of bool type in View and Bind it to Load property of VM like ``` public partial class MainWindow : Window { public static readonly DependencyProperty LoadProperty = DependencyProperty.Register("MyC...
The code you published ensures that `Load()` is being called once, even with multiple bindings. If I understand your real question correctly, you are actually asking for a way to make sure that each `SelectedVM` is calling `Load()` function once, and only once. Right? if that so, you need to add a bool property to ...
54,008,357
I am looking to sort a string list numerically which has both string and number also as a string. ['har 1', 'zee 3'] expected output : zee 3 har 1
2019/01/02
[ "https://Stackoverflow.com/questions/54008357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9510689/" ]
I found 2 problems: * The Q3 recursion only starts from cells in the top row and the right-most column. It should start from every cell. So simply loop all cells using 2 for loops instead of using recursion (although that could be done too, of course). * 2 of the if statements were wrong. See `>= 0` in 2 of the if sta...
I think you need to rethink your strategy. I'm guessing your code is not doing what you want it to do. This is what happens in your code: The method recursion will first call itself five times because of the first if statement (col) and then five times because of the second if statement (row). Then it will call Q3 a f...
4,203,607
I have stuck in a point when I convert a psd to html/css The page is this : <http://valogiannis.com/freelancer/neurosport/editdetails.html> Below the title "Edit Account Details" I have a table to show the user data. I have I have the following rule for the rows ``` #editAccountDetails tr { border-bottom:#cdd3e...
2010/11/17
[ "https://Stackoverflow.com/questions/4203607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407382/" ]
The reason you cant see your borders is because this is in your reset.css ``` table { border-collapse: collapse } ``` add in this to your css ``` #editAccountDetails table { border-collapse: seperate } ``` You will also need to remove the borders from the tr to the td ``` #editAccountDetails td { border-bott...
``` table { border-collapse: collapse } ``` try this
4,203,607
I have stuck in a point when I convert a psd to html/css The page is this : <http://valogiannis.com/freelancer/neurosport/editdetails.html> Below the title "Edit Account Details" I have a table to show the user data. I have I have the following rule for the rows ``` #editAccountDetails tr { border-bottom:#cdd3e...
2010/11/17
[ "https://Stackoverflow.com/questions/4203607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407382/" ]
``` table { border-collapse: collapse } ``` try this
Simply put borders on the TD instead of TR and all will be well :-) ``` #editAccountDetails tr td { border-bottom:#cdd3e0 solid 1px; border-top:#fff solid 1px; line-height:3; } ```
4,203,607
I have stuck in a point when I convert a psd to html/css The page is this : <http://valogiannis.com/freelancer/neurosport/editdetails.html> Below the title "Edit Account Details" I have a table to show the user data. I have I have the following rule for the rows ``` #editAccountDetails tr { border-bottom:#cdd3e...
2010/11/17
[ "https://Stackoverflow.com/questions/4203607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407382/" ]
The reason you cant see your borders is because this is in your reset.css ``` table { border-collapse: collapse } ``` add in this to your css ``` #editAccountDetails table { border-collapse: seperate } ``` You will also need to remove the borders from the tr to the td ``` #editAccountDetails td { border-bott...
Simply put borders on the TD instead of TR and all will be well :-) ``` #editAccountDetails tr td { border-bottom:#cdd3e0 solid 1px; border-top:#fff solid 1px; line-height:3; } ```
2,891,766
I typed this into Google, but I only found how-tos in C++. How can I do it in C?
2010/05/23
[ "https://Stackoverflow.com/questions/2891766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/335325/" ]
Plain old C doesn't actually support exceptions natively. You can use alternative error handling strategies, such as: * returning an error code * returning `FALSE` and using a `last_error` variable or function. See <http://en.wikibooks.org/wiki/C_Programming/Error_handling>.
In C we can't use try case to handle the error. but if you can use Windows.h so you can: ``` #include <stdio.h> #include <Windows.h> #include <setjmp.h> jmp_buf Buf; NTAPI Error_Handler(struct _EXCEPTION_POINTERS *ExceptionInfo) { printf("co loi roi ban oi.!!!\r\n"); longjmp(Buf, 1); } void main() { AddV...
2,891,766
I typed this into Google, but I only found how-tos in C++. How can I do it in C?
2010/05/23
[ "https://Stackoverflow.com/questions/2891766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/335325/" ]
In C you could use the combination of the `setjmp()` and `longjmp()` functions, defined in `setjmp.h`. [Example from Wikipedia](http://en.wikipedia.org/wiki/Setjmp.h) ``` #include <stdio.h> #include <setjmp.h> static jmp_buf buf; void second(void) { printf("second\n"); // prints longjmp(buf,1); ...
C is able to throw C++ exceptions. It is machine code anyway. For example, in file *bar.c*: ``` #include <stdlib.h> #include <stdint.h> extern void *__cxa_allocate_exception(size_t thrown_size); extern void __cxa_throw (void *thrown_exception, void* *tinfo, void (*dest) (void *) ); extern void * _ZTIl; // typeinfo o...
2,891,766
I typed this into Google, but I only found how-tos in C++. How can I do it in C?
2010/05/23
[ "https://Stackoverflow.com/questions/2891766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/335325/" ]
There's no *built-in* exception mechanism in C; you need to *simulate* exceptions and their semantics. This is usually achieved by relying on `setjmp` and `longjmp`. There are quite a few libraries around, and I'm implementing yet another one. It's called [exceptions4c](http://code.google.com/p/exceptions4c/); it's po...
On Windows with **Microsoft Visual C++** (MSVC) there's `__try ... __except ...`, but it's really horrible and you don't want to use it if you can possibly avoid it. Better to say that there are no exceptions.
2,891,766
I typed this into Google, but I only found how-tos in C++. How can I do it in C?
2010/05/23
[ "https://Stackoverflow.com/questions/2891766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/335325/" ]
Plain old C doesn't actually support exceptions natively. You can use alternative error handling strategies, such as: * returning an error code * returning `FALSE` and using a `last_error` variable or function. See <http://en.wikibooks.org/wiki/C_Programming/Error_handling>.
On Windows with **Microsoft Visual C++** (MSVC) there's `__try ... __except ...`, but it's really horrible and you don't want to use it if you can possibly avoid it. Better to say that there are no exceptions.
2,891,766
I typed this into Google, but I only found how-tos in C++. How can I do it in C?
2010/05/23
[ "https://Stackoverflow.com/questions/2891766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/335325/" ]
This question is super old, but I just stumbled across it and thought I'd share a technique: divide by zero, or dereference a null pointer. The question is simply "how to throw", not how to catch, or even how to throw a specific type of exception. I had a situation ages ago where we needed to trigger an exception fro...
If you write code with the *[happy path](https://en.wikipedia.org/wiki/Happy_path)* design pattern (for example, for an embedded device) you may simulate exception error processing (AKA deffering or finally emulation) with operator "goto". ``` int process(int port) { int rc; int fd1; int fd2; fd1 = op...
2,891,766
I typed this into Google, but I only found how-tos in C++. How can I do it in C?
2010/05/23
[ "https://Stackoverflow.com/questions/2891766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/335325/" ]
In C you could use the combination of the `setjmp()` and `longjmp()` functions, defined in `setjmp.h`. [Example from Wikipedia](http://en.wikipedia.org/wiki/Setjmp.h) ``` #include <stdio.h> #include <setjmp.h> static jmp_buf buf; void second(void) { printf("second\n"); // prints longjmp(buf,1); ...
C doesn't have exceptions. There are various hacky implementations that try to do it (one example at: <http://adomas.org/excc/>).
2,891,766
I typed this into Google, but I only found how-tos in C++. How can I do it in C?
2010/05/23
[ "https://Stackoverflow.com/questions/2891766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/335325/" ]
In C you could use the combination of the `setjmp()` and `longjmp()` functions, defined in `setjmp.h`. [Example from Wikipedia](http://en.wikipedia.org/wiki/Setjmp.h) ``` #include <stdio.h> #include <setjmp.h> static jmp_buf buf; void second(void) { printf("second\n"); // prints longjmp(buf,1); ...
This question is super old, but I just stumbled across it and thought I'd share a technique: divide by zero, or dereference a null pointer. The question is simply "how to throw", not how to catch, or even how to throw a specific type of exception. I had a situation ages ago where we needed to trigger an exception fro...
2,891,766
I typed this into Google, but I only found how-tos in C++. How can I do it in C?
2010/05/23
[ "https://Stackoverflow.com/questions/2891766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/335325/" ]
There are no exceptions in C. In C the errors are notified by the returned value of the function, the exit value of the process, signals to the process ([Program Error Signals (GNU libc)](http://www.gnu.org/software/libc/manual/html_node/Program-Error-Signals.html)) or the CPU hardware interruption (or other notificati...
Plain old C doesn't actually support exceptions natively. You can use alternative error handling strategies, such as: * returning an error code * returning `FALSE` and using a `last_error` variable or function. See <http://en.wikibooks.org/wiki/C_Programming/Error_handling>.
2,891,766
I typed this into Google, but I only found how-tos in C++. How can I do it in C?
2010/05/23
[ "https://Stackoverflow.com/questions/2891766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/335325/" ]
C is able to throw C++ exceptions. It is machine code anyway. For example, in file *bar.c*: ``` #include <stdlib.h> #include <stdint.h> extern void *__cxa_allocate_exception(size_t thrown_size); extern void __cxa_throw (void *thrown_exception, void* *tinfo, void (*dest) (void *) ); extern void * _ZTIl; // typeinfo o...
As mentioned in numerous threads, the "standard" way of doing this is using setjmp/longjmp. I posted yet another such solution to <https://github.com/psevon/exceptions-and-raii-in-c> This is to my knowledge the only solution that relies on automatic cleanup of allocated resources. It implements unique and shared smartp...
2,891,766
I typed this into Google, but I only found how-tos in C++. How can I do it in C?
2010/05/23
[ "https://Stackoverflow.com/questions/2891766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/335325/" ]
On Windows with **Microsoft Visual C++** (MSVC) there's `__try ... __except ...`, but it's really horrible and you don't want to use it if you can possibly avoid it. Better to say that there are no exceptions.
In C we can't use try case to handle the error. but if you can use Windows.h so you can: ``` #include <stdio.h> #include <Windows.h> #include <setjmp.h> jmp_buf Buf; NTAPI Error_Handler(struct _EXCEPTION_POINTERS *ExceptionInfo) { printf("co loi roi ban oi.!!!\r\n"); longjmp(Buf, 1); } void main() { AddV...
41,060
In [this question](https://chinese.stackexchange.com/q/34152/4709), we can clearly see the origin of 巨 is 矩, which is originally formed from 工 + 大 (corrupted into 矢). However, nowadays 巨 has lost the left hand side of 工, and so naturally the radical appears to be "匚". Some dictionaries list 巨 as having `工`, and some a...
2020/09/04
[ "https://chinese.stackexchange.com/questions/41060", "https://chinese.stackexchange.com", "https://chinese.stackexchange.com/users/4709/" ]
Since radicals are dictionary headers, "what is the radical of X" is dependent on the dictionary you're looking at. The most internationally-agreed-upon dictionary radicals for Chinese characters would be the [Kangxi Dictionary](https://en.wikipedia.org/wiki/Kangxi_Dictionary), which lists it under 「工」. Thankfully, mo...
first of all, **don’t fixated on regular script (楷書)**, read and think on bronze script or seal script; please. look at the [components semantic tree (部件樹):](http://humanum.arts.cuhk.edu.hk/Lexis/lexi-mf/search.php?word=%E7%9F%A9) 矩 is 大 + 人 + 工 [![enter image description here](https://i.stack.imgur.com/vAm7V.png)](...
11,991,062
In chrome browser, when using this snippet: ``` $(document).on('keyup', function(){ alert("Hey"); }); ``` Every time I press `enter` in the url bar (for example when I cut and paste the url of the page itself) the event listener fires. Why does it happen? **EDIT:** It surprised me because url bar is not in...
2012/08/16
[ "https://Stackoverflow.com/questions/11991062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/240338/" ]
This happens because once you hit enter in the omnibox, the focus turns to the page. If you tried the same thing with `onkeydown`, the omnibox would change nothing, because as you said, it isn't a part of the document. One way to filter the omnibox's false event out would be to check that every `keyup` has a pair keydo...
You could filter for the keycode ...if that helps...13 is enter key ``` $(document).on('keyup', function(event){ if( parseInt(event.keyCode,10) !== 13 ){ alert("Hey"); } });​ ```
11,991,062
In chrome browser, when using this snippet: ``` $(document).on('keyup', function(){ alert("Hey"); }); ``` Every time I press `enter` in the url bar (for example when I cut and paste the url of the page itself) the event listener fires. Why does it happen? **EDIT:** It surprised me because url bar is not in...
2012/08/16
[ "https://Stackoverflow.com/questions/11991062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/240338/" ]
The solution for Chrome is simple: use `keypress` instead of `keyup`. This doesn't work in all cases (IE), so you may have to add a conditional to switch the type depending on the browser. However, this will solve your issue. Note that looking for a specific keycode may negate your issue. Good luck.
You could filter for the keycode ...if that helps...13 is enter key ``` $(document).on('keyup', function(event){ if( parseInt(event.keyCode,10) !== 13 ){ alert("Hey"); } });​ ```
11,991,062
In chrome browser, when using this snippet: ``` $(document).on('keyup', function(){ alert("Hey"); }); ``` Every time I press `enter` in the url bar (for example when I cut and paste the url of the page itself) the event listener fires. Why does it happen? **EDIT:** It surprised me because url bar is not in...
2012/08/16
[ "https://Stackoverflow.com/questions/11991062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/240338/" ]
You could filter for the keycode ...if that helps...13 is enter key ``` $(document).on('keyup', function(event){ if( parseInt(event.keyCode,10) !== 13 ){ alert("Hey"); } });​ ```
A possible solution is to slightly delay the "keyup" event handler registration. This will skip the first "spurious" trigger that seems to happen in Chrome and Safari. ``` $(function() { setTimeout( function() { console.log("Delayed event attachment"); $(document).bind('keyup', log)...
11,991,062
In chrome browser, when using this snippet: ``` $(document).on('keyup', function(){ alert("Hey"); }); ``` Every time I press `enter` in the url bar (for example when I cut and paste the url of the page itself) the event listener fires. Why does it happen? **EDIT:** It surprised me because url bar is not in...
2012/08/16
[ "https://Stackoverflow.com/questions/11991062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/240338/" ]
This happens because once you hit enter in the omnibox, the focus turns to the page. If you tried the same thing with `onkeydown`, the omnibox would change nothing, because as you said, it isn't a part of the document. One way to filter the omnibox's false event out would be to check that every `keyup` has a pair keydo...
The solution for Chrome is simple: use `keypress` instead of `keyup`. This doesn't work in all cases (IE), so you may have to add a conditional to switch the type depending on the browser. However, this will solve your issue. Note that looking for a specific keycode may negate your issue. Good luck.
11,991,062
In chrome browser, when using this snippet: ``` $(document).on('keyup', function(){ alert("Hey"); }); ``` Every time I press `enter` in the url bar (for example when I cut and paste the url of the page itself) the event listener fires. Why does it happen? **EDIT:** It surprised me because url bar is not in...
2012/08/16
[ "https://Stackoverflow.com/questions/11991062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/240338/" ]
This happens because once you hit enter in the omnibox, the focus turns to the page. If you tried the same thing with `onkeydown`, the omnibox would change nothing, because as you said, it isn't a part of the document. One way to filter the omnibox's false event out would be to check that every `keyup` has a pair keydo...
A possible solution is to slightly delay the "keyup" event handler registration. This will skip the first "spurious" trigger that seems to happen in Chrome and Safari. ``` $(function() { setTimeout( function() { console.log("Delayed event attachment"); $(document).bind('keyup', log)...
11,991,062
In chrome browser, when using this snippet: ``` $(document).on('keyup', function(){ alert("Hey"); }); ``` Every time I press `enter` in the url bar (for example when I cut and paste the url of the page itself) the event listener fires. Why does it happen? **EDIT:** It surprised me because url bar is not in...
2012/08/16
[ "https://Stackoverflow.com/questions/11991062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/240338/" ]
The solution for Chrome is simple: use `keypress` instead of `keyup`. This doesn't work in all cases (IE), so you may have to add a conditional to switch the type depending on the browser. However, this will solve your issue. Note that looking for a specific keycode may negate your issue. Good luck.
A possible solution is to slightly delay the "keyup" event handler registration. This will skip the first "spurious" trigger that seems to happen in Chrome and Safari. ``` $(function() { setTimeout( function() { console.log("Delayed event attachment"); $(document).bind('keyup', log)...
30,961,582
I am doing a project for Data Structures. I need to have the user input Strings into a doubly linked list using bufferedReader, where -1 terminates the stream and displays the list. Here is what I have so far. Every input I enter is throwing an exception and closing the Stream. Where am I going wrong? ``` public class...
2015/06/21
[ "https://Stackoverflow.com/questions/30961582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2959353/" ]
Here you go, you had a bunch of mistakes, 1. Missing out a brace. 2. Closing the stream inside the loop. (How are you going to read input in the next iteration?) 3. `displayList` did not take any arguments (How will print the `LinkedList` if it doesn’t have any references to it? 4. Last but not the least, you didn’t e...
Your while should look like this: ``` System.out.println("Enter a String, then press enter."); while (!(inputString = in.readLine()).equals("-1")) { if (in.readLine().equals("")) { // filter empty lines, user probably hit enter twice continue; } // add inputString to the list System.out.println...
30,961,582
I am doing a project for Data Structures. I need to have the user input Strings into a doubly linked list using bufferedReader, where -1 terminates the stream and displays the list. Here is what I have so far. Every input I enter is throwing an exception and closing the Stream. Where am I going wrong? ``` public class...
2015/06/21
[ "https://Stackoverflow.com/questions/30961582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2959353/" ]
Here you go, you had a bunch of mistakes, 1. Missing out a brace. 2. Closing the stream inside the loop. (How are you going to read input in the next iteration?) 3. `displayList` did not take any arguments (How will print the `LinkedList` if it doesn’t have any references to it? 4. Last but not the least, you didn’t e...
You need to make 2 changes: 1. Change: ``` inputString.equals(-1) // A String cannot be equal to an integer. ``` to ``` inputString.equals("-1") ``` 2. To break out of the loop if user enters `-1`, add a `break;` statement after `displayList()`. ### Then you asked ``` DoublyLinkedList list = new Doubly...
21,612,120
I am trying to create 3 different .png images in R and save them to 3 different files - all at once. The following code creates 1 image and then stops. Why not the other 2 images? **“MatrixFunction”** is my own function that requires a df, column numbers, title. Each test type is also the name of a data frame. Than...
2014/02/06
[ "https://Stackoverflow.com/questions/21612120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3130947/" ]
You are overwriting your file over and over again. There's an obvious typo: `mypath <- paste("testing", i)`. In that case, you will create tree separate files instead of one.
Avoid `for`-loops in `R`. They are notorious slow. If you create your method as a function, it is easier to check for errors and you can apply `lapply` or `sapply` to it, ``` testtype <- list("Grade4TopBottom", "Grade8TopBottom", "HSPATopBottom") make.image <- function(n) { obj <- mget(n, ifnotfound=NA)[[1]] ...
2,964,913
I've made an MSBuild project that simply does an msbuild task with our solution file as parameter. I've defined a BeforeBuild target where I set some properties, and a Build target that executes the msbuild task. I've confirmed that no errors occured when building the msbuild script in the command line console. Howeve...
2010/06/03
[ "https://Stackoverflow.com/questions/2964913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/357333/" ]
I found I had a similar situation (but using TeamCity as my CI environment). In my particular case, the project was a Command Line application. To solve it, I had to manually edit my project file. Find these lines: ``` <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '...
The answer from David helped me. But later I found the actual source of the issue for my computer. The **PLATFORM** environment variable is added on HP machines and does impact a number of different scenarios with Visual Studio. Go into Environment Variables-> System Variables and remove the "PLATFORM" from the list. ...
516,817
I am trying to make a tax calculator for an invoice template and the idea is to pass the variable `subcost` to the command `\taxcalc`. ``` \newcommand*{\taxcalc}[2]{% \pgfmathparse{#1/(1.0-#2)-#1}% \pgfmathprintnumber{\pgfmathresult}% } \newcommand{\vatTotal}{ & & & {\bf BTW 21\%} & {\bf {\bf \euro\taxcalc{s...
2019/11/17
[ "https://tex.stackexchange.com/questions/516817", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/201545/" ]
Use `alignat`, that makes pairs of “right aligned/left aligned” columns with no intervening space (that you can add yourself). ```latex \documentclass{article} \usepackage{amsmath} \newcommand{\ceilset}{\mathsf{Ceil}} \newcommand{\ceilf}[1]{\lceil #1 \rceil} \begin{document} Define the following two functions \beg...
Define `\ceilset` and `\ceilif` according to your needs and try the following ``` \documentclass[paper=letter,twoside,fontsize=12pt,leqno]{scrbook} \usepackage{mathtools} \begin{document} \noindent Define the following two functions: \begin{align*} &\wedge \colon \ceilset \times \ceilset \longrightarrow \ceilset & & ...
516,817
I am trying to make a tax calculator for an invoice template and the idea is to pass the variable `subcost` to the command `\taxcalc`. ``` \newcommand*{\taxcalc}[2]{% \pgfmathparse{#1/(1.0-#2)-#1}% \pgfmathprintnumber{\pgfmathresult}% } \newcommand{\vatTotal}{ & & & {\bf BTW 21\%} & {\bf {\bf \euro\taxcalc{s...
2019/11/17
[ "https://tex.stackexchange.com/questions/516817", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/201545/" ]
Use `alignat`, that makes pairs of “right aligned/left aligned” columns with no intervening space (that you can add yourself). ```latex \documentclass{article} \usepackage{amsmath} \newcommand{\ceilset}{\mathsf{Ceil}} \newcommand{\ceilf}[1]{\lceil #1 \rceil} \begin{document} Define the following two functions \beg...
If you also want to align the operators: ``` \documentclass[paper=letter,twoside,fontsize=12pt,leqno]{scrbook} \usepackage{mathtools} \usepackage{showframe} \let\ceilset=\relax \let\ceilf=\relax \begin{document} Define the following two functions: \begin{align*} &\wedge \colon \ceilset \times \ceilset &&\longrightarr...
635,697
Does the union of intervals form a set? I mean the union of $(0,1)$ and $(1,2)$ is a set and if yes, then how?
2014/01/12
[ "https://math.stackexchange.com/questions/635697", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
A set is a collection of elements. In this case, all elements are real numbers. Any interval $(a,b)$ *is a set* (the set of those real numbers $x$ which satisfy $a<x<b$.) The union of any two sets is still a collection of elements, i.e. **is a set**.
It is because each interval is set and union of two sets is set.
635,697
Does the union of intervals form a set? I mean the union of $(0,1)$ and $(1,2)$ is a set and if yes, then how?
2014/01/12
[ "https://math.stackexchange.com/questions/635697", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
A set is just a collection of elements, therefore, you have a set, since you have a collection of real numbers.
It is because each interval is set and union of two sets is set.
635,697
Does the union of intervals form a set? I mean the union of $(0,1)$ and $(1,2)$ is a set and if yes, then how?
2014/01/12
[ "https://math.stackexchange.com/questions/635697", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
As "explicit" sets these intervals are written: $$(0,1)=\{x:0<x<1,\space x \in \mathbb{R}\}, (1,2)=\{x:1<x<2,\space x \in \mathbb{R}\}$$ So the union is: $$(0,1) \cup (1,2)=\{x:0<x<2,\space x\neq 1,\space x \in \mathbb{R}\}$$
It is because each interval is set and union of two sets is set.
19,564,670
I can generate html from a file on the fly and return like this: ``` from django.http import HttpResponse response = HttpResponse(mimetype="text/html") content = "".join(open(filename).readlines()) response._set_content(content) return response ``` but is there a better, built in way, in Django 1.5?
2013/10/24
[ "https://Stackoverflow.com/questions/19564670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/210801/" ]
The following code is a better method for making a file available for download or viewing, short of streaming (which has some downsides, such as not having a known size). ``` from django.http import HttpResponse def serve_file(filename): response = HttpResponse(mimetype="text/html") for line in open(filename):...
Django is an MVC framework (well, arguably it's MTV, but the basic principle is similar), so you should be [creating templates](https://docs.djangoproject.com/en/1.5/ref/templates/) for that kind of task.
19,564,670
I can generate html from a file on the fly and return like this: ``` from django.http import HttpResponse response = HttpResponse(mimetype="text/html") content = "".join(open(filename).readlines()) response._set_content(content) return response ``` but is there a better, built in way, in Django 1.5?
2013/10/24
[ "https://Stackoverflow.com/questions/19564670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/210801/" ]
The following code is a better method for making a file available for download or viewing, short of streaming (which has some downsides, such as not having a known size). ``` from django.http import HttpResponse def serve_file(filename): response = HttpResponse(mimetype="text/html") for line in open(filename):...
You should configure your webserver to [serve static files](https://docs.djangoproject.com/en/1.5/howto/static-files/deployment/) directly. If you absolutely have to do it through django you could use [static views](https://docs.djangoproject.com/en/1.5/howto/static-files/).
23,323,637
Want to start function if user clicked on `id^="mark_paid_used"` or value changed in class `paid_used_amount_for_below_header_debit` such codes works ``` $('[id^="mark_paid_used"]').click(function(){ //do something }); ``` . ``` $('.paid_used_amount_for_below_header_debit').change(function() { //do th...
2014/04/27
[ "https://Stackoverflow.com/questions/23323637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2118559/" ]
You can create a function, As I have in example. After that you can pass it to event handler ``` var yourFunction = function () { //do something }; $('[id^="mark_paid_used"]').click(yourFunction); $('.paid_used_amount_for_below_header_debit').change(yourFunction); ```
Call a function then add it as an event ``` var getfunction = function(){ }; $('[id^="mark_paid_used"]').click(getfunction); $('.paid_used_amount_for_below_header_debit').change(getfunction); ```
23,323,637
Want to start function if user clicked on `id^="mark_paid_used"` or value changed in class `paid_used_amount_for_below_header_debit` such codes works ``` $('[id^="mark_paid_used"]').click(function(){ //do something }); ``` . ``` $('.paid_used_amount_for_below_header_debit').change(function() { //do th...
2014/04/27
[ "https://Stackoverflow.com/questions/23323637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2118559/" ]
You can create a function, As I have in example. After that you can pass it to event handler ``` var yourFunction = function () { //do something }; $('[id^="mark_paid_used"]').click(yourFunction); $('.paid_used_amount_for_below_header_debit').change(yourFunction); ```
Define a function, and execute it when something happens. ``` function anyname(){ // your code } $('.paid_used_amount_for_below_header_debit').change(function(){anyname();}); $('[id^="mark_paid_used"]').click(function(){anyname()}); ```
23,323,637
Want to start function if user clicked on `id^="mark_paid_used"` or value changed in class `paid_used_amount_for_below_header_debit` such codes works ``` $('[id^="mark_paid_used"]').click(function(){ //do something }); ``` . ``` $('.paid_used_amount_for_below_header_debit').change(function() { //do th...
2014/04/27
[ "https://Stackoverflow.com/questions/23323637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2118559/" ]
Call a function then add it as an event ``` var getfunction = function(){ }; $('[id^="mark_paid_used"]').click(getfunction); $('.paid_used_amount_for_below_header_debit').change(getfunction); ```
Define a function, and execute it when something happens. ``` function anyname(){ // your code } $('.paid_used_amount_for_below_header_debit').change(function(){anyname();}); $('[id^="mark_paid_used"]').click(function(){anyname()}); ```
51,105,311
I have a webpage with rows of 'cards' which each contain an img, some text below, and an link styled as a button. The text varies in length but I want each card to be of equal length and the buttons to be aligned toward the bottom of each card. ``` <!--Grid row--> <div class="row"> <!--Grid column--> <div clas...
2018/06/29
[ "https://Stackoverflow.com/questions/51105311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3410340/" ]
You can just pass the column names as parameters to the function: ``` q)tab:([]x:1 2 3;y:4 5 6) q)func:{[x;y] x+y} q) q)select res:func[x;y]from tab res --- 5 7 9 ``` Alternatively you could use functional form to turn that query into a function: ``` q){?[x;();0b;enlist[`res]!enlist(`func;y;z)]}[tab;`x;`y] res --- ...
Since `+` is overloaded to work with both atom and list , `res:func[x;y]` will work perfectly fine; however in cases when a dyadic function only accepts the arguments as atoms rather than lists then `each-both` will do the trick: ``` q)select res:func'[x;y] from tab // using each-both func'[x;y] res --- 5 7 9 ``` e...
14,065,106
I can't seem to figure out how to take the year from say `Rogue Assassin 2007` and return: ``` moviename = "Rogue Assassin" 'Whitespace doesn't matter movieyear = "2007" 'Whitespace doesn't matter ``` However, I can't get it to work. I have been trying the following: ``` If System.Text.RegularExpressions.Regex....
2012/12/28
[ "https://Stackoverflow.com/questions/14065106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1808539/" ]
You could get the name of the variable inside the function ("str"), but you cannot get the name of the variable that was passed into the function unless you pass it in as a second parameter. It doesn't make sense to get the name of the variable passed to the function because there may not have even been a variable if ...
You don't need parameter name (possible from reflection) but rather a variable name that has been passed as a parameter. AFAIK, for all practical purpose, this is not possible for the code within the function. On the other hand, it's as such possible to do the code analysis of all assemblies loaded in the app-domain ...
102,846
OK, this might sound a bit confusing and complicated, so bear with me. We've written a framework that allows us to define friendly URLs. If you surf to any arbitrary URL, IIS tries to display a 404 error (or, in some cases, 403;14 or 405). However, IIS is set up so that anything directed to those specific errors is se...
2008/09/19
[ "https://Stackoverflow.com/questions/102846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16308/" ]
Since IIS7 uses .net from the top down there would not be any performance overhead of using an HttpModule, In fact there are several Managed HttpModules that are always used on every request. When the BeginRequest event is fired, the SessionStateModule may not have been added to the Modules collection, so if you try to...
Just a guess: the handler specified in IIS7's %windir%\system32\inetsrv\config\applicationhost.config which is handling your request is not allowing the POST verb to get through at all, and it is evaluating that rule before determining whether the URL doesn't exist.
102,846
OK, this might sound a bit confusing and complicated, so bear with me. We've written a framework that allows us to define friendly URLs. If you surf to any arbitrary URL, IIS tries to display a 404 error (or, in some cases, 403;14 or 405). However, IIS is set up so that anything directed to those specific errors is se...
2008/09/19
[ "https://Stackoverflow.com/questions/102846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16308/" ]
Microsoft released a hotfix for this : [<http://support.microsoft.com/default.aspx/kb/956578>](http://support.microsoft.com/default.aspx/kb/956578)
Just a guess: the handler specified in IIS7's %windir%\system32\inetsrv\config\applicationhost.config which is handling your request is not allowing the POST verb to get through at all, and it is evaluating that rule before determining whether the URL doesn't exist.
102,846
OK, this might sound a bit confusing and complicated, so bear with me. We've written a framework that allows us to define friendly URLs. If you surf to any arbitrary URL, IIS tries to display a 404 error (or, in some cases, 403;14 or 405). However, IIS is set up so that anything directed to those specific errors is se...
2008/09/19
[ "https://Stackoverflow.com/questions/102846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16308/" ]
The problem in IIS 7 of post variables not being passed through to custom error handlers is fixed in service pack 2 for Vista. Haven't tried it on Windows Server but I'm sure it will be fixed there too.
Just a guess: the handler specified in IIS7's %windir%\system32\inetsrv\config\applicationhost.config which is handling your request is not allowing the POST verb to get through at all, and it is evaluating that rule before determining whether the URL doesn't exist.
102,846
OK, this might sound a bit confusing and complicated, so bear with me. We've written a framework that allows us to define friendly URLs. If you surf to any arbitrary URL, IIS tries to display a 404 error (or, in some cases, 403;14 or 405). However, IIS is set up so that anything directed to those specific errors is se...
2008/09/19
[ "https://Stackoverflow.com/questions/102846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16308/" ]
Since IIS7 uses .net from the top down there would not be any performance overhead of using an HttpModule, In fact there are several Managed HttpModules that are always used on every request. When the BeginRequest event is fired, the SessionStateModule may not have been added to the Modules collection, so if you try to...
Yes, I would definitely recommend URL rewriting (using Microsoft's IIS7 one or one of the many alternatives). This is specifically designed for providing friendly URLs, whereas error documents are a last-ditch backstop for failures, which tends to munge the incoming data so it may not be what you expect.
102,846
OK, this might sound a bit confusing and complicated, so bear with me. We've written a framework that allows us to define friendly URLs. If you surf to any arbitrary URL, IIS tries to display a 404 error (or, in some cases, 403;14 or 405). However, IIS is set up so that anything directed to those specific errors is se...
2008/09/19
[ "https://Stackoverflow.com/questions/102846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16308/" ]
Microsoft released a hotfix for this : [<http://support.microsoft.com/default.aspx/kb/956578>](http://support.microsoft.com/default.aspx/kb/956578)
Since IIS7 uses .net from the top down there would not be any performance overhead of using an HttpModule, In fact there are several Managed HttpModules that are always used on every request. When the BeginRequest event is fired, the SessionStateModule may not have been added to the Modules collection, so if you try to...
102,846
OK, this might sound a bit confusing and complicated, so bear with me. We've written a framework that allows us to define friendly URLs. If you surf to any arbitrary URL, IIS tries to display a 404 error (or, in some cases, 403;14 or 405). However, IIS is set up so that anything directed to those specific errors is se...
2008/09/19
[ "https://Stackoverflow.com/questions/102846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16308/" ]
Microsoft released a hotfix for this : [<http://support.microsoft.com/default.aspx/kb/956578>](http://support.microsoft.com/default.aspx/kb/956578)
Yes, I would definitely recommend URL rewriting (using Microsoft's IIS7 one or one of the many alternatives). This is specifically designed for providing friendly URLs, whereas error documents are a last-ditch backstop for failures, which tends to munge the incoming data so it may not be what you expect.
102,846
OK, this might sound a bit confusing and complicated, so bear with me. We've written a framework that allows us to define friendly URLs. If you surf to any arbitrary URL, IIS tries to display a 404 error (or, in some cases, 403;14 or 405). However, IIS is set up so that anything directed to those specific errors is se...
2008/09/19
[ "https://Stackoverflow.com/questions/102846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16308/" ]
The problem in IIS 7 of post variables not being passed through to custom error handlers is fixed in service pack 2 for Vista. Haven't tried it on Windows Server but I'm sure it will be fixed there too.
Yes, I would definitely recommend URL rewriting (using Microsoft's IIS7 one or one of the many alternatives). This is specifically designed for providing friendly URLs, whereas error documents are a last-ditch backstop for failures, which tends to munge the incoming data so it may not be what you expect.
102,846
OK, this might sound a bit confusing and complicated, so bear with me. We've written a framework that allows us to define friendly URLs. If you surf to any arbitrary URL, IIS tries to display a 404 error (or, in some cases, 403;14 or 405). However, IIS is set up so that anything directed to those specific errors is se...
2008/09/19
[ "https://Stackoverflow.com/questions/102846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16308/" ]
Microsoft released a hotfix for this : [<http://support.microsoft.com/default.aspx/kb/956578>](http://support.microsoft.com/default.aspx/kb/956578)
The problem in IIS 7 of post variables not being passed through to custom error handlers is fixed in service pack 2 for Vista. Haven't tried it on Windows Server but I'm sure it will be fixed there too.
49,326,164
I am trying to work with jupyter notebook, but when I open a file I receive the following error: The kernel has died, and the automatic restart has failed. It is possible the kernel cannot be restarted. If you are not able to restart the kernel, you will still be able to save the notebook, but running code will no lo...
2018/03/16
[ "https://Stackoverflow.com/questions/49326164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9351684/" ]
It seems like there is something wrong with the jupyter installation. I recommend upgrading anaconda to v5, which should install jupyter by default(not sure if that is the case for v3, which is what seems to be used in this case). Try installing the missing modules using conda install if you want to stick with conda v3...
I got the same error. Its because we haven't given administrator privilege. You have to install anaconda using administrator. Or run the app as administrator. Just right click on jupyter or spyder then select run as administrator. Or while installing anaconda select install as administrator
38,980
I have a Dell PowerEdge 2850 with a PERC 4 controller and SCSI drives. I need to clone that to a PE2950 with a PERC6i with SAS drives. I've used the DKMS package along with the latest driver on Dells website to create a driver disk and successfully installed by hand so I know that it will install but I need a good sugg...
2009/07/10
[ "https://serverfault.com/questions/38980", "https://serverfault.com", "https://serverfault.com/users/7067/" ]
I've used SystemImager to move RHEL4 from 2850 to 2950. RHEL4 did not recognize the drive controller on the 2950, so I booted using a rescuse disk and re-created the initrd.
If you've got the new box partitioned and setup the way you want it, and just need to get the "soul" of the old box over, you've got nothing to lose by trying a quick and dirty method. I'd boot the RHEL 4.3 rescue CD on the new box using the driver disk and verify that you've got working network drivers and an IP addr...
38,980
I have a Dell PowerEdge 2850 with a PERC 4 controller and SCSI drives. I need to clone that to a PE2950 with a PERC6i with SAS drives. I've used the DKMS package along with the latest driver on Dells website to create a driver disk and successfully installed by hand so I know that it will install but I need a good sugg...
2009/07/10
[ "https://serverfault.com/questions/38980", "https://serverfault.com", "https://serverfault.com/users/7067/" ]
I've used SystemImager to move RHEL4 from 2850 to 2950. RHEL4 did not recognize the drive controller on the 2950, so I booted using a rescuse disk and re-created the initrd.
I've had success with similar moves using a procedure like this (I mostly did this for moving from physical servers to VMs). Where I say "Knoppix", any Linux Live CD should work: 1. boot both with Knoppix; or boot the OLD server in single-user mode. "knoppix 2" for text-only might be a good idea. 2. Get networking goi...
53,824,824
I'm sorry, I'm sure this will get marked as duplicate but I can not get my regex to work properly. I want my regex to only allow lowercase letters, periods, and underscores. I'm using the instagram regex from the community patterns found here <https://regexr.com/3cg7r> The pattern looks like `^(?!.*\.\.)(?!.*\.$)[^\W...
2018/12/18
[ "https://Stackoverflow.com/questions/53824824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8545437/" ]
There are a number of things going on in the regular expression you're starting from: ``` ^ # beginning of line (?!.*\.\.) # negative lookahead that effectively prevents double periods (?!.*\.$) # negative lookahead that prevents a period as the last character [^\W] # first character must be a word ...
Try this regex: ``` ^(?!.*\.\.)(?!.*__)(?!.*[A-Z])(?!.*\.$)[^\W][\w.]{0,29}$ ``` [RegExr demo](https://regexr.com/453us) I've added this negative lookahead to disallow uppercase characters: ``` (?!.*[A-Z]) ``` And this one to disallow double underscores: ``` (?!.*__) ``` --- One other important thing to reme...
53,824,824
I'm sorry, I'm sure this will get marked as duplicate but I can not get my regex to work properly. I want my regex to only allow lowercase letters, periods, and underscores. I'm using the instagram regex from the community patterns found here <https://regexr.com/3cg7r> The pattern looks like `^(?!.*\.\.)(?!.*\.$)[^\W...
2018/12/18
[ "https://Stackoverflow.com/questions/53824824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8545437/" ]
There are a number of things going on in the regular expression you're starting from: ``` ^ # beginning of line (?!.*\.\.) # negative lookahead that effectively prevents double periods (?!.*\.$) # negative lookahead that prevents a period as the last character [^\W] # first character must be a word ...
I found your issue: The flags you have selected `igm` include the `case insensitive` flag. To make your regex exclude uppercase letters, disable that and try again with `^[a-z]...` This should sort it out for you, but do comment if you can't get it to work, I'll try to help.
53,824,824
I'm sorry, I'm sure this will get marked as duplicate but I can not get my regex to work properly. I want my regex to only allow lowercase letters, periods, and underscores. I'm using the instagram regex from the community patterns found here <https://regexr.com/3cg7r> The pattern looks like `^(?!.*\.\.)(?!.*\.$)[^\W...
2018/12/18
[ "https://Stackoverflow.com/questions/53824824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8545437/" ]
There are a number of things going on in the regular expression you're starting from: ``` ^ # beginning of line (?!.*\.\.) # negative lookahead that effectively prevents double periods (?!.*\.$) # negative lookahead that prevents a period as the last character [^\W] # first character must be a word ...
You could try something like `^(?:[a-z]|([._])(?!\1))+$` Explained ``` ^ # BOS (?: # Repeat many times [a-z] # a - z | # or, ( [._] ) # (1), dot or underscore (?! \...
53,824,824
I'm sorry, I'm sure this will get marked as duplicate but I can not get my regex to work properly. I want my regex to only allow lowercase letters, periods, and underscores. I'm using the instagram regex from the community patterns found here <https://regexr.com/3cg7r> The pattern looks like `^(?!.*\.\.)(?!.*\.$)[^\W...
2018/12/18
[ "https://Stackoverflow.com/questions/53824824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8545437/" ]
Try this regex: ``` ^(?!.*\.\.)(?!.*__)(?!.*[A-Z])(?!.*\.$)[^\W][\w.]{0,29}$ ``` [RegExr demo](https://regexr.com/453us) I've added this negative lookahead to disallow uppercase characters: ``` (?!.*[A-Z]) ``` And this one to disallow double underscores: ``` (?!.*__) ``` --- One other important thing to reme...
I found your issue: The flags you have selected `igm` include the `case insensitive` flag. To make your regex exclude uppercase letters, disable that and try again with `^[a-z]...` This should sort it out for you, but do comment if you can't get it to work, I'll try to help.
53,824,824
I'm sorry, I'm sure this will get marked as duplicate but I can not get my regex to work properly. I want my regex to only allow lowercase letters, periods, and underscores. I'm using the instagram regex from the community patterns found here <https://regexr.com/3cg7r> The pattern looks like `^(?!.*\.\.)(?!.*\.$)[^\W...
2018/12/18
[ "https://Stackoverflow.com/questions/53824824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8545437/" ]
Try this regex: ``` ^(?!.*\.\.)(?!.*__)(?!.*[A-Z])(?!.*\.$)[^\W][\w.]{0,29}$ ``` [RegExr demo](https://regexr.com/453us) I've added this negative lookahead to disallow uppercase characters: ``` (?!.*[A-Z]) ``` And this one to disallow double underscores: ``` (?!.*__) ``` --- One other important thing to reme...
You could try something like `^(?:[a-z]|([._])(?!\1))+$` Explained ``` ^ # BOS (?: # Repeat many times [a-z] # a - z | # or, ( [._] ) # (1), dot or underscore (?! \...
53,824,824
I'm sorry, I'm sure this will get marked as duplicate but I can not get my regex to work properly. I want my regex to only allow lowercase letters, periods, and underscores. I'm using the instagram regex from the community patterns found here <https://regexr.com/3cg7r> The pattern looks like `^(?!.*\.\.)(?!.*\.$)[^\W...
2018/12/18
[ "https://Stackoverflow.com/questions/53824824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8545437/" ]
I found your issue: The flags you have selected `igm` include the `case insensitive` flag. To make your regex exclude uppercase letters, disable that and try again with `^[a-z]...` This should sort it out for you, but do comment if you can't get it to work, I'll try to help.
You could try something like `^(?:[a-z]|([._])(?!\1))+$` Explained ``` ^ # BOS (?: # Repeat many times [a-z] # a - z | # or, ( [._] ) # (1), dot or underscore (?! \...
298,296
First, how do you define "exhibit"? To you, would this mean you need to prove that your bijection is 1-1 and onto? If so, I think I've got the 1-1 part, but am struggling with showing it is onto. The examples of a linear function being shown as onto just seem too elementary, and I'm not sure they work when mapping natu...
2013/02/08
[ "https://math.stackexchange.com/questions/298296", "https://math.stackexchange.com", "https://math.stackexchange.com/users/60834/" ]
Your $f$ is a bijection $\Bbb N\to \{1,3,5,7,\dots\}$. This should be shifted with $12$ (if $13$ is included in the target set, and by $14$ if that starts with $15$), and you're there: $$g(n):=f(n)+12=2n+13$$ will do it.
Suppose that $n\in \mathbb Z$ is odd and that $n>13$. Then we can write $n=2z+1$ for some $z \in \mathbb Z$. Then $n= 2z+1 =2z+1 +(13-13) = 2z-12 +13 = 2(z-6)+13$. Hence $f(z-6) = n$. Now we need to show that $z-6 \in \mathbb N$. But since $2z+1 > 13$ then $2z >12$ and $z>6$ and finally $z-6>0$. Obviously all the ...
8,711,958
I have been struggling with CellFormatting event, it's so slow. I have a DataGridView something like this: ![enter image description here](https://i.stack.imgur.com/4OjP7.png) I have written a function that fires when you click the checkbox in the header and it makes all the check boxes to check in that column.... ...
2012/01/03
[ "https://Stackoverflow.com/questions/8711958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1002584/" ]
Did you already try [SuspendLayout()](http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout%28v=VS.100%29.aspx) and [ResumeLayout()](http://msdn.microsoft.com/en-us/library/system.windows.forms.control.resumelayout.aspx)? This temporarily suspends the layout logic for the control, so that ...
If you want to stop painting the control when you're checking all the rows, you should take a look at the `DrawingControl` class from this post: [https://stackoverflow.com/questions/487661/...](https://stackoverflow.com/questions/487661/how-do-i-suspend-painting-for-a-control-and-its-children)
8,711,958
I have been struggling with CellFormatting event, it's so slow. I have a DataGridView something like this: ![enter image description here](https://i.stack.imgur.com/4OjP7.png) I have written a function that fires when you click the checkbox in the header and it makes all the check boxes to check in that column.... ...
2012/01/03
[ "https://Stackoverflow.com/questions/8711958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1002584/" ]
Did you already try [SuspendLayout()](http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout%28v=VS.100%29.aspx) and [ResumeLayout()](http://msdn.microsoft.com/en-us/library/system.windows.forms.control.resumelayout.aspx)? This temporarily suspends the layout logic for the control, so that ...
In my case the problem was caused by DataGridView property **AutoSizeColumnsMode=AllCells**. Probably after cell formatting all other cells in column and header cell had to be redrawn to fit theirs dimensions to the new cell dimensions. After I was changed property value to it default value "None", grid is painted imme...
36,399,834
In mvc4 application I used datetime format `dd.MM.YYYY HH:mm` *EditorTemplates > DateTime.cshtml* ``` @Html.TextBoxFor(model => model, "{0:dd.MM.yyyy HH:mm}", ViewData["htmlAttributes"]) ``` and I parsed it like this ``` DateTime.ParseExact(myDate, "dd.MM.yyyy", CultureInfo.InvariantCulture); ``` where myDate is...
2016/04/04
[ "https://Stackoverflow.com/questions/36399834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1765862/" ]
[Custom Date and Time Format Strings](https://msdn.microsoft.com/en-us/library/8kb3ddd4%28v=vs.110%29.aspx) are case sensitive. There is no `YYYY` or `DD` as a specifiers. That's why those strings will be in *as* they are when you get it's string representation. From docs; > > Any other character. > > > The charac...
Try it with `"yyyy-MM-dd"` instead of `"YYYY-MM-DD"`.
35,249,962
I have two assignments/variables in my code: ``` OUTPUT1="/Users/check/1.html" OUTPUT2="/Users/check/2.html" ``` When I use one of the above, for instance, I write `c = open(OUTPUT1)`. However, I think the correct approach for this would be to have something like a generic: `OUTPUT="/Users/check/$var.html"` and t...
2016/02/07
[ "https://Stackoverflow.com/questions/35249962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4111128/" ]
Use string interpolation like so: ``` var = "1.html" path = "/Users/check/{}".format(var) open(path) ``` You may also want to use a more common pattern: ``` import os var = "1.html" path = os.path.join("/Users/check/", var) open(path) ```
Perhaps you would consider using a tuple: ``` OUTPUT_PATHS = ( '/Users/check/1.html', '/Users/check/2.html', '/tmp/3.html' ) ``` Then you can simply index them, starting with 0: ``` outnum = random(0, 3) c = open(outnum) ```
35,249,962
I have two assignments/variables in my code: ``` OUTPUT1="/Users/check/1.html" OUTPUT2="/Users/check/2.html" ``` When I use one of the above, for instance, I write `c = open(OUTPUT1)`. However, I think the correct approach for this would be to have something like a generic: `OUTPUT="/Users/check/$var.html"` and t...
2016/02/07
[ "https://Stackoverflow.com/questions/35249962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4111128/" ]
If you wanted to put it in a function: ``` def getPath(var): return "/Users/check/" + str(var) + ".html" print(getPath(1)) print(getPath(2)) ```
Perhaps you would consider using a tuple: ``` OUTPUT_PATHS = ( '/Users/check/1.html', '/Users/check/2.html', '/tmp/3.html' ) ``` Then you can simply index them, starting with 0: ``` outnum = random(0, 3) c = open(outnum) ```
40,318,778
Given a base-**10** integer,**n** , convert it to binary (base-2). Then find and print the base-10 integer denoting the maximum number of consecutive 1's in **n**'s binary representation. Here is the code I wrote for it ``` #!/bin/python import sys k=0 m=0 i=0 n = int(raw_input().strip()) x=bin(n)[2:] while x[i] : ...
2016/10/29
[ "https://Stackoverflow.com/questions/40318778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6243763/" ]
Your while loop increments `i` but never checks when it has gone past the end of the string `x`. Your test `while x[i]` does not check for the string's end, it just checks each character if is empty. Since no character in a string is empty (and your string contains only `'0'` and `'1'`), your loop just continues. Note ...
Your condition `while x[i]` is wrong since it will never evaluate to `False` for any character. Are you used to C's null-terminated strings? Also, you are comparing a `str` to an `int` here: ``` if x[i]==1: ``` The proper way to do this would be to use a for-each loop: ``` import sys k = 0 m = 0 i = 0 n = int(ra...
56,119,014
I have a school project in which I need to create a communication between a USB HID keyboard and Nexys4DDR in VHDL using Vivado 2018.3 . I have used the Nexys 4 keyboard demo from [here](https://reference.digilentinc.com/learn/programmable-logic/tutorials/nexys-4-ddr-keyboard-demo/start) which I wrote in VHDL and to wh...
2019/05/13
[ "https://Stackoverflow.com/questions/56119014", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9076867/" ]
Not sure if this helps but I have a similar setup (Vivado 2019.2 and Nexys 4 (not DDR). I had a very similar issue; I was unable to generate a bitstream. Closer inspection showed that I had this error too after Synthesis. What worked for me was this solution, posted here with the solution by user hongh: [Here](https://...
One possible cause is that there's an error in your constraint file, so Vivado didn't load it properly. Check log for any warnings mentioning your constraint file.
2,618,694
The first print shows the member value to be false, and the other two prints show it as true. Why does the first output differ from the last two? ``` #include <vector> #include <iostream> using namespace std; class MyClass { public: bool value; bool stuff; }; class Container { public: vector<MyClass> my_class...
2010/04/11
[ "https://Stackoverflow.com/questions/2618694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145058/" ]
The two members are primitive (non-class) objects and thus uninitialized. That means that their values will be arbitrary at runtime. You must initialize them in the constructor: ``` class MyClass { public: bool value; bool stuff; MyClass(): value(false), stuff(false) { } }; ```
You are not initializing members to any value. They will just have any value that was in that place of memory before.
2,618,694
The first print shows the member value to be false, and the other two prints show it as true. Why does the first output differ from the last two? ``` #include <vector> #include <iostream> using namespace std; class MyClass { public: bool value; bool stuff; }; class Container { public: vector<MyClass> my_class...
2010/04/11
[ "https://Stackoverflow.com/questions/2618694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145058/" ]
The two members are primitive (non-class) objects and thus uninitialized. That means that their values will be arbitrary at runtime. You must initialize them in the constructor: ``` class MyClass { public: bool value; bool stuff; MyClass(): value(false), stuff(false) { } }; ```
The objects you are declaring in main(..) are automatic hence allocated on the stack of the running thread. Since you don't initialize the objects, they are simply filled with the data that was previously in this very part of the stack. If you processor is of intel x86 architecture, the assembly language code for a t...
2,618,694
The first print shows the member value to be false, and the other two prints show it as true. Why does the first output differ from the last two? ``` #include <vector> #include <iostream> using namespace std; class MyClass { public: bool value; bool stuff; }; class Container { public: vector<MyClass> my_class...
2010/04/11
[ "https://Stackoverflow.com/questions/2618694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145058/" ]
You are not initializing members to any value. They will just have any value that was in that place of memory before.
The objects you are declaring in main(..) are automatic hence allocated on the stack of the running thread. Since you don't initialize the objects, they are simply filled with the data that was previously in this very part of the stack. If you processor is of intel x86 architecture, the assembly language code for a t...
19,640,762
I am trying to sum every other digit in the card number by doing this: ``` /* Return the sum of the odd-place digits. */ public static int sumOfoddPlace(long number) { int maxDigitLength = 16; int sum = 0; for (int i = 1; i <= maxDigitLength; i++) { if (i % 2 == 1) { sum =...
2013/10/28
[ "https://Stackoverflow.com/questions/19640762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2924177/" ]
You're breaking out of the loop on the very first iteration only. So, you won't go past to another iteration. However, removing the `break` too won't solve your problem. `number % 10` will always give you the last digit of the number, and not every alternate number. You should follow this approach: * `num % 10` - Wil...
Here is updated code in which i have removed logic of flag.This is shorter and easier to understand. ``` public static int sumOfOddDigits(long number){ int sum = 0; String newString = new StringBuilder(String.valueOf(number)).reverse().toString(); number = Long.parseLong(newString); while (number != 0...
19,640,762
I am trying to sum every other digit in the card number by doing this: ``` /* Return the sum of the odd-place digits. */ public static int sumOfoddPlace(long number) { int maxDigitLength = 16; int sum = 0; for (int i = 1; i <= maxDigitLength; i++) { if (i % 2 == 1) { sum =...
2013/10/28
[ "https://Stackoverflow.com/questions/19640762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2924177/" ]
You're breaking out of the loop on the very first iteration only. So, you won't go past to another iteration. However, removing the `break` too won't solve your problem. `number % 10` will always give you the last digit of the number, and not every alternate number. You should follow this approach: * `num % 10` - Wil...
I haven't seen the minimum solution yet, so here goes: ``` public static int sumOddDigits(long input) { int sum = 0; for (long temp = input; temp > 0; temp /= 100) { sum += temp % 10; } return sum; } ``` You don't need to divide by 10 and check if it's an even number, you can just divide by...
19,640,762
I am trying to sum every other digit in the card number by doing this: ``` /* Return the sum of the odd-place digits. */ public static int sumOfoddPlace(long number) { int maxDigitLength = 16; int sum = 0; for (int i = 1; i <= maxDigitLength; i++) { if (i % 2 == 1) { sum =...
2013/10/28
[ "https://Stackoverflow.com/questions/19640762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2924177/" ]
Try this ... this should work for you ``` public static int sumOfoddPlace(long number) { int maxDigitLength = 16; int sum = 0; for (int i = 0; i < maxDigitLength; i++) { if (i % 2 != 0) { sum = (sum + (int)(number % 10)); ...
Here is updated code in which i have removed logic of flag.This is shorter and easier to understand. ``` public static int sumOfOddDigits(long number){ int sum = 0; String newString = new StringBuilder(String.valueOf(number)).reverse().toString(); number = Long.parseLong(newString); while (number != 0...
19,640,762
I am trying to sum every other digit in the card number by doing this: ``` /* Return the sum of the odd-place digits. */ public static int sumOfoddPlace(long number) { int maxDigitLength = 16; int sum = 0; for (int i = 1; i <= maxDigitLength; i++) { if (i % 2 == 1) { sum =...
2013/10/28
[ "https://Stackoverflow.com/questions/19640762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2924177/" ]
Try this ... this should work for you ``` public static int sumOfoddPlace(long number) { int maxDigitLength = 16; int sum = 0; for (int i = 0; i < maxDigitLength; i++) { if (i % 2 != 0) { sum = (sum + (int)(number % 10)); ...
I haven't seen the minimum solution yet, so here goes: ``` public static int sumOddDigits(long input) { int sum = 0; for (long temp = input; temp > 0; temp /= 100) { sum += temp % 10; } return sum; } ``` You don't need to divide by 10 and check if it's an even number, you can just divide by...
19,640,762
I am trying to sum every other digit in the card number by doing this: ``` /* Return the sum of the odd-place digits. */ public static int sumOfoddPlace(long number) { int maxDigitLength = 16; int sum = 0; for (int i = 1; i <= maxDigitLength; i++) { if (i % 2 == 1) { sum =...
2013/10/28
[ "https://Stackoverflow.com/questions/19640762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2924177/" ]
I haven't seen the minimum solution yet, so here goes: ``` public static int sumOddDigits(long input) { int sum = 0; for (long temp = input; temp > 0; temp /= 100) { sum += temp % 10; } return sum; } ``` You don't need to divide by 10 and check if it's an even number, you can just divide by...
Here is updated code in which i have removed logic of flag.This is shorter and easier to understand. ``` public static int sumOfOddDigits(long number){ int sum = 0; String newString = new StringBuilder(String.valueOf(number)).reverse().toString(); number = Long.parseLong(newString); while (number != 0...
16,062
Short: I want DHCP server to assign a preconfigured IP address based on a port (on a switch, ideally) a device is connected to. Long: My situation: I am building an automated indoor farm (for growing tomatoes). The farm is composed of many (12 for now, but will grow to hundreds) identical 7"x7" rooms. Each roo...
2015/01/09
[ "https://networkengineering.stackexchange.com/questions/16062", "https://networkengineering.stackexchange.com", "https://networkengineering.stackexchange.com/users/13301/" ]
> > is it possible to assign a preconfigured IP address based on a port a device is connected to? What devices do I need for this? > > > You can use a Cisco switch and an IOS that supports [DHCP Server Port-Based Address Allocation](http://www.cisco.com/en/US/docs/switches/lan/catalyst2960/software/release/12.2_55...
If you want "hot swappable," the device names will have to be independent of their location. You'll need to keep track of device MAC addresses on a chart with an easy corresponding Minion name like "Bob." Then configure the device with that name or description "Bob." This way when network monitoring reports issues only...
16,062
Short: I want DHCP server to assign a preconfigured IP address based on a port (on a switch, ideally) a device is connected to. Long: My situation: I am building an automated indoor farm (for growing tomatoes). The farm is composed of many (12 for now, but will grow to hundreds) identical 7"x7" rooms. Each roo...
2015/01/09
[ "https://networkengineering.stackexchange.com/questions/16062", "https://networkengineering.stackexchange.com", "https://networkengineering.stackexchange.com/users/13301/" ]
> > is it possible to assign a preconfigured IP address based on a port a device is connected to? What devices do I need for this? > > > You can use a Cisco switch and an IOS that supports [DHCP Server Port-Based Address Allocation](http://www.cisco.com/en/US/docs/switches/lan/catalyst2960/software/release/12.2_55...
I was able to do what you wanted using Cisco IOS DHCP and option 82 snooping. I may not be using the right terms. But, basically I needed to assign IP addresses to kitchen printers based on the station in the kitchen they were at. If one of these printers died during a dinner shift, the store manager would need to be a...
16,062
Short: I want DHCP server to assign a preconfigured IP address based on a port (on a switch, ideally) a device is connected to. Long: My situation: I am building an automated indoor farm (for growing tomatoes). The farm is composed of many (12 for now, but will grow to hundreds) identical 7"x7" rooms. Each roo...
2015/01/09
[ "https://networkengineering.stackexchange.com/questions/16062", "https://networkengineering.stackexchange.com", "https://networkengineering.stackexchange.com/users/13301/" ]
I was able to do what you wanted using Cisco IOS DHCP and option 82 snooping. I may not be using the right terms. But, basically I needed to assign IP addresses to kitchen printers based on the station in the kitchen they were at. If one of these printers died during a dinner shift, the store manager would need to be a...
If you want "hot swappable," the device names will have to be independent of their location. You'll need to keep track of device MAC addresses on a chart with an easy corresponding Minion name like "Bob." Then configure the device with that name or description "Bob." This way when network monitoring reports issues only...
2,058,877
I am trying to add trusted sites to Mac OS X's firewall via command-line. I understand that previously, we were able to use **ipfw** to configure the firewall on a packet level by using port numbers or IPs. In Leopard (10.5) and on, there is a new feature to add a trusted application to a list. This can be accomplished...
2010/01/13
[ "https://Stackoverflow.com/questions/2058877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132429/" ]
Have 2 tables, Team and Game, where Team has a team name, and a team ID, and game has 2 team IDs (team 1 and team 2) and the score of the game. Then, you have foreign keys (for integrity) between the Game and Team tables. This will reflect who played who and what the score was with a minimal schema and a very simple st...
The first response is correct. If you organize your data into relations, and create one table for each relation, the data will be a lot easier to work with. The background learning you need to do in relational database design will teach you more about this. If you use the Team and Game structure from the response, you...
33,524,696
I was under the impression that this syntax: ``` import Router from 'react-router'; var {Link} = Router; ``` has the same final result as this: ``` import {Link} from 'react-router'; ``` Can someone explain what the difference is? (I originally thought it was a [React Router Bug](https://github.com/rackt/react-r...
2015/11/04
[ "https://Stackoverflow.com/questions/33524696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
``` import {Link} from 'react-router'; ``` imports a **named export** from `react-router`, i.e. something like ``` export const Link = 42; ``` --- ``` import Router from 'react-router'; const {Link} = Router; ``` pulls out the property `Link` from the **default export**, assuming it is an object, e.g. ``` expo...
To do this: ``` import {purple, grey} from 'themeColors'; ``` *Without repeating `export const` for each symbol*, just do: ``` export const purple = '#BADA55', grey = '#l0l', gray = grey, default = 'this line actually causes an error'; ```
33,524,696
I was under the impression that this syntax: ``` import Router from 'react-router'; var {Link} = Router; ``` has the same final result as this: ``` import {Link} from 'react-router'; ``` Can someone explain what the difference is? (I originally thought it was a [React Router Bug](https://github.com/rackt/react-r...
2015/11/04
[ "https://Stackoverflow.com/questions/33524696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
``` import {Link} from 'react-router'; ``` imports a **named export** from `react-router`, i.e. something like ``` export const Link = 42; ``` --- ``` import Router from 'react-router'; const {Link} = Router; ``` pulls out the property `Link` from the **default export**, assuming it is an object, e.g. ``` expo...
Except for different exports, it may also lead to different bundled code by WebPack when using two variant ways to destruct ESM modules: ```js // react-router export function Link(str) { /* ... */ } ``` 1. Destruct within the `import` statement: ```js import {Link} from 'react-router'; Link('1'); Link('2'); ``` ...