INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
How can I draw a rectangle that has a single concave face? I wanted to draw this using Photoshop: !cartoon drawing However as you can see the dark green rectangle is not a perfect rectangle. It's rounded at the bottom but I don't know how to do this. !cartoon drawing I drew a normal rectangle then subtracted an ellipse from it, but I wanted to know if that's the correct way to do things or not... Subtracting forms with Photoshop CS6 isn't precise, or I used it wrong. I looked on the web and didn't find anything.
1. Use the rectangle tool `U`. 2. Draw the shape. Get the pen tool out and "add anchor point tool" under the pen tool options `P`. 3. Place it in the bottom center of the rectangle. 4. Get the direct selection tool `A` and click on the new anchor point and drag upwards. !enter image description here
stackexchange-graphicdesign
{ "answer_score": 4, "question_score": 3, "tags": "adobe photoshop, shapes" }
How to write rake task to create data using excel in rails 3.2 I want to create data by importing excel. I have got the record of states in excel file and my state model has got only one field state_name. I want to make a rake task to create all the record of all the states present in the excel file but I don't know how to work with excel. I have created a basic rake task like this in the lib/tasks:- namespace :state do task :create => :environment do end end How do I put the code which will read the excel file and create the states based on that ?
You can put the xls file into /tmp directory. Then put gem spreadsheet into your Gemfile. Then create xls.rb class into lib with a read method. class Xls require 'spreadsheet' def self.read file_path Spreadsheet.open(file_path) do |book| book.worksheets.each do |ws| 0.upto ws.last_row_index do |index| row = ws.row(index) yield ws, row end end end end end Then, into your task.. namespace :project do desc "Load xls" task :load => :environment do Xls.read("xls_file_path") do |sheet, row| state = row[0] #row[0] = the first column of the this row. YourModel.save(state: state) end end end
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "ruby on rails, ruby on rails 3.2, rake task" }
If $f$ is continuous, $\Omega$ is open, $I=\{t:f(t)\in\Omega\}$ and $\sigma=\inf I^c$, does it hold $f(\sigma)\in\partial\Omega$? Let $\tau>0$, $E$ be a $\mathbb R$-Banach space, $\Omega\subseteq E$ be open, $f:[0,\tau]\to E$ be continuous with $f(0)\in\Omega$, $$I:=\\{t\in[0,\tau]:f(t)\in\Omega\\}$$ and $$\sigma:=\inf([0,\tau]\setminus I).$$ > Assume $I\ne[0,\tau]$. Can we show that $\sigma\not\in I$ and $f(\sigma)\in\partial\Omega$? Since $I\ne[0,\tau]$, we know that $\sigma\in[0,\tau]$ and hence $f(\sigma)$ is well-defined. Moreover, since $\Omega$ is open and $f$ is continuous, $I$ is $[0,\tau]$-open. So, I've tried to assume the contrary, i.e. $\sigma\in I$, so that there would be a $\varepsilon>0$ with $B_\varepsilon(\sigma)\cap[0,\tau]\subseteq I$. This would yield that $[0,\tau]\setminus I\subseteq[0,\tau]\setminus B_\varepsilon(\sigma)$, but I wasn't able to derive a contradiction to the definition of $\sigma$ from that.
By definition $$[0, \tau] \setminus I = \lbrace t \in [0, \tau] : f(t) \notin \Omega \rbrace = f^{-1}(E \setminus \Omega)$$ so $$\sigma = \inf \left( f^{-1}(E \setminus \Omega)\right)$$ Because $\Omega$ is open in $E$, then $E \setminus \Omega$ is closed. By continuity, $f^{-1}(E \setminus \Omega)$ is closed in $[0, \tau]$, hence it is a compact. So $\sigma$ is the infimum of a compact, so it is a minimum, which means that $\sigma \in f^{-1}(E \setminus \Omega)$, so $\sigma \notin I$. Now, for all $n$ sufficiently large, $\sigma - 1/n$ belongs to $[0, \tau]$ (because $f(0) \in \Omega$, so $\sigma > 0$), and by definition of $\sigma$ as the infimum, one has $f(\sigma - 1/n) \in \Omega$. But by continuity, $f(\sigma) = \lim f(\sigma - 1/n)$, so $f(\sigma)$ belongs to the closure of $\Omega$. Because $\Omega$ is open, and $f(\sigma) \notin \Omega$, you have indeed $f(\sigma) \in \partial \Omega$.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "general topology, continuity, supremum and infimum" }
How do I determine which voxels to test for collision against the player? I've implemented Minkowski subtraction to test whether (and where) two AABBs collide, independent of framerate/time-step, in my Minecraft-like game. But since there may be tens of thousands of voxels, I'm realizing I can't just test everyone of them. Is there an alternative to just scanning for nearby voxels? I worry that if I just do collision for voxels within a fixed range, then I've undone the framerate independence that I had sought.
This post is a bit old, but it got bumped, so I'll followup with the solution I implemented. I used the players velocity (multiplied by the framerate) to compute a simple 3D cartesian range of voxels that the player _could_ collide with. When moving diagonally, it tests more voxels than is required (as crudely sketched below): ![enter image description here]( However, at typical FPS & velocity, only about a dozen voxels are tested per frame (regardless of the size of the world). So I'm quite happy with it. Seems so obvious now; can't believe I asked, lol.
stackexchange-gamedev
{ "answer_score": 1, "question_score": 1, "tags": "collision detection, voxels, aabb" }
How to add Divs dynamically side by side using Jquery? can you please help me how to add Divs side by side dynamically using Jquery. Here is my code $(document).ready(function() { $('#idButton').click(function() { for (int i = 0; i <= 3; i++) { $('body').append('<div id="divId"+' i ' style="height:80px;width:80px;background-image:url(' flashcard1.png ');">Images</div>'); } }); });​
To add it side by side we need `float` css property. If you give `float:left` It will add side by side. Try with float. Try like this... And make int to var as xdazz stated. $(document).ready(function() { $('#idButton').click(function() { for (var i = 0; i <= 3; i++) { $('body').append('<div id="divId"+' i ' style="height:80px;width:80px;float:left;background-image:url(\' flashcard1.png \');">Images</div>'); } }); });​ One more thing after adding float you have to clear it to work the next markup correctly.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "jquery" }
Start/Stop and Restart Jenkins service on Windows I have downloaded "jenkins-1.501.zip" from < . I have extracted zip file and installed Jenkins on Windows 7 successfully. Jenkins runs at ` well. I want to stop Jenkins service from console. How can I do that? What's the way to start and restart through console/command line?
Open Console/Command line --> Go to your Jenkins installation directory. Execute the following commands respectively: **to stop:** `jenkins.exe stop` **to start:** `jenkins.exe start` **to restart:** `jenkins.exe restart`
stackexchange-stackoverflow
{ "answer_score": 226, "question_score": 119, "tags": "windows, command line, console, jenkins, command prompt" }
Помогите, пожалуйста создать поддомены на Apache Вопрос такой есть Url: site.loc/store/store_name Нужно что бы при переходе на этот Url, отображалось store_name.site.loc/store, т.е. название магазина сделать поддоменом Заранее благодарю.
В hosts нужно прописать subdomain. Думаю это должно помочь < <
stackexchange-ru_stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, yii2, apache, http, apache2" }
extract values from a list on python Im programming a webapp on python and on one part of the code i have to take a value from a database. this value is on a list but this list is from a length of one. How can i take it out without making a for that will only run once? btw this is the code if not password and email: flash("Please enter an email and a password to login", category="error") else: con = sqlite3.connect("DB.db") cur = con.cursor() cur.execute("SELECT * FROM users WHERE email = ?", (email,)) user = cur.fetchall() con.close() if not user: flash("This account doesn't exist") else: for User in user: #<-- this for pass
If you know that the list always has one element you can easily access the first element with `list[0]` (our_user,) = user[0] Edit: Thx @jedwards
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, database, for loop" }
touch: missing file operand with filename containing hash # My system is Kernel: 5.3.0-26-generic x86_64 bits: 64 Desktop: Cinnamon 4.4.8 Distro: Linux Mint 19.3 Tricia Touch version is `touch (GNU coreutils) 8.28` When the following command is given - $ touch #a{1..10} It says - touch: missing file operand Try 'touch --help' for more information. What is the issue here?
(Using `set -x` (`xtrace`) to see the command that actually runs) $ set -x $ touch #a{1..10} + touch touch: missing file operand Try 'touch --help' for more information. $ touch a{1..10} + touch a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 The hash sign `#` at the start of a word makes the rest of the line a comment. You need to quote it: $ touch "#"a{1..10} + touch '#a1' '#a2' '#a3' '#a4' '#a5' '#a6' '#a7' '#a8' '#a9' '#a10' Or in Bash, you can use `shopt -u interactive_comments` to disable processing comments altogether.
stackexchange-unix
{ "answer_score": 3, "question_score": 1, "tags": "bash, shell, touch" }
И еще о большой букве в обращении "Вы" Хочу посоветоваться. У меня есть свой сайт, где на главной странице я написал приветствие к посетителям. Но у меня вызвал затруднение вопрос: с какой буквы там писать местоимение "вы"? Вроде бы, это обращение к человеку, зашедшему на сайт, но, с другой, и ко всем читателям сайта. Я написал с большой, но все же сомневаюсь. Что вы посоветуете?
Логика логикой, а эмоции часто берут верх. Мне кажется, прописной буквой уж точно никого не обидишь. Почему бы не проявить уважение таким образом к каждому посетителю сайта? Ведь каждое новое посещение добавляет рейтинг. А _вы_ со строчной стоит писать, если автор явно обращается к группе людей (студентов, филологов, строителей...), когда их что-либо объединяет. И ведь на сайт люди "ходят" не группой, а по одному. Может быть, _Вы_ выглядит немного лестно, но почему нет? По-моему, это приятнее, когда к тебе обращаются лично, чем как к одному из толпы. И не важно, что никто друг друга не видит в глаза.
stackexchange-rus
{ "answer_score": 2, "question_score": 0, "tags": "прописная строчная" }
Showing $R(G) = R(T)^W$ Let $G$ be a compact connected Lie group and $T$ a maximal torus. Let $R(G)$ be the representation ring of $G$. Then restriction of reps gives a map $R(G) \to R(T)^W$, where $R(T)^W$ are the characters on $T$ that are invariant under the Weyl group $W$. How do you show that this map is a surjection? Does this involve ``inverting" the Weyl character formula?
Take an element of $f\in R(T)^W=\sum_\lambda c_\lambda e^\lambda$ ($\lambda$s are weights), choose a $\lambda_0$ which is maximal among those in the sum, and pass from $f$ to $f-c_{\lambda_0}\chi_{\lambda_0}$, where $\chi_{\lambda_0}$ is the irreducible character with highest weight $\lambda_0$. Repeat. After finitely many iterations you get to $0$.
stackexchange-math
{ "answer_score": 2, "question_score": 3, "tags": "representation theory, lie algebras, lie groups" }
Give program time to shutdown threads but with System.exit backup plan? Sometimes the system process of a java application doesn't fully shutdown. This is mainly because one or more threads didn't die. One can call: System.exit(0); But this kills all threads. I want all my threads to shutdown correctly so i don't plan on using System.exit. But sometimes due to circumstances one or more threads don't die correctly. This causes the application to not fully shutdown and linger in the background sometimes even locking up resources. My first thought was writing an ExitWatcher which starts when program stops and calls system.exit after 10 seconds if the program is still alive. I quickly found out that the ExitWatcher now prevents the program from shutting down ;-) How do you give a java program time to shutdown correctly (ie close all threads correctly) but at the same time have a backup plan that calls System.exit if shutdown takes too long?
You can use daemon threads when you don't want a thread to prevent a program from exiting (so using `setDaemon(true)` on your `ExitWatcher` thread would solve your immediate problem). However I doubt you really need or want an ExitWatcher, as situations like that are usually relatively easily prevented with proper design. Proper shutdown procedures include interrupting threads that are active (and designing them so they behave nicely when interrupted), using daemon threads where necessary, shutting down connections properly etc. Using a mechanism like your ExitWatcher is more of a hackish approach, as it indicates your program doesn't always behave nicely at shutdown.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "java, multithreading" }
Resize a dd dump without changing partition size First of all, apologies if this has been asked before. I found a lot of similar questions, but none that completely match my situation. I have a raw disk image made from an ext4 partition on an Android device using dd - busybox dd if=/dev/block/someblock of=backup.img The source partition was large in size, but didn't have much data. So the image file has a lot of unused space. I need to reduce the file size of the image without resizing the filesystem partition. Is it possible to move the data to the beginning of the image and then truncate the file? If I do this, will I be able to write this image back to the original source later without resizing the partition? (I can completely wipe the target device before writing, if required). If yes, how can I do this? Compression is not an option. I need a raw file. Thanks
I ended up cat-ing the file to a temporary partition on an HDD; resizing the partition to the minimum size (adding free space to the right side) and then back to the initial size using GParted; and dd-ing the part of the partition which had data to a new file.
stackexchange-superuser
{ "answer_score": 1, "question_score": 2, "tags": "linux, partitioning, filesystems, images" }
How to include values with count 0? I have the following table called Trains. id | name | train_id 1 Carl 1 2 Kat 1 3 Paul 2 4 Adam 4 5 Janet 4 6 James 4 I am trying to count for each name how many other people are in the same train. Here's what I've gotten so far: SELECT T1.name, COUNT(T2.name) FROM Trains T1, Trains T2 WHERE T1.name<>T2.name AND T1.train_id=T2.train_id GROUP BY T1.name; However, the result I get is Janet 2 Adam 2 Kat 1 Carl 1 James 2 but I should also have the name 'Paul' there with count 0. I am new to SQL and I am unsure of how I could change my code to have the zero values here as well.
If you phrase your current logic as a left join, it should work: SELECT t1.name, COUNT(t2.name) AS cnt FROM Trains t1 LEFT JOIN Trains t2 ON t1.name <> t2.name AND t1.train_id = t2.train_id GROUP BY t1.name; ![screen capture from demo link below]( ## Demo The problem with your current approach is that it doing an old school implicit inner join, not a left join. This means that first the join happens, then the `WHERE` clause is filtering off the missing Paul record. By using a left join, all names on the left side of the join are retained.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sql, count" }
How to get document id after creation Firestore ios? Pretty new to Firestore. Is there a way to get ID or reference to a newly created document? firestore.collection(myCollection).document().setData(["myData": data]) { err in if let err = err { print("Error writing document: \(err)") } else { print("Document successfully written!") } } Any kind of help is highly appreciated.
You can get it **before** the document is created, because it's generated on the client when you create the DocumentReference. let ref = firestore.collection(myCollection).document() // ref is a DocumentReference let id = ref.documentID // id contains the random ID ref.setData(...)
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 1, "tags": "ios, swift, firebase, google cloud firestore" }
Jordan Canonical form with zero eigenvalue? Can anyone tell me how to find the Jordan Canonical form of the matrix below? $$A=\begin{pmatrix} 0 & 1 & 2\\\ 0 & 0 & 1\\\ 0 & 0 & 0 \end{pmatrix}$$ Obviously this matrix cannot be transformed into a diagonal. Since $$ch_A=|(λ-AI)|=λ^3 \Rightarrow λ=0$$ with multiplicity of 3. Can anyone help me find the Jordan canonical form of it?
The matrix is obviously nilpotent, and in fact $\;A^3=0\,,\,\,A^2\neq0\;$ , and from here its JCF is $$J_A=\begin{pmatrix} 0 & 1 & 0\\\ 0 & 0 & 1\\\ 0 & 0 & 0 \end{pmatrix}$$ Or easier, as you began to argue: a nilpotent matrix is diagonalizable iff it is the zero matrix, so our matrix is non-diagonalizable...so now choose the size of the biggest Jordan block according to the _rank_ of $\;A\;$ ...
stackexchange-math
{ "answer_score": 3, "question_score": 0, "tags": "linear algebra, matrices, diagonalization, jordan normal form" }
Why does leading slash not match my RewriteRule? I hope I'm missing something silly. I'm trying to redirect URLs using .htaccess on Apache 2.2 using the PHP 5.4 cartridge on OpenShift's free hosting service. This matches the URI /permalink/a123 (note the lack of leading slash in the rule's filter pattern): RewriteEngine On RewriteRule permalink/a.*$ /permalink/b [R=301,L] This does not match the URI /permalink/a123 (note the leading slash in the rule's filter pattern): RewriteEngine On RewriteRule /permalink/a.*$ /permalink/b [R=301,L] So what stupid thing do I have wrong? Thanks.
The URI used to match patterns in a `RewriteRule` are canonicalized in a per-directory context (either in an htaccess file or in a `<Directory>` container) by removing the leading `/`. So if the requested URL is: And from within an htaccess file in the document root, the URI used to match rules is `web/permalink/123`. But within an htaccess file in the `web` folder, the URI is `permalink/123`, etc. Thus you can't have your patterns start with a `/` because they're stripped from the URI in the context of an htaccess file.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "php, apache, .htaccess, mod rewrite, openshift" }
Designing a multi-level game I want to know to code structure of a game that has different levels to choose from on the main screen. More precisely, I want to know how does the main loop hands off the rendering to another loop that exist in the level code. I could think of a solution but I would like to know how this is done by game developers. Solution: // Level.cpp void Level::LevelLoop() { while(LevelNotDone){ handleInput(); update(); render(); } } // Main.cpp void MainLoop() { while(GameNotDone){ handleInput(); if (Condition to start level) level.LevelLoop(); // wait until level loop exits update(); render(); } }
Lookup "data driven programming", "virtual functions" and "function pointers" < < short virtual function example: bool quit = false; class GameMode { public: virtual void Update() = 0; }; class GameModePlatformer : public GameMode { public: virtual void Update() { // do stuff in platformer mode } }; class GameModeMenu : public GameMode { public: virtual void Update() { // do stuff in menu mode } }; GameModePlatformer game_mode_platformer; GameModeMenu game_mode_menu; void main() { GameMode *current_mode = &game_mode_menu; while(!quit){ current_mode->Update(); render(); } } An actual game would have init and free functions and other details such as a convenient way to switch modes but that's the gist of it.
stackexchange-gamedev
{ "answer_score": 2, "question_score": 0, "tags": "game loop, level design" }
How will I overwrite a text-decoration underline coming from a library? I am using a library which provides an underline like the one below. I would like to overwrite it and not display the underline. My attempt: `.remove { text-decoration: none !important; }` .un { display: inline-block; } .un:after { content: ''; width: 0px; height: 1px; display: block; background: black; transition: 300ms; } .un:hover:after { width: 100%; } <span class="un remove">Underlined Text - Or to be underlined</span>
It actually isn't an underline - you need to remove the `:after` .un { display: inline-block; } .un:after { content: ''; width: 0px; height: 1px; display: block; background: black; transition: 300ms; } .un:hover:after { width: 100%; } .un.remove:after { /* hide after if it has remove */ display:none; } <span class="un remove">Underlined Text - Or to be underlined</span>
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "html, css" }
Visual Studio Emulator for Android in visual studio 2013 Here it is mentionned that in vs 2015 it was lauched the vs android emulator which is fatest than the usual android emalutor. How can I configure visual studio 2013 update 4 community edition to have this emulator?
I asked this same question myself only last week and actually posted my own answer with instructions. You can see it here.. My question on stack overflow I am using VS 2013 professional edition though so Im not sure if there are any foibles there. If you have the 'Device' option as a target it should work.. Please mark as answer if this helps you.. Thanks, Brett
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "visual studio, visual studio 2013, visual studio cordova" }
How to convert a blade file to HTML and save it? For example, there is a file `\resources\views\test.blade.php` @extends('layouts.app') @section('content') <div class="container"> {{ $article->content }} </div> @endsection I want to save it as `\resources\views\html\test.html`. What should I do?
I would try something like this, although I haven't test it my self: File::put('test.html', view('resources.views.test') ->with(["article" => $article]) ->render() );
stackexchange-stackoverflow
{ "answer_score": 15, "question_score": 7, "tags": "laravel, laravel blade" }
Setting Up Zend Framework on CentOS - Unsure where to place Zend folder I have a CentOS server and am attempting to setup Zend Framework on it. The command which php outputs /usr/bin/php and php -i | grep include_path outputs include_path => .:/usr/share/pear:/usr/share/php=> .:/usr/share/pear:/usr/share/php So, I copied the Zend folder from the Framework donwload to both /usr/share/pear and /usr/share/php and also copied zf.sh and zf.php to /usr/bin/php. When I execute zf show version, I receive bash: zf: command not found Can anyone suggest further steps to take to ensure installation of ZF? Thanks!
I've used the remi repository and did a `yum update;yum install *Zend*`. Zend should be installed correct and on a new ZF version you can just do `yum update` when remi pushed it into their repository (they are relative quick).
stackexchange-serverfault
{ "answer_score": 1, "question_score": 0, "tags": "php, centos5, zend framework" }
Why does the /dev directory exist? In Linux, there is the /dev directory, which is a special directory which contains all of the files for devices and other things like random, urandom, etc. Why did this directory exist? Was it just an artifact that never got removed from the Linux kernel (and couldn't really for compatibility)?
One of the philosophies in linux is that everything is a file, encoded or not, it is a special directory as you said. Linux, unlike windows is highly customizable and this is a way that the administrator has to create and manipulate devices and so on.
stackexchange-superuser
{ "answer_score": 3, "question_score": 0, "tags": "linux, linux kernel, dev" }
Excel VBA - exit for loop I would like to exit my `for` loop when a condition inside is met. How could I exit my `for` loop when the `if` condition has been met? I think some kind of exit at the end of my `if` statement, but don't know how that would work. Dim i As Long For i = 1 To 50 Range("B" & i).Select If Range("B" & i).Value = "Artikel" Then Dim temp As Long temp = i End If Next i Range("A1:Z" & temp - 1).EntireRow.Delete Shift:=xlToLeft
To exit your loop early you can use `Exit For` `If [condition] Then Exit For`
stackexchange-stackoverflow
{ "answer_score": 368, "question_score": 208, "tags": "excel, vba, for loop" }
PHP array: get first not empty value no matter the key I have an array with strings that are user's comments The array can be like this: //example 1 $comments : array = 0: string = 1: string = 2: string = this is one comment Or like this: //example 2 $comments : array = 0: string = hey, I am a comment 1: string = 2: string = 3: string = and this is another comment Or any other form containing empty strings and comments What I need is an string with the firs not empty comment. In example 1 the string should contain: "this is one comment" And in example 2 "hey, I am a comment" How can I do that? I am going round and round this and it has to be much more simple. Thanks a ton!
Here's a method using a forloop instead: <?php $ex1 = array("", "", "comment"); $ex2 = array("comment", "", ""); function getFirstNotEmpty($arr) { for ($i = 0; $i < count($arr); $i++) if (!empty($arr[$i])) return $arr[$i]; } echo getFirstNotEmpty($ex1) . "\n"; echo getFirstNotEmpty($ex2); Output: comment comment
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "php, arrays, string" }
Best way for connecting this redstone vertically? i am currently working on a big RAM in minecraft and i want to connect the inputs of each row vertically: !enter image description here I want to connect the yellow lines. It should be fast not use too much space.
If low latency is more important than space, you can go straight up in a mostly 1x2 space, with a small section of 2x3: !Ignore the house If space is more important than low latency, you can replace the repeater with a vertical double NOT gate, which would lower the maximum space from 2x3 to 1x3: !enter image description here
stackexchange-gaming
{ "answer_score": 6, "question_score": 5, "tags": "minecraft java edition, minecraft redstone" }
Feathered clipping mask for jCarousel I have a set of images scrolling continuously with jCarousel. Only one image is fully displayed at a time, and I would love to be able to "feather" the edges of the carousel so the images fade in and out as they traverse visibility. Hopefully that makes sense. Also, the carousel's motion seems a bit buggy at times. On occasional page loads it seems like the `animation` and/or `auto` parameters in the initialization of the carousel aren't being implemented properly, causing the carousel to either move quicker than expected, or delay longer, etc. Thoughts? Edit to add: Is there possibly a way, in lieu of a true clipping mask, to use one of jCarousel's callbacks to perform `fadeOut()` on an image as it moves out of the carousel's focus (and then `fadeIn()` as an image moves into focus)?
Here is an example of jcarousel with feathered edges Technically it isn't really feathered, there's just semi transparent PNG over the top. I don't think there is a way to have a true feather
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "javascript, jquery, html, css, jcarousel" }
Removing margin,padding properties using Regular expression in java i have a css file and i want to remove all margin properties(left,right,bottom) and padding(left,right) properties using regular expresion in java.please help me with this this is my css .calibre { background-color: white; display: block; font-family: Times New Roman; font-size: 1em; margin-bottom: 0; margin-left: 20pt; margin-right: 20pt; margin-top: 0; padding-left: 0; padding-right: 0; text-align: justify } and output will be like this .calibre { background-color: white; display: block; font-family: Times New Roman; font-size: 1em; text-align: justify }
This worked for me: String str = ".calibre {"+ " background-color: white;"+ " display: block;"+ " font-family: Times New Roman;"+ " font-size: 1em;"+ " margin-bottom: 0;"+ " margin-left: 20pt;"+ " margin-right: 20pt;"+ " margin-top: 0;"+ " padding-left: 0;"+ " padding-right: 0;"+ " text-align: justify"+ " }"; System.out.println(str.replaceAll("(margin|padding).+?;", "")); It printed: .calibre { background-color: white; display: block; font-family: Times New Roman; font-size: 1em; text-align: justify }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "java, css, regex" }
What are the conditions for a polygon to be tessellated? Upon one of my mathematical journey's (clicking through wikipedia), I encountered one of the most beautiful geometrical concept that I have ever encountered in my 16 and a half years on this oblate spheroid that we call a planet. I'm most interested in the tessellation of regular polygons and their 3D counterparts. I've noticed that simple shapes like squares or cubes can be tessellated but not circles or spheres. !tesselation example Somewhere after hexagons, shapes lose that ability to be tessellated by only themselves. Although it is intuitively clear to me when shape can be tessellated, I cant put it into words. Please describe to me, in a fair amount of detail, what the lesser sided shapes had that the greater sided shapes did not inorder to be tessellated.
A regular polygon can only tessellate the plane when its interior angle (in degrees) divides $360$ (this is because an integral number of them must meet at a vertex). This condition is met for equilateral triangles, squares, and regular hexagons. You can create irregular polygons that tessellate the plane easily, by cutting out and adding symmetrically.
stackexchange-math
{ "answer_score": 8, "question_score": 10, "tags": "geometry, algebraic geometry, intuition, tessellations" }
Why can my Mac charge my iPad but other computers can't? What do Macs do differently so its USB ports can charge my iPad, but if I plug into a USB port on my PC I get the "not charging" message?
Because the iPad needs more than the 500 mA that the USB 2.0 spec says computers need to provide. Macwork has more information.
stackexchange-apple
{ "answer_score": 14, "question_score": 10, "tags": "ipad, usb, charging, power" }
Does the comma operator in an array have a name? I was just wondering if any programming language, organization, or computer scientist had ever given a name for the comma operator _or equivalent separator_ when used in an array? ["Do", "the", "commas", "here", "have", "a", "name"]? i.e. separators, next, continue, etc.?
As per the comments: the comma in the example is not an operator. It is a list separator and where it appears in a grammar it is typically referred to as `list separator`, `separator` or just `comma'. It is used with this meaning and terminology in at least 90% of the languages I've used (which is quite a few). There are languages with different separators or additional separators, including white space or just about any punctuation character you can think of, but no original names for them as far as I recall. I do not rule out the possibility that some creative person has called it something different. If not, feel free to be the first.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "arrays, programming languages, computer science, language design, nomenclature" }
Override Eureka config via environment variable in Rancher I have a Spring Boot application deployed in a container on Rancher. I would like to override the configuration which is in application.yml via the environment variables set on the container in Rancher. Here is the configuration that I would like to set: eureka: instance: prefer-ip-address: false hostname: fqdn.api.stuff.com nonSecurePort: 65230 I tried the following equivalents but it doesn't seem to work: * EUREKA_INSTANCE_PREFERIPADDRESS * EUREKA_INSTANCE_HOSTNAME * EUREKA_INSTANCE_NONSECUREPORT What would be the appropriate spelling ?
Try to use the below names. EUREKA_INSTANCE_PREFER_IP_ADDRESS EUREKA_INSTANCE_HOSTNAME EUREKA_INSTANCE_NON_SECURE_PORT
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "spring boot, rancher" }
How to get the date 7 days back from (new Date()).zeroTime()? I am using (new Date()).zeroTime() to get the current date, how can I get the date 7 days back. for example, if today is 24th May 2012 how can I get 17th May 2012
In C#, you can use `DateTime.AddDays` and use `-7` as your parameter. Read more here In JavaScript it's: myDate.setDate(myDate.getDate() - 7);
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "javascript, date" }
Can I add delegates to abstract class? I know that I can't add delegate to interfaces in c# but can I add delegate to abstract class? Is it possible?
Do you mean public abstract class TestClass { public delegate void TestAction(string s); } then yes you can.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "c#, delegates, abstract class" }
Iterating through 2D list in prolog? I'm trying to iterate through a 2D list in prolog. So let's assume we have a list of `[item(Key,Value), ......., (item(Key,Value)]` I know we can go through a list by omitting the head element through: member2(X, [H|T]):- member2(X, T). But i do not know how to iterate through the Key/Value list.
You want to search if Key is present in the list or not. If yes then I have linked the code below. searchKey(Key,[(Key,Value)|_]):- write(Key) , write('-->'), write(Value) , !. searchKey(Key,[_|T]):- searchKey(Key,T). **OUTPUT** ?- searchKey(3,[(1,99),(2,98),(3,97),(4,96)]). 3-->97 if you search for a element that doesnt exist then it wil return false. ?- searchKey(5,[(1,99),(2,98),(3,97),(4,96)]). false Hope this helped you. If this is not what you've asked. Then try explaining the question more clearly.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "prolog" }
In Dying Light, what do the tiny white bouncing arrows indicate in the mini-map? Every so often, I see tiny white arrows in the mini-map that bounce up and down a little. I'm almost done with the game and never did figure out what they represent. At first I thought they might indicate a horde, because they usually show up in a group of four or five arrows, but that doesn't seem to be it.
Arrows are used to indicate difference in height between character and object. E.g. look on picture below. This arrows indicate that traps are lower than character. ![enter image description here]( And here white arrows show, that shop, bad etc are on higher floor. ![enter image description here]( If those are not arrows you mean, please, provide screenshot.
stackexchange-gaming
{ "answer_score": 4, "question_score": 3, "tags": "dying light" }
Angular 6: image from assets not working in inline style I'm using `Angular 6`. I have to set background image of div from template and for that, I'm doing <div class="full-page-background" [style.background-image]="'url(./assets/img/bg5.jpg)'"> </div> But this gives **404** not found. I tried same path with `<img>` tag <img src="./assets/img/bg5.jpg" alt=""> and it's working fine. **1\. Why it's not working with style element?** **2\. How to set background image of div?**
use the `ngStyle` directive [ngStyle]="{'background-image':'url(./assets/img/bg5.jpg)'}">
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "angular, angular template" }
Redirect non www to www including https I'm having trouble redirecting: ` to ` I've currently got this and its not achieving the result I need and I'm not sure why: RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ [R=301,L] I basically want to redirect everything to ` I appreciate any help.
Based on your comment you're trying to redirect in order to avoid a mis-matched URL SSL warning in the browser window. This cannot be done, as the redirect happens after the SSL handshake (because it uses a `Location:` response header to a request that won't be sent until the SSL handshake occurs and is accepted by the user). Your best approach is: * Split example.com into a separate `VirtualHost` and use mod_alias as @HampusLi suggested * Purchase another certificate for `example.com` and apply it to this `VirtualHost` Alternatively, you could get a SAN (Subject Alternate Name) certificate that works for both `example.com` and `www.example.com`.
stackexchange-serverfault
{ "answer_score": 2, "question_score": 0, "tags": "apache 2.2, .htaccess, mod rewrite" }
Delete Vote or Flag? I've just come across this question: !enter image description here With these types of questions, is it best to just let delete votes take care of it, or should it be flagged for more immediate results? I just delete-voted for now
If there's really no hope of redemption for the question, then casting a delete vote is fine. Getting rid of the questions that don't show effort is ideal. Otherwise, if there was a _sliver_ of hope that this question could be turned around, if there were stellar answers on it already, or there were well-accepted answers, I'd revert the edit immediately and notify a moderator that this is turning into an edit war. It's especially important in regards to the answers - if the answers are good, but the question is being actively vandalized, that's a problem. You'd want to let a diamond moderator know about that. Otherwise, if there's really no redeeming factor to it, deleting it is fine.
stackexchange-meta
{ "answer_score": 4, "question_score": 4, "tags": "discussion, flags, vote to delete" }
Search Within Two Dimensional Array I know I'm missing something obvious, but I can't seem to find my mistake. I want to see if an array is within another two dimensional array. Here's my code: var cell = [0, 0]; var population = [[0, 0], [1, 1]]; if (cell == population[0]) { alert("Cell found within population"); } else if ([0, 0] == population[0]) { alert("Array found within population"); } else { alert("Neither found within population"); } I used the second conditional just to be sure that the value of cell and population[0] weren't equivalent. But as it turns out, neither of them match. I've tested (cell[0] == population[0][0]), and that seems to work. I would appreciate any clarification. Thanks!
The issue here is that the == operator for arrays in javascript compares memory addresses rather than the actual values. This is why you notice that (cell[0] == population[0][0]) returns true (you're comparing values). You should iterate through the elements in the arrays to compare them. Here's an example of what I mean. function checkEquivalence(arr1, arr2){ if(arr1.length != arr2.length) return false; for (i = 0; i < arr2.length; i++) { if(arr1[i] != arr2[i]) return false; } return true; } Now you can run the operation `checkEquivalence( cell, population[0] );`
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "javascript, multidimensional array, equals" }
Is $S_6$ the derived subgroup of some group? I know that if $H$ is a complete group (meaning that the homomorphism $H\to\text{Aut}(H)$ is an isomorphism) and if $H$ is not perfect (meaning that $H^\prime\lneq H$) then $H$ is not the derived subgroup of any group. In particular, if $n\geq3$ and $n\neq6$ then $S_n$ is not the derived subgroup of any group. Clearly $S_1$ and $S_2$ are both the derived subgroup of some group. > Is $S_6$ the derived subgroup of some group? A natural choice would be $\text{Aut}(S_6)$ since $S_6$ is a normal subgroup of index 2. Unfortunately, $A_6$ is a normal subgroup of index 4 so $\text{Aut}(S_6)^\prime\leq A_6$.
Here is a general statement that proves that if $n\geq3$ then $S_n$ is not the derived subgroup of any group. Theorem: Let $H$ be a group such that $\text{Inn}(H)$ is not a subgroup of $\text{Aut}(H)^\prime$. Then $H$ is not the derived subgroup of any group. Proof: Suppose that $G^\prime=H$. Then there is a conjugation homomorphism $\varphi\colon G\to\text{Aut}(H)$. Then we have $\text{Inn}(H)=\varphi(H)=\varphi([G,G])=[\varphi(G),\varphi(G)]\leq\text{Aut}(H)^\prime$. If $n\geq3$ then $\text{Inn}(S_n)=S_n$ and $\text{Aut}(S_n)^\prime\leq A_n$ so the theorem applies.
stackexchange-math
{ "answer_score": 6, "question_score": 9, "tags": "group theory, finite groups, symmetric groups, derived subgroup" }
How to custom the color of IconButton I want to custom the color of IconButton instead of using the default value set on TopAppBar, but in android.compose.material there is no slot api to change it. Scaffold( topBar = { TopAppBar( title = { Text(text = "LayoutsCodelab") }, actions = { IconButton(onClick = { /* doSomething() */ }) { // <- why it has the theme color and how to custom it. Icon(Icons.Filled.Favorite) } } ) } )
You can use the **`tint`** parameter in the `Icon` composable: actions = { IconButton(onClick = { /* doSomething() */ }) { Icon(Icons.Filled.Add, "contentDescription", tint = Color.Red) } } ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 7, "tags": "android, android jetpack compose, android compose button" }
Rails 6 ActionText isn't working on Heroku (undefined method 'rich_text_area_tag') I am using ActionText to edit a paragraph and it works perfectly locally but when I deploy it to Heroku the page which has the form with rich_text_area it throws an error saying undefined method rich_text_area_tag even though I followed the rails guide. I thought I needed to configure Active Storage on production but that's not the case. Here is what I am getting in Heroku's logs: `ActionView::Template::Error (undefined method 'rich_text_area_tag' for #<#<Class> Did you mean? rich_text_area)` <%= f.label :something, class:'label' %> <%= f.rich_text_area :something %>
I found this online, and it was helpful for me: < I am not sure if this is the correct way to do it, but it's a temporary workaround. SOLUTION: In `application_controller.rb` enter the following: require 'action_text' class ApplicationController < ActionController::Base helper ActionText::Engine.helpers ... end Docs for `helper`: <
stackexchange-stackoverflow
{ "answer_score": 16, "question_score": 12, "tags": "ruby on rails, heroku, ruby on rails 6, actiontext" }
Can you call JavaScript function from PHP loop? I am wounding if I can do this, as I am trying this from last 2 days but no success. I want to run JavaScript function from PHP PHP example <div id="meprocess"></div> <?php for($i=1;$i<=10;$i++) { ?> <script> jfun(<?php echo $i;?>); </script> <?php } ?> JavaScript <script type="text/javascript"> function jfun(n) { html="Loop is on" + n; $("<div>"+ html +"</div>").appendTo("div#meprocess"); } </script> I am trying to generate a page which print loop number one by one. But I got error jfun is not defined. What I can understand my JavaScript function is not ready at the time of PHP execution. Is there any way round, like running the PHP loop when DOM/Page is ready so that the JavaScript function will be ready that time, or any other way round.
You have to define that function before calling it < <div id="meprocess"></div> <script type="text/javascript"> function jfun(n) { html="Loop is on" + n; $("<div>"+ html +"</div>").appendTo("div#meprocess"); } <?php for($i=1;$i<=10;$i++) { ?> jfun(<?php echo $i;?>); <?php } ?> </script>
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "php, javascript, jquery, ajax" }
Creating a geoTIFF from PostGIS raster column I am able to retrieve raw raster data from a PostGIS raster in a PostgreSQL database using SQL Alchmey. I can get the raw data directly from the database. Now I would like to create a geoTIFF file from the raw data. Here is the raw raster data from the database. 0100000100000000000000D03F000000000000D0BF0000000000804140000000000000F43F00000000000000000000000000000000E6100000010001004A003C1CC600000000 ![enter image description here]( The above image is a screenshot of the database table that I am accessing through SQL Alchemy. Is there a way that I can create a geotiff from this raw data using gdal in python? I have looked for a similar workflow, but couldn't find any examples on creating a tiff directly from raw raster data.
Thank you Alex for pointing me in the right direction. But I did not have to clip the raster. I am trying to upload the data from postgis database to geotiff using the requests module. For that purpose the following code did the trick. import psycopg2 sql = """SELECT ST_AsGDALRaster(rast, 'GTiff', ARRAY['COMPRESS=LZW']) as tiff FROM {0}.{1} WHERE id = {2}""".format(schema,table,date) cur.execute(sql) data = cur.fetchall() tif_data = data[0][0] #This can passed as the data variable in the requests.put function with open("d:/gis/pg_raster.tif", "wb") as f: f.write(tif_data)
stackexchange-gis
{ "answer_score": 2, "question_score": 2, "tags": "python, postgis, raster, gdal, geoalchemy" }
Proving limit involving random variables Let $X_n$ be a sequence of iid random variables with $X_n\in L^1$. Prove $$\lim_{n\to \infty} \left( \prod^n_{i=1}e^{X_i}\right)^{\frac{1}{n}}=e^{EX_1}\quad \text{almost surely}$$ We have $$ \left( \prod^n_{i=1}e^{X_i}\right)^{\frac{1}{n}}=\left( e^{\sum_{i=1}^nX_i}\right)^{\frac{1}{n}}=\left( e^{\sum_{i=1}^nX_i/n}\right)$$ since $e^x$ is continuous we must have $$\lim_{n\to \infty }\sum_{i=1}^n\frac{X_i}{n}=EX_1$$which looks like the strong law of large numbers, how do I bring the almost surely into this?
If $\lim_{n\to\infty} a_n=a$ then $\lim_{n\to\infty} e^{a_n}=e^a$. So $$\\{\lim_{n\to\infty}\frac1n\sum_{i=1}^nX_i=\mathbb EX_1\\}\subseteq\\{\lim_{n\to\infty}e^{\frac1n\sum_{i=1}^nX_i}=e^{\mathbb EX_1}\\}=\\{\lim_{n\to \infty} \left( \prod^n_{i=1}e^{X_i}\right)^{\frac{1}{n}}=e^{\mathbb EX_1}\\}$$ If the event on LHS has probability $1$ then so has the event on RHS.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "probability, limits, random variables" }
Firebase Custom Domain: What happen to old domain after that? When I just started exploring Firebase, I referenced many of the assets hosted on it, such as JavaScript files, images, and CSS from my **production site**. Now I realized that I should create a **Custom Domain** for my Firebase hosting site if I were to turn it into an official app eventually. But my concern is: Will all the links on my production site become **broken**? For example, images no longer load, JS no longer work etc.? Will Firebase auto-redirect to ` when referencing it with: <img src=" alt="thumbnail" /> Fixing the URLs to these assets will be very tedious because I have too many of it. Any advice? Thanks!
`my-id.firebaseapp.com` will continue to work just as it did before even if you add `new-subdomain.mycompany.com` as a custom domain to the `my-id.firebaseapp.com` Firebase project.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "firebase hosting" }
Implementing java FixedTreadPool status listener It's about an application which is supposed to process (VAD, Loudness, Clipping) a lot of soundfiles (e.g. 100k). At this time, I create as many worker threads (callables) as I can put into memory, and then run all with a threadPool.invokeAll(), write results to file system, unload processed files and continue at step 1. Due to the fact it's an app with a GUI, i don't want to user to feel like the app "is not responding" while processing all soundfiles. (which it does at this time cause invokeAll is blocking). I'm not sure what is a "good" way to fix this. It shall not be possible for the user to do other things while processing, but I'd like to show a progress bar like "10 of 100000 soundfiles are done". So how do I get there? Do I have to create a "watcher thread", so that every worker hold a callback on it? I'm quite new to multi threading, and don't get the idea of such a mechanism. If you need to know: I'm using SWT/JFace.
You could use an `ExecutorCompletionService` for this purpose; if you submit each of the `Callable` tasks in a loop, you can then call the `take` method of the completion service - receiving tasks one at a time as they finish. Every time you take a task, you can update your GUI. As another option, you could implement your own `ExecutorService` that is also an `Observable`, allowing the publication of updates to subscribing `Observer`s whenever a task is completed.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "java, multithreading, progress bar" }
SSH on boot via rc.local I am trying to `ssh` into a server on boot. I have written a simple bash script to perform this action. The script works fine if I run it from the command line, issue is with `rc.local`. The script `/home/RPi_1/autoCon.sh` is below: #!/bin/bash sleep 20 while true; do ssh [email protected] \ -R 22:localhost:22 -N -o ServerAliveInterval=10; \ sleep 5; done `/etc/rc.local`: /home/RPi_1/autoCon.sh > /home/RPi_1/autossh.log 2>&1 & exit 0 The `autossh.log` file is filled with this error: Host key verification failed. I have two users on the my Raspberry Pi, Pi and RPi_1. I think I have identified the issue being that when `rc.local` is being executed it is executed as root or Pi? Thus, when the key is being searched for it is looking in the wrong directory? The key for the server is in /home/RPi_1/.ssh/ Similar issue at: < 3B running Raspbian GNU/Linux 8 (jessie)
To further expand on the question and the replies: If you need to automate a startup script indeed `rc.local` is not the right way to do it. Not even a `cron`. A `systemd` service is preferable and you can set up **dependencies**. In your case the script should not start until networking is ready. Waiting for an arbitrary number of seconds is wasteful and does not guarantee that the network will be ready. Make the service run as your user `RPi_1` (or `pi` ?): example. I would also suggest to use autossh. If the connection is interrupted for some reason, then your script will reconnect automatically. You `while` loop does more or less the same but there is a tool for that.
stackexchange-raspberrypi
{ "answer_score": 1, "question_score": 2, "tags": "boot, ssh, bash" }
How to order SQL query result on condition? i have the this SQL query: SELECT DISTINCT category FROM merchant ORDER BY category ASC that gives this output: accommodation education food general health money shopping sport transport How to put the row that contains "general" at the start (or the end) of the result?
Use `CASE` expression in `ORDER BY` clause: SELECT category FROM ( SELECT DISTINCT category FROM merchant ) t ORDER BY CASE WHEN category = 'General' THEN 0 ELSE 1 END, category ASC `CASE` guarantees that rows with `General` will be sorted first. The second argument orders the rest of the categories in ascending order.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "sql, postgresql, conditional statements" }
add --> as delimiter to the URL pattern For extracting URL I use this regex: '/https?\:\/\/[^\",\s\]\|]+/i' (finishes with space, ", comma or |). **The problem is I also need to add "`-->`"** (3 symbols `-->`) as a break of the URL. However no luck. P.S. I know this is not a perfect URL validation however URLs are stored within the string in the db and space, comma, ", | and --> are definitely the delimiters of the URL (if met at the end).
The following _regex_ should do it : https?:\/\/.*?(?=\s|,|"|\||-->|$) see demo
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, regex, string, url" }
How do I completely remove phpmyadmin? I messed up my `phpmyadmin`, I haven't logged in `phpmyadmin` for a while and as a result I forgot my password. I decided to purge PHPMyAdmin: sudo apt-get purge phpmyadmin I did get some error messages asking for my password, but I forgot that, so I just pressed ignore, after that, I installed `phpmyadmin` again: sudo apt-get install phpmyadmin But now, when I logging to my `phpmyadmin`, I get a `404 not found` error page!? > How do i completely remove phpmyadmin?
You might want to try `sudo dpkg-reconfigure phpmyadmin`
stackexchange-askubuntu
{ "answer_score": 37, "question_score": 24, "tags": "php, phpmyadmin" }
Show that cardinality of intersection is infinite For each positive real number $x$ let $S(x)=\\{\lfloor kx\rfloor \,:\, k \in\mathbb{N}\\}$. Let $x_{1},x_{2},x_{3}$ be positive real numbers each greater than $1$ such that $\sum_{i=1}^{3}\frac{1}{x_i} >1$. Prove that there exists $i$ and $j$ (where $1\leq i<j\leq 3$) such that $|S(x_i)\cap S(x_j)| =\infty$. This problem looks hard and i have no idea how to start.
Write $[N] = \\{1, \ldots, N\\}$. Then note that $$\\#(S(x) \cap [N]) \geq N/x + \mathcal O(1)$$ for fixed $x > 1$. Write $\alpha = 1/x_1 + 1/x_2 + 1/x_3 > 1$. It follows that $$ \\#(S(x_1) \cap [N]) + \\#(S(x_2) \cap [N]) + \\#(S(x_3) \cap [N]) \geq \alpha N + \mathcal O(1). $$ As $N$ tends to infinity the gap between the sum on the left-hand side and $N$ grows without bound. Thus at least one pair-wise intersection between the $S(x_i)$ has to be infinite.
stackexchange-math
{ "answer_score": 3, "question_score": 0, "tags": "combinatorics" }
Which binary clang version I should use for CentOS Based on < * Clang Binaries for FreeBSD9/x86_64 (69M)(.sig) * Clang Binaries for Ubuntu-12.04/x86 (67M)(.sig) * Clang Binaries for Ubuntu-12.04/x86_64 (71M)(.sig) My OS is CentOS 6.3 Gnome Desktop x86 from < Item 13. Which version I should use for it?
The binaries for Ubuntu 12.04 x86 **may work** ( _may_ , not _will_ ); but if they don't, it's due to linkage to libraries which have changed incompatibly between 2010 and 2012. The userspace of CentOS / Red Hat Enterprise Linux of the 6.x series is based on Fedora 12, from late 2009 / early 2010. Ubuntu 12.04 was released in April 2012, with most of its libraries using versions that were released in late 2011. So there's roughly 24 to 30 months of development work between CentOS 6.x and Ubuntu 12.x. If anything in `glibc` (or `libstdc++` especially) has changed notably since then, Clang or anything based on LLVM won't work if it was compiled for Ubuntu 12.04 and run on CentOS 6.x. I can't say for sure because I haven't tested it. What you should do instead is either compile LLVM and Clang yourself on CentOS 6.3, _or_ look for a repository that ships Clang binaries for CentOS, like ELRepo.
stackexchange-superuser
{ "answer_score": 4, "question_score": 9, "tags": "centos, compatibility, clang" }
WinJS AutoSuggestBox get text I use AutoSuggestBox in my app. I do not how to get text from the input. I want to do search on button click, and I need input text ? <div id="accountsSearchBox" class="searchBox" data-win-control="WinJS.UI.AutoSuggestBox" data-win-options="{placeholderText: 'Search'}"> </div> I also tried with: data-win-options="{ queryText : value}" and still could not get text with: var queryText = accountsSearchBox.queryText; Do I need this option at all, because I just need get text not set ?
I just have solved this. This is correct form: var queryText = accountsSearchBox.winControl.queryText; I forget that "queryText" property is under "winControl". data-win-options="{ queryText : value}" It is redundant in this case.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, winjs" }
How to access webcam with Javascript I google'd quite a while about this topic, without any satisfying result. Actually my basic question is: Is there any possible way to access a webcam with Javascript ? Maybe with HTML5 ? `<video>` element ? What are options as developer to access the computers webcam anyway?
Please see this answer: Access webcam without Flash It is possible with beta browsers but if you want to developer something for IE users you need to stick with Flash.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 9, "tags": "javascript, html, webcam" }
Replace method names in String with outcome of method In a properties file I'm loading a String containing (with delimiters and a Regular expression) method names I want to dynamically invoke from Java. For example : `"%getProductName%-%GetProductCode%[-]*[0-9]*\.(.+)"` When the String get's read from the properties file, I want to replace the method names (between %%) with their return value when the method is called. But I'm not quite sure how to accomplish following in Java (best practice): \- Parse string & retrieve all the `%methodNames%` variables. After retrieving the different methods defined in the String, I will retrieve the result using Reflection and replacing this value in the original String. I'm just looking for a quick approach regarding parsing the String and retrieving the different `%methodNames%`. Thanks for any advice!
You could try regex like this : public static void main(String[] args) { String s = "%getProductName%-%GetProductCode%[-]*[0-9]*\\.(.+)"; Pattern p = Pattern.compile("%(.*?)%"); // capturing group to extract data between ()s Matcher m = p.matcher(s); while (m.find()) { System.out.println(m.group(1)); } } O/P : getProductName GetProductCode
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, replace" }
OAuth, Twitter and Indentity - who am I? Once authenticated to Twitter via OAuth I did not see a good call to get your username. How is this supposed to work? I'd like to pull back things like Twitter username, firstname, lastname, etc... basic profile stuff. Should the OAuth handshake give me my username?
Try this: It'll show you all information (you'ld normally get of any other user) of the OAuth-authenticated-account =)!
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 3, "tags": "oauth, twitter, identity, twitter oauth" }
What do the individual parts of the full name mean when something like ResNet-FasterRCNN is mentioned? What i mean by the title is as follows: Say I went into Tensorflows Object Detection Model zoo and picked some model like, Faster R-CNN ResNet101 V1 1024x1024. My question is, what is the architecture and what is the technique? Does Faster-RCNN point to the **technique** the architecture ( **i.e. ResNet 101** ) uses or is FasterRCNN also a standalone architecture? If what i'm saying above doesn't make much sense then what do both "Faster RCNN" & "ResNet 101" refer to within the context of the whole name of the model "Faster R-CNN ResNet101 V1 1024x1024"? Any help would be appreciated.
Typically, object detection networks can be broken down into two parts: a backbone network which takes an input image and outputs a feature map, and the "head(s)", which produces the final detections from the feature map. Backbones can often be swapped out for one another, and they're not usually the focus of research -- there's just much more interesting things to be explored in the heads. So in this context, "Faster R-CNN" refers to the design of the heads, and "ResNet 101" is the name of the backbone network.
stackexchange-stats
{ "answer_score": 2, "question_score": 1, "tags": "neural networks, tensorflow" }
How to focus and walk through menu bar on OS X using keyboard I'm using OS X 10.11, How can I navigate through items on menu bar using keyboard, like press Alt + letter with underscored in Windows?
The Alt + Letter is a Windows things doesn't appear in OS X. There are two native options to navigate the menu bar. First, very quick, and intuitive, is a Mac universal shortcut Command(`⌘`)+`?` (which is: `⌘`+`Shift`+`/`) which will take you to the Help menu. From there you can search whatever menu bar item you wish, and get the shortcut if one exists; just start typing. ![Help Menu]( Second if you manually want to navigate the menu bar then, open **System Preferences > Keyboard > Shortcuts > Keyboard > Check and Set shortcut for** _Move focus to the menu bar_. This way you can move focus and navigate using arrow keys. ![Move Focus]( If you go to the _App Shortcuts_ category in the same pane, you can also change the _Help Menu_ shortcut to your liking. Tertiary option would be, investing in a third party application to help you find/remember shortcuts faster. Personally, would recommend KeyCue. There are several others, just search on Google or App Store.
stackexchange-apple
{ "answer_score": 18, "question_score": 15, "tags": "macos, menu bar" }
Primefaces autoComplete change separator I am using primefaces autoComplete in my JSF page. The separator which it uses is comma. I am splitting the data to convert data of autoComplete to Array. Now issue is that my dataitems in autoComplete contains ", ". When I use Split in my data item, then it splits my data to. For example: [mydataitem1, mydataitem 2, mydataitem, 3 ,.....] Now Array becomes mydataitem1 mydataitem 2 mydataitem 3 ... <p:autoComplete id="someId" multiple="true" value="${someBean.SomeValue}" completeMethod="${someBean.completeMethod}" var="value" itemLabel="value" itemValue="#{title}" forceSelection="true"> <p:column> <h:outputText value="#{title}" /> </p:column> <p:ajax event="itemSelect" listener="#{someBean.action}" process="@form" /> </p:autoComplete> Is there any attribute of autoComplete where I can change the comma to some other character? Thanks in advance
As I understand it, you'll have to bind into a List when using `multiple="true"`. If you just use Strings you can just bind to a `List<String>`, if you use a complex object you'll have to use `List<MyObject>` and add a converter. Note: if you print out the list in the log, it will still write [mydataitem1, mydataitem 2, mydataitem 3,.....] but that's just the toString()-method that delimits with comma. Also, you have errors in `itemLabel` and `itemValue`, and should just always use `#{}` instead of `${}`. And I think `process="@form"` can be a bit dangerous, as if you have other input components in the form that fails validation/conversion the listener will not be called. I'd just remove it (default is process="@this").
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "primefaces, autocomplete" }
MySQL subquery error: Subquery returns more than 1 row im trying to select all data from my "events" table whenever the "event id" matches with the "user id". However i get an error 1242 Subquery returns more than 1 row. $query = "SELECT * FROM events WHERE id = (SELECT event_id FROM booking_dates WHERE user_id = '{$user_id}')"; $event_set = mysqli_query($connection, $query); I understand that my subquery will return multiple rows because a user can attend multiple events. So how can I make my query accept multiple rows?
You could use `in`: SELECT * FROM events WHERE id IN (SELECT event_id FROM booking_dates WHERE user_id = '{$user_id}') Warning: injecting strings like that in your SQL makes them vulnerable to SQL injection. Please look into prepared statements to which you can bind arguments without this vulnerability.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "mysql" }
uiview rotation keeping 1 coordinate constant Good Day! i want to ask that if i want to bring a uiview in front on another view, but i want to bring it by keeping its 1 points constant so that it looks like that only 1 (top) portion moved down. i put my uiview on 90 degrees but i could not figure out the way to bring it horizontal. here is code for uiview clView.frame = CGRectMake(0,100,258,171); clView.transform = CGAffineTransformIdentity; clView.transform = CGAffineTransformMakeRotation(degreesToRadians(90)); [self.view addSubview:clView]; Now it puts my view to 90 degrees but i could not bring it down with animation keeping one point constant. like projectile motion. Can somebody help me out ? Yellow circle part i want to be still and other moving, 90 degress and back to normal !Yellow circle part i want to be still and other moving, 90 degress and back to normal
You probably want to set the anchorPoint of the underlying CALayer, to whatever coordinates represent the middle of the yellow circle. So something like: myView.layer.anchorPoint = CGPointMake(x,y); // where x and y is the middle of the yellow circle. Once you've set the anchorPoint, transforms will be done about that point. This page has more detail on this.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "objective c, core animation, uiviewanimation, image rotation" }
Have a webservice and website in the same web root? I have an asp.net mvc site and a asp.net web service. I am wondering if it is possible to have them in the same root(wwwroot) folder? Like could I have wwwroot -> all mvc files wwwroot -> webservice folder -> webservice files Would this work? I don't want them all mixed together and I am sure having 2 web configs in the same root probably would cause some problems.
You can definitely host web service endpoints (like ASMX?) in the same folder as an MVC application. You're right to suspect multiple web.config files won't work, but that shouldn't be necessary - you can combine unique entries from the two, and simply tell MVC to disregard requests to the specific ASMX files. However, I'd suggest going one step further - combine the two if possible by bringing the logic of your web services into your MVC application, and have the MVC engine serve a SOAP response based on the type of request. This way you can dual-purpose your logic and give you a lot more flexibility down the road.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": ".net, asp.net mvc, web services, hosting" }
AttributeError: builtin_function_or_method' object has no attribute 'top' Here is the code: class Enemies(): def __init__(self): self.list = [] self.number= random.randrange(8) self.image= pygame.image.load("C:/Users/Aitor/Desktop/Odin.png") self.rect= self.image.get_rect self.run_across= 0 #El numero que recorrera la lista for x in range(self.number): self.list.append(self.rect) self.list[self.run_across].top= random.randrange(20,50) self.list[self.run_across].left= random.randrange(20,50) self.run_across += 1 self.run_across= 0 The error is in: `self.list[self.run_across].top= random.randrange(20,50)` The code is supposed to save in a list some rects with random dimensions but with the same image. I don't know why it get that error.
`self.rect` is set to a function object: self.rect= self.image.get_rect You subsequently add that to your `list` attribute: for x in range(self.number): self.list.append(self.rect) This is the `builtin_function_or_method` type the exception refers to; the method is implemented in C. Perhaps you meant to call it instead? self.rect = self.image.get_rect()
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, pygame" }
Static implicit operator I recently found this code: public static implicit operator XElement(XmlBase xmlBase) { return xmlBase.Xml; } What does `static implicit operator` mean?
This is a **conversion operator**. It means that you can write this code: XmlBase myBase = new XmlBase(); XElement myElement = myBase; And the compiler won't complain! At runtime, the conversion operator will be executed - passing `myBase` in as the argument, and returning a valid `XElement` as the result. It's a way for you as a developer to tell the compiler: > "even though these look like two totally unrelated types, there is actually a way to convert from one to the other; just let me handle the logic for how to do it."
stackexchange-stackoverflow
{ "answer_score": 337, "question_score": 206, "tags": "c#, operators, implicit conversion" }
Android: OutOfMemoryError to load a imageResource I've caught a code example to pinch and zoom an image. The works ok. The problem is when I implement this code in my app. I have an OutOfMemoryError here: **view.setImageResource (R.drawable.planometro);** To solve this problem I found this code: public Drawable getAssetImage (String filename) throws IOException { AssetManager assets = getResources () getAssets ().; InputStream buffer = new BufferedInputStream ((assets.open ("drawable /" + filename +)) "png."); Bitmap bitmap = BitmapFactory.decodeStream (buffer); return new BitmapDrawable (getResources (), bitmap); } The problem is that this code is to return an int, not a drawable. How I can fix my error? Thanks
try this try { Bitmap bitmap=((BitmapDrawable)activity.getResources().getDrawable(R.drawable.matches_placeholder_upcoming2x)).getBitmap(); Drawable drawable = new BitmapDrawable(activity.getResources(),bitmap); liveMatchHeaderContainer.setBackgroundDrawable(drawable); } catch (OutOfMemoryError E) { E.printStackTrace(); }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, image, bitmap, out of memory, drawable" }
Mysql returning clause equivalent I am a complete newbie to MySql so please be gentle. Is there an equivalent of the `RETURNING` clause in Oracle or the `Inserted'/'Deleted` tables in SQL Server in MySQL? What I want to do is the following: * Delete a set of rows from table A * Insert the deleted set of rows into table B. Please help! Thanks
Unfortunately, you can't do both insertion and deletion in **one query** , but you can do it all in one **transaction** if you are using a transactional store engine (like InnoDB). Moreover, `RETURNING` is supported by Oracle and PostgreSQL but not by MySQL and therefore you need to write separate `delete` and `insert` statements. Using a transaction however, will guarantee that only the successfully copied data will be deleted from tableA. Consider the following: begin transaction; insert into tableB select * from tableA where 'your_condition_here'; delete from tableA where 'your_condition_here'; commit;
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 19, "tags": "mysql" }
Get the file size from a WebP file header < I’ve got a WebP file (about 22 kilobytes), and the hexadecimal of the first 12 bytes is `524946461c57000057454250`. The first and last 4 bytes make sense (ASCII "RIFF" and "WEBP"), but I don’t know what `1c570000` signifies. The doc says it is the file size, but that would be a huge file if it were hexadecimal 1c570000 bytes. How do I calculate the file size (22 kilobytes) from the file header (reporting `1c570000`)?
As specified in the document (< the file size bytes are stored in Little Endian. That is, the bytes are stored in the order of least significance to most significance (the least significant byte is at the first location, and the most significant byte is stored at the last location). 00 00 57 1c is 22,300, so "about 22 kilobytes" is correct.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "file, webp, magic numbers" }
Arrangement of word MISSISSIPPI in which no three S occur together how many different word can be formed by jumbling the letter of the word MISSISSIPPI in which no three $"S"$ occur together No. of arrangement of the words MISSISSIPPI is $ = \frac{11!}{4!\cdot 4!\cdot 2!}$ now arrangement of the words in which all $ "S"$ are together is $ = \frac{8!}{4!\cdot 2!}$ total no. of arrangements of the words in which all four $"S"$ are occur together is $ = \frac{11!}{4!\cdot 4!\cdot 2!}-\frac{8!}{4!\cdot 2!}$ i want be able to go further , could some help me with this, Thanks
Here is a way using stars and bars) Consider the $4$ identical $S's$ ("stars") to be placed in $8$ boxes with a maximum of $3$ in any box, $\boxed.M\boxed.P\boxed.P\boxed.I\boxed.I\boxed.I\boxed.I\boxed. $ We must exclude any arrangement that has $3$ or more in any of the $8$ boxes, so applying stars and bars, there are $\binom{11}7- \binom81\binom87 = 266$ ways. The other letters, which were acting as "bars", can be permuted in $\frac{7!}{2!4!} = 105$ ways, thus answer $= 266\cdot105 = 27,930$
stackexchange-math
{ "answer_score": 4, "question_score": 3, "tags": "combinatorics" }
C# inserting <input> in htmldocument How do I insert a `<input type="text" ...>` in a `Systems.Windows.Forms.HtmlDocument`?
You can use htmlelement to create a input type tag HtmlElement input = doc.CreateElement("input"); Refer this <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, input, insert, dom" }
Incremental history searching I found this very useful tip in UsingTheTerminal to use the arrow keys to search through the command history: "\e[A": history-search-backward "\e[B": history-search-forward "\e[C": forward-char "\e[D": backward-char How can I change it in order to use `Ctrl+P` and `Ctrl+N` instead of the arrow keys?
Repeating what I said in comment section to not leave question hanging without answer, in order to bind one of Bash readline commands you can use `bind` command. For example, `Crtl+N` shortcut can be used with: $ bind '"\C-n": history-search-backward' This will be limited to current session and needs to be placed inside `.bashrc` to have it established in every one. Expanding my answer, you can also modify `~/.inputrc` file, as mentioned in link provided in question. There are two ways to do this. First syntax for same shortcut as above is: "\C-n": history-search-backward And the second one is: Control-n: history-search-backward This second type of syntax can be used with `bind` as well: $ bind 'Control-n: history-search-backward'
stackexchange-askubuntu
{ "answer_score": 2, "question_score": 2, "tags": "command line, search, history" }
Chewing Over the Counter Pain Medication? I am completely unable to swallow whole pills. Never been able to overcome the gag reflex. But I am in a lot of pain and the doctor prescribed over the counter pain medication such as Advil. I have ibuprofen and Advil pills. I know I remember a nurse at emerge telling me I could chew "Advil" or some other big name over the counter pain medication that she brought me (it was not a chewable pill, and it's name started with "A"). So my question is. Is there any adult over the counter medication that you can confirm is safe to chew? I would highly prefer the answer to include normal medical and not some super expensive chewable drug meant for my sort of case.
You can try soluble aspirin, or Diclofenac suppositories per rectum. Cancer patients have other modalities of pain relief available to them, many of which are open to abuse and addiction. But the best thing is for you to overcome your gag reflex which in most cases is learned and can be unlearned (otherwise you wouldn't be able to eat food). This method involves using a toothbrush to progressively desensitize yourself by touching more and more of the region that provokes your gag reflex. It takes a month to abolish.
stackexchange-health
{ "answer_score": 2, "question_score": 1, "tags": "medications" }
Is it legal or child-labor for a private pre-school to ask preschoolers to wash dishes without compensation? Is it legal for a private pre-school to ask preschoolers to take-turns to wash everyone's lunch dishes in the kitchen on behalf of all other students? It was a rotational. It was not singling out a specific person. I think two people worked on it cooperatively. I know a friend in the United States whose pre-school asked them to wash dishes one-day when they were four-years-old. Then the pre-school shutdown some subsequent days later because the nuns ran out of funding. Is this child-labor/abuse?
This is probably permitted on the theory that socializing children to do household type chores serves a reasonable educational purpose. If the dishes being washed were from a restaurant unrelated to the pre-school, on the other hand, this would probably be prohibited child labor.
stackexchange-law
{ "answer_score": 6, "question_score": -2, "tags": "united states, labor law, children, child abuse" }
Is there a shortcut to expand all folders in Finder's list view? I have my Finder window set up to display in "list" view so that it shows all folders with triangles on the left to click to expand. I have a number of levels of nested folders. Is there any way (keyboard shortcut, menu item, etc.) to expand all, so I don't have to click through each level to see the files contained?
Select the folder you want (or `command` \+ `A` to select all) and then press: * `Command` \+ `right arrow` And the left arrow undoes what the right arrow did, should you want to close things back up again. Using option instead of command works on all folders enclosed in the selected folder. Both option and command modify a mouse selection on the folder toggle icon “triangle” or “arrow” to execute these shortcuts using the GUI.
stackexchange-apple
{ "answer_score": 70, "question_score": 56, "tags": "macos, keyboard, finder, folders" }
power series help for real this time I'm given $$f(x)= \frac{1}{x+2} $$ I know i have to make it look like: $$f(x) = \frac{1}{1-x} $$ but I have no clue how to go about that. Any suggestions? or maybe I could divide by 2 throughout?
Hints: $$\frac1{2+x}=\frac12\frac1{1+\frac x2}\;,\;\;\left|\frac x2\right|<1\iff\ldots$$
stackexchange-math
{ "answer_score": 3, "question_score": 1, "tags": "sequences and series" }
How can I make a tiny line graph in .net How can I make a little line graph with .net like shown in the sites below? < or < ( < ) Thanks for your input.
These little line graphs are called sparklines - this is the keyword you need. There are plenty of ways, doing it on a client with jQuery or hacking ASP.NET Charting or even DYI with System.Drawing.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": ".net, graph, charts" }
Equation with several exponents Is there a way to get the result for this value of x? x^x^(x^(1/6)/6)==Sqrt[2^9]^(2*Sqrt[2])^(2/3+2*Sqrt[2]) I've tried `Solve`, `FindInstance` and I did not get a solution I tried this: Solve[x^x^(x^(1/6)/6)==Sqrt[2^9]^(2*Sqrt[2])^(2/3+2*Sqrt[2]),{x}]
Try NSolve[x^x^(x^(1/6)/6) == Sqrt[2^9]^(2*Sqrt[2])^(2/3 + 2*Sqrt[2]), x, Reals] (*{x->512}*)
stackexchange-mathematica
{ "answer_score": 7, "question_score": 6, "tags": "equation solving" }
XCode 4.2 Rename Target I am trying to create a LITE version of my iPhone app by using different targets. So I have duplicated the release target 'Checklists' and it will name it 'Checklists copy'. I have managed to change the name of the actual .app that is created but not the target name. Any ideas?
So the .app is named via the product name. The target name is an identifier for the build settings, which are actually built using a scheme. The name you see when selecting what to build is a scheme, and you can rename those by clicking on the bar and going to "manage schemes". To rename the target you just click on the name and it will turn into an edit box. !Targets
stackexchange-stackoverflow
{ "answer_score": 18, "question_score": 8, "tags": "iphone, ios, xcode" }
fa-user-circle-o not working I want to show user circle icon, I have download a font-awesome css file with version 4.7.0. But this is not working for me. If I use cdn then its working. I am not getting what is the issue in downloaded file. Here my code: <html> <head> <link href="font-awesome.min.css" rel="stylesheet" type="text/css"> </head> <body> <i class="fa fa-user-circle-o"></i> </body> </html> Does anyone know what is the issue?
As you can understand from it's name, Font-Awesome has cool font-based approach to use icons. So, including CSS file is not enough. If you want to store your CSS file locally, you should store font files too. As documented, you should have entire folder (including fonts folder which includes woff, tff etc) on your server. > 1. **Copy the entire font-awesome directory into your project.** > 2. In the of your html, reference the location to your font-awesome.min.css. >
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 6, "tags": "html, font awesome" }
Error when restoring database to a new server I receive the following error when I try to restore a database to SQL Server 2008 from SQL Server 2008 Express R2: > _The database was backed up on a server running version 10.50.2500. That version is incompatible with this server, which is running 10.00.4064. Either restore the database on a server that supports the backup, or use a backup that is compatible with this server._ Is there anything that I can do to fix this or am I stuck using SQL Server Express?
You cannot go "back" in SQL Server versions - if your database is on **2008 R2** (v10.50) - you cannot back it up and restore it onto a **2008** (v10.00) version. There's no trick, no workaround, no hack - it just **cannot be done** \- period. So you either need to upgrade your target system to **2008 R2** as well (Express will do, as long as the size is below 10 GB), or you need to script out structure and data to `.sql` files to run those on your "old" 2008 system (possibly using third-party tools like Red-Gate SQL Compare / SQL Data Compare to create those scripts and possibly run them against the target server directly).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "sql server 2008, sql server 2008 r2" }
Linking sidebarPanels in shiny for SelectizeInput function Assume I have a drop down in `sidebarPanel - location` from which I can select a maximum of 2 options. I want to create an if loop where in - chosing 'Saddle Joint' and 'Gliding Joint' from the drop down leads to selection of objects 'x' and 'y' in another `sidebarPanel - datasets` \- basically creating a linkage. I tried this piece of code, but it doesn't work: if (input$location== "Saddle Joint" & input$location== "Gliding Joint") { updateCheckboxGroupInput(session, "datasets", "Datasets:", choices = c("x","y"), selected= c("x","y")) } Do take a look at the screenshot for better picture! Thanks! Screenshot
Issue was with the boolean in your `if` statement. Use this: "Saddle Joint" %in% input$location & "Gliding Joint" %in% input$location Also could use: all(c("Saddle Joint","Gliding Joint") %in% input$location)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "shiny, shiny server, shinydashboard, shinyjs" }
Not satisfied with "trick" in zeta function regularization I am not satisfied with the explanations of $$\sum_n \log \lambda_n = - \frac{d}{ds} \sum_n \lambda_n^{-s}\bigg|_{s=0}$$ "trick" used in zeta function regularization, discussed here and here, or the references therein. If someone could give a step-by-step explanation or a reference if the explananation is more complicated than I'm guessing, that would be greatly appreciated.
Consider a function of $s$ as $$ f(s) = \frac{1}{a^s} $$ Now take the derivative with respect to $s$: $$ f'(s)=\frac{d}{ds}a^{-s}=-\frac{\log(a)}{a^s} $$ What happens at $s=0$? $$ f'(s=0)=-\frac{\log(a)}{a^0}=-\log(a) $$ What happens if $a=a_0+a_1+a_2+\cdots$ (i.e., $s$-independent constants)? We simply stick in a sum: $$ f(s) =\sum_n \frac{1}{a_n^s} $$ What does this do to the final answer? Nothing, we still can stick in the sum: $$ f'(s=0)=-\sum_n\frac{\log(a_n)}{a_n^0}=-\sum_n\log(a_n) $$ Thus, we get our relation, $$ \left.\frac{d}{ds}\sum_n\lambda_n^{-s}\right|_{s=0}=-\sum_n\log\left(\lambda_n\right) $$
stackexchange-physics
{ "answer_score": 3, "question_score": 4, "tags": "quantum mechanics, quantum field theory, mathematical physics, regularization" }
use authentication in a AppServiceProvider in laravel I am using Laravel so every logged in user can has a cart so I want to access their cart in my master blade because it's on the header and show all cart products in every pages so I use this in AppServiceProvider but I need to check if the user logged in it will show cart public function boot() { view()->composer('app.shop.2.layouts.master', function($view) { $data = \Auth::user()->cart()->get()->first()->products(); $view->with('data', $data); }); } so everything is ok until the user is logged in but when the user is not logged in it gives me this error : > Call to a member function cart() on null (View: F:\larav-pay\payment\resources\views\app\shop\2\index.blade.php)
You can use `Auth::check()` to check whether the user is authenticated or not like this: public function boot() { view()->composer('app.shop.2.layouts.master', function($view) { if (Auth::check()){ $data = \Auth::user()->cart()->get()->first()->products(); $view->with('data', $data); } }); }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, laravel" }
Selecting joining records where all rows have a field equalling false I have two tables: Customers and Addresses. There can only be 1 customer record, but a customer may have multiple addresses. Each address has true/false field called "active". I'm trying to design a query that selects any customers that don't have an active address. So customers with address records that are all marked "active = false", or have no address records at all. I'm working in Access for this, so the SQL needs to be MS friendly. However I am interested to know the general SQL technique to do this kind of selection. Edit: Table Structure ## Customers CustomerID, CustomerName, CustomerDoB ## Addresses AddressID, AddressName, AddressPostcode, CustomerID, Active
This should point you in the right direction, without the table schema I've made some assumptions: SELECT * FROM Customers WHERE ID Not In (SELECT CustomerID FROM Addresses WHERE Active = -1) This assumes an ID in the customer table and a CustomerID in the addresses table
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "sql, ms access" }
Is it possible to use parametrized GWT Messages in UIBinder XML layout? I have some Messages, described in com.google.gwt.i18n.client.Messages interface implementation and binded with some resource files. I use Messages and not Constants because I want to be able to specify some dynamical parameters while getting the messages. I.e. my messages are defined as "some text {0} - is value of my param" and I use corresponding method call with one (int this case) parameter. A question is: how can I use my parametrized messages in UIBinder XML layout? Imagine I have a button and I want to set its label. The label depends on some parameter, for example button number. So I need a message which looks somehow like this: "my button No {0}". How can I specify this parameter in XML layout?
You can't; you'll have to set the label from your Java code.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "gwt, internationalization, message" }
Identify which project is in runtime (Delphi Seattle) I hope someone help me with this little issue... I have two applications. Both of them use the same form shared added on DPR. I want to identify on a button click what project I am in runtime in this form. Each one has a name, "projectA.exe" and "projectB.exe". But I can't get the exe name using "ExtractFileName(Application.ExeName)" for example cause the user can change it and the verification it will not work. I could get version of application but in some moment they can be the same too so this is not confiable either... So, what is the best way to identify which project the button has been clicked independent of application name? Can I get the "project name" instead of application name in runtime, for example? Is there a way to do it? Thanks for the help!
In the version resource for your project you should define the program name. Presumably each of your programs have different names, and so this can be used to identify them.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": -1, "tags": "delphi" }
tsql script to find tables not being used by stored procedures, views, functions, etc? Is there a t-sql script to find out tables that aren't being used in sql server by stored procudures, views, functions, etc. I have a database that has 100s of tables, if not more and before I go dropping tables, I wanted to know if there was a script that could go through each object in the database and tell me if any tables are in use.
If you want using a script, here (Listing SQL Server Object Dependencies) is a very good article how to script dependencies. Using that, you can make a list of tables being referenced. You have the list of tables that are in your database, so you know which of them are not being used. In the article they use sp_depends stored procedure. However it has one failure. For example, if you have a stored procedure that used table "MyTable" and you create the procedure before you create the table "MyTable" you won't see this on the list of dependencies. That's why you should search the table syscomments to find dependencies. But this is also not accurate, because if you have the name of the table in the comment, you will treat it as a dependency.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 6, "tags": "sql, sql server, sql server 2005, tsql" }
how to use Jquery functions on Dynaically created elements having IDs I have created some elements dynamically and now i have to add datepicker and use jquery function on them so how can i do that.
Make use of jquery live() function $('.clickme').bind('click', function() { // Bound handler called. }); example $('a').live({ click: function() { // do something on click }, mouseover: function() { // do something on mouseover } });
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "jquery" }
Reordering Excel Table Without Interop Objects I am writing a program in C# that is required to reorder a sheet by one of the columns. At the moment I am unable to use Office Interop objects to control the file, so I have been reading it in using Excel Data Reader ( in order to read in the files, as my output is always in csv, tsv, or a SQL table. Any ideas as to how I would be able to save the DataTable as excel or if a command exists to reorder it without Interop?
There is a way to save a datatable to Excel, without using Interop, by means of a web-grid. I suppose you're talking about an application, so you have to make a reference to the `System.Web` library. The code: // Create the DataGrid and perform the databinding var myDataGrid = new System.Web.UI.WebControls.DataGrid(); myDataGrid.HeaderStyle.Font.Bold = true; myDataGrid.DataSource = myDataTable; myDataGrid.DataBind(); string myFile = "put the name here with full path.xls" var myFileStream = new FileStream( myFile, FileMode.Create, FileAccess.ReadWrite ); // Render the DataGrid control to a file using ( var myStreamWriter = new StreamWriter( myFileStream ) ) { using (var myHtmlTextWriter = new System.Web.UI.HtmlTextWriter(myStreamWriter )) { myDataGrid .RenderControl( myHtmlTextWriter ); } }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, excel, export, export to excel" }
SKip the variable that start with a word and ends BY number [0-9] I have this array `arr("PAPER","SHEET","SHEET1","SHEET2", "SHEET3")` with a loop `foreach(key,value)`. I will skip the variable that start with "SHEET" and ends with a number `[0-9]` How to do this with `preg_math` or other REGEX? if(Condition){ Code... }
Something like: if (preg_match('/^SHEET\d+$/i', $value)) { continue; }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -3, "tags": "php, expression, match" }
Google Translate in Chrome How do I enable google translation without prompting? I read a lot of texts in foreign language and clicking each time is driving me crazy. Thanks
I realized this is only due to running in incongnito mode. Normal Running Keeps everything normal and above options are shown.
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "google chrome, google translate" }
Can I determine the post that caused a user to earn a badge? Some badges, like 'Yearling' are associated with a user. Other badges, like 'Great Question' and 'Great Answer' are associated with a post as well. When I fetch the recipients of the badges, I get a link to the badge and a link to the user, but I can't see any way of extracting a link to the associated post which earned the badge. Short of walking through every question and answer posted by the user, and filtering them by the rules associated with the badge, is there any way of extracting this information?
No, this information is not currently available in the current versions of the API. It may be added in a subsequent release, it's a little finicky as many badges have no associated posts (or aren't linked to a single post).
stackexchange-stackapps
{ "answer_score": 3, "question_score": 9, "tags": "support, badges" }
Spring Tools Suite 4 for aarch64 macOS 11 M1, where? According the blog post "Spring Tools 4.11.0 released" by @Martin Lippert on June 21st there are > "early-access builds for Apple Silicon platform (ARM M1) available" for this 4.11 version. However, there seem to be no findable places to download those. I've seen there are Eclipse downloads native for Mac ARM (aarch64), but no STS as far as I can see. Anyone know where these early-access builds for Apple Silicon are available?
You can get the early-access version of Spring Tools 4 for Apple Silicon from here: < Due to a bug in the build scripts, the 4.11.0.RELEASE build for Apple Silicon ended up containing the wrong bits, so you should go with the nightly build for Apple Silicon for now.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "macos, apple m1, spring tools 4" }
Setting FPGA pins as virtual I have a Verilog module for which I want to check its timing in isolation to the rest of the system. The problem is that the FPGA has a limited number of physical pins, and my module has more inputs bits than there are physical pins, so Quartus II cannot compile (the fitter complains the FPGA does not have enough pins). As I understand, in order to make Quartus II happy, I need to some input pins of my module as virtual. These are the constraints in my `.sdc` that I have tried: set_input_delay -clock clk_i 0 [large_bus] set_instance_assignment -name VIRTUAL_PIN ON -to large_bus Even with those constraints, Quartus II is still complaining. How can I make a "dummy synthesis" of my Verilog module to check for timing?
Altera supports virtual IO and in order to get it to work, you must assigned them the property VIRTUAL_IO on (as you have done), but if these pins are connected to any signals in your design, it will no longer work. Check out this web site that describes the steps needed to get this to work: Declaring Virtual Pins in Quartus
stackexchange-electronics
{ "answer_score": 3, "question_score": 6, "tags": "fpga, verilog, quartus ii, timing analysis" }
Mechanics: example of less mass/volume gives more strength Lets assume we have a mechanical element from uniform material that is supposed to work in a static load conditions. Moreover lets assume there is no gravity or gravity is negligible. Are there any examples when reducing the element mass/volume actually gives an element more strength? I mean pure strength, no strength to weight ratio, the element cost is also irrelevant in this case. I have mechanics lectures some time ago and if I remember correctly, the lecturer have provided an example of that. Unfortunately I cannot remind myself any details about that. Maybe the "trick" was that he reduced the mass simultaneously changing the shape a little bit in a way that some pressure concentration was dispersed? Unfortunately I cannot produce or find any example of that now and I am not even sure if I remember this all correctly. I will appreciate any help.
I just found an answear, the keyword is "stress concentration". Sometimes, the material is removed to make a stress relief in an element. Some examples: ![Stress relief examples]( The origin source I found it: <
stackexchange-engineering
{ "answer_score": 5, "question_score": 1, "tags": "structural analysis, stresses, structures, strength" }
Is a negative logarithm meaningless? Is $log(-x)$, where $x \in (0, \infty)$ undefined? From solving quadratics I was first told that the discriminant has to be non-negative, since $\sqrt{-a}$, where $a \in (0, \infty)$ is undefined. But this was before learning about Imaginary numbers and the complex plane. For example, what would $log_3(-9)$ be? Is there a number $a$ such that $3^a=-9$? So can you evaluate negative logarithms?
Yes, it is possible to evaluate logarithm of a negative number in the complex plane. Moreover it is possible evaluate logarithm of any non-zero complex number $z=x+iy\ne0$: $$ \log z=\ln|z|+i\arg(z). $$ where the real numbers $|z|=\sqrt{x^2+y^2}$ and $\arg z$ are, respectively, the absolute value and argument of $z$. The argument is essentially the angle in the complex plane between $z$ and positive direction of the real axis. There is however a complication. Different from the real logarithm the complex one is multivalued function, so that any multiple of $2\pi i$ can be added to its value. One of possible solution of the problem is to bound the imaginary part (for example from $-\pi$ to $\pi$). Equipped with this knowledge and the fact that $\log_a z=\frac{\ln z}{\ln a}$: $$ \log_3(-9)=\frac{\ln9+i\pi}{\ln3}=2+\frac{\pi i}{\ln3}. $$
stackexchange-math
{ "answer_score": 3, "question_score": 2, "tags": "real analysis, complex analysis, logarithms" }
How to call a function of the 1st Page from the 3rd Page in Flutter? I basically need to call a function from another page. This is my navigation structure: 1st Screen > 2nd Screen > 3rd Screen. I have read many topics about my problem already but I can't get the perfect answer yet. I have tried using `ScopedModel` and `InheritedWidgets` but it requires a Widget on the tree just to pass data. I am using the Navigator's named routes with `pushNamed()` function to push these pages. Let's say my 1st screen has a listview and a function to refresh it: `void refresh()`. How can I call the `refresh()` function directly from the 3rd Screen?
**You can do this multiple ways** Some of the common ways are 1. Pass the function down through constructors and call it 2. Use rxDart 3. Use scoped_model or any state management library
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "dart, flutter" }
Python - The request headers for mechanize I am looking for a way to view the request (not response) headers, specifically what browser mechanize claims to be. Also how would I go about manipulating them, eg setting another browser? Example: import mechanize browser = mechanize.Browser() # Now I want to make a request to eg example.com with custom headers using browser The purpose is of course to test a website and see whether or not it shows different pages depending on the reported browser. It has to be the mechanize browser as the rest of the code depends on it (but is left out as it's irrelevant.)
browser.addheaders = [('User-Agent', 'Mozilla/5.0 blahblah')]
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 4, "tags": "python, mechanize" }
following-sibling for any descendant confusion For a html text <html> <body> <div id="1">1</div> <div id="2">1</div> <div id="3">1</div> </body> </html> I query //following-sibling::div[3] And the result is there <div id="3">1</div> But according to XPath specs > The following-sibling axis contains the context node's following siblings, those children of the context node's parent that occur after the context node in document order; So what is the context node after that 3rd div is successfully found? It seems that when // founds first div, there's no 3rd div after it, the last accessible should be [2]. If the context node is not div but body or html then divs are not siblings for them.
The context node is the first _text_ node (containing only whitespace) in the `body` element.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "xpath" }