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
20,861,417
I have a HomeController with an Index.cshtml Razor view that uses an InitialChoicesViewModel with validation attributes. The Index view contains the following form: ``` @using (Html.BeginForm("CreateCharacter", "DistributePoints", FormMethod.Get)) ``` This goes to a different controller (which is what I want): ```c...
2013/12/31
[ "https://Stackoverflow.com/questions/20861417", "https://Stackoverflow.com", "https://Stackoverflow.com/users/161457/" ]
``` [HttpPost] public ActionResult CreateCharacter(InitialChoicesViewModel model) { if (ModelState.IsValid) return RedirectToAction("SomeSuccessfulaction"); return View("~/Views/Home/Index.cshtml", model); } ``` The `~/` denotes the relative root of your site. The code above complies with the [Post-...
To check your `ModelState` just use an if statement in Controller: ``` if(ModelState.IsValid) { ... } ``` If there is any error add you can add an error message to the ModelState Dictionary like this: ``` ModelState.AddModelError("Somethings failed", ErrorCodeToString(e.StatusCode)); ``` After that return you...
38,530,491
I am trying to learn CMake, but I get a undefined reference to ... linker error I have a directory with a subdirectory. each of them has its own CMakeLists.txt ``` test |----main.cpp |----CMakeLists.txt |----test2 |----foo.hpp |----foo.cpp |----CMakeLists.txt ``` the CMakeLists.txt for test is: ``` c...
2016/07/22
[ "https://Stackoverflow.com/questions/38530491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4735801/" ]
Make sure that your test `CMakeLists.txt` links to the created library. ``` project(test) cmake_minimum_required(VERSION 2.8) set(SOURCE_FILES main.cpp) include_directories( test2 ) #here link_directories(test2) add_subdirectory(test2) add_executable( ${PROJECT_NAME} ${SOURCE_FILES} ) #and here target_link_libr...
Function `add_subdirectory($dir)` does not automatically add `$dir` to include directories and link directories. To use library `test2` you should do it manually in CMakeLists.txt of `test` directory: ``` include_directories(test2/) link_directories(test2/) ``` Then, link your executable with `test2` library to get ...
57,374,604
I have a single-threaded multi-client program written in c. If one client has a hideously slow network connection or is being malicious and limits their rate of send() tot he server application to something ridiculous like 1 byte/second, will select() return on the first byte received from the client (as the socket ha...
2019/08/06
[ "https://Stackoverflow.com/questions/57374604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10076563/" ]
From [the POSIX documentation about `select`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/pselect.html): > > A descriptor shall be considered ready for reading when a call to an input function with `O_NONBLOCK` clear would not block, whether or not the function would transfer data successfully. > > > ...
How would the OS know that it has to wait for 2000 bytes to arrive? TCP is a stream, so the OS can't know after 1999 bytes that there's still a byte pending. For UDP, the OS knows it's packet-based, and it will have the entire packet available once the last byte arrives. It can't deliver the first byte earlier, becaus...
5,720
I've noticed that people use present perfect when emailing other people, but I'm not sure how to utilize that verb tense. Will my example below work? > > "To this email, **I've attached** the copies of the photos you **asked** for. Also, because you *told* me that you **didn't** get the other copies, **I've made** mo...
2013/04/24
[ "https://ell.stackexchange.com/questions/5720", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/1319/" ]
First one seems reasonably good and enough. Though, I believe you can also phrase 1st line as, > > I have, herewith, attached the copies of the photos you asked for. > > > I also don't see the need for the following phrase in the end. > > I've also attached them to this email. > > > Also, it's usually a g...
Short answer: Use the Past Simple if it's clearer, and it is a bit clearer here, plus is quicker and more common. Longer answer: The Present Perfect is usually used in three ways. Life experience (something occurring in the subject's past): > > I've participated in scavenger hunts with members of the Royal Family. ...
5,720
I've noticed that people use present perfect when emailing other people, but I'm not sure how to utilize that verb tense. Will my example below work? > > "To this email, **I've attached** the copies of the photos you **asked** for. Also, because you *told* me that you **didn't** get the other copies, **I've made** mo...
2013/04/24
[ "https://ell.stackexchange.com/questions/5720", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/1319/" ]
This is probably one of those cases where British English would use the present perfect tense, while American English would use the simple past tense. The present perfect tense is used: * To describe how an even in the past continues to be relevant at a later time > > Mario has arrived home. > > > * To describe a...
Short answer: Use the Past Simple if it's clearer, and it is a bit clearer here, plus is quicker and more common. Longer answer: The Present Perfect is usually used in three ways. Life experience (something occurring in the subject's past): > > I've participated in scavenger hunts with members of the Royal Family. ...
5,720
I've noticed that people use present perfect when emailing other people, but I'm not sure how to utilize that verb tense. Will my example below work? > > "To this email, **I've attached** the copies of the photos you **asked** for. Also, because you *told* me that you **didn't** get the other copies, **I've made** mo...
2013/04/24
[ "https://ell.stackexchange.com/questions/5720", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/1319/" ]
I think it's because the past tense sounds somewhat awkward when the author is composing the email. We use the present perfect tense when we want to talk about unfinished actions that started in the past and continue to the present.[1](http://www.perfect-english-grammar.com/present-perfect-use.html) Well, at the mom...
Short answer: Use the Past Simple if it's clearer, and it is a bit clearer here, plus is quicker and more common. Longer answer: The Present Perfect is usually used in three ways. Life experience (something occurring in the subject's past): > > I've participated in scavenger hunts with members of the Royal Family. ...
3,281,842
i need upload a file in Chrome, and need **post** some params at the same request, and need Basic Authentication. i want use javascript AJAX to do this. but chrome do not support sendAsBinary, how can i do this? ``` function sendMsg(status){ var user = localStorage.getObject(CURRENT_USER_KEY); var file = $("#...
2010/07/19
[ "https://Stackoverflow.com/questions/3281842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/395885/" ]
Use `xhr.send(FormData)`. You don't need to construct the `multipart-form-data` yourself :) See my response here: [Javascript/HTML5 file API reading sequential files into multipart form data](https://stackoverflow.com/questions/5362747/javascript-html5-file-api-reading-sequential-files-into-multipart-form-data/6048522...
Use a form to submit the file upload request just like you would normally, but set the target of the form to a hidden iframe. This will not refresh the page, but will still upload the file. You can also have the server spit out some JavaScript code which, once loaded into the hidden iframe, will tell you when the file ...
3,281,842
i need upload a file in Chrome, and need **post** some params at the same request, and need Basic Authentication. i want use javascript AJAX to do this. but chrome do not support sendAsBinary, how can i do this? ``` function sendMsg(status){ var user = localStorage.getObject(CURRENT_USER_KEY); var file = $("#...
2010/07/19
[ "https://Stackoverflow.com/questions/3281842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/395885/" ]
> > builder += file.getAsBinary(); > //chrome do not support getAsBinary() > > > Use the `readAsBinaryString` method of the `FileReader` API. Chrome does support it. > > xhr.sendAsBinary(builder); //chrome do > not support sendAsBinary() > > > Learn how to accomplish it at the following URLs: <http://java...
Use a form to submit the file upload request just like you would normally, but set the target of the form to a hidden iframe. This will not refresh the page, but will still upload the file. You can also have the server spit out some JavaScript code which, once loaded into the hidden iframe, will tell you when the file ...
50,046,105
Below is an example for a custom web component `my-input`. I would like to bind the value attribute of my custom input component to the email attribute of a vue instance. (The example might require Chrome to support custom web components.) =>How do I have to adapt my web component example to get the binding working? ...
2018/04/26
[ "https://Stackoverflow.com/questions/50046105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2876079/" ]
To make `v-model` work you need to make a wrapper component for your webcomponent. The wrapper will conform to the [requirements for using `v-model` with a component](https://v2.vuejs.org/v2/guide/components.html#Using-v-model-on-Components). Alternatively, you can decompose the `v-model` into its two parts: set the `...
The `v-model` directive seems to check the type of the tag and handle them individually: <https://github.com/vuejs/vue/blob/dev/src/platforms/web/compiler/directives/model.js> I did not get the `v-model` to work for my custom component without extra wrappers. (I gave up on understanding how exactly my case is handled...
45,008,526
I'm trying to implement an await Task.Run in my controller and then return the response. Just curious if the response will always be got before we attempt to return it. ``` var response = await Task.Run(() => _myService.GetResponse(refno)); return Ok(response); ``` Could it attempt to return...
2017/07/10
[ "https://Stackoverflow.com/questions/45008526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115983/" ]
One way is to manually edit the csproj file. If you have currently referenced the NuGet package, you will have a part in the csproj file like this: ``` .... <ItemGroup> <Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <HintPath>..\packag...
> > Is it possible to do a project-reference the Nuget project (B) from the Solution (A) when building Debug. And when building Release use the Nuget package from Source? > > > **Certainly, but there are some restrictions you need to know.** **First**, the ID of the NuGet package should different from the name of...
30,591,015
Hey guys im new to xcode and programming im trying out this tutorial on making a slide out menu <https://www.youtube.com/watch?v=8EFfPT3UeWs> I cant get it working i downloaded the finished project files found here: <https://www.dropbox.com/s/7eku9pp06u75q6u/SlideoutMenuSwift-Full.zip?dl=0> I cant get it to work `...
2015/06/02
[ "https://Stackoverflow.com/questions/30591015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4964312/" ]
Welcome to the magic world of programming :-) As bjornorri writes, the syntax for `as` was changed in Swift 1.2. If you look at the documentation for the method `dequeueReusableCellWithIdentifier` (which can be found [here](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableView_Class/index...
This is because the Swift syntax has changed since the demo was written. You can probably fix this simply by following the suggestions in the error messages Xcode provides you.
13,662,270
I have a SQL Server database that contains usage data of an application (from over 100 devices), with over 1 year of data collected (30GB database). Inserting data into the DB is not a problem, is fast enough (for now), and is the only operation done by the clients. There is one master table and a few child tables, b...
2012/12/01
[ "https://Stackoverflow.com/questions/13662270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1216019/" ]
Your requirements can be easily handled by sql server. by the use of proper indexes and other optimization techniques. these queries can be execute efficiently by SQL SERVER. for your use case a sinmple index on (date,field1,field2) ``` CREATE CLUSTERED INDEX IDX_TABLE_ID ON TABLE(id) GO CREATE INDEX IDX_TABLE_2 ON ...
If you aren't using any joins within the query then the performance of the sql server will not be affected. If you use mongodb for the same purpose then also the querying time will be about that of the sql one or a little worse.
246,705
Is it possible to set page labels in pdfs “correctly”? Pages in my latex documents are numbered 1-x. I'd like the page labels to correspond to the actual page numbers (as mentioned here: <http://pdf.editme.com/pdfua-PageLabels>). So that the first page would be “Cover”, pages—let's say—2–5 (with toc and so on) numbere...
2015/05/24
[ "https://tex.stackexchange.com/questions/246705", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/75475/" ]
Package `hyperref` also adds support for the PDF page labels. It uses `\thepage` for this purpose. The cover page can be labeled using `\thispdfpagelabel`: ``` \documentclass{report} \usepackage{hyperref} \begin{document} \begin{titlepage} \hypersetup{pageanchor=false} \thispdfpagelabel{Cover} \Huge Cover \end{titlep...
As mentioned by Heiko, just use the [`hyperref`](https://www.ctan.org/pkg/hyperref?lang=en) package. Example: ``` \documentclass{report} \usepackage[pdfpagelabels,hyperindex,hyperfigures]{hyperref} \begin{document} Hola. This is my cover page \pdfbookmark[0]{Cover}{initialpage} \end{document} ``` Output: ![e...
21,718,701
I am using windows 8 (not yet updated to 8.1) The code I am using is > > import ctypes > > > SPI\_SETDESKWALLPAPER = 20 > > > ctypes.windll.user32.SystemParametersInfoA(SPI\_SETDESKWALLPAPER, 0, "word.jpg", 0) > > > print "hi" > > > For some reason regardless if i give it a valid image (in the same directo...
2014/02/12
[ "https://Stackoverflow.com/questions/21718701", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2180100/" ]
Try passing `SPIF_SENDCHANGE` (which is *2*) as the last parameter. You might also need to bitwise-or it with `SPIF_UPDATEINIFILE` (which is *1*).
Sorry, I know this is late, but the problem is that you need to include the path. Instead of "image.jpg" do r"C:\path to file\image.jpg" Otherwise python doesn't know where to look for the image.
21,904
I'm using/learning geodjango + postgis, and I'm trying to calculate distance between 2 cities in Poland. First using WGS84/4326 I define 2 points, and then after transforming this points into spherical mercator 900913 i get distance which is about 40km too long. Which map projection should I use then? Where can I find ...
2012/03/19
[ "https://gis.stackexchange.com/questions/21904", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/6434/" ]
That's what picking a decent map projection is all about. I don't know your lat/long range but you can query projections relevant to a lat/long bounding box at the [EPSG Geodetic Parameter Dataset](http://www.epsg.org/). This should give some codes to test out. EDIT: Thanks for posting your coordinates. When you just ...
Use latitude and longitude and the [great circle distance](http://en.wikipedia.org/wiki/Great-circle_distance), not a map projection.
21,904
I'm using/learning geodjango + postgis, and I'm trying to calculate distance between 2 cities in Poland. First using WGS84/4326 I define 2 points, and then after transforming this points into spherical mercator 900913 i get distance which is about 40km too long. Which map projection should I use then? Where can I find ...
2012/03/19
[ "https://gis.stackexchange.com/questions/21904", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/6434/" ]
Use latitude and longitude and the [great circle distance](http://en.wikipedia.org/wiki/Great-circle_distance), not a map projection.
Based on the 2 points in your comments: ``` 2 cities (lat; long): Slupsk(54.465249;17.026062) and Koszalin(54.193378;16.179428) ``` I used two different approaches. The formula given in [The Aviation Formulary](http://williams.best.vwh.net/avform.htm#Example) I ended up with a distance of 63.116745 KM I also used ...
21,904
I'm using/learning geodjango + postgis, and I'm trying to calculate distance between 2 cities in Poland. First using WGS84/4326 I define 2 points, and then after transforming this points into spherical mercator 900913 i get distance which is about 40km too long. Which map projection should I use then? Where can I find ...
2012/03/19
[ "https://gis.stackexchange.com/questions/21904", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/6434/" ]
That's what picking a decent map projection is all about. I don't know your lat/long range but you can query projections relevant to a lat/long bounding box at the [EPSG Geodetic Parameter Dataset](http://www.epsg.org/). This should give some codes to test out. EDIT: Thanks for posting your coordinates. When you just ...
Based on the 2 points in your comments: ``` 2 cities (lat; long): Slupsk(54.465249;17.026062) and Koszalin(54.193378;16.179428) ``` I used two different approaches. The formula given in [The Aviation Formulary](http://williams.best.vwh.net/avform.htm#Example) I ended up with a distance of 63.116745 KM I also used ...
17,832
I am following climate activist Greta Thunberg's sail to N America from Europe on <https://tracker.borisherrmannracing.com/>. The model shows a cyclonic storm forming south of Nova Scotia, east of New York on August 26, 2019. The same thing can be seen on <https://earth.nullschool.net/>. I wasn't aware that this type o...
2019/08/25
[ "https://earthscience.stackexchange.com/questions/17832", "https://earthscience.stackexchange.com", "https://earthscience.stackexchange.com/users/1242/" ]
A cyclone is nothing more than a low-pressure system. It can surely form in the North Atlantic; in fact, most low-pressure systems that reach Europe form in the North Atlantic. You are probably thinking about a *tropical* cyclone, which indeed cannot form that far north. Among others, a tropical cyclone needs high sea ...
No, it's not normal. Hurricanes and typhoons require sun-warmed seas like the Caribbean or Gulf of Mexico to form, because that's where they get their energy from. When meteorologists talk of cyclones and anticyclones, they are talking about high pressure or low pressure weather systems, not hurricanes and typhoons. St...
57,833,624
I want to use !test epicchannel (epicchannel being the name of the channel , for example if I want to use !test infinite , it will create a channel named testing-infinite ) but it doesn't work. it just makes a channel named testing-test I've tried using message.content.startsWith, but if I do that, nothing happens. `...
2019/09/07
[ "https://Stackoverflow.com/questions/57833624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11761104/" ]
First check if data is not same with: ``` dd($item->item_smallest_unit_cost, $item_unit->item_unit_coast_price); ``` If is data you expected result, you need to save updated item: ``` $item = $item_unit->getItem; $item->item_smallest_unit_cost = $item_unit->item_unit_coast_price; $item->item_smallest_unit_selling_...
`$item->item_smallest_unit_cost = $item_unit->item_unit_coast_price; $item->item_smallest_unit_selling_price = $item_unit->item_unit_selling_price;` instead of this use following ``` $item['item_smallest_unit_cost'] = $item_unit->item_unit_coast_price; $item['item_smallest_unit_selling_price'] = $item_unit->item_uni...
11,324,295
I am developing small android application in which I want to find user current location. My code structure for detecting user location looks like . ``` private void sendSMS(Context context, Intent intent) { final long MINIMUM_DISTANCE_CHANGE_FOR_UPDATES = 1; // in Meters final long MINIMUM_TIME_BETWEEN_UPDA...
2012/07/04
[ "https://Stackoverflow.com/questions/11324295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/861204/" ]
Here is the skeleton of the GPS `Service` I used in my tracking application, it has been tested, and works fine I can guarantee that. I hope it will help you out. ``` import java.util.Timer; import java.util.TimerTask; import android.app.Notification; import android.app.PendingIntent; import android.app.Service; impo...
Nilkash, I experienced the same problem on my Samsung Galaxy 5. I got my problem solved because of your suggestion to change as network provider. Thanks for that Buddy . I got the solution. "Network Provider" determines location based on availability of cell tower and WiFi access points. Results are retrieved by mean...
37,608,276
I'm trying to load an external OpenCL kernel and the `clCreateKernel` returns an error code: -46 `CL_INVALID_KERNEL_NAME`. The file structure is the following: ``` . ├── CMakeLists.txt └── src ├── cl.hpp ├── GameOfLife.cpp └── kernels └── programs.cl ``` This is my first CMake project, thus I'm n...
2016/06/03
[ "https://Stackoverflow.com/questions/37608276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2286520/" ]
Although the following line in CMake solves my problem, I'm still waiting for other answers maybe containing a better solution. ``` configure_file(src/kernels/programs.cl kernels/programs.cl COPYONLY) ```
you should update your path depending from where you build your program If your project looks like this: ``` ── CMakeLists.txt └── src | ├── cl.hpp | ├── GameOfLife.cpp | └── kernels | └── programs.cl └── build ``` and you call "make" from the build directory, the string path should look like this: ...
412,084
A pointer stores/is assigned a memory address; what about a reference variable? it stores the actual value of an object just like any other non-pointer simple variables on Stack? Thanks!
2009/01/05
[ "https://Stackoverflow.com/questions/412084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36064/" ]
A reference does contain nothing in itself. The C++ Standard even states that an implementation is not required to allocate any storage for a reference. It's really just an alias for the object or function that it references. Trying to take the value of a reference will take the value of the object or function (in that...
> > it stores the actual value of an object just like any other non-pointer simple variables on Stack? > > > Not exactly: because you don't have **two** copies of the value (one copy in the object, and another copy in the reference to the object); instead, the reference is probably implemented as a pointer to the ...
412,084
A pointer stores/is assigned a memory address; what about a reference variable? it stores the actual value of an object just like any other non-pointer simple variables on Stack? Thanks!
2009/01/05
[ "https://Stackoverflow.com/questions/412084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36064/" ]
A reference does contain nothing in itself. The C++ Standard even states that an implementation is not required to allocate any storage for a reference. It's really just an alias for the object or function that it references. Trying to take the value of a reference will take the value of the object or function (in that...
I'd say that it's just a pointer with a different syntax.
412,084
A pointer stores/is assigned a memory address; what about a reference variable? it stores the actual value of an object just like any other non-pointer simple variables on Stack? Thanks!
2009/01/05
[ "https://Stackoverflow.com/questions/412084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36064/" ]
A reference does contain nothing in itself. The C++ Standard even states that an implementation is not required to allocate any storage for a reference. It's really just an alias for the object or function that it references. Trying to take the value of a reference will take the value of the object or function (in that...
Internally, it's just a pointer to the object (although the standard not necessarily mandates it, all compilers implement this way). Externally, it behaves like the object itself. Think of it as a pointer with an implicit '\*' operator wherever it is used (except, of course, the declaration). It's also a const-pointer ...
40,790,385
I have a strange behavior, I have developed a hybrid app with ionic, afterwards I have installed it at my mobile with this command: [![Installation of apk](https://i.stack.imgur.com/5Hgch.png)](https://i.stack.imgur.com/5Hgch.png) everything was fine, but on my phone I cannot find this app and also cannot find this p...
2016/11/24
[ "https://Stackoverflow.com/questions/40790385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3318489/" ]
To run on device - ``` ionic run android ``` This will install application on mobile
1. Testing as a native app $ ionic run android [More about testing as a native app](https://ionicframework.com/docs/guide/testing.html) 2. To generate a release build for Android $ cordova build --release android [Android Publishing](https://ionicframework.com/docs/guide/publishing.html)
22,684
Card 0: **title** ``` the answer to each card is a single english word the cards dont have to be solved in order but some cards refer back to previous answers each card has a title which is a clue that is usually essential to the puzzle sometimes the title has to be interpreted cleverly good luck ``` --- Card 1: **...
2015/09/29
[ "https://puzzling.stackexchange.com/questions/22684", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/11100/" ]
Partial answer: Card 1: > > Count the W's in each line, interpret as two-digit numbers, and subtract 55 to get `22 01 21 12 20`. With 1-26 representing A-Z, this spells `VAULT`. > > > Card 3: > > Take the first letters of each word without a y to get `MERGE`. > > > Card 5: > > The title is an anagram of ...
Card 6 > > Turns/torus/tyres etc, based on f"'s answers and guessing the most likely results for t?r?s. Much less conclusive when I've read the clue properly. It looks like they may all be 5 letter words > > > Card 7 > > **wiles** Guessing that determin. means take the determinant, and that a=1,b=2..., the de...
22,684
Card 0: **title** ``` the answer to each card is a single english word the cards dont have to be solved in order but some cards refer back to previous answers each card has a title which is a clue that is usually essential to the puzzle sometimes the title has to be interpreted cleverly good luck ``` --- Card 1: **...
2015/09/29
[ "https://puzzling.stackexchange.com/questions/22684", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/11100/" ]
Partial answer: Card 1: > > Count the W's in each line, interpret as two-digit numbers, and subtract 55 to get `22 01 21 12 20`. With 1-26 representing A-Z, this spells `VAULT`. > > > Card 3: > > Take the first letters of each word without a y to get `MERGE`. > > > Card 5: > > The title is an anagram of ...
Partial answer, building on f\*'s answer to the first card. Card 2: > > The card reads **1 + 2 = npwan**. 1 refers to the word on the first card, `VAULT`. The plus means to add the letters' indices (starting with `A = 0`) individually without carry, i.e. modulo 26. The resulting digits are interpreted as letters ag...
22,684
Card 0: **title** ``` the answer to each card is a single english word the cards dont have to be solved in order but some cards refer back to previous answers each card has a title which is a clue that is usually essential to the puzzle sometimes the title has to be interpreted cleverly good luck ``` --- Card 1: **...
2015/09/29
[ "https://puzzling.stackexchange.com/questions/22684", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/11100/" ]
Partial answer, building on f\*'s answer to the first card. Card 2: > > The card reads **1 + 2 = npwan**. 1 refers to the word on the first card, `VAULT`. The plus means to add the letters' indices (starting with `A = 0`) individually without carry, i.e. modulo 26. The resulting digits are interpreted as letters ag...
Card 6 > > Turns/torus/tyres etc, based on f"'s answers and guessing the most likely results for t?r?s. Much less conclusive when I've read the clue properly. It looks like they may all be 5 letter words > > > Card 7 > > **wiles** Guessing that determin. means take the determinant, and that a=1,b=2..., the de...
67,954,931
I am making a simulation with C (for perfomance) that (currently) uses recursion and mallocs (generated in every step of the recursion). The problem is that I am not being able to free the mallocs anywhere in the code, without having the wrong final output. The code consist of two functions and the main function: `evo...
2021/06/13
[ "https://Stackoverflow.com/questions/67954931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11056678/" ]
You're supposed to free memory right after the last time it will be used. In your program, after the `while` loop in `recursion`, `Energy` isn't used again, so you should free it right after that (i.e., right before `return event_counter;`).
Joseph Sible-Reinstate Monica is correct about the question you asked. But your code can be improved in a number of areas. If you want to see the final version, you should scroll all the way to the bottom of my answer for `run_simulation`, which is a dramatically better version of your `recursion` function. Let's star...
60,051,250
I've specified a custom type which takes two floats and makes them a pair (a complex number): ``` type complex = (float * float);; let makeComplex x y = complex(x,y);; ``` The `makeComplex`function is of type `float -> float -> complex`, which is entirely correct. However, I want to create a function that takes a c...
2020/02/04
[ "https://Stackoverflow.com/questions/60051250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11055427/" ]
Type abbreviations do not hide or create a type distinct from their definitions. `complex` and `float * float` are still fully exchangeable, You've just given it another name. The idiomatic way to make a distinct type in F# is to use a single-case discriminated union: ``` type complex = Complex of float * float ``` ...
If you still really want to use type abbreviation, then use type annotation, like this: ``` type complex = float * float let complexToPair: complex -> float * float = id ```
60,051,250
I've specified a custom type which takes two floats and makes them a pair (a complex number): ``` type complex = (float * float);; let makeComplex x y = complex(x,y);; ``` The `makeComplex`function is of type `float -> float -> complex`, which is entirely correct. However, I want to create a function that takes a c...
2020/02/04
[ "https://Stackoverflow.com/questions/60051250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11055427/" ]
Type abbreviations do not hide or create a type distinct from their definitions. `complex` and `float * float` are still fully exchangeable, You've just given it another name. The idiomatic way to make a distinct type in F# is to use a single-case discriminated union: ``` type complex = Complex of float * float ``` ...
You can create a class: ```ml type Complex(x:float, y:float) = member t.Real = x member t.Imaginary = y ``` Or a record: ```ml type Complex = { Real:float; Imaginary:float } ``` These will be distinct types and also allow you to create and organize useful methods (such as arithmetic operators).
60,051,250
I've specified a custom type which takes two floats and makes them a pair (a complex number): ``` type complex = (float * float);; let makeComplex x y = complex(x,y);; ``` The `makeComplex`function is of type `float -> float -> complex`, which is entirely correct. However, I want to create a function that takes a c...
2020/02/04
[ "https://Stackoverflow.com/questions/60051250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11055427/" ]
If you still really want to use type abbreviation, then use type annotation, like this: ``` type complex = float * float let complexToPair: complex -> float * float = id ```
You can create a class: ```ml type Complex(x:float, y:float) = member t.Real = x member t.Imaginary = y ``` Or a record: ```ml type Complex = { Real:float; Imaginary:float } ``` These will be distinct types and also allow you to create and organize useful methods (such as arithmetic operators).
59,854,453
Assuming that ``` outputTemp = 2×1 cell array {122×1 string} {220×1 string} ``` `finalOutput` is a string array (`342x1 string`). is there any way to do the following ``` outputTemp = arrayfun(@(x)someFunc(x), someInput, 'UniformOutput', false)'; finalOutput= [outputTemp{1}; outputTemp{2}]; ``` in o...
2020/01/22
[ "https://Stackoverflow.com/questions/59854453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8443371/" ]
change your requirements.txt to this (without specifying the versions, so that pip will install latest versions) ``` asgiref beautifulsoup4 certifi chardet Click Django idna pytz requests six soupsieve sqlparse urllib3 ```
You can also look at this [question](https://stackoverflow.com/questions/24764549/upgrade-python-packages-from-requirements-txt-using-pip-command). From this question I took one of the answers which I think can solve your problem. It will not remove the package version but whenever you will install the requiremwnts.txt...
59,854,453
Assuming that ``` outputTemp = 2×1 cell array {122×1 string} {220×1 string} ``` `finalOutput` is a string array (`342x1 string`). is there any way to do the following ``` outputTemp = arrayfun(@(x)someFunc(x), someInput, 'UniformOutput', false)'; finalOutput= [outputTemp{1}; outputTemp{2}]; ``` in o...
2020/01/22
[ "https://Stackoverflow.com/questions/59854453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8443371/" ]
you can parse the `requirements.txt` file with python itself and get your package names and split it manually like below: ``` with open("requirements.txt") as myFile: pkgs = myFile.read() pkgs = pkgs.splitlines() for pkg in pkgs: print(pkg.split('==')[0]) ``` this will give you something like below: [!...
You can also look at this [question](https://stackoverflow.com/questions/24764549/upgrade-python-packages-from-requirements-txt-using-pip-command). From this question I took one of the answers which I think can solve your problem. It will not remove the package version but whenever you will install the requiremwnts.txt...
59,854,453
Assuming that ``` outputTemp = 2×1 cell array {122×1 string} {220×1 string} ``` `finalOutput` is a string array (`342x1 string`). is there any way to do the following ``` outputTemp = arrayfun(@(x)someFunc(x), someInput, 'UniformOutput', false)'; finalOutput= [outputTemp{1}; outputTemp{2}]; ``` in o...
2020/01/22
[ "https://Stackoverflow.com/questions/59854453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8443371/" ]
You need to change the `requirement.txt` file to remove all the version dependencies. you can parse the file for that. Or use regex. `==\w+.+.+` This will select all the element after symbol == including the symbol. Replace with null empty string. Open the requirements.txt in some editor that support regex (for exa...
Use `sed` to remove version info from your `requirements.txt` file. e.g. ``` sed 's/==.*$//' requirements.txt ``` will give output ``` asgiref beautifulsoup4 certifi chardet Click Django idna pytz requests six soupsieve sqlparse urllib3 ``` and this can be piped into `pip` to do the install ``` sed 's/==.*$//' r...
59,854,453
Assuming that ``` outputTemp = 2×1 cell array {122×1 string} {220×1 string} ``` `finalOutput` is a string array (`342x1 string`). is there any way to do the following ``` outputTemp = arrayfun(@(x)someFunc(x), someInput, 'UniformOutput', false)'; finalOutput= [outputTemp{1}; outputTemp{2}]; ``` in o...
2020/01/22
[ "https://Stackoverflow.com/questions/59854453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8443371/" ]
Consider if you had written your app in Django 2.x a few months ago and just had `Django` as dependency listed in your `requirements.txt`. Now that Django 3 is out, installing it now would cause a major version jump from Django 2 to 3 and *potentially* break half your app. And that’s just *one* of your dependencies. ...
You can also look at this [question](https://stackoverflow.com/questions/24764549/upgrade-python-packages-from-requirements-txt-using-pip-command). From this question I took one of the answers which I think can solve your problem. It will not remove the package version but whenever you will install the requiremwnts.txt...
59,854,453
Assuming that ``` outputTemp = 2×1 cell array {122×1 string} {220×1 string} ``` `finalOutput` is a string array (`342x1 string`). is there any way to do the following ``` outputTemp = arrayfun(@(x)someFunc(x), someInput, 'UniformOutput', false)'; finalOutput= [outputTemp{1}; outputTemp{2}]; ``` in o...
2020/01/22
[ "https://Stackoverflow.com/questions/59854453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8443371/" ]
you can parse the `requirements.txt` file with python itself and get your package names and split it manually like below: ``` with open("requirements.txt") as myFile: pkgs = myFile.read() pkgs = pkgs.splitlines() for pkg in pkgs: print(pkg.split('==')[0]) ``` this will give you something like below: [!...
Consider if you had written your app in Django 2.x a few months ago and just had `Django` as dependency listed in your `requirements.txt`. Now that Django 3 is out, installing it now would cause a major version jump from Django 2 to 3 and *potentially* break half your app. And that’s just *one* of your dependencies. ...
59,854,453
Assuming that ``` outputTemp = 2×1 cell array {122×1 string} {220×1 string} ``` `finalOutput` is a string array (`342x1 string`). is there any way to do the following ``` outputTemp = arrayfun(@(x)someFunc(x), someInput, 'UniformOutput', false)'; finalOutput= [outputTemp{1}; outputTemp{2}]; ``` in o...
2020/01/22
[ "https://Stackoverflow.com/questions/59854453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8443371/" ]
Consider if you had written your app in Django 2.x a few months ago and just had `Django` as dependency listed in your `requirements.txt`. Now that Django 3 is out, installing it now would cause a major version jump from Django 2 to 3 and *potentially* break half your app. And that’s just *one* of your dependencies. ...
You need to change the `requirement.txt` file to remove all the version dependencies. you can parse the file for that. Or use regex. `==\w+.+.+` This will select all the element after symbol == including the symbol. Replace with null empty string. Open the requirements.txt in some editor that support regex (for exa...
59,854,453
Assuming that ``` outputTemp = 2×1 cell array {122×1 string} {220×1 string} ``` `finalOutput` is a string array (`342x1 string`). is there any way to do the following ``` outputTemp = arrayfun(@(x)someFunc(x), someInput, 'UniformOutput', false)'; finalOutput= [outputTemp{1}; outputTemp{2}]; ``` in o...
2020/01/22
[ "https://Stackoverflow.com/questions/59854453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8443371/" ]
Consider if you had written your app in Django 2.x a few months ago and just had `Django` as dependency listed in your `requirements.txt`. Now that Django 3 is out, installing it now would cause a major version jump from Django 2 to 3 and *potentially* break half your app. And that’s just *one* of your dependencies. ...
Use `sed` to remove version info from your `requirements.txt` file. e.g. ``` sed 's/==.*$//' requirements.txt ``` will give output ``` asgiref beautifulsoup4 certifi chardet Click Django idna pytz requests six soupsieve sqlparse urllib3 ``` and this can be piped into `pip` to do the install ``` sed 's/==.*$//' r...
59,854,453
Assuming that ``` outputTemp = 2×1 cell array {122×1 string} {220×1 string} ``` `finalOutput` is a string array (`342x1 string`). is there any way to do the following ``` outputTemp = arrayfun(@(x)someFunc(x), someInput, 'UniformOutput', false)'; finalOutput= [outputTemp{1}; outputTemp{2}]; ``` in o...
2020/01/22
[ "https://Stackoverflow.com/questions/59854453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8443371/" ]
You can also look at this [question](https://stackoverflow.com/questions/24764549/upgrade-python-packages-from-requirements-txt-using-pip-command). From this question I took one of the answers which I think can solve your problem. It will not remove the package version but whenever you will install the requiremwnts.txt...
Use `sed` to remove version info from your `requirements.txt` file. e.g. ``` sed 's/==.*$//' requirements.txt ``` will give output ``` asgiref beautifulsoup4 certifi chardet Click Django idna pytz requests six soupsieve sqlparse urllib3 ``` and this can be piped into `pip` to do the install ``` sed 's/==.*$//' r...
59,854,453
Assuming that ``` outputTemp = 2×1 cell array {122×1 string} {220×1 string} ``` `finalOutput` is a string array (`342x1 string`). is there any way to do the following ``` outputTemp = arrayfun(@(x)someFunc(x), someInput, 'UniformOutput', false)'; finalOutput= [outputTemp{1}; outputTemp{2}]; ``` in o...
2020/01/22
[ "https://Stackoverflow.com/questions/59854453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8443371/" ]
you can parse the `requirements.txt` file with python itself and get your package names and split it manually like below: ``` with open("requirements.txt") as myFile: pkgs = myFile.read() pkgs = pkgs.splitlines() for pkg in pkgs: print(pkg.split('==')[0]) ``` this will give you something like below: [!...
Use `sed` to remove version info from your `requirements.txt` file. e.g. ``` sed 's/==.*$//' requirements.txt ``` will give output ``` asgiref beautifulsoup4 certifi chardet Click Django idna pytz requests six soupsieve sqlparse urllib3 ``` and this can be piped into `pip` to do the install ``` sed 's/==.*$//' r...
59,854,453
Assuming that ``` outputTemp = 2×1 cell array {122×1 string} {220×1 string} ``` `finalOutput` is a string array (`342x1 string`). is there any way to do the following ``` outputTemp = arrayfun(@(x)someFunc(x), someInput, 'UniformOutput', false)'; finalOutput= [outputTemp{1}; outputTemp{2}]; ``` in o...
2020/01/22
[ "https://Stackoverflow.com/questions/59854453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8443371/" ]
you can parse the `requirements.txt` file with python itself and get your package names and split it manually like below: ``` with open("requirements.txt") as myFile: pkgs = myFile.read() pkgs = pkgs.splitlines() for pkg in pkgs: print(pkg.split('==')[0]) ``` this will give you something like below: [!...
You need to change the `requirement.txt` file to remove all the version dependencies. you can parse the file for that. Or use regex. `==\w+.+.+` This will select all the element after symbol == including the symbol. Replace with null empty string. Open the requirements.txt in some editor that support regex (for exa...
3,757,350
I know what causes a PHP page to consistently download instead of running normally, but I have no idea why it would only sometimes download and sometimes run normally. It appears to be purely random: I just keep hitting Refresh until it stops trying to download and runs normally. This page has a lot of jQuery/AJAX scr...
2010/09/21
[ "https://Stackoverflow.com/questions/3757350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453464/" ]
At the top of your php page ``` <?php header('Content-Type: text/html'); ``` Should do the trick. The problem is that the wrong MIME Type is being sent over, confusing your browser to the point that it doesn't know what do do with it so it just downloads it.
I've seen this happen if your script crashes the PHP interpreter. Apart from finding the cause of the crash, I'm not sure what you can do.
3,757,350
I know what causes a PHP page to consistently download instead of running normally, but I have no idea why it would only sometimes download and sometimes run normally. It appears to be purely random: I just keep hitting Refresh until it stops trying to download and runs normally. This page has a lot of jQuery/AJAX scr...
2010/09/21
[ "https://Stackoverflow.com/questions/3757350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453464/" ]
At the top of your php page ``` <?php header('Content-Type: text/html'); ``` Should do the trick. The problem is that the wrong MIME Type is being sent over, confusing your browser to the point that it doesn't know what do do with it so it just downloads it.
Andrew Dunn said it right with `<?php header('Content-Type: text/html');` But also add this to your .htaccess file ``` AddHandler application/x-httpd-php .php ..html AddHandler x-httpd-php .php ..html ``` And then clear your browser cache before refreshing or trying to access the page again. This problem has b...
68,641,304
I have a Spring Boot application that is capturing the HTTP response content of REST requests made to the application. I am doing this for the purposes of logging and future analysis of the requests entering the system. Currently, I have this implemented as a filter bean (per [`OncePerRequestFilter`](https://docs.spri...
2021/08/03
[ "https://Stackoverflow.com/questions/68641304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1108305/" ]
You can't do it *quite* that simply. A file is a sequence of bytes. You must first ensure that when you write all of those lines, that you write them to their *final* positions. The easiest way to do this is to "reserve" space for your line count when you first write the file. Much as you have done in your description,...
``` f.seek(0) f.write("line_count = %s\n"%n) f.close() ``` Where n is line count value
68,641,304
I have a Spring Boot application that is capturing the HTTP response content of REST requests made to the application. I am doing this for the purposes of logging and future analysis of the requests entering the system. Currently, I have this implemented as a filter bean (per [`OncePerRequestFilter`](https://docs.spri...
2021/08/03
[ "https://Stackoverflow.com/questions/68641304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1108305/" ]
Here ya go! ``` text = open("textfile.txt").readlines() counter = 0 for row in text: counter += 1 # just snags the total amount of rows newtext = open("textfile.txt","w") newtext.write(f"line_count = {counter}\n\n") # This is your header xoxo for row in text: newtext.write(row) # put all of the original line...
``` f.seek(0) f.write("line_count = %s\n"%n) f.close() ``` Where n is line count value
68,641,304
I have a Spring Boot application that is capturing the HTTP response content of REST requests made to the application. I am doing this for the purposes of logging and future analysis of the requests entering the system. Currently, I have this implemented as a filter bean (per [`OncePerRequestFilter`](https://docs.spri...
2021/08/03
[ "https://Stackoverflow.com/questions/68641304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1108305/" ]
Here ya go! ``` text = open("textfile.txt").readlines() counter = 0 for row in text: counter += 1 # just snags the total amount of rows newtext = open("textfile.txt","w") newtext.write(f"line_count = {counter}\n\n") # This is your header xoxo for row in text: newtext.write(row) # put all of the original line...
You can't do it *quite* that simply. A file is a sequence of bytes. You must first ensure that when you write all of those lines, that you write them to their *final* positions. The easiest way to do this is to "reserve" space for your line count when you first write the file. Much as you have done in your description,...
2,812,144
let $p$ be a Pythagorean prime, and $n$ some integer. Does there necessarily exist a solution to the concurrency $n^2 \equiv (p-1) \mod p$? I've been studying this problem for the last 6 hours, and to no avail. The first thing I did was make a table $$1^2 + 2^2 = 5 \to n^2 \equiv 4 \mod 5 \Rightarrow n = 2,3$$ $$2^2...
2018/06/08
[ "https://math.stackexchange.com/questions/2812144", "https://math.stackexchange.com", "https://math.stackexchange.com/users/556198/" ]
Another way of formulating this is that $-1$ is a quadratic residue modulo $p$, which is well-known for primes $\equiv 1 \bmod 4$ - so yes it is true. There are various ways of proving this. For example you can use Wilson's theorem that $$(p-1)!\equiv -1 \bmod p$$ Now consider $q=\frac {p-1}2$ $$(p-1)!=1\cdot 2\cdot ...
Is a "pythagorean prime" a prime with $p\equiv1$ (mod $4$)? It's a well-known theorem of number theory that the congruence $x^2\equiv-1\pmod p$ has a solution for an odd prime $p$ iff $p\equiv1\pmod 4$.
67,155,497
Below is the table from which I need to create conditionalize view. [![enter image description here](https://i.stack.imgur.com/Nzmgj.png)](https://i.stack.imgur.com/Nzmgj.png) and I am getting one flag from different table. So based on the flag values i.e. if flag=1 then I need to display actual column values from ta...
2021/04/19
[ "https://Stackoverflow.com/questions/67155497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1704622/" ]
There's always the comma operator, although it doesn't make the code any more readable ``` return void_function(), 0; ```
Well, you can always (ab)use preprocessor macros: ``` #define CALL_AND_RETURN(x) {x; return 0;} [...] CALL_AND_RETURN(void_function()); ``` I don't think this is a good idea, though, since it doesn't gain you much and it makes your code harder for other people to understand.
67,155,497
Below is the table from which I need to create conditionalize view. [![enter image description here](https://i.stack.imgur.com/Nzmgj.png)](https://i.stack.imgur.com/Nzmgj.png) and I am getting one flag from different table. So based on the flag values i.e. if flag=1 then I need to display actual column values from ta...
2021/04/19
[ "https://Stackoverflow.com/questions/67155497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1704622/" ]
There's always the comma operator, although it doesn't make the code any more readable ``` return void_function(), 0; ```
Create a lambda that calls void\_function() and returns 0, then from the my\_function() you can return that invoked lambda.
41,880,973
Mandar has graciously written this code for me from this Q/A [in r, how to assess the two vectors based on other vectors](https://stackoverflow.com/questions/41817623/in-r-how-to-assess-the-two-vectors-based-on-other-vectors) ``` names(df) <- c("a","b","c","d") df_backup <- df df$newcol <- NA used <- c() for (i in se...
2017/01/26
[ "https://Stackoverflow.com/questions/41880973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7422511/" ]
we can find the nearest compass bearings like this: ``` nearest = function(i,df){ diff = abs(df[i, 1] - df[, 2]) diff = pmin(diff, 360-diff) which.min(diff) } df$nearest_b = sapply(1:NROW(df), nearest, df[1:2]) df$nearest_a = sapply(1:NROW(df), nearest, df[2:1]) # a b nearest_b nearest_a #...
The geosphere package has a few functions that incorporate distance between spherical points. <ftp://cran.r-project.org/pub/R/web/packages/geosphere/geosphere.pdf> I'm not sure it will be what you're looking for - you may have to figure out how the compass bearings in your data translate to the inputs you need. I n...
41,880,973
Mandar has graciously written this code for me from this Q/A [in r, how to assess the two vectors based on other vectors](https://stackoverflow.com/questions/41817623/in-r-how-to-assess-the-two-vectors-based-on-other-vectors) ``` names(df) <- c("a","b","c","d") df_backup <- df df$newcol <- NA used <- c() for (i in se...
2017/01/26
[ "https://Stackoverflow.com/questions/41880973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7422511/" ]
we can find the nearest compass bearings like this: ``` nearest = function(i,df){ diff = abs(df[i, 1] - df[, 2]) diff = pmin(diff, 360-diff) which.min(diff) } df$nearest_b = sapply(1:NROW(df), nearest, df[1:2]) df$nearest_a = sapply(1:NROW(df), nearest, df[2:1]) # a b nearest_b nearest_a #...
Check this code : Just changed how orderx is defined with ifelse Now if the abs difference between angles is > 180, then use the 360-difference (which is lower value); otherwise if the difference is already <=180 use the smaller difference itself ``` setwd("~/Desktop/") df <- read.table("trial.txt",header=T,sep="\t"...
14,641,361
I need to map ntext column of a table using the mapping by code feature in NHibernate 3.2, so that it doesn't get truncated to 4000 characters. What do I neet to change in the following example? "Notes" is the property which has ntext type in sql table: Property(emp => emp.Notes); Note: Please don't mix it with flue...
2013/02/01
[ "https://Stackoverflow.com/questions/14641361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/741507/" ]
Maybe you can try this, which should also work for nvarchar(max) columns : ``` Property(emp => emp.Notes, m => m.Type(NHibernateUtil.StringClob)); ``` Hope this will help
Try: ``` Property(emp => emp.Notes, mapinfo => mapinfo.Lenth(someHighValue)); ``` If the length provided is larger than what can fit in a varchar, NHibernate will switch to a different character type.
14,641,361
I need to map ntext column of a table using the mapping by code feature in NHibernate 3.2, so that it doesn't get truncated to 4000 characters. What do I neet to change in the following example? "Notes" is the property which has ntext type in sql table: Property(emp => emp.Notes); Note: Please don't mix it with flue...
2013/02/01
[ "https://Stackoverflow.com/questions/14641361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/741507/" ]
So, I solved the problem as following: > > Property(emp => emp.Notes, map => map.Column(col => > col.SqlType("ntext"))); > > > Actually, all what we need to do is: tell the NHibernate mapper the actual type of the column in sql. :) The solution comes from [here](http://devio.wordpress.com/2012/02/24/mssql-legac...
Try: ``` Property(emp => emp.Notes, mapinfo => mapinfo.Lenth(someHighValue)); ``` If the length provided is larger than what can fit in a varchar, NHibernate will switch to a different character type.
14,641,361
I need to map ntext column of a table using the mapping by code feature in NHibernate 3.2, so that it doesn't get truncated to 4000 characters. What do I neet to change in the following example? "Notes" is the property which has ntext type in sql table: Property(emp => emp.Notes); Note: Please don't mix it with flue...
2013/02/01
[ "https://Stackoverflow.com/questions/14641361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/741507/" ]
So, I solved the problem as following: > > Property(emp => emp.Notes, map => map.Column(col => > col.SqlType("ntext"))); > > > Actually, all what we need to do is: tell the NHibernate mapper the actual type of the column in sql. :) The solution comes from [here](http://devio.wordpress.com/2012/02/24/mssql-legac...
Maybe you can try this, which should also work for nvarchar(max) columns : ``` Property(emp => emp.Notes, m => m.Type(NHibernateUtil.StringClob)); ``` Hope this will help
4,577,981
I'm reading the [Wikipedia article](https://en.m.wikipedia.org/wiki/Analytic_continuation) on analytic continuation and I got stuck in the last step of the worked example. How to get the following result? $$\sum\_{n=0}^{\infty}(-1)^n{n\choose k}(a-1)^{n-k}=(-1)^ka^{-k-1}$$ Obviously the sum starts from $n=k$ because $...
2022/11/16
[ "https://math.stackexchange.com/questions/4577981", "https://math.stackexchange.com", "https://math.stackexchange.com/users/762068/" ]
> > We obtain > \begin{align\*} > \color{blue}{\sum\_{n=0}^{\infty}}&\color{blue}{(-1)^n{n\choose k}(a-1)^{n-k}}\\ > &=\sum\_{n=k}^{\infty}(-1)^n\binom{n}{k}(a-1)^{n-k}\tag{1}\\ > &=\sum\_{n=0}^{\infty}(-1)^{n+k}\binom{n+k}{k}(a-1)^{n}\tag{2}\\ > &=(-1)^k\sum\_{n=0}^{\infty}\binom{-k-1}{n}(a-1)^{n}\tag{3}\\ > &=(-1)^k...
You need to use this general fact: $$ \sum\_{n= 0}^\infty \binom nkx^n = \frac{x^k}{(1-x)^{k+1}}\qquad (|x|<1) $$ In your case, you want $x=a-1$. To prove this, let $S\_k=\sum\_{n\ge 0}\binom nkx^k$. Using Pascal's identity, $\binom nk=\binom{n-1}{k-1}+\binom {n-1}k$, you can split this into two sums, and derive the e...
418,120
In functional programming, it's often important to optimize any "looping" code to be tail recursive. Tail recursive algorithms are usually split between two functions, however - one which sets up the base case, and another that implements the actual loop. A good (albeit academic) example would be the reverse function. ...
2009/01/06
[ "https://Stackoverflow.com/questions/418120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32998/" ]
I agree with ShreevatsaR, if you don't make the helper function top-level (or worse, put it in the export list), than it doesn't matter what its name is. I tend to call helper functions `f` and `g`. ``` reverse :: [a] -> [a] reverse = f [] where f ys [] = xs f ys (x:xs) = f (x:ys) xs ``` I just use thi...
I use `aux` or `foo_aux` (for main function `foo`), and nest the definition so it's not externally visible.
418,120
In functional programming, it's often important to optimize any "looping" code to be tail recursive. Tail recursive algorithms are usually split between two functions, however - one which sets up the base case, and another that implements the actual loop. A good (albeit academic) example would be the reverse function. ...
2009/01/06
[ "https://Stackoverflow.com/questions/418120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32998/" ]
I tend to add "\_recurse" to the end. So "reverse\_recurse". Not sure where I got that from. I like leaving the base case function simple as you have in your example. It tends to be the "public" function and the fact that it uses a helper function to perform the iteration is irrelevant to the caller. In javascript I so...
setup and execute example: ``` function whateverSetup() { ... } function whateverExecute() { ... } ```
418,120
In functional programming, it's often important to optimize any "looping" code to be tail recursive. Tail recursive algorithms are usually split between two functions, however - one which sets up the base case, and another that implements the actual loop. A good (albeit academic) example would be the reverse function. ...
2009/01/06
[ "https://Stackoverflow.com/questions/418120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32998/" ]
I agree with ShreevatsaR, if you don't make the helper function top-level (or worse, put it in the export list), than it doesn't matter what its name is. I tend to call helper functions `f` and `g`. ``` reverse :: [a] -> [a] reverse = f [] where f ys [] = xs f ys (x:xs) = f (x:ys) xs ``` I just use thi...
setup and execute example: ``` function whateverSetup() { ... } function whateverExecute() { ... } ```
418,120
In functional programming, it's often important to optimize any "looping" code to be tail recursive. Tail recursive algorithms are usually split between two functions, however - one which sets up the base case, and another that implements the actual loop. A good (albeit academic) example would be the reverse function. ...
2009/01/06
[ "https://Stackoverflow.com/questions/418120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32998/" ]
You can call the helper function anything you want, and it won't matter as long as you don't put the helper function in the "global" namespace. Simply adding a "prime" seems a common practice. :) E.g., in Haskell, ``` reverse :: [a] -> [a] reverse = reverse' [] where reverse' :: [a] -> [a] -> [a] reverse...
I also agree with ShreevatsaR, in this example I would make the helper a private function. For other cases where I need helper functions to be visible in the whole module, but not exported, I tend to prefix functions with '\_'. Sure, there is the explicit exports statement but during development I tend to export all f...
418,120
In functional programming, it's often important to optimize any "looping" code to be tail recursive. Tail recursive algorithms are usually split between two functions, however - one which sets up the base case, and another that implements the actual loop. A good (albeit academic) example would be the reverse function. ...
2009/01/06
[ "https://Stackoverflow.com/questions/418120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32998/" ]
I also agree with ShreevatsaR, in this example I would make the helper a private function. For other cases where I need helper functions to be visible in the whole module, but not exported, I tend to prefix functions with '\_'. Sure, there is the explicit exports statement but during development I tend to export all f...
setup and execute example: ``` function whateverSetup() { ... } function whateverExecute() { ... } ```
418,120
In functional programming, it's often important to optimize any "looping" code to be tail recursive. Tail recursive algorithms are usually split between two functions, however - one which sets up the base case, and another that implements the actual loop. A good (albeit academic) example would be the reverse function. ...
2009/01/06
[ "https://Stackoverflow.com/questions/418120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32998/" ]
I always use do\_, like "do\_compute" with "compute". I find it quite descriptive as it is effectively the part of the function that performs the action, whereas the "compute" that gets called needs to have a simple descriptive name for the outside world.
I also agree with ShreevatsaR, in this example I would make the helper a private function. For other cases where I need helper functions to be visible in the whole module, but not exported, I tend to prefix functions with '\_'. Sure, there is the explicit exports statement but during development I tend to export all f...
418,120
In functional programming, it's often important to optimize any "looping" code to be tail recursive. Tail recursive algorithms are usually split between two functions, however - one which sets up the base case, and another that implements the actual loop. A good (albeit academic) example would be the reverse function. ...
2009/01/06
[ "https://Stackoverflow.com/questions/418120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32998/" ]
I tend to add "\_recurse" to the end. So "reverse\_recurse". Not sure where I got that from. I like leaving the base case function simple as you have in your example. It tends to be the "public" function and the fact that it uses a helper function to perform the iteration is irrelevant to the caller. In javascript I so...
I also agree with ShreevatsaR, in this example I would make the helper a private function. For other cases where I need helper functions to be visible in the whole module, but not exported, I tend to prefix functions with '\_'. Sure, there is the explicit exports statement but during development I tend to export all f...
418,120
In functional programming, it's often important to optimize any "looping" code to be tail recursive. Tail recursive algorithms are usually split between two functions, however - one which sets up the base case, and another that implements the actual loop. A good (albeit academic) example would be the reverse function. ...
2009/01/06
[ "https://Stackoverflow.com/questions/418120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32998/" ]
I agree with ShreevatsaR, if you don't make the helper function top-level (or worse, put it in the export list), than it doesn't matter what its name is. I tend to call helper functions `f` and `g`. ``` reverse :: [a] -> [a] reverse = f [] where f ys [] = xs f ys (x:xs) = f (x:ys) xs ``` I just use thi...
I also agree with ShreevatsaR, in this example I would make the helper a private function. For other cases where I need helper functions to be visible in the whole module, but not exported, I tend to prefix functions with '\_'. Sure, there is the explicit exports statement but during development I tend to export all f...
418,120
In functional programming, it's often important to optimize any "looping" code to be tail recursive. Tail recursive algorithms are usually split between two functions, however - one which sets up the base case, and another that implements the actual loop. A good (albeit academic) example would be the reverse function. ...
2009/01/06
[ "https://Stackoverflow.com/questions/418120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32998/" ]
I use `aux` or `foo_aux` (for main function `foo`), and nest the definition so it's not externally visible.
setup and execute example: ``` function whateverSetup() { ... } function whateverExecute() { ... } ```
418,120
In functional programming, it's often important to optimize any "looping" code to be tail recursive. Tail recursive algorithms are usually split between two functions, however - one which sets up the base case, and another that implements the actual loop. A good (albeit academic) example would be the reverse function. ...
2009/01/06
[ "https://Stackoverflow.com/questions/418120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32998/" ]
You can call the helper function anything you want, and it won't matter as long as you don't put the helper function in the "global" namespace. Simply adding a "prime" seems a common practice. :) E.g., in Haskell, ``` reverse :: [a] -> [a] reverse = reverse' [] where reverse' :: [a] -> [a] -> [a] reverse...
I always use do\_, like "do\_compute" with "compute". I find it quite descriptive as it is effectively the part of the function that performs the action, whereas the "compute" that gets called needs to have a simple descriptive name for the outside world.
8,861,015
s it possible to remove cancel button or override cancel button function from local notification view?If yes then how we can achieve this
2012/01/14
[ "https://Stackoverflow.com/questions/8861015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1125018/" ]
Have you [checked](http://www.java.com/en/download/testjava.jsp) that the [Java plugin](http://support.mozilla.org/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox) is working in Firefox? Edit: Apparently, FF [requires](http://www.java.com/en/download/faq/firefox_newplugin.xml) Java 6 Update 10 (or above) to work...
I had made these changes and after that it was working fine for me after searching a lot. Go to * Control panel * Java Control Panel * Java Tab View * IN run time parameters add this line ```none -Djava.net.preferIPv4Stack=true ```
3,316,120
I am a sole developer currently backing up my source code to .zip files on an external drive. Is it worthwhile for me to start looking at code repositories? What's the simplest, cheapest option for me? (ie. There is no need for lots of fancy features as the repository is just as a backup and not for sharing with a team...
2010/07/23
[ "https://Stackoverflow.com/questions/3316120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/384141/" ]
Get yourself subversion, mercurial, git, cvs, anything is a vast improvement over zip files. You can generally get free plugins for VS as well although they aren't necessary.
I've used Mercurial which has a plugin for VS2010 that can be found here: <http://visualhg.codeplex.com/> But, as GIT does also, you can use it via command line.
3,316,120
I am a sole developer currently backing up my source code to .zip files on an external drive. Is it worthwhile for me to start looking at code repositories? What's the simplest, cheapest option for me? (ie. There is no need for lots of fancy features as the repository is just as a backup and not for sharing with a team...
2010/07/23
[ "https://Stackoverflow.com/questions/3316120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/384141/" ]
Get yourself subversion, mercurial, git, cvs, anything is a vast improvement over zip files. You can generally get free plugins for VS as well although they aren't necessary.
Since you're working with VS2010 I suggest you start working with [**TFS2010 Basic**](https://devblogs.microsoft.com/bharry/tfs-2010-for-sourcesafe-users/).
3,316,120
I am a sole developer currently backing up my source code to .zip files on an external drive. Is it worthwhile for me to start looking at code repositories? What's the simplest, cheapest option for me? (ie. There is no need for lots of fancy features as the repository is just as a backup and not for sharing with a team...
2010/07/23
[ "https://Stackoverflow.com/questions/3316120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/384141/" ]
Get yourself subversion, mercurial, git, cvs, anything is a vast improvement over zip files. You can generally get free plugins for VS as well although they aren't necessary.
SVN would be perfect for you!! I use Visual Studio 2010 as well, and there's a great open source plugin for working with SVN - [AnkhSVN](http://ankhsvn.open.collab.net/)
3,316,120
I am a sole developer currently backing up my source code to .zip files on an external drive. Is it worthwhile for me to start looking at code repositories? What's the simplest, cheapest option for me? (ie. There is no need for lots of fancy features as the repository is just as a backup and not for sharing with a team...
2010/07/23
[ "https://Stackoverflow.com/questions/3316120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/384141/" ]
Anything would be better then zip files. For personal projects I would start with Git or SVN. Both are free and have addons for VS.
I've used Mercurial which has a plugin for VS2010 that can be found here: <http://visualhg.codeplex.com/> But, as GIT does also, you can use it via command line.
3,316,120
I am a sole developer currently backing up my source code to .zip files on an external drive. Is it worthwhile for me to start looking at code repositories? What's the simplest, cheapest option for me? (ie. There is no need for lots of fancy features as the repository is just as a backup and not for sharing with a team...
2010/07/23
[ "https://Stackoverflow.com/questions/3316120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/384141/" ]
Anything would be better then zip files. For personal projects I would start with Git or SVN. Both are free and have addons for VS.
Since you're working with VS2010 I suggest you start working with [**TFS2010 Basic**](https://devblogs.microsoft.com/bharry/tfs-2010-for-sourcesafe-users/).
3,316,120
I am a sole developer currently backing up my source code to .zip files on an external drive. Is it worthwhile for me to start looking at code repositories? What's the simplest, cheapest option for me? (ie. There is no need for lots of fancy features as the repository is just as a backup and not for sharing with a team...
2010/07/23
[ "https://Stackoverflow.com/questions/3316120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/384141/" ]
Anything would be better then zip files. For personal projects I would start with Git or SVN. Both are free and have addons for VS.
SVN would be perfect for you!! I use Visual Studio 2010 as well, and there's a great open source plugin for working with SVN - [AnkhSVN](http://ankhsvn.open.collab.net/)
3,316,120
I am a sole developer currently backing up my source code to .zip files on an external drive. Is it worthwhile for me to start looking at code repositories? What's the simplest, cheapest option for me? (ie. There is no need for lots of fancy features as the repository is just as a backup and not for sharing with a team...
2010/07/23
[ "https://Stackoverflow.com/questions/3316120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/384141/" ]
I've used Mercurial which has a plugin for VS2010 that can be found here: <http://visualhg.codeplex.com/> But, as GIT does also, you can use it via command line.
Since you're working with VS2010 I suggest you start working with [**TFS2010 Basic**](https://devblogs.microsoft.com/bharry/tfs-2010-for-sourcesafe-users/).
3,316,120
I am a sole developer currently backing up my source code to .zip files on an external drive. Is it worthwhile for me to start looking at code repositories? What's the simplest, cheapest option for me? (ie. There is no need for lots of fancy features as the repository is just as a backup and not for sharing with a team...
2010/07/23
[ "https://Stackoverflow.com/questions/3316120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/384141/" ]
SVN would be perfect for you!! I use Visual Studio 2010 as well, and there's a great open source plugin for working with SVN - [AnkhSVN](http://ankhsvn.open.collab.net/)
Since you're working with VS2010 I suggest you start working with [**TFS2010 Basic**](https://devblogs.microsoft.com/bharry/tfs-2010-for-sourcesafe-users/).
20,979,456
I'm trying to make a website with links rotating around a circle. (Something like this) <http://i.imgur.com/i9DzASw.jpg?1> with the different images and texts leading to different urls. The image is one unified image that also rotates as the user scrolls. Is there anyway I can do this? Also is there a way to make the p...
2014/01/07
[ "https://Stackoverflow.com/questions/20979456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3170382/" ]
Ok, finally I had found the problem !!! Encoding of PDO is the problem... Just adjusted driver options and all works good! ``` PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'') ``` Thanks guys anyway!
how about whitelisting? ie allow only valid characters regex\_replace `[^-_.@a-zA-Z]` with `''`
20,979,456
I'm trying to make a website with links rotating around a circle. (Something like this) <http://i.imgur.com/i9DzASw.jpg?1> with the different images and texts leading to different urls. The image is one unified image that also rotates as the user scrolls. Is there anyway I can do this? Also is there a way to make the p...
2014/01/07
[ "https://Stackoverflow.com/questions/20979456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3170382/" ]
how about whitelisting? ie allow only valid characters regex\_replace `[^-_.@a-zA-Z]` with `''`
Found that on MySQL checking against CHAR(160) does not work.For UTF-8 NBSP the below worked for me: ``` REPLACE(the_field, UNHEX('C2A0'), ' '). ``` Solution provided on similar stack overflow question [Whitespace in a database field is not removed by trim()](https://stackoverflow.com/a/44262935)
20,979,456
I'm trying to make a website with links rotating around a circle. (Something like this) <http://i.imgur.com/i9DzASw.jpg?1> with the different images and texts leading to different urls. The image is one unified image that also rotates as the user scrolls. Is there anyway I can do this? Also is there a way to make the p...
2014/01/07
[ "https://Stackoverflow.com/questions/20979456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3170382/" ]
Ok, finally I had found the problem !!! Encoding of PDO is the problem... Just adjusted driver options and all works good! ``` PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'') ``` Thanks guys anyway!
Found that on MySQL checking against CHAR(160) does not work.For UTF-8 NBSP the below worked for me: ``` REPLACE(the_field, UNHEX('C2A0'), ' '). ``` Solution provided on similar stack overflow question [Whitespace in a database field is not removed by trim()](https://stackoverflow.com/a/44262935)
44,556,536
I have a web app where the client side is developed in Javascript. I have already enabled Azure AD login for my app by configuring it at portal.azure.com. Then, every time when this app loads, users are required to log in, if they have not. I would like to have some Javascript in my client side so the app knows the us...
2017/06/15
[ "https://Stackoverflow.com/questions/44556536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8163283/" ]
That seems you are using "Authentication / Authorization" feature of azure app service and the identity provide is azure ad . If you want to access the tokens from a client (like JavaScript in a browser), or if you want to get a richer set of information about the logged in user, you can also send an authenticated GET ...
Thanks, Yan. That pretty solves my problem, only with little revision to your code. My situation is that I need to retrieve the user name first before generating the later part of my app. So, I removed the outer wrapper *$(document).ready(function(){}*. Correct me if I am wrong. Probably this out wrapper is telling thi...
64,690,799
i`m using Vue and wanna use async/await to give a sequence for my function A and B ``` result is false by default mounted() { this.A(); this.B(); } async A() { this.result = await this.$api... } async B() { if(this.result) let data = await this.$another1 api... else let data = await this.$another2 api...
2020/11/05
[ "https://Stackoverflow.com/questions/64690799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13531705/" ]
If you are coding in SwiftUI 2 you can convert your Color to UIColor and use getRed method to get the red, green, blue and alpha components. Once you have the components you can convert the values to hexa string: --- ``` extension Color { var uiColor: UIColor { .init(self) } typealias RGBA = (red: CGFloat, gr...
Isn't it good to use it like this? ``` import UIKit extension UIColor { convenience init(hex:Int, alpha: CGFloat = 1.0) { self.init( red: CGFloat((hex & 0xFF0000) >> 16) / 255.0, green: CGFloat((hex & 0x00FF00) >> 8) / 255.0, blue: CGFloat((hex & 0x0000FF) >> 0...
31,632,824
I know there are many threads already on 'spark streaming connection refused' issues. But most of these are in Linux or at least pointing to HDFS. I am running this on my local laptop with Windows. I am running a very simple basic Spark streaming standalone application, just to see how the streaming works. Not doing a...
2015/07/26
[ "https://Stackoverflow.com/questions/31632824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5057753/" ]
Within the code for `socketTextStream`, Spark creates an instance of `SocketInputDStream` which uses `java.net.Socket` <https://github.com/apache/spark/blob/master/streaming/src/main/scala/org/apache/spark/streaming/dstream/SocketInputDStream.scala#L73> `java.net.Socket` is a client socket, which means it is expecting...
Make sure to start the netcat or the port connection before you run the program. nc -lk 8080
113,595
Is there any ranking as to the usefulness or rarity of some of the offered quest rewards? Yes, I know that its possible to just run through the content multiple times and get all of them - but I don't want to do that yet, my furthest char is Act 2 Normal ;) What considerations should I think of, for e.g. when choosing...
2013/04/10
[ "https://gaming.stackexchange.com/questions/113595", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/25150/" ]
If you get offered 2 or more gems that you actually need for your character then pick the one that's harder to find and more expensive to buy from other players. Of course you should also check which gems you'll be getting from quests in the near future in case one of those gems will appear as reward again. [Check them...
For reference to anyone coming to this question post-2.0.0 update of the game, most, if not all, gems that are quest rewards can subsequently be bought from vendors.
25,934,325
I have an App Engine application which uses Google Cloud SQL, and from a page in my application I am doing some database operation; whenever this page is accessed, it is not able to perform all database operations. When I go to the console, all I see is `/_ah/queue/__deferred__`. I am able to run the application with...
2014/09/19
[ "https://Stackoverflow.com/questions/25934325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3776061/" ]
I had a similar issue. I've found that that in one of my filters was opening session for each incomming connection: ``` httpRequest.getSession(true); //or the one below - both opens a valid HTTP Session httpRequest.getSession(); ``` and my *appengine-web.xml* was configured to store session asynchronously ``` <sess...
Unless you specified a queue name, all deferred tasks go into the "default" Task Queue. From there, you can rerun and if you are on local dev server (debug mode) you can step through the code.
80,720
I am using a Postgres DB to implement a scheduling of jobs for a large number of computers/processes. To make the story short, every job has its id, all scheduling is implemented with three tabes: all jobs, currently running jobs, and already completed jobs. The key functionality of the scheduling is to (1) request a ...
2014/10/21
[ "https://dba.stackexchange.com/questions/80720", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/28367/" ]
Specific issues with the query ------------------------------ PostgreSQL defaults to `READ COMMITTED` isolation, and it looks like you're not using anything different. In `READ COMMITTED` each statement gets its own snapshot. It cannot see uncommitted changes from other transactions; it's as if they simply haven't hap...
The answer from craig-ringer fully answers the question. For the sake of completeness, I add up the following trivial code to solve the issue using locks: ``` create or replace function f_requestJob( jobs text, jobs_running text, jobs_completed text ) returns bigint as $$ declare sq...
8,499
It seems on Friday night that various people rise at various times towards the end of השכיבנו (and before beginning ושמרו). When is the actual proper moment to rise? (Sources, please.)
2011/06/26
[ "https://judaism.stackexchange.com/questions/8499", "https://judaism.stackexchange.com", "https://judaism.stackexchange.com/users/128/" ]
In the Nusach Edot HaMizrach... > > הַשְׁכִּיבֵנוּ אָבִינוּ לְשָׁלום, > וְהַעֲמִידֵנוּ מַלְכֵּנוּ לְחַיִּים > טובִים וּלְשָׁלום, וּפְרושׂ עָלֵינוּ > סֻכַּת שְׁלומֶךָ וְתַקְּנֵנוּ > מַלְכֵּנוּ בְּעֵצָה טובָה > מִלְּפָנֶיךָ, וְהושִׁיעֵנוּ מְהֵרָה > לְמַעַן שְׁמֶךָ וְהָגֵן בַּעֲדֵנוּ. <> > וּפְרושׂ עָלֵינוּ וְעַל...
Chabad stands before "Ufros aleinu" (See Hayom Yom, [2nd Day of Sivan](http://www.chabad.org/library/article_cdo/aid/5783/jewish/Sivan-2-46th-day-of-the-omer.htm)). It does not give a reason, but see [here](http://www.chabad.org/kabbalah/article_cdo/aid/1490225/jewish/Day-6.htm), where it quotes S'fardi prayer books as...
46,799,467
Trying to find a regex for a string containing only numbers and single spaces (but no spaces at beginning and end) such as this: "1 2 3 -4" --> Accept " 1 2 3 -4 " --> Not accept So far been using this: ``` ^\S+[-?\d ]*\b$ ``` However this still accepts the string for: "1 2 --3" which should not be accepted due ...
2017/10/17
[ "https://Stackoverflow.com/questions/46799467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4371769/" ]
This will work: ``` ^-?\d+(?:[ ]-?\d+)*$ ``` Note that * the `+` quantifier is applied only to the `\d` expressions. * I put the required single-space separator into a character class for clarity; it could equivalently be expressed without * the anchors aren't really necessary if you are going to use `Matcher.match...
Try this: ``` ^\S+( (-?)[\d]+)+\b$ ``` or even better: ``` ^\S+( ((-?)\d+))+\b$|^\d$ ``` in order to match single digits also Edit (see comments): This should be an even better version (removes that leading \S) ``` ^\d( (-?)[\d]+)*\b$ ```
46,799,467
Trying to find a regex for a string containing only numbers and single spaces (but no spaces at beginning and end) such as this: "1 2 3 -4" --> Accept " 1 2 3 -4 " --> Not accept So far been using this: ``` ^\S+[-?\d ]*\b$ ``` However this still accepts the string for: "1 2 --3" which should not be accepted due ...
2017/10/17
[ "https://Stackoverflow.com/questions/46799467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4371769/" ]
Code ---- ``` ^(?:-?\d+ )*(?:-?\d+)+$ ``` Explanation ----------- * `^` Assert position at beginning of the line * `(?:-?\d+ )*` Match the following any number of times + `-?\d+` Match zero or one of the `-` character, followed by one or more digits, followed by a space character * `(?:-?\d+)+` Match zero or one o...
Try this: ``` ^\S+( (-?)[\d]+)+\b$ ``` or even better: ``` ^\S+( ((-?)\d+))+\b$|^\d$ ``` in order to match single digits also Edit (see comments): This should be an even better version (removes that leading \S) ``` ^\d( (-?)[\d]+)*\b$ ```
46,799,467
Trying to find a regex for a string containing only numbers and single spaces (but no spaces at beginning and end) such as this: "1 2 3 -4" --> Accept " 1 2 3 -4 " --> Not accept So far been using this: ``` ^\S+[-?\d ]*\b$ ``` However this still accepts the string for: "1 2 --3" which should not be accepted due ...
2017/10/17
[ "https://Stackoverflow.com/questions/46799467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4371769/" ]
Code ---- ``` ^(?:-?\d+ )*(?:-?\d+)+$ ``` Explanation ----------- * `^` Assert position at beginning of the line * `(?:-?\d+ )*` Match the following any number of times + `-?\d+` Match zero or one of the `-` character, followed by one or more digits, followed by a space character * `(?:-?\d+)+` Match zero or one o...
This will work: ``` ^-?\d+(?:[ ]-?\d+)*$ ``` Note that * the `+` quantifier is applied only to the `\d` expressions. * I put the required single-space separator into a character class for clarity; it could equivalently be expressed without * the anchors aren't really necessary if you are going to use `Matcher.match...
104,748
Given a rectangular grid of text, line up the diagonals that go from the upper-left to the bottom-right into columns such that the lowest-rightmost characters of all diagonals are on a level. Use spaces for indentation. For example, if the input grid of text is ``` abcd 1234 WXYZ ``` then you'd line up the diagonal...
2016/12/27
[ "https://codegolf.stackexchange.com/questions/104748", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/26997/" ]
[CJam](https://sourceforge.net/p/cjam), 29 bytes ------------------------------------------------ ``` qN/{)\z}h]2/{~W%+}%eeSf.*W%N* ``` [Try it online!](https://tio.run/nexus/cjam#@1/op1@tGVNVmxFrpF9dF66qXauamhqcpqcVruqn9f@/oZGxnr0il4mpmT2QMrewVFRUBAA "CJam – TIO Nexus") ### Explanation Instead of extracting the d...
Python 3, 247 bytes =================== ``` def a(s): s=s.split('\n') for i,l in enumerate(s):r=len(s)-i-1;s[i]=' '*r+l+' '*(len(s)-r-1) print(*[''.join(i) for i in list(zip(*[''.join(a).rstrip([::-1].ljust(min(len(s),len(s[0])))for a in zip(*[list(i)for i in s])]))[::-1]],sep='\n')` ```
104,748
Given a rectangular grid of text, line up the diagonals that go from the upper-left to the bottom-right into columns such that the lowest-rightmost characters of all diagonals are on a level. Use spaces for indentation. For example, if the input grid of text is ``` abcd 1234 WXYZ ``` then you'd line up the diagonal...
2016/12/27
[ "https://codegolf.stackexchange.com/questions/104748", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/26997/" ]
[Jelly](https://github.com/DennisMitchell/jelly), 15 or 14 bytes ================================================================ ``` L’⁶x;\Ṛ;"µZUZṚY ``` [Try it online!](https://tio.run/nexus/jelly#@@/zqGHmo8ZtFdYxD3fOslY6tDUqNArIivz//7@SoZGxnr2iko6SiamZPZhhbmGpqKioBAA "Jelly – TIO Nexus") This is an algorithm tha...
Octave, 57 bytes ================ ```octave @(A){B=spdiags(A),C=B>0,D=' '(C+1),D(sort(C))=B(C),D}{5} ```
104,748
Given a rectangular grid of text, line up the diagonals that go from the upper-left to the bottom-right into columns such that the lowest-rightmost characters of all diagonals are on a level. Use spaces for indentation. For example, if the input grid of text is ``` abcd 1234 WXYZ ``` then you'd line up the diagonal...
2016/12/27
[ "https://codegolf.stackexchange.com/questions/104748", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/26997/" ]
[Jelly](https://github.com/DennisMitchell/jelly), 11 or 10 bytes ================================================================ ``` ZŒDṙLUz⁶ṚUY ``` [Try it online!](https://tio.run/nexus/jelly#@x91dJLLw50zfUKrHjVue7hzVmjk////lRKTklNSlXSU0tIzMrOAdHZObl6@EgA "Jelly – TIO Nexus") A fairly different algorithm from my...
[Jelly](https://github.com/DennisMitchell/jelly), 15 or 14 bytes ================================================================ ``` L’⁶x;\Ṛ;"µZUZṚY ``` [Try it online!](https://tio.run/nexus/jelly#@@/zqGHmo8ZtFdYxD3fOslY6tDUqNArIivz//7@SoZGxnr2iko6SiamZPZhhbmGpqKioBAA "Jelly – TIO Nexus") This is an algorithm tha...
104,748
Given a rectangular grid of text, line up the diagonals that go from the upper-left to the bottom-right into columns such that the lowest-rightmost characters of all diagonals are on a level. Use spaces for indentation. For example, if the input grid of text is ``` abcd 1234 WXYZ ``` then you'd line up the diagonal...
2016/12/27
[ "https://codegolf.stackexchange.com/questions/104748", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/26997/" ]
[CJam](https://sourceforge.net/p/cjam), 29 bytes ------------------------------------------------ ``` qN/{)\z}h]2/{~W%+}%eeSf.*W%N* ``` [Try it online!](https://tio.run/nexus/cjam#@1/op1@tGVNVmxFrpF9dF66qXauamhqcpqcVruqn9f@/oZGxnr0il4mpmT2QMrewVFRUBAA "CJam – TIO Nexus") ### Explanation Instead of extracting the d...
Clojure, 194 bytes ------------------ Implemented the hard way by grouping characters to `G` and then generating lines. ``` #(let[n(count %)m(count(% 0))G(group-by first(for[i(range n)j(range m)][(min(- n i)(- m j))((% i)j)]))](apply str(flatten(for[k(reverse(sort(keys G)))][(repeat(dec k)" ")(map last(G k))"\n"]))))...
104,748
Given a rectangular grid of text, line up the diagonals that go from the upper-left to the bottom-right into columns such that the lowest-rightmost characters of all diagonals are on a level. Use spaces for indentation. For example, if the input grid of text is ``` abcd 1234 WXYZ ``` then you'd line up the diagonal...
2016/12/27
[ "https://codegolf.stackexchange.com/questions/104748", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/26997/" ]
[J](http://jsoftware.com/), 12 bytes ------------------------------------ ``` |./.&.|:&.|. ``` Defines an anonymous verb. [Try it online!](https://tio.run/nexus/j#@5@mYGulUKOnr6emV2MFxHr/S0AixgomCioK6olJySmGRsYm4RGRUepcqckZ@QrqnnkFpSVQTglUzL@0BCGYplDyHwA "J – TIO Nexus") Explanation ----------- ``` |./.&.|:&.|. |....
Clojure, 194 bytes ------------------ Implemented the hard way by grouping characters to `G` and then generating lines. ``` #(let[n(count %)m(count(% 0))G(group-by first(for[i(range n)j(range m)][(min(- n i)(- m j))((% i)j)]))](apply str(flatten(for[k(reverse(sort(keys G)))][(repeat(dec k)" ")(map last(G k))"\n"]))))...
104,748
Given a rectangular grid of text, line up the diagonals that go from the upper-left to the bottom-right into columns such that the lowest-rightmost characters of all diagonals are on a level. Use spaces for indentation. For example, if the input grid of text is ``` abcd 1234 WXYZ ``` then you'd line up the diagonal...
2016/12/27
[ "https://codegolf.stackexchange.com/questions/104748", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/26997/" ]
[CJam](https://sourceforge.net/p/cjam), 29 bytes ------------------------------------------------ ``` qN/{)\z}h]2/{~W%+}%eeSf.*W%N* ``` [Try it online!](https://tio.run/nexus/cjam#@1/op1@tGVNVmxFrpF9dF66qXauamhqcpqcVruqn9f@/oZGxnr0il4mpmT2QMrewVFRUBAA "CJam – TIO Nexus") ### Explanation Instead of extracting the d...
JavaScript (ES6), 140 bytes --------------------------- ``` a=>[...Array(m=(h=a.length)<(w=a[0].length)?h:w)].map((_,i)=>[...Array(h+w-1)].map((_,j)=>(a[x=i+h-m-(++j>w&&j-w)]||``)[x+j-h]||` `).join``) ``` Takes input and output as arrays of strings. Also accepts a two-dimensional character array input, and save 7 by...
104,748
Given a rectangular grid of text, line up the diagonals that go from the upper-left to the bottom-right into columns such that the lowest-rightmost characters of all diagonals are on a level. Use spaces for indentation. For example, if the input grid of text is ``` abcd 1234 WXYZ ``` then you'd line up the diagonal...
2016/12/27
[ "https://codegolf.stackexchange.com/questions/104748", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/26997/" ]
JavaScript, ~~116~~ 101 bytes ============================= ```js f=(s,r='$&',l='',z=s.replace(/.$|\n?(?!.*\n)..+/gm,x=>(l=x+l,'')))=>l?f(z,r+' ')+l.replace(/\n?/,r):l G.onclick=()=>O.textContent=f(I.value); ``` ```html <textarea id=I style=height:100px>/\/\ \/ / / /\ \/\/</textarea><button id=G>Go</button><pre ...
Python 2, 150 bytes =================== ```py def f(l):w=len(l[0]);h=len(l);J=''.join;R=range;print'\n'.join(map(J,zip(*['%%-%ds'%h%J(l[h+~i][j-i]for i in R(h)if-w<i-j<1)for j in R(h-~w)]))[::-1]) ``` Takes input as list of strings.
104,748
Given a rectangular grid of text, line up the diagonals that go from the upper-left to the bottom-right into columns such that the lowest-rightmost characters of all diagonals are on a level. Use spaces for indentation. For example, if the input grid of text is ``` abcd 1234 WXYZ ``` then you'd line up the diagonal...
2016/12/27
[ "https://codegolf.stackexchange.com/questions/104748", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/26997/" ]
[J](http://jsoftware.com/), 12 bytes ------------------------------------ ``` |./.&.|:&.|. ``` Defines an anonymous verb. [Try it online!](https://tio.run/nexus/j#@5@mYGulUKOnr6emV2MFxHr/S0AixgomCioK6olJySmGRsYm4RGRUepcqckZ@QrqnnkFpSVQTglUzL@0BCGYplDyHwA "J – TIO Nexus") Explanation ----------- ``` |./.&.|:&.|. |....
JavaScript (ES6), 140 bytes --------------------------- ``` a=>[...Array(m=(h=a.length)<(w=a[0].length)?h:w)].map((_,i)=>[...Array(h+w-1)].map((_,j)=>(a[x=i+h-m-(++j>w&&j-w)]||``)[x+j-h]||` `).join``) ``` Takes input and output as arrays of strings. Also accepts a two-dimensional character array input, and save 7 by...
104,748
Given a rectangular grid of text, line up the diagonals that go from the upper-left to the bottom-right into columns such that the lowest-rightmost characters of all diagonals are on a level. Use spaces for indentation. For example, if the input grid of text is ``` abcd 1234 WXYZ ``` then you'd line up the diagonal...
2016/12/27
[ "https://codegolf.stackexchange.com/questions/104748", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/26997/" ]
JavaScript, ~~116~~ 101 bytes ============================= ```js f=(s,r='$&',l='',z=s.replace(/.$|\n?(?!.*\n)..+/gm,x=>(l=x+l,'')))=>l?f(z,r+' ')+l.replace(/\n?/,r):l G.onclick=()=>O.textContent=f(I.value); ``` ```html <textarea id=I style=height:100px>/\/\ \/ / / /\ \/\/</textarea><button id=G>Go</button><pre ...
JavaScript (ES6), 140 bytes --------------------------- ``` a=>[...Array(m=(h=a.length)<(w=a[0].length)?h:w)].map((_,i)=>[...Array(h+w-1)].map((_,j)=>(a[x=i+h-m-(++j>w&&j-w)]||``)[x+j-h]||` `).join``) ``` Takes input and output as arrays of strings. Also accepts a two-dimensional character array input, and save 7 by...
104,748
Given a rectangular grid of text, line up the diagonals that go from the upper-left to the bottom-right into columns such that the lowest-rightmost characters of all diagonals are on a level. Use spaces for indentation. For example, if the input grid of text is ``` abcd 1234 WXYZ ``` then you'd line up the diagonal...
2016/12/27
[ "https://codegolf.stackexchange.com/questions/104748", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/26997/" ]
[Jelly](https://github.com/DennisMitchell/jelly), 11 or 10 bytes ================================================================ ``` ZŒDṙLUz⁶ṚUY ``` [Try it online!](https://tio.run/nexus/jelly#@x91dJLLw50zfUKrHjVue7hzVmjk////lRKTklNSlXSU0tIzMrOAdHZObl6@EgA "Jelly – TIO Nexus") A fairly different algorithm from my...
Pyth, 16 bytes ============== ``` j_.t_M.Tm+*;l=tQ ``` ### [Big Pyth](https://github.com/isaacg1/pyth/blob/master/big-pyth.py): ``` join-on-newline reverse transpose-and-fill-with-spaces reverse func-map transpose-justified map plus times innermost-var length assign tail input implicit-innermost-var...
33,679,480
I am trying to insert div with iframe before HTML comment (it is the only unique element at this position). So I have comment like: `<!-- Comment -->` and I would like to insert code like this before the comment: ``` <div id="test"> <noscript> <iframe src="https://test.net" frameborder="0" scrolling="no" wi...
2015/11/12
[ "https://Stackoverflow.com/questions/33679480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4940705/" ]
You can do this in many ways, one of them is the following: ``` template <typename E, typename Enable = void> struct get_a_int_val { static const int value = 42; }; template <typename E> struct get_a_int_val<E, typename std::enable_if<std::is_same<decltype(E::a), dec...
You may create a traits for that: ``` template <typename E> std::false_type has_a_impl(...); template <typename E> auto has_a_impl(int) -> decltype(E::a, std::true_type{}); template <typename E> using has_a = decltype(has_a_impl<E>(0)); ``` And then use it in SFINAE: ``` template <typename E> std::enable_if_t<has...
70,501,845
I am trying to set the values of several cells in the same row of a cell that I am changing. IF the value in AJ2 is True then the range AK2:AX2 should also be true.If I change AJ2 to false, then I should be able to uncheck any of the values in the range and they would then be false. I 'sort of' have this logic working...
2021/12/28
[ "https://Stackoverflow.com/questions/70501845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17777132/" ]
Try this ``` function onEdit(e) { const sheet = e.source.getActiveSheet(); const cell = e.range; // AJ = column 36 (master column) if(sheet.getName() == "MasterData" && cell.getColumn()==36 && cell.isChecked()){ sheet.getRange(cell.getRow(),37,1,14).setValue('TRUE') } // individual columns : 37 (AK) to...
The [onEdit(e) simple trigger](https://developers.google.com/apps-script/guides/triggers) returns an [event object](https://developers.google.com/apps-script/guides/triggers/events). The event object contains the information about the spreadsheet that was edited, which you use instead of the "SpreadsheetApp.getActiveS...