INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
XNA: SpriteFont question I need some help with the SpriteFont. I want a different font for my game, other than Kootenay. So, I edit the SpriteFont xml, i.e: <FontName>Kootenay</FontName> or <FontName>Arial</FontName> No problem with Windows fonts, or other XNA redistributable fonts pack. However, I want to use other fonts, that I downloaded and installed already, they are TTF or OTF, both supported by XNA. My problem is, I cant use them, I got this error: > The font family "all the fonts i tried" could not be found. Please ensure the requested font is installed, and is a TrueType or OpenType font. So, checking at the windows fonts folder, I check the properties and details of the fonts, I try all the names they have, and but never works. Maybe I need some kind of importing or installing in order to use them, I dont know, and I hope you guys can help me, thanks!
If you see your font in fonts directory, just try to restart Visual Studio or whole system. It should help. I tried it - I installed new font, add it into running MSVS project, then compile and get the same error as you. When I restarted MSVS and compile again, it worked.
stackexchange-gamedev
{ "answer_score": 5, "question_score": 6, "tags": "xna, c#, fonts" }
Let $I$ and $J$ be ideals, $(I+J)/I\subseteq (I+J)$? Let $I$ and $J$ be ideal. We consider $$ \begin{split} (I+J)/I:=&\\{(i+j)+I\;|\;i\in I,j\in J\\}\\\ =&\\{j+(i+I)\;|\;i\in I,j\in J\\}\\\ =&\\{j+I\;|\;j\in J\\}. \end{split} $$ Can I conclude from this that $$(I+J)/I\subseteq (I+J).$$ Thanks in advance!
I think you need to be more careful with your definitions. The elements in $(I + J)/I$ are equivalence classes of elements in $(I + J)$. We say that two elements in $(I + J)/I$ are equivalent if they differ by something which lives in $I$. As such, I think that we could say that for an equivalence class $x \in (I + J)/I$, $x \subseteq I+J$, but in general $(I + J)/I$ is not a subset of $I+J$.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "abstract algebra, ideals" }
Can I change the MCU sleeping mode programmatically on FreeRTOS? I am a new been on FreeRTOS and working on a board that uses the Cortex-M4 Processor and the FreeRTOS "FreeRTOS V7.4.2 - Copyright (C) 2013 Real Time Engineers Ltd." Can I change the MCU mode programmatically or through a debugger? I want to make sure the MCU is NOT in sleeping mode. I looked at this thread but did not help much. Entering sleep mode on arm cortex m4 thank you.
Unless you specifically set the processor to enter sleep mode it will not be in sleep mode. You shouldn't have to do anything. You are also using quite an old version of FreeRTOS, I would recommend downloading 9.0.0. See < for info on how to enter sleep mode.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "embedded, freertos" }
Большая задержка(пауза) в Java Делаю Java приложения. Возникла необходимость при выполнении определенных условий делать паузу выполнения программы на длительное время(час или даже больше). Код выполняется отдельном потоке. На сколько правильно будет использовать для такой большой паузы Thread.sleep(*очень большое число*) Может быть есть другой, более правильный способ?
Правильнее будет воспользоваться таймером или ScheduledExecutor(ом) например вот так: Timer t = new Timer(); t.scheduleAtFixedRate(new TimerTask() { public void run() { System.out.println("do task"); } }, 0, 100); * * * ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); service.scheduleWithFixedDelay( () -> { System.out.println("do task"); }, 0, 1, TimeUnit.HOURS);
stackexchange-ru_stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "java" }
Unneeded spacing in TikZ graph The following code \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (0,0) node (A) [label=A] {} -- ++(60:2.0cm) node (B) {} -- ++(120:2.0cm) node (C) [label=C] {} -- ++(180:2.0cm) node (D) {} -- ++(240:2.0cm) node (D) {} -- ++(300:2.0cm) node (E) {} -- cycle{}; \draw (A) -- ++ (-30:1cm) node (A1){} -- ++(-30:1cm) node (A2){} -- ++(60:2cm) node (B2){} -- ++(150:1cm) node (B1){} -- (B) -- cycle; \draw (B1) -- (A1); \end{tikzpicture} \end{document} gives an unexpected spacing between node (A) and its repetition (I want to obtain a connected graph). How to avoid it? ![enter image description here](
Just use `coordinate` instead of `node {}` with its `inner width`, ... \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (0,0) coordinate[label=A] (A) -- ++(60:2.0cm) coordinate (B) -- ++(120:2.0cm) coordinate[label=C] (C) -- ++(180:2.0cm) coordinate (D) -- ++(240:2.0cm) coordinate (D) -- ++(300:2.0cm) coordinate (E) -- cycle{}; \draw (A) -- ++ (-30:1cm) coordinate (A1) -- ++(-30:1cm) coordinate (A2) -- ++(60:2cm) coordinate (B2) -- ++(150:1cm) coordinate (B1) -- (B) -- cycle; \draw (B1) -- (A1); \end{tikzpicture} \end{document} > ![Result](
stackexchange-tex
{ "answer_score": 2, "question_score": 0, "tags": "tikz pgf, graphs" }
Not able to find the href tag from string collection here is my code.... $(lines[i]).find('[href]').each(function () { checkLinkFooter = true; footerLinks += $(this).attr('href') + '~'; }); And my string is : If you prefer not to receive, reply to the sender or contact us at <a target="_blank" href="mailto:[email protected]" style="font-weight:bold;text-decoration:none;color:#0085d5">[email protected]</a>. Getting console error " Syntax error, unrecognized expression:"
You need to wrap your string with another dom object to use .find(). Now you have a string starting with a word, so jQuery will consider it as a selector, but since it contains invalid characters, it might throw an error saying something like `Uncaught Error: Syntax error, unrecognized expression: hi <a>`. $('<div />', { html: lines[i] }).find('[href]').each(function () { checkLinkFooter = true; footerLinks += $(this).attr('href') + '~'; }); Demo: Fiddle
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "javascript, jquery" }
Selecting Links in Google Maps InfoWindows w/ jQuery In my web app, I am using jQuery to select all the links on the page and intercept where they go to so that I can switch to a different part of the page with AJAX. The problem is that some of these links are in InfoWindows (if that's what they're called) on a Google Map. For some reason the jQuery selector $('a') isn't selecting them. They're loaded at the same time that the page is (which is when $('a').click is called) and I don't see how they don't show up in the DOM. Any ideas?
I think that the content of the infoWindows is injected to the DOM programmatically, when the window is shown up, so the links are not present when you execute your selector. Try to bind the `click` event with `live`: $('a').live('click', function () { // .. }); The `live` method works with event delegation, and it will work for all the anchors present in the document.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, ajax, maps" }
jQuery .nextAll() is not working with html table columns I have a html table as below: <table> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> </tr> <tr> <td>6</td> <td>7</td> <td>8</td> <td>9</td> <td>10</td> </tr> </table> On click of a td I am changing the color of it's next 4 td's and for that I have done it in jquery as below: $(this).nextAll("td").slice(0, 4).addClass("selected"); Above code is working if I click on 1st TD then it selects further 4 td's but if I click on 4th td then it selects only 5th td. I want it to select another 3 td's in next row as well. Please tell me how can I fix this?
jQuery `.index()` method returns the index of passed element in the current set. By using returned index you can `.slice()` the collection, this is more efficient than querying the DOM on each click, especially when you have a big table: var $tds = $('#table td').on('click', function() { var i = $tds.index(this); $tds.slice(++i, i+4).addClass("selected"); }); <
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 0, "tags": "javascript, jquery, html" }
Highlight line in react-syntax-highlighter Is there a way to highlight a code line inside a react-syntax-highlighter component? You can see the highlight I mean in the image below on line 43. ![enter image description here](
You can hack on the generated `span`s. Firstly, without talking about React, let us use plain jQuery to solve the problem: Open the demo, then run $(".language-javascript>span:nth-child(3)").css('background-color', 'blue') and you will see the `3`rd line being blue! ![enter image description here]( Secondly, let us make it work in React. You can use some libraries to inject css codes like `.language-javascript>span:nth-child(3) {background-color: blue;}` (where `3` is the line number you want to highlight) into React component tree.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 6, "tags": "javascript, reactjs, syntax highlighting" }
Image scaling and rotating in C/C++ What is the best way to scale a 2D image array? For instance, suppose I have an image of 1024 x 2048 bytes, with each byte being a pixel. Each pixel is a grayscale level from 0 to 255. I would like to be able to scale this image by an arbitrary factor and get a new image. So, if I scale the image by a factor of 0.68, I should get a new image of size 0.68*1024 x 0.68*2048. some pixels will be collapsed onto each other. And, if I scale by a factor of say 3.15, I would get a larger image with pixels being duplicated. So, what's the best way to accomplish this? Next, I would like to be able to rotate an image by an arbitrary angle, in the range of 0 to 360 degrees (0 - 2Pi). Cropping of the image after rotating isn't an issue. What would be the best way to do this?
There is no simple way of accomplishing this. Neither scaling nor rotating are trivial processes. It is therefore advisable to use a 2d imaging library. Magick++ can be an idea as divideandconquer.se point out, but there are others.
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 14, "tags": "c++, c, image, image scaling" }
Using variables from json - Google play games quests I have added Google play games services to my android app in Unity3d. I am trying to add quests, but am having issues claiming the reward. In the developer console, i have uploaded this reward data file: { "Coins" : 10 } In Unity, I am accessing this by using System.Text.Encoding.UTF8.GetString(quest.Milestone.CompletionRewardData) Which returns: { "Coins" : 10 } My question is, how do i then turn the variable coins into a c# variable for use in my app? Any help is greatly appreciated, thanks.
We're using JSONObject in Unity to create and parse JSON, it's quite easy to use. string reward = "{ \"Coins\" : 10 }"; JSONObject rewardJSON = new JSONObject(reward); int coins = int.Parse(rewardJSON.GetField("Coins").ToString());
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c#, android, json, unity3d, google play games" }
node console.log() output array in one line I use node `v10.6.0`. Here's my codes: console.log([{a:1, b:2}, {a:1, b:2}, {a:1, b:2}]) console.log([{a:1, b:2}, {a:1, b:2}, {a:1, b:2}, {a:1, b:2}, {a:1, b:2}, {a:1, b:2}, {a:1, b:2}, {a:1, b:2}, {a:1, b:2}]) the output is as following: [ { a: 1, b: 2 }, { a: 1, b: 2 }, { a: 1, b: 2 } ] [ { a: 1, b: 2 }, { a: 1, b: 2 }, { a: 1, b: 2 }, { a: 1, b: 2 }, { a: 1, b: 2 }, { a: 1, b: 2 }, { a: 1, b: 2 }, { a: 1, b: 2 }, { a: 1, b: 2 } ] How can I make the second array output in one line, instead of spreading to multiple lines.
Although the output is not exactly the same as if `console.log` is used, it's possible to use `JSON.stringify` to convert the array to a string, then print it: console.log(JSON.stringify(array)) Try it online! – Try It Online") It cannot process circular structures, however.
stackexchange-stackoverflow
{ "answer_score": 15, "question_score": 11, "tags": "node.js, console.log" }
Table or Collection view I'm creating a single column photo app with dynamic heights. Right now I'm using a tableview but I'm far from done. While I'm in the early stage of development & still new to objective -c, I'm wondering which would be the best solution for this app. I don't know why, but something tells me that a table view isn't the way to go. Should I use a Table or Collection view & why? Thanks in advance
Seems pretty much okay to use either. One thing to keep in mind is it is a bit easier to manage edit mode on a UITableView, so if you need that it might be best to stick with it. On the other hand, if you'd like to extend the same UIViewController to work on the iPad and display images in a grid, UICollectionView is probably your answer.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ios, cocoa touch" }
Finding the unconditional distribution I found two similar questions. One has a good answer What is the distribution of an unconditioned random variable knowing the conditional distribution? . I have a similar problem that I think should be **_much_** simpler. We have: > $ X \in U(0,1) $. > > $ Y|X=x \in U(0,x) $. From this I know how to calculate $ E[Y]=1/4 $ and $ Var(Y) $ but I want to find the distribution of $ Y $. $$ f_Y(y)= \int_{-\infty}^{\infty} f_{X,Y}(x,y) \,dx = \int_{-\infty}^{\infty} f_Y(y|x) f_X(x) \,dx $$ Now, $ f_X(x)=1 $ and $ f_Y(y|x)=1/x $. But I am completely lost at how to reason about the limits of integration here. Clearly the integral diverges unless I plug in something different, but what? Or is this the wrong way to tackle this problem?
> But I am completely lost at how to reason about the limits of integration here. Yes, and this is because the densities are **not** what you write. Rather, $f_X$ and $f(\ \mid x)$ are defined on the whole real line $\mathbb R$ by $$ f_X(x)=\mathbf 1_{0\lt x\lt 1},\qquad f(y\mid x)=\frac1x\cdot\mathbf 1_{0\lt y\lt x}. $$ Note that $f_X(x)$ exists for every $x$ and that, if $x$ is in $(0,1)$, $f(y\mid x)$ exists for every $y$. One usually extends $f(\ \mid x)$ by $f(y\mid x)=0$ for every $y$ if $x$ is not in $(0,1)$. Then, as you explained, for every $y$, $$ f_Y(y)=\int_{-\infty}^{\infty}f_Y(y\mid x)f_X(x)\mathrm dx, $$ that is, $$ f_Y(y)=\int_0^1\frac1x\mathbf 1_{0\lt y\lt x}\mathrm dx=\mathbf 1_{0\lt y\lt 1}\int_y^1\frac1x\mathrm dx=\text{____}\cdot\mathbf 1_{0\lt y\lt 1}. $$
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "probability, probability distributions, improper integrals, conditional probability" }
Exporting symbols rather than points in .dxf I have a map I've made in QGIS which is points from a .csv file. These have then be turned into different symbols based on what they represent and then the sizes of said symbols based on values in the .csv. I need to export this as a .dxf to use in AutoCAD so it basically looks the same as it does in QGIS. However, when I do so it just exports as single dots (points). Is there a way I can export them as the symbols as I can see in QGIS?
To export symbols not only geometry do not use Export layer but Project > Export > Export project to DXF: ![enter image description here]( ![enter image description here](
stackexchange-gis
{ "answer_score": 2, "question_score": 1, "tags": "qgis, export, autocad, dxf" }
month format php I am just a beginner in php. I am trying to print the array of months using the following code. <?php $totalmonth=12; for($startmonth=01; $startmonth<=$totalmonth; $startmonth++) { $montharr[]=$startmonth; } print_r($montharr); ?> My result is `Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9 [9] => 10 [10] => 11 [11] => 12 )` I need my result should look like this [0] => 01 [1] => 02 How can i do that?
Use str_pad. <?php $totalmonth=12; for($startmonth=1; $startmonth<=$totalmonth; $startmonth++) { $montharr[]=str_pad($startmonth, 2, "0", STR_PAD_LEFT); } print_r($montharr); ?>
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "php" }
Android: Recorded Video is not saved in Gallery I 'm creating the application to record the video and to display the recorded video. I followed < but video is started to record, and i stopped the recording. but it is not displayed in Gallery. Where it will be...? or anything i missed to save the recorded video?
Follow the Camera example that Android Developers supply on their Dev Guides.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "android" }
Cannot see the Glassfish adapter after installing plugin in Eclipse I've installed Glassfish 3.1.1 and Eclipse Indigo onto a Win 7 machine but cannot add the Glassfish server via Eclipse's Servers view. Oracle Glassfish Server Tools 1.8 is also installed but despite this there is no Glassifish entry in the list of avilable server adaptors. I will continue to scour the web for a way around this but if anyone can advise I'd be grateful. Thanks
You need to install the JavaEE development edition of Eclipse, and in that go to the Eclipse Marketplace where you can find and install the Glassfish adapter.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "eclipse plugin, glassfish 3" }
Edit the footer and delete any of the footer This is how I sit with a little problem that I can not take it away as has the red arrow and can not be right in the green arrow, how do I do it?, Hope you can help me further I want the RED AWAY! and the Greens I would be right, for example write something else or look like;) You can see it here !enter image description here
The red arrow is a module called "blockreinsurance". You can override this content by creating a template to the right folder : "themes/mytheme/modules/blockreinsurance/blockreinsurance.tpl" The green arrow is a mix of the footer and other modules, the easiest way to find out is to look at the source code, most of them have a comment before the block saying which module it is.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "prestashop" }
Setting all array elements to an integer I have an array, `int a[size];` I want to set all the array elements to `1` because some of the indexes in the array are already set to `1` so would it better checking each element using a conditional statement like, for (int index = 0; index < size; index++) { if (a[index] != 1) a[index] = 1; } or set all the indexes no matter what. what would be the difference?
Just set all the elements to 1. Code for simplicity and readability first. If you find that the code runs too slow, profile it to see where improvements need to be made (although I highly doubt performance problems can come from setting elements of an array of integers to a certain value).
stackexchange-stackoverflow
{ "answer_score": 14, "question_score": 4, "tags": "c++" }
edit image using php I am using php and I would like to a tool which help users cut their images using php. When a user uploads an image it is saved (for example as image1.png). I would like to know if there is a function which allows me to do it. What have I to do for example if I want to cut image1.png which has width and height 200px and make it have 100px width? Thank you for your time!
yes it is possible, use the php GD library, be sure it's installed on your server. see the imagecopyresampled coupled with imagecreatetruecolor functions for example
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "php" }
Magento 2: Override gallery.html file from vendor/magento/magento2-base/lib/web/mage/gallery How to override file from vendor/magento/magento2-base/lib/web/mage/gallery folder. I have to some changes inside gallery.html file and gallery.js file. How to override those file inside my custom theme. Thanks.
We have to just create **mage** folder inside our theme. Magneto2/app/design/frontend/{Vendorname}/{themename}/web/mage Keep gallery folder inside mage and remove var folder and apply command `php bin/magento setup:static-content:deploy` Its working fine.
stackexchange-magento
{ "answer_score": 4, "question_score": 3, "tags": "magento2, overrides" }
Ruby on Rails does not use the version defined in rbenv I want to use version 2.2.2 of Ruby, then r2d2@r2d2-acer ~/ApenasMeu/myapp $ rbenv global system r2d2@r2d2-acer ~/ApenasMeu/myapp $ rbenv versions system * 2.2.2 (set by RBENV_VERSION environment variable) However, the default home page of RoR, it appears that use this version: > Ruby version 1.9.3-p484 (x86_64-linux) How to solve it?
If you're using bundler you can specify the ruby version in your `Gemfile` \- just add a line like `ruby "2.2.2"` to your `Gemfile` (I've always seen it at/near the top - not sure if this is required or just convention) and run `bundle install`.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "ruby on rails, ruby, rbenv" }
Java LWJGL - How can I add water to my 3d world? The title says it all, how can I implement a simplistic water system into my game? I am using Java LWJGL and OpenGL glsl shaders. I am still fairly new to game programming, and a complete noob in the use of shaders so some guidance and a thorough explanation would be great!
Well you could just start with a plane/quad with a static/animated water texture. From there you could maybe make an animated mesh with a texture. If you want to get into shaders, then you'd have to research the optical physics of water before trying to develop any
stackexchange-gamedev
{ "answer_score": 0, "question_score": 0, "tags": "java, shaders, lwjgl, water" }
I want to get incomming call number and compare it Hello i want to get and compare incomming call number, it works but not as I want. When im calling from good number it print that I was calling form saved number when the number is stop calling i need to do it on start. And `else` is printing when nobody is calling. How can i do it? Here is my code: String d = ""; void setup() { Serial.begin(9600); Serial1.begin(9600); Serial1.println("AT"); delay(500); Serial1.println("AT+CLIP=1"); delay(1000); Serial1.println("AT+CPIN=1439"); } void loop() { d = Serial1.readString(); if(d.indexOf("xxxxxxxxx") >=0) { Serial.println("call is from saved number"); } else { Serial.println("call is not from saved number"); } }
The Arduino Serial class member function `readString()` has a builtin timeout. The function will return on timeout. The default timeout period is 1000 ms. The timeout can be set with `setTimeout()`. The sketch needs to filter out empty lines (timeout). This can be done by adding a check of the string length. See below for an example of checking: void loop() { String d = Serial1.readString(); if (d.length() == 0) return; Serial.print(d); if (d.indexOf("xxxxxxxxx") >= 0) { Serial.println(": call is from saved number"); } else { Serial.println(": call is not from saved number"); } } Cheers!
stackexchange-arduino
{ "answer_score": 1, "question_score": 0, "tags": "arduino mega, arduino ide, gsm" }
only one central vertex > Let $T$ be a tree and let $m$ be the legnth of the longest path in $T$. Prove that the center of $T$ consists of exactly one point if and only if $m$ is even. So lets start by doing $\Rightarrow$ We can assume that the center of T consists of exaclty one point. So this points minimizes $$ M(v) = \min_{w\in V} M(u) $$ And length is the maximum path that can be undertaken from this point, lets call it point $v_u$. Now lets define $m$: $$ m = \max_{u\in V}d(v_u,v) $$ Now my intuition tells me to prove the "$\Rightarrow$" by contradiction; lets assume that $m\neq$ even. But I cannot go on after this. Any pointers?
Let $v$ be a vertex in the center, let $d$ be the maximal length of paths starting in $v$, let $k\ge1$ be the number neighbours $w$ of $v$ such that there is a path of length $d$ starting with $vw$. If $k>1$, show that $m=2d$ and that no other vertex is in the center If $k=1$ and $w$ is that unique neighbour, show that $w$ is also in the center and that at least one path $vu_1u_2\ldots u_{d-1}$ (with $u_1\ne w$ and $u_{d-1}$ a leaf) exists and thet $m=2d-1$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "graph theory" }
Structures contained in the .pdata section I need to read the ".pdata" section of a x64 PE file. I've seen that the structures in the ".pdata" section differ from one platform to another < It also says the same thing in the PE specifications document. But I dont understand what it is for the regular windows (XP/Vista/Win7 etc.) Does anybody what it is?
The _.pdata_ section is an array of RUNTIME_FUNCTION. It gives you a code range (first two members) and an RVA to the corresponding UNWIND_INFO. From there you get info like exception handler RVA, size of prolog, etc.
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 8, "tags": "windows, 64 bit, portable executable" }
Where is the Crashlytics log file located for the new Firebase Crashlytics SDK For the previous Crashlytics SDK (Fabric) the file location of the logging was: On Linux / Windows: /.crashlytics/com.crashlytics.tools/crashlytics.log On Mac: ~/Library/Caches/com.crashlytics/com.crashlytics.tools/crashlytics.log Since I started using the new Firebase Crashlytics SDK nothing is getting logged there anymore. I tried to search for other locations the file could be, but I couldn't find anything at all.
Firebaser here - There is indeed no longer a crashlytics.log file. That information still exists if you invoke your symbol upload task with `--debug.` So if you have native symbol file upload enabled in Gradle, that may look like (all on Mac): `./gradlew app:uploadCrashlyticsSymbolFileDebug --debug` or `./gradlew app:assembleDebug --console=plain --debug` You may also see a lot of output irrelevant to Crashlytics. However your command looks, you may want to pipe a filter: `./gradlew ... | grep "[com.google.firebase.crashlytics]"` Finally, it can be inconvenient to be looking at the terminal or the logcat in Android Studio, so you may want to just save that output to a file: `./gradlew ... > crashlyticslog.txt`
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "android, firebase, logging, crashlytics, crashlytics android" }
Raspberry Pi analog read Trying to get the value from Arduino analog pin 0 to be shown as a live value in Tkinter but I'm new to Python. from Tkinter import * import RPi.GPIO as GPIO import time from pyfirmata import Arduino, util from time import sleep board = Arduino ('/dev/ttyUSB0') GPIO.setwarnings(False) ------------------------BOTTOM of the code---------------------------------- root = Tk() frame = Frame(root,height=500,width=500) frame.pack() root.title("Relay Controle") # Raspsberry output pin 11 / relay relayButton = Button(root, text="Turn RELAY On", command=relay) relayButton.place(x=10,y=2,) # Arduino maga: led button ledButton = Button(root, text="Turn LED pin 13 On", command=led ) ledButton.place(x=130,y=2,) # value print out # Quit Button quitButton = Button(root, text="Quit", command=func1 ) quitButton.place(x=444,y=470,) root.mainloop()
root = Tk() frame = Frame(root,height=500,width=500) frame.pack() my_label = StringVariable() label = Label(frame,textvariable=my_label) label.pack() def updateLabel(): my_label.set("%0.2f"%board.analog[0].read())) root.after(100,updateLabel) root.after(100,updateLabel) root.title("Relay Controle") this just calls updateLabel every 100 miliseconds ... updateLabel then refreshes the stringvariable with the new value from the analog read ... per the docs to read an analog pin #setup to recieve analog data it = util.iterator(board) it.start() board.analog[0].enable_reporting() # later to read board.analog[0].read() or you get an instance of the analog pin early analog_0 = board.get_pin(’a:0:i’) #then later you can read it analog_0.read() so my guess is maybe you arenot doing that setup part
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "python, tkinter, arduino, raspberry pi" }
Issue with custom webkit scrollbar ![enter image description here]( I'm making a custom scrollbar with css but as you can see in the picture the corner of the scrollbar track isn't like what I need, I have tried border radius for bottom right and top right but no luck, any help would be appreciated! ::-webkit-scrollbar-thumb { background: url("/assets/scrollbar.png") no-repeat; background-size: 9px 150px; display: block; } ::-webkit-scrollbar-track-piece { background: grey; }
Thanks to a guy in my team, we managed to solve the issue by adding the background to webkit scrollbar track.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "css, scrollbar" }
VS 2012 & IIS Express. Could not find a part of the path 'C:\Program Files (x86)\IIS Express\~\MyPics\My.jpg' I am developing a Asp.Net MVC 4 application using VS 2012. The application when running in local is using the IIS Express as web server.I am facing issues in trying to access a file which is part of my solution. I have the following action method : public FileContentResult GetImage() { byte[] imageByte = System.IO.File.ReadAllBytes(@"/MyPics/My.jpg"); string contentType = "image/jpeg"; return File(imageByte, contentType); } In the first line, I am getting the following error : Could not find a part of the path 'C:\Program Files (x86)\IIS Express\~\MyPics\My.jpg' I know that the above path is not correct but I am not able to understand what path I should provide in order to solve this problem. Regards Pawan Mishra
You can use Server.MapPath() to get the actual directory like this: byte[] imageByte = System.IO.File.ReadAllBytes(Server.MapPath("~/MyPics/My.jpg")); Some people advocate using HostingEnvironment.MapPath() instead: What is the difference between Server.MapPath and HostingEnvironment.MapPath?
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 0, "tags": "c#, visual studio 2012, iis express" }
Is it possible to use in IDEA -Dfoo.path=${env_var:FOO_ENV_KEY}? -Dfoo.path=${env_var:FOO_ENV_KEY}? ${env_var:FOO_ENV_KEY} Looks like no, works only -Dapp.log.path=BAR_ENV_VALUE. If yes, how?
You can define environment variables in the Edit Configuration Dialog of IntelliJ which eliminates the need for bash parameter substitutions.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, intellij idea, ide, environment variables, runtime" }
should i install LVM in ubuntu server? should i install LVM in ubuntu server? i have only one primary partition. what happens if i dont install it?
LVM helps you organize and reallocate disk space better. It isn't required in most cases, but it causes only very little slowdown (2% maximum, if that) for a lot of benefit if your disk/volume configuration changes.
stackexchange-superuser
{ "answer_score": 2, "question_score": 2, "tags": "linux" }
oracle apex interactive report based on temporary table I have an interactive report, which retrieves all records from a temporary table. The insertion to the temporary table is done through a button **search** (which is on the same page) and with a pl/SQL dynamic action. The insertion takes place successfully. After this, I refresh the interactive report region using javascript code pasted below. But the interactive report does not retrieve any row from the temporary table after the region is refreshed. Has anybody solved it? $('#temp_rpt').trigger('apexrefresh');
The problem was on the Temporary table query. I altered the table query " ON COMMIT DELETE ROWS " into " ON COMMIT PRESERVE ROWS ", and it works correctly now.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "javascript, oracle apex 5" }
SDL Get Keyboard State without using Events Does anyone know how to get SDL_GetKeyState to work properly, without having to setup a loop which polls the SDL Events? int *keystates; keystates = SDL_GetKeyState(NULL); SDL_PumpEvents(); std::cout << "Test 1\n"; if (keystates[SDLK_F1]) { std::cout << "Test 1 Okay\n"; key_ac = true; emu->setPower(true); } This code is run over 100 times a second, however even when I hold down the F1 key, I still do not get any output to say it was successful. I have no SDL event loop, so could this be that events are being discarded because I'm not using them? In which case, how could I get SDL to filter out all events?
`SDL_GetKeyState()` only has to be called once at the start of your program. unsigned char * keys = SDL_GetKeyState(NULL); Then the value it returns, a unsigned char pointer to an array is stored internally. To to update the state of the array call the function `SDL_PumpEvents()`. To update array `keys` in your main loop: SDL_PumpEvents(); if( keys[ SDLK_m ] ) { //do stuff } EDIT: You can call `SDL_GetKeyState()` as much as you want after the first call and you won't create a memory leak. The function is always returning the same pointer.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "c++, events, keyboard, gtk, sdl" }
SQL Select, different color depending on result number I have an SQL SELECT statement and after executing this I have a While statement to display every record in a div. These div are all under one another and I want the divs to alternate in color. So like this: Result 1 = white div Result 2 = grey div Result 3 = white div Result 4 = grey div. I actually have no idea how to accomplish this, anyone who could help me? Thanks! EDIT: I can actually come up with the theory do to this, even numbers white, uneven numbers grey, but how do I code this?
You can do it just with css, like this: .resultdiv:nth-child(odd) { background-color: white; } .resultdiv:nth-child(even) { background-color: grey; } This will work just make sure you add `class="resultdiv"` to all divs you create in the while loop.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "php, sql, css, select, html" }
What is the meaning of the dative in this sentence: "Dem Tod die Toten." I came across the sentence _"Dem Tod die Toten"_ in a book I'm reading ("Der Schwarm" by Frank Schätzing) and I can not understand it. It seems like this use of the dative implies a meaning which in many other languages would be expressed by a preposition or a verb, like in "the death _of_ the dead" or "death _is for_ the dead" or similiar. What does this sentence mean? How could it be rewritten into a regular sentence with subject verb and object? > So sind wir Menschen. Auch um der Toten zu gedenken, brauchen wir Ankerpunkte der Trauer, damit wir den Schmerz hinterher in eine Kiste stecken und ein weiteres Jahr zwischenlagern können, und wenn wir ihn das nächste Mal auspacken, stellen wir fest: Wir hatten ihn größer in Erinnerung. Dem Tod die Toten.
It means "the dead _to_ Death", or slightly longer "The dead should belong to Death", i.e., the narrator argues that grief for the dead should be treated wisely so it does not take the grieving as hostages forever. It is natural to grief for the dead, but one must step away from the grief for prolonged stretches of time too, so that one can actually notice that the grief has become smaller, so it can eventually be cast off and no longer negatively influence the living.
stackexchange-german
{ "answer_score": 17, "question_score": 14, "tags": "meaning, dative" }
Why can I not access files on another computer on my network? I have set up the workgroup all to the same word, for this I'll replace it with SUPERUSER. When I try to access files from another computer which is also on SUPERUSER, a pop up comes up and says: > Windows cannot access \PC\d-drive\USER\IMAGES > > You do not have permission to access \PC\d-drive\USER\IMAGES. Contact your network administrator to request access. Both computers are on Windows 7 x64. Help would be much appreciated.
For the sharing issue, you can just create an admin account, give your name and password of it, and add the account to the permission list. If you do not would like to do this (as you choose the option "password protect off"), you can modify this group policy: Computer Configuration-> Windows Settings ->Security Settings ->Local Policies ->Security Options, find this: Network access: Sharing and security model for local accounts < <
stackexchange-superuser
{ "answer_score": 1, "question_score": 2, "tags": "windows 7, networking, permissions, file sharing, workgroup" }
Como verificar se um ResultSet está vazio? Estou fazendo uma consulta no MySQL e quando a consulta existe ele retorna os valores de boa. Mas eis a pergunta, o qual valor o `ResultSet` recebe quando a busca não existe? Tipo procuro por um nome nos registros da tabela se esse nome não existe no banco o que é retornado? Já procurei na internet mas não encontro nada relacionado.
Você pode verificar se o método `ResultSet.html#isBeforeFirst` retorna falso: con = DriverManager.getConnection( ... ); stmt = con.prepareStatement( ... ); ResultSet rs = stmt.executeQuery(); if (!rs.isBeforeFirst() ) { // Não há dados, faça algo aqui... } O `isBeforeFirst` vai retornar `false` se o _cursor_ não estiver antes do primeiro registro ou se não tiver linhas no `ResultSet`, ou `true` caso contrário.
stackexchange-pt_stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "java, mysql, java 8" }
Riverpod - How to wrap a PreferredSizeWidget inside a Consumer I have a `DefaultTabController` and I have a method that returns `List<PreferredSizeWidget>` which are the `AppBar`'s of pages. I want them to watch a state in a `ChangeNotifier` and therefore I want to wrap them inside of a `Consumer`. When I try to do so I get an error like this: "The argument type 'Widget' can't be assigned to the parameter type 'PreferredSizeWidget'." How can I fix this? Thanks and regards.
The error comes from the `appBar`'s parameter of `Scaffold` requiring a `PreferredSizeWidget`. I can think of two solutions : * You can wrap your `Consumer` with a `PreferredSize` and use `Size.fromHeight()` as `preferredSize`. That is if the height is constant amongst your appbars. * You can avoid using the `appBar` parameter altogether by wrapping your `Scaffold`'s body with an `Expanded` inside a `Column`, and making the `Consumer` its first child.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "flutter, dart, flutter provider, riverpod" }
how to get animated gif image from browser clipboard api? I am testing the following code, and when I copy an animated gif and paste it to web page, I see `image/png` in the console - instead of `image/gif` as expected. Why? document.onpaste = function(event) { console.log(event.clipboardData.items[1]['type']); // 'image/png' }; How can I match a gif image? You can test it at this jsfiddle with this gif image for example.
The CF_GIF clipboard format is very seldomly used. Most app copy images to the clipboard only as CF_BITMAP, CF_ENHMETAFILE, or CF_DIB. Then when you paste, the data is converted to whatever format the target application perfers, such as PNG or Bitmap. So in your case, the GIF was likely copied to the clipboard as a Bitmap, then converted to PNG when pasting. All of the animation frames of your GIF were lost. In order to preserve, you need to do drag/drop or emulate file pasting with CF_HDROP, CF_FileName, etc..
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 10, "tags": "javascript, google chrome, clipboard, copy paste, clipboarddata" }
More than 255 characters in multiple lines of text? I have an InfoPath Form which submits the text of a textbox and saves it in a SharePoint list. Whenever a user types in more than 255 characters and I want to edit the element in the SharePoint list (e.g. change the value of a custom field) an error appears that the textbox cannot contain more than 255 characters. It's weird because initially the column can contain more than 255 characters but as soon as I want to edit the element, I get this error. My question is: How can I turn off the limitation OR how can I display a character counter next to my InfoPath textbox? Thanks for your help
You have to check the "Allow unlimited length" checkbox on the list column's properties page.
stackexchange-sharepoint
{ "answer_score": 23, "question_score": 10, "tags": "content type, infopath, column" }
Replace log4j Conversion pattern with sed I am trying to replace whenever the actual text contains need to be replaced with text output in sed. It doesn't work to me. Actual Text : %d{ConversionPattern} %-5p [%c{1}] %m%n Text output which i need %d{ConversionPattern} %-5p [%c{1}] [%t] - %X{Sample} - %m%n Command : sed -i "/<param name=\"ConversionPattern\" value=\"%d{ConversionPattern} %-5p [%c{1}] %m%n\"\/>/s@@<param name=\"ConversionPattern\" value=\"%d{ConversionPattern} %-5p [%c{1}] [%t] - %X{Sample} - %m%n\"\/>@"
With your shown samples, please try following. sed -E 's/(.*\])[[:space:]]++(.*)$/\1 [%t] - %X{Sample} - \2/' Input_file _**Explanation:**_ Using `sed`'s substitution capability and substituting everything from starting to till `]` and keeping it in 1st back reference, then keep everything after it into 2nd back reference. While substituting it mentioning `- %X{Sample} -` between 2 of the back references values to insert new text. _**NOTE:**_ Above code will print the output on terminal, once you are happy with above results, then you could run above command with `sed -i` option to perform an in-place save.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "linux, shell, awk, sed" }
Express Running time in Big Theta Notation ? For this pseudocode, how would I express the running time in the Θ notation in terms of n? s = 0 for i = 0 to n: for j = 0 to i: s = (s + i)*j print s
The assignment s = (s+i)*j has constant time-complexity Θ(1). For each i the inner loop gets executed exactly i times, whereas i is iterated from 0 to n. So the body of your loop (eg. the assignment) is executed 1+2+3+...+(n+1) = (n+1)(n+2)/2 = Θ(n^2). As the body of the loop is Θ(1) you get Θ(n^2) for the whole program noting that the first and last lines are just Θ(1) so you can ignore them.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "analysis, notation, big o" }
How to fulfil Visual Studio demand for self-hosted docker build agent? I've successfully setup and run a self hosted docker build agent using the instructions here: < however VS builds won't run on that agent because it doesn't fulfil a demand for Visual Studio. So my question is How do install Visual Studio in the docker build agent? However I've got a feeling this is the wrong question as the project can be build from the command line using dotnet, so an alternative question might be How to I remove this demand for VS from my build pipeline? I can't see as I've declared this demand anywhere in the YAML.
> How do install Visual Studio in the docker build agent? For this issue, you can install Visual Studio Build Tools in docker file and then use the built image in the container. For details, please refer to this official document.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "azure devops self hosted agent" }
How to hide ARIA-LIVE from screen readers but make they will can read content inside? I have on page ARIA-LIVE block like this: <div aria-live='polite' role='log' aria-relevant='additions' aria-atomic='false' style='position: absolute; width: 1px; height: 1px; margin-top: -1px; clip: rect(1px, 1px, 1px, 1px); overflow: hidden;'> <div>message</div> <div>message</div> </div> And now, if i using keyboard arrows, screen reader can reach aria-live zone, it is located at the very bottom of the page, and read content which he contain. Is there a way to hide the aria-alive zone but at the same time make it so that the content in it is still normally read by the reader?
That's kind of like asking how can one apply CSS `display:none` to an element but still allow the element to be seen. You can hide elements from a screen reader by specifying `aria-hidden="true"`. If you also have `aria-live`, then any updates to that element will be hidden from screen readers, essentially negating the purpose of having `aria-live`. About the best you can do is associate a label with that region to say "this element is for announcing dynamic updates", or something like that. A screen reader user may find it, but it doesn't hurt anything. They can easily ignore it and move on to the next element.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "accessibility, wai aria, screen readers, nvda" }
Wrong number associated with specific Tag When I check the number of my tags, can see ![Bug count not correct]( I'm particularly interested in the bug count. It has 0 bug x5. When I check all my posts related with the tag bug, ![Bug count]( There's 6 results with a total of more than 20 upvotes. I know that tags counts are > denormalized, and updated periodically but one of the posts with upvotes is from 2019. Can see that a similar problem is happening in other tags, like "review", and I've read about tag calculation.
The score shown in the tags tab in your profile is only the score obtained from the non-CW answers. (And you have no answers in this tag.) The score in the tag is calculated in the same way for the purposes of the tag badges and in the list of top answerers. See also here: Explain tag numbers in profile? Actually, if you hover over the number next to the tag, you are shown a more detailed information. ![screenshot]( It might also be worth mentioning that the scores in the profile aren't updated immediately. (See: Tag numbers in profile delayed?)
stackexchange-meta
{ "answer_score": 3, "question_score": 4, "tags": "discussion, bug, tags" }
How to find graph schema in Gremlin? I wanna to find all node and edge properties in graph. How can I list node (or edge) properties that exist in graph? for example if nodes has 3 non-reserved properties such as NAME, education, gender. I wanna a methods like g.V().schema().toList(); // result: [ID, LABEL, NAME, GENDER, EDUCATION]
If all nodes have a same properties. we can find the properties of the first vertex and generalize it to all nodes: TinkerGraph tg = TinkerGraph.open() ; tg.io(IoCore.graphml()).readGraph("src\\main\\resources\\air-routes.graphml"); GraphTraversalSource g = tg.traversal(); g.V().propertyMap().select(Column.keys).next(); // result = {LinkedHashSet@1831} size = 12 // 0 = "country" // 1 = "code" // 2 = "longest" // 3 = "city" // 4 = "elev" // 5 = "icao" // 6 = "lon" // 7 = "type" // 8 = "region" // 9 = "runways" // 10 = "lat" // 11 = "desc" but If there is no guaranty to each node has a same set of properties, I don't find any other solution instead of retrieving all properties in a Map List and find distinct property with java collection methods (outside Gremlin).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "java, gremlin, tinkerpop3" }
CMake: how to specify different steps for different build configurations for Visual Studio? Let's say, now I have a step add_custom_command(TARGET MyTarget POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy ${PROJECT_ROOT}/libs/somelib/Debug/lib.dll ${PROJECT_ROOT}/bin/Debug/ COMMENT "Copying dependency dll to output directory" ) I want to change it so that, if Visual Studio build is called for Debug configuration, it uses different paths from when it is called for Release configuration. How to achieve this?
You can use generator-expressions as arguments for `add_custom_command`. E.g., expression `$<CONFIG>` is evaluated to the build type, `$<TARGET_FILE_DIR:MyTarget>` is evaluated to the directory, where executable or library is generated.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "visual studio, cmake" }
Difference between Golang struct literals & pointers when accessing struct fields I don't understand the difference between a struct literal and a struct pointer **when accessing struct fields**. Is there any different internal behavior ? type Person struct { Name string } p := &Person{Name: "Alice"} u := Person{Name: "Bob"} fmt.Println(p.Name) // any difference ? fmt.Println(u.Name) // any difference ? I searched for this but posts I found all explain about difference between value & pointer, or "passing a value" vs "passing a pointer" to a method. They are not what I want to know.
`u` is a variable of type `Person`. `p` is a variable of type "pointer to `Person`", and it is initialized with the address of an anonymous ("temporary") object. The expression `p.Name` uses auto-dereferencing of pointers and is equivalent to `(*p).Name`. The object that `p` points to lives as long as `p` points to it and may thereafter be destroyed by Go's non-deterministic memory manager. Both `p.Name` and `u.Name` are expressions of type `string`, and they're not "passed by pointer" since their address is not taken in the call. In the case of `fmt.Println`, the value is actually passed "by interface" using Go's structural subtyping form of ad-hoc polymorphism.
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 5, "tags": "pointers, struct, go" }
Downloadable Mp3 Files hello there i am constructing a site where i can upload my own mp3 files. So i have the file uploaded to the server and when i link to it the browser plays the song. Is it possible to make it so when the link is press it downloads the file instead of playing it. For example www.example.com/music/song.mp3 once clicked it downloads instead of playing. Maybe this could be done in JavaScript? Thanks so much.
You need to set the correct header for your mp3 files. You can do that in your web server's configuration, or you can make a "download" script that will send the correct header, and the contents of the mp3 file If you ware using PHP, for instance, you could do something like this (from the PHP manual): <?php // We'll be outputting a PDF header('Content-type: audio/mpeg'); // It will be called file.mp3 header('Content-Disposition: attachment; filename="file.mp3"'); // The PDF source is in original.mp3 readfile('original.mp3'); ?>
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "javascript, jquery, html, mp3" }
Creating iframe by javascript I have a main page that include a javascript that was creating an iframe dynamically same below: <script> document.domain = "mydomain.com" var iframe = document.createElement("iframe"); document.body.appendChild(iframe); // creating other element in ifram dynamically </script> But in IE I kept receiving a security warning because of document.domain = "mydomain.com" (I need document.domain and I can not remove it). I found a solution for IE8. this is the solution : var u = 'javascript:(function(){document.open();document.domain="mydomain.com";document.close();})()'; iframe.src = u; But it does not work on IE6. Is there any solution for my problem? **Note:** I want to create other element in iframe by script and I want to load the content of iframe by src.
Create the iFrame using innerHTML. Write the full HTML for the iFrame including the SRC attribute. Then find your element and set innerHTML to the string with the iFrame source.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, iframe" }
Updating table column date with case expression? I need to update `column8` with data depending on two other columns with dates (`date1` and `date2`) - if `date1` is later than `date2` then `column8` is `YES` otherwise its `NO`. I wrote this: update table1 set delay = case when date1 > date2 then 'YES' when date2 is NULL then 'YES' else 'NO' end The problem is that it is probably not comparing the dates but length of the expression, because I have no in every column except for null columns... It tells me that it probably does not know I want it compare as a date But the columns in database are in date format `YYYY-MM-DD`. Is there any way to update my code or in adding something to make compare the dates and not the string lengths? Thanks!
You can try CAST function: WHEN CAST(date1 AS DATE) > CAST(date2 AS DATE)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sql, sql server, date, sql update, case" }
Cell background image mode I have a cell in a `UITableView` that has an image as a background using the `colorWithPatternImage`. I would like to set a mode on this image to fit the cell, i.e. `UIViewContentModeScaleAspectFill`, etc. (I'll go through and find the best one for my use) Here's my code: - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { if((indexPath.row)==1) cell.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"homeScreen-buttons.jpg"]]; } So how can I edit my code to add what I need? Thanks
You can set the `contents` of the cell's layer, try this: cell.layer.contents = (id)[UIImage imageNamed:@"homeScreen-buttons.jpg"].CGImage;
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ios, objective c, uitableview" }
No such module 'mailcore' I had tried to integrate the `mailcore2-ios` pod for `smtp` purpose after installation when I tried to give import `mailcore` it says no such module '`mailcore`' even inside that pod file no file directory present but pod file installed. Please any help me for how to resolve this issue.
Please add pod like pod 'mailcore2-ios' Then run a command like `pod install` after a while it looks like this. ![enter image description here]( []( if you want to use this pod just write import Pods_MailcoreDemo And you are ready to use.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "swift, smtp, mailcore2" }
Eclipse and clip board In Eclipse is there a provision to copy multiple items and then paste the items selectively from the clip board? IntelliJ has this feature and I used to find it very useful. Does Eclipse have this and if so what is the key board short cut to view items in the clip board?
There is a multi-clipboard plugin to do just that.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 5, "tags": "java, eclipse, intellij idea" }
Adding confirmation inside validation of editable not working I am using editable for my datepicker. I am trying to have some confirmation in my validation but it does not work. Is there something wrong? Here is my code: $('inputdate').editable({ type: 'date', params: function(params){ params.dateVal = dateVal; return params; }, validate : function(value){ var message = null; confirm("Are you sure you sure?", function(result) { if(result){ //ajax call here } }); }); return message; } else return 'Notif'; }, url: url2, success: function(response){ location.reload(); } });
Your usage of method **confirm** is wrong, you can read about that method here You can used code like this: if (confirm('question')){ console.log('yes') } else{ console.log('no') } **EDIT** Using bootbox use this code bootbox.confirm("Are you sure?", function(result) { Example.show("Confirm result: "+result); });
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, x editable" }
Adding Border Radius To a Table I have the following line for my table in HTML. How do I add a 10px radius to all the 4 corners? <table id="Table_01" width="929" height="650" border="0" cellpadding="0" cellspacing="0"> As i am a newbie, I don't know what other information I must include. Please help me do this possibly by adding something like border-radius:10px to the above line. Thanks.
If you can't write in a CSS file, then you can write it inline, like so: <table style="border-radius: 10px;"> But keep in mind that writing styles inline is not a very good practice.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, web" }
Showing that $\sum^\infty_{n=1}\left(\sin\left(\frac{1}{n}\right)-\ln\left(1+\frac{1}{\sqrt n}\right)\right)$ diverges Separately, I can show that both parts of the sum diverge, but that doesn't help me very much. I don't see any test which could come in handy. I know both sides of the sum have popular Taylor forms, so I can partially represent them as such around $x=0$, but my question then what do I do with the remainder?
$$\begin{split}\sin\left(\frac 1 n\right)-\ln\left(1+\frac 1 {\sqrt n}\right)&=\left[\frac 1 n +\mathcal O\left(\frac 1 {n^3}\right)\right]-\left[\frac 1 {\sqrt n}-\frac 1 {2n}+\mathcal O\left(\frac 1 {n\sqrt n}\right)\right]\\\ &=-\frac 1 {\sqrt n}+\frac 3 {2n}+\mathcal O\left(\frac 1 {n\sqrt n}\right)\\\ &\sim -\frac 1 {\sqrt n}\end{split}$$
stackexchange-math
{ "answer_score": 0, "question_score": 2, "tags": "sequences and series, taylor expansion, divergent series" }
flex plug-in for myeclipse Is there any plug-in for flex in order to develop it on myeclipse? Thanks.
Since myEclipse is essentially Eclipse, there are couple of options. 1. Flash Builder 4 by Adobe < 2. FDT < 3. Not Eclipse plugin, but worth trying. FlashDevelop, free but stand-alone application < Also I heard people using ASDT plugin < never tried it but I guess it's also worth mentioning.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "apache flex, flex4, myeclipse" }
Pre-compiled Entity Framework 4 Built from Edmx targeting SQL Server Safe for use with SQL CE? I'm using the following T4 template (< to pre-compile my Entity Framework 4 "Views" from a EDMX targeting an existing SQL Server 2008 database. (aside: this does help speed up the performance hit on the first `SaveChanges` \-- I have over 200 tables and the first `SaveChanges` went from 10 seconds to 5 seconds -- still not impressed but an improvement). My question is: are these pre-compiled views still "safe" to use with SQL CE 4 (i.e. in unit tests) or are they tied to SQL Server 2008? I ask because the generated view file appears to contain SQL statements and I wonder if they might be provider specific.
The EDMX file has SSDL information which has hard coded provider specific detail. Here are some articles explaining the procedure to change the provider * Preparing an Entity Framework model for multi provider support * Multiple database support with Entity Framework Regarding the performance issue you maybe able to split your database into multiple EDMX files. For example having separate contexts for "Marketing" and "Sales".
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": ".net, entity framework, entity framework 4, sql server ce, edmx" }
Why jQuery-migrate in not replacing depreciated functions directly in the code? Im using jQuery-migrate on a big project. I corrected all the warnings I could but now the warnings are inside libraries. Some libraries are not updated anymore so I can't update them to make them work with jQuery-3.3.1. Also, I can't replace the depreciated functions directly in the libraires because it is creating errors. So I think that I'll keep jQuery-migrate in my project. **My question is** : If jQuery-migrate is able to correct the depreciated functions when called, why it can not correct them directly in the code ?
JavaScript does not lend itself to static code analysis. Say you needed to replace the `foo` function. That would be fairly trivial if the code that called it was simply: something.foo(); It becomes rather harder if it is: function call(bar, method) { bar[method](); } call(something, "foo"); … and even harder if the logic needed to get there was more complicated. * * * Creating `something.foo` so it _just exists_ if anything try to access it at runtime is much simpler.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, jquery migrate" }
How can I change second background-image url with JavaScript/jQuery I have a element with following style: .element { background: transparent url(backgroundimage1.png) no-repeat, transparent url(backgroundimage2.png) no-repeat; } Is it possible to change only the second background url using JavaScript or jQuery without a lot of code?
Yes it is possible with a little string manipulation using jQuery. var first_background = $(".element").css('background').split(',')[0]; var second_background = $(".element").css('background').split(',')[1]; var new_background = //add new background here. $(".element").css('background', first_background + ',' + new_background); And you're done.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "javascript, jquery, css" }
Why do I only get one daily quest? I started playing Hearthstone and finished the tutorial and my first daily quests yesterday. As far as I understand I should get three new daily quests each day. I only got one daily quest this morning. Did I misunderstand this and do I only get one daily quest? Or do I have to do something specific to get the other ones?
You gain only one daily quest, but you can have up to 3 quests at the same time (source). Note that you can abandon up to 1 quest a day and receive immediately another random one in its place.
stackexchange-gaming
{ "answer_score": 11, "question_score": 7, "tags": "hearthstone" }
How to redirect multiple to a single page but with different URLs I am a beginner in practical web development.My situation is as follows I have a number of questions in my database and I provide a long list of links clicking on which the user can see each question in more detail.The strategy I am using is something like `www.mydomain.dom/questions/view.php?id=465` i.e I am passing the `id` of the question as GET to `view.php` which displays details. Now I want the URL something like `www.mydomain.com/questions/category_of_question/title_of_question/` i.e I want to append the question details from the database as if it appears that I have different page for each question though at the backend I am still using the page `view.php`. I have heard of pretty URLs where you can hide page extension but I couldn't how I can use it in my scenario. Any help?
If you are using Apache, Enable mod_rewrite. And add a .htaccess ` # Turn on URL rewriting RewriteEngine On #Allow any files or directories that exist to be displayed directly RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d #Rewrite url to the variable id RewriteRule ^(.*)$ view.php?id=$1 ` Now you can use the url like this, www.mysite.com/1/, it's the same as this www.mysite.com/view.php?id=1 . This will transfer all the urls in your website to the view.php If you want it only with a specific keyword (question) do this, you need to change the last line with this one. ` RewriteRule ^question/(.*)$ view.php?id=$1 ` Now your url would look like, mywebsite.com/question/1
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "php, .htaccess, url, web" }
Properties lost when going from real number system to quaternions and octonions What properties do we lose as we go from real numbers to quaternions, then to octonions? Do any new properties arise, or do calculations just become more "path dependant"?
From reals to complex you lose order. From complex to quaternions you lose commutativity. From quaternions to octonions you lose associativity. From octonions to ..? I had written this as a comment, then I followed Noah Schweber's link, which essentially says this plus more. And pregunton's answer is meaty. What specific algebraic properties are broken at each Cayley-Dickson stage beyond octonions? EDIT: Bcpicao's comment led me to < a fabulous link.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "complex numbers, real numbers, quaternions, octonions" }
Android: Should the GCM SENDER_ID be kept secret? I'm a little bit confused here, i'm using the new `GCM` service and of course i have to declare the `SENDER_ID` in my `MainActicity`, i'm just curious about the security here, if someone de-compile my APK he would see my `SENDER_ID`, right ? Shouldn't it be kept secret ? or it's enough to keep the `API` key secret ?
> Shouldn't it be kept secret ? No, it's not required to keep it secret. If anyone decompile your APK and find anyhow your sender ID then hacker cant do anything. Because to push GCM notification it's required to have API key of Server which is available to owner only.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "android, google cloud messaging, sender id" }
SQL Server 2008 GUID column is all 0's I'm hoping this is a simple goof I did on my end ... I have a table in my database set up like so: column name: widget_guid data type: uniqueidentifier allow nulls: false default value: newid() identity: false row guid: true When records are created (via LINQ to SQL) that the values in this field are formatted as a GUID but contain all 0's My assumption was that when a new record was created, that a guid would be autogenerated for that column, much like an auto-incrementing row id. Is this not true? Any help would be greatly appreciated. Thanks.
You need to check your properties on the GUID column - what you need to make sure is: * `Auto Generated Values` is set to `True` (so you basically tell Linq-to-SQL that the database will generate the value) * `Auto-Sync` should be set to `OnInsert` so that your C# object will be populated with the new value after you've called `context.SubmitChanges()` With these two settings, you should get the expected behavior: no need to set the GUID on the client side, the database will generate a new value and insert it, and you'll get it back right after the call to `.SubmitChanges()` !alt text
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 3, "tags": "sql, linq to sql, sql server 2008, guid" }
What windows form component would best be used to create a log file viewer C# I have a quick question. Really appreciate any help. I'm planning to create a simple log file view in c#. A windows form will display the content of a log file. The form will periodically update to view the latest logs and will always scroll down to the latest log. Which windows form component would best be used to create such view? Thanks
I would use a `GridView` if planning to parse and decompose the log content or a simple multiline `TextBox` if you plan to do not parse log content and simply show it. about Grids, I like the DevExpress XtraGrid which has tons of features and is highly customizable (if you need advanced features, no code excel/pdf export, print preview, send via email etc....) about text boxes, this is surely the best and has so many features.... ScintillaNet
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "c#, winforms, logging, tail" }
Mechanism of substitution reaction with no change in stereochemistry > When (2​ _S_ ,3​ _R_ )-3-iodobutan-2-ol undergoes a substitution reaction with sodium azide the only organic product from the reaction is (2​ _S_ ,3​ _R_ )-3-azidobutan-2-ol. Give a mechanism for the reaction. **My Attempt** Now I know this is not a normal $\mathrm{S_N1}$ or $\mathrm{S_N2}$ reaction since the stereochemistry remains the same and only one of the enantiomers are formed. I am guessing that at first there is some intramolecular reaction where the iodine atom attacks the other carbon bonded with the hydroxyl group. Then the azide substitutes the iodine atom.
I can explain the reason why the configuration does not change by using neighboring group participation of the hydroxyl group. This is the mechanism that I propose: 1. The hydroxyl group attacks C-3 and $\ce{I-}$ leaves. 2. Then $\ce{N3-}$, the nucleophile, attacks C-3. 3. Since two successive inversions occur at C-3, the net result is retention. ![Mechanism]( As you can see, the configuration has not changed. * * * @bon brought up a point: The formation of a mixture of products when an epoxide opening takes place. If the nucleophile were to attack C-2 instead, ![Attack at alternative carbon]( C-3 will still have the _S_ configuration. * * * As noted by @Jan in the comments, the epoxide intermediate is symmetrical and both epoxide carbons are equivalent. This can be shown by a $C_2$ rotation: ![Epoxide symmetry](
stackexchange-chemistry
{ "answer_score": 11, "question_score": 8, "tags": "organic chemistry, reaction mechanism, stereochemistry" }
jquery - Why do we write .attr('selected','selected') with select tag why do we write `.attr('selected','selected')` with select tag For ex: $('#countryList option').filter(function () { return ($(this).text() == findText); }).attr('selected','selected'); }); What does it really means?
Explanation of `.attr('selected','selected')`. First argument inside `.attr` represent the `attribute` you want to pointing at while second argument set `value` of attribute which is passed as first argument. if we have just `.attr('selected')` then it just return the value of `selected` attribute.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "jquery, select, attr, selected" }
Can member-methods of objects be called without bind? Is there a way to call inc of obj without bind? function callIt(callback){ callback(); } var obj = { count: 0, inc: function(){ this.count++; } }; callIt(obj.inc.bind(obj)); obj.count;// 1 Question is relevant to me because of older IE-versions that do not support the method bind.
You could use a function value callIt(function() { obj.inc(); });
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript" }
zsh - evaluate variable inside `` (command substitution) # remove all processes by port # like killport 8000 killport() { kill `lsof -t -i:$1` } however when I'm trying to run the command I get this killport 8000 killport:kill:2: not enough arguments
Try: killport() { local port=$(lsof -t -i:"$1") [[ -n $port ]] && kill $port } Your problem was that if `lsof -t -i:$1` didn't output anything - because nothing happened to be listening at the specified port - the `kill` builtin received _no argument_ , causing it to complain. With the solution above, if the specified port is not in use, there will be _no output_ , but the exit code - as reflected in `$?` \- will be `1`.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "shell, zsh" }
How to aggregate by names in two columns in R? I got a Data Frame: a <- c('A','A','B','B','A') b <- c(1,1,1,1,2) c <- c(NA,60,NA,100,NA) d <- c(10,NA,10,NA,100) frame <- data.frame(a,b,c,d) > frame a b c d 1 A 1 NA 10 2 A 1 60 NA 3 B 1 NA 10 4 B 1 100 NA 5 A 2 NA 100 And I want to aggregate it by a and b >frame2 a b c d 1 A 1 60 10 3 B 1 100 10 5 A 2 NA 100 I tried several things like aggregat() and group from dplyr but somehow it never works. I guess the NA is a problem.
With `aggregate`, we may need to use `na.action` aggregate(.~ a + b, frame, sum, na.rm = TRUE, na.action = 'na.pass') # a b c d #1 A 1 60 10 #2 B 1 100 10 #3 A 2 0 100 * * * If we intend to subset the rows library(dplyr) frame %>% group_by(a, b) %>% mutate_at(vars(-group_cols()), ~ .[order(is.na(.))]) %>% slice(1) # A tibble: 3 x 4 # Groups: a, b [3] # a b c d # <fct> <dbl> <dbl> <dbl> #1 A 1 60 10 #2 A 2 NA 100 #3 B 1 100 10
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 4, "tags": "r, merge, aggregate, na" }
Binary tree, deleting item and reconnecting node I'm learning data structures and found out that for binary search trees, there are two ways to reconnect node when you delete item. Are those two ways (below) correct? !alt text Link to the image to see it non-resized
Yes, they are. Note that you could also do the "mirror image" version of each way, so it's actually 4 ways in total. In fact, there are quite few ways that would produce a valid binary tree. All you need to take care of is that the left child of a node is less than the node itself, and the right child is more. However the ways you have listed are the simplest ones that are typically used (unless it's a balanced tree and you need to rebalance it).
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "binary tree, pseudocode" }
LibGDX: Sequence Not Working I cannot use sequence at all, even THESE gives me an error. this.AddAction(sequence()); this.AddAction(sequence(setX(getY()))); No matter what I do sequence won't work, despite these being imported. addAction does not work either, nor does addAction & Actions.sequence.. Nothing does as far as this goes. import com.badlogic.gdx.scenes.scene2d.actions.Actions; import com.badlogic.gdx.scenes.scene2d.actions.AddAction; Edit: I needed to make my class an Actor.
This worked fine for me. Do this in your constructor of the screen where you want the action: image.addAction(sequence(fadeOut(3), run(new Runnable() { @Override public void run() { game.setScreen(new MenuScreen(game)); } }));
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "java, image, libgdx, sequence, alpha" }
Ramified extension in number theory Assume that $K$ is a complete field under a discrete valuation with Dedekind ring $A$ and maximal ideal $\mathfrak p$ and $A\diagup\mathfrak p$ is perfect. Let $e$ be a positive integer not divisible by $E$. Let $E$ be a finite extension of $K$, $\pi_0$ a prime element in $\mathfrak p$, and $\beta$ an element of $E$ such that $|\beta|^e=|\pi_0|$. Then there exists an element $\pi$ of order one in $\mathfrak \pi$ s.t. one of the roots of the equation $X^e-\pi=0$ is contained in $K(\beta )$. I don't see that if $E/K$ is a finite extension then $E/K$ is a totally ramified extension as the proof claims.
In general, we have $ef=n$, where $f$ is the residue class field extension degree, and $e$ is the ramification, and $n$ is the degree. Here, the hypothesis $|\beta|^e=|\pi_0|$ does not suggest (nor imply) that $E/K$ is totally ramified, nor that the subextension $K(\beta)/K$. If you _add_ the hypothesis that $E/K$ is totally ramified, then the residue class field extension degree $f$ is $1$, and $K(\beta)/K$ _is_ totally ramified, so $\beta^e=\eta\cdot \pi_0$ with a unit $\eta$ at first in the integers of the extension... but, since the residue field extension is trivial, we can "correct" $\eta$ by units in the ground field to get $\pi$ in the groundfield so that $X^e-\pi=0$ behaves as you want.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "algebraic number theory" }
Save date as timestamp in CQ5 I need t use the CQ5 xtype 'datefield' since I need only the date and not time tombe entered by the author. But the issue is that 'datefield' saves the date in JCR as a String and not as a timestap [ as it does when 'datetime' is used.] Is there a work around to save the date as a timestamp ?
A rough workaround for your jsp: <%@page import="java.text.SimpleDateFormat,java.util.Date"%> <% SimpleDateFormat displayDateFormat = new SimpleDateFormat("dd MMM yyyy"); String dateField = properties.get("nameofdatefield", ""); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yy"); Date formattedDate = sdf.parse(dateField); String formattedDateStr = displayDateFormat.format(formattedDate); out.println('Example of formated string'+formattedDateStr); %> From the above, you can also convert it to a Date Object, depending on what you wish to manipulate. Let me know if the above example helps
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "aem" }
ClassNotFoundException while trying to create Air Native Extension of YouTube API I created a clean air native extension with a simple function that starts an activity from within the ANE, 'DumbActivity'. It worked. However, after having DumbActivity extend YouTubeFailureRecoveryActivity in order to start using the YouTube API 3.0, I got a ClassNotFoundException on DumbActivity when I run the ANE. Worht mentioning that when I run the code as a native android app, it runs properly, and I can use YouTube abilities. Also checked, the DumbActivity class is included in the Jar. Is that some sort of library conflict or something?
Need to copy the external Jar used to /android, then created platform-options-android.xml and add -platformoptions platform-options-android.xml to the command line of the ANE creation.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, apache flex, actionscript, air, youtube api" }
How Do You Add Mods to your Minecraft on Ubuntu? I've been trying to add mods to my minecraft using the old way of putting them in the bin folder. However, I do not have a bin folder in my .minecraft folder. How do I get the bin folder or find a different way to add the mods. I have already tried using the magic launcher and it did not work. I also so tried Ctrl-h to show the hidden items and the bin folder still did not show up. All help is appreciated! Thank you!
I'm not ubuntu native, but I did this on FEDORA 20, should work for all linux: 1. Download MINECRAFT FORGE UNIVERSAL INSTALLER (.jar) for the version you want (1.7.2 etc.) and run it using `java`. 2. There should now be a `mods` folder in your `.minecraft` directory. If it isn't there, just make a new folder and call it `mods` 3. Put your mods in that folder and run minecraft. There should now be a new profile called forge. Press play and you're done!
stackexchange-askubuntu
{ "answer_score": 1, "question_score": 0, "tags": "minecraft" }
Rails Model: How to make a attribute protected or private that is not visible outside model? There are some fields present in table which i don't want to be visible outside? Like created_on, is_first etc. I want to set value of these fields by using callbacks with in model but not accessible for some one to set it.
The standard way to prevent mass-assignment on certain fields is `attr_protected` and `attr_accessible`: < In your case, you would have to add this line in your model: attr_protected :created_on, :is_first Even if you have a form with these fields, their values will be ignored, when used in a new/create call.
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 1, "tags": "ruby, ruby on rails 3, attributes, model, private" }
Need help understanding product of cycles I need to understand how product of cycles work. The textbook i am referring gives explanation only for simple products and just answer for bigger ones. i would be very thankful if someone can explain me how to work around products like this : $(1532)(14)(35)$ some relevant link where i can read and understand will also work. Aman
Note that different authors define multiplication of permutations differently; it's either left-to-right or right-to-left. The distinction is whether we define $f \circ g$ as $x \mapsto f(g(x))$ or $x \mapsto g(f(x))$. Check with your notes/books as to which you should use. ## Left-to-right We can draw the points and where they map to as follows: !Visualization Then we just follow the paths to find \begin{align*} 1 & \mapsto 3 \\\ 2 & \mapsto 4 \\\ 3 & \mapsto 2 \\\ 4 & \mapsto 1 \\\ 5 & \mapsto 5. \\\ \end{align*} We can convert this to cycle notation $(1324)(5)$, or $(1324)$ for short. ## Right-to-left The drawing now looks like: !Visualization Again, we just follow the paths to find \begin{align*} 1 & \mapsto 4 \\\ 2 & \mapsto 1 \\\ 3 & \mapsto 3 \\\ 4 & \mapsto 5 \\\ 5 & \mapsto 2. \\\ \end{align*} We can convert this to cycle notation $(1452)(5)$, or $(1452)$ for short.
stackexchange-math
{ "answer_score": 17, "question_score": 8, "tags": "abstract algebra, group theory, permutations" }
Display PDF viewer inside the Google Apps Script Dialog I want to display a PDF inside a Dialog of a Google Spreadsheet Add-on Dialog. more about apps script dialog can be found here < <iframe id="iframe" src=" frameborder="0" height="500px" width="100%"></iframe> When I inspect, I see the message **Resource interpreted as Document but transferred with MIME type application/pdf: "<
### Answer: _You can embed the Google viewer to display the PDF using an`<iframe>`._ ### Code: <iframe src=" height="1080" width="1920"></iframe> Just make sure to change the `height` and `width` attributes of the `<iframe>`.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "javascript, html, google apps script, google apps script addon" }
GZip or Deflate for HTTP compression Which compression method is better? I've heard lots of back and forth about GZip being more widely used, but Deflate being faster (in some instances). Is there an accepted standard on which one to use and why?
## UPDATE According to the latest updates to the linked question, one should use GZip. See < ## Old Answer Deflate is better.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 5, "tags": "c#, compression, gzip, deflate" }
Converting arrays/pointers from C to Java I am trying to re-write a program in C to java. I have no experience in C, but some in C++, so I understand some of the pointer/array things. I am slightly confused though...I am given the following code in C: void ProcessStatus(Char *Stat){ DWORD relayDate; DWORD APIDate; version3=false; version4=false; version9=false; tiltAngle = false; ver4features=0; tooNew=false; ProgRev=0; switch(Stat[14]){ From what I understand, the function `ProcessStatus` is passed a pointer to a char; and I'm assuming since in the last line of the code provided `Stat[14]` is called its within in array. So what I'm confused about is how I would pass a pointer to a char within an array in Java. Any help would be appreciated, even if its helping with my understanding of the C code. Thanks.
Hard to say whether it's a string or a raw data that has been passed. In case of string, use Java's built-in String class. void ProcessStatus( String stat) { ... switch ( stat.charAt( 14 ) ) { } } In case of raw data array, use `byte` array void ProcessStatus( byte[] stat) { ... switch ( stat[ 14 ] ) { } } BTW, C's `char` data type is translated to `byte` type in Java. `char` type in Java denotes a UTF-16 character which is 2 bytes long. `byte` is exactly what it is (8-bits, signed).
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "java, c, arrays, pointers" }
Response from controller class I have a controller class that someone at work wrote that contains a method that looks like this. (obviously it's not the full code, just the part I find confusing). It's part of a ASP.Net Core project. var memoryStream = new MemoryStream(); var result = new HttpResponseMessage(HttpStatusCode.OK); using (var stream = System.IO.File.OpenRead(newZipPath)) { stream.CopyTo(memoryStream); result.Content = new ByteArrayContent(memoryStream.ToArray()); } return File(memoryStream.ToArray(), "application/zip"); Now I'm not that good at C# but it feels like that "result" variable is not going to be sent anywhere or used? Am I correct or does ASP.Net Core have some magic way of sending this result as well as the one in the return statement.
That's correct. There doesn't appear to be any point in the `result` variable, ASP.Net MVC (both Framework and Core versions) will generate an appropriate FileResult from `File(memoryStream.ToArray(), "application/zip");`. You could go one step further and really reduce this code even more: using (var stream = System.IO.File.OpenRead(newZipPath)) { return File(stream, "application/zip"); } No need to create a second MemoryStream ar convert it to a byte array.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c#, asp.net, asp.net mvc, asp.net core" }
Using past tense with progressive form when talking about tasks that wil be completed in the future Can I use the following form: > Please tell me when you finished filling in this form. Or does it have to be something along the lines of: > Please tell me when you have finished filling in this form.
Your first sentence > Please tell me when you finished filling in this form. is not correct, you could use either present or present perfect > Please tell me when you _are finished_ filling in this form. > Please tell me when you _have finished_ filling in this form. alternatively you could use > Please tell me when you _finish_ filling in this form. All three mean "upon completion, please let me know".
stackexchange-ell
{ "answer_score": 1, "question_score": 0, "tags": "grammar, past tense, present continuous" }
session management by storing data in sessionstorage I am handling sessions by storing the user data in the sessionStorage of the browser using AngularJs. The basic flow I am using is as follows: 1. Login by front-end 2. Returning the user from node i.e back-end 3. Storing the returned data in sessionStorage 4. sending id of user with every request to the server 5. clearing the storage when signing out Is my approach correct? If not then how can I manage sessions efficiently in a MEAN app?
Storing critical data as tokens into LocalStorage or SessionStorage is definitely not a good idea, as it is vulnerable to XSS attacks. A better practice would be to store these informations in a cookie... However, we're not done here, as cookies are vulnerable to CSRF attacks. Thus, best possible way to do it is to store critical infos in a cookie, and protect your clients from CSRF by storing a randomly generated session key in SessionStorage. Check this answer : CSRF Token necessary when using Stateless(= Sessionless) Authentication?
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "angularjs, node.js, mean stack" }
How to check id in a string column in a SQL Server 2008 table I have a table that stores integer IDs of other table as comma separated string column. Now I want to find all rows in this table that have a specific ID in this string column. Example InwardHeader ( inhdrid numeric(18, 0), inwardno numeric(10, 0), inwarddt datetime, item numeric(10), qty numeric(18, 2) ) StockOutward ( Stkouthdrid numeric(18, 0), stkoutno numeric(18, 0), stkoutdt datetime, item numeric(10), inwardids varchar(100) ) The column `StockOutward.inwardids` contains comma separated values of multiple `InwardHeader.inhdrid` I want to find rows from `stockoutward` which contain `inwardheader.inhdrid` for a specific value
First of all is not good practice to store id on string field delimited by comma, You should use 1:N relationships, Anyway i prepared a solution for you(tested) like below: SELECT [Stkouthdrid] ,[stkoutno] ,[stkoutdt] ,[item] ,[inwardids] FROM [test].[dbo].[StockOutward] where CHARINDEX(( SELECT convert(varchar(10),[inhdrid]) FROM [test].[dbo].[InwardHeader] where [inhdrid]=0), [inwardids]) > 0 Hope it Helps :) ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "sql, sql server, tsql, sql server express" }
When $I+J$ is a special indecomposable ideal of $R$ $\newcommand{\Ann}{\operatorname{Ann}}\newcommand{\Max}{\operatorname{Max}}$I am looking for an example of a commutatvive ring $R$ with $1$ having two ideals $I$ and $J$ such that $I\cap J\not=0$, $\sqrt{\Ann(I)}, \sqrt{\Ann(J)}\in \Max(R)$, and $I+J$ is indecomposable ideal of $R$. Where, $I+J$ is indecomposable if it is not a direct sum of two nonzero ideals, $\Ann(T):=\\{r\in R\mid rT=0\\}$ for $T\subseteq R$, and $\Max(R)$ is the set of all maximal ideals of $R$.
$\newcommand{\Ann}{\operatorname{Ann}}$Let $A=K[x]/(x^n)$ and $I=\langle x^a\rangle$ and $J=\langle x^b\rangle$ for $1 \leq a \leq b \leq n-1$. Their intersection is nonzero. $\Ann(I)=\langle x^{n-a}\rangle, \Ann(J)=\langle x^{n-b}\rangle$ and their radicals are $\langle x^1\rangle$, which is maximal. $I+J=\langle x^{\min(a,b)}\rangle$ is indecomposable.
stackexchange-mathoverflow_net_7z
{ "answer_score": 1, "question_score": 1, "tags": "ag.algebraic geometry, ac.commutative algebra, ra.rings and algebras, prime ideals" }
How to fix 'Notice: Undefined index:' in PHP form action I received the following error message when I tried to submit the content to my form. How may I fix it? > Notice: Undefined index: filename in D:\wamp\www\update.php on line 4 Example Update.php code: <?php $index = 1; $filename = $_POST['filename']; echo $filename; ?> And $_POST['filename'] comes from another page: <?php $db = substr($string[0],14) . "_" . substr($string[1],14) . "_db.txt"; ?> <input type="hidden" name="filename" value="<?php echo $db; ?>">
`Assuming` you only copy/pasted the relevant code and your form includes `<form method="POST">` * * * if(isset($_POST['filename'])){ $filename = $_POST['filename']; } if(isset($filename)){ echo $filename; } If `_POST` is not set the `filename` variable won't be either in the above example. An alternative way: $filename = false; if(isset($_POST['filename'])){ $filename = $_POST['filename']; } echo $filename; //guarenteed to be set so isset not needed In this example filename is set regardless of the situation with `_POST`. This should demonstrate the use of `isset` nicely. More information here: <
stackexchange-stackoverflow
{ "answer_score": 48, "question_score": 25, "tags": "php, forms, post" }
What is @csrf_exempt in Django? What is `@csrf_exempt`, and why should we use this in our `views.py`? Also, are there any alternatives to it?
Normally when you make a request via a form you want the form being submitted to your view to originate from your website and not come from some other domain. To ensure that this happens, you can put a csrf token in your form for your view to recognize. If you add `@csrf_exempt` to the top of your view, then you are basically telling the view that it doesn't need the token. This is a security exemption that you should take seriously.
stackexchange-stackoverflow
{ "answer_score": 30, "question_score": 27, "tags": "django, django rest framework" }
How to use,run cURL tool with Android Studio on windows environment? What is better way to use cURL tool with Android Studio 1.1.x on Windows? because there is no proper information in official site for client tools on windows environment. I tried to download from official website, but the downloads are available for windows 2000/XP. And unlike Linux cURL tool, it has got both free and paid version for Windows.
* 1)I have used my windows Git Hub environment (Git shell) downloaded from < I want to use cURL POST data to online forms from both windows and Linux desktops. * 2)alternatively download from official site !enter image description here * 3)best way to use cURL tool is, running/executing it on Linux environment. cURL is a tool for transferring data using various protocols using URL syntax. It can be used in windows command line, it was a project on Linux environment. One of the useful and powerful features of cURL too is to GET and POST data to online forms. * 4) And also please notice the comments of @Toby Allen ==> "Unfortunately the most prominent mirror link for windows does take you to a slightly dodgy website that tries to make you pay / download a dodgy downloader" !enter image description here
stackexchange-superuser
{ "answer_score": 0, "question_score": -1, "tags": "windows, command line, curl, android studio" }
Determining Number of Groups Returned From Regex Search in Python I'm performing a regex search in python like the one below: import re regexSearch = re.search(r'FTP-exception-sources-\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', line, re.M|re.I ) if regexSearch: outputFile2.write(str(lineCounter) + " , " + regexSearch.group(0) + "\n") How can I determine the number of `groups` that get returned from the regex search?
`regexSearch.groups()` is all of the groups. `len(regexSearch.groups())` gets the count. In your case there will always be 0 groups as your regex does not contain groups (`group(0)` is the whole match and not really a group)
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 4, "tags": "python, regex, match" }
QR codes in Android I'm searching a third-party library for scanning QR-codes in Android? Could you tell me one? I'm looking for one that doesn't call any other app. I want it integrated with my app. Thanks!
Have you tried zxing?
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "android, qr code" }
Can't connect to hidden WPA2 hidden network I am trying to connect to my works hidden network, I know the name of the network and the password but it doesn't want to connect to the network. I can see it when I can and still it will not connect. My phone connects to the network with the same credentials. I am at a loss. I also tried this one with no connection. I can not amend the work's network. Please advise. The settings are WPA2-Personal. I even hardcoded the details into the `wpa-supplicant.conf` file and still the same result.
I reinstalled Respian and then used that link from above and now it works. my wpa_supplicant.conf file just had these two lines: ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 and my config.txt file I did this: auto lo iface lo inet loopback iface eth0 inet dhcp auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-scan-ssid 1 wpa-ap-scan 1 wpa-key-mgmt WPA-PSK wpa-proto RSN WPA wpa-pairwise CCMP TKIP wpa-group CCMP TKIP wpa-ssid "My Secret SSID" wpa-psk "My SSID PSK" iface default inet dhcp
stackexchange-raspberrypi
{ "answer_score": 2, "question_score": 0, "tags": "wifi, wifi direct" }
how to tell a string is all in english in php or javascript? how to tell a string is all in english of php. eg:$test="eeeeeeeeeeeee" how to tell that the `$test` string is writen all in english.
If you have all the characters you consider "english" into a string, then it can be done like this: $english_chars = 'abcdefghijklmnopqrstuvwxyz'; $input = 'eeeeeee'; $is_all_english = strspn($input, $english_chars) == strlen($input);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, javascript" }
How does javascript access my GPU driver name When I visit < it shows my driver name under the WebGL Context Info > ANGLE I want to ask, how does javascript is able to access such info? I thought at first that they are accessing my registry keys, but I changed all the names of my driver in the registry and still was being detected by javascript (old name that I changed) So if it is not the registry, then how does javascript deal with the OS to inquire about my driver's name? Thank you guys
As it turned out, WebGL access my system via DirectX (Direct3D)
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 0, "tags": "javascript" }
Quarkus 2.5: @Inject inside JAX-RS Application subclass not working anymore After upgrading Quarkus from 1.6.1.Final to 2.5.Final the following `@Inject` fails inside `javax.ws.rs.core.Application` subclass: @ApplicationScoped public class MyBean { public String foo() { retun "bar"; } } @ApplicationPath("/") public class MyApplication extends Application { @Inject MyBean myBean; @Override public Set<Class<?>> getClasses() { myBean.foo(); // Causes NPE on Quarkus 2.5.Final, worked well with 1.6.1.Final } } I tried with `CDI.current().select(MyBean.class).get()` but got `Unable to locate CDIProvider`. Any other workaround I can try? Thanks.
`@Inject` in JAX-RS Application classes has been since disallowed. I was able to solve my issue (registering resource classes by config) using `@IfBuildProperty` annotation.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "jax rs, cdi, quarkus" }
Product of two cyclic groups is cyclic iff their orders are co-prime Say you have two groups $G = \langle g \rangle$ with order $n$ and $H = \langle h \rangle$ with order $m$. Then the product $G \times H$ is a cyclic group if and only if $\gcd(n,m)=1$. I can't seem to figure out how to start proving this. I have tried with some examples, where I pick $(g,h)$ as a candidate generator of $G \times H$. I see that what we want is for the cycles of $g$ and $h$, as we take powers of $(g,h)$, to interleave such that we do not get $(1,1)$ until the $(mn)$-th power. However, I am having a hard time formalizing this and relating it to the greatest common divisor. Any hints are much appreciated!
Note that $|G\times H|=|G||H|=nm$; so $G\times H$ is cyclic if and only if there is an element of order $nm$ in $G\times H$. In any group $A$, if $a,b\in A$ commute with one another, $a$ has order $k$, and $b$ has order $\ell$ then the order of $ab$ will divide lcm$(k,\ell)$ (prove it). Now take an element of $G\times H$, written as $(g^a,h^b)$, where $G=\langle g\rangle$, $H=\langle h\rangle$, $0\leq a\lt n$, $0\leq b\lt m$. Then $(g^a,h^b)=(g^a,1)(1,h^b)$. In this case, what is the order? Under what conditions can you get an element of order exactly $nm$, which is what you need?
stackexchange-math
{ "answer_score": 21, "question_score": 34, "tags": "abstract algebra, group theory, elementary number theory, cyclic groups" }