qid
int64
10
74.7M
question
stringlengths
15
26.2k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
27
28.1k
response_k
stringlengths
23
26.8k
2,055
I don't know if I should ask this here because the question is more like a sociology one. Anyway, I will give it a try, since most of the sociologists are also philosophers, so maybe I'll be lucky finding an answer. I am preparing for an exam, and I understand really well Lévi-Strauss's structuralism and I also unders...
2012/01/06
[ "https://philosophy.stackexchange.com/questions/2055", "https://philosophy.stackexchange.com", "https://philosophy.stackexchange.com/users/1342/" ]
Malinowski suggested that individuals have physiological needs (reproduction, food, shelter) and that social institutions exist to meet these needs. There are also culturally derived needs and four basic "instrumental needs" (economics, social control, education, and political organization), that require institutional ...
Malinowski concentrated much on the biological needs or the primary needs of the individual and how the sociocultral or the social institutions exist to meet those needs.Simply means culture exists to meet biological needs.Also humans can never live without culture since it is there to satisfy biologiacal needs.Much on...
29,298,549
I would like to confirm the correct use of the following: 1) Use a global variable to get return values from a function only once (since my function will be returning some Sequence values) 2) Use that variable inside a cursor multiple times 3) All of these will be inside a procedure Below shows a sample. ``` CREA...
2015/03/27
[ "https://Stackoverflow.com/questions/29298549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2828435/" ]
A few suggestions: 1. You have an `END;` statement after the declaration of `cursor c1` which doesn't match up with anything. You should remove this from your code. 2. There's no need to check to see if the cursor is open when you enter the procedure. It won't be. Even better, don't use an explicit cursor declaration ...
Taking into account the fact that you want all the rows being inserted to have the same sequence number assigned, I think you could probably rewrite your procedure to something like: ``` create or replace procedure insert_mytable is v_seq_no number; begin v_seq_no := somesequence.nextval; merge into mytable tgt...
21,001,672
I am creating a header with a logo and CSS menu. I want them to be both on the same line, and when I did this, I used ``` #header img, #header ul{ display:inline-block; } ``` When I was using a custom menu I made, this worked fine. However, I decided to use a CSS menu generator to design a nicer looking menu. This b...
2014/01/08
[ "https://Stackoverflow.com/questions/21001672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2070478/" ]
[Here is JsFiddle](http://jsfiddle.net/zaheerahmed/KYMfv/1/) Try add padding to header, change inline-block to inline and remove width: ``` #header { text-align:center; margin-top:0px; margin-bottom:0px; padding:10px; width:100%; } ``` to show at bottom [Here is Demo](http://jsfiddle.net/zaheera...
I couldn't view your image from your code, so I'm not sure what is exactly you wanted. But I made this simple code to make the logo and menu on the same line, whereby the menu is aligned in the middle of the height of logo/header. You can check the fiddle [HERE](http://jsfiddle.net/sJZx5/) ``` .header{ height: 10...
4,707,690
> > **Possible Duplicate:** > > [Storing Images in DB - Yea or Nay?](https://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay) > > > I need to store profile pictures. Lots of them. I'm not sure if I should store them in the database. I'm not even sure if that's a good idea to begin with, or if...
2011/01/16
[ "https://Stackoverflow.com/questions/4707690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Personal experience says that storing lots of image in a database makes the database very slow to back up. That can be irritating when you come to run repeatable tests, or update the DB schema and you want to take an ad-hoc backup, as well as in a general case. Also, depending on database, storing blobs (which inevitab...
I'd definitely root for storing only the image path in the database. Storing the image data will slow your site down and put extra strain on your system. The only case I could imagine an advantage in storing the image data inside the database would be, if you're planning on moving the site around. Then you wouldn't ha...
5,491,376
Basically, I'm not sure where to start: I have my Shell.xaml window. I also have my Popup.xaml window. I set the Shell.xaml to import the PopupWindow then when the PopupWindow Loaded event fires, it does: ``` Popup.Owner = this; Popup.Show(); ``` Now, I need to be able to have the PopupWindow's ViewModel communica...
2011/03/30
[ "https://Stackoverflow.com/questions/5491376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/535637/" ]
Have a look at the event aggregator in Prism. The aggregated events in Prism are intended as a means of facilitating decoupled, inter-viewmodel communication. If you are going for "pure" MVVM, I *think* that it would go something like this: * Your ViewModel publishes a message (interaction request) that it want's to d...
I'm no PRISM/MEF guru but if I were attacking this problem I'd take a slightly different approach and add a tad more decoupling. Essentially you want the **ViewModels** of your windows (Shell and Popup) to communicate - windows (**Views**) should only communicate with the user and update properties (in a decoupled, mod...
34,231,571
In MATLAB, I have a 256x256 RGB image and a 3x3 kernel that passes over it. The 3x3 kernel computes the colour-euclidean distance between every pair combination of the 9 pixels in the kernel, and stores the maximum value in an array. It then moves by 1 pixel and performs the same computation, and so on. I can easily c...
2015/12/11
[ "https://Stackoverflow.com/questions/34231571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3749634/" ]
If I understood the question correctly, you are looking to form unique pairwise combinations within a sliding `3x3` window, perform euclidean distance calculations consider all three channels, which we are calling as *colour-euclidean distances* and finally picking out the largest of all distances for each sliding wind...
Your question is interesting and caught my attention. As far as I understood, you need to calculate euclidean distance between RGB color values of all cells inside 3x3 kernel and to find the largest one. I suggest a possible way to do this by using `circshift` function and 4D array operations: Firstly, we pad the inpu...
1,132,567
I have a program that reads server information from a configuration file and would like to encrypt the password in that configuration that can be read by my program and decrypted. Requirments: * Encrypt plaintext password to be stored in the file * Decrypt the encrypted password read in from the file from my program ...
2009/07/15
[ "https://Stackoverflow.com/questions/1132567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/104998/" ]
A simple way of doing this is to use Password Based Encryption in Java. This allows you to encrypt and decrypt a text by using a password. This basically means initializing a `javax.crypto.Cipher` with algorithm `"AES/CBC/PKCS5Padding"` and getting a key from `javax.crypto.SecretKeyFactory` with the `"PBKDF2WithHmacSH...
The big point, and the elephant in the room and all that, is that *if your application can get hold of the password, then a hacker with access to the box can get hold of it too!* The only way somewhat around this, is that the application asks for the "master password" on the console using Standard Input, and then uses...
409,305
A similar question was asked at [Partial upgrade - why remove MariaDB?](https://askubuntu.com/questions/292245/partial-upgrade-why-remove-mariadb). The answer to that question basically was stating that dist-upgrade is the issue. This question is asking if there is some workaround (or fix). Sometimes it is necessary ...
2014/01/22
[ "https://askubuntu.com/questions/409305", "https://askubuntu.com", "https://askubuntu.com/users/238729/" ]
I am having the same issue with Ubuntu 13.10. However I am able to resolve the situation without having to log out and back in again. If you have the "Show current input source in the menu bar" checkbox selected in System Settings -> Keyboard -> Layout Settings (a.k.a "Text Entry" settings), then even though "English (...
Try this--at the top of your desktop is a bar that contains buttons for various services such as Bluetooth,wifi, and system power etc. There must be a button that says En2 or En1 depending on the layout you've selected. Adjust your keyboard layout using this button. A keyboard layout chart is available in the same drop...
60,088,893
I want to add LambdaFunctionAssociation to my existing CloudFront which is created manually [lambdafunctionassociation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-lambdafunctionassociation.html) Thanks in advance.
2020/02/06
[ "https://Stackoverflow.com/questions/60088893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3065730/" ]
As of mlflow 1.11.0, the recommended way to permanently delete runs within an experiment is: [`mlflow gc [OPTIONS]`](https://www.mlflow.org/docs/latest/cli.html#mlflow-gc). From the documentation, `mlflow gc` will > > Permanently delete runs in the *deleted* lifecycle stage from the specified backend store. This com...
I am adding SQL commands if you want to delete permanently Trash of MLFlow if you are using PostgreSQL as backend storage. Change to your MLFlow Database, e.g. by using: `\c mlflow` and then: ``` DELETE FROM experiment_tags WHERE experiment_id=ANY( SELECT experiment_id FROM experiments where lifecycle_stage='dele...
67,672,278
In my program code which is posted below, I need to assign a variable of Swift enum type to a variable of NSObject type. However, the compiler doesn't allow this. I know this is not allowed. So, I wonder whether there is a way to change the enum somehow so that it can be assigned to an NSObject variable. Thank you! Ph...
2021/05/24
[ "https://Stackoverflow.com/questions/67672278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6763591/" ]
You could do it using hacky `enum` byte serialization stored as `NSData` property in your `NSObject`. ``` enum Test { case testCase case testCase2 } func bytes<T>(of value: T) -> [UInt8]{ var value = value let size = MemoryLayout<T>.size return withUnsafePointer(to: &value, { $0.withMemory...
I tried bridging the flickrPhoto.datatakengranularity variable to NSObject via AnyObject like this: ``` photo.datetakengranularity = (flickrPhoto.datetakengranularity as AnyObject as! NSObject) ``` And the compiler made no complaints. This may be because in essence AnyObject is equivalent to NSObject and flickrPhot...
12,956,641
I want to convert a String to Datetime. I'm getting an error `This is not a valid datetime`. The string I want to convert and code are as follows. ``` string date1 = "9/13/2012 5:26:06 PM"; TimePart = DateTime.ParseExact(date1, "M/d/yyyy HH:mm:ss tt", System.Globalization.CultureInfo.InvariantCulture); ```
2012/10/18
[ "https://Stackoverflow.com/questions/12956641", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1755805/" ]
You need to use the lowercase `h`: ``` DateTime TimePart = DateTime.ParseExact( date1, "M/d/yyyy h:mm:ss tt", CultureInfo.InvariantCulture); Console.WriteLine(TimePart); // 09/13/2012 17:26:06 ``` Uppercase "H" is 24-hou...
It looks like the `HH` isn't matching the "5". Try `h`.
1,850,422
When running our program we get an exception of type java.lang.IllegalMonitorStateException. On Java6 API website, it says there is a constructor that gives a details about the exception: IllegalMonitorStateException(String s) How can we use this to get a better idea of where the bug is in our code? Is there anything ...
2009/12/04
[ "https://Stackoverflow.com/questions/1850422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/225182/" ]
> > How can we use this to get a better > idea of where the bug is in our code? > Is there anything else we can do > (besides lots of debugging which we're > currently doing) to pinpoint the > function or line that failed? > > > In this case, printing the message by itself probably won't help much. What you n...
You should print the stack trace, which will give you the exact location in the source. Unfortunately it's not uncommon for the JVM to throw exceptions which contain no detail message to assist in debugging.
15,000,913
Consider the following: ``` <a>a</a><a>b</a> ``` How can I align the second anchor (b) to the right? **PS:** float is an abuse in this situation. It's not made for this and it causes some problems, so I need other more reasonable solution.
2013/02/21
[ "https://Stackoverflow.com/questions/15000913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2080105/" ]
Maybe you can make something like this: `<a>a</a><a class="right">b</a>` And CSS like this: ```css a.right { position: absolute; right: 0; } ```
You may try the below code: ``` <a>a</a><a align="right">b</a> <a>a</a><a style="text-align:right">b</a> ```
37,807,636
Trying to create Web application based on Tomcat. Can't set Tomcat folder: [![enter image description here](https://i.stack.imgur.com/SH02Q.png)](https://i.stack.imgur.com/SH02Q.png) Error: ``` The specified Server Location (Catalina Home) folder is not valid. ``` [![enter image description here](https://i.stack.im...
2016/06/14
[ "https://Stackoverflow.com/questions/37807636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1501700/" ]
Open the folder and then you find the single folder with apache tomcat 9.0. Press open then, before you just selected the main folder didn't opened it. ![screenshot](https://i.stack.imgur.com/975D6.png)
Just download the appropriate tomcat file and unzip.[![enter image description here](https://i.stack.imgur.com/R8VGv.png)](https://i.stack.imgur.com/R8VGv.png)
26,984,038
At first I apologize for my English. Well, thats the deal <http://www.dotazoneapp.com/site/pt/> this site have a somekind of interesting scroll, when scroll down, the background-image is change his position, with the background-position (I check this on the source). But I don't even know HOW I CAN DO THIS, if is with ...
2014/11/17
[ "https://Stackoverflow.com/questions/26984038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4263274/" ]
One command will do this work: ``` git checkout -b <local_branch_name> origin/<remote_branch_name> ``` Edit: If an error occurred: fatal: 'origin/<branch\_name>' is not a commit and a branch '<branch\_name>' cannot be created from it. You may try: ``` git pull git checkout -b <local_branch_name> origin/<remote_bra...
As of Git version 2.37.2 you can now use `$ git switch -c` as shown in the steps below. #### Fetch everything from the remote repository. `$ git fetch <remote>` #### Checkout the remote branch `$ git checkout <remote>/<branch>` #### Create the new local branch `$ git switch -c <branch>`
56,563,644
I'm trying to create a code to check if an array has empty values between valid values or before them. At first I tried to use array\_filter to remove empty values and then check if the remaining indexes of the valid values are consecutives, but I think there might be a simple way. Here are examples These array are ...
2019/06/12
[ "https://Stackoverflow.com/questions/56563644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3421568/" ]
In MySql use IFNULL() function. For MsSql use ISNULL() function.
if you need all the rows and not the rows where goal is not null you could use count(\*) ``` select count(*) from fixtures where goal=1 and fixture='$fixture' ``` `count(goal)` return the number of rows where goal is not null `count(*)` return the total number rows selected otherwise in general when...
12,172,997
I want to fetch all service\_name and its status without using any 3rd party tool. So far [SC](http://ss64.com/nt/sc.html) command was good enough to fetch one of the values, something like ``` sc query | findstr SERVICE_NAME ``` but I also need `STATUS` for each `SERVICE_NAME` listed.
2012/08/29
[ "https://Stackoverflow.com/questions/12172997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/707414/" ]
By the way ``` sc query | findstr SERVICE_NAME ``` will show only active (RUNNING) services, so there is no need to filter status (STATE). Try SC with findstr syntax that supports multiple filtered items: ``` sc query state= all | findstr "SERVICE_NAME STATE" ``` or ``` sc query state= all | findstr "DISPLAY_NA...
Thanks [@jon](https://stackoverflow.com/users/50079/jon) for the post, that was very helpful. I wanted a column aligned output, so I grabbed your example above and created the following batch file: ``` @ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION ECHO.Service State ECHO.--...
36,707,383
Essentially, I want only the hour, minute, and seconds from a column of timestamps I have in R, because I want to view how often different data points occur throughout different times of day and day and date is irrelevant. However, this is how the timestamps are structured in the dataset: 2008-08-07T17:07:36Z And I'...
2016/04/19
[ "https://Stackoverflow.com/questions/36707383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5522760/" ]
I think you are expecting this... ``` Sys.time() [1] "2016-04-19 11:09:30 IST" format(Sys.time(),format = '%T') [1] "11:09:30" ``` if you want to give your own timestamp, then use bellow code: ``` format(as.POSIXlt("2016-04-19 11:02:22 IST"),format = '%T') [1] "11:02:22" ```
A regular expression will probably be quite efficient for this: ``` x <- '2008-08-07T17:07:36Z' x ## [1] "2008-08-07T17:07:36Z" sub('.*T(.*)Z', '\\1', x) ## [1] "17:07:36" ```
8,900
Inspired by [this question](https://codegolf.stackexchange.com/questions/77117/tips-for-king-of-the-hill-bots), what are some tips you guys have for creating king of the hill challenges? What are some things to keep in mind in the planning and implementing of the rules and the controller, and advice on what makes for a...
2016/04/05
[ "https://codegolf.meta.stackexchange.com/questions/8900", "https://codegolf.meta.stackexchange.com", "https://codegolf.meta.stackexchange.com/users/30793/" ]
Allow as many bots as possible ------------------------------ Nobody wants to be disallowed from a contest right? Allow as many languages as you can. If someone posts a bot in a language you don't have, try as hard as you can to install it. If you can't? Ask for instructions. Allow people to post as many bots as they...
Opponent prediction =================== In general, a koth is better if there is some level of opponent prediction, rather than perfect info where the result tends to be based on whether someone wrote the ideal bot. Even if your koth doesn't have perfect info, it can still have an ideal bot. for example, a move with...
60,551
I'm very new to GIMP and found that doing simple stuff in GIMP is much harder than it should be. All I want to do is add a simple black border around an image layer. I have added this image using the "Open as Layers" option (as I have many images in one document!), but can't seem to find an option to add a border arou...
2015/09/14
[ "https://graphicdesign.stackexchange.com/questions/60551", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/47793/" ]
Go to Filters -> Decor -> Add Border... Then choose your border settings [![border settings](https://i.stack.imgur.com/DNqwf.png)](https://i.stack.imgur.com/DNqwf.png) [From the GIMP help files](http://docs.gimp.org/en/script-fu-addborder.html) > > Border X size, Border Y size Here you can select the thickness of ...
Here's what worked for me in GIMP 2.10: 1. Select the layer with the image you want the border on (click on the layer itself in the list) 2. Using the menu: `Select` --> `All` 3. Using the menu: `Edit` --> `Stroke Selection` 4. In the dialogue box, leave everything selected as default, and set the line width and color...
26,473,371
I am new to rails and haven't really done to much with data outside of the model. I have a form that references a table controller for files. I want to add an dropdown that will display a list of projects from a project table for the user to assign a the file to a project if they want too. Assigning a project is not a ...
2014/10/20
[ "https://Stackoverflow.com/questions/26473371", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4099784/" ]
Adding sub views like this ``` [self.v addSubview:button]; ``` Access subviews like this ``` UIScrollView *scrollview = (UIScrollView *) _scroll; UIView *View = (UIView *) scrollview.subviews[0]; ```
I found the answer. In the ViewDidLoad method of my view controller's custom class I used the following: ``` NSArray *sv = self.view.subviews; UIScrollView *sc = sv[0]; sv = sc.subviews; UIView *v = sv[0]; ``` I stepped through execution to confirm the ScrollView was the first subview of the view, and to confirm the...
57,301,412
I am trying to avoid the nested subscription in request to the backend. I need to login, then get a service token based on the response of the login, then get a encryption token based on the service token. I have seen about concatMap but i am not sure how to use the first response in the second request or third ``` ...
2019/08/01
[ "https://Stackoverflow.com/questions/57301412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2837056/" ]
I ended up using SwitchMap ``` this.rest.CallLogin(this.data).pipe( switchMap((response: any) => { this.data.requestUrl = response.headers.get('Location'); return this.rest.GetServiceTicket(this.data) // serviceticket }), switchMap((serviceticket) => { return this.r...
If i understood correctly then you only want to chain the calls and use the response header from the first response. For that you need to use observe on response in your first call: ``` this.rest.CallLogin(this.data, {observe: 'response'}).pipe( concatMap(loginResponse => this.rest.GetServiceTicket(loginResponse.h...
55,479,887
I'am using a firebird 2.5 server to write in a Database file(BD.fbd). My delphi XE8 project has a Data module(DMDados) with: * `SQLConnection (conexao)` * `TSQLQUery1 (QueryBDPortico_Inicial) + TDataSetProvider1 (DSP_BDPortico_Inicial) + TClientDataSet1 (cdsBDPortico_Inicial)` * `TSQLQUery2 (QueryConsulta)` (just for ...
2019/04/02
[ "https://Stackoverflow.com/questions/55479887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10940927/" ]
Splite the problem into small parties using functions and procedures create an instance of TSqlQuery Execute the SQL statment's and destroy the instance when you finish with it... ``` procedure DeleteAll; var Qry: TSqlQuery; begin Qry := TSqlQuery.Create(nil); try Qry.SqlConnection := DMDados.conexao; Qr...
Just few obvervations, cause the primary answers were given, but they not deal with the secondary problems. ``` cdsBDPortico_Inicial.FieldbyName('NPORTICO').AsInteger := ``` `FieldByName` is slow function - it is linear search over objects array with uppercased string comparison over each one. You better only call ...
6,798,665
I am parsing the data it gets all the data in dictionary but when i check value using NSLog it showa nil value ``` SBJsonParser *parser = [[SBJsonParser alloc] init]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.krsconnect.no/community/api.html?method=bareListEventsByCategory...
2011/07/23
[ "https://Stackoverflow.com/questions/6798665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/838384/" ]
I'm guessing that your dictionary doesn't contain a "location", and that's consistent with what I see coming back from that web site. It sends back an array of dictionaries which contain arrays of dictionaries. You need to extract one of those inner dictionaries to find a "location". ``` [ { "date":132088...
Try: ``` - (id)initWithDictionary:(NSDictionary*) dict { self = [super init]; if(self) { self.date = [dict valueForKey:@"date"]; self.location = [dict valueForKey:@"location"]; self.municipality = [dict valueForKey:@"municipality"]; self.title = [dict valueForKey:@"title"]; } retu...
3,206,574
I'm looking for a way in SQL Server without using the .NET framework to find out the time in a given time zone, paying attention to daylight savings. However, this method also needs to take account for states (e.g. Arizona) that do NOT follow DST. There is a workaround if the server is located somewhere that does foll...
2010/07/08
[ "https://Stackoverflow.com/questions/3206574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/387007/" ]
Divide `rand()` by the maximum random numer, multiply it by the range and add the starting number: ``` <?php // rand()/getrandmax() gives a float number between 0 and 1 // if you multiply it by 0.002 you'll get a number between 0 and 0.002 // add the starting number -0.001 and you'll get a number between -0.001 ...
This will return any **possible** number between `-0.001` and `+0.001` ``` $random = ((rand()*(0.002/getrandmax()))-0.001) // or without paranthesis: $random = rand()*0.002/getrandmax()-0.001 ```
10,263,017
I realize similar questions have been asked before, but I read a couple of those and still don't see where I'm going wrong. When I simply write my class without separating the prototype from the definition, everything works fine. The problem happens when I separate the prototype and definition as shown below: ``` temp...
2012/04/21
[ "https://Stackoverflow.com/questions/10263017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1325279/" ]
You have to state the template parameter in the definition as well ``` template<class T> int VisitedSet<T>::getSize() { return vec.size(); } ``` otherwise the compiler cannot match it to the declaration. For example, there could be specializations for some parameter types.
Try putting ``` template <typename T> ``` above the implementation of VisitedSet::getSize() -- but beware that, in general, templated classes and functions should all be inlined. See the c++ faq [here](http://www.parashift.com/c++-faq-lite/templates.html) for more information.
218,185
I'm reading a proof and I'm struggling with basic calculus here. Given the equation, $F[x, F(y, z)] = F[F(x, y), z] $ set $u = F(x, y)$ and $v = F(y, z)$ so you have $$F(x, v) = F(u, z)$$ Now differentiate with respect to $x$ and $y$ leads to the following 1. $F\_{x}(x,v) = F\_{x}(u,z)F\_{x}(x,y)$ 2. $F\_{y}(x,v...
2012/10/21
[ "https://math.stackexchange.com/questions/218185", "https://math.stackexchange.com", "https://math.stackexchange.com/users/45521/" ]
$9\cos^2(B)-9\sin^2(B)=9\cos^2(B)-9(1-\cos^2(B))=18\cos^2(B)-9$
Since $\cos^2 B$ appears in two places, you could start by bringing everything to one side of the equation to see whether you get something nicer. In this case you get $$9\cos^2 B+9\sin^2 B-9=0\;,$$ which is true if and only if $\cos^2B+\sin^2B-1=0$, i.e., if and only if $\cos^2B+\sin^2B=1$, which you know is true. N...
53,697,814
It seems that I cannot get pip to install Cartopy on my computer. I work straight from the windows command line (no Anaconda or other proxy programs). When I try "pip install cartopy" I get the expected: ``` C:\Users\Justin\Documents\Python Programs>pip install cartopy Collecting cartopy Using cached https://files...
2018/12/09
[ "https://Stackoverflow.com/questions/53697814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8205368/" ]
If any problem arises while installing cartopy: Downlaod Cartopy, shapely and pyprof from this website [https://www.lfd.uci.edu/~gohlke/pythonlibs/](https://www.lfd.uci.edu/%7Egohlke/pythonlibs/) and install these using this commands in cmd terminal. For example installing Cartopy pip install "C:\Users\USER\Download...
I made good experiences using the osdeo/gdal image when encountering docker issues with cartopy (and other geo libraries): ``` # select latest osgeo container FROM osgeo/gdal:ubuntu-full-3.5.1 RUN apt-get update && \ apt-get install -y \ libgeos++-dev \ libproj-dev \ bash \ build-essential \ c...
14,377,140
When I load my frontend my browser returns those weird errors: ``` Uncaught ReferenceError: Mage is not defined Uncaught ReferenceError: Varien is not defined Uncaught ReferenceError: decorateGeneric is not defined Uncaught ReferenceError: VarienForm is not defined Uncaught ReferenceError: VarienForm is not defined `...
2013/01/17
[ "https://Stackoverflow.com/questions/14377140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
open "CATALOG.XML" file into your theme add this code ``` <default> <reference name="head"> <action method="addJs"><script>varien/product.js</script></action> <action method="addJs"><script>varien/configurable.js</script></action> <action method="addItem"><type>js_css</type><name>calenda...
Have a look into the .htaccess and set the RewriteBase correct to /magento Next try: I didn't know "Uncaught Reference Error" (http://stackoverflow.com/questions/2075337/uncaught-referenceerror-is-not-defined) But obviously it is something with JavaScript. Are you sure, that your PHP code is executed? What looks the...
70,831,457
For [repositories](https://jalsti.github.io/cov19de/pages/Deutschland.html) with daily updated data plots (including slightly changing background color gradients), I asked myself if there is some preferred format (or compression algorithm) to use, so that git can store them more efficiently, instead of having to re-wri...
2022/01/24
[ "https://Stackoverflow.com/questions/70831457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1783801/" ]
#### The theory Formats that are "Git friendly" will be formats that share long identical byte sequences, whether they are binary or text. Now, a lossy binary format will probably change most bytes when you change even just the background colour gradients, whereas a more descriptive text-based format might not. ####...
OK, so there seems to be no general answer, respective the answer by the SOF community seems to be: * try it out blindly * do not store images like you want to store them …never mind, probability to meet one who has really good expert knowledge about the compression types playing together would have been real luck. T...
48,078,637
Im trying to link a list of ID to a list of date in SQL. This is the data i have both in different table. ``` | Date | ID | |2017-12-25| 1 | |2017-12-26| 2 | |2017-12-27| 3 | ``` I will like to merge this into ``` | Date | ID | |2017-12-25| 1 | |2017-12-25| 2 | |2017-12-25| 3 | |2017-12-26| 1 | |201...
2018/01/03
[ "https://Stackoverflow.com/questions/48078637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9168368/" ]
You can write your own: ``` HAS_ATTR_MESSAGE = '{} should have an attribute {}' class BaseTestCase(TestCase): def assertHasAttr(self, obj, attrname, message=None): if not hasattr(obj, attrname): if message is not None: self.fail(message) else: self....
Going for the most succint answer so far: ``` self.assertTrue(hasattr(myInstance, "myAttribute")) ``` altough Dan's hint in a comment to the OP is also a valid answer: ``` assert hasattr(myInstance, "myAttribute")) ``` just not quite as syntactically aligned with the typical assertions from the unittest package.
115,974
A few months ago I had a gallon of milk in the back of the fridge that stayed fresh for over a month - maybe even two; I lost track. Our house is only me and my wife. We don't drink milk often. I use it more for recipes, and maybe an occasional iced coffee. Since I couldn't repeat this feat I have gone to half-gallons...
2021/06/08
[ "https://cooking.stackexchange.com/questions/115974", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/28767/" ]
Something to be aware of is where the milk is from and how it's pasteurized. My store brand milk is local and pasteurized only, but some other brands are ultra pasteurized and expected to last much longer. I've experienced similar flukes in the past, generally with ultra-pasteurized milk.
Your experience doesn't surprise me. FuzzyChef went into most of it but I would like to add one more bit of information: Locally, those opaque plastic containers are used for milk that they must be doing something different with the pasteurization as I have seen milk on the store shelf with a date more than a month ou...
6,066,487
Is there a way to tell that a pointer's memory assignment has been deallocated? I am just starting out in C and I think I am *finally* starting to understand the intricacies of memory management in C. So for example: ``` char* pointer; pointer = malloc(1024); /* do stuff */ free(pointer); /* test memory allocation...
2011/05/20
[ "https://Stackoverflow.com/questions/6066487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11194/" ]
You could always link against an instrumented version of the libraries (say [electric fence](http://en.wikipedia.org/wiki/Electric_Fence)) for the purposes of unit testing. Not ideal because you introduce a difference in the production and testing environments. And some systems may provide sufficient instrumentation ...
Use good c practices. Example: ``` char* pointer = NULL; /* do stuff */ pointer = malloc(1024);/* malloc does not always work, check it. */ if(pointer == NULL) { /*Help me, warn or exit*/ } /* do stuff */ if(pointer) { free(pointer); pointer = NULL; } /* do stuff */ if(pointer) { /* tested memory alloca...
49,643
I want to hide/remove the Personal Options in the **Your Profile** (`wp-admin/profile.php`) admin page. I am aware that solutions for this exist, but I they use jQuery to do hide this section. This works, but when a user has JavaScript disabled in their browser, it will show up again. Therefore it is not a proper way ...
2012/04/20
[ "https://wordpress.stackexchange.com/questions/49643", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14728/" ]
Thanks to the comment from @Per I got it working for 4.5.2 ``` // removes admin color scheme options remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' ); if ( ! function_exists( 'cor_remove_personal_options' ) ) { /** * Removes the leftover 'Visual Editor', 'Keyboard ...
I´ve found this solution on: <https://premium.wpmudev.org/blog/how-to-simplify-wordpress-profiles-by-removing-personal-options/?ptm=c&utm_expid=3606929-108.O6f5ypXuTg-XPCV9sY1yrw.2> ``` function hide_personal_options(){ echo "\n" . '<script type="text/javascript">jQuery(document).ready(function($) { $(\'form...
32,620,099
Everytime I try to add padding around the outside of an input, it just adds padding between the placeholder and the inside of the input. Does anyone know how to fix this? ``` #ask { padding: 10px 10px 10px 6px; font-size:45px; background-color:#F2F2F2; } <input id="ask" type=...
2015/09/16
[ "https://Stackoverflow.com/questions/32620099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5302703/" ]
Padding it's the space between the element and it's content. Maybe you should try margin. ``` #ask { margin: 10px 10px 10px 6px; font-size:45px; background-color:#F2F2F2; } ```
Try adding a `margin` instead of `padding`. <https://jsfiddle.net/Lw4d1ghs/> Margins change the space outside an element, padding change the space within it. These rules are governed by the CSS **Box Model**: <https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model> [![CSS B...
25,132,499
How please works following generic casting? ``` private <T, N> N send(final T request) { final String serviceUrl = "someUri" try { return (N) webServiceTemplate.marshalSendAndReceive(serviceUrl, request); } catch (final SoapFaultClientException e) { } } ``` When I call this private method l...
2014/08/05
[ "https://Stackoverflow.com/questions/25132499", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1089362/" ]
> > < T, N> > > > Is not a return type. N is. ``` private <T, N> N send(final T request) ↑ ``` You have "choosen" type T by passing MyReq argument. Before returning value of marshalSendAndReceive it is being casted to N type. In your case MyResp. ``` <T,N> ``` just declares that this class/me...
The method is parameterized with the generic parameters `T` and `N`. It takes an argument of type `T` and returns a reference of type `N`. The return type is not `<T,N>`, it is just `N`.
31,879,390
I need to replace the NA's of each row with non NA's values of different row for a given column for each group let say sample data like: ``` id name 1 a 1 NA 2 b 3 NA 3 c 3 NA ``` desired output: ``` id name 1 a 1 a 2 b 3 c 3 c 3 c ``` Is there a wa...
2015/08/07
[ "https://Stackoverflow.com/questions/31879390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4946087/" ]
We can use `data.table` to do this. Convert the 'data.frame' to 'data.table' (`setDT(df1)`). Grouped by 'id', we replace the 'name' with the non-NA value in 'name'. ``` library(data.table)#v1.9.5+ setDT(df1)[, name:= name[!is.na(name)][1L] , by = id] df1 # id name #1: 1 a #2: 1 a #3: 2 b #4: 3 c #5: ...
Base R ``` d<-na.omit(df) transform(df,name=d$name[match(id,d$id)]) ``` again assuming one unique value of name per id (forces it)
54,363,139
I am using `sqflite` database to save user list. I have user list screen, which shows list of user and it has a fab button, on click of fab button, user is redirected to next screen where he can add new user to database. The new user is properly inserted to the database but when user presses back button and go backs to...
2019/01/25
[ "https://Stackoverflow.com/questions/54363139", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Follow up from the comments, it seems you don't have a single instance of your UsersBloc in those two pages. Both the HomePage and UserDetails return a BlocProvider which instantiate a UsersBloc instance. Because you have two blocs instances(which you shouldn't have) you don't update the streams properly. The solution...
The issue is that you're using a `PublishSubject`. When a new listener subscribes to a `PublishSubject`, it does not receive the previously sent value and will only receive the next events. The easiest solution is to use a `BehaviorSubject` or a `ReplaySubject` instead. These two will directly call their listener wit...
13,851,629
In Java, I have been asked to store integer values in a singly-linked list and then print the elements stored in the list. Here is what I came up with: ``` int max = 10; List<Integer> list = new ArrayList<Integer>(); for (int num = 0; i < max; i++){ list.add(num); } System.out.print(list); ``` I was wondering,...
2012/12/13
[ "https://Stackoverflow.com/questions/13851629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1735089/" ]
No - `ArrayList` is not a linked list at all - it's an array list. `ArrayList` stores its elements in an array, whereas linked lists store them in arbitrary memory by linking objects together. `LinkedList` is a doubly-linked list, and I'm sure that there are various singly linked list implementations you could grab, b...
No `ArrayList` is definitely *not* the same as a singly linked list. In fact, it is not a *linked* list at all: it is a list that uses an array for its backing storage. This lets you access `ArrayList` in arbitrary order, as opposed to linked lists, that must be accessed sequentially. Java library has a doubly-linked ...
56,275,023
So, I have the main div (modal-container) which taking a full page and inside the main div and having another div (modal-inner) with two buttons. The main DIV was set to full height/width of the page and inside DIV (modal-inner) having calc(100% - 40px) width of screen. Through Jquery I have added two functions on eac...
2019/05/23
[ "https://Stackoverflow.com/questions/56275023", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2479903/" ]
Instead of using `e​.prevent​Default()`, you should use [`e.stop​Propagation()`](https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation): > > The `stopPropagation()` method of the Event interface prevents further propagation of the current event in the ***capturing*** and ***bubbling*** phases. > > ...
The click event is propagating up the dom from the button to the div so both elements event handler gets triggered. You can stop the propagation with `Event.stopImmediatePropagation` ```js $(document).ready(function () { $("body").on("click", ".jq-button-ok", function (e) { e.preventDefault(); ...
80,062
So the desired result is a compound that can be left in relatively isolated area, isolated such that weather has no direct affect on the area, and that will ignite/explode when touched, even after sitting in this area for a few thousand years. I am aware of things like touch powder that will explode violently when touc...
2017/05/04
[ "https://worldbuilding.stackexchange.com/questions/80062", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/37850/" ]
No. You can't both have isolated a material for 1000's of years from everything\* in its environment that will degrade/contaminate it and have it be exposed for human touch. (\* pollutants (SO2, NOx, CO2, Ozone), oxygen, humidity, UV light, visible light, dust, dirt, bacteria, mold, insects, mice, etc. etc. Not to ment...
A single drop of antimatter kept inside of a magnetic suspension chamber with a charge that lasts 1,000 years might do it. But making it sensitive enough to be set off would be an issue. Also the degradation of the materials used to construct the canister would be questionable.
53,534,397
I have to say who is the scientist who have been the most in mission. I tried this code but it wasn't successful: ``` select name from scientist, mission where mission.nums = chercheur.nums having count(*) = (select max(count(numis)) from mission, scientist where mission.nums = chercheur.nums group by name) ``` I...
2018/11/29
[ "https://Stackoverflow.com/questions/53534397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10721089/" ]
Step 0 : Format your code :-) It would make it much easier to visualize Step 1 : Get the count of Numis by Nums in the Mission table. This will tell you how many missions were done by each Nums This is done in the cte block cnt\_by\_nums Next to get the name of the scientist by joining cnt\_by\_nums with scientist t...
As you don't select the name of your scientist (only count their missions) you don't need to join those tables within the subquery. Grouping over the foreign key would be sufficient: ``` select count(numis) from mission group by nums ``` You column names are a bit weird but that's your choice ;-) Selecting only the...
9,974,392
I'm building a mvc application which will communicate with flash via AMF, anybody knows if there is any **AMF ActionResult** available on the web ? **EDIT**: using @mizi\_sk answer (but without using IExternalizable) I did this ActionResult: ``` public class AmfResult : ActionResult { private readonly object _o...
2012/04/02
[ "https://Stackoverflow.com/questions/9974392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112100/" ]
The trick is to use `FluorineFx.IO.AMFMessage` with AMFBody as a result object and set a `Content` property. You can see this in Charles proxy with other working examples (I've used great [WebORB examples](http://www.themidnightcoders.com/examples), specifically [Flash remoting Basic Invocation AS3](http://www.themidn...
I haven't seen an ActionResult implemented on the web but there's [FluorineFX.NET](http://www.fluorinefx.com/) which supports AMF.
37,827,375
In Eclipse, how to debug only a part of the code (Not from the starting). In the below code, the debugging is getting stuck at LINE 1 forever, no matter how many times I press F6 . I want to skip the first FOR loop , and start debugging from LINE 2. NOTE : LINE 1 runs a query which takes about 20 mins time. I alrea...
2016/06/15
[ "https://Stackoverflow.com/questions/37827375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3254725/" ]
I solved it by adding this in the model. ``` ng-model-options="{timezone: 'UTC'}" ``` See the updated plunkr here. <http://plnkr.co/edit/x0WLHNG7l5VBRU5tN8Q1?p=preview>
I think, time zone is causing this issue. Please refer the below URL: <https://gist.github.com/weberste/354a3f0a9ea58e0ea0de>
50,684,578
I have the following dictionary representing `id:parent. {1: 2, 3: 1}`. I need to loop and check if `id == parent` then it is a child. For example here: `1=1` so `3` is the child of `1`. I will append it to the dictionary accordingly. Any ideas? ``` d={1:2, 3:1} for node in d: ```
2018/06/04
[ "https://Stackoverflow.com/questions/50684578", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3057109/" ]
Do as follows. See comments within the code and remarks at the end. ``` const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); exports.sendNotif = functions.database.ref('/customers/{id}/chats/{chatId}').onUpdate((change, context) =>...
The fact that you are successfully updating the "customers/uid/chats/chat" branch says that you have the chat id/uid. All you do is fetch the "messages/chat" and read it. Since you have the chat id, a `.Promise.all` approach works here. Something like: ``` var promises = [writeChat(),readChat()]; Promise.all(...
569
Is there some algorithm out there that can return some value indicating a level of randomness? I believe it's called [Data Entropy](http://en.wikipedia.org/wiki/Entropy_%28information_theory%29). I recently read this article: <http://faculty.rhodes.edu/wetzel/random/mainbody.html> Would his approach of analyzing coin...
2010/08/25
[ "https://cstheory.stackexchange.com/questions/569", "https://cstheory.stackexchange.com", "https://cstheory.stackexchange.com/users/499/" ]
From random.org: > > Oddly enough, it is theoretically impossible to prove that a random number generator is really random. Rather, you analyse an increasing amount of numbers produced by a given generator, and depending on the results, your confidence in the generator increases (or decreases, as the case may be) > ...
As other answers mentioned, the decision version of this problem (like the Halting problem and a number of other problems like the Tiling Problem) is undecidable. However, I believe you are asking about practical ways to measure the randomness of a collection of bits. Standard practice here is to run the data through ...
2,246,940
I have a problem accessing a database through a JDBC connection. ``` End of stream was detected on a read ``` The error occurs at several different points at random. I appreciate any help.
2010/02/11
[ "https://Stackoverflow.com/questions/2246940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/229882/" ]
Use `Ctrl+F5` to start running without the debugger. This can also be accessed from the Debug menu, as "Start without debugging". You can also change the project configuration from Debug to Release, as explained [here](http://msdn.microsoft.com/en-us/library/wx0123s5.aspx).
`[Debug - Start without Debugging] or Ctrl F5`. Or launch your app outside Visual Studio.
3,892,042
I need to post data to a URL (https://somesite.com) to download file in responseStrem based on the parameters I posted. How can I do that using a C# console application? Parameters: filename, userid, password, type
2010/10/08
[ "https://Stackoverflow.com/questions/3892042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/470310/" ]
Take a look at the `System.Net.WebClient` class, it can be used to issue requests and handle their responses, as well as to download files: <http://www.hanselman.com/blog/HTTPPOSTsAndHTTPGETsWithWebClientAndCAndFakingAPostBack.aspx> <http://msdn.microsoft.com/en-us/library/system.net.webclient(VS.90).aspx>
Insted of using System.Net.WebClient I would recommend to have a look on System.Net.Http.HttpClient which was introduced with net 4.5 and makes your life much easier. Also microsoft recommends to use the HttpClient on this article <http://msdn.microsoft.com/en-us/library/system.net.webclient(VS.90).aspx> An example ...
72,116
I understand about race conditions and how with multiple threads accessing the same variable, updates made by one can be ignored and overwritten by others, but what if each thread is writing the same value (not different values) to the same variable; can even this cause problems? Could this code: GlobalVar.property = ...
2008/09/16
[ "https://Stackoverflow.com/questions/72116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The problem comes when you read that state back, and do something about it. Writing is a red herring - it is true that as long as this is a single word most environments guarantee the write will be atomic, but that doesn't mean that a larger piece of code that includes this fragment is thread-safe. Firstly, presumably ...
I would expect the result to be undetermined. As in it would vary from compiler to complier, langauge to language and OS to OS etc. So no, it is not safe WHy would you want to do this though - adding in a line to obtain a mutex lock is only one or two lines of code (in most languages), and would remove any possibility...
22,170,944
I have a string: `[1, 2, 3, 4]`. I need to get only integers `1 2 3 4`. I tried the following splits: ``` str.split(","); str.split("\\D\\s"); ``` Both splits return four elements: [1 2 3 4], but I don't need these brackets `[ ]`. What is wrong with split regexp? **updated** I had to mention that the case when ea...
2014/03/04
[ "https://Stackoverflow.com/questions/22170944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1049521/" ]
You could try filtering out unwanted elements first and then split: ``` String filtered = str.replaceAll("[^0-9,]",""); String[] numbers = filtered.split(","); ```
replace the brackets `[ ]`and then split ``` str.replaceAll("\\[", "").replaceAll("\\]", "").split(","); ```
81,724
While looking up my most favorite in-rem case (["US vs. approximately 64k Pounds of Shark Fins"](https://en.wikipedia.org/wiki/United_States_v._Approximately_64,695_Pounds_of_Shark_Fins)), I stumbled over a few quite strange ones: * [Pensylvania was sued **by** a car](https://en.wikipedia.org/wiki/One_1958_Plymouth_Se...
2022/07/02
[ "https://law.stackexchange.com/questions/81724", "https://law.stackexchange.com", "https://law.stackexchange.com/users/10334/" ]
The original filed case *would* have been "Government v. Item", with the government (plaintiff) suing the item (defendant), not the other way around. But these are appellate cases, and the title convention there is "Appellant v. Respondent", regardless of who was the original plaintiff or defendant. So in each case, th...
The reason is that the item "did" a wrong, therefore the police are seizing the item. A [civil forfeiture case](https://www.law.cornell.edu/wex/forfeiture) – against the item – will be filed by the government. The item is not protected by the Constitution, and in case the owner finds out and sues, the government's case...
144
Mount Hood in Oregon is a dormant volcano, and in Washington Mount St. Helens and Mt. Ranier are both active volcanoes. What causes this line of volcanoes running parallel to the coastline along the northwest coast of North America?
2014/04/16
[ "https://earthscience.stackexchange.com/questions/144", "https://earthscience.stackexchange.com", "https://earthscience.stackexchange.com/users/53/" ]
The Cascades (the volcanic range that Mt. St. Helens and Mt. Ranier are a part of) are "arc volcanoes" (a.k.a. "a volcanic arc", etc). Volcanic arcs form at a regular distance (and fairly regular spacing) behind subduction zones. Subduction zones are areas where dense oceanic crust dives beneath more buoyant crust (ei...
It's because in this place two tectonic plates meet. Most volcanoes are in such place - where there is border between tectonic plates.
2,326,741
I've got a string like this: ``` &lt;block trace="true" name="AssignResources: Append Resources"&gt; ``` I need to get the word (or the characters to next whitespace) after `&lt;` (in this case *block*) and the words before `=` (here *trace* and *name*). I tried several regex patterns, but all my attempts return t...
2010/02/24
[ "https://Stackoverflow.com/questions/2326741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/273433/" ]
Its looks so much like [parsing HTML with regex](https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454) to me Ruby has very good html parser called [Nokogiri](http://nokogiri.org/) And Here is howto for that ``` require 'nokogiri' html=Nokogiri::HTML('<bl...
Most probably you should go with Nokigiri or something similar. I couldn't fit it in one gsub but in two: ``` >> m,r=0,["&lt;blockie ", " tracie=", " namie="] >> s.gsub(/&lt;.*?([^\s]+)\s/, r[0]).gsub(/\s([^=]+)=/) {|ma| m+=1; r[m]} => "&lt;blockie tracie="true" namie="AssignResources: Append Resources"&gt;" ```
252,286
This sounds dumb, but I can't get it to work. I think i just dont' understand the difference between `%%v, %v% and %v` Here's what I'm trying to do: ``` for %%v in (*.flv) do ffmpeg.exe -i "%%v" -y -f mjpeg -ss 0.001 -vframes 1 -an "%%v.jpg" ``` This successfully generates a thumbnail for each of the movies, but th...
2008/10/31
[ "https://Stackoverflow.com/questions/252286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10680/" ]
For people who found this thread looking for how to actually perform string operations on for-loop variables (uses [delayed expansion](http://ss64.com/nt/delayedexpansion.html)): ``` setlocal enabledelayedexpansion ... ::Replace "12345" with "abcde" for %%i in (*.txt) do ( set temp=%%i echo !temp:12345=abcde...
``` for %%v in (*.flv) do ffmpeg.exe -i "%%v" -y -f mjpeg -ss 0.001 -vframes 1 -an "%%~nv.jpg" ``` From "help for": ``` %~I - expands %I removing any surrounding quotes (") %~fI - expands %I to a fully qualified path name %~dI - expands %I to a drive letter only %~pI - expands %I to a pa...
161,082
I would like to install a monitoring services (Monit or others) on my web server and am looking for recommendation. I have no idea which is good, and what parameters which I should evaluate on, and which is a good for for my needs. Some which I saw and am evaluating are Monit <http://mmonit.com/monit/> God <http:...
2010/07/16
[ "https://serverfault.com/questions/161082", "https://serverfault.com", "https://serverfault.com/users/28709/" ]
Monit satisfies all you requirements. It is easy to install, setup, add services, send emails and has a builtin http server. We've been running monit for over a year now without downtime. I've not tried the others.
easy to install = may be you are not going to receive all the info you want. May be you can install munin, its easy and as a munin-node you'll be able to monitorize mysql,cpu, ram and other stuff. <http://www.howtoforge.com/server_monitoring_monit_munin> It's very easy to install but it will not send any mail to ale...
22,781,754
I would like to print out the content of an associative array. For this I'm using Data::dumper. So, for exemple, if the associative array is called "%w", I write : ``` print OUT Dumper(\%w); ``` Here's the problem: there are some words like "récente" that are printed out as "r\x{e9}cente". If I write just : `...
2014/04/01
[ "https://Stackoverflow.com/questions/22781754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3025314/" ]
You can also use *Data::Dumper::AutoEncode*. ``` use utf8; use Data::Dumper::AutoEncode; warn eDumper($hash_ref); ``` [cpan Data::Dumper::AutoEncode](http://search.cpan.org/~bayashi/Data-Dumper-AutoEncode-0.103/lib/Data/Dumper/AutoEncode.pm)
This works for me: ``` use strict; use warnings; use Data::Dumper; $Data::Dumper::Useperl = 1; binmode STDOUT, ":utf8"; { no warnings 'redefine'; sub Data::Dumper::qquote { my $s = shift; return "'$s'"; } } my $s = "rcente\x{3a3}"; my %w = ($s=>12); print Dumper(\%w), "\n"; ```
4,364,458
i always in inserting data into a mysql table i use a select for that data before inserting to avoid duplicate records and if the query return null then i insert record. but i think maybe it is not a professional way to do this job. would you let me the ways you do?
2010/12/06
[ "https://Stackoverflow.com/questions/4364458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/313389/" ]
``` You can try the following example. I would suggest you to try this first in your testing environment then you can implement this in your actual scenario. Follow the below steps: Step 1: create a table CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(30) NOT NULL, `e...
The "professional" way to do this will be using a primary key constraint.
26,802,189
Say like we have in Spring Framework a lot of variations to set compile/run/test time environment, and use it to bind a different properties files with settings. It is made for us not to change anything except this one environment/profile variable to be able to have proper settings for app. More particularly: I have ...
2014/11/07
[ "https://Stackoverflow.com/questions/26802189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2782135/" ]
I just develop a solution for the issue. 1. Create a grunt task (or the equivalent build tools) to copy the `settings.<env>.js` file to `settings.js` file. ``` copy: { dev: { src: 'settings.dev.js', dest: 'settings.js' }, prod: { src: 'settings.prod.js', dest: 'settings.js' } }, grunt.registe...
For loading config files you can just ad script tag with the script URL in the HTML. ``` <script src="/your/path/settings.prod.js"></script> ``` or ``` <script src="/your/path/settings.dev.js"></script> ``` Then you can defined variables as usual.
214,688
Apparently, they're "confusing". Is that seriously the reason? Can you think of any others?
2008/10/18
[ "https://Stackoverflow.com/questions/214688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18658/" ]
Have you seen how many developers don't really understand ref/out? I use them where they're really necessary, but not otherwise. They're usually only useful if you want to effectively return two or more values - in which case it's worth at least *thinking* about whether there's a way of making the method only do one t...
You should be returning objects is probably the most likely reason that they suggest not using ref or out. "ref" really only needs to be used when passing scalar values but I see people use it often for objects that are being passed by reference anyways.
5,687,764
I'm doing some redirects using PHP, e.g.: ``` header('Location: '.$url); ``` But now I need to do some redirects with some other statuscodes. Should I http1.0 or http1.1 for this. Or are we already at http2.0 or greater? And are the status code the same for both? So let's say I want to redirect using statuscode ...
2011/04/16
[ "https://Stackoverflow.com/questions/5687764", "https://Stackoverflow.com", "https://Stackoverflow.com/users/508666/" ]
Generally speaking, browsers are using HTTP 1.1 *(HTTP 1.0 is quite old ; and doesn't support several interesting features which are pretty much required nowadays)* HTTP 2.0 ? There is no such thing ;-) Don't hesitate to take a look at [Hypertext Transfer Protocol][1] -- and going through [\*\*RFC 2616 - Hypertext Tr...
Its up to you, if you send `HTTP/1.0` or `HTTP/1.1`, because for your purposes nothing changed.
15,604,290
Writing Haskell programs I found myself in need of an operator like this. ``` (|>) :: a -> (a -> b) -> b (|>) = flip ($) infixl 0 |> ``` I think it is useful when glueing many functions together. ``` tText cs = someFun cs |> lines |> map (drop 4) |> reverse ``` I prefer ...
2013/03/24
[ "https://Stackoverflow.com/questions/15604290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2205541/" ]
The [`lens` library](http://hackage.haskell.org/package/lens) defines [this operator as `&`](http://hackage.haskell.org/packages/archive/lens/3.8.7.3/doc/html/Control-Lens-Combinators.html).
As far as my experience goes, I don't know any such library. And if such a library exists, I'd advise against using it. --- Unless you are using the lens package, I'd suggest not to use externally defined operators of that kind. (In case of that lens package, you really need and already have such an operator.) In my...
6,943,787
``` array( array('codcentrocustos' => 1, 'codparent' => null, 'name' => 'lorem ipsum'), array('codcentrocustos' => 2, 'codparent' => 1, 'name' => 'lorem ipsum1'), array('codcentrocustos' => 3, 'codparent' => 1, 'name' => 'lorem ipsum2'), array('codcentrocustos' => 4, 'codparent' => 2, 'name' => 'lorem ipsum...
2011/08/04
[ "https://Stackoverflow.com/questions/6943787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/878866/" ]
To convert your array to JSON just use [json\_encode](http://php.net/manual/en/function.json-encode.php). You don't need any sort of conversion. ``` $test = array( array('codcentrocustos' => 1, 'codparent' => null, 'name' => 'lorem ipsum'), array('codcentrocustos' => 2, 'codparent' => 1, 'name' => 'lorem ipsum1'...
You can't get away from from those indexes. Every element in an array MUST have a key. It's utterly unavoidable.
3,358,203
Let's assume i'm given a Probability Distribution as follows: $$Bin(n; N, p)=\binom{N}{n}p^n(1-p)^{(N-n)}$$ We know that the mean of this distribution is: $$E[n]=Np$$ However, we want to prove its true using the derivative of the normalized condition of the distribution: $$\sum\_{n=0}^{N}\binom{N}{n}p^n(1-p)^{(N-...
2019/09/16
[ "https://math.stackexchange.com/questions/3358203", "https://math.stackexchange.com", "https://math.stackexchange.com/users/666807/" ]
Instead say that $$B(k,n,p,q)= {n \choose k} p^k q^{n-k}~~~~~(1)$$ Now write the binomial expansion $$(p+q)^n = \sum\_{k=0}^{n} {n \choose k} p^k q ^{n-k}~~~~(2)$$ paretially differentiate both sides $(\frac{\partial}{\partial p}),$ to get $$\sum\_{k=0}^{n} k {n \choose k} p^{k}{q^{n-k}}=np (p+q)^{n-1}~~~~(3)$$ $$<k>=\...
Differntiation of $$\sum\_{n=0}^{N}\binom{N}{n}p^n(1-p)^{(N-n)}=1$$ gives $$\sum\_{n=0}^{N}\binom{N}{n} [np^{n-1}(1-p)^{(N-n)}-(N-n)p^{n}(1-p)^{N-n-1}]=0$$ You can write this as $$\sum\_{n=0}^{N}\binom{N}{n} p^n(1-p)^{(N-n)}[\frac n p -\frac {N-n} {1-p}]=0$$ After multiplying by $p(1-p)$ this becomes $$\sum\_{n=...
64,763,791
I want to design a Bottom app bar, First i implemented a dependency named as implementation 'com.google.android.material:material:1.2.0-alpha02' After that with the help of co-ordinate layout I started the project The xml file is: ``` <?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.Coordinato...
2020/11/10
[ "https://Stackoverflow.com/questions/64763791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14589996/" ]
You just need to add `GROUP BY` clause along with `COUNT` aggregation ``` CREATE OR REPLACE VIEW ViewTest AS SELECT First_Name || ' ' || last_Name As EMP_NAME, TO_CHAR(READ_DATE, 'YYYY-MON') As MONTH, COUNT(*) FROM EMPLOYEE E INNER JOIN EMPLOYEE_READ ER ON E.EMP_ID = ER.EMP_ID WHERE TO_CHAR(READ_...
You can use the following query using `GROUP BY`: ``` CREATE VIEW ViewTest AS SELECT EMP_ID AS ID, First_Name ||' '||last_Name As EMP_NAME, to_char(SYSDATE,'YYYY-MON') As MONTH, -- you can use SYSDATE here. No need to include it in GROUP BY Count(1) as "COUNT" FROM EMPLOYEE E INNER JOIN EMPLOYE...
49,580,725
Here is my code ``` async getAll(): Promise<GetAllUserData[]> { return await dbQuery(); // dbQuery returns User[] } class User { id: number; name: string; } class GetAllUserData{ id: number; } ``` `getAll` function returns `User[]`, and each element of array has the `name` property, even if its ret...
2018/03/30
[ "https://Stackoverflow.com/questions/49580725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7750163/" ]
I don't think it's possible with the code structure you have. Typescript *does* have [excess property checks](https://www.typescriptlang.org/docs/handbook/interfaces.html#excess-property-checks), which sounds like what you're after, but they only work for object literals. From those docs: > > Object literals get spec...
As an option, you can go with a hack: ``` const dbQuery = () => [ { name: '', id: 1}]; async function getAll(): Promise<GetAllUserData[]> { return await dbQuery(); // dbQuery returns User[] } type Exact<T> = {[k: string | number | symbol]: never} & T type User = { id: number; name: string; } type GetAl...
29,362
I work in an office and we have a server with a lot of music on it. I am looking for software that would allow anyone in the office to queue up songs to a playlist, sort of like an office radio station where people choose the songs. Are there any programs like this already written? I am considering writing software lik...
2009/08/25
[ "https://superuser.com/questions/29362", "https://superuser.com", "https://superuser.com/users/7698/" ]
[Ampache](http://ampache.org/) is a web-based A/V streaming application. It can be configured to play via embedded flash or stream to a local media player on a per-user basis, or it can be configured for democratic playlists to allow many users to vote on what they want to hear. It's done in PHP with a basic LAMP sta...
Would each person connect separately, or is there one player connected to speakers? My personal favourite is Squeezecenter. If you are all using PCs you can use the Jive UI to connect to it. An alternative some people use in our office is Spotify. You can have a group playlist that people add music to and take away.
13,202,797
I know that we cannot change the reference passed to a function such as ``` void fun(dog a){ a=null; } ``` After executing the function ``` main(String[] args){ dog a=new dog(); fun(a); } ``` the dog a is not changed. So I was wondering how can we change the reference a to null inside a function
2012/11/02
[ "https://Stackoverflow.com/questions/13202797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1698248/" ]
Java is Pass by Value, where the *value of the reference* is passed, so new reference value will be passed as parameter. When this reference points to new Object inside the method, changes on reference won't reflect on the object outside of the method. You may need to do something like below to make your outer referen...
Java is strictly a pass by value language (see [this for great info](http://javadude.com/articles/passbyvalue.htm)). In short, this means that, when you pass an object reference to a method, a copy of the reference is created for the method. Therefore, any thing you do to nullify the reference in the function is only n...
1,864,267
I have a list of strings whose values come from a fixed set. I need to sort this list in an arbitrary order. The order of the set is specified by another list of all possible strings, sorted in order in an array. Here is an example: ``` my @all_possible_strings_in_order = ('name', 'street', 'city','state', 'postalc...
2009/12/08
[ "https://Stackoverflow.com/questions/1864267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/144680/" ]
You can just go over the master list and push any element that occurs in the unsorted list onto the result list, while removing it from the unsorted list. If your unsorted list is short (from your example, I reckon about 5 elements), this should be faster and smaller than building hash tables each time (you said you co...
The most naive way to do this would be to sort based on a comparison function, where the comparison function comp(a,b) = "which of a and b comes first in the master list?", if I understand correctly. So yeah, your idea looks about right. If you have to do a lot of sorts between changes to `@all_possible_strings_in_ord...
2,387,316
I'm having a textbox and assigned the following function (it's the only function assigned): ``` txt.bind("keyup",function(event){ if(event.keyCode==13) { var nu = $("#debug").html(); nu+="<br>enter"; $("#debug").html(nu); } }); ``` The strange thing is that it's actually firing tw...
2010/03/05
[ "https://Stackoverflow.com/questions/2387316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/202862/" ]
I'm embarrassed to even mention this, but I was typing a capital letter into my textbox and so the release of my shift key was causing the supposed "second firing" of the keyup event. Turns out it wasn't a second firing at all, but it just fooled me into thinking it was for while. At first I thought the unbind trick ...
could it be possible that your html-element is contained twice within txt? it would be helpful if you would provide the html and the assigning javascript-code.
59,494,598
I'm currently trying to loop running a function. Can't figure it out and here's what I tried: ``` do { queryLastCursor(lastCursor).then(lastCursorResults => { if (lastCursorResults.hasNext = false) { hasNextPage = false; } console.log(hasNextPage); }) } while (hasNextPage); ``` `queryLastCur...
2019/12/26
[ "https://Stackoverflow.com/questions/59494598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2690257/" ]
If you want to do an async process in a loop, I suggest doing it recursively: ``` const runQuery = () => { queryLastCursor(lastCursor) .then(result => { if (result.hasNext) { // recursively call itself if hasNext is true runQuery(); } }); } runQuery(); ``` Assuming you'd want ...
I would do something like that: ``` const callApi = async () => { let result = await someMagic(); while (result.hasNext) { doSomethingwith(result); result = await someMagic(); } return result; }; const myResult = await callApi(); ``` Though this seems risky, what is we always get a ha...
71,318,723
I've been searching around for a while now, but I can't seem to find the answer to this small problem. how to convert string 06-JUL-89 to datetime 06/07/1989? I've tried with code like the following: ``` TO_CHAR(TO_DATE(BORN,'DD-MON-YY'),'DD/MM/YYYY') ``` however, the result shows wrong: to be 06/07/2089? how do i ...
2022/03/02
[ "https://Stackoverflow.com/questions/71318723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14388578/" ]
With `RR` format model. ``` SQL> select to_char(to_date('06-jul-89', 'dd-mon-rr'), 'dd/mm/yyyy') result from dual; -- RESULT here ---------- 06/07/1989 SQL> ``` --- By the way, it looks as if you store date values as strings....
It seem that you have the problem of year 2k : * `TO_DATE('06-jul-89', 'dd-mon-yy')` => 06/07/2089 * You must use `TO_DATE('06-jul-89', 'dd-mon-rr')` => 06/07/1989
5,450,596
This question appear when I worked with partial view (MVC3/Razor), but I am sure - it's clear Razor Syntax question, not related direct to partial view. So - I have partial view Menu.cshtml with full markup as: ``` @model IEnumerable<SportsStore.WebUI.Models.NavLink> @foreach(var link in Model) { @Html.RouteLink(l...
2011/03/27
[ "https://Stackoverflow.com/questions/5450596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/335149/" ]
Just use ls? ``` ls /path/to/directory ``` Alternatively, use `opendir()` and `readdir()`, see `man 3 opendir` and `man 3 readdir`
The other answers are suitable if you are at the terminal, but you would probably like a C API, rather than an expensive call to fork the process and list a directory. For a C API, you'll want to take a look at `opendir`, `readdir` and `closedir` - [this is a perfectly good reference](http://pubs.opengroup.org/onlinep...
23,764,812
I setup google developer console enabling *Google Cloud Messaging for Android*. In the credential side I create the browser API key typing 0.0.0.0 in the refers. Actually I create both the types of key because I found different indication in different tutorial. [browser-key picture](http://imgur.com/m6149WQ) [server...
2014/05/20
[ "https://Stackoverflow.com/questions/23764812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3631494/" ]
Instead of entering `0.0.0.0` as allowed referrers or allowed IPs, don't enter anything. That should work.
Don't enter anything in the IP address field.It works like a charm. Also make sure you are using the Server key in server side and proper sender id android client.
6,659,322
How to read all contents of a column from excel file in 1-d array and in C#? Not using ADO.net approach or excel reader. Also there can be any number of rows in the excel file(how to determine number of rows in the column)..some cells may have blank value in the column...need the most basic approach using Microsoft.Off...
2011/07/12
[ "https://Stackoverflow.com/questions/6659322", "https://Stackoverflow.com", "https://Stackoverflow.com/users/830873/" ]
Just a thought - Do you have any outstanding migrations that you have not performed on Heroku? That's something I always forget - Just run `heroku run rake db:migrate` and see if that helps. Might not be an error in your code after all. Hope this helps!
Had the same issue. Running heroku run rake db:migrate worked for me
6,941,924
For example: ``` s1="my_foo" s2="not_my_bar" ``` the desired result would be `my_o`. How do I do this in bash?
2011/08/04
[ "https://Stackoverflow.com/questions/6941924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/603625/" ]
a late entry, I've just found this page: ``` echo "$str2" | awk 'BEGIN{FS=""} { n=0; while(n<=NF) { if ($n == substr(test,n,1)) { if(!found[$n]) printf("%c",$n); found[$n]=1;} n++; } print ""}' test="$str1" ``` and another one, this one builds a regexp for matching (note: doesn't work with special character...
A solution using a single sed execution: ``` echo -e "$s1\n$s2" | sed -e 'N;s/^/\n/;:begin;s/\n\(.\)\(.*\)\n\(.*\)\1\(.*\)/\1\n\2\n\3\4/;t begin;s/\n.\(.*\)\n\(.*\)/\n\1\n\2/;t begin;s/\n\n.*//' ``` As all cryptic sed script, it needs explanation in the form of a sed script file that can be run by `echo -e "$s1\n$s2...
15,363,360
In a database, there is a string of +10000 chars that is in XML format. The XML is not well formed and I need to fix it. I have to convert the string (no CRLF's in it) into a file that I can edit sensibly and correct the tags. I am able to extract the string to an editor, it is the conversion to multiline, indented X...
2013/03/12
[ "https://Stackoverflow.com/questions/15363360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/653966/" ]
A good solution is to run : ``` xmllint --format file.xml ``` `xmllint` is a part of `libxml2-utils` on debian, see <http://www.xmlsoft.org/> (also available for windows)
use "Xml formatter" package in Atom text editor. <https://atom.io/packages/xml-formatter> Its offline and you don't risk data privacy
83,352
Inspired by the very nice problem solutions of [the problem of coinciding clock hands](https://mathematica.stackexchange.com/questions/573/figuring-when-the-minute-and-hour-hand-coincide-on-a-clock), I'd like to extend the question including a "second" hand. While it is obvious that all three hand can coincide only at...
2015/05/13
[ "https://mathematica.stackexchange.com/questions/83352", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/16361/" ]
The coincidences of the hour and minute hand occur when the number of hours since midnight $h$ satisfies $\frac{1}{12}h = h - n$ for some integer $n$. (The left-hand side corresponds to the number of revolutions the hour hand has made; the right-hand side corresponds to the number of of revolutions the minute hand has ...
I have not spent sufficient time but perhaps. In the following, starting clock at 12:00 with red second hand, blue minute hand and green hour hand. "SM" animates first coincidence second and minute hand, "MH", minute and hour hands, "SH" second and hour hands. First number after after graphic is time to first coinciden...
20,042,102
rubygems/dependency.rb:296:in `to\_specs': Could not find 'cocoapods' (>= 0) among 35 total gem(s) (Gem::LoadError) from /Users/divyam.shukla/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to\_spec' ``` from /Users/user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem...
2013/11/18
[ "https://Stackoverflow.com/questions/20042102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1768020/" ]
Hey I had the same problem that you have, I solve it following the next steps: (I strongly recommend to use rvm to manage ruby versions) 1. Remove cocoapods using `gem uninstall cocoapods` 2. Install **rvm**, to do this I followed this steps <https://rvm.io/rvm/install> 3. After that reinstall cocoapods using `gem in...
do this : sudo gem install -n /usr/local/bin cocoapods
70,104,211
The code works but its weird , when i run it and give the quantity 375 this is the result: Quantity: 375 2 notes of 100 2 notes of 50 2 notes of 20 2 notes of 10 2 notes of 5 2 notes of 2 1 notes of 1 It should give me 3 notes of 100 , one note of 50 , one note of 20 and one note of 5. Im really new to coding so this...
2021/11/24
[ "https://Stackoverflow.com/questions/70104211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17502805/" ]
I fixed this problem by removing the following line in my `build.gradle` file: ``` implementation 'androidx.test:core-ktx:1.4.0' ```
Espresso are not unit tests and you're probably lacking a dependency: ``` testImplementation "androidx.test:monitor:1.4.0" ```
8,300,108
I've been working with Xcode for about 5 months now and I just recently ran across a problem when I add a new class. If I add a new class, say for example "CustomCell" and I try to import '#import CustomCell.h' into a different .m file it will give me an error saying 'CustomCell.h file not found' even though it's right...
2011/11/28
[ "https://Stackoverflow.com/questions/8300108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/975592/" ]
**Multiple Targets:** Make sure your file belongs to the necessary targets! --- For a new file, make sure the appropriate targets are checked. [![xCode Screenshot](https://i.stack.imgur.com/PNhDI.png)](https://i.stack.imgur.com/PNhDI.png) --- For an existing file, check the file inspector to verify target membersh...
For those dealing with the same issue and the above solution failed to solve it, make sure you don't have the > > [circular import](https://stackoverflow.com/questions/7767811/circular-import-issues-in-objective-c-cocoa-touch) > > > issue like i had. It happened with me as i had complex code and i failed to real...
57,724,231
I understand that we want to use `assert` when we want to check for impossible case. In a book I have, I saw the following two examples: ``` void foo(char* str) { assert ((str+strlen(str)) != NULL); } void bar(char* str) { assert (str[strlen(str)] != NULL); } ``` I'm trying to figure out if they are valid checks. As...
2019/08/30
[ "https://Stackoverflow.com/questions/57724231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9808098/" ]
Neither expression makes sense. In the first expression ``` assert ((str+strlen(str)) != NULL); ``` there is a check whether the address of the terminating zero character `'\0'` of a string is equal to NULL. It is evident that it is always unequal to NULL. From the C Standard (6.5.6 Additive operators) > > 8. .....
``` void foo(char* str) { assert ((str+strlen(str)) != NULL); } ``` is legal C-code but the expression `(str+strlen(str)) != NULL` will always be true so there is no point in making an assert. ``` void bar(char* str) { assert (str[strlen(str)] != NULL); } ``` is comparing a pointer with a char (aka interger type)....
44,352,657
I am working with a question for that we need to get n string inputs how to store then in n string variables. I tried with array storing the string in each elements Is there any other way in java ?
2017/06/04
[ "https://Stackoverflow.com/questions/44352657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7963754/" ]
I would use streams for this. It doens’t turn out to be very much shorter, but once you get comfortable with streams, it will be conceptually simpler. ``` Map<Integer, Long> frequencies = Arrays.stream(data) .boxed() .collect(Collectors.groupingBy(i -> i, Collectors.counting())); if (fr...
I would use Java8 stream for it. In some cases you can even use parallel stream to improve performance. Here is how I would do that: ``` public static void main(String[] args) { List<Integer> integers = Arrays.asList(1, 8, 7, 8, 9, 2, 1, 9, 6, 4, 3, 5); //Here we have statistics of frequency for all numbers ...
60,382,563
``` public class A2 { protected virtual void f() {Console.WriteLine("from A2");} protected virtual void g() {Console.WriteLine("From A2");} protected virtual void h1() {Console.WriteLine("from A2");} } public class B2 { protected virtual void f() {Console.WriteLine("B2");} protected virtual void g() {Console...
2020/02/24
[ "https://Stackoverflow.com/questions/60382563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12270056/" ]
It's very difficult to center elements using VFL. It's also difficult to center two elements unless they are embedded in a `UIView` or a `UIStackView`. Here is one option by embedding the labels in a "container" `UIView`: ``` class MyVC: UIViewController { lazy var titleLabel: UILabel = { let l = UILabe...
This can be achieved easily by using stackview. Add both the labels in stackview and center it vertically in the superview with all other constraints(top, leading, bottom, trailing). Here is the sample code of view controller for your use-case. ``` class ViewController: UIViewController { lazy var titleLabel: UIL...
12,234,204
In Jenkins, is there a way to give different timeouts to each or selected build step? Build-time plugin out gives functionality of timeout "Abort the build if it's stuck" on complete project, what I need is to give different timeouts for each step. This way I can make my process more efficient.
2012/09/02
[ "https://Stackoverflow.com/questions/12234204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/458034/" ]
Build-timeout Plugin isn't applicable to pipelines. refer to [wiki](https://wiki.jenkins.io/display/JENKINS/Build-timeout+Plugin) For pipeline time out, try something like: ``` timeout(time: 30, unit: 'MINUTES') { node { sh 'foo' } } ``` Similar answer from another thread: [How to add a timeout step to Jenk...
Please install Build Timeout plugin for your Jenkins. Jenkins> Manage Jenkins> Manage Plugins search for Build Timeout in available tab.. Install it. You would be finding it in Build environment as "Abort the build if it's stuck". Set the Timeout strategy and time. Absolute Deadline Elastic Likely Stuck No Activity ...
3,479,916
I was wondering what would be a good way to accomplish the following using mysql: Lets say I have a table that contains these fields: ``` MyTable --------- Country [string] Region/Province/State [string] City [string] ``` And I have the following data rows in the database ``` Entry 1: Canada, Ontario, Toronto Ent...
2010/08/13
[ "https://Stackoverflow.com/questions/3479916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/387302/" ]
**I would go with the 3 queries.** Normalize the table so you can check on small tables for `country`, `region/province/state` and `city` and then link them to the actual entries on a 1 -> N (one to many relationship). ``` SELECT * FROM cities LEFT JOIN actual_locations ON actual_locations.city = cities.id WHERE ci...
You can create a query that selects rows that match any of the three possibilities (matching Country, Region and City, matching Country and Region, matching Country). In that query you can use IF statements to assign a value and rank based on that value. It's simpler to run a query to see if a record matches all three...
9,243,221
Question: Are the result that i'm getting reasonable? Is there anything which could have such an impact in reducing the number of requests per second? ------------------------------------------------------------------------------------------------------------------------------------------------------ **Edit:** A frien...
2012/02/11
[ "https://Stackoverflow.com/questions/9243221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/882993/" ]
I've found that node works really really slowly if you refer to it as "localhost", but very quickly if you refer to it by "127.0.0.1". I think the dns lookup on Windows is really what's slowing the requests down.
Do you realize that Apache uses multiple processes or threads to serve the requests, whereas there's a single Node.js process? Either configure Apache for a single worker process or thread, or run as many Node.js processes as you have CPU cores, and loadbalance among them.
72,475,806
How can we get data from an array of objects in angular. I have provided the typescript & service file & the consoled image. How can we able to get datas inside results object in the image?? Ts File ```html this.commonService.fetchVersionValue().subscribe((data) => { console.warn(data); }); ``` Service Fil...
2022/06/02
[ "https://Stackoverflow.com/questions/72475806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18948657/" ]
```html this.commonService.fetchVersionValue().subscribe((response: any) => { console.warn(response.results.data); }); ``` This Works !!!
Your version details values are stored in the `data` property in the returned response. So you need to iterate over that property values. ``` this.commonService.fetchVersionValue().subscribe((response) => { console.warn(response.data); // Renaming to response for clarity }); ```
48,602,865
I have done this and it works. ``` CREATE TABLE Employee ( Employee_ID varchar2(10) PRIMARY KEY NOT NULL, Office_ID varchar2(7) NOT NULL, Emp_FirstName varchar2(20) NOT NULL, Emp_LastName varchar2(20) NOT NULL, Emp_Gender varchar2(1) NOT NULL, Emp_DateOfBirth Date NOT NULL, Hire_Date date NOT NULL, Emp_Curren...
2018/02/03
[ "https://Stackoverflow.com/questions/48602865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9289017/" ]
Because you mentioned computed columns, maybe your business requirement can be satisfied with the below instead of a constraint. ``` CREATE TABLE Employee ( ... Employee_ID varchar2(10) PRIMARY KEY NOT NULL, Emp_Speciality varchar2(20) NOT NULL, Emp_Supervised_By AS (CASE WHEN Emp_Speciality = ...
I did this and it works: `CREATE TABLE OrderLine ( Invoice_ID varchar2(10) PRIMARY KEY NOT NULL, Item_ID varchar2(10) NOT NULL, Unit_Price number(6,2) NOT NULL, Quantity number(6) NOT NULL, Total_Price number(38,2) AS (CASE WHEN Quantity >= 50 THEN ((Unit_Price*Quantity)-((Unit_Price*Quantity)*0.80)) ELSE Unit_...
17,820,460
I have a large mysql table - basically a slightly altered LDAP dump. 120K employees. The table is needed for lots of things but I have one task that is pegging the server - recursive queries. Each employee has the empl. id and supervisor id on their row. Easy parent child relationship. However one of the applications...
2013/07/23
[ "https://Stackoverflow.com/questions/17820460", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1766389/" ]
Data.getData() is not null when requesting a thumbnail. When recording a picture to any location it will always be null.
EDIT It's probably wrong but i did this to get uri after ACTION\_IMAGE\_CAPTURE and it works for me. ``` Bitmap picture = (Bitmap) data.getExtras().get("data"); ByteArrayOutputStream stream = new ByteArrayOutputStream(); picture.compress(Bitmap.CompressFormat.JPEG, 100, stream); Strin...
3,962,545
i've been imagining that in the base 16 the number 10 is A and 11 is B so in the base 37, 35 will be Z so how we can write 36 ?
2020/12/26
[ "https://math.stackexchange.com/questions/3962545", "https://math.stackexchange.com", "https://math.stackexchange.com/users/784946/" ]
You could use a different symbol. Or you could use commas to separate place values in this base. Something like $5,22,36$ could represent the three-digit base thirty-seven numeral whose value in decimal would be $5\cdot 37^2+22\cdot 37 +36$.
You can use underscore `_` as symbol nr 36 (as the last symbol in your alphabet). Then you can have nice looking test IDs, if you have unit tests or end-to-end tests, e.g.: ``` 123abczxy_for_widget_a 456uvwxyz_user_b23 456uvwxyz_user_b23_copy ``` So, your 37 symbols could be: `0...9abc...xyz_`.
32,633,920
I tend to use a lot of line breaks in my code like the following: ``` # Data ========================================================================= ``` Where the entire comment is always 80 characters long (including the hashtag). What I would like to do is write a code snippet for Rstudio that will insert the ha...
2015/09/17
[ "https://Stackoverflow.com/questions/32633920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4379461/" ]
You can't do this with snippets, unfortunately; a snippet is a text template that contains fixed text with slots for user-inserted text. There is a command built into RStudio to do something very similar, however; from the Code menu, choose Insert Section (or `Ctrl`+`Shift`+`R`). This will do exactly what you're desc...
Inspired by nick's answer above I designed two snippets that allow the user to choose what level section to insert. The first will fill-in the rest of the line with `#`, `=`, or `-`. ``` snippet end `r strrep(ifelse(substr("$$", 1, 1) %in% c("-", "="), substr("$$", 1, 1), "#"), 84 - rstudioapi::primary_selection(...
9,264
There is an [old question on Christianity.SE](https://christianity.stackexchange.com/questions/2038/why-are-thighs-important) which I suggested that it should also be asked here - since we don't migrate OLD questions. In doing so, I noticed that the OP hasn't been really active and I suspect that it will never be asked...
2014/05/22
[ "https://hermeneutics.stackexchange.com/questions/9264", "https://hermeneutics.stackexchange.com", "https://hermeneutics.stackexchange.com/users/444/" ]
Copied and pasted from <http://www.gotquestions.org/hand-under-thigh.html> > > The thigh was considered the source of posterity in the ancient world. > Or, more properly, the “loins” or the testicles. The phrase “under the > thigh” could be a euphemism for “on the loins.” There are two reasons > why someone would ...
The concept/s behind this focus on the male organ becomes moot when it is set amid the land they had come to occupy, Canaan, which was the epitome of matriarchy from before history. When fatherhood, the ultimate dubious concept, is confronted with its irrelevance it is emasculating. The crucial aspect is the circumcis...
39,985,917
Here's the link to the page I made: <https://thawing-savannah-89995.herokuapp.com/> This is my first webpage I've made without help using only a PSD. Here's a SS of the area I'm having issues with and keeps breaking when I shrink the browser size. This layout was very difficult for me to think through and I don't thin...
2016/10/11
[ "https://Stackoverflow.com/questions/39985917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5137592/" ]
How about set the `UserID` as index and then join on index for the second data frame? ``` pd.merge(df1, df2.set_index('UserID'), left_on='UserName', right_index=True) # Col1 UserName Col2 # 0 a 1 d # 1 b 2 e # 2 c 3 f ```
There is nothing really nice in it: it's meant to be keeping the columns as the larger cases like left right or outer joins would bring additional information with two columns. Don't try to overengineer your merge line, be explicit as you suggest Solution 1: ``` df2.columns = ['Col2', 'UserName'] pd.merge(df1, df2,o...
54,657,896
I have an input dict-of-string-to-list with possibly different lengths for the list. ``` d = {'b': [2,3], 'a': [1]} ``` when I do: `df = pd.DataFrame(data=d)`, i'm seeing **ValueError: arrays must all be same length** **Question**: How do i fill the missing values with default (e.g. 0) when creating the df? --- ...
2019/02/12
[ "https://Stackoverflow.com/questions/54657896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3380951/" ]
You can use [`DataFrame.from_dict`](https://pandas.pydata.org/pandas-docs/version/0.22/generated/pandas.DataFrame.from_dict.html) setting `orient` to `index` so the keys of the dictionary are used as indices and the missing values are set to `NaN`. Then simply fill `NaNs` using [`.fillna`](https://pandas.pydata.org/pan...
``` d = {'b': [2,3], 'a': [1]} df = pd.DataFrame({ k:pd.Series(v) for k, v in d.items() }) ``` This will give the following output. ``` a b 0 1.0 2 1 NaN 3 ```
73,254,705
I have several custom queries in an interface that extends JpaRepository. The interface is analogous to the below (note: the below is just for illustration, and may have errors, but don't concern yourself with that). ``` public interface MyRepo extends JpaRepository<SMark, String> { @Transactional @Modifying @Query(v...
2022/08/05
[ "https://Stackoverflow.com/questions/73254705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8796806/" ]
Use js. First, give your textarea an id attr: `<textarea id="text"></textarea>` then, ``` <script> let t = document.getElementById('text') function addShortcut(placeholder, emoji) { t.addEventListener('change', function(e){ if(t.value.includes(placeholder)) { t.value = t.value.split(placeholder).join(emo...
To change source of image I would recommend selecting your image using query selector and then simply replacing it to other image ``` <img class="example-image" src="./image.jpg" alt=""> <script> document.querySelector('.example-image').src = 'image-replace.jpg'; </script> ``` Have in mind that in ...
19,347,444
The following output is a result of calling `var_export($charge)`; How can I access the output of `'paid'=>true` from `$charge`? Any ideas would be appreciated. I have tried `$charge->_values->paid`, `$charge->paid`, etc.. I haven't had any luck. I have also tried `$charge['_values']['paid']`; ``` Stripe_Charge::_...
2013/10/13
[ "https://Stackoverflow.com/questions/19347444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2355051/" ]
you can use `__toArray()` method: ``` $array = $collection->__toArray(true); ``` This will work for this case
whatever returns please parse it with json\_decode and you will get a assoc array in php i.e suppose return array is $ret ``` $ret = json_decode($ret); $ret->paid; $ret->captured; $ret->card->id; and so on.. ``` Hope it will help you.
28,939,067
whenever, I mouseover on the 'li', then, that particular 'li' attribute need to changed to 'clsSect'. On the other hand, based on the list[li] selection, the div content has to set to 'display:block' other should changed to 'display:none'. if the first 'li' selected, then, the first 'div' need to be selected, likewise...
2015/03/09
[ "https://Stackoverflow.com/questions/28939067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4622995/" ]
on nest version 6 use ``` connextionString.DisableDirectStreaming(); ``` then on response.DebugInformation you can see all information.
Use `result.ConnectionStatus.Request`.
1,854,288
I can use `isset($var)` to check if the variable is not defined or null. (eg. checking if a session variable has been set before) But after setting a variable, how do I reset it to the default such that `isset($var)` returns `false`?
2009/12/06
[ "https://Stackoverflow.com/questions/1854288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41021/" ]
As nacmartin said, `unset` will "undefine" a variable. You could also set the variable to null, however this is how the two approaches differ: ``` $x = 3; $y = 4; isset($x); // true; isset($y); // true; $x = null; unset($y); isset($x); // false isset($y); // false echo $x; // null echo $y; // PHP Notice (y not...
Also, you can set the variable to `null`: ``` <?php $v= 'string'; var_dump(isset($v)); $v= null; var_dump(isset($v)); ?> ```
19,703,380
**PROBLEM ONLY APPEARS WHEN NO MAIL ACCOUNT IS CONFIGURED - STILL I WOULD APPRECIATE A SOLUTION** I need some help. I have found a very weird habit of this little Script. And I have absolutely no clue, why this should happen. If I run through the code posted below, **Microsoft Outlook** starts. And as long as I don't ...
2013/10/31
[ "https://Stackoverflow.com/questions/19703380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2541974/" ]
The issue here is that when you run `$wb.Worksheets.add()` it returns the new worksheet to the pipeline (this is why the Sheet properties are displayed when you kill Outlook). I believe the MailEnvelope property of the Worksheet is what causes Outlook to open (if you store the Sheet and return the MailEnvelope propert...
You might try running Excel in "safe mode": <http://social.msdn.microsoft.com/Forums/vstudio/en-US/79a8d280-3b80-4371-95e1-e7827472d36f/how-to-start-excel-in-safe-mode-programmatically?forum=vsto>
65,824
I was wondering if there are some particularly important mechanism by which one can break electronics, when undervolting it. Its pretty obvious that lots of electronics will not work properly if undervolted, but what about permanent damage? The question was motivated by repair work. I was wondering about what sorts of ...
2013/04/16
[ "https://electronics.stackexchange.com/questions/65824", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/22675/" ]
Wouter has some good information, but there are more scenarios where not providing a high enough voltage can damage a device. Some higher end display screens require multiple voltage sources, and failing to power one source to a high enough level, or fast enough, before a second source, can cause damage to the screen ...
It depends on your load. If it's a resistive load, lowering voltage means it will conduct less current and dissipate less heat. Nothing wrong here. If you drop the voltage on the gate/base of a transistor and it may not fully saturate and have a larger voltage drop. As power dissipation is P=U\*I; the voltage drop on...