INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
How to change the filename on uploaded file? I have a `ImageField()` where I have specified the `upload_to` path. And it works it saves to the `MEDIA_ROOT` url. However I want to change the uploaded file to some other filename. Should I do that from the forms.py or from the models.py, and also should I override the the save function to archive that? **forms.py** class UserAvatarForm(forms.ModelForm): class Meta: model = UserProfile fields = ('avatar',) def __init__(self, *args, **kwargs): super(UserAvatarForm, self).__init__(*args, **kwargs)
Customize it in `upload_to` of the `ImageField` avatar directly. Normally it looks like def upload_to(instance, filename): import os.path # get extension from raw filename fn, ext = os.path.splitext(filename) new_filename = ... # return new filename, including its parent directories (based on MEDIA_ROOT) return "path/{new_filename}{ext}".format(new_filename=new_filename, ext=ext) You could introduce new name at the `new_filename` line, depends on `instance` or `filename` or any other strings that makes sense. It's even possible to name the file by instance.pk
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "django" }
Square - Triangle - Geometry L is a point on the diagonal $AC$ of a square $ABCD$ such that $AL=3 \times LC$. $K$ is the midpoint of $AB$. What is the measure of angle $KLD$? I tried solving the problem as : $(AC)^2=(AB)^2)+((BC)^2$ -> by Pythagoras Theorem. $ \Rightarrow(AL)^2)=(9/4)(AK)^2$ ---> Equation 1 Also, $(AC)^2=(AD)^2+(DC)^2$ -> by Pythagoras Theorem. $ \Rightarrow(AL)^2=(9/8)(AD)^2$ ---> Equation 2 $\Rightarrow 2(AK)^2=(AD)^2$ From here, I am not able to solve the problem. ... Please advise.
Let $M$ be the feet of the altitude dropped from $L$ to $AB$. Then $AM=3MB$. Thus, $KM=MB$ and $\triangle KLB$ is isosceles. As $B$ is the reflection of $D$ wrt $AC$, $\angle DLA = \angle BLA$. Now it is easy to see that $$\angle KLD=\angle DLA+\angle ALK=\angle BLA+(\angle BKL-\angle KAL)=\angle BLA + \angle LBK-\angle BAL=(\angle BLA+\angle LBA)-\angle BAL=(180^{\circ}-\angle BAL)-\angle BAL=180^{\circ}-2 \cdot 45^{\circ}=90^{\circ}.$$
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "geometry, triangles" }
How do I image a 250GB hard drive featuring a Windows 7 install to a smaller 160GB hard drive The total installation on the 250GB hard drive (will be) much, much less than 160GB. I'm about to install Windows 7 to a 250GB 7.2k RPM because of the need to have a machine up and running today. In about a week, I will have to switch out this drive for a 160GB 10k RPM drive. How can I go about doing the install and then the image and make this is painless as possible?
If the content used on the 250 is small enough create an new empty partition on the 250 using perhaps 100gb.(102400MB) Do that in win7 by going to My Computer, right click select Manage>Disk Management. Select C: and right click, shrink partition the amount of MB to shrink can be 102400 This should then give you a small enough installed OS partition to transfer to the new 160. It is up to you and what you are comfortable with but I have used < < which clonezilla uses. < has some good tools as well. All free stuff and you can transfer this new smaller partition to the new drive.
stackexchange-superuser
{ "answer_score": 2, "question_score": 2, "tags": "windows 7, installation, images" }
Convert a currency string to a number Drupal Views / PHP I am feeding a field from a CiviCRM (MySQL) database into a Drupal View of a currency: € 350.00 **How can I get this currency / string into number format to perform maths on it?** I've tried * removing that field from the display and feeding it into a Global Maths Field in order to "clean" it but it just shows up as zero (it is a string so the Maths Field cannot read it) * feeding it into a Global Text Field results in the same output as above * turning off all formatting in the field itself and in the Global Maths Field I was feeding it into, which outputs zero because it still is not recognized as a number
You need 2 steps: 1. Install Views PHP (7.x-2.x-dev) - that will give you a Global PHP field in Views 2. Exclude the original field (say `field_currency`) which is holding the value from display in Views (using tickbox), and then use the value of the excluded field in additional PHP field: * In Value code: `preg_match("#([0-9\.]+)#", $row->field_currency, $match); return $match[0];` * In Output code: `<?php echo $value; ?>`
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, drupal, drupal 7, view, drupal views" }
Problem with a proof of a statement about the arithmetic root of a rational number Let $x$, $y$, $n$ be natural numbers and $(x,y)=1$ (the greatest common divisor of $x,y$ is 1). I wish to prove that if $\sqrt[n]\frac{x}{y}$ is a rational number then there are natural numbers $p$, $q$ such that $x=p^n$ and $y=q^n$. My attempt. If $\sqrt[n]\frac{x}{y}=\frac{a}{b}$ and $(a,b)=1$ then $\frac{x}{y}=\frac{a^n}{b^n}$ and next $xb^n=ya^n$. Hence $x|xb^n=ya^n$ but $(x,y)=1$. Therefore $x|a^n$. Similarly $y|b^n$, $b|y$, $a|x$. I don't know how to obtain that $x$ and $y$ are $n$-th powers of natural numbers.
You missed just one little step. As you said $x\mid a^n$ and $y\mid b^n$. Now, $a^n\mid xb^n$ and since $(a,b)=1$, we have that $(a^n,b^n)=1$ and thus $a^n\mid x$. So $a^n\mid x \mid a^n$ implies $x=\pm a^n$. Same for $y$.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "arithmetic" }
First time audio playing getting slow my Sprite Kit game? I'm new with Sprite Kit, I have a short sound effect to play in a function. I have tried AVFoundation and SKAudioNode like below in that function. But I discovered It triggers some stuck for my SKActions. How Can I solve this playing problem. It looks waiting for completion or something different? let audioNode = SKAudioNode(fileNamed: "catch") audioNode.autoplayLooped = false self.addChild(audioNode) let playAction = SKAction.play() audioNode.run(playAction)
There is another action for playing sound file, you can use `SKAction.playSoundFileNamed("catch", waitForCompletion: false)` instead of `SKAction.play()`. There is a complete explanation of what _waitForCompletion_ is doing in Apple Documentation
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "ios, swift, audio, sprite kit" }
In PostgreSQL how do you join two tables select separate information Having trouble with joins. I have a table called `subjects` subno subname 30006 Math 31445 Science 31567 Business I also have a another table called `enrollment` subno sno 30009 980008 4134 988880 etc.. how to list subject numbers and subject names for student 9800007 ?
Try this select * from subjects s left join enrollment e on s.subno = e.subno where sno=9800007
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "sql, postgresql, join" }
How to get specific keys from object? (JS) I have this object: 728394 : { "playersAmount" : 2, "players" : { "LRFe9w9MQ6hf1urjAAAB" : { "nickname" : "spieler1", "type" : "player1" }, "nKUDWEd5p_FCBO4sAAAD" : { "nickname" : "spieler2", "type" : "player2" }, "ghdaWSWUdg27sf4sAAAC" : { "nickname" : "spieler3", "type" : "spectator" } }, "activePlayer" : "LRFe9w9MQ6hf1urjAAAB", "board" : [ [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0] ] } How do I get everything of the object above except for the k/v pair "board"? is there any other way than just adding every key except the right one?
You can create a copy and then delete the unwanted key: const copy = { ...original } delete copy.unwantedProperty Of course you can instead delete the property on the original if you don't care about mutating it. (Note: if your environment doesn't support the syntax `{ ...original }`, you can use `Object.assign({}, original)` instead.) EDIT: Actually, this answer is even neater.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "javascript, json, object" }
Make imported steam folder work with new win10 my old pc had win7 and I had a Steam folder with my games inside. I moved the disk drive to the new pc with win10, but now the steam folder is read-only. If I uncheck the atribute, a progress bar appears, does some stuff with the steam folder, I click ok when it's done, but if I close and reopen the property panel, the read-only flag is back. I want that win10 owns the steam folder like I created within the new system. How do I do that? How do I tell win 10 process the permissions in a way everything works later? Here some screenshots: ![property panel]( ![permissions]( Someone can help me fix the permissions? EDIT: this is what doesn't work: ![enter image description here](
After telling windows to own the folder (even if the screenshot shows that the admin already owned the folder) I was able to use the folder like I wanted. I don't exactly know what was wrong, but imposing the ownership fixed the issue, it seems.
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "windows 10, permissions, steam" }
Create a list with string + range I need your help: I want to create a list looking like this `['Unnamed: 16', 'Unnamed: 17', 'Unnamed:18']` for a range (16,60). How can I proceed? I don't know if my question is clear but it's like doing `list(range(16, 60)` but with a string before each numbers. Thank you very much for your help!!
You can use f-strings to do so : my_list = [f"Unnamed: {i}" for i in range(16, 60)] # Output ['Unnamed: 16', 'Unnamed: 17', 'Unnamed: 18', 'Unnamed: 19', ...]
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -2, "tags": "python, list, range" }
Prove that $f$ doesn't depend on the variable $x_i$ everybody! Problem: "A set $X \subset R^n$ is said to be i-convex when, for every $a,b \in X$, such that $b=a+te_i$, we have $[a,b] \subset X$. Prove that if the open set $U \subset R^n$ is i-convex and the function $f: U \rightarrow R$ has $\frac{\partial f}{\partial x_i}(x)=0$, for all $x \in U$, then $f$ doesn't depend on the variable $x_i$, i.e., $x,x+te_i \in U \Rightarrow f(x+te_i)=f(x)$". My doubt is the following: $\frac{\partial f}{\partial x_i}(x)= lim_{t \rightarrow 0} \frac{f(x+te_i)-f(x)}{t} \Rightarrow lim_{t \rightarrow 0} f(x+te_i)-f(x)= lim_{t \rightarrow o}t. \frac{\partial f(x)}{\partial x_i}=0$. It doesn't follow that $f(x+te_i)-f(x)=o$, for all $x, x+te_i \in U$.
Define $g(s):=f(x+s e_i)$. Then $g$ is differentiable in (a neighbourhood of) $[0,t]$ and $g'(s)=\lim_{h\to0}\frac{g(s+h)-g(s)}{h}=\lim_{h\to0}\frac{f(x+se_i+he_i)-f(x+se_i)}{h}=\frac{\partial f}{\partial x_i}(x+se_i)=0$, since $x+se_i\in U$ for each $s\in[0,t]$ (since $U$ is $i$-convex). Thus, $g$ is constant; in paticular, $g(0)=g(t)$, which is equivalent to $f(x)=f(x+te_i)$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "real analysis" }
_bstr_t concatenate gives 12142 I have a strange thing here. I'm concatenating `_bstr_t` strings in order to assemble a SQL command. _bstr_t strSQL = a+b+k+hk+Allin+hk+k+hk ...and so on. When I print it to the console (using `std::wcout << '/n'<< strSQL << '/n';`) I get my string, BUT with a 12142 in the beginning and end of the string. It looks like: 12142"SELECT * FROM....."12142 Does anyone know where it comes from? I'm using: VS2010 Express, C++, and I'm building a console app.
You wrote '/n' instead of '\n'. This is a multicharacter literal, which in this case gives an integer with the value 12142.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 1, "tags": "c++, sql, string concatenation" }
When does Chrome autofill in a web page render? I have a customer who wanted their UI to display field names in a form (username field says "username", password field says "password", etc.). Since the form uses a password type `<input>` (which normally displays dots), I had to mock filling data into the fields by overlaying them with divs that contained the verbiage. To recognize autofill, I wrote some Javascript that checks to see if the field is filled and acts accordingly (either hiding or showing the verbiage). As far as I can tell, Chrome is the only browser that goes wonky. It doesn't seem to care if there's autofill data or not, and the verbiage always overlays the autofill data (ostensibly because the `hide` functionality isn't being triggered). My long-winded question is When does Chrome autofill data in the rendering process? Does it wait until Javascript has finished as well? Is there any way for me to check if autofill data is occupying a field in Chrome?
I decided to attach a listener to an event that activated the modal that contained the forms. Needless to say, this is a solution that would only work in my particular circumstances. I don't consider this an answer, but I'm posting it here to possibly give others looking for a solution a workaround.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 4, "tags": "javascript, forms, google chrome, autofill" }
Postgres earth ERROR: value for domain earth violates check constraint "on_surface" error on creating index PostgreSQL earth CREATE INDEX "branch_location" ON "systems_branch" USING gist (ll_to_earth("latitude", "longitude")) I got this error message in console ERROR: value for domain earth violates check constraint "on_surface" CONTEXT: SQL function "ll_to_earth" statement 1
latitude and longitude must not empty in all rows
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "postgresql, geo" }
Python: Get data from URL query string So I have a string in which I have an URL. The URL/string is something like this: ` I want to get the `code` but I coulnd't figure out how. I looked at the `.split()` method. But I do not think it is efficient. and I couldn't really find a way to get it working.
Use urlparse and parse_qs from urlparse module: from urlparse import urlparse, parse_qs # For Python 3: # from urllib.parse import urlparse, parse_qs url = ' url += '/?code=32ll48hma6ldfm01bpki&data=57600&data2=aardappels' parsed = urlparse(url) code = parse_qs(parsed.query).get('code')[0] It does exactly what you want.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": -1, "tags": "python, string, python 2.7, url" }
Replace every color except a specific one in Imagemagick Let's say I have a PNG image with some random colors in it, like this one: ![Like this one.]( The goal is to make every color in the image EXCEPT a specific color (like #FCFF00) with pure black (#000000). So for example, if I gave the code the above image, it would replace it with this: ![It would replace it with this?]( How would I do this?
This would be the `+opaque` option. convert YiCYA.png -fill black +opaque '#FC00FF' output.png ![output.png](
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "imagemagick" }
How and why do the characters speak Japanese? In Ente Isla they have their own language, and I don't think the people there (especially the ones living on the land) know anything about Japan or Earth. So how could Emilia, her father and that one guy carrying that cart (in the flashback) speak fluent Japanese? And if they actually know Japanese, why don't they speak it all the time?
The people from Ente Isla do not speak Japanese. They are simply shown speaking Japanese for the convenience of the audience during the flashback. The moments where they are shown speaking their own language instead of Japanese are when they are chanting spells, which might not be able to be cast in other languages, or when it is necessary to remind the viewers that they come from a different world. When Maou and Alciel had just arrived in Japan, they did not know the language, so it is important to demonstrate the language barrier to the audience. During Emi's flashback, all the parties involved spoke the same language, so there was no need at all to show a language barrier, instead it is easier to make the whole scene in the audience's language.
stackexchange-anime
{ "answer_score": 3, "question_score": 5, "tags": "the devil is a part timer" }
Add all of the key values in a nested Dictionary I am trying to write a function that add all of the the inner key and value pairs of a nested dictionary. This is what I would pass in Pets = {'family1':{'dogs':2,'cats':3,'fish':1}, 'family2':{'dogs':3,'cats':2}} This is what I would expect as the result {'dogs': 5, 'cats': 5, 'fish': 1} This is the loop I have written so far def addDict(d): d2 = {} for outKey, inKey in d.items(): for inVal in inKey: print(inVal, " ", inKey[inVal]) d2[inVal] = inKey[inVal] return d2 This prints dogs 2 cats 3 fish 1 dogs 3 cats 2 and returns {'dogs': 3, 'cats': 2, 'fish': 1} But how can I get the data to be cumulative, because it is just giving me the data from the first dictionary.
You can do something like this, Pets={'family1': {'cats': 3, 'dogs': 2, 'fish': 1}, 'family2': {'cats': 2, 'dogs': 3}} d={} for i in Pets: for j in Pets[i]: if j in d: d[j] += Pets[i][j] else: d[j] = Pets[i][j] print d >> Output {'cats': 5, 'dogs': 5, 'fish': 1}
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "python, dictionary, nested" }
Put bit int value into bitarray How do you input an int value into a bitarray without it interpreting such as decimal, so that for example: intvalue = 101 keeps the same digits even after conversion? strvalue = bitstring.BitArray(intvalue) strvalue == 101
prefix it with `0b` (just as you can prefix a hexadecimal integer with `0x`): print(0b101) # 5 that is how you can input an integer in binary form (independent of `bitarray`). see e.g. PEP-3127.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, bitstring" }
How to uncheck a checkbox before disabling it? <coral-checkbox name="chk1" id="p_chk1" class="coral-Form-field" onclick="document.getElementById('p_chk2').disabled=this.checked;"> Checkbox1 </coral-checkbox> <coral-checkbox name="chk2" id="p_chk2" class="coral-Form-field" disabled> Checkbox2 </coral-checkbox> The above enables chk2 only when chk1 is checked (works fine). Now, if both chk1 and chk2 are checked, and later, on unchecking chk1, though chk2 is disabled, it still remains checked and that messes up the further logic since it evaluates to checked instead of unchecked. I tried using removeAttr('checked') but that has not helped. Greatly appreciate any suggestions!
Assign the `checked` property. <coral-checkbox name="chk1" id="p_chk1" class="coral-Form-field" onclick="document.getElementById('p_chk2').disabled=this.checked; if(this.checked) document.getElementById('p_chk2').checked = false"> Checkbox1 </coral-checkbox> <coral-checkbox name="chk2" id="p_chk2" class="coral-Form-field" disabled> Checkbox2 </coral-checkbox> BTW, I recommend moving the code out to a function, rather than using long inline-JavaScript.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, html, jquery" }
Push notifications suddenly stopped working in production My company's app is already in the app store. The push notifications were working fine but suddenly it stopped working. I am new to the company, they told me to fix the issue. I went to their apple account portal. The production SSL certificate for push notification is not expired. But the distribution provisioning profile was inactive. I made it active by using edit button. But is there anything to do with the inactive distribution profile? I am wondering I have to release again? Please help me fixing the push notification issue. Please note the push notifications were working already.
Once i faced the same issue and i created new certificate, profile & .pem file and give update to Appstore my app was updated on store but notification was not working in some devices. Then from my superior i came to know that i have to create only new .pem file and replaced old .pem file by new one. So you have don't need to update app just update .pem file only and replace by old .pem file.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ios, push notification, apple push notifications, provisioning profile" }
Newline and single double quotes in #define I'm trying to make a program (just for fun) that requires something like this: #define TEST "HELLO #define TEST2 WORLD\n" ... printf(TEST TEST2); ... and I want the output to be `HELLO WORLD` however that code does not work. Is there any way to include newlines and double quotes like this in C?
Arranging the macros using `\"` to _escape_ the quotation gives you #include <stdio.h> #define TEST "\"HELLO " #define TEST2 "WORLD\"\n" int main(void) { printf(TEST TEST2); } and yields the output `"HELLO WORLD"`
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "c, gcc, c preprocessor" }
Using fb.api calls with jquery deferred I just cannot get my head around deferred objects dfd = new $.Deferred(); FB.api('/me/posts?fields=id,story&access_token='+accessToken,function(response){ dfd.resolve(); //Do something with the result }); dfd.done(alert(dfd.isDeferred())); From my understanding the `.done` should only fire once the request is completed and the callback sets the object as resolved, however the alert box is firing false before the request completes. What am I missing?
Try changing the last line of code to : dfd.done(function(){ alert(dfd.isDeferred()); }); This is how the use of the `done()` function is documented in the jQuery API
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 5, "tags": "jquery, facebook, facebook graph api" }
Removing the numbering in text lines in R I have been given an output in R, and I wish to copy and paste the output into other Microsoft applications. However, each line is numbered. How do I remove the numbers? For example: library(stringr) str_extract_all(x, "“.*?”") %>% .[[1]] [1] "Gene validation and remodelling using proteogenomics of Phytophthora cinnamomi, the causal agent of Dieback." [2] "Cultivation Area Affects the Presence of Fungal Communities and Secondary Metabolites in Italian Durum Wheat Grains." [3] "Genetic analysis of wheat sensitivity to the ToxB fungal effector from Pyrenophora tritici-repentis, the causal agent of tan spot" [4] "When time really is money: in situ quantification of the strobilurin resistance mutation G143A in the wheat pathogen Blumeria graminis f. sp. tritici."
You can use `cat` to copy the output from R console : library(stringr) str_extract_all(x, "“.*?”") %>% .[[1]] %>% paste0(collapse = '\n') %>% cat This will print the output without numbers and would be easy to copy.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "r, text, extract" }
Best way to restructure nested if statements I have the following code: const config = { key1: { outlier: 'outlier1' }, key2: { test: 'test' }, key3: { outlier: 'outlier3' } } const finalArr = []; Object.keys(config).forEach((key) => { const obj = config[key]; // How to make this if/if/else structure cleaner? if (obj.outlier) { if (doSomeWithOutlier(obj.outlier)) { finalArr.push(obj); } }else { finalArr.push(obj); } }); Is there a cleaner way to do the above following? It seems like I am nesting the if/if stamenets and else statements to much and duplicating finalArr.push(obj) code.
You could use: if ((obj.outlier && doSomeWithOutlier(obj.outlier)) || !obj.outlier) { finalArr.push(obj); } However, I think your structure is easier to read. You can also loop over `Object.values(config)` rather than the keys, so you don't need the extra step of `const obj = config[key];`.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript" }
css div background become more to left I have this css class #asdfasdful li .deleteFood{ background-image: url( background-repeat: no-repeat; position: relative; float: right; right: 10px; width: 40px; height: 20px; margin-top: 5px; }
You'll need to add {clear: right;} on each row, or maybe adjust line-height to a larger value. Try this: #yourOrderFoodsItems ul li .deleteFood { clear: right; }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "jquery, html, css" }
Given an equation with trigonometric roots $\tan a$ and $\cot a$, determine $\sin a + \cos a$. **Question** : Given that $\tan a$ and $\cot a$ are two real roots of the equation $x^2 + k^2 - kx - 3 = 0$, and $3\pi < a < \frac{7\pi}{2}$, find the value of $\sin a + \cos a$. My solution can be found below in the answers section.
**My solution:** First realize that the range for $a$ can be simplified to $\pi < a < \frac{3\pi}{2}$. Since $\tan a$ and $\cot a$ have a product of $1$, using Vieta's formula, $k^2 - 3 = 1 \Longrightarrow k = \pm 2$. So, either $x^2 + 2x + 1 = 0$ or $x^2 - 2x + 1 = 0$. Hence, $x = \pm 1$. So, using the fact that $\tan a$ and $\cot a$ have a product of $1$, either $\tan a = \cot a = 1$ or $\tan a = \cot a = -1$. If $\tan a = \cot a = 1$ $\Longrightarrow \sin a = \cos a.$ This would make $a = \frac{\pi}{4}$. However, this does not fit within the range for $a$. So, $\tan a = \cot a = -1 \Longrightarrow \sin a = -\cos a.$ This would make $a = \frac{5\pi}{4}$. This fits within the range for $a$. However, we must read the problem carefully as it asks for the value of $\sin a + \cos a$ and not just the value of $a$ itself. So, the answer is $-\frac{\sqrt{2}}{2} + -\frac{\sqrt{2}}{2} = \boxed{-\sqrt{2}}$
stackexchange-math
{ "answer_score": 4, "question_score": 3, "tags": "algebra precalculus, trigonometry, roots" }
How could I test C++ compilation on Windows using a Mac OS? I'm easily able to check how C++ code compiles on Mac OS and Linux. However, it's always a guessing game with Windows, as I don't have any Windows OS nearby. Are there options for developers to check compilation on a Windows command line? I was going to use Docker, but it appears extremely complicated, given my OS is Mac: <
Just use a Mac-based virtual machine. Parallels or VMWare Fusion are perfectly capable of running any Windows, Mac or nix OS. VMWare have recently released a free [for personal use] version of Fusion - see < You need to sign up.
stackexchange-superuser
{ "answer_score": 1, "question_score": 0, "tags": "windows, mac, c++" }
UIImageView follow circular path in Single View Application, how? I'm working on a single view application, not SpriteKit, in Swift, and I have a UIImageView called obstacle, that I want to follow a circular path (assume the circle diameter is 100). How can this be done? Can anyone help me? I've seen lots of answers but they're all for people using SpriteKit, and other ones that I have found are in Objective-C and I can't find certain methods in Swift that they're referencing... Thanks!
Try out following code let curvedPath = CGPathCreateMutable() let circleContainer = CGRectMake(100, 100, 200, 200) // change according to your needs CGPathAddEllipseInRect(curvedPath, nil, circleContainer) let animation = CAKeyframeAnimation(keyPath: "position") animation.path = curvedPath animation.rotationMode = kCAAnimationRotateAuto animation.repeatCount = Float.infinity animation.duration = 5.0 obstacle.layer.addAnimation(animation, forKey: "animate position along path")
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "ios, swift, path, geometry" }
Prove $a^{1/k}+b^{1/k}\gt (a+b)^{1/k}$ Prove the statement(#): (#) Suppose $k$ is an integer greater than $1$. Suppose $a,b$ are positive real numbers. Then $a^{1/k}+b^{1/k}\gt (a+b)^{1/k}$. How should I start the proof? Any inequalities I can apply? Which topic is related to this proof? Plz give me some hints:( Thanks.
Firstly whenever proving any sort of algebraic (in)equality I would try to isolate a useful property to simplify the equation. In this case, $$ (a^{\frac{1}{k}}+b^{\frac{1}{k}})^{k} > [(a+b)^{\frac{1}{k}}]^{k} \\\ (a^{\frac{1}{k}}+b^{\frac{1}{k}})^{k} > a+b $$ as both sides have an exponent $1/k$. Secondly, I would try to identify any useful properties that I know something about. So in this case, $(p+q)^{k}$ is a very common binomial form. Then from this point onwards the proof is pretty straightforward. I would recommend always starting with this sort of approach. Sometimes you'll get stuck because novel ideas are required but it'll at least help you get started with most proofs of this form.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "proof writing" }
How to store varbinary in MySQL? Just a quick question.. Out of two options mentioned below, how to store to `varbinary` column in MySQL? public_key = '67498930589635764678356756719' or public_key = 67498930589635764678356756719 Will the second method work? I am into an emergency moment working on a production server and didn't want to experiment on it. Thank you for any help.
Printable data can be inserted using quotes. Non-printable data can be inserted using hexadecimal values. I.e.: INSERT INTO Table(VarBinaryColumn) VALUES('Printable data') -- Will be stored as binary representation using the charset of the operating system INSERT INTO Table(VarBinaryColumn) VALUES(0x12345) -- Non-printable binary data
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 8, "tags": "mysql, types, varbinary" }
How do I make Ghidra propagate modified functon signatures to other programs in that project? I have imported several programs to my Ghidra project and retyped a few function parameters in one of them. Now I am working on a different program, which imports these functions. However, the imported functions still have their original, unmodified signatures. How do I tell Ghidra to propagate the changes?
One way that should work is using the "Capture Function Prototypes" context menu action on the Project Datatype Archive while in the binary that defines those functions, then applying them in the binary that imports them.
stackexchange-reverseengineering
{ "answer_score": 0, "question_score": 0, "tags": "ghidra" }
Custom Landing Page Once Logged in salesforce I wish to create different **custom landing pages** for users based on their profile, after successful login through SalesForce. Is it possible to create? Provide your thoughts.
We can do this with Apps and Profiles in Salesforce. 1. Associate the custom Landing page(VF Page) to a Visualforce Tab (Create --> Tab --> New VF Tab) 2. Create an App and associate required Tabs to newly created App. (Create --> Apps) 3. Set the Default Landing page in the App settings. 4. Now go to Profiles (Manage User --> Profiles --> Custom App Settings) 5. Set the newly created app as default App. 6. Assign required users to the Profile. Now, when users logs into Salesforce, they would be taken to default App, which is associated to VF page. Hope this helps.
stackexchange-salesforce
{ "answer_score": 9, "question_score": 5, "tags": "oauth, oauth2" }
How to Restrict Content OVerview to certain content types for user roles I have a user role called Athletics and I have given these users access to add, edit or delete the content type Athletes. However when the content type is created it just creates a node not a URL alias so the Athletics users can not navigate to a page to edit or delete. I tried giving access to the content overview but I think that would confuse my non-technical users. Is there a way to make it so they can ONLY see the content they can edit or delete within the content overview?
Administration Views will replace the admin listing pages with views, and then you can tweak it. But looking at your question in the greater context what you really need is Contextual Admnistration. With it you can create a admin UI for your athletics role to manage content. There is a video tutorial series on Youtube.
stackexchange-drupal
{ "answer_score": 0, "question_score": 0, "tags": "nodes" }
Elm get raw JSON string I'm trying to build a very simple app that will just output the raw JSON object from an api. So I want a function that will take a url parameter and ideally return the JSON string. I have the following code: decode: String -> String decode jsonString = Decode.decodeString jsonString apiResonse : String -> String apiResonse url = let url = " request = Http.get Decode.decodeString url in Http.send NewRequest request But I'm struggling to understand the decoder part of the function. If anyone could help me that would be great.
If you just want to get the HTTP response as a string value, use `Http.getString`. The example you posted using `Http.get` assumes the result is in JSON and forces you to decode it to an Elm value. Here is a modified example of the random cat generator code which just displays a dump of the response JSON instead of a cat picture: getRandomGif : String -> Cmd Msg getRandomGif topic = let url = " ++ topic in Http.send NewGif (Http.getString url) Here is a working example on ellie-app.com
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 3, "tags": "elm" }
Cordova CLI:an error while adding Android I am facing a problem in cordova version I want to install cordova version 3.5 but it install the latest version and I got problems in it and the problem is it cant run android platform can anybody please tell me about how to download specific version of cordova. Thanks.
To answer your question, you can download a specific version with `npm install [email protected]` which installs cordova 3.5 for you. When you call `npm info cordova` you can see all the valid versions (because there are more 3.5 versions). This being said, you might want create a new question with the actual error you are having because staying on an older version might not be the best thing.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "cordova" }
Prevent default behavior of AuditingEntityListener in specific cases I use AuditingEntityListener and annotations @ _CreatedDate_ and @ _LastModifiedDate_ to manage creation/modification dates: //... import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; //... @Column(name = "creation_time", nullable = false) @CreatedDate private LocalDateTime creationDate; @Column(name = "modification_time", nullable = false) @LastModifiedDate private LocalDateTime modificationDate; However, sometimes I want to be able to modify this entity without creationDate and modificationDate fields being modified as well. Is there a way to implement this?
Just use correspond column properties: @Column(name = "creation_time", nullable = false, updatable = false) @CreatedDate private LocalDateTime creationDate; @Column(name = "modification_time", nullable = false, insertable = false) @LastModifiedDate private LocalDateTime modificationDate; I think your issue was not with `AuditingEntityListener`. * * * If you interesting manage in your own way `modificationDate` you should not use `@LastModifiedDate` annotation near `modificationDate` field and implement your special rules for simple field: @Column(name = "modification_time", nullable = false) private LocalDateTime modificationDate;
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "java, spring, hibernate, jpa, spring data" }
how to make my desktop application to web app application in java I have designed a GUI connect to DB button using Swing in java now i want to make it webapp application I need to host it on my website. Do i need to replace all my coding as swing is only for desktop application. Or is there any other way?
It will partly depend on how well you've structured your application. If there's no layering involved - if the GUI classes connect directly to the database, for example, then yes, you'll need to rewrite the whole thing. If, however, you already have a separate data access layer, business logic layer and presentation layer, then you may only need to completely rewrite the presentation layer - while checking the other layers for things like concurrency safety. The stateless nature of web applications - aside from session-based state - may mean you need to redesign the application significantly, of course. This may in turn mean that your existing "backend" layers aren't quite appropriate. While the _theory_ is that they'd be presentation-layer-neutral, in my experience it would be quite unusual to manage to write an app targeting a single UI technology without some of the usage assumptions leaking through into underlying layers.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "java" }
Rows to one column i have sql query: DECLARE @StartDate DATETIME, @EndDate DATETIME; SELECT @StartDate = DATEADD(yy, DATEDIFF(yy, 0, GETDATE()), 0) ,@EndDate = getdate(); SELECT LEFT(CONVERT(varchar, DATEADD(MM, DATEDIFF(MM, 0, DATEADD(MONTH, x.number, @StartDate)), 0),112),6) AS MonthName --LEFT(CONVERT(varchar, DATEADD(MONTH, x.number, @StartDate)), 0),112),6) FROM master.dbo.spt_values x WHERE x.type = 'P' AND x.number <= DATEDIFF(MONTH, @StartDate, @EndDate)` i need to do it in this format: 201901, 201902 Thanks
For the older version of SQL Server, you can try like following. DECLARE @StartDate DATETIME, @EndDate DATETIME; SELECT @StartDate = DATEADD(yy, DATEDIFF(yy, 0, GETDATE()), 0) ,@EndDate = getdate(); ;with cte as ( SELECT LEFT(CONVERT(varchar, DATEADD(MM, DATEDIFF(MM, 0, DATEADD(MONTH, x.number, @StartDate)), 0),112),6) AS MonthName FROM master.dbo.spt_values x WHERE x.type = 'P' AND x.number <= DATEDIFF(MONTH, @StartDate, @EndDate) ) SELECT DISTINCT STUFF (( SELECT ', ' + [MonthName] FROM cte ORDER BY [MonthName] FOR XML PATH('') ),1,2,'' ) AS [MonthName] For SQL Server 2017+, you can use `STRING_AGG` like following. select STRING_AGG (MonthName, ',') as MonthName FROM CTE
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "sql, sql server" }
Ways to handle dynamic public IP address for AWS EC2? Recently I have successfully set up a Windows server SFTP server. I noticed that whenever I shut down my EC2 instance and re-run it, the public IP address will change. This is an issue for me as I key in the public IP address in my hardware settings and I do not wish to update the IP address every time the EC2 instance restart; especially when some of my hardware are miles away from my location! What kind of approach should I take to tackle this issue? I remember that dynamic DNS will resolve dynamic public IP address, will it work in this case?
All you need to do is to attach a Elastic IP Address to your instance. By attaching this to your instance, whenever the instance stops or restarts the public IP address associated with the instance will remain. > An Elastic IP address is a static, public IPv4 address designed for dynamic cloud computing. You can associate an Elastic IP address with any instance or network interface for any VPC in your account.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 1, "tags": "amazon web services, amazon ec2" }
What video players/sites are fully accessible? I am in need of a video player that is fully accessible, but I'm hoping not to have to code it from scratch. How accessible are the youtube/vimeo players? are there other ones pre-made online that will work well in that respect? Basically I'm looking for something that is keyboard accessible and can support some kind of closed captioning I hope this is appropriate to this site, if not please let me know. I have been looking around and not finding a lot of good info on this
What do you mean by "fully accessible"? That it complies with WCAG / Section 508 / WAI-ARIA? Or that it's actually fully accessible to everyone? Or that it has basic accessibility features? Which specific features do you require? Because if you're just looking for a player that is Section 508 compliant, then this business.gov page shows you how to embed one. So as long as the video has closed captioning, it's 508 compliant. There's also Easy YouTube. But I think this was created before YouTube became 508 compliant. **Edit:** According to this page, the Vimeo player is also 508 compliant, so either player should work.
stackexchange-ux
{ "answer_score": 0, "question_score": 0, "tags": "web app, accessibility" }
problem with types of create react native apps Hello I'm very beginner to react-native. I have a problem There are 2 ways to create react-native apps (Please check those examples from those image links) first way is I got this method on documentation of react-native second way is this method is got from a you tube video my problem is **Are those methods are same or what is the different between of those 2 ways.** Thank you very much your reply.
first way is functional component and second one is class component. please check below links for explanations. what is the different between class component and function component - React Native or google it like " **difference between functional component and class component** "
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "react native" }
ElasticSearch - specifying an exact port (no port range) I want to specify an exact port for ElasticSearch to use for HTTP traffic. How can I do so? In the config file, it says it listens to a port range by default. How can I restrict this port range to just 1 port? Elasticsearch, by default, binds itself to the 0.0.0.0 address, and listens on port [9200-9300] for HTTP traffic and on port [9300-9400] for node-to-node communication. (the range means that if the port is busy, it will automatically try the next port).
In config folder.. There is an file called "elasticsearch.Yml". In that Parameters for port are commented.. Just remove hash before http.port and add port value to it.. http.port : 5000 You can do this for both tcp and http
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "elasticsearch" }
The pushout of an epimorphism is an epimorphism I'm reading the book "Handbook of Categorical Algebra: Volume 1, Basic Category Theory" by Francis Borceux, and in page 52 he states that > "..."the pullback of a monomorphism is a monomorphism". The dual notion of a "pullback" is that of a "pushout". In particular, "the pushout of an epimorphism is an epimorphism"..." how can I show this last statement directly?
So suppose $$\begin{array} AA & \stackrel{g}{\longrightarrow} & C \\\ \downarrow{f} & & \downarrow{\beta} \\\ B & \stackrel{\alpha}{\longrightarrow} & D \end{array}$$ is a pushout and $f$ is epi. We will show that $\beta$ is epi. Suppose, $h_1, h_2 \colon D \to D'$ are such that $h_1 \beta = h_2 \beta$. We have $$ h_1\alpha f = h_1 \beta g = h_2\beta g = h_2 \alpha f $$ As $f$ is epi, we have $h_1 \alpha = h_2 \alpha$. Now, as we have a pushout, there is a unique(!) $h \colon D \to D'$ such that $h\alpha = h_1\alpha = h_2\alpha$ and $h\beta = h_1 \beta = h_2 \beta$. As $h_1$ and $h_2$ both have this property, $h_1 = h_2$ and $\beta$ is epi.
stackexchange-math
{ "answer_score": 8, "question_score": 4, "tags": "abstract algebra, category theory, epimorphisms" }
Does ASP.NET web API support IValidatableObject? I have a view model that implements IValidatableObject and also has several validation attributes. When I attempt to call an action on my ApiController, only the attribute validation is performed. Does ASP.NET Web API not support IValidatableObject? What's the alternative for complex validation that cannot be represented by a single attribute? **Edit:** Somewhere along the line, I must have fudged something up. The validation mysteriously started working as expected. Looks like IValidatableObject is definitely supported by default.
Not yet tried IValidatableObject on webapi, but it should be supported according to the documentation the Validation provider for DataAnnotations (DataAnnotationsModelValidatorProvider) provide also IValidatableObject validation. See here: Anyway, you can use also Object level ValidationAttribute that you can use to decorated a class...It is not so easy as IValidatableObject, but should work.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 5, "tags": "validation, asp.net web api, data annotations, ivalidatableobject" }
how to write sql query? ## Table : promocode customerid promocode ------------------------ 1 123a-234b 2 123a 3 123a-234b-345c 4 23s-34f I want result as Promocode -------------- 123a,234b 123a 123a,234b,345c 23s,34f plz help me ........
You can use REPLACE to change the hyphen character to a comma: SELECT REPLACE(t.promocode, '-', ',') FROM PROMOCODE t If you want to write this change to the table: UPDATE PROMOCODE SET promocode = REPLACE(t.promocode, '-', ',') If there's no hyphen, nothing is updated. Reference: * REPLACE
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "sql, sql server, tsql, sql server 2008" }
What is the recommended way to include a global module with Webpack? I'm working on a large application using Webpack that includes a global `settings.js` file that all other modules need access to. Rather than add an `import settings from '../path/to/settings';` to the top of all modules, I'm hoping there is a more succinct way to make it available to all modules by default. Suggestions for adding a module globally available to all others?
Discovered I was already doing this with `webpack.ProvidePlugin`. Extended it to include my settings file: module.exports = { resolve: { modulesDirectories: [ 'src', 'node_modules' ], extensions: ['', '.json', '.js'] }, plugins: [ new webpack.ProvidePlugin({ settings: 'settings' }) ] }; My `settings.js` file is inside of `src`, which is already being accesed via the `resolve` Webpack config item.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "javascript, webpack" }
Installing windows service I have a windows service (.exe) file. How to install it as a service from the windows command prompt in a deployment system?
See: > Using SC to deploy Windows services > > < The "SC" (Service Controller) utility should be on any Windows system, really.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "windows services, installation" }
Python: wrapping recursive functions How can I wrap a recursive function, recursive calls included? For example, given `foo` and `wrap`: def foo(x): return foo(x - 1) if x > 0 else 1 def wrap(f): def wrapped(*args, **kwargs): print "f was called" return f(*args, **kwargs) return wrapped `wrap(foo)(x)` will only output `"f was called"` with the first call. Recursive calls still address `foo()`. I don't mind monkey patching, or poking around internals. I'm not planning to add this code to the next nuclear warhead handling program, so even if it's a bad idea, I'd like to achieve the effect. **Edit** : for example, would patching `foo.func_globals` to override `foo.__name__` work? If it always does, any side-effects I should be minding?
It works if you use your wrapper function as a decorator. def wrap(f): def wrapped(*args, **kwargs): print "f was called" return f(*args, **kwargs) return wrapped @wrap def foo(x): return foo(x - 1) if x > 0 else 1 Reason being that in your example, you're only calling the result of the `wrap` function once. If you use it as a decorator it actually replaces the definition of `foo` in the module namespace with the decorated function, so its internal call resolves to the wrapped version.
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 9, "tags": "python, higher order functions" }
Dealing with a nasty recruiter I received a job offer that I needed to reject because I feel it would not be the right fit. However, the (3rd party) recruiter seems to not want to take no for an answer and is accusing me of being dishonorable. I did verbally accept, but called later to retract and did not sign anything. I also spoke to the company HR and hiring manager directly about my intent to not go forward, and we seem to have parted on good terms. Can the recruiter do anything to me? He seems to suggest he'll damage my reputation in the industry, naming people that I've worked for before that I know and respect.
The recruiter is acting unprofessionally, and it's unlikely that someone with that character has the reputation to damage yours. He's likely just upset that he lost a commission, or is under pressure to meet a quota, and is acting out. I suspect he won't be a recruiter much longer. If the tables were reversed, that verbal commitment would be worthless, and you would still be looking for a job. In the future, you will want to tread carefully when making commitments. People act on your words, and your credibility--and therefore your character--will be judged on whether your word is reliable. Credibility is hard to earn and easy to lose, so don't squander it. Although the recruiter can't do much, you've done some damage yourself.
stackexchange-workplace
{ "answer_score": 109, "question_score": 47, "tags": "recruitment" }
How to extract values from single database column / store in array I am hoping someone can help me with this. I am trying to extract all the values from a single column of a database and store the returned values in a numeric array. $num = 1; $q = "SELECT `uninum` FROM `participants` WHERE `islecturer` = '".$num."'"; $result = @mysqli_query ($dbcon, $q); $storeArray = array(); while ($row = mysqli_fetch_array($result, MYSQLI_NUM)) { $storeArray [] = $row['uninum']; } echo $storeArray [1];
The second parameter to `mysqli_fetch_array` sets the array type. You have set it to a numerical index. You want an associative index: while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { //correct flag $storeArray [] = $row['uninum']; } Or just use the `mysqli_fetch_assoc` function instead: while ($row = mysqli_fetch_assoc($result)) { $storeArray [] = $row['uninum']; }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "php" }
Shorter syntax for casting from a List<X> to a List<Y>? I know it's possible to cast a list of items from one type to another (given that your object has a public static explicit operator method to do the casting) one at a time as follows: List<Y> ListOfY = new List<Y>(); foreach(X x in ListOfX) ListOfY.Add((Y)x); But is it not possible to cast the entire list at one time? For example, ListOfY = (List<Y>)ListOfX;
If `X` can really be cast to `Y` you should be able to use List<Y> listOfY = listOfX.Cast<Y>().ToList(); Some things to be aware of (H/T to commenters!) * You must include `using System.Linq;` to get this extension method * This casts each item in the list - not the list itself. A new `List<Y>` will be created by the call to `ToList()`. * This method does not support custom conversion operators. ( see Why does the Linq Cast<> helper not work with the implicit cast operator? ) * This method does not work for an object that has an explicit operator method (framework 4.0)
stackexchange-stackoverflow
{ "answer_score": 606, "question_score": 281, "tags": "c#, list, casting, ienumerable" }
C - Dynamic Memory Allocation #include<stdio.h> #include<malloc.h> int main() { char *string1; int length; scanf("%d", &length); string1 = (char *)malloc(sizeof(char) * length); printf("\n Enter the First String : "); fgets(string1, length, stdin); printf("\n The First String : %s ",string1); free(string1); return 0; } Can someone help me on the above code ? I trying to get the length of a string and the string as inputs. But, I am able to enter only Length of the string. After that it skips the string input part. This is the output I am getting : sh-4.3$ main 10 Enter the First String : The First String : sh-4.3$
* After typing `"10<enter>"` the `<enter>` or `"\n"` will remain in the stdin buffer, so you have to use `getchar()` after the `scanf` to remove it. * Also you should `#include <stdlib.h>` instead of malloc.h. * You `malloc` 1 character too less, because of the 0-terminator. `string1 = malloc(length + 1);` will do the job, the cast is not necessary and `sizeof(char)` is always 1.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "c, pointers" }
"patch" command (version 2.0-12u11-Apple) does not include "--dry-run" Parameter in macOS Ventura A collegue of mine upgrade to macOS Ventura, since then the parameter `--dry-run` is not available for the `patch` command anymore and our tools do not work automatically anymore as the command prompts for user input. The version of `patch` is `2.0-12u11-Apple` on Ventura while being `2.5.8` on Monterey. Is there a known way of how to solve this (for example an upgrade for the `patch` binary)? See also * < * <
`brew install gpatch` or `sudo port install gpatch` installs version `2.7.6` in which the `--dry-run` option is available again.
stackexchange-apple
{ "answer_score": 3, "question_score": 1, "tags": "terminal, command line, software update" }
How do you clear the cache in Chrome? Everywhere I look I see instructions saying to go Chrome > Tools > Clear browsing data. There's no "Tools" option in that menu. I've hunted high and low through the preferences and developer tools but cannot find anything that lets me clear the cache. My Mac Chrome version is 39.0.2171.71 which apparently is up to date.
Running Chrome Version 39.0.2171.71 (64-bit) on Mac OSX. It's under `More tools`. !enter image description here
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "google chrome" }
How to remove error: bundling failed: ReferenceError: SHA-1 for file is not computed ![enter image description here]( tried to connect mysql with my react-navtive app. I install express, body-parser and mysql also then I create server.js in my project and type "node server.js" cmd on terminal then I get this error error: bundling failed: ReferenceError: SHA-1 for file /usr/local/lib/node_modules/react-native/node_modules/metro/src/lib/polyfills/require.js (/usr/local/lib/node_modules/react-native/node_modules/metro/src/lib/polyfills/require.js) is not computed I don't know what is this and how to solve this error please help me with this error... Note: I'm using ubuntu
What's your react-native-cli version? Perhaps, update the react-native-cli: npm i -g react-native-cli
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 5, "tags": "react native" }
Parse requests per OS type apache log I'm trying to return a sorted list of requests per OS type, parsed from an Apache access_log file (not combined format as I need the user-agent info). Here's an example of the output I'm looking for: 250 Windows NT 6.1; WOW64 200 X11; Linux x86_64 I've been able to find a partial solution, thanks to this post. Here's what I've got so far: awk -F'"' '/GET/ {print $6}' access_log.3 | cut -d' ' -f2 | sort | uniq -c | sort -rn Is it possible to use cut to get the strings I need, or is another method needed?
awk -F'"' '/GET/ {print $6}' access_log.3 | awk -F "[()]" '{print $2}' | sort | uniq -c | sort -rn
stackexchange-serverfault
{ "answer_score": 1, "question_score": 0, "tags": "apache 2.2, log files, awk, parsing, linux" }
how can I assign an embedded json to a variable in Swift? My backend code returns the following `json`: ... "_id": "some_id", "opening_hours": { "mon": "9-5", "tue": "9-5", "wed": "9-5", "thu": "9-5", "fri": "9-5", "sat": "10-3", "sun": "closed" } ... and I want to assign the `opening_hours` to a variable in my `Swift` app, so that I can easily access different days from there. I'm using `SwiftyJSON`. I tried to do it with the following code: var openingHours:[String:String] = [:] if(json["opening_hours"] != nil){ openingHours = json["opening_hours"].dictionary } but I have an error: Cannot assign value of type '[String : JSON]?' to type '[String : String]' How can I make it easily accessible then?
What you are looking for is `dictionaryObject` property, it will return `[String:Any]?` object so type cast it to `[String:String]` will works for you. var openingHours:[String:String] = [:] if(json["opening_hours"] != nil){ openingHours = json["opening_hours"].dictionaryObject as? [String:String] ?? [:] }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "swift, swift3, swifty json" }
Appearing overly emotional while speaking with line manager I work in a small startup in the EU, and was teleconferencing with my line manager. I was on the train so connection was not so great and I was off video. However, as I had just learned about a family member's illness, even though I was not emotional about what my line manager and I were discussing, I could not stop thinking about my family member, and my voice broke more than once. I think he might have either thought that I was crying or that I was emotional about what we were discussing. We were speaking about my role in his team (we are a three person team), so it can be construed as though I was emotional about that, which I was not. I do not want him to think that I am an overly-emotional person, or that I get emotional about my work (it's just a job). How do I mend any false impressions of myself?
People may have stuff going on in their lives, and most people tend to be understanding of that. The manager connecting your voice tone to what you were discussing directly is pretty unlikely, he might even assume you had bit of a cold. I would not worry about it too much. The best way to not appear as emotional about your work is simply doing your job and keeping your feedback about the work to business itself only. In other words, the best way to give the impression of being logical about your work is being logical with your work over time.
stackexchange-workplace
{ "answer_score": 2, "question_score": 2, "tags": "employer relations" }
Merge multiline strings in python Trying to figure out how to merge multiple strings containing new lines. so: """line 1 line 2 line 3 line 4""" + """addition 1 addition 2 addition 3 addition 4""" becomes """line 1 addition 1 line 2 addition 2 line 3 addition 3 line 4 addition 4""" But with many more entries than just two. Any help would be appreciated.
You can use `list comprehension` and `join` to concatenate the strings: s1 = """line 1 line 2 line 3 line 4""" s2 = """addition 1 addition 2 addition 3 addition 4""" result = "\n".join([" ".join(elem) for elem in zip(s1.split("\n"), s2.split("\n"))]) print(result) Output: line 1 addition 1 line 2 addition 2 line 3 addition 3 line 4 addition 4
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "python, string, concatenation, newline" }
Unable to Map element from first record of source schema to 4th record of destination schema I am Mapping one schema which has choice group to another schema with reference of other schema with Choice group. Unable to Map element from first record of source schema to 4th record of destination schema. It only mapping with first record of Destination schema, no drag link if working for other records except first. Why? ![enter image description here]( Check image, where I need to map with element in yellow, but getting mapped with red circled element only.
Set Ignore Namespaces for Links to "False". Both namespaces were different and did not allow drag & drop in mappings. Image Illustration
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "biztalk, biztalk 2013" }
Is it possible to urlencode a url that contains a url encoded url? I have a website that uses the facebook, twitter, delicious share links. They contain a a url encoded url of the website that you wish to share. The problem is I then want to send the facebook/twitter/delicious url through a php redirect page. Will it work to encode a url within an encoded url? Will there be side effects? To simplify my question: www.website.com/redirect.php?url=" URLENCODED (
You can encode a string multiple times with the percent encoding and get the original value by decoding it the same amount of times: $str = implode(range("\x00", "\xFF")); var_dump($str === urldecode(urldecode(urldecode(urlencode(urlencode(urlencode($str))))))); Here the value of `$str` is encoded three times and then decoded three times. The output of that repeated encoding and decoding is identical to the value of `$str`. So try this: '
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 5, "tags": "php, urlencode" }
React Native version mismatch. JS V: 0.49.3 RN V: 0.59.9 Since I updated React Native version I'm facing with this issue. ![enter image description here]( All I find about this error make reference to having more than 1 Node terminal opened but this is not happening to me. I have tried all they say about close the terminals, reset the cache, etc and nothing changes. This happens only with react-native run-android, in iOS it doesn't happen. Also, I can build the APK with no problems, but I cannot run in debug mode to debug the app via react-native run-android. What could I do?
I found the fix to this problem. I have to clarify that it only was happening on Android 9. I had to add in the Android Manifest this line of code: <application ... android:usesCleartextTraffic="true" ... For more information about this issue check this link
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, android, node.js, react native" }
Profiling SharePoint 2010 with Red Gate ANTS Profiler I'm trying to profile my customized SharePoint 2010 site with Red Gate ANTS Profiler, but I can't get it to work. I've followed every guide I could find, including the official guide, but I'm just getting blank pages with 500 HTTP status codes when browsing the profiled site. It doesn't seem to matter which credentials I use or who the primary Site Collection Administrator is. Has anyone gotten it to work? If so, how?
It doesn't support sharepoint 2010: Profiling SharePoint
stackexchange-sharepoint
{ "answer_score": 2, "question_score": 0, "tags": "publishing site, performance" }
Is it possible for a layperson to suitably evaluate scientific disputes? As a layperson, I try not to fall victim to the Dunning-Kruger effect. As an example, one area where I know that I am vulnerable is when biochemistry intersects with nutrition and disease. Is it possible for me, as a layperson without specific scientific knowledge (in this case, biochemistry), to make any sound or valid judgment regarding a scientific dispute (in this case, over nutrition)? For instance, the China study says X, critics A say not-X, and critics B say Y. Isn't any attempt by a layperson to evaluate any of those claims going to be based on guesswork and confirmation bias?
In examining any claim, you always have at least two options: checking **validity** and checking the **truth**. In layman's terms, this means you can: * **Examine the _logical structure_ of the argument**. Does the conclusion follow from the premises? * **Examine the _content_ of the argument**. Are the premises in the argument true? In your case, it seems you lack knowledge of the content, but anyone who understands logic should be able to—even with no understanding of the topic being discussed—critique the logical structure of an argument and check whether it is valid. Your examination would be entirely free from the influence of confirmation bias because logical coherence has nothing to do with content but of form. On the other hand, if you were to question the _truth_ of the premises in the claim, you would be susceptible to (but not _necessarily_ fall prey to) the confirmation bias, because the confirmation bias deals with the truth/falseness of information.
stackexchange-philosophy
{ "answer_score": 13, "question_score": 17, "tags": "epistemology, philosophy of science, skepticism" }
how to use drupal mail functionality from external php file (sub folder)? I have developed a separate functionality using core php in a sub folder of my drupal site (assume something like `mysite.com/myfolder/myfunc.php`). Now i want to send email as same like how drupal site send it. Since this is not custom module i can't use `hook_mail`. Or is there any possibility to achieve this? How to use drupal mail functionality from core php (sub folder of the site)?
best way is create a module but if needed you can use require_once './includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); /** Write your code here use PHP core, drupal core and contrib functions **/
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, email, drupal, drupal 7" }
Page Renders before data pull is complete I have two columns. The column on the left renders first (obviously). The column on the right is injected code that is built from a data pull. The column on the right finishes rendering the page before the data is loaded and visible. Therefore the right column is blank, unless I refresh the page several times. Is there a way to slow down the page rendering? The page renders properly in ie, but not ff and chrome.
No but you can delay rendering the right column until your ajax call are completed. Depending on the Javascript library you're using, or if you're using raw Javascript, there should be a way to register a callback function to be called back when the data finished downloading from the server. Load your data in this callback instead of relying on delaying for a specific amount of time, because that will always be wrong, too slow for some users and too fast for other users.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript" }
iPhone 6, iOS 8, App Store Update count doesn't update This is a small thing, but the details are where it is at. I have a new iPhone 6 running iOS 8.02 and the App Store flag says I have four new app updates to download. This was true before I downloaded all the updates in iTunes and synched with my phone. When I click on the App Store app and click on Updates 'Update All' is grayed out and there are no apps to update. Is this a bug? Is there some way to get rid of that annoying and misleading flag?
Solution: Open Settings > iTunes & App Store > Automatic Downloads > Updates set to On.
stackexchange-apple
{ "answer_score": 1, "question_score": 1, "tags": "iphone, ios appstore" }
JSONObject fields in GSON class - Remains empty Can Gson classes contain fields of type JSONObject? Here is my GSON class class Item { @Expose var name: String? = "" @Expose var type: String? = "" @Expose @SerializedName("agr") var aggregate: JSONObject? = null @Expose @SerializedName("seg") var segments: JSONObject? = null @Expose @SerializedName("ts") var timestamp: String? = "" } The JSONObject fields **segments** and **aggregate** remains an empty JSONObject when serialised (in Retrofit using default GsonConverterFactory). here's what I got. Any suggestions to get it write? {"items":[{"agr":{},"name":"Logged In","seg":{},"ts":"2017-10-17T12:20:32Z","type":"event"}]}
A work around - Replacing the **JSONObject** with a **HashMap()** had helped me achieve the same results.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, json, serialization, gson, retrofit" }
Correlation between network throughput and number of concurrent users I need to identify/formulate the relationship between number of concurrent users that are downloading data from a server on network throughput. Suppose, we have a 600KB file on a server A and N users download it at the same time. So, I would lie to know that how increase in N impacts of network throughput. Is the relation linear? any equation for
Let me make up some numbers: Assume a network bandwidth of 4.8Mbps. That works out to 600kB/sec, ignoring overhead. So one user would get the file in 1 sec (again, ignoring overhead). 2 users would take 2 sec and so on.
stackexchange-networkengineering
{ "answer_score": 2, "question_score": -1, "tags": "lan, throughput" }
What awesome foo.stackexchange am I not a member of but should be? Background: I'm only active on Stackoverflow, but other interesting Stack Exchange sites have been drifting into my view. Are there any that have matched or surpassed the original in terms of awesomeness?
Area 51 is the place to find new sites to join. !enter image description here In your case you'll want to hit the Technology tab on the bottom left, then click on either `beta` or `launched` on the top right to find sites that are currently active.
stackexchange-meta
{ "answer_score": 6, "question_score": -1, "tags": "discussion, stack exchange, subjective" }
What number format or notation is 01h? I was reviewing this NEC document for programming a projector which shows RS232 command examples using number formats such as: `20h + 81h + 01h + 60h + 01h + 00h = 103h` from other sections in the document it would seem that h = 15, though I could be wrong. I'm a bit embarrassed to ask, but what number format is this? `20h` or `103h`
Its hexadecimal. That means 16 instead of 10 as number base. So the numbers are 0 1 2 3 4 5 6 7 8 9 A B C D E F. Adding 20h + 81h equals A1h or 32 + 129 = 161. Other notations are `0x00` (C languages)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "numbers" }
Handle a kill signal I want to handle a `kill signal` from C program. I'm starting by create an infinite loop and handle the signal void signal_callback_handler(int signum) { printf("Caught signal %d\n",signum); // Cleanup and close up stuff here // Terminate program exit(signum); } main() { signal(SIGINT, signal_callback_handler); printf("pid: %d \n",getpid()); while(1) { } } When I run this program and make CTRL+C, the kill is handled, and it works. The message `Caught signal` is printed. However, when I'm trying to kill from another program int main(int argc, char **argv) { kill(atoi(argv[1]), SIGKILL); return 0; } The program is stoped but the signal is not handled. In other words, the message `Caught signal` is not printed. The infinite loop is just stopped.
This is it: **you cannot catch a`SIGKILL`**, it will _definitely_ kill your program, this is what it's been created for.
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 2, "tags": "c, linux, signals" }
DLLs Missing From Project Output Directory I have the following Solution structure: Solution.sln --LibProject1 --LibProject2 (References LibProject1) --WCFProject (References LibProject2) The issue I'm experiencing is that when I build `WCFProject`, the DLL corresponding to `LibProject1` is not added to the `WCFProject` output directory. For some reason it is not adding project sub-references. My question is: Where could I have screwed the project files for this to happen? Is there any option I'm missing in the csproj or sln file? Thanks! P.D.: I'm using VS2012 Ultimate. Also, I already checked Copy Local is true for all projects.
Ok, I got this figured out. Apparently, LibProject2 was not using any classes from LibProject1, hence, VS would not copy the DLL to the WCFProject output directory. As soon as classes from LibProject1 was consumed by LibProject2, the DLL was copied. There you go, one day wasted over VS default behavior. u_u
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "c#, visual studio 2012" }
Status of the Nichols claim to proof of the Collatz conjecture? In December 2021, Robert Hills Nichols, Jr of Cumberland University claimed a proof of Collatz on arXiv. But I've not seen any reviews or comments on the validity of his claim, and it's certainly beyond me. Is there any validity to his claim? <
Got a quick look and from what I see, there is a bunch of variable transformation and 2 main functions $p_n=p(2^{n+1}x+2^n-1)=x$ which gives the root $x$ of a number of the form $2^{n+1}x+2^n-1$ and some kind of 2-valuation $q_n=q(y)=\nu_2(y+1)+1$ used like this: $q(2^{n+1}x+2^n-1)=n+1$ which leads to the construction of two sequences: $v_n$ which are odd numbers and are the "bottom" of successive 1-cycles (the classical $a2^i-1$), and $u_n$ which are even and are the top of the successive 1-cycles (the classical $a3^i-1$) e.g. from $v_0=7$, you get $u_1=26$, $v_1=13$, $u_2=20$, $v_2=5$,.... This re-arrangement gives another (Collatz) tree which has the same pitfalls as the classical (Collatz) tree: It fails to show the presence of all natural numbers in the tree (it uses the same argument as the classical tree), it fails to show there are no cycles (several trees), it fails to show there are no infinite sequences.
stackexchange-math
{ "answer_score": 9, "question_score": 2, "tags": "collatz conjecture" }
How long does each research project take to complete? In SimCity, there are a variety of research projects, many of which unlock the great work for your region. I am currently working on the Solar Farm Great Work; !enter image description here How long does each research project take to complete? Is it a set time for each research project and if so does each research project take the same amount of time to complete? Are there any other factors that influence how long it takes for each research project to complete?
Every student seems to "unload" some of his knowledge into the project. You can observe that every time a class starts and all the students flow into the building, the percentage of completeness rises. Also it seems that the projects have various required amounts corresponding to the complexity of the project. The advanced solar panels seemed to take much less time than the nuclear reactor.
stackexchange-gaming
{ "answer_score": 3, "question_score": 3, "tags": "simcity 2013" }
How can you navigate "Writing" onto FlightRadar Plans? Sorry if the question title here is a bit misleading, the graphic here should explain all: ![enter image description here]( I read a news story this morning about how a guy flying a Robin DR400 regularly creates inventive patterns in his flight tracks. Source The question is, how would the pilot be able to create this writing (and other creative patterns)? Autopilot instructions? Watching himself on FlightRadar? * * * ![enter image description here](
Most Robin 400s don't have autopilots, but some do. Whether it has an autopilot or not it was almost certainly navigated using a pre-set course which was fed into a GPS. One would use flight planning software to create a course using a series of waypoints which would then be uploaded to a built-in or handheld GPS, and then either flown by hand or followed by an autopilot. You can see that the curves are mostly a series of small straight lines, I think that these straight lines are the space between waypoints, it could be the refresh between the FlightRadar inputs causing the lines though.
stackexchange-aviation
{ "answer_score": 6, "question_score": 7, "tags": "flight planning" }
How to convert part of file to lowercase? Using gVIM on XP How can I convert the left side of this file to lowercase while keeping right side unchanged? %s/**what goes here?**/g CONVERTTOLOWERCASE###Keep CaSe AAAA###AeiOu BBBB###qWerTy Desired Results converttolowercase###Keep CaSe aaaa###AeiOu bbbb###qWerTy
Here is the command you are looking for: %s/^[^#]\+/\=toupper(submatch(0))/ See: * `:help tolower()` * `:help sub-replace-special` * `:help sub-replace-expression` * `:help submatch()`
stackexchange-superuser
{ "answer_score": 1, "question_score": 0, "tags": "gvim, find and replace" }
How I can make users authentication same on www.domain.com and domain.com I am facing a issue, I have implemented User authentication using Node.Js and Passport.js. The issue is when I am reaching out using eg:- domain.com it successfully logged me in but when i visit same website on www.domain.com it is not preserving the authentication that was done using domain.com. How I can preserve the user data.
An Alternative to it is we can redirect all users coming on non-www domain to www domain * * * app.get("/*", function (req, res, next) { var protocol = " host = req.headers.host, href; // if www. present, nothing to do here if (/^www\./i.test(host)) { next(); return; } // Add www. host = host.replace("", "www."); href = protocol + host + req.url; console.log(href); res.statusCode = 301; res.setHeader("Location", href); res.write("Redirecting to " + host + req.url + ""); res.end(); });
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "authentication" }
How are links like drive.google.com, app.codeable.io etc. achieved? Websites that have sort of a secondary domain. What are links like these called? Can it be done trough code or is it a domain thing?
This isn't a coding question - this is related to network and DNS administration. The "drive" part of "drive.google.com" is just a subdomain or machine name on the "google.com" domain. As far as DNS is concerned, it is even easier - these are just additional entries in your DNS configuration. There is almost nothing special that needs to be done.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "web services, web" }
Send feedback button disappear when reporting ad When I try to report an ad in Stack Overflow, this popup comes up to report it. ![report ad]( But after I attach an image and select Other, the Send Feedback button disappears from the screen. ![report ad with image]( The main issue is, I can't even scroll down to click the Send Feedback button.
Thanks for notifying us! We were able to reproduce the issue and will fix this. I will update this post with any updates. **Update May 17th** This problem is fixed, feel free to comment below if you're still experiencing any issues.
stackexchange-meta_stackoverflow
{ "answer_score": 7, "question_score": 7, "tags": "bug, status completed, design, advertising, popup" }
React-Native CLI Unable to boot device in current state: Booted I want run react-native project but when i write 'npx react-native run-ios' I get the following error. After OK button clicking simulator worked. What is this error and how can i solve it? ![enter image description here]( I tried many methods but didn't work.
I found solution. Simulator -> Preferences -> Simulator lifetime: When Simulator starts boot the most recently used simulator I unchecked.
stackexchange-stackoverflow
{ "answer_score": 14, "question_score": 9, "tags": "ios, react native, macos" }
Addressing individual distributed RGB LEDs I want to have a set of RGB LEDs and to be able to define the color for each one individually. The LEDs will be in different locations but in the same room. Some solutions I'm considering with wired and wireless approaches: * Each LED has its own Arduino (or similar), all Arduino are connected with I2C, the "main" Arduino sets the color for each * Each LED has its own ESP8266 (or similar), through wifi, the "main" board set the color for each * Use TTGO with color display, instead of LED I can set the color on the display, wifi also. Is there any simple solution? Are there LED strips where each LED can be addressed independently?
The WS2812B is exactly what you want. It is most commonly seen on colour strips and often sold with a controller and remote. There are oodles of articles about them and how to control them with a microcontroller study as those embedded in the Arduino platform.
stackexchange-electronics
{ "answer_score": 3, "question_score": 1, "tags": "arduino, i2c, communication" }
Maximum Supported RAM in a Sony Vaio VPCW12J1E I have this Sony Vaio 10.1 inch laptop which has 1 GB ddr2 RAM and runs on an Intel Atom N280 at 1.66 GHz. My question is what is the maximum amount of RAM this laptop supports? It has only one slot.
Google says 2GB is the max. So , no , you cannot put 4gb.
stackexchange-superuser
{ "answer_score": 0, "question_score": -1, "tags": "memory, ddr2" }
Create an event for all of the RadioButton's GroupName in a form I need to create a click event that when a radiobutton was clicked/checked/ticked I need to know what is the value of that radiobutton and what groupname does it belongs to. $("input[name='tstProCon'], input[name='thsProCon'], input[name='thProCon']").click(function () { var myVal1 = $(this + ":checked").val(); alert(myVal1); }); I used the above click event but it throws a jquery syntax error. Please help.
Try this: $("input[name='tstProCon'], input[name='thsProCon'], input[name='thProCon']").click(function () { var myVal1 = this.value; // or the complicated way ;) // var myVal1 = $(this).val(); alert(myVal1); }); The expression `$(this + ":checked").val();` is the problem. `this` is a (native, not jQuery!) reference to the DOM element which received the event. Obviously, you can't mix it with a string.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, html" }
¿Como saber si el usuario tiene la sesión iniciada? Quiero saber el usuario tiene la sesión iniciada para mostrar o no ciertas cosas en la vista. Puedo hacer la opción de que en un menú se vea que si el usuario que tiene la sesión iniciada es administrador muestre un boton hacía el panel de administración. @if(Auth::user()->tipoUsuario == 'Administrador') <li><a href="/admin/usuario">Administración</a></li> @endif Lo que quiero hacer es ver si un usuario cualquiera tenga la sesión activa para mostrar ciertas cosas.
En estos momento yo tambien tengo la misma cuestion He creado varios Auth::guard usando < cada tipo de usuario tiene una tabla diferente y dependiendo del tipo de usuario se muestran diferentes opciones, por lo que las opciones Auth::guest() (que da true si no esta logueado) y Auth::check() da true o false porlo que necesito al mas especifico para cada tipo de usuario Gracias ACTUALIZACION encontre una solucion para determinar que mostrará en funcion del tipo de usuario @if(Auth::guard('trader')->check()) ES UN TRADER @elseif(Auth::guard('admin')->check()) ES UN ADMIN @endif Donde "trader" y "admin" son mis Auth::guard
stackexchange-es_stackoverflow
{ "answer_score": 6, "question_score": 2, "tags": "laravel 5, laravel, autenticación" }
Does anyone has a working smart tag solution for autolinking bug numbers from emails? I'm looking for a solution that will auto add hyper-links to Outlooks emails (including incoming) when the email does contain a text like "bug # 1234" or similar. There are some information on this MSDN article.aspx) but I wasn't able to find any working solution so far.
I havent done it before but may be this is a good pointer it would only seem possible if word is used. < Also there is an active news group <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "email, outlook, hyperlink, smart tags" }
Prove that there exists a canonical isomorphism of A-algebras This question is from an assignment in algebraic geometry and I am struck on it. > Question: Let $A$ be a commutative ring and let $T =\\{ t_i \mid i \in I\\}$ be a family of elements in $A$ and let $S=\langle T,\cdot\rangle\subseteq A$ be the multiplicative submonoid of $(A,\cdot)$ generated by $T$, i.e. $S$ consists of all finite products of elements in $T$. Then there exists a canonical isomorphism of $A$-algebras $S^{-1} A \to A[X_i\mid i\in I]/\langle t_iX_i -1\mid i\in I\rangle$. Unfortunately, I don't have much to show in work for this question. Can you please tell how exactly should I define the map? I can see that $\langle t_i X_i -1 \mid i \in I\rangle $ should be in the kernel of the map. But, except this I don't have any clues? Kindly consider helping.
Just to write an answer I'll rewrite my comment here. The fact that we are quotienting out by $\langle t_iX_i-1\mid i\in I\rangle$ implies that in the quotient we have $t_iX_i-1=0$ for all $i$, which is equivalent to $t_iX_i=1$. In other words, $X_i$ is the multiplicative inverse of $t_i$. This forces $t_i^{-1}\in S^{-1}$ to be mapped to $X_i$. And this is enough to define a map $S^{-1}A\to A[X_i\mid i\in I]$ if we leave $A$ fixed, i.e., $a\mapsto a$ for all $a\in A$. I'll let you finish the definition of the map from here. With that definition it is more or less clear that the map is surjective and the kernel is precisely $\langle t_iX_i-1\mid i\in I\rangle$ since the only relation we are introducing is $t_iX_i=1$ from the fact that $t_it_i^{-1}=1$.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "commutative algebra, localization" }
Can we use PostgREST with CockroachDB PostgREST serves a fully RESTful API from any existing PostgreSQL database. CockroachDB promises distributed SQL advantages. CockroachDB is built to be largely compatible with PostgreSQL. Here is a detailed blog on this If we can bring these two together that's a powerful combination. We could automatically generate RESTful API for CockroachDB using PostgREST. Is PostgREST compatible with CockroachDB ? Has anyone used this combination on a production application ?
Like Steve Chavez commented, PostgREST is not currently compatible with CockroachDB since CockroachDB doesn't support `SET LOCAL`. See < for more details.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "postgresql, cockroachdb, postgrest" }
Does SQL Server lock the row after insert? I have a SQL Server `after insert` trigger that takes row id and sends it to a web service that performs select query on the same row but it seems the operation deadlocked all operation.
Yes. AFTER INSERT triggers run in the same transaction as the INSERT statement, so the rows affected by the operation will be locked. Your trigger should insert a row into another table or queue, and have a background process call your web service after the INSERT commits.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": -3, "tags": "sql server, tsql" }
Electricity cost of mining I've checked with my electricity provider, and I have been told the following: Unit Rate (per kWh) = 0.1399USD Standard Charge (per day) = 0.1645USD While mining, if my computer is using 100w (which is a reading my electric monitor is giving me). How do I work out how much this miner is costing me per hour in terms of electricity usage?
Basic Algebra 101: 100 W = 0.1 kW so 0.1 (kW) * 0.1399 (USD/kWh) = ~$0.014 (USD/hour) or 0.1 (kW) * 24 (h/Day) = 2.4 kWh/Day 2.4 (kWh/Day) * 0.1399 (USD/kWh) = $0.3358 (USD/Day)
stackexchange-bitcoin
{ "answer_score": 4, "question_score": 2, "tags": "mining profitability, energy consumption" }
How does one enter women's restroom? On the Crew Deck of Normandy, we have the restrooms. Throughout the game thus far, I have been able enter men's restroom, but never women's (no hologrammatic lock on it). How do I enter women's? Is it openable at all at certain point in the game? I play a male Shepherd if that makes any difference. I am not a pervert or anything. Just curious about what's in that room. :-)
One may only enter the bathroom appropriate for one's gender. If you're **really** curious you could start a character of the opposite gender, though you will likely be disappointed.
stackexchange-gaming
{ "answer_score": 21, "question_score": 8, "tags": "mass effect 3" }
Find the generating function of the sequence $(a_0, a_1, a_2, \dots)$ where $a_n = n2^n$ I am tasked to find the generating function of the sequence $(a_0, a_1, a_2, \dots)$ where $a_n = n2^n$ Here is how I approached it: First, I wrote out the first few terms of the sequence, $(0, 2, 8, 24, 64)$. Then, using the definition of a generating function, set up this summation: $$ \sum_{n=0}^{}n2^{n}x^n = \sum_{n=0}^{}n(2x)^{n}$$ However, I am stuck here. I am not sure if this is the right start, but it seems promising.
Let $f(x)=\sum_{n=1}^{}n(x)^{n-1}$. Then integrate it. $\int f(x)dx=\sum_{n=1}^{}(x)^{n}=\frac{x}{1-x}$. $f(x)=\frac{d}{dx}\frac{x}{1-x}=\frac{1}{(1-x)^2}$ $\frac{2x}{(1-2x)^2}=2xf(2x)= \sum_{n=0}^{}n(2x)^{n}$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "combinatorics, discrete mathematics, generating functions" }
ssh -X oracle is not working properly I run the following command to switch to oracle user on linux. ssh -X oracle@hostname This is suppose to set environmental variable DISPLAY. I ran xclock command but it throws the following error Invalid MIT-MAGIC-COOKIE-1 keyError: Can't open display: localhost:16.0 How should i set environmental variable DISPLAY correctly to run GUI application?
You may have logged in as Oracle with -l option, if that is the case your DISPLAY variable won't set correctly when you switch user to root and then issue the command shh -X oracle@servername you need to exit out from the current shell. Login as root and then issue the command shh -X oracle@servername Hope, this will correctly set your DISPLAY variable.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "linux, oracle, display" }
iOS test flight build missing from builds drop down? So here is what I'm dealing with: ![enter image description here]( Version 0.2 and 0.1 both have items in the drop down but version 0.25 comes up blank. Am I missing something or has iTunes Connect just gotten confused?
I also had this issue, resolved by adding the `beta-reports-active` entitlement to entitlements.plist. `<key>beta-reports-active</key>` Related is Apple's documentation on the entitlement here: < Which states: > ...to allow App Store code signed builds to be tested using iTunes Connect
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ios, app store connect, testflight" }
Safe NSArray access I expected `objectAtIndex:` to return a retained and autoreleased object for my use, but my tests with autorelease pools indicate they do not. This being the case, how do I protect myself against another thread removing an object from an array **_after_** I retrieve its reference using objectAtIndex but **_before_** I have a chance to use or retain that reference?
Synchronize access to the array, as you should any access to resources shared across threads.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "objective c, multithreading, memory management, nsarray, autorelease" }
How to concat AMD modules so they work in non-amd environment too? I wrote a library with requirejs. Now I would like to build a distribute version of it where concat all files into a "mylib.dist.js" file. Problem: My library should also work in non-requirejs environments. jQuery for example goes this way too. Every file in the `src` directory is a amd-module. In the build-process the code will we restructured somehow. They have wrote an own `build.js` file for this purpose. Is there a library out there which can handle this for me out of the box? Or do I need to write my own build like jQuery Team?
You can use RequireJS' builder, `r.js` and combine you code with Almond to create a file that would externally behave like a library that is not made up of AMD modules. Almond is a small piece of code that is able to load AMD modules, but with some limitations explained in the documentation. (The limitations should not be an issue with what you are trying to do.) The process for doing exactly what you are trying to do is described in Almond's documentation, but in brief what you do is tell `r.js` to wrap your code in an IIFE and include Almond in the produced bundle.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "requirejs, amd" }
Storing & getting the device orientation (yaw, pitch, roll) when taking a photo I want to take a photo and use the stored GPS coordinates and the orientation of the phone to do some calculations. How can I access that information? Alternatively if there is an API to do that I could make my own app.
Of course! You can use Metadata viewer to see the GPS coordinates and other information of your photos. Android has Handful of APIs for anything you want. If you a developer you can make use of that. Here is all you need. * Tutorial to get yaw, pitch, roll in android. * Simple Camera API tutorial * Google documentation about accelerometer api :)
stackexchange-android
{ "answer_score": 1, "question_score": 0, "tags": "camera, sensors" }
What's the correct syntax for setting up memcached caching driver in EE 2.8+ with socket? In EE 2.8 and above, you can select 'Memcached' as your 'Caching Driver' under "Admin" => "General Configuration". I am using one of Nexcess' "ExpressionEngine optimized" hosting plans, which lists "Memcached Back-End" as one of their features. I wanted to enable this, so I contacted their support folks. They set up a socket to use memcache. However, when I select 'Memcached' as my caching driver, EE displays the error message "Cannot connect to Memcached, using File driver instead". What is the correct syntax for my config file to get this to work?
I'm glad you asked! $config['cache_driver'] = 'memcached'; $config['memcached'] = array( array( 'host' => '/var/tmp/memcached.sock', 'port' => 0, 'weight' => 1, ) ); Adding that to your config.php should do the trick, assuming you list the correct socket location and port. (this is me answering my own question, because I searched and searched and couldn't find this info anywhere.)
stackexchange-expressionengine
{ "answer_score": 1, "question_score": 0, "tags": "config, caching, config overrides" }
How do you extract a number from a URL as raw text? So I have a list of Google+ profile links in a Google Sheet > < How can I extract the number on the end in a seperate column? I've tried `=split(url,"/")` but that ends up formatting the numerical id in scientific notation and will not display it as text no matter what I try. Additionally I don't want the rest, just the last element.
With a `REGEXEXTRACT` formula you can do the following. ## Formula A1 = =REGEXEXTRACT(A1, "\d+") ## Explained The REGEX (`\d+`) searches for numbers only; d == numbers and + == all instances. ## Screenshot !enter image description here ## Note The `REGEXEXTRACT` formula returns a string. The `SPLIT` formula however returns a formatted value, in your case a number existing of 21 digits. Google Sheets can only handle numbers up to 15 digits. The rest of the digits are being set to zero and a scientific notation is chosen. ## Example I've created an example file for you: **SPLIT vs. REGEXEXTRACT**
stackexchange-webapps
{ "answer_score": 6, "question_score": 2, "tags": "google sheets" }